@or-sdk/flows 0.4.0 → 0.7.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 CHANGED
@@ -90,7 +90,7 @@ var Flows = (function (_super) {
90
90
  includeDeleted: false,
91
91
  includeExisting: true,
92
92
  projection: JSON.stringify(['id', 'version', 'botId', 'data.label', 'data.color', 'data.description', 'data.isHidden', 'tags', 'dateModified']),
93
- query: undefined
93
+ query: undefined,
94
94
  };
95
95
  route = "/v2/" + this.currentAccountId + "/flows";
96
96
  flowList = [];
@@ -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
  });
@@ -126,7 +126,7 @@ var Flows = (function (_super) {
126
126
  params = {
127
127
  includeDeleted: false,
128
128
  includeExisting: true,
129
- sandbox: false
129
+ sandbox: false,
130
130
  };
131
131
  return [4, this.dataHub.makeRequest({
132
132
  method: 'GET',
@@ -147,7 +147,7 @@ var Flows = (function (_super) {
147
147
  route = "/v2/" + this.currentAccountId + "/flow/" + (source.id ? source.id : 'new');
148
148
  data = {
149
149
  flow: source,
150
- previousVersion: source.id ? source.version : undefined
150
+ previousVersion: source.id ? source.version : undefined,
151
151
  };
152
152
  return [4, this.dataHub.makeRequest({
153
153
  method: 'POST',
@@ -162,23 +162,23 @@ var Flows = (function (_super) {
162
162
  Flows.prototype.deleteFlow = function (source, flowAlias) {
163
163
  if (flowAlias === void 0) { flowAlias = 'dev'; }
164
164
  return __awaiter(this, void 0, void 0, function () {
165
- var variables, data, result;
165
+ var variables, data, requestId;
166
166
  return __generator(this, function (_a) {
167
167
  switch (_a.label) {
168
168
  case 0:
169
169
  variables = {
170
- entity: 'FLOW',
170
+ entity: constants_1.ENTITY_NAME,
171
171
  data: {
172
172
  id: source.id,
173
173
  flowAlias: flowAlias,
174
174
  subscribe: true,
175
- role: source.data.deploy.role
176
- }
175
+ role: source.data.deploy.role,
176
+ },
177
177
  };
178
178
  data = {
179
179
  operationName: 'deleteTemporarily',
180
180
  query: constants_1.QUERY_DELETE,
181
- variables: variables
181
+ variables: variables,
182
182
  };
183
183
  return [4, this.dataHub.makeRequest({
184
184
  method: 'POST',
@@ -186,16 +186,17 @@ var Flows = (function (_super) {
186
186
  data: data,
187
187
  })];
188
188
  case 1:
189
- result = _a.sent();
190
- return [2, this.dataHub.subscribe(result.data.deleteTemporarily.requestId)];
189
+ requestId = (_a.sent()).data.deleteTemporarily.requestId;
190
+ return [2, this.dataHub.subscribe(requestId)];
191
191
  }
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
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Flows.js","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AACpC,6CAAgE;AAChE,6CAAgH;AAEhH,yCAAwD;AAMxD;IAA2B,yBAAI;IAY7B,eAAY,MAAmB;QAA/B,iBAYC;QAXS,IAAA,YAAY,GAAY,MAAM,aAAlB,EAAE,KAAK,GAAK,MAAM,MAAX,CAAY;QAEvC,QAAA,kBAAM;YACJ,YAAY,cAAA;YACZ,KAAK,OAAA;YACL,UAAU,EAAE,uBAAW;YACvB,gBAAgB,EAAE,IAAI;SACvB,CAAC,SAAC;QAEH,KAAI,CAAC,OAAO,GAAG,IAAI,kBAAO,CAAC,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AA,iCAJ4C;wBAM9C,WAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,EAAC;;;;KAC1C;IAQY,4BAAY,GAAzB,UAA0B,MAAY,EAAE,gBAAwB;QAAxB,iCAAA,EAAA,wBAAwB;;;gBAC9D,WAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAC;;;KAC7D;IAQY,8BAAc,GAA3B,UAA4B,MAAY,EAAE,SAAiB,EAAE,YAAoB;QAApB,6BAAA,EAAA,oBAAoB;;;gBAC/E,WAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,EAAC;;;KACtE;IAEH,YAAC;AAAD,CAAC,AAlKD,CAA2B,WAAI,GAkK9B;AAlKY,sBAAK"}
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QUERY_DELETE = exports.QUERY_UPDATE = exports.QUERY_CREATE = exports.QUERY_GET = exports.QUERY_LIST = exports.SERVICE_KEY = void 0;
3
+ exports.ENTITY_NAME = exports.QUERY_DELETE = exports.SERVICE_KEY = void 0;
4
4
  exports.SERVICE_KEY = 'sdk-api';
5
- exports.QUERY_LIST = "query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {\n list(entity: $entity, params: $params, sandbox: $sandbox) {\n records {\n ... on Flow {\n id\n version\n botId\n data {\n label\n color\n description\n isHidden\n __typename\n }\n tags\n dateModified\n __typename\n }\n __typename\n }\n last\n __typename\n }\n}";
6
- exports.QUERY_GET = "query get($entity: EntityType!, $params: GetInput!) {\n get(entity: $entity, params: $params) {\n ... on Flow {\n id\n botId\n schemaVersion\n dateCreated\n dateModified\n data {\n label\n isHidden\n type\n deploy {\n memory\n timeout\n role\n logsTTL\n __typename\n }\n description\n trees\n stepTemplates {\n id\n version\n cacheVersion\n source\n label\n icon\n iconType\n iconUrl\n shape\n description\n isGatewayStep\n publishedBy\n categories\n recommended\n tags\n template\n form {\n template\n code\n component\n style\n __typename\n }\n data\n validationSchema\n reporting\n stepInputData\n outputExample\n help\n formBuilder\n rawMode\n tour\n meta\n migrations {\n version\n script\n sample\n __typename\n }\n modules\n dateCreated\n dateModified\n hooks\n __typename\n }\n packages\n meta\n color\n categories\n __typename\n }\n version\n tags\n __typename\n }\n __typename\n }\n}";
7
- exports.QUERY_CREATE = "mutation create($entity: EntityType!, $data: CreateInput!) {\n create(entity: $entity, data: $data) {\n ... on Flow {\n id\n botId\n schemaVersion\n dateCreated\n dateModified\n data {\n label\n isHidden\n type\n deploy {\n memory\n timeout\n role\n logsTTL\n __typename\n }\n description\n trees\n stepTemplates {\n id\n version\n cacheVersion\n source\n label\n icon\n iconType\n iconUrl\n shape\n description\n isGatewayStep\n publishedBy\n categories\n recommended\n tags\n template\n form {\n template\n code\n component\n style\n __typename\n }\n data\n validationSchema\n reporting\n stepInputData\n outputExample\n help\n formBuilder\n rawMode\n tour\n meta\n migrations {\n version\n script\n sample\n __typename\n }\n modules\n dateCreated\n dateModified\n hooks\n __typename\n }\n packages\n meta\n color\n categories\n __typename\n }\n version\n tags\n __typename\n }\n __typename\n }\n}";
8
- exports.QUERY_UPDATE = "mutation update($entity: EntityType!, $data: UpdateInput!) {\n update(entity: $entity, data: $data) {\n ... on Flow {\n id\n botId\n schemaVersion\n dateCreated\n dateModified\n data {\n label\n isHidden\n type\n deploy {\n memory\n timeout\n role\n logsTTL\n __typename\n }\n description\n trees\n stepTemplates {\n id\n version\n cacheVersion\n source\n label\n icon\n iconType\n iconUrl\n shape\n description\n isGatewayStep\n publishedBy\n categories\n recommended\n tags\n template\n form {\n template\n code\n component\n style\n __typename\n }\n data\n validationSchema\n reporting\n stepInputData\n outputExample\n help\n formBuilder\n rawMode\n tour\n meta\n migrations {\n version\n script\n sample\n __typename\n }\n modules\n dateCreated\n dateModified\n hooks\n __typename\n }\n packages\n meta\n color\n categories\n __typename\n }\n version\n tags\n __typename\n }\n __typename\n }\n}";
9
- exports.QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n __typename\n }\n __typename\n }\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
+ exports.ENTITY_NAME = 'FLOW';
10
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,UAAU,GAAG,qdAuBxB,CAAC;AAEU,QAAA,SAAS,GAAG,y+CA+EvB,CAAC;AAEU,QAAA,YAAY,GAAG,++CA+E1B,CAAC;AAEU,QAAA,YAAY,GAAG,++CA+E1B,CAAC;AAEU,QAAA,YAAY,GAAG,2NAQ1B,CAAC"}
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,10 +7,10 @@ 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
- import { SERVICE_KEY, QUERY_DELETE } from './constants';
13
+ import { SERVICE_KEY, QUERY_DELETE, ENTITY_NAME } from './constants';
14
14
  export class Flows extends Base {
15
15
  constructor(params) {
16
16
  const { discoveryUrl, token } = params;
@@ -20,8 +20,10 @@ export class Flows extends Base {
20
20
  serviceKey: SERVICE_KEY,
21
21
  requestAccountId: true,
22
22
  });
23
- this.dataHub = new DataHub({ token, discoveryUrl });
24
- this.deployer = new Deployer({ token, discoveryUrl });
23
+ this.dataHub = new DataHub({ token,
24
+ discoveryUrl });
25
+ this.deployer = new Deployer({ token,
26
+ discoveryUrl });
25
27
  }
26
28
  listFlows(botId) {
27
29
  return __awaiter(this, void 0, void 0, function* () {
@@ -29,12 +31,12 @@ export class Flows extends Base {
29
31
  includeDeleted: false,
30
32
  includeExisting: true,
31
33
  projection: JSON.stringify(['id', 'version', 'botId', 'data.label', 'data.color', 'data.description', 'data.isHidden', 'tags', 'dateModified']),
32
- query: undefined
34
+ query: undefined,
33
35
  };
34
36
  const route = `/v2/${this.currentAccountId}/flows`;
35
37
  let result;
36
38
  let flowList = [];
37
- let query = { botId: botId ? botId : undefined };
39
+ const query = { botId: botId ? botId : undefined };
38
40
  do {
39
41
  params.query = JSON.stringify(query);
40
42
  result = yield this.dataHub.makeRequest({
@@ -45,7 +47,7 @@ export class Flows extends Base {
45
47
  flowList = [...flowList, ...result.items];
46
48
  query.last = result.last;
47
49
  } while (result.last);
48
- return flowList;
50
+ return makeList(flowList);
49
51
  });
50
52
  }
51
53
  getFlow(id) {
@@ -54,7 +56,7 @@ export class Flows extends Base {
54
56
  const params = {
55
57
  includeDeleted: false,
56
58
  includeExisting: true,
57
- sandbox: false
59
+ sandbox: false,
58
60
  };
59
61
  return yield this.dataHub.makeRequest({
60
62
  method: 'GET',
@@ -68,7 +70,7 @@ export class Flows extends Base {
68
70
  const route = `/v2/${this.currentAccountId}/flow/${source.id ? source.id : 'new'}`;
69
71
  const data = {
70
72
  flow: source,
71
- previousVersion: source.id ? source.version : undefined
73
+ previousVersion: source.id ? source.version : undefined,
72
74
  };
73
75
  return yield this.dataHub.makeRequest({
74
76
  method: 'POST',
@@ -80,30 +82,30 @@ export class Flows extends Base {
80
82
  deleteFlow(source, flowAlias = 'dev') {
81
83
  return __awaiter(this, void 0, void 0, function* () {
82
84
  const variables = {
83
- entity: 'FLOW',
85
+ entity: ENTITY_NAME,
84
86
  data: {
85
87
  id: source.id,
86
88
  flowAlias,
87
89
  subscribe: true,
88
- role: source.data.deploy.role
89
- }
90
+ role: source.data.deploy.role,
91
+ },
90
92
  };
91
93
  const data = {
92
94
  operationName: 'deleteTemporarily',
93
95
  query: QUERY_DELETE,
94
- variables
96
+ variables,
95
97
  };
96
- const result = yield this.dataHub.makeRequest({
98
+ const { data: { deleteTemporarily: { requestId } } } = yield this.dataHub.makeRequest({
97
99
  method: 'POST',
98
100
  route: '/graphql',
99
101
  data,
100
102
  });
101
- return this.dataHub.subscribe(result.data.deleteTemporarily.requestId);
103
+ return this.dataHub.subscribe(requestId);
102
104
  });
103
105
  }
104
- activateFlow(source) {
106
+ activateFlow(source, interactiveDebug = false) {
105
107
  return __awaiter(this, void 0, void 0, function* () {
106
- return this.deployer.activateFlow(source);
108
+ return this.deployer.activateFlow(source, interactiveDebug);
107
109
  });
108
110
  }
109
111
  deactivateFlow(source, flowAlias, deleteLambda = false) {
@@ -1 +1 @@
1
- {"version":3,"file":"Flows.js","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,OAAO,EAAuB,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAsE,MAAM,kBAAkB,CAAC;AAEhH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMxD,MAAM,OAAO,KAAM,SAAQ,IAAI;IAY7B,YAAY,MAAmB;QAC7B,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAEvC,KAAK,CAAC;YACJ,YAAY;YACZ,KAAK;YACL,UAAU,EAAE,WAAW;YACvB,gBAAgB,EAAE,IAAI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;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"}
@@ -1,275 +1,10 @@
1
1
  export const SERVICE_KEY = 'sdk-api';
2
- export const QUERY_LIST = `query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {
3
- list(entity: $entity, params: $params, sandbox: $sandbox) {
4
- records {
5
- ... on Flow {
6
- id
7
- version
8
- botId
9
- data {
10
- label
11
- color
12
- description
13
- isHidden
14
- __typename
15
- }
16
- tags
17
- dateModified
18
- __typename
19
- }
20
- __typename
21
- }
22
- last
23
- __typename
24
- }
25
- }`;
26
- export const QUERY_GET = `query get($entity: EntityType!, $params: GetInput!) {
27
- get(entity: $entity, params: $params) {
28
- ... on Flow {
29
- id
30
- botId
31
- schemaVersion
32
- dateCreated
33
- dateModified
34
- data {
35
- label
36
- isHidden
37
- type
38
- deploy {
39
- memory
40
- timeout
41
- role
42
- logsTTL
43
- __typename
44
- }
45
- description
46
- trees
47
- stepTemplates {
48
- id
49
- version
50
- cacheVersion
51
- source
52
- label
53
- icon
54
- iconType
55
- iconUrl
56
- shape
57
- description
58
- isGatewayStep
59
- publishedBy
60
- categories
61
- recommended
62
- tags
63
- template
64
- form {
65
- template
66
- code
67
- component
68
- style
69
- __typename
70
- }
71
- data
72
- validationSchema
73
- reporting
74
- stepInputData
75
- outputExample
76
- help
77
- formBuilder
78
- rawMode
79
- tour
80
- meta
81
- migrations {
82
- version
83
- script
84
- sample
85
- __typename
86
- }
87
- modules
88
- dateCreated
89
- dateModified
90
- hooks
91
- __typename
92
- }
93
- packages
94
- meta
95
- color
96
- categories
97
- __typename
98
- }
99
- version
100
- tags
101
- __typename
102
- }
103
- __typename
104
- }
105
- }`;
106
- export const QUERY_CREATE = `mutation create($entity: EntityType!, $data: CreateInput!) {
107
- create(entity: $entity, data: $data) {
108
- ... on Flow {
109
- id
110
- botId
111
- schemaVersion
112
- dateCreated
113
- dateModified
114
- data {
115
- label
116
- isHidden
117
- type
118
- deploy {
119
- memory
120
- timeout
121
- role
122
- logsTTL
123
- __typename
124
- }
125
- description
126
- trees
127
- stepTemplates {
128
- id
129
- version
130
- cacheVersion
131
- source
132
- label
133
- icon
134
- iconType
135
- iconUrl
136
- shape
137
- description
138
- isGatewayStep
139
- publishedBy
140
- categories
141
- recommended
142
- tags
143
- template
144
- form {
145
- template
146
- code
147
- component
148
- style
149
- __typename
150
- }
151
- data
152
- validationSchema
153
- reporting
154
- stepInputData
155
- outputExample
156
- help
157
- formBuilder
158
- rawMode
159
- tour
160
- meta
161
- migrations {
162
- version
163
- script
164
- sample
165
- __typename
166
- }
167
- modules
168
- dateCreated
169
- dateModified
170
- hooks
171
- __typename
172
- }
173
- packages
174
- meta
175
- color
176
- categories
177
- __typename
178
- }
179
- version
180
- tags
181
- __typename
182
- }
183
- __typename
184
- }
185
- }`;
186
- export const QUERY_UPDATE = `mutation update($entity: EntityType!, $data: UpdateInput!) {
187
- update(entity: $entity, data: $data) {
188
- ... on Flow {
189
- id
190
- botId
191
- schemaVersion
192
- dateCreated
193
- dateModified
194
- data {
195
- label
196
- isHidden
197
- type
198
- deploy {
199
- memory
200
- timeout
201
- role
202
- logsTTL
203
- __typename
204
- }
205
- description
206
- trees
207
- stepTemplates {
208
- id
209
- version
210
- cacheVersion
211
- source
212
- label
213
- icon
214
- iconType
215
- iconUrl
216
- shape
217
- description
218
- isGatewayStep
219
- publishedBy
220
- categories
221
- recommended
222
- tags
223
- template
224
- form {
225
- template
226
- code
227
- component
228
- style
229
- __typename
230
- }
231
- data
232
- validationSchema
233
- reporting
234
- stepInputData
235
- outputExample
236
- help
237
- formBuilder
238
- rawMode
239
- tour
240
- meta
241
- migrations {
242
- version
243
- script
244
- sample
245
- __typename
246
- }
247
- modules
248
- dateCreated
249
- dateModified
250
- hooks
251
- __typename
252
- }
253
- packages
254
- meta
255
- color
256
- categories
257
- __typename
258
- }
259
- version
260
- tags
261
- __typename
262
- }
263
- __typename
264
- }
265
- }`;
266
2
  export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
267
3
  deleteTemporarily(entity: $entity, data: $data) {
268
4
  ... on AsyncRequest {
269
5
  requestId
270
- __typename
271
6
  }
272
- __typename
273
7
  }
274
8
  }`;
9
+ export const ENTITY_NAME = 'FLOW';
275
10
  //# sourceMappingURL=constants.js.map
@@ -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,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuBxB,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+EvB,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+E1B,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+E1B,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;EAQ1B,CAAC"}
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"}
@@ -1,15 +1,15 @@
1
- import { Base } from '@or-sdk/base';
2
- import { SubscribeResultData } from '@or-sdk/data-hub';
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 { FlowList, FlowsConfig } from './types';
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<FlowList>;
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<SubscribeResultData>;
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,6 +1,3 @@
1
1
  export declare const SERVICE_KEY = "sdk-api";
2
- export declare const QUERY_LIST = "query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {\n list(entity: $entity, params: $params, sandbox: $sandbox) {\n records {\n ... on Flow {\n id\n version\n botId\n data {\n label\n color\n description\n isHidden\n __typename\n }\n tags\n dateModified\n __typename\n }\n __typename\n }\n last\n __typename\n }\n}";
3
- export declare const QUERY_GET = "query get($entity: EntityType!, $params: GetInput!) {\n get(entity: $entity, params: $params) {\n ... on Flow {\n id\n botId\n schemaVersion\n dateCreated\n dateModified\n data {\n label\n isHidden\n type\n deploy {\n memory\n timeout\n role\n logsTTL\n __typename\n }\n description\n trees\n stepTemplates {\n id\n version\n cacheVersion\n source\n label\n icon\n iconType\n iconUrl\n shape\n description\n isGatewayStep\n publishedBy\n categories\n recommended\n tags\n template\n form {\n template\n code\n component\n style\n __typename\n }\n data\n validationSchema\n reporting\n stepInputData\n outputExample\n help\n formBuilder\n rawMode\n tour\n meta\n migrations {\n version\n script\n sample\n __typename\n }\n modules\n dateCreated\n dateModified\n hooks\n __typename\n }\n packages\n meta\n color\n categories\n __typename\n }\n version\n tags\n __typename\n }\n __typename\n }\n}";
4
- export declare const QUERY_CREATE = "mutation create($entity: EntityType!, $data: CreateInput!) {\n create(entity: $entity, data: $data) {\n ... on Flow {\n id\n botId\n schemaVersion\n dateCreated\n dateModified\n data {\n label\n isHidden\n type\n deploy {\n memory\n timeout\n role\n logsTTL\n __typename\n }\n description\n trees\n stepTemplates {\n id\n version\n cacheVersion\n source\n label\n icon\n iconType\n iconUrl\n shape\n description\n isGatewayStep\n publishedBy\n categories\n recommended\n tags\n template\n form {\n template\n code\n component\n style\n __typename\n }\n data\n validationSchema\n reporting\n stepInputData\n outputExample\n help\n formBuilder\n rawMode\n tour\n meta\n migrations {\n version\n script\n sample\n __typename\n }\n modules\n dateCreated\n dateModified\n hooks\n __typename\n }\n packages\n meta\n color\n categories\n __typename\n }\n version\n tags\n __typename\n }\n __typename\n }\n}";
5
- export declare const QUERY_UPDATE = "mutation update($entity: EntityType!, $data: UpdateInput!) {\n update(entity: $entity, data: $data) {\n ... on Flow {\n id\n botId\n schemaVersion\n dateCreated\n dateModified\n data {\n label\n isHidden\n type\n deploy {\n memory\n timeout\n role\n logsTTL\n __typename\n }\n description\n trees\n stepTemplates {\n id\n version\n cacheVersion\n source\n label\n icon\n iconType\n iconUrl\n shape\n description\n isGatewayStep\n publishedBy\n categories\n recommended\n tags\n template\n form {\n template\n code\n component\n style\n __typename\n }\n data\n validationSchema\n reporting\n stepInputData\n outputExample\n help\n formBuilder\n rawMode\n tour\n meta\n migrations {\n version\n script\n sample\n __typename\n }\n modules\n dateCreated\n dateModified\n hooks\n __typename\n }\n packages\n meta\n color\n categories\n __typename\n }\n version\n tags\n __typename\n }\n __typename\n }\n}";
6
- export declare const QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n __typename\n }\n __typename\n }\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
+ export declare const ENTITY_NAME = "FLOW";
@@ -4,9 +4,8 @@ export declare type FlowsConfig = {
4
4
  token: Token;
5
5
  discoveryUrl: string;
6
6
  };
7
- export declare type FlowList = Flow[];
8
7
  export declare type FlowListResponse = {
9
8
  count: number;
10
- items: FlowList;
9
+ items: Flow[];
11
10
  last?: string;
12
11
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.4.0",
2
+ "version": "0.7.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.4.0",
27
- "@or-sdk/data-hub": "^0.4.0",
28
- "@or-sdk/deployer": "^0.4.0"
26
+ "@or-sdk/base": "^0.7.0",
27
+ "@or-sdk/data-hub": "^0.7.0",
28
+ "@or-sdk/deployer": "^0.7.0"
29
29
  },
30
- "gitHead": "1ff2df6f74e5cc7ceacdc3f8eafeeed9f417a882"
30
+ "gitHead": "836cfcb137cdc452b1ee3088fec811d1f4901255"
31
31
  }
package/src/Flows.ts CHANGED
@@ -1,23 +1,25 @@
1
- import { Base } from '@or-sdk/base';
2
- import { DataHub, SubscribeResultData } from '@or-sdk/data-hub';
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 { FlowList, FlowsConfig, FlowListResponse } from './types';
5
- import { SERVICE_KEY, QUERY_DELETE } from './constants';
4
+ import { FlowsConfig, FlowListResponse } from './types';
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
- private readonly dataHub: any;
13
- private readonly deployer: any;
16
+ private readonly dataHub: DataHub;
17
+ private readonly deployer: Deployer;
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) {
@@ -30,29 +32,33 @@ export class Flows extends Base {
30
32
  requestAccountId: true,
31
33
  });
32
34
 
33
- this.dataHub = new DataHub({ token, discoveryUrl });
34
- this.deployer = new Deployer({ token, discoveryUrl });
35
+ this.dataHub = new DataHub({ token,
36
+ discoveryUrl });
37
+ this.deployer = new Deployer({ token,
38
+ discoveryUrl });
35
39
  }
36
40
 
37
41
  /**
42
+ * List identifiers
38
43
  *
39
- * if botId is passed - lists flows from the specified bot
40
- *
41
- * @returns created/updated flow source
44
+ * If botId is passed - lists flows from the specified bot
45
+ * ```typescript
46
+ * const flowsList = await flows.listFlows('bot-id');
47
+ * ```
42
48
  */
43
- public async listFlows(botId?: string): Promise<FlowList> {
49
+ public async listFlows(botId?: string): Promise<List<Flow>> {
44
50
  const params = {
45
51
  includeDeleted: false,
46
52
  includeExisting: true,
47
- projection: JSON.stringify(['id','version','botId','data.label','data.color','data.description','data.isHidden','tags','dateModified']),
48
- query: undefined as any
53
+ projection: JSON.stringify(['id', 'version', 'botId', 'data.label', 'data.color', 'data.description', 'data.isHidden', 'tags', 'dateModified']),
54
+ query: undefined as unknown,
49
55
  };
50
56
 
51
57
  const route = `/v2/${this.currentAccountId}/flows`;
52
58
 
53
59
  let result: FlowListResponse;
54
- let flowList: FlowList = [];
55
- let query: { botId?: string, last?: string } = { botId: botId ? botId : undefined };
60
+ let flowList: Flow[] = [];
61
+ const query: { botId?: string; last?: string; } = { botId: botId ? botId : undefined };
56
62
 
57
63
  do {
58
64
  params.query = JSON.stringify(query);
@@ -68,19 +74,25 @@ export class Flows extends Base {
68
74
 
69
75
  } while (result.last);
70
76
 
71
- return flowList;
77
+ return makeList<Flow>(flowList);
72
78
  }
73
79
 
80
+ /**
81
+ * Get flow
82
+ * ```typescript
83
+ * const flow = await flows.getFlow('flow-id');
84
+ * ```
85
+ */
74
86
  public async getFlow(id: string): Promise<Flow> {
75
87
  const route = `/v2/${this.currentAccountId}/flow/${id}`;
76
88
 
77
89
  const params = {
78
90
  includeDeleted: false,
79
91
  includeExisting: true,
80
- sandbox: false
92
+ sandbox: false,
81
93
  };
82
94
 
83
- return await this.dataHub.makeRequest({
95
+ return await this.dataHub.makeRequest<Flow>({
84
96
  method: 'GET',
85
97
  route,
86
98
  params,
@@ -88,59 +100,77 @@ export class Flows extends Base {
88
100
  }
89
101
 
90
102
  /**
103
+ * Save flow
91
104
  *
92
- * if source contains id - existing flow be updated
93
- *
94
- * @returns created/updated flow source
105
+ * If source contains existing id - existing flow be updated
106
+ * ```typescript
107
+ * const savedFlow = await flows.saveFlow(flowSource);
108
+ * ```
95
109
  */
96
110
  public async saveFlow(source: Flow): Promise<Flow> {
97
111
  const route = `/v2/${this.currentAccountId}/flow/${source.id ? source.id : 'new'}`;
98
112
 
99
113
  const data = {
100
114
  flow: source,
101
- previousVersion: source.id ? source.version : undefined
115
+ previousVersion: source.id ? source.version : undefined,
102
116
  };
103
117
 
104
- return await this.dataHub.makeRequest({
118
+ return await this.dataHub.makeRequest<Flow>({
105
119
  method: 'POST',
106
120
  route,
107
121
  data,
108
122
  });
109
123
  }
110
124
 
111
- public async deleteFlow(source: Flow, flowAlias: string = 'dev'): Promise<SubscribeResultData> {
112
- // TODO: no REST yet, but graphql needs another base url...
113
-
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> {
114
132
  const variables = {
115
- entity: 'FLOW',
133
+ entity: ENTITY_NAME,
116
134
  data: {
117
135
  id: source.id,
118
136
  flowAlias,
119
137
  subscribe: true,
120
- role: source.data.deploy.role
121
- }
138
+ role: source.data.deploy.role,
139
+ },
122
140
  };
123
141
 
124
142
  const data = {
125
143
  operationName: 'deleteTemporarily',
126
144
  query: QUERY_DELETE,
127
- variables
145
+ variables,
128
146
  };
129
147
 
130
- const result = await this.dataHub.makeRequest({
148
+ const { data: { deleteTemporarily: { requestId } } } = await this.dataHub.makeRequest<GraphqlResponse<'deleteTemporarily', void>>({
131
149
  method: 'POST',
132
150
  route: '/graphql',
133
151
  data,
134
152
  });
135
153
 
136
- return this.dataHub.subscribe(result.data.deleteTemporarily.requestId);
154
+ return this.dataHub.subscribe(requestId);
137
155
  }
138
156
 
139
- public async activateFlow(source: Flow): Promise<PollingResultActivateSuccess> {
140
- return this.deployer.activateFlow(source);
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);
141
165
  }
142
166
 
143
- public async deactivateFlow(source: Flow, flowAlias: string, deleteLambda: boolean = false): Promise<PollingResultDeactivateSuccess> {
167
+ /**
168
+ * Deactivate flow
169
+ * ```typescript
170
+ * const deactivatedFlowList = await flows.deactivateFlow(flowSource, 'flowAlias', false);
171
+ * ```
172
+ */
173
+ public async deactivateFlow(source: Flow, flowAlias: string, deleteLambda = false): Promise<PollingResultDeactivateSuccess> {
144
174
  return this.deployer.deactivateFlow(source, flowAlias, deleteLambda);
145
175
  }
146
176
 
package/src/constants.ts CHANGED
@@ -1,279 +1,11 @@
1
1
  export const SERVICE_KEY = 'sdk-api';
2
2
 
3
- export const QUERY_LIST = `query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {
4
- list(entity: $entity, params: $params, sandbox: $sandbox) {
5
- records {
6
- ... on Flow {
7
- id
8
- version
9
- botId
10
- data {
11
- label
12
- color
13
- description
14
- isHidden
15
- __typename
16
- }
17
- tags
18
- dateModified
19
- __typename
20
- }
21
- __typename
22
- }
23
- last
24
- __typename
25
- }
26
- }`;
27
-
28
- export const QUERY_GET = `query get($entity: EntityType!, $params: GetInput!) {
29
- get(entity: $entity, params: $params) {
30
- ... on Flow {
31
- id
32
- botId
33
- schemaVersion
34
- dateCreated
35
- dateModified
36
- data {
37
- label
38
- isHidden
39
- type
40
- deploy {
41
- memory
42
- timeout
43
- role
44
- logsTTL
45
- __typename
46
- }
47
- description
48
- trees
49
- stepTemplates {
50
- id
51
- version
52
- cacheVersion
53
- source
54
- label
55
- icon
56
- iconType
57
- iconUrl
58
- shape
59
- description
60
- isGatewayStep
61
- publishedBy
62
- categories
63
- recommended
64
- tags
65
- template
66
- form {
67
- template
68
- code
69
- component
70
- style
71
- __typename
72
- }
73
- data
74
- validationSchema
75
- reporting
76
- stepInputData
77
- outputExample
78
- help
79
- formBuilder
80
- rawMode
81
- tour
82
- meta
83
- migrations {
84
- version
85
- script
86
- sample
87
- __typename
88
- }
89
- modules
90
- dateCreated
91
- dateModified
92
- hooks
93
- __typename
94
- }
95
- packages
96
- meta
97
- color
98
- categories
99
- __typename
100
- }
101
- version
102
- tags
103
- __typename
104
- }
105
- __typename
106
- }
107
- }`;
108
-
109
- export const QUERY_CREATE = `mutation create($entity: EntityType!, $data: CreateInput!) {
110
- create(entity: $entity, data: $data) {
111
- ... on Flow {
112
- id
113
- botId
114
- schemaVersion
115
- dateCreated
116
- dateModified
117
- data {
118
- label
119
- isHidden
120
- type
121
- deploy {
122
- memory
123
- timeout
124
- role
125
- logsTTL
126
- __typename
127
- }
128
- description
129
- trees
130
- stepTemplates {
131
- id
132
- version
133
- cacheVersion
134
- source
135
- label
136
- icon
137
- iconType
138
- iconUrl
139
- shape
140
- description
141
- isGatewayStep
142
- publishedBy
143
- categories
144
- recommended
145
- tags
146
- template
147
- form {
148
- template
149
- code
150
- component
151
- style
152
- __typename
153
- }
154
- data
155
- validationSchema
156
- reporting
157
- stepInputData
158
- outputExample
159
- help
160
- formBuilder
161
- rawMode
162
- tour
163
- meta
164
- migrations {
165
- version
166
- script
167
- sample
168
- __typename
169
- }
170
- modules
171
- dateCreated
172
- dateModified
173
- hooks
174
- __typename
175
- }
176
- packages
177
- meta
178
- color
179
- categories
180
- __typename
181
- }
182
- version
183
- tags
184
- __typename
185
- }
186
- __typename
187
- }
188
- }`;
189
-
190
- export const QUERY_UPDATE = `mutation update($entity: EntityType!, $data: UpdateInput!) {
191
- update(entity: $entity, data: $data) {
192
- ... on Flow {
193
- id
194
- botId
195
- schemaVersion
196
- dateCreated
197
- dateModified
198
- data {
199
- label
200
- isHidden
201
- type
202
- deploy {
203
- memory
204
- timeout
205
- role
206
- logsTTL
207
- __typename
208
- }
209
- description
210
- trees
211
- stepTemplates {
212
- id
213
- version
214
- cacheVersion
215
- source
216
- label
217
- icon
218
- iconType
219
- iconUrl
220
- shape
221
- description
222
- isGatewayStep
223
- publishedBy
224
- categories
225
- recommended
226
- tags
227
- template
228
- form {
229
- template
230
- code
231
- component
232
- style
233
- __typename
234
- }
235
- data
236
- validationSchema
237
- reporting
238
- stepInputData
239
- outputExample
240
- help
241
- formBuilder
242
- rawMode
243
- tour
244
- meta
245
- migrations {
246
- version
247
- script
248
- sample
249
- __typename
250
- }
251
- modules
252
- dateCreated
253
- dateModified
254
- hooks
255
- __typename
256
- }
257
- packages
258
- meta
259
- color
260
- categories
261
- __typename
262
- }
263
- version
264
- tags
265
- __typename
266
- }
267
- __typename
268
- }
269
- }`;
270
-
271
3
  export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
272
4
  deleteTemporarily(entity: $entity, data: $data) {
273
5
  ... on AsyncRequest {
274
6
  requestId
275
- __typename
276
7
  }
277
- __typename
278
8
  }
279
9
  }`;
10
+
11
+ export const ENTITY_NAME = 'FLOW';
package/src/types.ts CHANGED
@@ -13,10 +13,8 @@ export type FlowsConfig = {
13
13
  discoveryUrl: string;
14
14
  };
15
15
 
16
- export type FlowList = Flow[];
17
-
18
16
  export type FlowListResponse = {
19
17
  count: number;
20
- items: FlowList;
18
+ items: Flow[];
21
19
  last?: string;
22
20
  };