@ldsg/workflow 0.3.9 → 0.3.10

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 (45) hide show
  1. package/dist/__tests__/unit/resource.js +62 -61
  2. package/dist/constants.d.ts +3 -3
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +11 -11
  5. package/dist/handler.d.ts +5 -7
  6. package/dist/handler.d.ts.map +1 -1
  7. package/dist/index.d.ts +5 -5
  8. package/dist/instantiate-resource.d.ts +4 -4
  9. package/dist/instantiate-resource.js +1 -1
  10. package/dist/resource.d.ts +2 -2
  11. package/dist/resource.d.ts.map +1 -1
  12. package/dist/resource.js +30 -30
  13. package/dist/types/index.d.ts +6 -6
  14. package/dist/types/json_schema_with_expression_extension.d.ts +8 -6
  15. package/dist/types/json_schema_with_expression_extension.d.ts.map +1 -1
  16. package/dist/types/node.d.ts +11 -11
  17. package/dist/types/node.d.ts.map +1 -1
  18. package/dist/types/specific-resource-settings.d.ts +1 -1
  19. package/dist/types/specific-resource-settings.d.ts.map +1 -1
  20. package/dist/types/workflow.d.ts +7 -3
  21. package/dist/types/workflow.d.ts.map +1 -1
  22. package/dist/utils/evaluate-variables/constants.d.ts.map +1 -1
  23. package/dist/utils/evaluate-variables/constants.js +17 -17
  24. package/dist/utils/evaluate-variables/index.d.ts +2 -2
  25. package/dist/utils/evaluate-variables/index.d.ts.map +1 -1
  26. package/dist/utils/evaluate-variables/index.debug.d.ts +2 -0
  27. package/dist/utils/evaluate-variables/index.debug.d.ts.map +1 -0
  28. package/dist/utils/evaluate-variables/index.debug.js +194 -0
  29. package/dist/utils/evaluate-variables/index.js +5 -5
  30. package/dist/utils/evaluate-variables/index.test.js +98 -98
  31. package/dist/utils/evaluate-variables/utils/get-data-with-json-schema-and-input/index.d.ts +21 -0
  32. package/dist/utils/evaluate-variables/utils/get-data-with-json-schema-and-input/index.d.ts.map +1 -0
  33. package/dist/utils/evaluate-variables/utils/get-data-with-json-schema-and-input/index.js +17 -0
  34. package/dist/utils/evaluate-variables/utils/{resolve-json-schema.d.ts → get-data-with-json-schema-and-input/resolve-json-schema.d.ts} +10 -7
  35. package/dist/utils/evaluate-variables/utils/get-data-with-json-schema-and-input/resolve-json-schema.d.ts.map +1 -0
  36. package/dist/utils/evaluate-variables/utils/get-data-with-json-schema-and-input/resolve-json-schema.js +73 -0
  37. package/dist/utils/evaluate-variables/utils/get-field-path-by-field-type-key.d.ts.map +1 -1
  38. package/dist/utils/evaluate-variables/utils/get-field-path-by-field-type-key.js +3 -3
  39. package/dist/utils/get-execution-levels.d.ts +1 -1
  40. package/dist/utils/get-execution-levels.d.ts.map +1 -1
  41. package/dist/utils/get-execution-levels.js +5 -5
  42. package/dist/utils/get-execution-levels.test.js +86 -86
  43. package/package.json +22 -13
  44. package/dist/utils/evaluate-variables/utils/resolve-json-schema.d.ts.map +0 -1
  45. package/dist/utils/evaluate-variables/utils/resolve-json-schema.js +0 -112
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/evaluate-variables/constants.ts"],"names":[],"mappings":"AAEA,UAAU,qCAAqC;IAC7C;;OAEG;IACH,oBAAoB,EAAE,GAAG,CAAC;IAE1B;;;OAGG;IACH,KAAK,EAAE,GAAG,CAAC;IAEX;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAG3B;AAED,MAAM,WAAW,kCAAkC;IACjD,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,EAAE,GAAG,CAAC;IAEd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,KAAK,+BAA+B,GAAG,CACrC,MAAM,EAAE,qCAAqC,KAE3C,OAAO,CAAC,kCAAkC,CAAC,GAC3C,kCAAkC,CAAC;AAEvC;;GAEG;AACH,UAAU,yBAAyB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,+BAA+B,CAAC;CACzC;AAqCD;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,yBAAyB,EAuCpE,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/evaluate-variables/constants.ts"],"names":[],"mappings":"AAEA,UAAU,qCAAqC;IAC7C;;OAEG;IACH,oBAAoB,EAAE,GAAG,CAAC;IAE1B;;;OAGG;IACH,KAAK,EAAE,GAAG,CAAC;IAEX;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAG3B;AAED,MAAM,WAAW,kCAAkC;IACjD,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,EAAE,GAAG,CAAC;IAEd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,KAAK,+BAA+B,GAAG,CACrC,MAAM,EAAE,qCAAqC,KAC1C,OAAO,CAAC,kCAAkC,CAAC,GAAG,kCAAkC,CAAC;AAEtF;;GAEG;AACH,UAAU,yBAAyB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,+BAA+B,CAAC;CACzC;AAqCD;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,yBAAyB,EAuCpE,CAAC"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FIELD_VALUE_RETRIEVAL_METHODS = void 0;
7
7
  const jsonata_1 = __importDefault(require("jsonata"));
8
8
  const expressionHandle = async (params) => {
9
- const { input, retrievalMethodValue, returnExpressionAsData, objectExpression,
9
+ const { input, retrievalMethodValue, returnExpressionAsData, objectExpression
10
10
  // expressionMayContainObject
11
11
  } = params;
12
12
  /**
@@ -14,17 +14,17 @@ const expressionHandle = async (params) => {
14
14
  */
15
15
  if (returnExpressionAsData) {
16
16
  return {
17
- expression: retrievalMethodValue,
17
+ expression: retrievalMethodValue
18
18
  };
19
19
  }
20
20
  let jsonataStr = retrievalMethodValue;
21
21
  if (objectExpression) {
22
- jsonataStr = retrievalMethodValue.replace("{}", objectExpression);
22
+ jsonataStr = retrievalMethodValue.replace('{}', objectExpression);
23
23
  }
24
24
  const expression = (0, jsonata_1.default)(jsonataStr);
25
25
  const data = await expression.evaluate(input);
26
26
  const res = {
27
- data,
27
+ data
28
28
  };
29
29
  return res;
30
30
  };
@@ -33,37 +33,37 @@ const expressionHandle = async (params) => {
33
33
  */
34
34
  exports.FIELD_VALUE_RETRIEVAL_METHODS = [
35
35
  {
36
- name: "const",
36
+ name: 'const',
37
37
  handle: (params) => {
38
38
  const { retrievalMethodValue } = params;
39
39
  const res = {
40
40
  const: retrievalMethodValue,
41
- data: retrievalMethodValue,
41
+ data: retrievalMethodValue
42
42
  };
43
43
  return res;
44
- },
44
+ }
45
45
  },
46
46
  {
47
- name: "x-expression-const",
48
- handle: expressionHandle,
47
+ name: 'x-expression-const',
48
+ handle: expressionHandle
49
49
  },
50
50
  {
51
- name: "x-expression",
52
- handle: expressionHandle,
51
+ name: 'x-expression',
52
+ handle: expressionHandle
53
53
  },
54
54
  {
55
- name: "x-expression-default",
56
- handle: expressionHandle,
55
+ name: 'x-expression-default',
56
+ handle: expressionHandle
57
57
  },
58
58
  {
59
- name: "default",
59
+ name: 'default',
60
60
  handle: (params) => {
61
61
  const { retrievalMethodValue } = params;
62
62
  const res = {
63
63
  default: retrievalMethodValue,
64
- data: retrievalMethodValue,
64
+ data: retrievalMethodValue
65
65
  };
66
66
  return res;
67
- },
68
- },
67
+ }
68
+ }
69
69
  ];
@@ -1,6 +1,6 @@
1
- import { JSONSchema7 } from "json-schema";
1
+ import { JSONSchemaWithExpressionExtension } from '../../types';
2
2
  interface EvaluateVariablesParams {
3
- jsonSchema: JSONSchema7;
3
+ jsonSchema: JSONSchemaWithExpressionExtension;
4
4
  variables: any;
5
5
  }
6
6
  interface EvaluateVariablesRes {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/evaluate-variables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,UAAU,uBAAuB;IAC/B,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,UAAU,oBAAoB;IAC5B,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,KAAK,iBAAiB,GAAG,CACvB,MAAM,EAAE,uBAAuB,KAC5B,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAEnC,eAAO,MAAM,iBAAiB,EAAE,iBAe/B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/evaluate-variables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAGhE,UAAU,uBAAuB;IAC/B,UAAU,EAAE,iCAAiC,CAAC;IAC9C,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,UAAU,oBAAoB;IAC5B,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,KAAK,iBAAiB,GAAG,CAAC,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE5F,eAAO,MAAM,iBAAiB,EAAE,iBAe/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.debug.d.ts","sourceRoot":"","sources":["../../../src/utils/evaluate-variables/index.debug.ts"],"names":[],"mappings":""}
@@ -0,0 +1,194 @@
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
+ const fs_extra_1 = __importDefault(require("fs-extra"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const _1 = require(".");
9
+ const input = {
10
+ Account: {
11
+ 'Account Name': 'Firefly',
12
+ Order: [
13
+ {
14
+ OrderID: 'order103',
15
+ Product: [
16
+ {
17
+ 'Product Name': 'Bowler Hat',
18
+ ProductID: 858383,
19
+ SKU: '0406654608',
20
+ Description: {
21
+ Colour: 'Purple',
22
+ Width: 300,
23
+ Height: 200,
24
+ Depth: 210,
25
+ Weight: 0.75
26
+ },
27
+ Price: 34.45,
28
+ Quantity: 2
29
+ },
30
+ {
31
+ 'Product Name': 'Trilby hat',
32
+ ProductID: 858236,
33
+ SKU: '0406634348',
34
+ Description: {
35
+ Colour: 'Orange',
36
+ Width: 300,
37
+ Height: 200,
38
+ Depth: 210,
39
+ Weight: 0.6
40
+ },
41
+ Price: 21.67,
42
+ Quantity: 1
43
+ }
44
+ ]
45
+ },
46
+ {
47
+ OrderID: 'order104',
48
+ Product: [
49
+ {
50
+ 'Product Name': 'Bowler Hat',
51
+ ProductID: 858383,
52
+ SKU: '040657863',
53
+ Description: {
54
+ Colour: 'Purple',
55
+ Width: 300,
56
+ Height: 200,
57
+ Depth: 210,
58
+ Weight: 0.75
59
+ },
60
+ Price: 34.45,
61
+ Quantity: 4
62
+ },
63
+ {
64
+ ProductID: 345664,
65
+ SKU: '0406654603',
66
+ 'Product Name': 'Cloak',
67
+ Description: {
68
+ Colour: 'Black',
69
+ Width: 30,
70
+ Height: 20,
71
+ Depth: 210,
72
+ Weight: 2
73
+ },
74
+ Price: 107.99,
75
+ Quantity: 1
76
+ }
77
+ ]
78
+ }
79
+ ]
80
+ }
81
+ };
82
+ const subJsonSchema = {
83
+ type: 'object',
84
+ properties: {
85
+ CurrentAccount: {
86
+ type: 'string',
87
+ /**
88
+ * 从默认值内取值
89
+ */
90
+ default: 'Current Account',
91
+ const: 'Current Account'
92
+ },
93
+ type: {
94
+ type: 'string',
95
+ default: 'order',
96
+ const: 'order'
97
+ },
98
+ AccountName: {
99
+ type: 'string',
100
+ /**
101
+ * 根据 jsonata 取值
102
+ */
103
+ 'x-expression': `Account."Account Name"`
104
+ },
105
+ CurrentOrder: {
106
+ type: 'string',
107
+ /**
108
+ * 根据 jsonata 取值
109
+ */
110
+ 'x-expression': `"Current Order"`
111
+ },
112
+ OrderPrice: {
113
+ type: 'number',
114
+ 'x-expression': '$sum(Account.Order.Product.(Price * Quantity))'
115
+ },
116
+ ProductIds: {
117
+ type: 'array',
118
+ items: {
119
+ type: 'number'
120
+ },
121
+ 'x-expression': 'Account.Order.Product.ProductID'
122
+ },
123
+ ordersWithProductIds: {
124
+ type: 'array',
125
+ title: '具有产品 ID 的订单列表',
126
+ items: {
127
+ type: 'object',
128
+ properties: {
129
+ CurrentOrdersWithProductIdsTitle: {
130
+ type: 'string',
131
+ /**
132
+ * 从默认值内取值
133
+ */
134
+ default: 'CurrentOrdersWithProductIdsTitle',
135
+ const: 'CurrentOrdersWithProductIdsTitle'
136
+ },
137
+ productIds: {
138
+ type: 'array',
139
+ items: {
140
+ type: 'number'
141
+ },
142
+ 'x-expression': '$v.Product.ProductID'
143
+ },
144
+ AccountName: {
145
+ type: 'string',
146
+ /**
147
+ * 根据 jsonata 取值
148
+ */
149
+ 'x-expression': `Account."Account Name"`
150
+ },
151
+ orderId: {
152
+ type: 'string',
153
+ 'x-expression': '$v.OrderID'
154
+ }
155
+ }
156
+ },
157
+ 'x-expression': '$map($.Account.Order, function($v, $i, $a) {{}})'
158
+ }
159
+ }
160
+ };
161
+ const jsonSchema = {
162
+ type: 'object',
163
+ properties: {
164
+ ...subJsonSchema.properties,
165
+ nestd: {
166
+ type: 'object',
167
+ properties: {
168
+ ...subJsonSchema.properties,
169
+ nestd: {
170
+ type: 'object',
171
+ properties: {
172
+ ...subJsonSchema.properties,
173
+ nestd: {
174
+ type: 'object',
175
+ properties: {
176
+ ...subJsonSchema.properties
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+ }
184
+ };
185
+ const main = async () => {
186
+ const evaluateVariablesRes = await (0, _1.evaluateVariables)({
187
+ jsonSchema,
188
+ variables: input
189
+ });
190
+ await fs_extra_1.default.writeJson(path_1.default.resolve(__dirname, 'evaluate-variables-res.json'), evaluateVariablesRes, {
191
+ spaces: 2
192
+ });
193
+ };
194
+ main();
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.evaluateVariables = void 0;
4
- const resolve_json_schema_1 = require("./utils/resolve-json-schema");
4
+ const get_data_with_json_schema_and_input_1 = require("./utils/get-data-with-json-schema-and-input");
5
5
  const evaluateVariables = async (params) => {
6
6
  const { jsonSchema, variables: paramsVariables } = params;
7
- const resolveJsonSchemaRes = await (0, resolve_json_schema_1.resolveJsonSchema)({
7
+ const getDataWithJsonSchemaAndInputRes = await (0, get_data_with_json_schema_and_input_1.getDataWithJsonSchemaAndInput)({
8
8
  jsonSchema,
9
- input: paramsVariables,
9
+ input: paramsVariables
10
10
  });
11
- const variables = JSON.parse(JSON.stringify(resolveJsonSchemaRes.data));
11
+ const variables = getDataWithJsonSchemaAndInputRes.data;
12
12
  const res = {
13
- variables,
13
+ variables
14
14
  };
15
15
  return res;
16
16
  };
@@ -3,217 +3,217 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const _1 = require(".");
4
4
  const input = {
5
5
  Account: {
6
- "Account Name": "Firefly",
6
+ 'Account Name': 'Firefly',
7
7
  Order: [
8
8
  {
9
- OrderID: "order103",
9
+ OrderID: 'order103',
10
10
  Product: [
11
11
  {
12
- "Product Name": "Bowler Hat",
12
+ 'Product Name': 'Bowler Hat',
13
13
  ProductID: 858383,
14
- SKU: "0406654608",
14
+ SKU: '0406654608',
15
15
  Description: {
16
- Colour: "Purple",
16
+ Colour: 'Purple',
17
17
  Width: 300,
18
18
  Height: 200,
19
19
  Depth: 210,
20
- Weight: 0.75,
20
+ Weight: 0.75
21
21
  },
22
22
  Price: 34.45,
23
- Quantity: 2,
23
+ Quantity: 2
24
24
  },
25
25
  {
26
- "Product Name": "Trilby hat",
26
+ 'Product Name': 'Trilby hat',
27
27
  ProductID: 858236,
28
- SKU: "0406634348",
28
+ SKU: '0406634348',
29
29
  Description: {
30
- Colour: "Orange",
30
+ Colour: 'Orange',
31
31
  Width: 300,
32
32
  Height: 200,
33
33
  Depth: 210,
34
- Weight: 0.6,
34
+ Weight: 0.6
35
35
  },
36
36
  Price: 21.67,
37
- Quantity: 1,
38
- },
39
- ],
37
+ Quantity: 1
38
+ }
39
+ ]
40
40
  },
41
41
  {
42
- OrderID: "order104",
42
+ OrderID: 'order104',
43
43
  Product: [
44
44
  {
45
- "Product Name": "Bowler Hat",
45
+ 'Product Name': 'Bowler Hat',
46
46
  ProductID: 858383,
47
- SKU: "040657863",
47
+ SKU: '040657863',
48
48
  Description: {
49
- Colour: "Purple",
49
+ Colour: 'Purple',
50
50
  Width: 300,
51
51
  Height: 200,
52
52
  Depth: 210,
53
- Weight: 0.75,
53
+ Weight: 0.75
54
54
  },
55
55
  Price: 34.45,
56
- Quantity: 4,
56
+ Quantity: 4
57
57
  },
58
58
  {
59
59
  ProductID: 345664,
60
- SKU: "0406654603",
61
- "Product Name": "Cloak",
60
+ SKU: '0406654603',
61
+ 'Product Name': 'Cloak',
62
62
  Description: {
63
- Colour: "Black",
63
+ Colour: 'Black',
64
64
  Width: 30,
65
65
  Height: 20,
66
66
  Depth: 210,
67
- Weight: 2,
67
+ Weight: 2
68
68
  },
69
69
  Price: 107.99,
70
- Quantity: 1,
71
- },
72
- ],
73
- },
74
- ],
75
- },
70
+ Quantity: 1
71
+ }
72
+ ]
73
+ }
74
+ ]
75
+ }
76
76
  };
77
77
  const subJsonSchema = {
78
- type: "object",
78
+ type: 'object',
79
79
  properties: {
80
80
  CurrentAccount: {
81
- type: "string",
81
+ type: 'string',
82
82
  /**
83
83
  * 从默认值内取值
84
84
  */
85
- default: "Current Account",
86
- const: "Current Account",
85
+ default: 'Current Account',
86
+ const: 'Current Account'
87
87
  },
88
88
  type: {
89
- type: "string",
90
- default: "order",
89
+ type: 'string',
90
+ default: 'order'
91
91
  },
92
92
  AccountName: {
93
- type: "string",
93
+ type: 'string',
94
94
  /**
95
95
  * 根据 jsonata 取值
96
96
  */
97
- "x-expression": `Account."Account Name"`,
97
+ 'x-expression': `Account."Account Name"`
98
98
  },
99
99
  CurrentOrder: {
100
- type: "string",
100
+ type: 'string',
101
101
  /**
102
102
  * 根据 jsonata 取值
103
103
  */
104
- "x-expression": `"Current Order"`,
104
+ 'x-expression': `"Current Order"`
105
105
  },
106
106
  OrderPrice: {
107
- type: "number",
108
- "x-expression": "$sum(Account.Order.Product.(Price * Quantity))",
107
+ type: 'number',
108
+ 'x-expression': '$sum(Account.Order.Product.(Price * Quantity))'
109
109
  },
110
110
  ProductIds: {
111
- type: "array",
111
+ type: 'array',
112
112
  items: {
113
- type: "number",
113
+ type: 'number'
114
114
  },
115
- "x-expression": "Account.Order.Product.ProductID",
115
+ 'x-expression': 'Account.Order.Product.ProductID'
116
116
  },
117
117
  ordersWithProductIds: {
118
- type: "array",
119
- title: "具有产品 ID 的订单列表",
118
+ type: 'array',
119
+ title: '具有产品 ID 的订单列表',
120
120
  items: {
121
- type: "object",
121
+ type: 'object',
122
122
  properties: {
123
123
  CurrentOrdersWithProductIdsTitle: {
124
- type: "string",
124
+ type: 'string',
125
125
  /**
126
126
  * 从默认值内取值
127
127
  */
128
- default: "CurrentOrdersWithProductIdsTitle",
129
- const: "CurrentOrdersWithProductIdsTitle",
128
+ default: 'CurrentOrdersWithProductIdsTitle',
129
+ const: 'CurrentOrdersWithProductIdsTitle'
130
130
  },
131
131
  productIds: {
132
- type: "array",
132
+ type: 'array',
133
133
  items: {
134
- type: "number",
134
+ type: 'number'
135
135
  },
136
- "x-expression": "$v.Product.ProductID",
136
+ 'x-expression': '$v.Product.ProductID'
137
137
  },
138
138
  AccountName: {
139
- type: "string",
139
+ type: 'string',
140
140
  /**
141
141
  * 根据 jsonata 取值
142
142
  */
143
- "x-expression": `Account."Account Name"`,
143
+ 'x-expression': `Account."Account Name"`
144
144
  },
145
145
  orderId: {
146
- type: "string",
147
- "x-expression": "$v.OrderID",
148
- },
149
- },
146
+ type: 'string',
147
+ 'x-expression': '$v.OrderID'
148
+ }
149
+ }
150
150
  },
151
- "x-expression": "$map($.Account.Order, function($v, $i, $a) {{}})",
152
- },
153
- },
151
+ 'x-expression': '$map($.Account.Order, function($v, $i, $a) {{}})'
152
+ }
153
+ }
154
154
  };
155
155
  const jsonSchema = {
156
- type: "object",
156
+ type: 'object',
157
157
  properties: {
158
158
  ...subJsonSchema.properties,
159
159
  nestd: {
160
- type: "object",
160
+ type: 'object',
161
161
  properties: {
162
162
  ...subJsonSchema.properties,
163
163
  nestd: {
164
- type: "object",
164
+ type: 'object',
165
165
  properties: {
166
166
  ...subJsonSchema.properties,
167
167
  nestd: {
168
- type: "object",
168
+ type: 'object',
169
169
  properties: {
170
- ...subJsonSchema.properties,
171
- },
172
- },
173
- },
174
- },
175
- },
176
- },
177
- },
170
+ ...subJsonSchema.properties
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
178
  };
179
- test("evaluate variables", async () => {
179
+ test('evaluate variables', async () => {
180
180
  const evaluateVariablesRes = await (0, _1.evaluateVariables)({
181
181
  jsonSchema,
182
- variables: input,
182
+ variables: input
183
183
  });
184
184
  const expectedObject = {
185
185
  variables: {
186
- CurrentAccount: "Current Account",
187
- type: "order",
188
- AccountName: "Firefly",
189
- CurrentOrder: "Current Order",
186
+ CurrentAccount: 'Current Account',
187
+ type: 'order',
188
+ AccountName: 'Firefly',
189
+ CurrentOrder: 'Current Order',
190
190
  OrderPrice: 336.36,
191
191
  ProductIds: [858383, 858236, 858383, 345664],
192
192
  nestd: {
193
- CurrentAccount: "Current Account",
194
- type: "order",
195
- AccountName: "Firefly",
196
- CurrentOrder: "Current Order",
193
+ CurrentAccount: 'Current Account',
194
+ type: 'order',
195
+ AccountName: 'Firefly',
196
+ CurrentOrder: 'Current Order',
197
197
  OrderPrice: 336.36,
198
198
  ProductIds: [858383, 858236, 858383, 345664],
199
199
  nestd: {
200
- CurrentAccount: "Current Account",
201
- type: "order",
202
- AccountName: "Firefly",
203
- CurrentOrder: "Current Order",
200
+ CurrentAccount: 'Current Account',
201
+ type: 'order',
202
+ AccountName: 'Firefly',
203
+ CurrentOrder: 'Current Order',
204
204
  OrderPrice: 336.36,
205
205
  ProductIds: [858383, 858236, 858383, 345664],
206
206
  nestd: {
207
- CurrentAccount: "Current Account",
208
- type: "order",
209
- AccountName: "Firefly",
210
- CurrentOrder: "Current Order",
207
+ CurrentAccount: 'Current Account',
208
+ type: 'order',
209
+ AccountName: 'Firefly',
210
+ CurrentOrder: 'Current Order',
211
211
  OrderPrice: 336.36,
212
- ProductIds: [858383, 858236, 858383, 345664],
213
- },
214
- },
215
- },
216
- },
212
+ ProductIds: [858383, 858236, 858383, 345664]
213
+ }
214
+ }
215
+ }
216
+ }
217
217
  };
218
218
  expect(evaluateVariablesRes).toMatchObject(expectedObject);
219
219
  });
@@ -0,0 +1,21 @@
1
+ import { JSONSchemaWithExpressionExtension } from '../../../../types';
2
+ interface GetDataWithJsonSchemaAndInputParams {
3
+ /**
4
+ * 输入
5
+ */
6
+ input: any;
7
+ /**
8
+ * json schema
9
+ */
10
+ jsonSchema: JSONSchemaWithExpressionExtension;
11
+ }
12
+ interface GetDataWithJsonSchemaAndInputRes {
13
+ /**
14
+ * 数据
15
+ */
16
+ data?: any;
17
+ }
18
+ type GetDataWithJsonSchemaAndInput = (params: GetDataWithJsonSchemaAndInputParams) => Promise<GetDataWithJsonSchemaAndInputRes>;
19
+ export declare const getDataWithJsonSchemaAndInput: GetDataWithJsonSchemaAndInput;
20
+ export {};
21
+ //# sourceMappingURL=index.d.ts.map