-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
131 lines (125 loc) · 5.41 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
var TargetView = require('./src/targets/view/api'),
TargetRemove = require('./src/targets/remove'),
TargetReplace = require('./src/targets/replace'),
TargetPublish = require('./src/targets/publish'),
TargetPrepare = require('./src/targets/prepare'),
TargetSend = require('./src/targets/send');
/**
* Publish library data to storage
* @param {String} version - name of version (branch|tag|pr)
* @param {Object} options - options object with fields:
* - {Object} storage configuration:
* - {String} namespace - storage key namespace
* - {Object} get - object with host and port fields that describes
* host and port configuration for read requests
* - {Object} post - object with host and port fields that describes
* host and port configuration for write|modify requests
* - {String} auth header
* - {Object} logger - logger settings
* - {Boolean} isDocsOnly - if this flag is set to true then sending examples to storage will be skipped
* - {Number} maxOpenFiles - number of open files which can be opened at the same time
* @param {Boolean} isDryRun - dry run flag
* @returns {*}
*/
exports.publish = function (version, options, isDryRun) {
options.isDryRun = isDryRun;
var target = new TargetPublish(version, options);
return target.execute();
};
/**
* Prepare library data for sending storage
* @param {String} version - name of version (branch|tag|pr)
* @param {Object} options - options object with fields:
* - {Object} logger - logger settings
* - {Boolean} sourceUrl - url to original sources on gh
* @returns {*}
*/
exports.prepare = function (version, options) {
var target = new TargetPrepare(version, options);
return target.execute();
};
/**
* Sends library data to storage
* @param {String} version - name of version (branch|tag|pr)
* @param {Object} options - options object with fields:
* - {Object} storage configuration:
* - {String} namespace - storage key namespace
* - {Object} get - object with host and port fields that describes
* host and port configuration for read requests
* - {Object} post - object with host and port fields that describes
* host and port configuration for write|modify requests
* - {String} auth header
* - {Object} logger - logger settings
* - {Boolean} isDocsOnly - if this flag is set to true then sending examples to storage will be skipped
* - {Number} maxOpenFiles - number of open files which can be opened at the same time
* @param {Boolean} isDryRun - dry run flag
* @returns {*}
*/
exports.send = function (version, options, isDryRun) {
options.isDryRun = isDryRun;
var target = new TargetSend(version, options);
return target.execute();
};
/**
* View registry data
* @param {String} repo - name of repository (library)
* @param {String} version - name of version (branch|tag|pr)
* @param {Object} options - options object with fields:
* - {Object} storage configuration:
* - {String} namespace - storage key namespace
* - {Object} get - object with host and port fields that describes
* host and port configuration for read requests
* - {Object} post - object with host and port fields that describes
* host and port configuration for write|modify requests
* - {Object} logger - logger settings
* @returns {Promise}
*/
exports.view = function (repo, version, options) {
var target = new TargetView(repo, version, options);
return target.execute();
};
/**
* Replace documentation data in documentation object
* @param {String} repo - name of repository (library) required
* @param {String} version - name of version (branch|tag|pr) required
* @param {Object} options - options object with fields:
* - {Object} storage configuration:
* - {String} namespace - storage key namespace
* - {Object} get - object with host and port fields that describes
* host and port configuration for read requests
* - {Object} post - object with host and port fields that describes
* host and port configuration for write|modify requests
* - {String} auth header
* - {Object} logger - logger settings
* - {String} doc - doc key (readme|changelog|migration|notes) required
* - {String} lang - language param (en|ru) required
* - {String} url - url for new document on github (like in browser view) required
* @returns {Promise}
*/
exports.replace = function (repo, version, options) {
var target = new TargetReplace(repo, version, options);
return target.execute();
};
/**
* Removes version from registry
* Also removes all example files from storage
* @param {String} repo - name of repository (library)
* @param {String} version - name of version (branch|tag|pr)
* @param {Object} options - options object with fields:
* - {Object} storage configuration:
* - {String} namespace - storage key namespace
* - {Object} get - object with host and port fields that describes
* host and port configuration for read requests
* - {Object} post - object with host and port fields that describes
* host and port configuration for write|modify requests
* - {String} auth header
* - {Object} logger - logger settings
* - {Number} maxOpenFiles - number of open files which can be opened at the same time
* @param {Boolean} isDryRun - dry run flag
* @returns {*}
*/
exports.remove = function (repo, version, options, isDryRun) {
options.isDryRun = isDryRun;
var target = new TargetRemove(repo, version, options);
return target.execute();
};