@servicenow/sdk-build-plugins 4.6.0 → 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 +3 -4
- 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 +6 -10
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +10 -4
- 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 +120 -49
- 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 +1 -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 +5 -4
- 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 +4 -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 +2 -4
- 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 +2 -4
- 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/service-catalog-base.d.ts +2 -2
- package/dist/service-catalog/service-catalog-base.js +2 -2
- package/dist/service-catalog/service-catalog-base.js.map +1 -1
- package/dist/service-catalog/utils.js +1 -1
- package/dist/service-catalog/utils.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 +303 -66
- 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 +28 -97
- 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 +5 -9
- package/dist/utils.js +38 -11
- 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 +4 -5
- 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 +6 -11
- package/src/basic-syntax-plugin.ts +11 -4
- 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 +163 -76
- 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 +1 -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 +14 -6
- 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 +8 -4
- package/src/server-module-plugin/index.ts +2 -3
- package/src/service-catalog/catalog-clientscript-plugin.ts +2 -4
- package/src/service-catalog/catalog-item-plugin.ts +0 -2
- package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -4
- package/src/service-catalog/sc-record-producer-plugin.ts +0 -2
- package/src/service-catalog/service-catalog-base.ts +2 -2
- package/src/service-catalog/utils.ts +1 -1
- 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 +371 -92
- package/src/ui-action-plugin.ts +30 -17
- package/src/ui-page-plugin.ts +188 -20
- package/src/ui-policy-plugin.ts +33 -130
- package/src/user-preference-plugin.ts +0 -2
- package/src/utils.ts +48 -11
- 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/rest-api-plugin.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { ModuleFunctionShape } from './server-module-plugin'
|
|
14
14
|
import { NowIdShape } from './now-id-plugin'
|
|
15
15
|
import { NowIncludeShape } from './now-include-plugin'
|
|
16
|
-
import {
|
|
16
|
+
import { generateDeprecatedDiagnostics } from './utils'
|
|
17
17
|
import { RecordPlugin } from './record-plugin'
|
|
18
18
|
|
|
19
19
|
const DEFAULT_MEDIA_TYPE = 'application/json,application/xml,text/xml'
|
|
@@ -24,11 +24,13 @@ const restDefAliases = {
|
|
|
24
24
|
enforceAcl: ['enforce_acl'],
|
|
25
25
|
docLink: ['doc_link'],
|
|
26
26
|
shortDescription: ['short_description'],
|
|
27
|
+
protectionPolicy: ['policy'],
|
|
27
28
|
}
|
|
28
29
|
const routeAliases = {
|
|
29
30
|
shortDescription: ['short_description'],
|
|
30
31
|
requestExample: ['request_example'],
|
|
31
32
|
enforceAcl: ['enforce_acl'],
|
|
33
|
+
protectionPolicy: ['policy'],
|
|
32
34
|
}
|
|
33
35
|
const versionAliases = {
|
|
34
36
|
isDefault: ['is_default'],
|
|
@@ -286,7 +288,7 @@ async function generateRouteAndRouteAttrRecords(
|
|
|
286
288
|
request_example: $.from('requestExample').def(''),
|
|
287
289
|
web_service_definition: $.val(restDef.getId()),
|
|
288
290
|
web_service_version: $.val(versionId),
|
|
289
|
-
sys_policy: $.from('
|
|
291
|
+
sys_policy: $.from('protectionPolicy').def(''),
|
|
290
292
|
})),
|
|
291
293
|
})
|
|
292
294
|
|
|
@@ -436,7 +438,6 @@ function versionsTransform(versions: Record[]) {
|
|
|
436
438
|
|
|
437
439
|
export const RestApiPlugin = Plugin.create({
|
|
438
440
|
name: 'RestApiPlugin',
|
|
439
|
-
docs: [createSdkDocEntry('RestApi', ['sys_ws_definition'])],
|
|
440
441
|
records: {
|
|
441
442
|
sys_ws_header_map: {
|
|
442
443
|
coalesce: ['web_service_operation', 'web_service_header'],
|
|
@@ -517,7 +518,7 @@ export const RestApiPlugin = Plugin.create({
|
|
|
517
518
|
internalRole: $.from('requires_snc_internal_role').toBoolean().def(true),
|
|
518
519
|
shortDescription: $.from('short_description').def(''),
|
|
519
520
|
requestExample: $.from('request_example').def(''),
|
|
520
|
-
|
|
521
|
+
protectionPolicy: $.from('sys_policy').def(''),
|
|
521
522
|
parameters: $.val(
|
|
522
523
|
routeAttributeTransform(
|
|
523
524
|
paramRouteAssociations,
|
|
@@ -556,7 +557,7 @@ export const RestApiPlugin = Plugin.create({
|
|
|
556
557
|
.def([DEFAULT_REST_ENFORCED_ACL]),
|
|
557
558
|
serviceId: $.from('service_id'),
|
|
558
559
|
shortDescription: $.from('short_description').def(''),
|
|
559
|
-
|
|
560
|
+
protectionPolicy: $.from('sys_policy').def(''),
|
|
560
561
|
docLink: $.from('doc_link').def(''),
|
|
561
562
|
routes: $.val(routesWithScript).def([]),
|
|
562
563
|
versions: $.val(versionsTransform(versions)).def([]),
|
|
@@ -650,7 +651,7 @@ export const RestApiPlugin = Plugin.create({
|
|
|
650
651
|
produces_customized: $.from('produces').map((v) =>
|
|
651
652
|
v.isString() ? v.getValue() !== DEFAULT_MEDIA_TYPE : false
|
|
652
653
|
),
|
|
653
|
-
sys_policy: $.from('
|
|
654
|
+
sys_policy: $.from('protectionPolicy').def(''),
|
|
654
655
|
enforce_acl: $.val(mergeAcls(enforceAcls)),
|
|
655
656
|
})),
|
|
656
657
|
})
|
package/src/role-plugin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isSNScope, type Record } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
3
|
-
import {
|
|
3
|
+
import { generateDeprecatedDiagnostics } from './utils'
|
|
4
4
|
|
|
5
5
|
const roleAliases = {
|
|
6
6
|
canDelegate: ['can_delegate'],
|
|
@@ -12,7 +12,6 @@ const roleAliases = {
|
|
|
12
12
|
|
|
13
13
|
export const RolePlugin = Plugin.create({
|
|
14
14
|
name: 'RolePlugin',
|
|
15
|
-
docs: [createSdkDocEntry('Role', ['sys_user_role'])],
|
|
16
15
|
records: {
|
|
17
16
|
sys_user_role: {
|
|
18
17
|
relationships: {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { NowIdShape } from '../now-id-plugin'
|
|
11
11
|
import { NowIncludeShape } from '../now-include-plugin'
|
|
12
12
|
import { ModuleFunctionShape } from '../server-module-plugin'
|
|
13
|
-
import {
|
|
13
|
+
import { toReference } from '../utils'
|
|
14
14
|
import { dateTimeFieldToXML, convertXMLToDateTime, formatTimeDataToDateTime, formatToUTC } from './timeZoneConverter'
|
|
15
15
|
|
|
16
16
|
const DEFAULT_DATE_TIME = '1970-01-01 00:00:00'
|
|
@@ -289,7 +289,6 @@ function validateRecurringJobSchedule(
|
|
|
289
289
|
|
|
290
290
|
export const ScheduledScriptPlugin = Plugin.create({
|
|
291
291
|
name: 'ScheduledScriptPlugin',
|
|
292
|
-
docs: [createSdkDocEntry('ScheduledScript', ['sysauto_script'])],
|
|
293
292
|
records: {
|
|
294
293
|
sysauto_script: {
|
|
295
294
|
async toShape(record, { transform }) {
|
|
@@ -469,9 +468,16 @@ export const ScheduledScriptPlugin = Plugin.create({
|
|
|
469
468
|
)
|
|
470
469
|
}
|
|
471
470
|
|
|
472
|
-
// Validate daysOfWeek is defined when frequency is 'weekly'
|
|
473
|
-
if (
|
|
474
|
-
|
|
471
|
+
// Validate dayOfWeek or daysOfWeek is defined when frequency is 'weekly'
|
|
472
|
+
if (
|
|
473
|
+
frequency === 'weekly' &&
|
|
474
|
+
args.get('daysOfWeek').isUndefined() &&
|
|
475
|
+
args.get('dayOfWeek').isUndefined()
|
|
476
|
+
) {
|
|
477
|
+
diagnostics.error(
|
|
478
|
+
args.get('frequency'),
|
|
479
|
+
`dayOfWeek or daysOfWeek must be defined when frequency is 'weekly'`
|
|
480
|
+
)
|
|
475
481
|
}
|
|
476
482
|
|
|
477
483
|
// Validate businessCalendar is not empty when frequency is business calendar related
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
3
|
import { ModuleFunctionShape } from './server-module-plugin'
|
|
4
|
-
import { createSdkDocEntry } from './utils'
|
|
5
4
|
|
|
6
5
|
export const ScriptActionPlugin = Plugin.create({
|
|
7
6
|
name: 'ScriptActionPlugin',
|
|
8
|
-
docs: [createSdkDocEntry('ScriptAction', ['sysevent_script_action'])],
|
|
9
7
|
records: {
|
|
10
8
|
sysevent_script_action: {
|
|
11
9
|
toShape(record) {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { CallExpressionShape, isSNScope, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
3
|
import { NowIncludeShape } from './now-include-plugin'
|
|
4
|
-
import { createSdkDocEntry } from './utils'
|
|
5
4
|
|
|
6
5
|
const nameRegex = /^[a-zA-Z_$][0-9a-zA-Z_$]+$/
|
|
7
6
|
|
|
8
7
|
export const ScriptIncludePlugin = Plugin.create({
|
|
9
8
|
name: `ScriptIncludePlugin`,
|
|
10
|
-
docs: [createSdkDocEntry('ScriptInclude', ['sys_script_include'])],
|
|
11
9
|
records: {
|
|
12
10
|
sys_script_include: {
|
|
13
11
|
async toShape(record, { transform }) {
|
|
@@ -37,7 +35,6 @@ export const ScriptIncludePlugin = Plugin.create({
|
|
|
37
35
|
sandboxCallable: $.from('sandbox_callable').toBoolean(),
|
|
38
36
|
accessibleFrom: $.from('access').def('package_private'),
|
|
39
37
|
active: $.toBoolean(),
|
|
40
|
-
protectionPolicy: $.from('sys_policy').def(''),
|
|
41
38
|
})),
|
|
42
39
|
],
|
|
43
40
|
}),
|
|
@@ -61,6 +58,14 @@ export const ScriptIncludePlugin = Plugin.create({
|
|
|
61
58
|
diagnostics.error(name.getOriginalNode(), `name must be a valid JavaScript identifier`)
|
|
62
59
|
}
|
|
63
60
|
|
|
61
|
+
const callerAccess = prop.get('callerAccess')
|
|
62
|
+
if (callerAccess.isDefined() && prop.get('accessibleFrom').ifString()?.getValue() !== 'public') {
|
|
63
|
+
diagnostics.hint(
|
|
64
|
+
callerAccess.getOriginalNode(),
|
|
65
|
+
`'callerAccess' is only effective when 'accessibleFrom' is set to 'public'. It is ignored by the platform otherwise.`
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
const apiName = prop.get('apiName')
|
|
65
70
|
|
|
66
71
|
if (apiName.isDefined()) {
|
|
@@ -104,7 +109,6 @@ export const ScriptIncludePlugin = Plugin.create({
|
|
|
104
109
|
sandbox_callable: $.from('sandboxCallable').def(false),
|
|
105
110
|
access: $.from('accessibleFrom').def('package_private'),
|
|
106
111
|
active: $.def(true),
|
|
107
|
-
sys_policy: $.from('protectionPolicy'),
|
|
108
112
|
}
|
|
109
113
|
}),
|
|
110
114
|
}),
|
|
@@ -351,7 +351,6 @@ function getModuleDependencyPath(
|
|
|
351
351
|
|
|
352
352
|
export const ServerModulePlugin = Plugin.create({
|
|
353
353
|
name: 'ServerModulePlugin',
|
|
354
|
-
docs: [],
|
|
355
354
|
files: [
|
|
356
355
|
{
|
|
357
356
|
entryPoint: true,
|
|
@@ -434,7 +433,7 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
434
433
|
}
|
|
435
434
|
|
|
436
435
|
// Lint local module for Rhino compatibility (no Glide restrictions)
|
|
437
|
-
if (/\.(js|cjs|mjs|ts)$/.test(pathModule.extname(resolvedPath))) {
|
|
436
|
+
if (config.linter.module.enabled && /\.(js|cjs|mjs|ts)$/.test(pathModule.extname(resolvedPath))) {
|
|
438
437
|
const { LocalModuleLint } = await import('../repack/lint/index.js')
|
|
439
438
|
const lint = new LocalModuleLint()
|
|
440
439
|
const lintResult = lint.check(content)
|
|
@@ -511,7 +510,7 @@ export const ServerModulePlugin = Plugin.create({
|
|
|
511
510
|
)
|
|
512
511
|
for (const file of files) {
|
|
513
512
|
const fileContent = fs.readFileSync(pathModule.join(packagePath, file)).toString('utf-8')
|
|
514
|
-
if (/\.(js|cjs|mjs)$/.test(pathModule.extname(file))) {
|
|
513
|
+
if (config.linter.module.enabled && /\.(js|cjs|mjs)$/.test(pathModule.extname(file))) {
|
|
515
514
|
const result = lint.check(fileContent)
|
|
516
515
|
if (result) {
|
|
517
516
|
logger.warn(`Use of unsupported APIs detected in npm dependency ${name}`)
|
|
@@ -11,11 +11,9 @@ import {
|
|
|
11
11
|
resolveAndValidateVariableId,
|
|
12
12
|
} from './utils'
|
|
13
13
|
import { validateCatalogItemVariableSetExclusivity } from './service-catalog-diagnostics'
|
|
14
|
-
import { createSdkDocEntry } from '../utils'
|
|
15
14
|
|
|
16
15
|
export const CatalogClientScriptPlugin = Plugin.create({
|
|
17
16
|
name: 'CatalogClientScriptPlugin',
|
|
18
|
-
docs: [createSdkDocEntry('CatalogClientScript', ['catalog_script_client'])],
|
|
19
17
|
records: {
|
|
20
18
|
catalog_script_client: {
|
|
21
19
|
async toShape(record, { database, transform }) {
|
|
@@ -58,7 +56,7 @@ export const CatalogClientScriptPlugin = Plugin.create({
|
|
|
58
56
|
.map((v) =>
|
|
59
57
|
v.ifString()?.isEmpty() ? undefined : getUITypeFromId(v.toNumber()?.getValue())
|
|
60
58
|
)
|
|
61
|
-
.def('
|
|
59
|
+
.def('all'),
|
|
62
60
|
catalogItem: $.val(catalogItemReference).def(''),
|
|
63
61
|
variableName: $.val(propertyAccess).def(''),
|
|
64
62
|
variableSet: $.val(variableSetReference).def(''),
|
|
@@ -130,7 +128,7 @@ export const CatalogClientScriptPlugin = Plugin.create({
|
|
|
130
128
|
isolate_script: $.from('isolateScript').def(true),
|
|
131
129
|
ui_type: $.from('uiType')
|
|
132
130
|
.map((v) => (v.isString() && !v.isEmpty() ? getUITypeId(v.getValue()) : undefined))
|
|
133
|
-
.def(
|
|
131
|
+
.def(10),
|
|
134
132
|
va_supported: $.from('vaSupported').toBoolean().def(false),
|
|
135
133
|
published_ref: $.from('publishedRef').def(''),
|
|
136
134
|
})),
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
createScript,
|
|
15
15
|
} from './utils'
|
|
16
16
|
import { validateFulfillmentProcessExclusivity, validateCategoriesRequireCatalogs } from './service-catalog-diagnostics'
|
|
17
|
-
import { createSdkDocEntry } from '../utils'
|
|
18
17
|
import {
|
|
19
18
|
buildVariablesSchema,
|
|
20
19
|
CatalogItemBaseRelationships,
|
|
@@ -28,7 +27,6 @@ import {
|
|
|
28
27
|
|
|
29
28
|
export const CatalogItemPlugin = Plugin.create({
|
|
30
29
|
name: 'CatalogItemPlugin',
|
|
31
|
-
docs: [createSdkDocEntry('CatalogItem', ['sc_cat_item'])],
|
|
32
30
|
records: {
|
|
33
31
|
sc_cat_item: {
|
|
34
32
|
relationships: CatalogItemBaseRelationships,
|
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
getValueActionToDb,
|
|
26
26
|
} from './utils'
|
|
27
27
|
import { validateCatalogItemVariableSetExclusivity, validateUiPolicyActionMessage } from './service-catalog-diagnostics'
|
|
28
|
-
import { createSdkDocEntry } from '../utils'
|
|
29
28
|
|
|
30
29
|
// Define table names as constants since they're not exported from the core tables
|
|
31
30
|
const CATALOG_UI_POLICY = 'catalog_ui_policy'
|
|
@@ -51,7 +50,6 @@ const stripIOPrefix = (value: string): string => {
|
|
|
51
50
|
|
|
52
51
|
export const CatalogUiPolicyPlugin = Plugin.create({
|
|
53
52
|
name: 'CatalogUiPolicyPlugin',
|
|
54
|
-
docs: [createSdkDocEntry('CatalogUiPolicy', ['catalog_ui_policy'])],
|
|
55
53
|
records: {
|
|
56
54
|
[CATALOG_UI_POLICY]: {
|
|
57
55
|
relationships: {
|
|
@@ -166,7 +164,7 @@ export const CatalogUiPolicyPlugin = Plugin.create({
|
|
|
166
164
|
.map((v) =>
|
|
167
165
|
v.ifString()?.isEmpty() ? undefined : getUITypeFromId(v.toNumber()?.getValue())
|
|
168
166
|
)
|
|
169
|
-
.def('
|
|
167
|
+
.def('all'),
|
|
170
168
|
actions: $.val(actions.length > 0 ? actions : []).def([]),
|
|
171
169
|
})),
|
|
172
170
|
],
|
|
@@ -239,7 +237,7 @@ export const CatalogUiPolicyPlugin = Plugin.create({
|
|
|
239
237
|
published_ref: $.from('publishedRef').def(''),
|
|
240
238
|
ui_type: $.from('runScriptsInUiType')
|
|
241
239
|
.map((v) => (v.isString() && !v.isEmpty() ? getUITypeId(v.getValue()) : undefined))
|
|
242
|
-
.def(
|
|
240
|
+
.def(10),
|
|
243
241
|
table: $.def(''),
|
|
244
242
|
va_supported: $.from('vaSupported').def(true),
|
|
245
243
|
view: $.def(''),
|
|
@@ -28,11 +28,9 @@ import {
|
|
|
28
28
|
} from './service-catalog-base'
|
|
29
29
|
import { validateFulfillmentProcessExclusivity, validateCategoriesRequireCatalogs } from './service-catalog-diagnostics'
|
|
30
30
|
import { ModuleFunctionShape } from '../server-module-plugin'
|
|
31
|
-
import { createSdkDocEntry } from '../utils'
|
|
32
31
|
|
|
33
32
|
export const CatalogItemRecordProducerPlugin = Plugin.create({
|
|
34
33
|
name: 'CatalogItemRecordProducerPlugin',
|
|
35
|
-
docs: [createSdkDocEntry('CatalogItemRecordProducer', ['sc_cat_item_producer'])],
|
|
36
34
|
records: {
|
|
37
35
|
sc_cat_item_producer: {
|
|
38
36
|
relationships: CatalogItemBaseRelationships,
|
|
@@ -266,6 +266,7 @@ export function transformCatalogBaseFieldsToShape(record: Record, $: ShapeTransf
|
|
|
266
266
|
.map((v: Shape) => getMobilePictureTypeFromDb(v.toString().getValue()))
|
|
267
267
|
.def('desktopPicture'),
|
|
268
268
|
makeItemNonConversational: $.from('make_item_non_conversational').toBoolean().def(false),
|
|
269
|
+
noSearch: $.from('no_search').toBoolean().def(false),
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
272
|
|
|
@@ -349,6 +350,7 @@ export function transformCatalogItemBaseFieldsToRecord($: ShapeTransform) {
|
|
|
349
350
|
.map((v: Shape) => getMobilePictureTypeToDb(v.toString().getValue()))
|
|
350
351
|
.def('use_desktop_picture'),
|
|
351
352
|
make_item_non_conversational: $.from('makeItemNonConversational').def(false),
|
|
353
|
+
no_search: $.from('noSearch').def(false),
|
|
352
354
|
}
|
|
353
355
|
}
|
|
354
356
|
|
|
@@ -406,7 +408,6 @@ export function transformCatalogItemSpecificFieldsToShape(record: Record, $: Sha
|
|
|
406
408
|
noOrderNow: $.from('no_order_now').toBoolean().def(false),
|
|
407
409
|
noProceedCheckout: $.from('no_proceed_checkout').toBoolean().def(false),
|
|
408
410
|
noQuantity: $.from('no_quantity').toBoolean().def(false),
|
|
409
|
-
noSearch: $.from('no_search').toBoolean().def(false),
|
|
410
411
|
|
|
411
412
|
// Additional fields
|
|
412
413
|
vendor: $.def(''),
|
|
@@ -468,7 +469,6 @@ export function transformCatalogItemSpecificFieldsToRecord(arg: ObjectShape, $:
|
|
|
468
469
|
no_order_now: $.from('noOrderNow').def(false),
|
|
469
470
|
no_proceed_checkout: $.from('noProceedCheckout').def(false),
|
|
470
471
|
no_quantity: $.from('noQuantity').def(false),
|
|
471
|
-
no_search: $.from('noSearch').def(false),
|
|
472
472
|
|
|
473
473
|
// Additional
|
|
474
474
|
vendor: $.def(''),
|
|
@@ -20,11 +20,9 @@ import {
|
|
|
20
20
|
getVariableSetTypeFromDb,
|
|
21
21
|
getVariableSetTypeToDb,
|
|
22
22
|
} from './utils'
|
|
23
|
-
import { createSdkDocEntry } from '../utils'
|
|
24
23
|
|
|
25
24
|
export const VariableSetPlugin = Plugin.create({
|
|
26
25
|
name: 'VariableSetPlugin',
|
|
27
|
-
docs: [createSdkDocEntry('VariableSet', ['item_option_new_set'])],
|
|
28
26
|
records: {
|
|
29
27
|
item_option_new_set: {
|
|
30
28
|
relationships: {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from '../now-id-plugin'
|
|
3
|
-
import { createSdkDocEntry } from '../utils'
|
|
4
3
|
|
|
5
4
|
export const SPAngularProviderPlugin = Plugin.create({
|
|
6
5
|
name: 'SPAngularProviderPlugin',
|
|
7
|
-
docs: [createSdkDocEntry('SPAngularProvider', ['sp_angular_provider'])],
|
|
8
6
|
records: {
|
|
9
7
|
sp_angular_provider: {
|
|
10
8
|
relationships: {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { toReference } from '../utils'
|
|
3
3
|
import { NowIdShape } from '../now-id-plugin'
|
|
4
|
-
import { createSdkDocEntry } from '../utils'
|
|
5
4
|
import { getIncludeRecords } from './utils'
|
|
6
5
|
|
|
7
6
|
export const SPWidgetDependencyPlugin = Plugin.create({
|
|
8
7
|
name: 'SPWidgetDependencyPlugin',
|
|
9
|
-
docs: [createSdkDocEntry('SPWidgetDependency', ['sp_dependency'])],
|
|
10
8
|
records: {
|
|
11
9
|
sp_dependency: {
|
|
12
10
|
relationships: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
|
-
import { createSdkDocEntry } from '../utils'
|
|
3
2
|
import { createWidgetToRecord, createWidgetToShape } from './utils'
|
|
4
3
|
import {
|
|
5
4
|
getDefaultClientScript,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
|
|
11
10
|
export const SPHeaderFooterPlugin = Plugin.create({
|
|
12
11
|
name: 'SPHeaderFooterPlugin',
|
|
13
|
-
docs: [createSdkDocEntry('SPHeaderFooter', ['sp_header_footer'])],
|
|
14
12
|
records: {
|
|
15
13
|
sp_header_footer: {
|
|
16
14
|
relationships: {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@servicenow/sdk-build-core'
|
|
10
10
|
import { NowIdShape } from '../now-id-plugin'
|
|
11
11
|
import { NowIncludeShape } from '../now-include-plugin'
|
|
12
|
-
import { toReference, getFieldAsNumber, noThrow
|
|
12
|
+
import { toReference, getFieldAsNumber, noThrow } from '../utils'
|
|
13
13
|
import { getRolesString } from './utils'
|
|
14
14
|
|
|
15
15
|
const default_placeholder_dimensions = `{
|
|
@@ -219,7 +219,6 @@ async function createItemRecords(
|
|
|
219
219
|
|
|
220
220
|
export const SPMenuPlugin = Plugin.create({
|
|
221
221
|
name: 'SPMenuPlugin',
|
|
222
|
-
docs: [createSdkDocEntry('SPMenu', ['sp_instance_menu'])],
|
|
223
222
|
records: {
|
|
224
223
|
sp_instance_menu: {
|
|
225
224
|
relationships: {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type ObjectShape,
|
|
10
10
|
} from '@servicenow/sdk-build-core'
|
|
11
11
|
import isEmpty from 'lodash/isEmpty'
|
|
12
|
-
import { toReference, getFieldAsNumber
|
|
12
|
+
import { toReference, getFieldAsNumber } from '../utils'
|
|
13
13
|
import { getRolesString } from './utils'
|
|
14
14
|
|
|
15
15
|
type Dict = { [key: string]: unknown }
|
|
@@ -566,7 +566,6 @@ async function createInstanceRecords(instancesArray: Shape[], columnId: RecordId
|
|
|
566
566
|
|
|
567
567
|
export const SPPagePlugin = Plugin.create({
|
|
568
568
|
name: 'SPPagePlugin',
|
|
569
|
-
docs: [createSdkDocEntry('SPPage', ['sp_page'])],
|
|
570
569
|
records: {
|
|
571
570
|
sp_page: {
|
|
572
571
|
coalesce: ['id'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin, type Shape } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from '../now-id-plugin'
|
|
3
|
-
import { toReference
|
|
3
|
+
import { toReference } from '../utils'
|
|
4
4
|
import { getRolesString } from './utils'
|
|
5
5
|
|
|
6
6
|
function getPortalsString(portalsShape: Shape): string {
|
|
@@ -21,7 +21,6 @@ function getPortalsString(portalsShape: Shape): string {
|
|
|
21
21
|
|
|
22
22
|
export const SPPageRouteMapPlugin = Plugin.create({
|
|
23
23
|
name: 'SPPageRouteMapPlugin',
|
|
24
|
-
docs: [createSdkDocEntry('SPPageRouteMap', ['sp_page_route_map'])],
|
|
25
24
|
records: {
|
|
26
25
|
sp_page_route_map: {
|
|
27
26
|
coalesce: ['route_from_page', 'portals'],
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Plugin, CallExpressionShape, type Record, type Shape } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from '../now-id-plugin'
|
|
3
|
-
import { createSdkDocEntry } from '../utils'
|
|
4
3
|
|
|
5
4
|
function convertToNumber(value: Shape, defaultValue: number = 0): number {
|
|
6
5
|
if (!value || value.isUndefined() || value.ifString()?.isEmpty()) {
|
|
@@ -11,7 +10,6 @@ function convertToNumber(value: Shape, defaultValue: number = 0): number {
|
|
|
11
10
|
|
|
12
11
|
export const ServicePortalPlugin = Plugin.create({
|
|
13
12
|
name: 'ServicePortalPlugin',
|
|
14
|
-
docs: [createSdkDocEntry('ServicePortal', ['sp_portal'])],
|
|
15
13
|
records: {
|
|
16
14
|
sp_portal: {
|
|
17
15
|
relationships: {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from '../now-id-plugin'
|
|
3
3
|
import { DEFAULT_ORDER, getIncludeRecords } from './utils'
|
|
4
|
-
import { createSdkDocEntry } from '../utils'
|
|
5
4
|
|
|
6
5
|
export const SPThemePlugin = Plugin.create({
|
|
7
6
|
name: 'SPThemePlugin',
|
|
8
|
-
docs: [createSdkDocEntry('SPTheme', ['sp_theme'])],
|
|
9
7
|
records: {
|
|
10
8
|
sp_theme: {
|
|
11
9
|
relationships: {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
|
-
import { createSdkDocEntry } from '../utils'
|
|
3
2
|
import { createWidgetToRecord, createWidgetToShape } from './utils'
|
|
4
3
|
|
|
5
4
|
export const SPWidgetPlugin = Plugin.create({
|
|
6
5
|
name: 'SPWidgetPlugin',
|
|
7
|
-
docs: [createSdkDocEntry('SPWidget', ['sp_widget'])],
|
|
8
6
|
records: {
|
|
9
7
|
sp_widget: {
|
|
10
8
|
relationships: {
|
package/src/sla-plugin.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin, DurationShape } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
-
import { createSdkDocEntry } from './utils'
|
|
4
3
|
import {
|
|
5
4
|
validateUserSpecifiedDuration,
|
|
6
5
|
validateRelativeDuration,
|
|
@@ -37,7 +36,6 @@ const DEFAULT_DURATION_ON_PLATFORM = '1970-01-01 00:00:00'
|
|
|
37
36
|
*/
|
|
38
37
|
export const SLAPlugin = Plugin.create({
|
|
39
38
|
name: 'SLAPlugin',
|
|
40
|
-
docs: [createSdkDocEntry('Sla', ['contract_sla'])],
|
|
41
39
|
|
|
42
40
|
records: {
|
|
43
41
|
contract_sla: {
|
|
@@ -3,7 +3,7 @@ import * as mime from 'mime-types'
|
|
|
3
3
|
import { Shape, Plugin, type Record, unloadBuilder, gzipSync, type RecordContext } from '@servicenow/sdk-build-core'
|
|
4
4
|
import { path as pathModule } from '@servicenow/sdk-build-core'
|
|
5
5
|
import { INVALID_XML_CHARACTERS } from './utils'
|
|
6
|
-
import {
|
|
6
|
+
import { TRANSLATIONS_SUFFIX } from '@servicenow/isomorphic-rollup'
|
|
7
7
|
|
|
8
8
|
// based on tectonic code for attachments
|
|
9
9
|
// https://code.devsnc.com/dev/sn-tectonic/blob/b3ab42ce742158cb5a0d00efd540b97eeafcbdd7/core/metadata-transform-san-diego/utils/index.js#L66
|
|
@@ -92,7 +92,6 @@ const toNoOpShape = (record: Record) => {
|
|
|
92
92
|
|
|
93
93
|
export const StaticContentPlugin = Plugin.create({
|
|
94
94
|
name: 'StaticContentPlugin',
|
|
95
|
-
docs: [],
|
|
96
95
|
records: {
|
|
97
96
|
// TODO: remove when we have generic attachment support
|
|
98
97
|
sys_attachment: {
|
|
@@ -102,6 +101,9 @@ export const StaticContentPlugin = Plugin.create({
|
|
|
102
101
|
sys_attachment_doc: {
|
|
103
102
|
toShape: toNoOpShape,
|
|
104
103
|
},
|
|
104
|
+
sys_ui_message: {
|
|
105
|
+
toShape: toNoOpShape,
|
|
106
|
+
},
|
|
105
107
|
sys_ux_lib_asset: {
|
|
106
108
|
coalesce: ['name'],
|
|
107
109
|
relationships: { ...attachmentRelationships, ...sourceArtifactRelationships },
|
|
@@ -167,8 +169,39 @@ export const StaticContentPlugin = Plugin.create({
|
|
|
167
169
|
// Build-time manifest produced by the uiPageSourceManifest rollup plugin.
|
|
168
170
|
// Consumed by UiPage during build to determine which source files to include
|
|
169
171
|
// in the source artifact record. Not a deployable asset.
|
|
170
|
-
} else if (relativePath
|
|
171
|
-
|
|
172
|
+
} else if (relativePath.endsWith(TRANSLATIONS_SUFFIX)) {
|
|
173
|
+
// Build-time asset produced by collectSnTranslate() rollup plugin.
|
|
174
|
+
// Create sys_ui_message records for each collected translation message key.
|
|
175
|
+
// Messages can be plain strings (t('key')) or objects (t({ code, message, ... })).
|
|
176
|
+
const parsed = JSON.parse(stringFileContent) as {
|
|
177
|
+
messages: Array<string | { [key: string]: string }>
|
|
178
|
+
}
|
|
179
|
+
const { messages } = parsed
|
|
180
|
+
if (messages.length > 0) {
|
|
181
|
+
const messageRecords = await Promise.all(
|
|
182
|
+
messages.map((entry) => {
|
|
183
|
+
const key = typeof entry === 'string' ? entry : (entry['code'] ?? '')
|
|
184
|
+
const messageText = typeof entry === 'string' ? entry : (entry['message'] ?? key)
|
|
185
|
+
return factory.createRecord({
|
|
186
|
+
source: file,
|
|
187
|
+
explicitId: key,
|
|
188
|
+
table: 'sys_ui_message',
|
|
189
|
+
properties: {
|
|
190
|
+
code: config.scope,
|
|
191
|
+
key,
|
|
192
|
+
language: config.defaultLanguage,
|
|
193
|
+
message: messageText,
|
|
194
|
+
},
|
|
195
|
+
})
|
|
196
|
+
})
|
|
197
|
+
)
|
|
198
|
+
const [first, ...rest] = messageRecords
|
|
199
|
+
if (!first) {
|
|
200
|
+
return { success: false }
|
|
201
|
+
}
|
|
202
|
+
return { success: true, value: first.with(...rest) }
|
|
203
|
+
}
|
|
204
|
+
return { success: false }
|
|
172
205
|
} else if (mimeType === 'application/javascript') {
|
|
173
206
|
tableName = 'sys_ux_lib_asset'
|
|
174
207
|
assetName = pathModule.join(
|