@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
|
@@ -24,7 +24,12 @@ import {
|
|
|
24
24
|
remove,
|
|
25
25
|
isFluentFile,
|
|
26
26
|
path as pathModule,
|
|
27
|
+
Record as DBRecord,
|
|
28
|
+
asDataHelper,
|
|
29
|
+
isValidNode,
|
|
27
30
|
} from '@servicenow/sdk-build-core'
|
|
31
|
+
import { isDataHelper } from './data-plugin'
|
|
32
|
+
import { getCallExpressionName } from './utils'
|
|
28
33
|
|
|
29
34
|
export const BasicSyntaxPlugin = Plugin.create({
|
|
30
35
|
name: 'BasicSyntaxPlugin',
|
|
@@ -61,7 +66,7 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
61
66
|
shape: Shape,
|
|
62
67
|
getTarget(shape, { compiler, project, config }) {
|
|
63
68
|
const source = shape.getOriginalSource()
|
|
64
|
-
if (
|
|
69
|
+
if (isValidNode(source)) {
|
|
65
70
|
return { success: true, value: source }
|
|
66
71
|
}
|
|
67
72
|
|
|
@@ -70,8 +75,34 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
70
75
|
return { success: false }
|
|
71
76
|
}
|
|
72
77
|
|
|
73
|
-
const
|
|
74
|
-
const
|
|
78
|
+
const { generatedDir, taxonomy } = config
|
|
79
|
+
const tableName =
|
|
80
|
+
shape.getSource() instanceof DBRecord ? (shape.getSource() as DBRecord).getTable() : undefined
|
|
81
|
+
|
|
82
|
+
const dir =
|
|
83
|
+
tableName && taxonomy.mapping[tableName]
|
|
84
|
+
? pathModule.join(generatedDir, taxonomy.mapping[tableName])
|
|
85
|
+
: generatedDir
|
|
86
|
+
|
|
87
|
+
let name = pathModule.basename(source.path).replace(RegExp(`${pathModule.extname(source.path)}$`), '')
|
|
88
|
+
if (!name) {
|
|
89
|
+
const id =
|
|
90
|
+
shape.getSource() instanceof DBRecord
|
|
91
|
+
? (shape.getSource() as DBRecord).getId().getValue()
|
|
92
|
+
: undefined
|
|
93
|
+
name = `${tableName}_${id}`
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (project.isTypesGenerationMode()) {
|
|
97
|
+
// In types generation mode, use the exported variable name as the file name
|
|
98
|
+
// Scope directory is already set via per-scope Project rootDir
|
|
99
|
+
if (shape.is(VariableStatementShape) && shape.isExported()) {
|
|
100
|
+
name = shape.getVariableName().getName()
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const file = compiler.getOrCreateSourceFile(
|
|
104
|
+
project.resolvePath(project.getRootDir(), dir, `${name}.now.ts`)
|
|
105
|
+
)
|
|
75
106
|
const statement = project
|
|
76
107
|
.addFile(file.getFilePath(), { resolveDependencies: false })
|
|
77
108
|
.addStatement(shape.getCode())
|
|
@@ -167,6 +198,16 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
167
198
|
// Turn the number back into a string and compare with the original string to avoid
|
|
168
199
|
// lossy conversions due to floating point precision or other factors
|
|
169
200
|
return number.getValue().toString() === shape.getValue() ? number : undefined
|
|
201
|
+
} else if (isDataHelper(target)) {
|
|
202
|
+
if (!ts.Node.isCallExpression(target)) {
|
|
203
|
+
return undefined
|
|
204
|
+
}
|
|
205
|
+
const helperName = getCallExpressionName(target)
|
|
206
|
+
const timeZone = target
|
|
207
|
+
.getArguments()[1]
|
|
208
|
+
?.asKind(ts.SyntaxKind.StringLiteral)
|
|
209
|
+
?.getLiteralValue()
|
|
210
|
+
return asDataHelper(helperName, shape, timeZone)
|
|
170
211
|
} else {
|
|
171
212
|
return undefined
|
|
172
213
|
}
|
|
@@ -272,7 +313,7 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
272
313
|
const existingPropKey = [...shape.getAliases(name), name].find((aliasedKey) =>
|
|
273
314
|
existingNames.has(aliasedKey)
|
|
274
315
|
)
|
|
275
|
-
if (existingPropKey) {
|
|
316
|
+
if (existingPropKey !== undefined) {
|
|
276
317
|
if (existingPropKey !== name) {
|
|
277
318
|
target
|
|
278
319
|
.getPropertyOrThrow(existingPropKey)
|
|
@@ -280,6 +321,7 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
280
321
|
.getNameNode()
|
|
281
322
|
.replaceWithText(name)
|
|
282
323
|
}
|
|
324
|
+
|
|
283
325
|
await commit(value, existingNames.get(existingPropKey) as ts.Expression)
|
|
284
326
|
} else if (!value.equals(shape.getDefault(name))) {
|
|
285
327
|
propsToAdd.push({
|
|
@@ -318,35 +360,50 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
318
360
|
{
|
|
319
361
|
shape: VariableStatementShape,
|
|
320
362
|
async commit(shape, target, { commit }) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (ts.Node.isCallExpression(target) && parentStatement) {
|
|
324
|
-
parentStatement.replaceWithText(shape.getCode())
|
|
325
|
-
return { success: true }
|
|
326
|
-
}
|
|
363
|
+
// If target is ExpressionStatement, replace it directly
|
|
364
|
+
if (ts.Node.isExpressionStatement(target)) {
|
|
327
365
|
target.replaceWithText(shape.getCode())
|
|
328
366
|
return { success: true }
|
|
329
367
|
}
|
|
330
368
|
|
|
331
|
-
|
|
332
|
-
|
|
369
|
+
// If target is CallExpression, check parent type
|
|
370
|
+
if (ts.Node.isCallExpression(target)) {
|
|
371
|
+
const expressionStatement = target.getParentIfKind(ts.SyntaxKind.ExpressionStatement)
|
|
372
|
+
if (expressionStatement) {
|
|
373
|
+
expressionStatement.replaceWithText(shape.getCode())
|
|
374
|
+
return { success: true }
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// Get VariableStatement for in-place updates (either from CallExpression ancestor or target itself)
|
|
379
|
+
const variableStatement = ts.Node.isVariableStatement(target)
|
|
380
|
+
? target
|
|
381
|
+
: target.getFirstAncestorByKindOrThrow(ts.SyntaxKind.VariableStatement)
|
|
382
|
+
|
|
383
|
+
// Update export modifier if needed
|
|
384
|
+
if (variableStatement.isExported() !== shape.isExported()) {
|
|
385
|
+
variableStatement.setIsExported(shape.isExported())
|
|
333
386
|
}
|
|
334
387
|
|
|
335
|
-
|
|
388
|
+
// Get the variable declaration
|
|
389
|
+
const [declaration, otherDeclaration] = variableStatement.getDeclarations()
|
|
336
390
|
if (!declaration) {
|
|
337
|
-
throw new Error(`Variable statement is missing a declaration: ${
|
|
391
|
+
throw new Error(`Variable statement is missing a declaration: ${variableStatement.getFullText()}`)
|
|
338
392
|
}
|
|
339
393
|
|
|
394
|
+
// Remove duplicate declarations
|
|
340
395
|
if (otherDeclaration) {
|
|
341
396
|
removeReferences(otherDeclaration)
|
|
342
397
|
remove(otherDeclaration)
|
|
343
398
|
}
|
|
344
399
|
|
|
400
|
+
// Update variable name if changed
|
|
345
401
|
const variableName = shape.getVariableName()
|
|
346
402
|
if (declaration.getName() !== variableName.getName()) {
|
|
347
403
|
await commit(variableName, declaration.getNameNode())
|
|
348
404
|
}
|
|
349
405
|
|
|
406
|
+
// Update initializer
|
|
350
407
|
await commit(shape.getInitializer(), declaration.getInitializerOrThrow())
|
|
351
408
|
return { success: true }
|
|
352
409
|
},
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { CallExpressionShape, type ObjectShape, Plugin, type ArrayShape, type Shape } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { ModuleFunctionShape } from './server-module-plugin'
|
|
3
3
|
import { NowIdShape } from './now-id-plugin'
|
|
4
|
-
import { generateDeprecatedDiagnostics } from './utils'
|
|
4
|
+
import { createSdkDocEntry, generateDeprecatedDiagnostics } from './utils'
|
|
5
5
|
import { NowIncludeShape } from './now-include-plugin'
|
|
6
6
|
|
|
7
7
|
// Similar to lodash's groupBy, but simply stores the last element of each group
|
|
8
8
|
function groupByExistence<T>(collection: T[] | undefined, keyProvider: (element: T) => string): { [key: string]: T } {
|
|
9
9
|
return (
|
|
10
|
-
collection?.reduce(
|
|
11
|
-
groups
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
collection?.reduce(
|
|
11
|
+
(groups, e) => {
|
|
12
|
+
groups[keyProvider(e)] = e
|
|
13
|
+
return groups
|
|
14
|
+
},
|
|
15
|
+
{} as { [key: string]: T }
|
|
16
|
+
) ?? {}
|
|
14
17
|
)
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -42,6 +45,7 @@ const brAliases = {
|
|
|
42
45
|
|
|
43
46
|
export const BusinessRulePlugin = Plugin.create({
|
|
44
47
|
name: 'BusinessRulePlugin',
|
|
48
|
+
docs: [createSdkDocEntry('BusinessRule', ['sys_script'])],
|
|
45
49
|
records: {
|
|
46
50
|
sys_script: {
|
|
47
51
|
async toShape(record, { transform }) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ts, Plugin, CallExpressionShape, type Shape
|
|
2
|
-
import { Record } from '@servicenow/sdk-core/runtime/db'
|
|
1
|
+
import { ts, Plugin, CallExpressionShape, type Shape } from '@servicenow/sdk-build-core'
|
|
3
2
|
import { getCallExpressionName } from './utils'
|
|
4
3
|
|
|
5
4
|
export const CallExpressionPlugin = Plugin.create({
|
|
@@ -34,7 +33,7 @@ export const CallExpressionPlugin = Plugin.create({
|
|
|
34
33
|
shapes: [
|
|
35
34
|
{
|
|
36
35
|
shape: CallExpressionShape,
|
|
37
|
-
async commit(shape, target, { commit
|
|
36
|
+
async commit(shape, target, { commit }) {
|
|
38
37
|
if (target.isKind(ts.SyntaxKind.ExpressionStatement)) {
|
|
39
38
|
target = target.getExpression()
|
|
40
39
|
}
|
|
@@ -68,135 +67,8 @@ export const CallExpressionPlugin = Plugin.create({
|
|
|
68
67
|
target.addArguments(argumentsToAdd)
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
if (shape.getCallee() === Record.name) {
|
|
72
|
-
fixCallExpressionArgTypes(compiler, target)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
70
|
return { success: true }
|
|
76
71
|
},
|
|
77
72
|
},
|
|
78
73
|
],
|
|
79
74
|
})
|
|
80
|
-
|
|
81
|
-
function fixCallExpressionArgTypes(compiler: Compiler, node: ts.CallExpression) {
|
|
82
|
-
if (node.wasForgotten()) {
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
node.getSourceFile().fixMissingImports()
|
|
87
|
-
const signature = compiler.getTypeChecker().getResolvedSignature(node)
|
|
88
|
-
if (!signature) {
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
signature.getParameters().forEach((param, idx) => {
|
|
93
|
-
const argType = param.getTypeAtLocation(node)
|
|
94
|
-
const argNode = node.getArguments()[idx]?.asKind(ts.SyntaxKind.ObjectLiteralExpression)
|
|
95
|
-
if (!argType || !argNode) {
|
|
96
|
-
return
|
|
97
|
-
}
|
|
98
|
-
fixCallExpressionArgType(node, argNode, argType)
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function fixCallExpressionArgType(
|
|
103
|
-
node: ts.CallExpression,
|
|
104
|
-
argNode: ts.ObjectLiteralExpression | ts.PropertyAssignment,
|
|
105
|
-
argType: ts.Type
|
|
106
|
-
) {
|
|
107
|
-
if (argNode.getType().isObject()) {
|
|
108
|
-
const objectLiteral = argNode.isKind(ts.SyntaxKind.ObjectLiteralExpression)
|
|
109
|
-
? argNode
|
|
110
|
-
: argNode.getInitializerIfKind(ts.SyntaxKind.ObjectLiteralExpression)
|
|
111
|
-
argType.getApparentProperties().forEach((prop) => {
|
|
112
|
-
const propNode = objectLiteral?.getProperty(prop.getName())?.asKind(ts.SyntaxKind.PropertyAssignment)
|
|
113
|
-
if (!propNode) {
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
fixCallExpressionArgType(node, propNode, prop.getTypeAtLocation(node))
|
|
117
|
-
})
|
|
118
|
-
} else if (argNode.isKind(ts.SyntaxKind.PropertyAssignment)) {
|
|
119
|
-
const nodeType = argNode.getType()
|
|
120
|
-
if (
|
|
121
|
-
nodeType.isAssignableTo(argType) ||
|
|
122
|
-
canAssignString(argNode, argType) ||
|
|
123
|
-
canCastAndAssignBoolean(argNode, argType) ||
|
|
124
|
-
canCastAndAssignNumber(argNode, argType)
|
|
125
|
-
) {
|
|
126
|
-
return
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// cast 'as any' for other types
|
|
130
|
-
const argValue = argNode.getInitializer()?.getText()
|
|
131
|
-
argNode.setInitializer(`${argValue} as any`)
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function canCastAndAssignBoolean(argNode: ts.PropertyAssignment, argType: ts.Type): boolean {
|
|
136
|
-
const booleanTypes = getBooleanTypes(argType)
|
|
137
|
-
const booleanValue = getBooleanValue(argNode)
|
|
138
|
-
if (booleanValue && booleanTypes.length > 0) {
|
|
139
|
-
const isAssignable = booleanTypes.some((type) => {
|
|
140
|
-
return (
|
|
141
|
-
(type.isBoolean() && (booleanValue === 'true' || booleanValue === 'false')) ||
|
|
142
|
-
type.getText() === booleanValue
|
|
143
|
-
)
|
|
144
|
-
})
|
|
145
|
-
if (isAssignable) {
|
|
146
|
-
argNode.setInitializer(`${booleanValue}`)
|
|
147
|
-
return true
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return false
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function canCastAndAssignNumber(argNode: ts.PropertyAssignment, argType: ts.Type): boolean {
|
|
154
|
-
const numberTypes = getNumberTypes(argType)
|
|
155
|
-
const numberValue = getNumberValue(argNode)
|
|
156
|
-
if (numberValue && numberTypes.length > 0) {
|
|
157
|
-
const isAssignable = numberTypes.some((type) => {
|
|
158
|
-
return type.isNumber() || `${type.getLiteralValue()}` === numberValue
|
|
159
|
-
})
|
|
160
|
-
if (isAssignable) {
|
|
161
|
-
argNode.setInitializer(`${numberValue}`)
|
|
162
|
-
return true
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return false
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function canAssignString(argNode: ts.PropertyAssignment, argType: ts.Type): boolean {
|
|
169
|
-
const stringTypes = getStringTypes(argType)
|
|
170
|
-
const stringValue = getStringValue(argNode)
|
|
171
|
-
return stringTypes.some((type) => {
|
|
172
|
-
return type.isString() || type.getLiteralValue() === stringValue
|
|
173
|
-
})
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function getBooleanValue(argNode: ts.PropertyAssignment): string | undefined {
|
|
177
|
-
return argNode.getInitializerIfKind(ts.SyntaxKind.StringLiteral)?.getLiteralValue()
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function getBooleanTypes(argType: ts.Type) {
|
|
181
|
-
const type = argType.isUnion() ? argType.getUnionTypes() : [argType]
|
|
182
|
-
return type.filter((type) => type.isBoolean() || type.isBooleanLiteral())
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function getNumberValue(argNode: ts.PropertyAssignment): string | undefined {
|
|
186
|
-
const numStrVal = argNode.getInitializerIfKind(ts.SyntaxKind.StringLiteral)?.getLiteralValue()
|
|
187
|
-
return numStrVal && !isNaN(Number(numStrVal)) ? `${numStrVal}` : undefined
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function getNumberTypes(argType: ts.Type) {
|
|
191
|
-
const type = argType.isUnion() ? argType.getUnionTypes() : [argType]
|
|
192
|
-
return type.filter((type) => type.isNumber() || type.isNumberLiteral())
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function getStringValue(argNode: ts.PropertyAssignment): string | undefined {
|
|
196
|
-
return argNode.getInitializerIfKind(ts.SyntaxKind.StringLiteral)?.getLiteralValue()
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function getStringTypes(argType: ts.Type) {
|
|
200
|
-
const type = argType.isUnion() ? argType.getUnionTypes() : [argType]
|
|
201
|
-
return type.filter((type) => type.isString() || type.isStringLiteral())
|
|
202
|
-
}
|
package/src/claims-plugin.ts
CHANGED
|
@@ -59,7 +59,7 @@ export const ClaimsPlugin = Plugin.create({
|
|
|
59
59
|
return { success: false }
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
const allClaims = file.getJson()
|
|
62
|
+
const allClaims = file.getJson().asObject()
|
|
63
63
|
const records: Record[] = []
|
|
64
64
|
for (const [updateName, claims] of allClaims.entries()) {
|
|
65
65
|
for (const claim of claims
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
-
import { generateDeprecatedDiagnostics } from './utils'
|
|
3
|
+
import { generateDeprecatedDiagnostics, validateClientSideScript } from './utils'
|
|
4
|
+
import { NowIncludeShape } from './now-include-plugin'
|
|
4
5
|
|
|
5
6
|
enum UITypeMapping {
|
|
6
7
|
desktop = 0,
|
|
@@ -45,7 +46,8 @@ export const ClientScriptPlugin = Plugin.create({
|
|
|
45
46
|
name: 'ClientScriptPlugin',
|
|
46
47
|
records: {
|
|
47
48
|
sys_script_client: {
|
|
48
|
-
toShape(record) {
|
|
49
|
+
async toShape(record, { transform }) {
|
|
50
|
+
const script = await NowIncludeShape.fromRecord(record, record.get('script'), transform)
|
|
49
51
|
return {
|
|
50
52
|
success: true,
|
|
51
53
|
value: new CallExpressionShape({
|
|
@@ -59,7 +61,7 @@ export const ClientScriptPlugin = Plugin.create({
|
|
|
59
61
|
table: $,
|
|
60
62
|
appliesExtended: $.from('applies_extended').toBoolean().def(false),
|
|
61
63
|
isolateScript: $.from('isolate_script').toBoolean().def(false),
|
|
62
|
-
script:
|
|
64
|
+
script: $.val(script),
|
|
63
65
|
name: $,
|
|
64
66
|
description: $.def(''),
|
|
65
67
|
messages: $.def(''),
|
|
@@ -110,7 +112,7 @@ export const ClientScriptPlugin = Plugin.create({
|
|
|
110
112
|
)
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
if (script && !
|
|
115
|
+
if (script && !validateClientSideScript(script, compiler)) {
|
|
114
116
|
diagnostics.error(
|
|
115
117
|
clientScript.get('script'),
|
|
116
118
|
`Client side scripts cannot import or require modules.`
|
|
@@ -147,17 +149,6 @@ export const ClientScriptPlugin = Plugin.create({
|
|
|
147
149
|
],
|
|
148
150
|
})
|
|
149
151
|
|
|
150
|
-
function validateClientSideScripts(script: string, compiler: Compiler) {
|
|
151
|
-
const source = compiler.createSourceFile('tmp-file.ts', script)
|
|
152
|
-
const importDeclarations = source.getDescendantsOfKind(ts.SyntaxKind.ImportDeclaration)
|
|
153
|
-
const requireCalls = source.getDescendantsOfKind(ts.SyntaxKind.CallExpression).filter((callExpression) => {
|
|
154
|
-
return isRequire(callExpression)
|
|
155
|
-
})
|
|
156
|
-
const isValid = !(importDeclarations.length > 0 || requireCalls.length > 0)
|
|
157
|
-
compiler.removeSourceFile(source)
|
|
158
|
-
return isValid
|
|
159
|
-
}
|
|
160
|
-
|
|
161
152
|
function getUITypeFromId(id: number) {
|
|
162
153
|
const type = UITypeMapping[id]
|
|
163
154
|
if (!type) {
|
|
@@ -168,12 +159,7 @@ function getUITypeFromId(id: number) {
|
|
|
168
159
|
|
|
169
160
|
function getUITypeId(value: string) {
|
|
170
161
|
if (value in UITypeMapping) {
|
|
171
|
-
return UITypeMapping[value]
|
|
162
|
+
return UITypeMapping[value as keyof typeof UITypeMapping]
|
|
172
163
|
}
|
|
173
164
|
throw Error('Invalid ui_type found in xml')
|
|
174
165
|
}
|
|
175
|
-
|
|
176
|
-
function isRequire(callExpression: ts.CallExpression): boolean {
|
|
177
|
-
const expression = callExpression.getExpression()
|
|
178
|
-
return ts.Node.isIdentifier(expression) && expression.getText() === 'require'
|
|
179
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Shape } from '@servicenow/sdk-build-core'
|
|
2
2
|
import {
|
|
3
|
+
ApprovalRulesColumn,
|
|
3
4
|
BasicDateTimeColumn,
|
|
4
5
|
BasicImageColumn,
|
|
5
6
|
BooleanColumn,
|
|
@@ -8,25 +9,42 @@ import {
|
|
|
8
9
|
ConditionsColumn,
|
|
9
10
|
DateColumn,
|
|
10
11
|
DateTimeColumn,
|
|
12
|
+
DayOfWeekColumn,
|
|
13
|
+
DaysOfWeekColumn,
|
|
11
14
|
DecimalColumn,
|
|
12
15
|
DocumentIdColumn,
|
|
13
16
|
DomainIdColumn,
|
|
14
17
|
DomainPathColumn,
|
|
15
18
|
DueDateColumn,
|
|
19
|
+
DurationColumn,
|
|
20
|
+
EmailColumn,
|
|
21
|
+
FieldListColumn,
|
|
16
22
|
FieldNameColumn,
|
|
23
|
+
FloatColumn,
|
|
24
|
+
GuidColumn,
|
|
25
|
+
HtmlColumn,
|
|
17
26
|
IntegerColumn,
|
|
18
27
|
IntegerDateColumn,
|
|
28
|
+
JsonColumn,
|
|
19
29
|
ListColumn,
|
|
30
|
+
MultiLineTextColumn,
|
|
31
|
+
NameValuePairsColumn,
|
|
20
32
|
OtherDateColumn,
|
|
33
|
+
Password2Column,
|
|
21
34
|
RadioColumn,
|
|
35
|
+
RecordsColumn,
|
|
22
36
|
ReferenceColumn,
|
|
23
37
|
ScheduleDateTimeColumn,
|
|
24
38
|
ScriptColumn,
|
|
39
|
+
SlushBucketColumn,
|
|
25
40
|
StringColumn,
|
|
26
41
|
SystemClassNameColumn,
|
|
27
42
|
TableNameColumn,
|
|
43
|
+
TemplateValueColumn,
|
|
44
|
+
TimeColumn,
|
|
28
45
|
TranslatedFieldColumn,
|
|
29
46
|
TranslatedTextColumn,
|
|
47
|
+
UrlColumn,
|
|
30
48
|
UserRolesColumn,
|
|
31
49
|
VersionColumn,
|
|
32
50
|
} from '@servicenow/sdk-core/runtime/db'
|
|
@@ -61,6 +79,25 @@ export const COLUMN_TYPE_TO_API: Record<string, string> = {
|
|
|
61
79
|
version: VersionColumn.name,
|
|
62
80
|
glide_list: ListColumn.name,
|
|
63
81
|
image: BasicImageColumn.name,
|
|
82
|
+
// New column types
|
|
83
|
+
GUID: GuidColumn.name,
|
|
84
|
+
password2: Password2Column.name,
|
|
85
|
+
json: JsonColumn.name,
|
|
86
|
+
url: UrlColumn.name,
|
|
87
|
+
email: EmailColumn.name,
|
|
88
|
+
html: HtmlColumn.name,
|
|
89
|
+
float: FloatColumn.name,
|
|
90
|
+
glide_duration: DurationColumn.name,
|
|
91
|
+
glide_time: TimeColumn.name,
|
|
92
|
+
field_list: FieldListColumn.name,
|
|
93
|
+
records: RecordsColumn.name,
|
|
94
|
+
slushbucket: SlushBucketColumn.name,
|
|
95
|
+
name_values: NameValuePairsColumn.name,
|
|
96
|
+
approval_rules: ApprovalRulesColumn.name,
|
|
97
|
+
multi_two_lines: MultiLineTextColumn.name,
|
|
98
|
+
template_value: TemplateValueColumn.name,
|
|
99
|
+
day_of_week: DayOfWeekColumn.name,
|
|
100
|
+
days_of_week: DaysOfWeekColumn.name,
|
|
64
101
|
}
|
|
65
102
|
|
|
66
103
|
export const COLUMN_API_TO_TYPE = Object.fromEntries(
|
|
@@ -87,25 +124,50 @@ export function addFieldsToColumn(
|
|
|
87
124
|
})
|
|
88
125
|
}
|
|
89
126
|
|
|
90
|
-
export function getDefaultMaxLength(columnType: string): number {
|
|
127
|
+
export function getDefaultMaxLength(columnType: string | undefined): number {
|
|
91
128
|
switch (columnType) {
|
|
92
129
|
case 'conditions':
|
|
93
130
|
case 'glide_list':
|
|
131
|
+
case 'json':
|
|
132
|
+
case 'name_values':
|
|
133
|
+
case 'multi_two_lines':
|
|
94
134
|
return 4000
|
|
135
|
+
case 'template_value':
|
|
136
|
+
return 65000
|
|
137
|
+
case 'script':
|
|
138
|
+
return 8000
|
|
139
|
+
case 'html':
|
|
140
|
+
return 65536
|
|
95
141
|
case 'decimal':
|
|
96
142
|
return 20
|
|
143
|
+
case 'float':
|
|
144
|
+
return 15
|
|
97
145
|
case 'domain_id':
|
|
98
146
|
case 'document_id':
|
|
99
147
|
case 'reference':
|
|
148
|
+
case 'GUID':
|
|
100
149
|
return 32
|
|
150
|
+
case 'string_full_utf8':
|
|
101
151
|
case 'domain_path':
|
|
102
152
|
case 'user_roles':
|
|
153
|
+
case 'password2':
|
|
154
|
+
case 'email':
|
|
103
155
|
return 255
|
|
104
|
-
case '
|
|
105
|
-
|
|
156
|
+
case 'url':
|
|
157
|
+
case 'records':
|
|
158
|
+
return 1024
|
|
106
159
|
case 'table_name':
|
|
107
160
|
case 'field_name':
|
|
108
161
|
return 80
|
|
162
|
+
case 'glide_duration':
|
|
163
|
+
return 20
|
|
164
|
+
case 'glide_time':
|
|
165
|
+
return 8
|
|
166
|
+
case 'field_list':
|
|
167
|
+
case 'approval_rules':
|
|
168
|
+
return 1024
|
|
169
|
+
case 'slushbucket':
|
|
170
|
+
return 4000
|
|
109
171
|
default:
|
|
110
172
|
/**
|
|
111
173
|
* For types mentioned below it default to 40 on instance
|
|
@@ -28,6 +28,7 @@ export async function getDocumentationRecords(
|
|
|
28
28
|
name: $.from('table'),
|
|
29
29
|
element: $.val(columnName),
|
|
30
30
|
language: $.def('en'),
|
|
31
|
+
hint: $.def(''),
|
|
31
32
|
label: $.val(documentation.ifDefined() ?? columnName),
|
|
32
33
|
plural: $.val(
|
|
33
34
|
generatePlural(
|
|
@@ -52,7 +53,7 @@ export async function getDocumentationRecords(
|
|
|
52
53
|
name: $.val(column.get('table')),
|
|
53
54
|
element: $.val(column.get('name')),
|
|
54
55
|
language: $,
|
|
55
|
-
hint:
|
|
56
|
+
hint: $.def(''),
|
|
56
57
|
help: $,
|
|
57
58
|
label: $,
|
|
58
59
|
plural: $,
|
|
@@ -78,6 +79,7 @@ export async function getDocumentationRecords(
|
|
|
78
79
|
name: $.from('table'),
|
|
79
80
|
element: $.val(columnName),
|
|
80
81
|
language: $.def('en'),
|
|
82
|
+
hint: $.def(''),
|
|
81
83
|
label: $.val(documentation.ifDefined() ?? columnName),
|
|
82
84
|
plural: $.val(
|
|
83
85
|
generatePlural(documentation.ifDefined()?.asString().getValue() ?? columnName.asString().getValue())
|
|
@@ -100,9 +102,7 @@ export async function getChoiceRecords(
|
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
const records: Record[] = []
|
|
103
|
-
for (const choiceValue of Object.
|
|
104
|
-
// TODO Should have proper type here
|
|
105
|
-
const choice = choiceArg.get(choiceValue)
|
|
105
|
+
for (const [idx, [choiceValue, choice]] of Object.entries(choiceArg.properties()).entries()) {
|
|
106
106
|
if (choice.isObject()) {
|
|
107
107
|
generateDeprecatedDiagnostics(choice.withAliasedKeys(aliasedKeys), diagnostics)
|
|
108
108
|
}
|
|
@@ -116,6 +116,8 @@ export async function getChoiceRecords(
|
|
|
116
116
|
element: column.get('name').asString().getValue(),
|
|
117
117
|
label: choice,
|
|
118
118
|
value: choiceValue,
|
|
119
|
+
sequence: idx + 1,
|
|
120
|
+
language: 'en',
|
|
119
121
|
}
|
|
120
122
|
: choice.asObject().transform(({ $ }) => ({
|
|
121
123
|
name: $.val(column.get('table')),
|