@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
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type Package,
|
|
14
14
|
type Record,
|
|
15
15
|
} from '@servicenow/sdk-build-core'
|
|
16
|
-
import { NowConfig, path as pathModule, ts, type FileSystem } from '@servicenow/sdk-build-core'
|
|
16
|
+
import { NowConfig, path as pathModule, ts, type FileSystem, type Logger } from '@servicenow/sdk-build-core'
|
|
17
17
|
import { RepackService } from '../repack'
|
|
18
18
|
import { SBOMBuilder } from './sbom-builder'
|
|
19
19
|
import isEqual from 'lodash/isEqual'
|
|
@@ -34,6 +34,33 @@ const GLUE_CODE_WARNING = `
|
|
|
34
34
|
|
|
35
35
|
const NODE_MODULES = 'node_modules'
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Check if a module matches any trusted module patterns.
|
|
39
|
+
* Supports exact matches ('lodash', '@servicenow/sdk') and org wildcards ('@servicenow/*').
|
|
40
|
+
* Invalid patterns (like '*' or 'lodash-*-utils') are ignored.
|
|
41
|
+
*/
|
|
42
|
+
function isModuleTrusted(moduleName: string, trustedModules: string[], logger: Logger): boolean {
|
|
43
|
+
if (trustedModules.length === 0) {
|
|
44
|
+
return false
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return trustedModules.some((pattern) => {
|
|
48
|
+
// @org/* pattern
|
|
49
|
+
if (pattern.startsWith('@') && pattern.endsWith('/*')) {
|
|
50
|
+
return moduleName.startsWith(pattern.slice(0, -1))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Exact match (no wildcards allowed)
|
|
54
|
+
if (!pattern.includes('*')) {
|
|
55
|
+
return moduleName === pattern
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Invalid pattern, ignore
|
|
59
|
+
logger.warn(`Invalid trusted module pattern used in fluent config: ${pattern}`)
|
|
60
|
+
return false
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
37
64
|
type GlueCodeMeta = {
|
|
38
65
|
name: string
|
|
39
66
|
path: string
|
|
@@ -223,8 +250,8 @@ function isValidRequireCall(callExpression: ts.CallExpression, requirePath: ts.S
|
|
|
223
250
|
return isRequire && !isRelativePath
|
|
224
251
|
}
|
|
225
252
|
|
|
226
|
-
function buildParentPathMap(dependencyNodes: DependencyNode[]) {
|
|
227
|
-
const importerMap = {}
|
|
253
|
+
function buildParentPathMap(dependencyNodes: DependencyNode[]): { [key: string]: string[] } {
|
|
254
|
+
const importerMap: { [key: string]: string[] } = {}
|
|
228
255
|
for (const node of dependencyNodes) {
|
|
229
256
|
let parent = node.parentPackage
|
|
230
257
|
|
|
@@ -233,7 +260,9 @@ function buildParentPathMap(dependencyNodes: DependencyNode[]) {
|
|
|
233
260
|
if (!importerMap[importerMapKey]) {
|
|
234
261
|
importerMap[importerMapKey] = []
|
|
235
262
|
}
|
|
236
|
-
|
|
263
|
+
if (parent.pkgName) {
|
|
264
|
+
importerMap[importerMapKey].push(parent.pkgName)
|
|
265
|
+
}
|
|
237
266
|
|
|
238
267
|
const newParent = dependencyNodes.find((potentialParent) => {
|
|
239
268
|
if (!parent || !parent.pkgName) {
|
|
@@ -276,14 +305,22 @@ class ModuleDependencyShape extends Shape {
|
|
|
276
305
|
|
|
277
306
|
// TODO: Need to have some invalidation mechanism. Maybe the plugin framework can provide plugins with a managed cache to use for stuff like this?
|
|
278
307
|
let DEPENDENCY_CACHE: globalThis.Record<string, Result<ModuleDependencyShape>> = {}
|
|
308
|
+
// Track external module record IDs for SBOM generation (not persisted to XML)
|
|
309
|
+
let EXTERNAL_MODULE_IDS: Set<string> = new Set()
|
|
279
310
|
// Expose cache clearing for tests
|
|
280
311
|
export function clearDependencyCache() {
|
|
281
312
|
DEPENDENCY_CACHE = {}
|
|
313
|
+
EXTERNAL_MODULE_IDS = new Set()
|
|
282
314
|
}
|
|
283
315
|
|
|
284
316
|
function parseModuleDependency(
|
|
285
317
|
node: ts.ImportDeclaration | ts.ExportDeclaration | ts.CallExpression
|
|
286
318
|
): Result<ModuleDependencyShape> {
|
|
319
|
+
//Check if this is a type only import and skip it
|
|
320
|
+
if (node.asKind(ts.SyntaxKind.ImportDeclaration)?.getImportClause()?.isTypeOnly()) {
|
|
321
|
+
return { success: false }
|
|
322
|
+
}
|
|
323
|
+
|
|
287
324
|
let moduleName: string | undefined
|
|
288
325
|
if (ts.Node.isImportDeclaration(node) && !node.isModuleSpecifierRelative()) {
|
|
289
326
|
moduleName = node.getModuleSpecifierValue()
|
|
@@ -314,7 +351,11 @@ function parseModuleDependency(
|
|
|
314
351
|
|
|
315
352
|
function generateSBOMContent(context: RecordContext) {
|
|
316
353
|
const { database } = context
|
|
317
|
-
|
|
354
|
+
// Query sys_module records that are tracked as external
|
|
355
|
+
const moduleRecords = database.query('sys_module').filter((mod) => {
|
|
356
|
+
const recordId = mod.getId().getValue()
|
|
357
|
+
return EXTERNAL_MODULE_IDS.has(recordId)
|
|
358
|
+
})
|
|
318
359
|
const sbomBuilder = new SBOMBuilder()
|
|
319
360
|
for (const mod of moduleRecords) {
|
|
320
361
|
const modulePath = mod.get('path').asString().getValue()
|
|
@@ -386,6 +427,7 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
386
427
|
success: false,
|
|
387
428
|
}
|
|
388
429
|
}
|
|
430
|
+
|
|
389
431
|
const sbomContent = generateSBOMContent(context)
|
|
390
432
|
|
|
391
433
|
return {
|
|
@@ -417,6 +459,9 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
417
459
|
shape: SourceFileShape,
|
|
418
460
|
fileTypes: ['module'],
|
|
419
461
|
async toRecord(file, { factory, fs, diagnostics, project, config, packageJson, compiler }) {
|
|
462
|
+
if (config.type === 'configuration') {
|
|
463
|
+
throw new Error(`Modules cannot be used in a configuration project`)
|
|
464
|
+
}
|
|
420
465
|
const path = file.getPath()
|
|
421
466
|
if (!path.startsWith(project.resolvePath(config.serverModulesDir))) {
|
|
422
467
|
return { success: false }
|
|
@@ -467,6 +512,10 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
467
512
|
fileTypes: ['module'],
|
|
468
513
|
// TODO: When managed cache is provided to plugins, cache dependencies that were already handled to avoid reprocessing
|
|
469
514
|
async toRecord(shape, { packageJson, diagnostics, fs, logger, project, factory, config }) {
|
|
515
|
+
if (config.type === 'configuration') {
|
|
516
|
+
throw new Error(`Modules cannot be used in a configuration project`)
|
|
517
|
+
}
|
|
518
|
+
|
|
470
519
|
const dependencies = packageJson.dependencies ?? {}
|
|
471
520
|
const { name: parentName, entry } = validateAndGetModuleSpecifier(shape.getModuleName())
|
|
472
521
|
|
|
@@ -476,6 +525,7 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
476
525
|
return { success: false }
|
|
477
526
|
}
|
|
478
527
|
|
|
528
|
+
const isTrusted = isModuleTrusted(parentName, config.trustedModules, logger)
|
|
479
529
|
const id = `${parentName}@${version}`
|
|
480
530
|
const repack = await RepackService.create(logger, fs, project.getRootDir())
|
|
481
531
|
const dependencyNodes = await repack.execute({
|
|
@@ -486,7 +536,7 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
486
536
|
throw new Error(`Failed to build dependency ${id}`)
|
|
487
537
|
}
|
|
488
538
|
|
|
489
|
-
let importerMap = {}
|
|
539
|
+
let importerMap: { [key: string]: string[] } = {}
|
|
490
540
|
if (!config.hoistDependencies) {
|
|
491
541
|
importerMap = buildParentPathMap(dependencyNodes)
|
|
492
542
|
}
|
|
@@ -507,6 +557,7 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
507
557
|
}
|
|
508
558
|
}
|
|
509
559
|
|
|
560
|
+
const importerPath = importerMap[`${pkgName}@${version}`]
|
|
510
561
|
modules.push({
|
|
511
562
|
id: `${name}@${version}/${file}`,
|
|
512
563
|
path: getModuleDependencyPath(config, {
|
|
@@ -514,7 +565,7 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
514
565
|
file,
|
|
515
566
|
version,
|
|
516
567
|
packageJson,
|
|
517
|
-
importerPath
|
|
568
|
+
...(importerPath ? { importerPath } : {}),
|
|
518
569
|
}),
|
|
519
570
|
content: fileContent,
|
|
520
571
|
})
|
|
@@ -523,21 +574,22 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
523
574
|
|
|
524
575
|
const records: Record[] = []
|
|
525
576
|
for (const m of modules) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
)
|
|
577
|
+
const record = await factory.createRecord({
|
|
578
|
+
source: shape,
|
|
579
|
+
table: 'sys_module',
|
|
580
|
+
explicitId: m.id,
|
|
581
|
+
properties: {
|
|
582
|
+
path: m.path,
|
|
583
|
+
content: Shape.from(shape, sanitizeModuleContent(m.content))
|
|
584
|
+
.asString()
|
|
585
|
+
.withContentType('cdata'),
|
|
586
|
+
external_source: !isTrusted,
|
|
587
|
+
sys_name: m.path,
|
|
588
|
+
},
|
|
589
|
+
})
|
|
590
|
+
// Track external module IDs for SBOM generation
|
|
591
|
+
EXTERNAL_MODULE_IDS.add(record.getId().getValue())
|
|
592
|
+
records.push(record)
|
|
541
593
|
}
|
|
542
594
|
|
|
543
595
|
const [first, ...rest] = records
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { CallExpressionShape, Plugin, type PropertyAccessShape } from '@servicenow/sdk-build-core'
|
|
2
|
+
import { NowIdShape } from '../now-id-plugin'
|
|
3
|
+
import {
|
|
4
|
+
getUITypeFromId,
|
|
5
|
+
getUITypeId,
|
|
6
|
+
APPLIES_TO_CATALOG_ITEM,
|
|
7
|
+
createScript,
|
|
8
|
+
createVariablePropertyAccess,
|
|
9
|
+
getTargetRecord,
|
|
10
|
+
resolveCatalogReferences,
|
|
11
|
+
resolveAndValidateVariableId,
|
|
12
|
+
} from './utils'
|
|
13
|
+
import { validateCatalogItemVariableSetExclusivity } from './service-catalog-diagnostics'
|
|
14
|
+
|
|
15
|
+
export const CatalogClientScriptPlugin = Plugin.create({
|
|
16
|
+
name: 'CatalogClientScriptPlugin',
|
|
17
|
+
records: {
|
|
18
|
+
catalog_script_client: {
|
|
19
|
+
async toShape(record, { database, transform }) {
|
|
20
|
+
let propertyAccess: PropertyAccessShape | string | undefined
|
|
21
|
+
if (
|
|
22
|
+
record.get('type').asString().getValue() === 'onChange' &&
|
|
23
|
+
!record.get('cat_variable')?.ifString()?.isEmpty()
|
|
24
|
+
) {
|
|
25
|
+
const variableId = record.get('cat_variable').asString()?.getValue()?.replace('IO:', '')
|
|
26
|
+
const varRecord = database.get('item_option_new', variableId)
|
|
27
|
+
|
|
28
|
+
if (varRecord?.isRecord()) {
|
|
29
|
+
const appliesToRecord = getTargetRecord(record, database)
|
|
30
|
+
propertyAccess =
|
|
31
|
+
(appliesToRecord?.isRecord() &&
|
|
32
|
+
createVariablePropertyAccess(varRecord, record, appliesToRecord)) ||
|
|
33
|
+
variableId
|
|
34
|
+
} else {
|
|
35
|
+
propertyAccess = variableId
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { catalogItemReference, variableSetReference } = resolveCatalogReferences(record, database)
|
|
40
|
+
const script = await createScript(record, record.get('script'), transform, 'script')
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
success: true,
|
|
44
|
+
value: new CallExpressionShape({
|
|
45
|
+
source: record,
|
|
46
|
+
callee: 'CatalogClientScript',
|
|
47
|
+
args: [
|
|
48
|
+
record.transform(({ $ }) => ({
|
|
49
|
+
$id: $.val(NowIdShape.from(record)),
|
|
50
|
+
name: $,
|
|
51
|
+
script: $.val(script).def(''),
|
|
52
|
+
global: $.toBoolean().def(true),
|
|
53
|
+
active: $.toBoolean().def(true),
|
|
54
|
+
type: $,
|
|
55
|
+
uiType: $.from('ui_type')
|
|
56
|
+
.map((v) =>
|
|
57
|
+
v.ifString()?.isEmpty() ? undefined : getUITypeFromId(v.toNumber()?.getValue())
|
|
58
|
+
)
|
|
59
|
+
.def('desktop'),
|
|
60
|
+
catalogItem: $.val(catalogItemReference).def(''),
|
|
61
|
+
variableName: $.val(propertyAccess).def(''),
|
|
62
|
+
variableSet: $.val(variableSetReference).def(''),
|
|
63
|
+
appliesTo: $.from('applies_to').def(APPLIES_TO_CATALOG_ITEM),
|
|
64
|
+
appliesOnCatalogItemView: $.from('applies_catalog').toBoolean().def(true),
|
|
65
|
+
appliesOnRequestedItems: $.from('applies_req_item').toBoolean().def(false),
|
|
66
|
+
appliesOnCatalogTasks: $.from('applies_sc_task').toBoolean().def(false),
|
|
67
|
+
appliesOnTargetRecord: $.from('applies_target_record').toBoolean().def(false),
|
|
68
|
+
vaSupported: $.from('va_supported').toBoolean().def(false),
|
|
69
|
+
publishedRef: $.from('published_ref').def(''),
|
|
70
|
+
isolateScript: $.from('isolate_script').toBoolean().def(true),
|
|
71
|
+
})),
|
|
72
|
+
],
|
|
73
|
+
}),
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
shapes: [
|
|
79
|
+
{
|
|
80
|
+
shape: CallExpressionShape,
|
|
81
|
+
fileTypes: ['fluent'],
|
|
82
|
+
async toRecord(callExpression, { diagnostics, factory }) {
|
|
83
|
+
if (callExpression.getCallee() !== 'CatalogClientScript') {
|
|
84
|
+
return { success: false }
|
|
85
|
+
}
|
|
86
|
+
const catalogClientScriptArgs = callExpression.getArgument(0).asObject()
|
|
87
|
+
|
|
88
|
+
// Validate catalogItem and variableSet are mutually exclusive
|
|
89
|
+
validateCatalogItemVariableSetExclusivity(catalogClientScriptArgs, diagnostics, 'CatalogClientScript')
|
|
90
|
+
|
|
91
|
+
// Check that uiType is 'onChange' only
|
|
92
|
+
const typeValue = catalogClientScriptArgs.get('type')?.toString()?.getValue()
|
|
93
|
+
// Handle variableName - extract name and ID from PropertyAccessShape
|
|
94
|
+
|
|
95
|
+
let variableId: string | undefined
|
|
96
|
+
const appliedTo: 'set' | 'item' =
|
|
97
|
+
catalogClientScriptArgs.get('appliesTo')?.toString()?.getValue() === 'set'
|
|
98
|
+
? 'set'
|
|
99
|
+
: APPLIES_TO_CATALOG_ITEM
|
|
100
|
+
if (typeValue && typeValue === 'onChange') {
|
|
101
|
+
variableId = resolveAndValidateVariableId(
|
|
102
|
+
catalogClientScriptArgs.get('variableName', false),
|
|
103
|
+
appliedTo,
|
|
104
|
+
catalogClientScriptArgs.get('variableSet', false),
|
|
105
|
+
catalogClientScriptArgs.get('catalogItem', false),
|
|
106
|
+
diagnostics
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const record = await factory.createRecord({
|
|
111
|
+
source: callExpression,
|
|
112
|
+
table: 'catalog_script_client',
|
|
113
|
+
explicitId: catalogClientScriptArgs.get('$id'),
|
|
114
|
+
properties: catalogClientScriptArgs.transform(({ $ }) => ({
|
|
115
|
+
name: $,
|
|
116
|
+
active: $.def(true),
|
|
117
|
+
global: $.def(true),
|
|
118
|
+
script: $.toCdata(),
|
|
119
|
+
type: $,
|
|
120
|
+
applies_to: $.from('appliesTo').def(APPLIES_TO_CATALOG_ITEM),
|
|
121
|
+
cat_item: $.from('catalogItem').def(''),
|
|
122
|
+
variable_set: $.from('variableSet').def(''),
|
|
123
|
+
cat_variable: $.val(variableId).def(''),
|
|
124
|
+
applies_catalog: $.from('appliesOnCatalogItemView').def(true),
|
|
125
|
+
applies_req_item: $.from('appliesOnRequestedItems').def(false),
|
|
126
|
+
applies_sc_task: $.from('appliesOnCatalogTasks').def(false),
|
|
127
|
+
applies_target_record: $.from('appliesOnTargetRecord').def(false),
|
|
128
|
+
isolate_script: $.from('isolateScript').def(true),
|
|
129
|
+
ui_type: $.from('uiType')
|
|
130
|
+
.map((v) => (v.isString() && !v.isEmpty() ? getUITypeId(v.getValue()) : undefined))
|
|
131
|
+
.def(0),
|
|
132
|
+
va_supported: $.from('vaSupported').toBoolean().def(false),
|
|
133
|
+
published_ref: $.from('publishedRef').def(''),
|
|
134
|
+
})),
|
|
135
|
+
})
|
|
136
|
+
return { success: true, value: record }
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
})
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CallExpressionShape,
|
|
3
|
+
Plugin,
|
|
4
|
+
type Record,
|
|
5
|
+
VariableStatementShape,
|
|
6
|
+
IdentifierShape,
|
|
7
|
+
} from '@servicenow/sdk-build-core'
|
|
8
|
+
import { buildVariableRecords } from './shape-to-record'
|
|
9
|
+
import {
|
|
10
|
+
toValidIdentifier,
|
|
11
|
+
shouldWriteAsCallExpression,
|
|
12
|
+
validateRequestedForVariableConflict,
|
|
13
|
+
validateVariableNameConflicts,
|
|
14
|
+
createScript,
|
|
15
|
+
} from './utils'
|
|
16
|
+
import { validateFulfillmentProcessExclusivity, validateCategoriesRequireCatalogs } from './service-catalog-diagnostics'
|
|
17
|
+
import {
|
|
18
|
+
buildVariablesSchema,
|
|
19
|
+
CatalogItemBaseRelationships,
|
|
20
|
+
CatalogItemBaseCoalesce,
|
|
21
|
+
transformCatalogBaseFieldsToShape,
|
|
22
|
+
transformCatalogItemBaseFieldsToRecord,
|
|
23
|
+
transformCatalogItemSpecificFieldsToShape,
|
|
24
|
+
transformCatalogItemSpecificFieldsToRecord,
|
|
25
|
+
createSharedM2MRecords,
|
|
26
|
+
} from './service-catalog-base'
|
|
27
|
+
|
|
28
|
+
export const CatalogItemPlugin = Plugin.create({
|
|
29
|
+
name: 'CatalogItemPlugin',
|
|
30
|
+
records: {
|
|
31
|
+
sc_cat_item: {
|
|
32
|
+
relationships: CatalogItemBaseRelationships,
|
|
33
|
+
async toShape(record, { descendants, transform, logger }) {
|
|
34
|
+
const variablesSchema = buildVariablesSchema(descendants, logger)
|
|
35
|
+
const deliveryPlanScript = await createScript(
|
|
36
|
+
record,
|
|
37
|
+
record.get('delivery_plan_script'),
|
|
38
|
+
transform,
|
|
39
|
+
'delivery-plan-script'
|
|
40
|
+
)
|
|
41
|
+
const entitlementScript = await createScript(
|
|
42
|
+
record,
|
|
43
|
+
record.get('entitlement_script'),
|
|
44
|
+
transform,
|
|
45
|
+
'entitlement-script'
|
|
46
|
+
)
|
|
47
|
+
const callExpression = new CallExpressionShape({
|
|
48
|
+
source: record,
|
|
49
|
+
callee: 'CatalogItem',
|
|
50
|
+
args: [
|
|
51
|
+
record.transform(({ $ }) => ({
|
|
52
|
+
...transformCatalogBaseFieldsToShape(record, $, descendants),
|
|
53
|
+
...transformCatalogItemSpecificFieldsToShape(record, $, descendants),
|
|
54
|
+
entitlementScript: $.val(entitlementScript).def(''),
|
|
55
|
+
deliveryPlanScript: $.val(deliveryPlanScript).def(''),
|
|
56
|
+
variables: $.val(variablesSchema).def({}),
|
|
57
|
+
})),
|
|
58
|
+
],
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
success: true,
|
|
63
|
+
value: shouldWriteAsCallExpression(record)
|
|
64
|
+
? callExpression
|
|
65
|
+
: new VariableStatementShape({
|
|
66
|
+
source: record,
|
|
67
|
+
isExported: true,
|
|
68
|
+
variableName: new IdentifierShape({
|
|
69
|
+
source: record,
|
|
70
|
+
name: toValidIdentifier(record.get('name').toString().getValue()),
|
|
71
|
+
}),
|
|
72
|
+
initializer: callExpression,
|
|
73
|
+
}),
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
...CatalogItemBaseCoalesce,
|
|
78
|
+
},
|
|
79
|
+
shapes: [
|
|
80
|
+
{
|
|
81
|
+
shape: CallExpressionShape,
|
|
82
|
+
fileTypes: ['fluent'],
|
|
83
|
+
async toRecord(callExpression, { diagnostics, factory }) {
|
|
84
|
+
if (callExpression.getCallee() !== 'CatalogItem') {
|
|
85
|
+
return { success: false }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const arg = callExpression.getArgument(0).asObject()
|
|
89
|
+
|
|
90
|
+
// Validate mutually exclusive fulfillment process fields (executionPlan/flow/workflow)
|
|
91
|
+
validateFulfillmentProcessExclusivity(arg, diagnostics)
|
|
92
|
+
|
|
93
|
+
// Validate categories require catalogs
|
|
94
|
+
validateCategoriesRequireCatalogs(arg, diagnostics)
|
|
95
|
+
|
|
96
|
+
// Validate all RequestedForVariable constraints (direct variables + variable sets) in a single optimized pass
|
|
97
|
+
if (!validateRequestedForVariableConflict(arg, diagnostics, 'CatalogItem')) {
|
|
98
|
+
return { success: false }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Validate that variable names don't conflict between direct variables and variable sets
|
|
102
|
+
if (!validateVariableNameConflicts(arg, diagnostics, 'CatalogItem')) {
|
|
103
|
+
return { success: false }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const catItem = await factory.createRecord({
|
|
107
|
+
source: callExpression,
|
|
108
|
+
table: 'sc_cat_item',
|
|
109
|
+
explicitId: arg.get('$id'),
|
|
110
|
+
properties: arg.transform(({ $ }) => ({
|
|
111
|
+
...transformCatalogItemBaseFieldsToRecord($),
|
|
112
|
+
...transformCatalogItemSpecificFieldsToRecord(arg, $),
|
|
113
|
+
})),
|
|
114
|
+
})
|
|
115
|
+
const m2mRecords = await createSharedM2MRecords(callExpression, arg, catItem, factory)
|
|
116
|
+
let variableRecords: Record[] = []
|
|
117
|
+
if (arg.get('variables').isDefined()) {
|
|
118
|
+
const variablesConfig = arg.get('variables').asObject()
|
|
119
|
+
variableRecords = await buildVariableRecords({
|
|
120
|
+
variablesConfig,
|
|
121
|
+
factory,
|
|
122
|
+
parent: catItem,
|
|
123
|
+
diagnostics,
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
const pricingDetails = arg.get('pricingDetails').ifArray()?.getElements() ?? []
|
|
127
|
+
const pricingDetailsRecords: Record[] = []
|
|
128
|
+
for (const pricingDetail of pricingDetails) {
|
|
129
|
+
const pricingDetailObj = pricingDetail.asObject()
|
|
130
|
+
pricingDetailsRecords.push(
|
|
131
|
+
await factory.createRecord({
|
|
132
|
+
source: callExpression,
|
|
133
|
+
table: 'fx_price',
|
|
134
|
+
properties: {
|
|
135
|
+
id: catItem,
|
|
136
|
+
amount: pricingDetailObj.get('amount')?.getValue(),
|
|
137
|
+
currency: pricingDetailObj.get('currencyType')?.getValue(),
|
|
138
|
+
type: 'calculated',
|
|
139
|
+
field: pricingDetailObj.get('field')?.getValue(),
|
|
140
|
+
table: 'sc_cat_item',
|
|
141
|
+
},
|
|
142
|
+
})
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
success: true,
|
|
148
|
+
value: catItem.with(
|
|
149
|
+
...m2mRecords.catalogsRecords,
|
|
150
|
+
...m2mRecords.categoriesRecords,
|
|
151
|
+
...m2mRecords.variableSetRecords,
|
|
152
|
+
...m2mRecords.availableForRecords,
|
|
153
|
+
...m2mRecords.notAvailableForRecords,
|
|
154
|
+
...m2mRecords.assignedTopicsRecords,
|
|
155
|
+
...pricingDetailsRecords,
|
|
156
|
+
...variableRecords
|
|
157
|
+
),
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
})
|