@or-sdk/deployer 0.24.4 → 0.24.5-410.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Deployer.js +127 -1
- package/dist/cjs/Deployer.js.map +1 -1
- package/dist/esm/Deployer.js +98 -1
- package/dist/esm/Deployer.js.map +1 -1
- package/dist/types/Deployer.d.ts +16 -1
- package/dist/types/types.d.ts +14 -0
- package/package.json +4 -5
- package/src/Deployer.ts +178 -5
- package/src/types.ts +8 -0
package/dist/cjs/Deployer.js
CHANGED
|
@@ -14,6 +14,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
17
28
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
29
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
30
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -58,7 +69,7 @@ var Deployer = (function (_super) {
|
|
|
58
69
|
__extends(Deployer, _super);
|
|
59
70
|
function Deployer(params) {
|
|
60
71
|
var _this = this;
|
|
61
|
-
var token = params.token, discoveryUrl = params.discoveryUrl, accountId = params.accountId, deployerUrl = params.deployerUrl;
|
|
72
|
+
var token = params.token, discoveryUrl = params.discoveryUrl, accountId = params.accountId, deployerUrl = params.deployerUrl, dataHub2Url = params.dataHub2Url;
|
|
62
73
|
_this = _super.call(this, {
|
|
63
74
|
token: token,
|
|
64
75
|
discoveryUrl: discoveryUrl,
|
|
@@ -66,6 +77,7 @@ var Deployer = (function (_super) {
|
|
|
66
77
|
accountId: accountId,
|
|
67
78
|
serviceUrl: deployerUrl,
|
|
68
79
|
}) || this;
|
|
80
|
+
_this.dataHub2Url = dataHub2Url;
|
|
69
81
|
return _this;
|
|
70
82
|
}
|
|
71
83
|
Deployer.prototype.removeRole = function () {
|
|
@@ -181,6 +193,120 @@ var Deployer = (function (_super) {
|
|
|
181
193
|
});
|
|
182
194
|
});
|
|
183
195
|
};
|
|
196
|
+
Deployer.prototype.deleteDeployment = function (deployment) {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
198
|
+
return __generator(this, function (_a) {
|
|
199
|
+
return [2, this.callApiV2({
|
|
200
|
+
url: this.dataHub2Url,
|
|
201
|
+
route: "/deployments/" + deployment.id,
|
|
202
|
+
method: 'delete',
|
|
203
|
+
})];
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
Deployer.prototype.getDeploymentById = function (id, projection) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
209
|
+
return __generator(this, function (_a) {
|
|
210
|
+
return [2, this.callApiV2({
|
|
211
|
+
url: this.dataHub2Url,
|
|
212
|
+
route: "/deployments/" + id,
|
|
213
|
+
params: {
|
|
214
|
+
projection: projection,
|
|
215
|
+
},
|
|
216
|
+
method: 'get',
|
|
217
|
+
})];
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
Deployer.prototype.getDeployments = function (_a) {
|
|
222
|
+
var _b = _a.query, query = _b === void 0 ? {} : _b, projection = _a.projection;
|
|
223
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
224
|
+
return __generator(this, function (_c) {
|
|
225
|
+
query.dateDeactivated = 0;
|
|
226
|
+
return [2, this.getAllDeployments({
|
|
227
|
+
query: query,
|
|
228
|
+
projection: projection,
|
|
229
|
+
})];
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
Deployer.prototype.getAllDeployments = function (_a) {
|
|
234
|
+
var _b = _a.query, query = _b === void 0 ? {} : _b, projection = _a.projection;
|
|
235
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
236
|
+
return __generator(this, function (_c) {
|
|
237
|
+
return [2, this.callApiV2({
|
|
238
|
+
url: this.dataHub2Url,
|
|
239
|
+
route: '/deployments',
|
|
240
|
+
params: {
|
|
241
|
+
projection: projection,
|
|
242
|
+
query: query,
|
|
243
|
+
},
|
|
244
|
+
method: 'get',
|
|
245
|
+
})];
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
Deployer.prototype.getActiveDeployments = function (projection) {
|
|
250
|
+
return this.getDeployments({ projection: projection });
|
|
251
|
+
};
|
|
252
|
+
Deployer.prototype.getDeploymentsByBotId = function (botId, projection) {
|
|
253
|
+
return this.getDeployments({
|
|
254
|
+
query: { botId: botId },
|
|
255
|
+
projection: projection,
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
Deployer.prototype.getAllDeploymentsByBotId = function (botId, projection) {
|
|
259
|
+
return this.getAllDeployments({
|
|
260
|
+
query: { botId: botId },
|
|
261
|
+
projection: projection,
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
Deployer.prototype.getActiveDeploymentsByBotId = function (botId, projection) {
|
|
265
|
+
return this.getDeployments({
|
|
266
|
+
query: { botId: botId },
|
|
267
|
+
projection: projection,
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
Deployer.prototype.getDeploymentsByFlowId = function (flowId, projection) {
|
|
271
|
+
return this.getDeployments({
|
|
272
|
+
query: { flowId: flowId },
|
|
273
|
+
projection: projection,
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
Deployer.prototype.getAllDeploymentsByFlowId = function (flowId, projection) {
|
|
277
|
+
return this.getAllDeployments({
|
|
278
|
+
query: { flowId: flowId },
|
|
279
|
+
projection: projection,
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
Deployer.prototype.getActiveDeploymentsByFlowId = function (flowId, projection) {
|
|
283
|
+
return this.getDeployments({
|
|
284
|
+
query: { flowId: flowId },
|
|
285
|
+
projection: projection,
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
Deployer.prototype.saveDeployment = function (deployment) {
|
|
289
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
290
|
+
var id;
|
|
291
|
+
return __generator(this, function (_a) {
|
|
292
|
+
switch (_a.label) {
|
|
293
|
+
case 0:
|
|
294
|
+
deployment.id = deployment.id || 'new';
|
|
295
|
+
return [4, this.callApiV2({
|
|
296
|
+
url: this.dataHub2Url,
|
|
297
|
+
route: "/deployments/" + deployment.id,
|
|
298
|
+
data: {
|
|
299
|
+
deployment: deployment,
|
|
300
|
+
},
|
|
301
|
+
method: 'post',
|
|
302
|
+
})];
|
|
303
|
+
case 1:
|
|
304
|
+
id = (_a.sent()).id;
|
|
305
|
+
return [2, __assign(__assign({}, deployment), { id: id })];
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
};
|
|
184
310
|
return Deployer;
|
|
185
311
|
}(base_1.Base));
|
|
186
312
|
exports.Deployer = Deployer;
|
package/dist/cjs/Deployer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deployer.js","sourceRoot":"","sources":["../../src/Deployer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Deployer.js","sourceRoot":"","sources":["../../src/Deployer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA6C;AAC7C,yCAA0C;AAa1C;IAA8B,4BAAI;IAQhC,kBAAY,MAAsB;QAAlC,iBAWC;QAVS,IAAA,KAAK,GAAwD,MAAM,MAA9D,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ACL,CAAC;IAQK,iCAAc,GAApB,UAAqB,UAAsB;;;;;;wBACzC,UAAU,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,IAAI,KAAK,CAAC;wBACxB,WAAM,IAAI,CAAC,SAAS,CAAC;gCAClC,GAAG,EAAE,IAAI,CAAC,WAAW;gCACrB,KAAK,EAAE,kBAAgB,UAAU,CAAC,EAAI;gCACtC,IAAI,EAAE;oCACJ,UAAU,YAAA;iCACX;gCACD,MAAM,EAAE,MAAM;6BACf,CAAC,EAAA;;wBAPM,EAAE,GAAK,CAAA,SAOb,CAAA,GAPQ;wBAQV,iCACK,UAAU,KACb,EAAE,IAAA,KACF;;;;KACH;IAEH,eAAC;AAAD,CAAC,AA9SD,CAA8B,WAAI,GA8SjC;AA9SY,4BAAQ"}
|
package/dist/esm/Deployer.js
CHANGED
|
@@ -11,7 +11,7 @@ import { Base, timeout } from '@or-sdk/base';
|
|
|
11
11
|
import { SERVICE_KEY } from './constants';
|
|
12
12
|
export class Deployer extends Base {
|
|
13
13
|
constructor(params) {
|
|
14
|
-
const { token, discoveryUrl, accountId, deployerUrl } = params;
|
|
14
|
+
const { token, discoveryUrl, accountId, deployerUrl, dataHub2Url } = params;
|
|
15
15
|
super({
|
|
16
16
|
token,
|
|
17
17
|
discoveryUrl,
|
|
@@ -19,6 +19,7 @@ export class Deployer extends Base {
|
|
|
19
19
|
accountId,
|
|
20
20
|
serviceUrl: deployerUrl,
|
|
21
21
|
});
|
|
22
|
+
this.dataHub2Url = dataHub2Url;
|
|
22
23
|
}
|
|
23
24
|
removeRole() {
|
|
24
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -96,5 +97,101 @@ export class Deployer extends Base {
|
|
|
96
97
|
throw new Error('Polling is too long');
|
|
97
98
|
});
|
|
98
99
|
}
|
|
100
|
+
deleteDeployment(deployment) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
return this.callApiV2({
|
|
103
|
+
url: this.dataHub2Url,
|
|
104
|
+
route: `/deployments/${deployment.id}`,
|
|
105
|
+
method: 'delete',
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
getDeploymentById(id, projection) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
return this.callApiV2({
|
|
112
|
+
url: this.dataHub2Url,
|
|
113
|
+
route: `/deployments/${id}`,
|
|
114
|
+
params: {
|
|
115
|
+
projection,
|
|
116
|
+
},
|
|
117
|
+
method: 'get',
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
getDeployments({ query = {}, projection }) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
query.dateDeactivated = 0;
|
|
124
|
+
return this.getAllDeployments({
|
|
125
|
+
query,
|
|
126
|
+
projection,
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
getAllDeployments({ query = {}, projection }) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
return this.callApiV2({
|
|
133
|
+
url: this.dataHub2Url,
|
|
134
|
+
route: '/deployments',
|
|
135
|
+
params: {
|
|
136
|
+
projection,
|
|
137
|
+
query,
|
|
138
|
+
},
|
|
139
|
+
method: 'get',
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
getActiveDeployments(projection) {
|
|
144
|
+
return this.getDeployments({ projection });
|
|
145
|
+
}
|
|
146
|
+
getDeploymentsByBotId(botId, projection) {
|
|
147
|
+
return this.getDeployments({
|
|
148
|
+
query: { botId },
|
|
149
|
+
projection,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
getAllDeploymentsByBotId(botId, projection) {
|
|
153
|
+
return this.getAllDeployments({
|
|
154
|
+
query: { botId },
|
|
155
|
+
projection,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
getActiveDeploymentsByBotId(botId, projection) {
|
|
159
|
+
return this.getDeployments({
|
|
160
|
+
query: { botId },
|
|
161
|
+
projection,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
getDeploymentsByFlowId(flowId, projection) {
|
|
165
|
+
return this.getDeployments({
|
|
166
|
+
query: { flowId },
|
|
167
|
+
projection,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
getAllDeploymentsByFlowId(flowId, projection) {
|
|
171
|
+
return this.getAllDeployments({
|
|
172
|
+
query: { flowId },
|
|
173
|
+
projection,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
getActiveDeploymentsByFlowId(flowId, projection) {
|
|
177
|
+
return this.getDeployments({
|
|
178
|
+
query: { flowId },
|
|
179
|
+
projection,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
saveDeployment(deployment) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
deployment.id = deployment.id || 'new';
|
|
185
|
+
const { id } = yield this.callApiV2({
|
|
186
|
+
url: this.dataHub2Url,
|
|
187
|
+
route: `/deployments/${deployment.id}`,
|
|
188
|
+
data: {
|
|
189
|
+
deployment,
|
|
190
|
+
},
|
|
191
|
+
method: 'post',
|
|
192
|
+
});
|
|
193
|
+
return Object.assign(Object.assign({}, deployment), { id });
|
|
194
|
+
});
|
|
195
|
+
}
|
|
99
196
|
}
|
|
100
197
|
//# sourceMappingURL=Deployer.js.map
|
package/dist/esm/Deployer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deployer.js","sourceRoot":"","sources":["../../src/Deployer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Deployer.js","sourceRoot":"","sources":["../../src/Deployer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAA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BACJ,UAAU;iBACX;gBACD,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;YACH,uCACK,UAAU,KACb,EAAE,IACF;QACJ,CAAC;KAAA;CAEF"}
|
package/dist/types/Deployer.d.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { Base } from '@or-sdk/base';
|
|
2
|
-
import { DeployerConfig, Flow, PollingResultActivateSuccess, PollingResultDeactivateSuccess } from './types';
|
|
2
|
+
import { DeployerConfig, Deployment, Flow, GetDeploymentsParams, PollingResultActivateSuccess, PollingResultDeactivateSuccess } from './types';
|
|
3
3
|
export declare class Deployer extends Base {
|
|
4
|
+
dataHub2Url?: string;
|
|
4
5
|
constructor(params: DeployerConfig);
|
|
5
6
|
removeRole(): Promise<void>;
|
|
6
7
|
activateFlow({ id, data: { deploy: { role } } }: Flow, interactiveDebug?: boolean): Promise<PollingResultActivateSuccess>;
|
|
7
8
|
deactivateFlow({ id, data: { deploy: { role } } }: Flow, flowAlias: string, deleteLambda?: boolean): Promise<PollingResultDeactivateSuccess>;
|
|
8
9
|
private pollResult;
|
|
10
|
+
deleteDeployment(deployment: {
|
|
11
|
+
id: string;
|
|
12
|
+
}): Promise<any>;
|
|
13
|
+
getDeploymentById(id: string, projection: string[]): Promise<Deployment[]>;
|
|
14
|
+
getDeployments({ query, projection }: GetDeploymentsParams): Promise<Deployment[]>;
|
|
15
|
+
getAllDeployments({ query, projection }: GetDeploymentsParams): Promise<Deployment[]>;
|
|
16
|
+
getActiveDeployments(projection: string[]): Promise<Deployment[]>;
|
|
17
|
+
getDeploymentsByBotId(botId: string, projection: string[]): Promise<Deployment[]>;
|
|
18
|
+
getAllDeploymentsByBotId(botId: string, projection: string[]): Promise<Deployment[]>;
|
|
19
|
+
getActiveDeploymentsByBotId(botId: string, projection: string[]): Promise<Deployment[]>;
|
|
20
|
+
getDeploymentsByFlowId(flowId: string, projection: string[]): Promise<Deployment[]>;
|
|
21
|
+
getAllDeploymentsByFlowId(flowId: string, projection: string[]): Promise<Deployment[]>;
|
|
22
|
+
getActiveDeploymentsByFlowId(flowId: string, projection: string[]): Promise<Deployment[]>;
|
|
23
|
+
saveDeployment(deployment: Deployment): Promise<Deployment>;
|
|
9
24
|
}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare type DeployerConfig = {
|
|
|
6
6
|
discoveryUrl?: string;
|
|
7
7
|
accountId?: string;
|
|
8
8
|
deployerUrl?: string;
|
|
9
|
+
dataHub2Url?: string;
|
|
9
10
|
};
|
|
10
11
|
export declare type Step = {
|
|
11
12
|
id: string;
|
|
@@ -124,3 +125,16 @@ export declare type PollingResultError = {
|
|
|
124
125
|
name?: string;
|
|
125
126
|
};
|
|
126
127
|
export declare type PollingResult = PollingResultPending | PollingResultActivateSuccess | PollingResultDeactivateSuccess | PollingResultError;
|
|
128
|
+
export declare type GetDeploymentsParams = {
|
|
129
|
+
query?: {
|
|
130
|
+
[key: string]: any;
|
|
131
|
+
};
|
|
132
|
+
projection: string[];
|
|
133
|
+
};
|
|
134
|
+
export declare type Deployment = {
|
|
135
|
+
id: string;
|
|
136
|
+
data: {
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
};
|
|
139
|
+
flowId: string;
|
|
140
|
+
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.24.
|
|
2
|
+
"version": "0.24.5-410.0",
|
|
3
3
|
"name": "@or-sdk/deployer",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
@@ -24,9 +24,8 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@or-sdk/base": "^0.24.
|
|
28
|
-
"@or-sdk/step-templates": "^1.1.
|
|
27
|
+
"@or-sdk/base": "^0.24.2-410.0",
|
|
28
|
+
"@or-sdk/step-templates": "^1.1.3-410.0",
|
|
29
29
|
"lodash": "^4.17.21"
|
|
30
|
-
}
|
|
31
|
-
"gitHead": "70275da9788930b6234570b7a9806738d66104ed"
|
|
30
|
+
}
|
|
32
31
|
}
|
package/src/Deployer.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Base, timeout } from '@or-sdk/base';
|
|
2
|
+
import { SERVICE_KEY } from './constants';
|
|
2
3
|
import {
|
|
3
|
-
DeployerConfig,
|
|
4
|
-
Flow,
|
|
5
|
-
PollingResult,
|
|
4
|
+
DeployerConfig, Deployment, Flow, GetDeploymentsParams, PollingResult,
|
|
6
5
|
PollingResultActivateSuccess, PollingResultDeactivateSuccess, PollingResultError, PollingResultPending,
|
|
7
6
|
} from './types';
|
|
8
|
-
import { SERVICE_KEY } from './constants';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* OneReach Deployer service client
|
|
@@ -21,8 +19,9 @@ export class Deployer extends Base {
|
|
|
21
19
|
* const deployer = new Deployer({token: 'my-account-token-string', discoveryUrl: 'http://example.tables/endpoint'});
|
|
22
20
|
* ```
|
|
23
21
|
*/
|
|
22
|
+
dataHub2Url?: string;
|
|
24
23
|
constructor(params: DeployerConfig) {
|
|
25
|
-
const { token, discoveryUrl, accountId, deployerUrl } = params;
|
|
24
|
+
const { token, discoveryUrl, accountId, deployerUrl, dataHub2Url } = params;
|
|
26
25
|
|
|
27
26
|
super({
|
|
28
27
|
token,
|
|
@@ -31,6 +30,7 @@ export class Deployer extends Base {
|
|
|
31
30
|
accountId,
|
|
32
31
|
serviceUrl: deployerUrl,
|
|
33
32
|
});
|
|
33
|
+
this.dataHub2Url = dataHub2Url;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -141,4 +141,177 @@ export class Deployer extends Base {
|
|
|
141
141
|
throw new Error('Polling is too long');
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Delete deployment
|
|
146
|
+
* ```typescript
|
|
147
|
+
* const data = await deployer.deleteDeployment({id});
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
async deleteDeployment(deployment: {id: string;}): Promise<any> {
|
|
151
|
+
return this.callApiV2({
|
|
152
|
+
url: this.dataHub2Url,
|
|
153
|
+
route: `/deployments/${deployment.id}`,
|
|
154
|
+
method: 'delete',
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Get deployments by bot id
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const data = await deployer.getDeploymentById({id, projection});
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
async getDeploymentById(id: string, projection: string[]): Promise<Deployment[]> {
|
|
165
|
+
return this.callApiV2({
|
|
166
|
+
url: this.dataHub2Url,
|
|
167
|
+
route: `/deployments/${id}`,
|
|
168
|
+
params: {
|
|
169
|
+
projection,
|
|
170
|
+
},
|
|
171
|
+
method: 'get',
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Get deployments
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const data = await deployer.getDeployments({query, projection});
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
async getDeployments({ query = {}, projection }: GetDeploymentsParams): Promise<Deployment[]> {
|
|
182
|
+
query.dateDeactivated = 0;
|
|
183
|
+
return this.getAllDeployments ({
|
|
184
|
+
query,
|
|
185
|
+
projection,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Get all deployments
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const data = await deployer.getAllDeployments({query, projection});
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
async getAllDeployments({ query = {}, projection }: GetDeploymentsParams): Promise<Deployment[]> {
|
|
196
|
+
return this.callApiV2({
|
|
197
|
+
url: this.dataHub2Url,
|
|
198
|
+
route: '/deployments',
|
|
199
|
+
params: {
|
|
200
|
+
projection,
|
|
201
|
+
query,
|
|
202
|
+
},
|
|
203
|
+
method: 'get',
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Get active deployments
|
|
209
|
+
* ```typescript
|
|
210
|
+
* const data = await deployer.getActiveDeployments({query, projection});
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
getActiveDeployments(projection: string[]): Promise<Deployment[]> {
|
|
214
|
+
return this.getDeployments({ projection });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get deployments by bot id
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const data = await deployer.getDeploymentsByBotId(botId, projection);
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
getDeploymentsByBotId(botId: string, projection: string[]): Promise<Deployment[]> {
|
|
224
|
+
return this.getDeployments({
|
|
225
|
+
query: { botId },
|
|
226
|
+
projection,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Get all deployments by bot id
|
|
232
|
+
* ```typescript
|
|
233
|
+
* const data = await deployer.getAllDeploymentsByBotId(botId, projection);
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
getAllDeploymentsByBotId(botId: string, projection: string[]): Promise<Deployment[]> {
|
|
237
|
+
return this.getAllDeployments({
|
|
238
|
+
query: { botId },
|
|
239
|
+
projection,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get active deployments by bot id
|
|
245
|
+
* ```typescript
|
|
246
|
+
* const data = await deployer.getActiveDeploymentsByBotId(botId, projection);
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
getActiveDeploymentsByBotId(botId: string, projection: string[]): Promise<Deployment[]> {
|
|
250
|
+
return this.getDeployments({
|
|
251
|
+
query: { botId },
|
|
252
|
+
projection,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Get deployments by flow id
|
|
258
|
+
* ```typescript
|
|
259
|
+
* const data = await deployer.getDeploymentsByFlowId(flowId, projection);
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
getDeploymentsByFlowId(flowId: string, projection: string[]): Promise<Deployment[]> {
|
|
263
|
+
return this.getDeployments({
|
|
264
|
+
query: { flowId },
|
|
265
|
+
projection,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Get all deployments by flow id
|
|
271
|
+
* ```typescript
|
|
272
|
+
* const data = await deployer.getAllDeploymentsByFlowId(flowId, projection);
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
getAllDeploymentsByFlowId(flowId: string, projection: string[]): Promise<Deployment[]> {
|
|
276
|
+
return this.getAllDeployments({
|
|
277
|
+
query: { flowId },
|
|
278
|
+
projection,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Get active deployments by flow id
|
|
284
|
+
* ```typescript
|
|
285
|
+
* const data = await deployer.getActiveDeploymentsByFlowId(flowId, projection);
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
getActiveDeploymentsByFlowId(flowId: string, projection: string[]): Promise<Deployment[]> {
|
|
289
|
+
return this.getDeployments({
|
|
290
|
+
query: { flowId },
|
|
291
|
+
projection,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Save deployment
|
|
297
|
+
* ```typescript
|
|
298
|
+
* const data = await deployer.saveDeployment(deployment);
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
async saveDeployment(deployment: Deployment): Promise<Deployment> {
|
|
302
|
+
deployment.id = deployment.id || 'new';
|
|
303
|
+
const { id } = await this.callApiV2({
|
|
304
|
+
url: this.dataHub2Url,
|
|
305
|
+
route: `/deployments/${deployment.id}`,
|
|
306
|
+
data: {
|
|
307
|
+
deployment,
|
|
308
|
+
},
|
|
309
|
+
method: 'post',
|
|
310
|
+
});
|
|
311
|
+
return {
|
|
312
|
+
...deployment,
|
|
313
|
+
id,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
144
317
|
}
|
package/src/types.ts
CHANGED
|
@@ -22,6 +22,10 @@ export type DeployerConfig = {
|
|
|
22
22
|
* Url of OneReach Deployer api
|
|
23
23
|
*/
|
|
24
24
|
deployerUrl?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Url of OneReach DataHub2 api
|
|
27
|
+
*/
|
|
28
|
+
dataHub2Url?: string;
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
export type Step = {
|
|
@@ -152,3 +156,7 @@ export type PollingResultError = {
|
|
|
152
156
|
};
|
|
153
157
|
|
|
154
158
|
export type PollingResult = PollingResultPending | PollingResultActivateSuccess | PollingResultDeactivateSuccess | PollingResultError;
|
|
159
|
+
|
|
160
|
+
export type GetDeploymentsParams = {query?: {[key: string]: any;}; projection: string[];};
|
|
161
|
+
|
|
162
|
+
export type Deployment = {id: string; data: {[key: string]: any;}; flowId: string;};
|