@ldsg/workflow-node-type 0.2.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.
Files changed (51) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +1 -0
  3. package/dist/__tests__/unit.d.ts +2 -0
  4. package/dist/__tests__/unit.d.ts.map +1 -0
  5. package/dist/__tests__/unit.js +72 -0
  6. package/dist/constants.d.ts +13 -0
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/constants.js +29 -0
  9. package/dist/handler.d.ts +8 -0
  10. package/dist/handler.d.ts.map +1 -0
  11. package/dist/handler.js +5 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +22 -0
  15. package/dist/instantiate-resource.d.ts +6 -0
  16. package/dist/instantiate-resource.d.ts.map +1 -0
  17. package/dist/instantiate-resource.js +13 -0
  18. package/dist/resource-records/end/handler/constants.d.ts +2 -0
  19. package/dist/resource-records/end/handler/constants.d.ts.map +1 -0
  20. package/dist/resource-records/end/handler/constants.js +5 -0
  21. package/dist/resource-records/end/handler/index.d.ts +4 -0
  22. package/dist/resource-records/end/handler/index.d.ts.map +1 -0
  23. package/dist/resource-records/end/handler/index.js +47 -0
  24. package/dist/resource-records/end/index.d.ts +5 -0
  25. package/dist/resource-records/end/index.d.ts.map +1 -0
  26. package/dist/resource-records/end/index.js +42 -0
  27. package/dist/resource-records/index.d.ts +4 -0
  28. package/dist/resource-records/index.d.ts.map +1 -0
  29. package/dist/resource-records/index.js +27 -0
  30. package/dist/resource-records/start/handler/constants.d.ts +2 -0
  31. package/dist/resource-records/start/handler/constants.d.ts.map +1 -0
  32. package/dist/resource-records/start/handler/constants.js +5 -0
  33. package/dist/resource-records/start/handler/index.d.ts +4 -0
  34. package/dist/resource-records/start/handler/index.d.ts.map +1 -0
  35. package/dist/resource-records/start/handler/index.js +38 -0
  36. package/dist/resource-records/start/index.d.ts +5 -0
  37. package/dist/resource-records/start/index.d.ts.map +1 -0
  38. package/dist/resource-records/start/index.js +42 -0
  39. package/dist/resource.d.ts +6 -0
  40. package/dist/resource.d.ts.map +1 -0
  41. package/dist/resource.js +23 -0
  42. package/dist/types/extra-workflow-node-info.d.ts +16 -0
  43. package/dist/types/extra-workflow-node-info.d.ts.map +1 -0
  44. package/dist/types/extra-workflow-node-info.js +2 -0
  45. package/dist/types/index.d.ts +3 -0
  46. package/dist/types/index.d.ts.map +1 -0
  47. package/dist/types/index.js +18 -0
  48. package/dist/types/specific-resource-settings.d.ts +9 -0
  49. package/dist/types/specific-resource-settings.d.ts.map +1 -0
  50. package/dist/types/specific-resource-settings.js +2 -0
  51. package/package.json +34 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2014-present Sebastian McKenzie and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # LDSG Workflow Node Type
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=unit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../src/__tests__/unit.ts"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const handler_1 = require("@ldsg/handler");
4
+ const workflow_1 = require("@ldsg/workflow");
5
+ const resource_1 = require("../resource");
6
+ const handler = (params) => {
7
+ const { workflowNodeProperties } = params;
8
+ const { name } = workflowNodeProperties;
9
+ class AWorkflowNodeExecuter extends workflow_1.WorkflowNodeExecuter {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.execute = async () => {
13
+ const { setVariables } = this;
14
+ setVariables({
15
+ variables: name,
16
+ });
17
+ };
18
+ }
19
+ }
20
+ const res = {
21
+ Executer: AWorkflowNodeExecuter,
22
+ };
23
+ return res;
24
+ };
25
+ test("field type", () => {
26
+ new handler_1.HandlerResource({
27
+ id: "test-handler",
28
+ kind: "handler",
29
+ parentId: "root",
30
+ settings: {
31
+ title: "测试处理程序",
32
+ description: "",
33
+ code: "",
34
+ dependencies: [],
35
+ handler,
36
+ },
37
+ });
38
+ const workflowNodeTypeResource = new resource_1.WorkflowNodeTypeResource({
39
+ id: "test-workflow-node-type",
40
+ kind: "workflow_node_type",
41
+ parentId: "root",
42
+ settings: {
43
+ title: "文本",
44
+ description: "可用来存储各种文本",
45
+ workflowNodePropertiesSchema: {
46
+ type: "object",
47
+ properties: {
48
+ name: {
49
+ type: "string",
50
+ title: "名称",
51
+ description: "",
52
+ },
53
+ },
54
+ },
55
+ handlerResourceId: "test-handler",
56
+ },
57
+ });
58
+ const { extraWorkflowNodeInfo } = workflowNodeTypeResource.getExtraWorkflowNodeInfo({
59
+ workflowNodeProperties: {
60
+ name: "test",
61
+ },
62
+ });
63
+ expect(extraWorkflowNodeInfo).toMatchSnapshot();
64
+ const { Executer } = extraWorkflowNodeInfo;
65
+ const nodeIdToVariablesMap = new Map();
66
+ const executer = new Executer({
67
+ nodeId: "test-node",
68
+ nodeIdToVariablesMap,
69
+ });
70
+ executer.execute();
71
+ expect(executer.nodeIdToVariablesMap).toMatchSnapshot();
72
+ });
@@ -0,0 +1,13 @@
1
+ import { HandlerSpecificResourceSettings } from "@ldsg/handler";
2
+ import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
3
+ import { GeneralResourceSettings } from "@ldsg/types";
4
+ export declare const HANDLER_GENERAL_RESOURCE_SETTINGS: GeneralResourceSettings;
5
+ /**
6
+ * Handler Resource Settings
7
+ * 此类型资源的子级处理程序资源的配置
8
+ * 如无或为 undefined,则说明无需子级处理程序。
9
+ */
10
+ export declare const HANDLER_SPECIFIC_RESOURCE_SETTINGS: HandlerSpecificResourceSettings;
11
+ export declare const RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS: GeneralResourceSettings;
12
+ export declare const RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS: ResourceDefinitionSpecificResourceSettings;
13
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,eAAO,MAAM,iCAAiC,EAAE,uBAG/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BAQ9C,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBAIzD,CAAC;AAEJ,eAAO,MAAM,8CAA8C,EAAE,0CAI1D,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = exports.HANDLER_SPECIFIC_RESOURCE_SETTINGS = exports.HANDLER_GENERAL_RESOURCE_SETTINGS = void 0;
4
+ const constants_1 = require("@ldsg/constants");
5
+ exports.HANDLER_GENERAL_RESOURCE_SETTINGS = {
6
+ title: "工作流节点类型类型资源处理程序",
7
+ description: "",
8
+ };
9
+ /**
10
+ * Handler Resource Settings
11
+ * 此类型资源的子级处理程序资源的配置
12
+ * 如无或为 undefined,则说明无需子级处理程序。
13
+ */
14
+ exports.HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
15
+ code: `export * from "@ldsg/workflow-node-type";`,
16
+ dependencies: [
17
+ {
18
+ name: "@ldsg/workflow-node-type",
19
+ },
20
+ ],
21
+ };
22
+ exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = {
23
+ title: "工作流节点类型类型资源定义",
24
+ description: "",
25
+ };
26
+ exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
27
+ kind: "workflow_node_type",
28
+ parentKind: constants_1.ROOT_RESOURCE_KIND,
29
+ };
@@ -0,0 +1,8 @@
1
+ import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
2
+ import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
3
+ import { WorkflowNodeTypeResource } from "./resource";
4
+ import { WorkflowNodeTypeSpecificResourceSettings } from "./types";
5
+ export declare const handler: Handler<[
6
+ InstantiateResourceParams<HandlerExtendedResourceSettings<WorkflowNodeTypeSpecificResourceSettings>>
7
+ ], InstantiateResourceRes<WorkflowNodeTypeResource>>;
8
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC;AAEnE,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IACE,yBAAyB,CACvB,+BAA+B,CAAC,wCAAwC,CAAC,CAC1E;CACF,EACD,sBAAsB,CAAC,wBAAwB,CAAC,CAC3B,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handler = void 0;
4
+ const instantiate_resource_1 = require("./instantiate-resource");
5
+ exports.handler = instantiate_resource_1.instantiateResource;
@@ -0,0 +1,7 @@
1
+ export * from "./constants";
2
+ export * from "./handler";
3
+ export * from "./instantiate-resource";
4
+ export * from "./resource";
5
+ export * from "./resource-records";
6
+ export * from "./types";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
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("./constants"), exports);
18
+ __exportStar(require("./handler"), exports);
19
+ __exportStar(require("./instantiate-resource"), exports);
20
+ __exportStar(require("./resource"), exports);
21
+ __exportStar(require("./resource-records"), exports);
22
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,6 @@
1
+ import { HandlerExtendedResourceSettings } from "@ldsg/handler";
2
+ import { InstantiateResource } from "@ldsg/resource";
3
+ import { WorkflowNodeTypeResource } from "./resource";
4
+ import { WorkflowNodeTypeSpecificResourceSettings } from "./types";
5
+ export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<WorkflowNodeTypeSpecificResourceSettings>, WorkflowNodeTypeResource>;
6
+ //# sourceMappingURL=instantiate-resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instantiate-resource.d.ts","sourceRoot":"","sources":["../src/instantiate-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC;AAEnE,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CACnD,+BAA+B,CAAC,wCAAwC,CAAC,EACzE,wBAAwB,CAWzB,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.instantiateResource = void 0;
4
+ const resource_1 = require("./resource");
5
+ const instantiateResource = (params) => {
6
+ const { resourceConstructorParams } = params;
7
+ const resource = new resource_1.WorkflowNodeTypeResource(resourceConstructorParams);
8
+ const res = {
9
+ resource,
10
+ };
11
+ return res;
12
+ };
13
+ exports.instantiateResource = instantiateResource;
@@ -0,0 +1,2 @@
1
+ export declare const END_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID: string;
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/resource-records/end/handler/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0CAA0C,QAAqF,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.END_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID = void 0;
4
+ const workflow_1 = require("@ldsg/workflow");
5
+ exports.END_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID = `${workflow_1.SPECIFIC_WORKFLOW_NODE_TYPE_TO_WORKFLOW_NODE_TYPE_RESOURCE_ID_MAP.end}-handler`;
@@ -0,0 +1,4 @@
1
+ import { HandlerSpecificResourceSettings } from "@ldsg/handler";
2
+ import { ResourceRecord } from "@ldsg/types";
3
+ export declare const endWorkflowNodeTypeHandlerResourceRecord: ResourceRecord<HandlerSpecificResourceSettings>;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resource-records/end/handler/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,+BAA+B,EAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA6C7C,eAAO,MAAM,wCAAwC,EAAE,cAAc,CAAC,+BAA+B,CAYlG,CAAC"}
@@ -0,0 +1,47 @@
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.endWorkflowNodeTypeHandlerResourceRecord = void 0;
7
+ const constants_1 = require("@ldsg/constants");
8
+ const handler_1 = require("@ldsg/handler");
9
+ const workflow_1 = require("@ldsg/workflow");
10
+ const jsonata_1 = __importDefault(require("jsonata"));
11
+ const constants_2 = require("./constants");
12
+ function handler(params) {
13
+ const { workflowNodeProperties } = params;
14
+ const { output } = workflowNodeProperties;
15
+ const { jsonataStr } = output;
16
+ const expression = (0, jsonata_1.default)(jsonataStr);
17
+ class EndWorkflowNodeExecuter extends workflow_1.WorkflowNodeExecuter {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.execute = async () => {
21
+ const { setVariables, nodeIdToVariablesMap } = this;
22
+ const variables = await expression.evaluate({
23
+ nodeIdToVariablesMap: Object.fromEntries(nodeIdToVariablesMap),
24
+ });
25
+ setVariables({
26
+ variables,
27
+ });
28
+ };
29
+ }
30
+ }
31
+ const res = {
32
+ Executer: EndWorkflowNodeExecuter,
33
+ };
34
+ return res;
35
+ }
36
+ exports.endWorkflowNodeTypeHandlerResourceRecord = {
37
+ id: constants_2.END_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID,
38
+ kind: handler_1.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS.kind,
39
+ parentId: constants_1.ROOT_RESOURCE_ID,
40
+ settings: {
41
+ title: "结束工作流节点类型",
42
+ description: "",
43
+ code: "",
44
+ dependencies: [],
45
+ handler,
46
+ },
47
+ };
@@ -0,0 +1,5 @@
1
+ import { ResourceRecord } from "@ldsg/types";
2
+ import { WorkflowNodeTypeSpecificResourceSettings } from "../../types";
3
+ export * from "./handler";
4
+ export declare const endWorkflowNodeTypeResourceRecord: ResourceRecord<WorkflowNodeTypeSpecificResourceSettings>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,CAoBpG,CAAC"}
@@ -0,0 +1,42 @@
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
+ exports.endWorkflowNodeTypeResourceRecord = void 0;
18
+ const constants_1 = require("@ldsg/constants");
19
+ const workflow_1 = require("@ldsg/workflow");
20
+ const constants_2 = require("../../constants");
21
+ const constants_3 = require("./handler/constants");
22
+ __exportStar(require("./handler"), exports);
23
+ exports.endWorkflowNodeTypeResourceRecord = {
24
+ id: workflow_1.SPECIFIC_WORKFLOW_NODE_TYPE_TO_WORKFLOW_NODE_TYPE_RESOURCE_ID_MAP.end,
25
+ kind: constants_2.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS.kind,
26
+ parentId: constants_1.ROOT_RESOURCE_ID,
27
+ settings: {
28
+ title: "结束工作流节点类型",
29
+ description: "",
30
+ workflowNodePropertiesSchema: {
31
+ type: "object",
32
+ properties: {
33
+ output: {
34
+ type: "object",
35
+ properties: {},
36
+ additionalItems: true,
37
+ },
38
+ },
39
+ },
40
+ handlerResourceId: constants_3.END_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID,
41
+ },
42
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./end";
2
+ export * from "./start";
3
+ export declare const WORKFLOW_NODE_TYPE_RESOURCE_RECORDS: (import("@ldsg/types").ResourceRecord<import("@ldsg/handler").HandlerSpecificResourceSettings> | import("@ldsg/types").ResourceRecord<import("..").WorkflowNodeTypeSpecificResourceSettings>)[];
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resource-records/index.ts"],"names":[],"mappings":"AASA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,mCAAmC,iMAK/C,CAAC"}
@@ -0,0 +1,27 @@
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
+ exports.WORKFLOW_NODE_TYPE_RESOURCE_RECORDS = void 0;
18
+ const end_1 = require("./end");
19
+ const start_1 = require("./start");
20
+ __exportStar(require("./end"), exports);
21
+ __exportStar(require("./start"), exports);
22
+ exports.WORKFLOW_NODE_TYPE_RESOURCE_RECORDS = [
23
+ end_1.endWorkflowNodeTypeResourceRecord,
24
+ end_1.endWorkflowNodeTypeHandlerResourceRecord,
25
+ start_1.startWorkflowNodeTypeResourceRecord,
26
+ start_1.startWorkflowNodeTypeHandlerResourceRecord,
27
+ ];
@@ -0,0 +1,2 @@
1
+ export declare const START_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID: string;
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/resource-records/start/handler/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4CAA4C,QAAuF,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.START_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID = void 0;
4
+ const workflow_1 = require("@ldsg/workflow");
5
+ exports.START_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID = `${workflow_1.SPECIFIC_WORKFLOW_NODE_TYPE_TO_WORKFLOW_NODE_TYPE_RESOURCE_ID_MAP.start}-handler`;
@@ -0,0 +1,4 @@
1
+ import { HandlerSpecificResourceSettings } from "@ldsg/handler";
2
+ import { ResourceRecord } from "@ldsg/types";
3
+ export declare const startWorkflowNodeTypeHandlerResourceRecord: ResourceRecord<HandlerSpecificResourceSettings>;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resource-records/start/handler/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,+BAA+B,EAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoC7C,eAAO,MAAM,0CAA0C,EAAE,cAAc,CAAC,+BAA+B,CAYpG,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.startWorkflowNodeTypeHandlerResourceRecord = void 0;
4
+ const constants_1 = require("@ldsg/constants");
5
+ const handler_1 = require("@ldsg/handler");
6
+ const workflow_1 = require("@ldsg/workflow");
7
+ const constants_2 = require("./constants");
8
+ function handler(params) {
9
+ const { workflowNodeProperties } = params;
10
+ const { input } = workflowNodeProperties;
11
+ class StartWorkflowNodeExecuter extends workflow_1.WorkflowNodeExecuter {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.execute = () => {
15
+ const { setVariables, inputVariables } = this;
16
+ setVariables({
17
+ variables: inputVariables,
18
+ });
19
+ };
20
+ }
21
+ }
22
+ const res = {
23
+ Executer: StartWorkflowNodeExecuter,
24
+ };
25
+ return res;
26
+ }
27
+ exports.startWorkflowNodeTypeHandlerResourceRecord = {
28
+ id: constants_2.START_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID,
29
+ kind: handler_1.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS.kind,
30
+ parentId: constants_1.ROOT_RESOURCE_ID,
31
+ settings: {
32
+ title: "开始工作流节点类型",
33
+ description: "",
34
+ code: "",
35
+ dependencies: [],
36
+ handler,
37
+ },
38
+ };
@@ -0,0 +1,5 @@
1
+ import { ResourceRecord } from "@ldsg/types";
2
+ import { WorkflowNodeTypeSpecificResourceSettings } from "../../types";
3
+ export * from "./handler";
4
+ export declare const startWorkflowNodeTypeResourceRecord: ResourceRecord<WorkflowNodeTypeSpecificResourceSettings>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,CAoBtG,CAAC"}
@@ -0,0 +1,42 @@
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
+ exports.startWorkflowNodeTypeResourceRecord = void 0;
18
+ const constants_1 = require("@ldsg/constants");
19
+ const workflow_1 = require("@ldsg/workflow");
20
+ const constants_2 = require("../../constants");
21
+ const constants_3 = require("./handler/constants");
22
+ __exportStar(require("./handler"), exports);
23
+ exports.startWorkflowNodeTypeResourceRecord = {
24
+ id: workflow_1.SPECIFIC_WORKFLOW_NODE_TYPE_TO_WORKFLOW_NODE_TYPE_RESOURCE_ID_MAP.start,
25
+ kind: constants_2.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS.kind,
26
+ parentId: constants_1.ROOT_RESOURCE_ID,
27
+ settings: {
28
+ title: "开始",
29
+ description: "",
30
+ workflowNodePropertiesSchema: {
31
+ type: "object",
32
+ properties: {
33
+ input: {
34
+ type: "object",
35
+ properties: {},
36
+ additionalItems: true,
37
+ },
38
+ },
39
+ },
40
+ handlerResourceId: constants_3.START_WORKFLOW_NODE_TYPE_HANDLER_RESOURCE_ID,
41
+ },
42
+ };
@@ -0,0 +1,6 @@
1
+ import { HandlerExtendedResource } from "@ldsg/handler";
2
+ import { GetExtraWorkflowNodeInfo, WorkflowNodeTypeSpecificResourceSettings } from "./types";
3
+ export declare class WorkflowNodeTypeResource extends HandlerExtendedResource<WorkflowNodeTypeSpecificResourceSettings> {
4
+ getExtraWorkflowNodeInfo: GetExtraWorkflowNodeInfo;
5
+ }
6
+ //# sourceMappingURL=resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EACL,wBAAwB,EACxB,wCAAwC,EACzC,MAAM,SAAS,CAAC;AAEjB,qBAAa,wBAAyB,SAAQ,uBAAuB,CAAC,wCAAwC,CAAC;IAC7G,wBAAwB,EAAE,wBAAwB,CAiBhD;CACH"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkflowNodeTypeResource = void 0;
4
+ const handler_1 = require("@ldsg/handler");
5
+ class WorkflowNodeTypeResource extends handler_1.HandlerExtendedResource {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.getExtraWorkflowNodeInfo = (params) => {
9
+ var _a;
10
+ const { workflowNodeProperties } = params;
11
+ const { getExtendedHandlerOrUndefined } = this;
12
+ const extendedHandlerOrUndefined = getExtendedHandlerOrUndefined();
13
+ const extraWorkflowNodeInfo = (_a = extendedHandlerOrUndefined === null || extendedHandlerOrUndefined === void 0 ? void 0 : extendedHandlerOrUndefined({
14
+ workflowNodeProperties,
15
+ })) !== null && _a !== void 0 ? _a : {};
16
+ const res = {
17
+ extraWorkflowNodeInfo,
18
+ };
19
+ return res;
20
+ };
21
+ }
22
+ }
23
+ exports.WorkflowNodeTypeResource = WorkflowNodeTypeResource;
@@ -0,0 +1,16 @@
1
+ import { WorkflowNodeInfo } from "@ldsg/workflow";
2
+ export interface GetExtraWorkflowNodeInfoParams {
3
+ /**
4
+ * Workflow Node Properties
5
+ */
6
+ workflowNodeProperties: any;
7
+ }
8
+ export type ExtraWorkflowNodeInfo = Pick<WorkflowNodeInfo, "Executer">;
9
+ export interface GetExtraWorkflowNodeInfoRes {
10
+ /**
11
+ * Extra Workflow Node Info
12
+ */
13
+ extraWorkflowNodeInfo: ExtraWorkflowNodeInfo;
14
+ }
15
+ export type GetExtraWorkflowNodeInfo = (params: GetExtraWorkflowNodeInfoParams) => GetExtraWorkflowNodeInfoRes;
16
+ //# sourceMappingURL=extra-workflow-node-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extra-workflow-node-info.d.ts","sourceRoot":"","sources":["../../src/types/extra-workflow-node-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,sBAAsB,EAAE,GAAG,CAAC;CAC7B;AAED,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,qBAAqB,EAAE,qBAAqB,CAAC;CAC9C;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,MAAM,EAAE,8BAA8B,KACnC,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from "./extra-workflow-node-info";
2
+ export * from "./specific-resource-settings";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
@@ -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("./extra-workflow-node-info"), exports);
18
+ __exportStar(require("./specific-resource-settings"), exports);
@@ -0,0 +1,9 @@
1
+ import { SpecificResourceSettings } from "@ldsg/types";
2
+ import { JSONSchema7 } from "json-schema";
3
+ export interface WorkflowNodeTypeSpecificResourceSettings extends SpecificResourceSettings {
4
+ /**
5
+ * Workflow Node Properties Schema
6
+ */
7
+ workflowNodePropertiesSchema: JSONSchema7;
8
+ }
9
+ //# sourceMappingURL=specific-resource-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,wCACf,SAAQ,wBAAwB;IAChC;;OAEG;IACH,4BAA4B,EAAE,WAAW,CAAC;CAC3C"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@ldsg/workflow-node-type",
3
+ "version": "0.2.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist/"
8
+ ],
9
+ "types": "dist",
10
+ "keywords": [],
11
+ "author": "wanxger",
12
+ "license": "MIT",
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "dependencies": {
17
+ "json-schema": "0.4.0",
18
+ "jsonata": "^2.0.6",
19
+ "lodash": "^4.17.21",
20
+ "@ldsg/handler": "0.2.0",
21
+ "@ldsg/resource": "0.2.0",
22
+ "@ldsg/workflow": "0.2.0",
23
+ "@ldsg/resource-definition": "0.2.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/json-schema": "^7.0.15",
27
+ "@types/lodash": "^4.14.202",
28
+ "@ldsg/types": "0.2.0"
29
+ },
30
+ "scripts": {
31
+ "build": "pnpm clean && tsc --project tsconfig.build.json",
32
+ "clean": "rm -rf dist"
33
+ }
34
+ }