@ldsg/workflow-node-type 0.2.12 → 0.3.1
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/__tests__/unit.js +6 -15
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/resource-records/end/handler/index.d.ts.map +1 -1
- package/dist/resource-records/end/handler/index.js +4 -2
- package/dist/resource-records/end/index.d.ts.map +1 -1
- package/dist/resource-records/end/index.js +5 -0
- package/dist/resource-records/start/handler/index.d.ts.map +1 -1
- package/dist/resource-records/start/handler/index.js +4 -2
- package/dist/resource-records/start/index.d.ts.map +1 -1
- package/dist/resource-records/start/index.js +5 -0
- package/dist/types/workflow-node-type.d.ts +0 -4
- package/dist/types/workflow-node-type.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/utils/get-input-variables.d.ts +0 -4
- package/dist/utils/get-input-variables.d.ts.map +0 -1
- package/dist/utils/get-input-variables.js +0 -24
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -17
package/dist/__tests__/unit.js
CHANGED
|
@@ -3,15 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const handler_1 = require("@ldsg/handler");
|
|
4
4
|
const resource_1 = require("../resource");
|
|
5
5
|
const handler = async (params) => {
|
|
6
|
-
const {
|
|
7
|
-
const { name } = workflowNodeProperties;
|
|
8
|
-
let variables;
|
|
9
|
-
if (workflowInputVariables) {
|
|
10
|
-
variables = workflowInputVariables;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
variables = name;
|
|
14
|
-
}
|
|
6
|
+
const { variables } = params;
|
|
15
7
|
const res = {
|
|
16
8
|
variables,
|
|
17
9
|
};
|
|
@@ -52,18 +44,17 @@ test("field type", async () => {
|
|
|
52
44
|
});
|
|
53
45
|
const { workflowNodeTypeInfo: { execute: workflowNodeTypeExecute }, } = workflowNodeTypeResource.getWorkflowNodeTypeInfo();
|
|
54
46
|
const { variables: variables1 } = await workflowNodeTypeExecute({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
workflowNodeProperties: {
|
|
58
|
-
name: "test",
|
|
47
|
+
variables: {
|
|
48
|
+
hello: "world",
|
|
59
49
|
},
|
|
50
|
+
context: {},
|
|
60
51
|
});
|
|
61
52
|
expect(variables1).toEqual({ hello: "world" });
|
|
62
53
|
const { variables: variables2 } = await workflowNodeTypeExecute({
|
|
63
|
-
|
|
64
|
-
workflowNodeProperties: {
|
|
54
|
+
variables: {
|
|
65
55
|
name: "test",
|
|
66
56
|
},
|
|
57
|
+
context: {},
|
|
67
58
|
});
|
|
68
59
|
expect(variables2).toEqual({ name: "test" });
|
|
69
60
|
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resource-records/end/handler/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,+BAA+B,EAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resource-records/end/handler/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,+BAA+B,EAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAc7C,eAAO,MAAM,wCAAwC,EAAE,cAAc,CAAC,+BAA+B,CAYlG,CAAC"}
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.endWorkflowNodeTypeHandlerResourceRecord = void 0;
|
|
4
4
|
const constants_1 = require("@ldsg/constants");
|
|
5
5
|
const handler_1 = require("@ldsg/handler");
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
6
|
const constants_2 = require("./constants");
|
|
8
7
|
const handler = async (params) => {
|
|
9
|
-
const
|
|
8
|
+
const { variables } = params;
|
|
9
|
+
const res = {
|
|
10
|
+
variables,
|
|
11
|
+
};
|
|
10
12
|
return res;
|
|
11
13
|
};
|
|
12
14
|
exports.endWorkflowNodeTypeHandlerResourceRecord = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resource-records/end/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAGvE,cAAc,WAAW,CAAC;AAE1B,eAAO,MAAM,iCAAiC,EAAE,cAAc,CAAC,wCAAwC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resource-records/end/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAGvE,cAAc,WAAW,CAAC;AAE1B,eAAO,MAAM,iCAAiC,EAAE,cAAc,CAAC,wCAAwC,CAyBpG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resource-records/start/handler/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,+BAA+B,EAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resource-records/start/handler/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,+BAA+B,EAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAc7C,eAAO,MAAM,0CAA0C,EAAE,cAAc,CAAC,+BAA+B,CAYpG,CAAC"}
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.startWorkflowNodeTypeHandlerResourceRecord = void 0;
|
|
4
4
|
const constants_1 = require("@ldsg/constants");
|
|
5
5
|
const handler_1 = require("@ldsg/handler");
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
6
|
const constants_2 = require("./constants");
|
|
8
7
|
const handler = async (params) => {
|
|
9
|
-
const
|
|
8
|
+
const { variables } = params;
|
|
9
|
+
const res = {
|
|
10
|
+
variables,
|
|
11
|
+
};
|
|
10
12
|
return res;
|
|
11
13
|
};
|
|
12
14
|
exports.startWorkflowNodeTypeHandlerResourceRecord = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resource-records/start/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAGvE,cAAc,WAAW,CAAC;AAE1B,eAAO,MAAM,mCAAmC,EAAE,cAAc,CAAC,wCAAwC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resource-records/start/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAGvE,cAAc,WAAW,CAAC;AAE1B,eAAO,MAAM,mCAAmC,EAAE,cAAc,CAAC,wCAAwC,CAyBtG,CAAC"}
|
|
@@ -35,6 +35,11 @@ exports.startWorkflowNodeTypeResourceRecord = {
|
|
|
35
35
|
properties: {},
|
|
36
36
|
additionalItems: true,
|
|
37
37
|
},
|
|
38
|
+
output: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {},
|
|
41
|
+
additionalItems: true,
|
|
42
|
+
},
|
|
38
43
|
},
|
|
39
44
|
},
|
|
40
45
|
handlerResourceId: constants_3.START_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID,
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { WorkflowNodeExecuteParams, WorkflowNodeExecuteRes } from "@ldsg/workflow";
|
|
2
2
|
export interface WorkflowNodeTypeExecuteParams extends WorkflowNodeExecuteParams {
|
|
3
|
-
/**
|
|
4
|
-
* Workflow Node Properties
|
|
5
|
-
*/
|
|
6
|
-
workflowNodeProperties: any;
|
|
7
3
|
}
|
|
8
4
|
export interface WorkflowNodeTypeExecuteRes extends WorkflowNodeExecuteRes {
|
|
9
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-node-type.d.ts","sourceRoot":"","sources":["../../src/types/workflow-node-type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,6BACf,SAAQ,yBAAyB;
|
|
1
|
+
{"version":3,"file":"workflow-node-type.d.ts","sourceRoot":"","sources":["../../src/types/workflow-node-type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,6BACf,SAAQ,yBAAyB;CAAG;AAEtC,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;CAAG;AAE7E;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,CACpC,MAAM,EAAE,6BAA6B,KAClC,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAED,MAAM,MAAM,+BAA+B,GAAG,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/workflow-node-type",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"json-schema": "0.4.0",
|
|
18
18
|
"jsonata": "^2.0.6",
|
|
19
19
|
"lodash": "^4.17.21",
|
|
20
|
-
"@ldsg/handler": "0.
|
|
21
|
-
"@ldsg/resource": "0.
|
|
22
|
-
"@ldsg/workflow": "0.
|
|
23
|
-
"@ldsg/resource-definition": "0.
|
|
20
|
+
"@ldsg/handler": "0.3.1",
|
|
21
|
+
"@ldsg/resource": "0.3.1",
|
|
22
|
+
"@ldsg/workflow": "0.3.1",
|
|
23
|
+
"@ldsg/resource-definition": "0.3.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/json-schema": "^7.0.15",
|
|
27
27
|
"@types/lodash": "^4.14.202",
|
|
28
|
-
"@ldsg/types": "0.
|
|
28
|
+
"@ldsg/types": "0.3.1"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { WorkflowNodeTypeExecuteParams, WorkflowNodeTypeExecuteRes } from "../types";
|
|
2
|
-
export type GetInputVariables = (params: WorkflowNodeTypeExecuteParams) => Promise<WorkflowNodeTypeExecuteRes>;
|
|
3
|
-
export declare const getInputVariables: GetInputVariables;
|
|
4
|
-
//# sourceMappingURL=get-input-variables.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-input-variables.d.ts","sourceRoot":"","sources":["../../src/utils/get-input-variables.ts"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,iBAAiB,GAAG,CAC9B,MAAM,EAAE,6BAA6B,KAClC,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC,eAAO,MAAM,iBAAiB,EAAE,iBAwB/B,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getInputVariables = void 0;
|
|
7
|
-
const jsonata_1 = __importDefault(require("jsonata"));
|
|
8
|
-
const getInputVariables = async (params) => {
|
|
9
|
-
const { workflowInputVariables, workflowVariablesRecord, workflowNodeProperties, } = params;
|
|
10
|
-
let inputVariables;
|
|
11
|
-
if (workflowInputVariables) {
|
|
12
|
-
inputVariables = workflowInputVariables;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
const { query } = workflowNodeProperties === null || workflowNodeProperties === void 0 ? void 0 : workflowNodeProperties.input;
|
|
16
|
-
const expression = (0, jsonata_1.default)(query);
|
|
17
|
-
inputVariables = await expression.evaluate(workflowVariablesRecord);
|
|
18
|
-
}
|
|
19
|
-
const res = {
|
|
20
|
-
variables: inputVariables,
|
|
21
|
-
};
|
|
22
|
-
return res;
|
|
23
|
-
};
|
|
24
|
-
exports.getInputVariables = getInputVariables;
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/utils/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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("./get-input-variables"), exports);
|