@or-sdk/idw 4.1.0-beta.1726.0 → 4.1.0-beta.1727.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/CHANGELOG.md +9 -0
- package/dist/cjs/api/flowApi.js +11 -4
- package/dist/cjs/api/flowApi.js.map +1 -1
- package/dist/cjs/dto/flowUpsert.dto.js +36 -0
- package/dist/cjs/dto/flowUpsert.dto.js.map +1 -0
- package/dist/cjs/dto/index.js +18 -0
- package/dist/cjs/dto/index.js.map +1 -0
- package/dist/esm/api/flowApi.js +11 -4
- package/dist/esm/api/flowApi.js.map +1 -1
- package/dist/esm/dto/flowUpsert.dto.js +20 -0
- package/dist/esm/dto/flowUpsert.dto.js.map +1 -0
- package/dist/esm/dto/index.js +2 -0
- package/dist/esm/dto/index.js.map +1 -0
- package/dist/types/api/flowApi.d.ts +4 -3
- package/dist/types/api/flowApi.d.ts.map +1 -1
- package/dist/types/dto/flowUpsert.dto.d.ts +22 -0
- package/dist/types/dto/flowUpsert.dto.d.ts.map +1 -0
- package/dist/types/dto/index.d.ts +2 -0
- package/dist/types/dto/index.d.ts.map +1 -0
- package/dist/types/types/flow.d.ts +5 -2
- package/dist/types/types/flow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/flowApi.ts +23 -7
- package/src/dto/flowUpsert.dto.ts +24 -0
- package/src/dto/index.ts +1 -0
- package/src/types/flow.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.1](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@4.0.0...@or-sdk/idw@4.0.1) (2023-08-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **@or-sdk/idw:** fix flow api ([74ee414](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/74ee414bcf1a9581b5805fa18364590429dbb1ab))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [4.0.0](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@3.1.1...@or-sdk/idw@4.0.0) (2023-08-03)
|
|
7
16
|
|
|
8
17
|
|
package/dist/cjs/api/flowApi.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowApi = void 0;
|
|
4
4
|
var helpers_1 = require("../helpers");
|
|
5
|
+
var dto_1 = require("../dto");
|
|
5
6
|
var FlowApi = (function () {
|
|
6
7
|
function FlowApi(providers) {
|
|
7
8
|
this.providers = providers;
|
|
@@ -32,24 +33,30 @@ var FlowApi = (function () {
|
|
|
32
33
|
},
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
|
-
FlowApi.prototype.upsert = function (
|
|
36
|
+
FlowApi.prototype.upsert = function (flow) {
|
|
37
|
+
var data = (0, dto_1.flowUpsertDataDto)(flow);
|
|
36
38
|
return this.providers.makeRequest({
|
|
37
39
|
route: (0, helpers_1.buildRoute)('flow'),
|
|
38
40
|
method: 'POST',
|
|
39
41
|
data: data,
|
|
40
42
|
});
|
|
41
43
|
};
|
|
42
|
-
FlowApi.prototype.activateFlow = function (
|
|
44
|
+
FlowApi.prototype.activateFlow = function (flow) {
|
|
45
|
+
var id = flow.id;
|
|
46
|
+
var data = (0, dto_1.flowActivateDataDto)(flow);
|
|
43
47
|
return this.providers.makeRequest({
|
|
44
48
|
route: (0, helpers_1.buildRoute)('flow/activate'),
|
|
45
|
-
method: '
|
|
49
|
+
method: 'PATCH',
|
|
46
50
|
data: data,
|
|
51
|
+
params: {
|
|
52
|
+
id: id,
|
|
53
|
+
},
|
|
47
54
|
});
|
|
48
55
|
};
|
|
49
56
|
FlowApi.prototype.deactivateFlow = function (id) {
|
|
50
57
|
return this.providers.makeRequest({
|
|
51
58
|
route: (0, helpers_1.buildRoute)('flow/deactivate'),
|
|
52
|
-
method: '
|
|
59
|
+
method: 'PATCH',
|
|
53
60
|
params: {
|
|
54
61
|
id: id,
|
|
55
62
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowApi.js","sourceRoot":"","sources":["../../../src/api/flowApi.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"flowApi.js","sourceRoot":"","sources":["../../../src/api/flowApi.ts"],"names":[],"mappings":";;;AAGA,sCAAwC;AACxC,8BAAgE;AAEhE;IACE,iBACmB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IACpC,CAAC;IAMJ,yBAAO,GAAP,UAAQ,EAAU;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAA,oBAAU,EAAC,MAAM,CAAC;YACzB,MAAM,EAAE;gBACN,EAAE,IAAA;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAMD,4BAAU,GAAV,UAAW,EAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAA,oBAAU,EAAC,MAAM,CAAC;YACzB,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,EAAE,IAAA;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAMD,6BAAW,GAAX,UAAY,GAAa;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAA,oBAAU,EAAC,OAAO,CAAC;YAC1B,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;aAChB;SACF,CAAC,CAAC;IACL,CAAC;IAMD,wBAAM,GAAN,UAAO,IAAc;QACnB,IAAM,IAAI,GAAG,IAAA,uBAAiB,EAAC,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAA,oBAAU,EAAC,MAAM,CAAC;YACzB,MAAM,EAAE,MAAM;YACd,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAMD,8BAAY,GAAZ,UAAa,IAAc;QACzB,IAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,IAAM,IAAI,GAAG,IAAA,yBAAmB,EAAC,IAAI,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAA,oBAAU,EAAC,eAAe,CAAC;YAClC,MAAM,EAAE,OAAO;YACf,IAAI,MAAA;YACJ,MAAM,EAAE;gBACN,EAAE,IAAA;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAMD,gCAAc,GAAd,UAAe,EAAU;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAA,oBAAU,EAAC,iBAAiB,CAAC;YACpC,MAAM,EAAE,OAAO;YACf,MAAM,EAAE;gBACN,EAAE,IAAA;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAEH,cAAC;AAAD,CAAC,AA1FD,IA0FC;AA1FY,0BAAO"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.flowActivateDataDto = exports.flowUpsertDataDto = void 0;
|
|
15
|
+
function flowUpsertDataDto(flow) {
|
|
16
|
+
var _a = flow.data, description = _a.description, label = _a.label, trees = _a.trees, meta = _a.meta;
|
|
17
|
+
var id = flow.id, botId = flow.botId, dateCreated = flow.dateCreated, dateModified = flow.dateModified, isDeleted = flow.isDeleted;
|
|
18
|
+
return {
|
|
19
|
+
id: id,
|
|
20
|
+
botId: botId,
|
|
21
|
+
dateCreated: dateCreated,
|
|
22
|
+
dateModified: dateModified,
|
|
23
|
+
isDeleted: isDeleted,
|
|
24
|
+
description: description,
|
|
25
|
+
label: label,
|
|
26
|
+
trees: trees,
|
|
27
|
+
meta: meta,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.flowUpsertDataDto = flowUpsertDataDto;
|
|
31
|
+
function flowActivateDataDto(flow) {
|
|
32
|
+
var _a = flow.data.meta.idw, idw = _a === void 0 ? {} : _a;
|
|
33
|
+
return __assign({}, idw);
|
|
34
|
+
}
|
|
35
|
+
exports.flowActivateDataDto = flowActivateDataDto;
|
|
36
|
+
//# sourceMappingURL=flowUpsert.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowUpsert.dto.js","sourceRoot":"","sources":["../../../src/dto/flowUpsert.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,SAAgB,iBAAiB,CAAC,IAAc;IACxC,IAAA,KAAsC,IAAI,CAAC,IAAI,EAA7C,WAAW,iBAAA,EAAE,KAAK,WAAA,EAAE,KAAK,WAAA,EAAE,IAAI,UAAc,CAAC;IAC9C,IAAA,EAAE,GAAkD,IAAI,GAAtD,EAAE,KAAK,GAA2C,IAAI,MAA/C,EAAE,WAAW,GAA8B,IAAI,YAAlC,EAAE,YAAY,GAAgB,IAAI,aAApB,EAAE,SAAS,GAAK,IAAI,UAAT,CAAU;IACjE,OAAO;QACL,EAAE,IAAA;QACF,KAAK,OAAA;QACL,WAAW,aAAA;QACX,YAAY,cAAA;QACZ,SAAS,WAAA;QACT,WAAW,aAAA;QACX,KAAK,OAAA;QACL,KAAK,OAAA;QACL,IAAI,MAAA;KACL,CAAC;AACJ,CAAC;AAdD,8CAcC;AAED,SAAgB,mBAAmB,CAAC,IAAc;IAChC,IAAA,KAAe,IAAI,CAAC,IAAI,SAAhB,EAAR,GAAG,mBAAG,EAAE,KAAA,CAAiB;IACzC,oBACK,GAAG,EACN;AACJ,CAAC;AALD,kDAKC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./flowUpsert.dto"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
|
package/dist/esm/api/flowApi.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buildRoute } from '../helpers';
|
|
2
|
+
import { flowActivateDataDto, flowUpsertDataDto } from '../dto';
|
|
2
3
|
export class FlowApi {
|
|
3
4
|
constructor(providers) {
|
|
4
5
|
this.providers = providers;
|
|
@@ -29,24 +30,30 @@ export class FlowApi {
|
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
|
-
upsert(
|
|
33
|
+
upsert(flow) {
|
|
34
|
+
const data = flowUpsertDataDto(flow);
|
|
33
35
|
return this.providers.makeRequest({
|
|
34
36
|
route: buildRoute('flow'),
|
|
35
37
|
method: 'POST',
|
|
36
38
|
data,
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
|
-
activateFlow(
|
|
41
|
+
activateFlow(flow) {
|
|
42
|
+
const id = flow.id;
|
|
43
|
+
const data = flowActivateDataDto(flow);
|
|
40
44
|
return this.providers.makeRequest({
|
|
41
45
|
route: buildRoute('flow/activate'),
|
|
42
|
-
method: '
|
|
46
|
+
method: 'PATCH',
|
|
43
47
|
data,
|
|
48
|
+
params: {
|
|
49
|
+
id,
|
|
50
|
+
},
|
|
44
51
|
});
|
|
45
52
|
}
|
|
46
53
|
deactivateFlow(id) {
|
|
47
54
|
return this.providers.makeRequest({
|
|
48
55
|
route: buildRoute('flow/deactivate'),
|
|
49
|
-
method: '
|
|
56
|
+
method: 'PATCH',
|
|
50
57
|
params: {
|
|
51
58
|
id,
|
|
52
59
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowApi.js","sourceRoot":"","sources":["../../../src/api/flowApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flowApi.js","sourceRoot":"","sources":["../../../src/api/flowApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhE,MAAM,OAAO,OAAO;IAClB,YACmB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IACpC,CAAC;IAMJ,OAAO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC;YACzB,MAAM,EAAE;gBACN,EAAE;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAMD,UAAU,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC;YACzB,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,EAAE;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAMD,WAAW,CAAC,GAAa;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;YAC1B,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;aAChB;SACF,CAAC,CAAC;IACL,CAAC;IAMD,MAAM,CAAC,IAAc;QACnB,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC;YACzB,MAAM,EAAE,MAAM;YACd,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAMD,YAAY,CAAC,IAAc;QACzB,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC;YAClC,MAAM,EAAE,OAAO;YACf,IAAI;YACJ,MAAM,EAAE;gBACN,EAAE;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAMD,cAAc,CAAC,EAAU;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC;YACpC,MAAM,EAAE,OAAO;YACf,MAAM,EAAE;gBACN,EAAE;aACH;SACF,CAAC,CAAC;IACL,CAAC;CAEF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function flowUpsertDataDto(flow) {
|
|
2
|
+
const { description, label, trees, meta } = flow.data;
|
|
3
|
+
const { id, botId, dateCreated, dateModified, isDeleted } = flow;
|
|
4
|
+
return {
|
|
5
|
+
id,
|
|
6
|
+
botId,
|
|
7
|
+
dateCreated,
|
|
8
|
+
dateModified,
|
|
9
|
+
isDeleted,
|
|
10
|
+
description,
|
|
11
|
+
label,
|
|
12
|
+
trees,
|
|
13
|
+
meta,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function flowActivateDataDto(flow) {
|
|
17
|
+
const { meta: { idw = {} } } = flow.data;
|
|
18
|
+
return Object.assign({}, idw);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=flowUpsert.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowUpsert.dto.js","sourceRoot":"","sources":["../../../src/dto/flowUpsert.dto.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,IAAc;IAC9C,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;IACtD,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACjE,OAAO;QACL,EAAE;QACF,KAAK;QACL,WAAW;QACX,YAAY;QACZ,SAAS;QACT,WAAW;QACX,KAAK;QACL,KAAK;QACL,IAAI;KACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAc;IAChD,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;IACzC,yBACK,GAAG,EACN;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Flow
|
|
1
|
+
import { Flow as FlowType } from '@or-sdk/deployer';
|
|
2
|
+
import { Flow } from '../types';
|
|
2
3
|
import { Providers } from '@or-sdk/providers';
|
|
3
4
|
export declare class FlowApi {
|
|
4
5
|
private readonly providers;
|
|
@@ -6,8 +7,8 @@ export declare class FlowApi {
|
|
|
6
7
|
getFlow(id: string): Promise<Flow>;
|
|
7
8
|
deleteFlow(id: string): Promise<void>;
|
|
8
9
|
deleteFlows(ids: string[]): Promise<void>;
|
|
9
|
-
upsert(
|
|
10
|
-
activateFlow(
|
|
10
|
+
upsert(flow: FlowType): Promise<Flow>;
|
|
11
|
+
activateFlow(flow: FlowType): Promise<void>;
|
|
11
12
|
deactivateFlow(id: string): Promise<void>;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=flowApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowApi.d.ts","sourceRoot":"","sources":["../../../src/api/flowApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"flowApi.d.ts","sourceRoot":"","sources":["../../../src/api/flowApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI9C,qBAAa,OAAO;IAEhB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAOvC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAalC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcrC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAczC,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAarC,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB3C,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAU1C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Flow as FlowType } from '@or-sdk/deployer';
|
|
2
|
+
export declare function flowUpsertDataDto(flow: FlowType): {
|
|
3
|
+
id: string | undefined;
|
|
4
|
+
botId: string;
|
|
5
|
+
dateCreated: number;
|
|
6
|
+
dateModified: number;
|
|
7
|
+
isDeleted: boolean;
|
|
8
|
+
description: string;
|
|
9
|
+
label: string;
|
|
10
|
+
trees: {
|
|
11
|
+
[key: string]: import("@or-sdk/deployer").Tree;
|
|
12
|
+
};
|
|
13
|
+
meta: {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
idw?: import("@or-sdk/deployer").IDWFlowMeta | undefined;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function flowActivateDataDto(flow: FlowType): {
|
|
19
|
+
channel?: string | undefined;
|
|
20
|
+
skills?: string[] | undefined;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=flowUpsert.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowUpsert.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/flowUpsert.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEpD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ;;;;;;;;;;;;;;;EAc/C;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ;;;EAKjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dto/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { flowActivateDataDto, flowUpsertDataDto } from '../dto';
|
|
2
2
|
export interface Flow {
|
|
3
3
|
id: string;
|
|
4
4
|
createdAt: number;
|
|
@@ -15,5 +15,8 @@ export interface Flow {
|
|
|
15
15
|
export interface FlowWithRelationshipStatus extends Flow {
|
|
16
16
|
isRelationshipActive: boolean;
|
|
17
17
|
}
|
|
18
|
-
export type
|
|
18
|
+
export type FlowUpsertData = ReturnType<typeof flowUpsertDataDto> & {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
export type FlowActivateData = ReturnType<typeof flowActivateDataDto>;
|
|
19
22
|
//# sourceMappingURL=flow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../../src/types/flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../../src/types/flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhE,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA2B,SAAQ,IAAI;IACtD,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,GAAG;IAAC,EAAE,EAAE,MAAM,CAAC;CAAC,CAAC;AAClF,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/api/flowApi.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Flow
|
|
1
|
+
import { Flow as FlowType } from '@or-sdk/deployer';
|
|
2
|
+
import { Flow } from '../types';
|
|
2
3
|
import { Providers } from '@or-sdk/providers';
|
|
3
4
|
import { buildRoute } from '../helpers';
|
|
5
|
+
import { flowActivateDataDto, flowUpsertDataDto } from '../dto';
|
|
4
6
|
|
|
5
7
|
export class FlowApi {
|
|
6
8
|
constructor(
|
|
@@ -36,7 +38,7 @@ export class FlowApi {
|
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* @description Delete specific flow
|
|
39
|
-
* @param
|
|
41
|
+
* @param ids
|
|
40
42
|
*/
|
|
41
43
|
deleteFlows(ids: string[]): Promise<void> {
|
|
42
44
|
return this.providers.makeRequest({
|
|
@@ -50,9 +52,10 @@ export class FlowApi {
|
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* @description create flow connected with existing node
|
|
53
|
-
* @param
|
|
55
|
+
* @param flow
|
|
54
56
|
*/
|
|
55
|
-
upsert(
|
|
57
|
+
upsert(flow: FlowType): Promise<Flow> {
|
|
58
|
+
const data = flowUpsertDataDto(flow);
|
|
56
59
|
return this.providers.makeRequest({
|
|
57
60
|
route: buildRoute('flow'),
|
|
58
61
|
method: 'POST',
|
|
@@ -60,18 +63,31 @@ export class FlowApi {
|
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
|
|
66
|
+
/**
|
|
67
|
+
* activate flow
|
|
68
|
+
* @param flow
|
|
69
|
+
*/
|
|
70
|
+
activateFlow(flow: FlowType): Promise<void> {
|
|
71
|
+
const id = flow.id;
|
|
72
|
+
const data = flowActivateDataDto(flow);
|
|
64
73
|
return this.providers.makeRequest({
|
|
65
74
|
route: buildRoute('flow/activate'),
|
|
66
|
-
method: '
|
|
75
|
+
method: 'PATCH',
|
|
67
76
|
data,
|
|
77
|
+
params: {
|
|
78
|
+
id,
|
|
79
|
+
},
|
|
68
80
|
});
|
|
69
81
|
}
|
|
70
82
|
|
|
83
|
+
/**
|
|
84
|
+
* deactivate flow
|
|
85
|
+
* @param id
|
|
86
|
+
*/
|
|
71
87
|
deactivateFlow(id: string): Promise<void> {
|
|
72
88
|
return this.providers.makeRequest({
|
|
73
89
|
route: buildRoute('flow/deactivate'),
|
|
74
|
-
method: '
|
|
90
|
+
method: 'PATCH',
|
|
75
91
|
params: {
|
|
76
92
|
id,
|
|
77
93
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Flow as FlowType } from '@or-sdk/deployer';
|
|
2
|
+
|
|
3
|
+
export function flowUpsertDataDto(flow: FlowType) {
|
|
4
|
+
const { description, label, trees, meta } = flow.data;
|
|
5
|
+
const { id, botId, dateCreated, dateModified, isDeleted } = flow;
|
|
6
|
+
return {
|
|
7
|
+
id,
|
|
8
|
+
botId,
|
|
9
|
+
dateCreated,
|
|
10
|
+
dateModified,
|
|
11
|
+
isDeleted,
|
|
12
|
+
description,
|
|
13
|
+
label,
|
|
14
|
+
trees,
|
|
15
|
+
meta,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function flowActivateDataDto(flow: FlowType) {
|
|
20
|
+
const { meta: { idw = {} } } = flow.data;
|
|
21
|
+
return {
|
|
22
|
+
...idw,
|
|
23
|
+
};
|
|
24
|
+
}
|
package/src/dto/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './flowUpsert.dto';
|
package/src/types/flow.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { flowActivateDataDto, flowUpsertDataDto } from '../dto';
|
|
2
2
|
|
|
3
3
|
export interface Flow {
|
|
4
4
|
id: string;
|
|
@@ -18,4 +18,5 @@ export interface FlowWithRelationshipStatus extends Flow {
|
|
|
18
18
|
isRelationshipActive: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type FlowUpsertData = ReturnType<typeof flowUpsertDataDto> & {id: string;};
|
|
22
|
+
export type FlowActivateData = ReturnType<typeof flowActivateDataDto>;
|