@servicenow/sdk-build-plugins 4.4.0 → 4.5.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 +1 -0
- 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-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 +4 -2
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-data-pill-plugin.js +1 -0
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-definition-plugin.js +8 -3
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-diagnostics-plugin.js +1 -0
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-instance-plugin.js +68 -12
- 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 +3 -2
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/step-instance-plugin.js +1 -0
- 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 +1 -0
- 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 +58 -0
- package/dist/flow/post-install.js.map +1 -0
- package/dist/flow/utils/complex-objects.js +4 -2
- package/dist/flow/utils/complex-objects.js.map +1 -1
- package/dist/flow/utils/flow-constants.d.ts +24 -0
- package/dist/flow/utils/flow-constants.js +29 -2
- package/dist/flow/utils/flow-constants.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-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/service-catalog.js +5 -1
- package/dist/flow/utils/service-catalog.js.map +1 -1
- package/dist/form-plugin.d.ts +2 -0
- package/dist/form-plugin.js +1134 -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/index.d.ts +9 -0
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-scan-plugin.d.ts +2 -0
- package/dist/instance-scan-plugin.js +298 -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 +30 -0
- package/dist/record-plugin.js +37 -1
- 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 +14 -0
- 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 +551 -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-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/menu-plugin.d.ts +2 -0
- package/dist/service-portal/menu-plugin.js +353 -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 +702 -0
- package/dist/service-portal/page-plugin.js.map +1 -0
- package/dist/service-portal/portal-plugin.d.ts +2 -0
- package/dist/service-portal/portal-plugin.js +296 -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 +8 -0
- package/dist/service-portal/utils.js +50 -0
- package/dist/service-portal/utils.js.map +1 -0
- package/dist/service-portal/widget-plugin.js +45 -8
- 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 +1 -0
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +1 -0
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-action-plugin.js +2 -0
- package/dist/ui-action-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +33 -8
- 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 +1 -0
- package/dist/view-plugin.js.map +1 -1
- package/dist/workspace-plugin.js +2 -0
- package/dist/workspace-plugin.js.map +1 -1
- package/package.json +10 -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 +1 -0
- 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-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 +4 -2
- package/src/flow/plugins/flow-data-pill-plugin.ts +1 -0
- package/src/flow/plugins/flow-definition-plugin.ts +10 -4
- package/src/flow/plugins/flow-diagnostics-plugin.ts +1 -0
- package/src/flow/plugins/flow-instance-plugin.ts +103 -14
- 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 +3 -2
- package/src/flow/plugins/step-instance-plugin.ts +1 -0
- package/src/flow/plugins/trigger-plugin.ts +2 -0
- package/src/flow/plugins/wfa-datapill-plugin.ts +1 -0
- package/src/flow/post-install.ts +92 -0
- package/src/flow/utils/complex-objects.ts +10 -2
- package/src/flow/utils/flow-constants.ts +30 -1
- package/src/flow/utils/flow-to-xml.ts +4 -4
- package/src/flow/utils/label-cache-processor.ts +14 -2
- package/src/flow/utils/service-catalog.ts +5 -2
- package/src/form-plugin.ts +1411 -0
- package/src/html-import-plugin.ts +1 -0
- package/src/import-sets-plugin.ts +2 -0
- package/src/index.ts +9 -0
- package/src/instance-scan-plugin.ts +318 -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 +3 -1
- package/src/record-plugin.ts +42 -2
- package/src/repack/lint/Rules.ts +171 -22
- package/src/repack/lint/index.ts +80 -56
- package/src/rest-api-plugin.ts +21 -1
- package/src/role-plugin.ts +2 -1
- package/src/schedule-script/index.ts +1 -0
- package/src/schedule-script/scheduled-script-plugin.ts +679 -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-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/menu-plugin.ts +435 -0
- package/src/service-portal/page-plugin.ts +830 -0
- package/src/service-portal/portal-plugin.ts +319 -0
- package/src/service-portal/theme-plugin.ts +135 -0
- package/src/service-portal/utils.ts +69 -0
- package/src/service-portal/widget-plugin.ts +79 -9
- package/src/sla-plugin.ts +2 -0
- package/src/static-content-plugin.ts +1 -0
- package/src/table-plugin.ts +2 -1
- package/src/ui-action-plugin.ts +2 -0
- package/src/ui-page-plugin.ts +34 -8
- 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 +1 -0
- package/src/workspace-plugin.ts +2 -0
- package/src/_types/eslint-plugin-es-x.d.ts +0 -17
package/src/sla-plugin.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin, DurationShape } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
+
import { createSdkDocEntry } from './utils'
|
|
3
4
|
import {
|
|
4
5
|
validateUserSpecifiedDuration,
|
|
5
6
|
validateRelativeDuration,
|
|
@@ -36,6 +37,7 @@ const DEFAULT_DURATION_ON_PLATFORM = '1970-01-01 00:00:00'
|
|
|
36
37
|
*/
|
|
37
38
|
export const SLAPlugin = Plugin.create({
|
|
38
39
|
name: 'SLAPlugin',
|
|
40
|
+
docs: [createSdkDocEntry('Sla', ['contract_sla'])],
|
|
39
41
|
|
|
40
42
|
records: {
|
|
41
43
|
contract_sla: {
|
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>
|
|
@@ -370,6 +370,7 @@ const licensingAliases = {
|
|
|
370
370
|
|
|
371
371
|
export const TablePlugin = Plugin.create({
|
|
372
372
|
name: 'TablePlugin',
|
|
373
|
+
docs: [createSdkDocEntry('Table', ['sys_db_object'])],
|
|
373
374
|
files: [
|
|
374
375
|
{
|
|
375
376
|
matcher: /\.xml$/,
|
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: {
|
package/src/ui-page-plugin.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { create } from 'xmlbuilder2'
|
|
|
22
22
|
import { NowIdShape } from './now-id-plugin'
|
|
23
23
|
import { CHUNK_SIZE, chunkData, generateId } from './static-content-plugin'
|
|
24
24
|
import { sha256 } from './now-attach-plugin'
|
|
25
|
+
import { createSdkDocEntry } from './utils'
|
|
25
26
|
|
|
26
27
|
const parserOptions: X2jOptions = {
|
|
27
28
|
ignoreAttributes: false,
|
|
@@ -158,10 +159,19 @@ const nodeTransformer = (nodes: any[]) => {
|
|
|
158
159
|
|
|
159
160
|
export const UiPagePlugin = Plugin.create({
|
|
160
161
|
name: 'UiPagePlugin',
|
|
162
|
+
docs: [createSdkDocEntry('UiPage', ['sys_ui_page'])],
|
|
161
163
|
records: {
|
|
162
164
|
sys_ui_page: {
|
|
163
165
|
composite: true,
|
|
164
|
-
coalesce:
|
|
166
|
+
coalesce: (properties) => {
|
|
167
|
+
// Use endpoint for scoped pages (backward compatible), fall back to name for global scope
|
|
168
|
+
const endpoint = properties.get('endpoint').pipe((v) => v.ifDefined()?.toString().getValue())
|
|
169
|
+
if (endpoint) {
|
|
170
|
+
return { endpoint }
|
|
171
|
+
}
|
|
172
|
+
const name = properties.get('name').pipe((v) => v.ifDefined()?.toString().getValue()) ?? 'NULL'
|
|
173
|
+
return { name }
|
|
174
|
+
},
|
|
165
175
|
relationships: SOURCE_ARTIFACT_RELATIONSHIPS,
|
|
166
176
|
async toShape(record, { descendants, fs, project, config, logger, diagnostics }) {
|
|
167
177
|
const shapeWithSourceArtifacts = await getShapeWithSourceArtifacts(record, descendants, {
|
|
@@ -178,6 +188,11 @@ export const UiPagePlugin = Plugin.create({
|
|
|
178
188
|
}
|
|
179
189
|
}
|
|
180
190
|
|
|
191
|
+
// For global scope, endpoint is empty in the DB — synthesize from name
|
|
192
|
+
const endpointValue = record.get('endpoint').toString().getValue()
|
|
193
|
+
const nameValue = record.get('name').toString().getValue()
|
|
194
|
+
const effectiveEndpoint = endpointValue || (nameValue ? `${nameValue}.do` : '')
|
|
195
|
+
|
|
181
196
|
return {
|
|
182
197
|
success: true,
|
|
183
198
|
value: new CallExpressionShape({
|
|
@@ -187,7 +202,7 @@ export const UiPagePlugin = Plugin.create({
|
|
|
187
202
|
record.transform(({ $ }) => ({
|
|
188
203
|
$id: $.val(NowIdShape.from(record)),
|
|
189
204
|
category: $.def(''),
|
|
190
|
-
endpoint:
|
|
205
|
+
endpoint: $.val(effectiveEndpoint).def(''),
|
|
191
206
|
description: $.def(''),
|
|
192
207
|
direct: $.toBoolean().def(false),
|
|
193
208
|
html: $.def(''),
|
|
@@ -200,7 +215,7 @@ export const UiPagePlugin = Plugin.create({
|
|
|
200
215
|
},
|
|
201
216
|
|
|
202
217
|
async toFile(uiPage, { config, descendants, transform }) {
|
|
203
|
-
if (!uiPage.has('endpoint')) {
|
|
218
|
+
if (!uiPage.has('endpoint') && !uiPage.has('name')) {
|
|
204
219
|
return { success: false }
|
|
205
220
|
}
|
|
206
221
|
|
|
@@ -324,11 +339,20 @@ export const UiPagePlugin = Plugin.create({
|
|
|
324
339
|
const arg = callExpression.getArgument(0).asObject()
|
|
325
340
|
const endpoint = arg.get('endpoint').asString()
|
|
326
341
|
const scope = config.scope
|
|
327
|
-
|
|
342
|
+
const isGlobalScope = scope === 'global'
|
|
343
|
+
if (!isGlobalScope && !isSNScope(scope) && !endpoint.getValue().startsWith(`${scope}_`)) {
|
|
328
344
|
diagnostics.error(endpoint.getOriginalNode(), `endpoint must begin with '${scope}_'`)
|
|
329
345
|
return { success: false }
|
|
330
346
|
}
|
|
331
|
-
|
|
347
|
+
// For global scope, name is the endpoint without .do (e.g., 'my-page.do' → 'my-page')
|
|
348
|
+
// For scoped, strip scope prefix and .do (e.g., 'x_test_boats.do' → 'boats')
|
|
349
|
+
const name = isGlobalScope
|
|
350
|
+
? endpoint.getValue().replace(/\.do$/, '')
|
|
351
|
+
: endpoint.getValue().replace(`${scope}_`, '').replace(/\.do$/, '')
|
|
352
|
+
if (!name) {
|
|
353
|
+
diagnostics.error(endpoint.getOriginalNode(), 'endpoint must include a page name before .do')
|
|
354
|
+
return { success: false }
|
|
355
|
+
}
|
|
332
356
|
let html = arg.get('html').toString().getValue()
|
|
333
357
|
let sourceFilePaths: string[] = []
|
|
334
358
|
let assetNames: string[] = []
|
|
@@ -383,7 +407,7 @@ export const UiPagePlugin = Plugin.create({
|
|
|
383
407
|
explicitId: arg.get('$id'),
|
|
384
408
|
properties: arg.transform(({ $ }) => ({
|
|
385
409
|
name: $.val(name),
|
|
386
|
-
endpoint: $.val(endpoint),
|
|
410
|
+
endpoint: $.val(isGlobalScope ? '' : endpoint),
|
|
387
411
|
description: $,
|
|
388
412
|
direct: $.def(false),
|
|
389
413
|
category: $,
|
|
@@ -574,6 +598,8 @@ async function getShapeWithSourceArtifacts(
|
|
|
574
598
|
|
|
575
599
|
if (htmlFileRelativePath && !context.project.isInFluentDir(originalFilePath)) {
|
|
576
600
|
const endpoint = uiPageRecord.get('endpoint').toString().getValue()
|
|
601
|
+
const pageName = uiPageRecord.get('name').toString().getValue()
|
|
602
|
+
const effectiveEndpoint = endpoint || (pageName ? `${pageName}.do` : '')
|
|
577
603
|
const description = uiPageRecord.get('description').toString().getValue()
|
|
578
604
|
const category = uiPageRecord.get('category').toString().getValue()
|
|
579
605
|
const direct = uiPageRecord.get('direct').toString().getValue()
|
|
@@ -587,7 +613,7 @@ async function getShapeWithSourceArtifacts(
|
|
|
587
613
|
|
|
588
614
|
UiPage({
|
|
589
615
|
$id: Now.ID['${uiPageRecord.getId().getValue()}'],
|
|
590
|
-
endpoint: ${JSON.stringify(
|
|
616
|
+
endpoint: ${JSON.stringify(effectiveEndpoint)},
|
|
591
617
|
description: ${JSON.stringify(description)},
|
|
592
618
|
category: ${JSON.stringify(category)},
|
|
593
619
|
direct: ${direct},
|
|
@@ -596,7 +622,7 @@ async function getShapeWithSourceArtifacts(
|
|
|
596
622
|
processingScript: ${JSON.stringify(processingScript)},
|
|
597
623
|
})
|
|
598
624
|
`
|
|
599
|
-
const newFileName =
|
|
625
|
+
const newFileName = effectiveEndpoint.replace('.do', '.now.ts')
|
|
600
626
|
const sourceFileShape = new SourceFileShape({
|
|
601
627
|
source: uiPageRecord,
|
|
602
628
|
path: `${path.join(fluentFileDirByTaxonomy, newFileName)}`,
|
package/src/ui-policy-plugin.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type Record,
|
|
9
9
|
type Shape,
|
|
10
10
|
} from '@servicenow/sdk-build-core'
|
|
11
|
-
import { validateClientSideScript } from './utils'
|
|
11
|
+
import { createSdkDocEntry, validateClientSideScript } from './utils'
|
|
12
12
|
import { NowIdShape } from './now-id-plugin'
|
|
13
13
|
|
|
14
14
|
// Define table names as constants since they're not exported from the core tables
|
|
@@ -93,6 +93,7 @@ const validateScriptProperty = (
|
|
|
93
93
|
|
|
94
94
|
export const UiPolicyPlugin = Plugin.create({
|
|
95
95
|
name: 'UiPolicyPlugin',
|
|
96
|
+
docs: [createSdkDocEntry('UiPolicy', ['sys_ui_policy'])],
|
|
96
97
|
records: {
|
|
97
98
|
[SYS_UI_POLICY]: {
|
|
98
99
|
coalesce: ['table', 'short_description'],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
+
import { createSdkDocEntry } from './utils'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a User Preference (sys_user_preference).
|
|
@@ -16,6 +17,7 @@ import { NowIdShape } from './now-id-plugin'
|
|
|
16
17
|
*/
|
|
17
18
|
export const UserPreferencePlugin = Plugin.create({
|
|
18
19
|
name: 'UserPreferencePlugin',
|
|
20
|
+
docs: [createSdkDocEntry('UserPreference', ['sys_user_preference'])],
|
|
19
21
|
records: {
|
|
20
22
|
sys_user_preference: {
|
|
21
23
|
toShape(record) {
|
package/src/utils.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type Diagnostics,
|
|
6
6
|
type Compiler,
|
|
7
7
|
type PluginApiDoc,
|
|
8
|
+
type Record as FluentRecord,
|
|
8
9
|
} from '@servicenow/sdk-build-core'
|
|
9
10
|
|
|
10
11
|
export function toReference(shape: Shape) {
|
|
@@ -101,9 +102,36 @@ export function validateClientSideScript(script: string, compiler: Compiler): bo
|
|
|
101
102
|
return isValid
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Shows a diagnostic error when a field expects a valid GUID but receives an invalid value.
|
|
107
|
+
*
|
|
108
|
+
* @param inputReceived - The shape containing the invalid value
|
|
109
|
+
* @param fieldName - Name of the field being validated (e.g., 'annotationId', 'formatterRef')
|
|
110
|
+
* @param tableName - ServiceNow table name for the expected reference (e.g., 'sys_ui_annotation')
|
|
111
|
+
* @param diagnostics - Diagnostics collection to add the error to
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* if (!isGUID(annotationSysId)) {
|
|
115
|
+
* showGuidFieldDiagnostic(annotationIdField, 'annotationId', 'sys_ui_annotation', diagnostics)
|
|
116
|
+
* }
|
|
117
|
+
*/
|
|
118
|
+
export const showGuidFieldDiagnostic = (
|
|
119
|
+
inputReceived: Shape | undefined,
|
|
120
|
+
fieldName: string,
|
|
121
|
+
tableName: string,
|
|
122
|
+
diagnostics: Diagnostics
|
|
123
|
+
) => {
|
|
124
|
+
if (inputReceived) {
|
|
125
|
+
const receivedValue = inputReceived.getValue()
|
|
126
|
+
diagnostics.error(
|
|
127
|
+
inputReceived,
|
|
128
|
+
`'${fieldName}' must be a valid GUID or a Record<'${tableName}'>. Received: '${receivedValue}'`
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
104
133
|
/**
|
|
105
134
|
* Creates a documentation entry for first-party SDK plugins.
|
|
106
|
-
* Using this helper ensures apiName and docPath are always in sync.
|
|
107
135
|
*
|
|
108
136
|
* @param apiName - The API name (e.g., 'BusinessRule', 'Acl')
|
|
109
137
|
* @param tags - Keywords for categorization (typically includes the ServiceNow table name)
|
|
@@ -112,7 +140,19 @@ export function validateClientSideScript(script: string, compiler: Compiler): bo
|
|
|
112
140
|
export function createSdkDocEntry(apiName: string, tags: string[]): PluginApiDoc {
|
|
113
141
|
return {
|
|
114
142
|
apiName,
|
|
115
|
-
docPath: `@servicenow/sdk/docs/${apiName}/${apiName}.md`,
|
|
116
143
|
tags,
|
|
117
144
|
}
|
|
118
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Parses a number from a shape record field with fallback to default value.
|
|
149
|
+
* Returns undefined if the field doesn't exist and no default is provided.
|
|
150
|
+
*/
|
|
151
|
+
export function getFieldAsNumber(shape: FluentRecord, fieldName: string, defaultValue?: number): number | undefined {
|
|
152
|
+
const rawValue = shape.get(fieldName)?.getValue()
|
|
153
|
+
if (rawValue === undefined || rawValue === null || rawValue === '') {
|
|
154
|
+
return defaultValue
|
|
155
|
+
}
|
|
156
|
+
const parsed = Number(rawValue)
|
|
157
|
+
return Number.isNaN(parsed) ? defaultValue : parsed
|
|
158
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Plugin, CallExpressionShape, type Record } from '@servicenow/sdk-build-core'
|
|
2
2
|
|
|
3
3
|
import { NowIdShape } from './now-id-plugin'
|
|
4
|
+
import { createSdkDocEntry } from './utils'
|
|
4
5
|
|
|
5
6
|
export const UxListMenuConfigPlugin = Plugin.create({
|
|
6
7
|
name: 'UxListMenuConfigPlugin',
|
|
8
|
+
docs: [createSdkDocEntry('UxListMenuConfig', ['sys_ux_list_menu_config'])],
|
|
7
9
|
records: {
|
|
8
10
|
sys_ux_list_menu_config: {
|
|
9
11
|
relationships: {
|
package/src/view-plugin.ts
CHANGED
package/src/workspace-plugin.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type ObjectShape,
|
|
8
8
|
} from '@servicenow/sdk-build-core'
|
|
9
9
|
import { NowIdShape } from './now-id-plugin'
|
|
10
|
+
import { createSdkDocEntry } from './utils'
|
|
10
11
|
import { parsePagePropChromeTabJson, createChromeTabJsonStringForPageProp } from './workspace-plugin/chrome-tab'
|
|
11
12
|
import { createPage } from './workspace-plugin/page'
|
|
12
13
|
import {
|
|
@@ -41,6 +42,7 @@ type InnerTransformFromObjectShape = Parameters<Parameters<ObjectShape['transfor
|
|
|
41
42
|
|
|
42
43
|
export const WorkspacePlugin = Plugin.create({
|
|
43
44
|
name: 'WorkspacePlugin',
|
|
45
|
+
docs: [createSdkDocEntry('Workspace', ['sys_ux_page_registry'])],
|
|
44
46
|
records: {
|
|
45
47
|
sys_ux_page_registry: {
|
|
46
48
|
relationships: {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare module 'eslint-plugin-es-x/lib/rules/no-dynamic-import.js' {
|
|
2
|
-
import type { Rule } from 'eslint'
|
|
3
|
-
const rule: Rule.RuleModule
|
|
4
|
-
export default rule
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
declare module 'eslint-plugin-es-x/lib/rules/no-regexp-lookbehind-assertions.js' {
|
|
8
|
-
import type { Rule } from 'eslint'
|
|
9
|
-
const rule: Rule.RuleModule
|
|
10
|
-
export default rule
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare module 'eslint-plugin-es-x/lib/rules/no-regexp-unicode-property-escapes.js' {
|
|
14
|
-
import type { Rule } from 'eslint'
|
|
15
|
-
const rule: Rule.RuleModule
|
|
16
|
-
export default rule
|
|
17
|
-
}
|