@servicenow/sdk-build-plugins 4.1.1 → 4.3.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 +22 -4
- 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/application-menu-plugin.js +1 -0
- package/dist/application-menu-plugin.js.map +1 -1
- package/dist/atf/step-configs.d.ts +13 -12
- package/dist/atf/step-configs.js.map +1 -1
- package/dist/atf/test-plugin.d.ts +1 -1
- package/dist/atf/test-plugin.js +13 -7
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +58 -14
- 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/claims-plugin.js +1 -1
- package/dist/claims-plugin.js.map +1 -1
- package/dist/client-script-plugin.js +5 -17
- package/dist/client-script-plugin.js.map +1 -1
- package/dist/column/column-helper.d.ts +1 -1
- package/dist/column/column-helper.js +46 -2
- package/dist/column/column-helper.js.map +1 -1
- package/dist/column/column-to-record.js +6 -4
- package/dist/column/column-to-record.js.map +1 -1
- package/dist/column-plugin.js +107 -28
- 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 +6 -0
- package/dist/data-plugin.js +156 -0
- package/dist/data-plugin.js.map +1 -0
- 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 +930 -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 +324 -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 +65 -0
- package/dist/flow/utils/flow-constants.js +223 -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/utils.d.ts +117 -0
- package/dist/flow/utils/utils.js +345 -0
- package/dist/flow/utils/utils.js.map +1 -0
- package/dist/import-sets-plugin.d.ts +2 -0
- package/dist/import-sets-plugin.js +412 -0
- package/dist/import-sets-plugin.js.map +1 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/json-plugin.d.ts +4 -4
- package/dist/json-plugin.js +21 -7
- package/dist/json-plugin.js.map +1 -1
- package/dist/list-plugin.js +83 -1
- package/dist/list-plugin.js.map +1 -1
- package/dist/now-attach-plugin.d.ts +36 -0
- package/dist/now-attach-plugin.js +320 -0
- package/dist/now-attach-plugin.js.map +1 -0
- package/dist/now-config-plugin.js +3 -0
- package/dist/now-config-plugin.js.map +1 -1
- package/dist/now-include-plugin.js +7 -1
- package/dist/now-include-plugin.js.map +1 -1
- package/dist/package-json-plugin.js +2 -2
- package/dist/package-json-plugin.js.map +1 -1
- package/dist/record-plugin.d.ts +35 -0
- package/dist/record-plugin.js +109 -23
- 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/repack/lint/Rules.js.map +1 -1
- package/dist/rest-api-plugin.js +81 -74
- package/dist/rest-api-plugin.js.map +1 -1
- package/dist/role-plugin.js +1 -0
- package/dist/role-plugin.js.map +1 -1
- package/dist/server-module-plugin/index.js +53 -6
- 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 +139 -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 +169 -0
- package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -0
- package/dist/service-catalog/shape-to-record.d.ts +7 -0
- package/dist/service-catalog/shape-to-record.js +232 -0
- package/dist/service-catalog/shape-to-record.js.map +1 -0
- package/dist/service-catalog/utils.d.ts +313 -0
- package/dist/service-catalog/utils.js +1144 -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/service-portal/widget-plugin.js +4 -1
- package/dist/service-portal/widget-plugin.js.map +1 -1
- 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.d.ts +1 -0
- package/dist/static-content-plugin.js +4 -3
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +49 -4
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +2 -1
- package/dist/ui-page-plugin.js.map +1 -1
- package/dist/ui-policy-plugin.d.ts +2 -0
- package/dist/ui-policy-plugin.js +405 -0
- package/dist/ui-policy-plugin.js.map +1 -0
- package/dist/utils.d.ts +19 -1
- package/dist/utils.js +40 -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/view-plugin.js +1 -1
- package/dist/view-plugin.js.map +1 -1
- 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/_types/eslint-plugin-es-x.d.ts +17 -0
- package/src/_types/md5.js.d.ts +8 -0
- package/src/acl-plugin.ts +33 -10
- package/src/applicability-plugin.ts +82 -0
- package/src/application-menu-plugin.ts +1 -0
- package/src/atf/step-configs.ts +14 -12
- package/src/atf/test-plugin.ts +46 -24
- package/src/basic-syntax-plugin.ts +71 -14
- package/src/business-rule-plugin.ts +9 -5
- package/src/call-expression-plugin.ts +2 -130
- package/src/claims-plugin.ts +1 -1
- package/src/client-script-plugin.ts +8 -22
- package/src/column/column-helper.ts +65 -3
- package/src/column/column-to-record.ts +6 -4
- package/src/column-plugin.ts +142 -40
- 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 +194 -0
- 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 +1148 -0
- package/src/flow/plugins/flow-trigger-instance-plugin.ts +426 -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 +276 -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/utils.ts +395 -0
- package/src/import-sets-plugin.ts +542 -0
- package/src/index.ts +25 -1
- package/src/json-plugin.ts +31 -12
- package/src/list-plugin.ts +91 -1
- package/src/now-attach-plugin.ts +403 -0
- package/src/now-config-plugin.ts +6 -2
- package/src/now-include-plugin.ts +8 -1
- package/src/package-json-plugin.ts +3 -3
- package/src/record-plugin.ts +126 -30
- package/src/repack/index.ts +14 -0
- package/src/repack/lint/Rules.ts +1 -10
- package/src/rest-api-plugin.ts +106 -100
- package/src/role-plugin.ts +1 -0
- package/src/server-module-plugin/index.ts +74 -22
- 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 +251 -0
- package/src/service-catalog/shape-to-record.ts +275 -0
- package/src/service-catalog/utils.ts +1362 -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/service-portal/widget-plugin.ts +4 -1
- package/src/sla/sla-validators.ts +331 -0
- package/src/sla-plugin.ts +358 -0
- package/src/static-content-plugin.ts +2 -2
- package/src/table-plugin.ts +66 -9
- package/src/ui-page-plugin.ts +2 -1
- package/src/ui-policy-plugin.ts +505 -0
- package/src/utils.ts +50 -1
- package/src/ux-list-menu-config-plugin.ts +312 -0
- package/src/view-plugin.ts +1 -1
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicenow/sdk-build-plugins",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "ServiceNow SDK Build System Plugins",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,32 +13,30 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@cyclonedx/cyclonedx-library": "8.6.0",
|
|
16
|
-
"@servicenow/glide": "
|
|
16
|
+
"@servicenow/glide": "27.0.4",
|
|
17
17
|
"eslint": "8.50.0",
|
|
18
18
|
"eslint-formatter-stylish": "8.40.0",
|
|
19
19
|
"eslint-plugin-es-x": "7.2.0",
|
|
20
|
-
"fast-xml-parser": "
|
|
20
|
+
"fast-xml-parser": "5.3.7",
|
|
21
21
|
"globals": "13.23.0",
|
|
22
|
-
"
|
|
23
|
-
"lodash": "4.17.21",
|
|
22
|
+
"lodash": "4.17.23",
|
|
24
23
|
"md5.js": "1.3.5",
|
|
25
24
|
"mime-types": "2.1.35",
|
|
26
|
-
"moo": "0.5.2",
|
|
27
|
-
"nearley": "2.20.1",
|
|
28
25
|
"packageurl-js": "2.0.1",
|
|
29
26
|
"xmlbuilder2": "3.1.1",
|
|
27
|
+
"xml-js": "1.6.11",
|
|
30
28
|
"zod": "3.22.4",
|
|
31
|
-
"@servicenow/eslint-plugin-sdk-app-plugin": "4.
|
|
32
|
-
"@servicenow/sdk-
|
|
33
|
-
"@servicenow/sdk-
|
|
34
|
-
"@servicenow/sdk-core": "4.
|
|
29
|
+
"@servicenow/eslint-plugin-sdk-app-plugin": "4.3.0",
|
|
30
|
+
"@servicenow/sdk-build-core": "4.3.0",
|
|
31
|
+
"@servicenow/sdk-repack": "4.3.0",
|
|
32
|
+
"@servicenow/sdk-core": "4.3.0"
|
|
35
33
|
},
|
|
36
34
|
"overrides": {
|
|
37
35
|
"micromatch": "4.0.7"
|
|
38
36
|
},
|
|
39
37
|
"devDependencies": {
|
|
40
38
|
"@types/eslint": "8.56.0",
|
|
41
|
-
"@types/lodash": "4.
|
|
39
|
+
"@types/lodash": "4.17.23",
|
|
42
40
|
"@types/mime-types": "2.1.4"
|
|
43
41
|
},
|
|
44
42
|
"engines": {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare module 'eslint-plugin-es-x/lib/rules/no-dynamic-import.js' {
|
|
2
|
+
import type { Rule } from 'eslint'
|
|
3
|
+
const rule: Rule.RuleModule
|
|
4
|
+
export default rule
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module 'eslint-plugin-es-x/lib/rules/no-regexp-lookbehind-assertions.js' {
|
|
8
|
+
import type { Rule } from 'eslint'
|
|
9
|
+
const rule: Rule.RuleModule
|
|
10
|
+
export default rule
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module 'eslint-plugin-es-x/lib/rules/no-regexp-unicode-property-escapes.js' {
|
|
14
|
+
import type { Rule } from 'eslint'
|
|
15
|
+
const rule: Rule.RuleModule
|
|
16
|
+
export default rule
|
|
17
|
+
}
|
package/src/acl-plugin.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CallExpressionShape, isGUID, Plugin, type Record } from '@servicenow/sd
|
|
|
2
2
|
import { AclTypes, AclOperations, AclAttributes, AclNamedTypes } from '@servicenow/sdk-core/runtime/app'
|
|
3
3
|
import { ModuleFunctionShape } from './server-module-plugin'
|
|
4
4
|
import { NowIdShape } from './now-id-plugin'
|
|
5
|
-
import { generateDeprecatedDiagnostics } from './utils'
|
|
5
|
+
import { createSdkDocEntry, generateDeprecatedDiagnostics } from './utils'
|
|
6
6
|
|
|
7
7
|
const ExecuteOnlyTypes = new Set([
|
|
8
8
|
'client_callable_flow_object',
|
|
@@ -39,6 +39,7 @@ const aclAliases = {
|
|
|
39
39
|
*/
|
|
40
40
|
export const AclPlugin = Plugin.create({
|
|
41
41
|
name: 'AclPlugin',
|
|
42
|
+
docs: [createSdkDocEntry('Acl', ['sys_security_acl'])],
|
|
42
43
|
records: {
|
|
43
44
|
sys_security_acl: {
|
|
44
45
|
relationships: {
|
|
@@ -54,7 +55,7 @@ export const AclPlugin = Plugin.create({
|
|
|
54
55
|
},
|
|
55
56
|
},
|
|
56
57
|
toShape(record, { descendants }) {
|
|
57
|
-
const type = reverseLookup(AclTypes, record.get('type').getValue()) || record.get('type')
|
|
58
|
+
const type = reverseLookup(AclTypes, record.get('type').getValue() as string) || record.get('type')
|
|
58
59
|
const roles = descendants.query('sys_security_acl_role').map((m2m) => m2m.get('sys_user_role'))
|
|
59
60
|
|
|
60
61
|
return {
|
|
@@ -75,14 +76,14 @@ export const AclPlugin = Plugin.create({
|
|
|
75
76
|
appliesTo: $.from('applies_to').def(''),
|
|
76
77
|
type: $.val(type),
|
|
77
78
|
securityAttribute: $.from('security_attribute')
|
|
78
|
-
.map((v) => reverseLookup(AclAttributes, v.getValue()) || v)
|
|
79
|
+
.map((v) => reverseLookup(AclAttributes, v.getValue() as string) || v)
|
|
79
80
|
.def(''),
|
|
80
|
-
operation: $.map((v) => reverseLookup(AclOperations, v.getValue()) || v),
|
|
81
|
+
operation: $.map((v) => reverseLookup(AclOperations, v.getValue() as string) || v),
|
|
81
82
|
script: $.map((v) => v.ifString()?.getValue()).def(''),
|
|
82
83
|
roles: $.val(roles.length > 0 ? roles : undefined),
|
|
83
84
|
[merge]: $.from('type', 'name').map((type, name) =>
|
|
84
85
|
getTableOrName(
|
|
85
|
-
type.pipe((t) => reverseLookup(AclTypes, t.getValue())),
|
|
86
|
+
type.pipe((t) => reverseLookup(AclTypes, t.getValue() as string)),
|
|
86
87
|
name.asString().getValue()
|
|
87
88
|
)
|
|
88
89
|
),
|
|
@@ -128,6 +129,18 @@ export const AclPlugin = Plugin.create({
|
|
|
128
129
|
diagnostics.error(appliesTo, `ACL cannot set applies_to unless its type is 'record'`)
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
// Check for deprecated table/field properties on ux_route and ux_page ACLs
|
|
133
|
+
if (type.equals('ux_route') || type.equals('ux_page')) {
|
|
134
|
+
const table = arg.get('table')
|
|
135
|
+
const field = arg.get('field')
|
|
136
|
+
if (!table.isUndefined() || !field.isUndefined()) {
|
|
137
|
+
diagnostics.warn(
|
|
138
|
+
table.isUndefined() ? field : table,
|
|
139
|
+
`The 'table' and 'field' properties are deprecated for '${type.getValue()}' ACLs and will be ignored. Use the 'name' property instead.`
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
131
144
|
if (operation.equals('add_to_list')) {
|
|
132
145
|
const condition = arg.get('condition').ifString()
|
|
133
146
|
if (advanced) {
|
|
@@ -159,8 +172,14 @@ export const AclPlugin = Plugin.create({
|
|
|
159
172
|
name: $.from('name', 'table', 'field').map(
|
|
160
173
|
(n, t, f) => n.ifString() ?? (f.ifString() ? `${t.getValue()}.${f.getValue()}` : t)
|
|
161
174
|
),
|
|
162
|
-
type: $.map((type) =>
|
|
163
|
-
|
|
175
|
+
type: $.map((type) => {
|
|
176
|
+
const typeKey = type.asString().getValue()
|
|
177
|
+
return AclTypes[typeKey as keyof typeof AclTypes] ?? type
|
|
178
|
+
}),
|
|
179
|
+
operation: $.map((op) => {
|
|
180
|
+
const opKey = op.asString().getValue()
|
|
181
|
+
return AclOperations[opKey as keyof typeof AclOperations] ?? op
|
|
182
|
+
}),
|
|
164
183
|
advanced: $.val(advanced),
|
|
165
184
|
script: $.map(
|
|
166
185
|
(v) =>
|
|
@@ -168,7 +187,11 @@ export const AclPlugin = Plugin.create({
|
|
|
168
187
|
v
|
|
169
188
|
).toCdata(),
|
|
170
189
|
security_attribute: $.from('securityAttribute').map(
|
|
171
|
-
(v) =>
|
|
190
|
+
(v) =>
|
|
191
|
+
v.ifString()?.pipe((v) => {
|
|
192
|
+
const attrKey = v.getValue()
|
|
193
|
+
return AclAttributes[attrKey as keyof typeof AclAttributes]
|
|
194
|
+
}) ?? v
|
|
172
195
|
),
|
|
173
196
|
})),
|
|
174
197
|
})
|
|
@@ -243,7 +266,7 @@ export const AclPlugin = Plugin.create({
|
|
|
243
266
|
})
|
|
244
267
|
|
|
245
268
|
function getTableOrName(type: keyof typeof AclTypes, name: string) {
|
|
246
|
-
if (AclNamedTypes
|
|
269
|
+
if (type in AclNamedTypes) {
|
|
247
270
|
return { name }
|
|
248
271
|
}
|
|
249
272
|
const split = name.indexOf('.')
|
|
@@ -253,7 +276,7 @@ function getTableOrName(type: keyof typeof AclTypes, name: string) {
|
|
|
253
276
|
return { table, ...(field ? { field } : {}) }
|
|
254
277
|
}
|
|
255
278
|
|
|
256
|
-
function reverseLookup<T extends object>(obj: T, sysId): keyof T {
|
|
279
|
+
function reverseLookup<T extends object>(obj: T, sysId: string): keyof T {
|
|
257
280
|
return (Object.entries(obj)
|
|
258
281
|
.filter(([_, id]) => id === sysId)
|
|
259
282
|
.map(([key]) => key)[0] || '') as keyof T
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Plugin, CallExpressionShape, type RecordId } from '@servicenow/sdk-build-core'
|
|
2
|
+
import { NowIdShape } from './now-id-plugin'
|
|
3
|
+
|
|
4
|
+
export const ApplicabilityPlugin = Plugin.create({
|
|
5
|
+
name: 'ApplicabilityPlugin',
|
|
6
|
+
records: {
|
|
7
|
+
// TODO Add relationship support for role_names?
|
|
8
|
+
sys_ux_applicability: {
|
|
9
|
+
async toShape(record, { factory }) {
|
|
10
|
+
const roles = record.get('roles')
|
|
11
|
+
const roleIds = roles.ifString()?.ifNotEmpty()?.split(',') ?? []
|
|
12
|
+
const roleRefs: RecordId[] = []
|
|
13
|
+
|
|
14
|
+
for (const roleId of roleIds) {
|
|
15
|
+
roleRefs.push(
|
|
16
|
+
await factory.createReference({
|
|
17
|
+
source: record,
|
|
18
|
+
table: 'sys_user_role',
|
|
19
|
+
guid: roleId,
|
|
20
|
+
})
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
success: true,
|
|
25
|
+
value: new CallExpressionShape({
|
|
26
|
+
source: record,
|
|
27
|
+
callee: 'Applicability',
|
|
28
|
+
args: [
|
|
29
|
+
record.transform(({ $ }) => {
|
|
30
|
+
return {
|
|
31
|
+
$id: $.val(NowIdShape.from(record)),
|
|
32
|
+
name: $.def(''),
|
|
33
|
+
description: $.def(''),
|
|
34
|
+
active: $.toBoolean().def(true),
|
|
35
|
+
roles: $.val(roleRefs).def([]),
|
|
36
|
+
roleNames: $.from('role_names').def(''), // TODO Better support of this with references
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
}),
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
shapes: [
|
|
46
|
+
{
|
|
47
|
+
shape: CallExpressionShape,
|
|
48
|
+
fileTypes: ['fluent'],
|
|
49
|
+
async toRecord(source, { factory }) {
|
|
50
|
+
if (source.getCallee() !== 'Applicability') {
|
|
51
|
+
return { success: false }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const arg = source.getArgument(0).asObject()
|
|
55
|
+
const applicability = await factory.createRecord({
|
|
56
|
+
source: source,
|
|
57
|
+
table: 'sys_ux_applicability',
|
|
58
|
+
explicitId: arg.get('$id'),
|
|
59
|
+
properties: arg.transform(({ $ }) => ({
|
|
60
|
+
name: $,
|
|
61
|
+
description: $.def(''),
|
|
62
|
+
active: $.toBoolean().def(true),
|
|
63
|
+
roles: $.def([]).map((v) =>
|
|
64
|
+
v
|
|
65
|
+
.ifArray()
|
|
66
|
+
?.pipe((r) =>
|
|
67
|
+
Array.from(
|
|
68
|
+
new Set(
|
|
69
|
+
r.getElements().map((r) => r.ifRecord()?.getId().getValue() ?? r.getValue())
|
|
70
|
+
)
|
|
71
|
+
).join(',')
|
|
72
|
+
)
|
|
73
|
+
),
|
|
74
|
+
role_names: $.from('roleNames').def(''), // TODO Better support of this with references
|
|
75
|
+
})),
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
return { success: true, value: applicability }
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
})
|
|
@@ -51,6 +51,7 @@ export const ApplicationMenuPlugin = Plugin.create({
|
|
|
51
51
|
value: new CallExpressionShape({
|
|
52
52
|
source: record,
|
|
53
53
|
callee: 'ApplicationMenu',
|
|
54
|
+
exportName: record.get('sys_name')?.ifString()?.getValue(),
|
|
54
55
|
args: [
|
|
55
56
|
record.transform(({ $ }) => ({
|
|
56
57
|
$id: $.val(NowIdShape.from(record)),
|
package/src/atf/step-configs.ts
CHANGED
|
@@ -5,28 +5,30 @@ export type ATFVariableInfo = {
|
|
|
5
5
|
inputVariableId: string
|
|
6
6
|
type: string
|
|
7
7
|
order: number
|
|
8
|
-
default?:
|
|
8
|
+
default?: unknown
|
|
9
9
|
mandatory?: boolean
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export type Category = keyof ATFType
|
|
13
13
|
|
|
14
|
-
type FunctionParameters<F> = F extends (inputs: infer P) =>
|
|
14
|
+
type FunctionParameters<F> = F extends (inputs: infer P) => unknown
|
|
15
15
|
? P extends object
|
|
16
16
|
? Exclude<keyof P, keyof StandardStepValues>
|
|
17
17
|
: never
|
|
18
18
|
: never
|
|
19
19
|
|
|
20
|
-
type
|
|
20
|
+
export type StepMetadata<T extends FunctionParameters<unknown> = FunctionParameters<unknown>> = {
|
|
21
|
+
name: string
|
|
22
|
+
stepConfigId: string
|
|
23
|
+
variables: {
|
|
24
|
+
[K in T]: ATFVariableInfo
|
|
25
|
+
}
|
|
26
|
+
defaultTimeout?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type ToRecordStepMetadata = {
|
|
21
30
|
[C in keyof ATFType]: {
|
|
22
|
-
[FunctionName in keyof ATFType[C]]:
|
|
23
|
-
name: string
|
|
24
|
-
stepConfigId: string
|
|
25
|
-
variables: {
|
|
26
|
-
[K in FunctionParameters<ATFType[C][FunctionName]>]: ATFVariableInfo
|
|
27
|
-
}
|
|
28
|
-
defaultTimeout?: string
|
|
29
|
-
}
|
|
31
|
+
[FunctionName in keyof ATFType[C]]: StepMetadata<FunctionParameters<ATFType[C][FunctionName]>>
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -2355,7 +2357,7 @@ export type ToShapeStepMetadata = Record<
|
|
|
2355
2357
|
field: string
|
|
2356
2358
|
type: string
|
|
2357
2359
|
mandatory: boolean
|
|
2358
|
-
default?:
|
|
2360
|
+
default?: unknown
|
|
2359
2361
|
}
|
|
2360
2362
|
>
|
|
2361
2363
|
}
|
package/src/atf/test-plugin.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CallExpressionShape,
|
|
3
|
+
deleteMultipleDiff,
|
|
3
4
|
type Diagnostics,
|
|
4
5
|
IdentifierShape,
|
|
5
6
|
ObjectShape,
|
|
@@ -20,9 +21,15 @@ import { NowIdShape } from '../now-id-plugin'
|
|
|
20
21
|
import { ArrowFunctionShape } from '../arrow-function-plugin'
|
|
21
22
|
import { create } from 'xmlbuilder2'
|
|
22
23
|
import { Test } from '@servicenow/sdk-core/runtime/app'
|
|
23
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
type ATFVariableInfo,
|
|
26
|
+
type Category,
|
|
27
|
+
ToShapeStepConfigs,
|
|
28
|
+
ToRecordStepConfigs,
|
|
29
|
+
type StepMetadata,
|
|
30
|
+
} from './step-configs'
|
|
24
31
|
import { durationFieldToXML, formatDateToPlatformFormat, parseGlideDuration } from '@servicenow/sdk-build-core'
|
|
25
|
-
import type {
|
|
32
|
+
import type { Duration } from '@servicenow/sdk/core'
|
|
26
33
|
|
|
27
34
|
export const TestPlugin = Plugin.create({
|
|
28
35
|
name: 'TestPlugin',
|
|
@@ -125,7 +132,7 @@ export const TestPlugin = Plugin.create({
|
|
|
125
132
|
notes: $.def(''),
|
|
126
133
|
warning: $.from('warning_message').def(''),
|
|
127
134
|
timeout: $.val(timeout),
|
|
128
|
-
[merge]: $.val(variables),
|
|
135
|
+
[merge]: $.val(variables).def({}),
|
|
129
136
|
})),
|
|
130
137
|
}),
|
|
131
138
|
],
|
|
@@ -166,6 +173,9 @@ export const TestPlugin = Plugin.create({
|
|
|
166
173
|
}),
|
|
167
174
|
}
|
|
168
175
|
},
|
|
176
|
+
async diff(existing, incoming, descendants, context) {
|
|
177
|
+
return deleteMultipleDiff(existing, incoming, descendants, context)
|
|
178
|
+
},
|
|
169
179
|
},
|
|
170
180
|
sys_variable_value: {
|
|
171
181
|
coalesce: ['document', 'document_key', 'variable'],
|
|
@@ -369,7 +379,6 @@ const UNSUPPORTED_STEP_CONFIGS = {
|
|
|
369
379
|
a69843f2531332007e7829cac2dc34d7: 'Apply Filter to List',
|
|
370
380
|
c5f44934532332007e7829cac2dc342e: 'Click a List UI Action',
|
|
371
381
|
}
|
|
372
|
-
|
|
373
382
|
function getFieldValuesFromElementMappingRecords(elementMappingRecords: RecordShape[]) {
|
|
374
383
|
return elementMappingRecords
|
|
375
384
|
.filter((em) => em.get('value').getValue())
|
|
@@ -381,7 +390,7 @@ function getFieldValuesFromElementMappingRecords(elementMappingRecords: RecordSh
|
|
|
381
390
|
}
|
|
382
391
|
|
|
383
392
|
function convertTimeoutToSystemFormat(timeoutShape: Shape) {
|
|
384
|
-
const timeoutDuration = timeoutShape.ifObject()?.getValue() as
|
|
393
|
+
const timeoutDuration = timeoutShape.ifObject()?.getValue() as Duration | undefined
|
|
385
394
|
const timeoutDate = timeoutDuration && durationFieldToXML(timeoutDuration)
|
|
386
395
|
return timeoutDate && formatDateToPlatformFormat(timeoutDate)
|
|
387
396
|
}
|
|
@@ -389,8 +398,9 @@ function convertTimeoutToSystemFormat(timeoutShape: Shape) {
|
|
|
389
398
|
function anyStepsAreUnknown(stepRecords: RecordShape[], testName: string) {
|
|
390
399
|
return stepRecords.some((stepRecord) => {
|
|
391
400
|
const stepConfigId = stepRecord.get('step_config').toString().getValue()
|
|
392
|
-
if (!ToShapeStepConfigs[stepConfigId]) {
|
|
393
|
-
const stepConfigName =
|
|
401
|
+
if (!ToShapeStepConfigs[stepConfigId as keyof typeof ToShapeStepConfigs]) {
|
|
402
|
+
const stepConfigName =
|
|
403
|
+
UNSUPPORTED_STEP_CONFIGS[stepConfigId as keyof typeof UNSUPPORTED_STEP_CONFIGS] ?? stepConfigId
|
|
394
404
|
console.error(
|
|
395
405
|
`Unable to transform ATF test '${testName}' because of unsupported step_config: '${stepConfigName}'`
|
|
396
406
|
)
|
|
@@ -436,7 +446,11 @@ function propertyAccessToGemExpression(
|
|
|
436
446
|
return `{{step['${stepId}']${suffix}}}`
|
|
437
447
|
}
|
|
438
448
|
|
|
439
|
-
function createGemExpressionsFromShape(
|
|
449
|
+
function createGemExpressionsFromShape(
|
|
450
|
+
shape: Shape,
|
|
451
|
+
stepRecords: RecordShape[],
|
|
452
|
+
diagnostics: Diagnostics
|
|
453
|
+
): string | Record<string, unknown> | undefined {
|
|
440
454
|
if (shape instanceof PropertyAccessShape) {
|
|
441
455
|
return propertyAccessToGemExpression(shape, stepRecords, diagnostics)
|
|
442
456
|
}
|
|
@@ -452,7 +466,7 @@ function createGemExpressionsFromShape(shape: Shape, stepRecords: RecordShape[],
|
|
|
452
466
|
}
|
|
453
467
|
|
|
454
468
|
if (shape instanceof ObjectShape) {
|
|
455
|
-
const obj = {}
|
|
469
|
+
const obj: Record<string, unknown> = {}
|
|
456
470
|
let gemExpressionFound = false
|
|
457
471
|
for (const key in shape.properties()) {
|
|
458
472
|
const value = createGemExpressionsFromShape(shape.get(key, false), stepRecords, diagnostics)
|
|
@@ -499,23 +513,26 @@ function getStepInfoFromAtfCallExpression(
|
|
|
499
513
|
return undefined
|
|
500
514
|
}
|
|
501
515
|
|
|
502
|
-
const [, category, funcName] = callExpression.getCallee().split('.')
|
|
516
|
+
const [, category, funcName] = callExpression.getCallee().split('.') as [never, Category?, string?]
|
|
517
|
+
|
|
503
518
|
if (!category || !funcName) {
|
|
504
519
|
diagnostics.info(callExpression, 'Invalid ATF step')
|
|
505
520
|
return undefined
|
|
506
521
|
}
|
|
507
522
|
|
|
508
|
-
|
|
523
|
+
const categoryKey = category
|
|
524
|
+
if (!ToRecordStepConfigs[categoryKey]) {
|
|
509
525
|
diagnostics.warn(callExpression, `Unknown category: ${category}`)
|
|
510
526
|
return undefined
|
|
511
527
|
}
|
|
512
528
|
|
|
513
|
-
|
|
529
|
+
const categorySteps = ToRecordStepConfigs[categoryKey]
|
|
530
|
+
if (!(funcName in categorySteps)) {
|
|
514
531
|
diagnostics.warn(callExpression, `Unknown step: ${funcName}`)
|
|
515
532
|
return undefined
|
|
516
533
|
}
|
|
517
534
|
|
|
518
|
-
const stepConfig =
|
|
535
|
+
const stepConfig = categorySteps[funcName as keyof typeof categorySteps] as StepMetadata
|
|
519
536
|
const values = callExpression.getArgument(0).asObject()
|
|
520
537
|
return {
|
|
521
538
|
displayName: stepConfig.name,
|
|
@@ -524,7 +541,7 @@ function getStepInfoFromAtfCallExpression(
|
|
|
524
541
|
table: values.get('table')?.ifString(),
|
|
525
542
|
source: callExpression,
|
|
526
543
|
identifier,
|
|
527
|
-
defaultTimeout: stepConfig.defaultTimeout,
|
|
544
|
+
defaultTimeout: stepConfig.defaultTimeout as string,
|
|
528
545
|
values,
|
|
529
546
|
}
|
|
530
547
|
}
|
|
@@ -566,14 +583,19 @@ function variableElementPathToPropertyAccess(source: Source, propertyAccessPath:
|
|
|
566
583
|
})
|
|
567
584
|
}
|
|
568
585
|
|
|
569
|
-
function getElementMappingValues(
|
|
586
|
+
function getElementMappingValues(
|
|
587
|
+
source: Source,
|
|
588
|
+
value: unknown,
|
|
589
|
+
stepIdToVarName: Map<string, string>
|
|
590
|
+
): object | object[] | string | undefined {
|
|
570
591
|
if (typeof value === 'object' && value !== null) {
|
|
571
592
|
if (Array.isArray(value)) {
|
|
572
593
|
return value.map((v) => getElementMappingValues(source, v, stepIdToVarName))
|
|
573
594
|
} else {
|
|
574
|
-
const obj = {}
|
|
575
|
-
|
|
576
|
-
|
|
595
|
+
const obj: Record<string, unknown> = {}
|
|
596
|
+
const valueObj = value
|
|
597
|
+
for (const key in valueObj) {
|
|
598
|
+
obj[key] = getElementMappingValues(source, valueObj[key as keyof typeof valueObj], stepIdToVarName)
|
|
577
599
|
}
|
|
578
600
|
return obj
|
|
579
601
|
}
|
|
@@ -581,13 +603,13 @@ function getElementMappingValues(source: Source, value: any, stepIdToVarName: Ma
|
|
|
581
603
|
|
|
582
604
|
const potentialGemExpression = typeof value === 'string' ? value : undefined
|
|
583
605
|
if (!potentialGemExpression) {
|
|
584
|
-
return value
|
|
606
|
+
return value as string
|
|
585
607
|
}
|
|
586
608
|
|
|
587
609
|
const [matched] = Array.from(potentialGemExpression.matchAll(GemRegex))
|
|
588
610
|
const simpleGemExpression = matched && matched[0] === potentialGemExpression
|
|
589
611
|
if (!matched) {
|
|
590
|
-
return value
|
|
612
|
+
return value as string
|
|
591
613
|
}
|
|
592
614
|
|
|
593
615
|
// If the GEM expression is simple, it only contains the GEM
|
|
@@ -643,7 +665,7 @@ function getElementMappingValues(source: Source, value: any, stepIdToVarName: Ma
|
|
|
643
665
|
})
|
|
644
666
|
}
|
|
645
667
|
|
|
646
|
-
function objectToEncodedQuery(objectShape: Record<string,
|
|
668
|
+
function objectToEncodedQuery(objectShape: Record<string, object | string | number | boolean>) {
|
|
647
669
|
return Object.entries(objectShape)
|
|
648
670
|
.map(([key, value]) => {
|
|
649
671
|
const escapedValue = value.toString().replaceAll('^', '^^')
|
|
@@ -653,7 +675,7 @@ function objectToEncodedQuery(objectShape: Record<string, any>) {
|
|
|
653
675
|
.join('^')
|
|
654
676
|
}
|
|
655
677
|
|
|
656
|
-
export function serializeValueToRecord(value:
|
|
678
|
+
export function serializeValueToRecord(value: unknown, type: string, defaultValue: unknown) {
|
|
657
679
|
value = value === undefined ? defaultValue : value
|
|
658
680
|
|
|
659
681
|
switch (type) {
|
|
@@ -670,7 +692,7 @@ export function serializeValueToRecord(value: any, type: string, defaultValue: a
|
|
|
670
692
|
return JSON.stringify(value)
|
|
671
693
|
}
|
|
672
694
|
case 'template_value':
|
|
673
|
-
return value && objectToEncodedQuery(value)
|
|
695
|
+
return value && objectToEncodedQuery(value as Record<string, object | string | number | boolean>)
|
|
674
696
|
case 'boolean':
|
|
675
697
|
return value ? 1 : 0
|
|
676
698
|
default:
|
|
@@ -706,7 +728,7 @@ function queryToFieldValues(query: string) {
|
|
|
706
728
|
.split('^')
|
|
707
729
|
.filter((term) => term !== 'EQ')
|
|
708
730
|
.map((term) => term.split('='))
|
|
709
|
-
.filter(([, value]) => value !== undefined)
|
|
731
|
+
.filter(([, value]) => value !== undefined && value !== '')
|
|
710
732
|
.map(([key, value]) => ({ [key as string]: convertToPrimitiveValue(value!.replaceAll(caratReplacement, '^')) }))
|
|
711
733
|
.reduce((acc, obj) => ({ ...acc, ...obj }), {})
|
|
712
734
|
}
|