@servicenow/sdk-build-plugins 4.6.1 → 4.7.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 +0 -3
- package/dist/acl-plugin.js.map +1 -1
- package/dist/applicability-plugin.js +0 -2
- package/dist/applicability-plugin.js.map +1 -1
- package/dist/application-menu-plugin.js +0 -2
- package/dist/application-menu-plugin.js.map +1 -1
- package/dist/arrow-function-plugin.js +0 -1
- package/dist/arrow-function-plugin.js.map +1 -1
- package/dist/atf/test-plugin.js +0 -2
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +0 -1
- package/dist/basic-syntax-plugin.js.map +1 -1
- package/dist/business-rule-plugin.js +0 -1
- package/dist/business-rule-plugin.js.map +1 -1
- package/dist/call-expression-plugin.js +0 -1
- package/dist/call-expression-plugin.js.map +1 -1
- package/dist/claims-plugin.js +0 -1
- package/dist/claims-plugin.js.map +1 -1
- package/dist/client-script-plugin.js +0 -1
- package/dist/client-script-plugin.js.map +1 -1
- package/dist/column-plugin.js +24 -7
- package/dist/column-plugin.js.map +1 -1
- package/dist/cross-scope-privilege-plugin.js +0 -1
- package/dist/cross-scope-privilege-plugin.js.map +1 -1
- package/dist/dashboard/dashboard-plugin.js +0 -2
- package/dist/dashboard/dashboard-plugin.js.map +1 -1
- package/dist/data-plugin.js +0 -1
- package/dist/data-plugin.js.map +1 -1
- package/dist/data-policy-plugin.d.ts +2 -0
- package/dist/data-policy-plugin.js +276 -0
- package/dist/data-policy-plugin.js.map +1 -0
- package/dist/email-notification-plugin.js +2 -3
- package/dist/email-notification-plugin.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-constants.d.ts +2 -0
- package/dist/flow/flow-logic/flow-logic-constants.js +6 -1
- package/dist/flow/flow-logic/flow-logic-constants.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-diagnostics.js +192 -56
- package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +2 -1
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +44 -5
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin.js +279 -29
- package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-shapes.d.ts +15 -0
- package/dist/flow/flow-logic/flow-logic-shapes.js +25 -1
- package/dist/flow/flow-logic/flow-logic-shapes.js.map +1 -1
- package/dist/flow/plugins/approval-rules-plugin.js +0 -1
- package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-action-definition-plugin.js +804 -205
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-data-pill-plugin.js +3 -5
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-definition-plugin.js +84 -17
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-diagnostics-plugin.js +65 -3
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-instance-plugin.js +13 -5
- package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-trigger-instance-plugin.js +0 -1
- package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/inline-script-plugin.js +0 -1
- package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
- package/dist/flow/plugins/step-definition-plugin.js +0 -2
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/step-instance-plugin.js +216 -77
- package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/trigger-plugin.js +0 -2
- package/dist/flow/plugins/trigger-plugin.js.map +1 -1
- package/dist/flow/plugins/wfa-datapill-plugin.js +0 -1
- package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
- package/dist/flow/utils/datapill-transformer.js +9 -5
- package/dist/flow/utils/datapill-transformer.js.map +1 -1
- package/dist/flow/utils/flow-constants.d.ts +12 -0
- package/dist/flow/utils/flow-constants.js +17 -3
- 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 +21 -13
- package/dist/flow/utils/flow-io-to-record.js.map +1 -1
- package/dist/flow/utils/flow-pill-utils.d.ts +26 -0
- package/dist/flow/utils/flow-pill-utils.js +50 -0
- package/dist/flow/utils/flow-pill-utils.js.map +1 -0
- package/dist/flow/utils/flow-stage-processor.d.ts +138 -0
- package/dist/flow/utils/flow-stage-processor.js +665 -0
- package/dist/flow/utils/flow-stage-processor.js.map +1 -0
- package/dist/flow/utils/pill-string-parser.js +28 -43
- package/dist/flow/utils/pill-string-parser.js.map +1 -1
- package/dist/flow/utils/utils.d.ts +11 -6
- package/dist/flow/utils/utils.js +37 -28
- package/dist/flow/utils/utils.js.map +1 -1
- package/dist/form-plugin.js +4 -14
- package/dist/form-plugin.js.map +1 -1
- package/dist/html-import-plugin.js +0 -1
- package/dist/html-import-plugin.js.map +1 -1
- package/dist/import-sets-plugin.js +0 -2
- package/dist/import-sets-plugin.js.map +1 -1
- package/dist/inbound-email-action-plugin.js +0 -1
- package/dist/inbound-email-action-plugin.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-scan-plugin.js +0 -7
- package/dist/instance-scan-plugin.js.map +1 -1
- package/dist/json-plugin.js +0 -1
- package/dist/json-plugin.js.map +1 -1
- package/dist/list-plugin.js +4 -1
- package/dist/list-plugin.js.map +1 -1
- package/dist/now-attach-plugin.js +0 -1
- package/dist/now-attach-plugin.js.map +1 -1
- package/dist/now-config-plugin.js +0 -1
- package/dist/now-config-plugin.js.map +1 -1
- package/dist/now-id-plugin.js +0 -1
- package/dist/now-id-plugin.js.map +1 -1
- package/dist/now-include-plugin.js +0 -1
- package/dist/now-include-plugin.js.map +1 -1
- package/dist/now-ref-plugin.js +0 -1
- package/dist/now-ref-plugin.js.map +1 -1
- package/dist/now-unresolved-plugin.js +0 -1
- package/dist/now-unresolved-plugin.js.map +1 -1
- package/dist/package-json-plugin.js +3 -2
- package/dist/package-json-plugin.js.map +1 -1
- package/dist/property-plugin.js +0 -2
- package/dist/property-plugin.js.map +1 -1
- package/dist/record-plugin.d.ts +2 -0
- package/dist/record-plugin.js +2 -2
- package/dist/record-plugin.js.map +1 -1
- package/dist/repack/lint/Rules.d.ts +1 -2
- package/dist/rest-api-plugin.js +6 -5
- package/dist/rest-api-plugin.js.map +1 -1
- package/dist/role-plugin.js +0 -1
- package/dist/role-plugin.js.map +1 -1
- package/dist/schedule-script/scheduled-script-plugin.js +5 -4
- package/dist/schedule-script/scheduled-script-plugin.js.map +1 -1
- package/dist/script-action-plugin.js +0 -2
- package/dist/script-action-plugin.js.map +1 -1
- package/dist/script-include-plugin.js +0 -4
- package/dist/script-include-plugin.js.map +1 -1
- package/dist/server-module-plugin/index.js +2 -3
- package/dist/server-module-plugin/index.js.map +1 -1
- package/dist/service-catalog/catalog-clientscript-plugin.js +0 -2
- package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-item-plugin.js +0 -2
- package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-ui-policy-plugin.js +0 -2
- package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
- package/dist/service-catalog/sc-record-producer-plugin.js +0 -2
- package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
- package/dist/service-catalog/variable-set-plugin.js +0 -2
- package/dist/service-catalog/variable-set-plugin.js.map +1 -1
- package/dist/service-portal/angular-provider-plugin.js +0 -2
- package/dist/service-portal/angular-provider-plugin.js.map +1 -1
- package/dist/service-portal/dependency-plugin.js +3 -5
- package/dist/service-portal/dependency-plugin.js.map +1 -1
- package/dist/service-portal/header-footer-plugin.js +3 -5
- package/dist/service-portal/header-footer-plugin.js.map +1 -1
- package/dist/service-portal/menu-plugin.js +0 -1
- package/dist/service-portal/menu-plugin.js.map +1 -1
- package/dist/service-portal/page-plugin.js +0 -1
- package/dist/service-portal/page-plugin.js.map +1 -1
- package/dist/service-portal/page-route-map-plugin.js +0 -1
- package/dist/service-portal/page-route-map-plugin.js.map +1 -1
- package/dist/service-portal/portal-plugin.js +0 -2
- package/dist/service-portal/portal-plugin.js.map +1 -1
- package/dist/service-portal/theme-plugin.js +0 -2
- package/dist/service-portal/theme-plugin.js.map +1 -1
- package/dist/service-portal/widget-plugin.js +3 -5
- package/dist/service-portal/widget-plugin.js.map +1 -1
- package/dist/sla-plugin.js +0 -2
- package/dist/sla-plugin.js.map +1 -1
- package/dist/static-content-plugin.js +32 -3
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +102 -11
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-action-plugin.js +26 -17
- package/dist/ui-action-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +159 -17
- package/dist/ui-page-plugin.js.map +1 -1
- package/dist/ui-policy-plugin.js +0 -1
- package/dist/ui-policy-plugin.js.map +1 -1
- package/dist/user-preference-plugin.js +0 -2
- package/dist/user-preference-plugin.js.map +1 -1
- package/dist/utils.d.ts +1 -9
- package/dist/utils.js +0 -14
- package/dist/utils.js.map +1 -1
- package/dist/ux-list-menu-config-plugin.js +0 -2
- package/dist/ux-list-menu-config-plugin.js.map +1 -1
- package/dist/view-plugin.js +0 -1
- package/dist/view-plugin.js.map +1 -1
- package/dist/workspace-plugin.js +0 -2
- package/dist/workspace-plugin.js.map +1 -1
- package/package.json +6 -6
- package/src/acl-plugin.ts +1 -4
- package/src/applicability-plugin.ts +0 -2
- package/src/application-menu-plugin.ts +0 -2
- package/src/arrow-function-plugin.ts +0 -1
- package/src/atf/test-plugin.ts +0 -2
- package/src/basic-syntax-plugin.ts +0 -1
- package/src/business-rule-plugin.ts +1 -2
- package/src/call-expression-plugin.ts +0 -1
- package/src/claims-plugin.ts +0 -1
- package/src/client-script-plugin.ts +1 -2
- package/src/column-plugin.ts +29 -9
- package/src/cross-scope-privilege-plugin.ts +1 -2
- package/src/dashboard/dashboard-plugin.ts +0 -2
- package/src/data-plugin.ts +0 -1
- package/src/data-policy-plugin.ts +333 -0
- package/src/email-notification-plugin.ts +8 -4
- package/src/flow/flow-logic/flow-logic-constants.ts +6 -0
- package/src/flow/flow-logic/flow-logic-diagnostics.ts +236 -58
- package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +59 -6
- package/src/flow/flow-logic/flow-logic-plugin.ts +368 -38
- package/src/flow/flow-logic/flow-logic-shapes.ts +25 -0
- package/src/flow/plugins/approval-rules-plugin.ts +0 -1
- package/src/flow/plugins/flow-action-definition-plugin.ts +940 -208
- package/src/flow/plugins/flow-data-pill-plugin.ts +3 -5
- package/src/flow/plugins/flow-definition-plugin.ts +159 -26
- package/src/flow/plugins/flow-diagnostics-plugin.ts +89 -3
- package/src/flow/plugins/flow-instance-plugin.ts +26 -12
- package/src/flow/plugins/flow-trigger-instance-plugin.ts +0 -1
- package/src/flow/plugins/inline-script-plugin.ts +0 -1
- package/src/flow/plugins/step-definition-plugin.ts +0 -2
- package/src/flow/plugins/step-instance-plugin.ts +259 -65
- package/src/flow/plugins/trigger-plugin.ts +0 -2
- package/src/flow/plugins/wfa-datapill-plugin.ts +0 -1
- package/src/flow/utils/datapill-transformer.ts +13 -5
- package/src/flow/utils/flow-constants.ts +19 -1
- package/src/flow/utils/flow-io-to-record.ts +29 -19
- package/src/flow/utils/flow-pill-utils.ts +48 -0
- package/src/flow/utils/flow-stage-processor.ts +831 -0
- package/src/flow/utils/pill-string-parser.ts +29 -47
- package/src/flow/utils/utils.ts +39 -35
- package/src/form-plugin.ts +5 -15
- package/src/html-import-plugin.ts +0 -1
- package/src/import-sets-plugin.ts +0 -2
- package/src/inbound-email-action-plugin.ts +1 -2
- package/src/index.ts +7 -1
- package/src/instance-scan-plugin.ts +0 -7
- package/src/json-plugin.ts +0 -1
- package/src/list-plugin.ts +6 -2
- package/src/now-attach-plugin.ts +0 -1
- package/src/now-config-plugin.ts +0 -1
- package/src/now-id-plugin.ts +0 -1
- package/src/now-include-plugin.ts +0 -1
- package/src/now-ref-plugin.ts +0 -1
- package/src/now-unresolved-plugin.ts +0 -1
- package/src/package-json-plugin.ts +8 -3
- package/src/property-plugin.ts +0 -2
- package/src/record-plugin.ts +3 -3
- package/src/repack/lint/Rules.ts +1 -1
- package/src/rest-api-plugin.ts +7 -6
- package/src/role-plugin.ts +1 -2
- package/src/schedule-script/scheduled-script-plugin.ts +11 -5
- package/src/script-action-plugin.ts +0 -2
- package/src/script-include-plugin.ts +0 -4
- package/src/server-module-plugin/index.ts +2 -3
- package/src/service-catalog/catalog-clientscript-plugin.ts +0 -2
- package/src/service-catalog/catalog-item-plugin.ts +0 -2
- package/src/service-catalog/catalog-ui-policy-plugin.ts +0 -2
- package/src/service-catalog/sc-record-producer-plugin.ts +0 -2
- package/src/service-catalog/variable-set-plugin.ts +0 -2
- package/src/service-portal/angular-provider-plugin.ts +0 -2
- package/src/service-portal/dependency-plugin.ts +0 -2
- package/src/service-portal/header-footer-plugin.ts +0 -2
- package/src/service-portal/menu-plugin.ts +1 -2
- package/src/service-portal/page-plugin.ts +1 -2
- package/src/service-portal/page-route-map-plugin.ts +1 -2
- package/src/service-portal/portal-plugin.ts +0 -2
- package/src/service-portal/theme-plugin.ts +0 -2
- package/src/service-portal/widget-plugin.ts +0 -2
- package/src/sla-plugin.ts +0 -2
- package/src/static-content-plugin.ts +37 -4
- package/src/table-plugin.ts +118 -16
- package/src/ui-action-plugin.ts +30 -17
- package/src/ui-page-plugin.ts +188 -20
- package/src/ui-policy-plugin.ts +1 -2
- package/src/user-preference-plugin.ts +0 -2
- package/src/utils.ts +0 -15
- package/src/ux-list-menu-config-plugin.ts +0 -2
- package/src/view-plugin.ts +0 -1
- package/src/workspace-plugin.ts +0 -2
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 {
|
|
29
|
+
import { generateDeprecatedDiagnostics, generateChoiceSetFile } 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>
|
|
@@ -229,6 +229,8 @@ type TableDefinition = {
|
|
|
229
229
|
actionsAccess: boolean | undefined
|
|
230
230
|
readAccess: boolean | undefined
|
|
231
231
|
isExtendable: boolean | undefined
|
|
232
|
+
createAccessControls: boolean | undefined
|
|
233
|
+
userRole: string | undefined
|
|
232
234
|
scriptableTable: boolean | undefined
|
|
233
235
|
attributes: string | undefined
|
|
234
236
|
display: string | undefined
|
|
@@ -240,6 +242,8 @@ type SysDbObjectProperties = {
|
|
|
240
242
|
label: string | undefined
|
|
241
243
|
super_class: string | undefined
|
|
242
244
|
is_extendable: boolean | undefined
|
|
245
|
+
create_access_controls: boolean | undefined
|
|
246
|
+
user_role: string | undefined
|
|
243
247
|
scriptable_table: boolean | undefined
|
|
244
248
|
client_scripts_access: boolean | undefined
|
|
245
249
|
ws_access: boolean | undefined
|
|
@@ -396,7 +400,6 @@ const licensingAliases = {
|
|
|
396
400
|
|
|
397
401
|
export const TablePlugin = Plugin.create({
|
|
398
402
|
name: 'TablePlugin',
|
|
399
|
-
docs: [createSdkDocEntry('Table', ['sys_db_object'])],
|
|
400
403
|
files: [
|
|
401
404
|
{
|
|
402
405
|
matcher: /\.xml$/,
|
|
@@ -505,7 +508,7 @@ export const TablePlugin = Plugin.create({
|
|
|
505
508
|
via: 'super_class',
|
|
506
509
|
},
|
|
507
510
|
},
|
|
508
|
-
toShape(record, { descendants, config }) {
|
|
511
|
+
toShape(record, { descendants, config, compiler }) {
|
|
509
512
|
const schema: { [key: string]: CallExpressionShape } = {}
|
|
510
513
|
let displayColumn: string | undefined
|
|
511
514
|
const columns = descendants.query('sys_dictionary')
|
|
@@ -652,6 +655,7 @@ export const TablePlugin = Plugin.create({
|
|
|
652
655
|
})),
|
|
653
656
|
],
|
|
654
657
|
})
|
|
658
|
+
registerBootstrappedTable(augmentsExpression, schema, compiler)
|
|
655
659
|
return {
|
|
656
660
|
success: true,
|
|
657
661
|
value: writeAsCallExpression
|
|
@@ -758,18 +762,24 @@ export const TablePlugin = Plugin.create({
|
|
|
758
762
|
),
|
|
759
763
|
callerAccess: $.from('caller_access')
|
|
760
764
|
.map((callerAccess) => {
|
|
765
|
+
// An empty <caller_access/> element arrives as '', not 0 — guard before
|
|
766
|
+
// '' and 0 both mean "none" on the platform — omit from generated Fluent.
|
|
767
|
+
if (callerAccess.isString() && callerAccess.getValue() === '') {
|
|
768
|
+
return ''
|
|
769
|
+
}
|
|
761
770
|
if (callerAccess.isNumber()) {
|
|
762
|
-
|
|
771
|
+
const value = callerAccess.getValue()
|
|
772
|
+
return value === 0 ? '' : callerAccessLevels[value]
|
|
763
773
|
}
|
|
764
774
|
if (callerAccess.isString()) {
|
|
765
|
-
const
|
|
766
|
-
if (!isNaN(
|
|
767
|
-
return callerAccessLevels[
|
|
775
|
+
const parsed = Number(callerAccess.getValue())
|
|
776
|
+
if (!isNaN(parsed)) {
|
|
777
|
+
return parsed === 0 ? '' : callerAccessLevels[parsed]
|
|
768
778
|
}
|
|
769
779
|
}
|
|
770
|
-
return '
|
|
780
|
+
return ''
|
|
771
781
|
})
|
|
772
|
-
.def('
|
|
782
|
+
.def(''),
|
|
773
783
|
display: displayColumn ? $.val(displayColumn) : undefined,
|
|
774
784
|
extends: $.from('super_class').def(''),
|
|
775
785
|
extensible: $.from('is_extendable').toBoolean().def(false),
|
|
@@ -847,12 +857,24 @@ export const TablePlugin = Plugin.create({
|
|
|
847
857
|
name: $,
|
|
848
858
|
readOnly: $.val(collectionRecord?.get('read_only')).toBoolean().def(false),
|
|
849
859
|
schema: $.val(schema),
|
|
860
|
+
// create_access_controls and user_role only ever arrive here from the
|
|
861
|
+
// sys_db_object record. The platform's bootstrap XML pipeline does not
|
|
862
|
+
// touch either field (no references in /glide/db/bootstrap/xml/ or
|
|
863
|
+
// TableDescriptorProvider.createTableLevelMetaData), and the SDK's own
|
|
864
|
+
// bootstrap output is always paired with sys_db_object_<id>.xml that
|
|
865
|
+
// carries the record values. So the bootstrap-only string path through
|
|
866
|
+
// tableDefToRecordProperties is unreachable for these two fields.
|
|
867
|
+
createAccessControls: $.from('create_access_controls').toBoolean().def(false),
|
|
868
|
+
userRole: $.from('user_role')
|
|
869
|
+
.map((v) => v.ifRecordId()?.getPrimaryKey())
|
|
870
|
+
.def(''),
|
|
850
871
|
scriptableTable: $.from('scriptable_table').toBoolean().def(false),
|
|
851
872
|
textIndex: $.val(collectionRecord?.get('text_index')).toBoolean().def(false),
|
|
852
873
|
}))
|
|
853
874
|
.withAliasedKeys(tableAliases),
|
|
854
875
|
],
|
|
855
876
|
})
|
|
877
|
+
registerBootstrappedTable(callExpression, schema, compiler)
|
|
856
878
|
return {
|
|
857
879
|
success: true,
|
|
858
880
|
value: writeAsCallExpression
|
|
@@ -990,7 +1012,10 @@ export const TablePlugin = Plugin.create({
|
|
|
990
1012
|
['read_only_option', column.get('read_only_option').ifString()?.getValue()],
|
|
991
1013
|
['reference_cascade_rule', column.get('reference_cascade_rule').ifString()?.getValue()],
|
|
992
1014
|
['calculation', column.get('calculation').ifString()?.getValue()],
|
|
993
|
-
|
|
1015
|
+
// Bootstrap convention: emit `choice="0"` for the platform default ("none").
|
|
1016
|
+
// The component (install) path uses an empty `<choice/>` element instead, but
|
|
1017
|
+
// bootstrap files conventionally include the literal "0" attribute.
|
|
1018
|
+
['choice', (column.get('choice').ifNumber()?.getValue() ?? 0).toString()],
|
|
994
1019
|
['choice_table', column.get('choice_table').ifString()?.getValue()],
|
|
995
1020
|
['choice_field', column.get('choice_field').ifString()?.getValue()],
|
|
996
1021
|
['display', displayValue?.toString()],
|
|
@@ -1106,7 +1131,9 @@ export const TablePlugin = Plugin.create({
|
|
|
1106
1131
|
['audit', collectionRecord?.get('audit').ifBoolean()?.getValue().toString()],
|
|
1107
1132
|
['display', displayColumn],
|
|
1108
1133
|
['access', record.get('access').ifString()?.getValue()],
|
|
1109
|
-
|
|
1134
|
+
// Bootstrap convention: emit `caller_access="0"` for the platform default ("none").
|
|
1135
|
+
// The component (install) path uses an empty `<caller_access/>` element instead.
|
|
1136
|
+
['caller_access', (record.get('caller_access').ifNumber()?.getValue() ?? 0).toString()],
|
|
1110
1137
|
['ws_access', record.get('ws_access').ifBoolean()?.getValue().toString()],
|
|
1111
1138
|
['read_access', record.get('read_access').ifBoolean()?.getValue().toString()],
|
|
1112
1139
|
['alter_access', record.get('alter_access').ifBoolean()?.getValue().toString()],
|
|
@@ -1115,6 +1142,8 @@ export const TablePlugin = Plugin.create({
|
|
|
1115
1142
|
['delete_access', record.get('delete_access').ifBoolean()?.getValue().toString()],
|
|
1116
1143
|
['actions_access', record.get('actions_access').ifBoolean()?.getValue().toString()],
|
|
1117
1144
|
['client_scripts_access', record.get('client_scripts_access').ifBoolean()?.getValue().toString()],
|
|
1145
|
+
// create_access_controls and user_role are omitted: the platform's bootstrap
|
|
1146
|
+
// pipeline doesn't read them. They're carried by the paired sys_db_object_<id>.xml.
|
|
1118
1147
|
['scriptable_table', record.get('scriptable_table').ifBoolean()?.getValue().toString()],
|
|
1119
1148
|
['attributes', collectionRecord?.get('attributes').ifString()?.getValue()],
|
|
1120
1149
|
]
|
|
@@ -1600,6 +1629,17 @@ export const TablePlugin = Plugin.create({
|
|
|
1600
1629
|
})
|
|
1601
1630
|
: ext.ifDefined()?.toRecordId()
|
|
1602
1631
|
|
|
1632
|
+
const userRoleField = table.get('userRole')
|
|
1633
|
+
const userRoleReference = userRoleField.isString()
|
|
1634
|
+
? userRoleField.getValue() === ''
|
|
1635
|
+
? undefined
|
|
1636
|
+
: await factory.createReference({
|
|
1637
|
+
source: userRoleField,
|
|
1638
|
+
table: 'sys_user_role',
|
|
1639
|
+
keys: { name: userRoleField },
|
|
1640
|
+
})
|
|
1641
|
+
: userRoleField.ifDefined()?.toRecordId()
|
|
1642
|
+
|
|
1603
1643
|
// sys_db_object
|
|
1604
1644
|
const tableRecord = await factory.createRecord({
|
|
1605
1645
|
source: statement ?? callExpression,
|
|
@@ -1611,11 +1651,15 @@ export const TablePlugin = Plugin.create({
|
|
|
1611
1651
|
ws_access: $.from('allowWebServiceAccess').toBoolean().def(false),
|
|
1612
1652
|
number_ref: $.val(numberRef),
|
|
1613
1653
|
access: $.from('accessibleFrom').def('public'),
|
|
1614
|
-
caller_access: $.from('callerAccess').map((callerAccess) =>
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1654
|
+
caller_access: $.from('callerAccess').map((callerAccess) => {
|
|
1655
|
+
const value = callerAccess.ifString()?.getValue()
|
|
1656
|
+
if (!value) {
|
|
1657
|
+
return undefined
|
|
1658
|
+
}
|
|
1659
|
+
const index = callerAccessLevels.indexOf(value as 'none' | 'tracking' | 'restricted')
|
|
1660
|
+
// index 0 ('none') is the platform default — emit empty <caller_access/>, matching stock.
|
|
1661
|
+
return index > 0 ? index : undefined
|
|
1662
|
+
}),
|
|
1619
1663
|
super_class: $.val(parentReference),
|
|
1620
1664
|
read_access: $.from('actions')
|
|
1621
1665
|
.map((actions) => hasAction('read', actions))
|
|
@@ -1635,6 +1679,8 @@ export const TablePlugin = Plugin.create({
|
|
|
1635
1679
|
name: $.from('name', 'augments').map(
|
|
1636
1680
|
(nameVal, augmentsVal) => augmentsVal.ifString() ?? nameVal
|
|
1637
1681
|
),
|
|
1682
|
+
create_access_controls: $.from('createAccessControls').toBoolean().def(false),
|
|
1683
|
+
user_role: $.val(userRoleReference),
|
|
1638
1684
|
scriptable_table: $.from('scriptableTable').toBoolean().def(false),
|
|
1639
1685
|
// Controls toFile output, not written to record XML
|
|
1640
1686
|
augments: $.from('augments'),
|
|
@@ -1809,6 +1855,8 @@ function parseTableBootstrapXml(xml: unknown): TableDefinition | null {
|
|
|
1809
1855
|
actionsAccess: table['@_actions_access'],
|
|
1810
1856
|
readAccess: table['@_read_access'],
|
|
1811
1857
|
isExtendable: table['@_is_extendable'],
|
|
1858
|
+
createAccessControls: table['@_create_access_controls'],
|
|
1859
|
+
userRole: table['@_user_role'],
|
|
1812
1860
|
scriptableTable: table['@_scriptable_table'],
|
|
1813
1861
|
attributes: table['@_attributes'],
|
|
1814
1862
|
}
|
|
@@ -1830,6 +1878,8 @@ function tableDefToRecordProperties(
|
|
|
1830
1878
|
label: tableDef.label,
|
|
1831
1879
|
super_class: tableDef.extends,
|
|
1832
1880
|
is_extendable: tableDef.isExtendable,
|
|
1881
|
+
create_access_controls: tableDef.createAccessControls,
|
|
1882
|
+
user_role: tableDef.userRole,
|
|
1833
1883
|
scriptable_table: tableDef.scriptableTable,
|
|
1834
1884
|
client_scripts_access: tableDef.clientScriptsAccess,
|
|
1835
1885
|
ws_access: tableDef.wsAccess,
|
|
@@ -2085,6 +2135,58 @@ function addTableToGlobalGeneratedFile(tableArg: ObjectShape, sourceFilePath: st
|
|
|
2085
2135
|
}
|
|
2086
2136
|
}
|
|
2087
2137
|
|
|
2138
|
+
/**
|
|
2139
|
+
* Records a bootstrap-derived Table() shape into $$GENERATED$$_bootstrapped_tables.ts so that other plugins (e.g. RecordPlugin)
|
|
2140
|
+
* can resolve Data<T> column types via TypeScript during the same transform pass — no sys_dictionary query needed.
|
|
2141
|
+
*
|
|
2142
|
+
* The `declare global` augmentation lives inside the bootstrapped file (referencing its LOCAL `typeof tableName` export) rather
|
|
2143
|
+
* than the common table file. That avoids the duplicate-import error when a pre-existing Fluent Table() of the same name was
|
|
2144
|
+
* already wired into the common file, and TypeScript still merges the two TableSchemas interface declarations so both
|
|
2145
|
+
* contribute their columns to the resolved Data<T>.
|
|
2146
|
+
*/
|
|
2147
|
+
function registerBootstrappedTable(
|
|
2148
|
+
tableCall: CallExpressionShape,
|
|
2149
|
+
schema: { [key: string]: CallExpressionShape },
|
|
2150
|
+
compiler: Compiler
|
|
2151
|
+
): void {
|
|
2152
|
+
const file = compiler.getGeneratedBootstrappedTablesFile()
|
|
2153
|
+
if (!file || Object.keys(schema).length === 0) {
|
|
2154
|
+
return
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
const tableArg = tableCall.getArgument(0).asObject()
|
|
2158
|
+
const tableName = tableArg.get('augments').ifString()?.getValue() ?? tableArg.get('name').asString().getValue()
|
|
2159
|
+
|
|
2160
|
+
const tableSchemas = file.getModule('global')?.getModule('Now')?.getModule('Internal')?.getModule('TableSchemas')
|
|
2161
|
+
const tables = file.getModule('global')?.getModule('Now')?.getModule('Internal')?.getInterface('Tables')
|
|
2162
|
+
if (!tableSchemas || !tables) {
|
|
2163
|
+
return
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
const coreImport = file.getImportDeclaration('@servicenow/sdk/core')
|
|
2167
|
+
const existingImports = new Set(coreImport?.getNamedImports().map((n) => n.getName()))
|
|
2168
|
+
for (const callee of new Set(Object.values(schema).map((s) => s.getCallee()))) {
|
|
2169
|
+
if (!existingImports.has(callee)) {
|
|
2170
|
+
coreImport?.addNamedImport(callee)
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
// Replace any existing export (re-transform of same XML), then write the shape's rendered code.
|
|
2175
|
+
file.getVariableDeclaration(tableName)?.getVariableStatement()?.remove()
|
|
2176
|
+
file.addVariableStatement({
|
|
2177
|
+
isExported: true,
|
|
2178
|
+
declarationKind: ts.VariableDeclarationKind.Const,
|
|
2179
|
+
declarations: [{ name: tableName, initializer: tableCall.getCode() }],
|
|
2180
|
+
})
|
|
2181
|
+
|
|
2182
|
+
if (!tableSchemas.getInterface(tableName)) {
|
|
2183
|
+
tableSchemas.addInterface({ name: tableName, extends: [`Helper<typeof ${tableName}>`] })
|
|
2184
|
+
}
|
|
2185
|
+
if (!tables.getProperty(tableName)) {
|
|
2186
|
+
tables.addProperty({ name: tableName, type: `Table<TableSchemas.${tableName}>` })
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2088
2190
|
function filterUndefinedProperties<T extends object>(obj: T): T {
|
|
2089
2191
|
return Object.fromEntries(Object.entries(obj).filter(([_, value]) => value !== undefined)) as T
|
|
2090
2192
|
}
|
package/src/ui-action-plugin.ts
CHANGED
|
@@ -6,13 +6,12 @@ import {
|
|
|
6
6
|
type Shape,
|
|
7
7
|
type StringShape,
|
|
8
8
|
} from '@servicenow/sdk-build-core'
|
|
9
|
+
import type { UiAction } from '@servicenow/sdk-core/runtime/ui'
|
|
9
10
|
import { NowIdShape } from './now-id-plugin'
|
|
10
11
|
import { ModuleFunctionShape } from './server-module-plugin'
|
|
11
|
-
import { createSdkDocEntry } from './utils'
|
|
12
12
|
|
|
13
13
|
export const UiActionPlugin = Plugin.create({
|
|
14
14
|
name: 'UiActionPlugin',
|
|
15
|
-
docs: [createSdkDocEntry('UiAction', ['sys_ui_action'])],
|
|
16
15
|
records: {
|
|
17
16
|
sys_ui_action: {
|
|
18
17
|
relationships: {
|
|
@@ -161,7 +160,7 @@ export const UiActionPlugin = Plugin.create({
|
|
|
161
160
|
order: $.map((o) => (o.ifString()?.getValue() === '' ? 100 : o))
|
|
162
161
|
.toNumber()
|
|
163
162
|
.def(100),
|
|
164
|
-
overrides: $.def(''),
|
|
163
|
+
overrides: $.from('sys_overrides').def(''),
|
|
165
164
|
showQuery: $.from('show_query').toBoolean().def(false),
|
|
166
165
|
showUpdate: $.from('show_update').toBoolean(),
|
|
167
166
|
showInsert: $.from('show_insert').toBoolean(),
|
|
@@ -195,6 +194,18 @@ export const UiActionPlugin = Plugin.create({
|
|
|
195
194
|
const arg = callExpression.getArgument(0).asObject()
|
|
196
195
|
const isClient = arg.get(['client', 'isClient'])
|
|
197
196
|
|
|
197
|
+
const form = arg.get('form')?.getValue() as UiAction<string>['form']
|
|
198
|
+
const isFormAction = form?.showButton || form?.showLink || form?.showContextMenu
|
|
199
|
+
|
|
200
|
+
const list = arg.get('list').getValue() as UiAction<string>['list']
|
|
201
|
+
const isListAction =
|
|
202
|
+
list?.showButton ||
|
|
203
|
+
list?.showBannerButton ||
|
|
204
|
+
list?.showContextMenu ||
|
|
205
|
+
list?.showListChoice ||
|
|
206
|
+
list?.showLink ||
|
|
207
|
+
list?.showSaveWithFormButton
|
|
208
|
+
|
|
198
209
|
const uiAction = await factory.createRecord({
|
|
199
210
|
source: callExpression,
|
|
200
211
|
table: 'sys_ui_action',
|
|
@@ -212,8 +223,8 @@ export const UiActionPlugin = Plugin.create({
|
|
|
212
223
|
? arg.get('messages').asArray().getValue().join('\n')
|
|
213
224
|
: arg.get('messages')
|
|
214
225
|
).def([]),
|
|
215
|
-
list_style: $.val(
|
|
216
|
-
form_style: $.val(
|
|
226
|
+
list_style: $.val(list?.style),
|
|
227
|
+
form_style: $.val(form?.style),
|
|
217
228
|
condition: $.def(''),
|
|
218
229
|
script: $.map(
|
|
219
230
|
(v) => v.if(ModuleFunctionShape)?.toString((n) => `${n}({{PARAMS}})`, ['current']) ?? v
|
|
@@ -222,24 +233,26 @@ export const UiActionPlugin = Plugin.create({
|
|
|
222
233
|
.toCdata(),
|
|
223
234
|
hint: $.def(''),
|
|
224
235
|
order: $.toNumber().def(100),
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
236
|
+
sys_overrides: $.from('overrides').def(''),
|
|
237
|
+
form_action: $.val(isFormAction).def(false),
|
|
238
|
+
list_action: $.val(isListAction).def(false),
|
|
239
|
+
form_button: $.val(form?.showButton).def(false),
|
|
240
|
+
list_button: $.val(list?.showButton).def(false),
|
|
241
|
+
form_link: $.val(form?.showLink).def(false),
|
|
242
|
+
list_link: $.val(list?.showLink).def(false),
|
|
243
|
+
form_context_menu: $.val(form?.showContextMenu).def(false),
|
|
244
|
+
list_context_menu: $.val(list?.showContextMenu).def(false),
|
|
232
245
|
show_query: $.from('showQuery').toBoolean().def(false),
|
|
233
246
|
show_insert: $.from('showInsert').toBoolean().def(false).def(true),
|
|
234
247
|
show_multiple_update: $.from('showMultipleUpdate').toBoolean().def(false),
|
|
235
248
|
show_update: $.from('showUpdate').toBoolean().def(true),
|
|
236
|
-
list_choice: $.val(
|
|
237
|
-
list_banner_button: $.val(
|
|
238
|
-
list_save_with_form_button: $.val(
|
|
249
|
+
list_choice: $.val(list?.showListChoice).def(false),
|
|
250
|
+
list_banner_button: $.val(list?.showBannerButton).def(false),
|
|
251
|
+
list_save_with_form_button: $.val(list?.showSaveWithFormButton).def(false),
|
|
239
252
|
isolate_script: $.from('isolateScript').toBoolean().def(false),
|
|
240
253
|
ui11_compatible: $.val(arg.get(['client', 'isUi11Compatible'])).def(false),
|
|
241
|
-
ui16_compatible: $.val(arg.get(['client', 'isUi16Compatible'])),
|
|
242
|
-
client_script_v2: $.val(arg.get(['workspace', 'clientScriptV2'])),
|
|
254
|
+
ui16_compatible: $.val(arg.get(['client', 'isUi16Compatible'])).def(false),
|
|
255
|
+
client_script_v2: $.val(arg.get(['workspace', 'clientScriptV2'])).toCdata(),
|
|
243
256
|
form_button_v2: $.val(arg.get(['workspace', 'showFormButtonV2'])).def(false),
|
|
244
257
|
form_menu_button_v2: $.val(arg.get(['workspace', 'showFormMenuButtonV2'])).def(false),
|
|
245
258
|
format_for_configurable_workspace: $.val(arg.get(['workspace', 'isConfigurableWorkspace'])).def(
|