@servicenow/sdk-build-plugins 4.4.1 → 4.6.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 +54 -4
- package/dist/acl-plugin.js.map +1 -1
- package/dist/applicability-plugin.js +2 -0
- package/dist/applicability-plugin.js.map +1 -1
- package/dist/application-menu-plugin.js +2 -0
- package/dist/application-menu-plugin.js.map +1 -1
- package/dist/arrow-function-plugin.d.ts +6 -1
- package/dist/arrow-function-plugin.js +105 -12
- package/dist/arrow-function-plugin.js.map +1 -1
- package/dist/atf/test-plugin.js +2 -0
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +20 -0
- package/dist/basic-syntax-plugin.js.map +1 -1
- package/dist/call-expression-plugin.js +1 -0
- package/dist/call-expression-plugin.js.map +1 -1
- package/dist/claims-plugin.js +1 -0
- package/dist/claims-plugin.js.map +1 -1
- package/dist/client-script-plugin.js +1 -0
- package/dist/client-script-plugin.js.map +1 -1
- package/dist/column-plugin.js +4 -7
- package/dist/column-plugin.js.map +1 -1
- package/dist/cross-scope-privilege-plugin.js +1 -0
- package/dist/cross-scope-privilege-plugin.js.map +1 -1
- package/dist/dashboard/dashboard-plugin.js +2 -0
- package/dist/dashboard/dashboard-plugin.js.map +1 -1
- package/dist/data-plugin.js +1 -0
- package/dist/data-plugin.js.map +1 -1
- package/dist/email-notification-plugin.js +9 -13
- package/dist/email-notification-plugin.js.map +1 -1
- package/dist/flow/constants/flow-plugin-constants.d.ts +1 -1
- package/dist/flow/constants/flow-plugin-constants.js +1 -1
- package/dist/flow/constants/flow-plugin-constants.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-diagnostics.js +5 -5
- package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +82 -2
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +48 -40
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin.js +1 -0
- package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
- package/dist/flow/plugins/approval-rules-plugin.js +1 -0
- package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-action-definition-plugin.js +1232 -55
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-data-pill-plugin.js +6 -2
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-definition-plugin.js +23 -44
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +2 -2
- package/dist/flow/plugins/flow-diagnostics-plugin.js +3 -2
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-instance-plugin.js +136 -34
- package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-trigger-instance-plugin.js +1 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/inline-script-plugin.js +1 -0
- package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
- package/dist/flow/plugins/step-definition-plugin.js +4 -2
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/step-instance-plugin.d.ts +9 -1
- package/dist/flow/plugins/step-instance-plugin.js +649 -135
- package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/trigger-plugin.js +2 -0
- package/dist/flow/plugins/trigger-plugin.js.map +1 -1
- package/dist/flow/plugins/wfa-datapill-plugin.js +21 -5
- package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
- package/dist/flow/post-install.d.ts +2 -0
- package/dist/flow/post-install.js +59 -0
- package/dist/flow/post-install.js.map +1 -0
- package/dist/flow/utils/complex-object-resolver.js +4 -1
- package/dist/flow/utils/complex-object-resolver.js.map +1 -1
- package/dist/flow/utils/complex-objects.js +5 -3
- package/dist/flow/utils/complex-objects.js.map +1 -1
- package/dist/flow/utils/flow-constants.d.ts +90 -2
- package/dist/flow/utils/flow-constants.js +430 -7
- package/dist/flow/utils/flow-constants.js.map +1 -1
- package/dist/flow/utils/flow-io-to-record.d.ts +1 -1
- package/dist/flow/utils/flow-io-to-record.js +37 -16
- package/dist/flow/utils/flow-io-to-record.js.map +1 -1
- package/dist/flow/utils/flow-shapes.js +4 -0
- package/dist/flow/utils/flow-shapes.js.map +1 -1
- package/dist/flow/utils/flow-to-xml.d.ts +3 -2
- package/dist/flow/utils/flow-to-xml.js +3 -4
- package/dist/flow/utils/flow-to-xml.js.map +1 -1
- package/dist/flow/utils/label-cache-parser.d.ts +9 -2
- package/dist/flow/utils/label-cache-parser.js +32 -4
- package/dist/flow/utils/label-cache-parser.js.map +1 -1
- package/dist/flow/utils/label-cache-processor.d.ts +5 -0
- package/dist/flow/utils/label-cache-processor.js +14 -2
- package/dist/flow/utils/label-cache-processor.js.map +1 -1
- package/dist/flow/utils/pill-shape-helpers.d.ts +15 -0
- package/dist/flow/utils/pill-shape-helpers.js +35 -0
- package/dist/flow/utils/pill-shape-helpers.js.map +1 -0
- package/dist/flow/utils/pill-string-parser.js +1 -0
- package/dist/flow/utils/pill-string-parser.js.map +1 -1
- package/dist/flow/utils/schema-to-flow-object.d.ts +6 -1
- package/dist/flow/utils/schema-to-flow-object.js +131 -15
- package/dist/flow/utils/schema-to-flow-object.js.map +1 -1
- package/dist/flow/utils/service-catalog.js +5 -1
- package/dist/flow/utils/service-catalog.js.map +1 -1
- package/dist/flow/utils/utils.d.ts +1 -0
- package/dist/flow/utils/utils.js +6 -1
- package/dist/flow/utils/utils.js.map +1 -1
- package/dist/form-plugin.d.ts +2 -0
- package/dist/form-plugin.js +1132 -0
- package/dist/form-plugin.js.map +1 -0
- package/dist/html-import-plugin.js +1 -0
- package/dist/html-import-plugin.js.map +1 -1
- package/dist/import-sets-plugin.js +2 -0
- package/dist/import-sets-plugin.js.map +1 -1
- package/dist/inbound-email-action-plugin.d.ts +10 -0
- package/dist/inbound-email-action-plugin.js +128 -0
- package/dist/inbound-email-action-plugin.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-scan-plugin.d.ts +2 -0
- package/dist/instance-scan-plugin.js +293 -0
- package/dist/instance-scan-plugin.js.map +1 -0
- package/dist/json-plugin.js +1 -0
- package/dist/json-plugin.js.map +1 -1
- package/dist/list-plugin.js +1 -0
- package/dist/list-plugin.js.map +1 -1
- package/dist/now-attach-plugin.js +1 -0
- package/dist/now-attach-plugin.js.map +1 -1
- package/dist/now-config-plugin.js +659 -51
- package/dist/now-config-plugin.js.map +1 -1
- package/dist/now-id-plugin.js +1 -0
- package/dist/now-id-plugin.js.map +1 -1
- package/dist/now-include-plugin.js +1 -0
- package/dist/now-include-plugin.js.map +1 -1
- package/dist/now-ref-plugin.js +1 -0
- package/dist/now-ref-plugin.js.map +1 -1
- package/dist/now-unresolved-plugin.js +1 -0
- package/dist/now-unresolved-plugin.js.map +1 -1
- package/dist/package-json-plugin.js +1 -0
- package/dist/package-json-plugin.js.map +1 -1
- package/dist/property-plugin.js +3 -1
- package/dist/property-plugin.js.map +1 -1
- package/dist/record-plugin.d.ts +37 -0
- package/dist/record-plugin.js +47 -3
- package/dist/record-plugin.js.map +1 -1
- package/dist/repack/lint/Rules.d.ts +11 -2
- package/dist/repack/lint/Rules.js +160 -16
- package/dist/repack/lint/Rules.js.map +1 -1
- package/dist/repack/lint/index.d.ts +10 -5
- package/dist/repack/lint/index.js +76 -50
- package/dist/repack/lint/index.js.map +1 -1
- package/dist/rest-api-plugin.js +22 -1
- 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/schedule-script/index.d.ts +1 -0
- package/dist/schedule-script/index.js +18 -0
- package/dist/schedule-script/index.js.map +1 -0
- package/dist/schedule-script/scheduled-script-plugin.d.ts +2 -0
- package/dist/schedule-script/scheduled-script-plugin.js +556 -0
- package/dist/schedule-script/scheduled-script-plugin.js.map +1 -0
- package/dist/schedule-script/timeZoneConverter.d.ts +61 -0
- package/dist/schedule-script/timeZoneConverter.js +170 -0
- package/dist/schedule-script/timeZoneConverter.js.map +1 -0
- package/dist/script-action-plugin.js +2 -0
- package/dist/script-action-plugin.js.map +1 -1
- package/dist/script-include-plugin.js +2 -0
- package/dist/script-include-plugin.js.map +1 -1
- package/dist/server-module-plugin/index.js +13 -2
- package/dist/server-module-plugin/index.js.map +1 -1
- package/dist/service-catalog/catalog-clientscript-plugin.js +2 -0
- package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-item-plugin.js +2 -0
- package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-ui-policy-plugin.js +2 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
- package/dist/service-catalog/sc-record-producer-plugin.js +2 -0
- package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
- package/dist/service-catalog/service-catalog-base.d.ts +18 -18
- package/dist/service-catalog/service-catalog-base.js +22 -22
- package/dist/service-catalog/service-catalog-base.js.map +1 -1
- package/dist/service-catalog/service-catalog-diagnostics.d.ts +6 -0
- package/dist/service-catalog/service-catalog-diagnostics.js +20 -0
- package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -1
- package/dist/service-catalog/shape-to-record.js +7 -2
- package/dist/service-catalog/shape-to-record.js.map +1 -1
- package/dist/service-catalog/variable-set-plugin.js +2 -0
- package/dist/service-catalog/variable-set-plugin.js.map +1 -1
- package/dist/service-portal/angular-provider-plugin.js +2 -0
- package/dist/service-portal/angular-provider-plugin.js.map +1 -1
- package/dist/service-portal/dependency-plugin.js +5 -31
- package/dist/service-portal/dependency-plugin.js.map +1 -1
- package/dist/service-portal/header-footer-plugin.d.ts +2 -0
- package/dist/service-portal/header-footer-plugin.js +50 -0
- package/dist/service-portal/header-footer-plugin.js.map +1 -0
- package/dist/service-portal/menu-plugin.d.ts +2 -0
- package/dist/service-portal/menu-plugin.js +334 -0
- package/dist/service-portal/menu-plugin.js.map +1 -0
- package/dist/service-portal/page-plugin.d.ts +2 -0
- package/dist/service-portal/page-plugin.js +681 -0
- package/dist/service-portal/page-plugin.js.map +1 -0
- package/dist/service-portal/page-route-map-plugin.d.ts +2 -0
- package/dist/service-portal/page-route-map-plugin.js +114 -0
- package/dist/service-portal/page-route-map-plugin.js.map +1 -0
- package/dist/service-portal/portal-plugin.d.ts +2 -0
- package/dist/service-portal/portal-plugin.js +309 -0
- package/dist/service-portal/portal-plugin.js.map +1 -0
- package/dist/service-portal/theme-plugin.d.ts +2 -0
- package/dist/service-portal/theme-plugin.js +112 -0
- package/dist/service-portal/theme-plugin.js.map +1 -0
- package/dist/service-portal/utils.d.ts +46 -0
- package/dist/service-portal/utils.js +331 -0
- package/dist/service-portal/utils.js.map +1 -0
- package/dist/service-portal/widget-plugin.js +10 -182
- package/dist/service-portal/widget-plugin.js.map +1 -1
- package/dist/sla-plugin.js +2 -0
- package/dist/sla-plugin.js.map +1 -1
- package/dist/static-content-plugin.js +5 -0
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +191 -26
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-action-plugin.js +3 -4
- package/dist/ui-action-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +101 -21
- package/dist/ui-page-plugin.js.map +1 -1
- package/dist/ui-policy-plugin.js +1 -0
- package/dist/ui-policy-plugin.js.map +1 -1
- package/dist/user-preference-plugin.js +2 -0
- package/dist/user-preference-plugin.js.map +1 -1
- package/dist/utils.d.ts +20 -2
- package/dist/utils.js +34 -3
- package/dist/utils.js.map +1 -1
- package/dist/ux-list-menu-config-plugin.js +2 -0
- package/dist/ux-list-menu-config-plugin.js.map +1 -1
- package/dist/view-plugin.js +9 -3
- package/dist/view-plugin.js.map +1 -1
- package/dist/workspace-plugin.js +41 -36
- package/dist/workspace-plugin.js.map +1 -1
- package/package.json +11 -11
- package/src/_types/eslint-community-eslint-utils.d.ts +15 -0
- package/src/acl-plugin.ts +97 -8
- package/src/applicability-plugin.ts +2 -0
- package/src/application-menu-plugin.ts +2 -0
- package/src/arrow-function-plugin.ts +128 -13
- package/src/atf/test-plugin.ts +2 -0
- package/src/basic-syntax-plugin.ts +21 -0
- package/src/call-expression-plugin.ts +1 -0
- package/src/claims-plugin.ts +1 -0
- package/src/client-script-plugin.ts +2 -1
- package/src/column-plugin.ts +4 -8
- package/src/cross-scope-privilege-plugin.ts +2 -1
- package/src/dashboard/dashboard-plugin.ts +2 -0
- package/src/data-plugin.ts +1 -0
- package/src/email-notification-plugin.ts +3 -23
- package/src/flow/constants/flow-plugin-constants.ts +1 -1
- package/src/flow/flow-logic/flow-logic-diagnostics.ts +5 -6
- package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +47 -45
- package/src/flow/flow-logic/flow-logic-plugin.ts +1 -0
- package/src/flow/plugins/approval-rules-plugin.ts +1 -0
- package/src/flow/plugins/flow-action-definition-plugin.ts +1584 -62
- package/src/flow/plugins/flow-data-pill-plugin.ts +6 -2
- package/src/flow/plugins/flow-definition-plugin.ts +22 -51
- package/src/flow/plugins/flow-diagnostics-plugin.ts +3 -2
- package/src/flow/plugins/flow-instance-plugin.ts +201 -36
- package/src/flow/plugins/flow-trigger-instance-plugin.ts +1 -0
- package/src/flow/plugins/inline-script-plugin.ts +1 -0
- package/src/flow/plugins/step-definition-plugin.ts +4 -2
- package/src/flow/plugins/step-instance-plugin.ts +772 -155
- package/src/flow/plugins/trigger-plugin.ts +2 -0
- package/src/flow/plugins/wfa-datapill-plugin.ts +26 -5
- package/src/flow/post-install.ts +93 -0
- package/src/flow/utils/complex-object-resolver.ts +4 -1
- package/src/flow/utils/complex-objects.ts +11 -3
- package/src/flow/utils/flow-constants.ts +451 -6
- package/src/flow/utils/flow-io-to-record.ts +43 -17
- package/src/flow/utils/flow-shapes.ts +4 -0
- package/src/flow/utils/flow-to-xml.ts +4 -4
- package/src/flow/utils/label-cache-parser.ts +33 -4
- package/src/flow/utils/label-cache-processor.ts +14 -2
- package/src/flow/utils/pill-shape-helpers.ts +42 -0
- package/src/flow/utils/pill-string-parser.ts +1 -0
- package/src/flow/utils/schema-to-flow-object.ts +183 -15
- package/src/flow/utils/service-catalog.ts +5 -2
- package/src/flow/utils/utils.ts +12 -1
- package/src/form-plugin.ts +1409 -0
- package/src/html-import-plugin.ts +1 -0
- package/src/import-sets-plugin.ts +2 -0
- package/src/inbound-email-action-plugin.ts +145 -0
- package/src/index.ts +13 -0
- package/src/instance-scan-plugin.ts +313 -0
- package/src/json-plugin.ts +1 -0
- package/src/list-plugin.ts +2 -1
- package/src/now-attach-plugin.ts +1 -0
- package/src/now-config-plugin.ts +833 -53
- package/src/now-id-plugin.ts +1 -0
- package/src/now-include-plugin.ts +1 -0
- package/src/now-ref-plugin.ts +1 -0
- package/src/now-unresolved-plugin.ts +1 -0
- package/src/package-json-plugin.ts +1 -0
- package/src/property-plugin.ts +6 -1
- package/src/record-plugin.ts +56 -6
- package/src/repack/lint/Rules.ts +171 -22
- package/src/repack/lint/index.ts +80 -56
- package/src/rest-api-plugin.ts +28 -2
- package/src/role-plugin.ts +2 -1
- package/src/schedule-script/index.ts +1 -0
- package/src/schedule-script/scheduled-script-plugin.ts +690 -0
- package/src/schedule-script/timeZoneConverter.ts +188 -0
- package/src/script-action-plugin.ts +2 -0
- package/src/script-include-plugin.ts +2 -0
- package/src/server-module-plugin/index.ts +14 -2
- package/src/service-catalog/catalog-clientscript-plugin.ts +2 -0
- package/src/service-catalog/catalog-item-plugin.ts +2 -0
- package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -0
- package/src/service-catalog/sc-record-producer-plugin.ts +2 -0
- package/src/service-catalog/service-catalog-base.ts +22 -22
- package/src/service-catalog/service-catalog-diagnostics.ts +30 -0
- package/src/service-catalog/shape-to-record.ts +8 -2
- package/src/service-catalog/variable-set-plugin.ts +2 -0
- package/src/service-portal/angular-provider-plugin.ts +2 -0
- package/src/service-portal/dependency-plugin.ts +6 -53
- package/src/service-portal/header-footer-plugin.ts +57 -0
- package/src/service-portal/menu-plugin.ts +413 -0
- package/src/service-portal/page-plugin.ts +805 -0
- package/src/service-portal/page-route-map-plugin.ts +124 -0
- package/src/service-portal/portal-plugin.ts +342 -0
- package/src/service-portal/theme-plugin.ts +135 -0
- package/src/service-portal/utils.ts +470 -0
- package/src/service-portal/widget-plugin.ts +18 -224
- package/src/sla-plugin.ts +2 -0
- package/src/static-content-plugin.ts +4 -0
- package/src/table-plugin.ts +228 -37
- package/src/ui-action-plugin.ts +3 -8
- package/src/ui-page-plugin.ts +110 -21
- package/src/ui-policy-plugin.ts +2 -1
- package/src/user-preference-plugin.ts +2 -0
- package/src/utils.ts +42 -2
- package/src/ux-list-menu-config-plugin.ts +2 -0
- package/src/view-plugin.ts +11 -4
- package/src/workspace-plugin.ts +45 -43
- package/src/_types/eslint-plugin-es-x.d.ts +0 -17
package/src/table-plugin.ts
CHANGED
|
@@ -26,7 +26,7 @@ import { create } from 'xmlbuilder2'
|
|
|
26
26
|
import type { XMLBuilder } from 'xmlbuilder2/lib/interfaces'
|
|
27
27
|
import { addFieldsToColumn } from './column/column-helper'
|
|
28
28
|
import { getLabelForDefaultLanguage } from './column/column-to-record'
|
|
29
|
-
import { generateDeprecatedDiagnostics } from './utils'
|
|
29
|
+
import { createSdkDocEntry, generateDeprecatedDiagnostics } from './utils'
|
|
30
30
|
import isEqual from 'lodash/isEqual'
|
|
31
31
|
|
|
32
32
|
type GlobalRecord<T extends string | number | symbol, U> = globalThis.Record<T, U>
|
|
@@ -321,6 +321,20 @@ type SysDocumentationProperties = {
|
|
|
321
321
|
help: string | undefined
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
type SysDictionaryOverrideProperties = {
|
|
325
|
+
name: string
|
|
326
|
+
element: string
|
|
327
|
+
base_table: string | undefined
|
|
328
|
+
default: string | undefined
|
|
329
|
+
calculation: string | undefined
|
|
330
|
+
reference_qual: string | undefined
|
|
331
|
+
read_only_option: string | undefined
|
|
332
|
+
dependent: string | undefined
|
|
333
|
+
mandatory: boolean | undefined
|
|
334
|
+
display: boolean | undefined
|
|
335
|
+
attributes: string | undefined
|
|
336
|
+
}
|
|
337
|
+
|
|
324
338
|
/**
|
|
325
339
|
* The access levels are mapped to the following values on the platform
|
|
326
340
|
*
|
|
@@ -370,6 +384,7 @@ const licensingAliases = {
|
|
|
370
384
|
|
|
371
385
|
export const TablePlugin = Plugin.create({
|
|
372
386
|
name: 'TablePlugin',
|
|
387
|
+
docs: [createSdkDocEntry('Table', ['sys_db_object'])],
|
|
373
388
|
files: [
|
|
374
389
|
{
|
|
375
390
|
matcher: /\.xml$/,
|
|
@@ -389,7 +404,7 @@ export const TablePlugin = Plugin.create({
|
|
|
389
404
|
return { success: false }
|
|
390
405
|
}
|
|
391
406
|
|
|
392
|
-
const recordDefs = tableDefToRecordProperties(tableDef, config.
|
|
407
|
+
const recordDefs = tableDefToRecordProperties(tableDef, config.defaultLanguage)
|
|
393
408
|
const records: Record[] = []
|
|
394
409
|
for (const [key, table] of [
|
|
395
410
|
['sysDbObject', 'sys_db_object'],
|
|
@@ -397,6 +412,7 @@ export const TablePlugin = Plugin.create({
|
|
|
397
412
|
['sysChoice', 'sys_choice'],
|
|
398
413
|
['sysIndex', 'sys_index'],
|
|
399
414
|
['sysDocumentation', 'sys_documentation'],
|
|
415
|
+
['sysDictionaryOverride', 'sys_dictionary_override'],
|
|
400
416
|
] as const) {
|
|
401
417
|
for (const rec of [recordDefs[key]].flat()) {
|
|
402
418
|
records.push(
|
|
@@ -448,6 +464,10 @@ export const TablePlugin = Plugin.create({
|
|
|
448
464
|
},
|
|
449
465
|
},
|
|
450
466
|
},
|
|
467
|
+
sys_dictionary_override: {
|
|
468
|
+
via: { name: 'name' },
|
|
469
|
+
descendant: true,
|
|
470
|
+
},
|
|
451
471
|
ua_table_licensing_config: {
|
|
452
472
|
descendant: true,
|
|
453
473
|
via: { name: 'name' },
|
|
@@ -473,9 +493,12 @@ export const TablePlugin = Plugin.create({
|
|
|
473
493
|
const schema: { [key: string]: CallExpressionShape } = {}
|
|
474
494
|
let displayColumn: string | undefined
|
|
475
495
|
const columns = descendants.query('sys_dictionary')
|
|
496
|
+
const overrides = descendants.query('sys_dictionary_override')
|
|
476
497
|
let collectionRecord: Record
|
|
477
498
|
const choices = descendants.query('sys_choice')
|
|
478
499
|
const documentation = descendants.query('sys_documentation')
|
|
500
|
+
|
|
501
|
+
// Process regular columns
|
|
479
502
|
for (const column of columns) {
|
|
480
503
|
if (column.get('internal_type').getValue() === 'collection') {
|
|
481
504
|
// 'collection' sys_dictionary record only has table properties
|
|
@@ -488,13 +511,89 @@ export const TablePlugin = Plugin.create({
|
|
|
488
511
|
documentation: documentation.filter(
|
|
489
512
|
(d) => d.get('element').ifString()?.getValue() === columnName
|
|
490
513
|
),
|
|
491
|
-
tableDefaultLanguage: config.
|
|
514
|
+
tableDefaultLanguage: config.defaultLanguage,
|
|
492
515
|
})
|
|
493
516
|
if (column.get('display').ifDefined()?.toBoolean().getValue()) {
|
|
494
517
|
displayColumn = columnName
|
|
495
518
|
}
|
|
496
519
|
}
|
|
497
520
|
|
|
521
|
+
// Process dictionary overrides as OverrideColumn
|
|
522
|
+
for (const override of overrides) {
|
|
523
|
+
const columnName = override.get('element').asString().getValue()
|
|
524
|
+
schema[columnName] = new CallExpressionShape({
|
|
525
|
+
source: override,
|
|
526
|
+
callee: 'OverrideColumn',
|
|
527
|
+
args: [
|
|
528
|
+
override.transform(({ $ }) => ({
|
|
529
|
+
baseTable: $.from('base_table'),
|
|
530
|
+
default: $.from('default_value_override', 'default_value').map((flag, value) => {
|
|
531
|
+
return flag.toBoolean()?.getValue() ? value.ifString()?.getValue() : undefined
|
|
532
|
+
}),
|
|
533
|
+
calculation: $.from('calculation_override', 'calculation').map((flag, value) => {
|
|
534
|
+
return flag.toBoolean()?.getValue() ? value.ifString()?.getValue() : undefined
|
|
535
|
+
}),
|
|
536
|
+
referenceQualifier: $.from('reference_qual_override', 'reference_qual').map(
|
|
537
|
+
(flag, value) => {
|
|
538
|
+
return flag.toBoolean()?.getValue() ? value.ifString()?.getValue() : undefined
|
|
539
|
+
}
|
|
540
|
+
),
|
|
541
|
+
readOnlyOption: $.from('read_only_option_override', 'read_only_option').map(
|
|
542
|
+
(flag, value) => {
|
|
543
|
+
return flag.toBoolean()?.getValue() ? value.ifString()?.getValue() : undefined
|
|
544
|
+
}
|
|
545
|
+
),
|
|
546
|
+
dependent: $.from('dependent_override', 'dependent').map((flag, value) => {
|
|
547
|
+
return flag.toBoolean()?.getValue() ? value.ifString()?.getValue() : undefined
|
|
548
|
+
}),
|
|
549
|
+
mandatory: $.from('mandatory_override', 'mandatory').map((flag, value) => {
|
|
550
|
+
return flag.toBoolean()?.getValue() ? value.toBoolean()?.getValue() : undefined
|
|
551
|
+
}),
|
|
552
|
+
attributes: $.from('attributes_override', 'attributes').map((flag, attrs) => {
|
|
553
|
+
if (!flag.toBoolean()?.getValue() || !attrs.isString()) {
|
|
554
|
+
return undefined
|
|
555
|
+
}
|
|
556
|
+
const result: { [key: string]: string | number | boolean } = {}
|
|
557
|
+
attrs
|
|
558
|
+
.toString()
|
|
559
|
+
.getValue()
|
|
560
|
+
.split(',')
|
|
561
|
+
.forEach((attr) => {
|
|
562
|
+
if (attr === '') {
|
|
563
|
+
return
|
|
564
|
+
}
|
|
565
|
+
const [key, value] = attr.split('=').map((s) => s.trim())
|
|
566
|
+
if (!key || value === undefined) {
|
|
567
|
+
return
|
|
568
|
+
}
|
|
569
|
+
if (value === 'true') {
|
|
570
|
+
result[key] = true
|
|
571
|
+
} else if (value === 'false') {
|
|
572
|
+
result[key] = false
|
|
573
|
+
} else {
|
|
574
|
+
// Try to parse as number
|
|
575
|
+
const numValue = Number(value)
|
|
576
|
+
if (!isNaN(numValue) && value !== '') {
|
|
577
|
+
result[key] = numValue
|
|
578
|
+
} else {
|
|
579
|
+
result[key] = value
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
})
|
|
583
|
+
return result
|
|
584
|
+
}),
|
|
585
|
+
display: $.from('display_override').map((v) => {
|
|
586
|
+
if (!v.ifDefined()) {
|
|
587
|
+
return undefined
|
|
588
|
+
}
|
|
589
|
+
const boolValue = v.toBoolean().getValue()
|
|
590
|
+
return boolValue === true ? true : undefined
|
|
591
|
+
}),
|
|
592
|
+
})),
|
|
593
|
+
],
|
|
594
|
+
})
|
|
595
|
+
}
|
|
596
|
+
|
|
498
597
|
const tableDocumentation = documentation.filter((d) => !d.get('element').getValue())
|
|
499
598
|
const licensing = descendants.query('ua_table_licensing_config')
|
|
500
599
|
const autoNumber = descendants.query('sys_number')
|
|
@@ -628,14 +727,14 @@ export const TablePlugin = Plugin.create({
|
|
|
628
727
|
(label) =>
|
|
629
728
|
label.ifString() ??
|
|
630
729
|
(tableDocumentation.length &&
|
|
631
|
-
!isDefaultDocumentation('', tableDocumentation, config.
|
|
730
|
+
!isDefaultDocumentation('', tableDocumentation, config.defaultLanguage)
|
|
632
731
|
? tableDocumentation.map((doc) =>
|
|
633
732
|
doc
|
|
634
733
|
.transform(({ $ }) => ({
|
|
635
734
|
label: $.def(''),
|
|
636
735
|
help: $.def(''),
|
|
637
736
|
hint: $.def(''),
|
|
638
|
-
language: $.def(config.
|
|
737
|
+
language: $.def(config.defaultLanguage),
|
|
639
738
|
plural: $.def(''),
|
|
640
739
|
url: $.def(''),
|
|
641
740
|
urlTarget: $.from('url_target').def(''),
|
|
@@ -717,8 +816,9 @@ export const TablePlugin = Plugin.create({
|
|
|
717
816
|
const documentation = descendants.query('sys_documentation')
|
|
718
817
|
const licensing = descendants.query('ua_table_licensing_config')
|
|
719
818
|
const autoNumber = descendants.query('sys_number')
|
|
720
|
-
|
|
819
|
+
const overrides = descendants.query('sys_dictionary_override')
|
|
721
820
|
let displayColumn: string | undefined
|
|
821
|
+
let collectionRecord: Record | undefined
|
|
722
822
|
const elements: XMLBuilder[] = []
|
|
723
823
|
for (const column of columns) {
|
|
724
824
|
const displayValue = column.get('display').ifBoolean()?.getValue()
|
|
@@ -888,7 +988,7 @@ export const TablePlugin = Plugin.create({
|
|
|
888
988
|
!isDefaultDocumentation(
|
|
889
989
|
doc.get('element')?.toString().getValue(),
|
|
890
990
|
[doc],
|
|
891
|
-
config.
|
|
991
|
+
config.defaultLanguage
|
|
892
992
|
)
|
|
893
993
|
),
|
|
894
994
|
config,
|
|
@@ -902,6 +1002,7 @@ export const TablePlugin = Plugin.create({
|
|
|
902
1002
|
)
|
|
903
1003
|
|
|
904
1004
|
const autoNumberFiles = await generateRecordXml(autoNumber, config, transform)
|
|
1005
|
+
const overrideFiles = await generateRecordXml(overrides, config, transform)
|
|
905
1006
|
|
|
906
1007
|
return {
|
|
907
1008
|
success: true,
|
|
@@ -915,6 +1016,7 @@ export const TablePlugin = Plugin.create({
|
|
|
915
1016
|
...documentationFiles,
|
|
916
1017
|
...licensingFiles,
|
|
917
1018
|
...autoNumberFiles,
|
|
1019
|
+
...overrideFiles,
|
|
918
1020
|
],
|
|
919
1021
|
}
|
|
920
1022
|
},
|
|
@@ -926,6 +1028,13 @@ export const TablePlugin = Plugin.create({
|
|
|
926
1028
|
value: `sys_dictionary_${record.get('name').getValue()}_${record.get('element').getValue() || 'null'}`,
|
|
927
1029
|
}),
|
|
928
1030
|
},
|
|
1031
|
+
sys_dictionary_override: {
|
|
1032
|
+
coalesce: ['name', 'element'],
|
|
1033
|
+
getUpdateName: (record) => ({
|
|
1034
|
+
success: true,
|
|
1035
|
+
value: `sys_dictionary_override_${record.get('name').getValue()}_${record.get('element').getValue() || 'null'}`,
|
|
1036
|
+
}),
|
|
1037
|
+
},
|
|
929
1038
|
sys_documentation: {
|
|
930
1039
|
coalesce: ['name', 'element', 'language'],
|
|
931
1040
|
getUpdateName: (record) => ({
|
|
@@ -1020,7 +1129,7 @@ export const TablePlugin = Plugin.create({
|
|
|
1020
1129
|
ignoreColumnNameCheck = true
|
|
1021
1130
|
}
|
|
1022
1131
|
|
|
1023
|
-
// sys_dictionary
|
|
1132
|
+
// sys_dictionary and sys_dictionary_override
|
|
1024
1133
|
const schema = table.get('schema').asObject()
|
|
1025
1134
|
const columnIdsMap = new Map<string, string>()
|
|
1026
1135
|
for (const [name, column] of schema.entries()) {
|
|
@@ -1030,37 +1139,116 @@ export const TablePlugin = Plugin.create({
|
|
|
1030
1139
|
'Column name must only contain lowercase letters, numbers, and underscores'
|
|
1031
1140
|
)
|
|
1032
1141
|
}
|
|
1142
|
+
|
|
1143
|
+
// Check if this is an OverrideColumn
|
|
1033
1144
|
if (
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
!isSNScope(scopeName) &&
|
|
1037
|
-
scopeName !== 'global' &&
|
|
1038
|
-
!name.match(scopeRegex)
|
|
1145
|
+
column.is(CallExpressionShape) &&
|
|
1146
|
+
column.as(CallExpressionShape).getCallee() === 'OverrideColumn'
|
|
1039
1147
|
) {
|
|
1040
|
-
//
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1148
|
+
// This is an OverrideColumn() call - get the object from its first argument
|
|
1149
|
+
const columnObj = column.as(CallExpressionShape).getArgument(0).asObject()
|
|
1150
|
+
|
|
1151
|
+
// Handle OverrideColumn - create sys_dictionary_override record
|
|
1152
|
+
// Validate that the table extends another table
|
|
1153
|
+
const extendsTable = table.get('extends').ifString()?.getValue()
|
|
1154
|
+
if (!extendsTable) {
|
|
1155
|
+
diagnostics.error(
|
|
1156
|
+
column,
|
|
1157
|
+
`Cannot use OverrideColumn in table '${tableName.getValue()}' because it does not extend another table`
|
|
1158
|
+
)
|
|
1159
|
+
return { success: false }
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// Use baseTable if provided, otherwise default to extends
|
|
1163
|
+
const baseTableValue = columnObj.get('baseTable')
|
|
1164
|
+
let baseTable: string
|
|
1165
|
+
|
|
1166
|
+
if (baseTableValue.ifString()) {
|
|
1167
|
+
baseTable = baseTableValue.asString().getValue()
|
|
1168
|
+
} else {
|
|
1169
|
+
// Default to extends if baseTable not provided
|
|
1170
|
+
baseTable = extendsTable
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// Create sys_dictionary_override record
|
|
1174
|
+
const overrideRecord = await factory.createRecord({
|
|
1175
|
+
source: statement ?? callExpression,
|
|
1176
|
+
table: 'sys_dictionary_override',
|
|
1177
|
+
properties: columnObj.transform(({ $ }) => ({
|
|
1178
|
+
name: $.val(tableName),
|
|
1179
|
+
element: $.val(name),
|
|
1180
|
+
base_table: $.val(baseTable),
|
|
1181
|
+
default_value: $.from('default'),
|
|
1182
|
+
default_value_override: $.from('default').map((v) => !!v.ifDefined()),
|
|
1183
|
+
calculation: $.from('calculation'),
|
|
1184
|
+
calculation_override: $.from('calculation').map((v) => !!v.ifDefined()),
|
|
1185
|
+
reference_qual: $.from('referenceQualifier'),
|
|
1186
|
+
reference_qual_override: $.from('referenceQualifier').map((v) => !!v.ifDefined()),
|
|
1187
|
+
read_only_option: $.from('readOnlyOption'),
|
|
1188
|
+
read_only_option_override: $.from('readOnlyOption').map((v) => !!v.ifDefined()),
|
|
1189
|
+
read_only: $.from('readOnlyOption').map((readOnlyOption) => {
|
|
1190
|
+
// read_only should be true if readOnlyOption has a value
|
|
1191
|
+
return !!readOnlyOption.ifDefined()
|
|
1192
|
+
}),
|
|
1193
|
+
read_only_override: $.from('readOnlyOption').map((v) => !!v.ifDefined()),
|
|
1194
|
+
dependent: $.from('dependent'),
|
|
1195
|
+
dependent_override: $.from('dependent').map((v) => !!v.ifDefined()),
|
|
1196
|
+
mandatory: $.from('mandatory').toBoolean().def(false),
|
|
1197
|
+
mandatory_override: $.from('mandatory').map((v) => !!v.ifDefined()),
|
|
1198
|
+
attributes: $.from('attributes').map((attrs) => {
|
|
1199
|
+
if (!attrs.isObject()) {
|
|
1200
|
+
return
|
|
1201
|
+
}
|
|
1202
|
+
const attrsObj = attrs.asObject().getValue()
|
|
1203
|
+
return Object.entries(attrsObj)
|
|
1204
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
1205
|
+
.join(',')
|
|
1206
|
+
}),
|
|
1207
|
+
attributes_override: $.from('attributes').map((v) => !!v.ifDefined()),
|
|
1208
|
+
display_override: $.from('display').map((v) => {
|
|
1209
|
+
const boolShape = v.ifBoolean()
|
|
1210
|
+
if (!boolShape) {
|
|
1211
|
+
return false
|
|
1212
|
+
}
|
|
1213
|
+
return boolShape.getValue() === true
|
|
1214
|
+
}),
|
|
1215
|
+
})),
|
|
1216
|
+
})
|
|
1217
|
+
relatedRecords.push(overrideRecord)
|
|
1218
|
+
} else {
|
|
1219
|
+
// Handle regular column - create sys_dictionary record
|
|
1220
|
+
if (
|
|
1221
|
+
!ignoreColumnNameCheck &&
|
|
1222
|
+
!tableNameMatch &&
|
|
1223
|
+
!isSNScope(scopeName) &&
|
|
1224
|
+
scopeName !== 'global' &&
|
|
1225
|
+
!name.match(scopeRegex)
|
|
1226
|
+
) {
|
|
1227
|
+
// 'sn' and 'now' scoped apps ignore this validation
|
|
1228
|
+
diagnostics.error(
|
|
1229
|
+
column.getOriginalNode().getParentIfKind(ts.SyntaxKind.PropertyAssignment) ?? column,
|
|
1230
|
+
`Column name should be prefixed with scope '${scopeName}_' if table name does not contain prefix`
|
|
1231
|
+
)
|
|
1232
|
+
} else if (scopeName === 'global' && !globalTableNameMatch && !name.match(globalRegex)) {
|
|
1233
|
+
diagnostics.error(
|
|
1234
|
+
column.getOriginalNode().getParentIfKind(ts.SyntaxKind.PropertyAssignment) ?? column,
|
|
1235
|
+
`Column name should be prefixed with 'u_' custom prefix if table name does not contain this prefix, such as when adding columns to an existing global table`
|
|
1236
|
+
)
|
|
1237
|
+
}
|
|
1238
|
+
const display = table.get('display').ifString()?.getValue() === name
|
|
1239
|
+
const result = await transform.toRecord(
|
|
1240
|
+
addFieldsToColumn(
|
|
1241
|
+
{ name, table: tableName.getValue(), display },
|
|
1242
|
+
column.as(CallExpressionShape)
|
|
1243
|
+
)
|
|
1056
1244
|
)
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1245
|
+
if (!result.success) {
|
|
1246
|
+
diagnostics.error(column, 'Invalid column in table schema')
|
|
1247
|
+
return { success: false }
|
|
1248
|
+
}
|
|
1249
|
+
relatedRecords.push(result.value)
|
|
1250
|
+
columnIdsMap.set(name, result.value.getId().getValue())
|
|
1061
1251
|
}
|
|
1062
|
-
relatedRecords.push(result.value)
|
|
1063
|
-
columnIdsMap.set(name, result.value.getId().getValue())
|
|
1064
1252
|
}
|
|
1065
1253
|
|
|
1066
1254
|
// sys_index
|
|
@@ -1192,7 +1380,7 @@ export const TablePlugin = Plugin.create({
|
|
|
1192
1380
|
properties: {
|
|
1193
1381
|
name: tableName,
|
|
1194
1382
|
element: undefined,
|
|
1195
|
-
language: config.
|
|
1383
|
+
language: config.defaultLanguage,
|
|
1196
1384
|
label: table.get('label').ifString() ?? tableName,
|
|
1197
1385
|
plural: generatePlural(
|
|
1198
1386
|
table.get('label')?.ifString()?.getValue() ?? tableName.getValue()
|
|
@@ -1291,7 +1479,7 @@ export const TablePlugin = Plugin.create({
|
|
|
1291
1479
|
.map((actions) => hasAction('create', actions))
|
|
1292
1480
|
.def(false),
|
|
1293
1481
|
is_extendable: $.from('extensible').toBoolean().def(false),
|
|
1294
|
-
label: $.map((label) => getLabelForDefaultLanguage(label, config.
|
|
1482
|
+
label: $.map((label) => getLabelForDefaultLanguage(label, config.defaultLanguage)),
|
|
1295
1483
|
live_feed_enabled: $.from('liveFeed').toBoolean().def(false),
|
|
1296
1484
|
name: $,
|
|
1297
1485
|
scriptable_table: $.from('scriptableTable').toBoolean().def(false),
|
|
@@ -1468,6 +1656,7 @@ function tableDefToRecordProperties(
|
|
|
1468
1656
|
sysChoice: SysChoiceProperties[]
|
|
1469
1657
|
sysIndex: SysIndexProperties[]
|
|
1470
1658
|
sysDocumentation: SysDocumentationProperties[]
|
|
1659
|
+
sysDictionaryOverride: SysDictionaryOverrideProperties[]
|
|
1471
1660
|
} {
|
|
1472
1661
|
const sysDbObject: SysDbObjectProperties = {
|
|
1473
1662
|
name: tableDef.name,
|
|
@@ -1489,6 +1678,7 @@ function tableDefToRecordProperties(
|
|
|
1489
1678
|
const sysDictionary: SysDictionaryProperties[] = []
|
|
1490
1679
|
const sysChoice: SysChoiceProperties[] = []
|
|
1491
1680
|
const sysDocumentation: SysDocumentationProperties[] = []
|
|
1681
|
+
const sysDictionaryOverride: SysDictionaryOverrideProperties[] = []
|
|
1492
1682
|
|
|
1493
1683
|
// table documentation
|
|
1494
1684
|
if (tableDef.label && tableDef.plural) {
|
|
@@ -1646,6 +1836,7 @@ function tableDefToRecordProperties(
|
|
|
1646
1836
|
sysChoice,
|
|
1647
1837
|
sysIndex,
|
|
1648
1838
|
sysDocumentation,
|
|
1839
|
+
sysDictionaryOverride,
|
|
1649
1840
|
}
|
|
1650
1841
|
}
|
|
1651
1842
|
|
package/src/ui-action-plugin.ts
CHANGED
|
@@ -8,9 +8,11 @@ import {
|
|
|
8
8
|
} from '@servicenow/sdk-build-core'
|
|
9
9
|
import { NowIdShape } from './now-id-plugin'
|
|
10
10
|
import { ModuleFunctionShape } from './server-module-plugin'
|
|
11
|
+
import { createSdkDocEntry } from './utils'
|
|
11
12
|
|
|
12
13
|
export const UiActionPlugin = Plugin.create({
|
|
13
14
|
name: 'UiActionPlugin',
|
|
15
|
+
docs: [createSdkDocEntry('UiAction', ['sys_ui_action'])],
|
|
14
16
|
records: {
|
|
15
17
|
sys_ui_action: {
|
|
16
18
|
relationships: {
|
|
@@ -245,13 +247,6 @@ export const UiActionPlugin = Plugin.create({
|
|
|
245
247
|
),
|
|
246
248
|
})),
|
|
247
249
|
})
|
|
248
|
-
const roles = arg.get('roles').ifArray()?.getElements() ?? []
|
|
249
|
-
if (!arg.get('condition').toString().getValue().trim() && roles.length === 0) {
|
|
250
|
-
diagnostics.warn(
|
|
251
|
-
arg.get('roles').ifDefined() ?? arg.get('condition').ifDefined() ?? arg,
|
|
252
|
-
'UI Actions with an empty condition and no roles defined can be called by any logged-in users. Please restrict UI actions. The condition field should be specified to restrict execution of this UI Action to certain users. For example, current.canWrite() condition restricts the UI Action to the users who can modify the current record, gs.hasRole("admin") condition restricts the UI Action to the users with admin role.'
|
|
253
|
-
)
|
|
254
|
-
}
|
|
255
250
|
|
|
256
251
|
if (arg.get('script').is(ModuleFunctionShape) && isClient.ifBoolean()?.getValue()) {
|
|
257
252
|
diagnostics.error(isClient, 'Module scripts (sys_module) cannot be used on client-side UI Actions')
|
|
@@ -307,7 +302,7 @@ export const UiActionPlugin = Plugin.create({
|
|
|
307
302
|
})
|
|
308
303
|
)
|
|
309
304
|
}
|
|
310
|
-
|
|
305
|
+
const roles = arg.get('roles').ifArray()?.getElements() ?? []
|
|
311
306
|
const roleRecords: Record[] = []
|
|
312
307
|
for (const role of roles) {
|
|
313
308
|
const roleReference = role.isString()
|