@or-sdk/flows 0.5.0 → 0.8.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/Flows.js +4 -3
- package/dist/cjs/Flows.js.map +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/esm/Flows.js +4 -4
- package/dist/esm/Flows.js.map +1 -1
- package/dist/esm/constants.js +0 -2
- package/dist/esm/constants.js.map +1 -1
- package/dist/types/Flows.d.ts +6 -6
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/types.d.ts +1 -2
- package/package.json +5 -5
- package/src/Flows.ts +50 -22
- package/src/constants.ts +0 -2
- package/src/types.ts +1 -3
package/dist/cjs/Flows.js
CHANGED
|
@@ -111,7 +111,7 @@ var Flows = (function (_super) {
|
|
|
111
111
|
case 3:
|
|
112
112
|
if (result.last) return [3, 1];
|
|
113
113
|
_a.label = 4;
|
|
114
|
-
case 4: return [2, flowList];
|
|
114
|
+
case 4: return [2, (0, base_1.makeList)(flowList)];
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
});
|
|
@@ -192,10 +192,11 @@ var Flows = (function (_super) {
|
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
194
|
};
|
|
195
|
-
Flows.prototype.activateFlow = function (source) {
|
|
195
|
+
Flows.prototype.activateFlow = function (source, interactiveDebug) {
|
|
196
|
+
if (interactiveDebug === void 0) { interactiveDebug = false; }
|
|
196
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
197
198
|
return __generator(this, function (_a) {
|
|
198
|
-
return [2, this.deployer.activateFlow(source)];
|
|
199
|
+
return [2, this.deployer.activateFlow(source, interactiveDebug)];
|
|
199
200
|
});
|
|
200
201
|
});
|
|
201
202
|
};
|
package/dist/cjs/Flows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flows.js","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"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AA2B,WAAI,GAkK9B;AAlKY,sBAAK"}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ENTITY_NAME = exports.QUERY_DELETE = exports.SERVICE_KEY = void 0;
|
|
4
4
|
exports.SERVICE_KEY = 'sdk-api';
|
|
5
|
-
exports.QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n
|
|
5
|
+
exports.QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n }\n }\n}";
|
|
6
6
|
exports.ENTITY_NAME = 'FLOW';
|
|
7
7
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,SAAS,CAAC;AAExB,QAAA,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,SAAS,CAAC;AAExB,QAAA,YAAY,GAAG,yLAM1B,CAAC;AAEU,QAAA,WAAW,GAAG,MAAM,CAAC"}
|
package/dist/esm/Flows.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { Base } from '@or-sdk/base';
|
|
10
|
+
import { Base, makeList } from '@or-sdk/base';
|
|
11
11
|
import { DataHub } from '@or-sdk/data-hub';
|
|
12
12
|
import { Deployer } from '@or-sdk/deployer';
|
|
13
13
|
import { SERVICE_KEY, QUERY_DELETE, ENTITY_NAME } from './constants';
|
|
@@ -47,7 +47,7 @@ export class Flows extends Base {
|
|
|
47
47
|
flowList = [...flowList, ...result.items];
|
|
48
48
|
query.last = result.last;
|
|
49
49
|
} while (result.last);
|
|
50
|
-
return flowList;
|
|
50
|
+
return makeList(flowList);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
getFlow(id) {
|
|
@@ -103,9 +103,9 @@ export class Flows extends Base {
|
|
|
103
103
|
return this.dataHub.subscribe(requestId);
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
activateFlow(source) {
|
|
106
|
+
activateFlow(source, interactiveDebug = false) {
|
|
107
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
return this.deployer.activateFlow(source);
|
|
108
|
+
return this.deployer.activateFlow(source, interactiveDebug);
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
deactivateFlow(source, flowAlias, deleteLambda = false) {
|
package/dist/esm/Flows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flows.js","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Flows.js","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,OAAO,EAAkD,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAsE,MAAM,kBAAkB,CAAC;AAEhH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAUrE,MAAM,OAAO,KAAM,SAAQ,IAAI;IAU7B,YAAY,MAAmB;QAC7B,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAE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AY;gBACnB,SAAS;aACV,CAAC;YAEF,MAAM,EAAE,IAAI,EAAE,EAAE,iBAAiB,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAA6C;gBAChI,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,UAAU;gBACjB,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC3C,CAAC;KAAA;IAQY,YAAY,CAAC,MAAY,EAAE,gBAAgB,GAAG,KAAK;;YAC9D,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAC9D,CAAC;KAAA;IAQY,cAAc,CAAC,MAAY,EAAE,SAAiB,EAAE,YAAY,GAAG,KAAK;;YAC/E,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QACvE,CAAC;KAAA;CAEF"}
|
package/dist/esm/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AAErC,MAAM,CAAC,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AAErC,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;EAM1B,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC"}
|
package/dist/types/Flows.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Base } from '@or-sdk/base';
|
|
2
|
-
import {
|
|
1
|
+
import { Base, List } from '@or-sdk/base';
|
|
2
|
+
import { GraphqlResponseCheckExecution } from '@or-sdk/data-hub';
|
|
3
3
|
import { Flow, PollingResultActivateSuccess, PollingResultDeactivateSuccess } from '@or-sdk/deployer';
|
|
4
|
-
import {
|
|
4
|
+
import { FlowsConfig } from './types';
|
|
5
5
|
export declare class Flows extends Base {
|
|
6
6
|
private readonly dataHub;
|
|
7
7
|
private readonly deployer;
|
|
8
8
|
constructor(params: FlowsConfig);
|
|
9
|
-
listFlows(botId?: string): Promise<
|
|
9
|
+
listFlows(botId?: string): Promise<List<Flow>>;
|
|
10
10
|
getFlow(id: string): Promise<Flow>;
|
|
11
11
|
saveFlow(source: Flow): Promise<Flow>;
|
|
12
|
-
deleteFlow(source: Flow, flowAlias?: string): Promise<
|
|
13
|
-
activateFlow(source: Flow): Promise<PollingResultActivateSuccess>;
|
|
12
|
+
deleteFlow(source: Flow, flowAlias?: string): Promise<GraphqlResponseCheckExecution>;
|
|
13
|
+
activateFlow(source: Flow, interactiveDebug?: boolean): Promise<PollingResultActivateSuccess>;
|
|
14
14
|
deactivateFlow(source: Flow, flowAlias: string, deleteLambda?: boolean): Promise<PollingResultDeactivateSuccess>;
|
|
15
15
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const SERVICE_KEY = "sdk-api";
|
|
2
|
-
export declare const QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n
|
|
2
|
+
export declare const QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n }\n }\n}";
|
|
3
3
|
export declare const ENTITY_NAME = "FLOW";
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.8.0",
|
|
3
3
|
"name": "@or-sdk/flows",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@or-sdk/base": "^0.
|
|
27
|
-
"@or-sdk/data-hub": "^0.
|
|
28
|
-
"@or-sdk/deployer": "^0.
|
|
26
|
+
"@or-sdk/base": "^0.8.0",
|
|
27
|
+
"@or-sdk/data-hub": "^0.8.0",
|
|
28
|
+
"@or-sdk/deployer": "^0.8.0"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "da566635aafed274ea7a9abbc788d6a4961ff9a2"
|
|
31
31
|
}
|
package/src/Flows.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { Base } from '@or-sdk/base';
|
|
2
|
-
import { DataHub,
|
|
1
|
+
import { Base, List, makeList } from '@or-sdk/base';
|
|
2
|
+
import { DataHub, GraphqlResponseCheckExecution, GraphqlResponse } from '@or-sdk/data-hub';
|
|
3
3
|
import { Deployer, Flow, PollingResultActivateSuccess, PollingResultDeactivateSuccess } from '@or-sdk/deployer';
|
|
4
|
-
import {
|
|
4
|
+
import { FlowsConfig, FlowListResponse } from './types';
|
|
5
5
|
import { SERVICE_KEY, QUERY_DELETE, ENTITY_NAME } from './constants';
|
|
6
6
|
// import {} from './utils';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* OneReach Flows service client
|
|
10
|
+
* ## Installation:
|
|
11
|
+
* ```
|
|
12
|
+
* $ npm i @or-sdk/flows
|
|
13
|
+
* ```
|
|
10
14
|
*/
|
|
11
15
|
export class Flows extends Base {
|
|
12
16
|
private readonly dataHub: DataHub;
|
|
@@ -14,10 +18,8 @@ export class Flows extends Base {
|
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* ```typescript
|
|
17
|
-
*
|
|
18
21
|
* import { Flows } from '@or-sdk/flows'
|
|
19
22
|
* const flows = new Flows({token: 'my-account-token-string', baseUrl: 'http://example.flows/endpoint'});
|
|
20
|
-
*
|
|
21
23
|
* ```
|
|
22
24
|
*/
|
|
23
25
|
constructor(params: FlowsConfig) {
|
|
@@ -37,12 +39,14 @@ export class Flows extends Base {
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
/**
|
|
42
|
+
* List identifiers
|
|
40
43
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
+
* If botId is passed - lists flows from the specified bot
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const flowsList = await flows.listFlows('bot-id');
|
|
47
|
+
* ```
|
|
44
48
|
*/
|
|
45
|
-
public async listFlows(botId?: string): Promise<
|
|
49
|
+
public async listFlows(botId?: string): Promise<List<Flow>> {
|
|
46
50
|
const params = {
|
|
47
51
|
includeDeleted: false,
|
|
48
52
|
includeExisting: true,
|
|
@@ -53,7 +57,7 @@ export class Flows extends Base {
|
|
|
53
57
|
const route = `/v2/${this.currentAccountId}/flows`;
|
|
54
58
|
|
|
55
59
|
let result: FlowListResponse;
|
|
56
|
-
let flowList:
|
|
60
|
+
let flowList: Flow[] = [];
|
|
57
61
|
const query: { botId?: string; last?: string; } = { botId: botId ? botId : undefined };
|
|
58
62
|
|
|
59
63
|
do {
|
|
@@ -70,9 +74,15 @@ export class Flows extends Base {
|
|
|
70
74
|
|
|
71
75
|
} while (result.last);
|
|
72
76
|
|
|
73
|
-
return flowList;
|
|
77
|
+
return makeList<Flow>(flowList);
|
|
74
78
|
}
|
|
75
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Get flow
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const flow = await flows.getFlow('flow-id');
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
76
86
|
public async getFlow(id: string): Promise<Flow> {
|
|
77
87
|
const route = `/v2/${this.currentAccountId}/flow/${id}`;
|
|
78
88
|
|
|
@@ -82,7 +92,7 @@ export class Flows extends Base {
|
|
|
82
92
|
sandbox: false,
|
|
83
93
|
};
|
|
84
94
|
|
|
85
|
-
return await this.dataHub.makeRequest({
|
|
95
|
+
return await this.dataHub.makeRequest<Flow>({
|
|
86
96
|
method: 'GET',
|
|
87
97
|
route,
|
|
88
98
|
params,
|
|
@@ -90,10 +100,12 @@ export class Flows extends Base {
|
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
/**
|
|
103
|
+
* Save flow
|
|
93
104
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
105
|
+
* If source contains existing id - existing flow be updated
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const savedFlow = await flows.saveFlow(flowSource);
|
|
108
|
+
* ```
|
|
97
109
|
*/
|
|
98
110
|
public async saveFlow(source: Flow): Promise<Flow> {
|
|
99
111
|
const route = `/v2/${this.currentAccountId}/flow/${source.id ? source.id : 'new'}`;
|
|
@@ -103,16 +115,20 @@ export class Flows extends Base {
|
|
|
103
115
|
previousVersion: source.id ? source.version : undefined,
|
|
104
116
|
};
|
|
105
117
|
|
|
106
|
-
return await this.dataHub.makeRequest({
|
|
118
|
+
return await this.dataHub.makeRequest<Flow>({
|
|
107
119
|
method: 'POST',
|
|
108
120
|
route,
|
|
109
121
|
data,
|
|
110
122
|
});
|
|
111
123
|
}
|
|
112
124
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Delete flow
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const result = await flows.deleteFlow(flowSource, flowAlias);
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
public async deleteFlow(source: Flow, flowAlias = 'dev'): Promise<GraphqlResponseCheckExecution> {
|
|
116
132
|
const variables = {
|
|
117
133
|
entity: ENTITY_NAME,
|
|
118
134
|
data: {
|
|
@@ -129,7 +145,7 @@ export class Flows extends Base {
|
|
|
129
145
|
variables,
|
|
130
146
|
};
|
|
131
147
|
|
|
132
|
-
const { data: { deleteTemporarily: { requestId } } } = await this.dataHub.makeRequest({
|
|
148
|
+
const { data: { deleteTemporarily: { requestId } } } = await this.dataHub.makeRequest<GraphqlResponse<'deleteTemporarily', void>>({
|
|
133
149
|
method: 'POST',
|
|
134
150
|
route: '/graphql',
|
|
135
151
|
data,
|
|
@@ -138,10 +154,22 @@ export class Flows extends Base {
|
|
|
138
154
|
return this.dataHub.subscribe(requestId);
|
|
139
155
|
}
|
|
140
156
|
|
|
141
|
-
|
|
142
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Activate flow
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const triggerList = await flows.activateFlow(flowSource, false);
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
public async activateFlow(source: Flow, interactiveDebug = false): Promise<PollingResultActivateSuccess> {
|
|
164
|
+
return this.deployer.activateFlow(source, interactiveDebug);
|
|
143
165
|
}
|
|
144
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Deactivate flow
|
|
169
|
+
* ```typescript
|
|
170
|
+
* const deactivatedFlowList = await flows.deactivateFlow(flowSource, 'flowAlias', false);
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
145
173
|
public async deactivateFlow(source: Flow, flowAlias: string, deleteLambda = false): Promise<PollingResultDeactivateSuccess> {
|
|
146
174
|
return this.deployer.deactivateFlow(source, flowAlias, deleteLambda);
|
|
147
175
|
}
|
package/src/constants.ts
CHANGED