@or-sdk/flows 0.28.0 → 0.29.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 +0 -13
- package/README.md +1 -1
- package/dist/cjs/Flows.js +126 -101
- package/dist/cjs/Flows.js.map +1 -1
- package/dist/cjs/constants.js +5 -3
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/Flows.js +87 -73
- package/dist/esm/Flows.js.map +1 -1
- package/dist/esm/constants.js +9 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/Flows.d.ts +7 -8
- package/dist/types/Flows.d.ts.map +1 -1
- package/dist/types/constants.d.ts +3 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +10 -45
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/Flows.ts +115 -126
- package/src/constants.ts +11 -1
- package/src/index.ts +0 -2
- package/src/types.ts +11 -50
package/dist/esm/Flows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flows.js","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Flows.js","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAyE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClI,OAAO,EAAE,QAAQ,EAAuF,MAAM,kBAAkB,CAAC;AAEjI,OAAO,EAAE,YAAY,EAAE,WAA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YAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAG,CAAC,CAAC;YAExC,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAE1D,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;gBACvB,MAAM,KAAK,CAAC,oBAAoB,CAAC,CAAC;aACnC;YAED,OAAO,IAAI,CAAC,QAAQ,iCACf,MAAM,KACT,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAC5C,CAAC;QACL,CAAC;KAAA;IAQM,MAAM,CAAC,uBAAuB,CAAC,MAAY;QAChD,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAUM,MAAM,CAAC,yBAAyB,CAAC,MAAY,EAAE,gBAAwC,EAAE;QAC9F,OAAO,yBAAyB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1D,CAAC;CAEF"}
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DATA_HUB_SERVICE_KEY } from '@or-sdk/data-hub';
|
|
2
2
|
export { DEPLOYER_SERVICE_KEY } from '@or-sdk/deployer';
|
|
3
|
+
export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
|
|
4
|
+
deleteTemporarily(entity: $entity, data: $data) {
|
|
5
|
+
... on AsyncRequest {
|
|
6
|
+
requestId
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}`;
|
|
10
|
+
export const ENTITY_NAME = 'FLOW';
|
|
3
11
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;EAM1B,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,cAAc,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,cAAc,SAAS,CAAC"}
|
package/dist/types/Flows.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { List } from '@or-sdk/base';
|
|
2
|
+
import { GraphqlResponseCheckExecution } from '@or-sdk/data-hub';
|
|
2
3
|
import { Flow, PollingResultActivateSuccess, PollingResultDeactivateSuccess, StepTemplateRaw } from '@or-sdk/deployer';
|
|
3
|
-
import { FlowsConfig, ListFlowsParams, StepTemplateToDelete
|
|
4
|
+
import { FlowsConfig, ListFlowsParams, StepTemplateToDelete } from './types';
|
|
4
5
|
import { Taggable } from '@or-sdk/tags';
|
|
5
6
|
export declare class Flows implements Taggable<Flow> {
|
|
6
|
-
private readonly
|
|
7
|
+
private readonly dataHub;
|
|
7
8
|
private readonly deployer;
|
|
8
9
|
private readonly tags;
|
|
9
10
|
constructor(params: FlowsConfig);
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
init(): Promise<void>;
|
|
12
|
+
listFlows(botId?: string, params?: ListFlowsParams): Promise<List<Flow>>;
|
|
13
|
+
getFlow(id: string): Promise<Flow>;
|
|
12
14
|
saveFlow(source: Flow): Promise<Flow>;
|
|
13
|
-
deleteFlow(
|
|
14
|
-
recoverFlow(flowId: string): Promise<void>;
|
|
15
|
+
deleteFlow(source: Flow, flowAlias?: string): Promise<GraphqlResponseCheckExecution>;
|
|
15
16
|
activateFlow(source: Flow, interactiveDebug?: boolean): Promise<PollingResultActivateSuccess>;
|
|
16
17
|
deactivateFlow(source: Flow, flowAlias: string, deleteLambda?: boolean): Promise<PollingResultDeactivateSuccess>;
|
|
17
|
-
listDataOuts(paginationOptions?: PaginationOptions, params?: ListDataOutsParams): Promise<List<DataOut>>;
|
|
18
18
|
addTags(source: Flow, tagNames: string[]): Promise<Flow>;
|
|
19
19
|
removeTags(source: Flow, tagNames: string[]): Promise<Flow>;
|
|
20
|
-
downloadTemplate(flowTemplateId: string, botId: string, shouldUpdateSteps?: boolean): Promise<DownloadTemplateResult>;
|
|
21
20
|
static listUnusedStepTemplates(source: Flow): StepTemplateRaw[];
|
|
22
21
|
static deleteUnusedStepTemplates(source: Flow, stepTemplates?: StepTemplateToDelete[]): Flow;
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flows.d.ts","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAY,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Flows.d.ts","sourceRoot":"","sources":["../../src/Flows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAY,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAW,6BAA6B,EAA0D,MAAM,kBAAkB,CAAC;AAClI,OAAO,EAAY,IAAI,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjI,OAAO,EAAE,WAAW,EAAoB,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/F,OAAO,EAAQ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ERVICE_KEY } from '@or-sdk/data-hub';
|
|
2
2
|
export { DEPLOYER_SERVICE_KEY } from '@or-sdk/deployer';
|
|
3
|
+
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}";
|
|
4
|
+
export declare const ENTITY_NAME = "FLOW";
|
|
3
5
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,YAAY,4LAMvB,CAAC;AAEH,eAAO,MAAM,WAAW,SAAS,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,cAAc,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,cAAc,SAAS,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,59 +1,24 @@
|
|
|
1
1
|
import { Token } from '@or-sdk/base';
|
|
2
|
+
import { Flow } from '@or-sdk/deployer';
|
|
2
3
|
export declare type FlowsConfig = {
|
|
3
4
|
token: Token;
|
|
4
5
|
discoveryUrl?: string;
|
|
5
6
|
accountId?: string;
|
|
6
|
-
|
|
7
|
+
dataHubUrl?: string;
|
|
7
8
|
deployerUrl?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
};
|
|
15
|
-
projection?: string[];
|
|
16
|
-
group?: string[];
|
|
17
|
-
sandbox?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare type ListDataOutsParams = {
|
|
20
|
-
query?: {
|
|
21
|
-
[key: string]: unknown;
|
|
22
|
-
};
|
|
23
|
-
projection?: string[];
|
|
24
|
-
group?: string[];
|
|
25
|
-
sandbox?: boolean;
|
|
26
|
-
};
|
|
27
|
-
export declare type PaginationOptions = {
|
|
28
|
-
limit?: number;
|
|
29
|
-
offset?: number;
|
|
30
|
-
};
|
|
31
|
-
export declare type GetFlowParams = {
|
|
32
|
-
query?: {
|
|
33
|
-
[key: string]: unknown;
|
|
34
|
-
};
|
|
35
|
-
projection?: string[];
|
|
36
|
-
sandbox?: boolean;
|
|
10
|
+
export declare type FlowListResponse = {
|
|
11
|
+
count: number;
|
|
12
|
+
items: Flow[];
|
|
13
|
+
last?: string;
|
|
37
14
|
};
|
|
38
|
-
export declare type
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
type: string;
|
|
43
|
-
ttl: number;
|
|
44
|
-
meta: string;
|
|
45
|
-
outputExample: string;
|
|
46
|
-
stepLabel: string;
|
|
47
|
-
stepId: string;
|
|
15
|
+
export declare type ListFlowsParams = {
|
|
16
|
+
includeDeleted: boolean;
|
|
17
|
+
includeExisting: boolean;
|
|
18
|
+
projection: string[];
|
|
48
19
|
};
|
|
49
20
|
export declare type StepTemplateToDelete = {
|
|
50
21
|
id: string;
|
|
51
22
|
[key: string]: unknown;
|
|
52
23
|
};
|
|
53
|
-
export declare type DownloadTemplateResult = {
|
|
54
|
-
id: string;
|
|
55
|
-
data: {
|
|
56
|
-
label: string;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
24
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,oBAAY,WAAW,GAAG;IAIxB,KAAK,EAAE,KAAK,CAAC;IAKb,YAAY,CAAC,EAAE,MAAM,CAAC;IAKtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAKpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@or-sdk/flows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@or-sdk/base": "^0.26.7",
|
|
21
|
-
"@or-sdk/data-hub
|
|
22
|
-
"@or-sdk/deployer": "^0.26.
|
|
23
|
-
"@or-sdk/tags": "^0.
|
|
21
|
+
"@or-sdk/data-hub": "^0.25.5",
|
|
22
|
+
"@or-sdk/deployer": "^0.26.3",
|
|
23
|
+
"@or-sdk/tags": "^0.25.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"concurrently": "^6.4.0",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "a765eb4cea6c2c6089a7374c9b6a427e78a5dab3"
|
|
33
33
|
}
|
package/src/Flows.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { List, makeList } from '@or-sdk/base';
|
|
2
|
-
import {
|
|
2
|
+
import { DataHub, GraphqlResponseCheckExecution, GraphqlResponse, GraphqlResponseDelete, OperationNames } from '@or-sdk/data-hub';
|
|
3
3
|
import { Deployer, Flow, PollingResultActivateSuccess, PollingResultDeactivateSuccess, StepTemplateRaw } from '@or-sdk/deployer';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
ListFlowsParams,
|
|
7
|
-
StepTemplateToDelete,
|
|
8
|
-
PaginationOptions,
|
|
9
|
-
DownloadTemplateResult,
|
|
10
|
-
ListDataOutsParams, DataOut, GetFlowParams,
|
|
11
|
-
} from './types';
|
|
4
|
+
import { FlowsConfig, FlowListResponse, ListFlowsParams, StepTemplateToDelete } from './types';
|
|
5
|
+
import { QUERY_DELETE, ENTITY_NAME } from './constants';
|
|
12
6
|
import { Tags, Taggable, filterTagIds, addTagsIds, removeTagIds } from '@or-sdk/tags';
|
|
13
7
|
import { listUnusedStepTemplates, deleteUnusedStepTemplates } from './utils';
|
|
14
8
|
|
|
15
9
|
export class Flows implements Taggable<Flow> {
|
|
16
|
-
private readonly
|
|
10
|
+
private readonly dataHub: DataHub;
|
|
17
11
|
private readonly deployer: Deployer;
|
|
18
12
|
private readonly tags: Tags;
|
|
19
13
|
|
|
14
|
+
/**
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { Flows } from '@or-sdk/flows'
|
|
17
|
+
* const flows = new Flows({token: 'my-account-token-string', baseUrl: 'http://example.flows/endpoint'});
|
|
18
|
+
* await flows.init();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
20
21
|
constructor(params: FlowsConfig) {
|
|
21
|
-
const { discoveryUrl, token, accountId,
|
|
22
|
+
const { discoveryUrl, token, accountId, dataHubUrl, deployerUrl } = params;
|
|
22
23
|
|
|
23
|
-
this.
|
|
24
|
+
this.dataHub = new DataHub({
|
|
24
25
|
token,
|
|
25
26
|
discoveryUrl,
|
|
26
27
|
accountId,
|
|
27
|
-
|
|
28
|
+
dataHubUrl,
|
|
28
29
|
});
|
|
29
30
|
this.deployer = new Deployer({
|
|
30
31
|
token,
|
|
@@ -36,46 +37,72 @@ export class Flows implements Taggable<Flow> {
|
|
|
36
37
|
token,
|
|
37
38
|
discoveryUrl,
|
|
38
39
|
accountId,
|
|
39
|
-
|
|
40
|
+
dataHubUrl,
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
async init() {
|
|
45
|
+
await Promise.all([
|
|
46
|
+
this.dataHub.init(),
|
|
47
|
+
this.deployer.init(),
|
|
48
|
+
this.tags.init(),
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
/**
|
|
44
|
-
* List
|
|
53
|
+
* List identifiers
|
|
54
|
+
*
|
|
55
|
+
* If botId is passed - lists flows from the specified bot
|
|
45
56
|
* ```typescript
|
|
46
|
-
* const flowsList = await flows.listFlows();
|
|
57
|
+
* const flowsList = await flows.listFlows('bot-id');
|
|
47
58
|
* ```
|
|
48
59
|
*/
|
|
49
|
-
public async listFlows(botId?: string, params
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
public async listFlows(botId?: string, params?: ListFlowsParams): Promise<List<Flow>> {
|
|
61
|
+
const requestParams = {
|
|
62
|
+
// defaults
|
|
63
|
+
includeDeleted: false,
|
|
64
|
+
includeExisting: true,
|
|
65
|
+
projection: [
|
|
66
|
+
'id',
|
|
67
|
+
'version',
|
|
68
|
+
'botId',
|
|
69
|
+
'data.label',
|
|
70
|
+
'data.color',
|
|
71
|
+
'data.description',
|
|
72
|
+
'data.isHidden',
|
|
73
|
+
'tags',
|
|
74
|
+
'dateModified',
|
|
75
|
+
],
|
|
58
76
|
|
|
59
|
-
|
|
77
|
+
// overrides
|
|
60
78
|
...params,
|
|
61
|
-
query: {
|
|
62
|
-
...params.query,
|
|
63
|
-
...includeQuery,
|
|
64
|
-
},
|
|
65
|
-
...paginationOptions,
|
|
66
|
-
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
67
79
|
};
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
delete paramsToSend.includeExisting;
|
|
81
|
+
const route = `/v2/${this.dataHub.currentAccountId ? this.dataHub.currentAccountId : 'current'}/flows`;
|
|
71
82
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
let result: FlowListResponse;
|
|
84
|
+
let flowList: Flow[] = [];
|
|
85
|
+
const query: { botId?: string; last?: string; } = { botId: botId ? botId : undefined };
|
|
86
|
+
const projection = JSON.stringify(requestParams.projection);
|
|
87
|
+
|
|
88
|
+
do {
|
|
89
|
+
result = await this.dataHub.makeRequest({
|
|
90
|
+
method: 'GET',
|
|
91
|
+
route,
|
|
92
|
+
params: {
|
|
93
|
+
includeDeleted: requestParams.includeDeleted,
|
|
94
|
+
includeExisting: requestParams.includeExisting,
|
|
95
|
+
projection,
|
|
96
|
+
query: JSON.stringify(query),
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
flowList = [...flowList, ...result.items];
|
|
101
|
+
query.last = result.last;
|
|
77
102
|
|
|
78
|
-
|
|
103
|
+
} while (result.last);
|
|
104
|
+
|
|
105
|
+
return makeList<Flow>(flowList);
|
|
79
106
|
}
|
|
80
107
|
|
|
81
108
|
/**
|
|
@@ -84,14 +111,19 @@ export class Flows implements Taggable<Flow> {
|
|
|
84
111
|
* const flow = await flows.getFlow('flow-id');
|
|
85
112
|
* ```
|
|
86
113
|
*/
|
|
87
|
-
public async getFlow(id: string
|
|
88
|
-
|
|
114
|
+
public async getFlow(id: string): Promise<Flow> {
|
|
115
|
+
const route = `/v2/${this.dataHub.currentAccountId ? this.dataHub.currentAccountId : 'current'}/flow/${id}`;
|
|
116
|
+
|
|
117
|
+
const params = {
|
|
118
|
+
includeDeleted: false,
|
|
119
|
+
includeExisting: true,
|
|
120
|
+
sandbox: false,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return await this.dataHub.makeRequest<Flow>({
|
|
89
124
|
method: 'GET',
|
|
90
|
-
route
|
|
91
|
-
params
|
|
92
|
-
...params,
|
|
93
|
-
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
94
|
-
},
|
|
125
|
+
route,
|
|
126
|
+
params,
|
|
95
127
|
});
|
|
96
128
|
}
|
|
97
129
|
|
|
@@ -104,59 +136,56 @@ export class Flows implements Taggable<Flow> {
|
|
|
104
136
|
* ```
|
|
105
137
|
*/
|
|
106
138
|
public async saveFlow(source: Flow): Promise<Flow> {
|
|
107
|
-
const
|
|
139
|
+
const route = `/v2/${this.dataHub.currentAccountId ? this.dataHub.currentAccountId : 'current'}/flow/${source.id ? source.id : 'new'}`;
|
|
140
|
+
|
|
141
|
+
const data = {
|
|
142
|
+
flow: source,
|
|
143
|
+
previousVersion: source.id ? source.version : undefined,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
return await this.dataHub.makeRequest<Flow>({
|
|
108
147
|
method: 'POST',
|
|
109
|
-
route
|
|
110
|
-
data
|
|
111
|
-
flow: (source.id && source.id !== 'new') ? source : {
|
|
112
|
-
...source,
|
|
113
|
-
id: 'new', //TODO: remove later
|
|
114
|
-
},
|
|
115
|
-
previousVersion: (source.id && source.id !== 'new') ? source.version : undefined,
|
|
116
|
-
},
|
|
117
|
-
params: {
|
|
118
|
-
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
119
|
-
},
|
|
148
|
+
route,
|
|
149
|
+
data,
|
|
120
150
|
});
|
|
121
|
-
|
|
122
|
-
return setDiff<Flow>(source, result);
|
|
123
151
|
}
|
|
124
152
|
|
|
125
153
|
/**
|
|
126
154
|
* Delete flow
|
|
127
155
|
* ```typescript
|
|
128
|
-
* await flows.deleteFlow(
|
|
156
|
+
* const result = await flows.deleteFlow(flowSource, flowAlias);
|
|
129
157
|
* ```
|
|
130
158
|
*/
|
|
131
|
-
public async deleteFlow(
|
|
132
|
-
|
|
159
|
+
public async deleteFlow(source: Flow, flowAlias = 'dev'): Promise<GraphqlResponseCheckExecution> {
|
|
160
|
+
if (this.dataHub.isCrossAccount) {
|
|
161
|
+
throw Error('Cross-account deleting is not implemented.');
|
|
162
|
+
}
|
|
133
163
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
route: `flows/${flowId}`,
|
|
164
|
+
const variables = {
|
|
165
|
+
entity: ENTITY_NAME,
|
|
137
166
|
data: {
|
|
138
|
-
|
|
167
|
+
id: source.id,
|
|
168
|
+
flowAlias,
|
|
169
|
+
subscribe: true,
|
|
170
|
+
role: source.data.deploy.role,
|
|
139
171
|
},
|
|
140
|
-
|
|
141
|
-
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
}
|
|
172
|
+
};
|
|
145
173
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
},
|
|
174
|
+
const operationName = this.dataHub.getOperationName(OperationNames.DELETE_TEMPORARILY);
|
|
175
|
+
|
|
176
|
+
const data = {
|
|
177
|
+
operationName,
|
|
178
|
+
query: QUERY_DELETE,
|
|
179
|
+
variables,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const result = await this.dataHub.makeRequest<GraphqlResponse<void>>({
|
|
183
|
+
method: 'POST',
|
|
184
|
+
route: '/graphql',
|
|
185
|
+
data,
|
|
159
186
|
});
|
|
187
|
+
|
|
188
|
+
return this.dataHub.subscribe((result.data[operationName] as GraphqlResponseDelete).requestId);
|
|
160
189
|
}
|
|
161
190
|
|
|
162
191
|
/**
|
|
@@ -179,26 +208,6 @@ export class Flows implements Taggable<Flow> {
|
|
|
179
208
|
return this.deployer.deactivateFlow(source, flowAlias, deleteLambda);
|
|
180
209
|
}
|
|
181
210
|
|
|
182
|
-
/**
|
|
183
|
-
* List data outs
|
|
184
|
-
* ```typescript
|
|
185
|
-
* const result = await flows.downloadTemplate('flow-template-id', 'bot-id');
|
|
186
|
-
* ```
|
|
187
|
-
*/
|
|
188
|
-
public async listDataOuts(paginationOptions: PaginationOptions = {}, params: ListDataOutsParams = {}): Promise<List<DataOut>> {
|
|
189
|
-
const result = await this.dataHubSvc.makeRequest<DataOut[]>({
|
|
190
|
-
method: 'GET',
|
|
191
|
-
route: '/flows/data-outs',
|
|
192
|
-
params: {
|
|
193
|
-
...params,
|
|
194
|
-
...paginationOptions,
|
|
195
|
-
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
return makeList<DataOut>(result);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
211
|
/**
|
|
203
212
|
* Add tags
|
|
204
213
|
* ```typescript
|
|
@@ -243,26 +252,6 @@ export class Flows implements Taggable<Flow> {
|
|
|
243
252
|
});
|
|
244
253
|
}
|
|
245
254
|
|
|
246
|
-
/**
|
|
247
|
-
* Download flow template to account
|
|
248
|
-
* ```typescript
|
|
249
|
-
* const result = await flows.downloadTemplate('flow-template-id', 'bot-id');
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
public async downloadTemplate(flowTemplateId: string, botId: string, shouldUpdateSteps = false): Promise<DownloadTemplateResult> {
|
|
253
|
-
return this.dataHubSvc.makeRequest<DownloadTemplateResult>({
|
|
254
|
-
method: 'PUT',
|
|
255
|
-
route: `flows/${botId}`,
|
|
256
|
-
data: {
|
|
257
|
-
flowId: flowTemplateId,
|
|
258
|
-
shouldUpdateSteps,
|
|
259
|
-
},
|
|
260
|
-
params: {
|
|
261
|
-
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
|
|
266
255
|
/**
|
|
267
256
|
* List unused step templates from flow source
|
|
268
257
|
* ```typescript
|
package/src/constants.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DATA_HUB_SERVICE_KEY } from '@or-sdk/data-hub';
|
|
2
2
|
export { DEPLOYER_SERVICE_KEY } from '@or-sdk/deployer';
|
|
3
|
+
|
|
4
|
+
export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
|
|
5
|
+
deleteTemporarily(entity: $entity, data: $data) {
|
|
6
|
+
... on AsyncRequest {
|
|
7
|
+
requestId
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}`;
|
|
11
|
+
|
|
12
|
+
export const ENTITY_NAME = 'FLOW';
|
package/src/index.ts
CHANGED