@servicenow/sdk-build-plugins 4.2.0 → 4.4.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/acl-plugin.js +11 -0
- package/dist/acl-plugin.js.map +1 -1
- package/dist/applicability-plugin.d.ts +2 -0
- package/dist/applicability-plugin.js +72 -0
- package/dist/applicability-plugin.js.map +1 -0
- package/dist/atf/test-plugin.js +5 -2
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +7 -1
- package/dist/basic-syntax-plugin.js.map +1 -1
- package/dist/business-rule-plugin.js +1 -0
- package/dist/business-rule-plugin.js.map +1 -1
- package/dist/call-expression-plugin.js +1 -107
- package/dist/call-expression-plugin.js.map +1 -1
- package/dist/column/column-to-record.d.ts +10 -3
- package/dist/column/column-to-record.js +44 -7
- package/dist/column/column-to-record.js.map +1 -1
- package/dist/column-plugin.d.ts +3 -1
- package/dist/column-plugin.js +12 -12
- package/dist/column-plugin.js.map +1 -1
- package/dist/dashboard/dashboard-component-property-defaults.d.ts +152 -0
- package/dist/dashboard/dashboard-component-property-defaults.js +264 -0
- package/dist/dashboard/dashboard-component-property-defaults.js.map +1 -0
- package/dist/dashboard/dashboard-component-resolver.d.ts +13 -0
- package/dist/dashboard/dashboard-component-resolver.js +69 -0
- package/dist/dashboard/dashboard-component-resolver.js.map +1 -0
- package/dist/dashboard/dashboard-plugin.d.ts +12 -0
- package/dist/dashboard/dashboard-plugin.js +397 -0
- package/dist/dashboard/dashboard-plugin.js.map +1 -0
- package/dist/data-plugin.d.ts +3 -0
- package/dist/data-plugin.js +61 -113
- package/dist/data-plugin.js.map +1 -1
- package/dist/email-notification-plugin.d.ts +2 -0
- package/dist/email-notification-plugin.js +541 -0
- package/dist/email-notification-plugin.js.map +1 -0
- package/dist/flow/constants/flow-plugin-constants.d.ts +58 -0
- package/dist/flow/constants/flow-plugin-constants.js +70 -0
- package/dist/flow/constants/flow-plugin-constants.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-constants.d.ts +38 -0
- package/dist/flow/flow-logic/flow-logic-constants.js +118 -0
- package/dist/flow/flow-logic/flow-logic-constants.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-diagnostics.d.ts +19 -0
- package/dist/flow/flow-logic/flow-logic-diagnostics.js +503 -0
- package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +62 -0
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +2092 -0
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-plugin.d.ts +52 -0
- package/dist/flow/flow-logic/flow-logic-plugin.js +283 -0
- package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-shapes.d.ts +104 -0
- package/dist/flow/flow-logic/flow-logic-shapes.js +201 -0
- package/dist/flow/flow-logic/flow-logic-shapes.js.map +1 -0
- package/dist/flow/plugins/approval-rules-plugin.d.ts +2 -0
- package/dist/flow/plugins/approval-rules-plugin.js +49 -0
- package/dist/flow/plugins/approval-rules-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-action-definition-plugin.d.ts +2 -0
- package/dist/flow/plugins/flow-action-definition-plugin.js +286 -0
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-data-pill-plugin.d.ts +9 -0
- package/dist/flow/plugins/flow-data-pill-plugin.js +212 -0
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-definition-plugin.d.ts +2 -0
- package/dist/flow/plugins/flow-definition-plugin.js +1668 -0
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +26 -0
- package/dist/flow/plugins/flow-diagnostics-plugin.js +217 -0
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-instance-plugin.d.ts +12 -0
- package/dist/flow/plugins/flow-instance-plugin.js +1205 -0
- package/dist/flow/plugins/flow-instance-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.d.ts +2 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.js +338 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -0
- package/dist/flow/plugins/inline-script-plugin.d.ts +39 -0
- package/dist/flow/plugins/inline-script-plugin.js +80 -0
- package/dist/flow/plugins/inline-script-plugin.js.map +1 -0
- package/dist/flow/plugins/step-definition-plugin.d.ts +5 -0
- package/dist/flow/plugins/step-definition-plugin.js +71 -0
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -0
- package/dist/flow/plugins/step-instance-plugin.d.ts +31 -0
- package/dist/flow/plugins/step-instance-plugin.js +339 -0
- package/dist/flow/plugins/step-instance-plugin.js.map +1 -0
- package/dist/flow/plugins/trigger-plugin.d.ts +2 -0
- package/dist/flow/plugins/trigger-plugin.js +96 -0
- package/dist/flow/plugins/trigger-plugin.js.map +1 -0
- package/dist/flow/plugins/wfa-datapill-plugin.d.ts +15 -0
- package/dist/flow/plugins/wfa-datapill-plugin.js +178 -0
- package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -0
- package/dist/flow/utils/approval-rules-processor.d.ts +13 -0
- package/dist/flow/utils/approval-rules-processor.js +267 -0
- package/dist/flow/utils/approval-rules-processor.js.map +1 -0
- package/dist/flow/utils/built-in-complex-objects.d.ts +19 -0
- package/dist/flow/utils/built-in-complex-objects.js +62 -0
- package/dist/flow/utils/built-in-complex-objects.js.map +1 -0
- package/dist/flow/utils/complex-object-resolver.d.ts +8 -0
- package/dist/flow/utils/complex-object-resolver.js +614 -0
- package/dist/flow/utils/complex-object-resolver.js.map +1 -0
- package/dist/flow/utils/complex-objects.d.ts +36 -0
- package/dist/flow/utils/complex-objects.js +481 -0
- package/dist/flow/utils/complex-objects.js.map +1 -0
- package/dist/flow/utils/data-pill-shapes.d.ts +58 -0
- package/dist/flow/utils/data-pill-shapes.js +135 -0
- package/dist/flow/utils/data-pill-shapes.js.map +1 -0
- package/dist/flow/utils/datapill-transformer.d.ts +110 -0
- package/dist/flow/utils/datapill-transformer.js +503 -0
- package/dist/flow/utils/datapill-transformer.js.map +1 -0
- package/dist/flow/utils/flow-constants.d.ts +72 -0
- package/dist/flow/utils/flow-constants.js +230 -0
- package/dist/flow/utils/flow-constants.js.map +1 -0
- package/dist/flow/utils/flow-io-to-record.d.ts +44 -0
- package/dist/flow/utils/flow-io-to-record.js +409 -0
- package/dist/flow/utils/flow-io-to-record.js.map +1 -0
- package/dist/flow/utils/flow-shapes.d.ts +161 -0
- package/dist/flow/utils/flow-shapes.js +255 -0
- package/dist/flow/utils/flow-shapes.js.map +1 -0
- package/dist/flow/utils/flow-to-xml.d.ts +16 -0
- package/dist/flow/utils/flow-to-xml.js +237 -0
- package/dist/flow/utils/flow-to-xml.js.map +1 -0
- package/dist/flow/utils/flow-variable-processor.d.ts +51 -0
- package/dist/flow/utils/flow-variable-processor.js +69 -0
- package/dist/flow/utils/flow-variable-processor.js.map +1 -0
- package/dist/flow/utils/label-cache-parser.d.ts +7 -0
- package/dist/flow/utils/label-cache-parser.js +24 -0
- package/dist/flow/utils/label-cache-parser.js.map +1 -0
- package/dist/flow/utils/label-cache-processor.d.ts +119 -0
- package/dist/flow/utils/label-cache-processor.js +719 -0
- package/dist/flow/utils/label-cache-processor.js.map +1 -0
- package/dist/flow/utils/pill-string-parser.d.ts +88 -0
- package/dist/flow/utils/pill-string-parser.js +306 -0
- package/dist/flow/utils/pill-string-parser.js.map +1 -0
- package/dist/flow/utils/schema-to-flow-object.d.ts +22 -0
- package/dist/flow/utils/schema-to-flow-object.js +318 -0
- package/dist/flow/utils/schema-to-flow-object.js.map +1 -0
- package/dist/flow/utils/service-catalog.d.ts +47 -0
- package/dist/flow/utils/service-catalog.js +137 -0
- package/dist/flow/utils/service-catalog.js.map +1 -0
- package/dist/flow/utils/utils.d.ts +117 -0
- package/dist/flow/utils/utils.js +345 -0
- package/dist/flow/utils/utils.js.map +1 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/list-plugin.js +1 -1
- package/dist/list-plugin.js.map +1 -1
- package/dist/now-attach-plugin.d.ts +1 -0
- package/dist/now-attach-plugin.js +10 -10
- package/dist/now-attach-plugin.js.map +1 -1
- package/dist/now-ref-plugin.js +1 -1
- package/dist/now-ref-plugin.js.map +1 -1
- package/dist/record-plugin.d.ts +29 -0
- package/dist/record-plugin.js +66 -7
- package/dist/record-plugin.js.map +1 -1
- package/dist/repack/index.d.ts +2 -0
- package/dist/repack/index.js +8 -0
- package/dist/repack/index.js.map +1 -1
- package/dist/rest-api-plugin.js +54 -44
- package/dist/rest-api-plugin.js.map +1 -1
- package/dist/server-module-plugin/index.d.ts +10 -0
- package/dist/server-module-plugin/index.js +83 -59
- package/dist/server-module-plugin/index.js.map +1 -1
- package/dist/service-catalog/catalog-clientscript-plugin.d.ts +2 -0
- package/dist/service-catalog/catalog-clientscript-plugin.js +117 -0
- package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -0
- package/dist/service-catalog/catalog-item-plugin.d.ts +2 -0
- package/dist/service-catalog/catalog-item-plugin.js +115 -0
- package/dist/service-catalog/catalog-item-plugin.js.map +1 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.d.ts +2 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.js +266 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -0
- package/dist/service-catalog/index.d.ts +5 -0
- package/dist/service-catalog/index.js +22 -0
- package/dist/service-catalog/index.js.map +1 -0
- package/dist/service-catalog/record-to-shape.d.ts +6 -0
- package/dist/service-catalog/record-to-shape.js +93 -0
- package/dist/service-catalog/record-to-shape.js.map +1 -0
- package/dist/service-catalog/sc-record-producer-plugin.d.ts +2 -0
- package/dist/service-catalog/sc-record-producer-plugin.js +140 -0
- package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -0
- package/dist/service-catalog/service-catalog-base.d.ts +311 -0
- package/dist/service-catalog/service-catalog-base.js +542 -0
- package/dist/service-catalog/service-catalog-base.js.map +1 -0
- package/dist/service-catalog/service-catalog-diagnostics.d.ts +45 -0
- package/dist/service-catalog/service-catalog-diagnostics.js +172 -0
- package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -0
- package/dist/service-catalog/shape-to-record.d.ts +8 -0
- package/dist/service-catalog/shape-to-record.js +235 -0
- package/dist/service-catalog/shape-to-record.js.map +1 -0
- package/dist/service-catalog/utils.d.ts +323 -0
- package/dist/service-catalog/utils.js +1216 -0
- package/dist/service-catalog/utils.js.map +1 -0
- package/dist/service-catalog/variable-helper.d.ts +43 -0
- package/dist/service-catalog/variable-helper.js +92 -0
- package/dist/service-catalog/variable-helper.js.map +1 -0
- package/dist/service-catalog/variable-set-plugin.d.ts +2 -0
- package/dist/service-catalog/variable-set-plugin.js +175 -0
- package/dist/service-catalog/variable-set-plugin.js.map +1 -0
- package/dist/service-catalog/variables-transform.d.ts +139 -0
- package/dist/service-catalog/variables-transform.js +403 -0
- package/dist/service-catalog/variables-transform.js.map +1 -0
- package/dist/sla/sla-validators.d.ts +61 -0
- package/dist/sla/sla-validators.js +224 -0
- package/dist/sla/sla-validators.js.map +1 -0
- package/dist/sla-plugin.d.ts +5 -0
- package/dist/sla-plugin.js +280 -0
- package/dist/sla-plugin.js.map +1 -0
- package/dist/static-content-plugin.js +25 -2
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +32 -15
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +832 -19
- package/dist/ui-page-plugin.js.map +1 -1
- package/dist/ui-policy-plugin.js +5 -7
- package/dist/ui-policy-plugin.js.map +1 -1
- package/dist/utils.d.ts +10 -1
- package/dist/utils.js +16 -0
- package/dist/utils.js.map +1 -1
- package/dist/ux-list-menu-config-plugin.d.ts +2 -0
- package/dist/ux-list-menu-config-plugin.js +292 -0
- package/dist/ux-list-menu-config-plugin.js.map +1 -0
- package/dist/workspace-plugin/chrome-tab.d.ts +2 -0
- package/dist/workspace-plugin/chrome-tab.js +46 -0
- package/dist/workspace-plugin/chrome-tab.js.map +1 -0
- package/dist/workspace-plugin/constants.d.ts +52 -0
- package/dist/workspace-plugin/constants.js +56 -0
- package/dist/workspace-plugin/constants.js.map +1 -0
- package/dist/workspace-plugin/fluent-utils.d.ts +9 -0
- package/dist/workspace-plugin/fluent-utils.js +60 -0
- package/dist/workspace-plugin/fluent-utils.js.map +1 -0
- package/dist/workspace-plugin/page.d.ts +8 -0
- package/dist/workspace-plugin/page.js +108 -0
- package/dist/workspace-plugin/page.js.map +1 -0
- package/dist/workspace-plugin/screen.d.ts +1 -0
- package/dist/workspace-plugin/screen.js +38 -0
- package/dist/workspace-plugin/screen.js.map +1 -0
- package/dist/workspace-plugin/templates/index.d.ts +10 -0
- package/dist/workspace-plugin/templates/index.js +20 -0
- package/dist/workspace-plugin/templates/index.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-composition.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-composition.js +4043 -0
- package/dist/workspace-plugin/templates/record-page-composition.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-data.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-data.js +527 -0
- package/dist/workspace-plugin/templates/record-page-data.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-interalEventMappings.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-interalEventMappings.js +39 -0
- package/dist/workspace-plugin/templates/record-page-interalEventMappings.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-layoutModel.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-layoutModel.js +55 -0
- package/dist/workspace-plugin/templates/record-page-layoutModel.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-properties.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-properties.js +135 -0
- package/dist/workspace-plugin/templates/record-page-properties.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page.d.ts +3 -0
- package/dist/workspace-plugin/templates/record-page.js +8 -0
- package/dist/workspace-plugin/templates/record-page.js.map +1 -0
- package/dist/workspace-plugin.d.ts +2 -0
- package/dist/workspace-plugin.js +453 -0
- package/dist/workspace-plugin.js.map +1 -0
- package/package.json +10 -12
- package/src/acl-plugin.ts +16 -1
- package/src/applicability-plugin.ts +82 -0
- package/src/atf/test-plugin.ts +6 -3
- package/src/basic-syntax-plugin.ts +10 -1
- package/src/business-rule-plugin.ts +2 -1
- package/src/call-expression-plugin.ts +2 -130
- package/src/column/column-to-record.ts +54 -8
- package/src/column-plugin.ts +29 -13
- package/src/dashboard/dashboard-component-property-defaults.ts +277 -0
- package/src/dashboard/dashboard-component-resolver.ts +69 -0
- package/src/dashboard/dashboard-plugin.ts +450 -0
- package/src/data-plugin.ts +67 -139
- package/src/email-notification-plugin.ts +850 -0
- package/src/flow/constants/flow-plugin-constants.ts +79 -0
- package/src/flow/flow-logic/flow-logic-constants.ts +120 -0
- package/src/flow/flow-logic/flow-logic-diagnostics.ts +591 -0
- package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +2550 -0
- package/src/flow/flow-logic/flow-logic-plugin.ts +337 -0
- package/src/flow/flow-logic/flow-logic-shapes.ts +215 -0
- package/src/flow/plugins/approval-rules-plugin.ts +48 -0
- package/src/flow/plugins/flow-action-definition-plugin.ts +295 -0
- package/src/flow/plugins/flow-data-pill-plugin.ts +258 -0
- package/src/flow/plugins/flow-definition-plugin.ts +2173 -0
- package/src/flow/plugins/flow-diagnostics-plugin.ts +280 -0
- package/src/flow/plugins/flow-instance-plugin.ts +1499 -0
- package/src/flow/plugins/flow-trigger-instance-plugin.ts +444 -0
- package/src/flow/plugins/inline-script-plugin.ts +83 -0
- package/src/flow/plugins/step-definition-plugin.ts +67 -0
- package/src/flow/plugins/step-instance-plugin.ts +431 -0
- package/src/flow/plugins/trigger-plugin.ts +95 -0
- package/src/flow/plugins/wfa-datapill-plugin.ts +213 -0
- package/src/flow/utils/approval-rules-processor.ts +298 -0
- package/src/flow/utils/built-in-complex-objects.ts +81 -0
- package/src/flow/utils/complex-object-resolver.ts +875 -0
- package/src/flow/utils/complex-objects.ts +656 -0
- package/src/flow/utils/data-pill-shapes.ts +165 -0
- package/src/flow/utils/datapill-transformer.ts +632 -0
- package/src/flow/utils/flow-constants.ts +285 -0
- package/src/flow/utils/flow-io-to-record.ts +533 -0
- package/src/flow/utils/flow-shapes.ts +296 -0
- package/src/flow/utils/flow-to-xml.ts +318 -0
- package/src/flow/utils/flow-variable-processor.ts +100 -0
- package/src/flow/utils/label-cache-parser.ts +37 -0
- package/src/flow/utils/label-cache-processor.ts +870 -0
- package/src/flow/utils/pill-string-parser.ts +375 -0
- package/src/flow/utils/schema-to-flow-object.ts +385 -0
- package/src/flow/utils/service-catalog.ts +174 -0
- package/src/flow/utils/utils.ts +395 -0
- package/src/index.ts +20 -1
- package/src/list-plugin.ts +1 -1
- package/src/now-attach-plugin.ts +14 -11
- package/src/now-ref-plugin.ts +1 -1
- package/src/record-plugin.ts +76 -11
- package/src/repack/index.ts +14 -0
- package/src/rest-api-plugin.ts +62 -50
- package/src/server-module-plugin/index.ts +112 -86
- package/src/service-catalog/catalog-clientscript-plugin.ts +140 -0
- package/src/service-catalog/catalog-item-plugin.ts +162 -0
- package/src/service-catalog/catalog-ui-policy-plugin.ts +324 -0
- package/src/service-catalog/index.ts +5 -0
- package/src/service-catalog/record-to-shape.ts +109 -0
- package/src/service-catalog/sc-record-producer-plugin.ts +201 -0
- package/src/service-catalog/service-catalog-base.ts +600 -0
- package/src/service-catalog/service-catalog-diagnostics.ts +254 -0
- package/src/service-catalog/shape-to-record.ts +279 -0
- package/src/service-catalog/utils.ts +1455 -0
- package/src/service-catalog/variable-helper.ts +135 -0
- package/src/service-catalog/variable-set-plugin.ts +197 -0
- package/src/service-catalog/variables-transform.ts +438 -0
- package/src/sla/sla-validators.ts +331 -0
- package/src/sla-plugin.ts +358 -0
- package/src/static-content-plugin.ts +25 -2
- package/src/table-plugin.ts +49 -16
- package/src/ui-page-plugin.ts +1063 -20
- package/src/ui-policy-plugin.ts +5 -9
- package/src/utils.ts +24 -1
- package/src/ux-list-menu-config-plugin.ts +312 -0
- package/src/workspace-plugin/chrome-tab.ts +44 -0
- package/src/workspace-plugin/constants.ts +53 -0
- package/src/workspace-plugin/fluent-utils.ts +60 -0
- package/src/workspace-plugin/page.ts +139 -0
- package/src/workspace-plugin/screen.ts +34 -0
- package/src/workspace-plugin/templates/index.ts +17 -0
- package/src/workspace-plugin/templates/record-page-composition.ts +4051 -0
- package/src/workspace-plugin/templates/record-page-data.ts +523 -0
- package/src/workspace-plugin/templates/record-page-interalEventMappings.ts +35 -0
- package/src/workspace-plugin/templates/record-page-layoutModel.ts +51 -0
- package/src/workspace-plugin/templates/record-page-properties.ts +131 -0
- package/src/workspace-plugin/templates/record-page.ts +6 -0
- package/src/workspace-plugin.ts +574 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { CallExpressionShape, deleteMultipleDiff, Plugin, Record, UndefinedShape } from '@servicenow/sdk-build-core'
|
|
2
|
+
import { buildVariableRecords, complexObjectMatchesIoRecord } from '../utils/flow-io-to-record'
|
|
3
|
+
import { generateXML } from '../utils/flow-to-xml'
|
|
4
|
+
import { slugifyString } from '../utils/flow-constants'
|
|
5
|
+
import { ArrowFunctionShape } from '../../arrow-function-plugin'
|
|
6
|
+
import { StepInstanceShape } from './step-instance-plugin'
|
|
7
|
+
|
|
8
|
+
const actionDefRelationships = {
|
|
9
|
+
sys_hub_step_instance: {
|
|
10
|
+
via: 'action',
|
|
11
|
+
descendant: true,
|
|
12
|
+
relationships: {
|
|
13
|
+
sys_variable_value: {
|
|
14
|
+
via: 'document_key',
|
|
15
|
+
descendant: true,
|
|
16
|
+
},
|
|
17
|
+
sys_element_mapping: {
|
|
18
|
+
via: 'id',
|
|
19
|
+
descendant: true,
|
|
20
|
+
},
|
|
21
|
+
sys_hub_step_ext_input: {
|
|
22
|
+
via: 'model_id',
|
|
23
|
+
descendant: true,
|
|
24
|
+
relationships: {
|
|
25
|
+
sys_documentation: {
|
|
26
|
+
via: { name: 'name', element: 'element' },
|
|
27
|
+
descendant: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
sys_hub_step_ext_output: {
|
|
32
|
+
via: 'model_id',
|
|
33
|
+
descendant: true,
|
|
34
|
+
relationships: {
|
|
35
|
+
sys_documentation: {
|
|
36
|
+
via: { name: 'name', element: 'element' },
|
|
37
|
+
descendant: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
sys_hub_input_scripts: {
|
|
42
|
+
via: 'instance',
|
|
43
|
+
descendant: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
sys_hub_action_input: {
|
|
48
|
+
via: 'model',
|
|
49
|
+
descendant: true,
|
|
50
|
+
relationships: {
|
|
51
|
+
sys_documentation: {
|
|
52
|
+
via: { name: 'name', element: 'element' },
|
|
53
|
+
descendant: true,
|
|
54
|
+
},
|
|
55
|
+
sys_choice: {
|
|
56
|
+
via: { name: 'name', element: 'element' },
|
|
57
|
+
descendant: true,
|
|
58
|
+
},
|
|
59
|
+
sys_variable_value: {
|
|
60
|
+
via: 'variable',
|
|
61
|
+
descendant: true,
|
|
62
|
+
},
|
|
63
|
+
sys_complex_object: {
|
|
64
|
+
via: [complexObjectMatchesIoRecord],
|
|
65
|
+
descendant: true,
|
|
66
|
+
inverse: true,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
sys_hub_action_output: {
|
|
71
|
+
via: 'model',
|
|
72
|
+
descendant: true,
|
|
73
|
+
relationships: {
|
|
74
|
+
sys_documentation: {
|
|
75
|
+
via: { name: 'name', element: 'element' },
|
|
76
|
+
descendant: true,
|
|
77
|
+
},
|
|
78
|
+
sys_choice: {
|
|
79
|
+
via: { name: 'name', element: 'element' },
|
|
80
|
+
descendant: true,
|
|
81
|
+
},
|
|
82
|
+
sys_variable_value: {
|
|
83
|
+
via: 'variable',
|
|
84
|
+
descendant: true,
|
|
85
|
+
},
|
|
86
|
+
sys_complex_object: {
|
|
87
|
+
via: [complexObjectMatchesIoRecord],
|
|
88
|
+
descendant: true,
|
|
89
|
+
inverse: true,
|
|
90
|
+
},
|
|
91
|
+
sys_hub_input_scripts: {
|
|
92
|
+
via: 'instance',
|
|
93
|
+
descendant: true,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
sys_hub_action_status_metadata: {
|
|
98
|
+
via: 'action_type_id',
|
|
99
|
+
descendant: true,
|
|
100
|
+
relationships: {
|
|
101
|
+
sys_hub_status_condition: {
|
|
102
|
+
via: 'action_status_metadata_id',
|
|
103
|
+
descendant: true,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const ActionDefinitionPlugin = Plugin.create({
|
|
110
|
+
name: 'ActionDefinitionPlugin',
|
|
111
|
+
records: {
|
|
112
|
+
sys_hub_action_type_definition: {
|
|
113
|
+
relationships: {
|
|
114
|
+
...actionDefRelationships,
|
|
115
|
+
sys_hub_action_type_snapshot: {
|
|
116
|
+
via: 'parent_action',
|
|
117
|
+
descendant: true,
|
|
118
|
+
relationships: {
|
|
119
|
+
...actionDefRelationships,
|
|
120
|
+
sys_element_mapping: {
|
|
121
|
+
via: 'id',
|
|
122
|
+
descendant: true,
|
|
123
|
+
},
|
|
124
|
+
sys_hub_step_ext_input: {
|
|
125
|
+
via: 'model',
|
|
126
|
+
descendant: true,
|
|
127
|
+
},
|
|
128
|
+
sys_hub_step_ext_output: {
|
|
129
|
+
via: 'model',
|
|
130
|
+
descendant: true,
|
|
131
|
+
},
|
|
132
|
+
sys_translated_text: {
|
|
133
|
+
via: 'documentkey',
|
|
134
|
+
descendant: true,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
sys_hub_action_plan: {
|
|
139
|
+
via: 'action_id',
|
|
140
|
+
descendant: true,
|
|
141
|
+
},
|
|
142
|
+
sys_element_mapping: {
|
|
143
|
+
via: 'id',
|
|
144
|
+
descendant: true,
|
|
145
|
+
},
|
|
146
|
+
sys_translated_text: {
|
|
147
|
+
via: 'documentkey',
|
|
148
|
+
descendant: true,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
toShape(record, { logger }) {
|
|
152
|
+
logger.warn(`Unsupported record type: ${record.getTable()}, Action definition is not implemented yet`)
|
|
153
|
+
return { success: false }
|
|
154
|
+
// TODO Uncomment this in next release
|
|
155
|
+
// const inputs = buildVariableShapes(descendants.query('sys_hub_action_input'), descendants)
|
|
156
|
+
// const outputs = buildVariableShapes(descendants.query('sys_hub_action_output'), descendants)
|
|
157
|
+
|
|
158
|
+
// // Create the CallExpressionShape for the action definition
|
|
159
|
+
// const callExpression = new CallExpressionShape({
|
|
160
|
+
// source: record,
|
|
161
|
+
// callee: 'ActionDefinition',
|
|
162
|
+
// args: [
|
|
163
|
+
// record.transform(({ $ }) => ({
|
|
164
|
+
// $id: $.val(NowIdShape.from(record)),
|
|
165
|
+
// name: $,
|
|
166
|
+
// annotation: $.def(''),
|
|
167
|
+
// description: $.def(''),
|
|
168
|
+
// natlang: $.def(''),
|
|
169
|
+
// access: $.def('public'),
|
|
170
|
+
// category: $.def(''),
|
|
171
|
+
// protection: $.from('sys_policy').def(''),
|
|
172
|
+
// inputs: $.val(inputs),
|
|
173
|
+
// outputs: $.val(outputs),
|
|
174
|
+
// })),
|
|
175
|
+
// ],
|
|
176
|
+
// })
|
|
177
|
+
|
|
178
|
+
// // Try to get the existing identifier from the record source, fallback to slugified name
|
|
179
|
+
// const actionName =
|
|
180
|
+
// getIdentifierFromRecord(record) ??
|
|
181
|
+
// slugifyString(String(record.get('internal_name')?.getValue() || record.get('name')?.getValue()))
|
|
182
|
+
|
|
183
|
+
// return {
|
|
184
|
+
// success: true,
|
|
185
|
+
// value: new VariableStatementShape({
|
|
186
|
+
// source: record,
|
|
187
|
+
// variableName: actionName,
|
|
188
|
+
// initializer: callExpression,
|
|
189
|
+
// isExported: true,
|
|
190
|
+
// }),
|
|
191
|
+
// }
|
|
192
|
+
},
|
|
193
|
+
async diff(existing, incoming, descendants, context) {
|
|
194
|
+
return deleteMultipleDiff(existing, incoming, descendants, context)
|
|
195
|
+
},
|
|
196
|
+
toFile(record, { config, database }) {
|
|
197
|
+
return generateXML(record, { config, database })
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
sys_hub_action_input: {
|
|
201
|
+
coalesce: ['model', 'element'],
|
|
202
|
+
},
|
|
203
|
+
sys_hub_action_output: {
|
|
204
|
+
coalesce: ['model', 'element'],
|
|
205
|
+
},
|
|
206
|
+
sys_variable_value: {
|
|
207
|
+
coalesce: ['document_key', 'variable'],
|
|
208
|
+
},
|
|
209
|
+
sys_complex_object: {
|
|
210
|
+
coalesce: ['name'],
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
shapes: [
|
|
214
|
+
{
|
|
215
|
+
shape: CallExpressionShape,
|
|
216
|
+
fileTypes: ['fluent'],
|
|
217
|
+
async toRecord(callExpression, { factory, diagnostics }) {
|
|
218
|
+
if (callExpression.getCallee() !== 'ActionDefinition') {
|
|
219
|
+
return { success: false }
|
|
220
|
+
}
|
|
221
|
+
const relatedRecords: Record[] = []
|
|
222
|
+
const actionConfiguration = callExpression.getArgument(0).asObject()
|
|
223
|
+
const actionDefinitionRecord = await factory.createRecord({
|
|
224
|
+
source: callExpression,
|
|
225
|
+
table: 'sys_hub_action_type_definition',
|
|
226
|
+
explicitId: actionConfiguration.get('$id'),
|
|
227
|
+
properties: actionConfiguration.transform(({ $ }) => ({
|
|
228
|
+
name: $,
|
|
229
|
+
internal_name: $.from('name').map((n) => slugifyString(n.getValue())),
|
|
230
|
+
annotation: $.def(''),
|
|
231
|
+
description: $.def(''),
|
|
232
|
+
access: $.def('public'),
|
|
233
|
+
category: $.def(''),
|
|
234
|
+
sys_policy: $.from('protection').def(''),
|
|
235
|
+
active: $.val(true),
|
|
236
|
+
state: $.val('draft'),
|
|
237
|
+
system_level: $.val(false),
|
|
238
|
+
})),
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
const inputsConfig = actionConfiguration.get('inputs').ifObject()?.asObject()
|
|
242
|
+
if (inputsConfig) {
|
|
243
|
+
const { variableRecords: inputRecords, complexObjectRecords: inputComplexObjects } =
|
|
244
|
+
await buildVariableRecords({
|
|
245
|
+
variablesConfig: inputsConfig,
|
|
246
|
+
parentRecord: actionDefinitionRecord,
|
|
247
|
+
factory,
|
|
248
|
+
diagnostics,
|
|
249
|
+
parentTable: 'sys_hub_action_type_definition',
|
|
250
|
+
varTable: 'sys_hub_action_input',
|
|
251
|
+
})
|
|
252
|
+
relatedRecords.push(...inputRecords, ...inputComplexObjects)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const outputsConfig = actionConfiguration.get('outputs').ifObject()?.asObject()
|
|
256
|
+
|
|
257
|
+
if (outputsConfig) {
|
|
258
|
+
const { variableRecords: outputRecords, complexObjectRecords: outputComplexObjects } =
|
|
259
|
+
await buildVariableRecords({
|
|
260
|
+
variablesConfig: outputsConfig,
|
|
261
|
+
parentRecord: actionDefinitionRecord,
|
|
262
|
+
factory,
|
|
263
|
+
diagnostics,
|
|
264
|
+
parentTable: 'sys_hub_action_type_definition',
|
|
265
|
+
varTable: 'sys_hub_action_output',
|
|
266
|
+
isOutput: true,
|
|
267
|
+
})
|
|
268
|
+
relatedRecords.push(...outputRecords, ...outputComplexObjects)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
let actionBody: ArrowFunctionShape | undefined
|
|
272
|
+
actionBody = !callExpression.getArgument(1)?.if(UndefinedShape)
|
|
273
|
+
? callExpression.getArgument(1)?.as(ArrowFunctionShape)
|
|
274
|
+
: undefined
|
|
275
|
+
const allInstances = actionBody?.getStatements()
|
|
276
|
+
|
|
277
|
+
for (const [, v] of (allInstances ?? []).entries()) {
|
|
278
|
+
const source = v.getSource()
|
|
279
|
+
if (source instanceof StepInstanceShape) {
|
|
280
|
+
const instanceRecord = v.as(Record)
|
|
281
|
+
const record = instanceRecord.merge({
|
|
282
|
+
action: actionDefinitionRecord.getId().getValue(),
|
|
283
|
+
})
|
|
284
|
+
relatedRecords.push(record)
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return {
|
|
289
|
+
success: true,
|
|
290
|
+
value: actionDefinitionRecord.with(...relatedRecords),
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
})
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Diagnostics,
|
|
3
|
+
type Result,
|
|
4
|
+
IdentifierShape,
|
|
5
|
+
Plugin,
|
|
6
|
+
PropertyAccessShape,
|
|
7
|
+
Record,
|
|
8
|
+
TemplateExpressionShape,
|
|
9
|
+
ts,
|
|
10
|
+
UnresolvedShape,
|
|
11
|
+
} from '@servicenow/sdk-build-core'
|
|
12
|
+
import { FDInstanceShape } from '../utils/flow-shapes'
|
|
13
|
+
import { ForEachItemShape, PillShape, PillTemplateShape } from '../utils/data-pill-shapes'
|
|
14
|
+
import { FLOW_LOGIC } from '../flow-logic/flow-logic-constants'
|
|
15
|
+
import { getCallExpressionName } from '../../utils'
|
|
16
|
+
import { findAncestorByCalleeName, getRecordFromFlowInstaceShape } from '../utils/utils'
|
|
17
|
+
|
|
18
|
+
function handleRecordType(
|
|
19
|
+
value: Record,
|
|
20
|
+
propertyAccessShape: PropertyAccessShape,
|
|
21
|
+
propertyNames: string[],
|
|
22
|
+
diagnostics: Diagnostics
|
|
23
|
+
): Result<PropertyAccessShape> {
|
|
24
|
+
if (!(value.getSource() instanceof FDInstanceShape)) {
|
|
25
|
+
diagnostics.error(
|
|
26
|
+
propertyAccessShape,
|
|
27
|
+
'Invalid data pill: Record references must come from a flow action or subflow output'
|
|
28
|
+
)
|
|
29
|
+
return { success: false as const }
|
|
30
|
+
}
|
|
31
|
+
const pathStr = propertyNames.slice(1).join('.')
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
success: true,
|
|
35
|
+
value: new PillShape({
|
|
36
|
+
source: propertyAccessShape,
|
|
37
|
+
uiId: value.as(Record).get('ui_id').asString().getValue(),
|
|
38
|
+
path: pathStr,
|
|
39
|
+
}),
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function handleUnresolvedShape(
|
|
44
|
+
value: UnresolvedShape,
|
|
45
|
+
propertyAccessShape: PropertyAccessShape,
|
|
46
|
+
propertyNames: string[],
|
|
47
|
+
diagnostics: Diagnostics
|
|
48
|
+
): Result<PropertyAccessShape> {
|
|
49
|
+
const source = value.getSource()
|
|
50
|
+
if (!(source instanceof ts.Node)) {
|
|
51
|
+
diagnostics.error(propertyAccessShape, 'Invalid root source for pill expression')
|
|
52
|
+
return { success: false as const }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Todo: if it is any other, below code will take care of it
|
|
56
|
+
const { rootIdentifier, pathStr } = determineRootIdentifierAndPath(propertyNames, diagnostics, propertyAccessShape)
|
|
57
|
+
|
|
58
|
+
if (!rootIdentifier) {
|
|
59
|
+
const forEachParamName = getForEachParameterName(propertyAccessShape.getElement(0))
|
|
60
|
+
if (forEachParamName) {
|
|
61
|
+
return {
|
|
62
|
+
success: true,
|
|
63
|
+
value: new PillShape({
|
|
64
|
+
source: propertyAccessShape,
|
|
65
|
+
uiId: 'forEach',
|
|
66
|
+
path: [forEachParamName, ...propertyNames.slice(1)].join('.'),
|
|
67
|
+
}),
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
diagnostics.error(propertyAccessShape, 'Invalid pill reference')
|
|
72
|
+
return { success: false }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
success: true,
|
|
77
|
+
value: new PillShape({
|
|
78
|
+
source: source,
|
|
79
|
+
uiId: rootIdentifier,
|
|
80
|
+
path: pathStr,
|
|
81
|
+
}),
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function determineRootIdentifierAndPath(
|
|
86
|
+
propertyNames: string[],
|
|
87
|
+
diagnostics: Diagnostics,
|
|
88
|
+
propertyAccessShape: PropertyAccessShape
|
|
89
|
+
) {
|
|
90
|
+
let rootIdentifier = ''
|
|
91
|
+
let pathStr = ''
|
|
92
|
+
|
|
93
|
+
switch (propertyNames[1]) {
|
|
94
|
+
case 'inputs':
|
|
95
|
+
rootIdentifier = 'subflow' // <-- Hardcoded: But need to handle if this input is in action/subflow body when we do action body impl.
|
|
96
|
+
pathStr = propertyNames.slice(2).join('.')
|
|
97
|
+
break
|
|
98
|
+
case 'flowVariables':
|
|
99
|
+
// For params.flowVariables (schema reference), use 'flowVariables' as identifier with empty path
|
|
100
|
+
// For params.flowVariables.someVar (property access), use 'flow_variable' as identifier
|
|
101
|
+
if (propertyNames.length === 2) {
|
|
102
|
+
// Schema reference: params.flowVariables → {{flowVariables}}
|
|
103
|
+
rootIdentifier = 'flowVariables'
|
|
104
|
+
pathStr = ''
|
|
105
|
+
} else {
|
|
106
|
+
// Property access: params.flowVariables.someVar → {{flow_variable.someVar}}
|
|
107
|
+
rootIdentifier = 'flow_variable'
|
|
108
|
+
pathStr = propertyNames.slice(2).join('.')
|
|
109
|
+
}
|
|
110
|
+
break
|
|
111
|
+
case 'trigger':
|
|
112
|
+
rootIdentifier = 'trigger'
|
|
113
|
+
pathStr = propertyNames.slice(2).join('.')
|
|
114
|
+
break
|
|
115
|
+
case 'outputs':
|
|
116
|
+
// For params.outputs (schema reference in assignSubflowOutputs context), allow it
|
|
117
|
+
// For params.outputs.someOutput (property access), reject it
|
|
118
|
+
if (propertyNames.length === 2) {
|
|
119
|
+
// Schema reference: params.outputs → {{outputs}}
|
|
120
|
+
rootIdentifier = 'outputs'
|
|
121
|
+
pathStr = ''
|
|
122
|
+
} else {
|
|
123
|
+
// Property access: params.outputs.someOutput → error (not allowed)
|
|
124
|
+
diagnostics.error(
|
|
125
|
+
propertyAccessShape,
|
|
126
|
+
'Invalid pill reference: Subflow outputs are not allowed as datapills'
|
|
127
|
+
)
|
|
128
|
+
return { rootIdentifier: null, pathStr: null }
|
|
129
|
+
}
|
|
130
|
+
break
|
|
131
|
+
default:
|
|
132
|
+
return { rootIdentifier: null, pathStr: null }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return { rootIdentifier, pathStr }
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Get the parameter name from a forEach arrow function
|
|
140
|
+
* Returns the actual parameter name (e.g., 'dept', 'category', 'item') instead of generic 'item'
|
|
141
|
+
* Returns null if the identifier is not a forEach parameter
|
|
142
|
+
*/
|
|
143
|
+
function getForEachParameterName(identifierShape: IdentifierShape): string | null {
|
|
144
|
+
const param = identifierShape.getOriginalNode().asKind(ts.SyntaxKind.Identifier)?.getDefinitionNodes()?.[0]
|
|
145
|
+
const parentLogicNode = param
|
|
146
|
+
?.getParentIfKind(ts.SyntaxKind.ArrowFunction)
|
|
147
|
+
?.getParentIfKind(ts.SyntaxKind.CallExpression)
|
|
148
|
+
|
|
149
|
+
if (!parentLogicNode || getCallExpressionName(parentLogicNode) !== FLOW_LOGIC.FOR_EACH) {
|
|
150
|
+
return null
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Get the actual parameter name from the identifier
|
|
154
|
+
return identifierShape.getName()
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const DataPillPlugin = Plugin.create({
|
|
158
|
+
name: 'DataPillPlugin',
|
|
159
|
+
shapes: [
|
|
160
|
+
{
|
|
161
|
+
shape: PropertyAccessShape,
|
|
162
|
+
fileTypes: ['fluent'],
|
|
163
|
+
async toSubclass(propertyAccessShape, { diagnostics, transform }): Promise<Result<PropertyAccessShape>> {
|
|
164
|
+
// Decompose PropertyAccessExpression into root identifier and remaining path
|
|
165
|
+
const ancestor = findAncestorByCalleeName(propertyAccessShape.getOriginalNode(), 'wfa.dataPill')
|
|
166
|
+
if (!ancestor) {
|
|
167
|
+
diagnostics.error(propertyAccessShape, 'Datapill reference must be inside a wfa.dataPill call')
|
|
168
|
+
return { success: false }
|
|
169
|
+
}
|
|
170
|
+
const propertyNames: string[] = []
|
|
171
|
+
propertyAccessShape.getElements().forEach((element) => {
|
|
172
|
+
if (element instanceof IdentifierShape) {
|
|
173
|
+
propertyNames.push(element.getName())
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
const value = propertyAccessShape.getElement(0).resolve()
|
|
178
|
+
if (value.is(UnresolvedShape)) {
|
|
179
|
+
return handleUnresolvedShape(value, propertyAccessShape, propertyNames, diagnostics)
|
|
180
|
+
}
|
|
181
|
+
const record = await getRecordFromFlowInstaceShape(value, transform)
|
|
182
|
+
|
|
183
|
+
if (record?.is(Record)) {
|
|
184
|
+
return handleRecordType(record, propertyAccessShape, propertyNames, diagnostics)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return { success: false }
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
shape: TemplateExpressionShape,
|
|
192
|
+
fileTypes: ['fluent'],
|
|
193
|
+
async toSubclass(shape: TemplateExpressionShape, { transform }): Promise<Result<TemplateExpressionShape>> {
|
|
194
|
+
const parts: (string | PillShape)[] = []
|
|
195
|
+
const head = shape.getLiteralText()
|
|
196
|
+
const leadingText = head
|
|
197
|
+
|
|
198
|
+
if (leadingText.length > 0) {
|
|
199
|
+
parts.push(leadingText)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
for (const span of shape.getSpans()) {
|
|
203
|
+
const expr = span.getExpression()
|
|
204
|
+
const literalText = span.getLiteralText()
|
|
205
|
+
|
|
206
|
+
const pillShapeResult = expr.is([PropertyAccessShape, IdentifierShape])
|
|
207
|
+
? await transform.toSubclass(expr, DataPillPlugin) // In case of PropertyAccessShape call the toSubclass() again, which calls above handler
|
|
208
|
+
: { success: false, value: undefined }
|
|
209
|
+
|
|
210
|
+
if (pillShapeResult.success) {
|
|
211
|
+
const pillShape = pillShapeResult.value
|
|
212
|
+
if (pillShape instanceof PillShape) {
|
|
213
|
+
// do not call getValue() for trigger, as this will be handled in flow-instance-plugin
|
|
214
|
+
if (pillShape.getRootIdentifier() === 'trigger') {
|
|
215
|
+
parts.push(pillShape)
|
|
216
|
+
} else {
|
|
217
|
+
parts.push(pillShape.getValue())
|
|
218
|
+
}
|
|
219
|
+
parts.push(literalText)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (pillShape instanceof ForEachItemShape) {
|
|
223
|
+
parts.push(pillShape.getValue())
|
|
224
|
+
parts.push(literalText)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
success: true,
|
|
231
|
+
value: new PillTemplateShape({
|
|
232
|
+
source: shape,
|
|
233
|
+
parts,
|
|
234
|
+
}),
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
shape: IdentifierShape,
|
|
240
|
+
fileTypes: ['fluent'],
|
|
241
|
+
async toSubclass(identifierShape) {
|
|
242
|
+
const forEachParamName = getForEachParameterName(identifierShape)
|
|
243
|
+
if (!forEachParamName) {
|
|
244
|
+
return { success: false }
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return {
|
|
248
|
+
success: true,
|
|
249
|
+
value: new ForEachItemShape({
|
|
250
|
+
source: identifierShape,
|
|
251
|
+
uiId: 'forEach',
|
|
252
|
+
path: forEachParamName,
|
|
253
|
+
}),
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
})
|