@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,395 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CallExpressionShape,
|
|
3
|
+
type Database,
|
|
4
|
+
type Diagnostics,
|
|
5
|
+
type IdentifierShape,
|
|
6
|
+
type Logger,
|
|
7
|
+
type ObjectShape,
|
|
8
|
+
type PropertyAccessShape,
|
|
9
|
+
type Record,
|
|
10
|
+
type Shape,
|
|
11
|
+
type TemplateExpressionShape,
|
|
12
|
+
type Transform,
|
|
13
|
+
ts,
|
|
14
|
+
VariableStatementShape,
|
|
15
|
+
} from '@servicenow/sdk-build-core'
|
|
16
|
+
import { PillShape, PillTemplateShape } from '../utils/data-pill-shapes'
|
|
17
|
+
import { DataPillPlugin } from '../plugins/flow-data-pill-plugin'
|
|
18
|
+
import { TriggerInstancePlugin } from '../plugins/flow-trigger-instance-plugin'
|
|
19
|
+
import { CallExpressionPlugin } from '../../call-expression-plugin'
|
|
20
|
+
import { FlowLogicPlugin } from '../flow-logic/flow-logic-plugin'
|
|
21
|
+
import { FlowInstancePlugin } from '../plugins/flow-instance-plugin'
|
|
22
|
+
import { FDInstanceShape } from './flow-shapes'
|
|
23
|
+
import { CORE_ACTIONS_PREFIX, CORE_ACTIONS_SYS_ID_NAME_MAP, UNSUPPORTED_FLOW_DESCENDANTS } from './flow-constants'
|
|
24
|
+
|
|
25
|
+
export function sysIdToUuid(id: string): string {
|
|
26
|
+
return id.length === 32
|
|
27
|
+
? `${id.slice(0, 8)}-${id.slice(8, 12)}-${id.slice(12, 16)}-${id.slice(16, 20)}-${id.slice(20)}`
|
|
28
|
+
: id // already UUID or unexpected
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function uuidToSysId(id: string): string {
|
|
32
|
+
return id.includes('-') ? id.replace(/-/g, '') : id // already sys_id or unexpected
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the identifier name from an original source (TypeScript node)
|
|
37
|
+
* Searches for a VariableDeclaration ancestor and extracts the identifier name
|
|
38
|
+
*
|
|
39
|
+
* @param originalSource - The original TypeScript source node
|
|
40
|
+
* @returns The identifier name if found, undefined otherwise
|
|
41
|
+
*/
|
|
42
|
+
export function getIdentifierFromSource(originalSource: unknown): string | undefined {
|
|
43
|
+
if (ts.Node.isNode(originalSource)) {
|
|
44
|
+
const node = originalSource as ts.Node
|
|
45
|
+
const varDecl = node.getFirstAncestorByKind(ts.SyntaxKind.VariableDeclaration)
|
|
46
|
+
const idNode = varDecl?.getNameNode()
|
|
47
|
+
if (idNode) {
|
|
48
|
+
return idNode.getText()
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return undefined
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get the identifier name for an action/subflow instance from its original source
|
|
56
|
+
* Only checks if this node is DIRECTLY wrapped in a VariableDeclaration (not any ancestor)
|
|
57
|
+
* This prevents scope collisions where inner actions inherit parent Subflow/Flow variable names
|
|
58
|
+
*
|
|
59
|
+
* Use this specifically for preserving action/subflow variable names during transform
|
|
60
|
+
*
|
|
61
|
+
* @param originalSource - The original source to extract the identifier from
|
|
62
|
+
* @returns The identifier name if found, undefined otherwise
|
|
63
|
+
*/
|
|
64
|
+
export function getDirectVariableIdentifier(originalSource: unknown): string | undefined {
|
|
65
|
+
if (!ts.Node.isNode(originalSource)) {
|
|
66
|
+
return undefined
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const node = originalSource as ts.Node
|
|
70
|
+
|
|
71
|
+
// Only check immediate parent, not any ancestor
|
|
72
|
+
// This prevents actions inside Subflow/Flow bodies from inheriting the Subflow/Flow's variable name
|
|
73
|
+
const varDecl = node.getParentIfKind(ts.SyntaxKind.VariableDeclaration)
|
|
74
|
+
if (!varDecl) {
|
|
75
|
+
return undefined
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const idNode = varDecl.getNameNode()
|
|
79
|
+
return idNode?.getText()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get the identifier name from a record's original source
|
|
84
|
+
* Convenience wrapper around getIdentifierFromSource for Record types
|
|
85
|
+
*
|
|
86
|
+
* @param record - The record to extract the identifier from
|
|
87
|
+
* @returns The identifier name if found, undefined otherwise
|
|
88
|
+
*/
|
|
89
|
+
export function getIdentifierFromRecord(record: Record): string | undefined {
|
|
90
|
+
return getIdentifierFromSource(record.getOriginalSource())
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get the identifier name from a shape's original source
|
|
95
|
+
* Convenience wrapper around getIdentifierFromSource for Shape types
|
|
96
|
+
*
|
|
97
|
+
* @param shape - The shape to extract the identifier from
|
|
98
|
+
* @returns The identifier name if found, undefined otherwise
|
|
99
|
+
*/
|
|
100
|
+
export function getIdentifierFromShape(shape: Shape): string | undefined {
|
|
101
|
+
return getIdentifierFromSource(shape.getOriginalSource())
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Set of allowed FlowValueType helper function names for flow variable validation
|
|
106
|
+
*
|
|
107
|
+
* @constant {Set<string>}
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* // Supported types: StringColumn, IntegerColumn, DecimalColumn, ReferenceColumn,
|
|
111
|
+
* // DateTimeColumn, BooleanColumn, GenericColumn, FlowObject, FlowArray
|
|
112
|
+
* if (ALLOWED_VARIABLE_CALLEES.has('StringColumn')) {
|
|
113
|
+
* // StringColumn is supported
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export const ALLOWED_VARIABLE_CALLEES = new Set([
|
|
118
|
+
'StringColumn',
|
|
119
|
+
'IntegerColumn',
|
|
120
|
+
'DecimalColumn',
|
|
121
|
+
'ReferenceColumn',
|
|
122
|
+
'DateTimeColumn',
|
|
123
|
+
'BooleanColumn',
|
|
124
|
+
'FloatColumn',
|
|
125
|
+
'JsonColumn',
|
|
126
|
+
'GenericColumn',
|
|
127
|
+
'FlowObject',
|
|
128
|
+
'FlowArray',
|
|
129
|
+
])
|
|
130
|
+
|
|
131
|
+
export const ALLOWED_VARIABLE_CALLEES_IN_FLOW_OBJECT = new Set([
|
|
132
|
+
'StringColumn',
|
|
133
|
+
'IntegerColumn',
|
|
134
|
+
'DecimalColumn',
|
|
135
|
+
'DateTimeColumn',
|
|
136
|
+
'BooleanColumn',
|
|
137
|
+
'FlowObject',
|
|
138
|
+
'FlowArray',
|
|
139
|
+
])
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Validates a single flow variable call expression for type safety and correctness
|
|
143
|
+
*
|
|
144
|
+
* @param variableCall - The CallExpressionShape representing the variable definition
|
|
145
|
+
* @param path - The path/name of the variable for error reporting
|
|
146
|
+
* @param diagnostics - Diagnostics object for reporting validation errors
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* // Validates allowed types, GenericColumn columnType (json/float only),
|
|
151
|
+
* // and recursively validates FlowArray/FlowObject structures
|
|
152
|
+
* validateFlowVariableCall(StringColumn({ label: 'Name' }), 'flow_variables.userName', diagnostics)
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
export function validateFlowVariableCall(variableCall: CallExpressionShape, path: string, diagnostics: Diagnostics) {
|
|
156
|
+
const callee = variableCall.getCallee()
|
|
157
|
+
|
|
158
|
+
if (!ALLOWED_VARIABLE_CALLEES.has(callee)) {
|
|
159
|
+
diagnostics.error(
|
|
160
|
+
variableCall.getOriginalNode(),
|
|
161
|
+
`${path} uses unsupported type '${callee}'. Only FlowValueType helpers are allowed.`
|
|
162
|
+
)
|
|
163
|
+
} else if (callee === 'GenericColumn') {
|
|
164
|
+
const arg0 = variableCall.getArgument(0)
|
|
165
|
+
const colTypeNode = arg0.ifObject()?.get('columnType')
|
|
166
|
+
const colType = colTypeNode?.ifString()?.asString().getValue()
|
|
167
|
+
if (colType && colType !== 'json' && colType !== 'float') {
|
|
168
|
+
diagnostics.error(
|
|
169
|
+
colTypeNode!.getOriginalNode(),
|
|
170
|
+
`${path} GenericColumn supports only columnType 'json' or 'float'. Found '${colType}'.`
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
} else if (callee === 'FlowArray') {
|
|
174
|
+
// Validate FlowArray structure recursively
|
|
175
|
+
// Primitive types (StringColumn, IntegerColumn, etc.) are now supported as elementType
|
|
176
|
+
const arg0 = variableCall.getArgument(0)
|
|
177
|
+
const elementTypeNode = arg0.ifObject()?.get('elementType')
|
|
178
|
+
if (elementTypeNode?.if(CallExpressionShape)) {
|
|
179
|
+
const elementTypeCall = elementTypeNode.as(CallExpressionShape)
|
|
180
|
+
const elementTypeCallee = elementTypeCall.getCallee()
|
|
181
|
+
|
|
182
|
+
// Recursively validate if elementType is FlowObject or FlowArray
|
|
183
|
+
if (elementTypeCallee === 'FlowObject') {
|
|
184
|
+
validateFlowObjectFields(elementTypeCall, `${path}.elementType`, diagnostics)
|
|
185
|
+
} else if (elementTypeCallee === 'FlowArray') {
|
|
186
|
+
validateFlowVariableCall(elementTypeCall, `${path}.elementType`, diagnostics)
|
|
187
|
+
}
|
|
188
|
+
// Primitive column types (StringColumn, IntegerColumn, etc.) are allowed - no validation needed
|
|
189
|
+
}
|
|
190
|
+
} else if (callee === 'FlowObject') {
|
|
191
|
+
validateFlowObjectFields(variableCall, path, diagnostics)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Recursively validates FlowObject fields for nested FlowArray violations and other type validations
|
|
197
|
+
*
|
|
198
|
+
* @param flowObjectCall - The CallExpressionShape representing the FlowObject definition
|
|
199
|
+
* @param path - The path/name of the variable for error reporting
|
|
200
|
+
* @param diagnostics - Diagnostics object for reporting validation errors
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* // Validates all field types are allowed, recursively validates nested
|
|
205
|
+
* // FlowArray/FlowObject structures, and checks GenericColumn columnType
|
|
206
|
+
* FlowObject({ fields: { name: StringColumn({...}), data: FlowArray({...}) } })
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export function validateFlowObjectFields(flowObjectCall: CallExpressionShape, path: string, diagnostics: Diagnostics) {
|
|
210
|
+
const arg0 = flowObjectCall.getArgument(0)
|
|
211
|
+
if (arg0.ifObject()) {
|
|
212
|
+
const fieldsNode = arg0.asObject().get('fields')
|
|
213
|
+
fieldsNode
|
|
214
|
+
?.ifObject()
|
|
215
|
+
?.entries()
|
|
216
|
+
.forEach(([fieldName, fieldValue]) => {
|
|
217
|
+
if (fieldValue.if(CallExpressionShape)) {
|
|
218
|
+
const fieldCall = fieldValue.as(CallExpressionShape)
|
|
219
|
+
const fieldPath = `${path}.${fieldName}`
|
|
220
|
+
const fieldCallee = fieldCall.getCallee()
|
|
221
|
+
|
|
222
|
+
if (!ALLOWED_VARIABLE_CALLEES.has(fieldCallee)) {
|
|
223
|
+
diagnostics.error(
|
|
224
|
+
fieldValue.getOriginalNode(),
|
|
225
|
+
`${fieldPath} uses unsupported type '${fieldCallee}'. Only FlowValueType helpers are allowed.`
|
|
226
|
+
)
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// work around until DEF0797916 is fixed : Check if ReferenceColumn, JSONColumn, FloatColumn is used inside a FlowObject in flow variables
|
|
231
|
+
if (!ALLOWED_VARIABLE_CALLEES_IN_FLOW_OBJECT.has(fieldCallee)) {
|
|
232
|
+
diagnostics.error(
|
|
233
|
+
fieldValue.getOriginalNode(),
|
|
234
|
+
`Unsupported type '${fieldCallee}' inside flow object in the flow variable is not allowed for flow variables at ${fieldPath}.`
|
|
235
|
+
)
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
validateFlowVariableCall(fieldCall, fieldPath, diagnostics)
|
|
240
|
+
} else {
|
|
241
|
+
diagnostics.error(
|
|
242
|
+
fieldValue.getOriginalNode(),
|
|
243
|
+
`${path}.${fieldName} is not a valid variable expression.`
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Recursively searches ancestors of a node to find a CallExpression
|
|
252
|
+
* with any of the given callee names.
|
|
253
|
+
*
|
|
254
|
+
* @param node - The starting node
|
|
255
|
+
* @param calleeNames - One or more function names to match against
|
|
256
|
+
* @returns The CallExpression if found, otherwise undefined
|
|
257
|
+
*/
|
|
258
|
+
export function findAncestorByCalleeName(
|
|
259
|
+
node: ts.Node | undefined,
|
|
260
|
+
...calleeNames: string[]
|
|
261
|
+
): ts.CallExpression | undefined {
|
|
262
|
+
if (!node) {
|
|
263
|
+
return undefined
|
|
264
|
+
}
|
|
265
|
+
if (ts.Node.isCallExpression(node)) {
|
|
266
|
+
const expr = node.getExpression()
|
|
267
|
+
// Handle simple identifiers: Flow, Subflow, etc.
|
|
268
|
+
if (ts.Node.isIdentifier(expr) && calleeNames.includes(expr.getText())) {
|
|
269
|
+
return node
|
|
270
|
+
}
|
|
271
|
+
// Handle property access expressions: wfa.flowLogic.if, wfa.flowLogic.forEach, etc.
|
|
272
|
+
if (ts.Node.isPropertyAccessExpression(expr) && calleeNames.includes(expr.getText())) {
|
|
273
|
+
return node
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// recurse upwards
|
|
277
|
+
return findAncestorByCalleeName(node.getFirstAncestorByKind(ts.SyntaxKind.CallExpression), ...calleeNames)
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Resolves a data pill shape by transforming it and handling trigger pills
|
|
282
|
+
* @param shape - The shape to resolve (PropertyAccessShape, TemplateExpressionShape, or IdentifierShape)
|
|
283
|
+
* @param transform - The transform instance
|
|
284
|
+
* @returns The resolved value or the original shape value if not a data pill
|
|
285
|
+
*/
|
|
286
|
+
export async function resolveDataPillShape(
|
|
287
|
+
shape: PillShape | PropertyAccessShape | TemplateExpressionShape | IdentifierShape,
|
|
288
|
+
transform: Transform
|
|
289
|
+
): Promise<unknown> {
|
|
290
|
+
const mayBePills = await transform.toSubclass(shape, DataPillPlugin)
|
|
291
|
+
if (mayBePills.success) {
|
|
292
|
+
let processedShape = mayBePills.value
|
|
293
|
+
|
|
294
|
+
// Magical code to handle trigger pills :) as they do not follow the same pattern as other pills
|
|
295
|
+
// subflow inputs will be {{subflow.<pill-name>}}, flow variable {{flow_variable.<pill-name>}} but for triggers {{Created_1.<pill-name>}}
|
|
296
|
+
if (processedShape instanceof PillShape && processedShape.getRootIdentifier() === 'trigger') {
|
|
297
|
+
processedShape = await resolveTriggerPills(processedShape, transform)
|
|
298
|
+
}
|
|
299
|
+
// Magical code to handle PillTemplateShape with trigger pills
|
|
300
|
+
else if (processedShape.is(PillTemplateShape)) {
|
|
301
|
+
// Process each pill shape in the template
|
|
302
|
+
const pillShapes = processedShape.getParts()
|
|
303
|
+
const elements = pillShapes.getElements(false)
|
|
304
|
+
|
|
305
|
+
for (const shapePart of elements) {
|
|
306
|
+
if (shapePart instanceof PillShape && shapePart.getRootIdentifier() === 'trigger') {
|
|
307
|
+
await resolveTriggerPills(shapePart, transform) // mutates shapePart
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return processedShape.getValue()
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return shape.getValue()
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
async function resolveTriggerPills(shape: PillShape, transform: Transform) {
|
|
319
|
+
const flowCallExpression = findAncestorByCalleeName(shape.getOriginalNode(), 'Flow')
|
|
320
|
+
if (flowCallExpression instanceof ts.CallExpression) {
|
|
321
|
+
if (flowCallExpression?.getArguments()?.length > 2) {
|
|
322
|
+
const triggerExpression = flowCallExpression?.getArguments()[1]
|
|
323
|
+
const triggerRecord = triggerExpression
|
|
324
|
+
? await transform.toRecord(triggerExpression, CallExpressionPlugin, TriggerInstancePlugin)
|
|
325
|
+
: { success: false, value: undefined }
|
|
326
|
+
|
|
327
|
+
if (triggerRecord.success && triggerRecord.value?.isRecord()) {
|
|
328
|
+
const triggerName = triggerRecord.value.asRecord().get('name')?.getValue() as string
|
|
329
|
+
shape.setRootIdentifier(triggerName.concat('_1')) // <-- TODO: Temp code to match what UI does now, but raised a defect against FD team to fix it in the app itself.
|
|
330
|
+
return shape
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return shape
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Function to get the record by transforming the FDInstanceShape
|
|
339
|
+
* @param shape - The shape to transform (VariableStatementShape, CallExpressionShape)
|
|
340
|
+
* @param transform - The transform instance
|
|
341
|
+
* @returns The instance record of the FDInstanceShape
|
|
342
|
+
*/
|
|
343
|
+
export async function getRecordFromFlowInstaceShape(shape: Shape, transform: Transform) {
|
|
344
|
+
let instanceRecord: Record | undefined
|
|
345
|
+
const callExpressionShape = shape.is(VariableStatementShape) ? shape.getInitializer() : shape
|
|
346
|
+
if (callExpressionShape.is(CallExpressionShape)) {
|
|
347
|
+
//Get the Flow Instance Shape using toSubclass() utility
|
|
348
|
+
const flowInstanceShape = await transform.toSubclass(callExpressionShape, FlowLogicPlugin, FlowInstancePlugin)
|
|
349
|
+
if (flowInstanceShape.success && flowInstanceShape.value.is(FDInstanceShape)) {
|
|
350
|
+
//Get the Flow Instance Record using toRecord() utility
|
|
351
|
+
const flowInstanceRecord = await transform.toRecord(
|
|
352
|
+
flowInstanceShape.value,
|
|
353
|
+
FlowLogicPlugin,
|
|
354
|
+
FlowInstancePlugin
|
|
355
|
+
)
|
|
356
|
+
if (flowInstanceRecord.success) {
|
|
357
|
+
instanceRecord = flowInstanceRecord.value
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return instanceRecord
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export function checkForUnsupportedFlowDescendants(descendants: Database, record: Record, logger: Logger): boolean {
|
|
365
|
+
if (descendants) {
|
|
366
|
+
for (const tableName of UNSUPPORTED_FLOW_DESCENDANTS) {
|
|
367
|
+
const descendantRecords = descendants.query(tableName)
|
|
368
|
+
|
|
369
|
+
if (descendantRecords?.length > 0) {
|
|
370
|
+
logger.warn(
|
|
371
|
+
`Unsupported flow descendant tables found, falling back to Record() api. Flow = ${record.getId().getValue()}, table = ${tableName}`
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
return true
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return false
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export const getCoreActionIdentifier = (sysId: string) => {
|
|
382
|
+
const actionName = CORE_ACTIONS_SYS_ID_NAME_MAP[sysId]
|
|
383
|
+
return actionName ? `${CORE_ACTIONS_PREFIX}.${actionName}` : undefined
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Extracts the order value from a record for sorting purposes.
|
|
388
|
+
* Converts the 'order' field to a number, defaulting to 0 if not present or invalid.
|
|
389
|
+
*
|
|
390
|
+
* @param record - The record containing the order field
|
|
391
|
+
* @returns The numeric order value
|
|
392
|
+
*/
|
|
393
|
+
export function getOrder(x: ObjectShape) {
|
|
394
|
+
return Number(x.get('order').asString()?.getValue() ?? 0)
|
|
395
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -35,10 +35,29 @@ export * from './html-import-plugin'
|
|
|
35
35
|
export * from './static-content-plugin'
|
|
36
36
|
export * from './script-action-plugin'
|
|
37
37
|
export * from './claims-plugin'
|
|
38
|
+
export * from './flow/plugins/flow-action-definition-plugin'
|
|
39
|
+
export * from './flow/plugins/wfa-datapill-plugin'
|
|
40
|
+
export * from './flow/plugins/flow-instance-plugin'
|
|
41
|
+
export * from './flow/plugins/inline-script-plugin'
|
|
42
|
+
export * from './flow/plugins/approval-rules-plugin'
|
|
43
|
+
export * from './flow/plugins/flow-trigger-instance-plugin'
|
|
44
|
+
export * from './flow/plugins/flow-definition-plugin'
|
|
45
|
+
export * from './flow/plugins/trigger-plugin'
|
|
46
|
+
export * from './flow/flow-logic/flow-logic-plugin'
|
|
47
|
+
export * from './flow/plugins/step-instance-plugin'
|
|
48
|
+
export * from './flow/plugins/step-definition-plugin'
|
|
49
|
+
export * from './flow/plugins/flow-diagnostics-plugin'
|
|
38
50
|
export * from './ui-policy-plugin'
|
|
39
51
|
export * from './import-sets-plugin'
|
|
40
52
|
export * from './now-attach-plugin'
|
|
53
|
+
export * from './sla-plugin'
|
|
54
|
+
export * from './email-notification-plugin'
|
|
41
55
|
|
|
56
|
+
export * from './service-catalog'
|
|
57
|
+
export * from './ux-list-menu-config-plugin'
|
|
58
|
+
export * from './workspace-plugin'
|
|
59
|
+
export * from './dashboard/dashboard-plugin'
|
|
60
|
+
export * from './applicability-plugin'
|
|
42
61
|
// non-plugins
|
|
43
62
|
export * from './atf/step-configs'
|
|
44
|
-
export { REPACK_OUTPUT_DIR, checkModuleExists } from './repack'
|
|
63
|
+
export { REPACK_OUTPUT_DIR, checkModuleExists, resolveModule } from './repack'
|
package/src/list-plugin.ts
CHANGED
|
@@ -197,7 +197,7 @@ export const ListPlugin = Plugin.create({
|
|
|
197
197
|
},
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
|
-
async diff(existing, incoming, { factory }) {
|
|
200
|
+
async diff(existing, incoming, _, { factory }) {
|
|
201
201
|
if (incoming.query().length === 0 || existing.query().length === 0) {
|
|
202
202
|
return {
|
|
203
203
|
success: true,
|
package/src/now-attach-plugin.ts
CHANGED
|
@@ -150,6 +150,10 @@ export class NowAttachShape extends CallExpressionShape implements AssociateReco
|
|
|
150
150
|
return [attachment, ...attachmentDocs]
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
override equals<E = unknown>(value: E): boolean {
|
|
154
|
+
return value instanceof NowAttachShape && value.baseProperties.hash === this.baseProperties.hash
|
|
155
|
+
}
|
|
156
|
+
|
|
153
157
|
static async create(source: Source, fs: FileSystem, filePath: string) {
|
|
154
158
|
const buffer = (await fs.readFileSync(filePath)) as Buffer
|
|
155
159
|
|
|
@@ -210,17 +214,23 @@ export const NowAttachPlugin = Plugin.create({
|
|
|
210
214
|
records: {
|
|
211
215
|
'*': {
|
|
212
216
|
async toFile(record, { config, database, factory, transform }) {
|
|
217
|
+
const entries = record.entries()
|
|
218
|
+
const hasAttachments =
|
|
219
|
+
entries.some(([, shape]) => isLazyValue(shape)) ||
|
|
220
|
+
Object.keys(record.properties()).some((field) => hasAssociatedRecords(record.get(field)))
|
|
221
|
+
|
|
222
|
+
if (!hasAttachments) {
|
|
223
|
+
return { success: false }
|
|
224
|
+
}
|
|
225
|
+
|
|
213
226
|
const recordBuilder = unloadBuilder(config)
|
|
214
227
|
const updateName = await transform.getUpdateName(record)
|
|
215
228
|
const builder = recordBuilder.record(record, updateName)
|
|
216
|
-
let attachmentsProcessed = false
|
|
217
229
|
|
|
218
|
-
|
|
219
|
-
.entries()
|
|
230
|
+
entries
|
|
220
231
|
.sort(([a], [b]) => a.localeCompare(b)) // Sort keys to make outputs more deterministic
|
|
221
232
|
.forEach(([prop, shape]) => {
|
|
222
233
|
if (isLazyValue(shape)) {
|
|
223
|
-
attachmentsProcessed = true
|
|
224
234
|
builder.field(prop, shape.evaluate(record, prop))
|
|
225
235
|
} else {
|
|
226
236
|
builder.field(prop, shape)
|
|
@@ -230,7 +240,6 @@ export const NowAttachPlugin = Plugin.create({
|
|
|
230
240
|
for (const field in record.properties()) {
|
|
231
241
|
const shape = record.get(field)
|
|
232
242
|
if (hasAssociatedRecords(shape)) {
|
|
233
|
-
attachmentsProcessed = true
|
|
234
243
|
for (const rec of await shape.createAssociatedRecords({
|
|
235
244
|
parentRecord: record,
|
|
236
245
|
factory,
|
|
@@ -245,12 +254,6 @@ export const NowAttachPlugin = Plugin.create({
|
|
|
245
254
|
}
|
|
246
255
|
}
|
|
247
256
|
|
|
248
|
-
if (!attachmentsProcessed) {
|
|
249
|
-
return {
|
|
250
|
-
success: false,
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
257
|
const claims = database
|
|
255
258
|
.query('sys_claim')
|
|
256
259
|
.filter((claim) => claim.get('metadata_update_name').equals(updateName))
|
package/src/now-ref-plugin.ts
CHANGED
|
@@ -24,7 +24,7 @@ export const NowRefPlugin = Plugin.create({
|
|
|
24
24
|
.getArgument(1)
|
|
25
25
|
.as(
|
|
26
26
|
[StringShape, ObjectShape],
|
|
27
|
-
'The second argument to Now.ref() must be a GUID or a coalesce keys object'
|
|
27
|
+
'The second argument to Now.ref() must be a GUID, a Now ID string, or a coalesce keys object'
|
|
28
28
|
)
|
|
29
29
|
const maybeKeys = callExpression.hasArgument(2)
|
|
30
30
|
? callExpression
|
package/src/record-plugin.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Test,
|
|
11
11
|
UserPreference,
|
|
12
12
|
ImportSet,
|
|
13
|
+
Sla,
|
|
13
14
|
} from '@servicenow/sdk-core/runtime/app'
|
|
14
15
|
import {
|
|
15
16
|
SPWidget,
|
|
@@ -18,12 +19,22 @@ import {
|
|
|
18
19
|
CssInclude,
|
|
19
20
|
JsInclude,
|
|
20
21
|
} from '@servicenow/sdk-core/runtime/service-portal'
|
|
22
|
+
import {
|
|
23
|
+
CatalogItem,
|
|
24
|
+
CatalogClientScript,
|
|
25
|
+
VariableSet,
|
|
26
|
+
CatalogUiPolicy,
|
|
27
|
+
CatalogItemRecordProducer,
|
|
28
|
+
} from '@servicenow/sdk-core/runtime/service-catalog'
|
|
21
29
|
import { ClientScript } from '@servicenow/sdk-core/runtime/clientscript'
|
|
22
30
|
import { ScriptAction, ScriptInclude } from '@servicenow/sdk-core/runtime/sys'
|
|
23
31
|
import { List } from '@servicenow/sdk-core/runtime/ui'
|
|
24
32
|
import { Table } from '@servicenow/sdk-core/runtime/db'
|
|
25
33
|
import { RestApi } from '@servicenow/sdk-core/runtime/rest'
|
|
34
|
+
import { EmailNotification } from '@servicenow/sdk-core/runtime/notification'
|
|
26
35
|
import { UiAction, UiPage, UiPolicy } from '@servicenow/sdk-core/runtime/ui'
|
|
36
|
+
import { Applicability, UxListMenuConfig, Workspace } from '@servicenow/sdk-core/runtime/uxf'
|
|
37
|
+
import { Dashboard } from '@servicenow/sdk-core/runtime/dashboard'
|
|
27
38
|
|
|
28
39
|
export const RecordPlugin = Plugin.create({
|
|
29
40
|
name: 'RecordPlugin',
|
|
@@ -39,7 +50,40 @@ export const RecordPlugin = Plugin.create({
|
|
|
39
50
|
value: changeDatabase.hasChanges() ? new Database(changeDatabase.query()) : new Database(),
|
|
40
51
|
}
|
|
41
52
|
},
|
|
42
|
-
async toShape(record) {
|
|
53
|
+
async toShape(record, { compiler }) {
|
|
54
|
+
const tableName = record.getTable()
|
|
55
|
+
const columnTypes = compiler.getTableColumnTypes(tableName)
|
|
56
|
+
|
|
57
|
+
const dataProperties = record.transform(({ $ }) =>
|
|
58
|
+
Object.fromEntries(
|
|
59
|
+
record
|
|
60
|
+
.keys()
|
|
61
|
+
.filter((key) => key !== 'sys_name')
|
|
62
|
+
.map((key) => {
|
|
63
|
+
const shape = record.get(key)
|
|
64
|
+
if (columnTypes?.has(key) && shape?.isString()) {
|
|
65
|
+
const expectedType = columnTypes.get(key)
|
|
66
|
+
try {
|
|
67
|
+
if (expectedType === 'boolean') {
|
|
68
|
+
return [key, $.val(shape.toBoolean())]
|
|
69
|
+
} else if (expectedType === 'number') {
|
|
70
|
+
return [key, $.val(shape.toNumber())]
|
|
71
|
+
} else if (expectedType === 'array') {
|
|
72
|
+
return [key, $.val(shape.asString().split(',')).def([''])]
|
|
73
|
+
} else if (expectedType === 'array-optional') {
|
|
74
|
+
const arrayParts = shape.asString().includes(',')
|
|
75
|
+
return [key, arrayParts ? $.val(shape.asString().split(',')).def(['']) : $]
|
|
76
|
+
}
|
|
77
|
+
} catch {
|
|
78
|
+
// Keep as string if conversion fails
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return [key, shape?.isString() ? $.def('') : $] //to avoid writing empty string values to the code
|
|
83
|
+
})
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
|
|
43
87
|
const value = new CallExpressionShape({
|
|
44
88
|
source: record,
|
|
45
89
|
callee: 'Record',
|
|
@@ -47,16 +91,8 @@ export const RecordPlugin = Plugin.create({
|
|
|
47
91
|
args: [
|
|
48
92
|
{
|
|
49
93
|
$id: NowIdShape.from(record),
|
|
50
|
-
table:
|
|
51
|
-
data:
|
|
52
|
-
({ $ }) =>
|
|
53
|
-
Object.fromEntries(
|
|
54
|
-
record
|
|
55
|
-
.keys()
|
|
56
|
-
.filter((key) => key !== 'sys_name')
|
|
57
|
-
.map((key) => [key, record.get(key).isString() ? $.def('') : $])
|
|
58
|
-
) //to avoid writing empty string values to the code
|
|
59
|
-
),
|
|
94
|
+
table: tableName,
|
|
95
|
+
data: dataProperties,
|
|
60
96
|
},
|
|
61
97
|
],
|
|
62
98
|
})
|
|
@@ -170,6 +206,7 @@ export const RecordPlugin = Plugin.create({
|
|
|
170
206
|
})
|
|
171
207
|
|
|
172
208
|
export const TableOwnership = {
|
|
209
|
+
contract_sla: Sla.name,
|
|
173
210
|
sys_security_acl: Acl.name,
|
|
174
211
|
sys_security_acl_role: Acl.name,
|
|
175
212
|
sys_app_application: ApplicationMenu.name,
|
|
@@ -210,9 +247,37 @@ export const TableOwnership = {
|
|
|
210
247
|
sys_ui_policy_action: UiPolicy.name,
|
|
211
248
|
sys_ui_policy_rl_action: UiPolicy.name,
|
|
212
249
|
sysevent_script_action: ScriptAction.name,
|
|
250
|
+
sysevent_email_action: EmailNotification.name,
|
|
213
251
|
sys_db_object: Table.name,
|
|
214
252
|
sys_dictionary: Table.name,
|
|
253
|
+
sys_hub_flow: 'Flow',
|
|
254
|
+
sys_hub_trigger_instance_v2: 'wfa.trigger',
|
|
255
|
+
sys_hub_action_instance_v2: 'wfa.action',
|
|
256
|
+
sys_hub_sub_flow_instance_v2: 'wfa.subflow',
|
|
257
|
+
sys_hub_flow_logic_instance_v2: 'wfa.flowLogic',
|
|
258
|
+
sys_flow_step_definition: 'ActionStepDefinition',
|
|
259
|
+
sys_decision: 'DecisionTablePlugin',
|
|
260
|
+
sys_hub_action_type_definition: 'Action',
|
|
261
|
+
sys_hub_step_instance: 'wfa.action_step',
|
|
215
262
|
sys_transform_map: ImportSet.name,
|
|
216
263
|
sys_transform_entry: ImportSet.name,
|
|
217
264
|
sys_transform_script: ImportSet.name,
|
|
265
|
+
sys_ux_applicability: Applicability.name,
|
|
266
|
+
sys_ux_list_menu_config: UxListMenuConfig.name,
|
|
267
|
+
sys_ux_list_category: UxListMenuConfig.name,
|
|
268
|
+
sys_ux_list: UxListMenuConfig.name,
|
|
269
|
+
sys_ux_applicability_m2m_list: UxListMenuConfig.name,
|
|
270
|
+
sys_ux_page_registry: Workspace.name,
|
|
271
|
+
sys_ux_app_config: Workspace.name,
|
|
272
|
+
par_dashboard: Dashboard.name,
|
|
273
|
+
par_dashboard_canvas: Dashboard.name,
|
|
274
|
+
par_dashboard_tab: Dashboard.name,
|
|
275
|
+
par_dashboard_widget: Dashboard.name,
|
|
276
|
+
par_dashboard_permission: Dashboard.name,
|
|
277
|
+
par_dashboard_visibility: Dashboard.name,
|
|
278
|
+
item_option_new_set: VariableSet.name,
|
|
279
|
+
sc_cat_item: CatalogItem.name,
|
|
280
|
+
sc_cat_item_producer: CatalogItemRecordProducer.name,
|
|
281
|
+
catalog_script_client: CatalogClientScript.name,
|
|
282
|
+
catalog_ui_policy: CatalogUiPolicy.name,
|
|
218
283
|
}
|
package/src/repack/index.ts
CHANGED
|
@@ -11,6 +11,16 @@ export async function checkModuleExists(
|
|
|
11
11
|
return repackService.checkModuleExists(module)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export async function resolveModule(
|
|
15
|
+
module: string,
|
|
16
|
+
logger: RepackOptions['logger'],
|
|
17
|
+
fs: RepackOptions['fs'],
|
|
18
|
+
workingDir: RepackOptions['workingDir']
|
|
19
|
+
): Promise<string | undefined> {
|
|
20
|
+
const repackService = await RepackService.create(logger, fs, workingDir)
|
|
21
|
+
return repackService.resolveModule(module)
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
export const REPACK_OUTPUT_DIR = path.join('.now', '.output')
|
|
15
25
|
|
|
16
26
|
export class RepackService {
|
|
@@ -52,4 +62,8 @@ export class RepackService {
|
|
|
52
62
|
async checkModuleExists(module: string) {
|
|
53
63
|
return this.repack.checkModuleExists(module, this.fs, this.workingDir, this.logger!)
|
|
54
64
|
}
|
|
65
|
+
|
|
66
|
+
async resolveModule(module: string): Promise<string | undefined> {
|
|
67
|
+
return this.repack.resolveModule(module, this.fs, this.workingDir, this.logger)
|
|
68
|
+
}
|
|
55
69
|
}
|