@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.
Files changed (287) hide show
  1. package/dist/acl-plugin.js +54 -4
  2. package/dist/acl-plugin.js.map +1 -1
  3. package/dist/applicability-plugin.js +2 -0
  4. package/dist/applicability-plugin.js.map +1 -1
  5. package/dist/application-menu-plugin.js +2 -0
  6. package/dist/application-menu-plugin.js.map +1 -1
  7. package/dist/arrow-function-plugin.d.ts +6 -1
  8. package/dist/arrow-function-plugin.js +105 -12
  9. package/dist/arrow-function-plugin.js.map +1 -1
  10. package/dist/atf/test-plugin.js +2 -0
  11. package/dist/atf/test-plugin.js.map +1 -1
  12. package/dist/basic-syntax-plugin.js +20 -0
  13. package/dist/basic-syntax-plugin.js.map +1 -1
  14. package/dist/call-expression-plugin.js +1 -0
  15. package/dist/call-expression-plugin.js.map +1 -1
  16. package/dist/claims-plugin.js +1 -0
  17. package/dist/claims-plugin.js.map +1 -1
  18. package/dist/client-script-plugin.js +1 -0
  19. package/dist/client-script-plugin.js.map +1 -1
  20. package/dist/column-plugin.js +1 -0
  21. package/dist/column-plugin.js.map +1 -1
  22. package/dist/cross-scope-privilege-plugin.js +1 -0
  23. package/dist/cross-scope-privilege-plugin.js.map +1 -1
  24. package/dist/dashboard/dashboard-plugin.js +2 -0
  25. package/dist/dashboard/dashboard-plugin.js.map +1 -1
  26. package/dist/data-plugin.js +1 -0
  27. package/dist/data-plugin.js.map +1 -1
  28. package/dist/email-notification-plugin.js +9 -13
  29. package/dist/email-notification-plugin.js.map +1 -1
  30. package/dist/flow/constants/flow-plugin-constants.d.ts +1 -1
  31. package/dist/flow/constants/flow-plugin-constants.js +1 -1
  32. package/dist/flow/constants/flow-plugin-constants.js.map +1 -1
  33. package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +82 -2
  34. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +48 -40
  35. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
  36. package/dist/flow/flow-logic/flow-logic-plugin.js +1 -0
  37. package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
  38. package/dist/flow/plugins/approval-rules-plugin.js +1 -0
  39. package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
  40. package/dist/flow/plugins/flow-action-definition-plugin.js +4 -2
  41. package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
  42. package/dist/flow/plugins/flow-data-pill-plugin.js +1 -0
  43. package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
  44. package/dist/flow/plugins/flow-definition-plugin.js +8 -3
  45. package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
  46. package/dist/flow/plugins/flow-diagnostics-plugin.js +1 -0
  47. package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
  48. package/dist/flow/plugins/flow-instance-plugin.js +68 -12
  49. package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
  50. package/dist/flow/plugins/flow-trigger-instance-plugin.js +1 -0
  51. package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
  52. package/dist/flow/plugins/inline-script-plugin.js +1 -0
  53. package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
  54. package/dist/flow/plugins/step-definition-plugin.js +3 -2
  55. package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
  56. package/dist/flow/plugins/step-instance-plugin.js +1 -0
  57. package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
  58. package/dist/flow/plugins/trigger-plugin.js +2 -0
  59. package/dist/flow/plugins/trigger-plugin.js.map +1 -1
  60. package/dist/flow/plugins/wfa-datapill-plugin.js +1 -0
  61. package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
  62. package/dist/flow/post-install.d.ts +2 -0
  63. package/dist/flow/post-install.js +58 -0
  64. package/dist/flow/post-install.js.map +1 -0
  65. package/dist/flow/utils/complex-objects.js +4 -2
  66. package/dist/flow/utils/complex-objects.js.map +1 -1
  67. package/dist/flow/utils/flow-constants.d.ts +24 -0
  68. package/dist/flow/utils/flow-constants.js +29 -2
  69. package/dist/flow/utils/flow-constants.js.map +1 -1
  70. package/dist/flow/utils/flow-to-xml.d.ts +3 -2
  71. package/dist/flow/utils/flow-to-xml.js +3 -4
  72. package/dist/flow/utils/flow-to-xml.js.map +1 -1
  73. package/dist/flow/utils/label-cache-processor.d.ts +5 -0
  74. package/dist/flow/utils/label-cache-processor.js +14 -2
  75. package/dist/flow/utils/label-cache-processor.js.map +1 -1
  76. package/dist/flow/utils/service-catalog.js +5 -1
  77. package/dist/flow/utils/service-catalog.js.map +1 -1
  78. package/dist/form-plugin.d.ts +2 -0
  79. package/dist/form-plugin.js +1134 -0
  80. package/dist/form-plugin.js.map +1 -0
  81. package/dist/html-import-plugin.js +1 -0
  82. package/dist/html-import-plugin.js.map +1 -1
  83. package/dist/import-sets-plugin.js +2 -0
  84. package/dist/import-sets-plugin.js.map +1 -1
  85. package/dist/index.d.ts +9 -0
  86. package/dist/index.js +13 -1
  87. package/dist/index.js.map +1 -1
  88. package/dist/instance-scan-plugin.d.ts +2 -0
  89. package/dist/instance-scan-plugin.js +298 -0
  90. package/dist/instance-scan-plugin.js.map +1 -0
  91. package/dist/json-plugin.js +1 -0
  92. package/dist/json-plugin.js.map +1 -1
  93. package/dist/list-plugin.js +1 -0
  94. package/dist/list-plugin.js.map +1 -1
  95. package/dist/now-attach-plugin.js +1 -0
  96. package/dist/now-attach-plugin.js.map +1 -1
  97. package/dist/now-config-plugin.js +659 -51
  98. package/dist/now-config-plugin.js.map +1 -1
  99. package/dist/now-id-plugin.js +1 -0
  100. package/dist/now-id-plugin.js.map +1 -1
  101. package/dist/now-include-plugin.js +1 -0
  102. package/dist/now-include-plugin.js.map +1 -1
  103. package/dist/now-ref-plugin.js +1 -0
  104. package/dist/now-ref-plugin.js.map +1 -1
  105. package/dist/now-unresolved-plugin.js +1 -0
  106. package/dist/now-unresolved-plugin.js.map +1 -1
  107. package/dist/package-json-plugin.js +1 -0
  108. package/dist/package-json-plugin.js.map +1 -1
  109. package/dist/property-plugin.js +3 -1
  110. package/dist/property-plugin.js.map +1 -1
  111. package/dist/record-plugin.d.ts +30 -0
  112. package/dist/record-plugin.js +37 -1
  113. package/dist/record-plugin.js.map +1 -1
  114. package/dist/repack/lint/Rules.d.ts +11 -2
  115. package/dist/repack/lint/Rules.js +160 -16
  116. package/dist/repack/lint/Rules.js.map +1 -1
  117. package/dist/repack/lint/index.d.ts +10 -5
  118. package/dist/repack/lint/index.js +76 -50
  119. package/dist/repack/lint/index.js.map +1 -1
  120. package/dist/rest-api-plugin.js +14 -0
  121. package/dist/rest-api-plugin.js.map +1 -1
  122. package/dist/role-plugin.js +1 -0
  123. package/dist/role-plugin.js.map +1 -1
  124. package/dist/schedule-script/index.d.ts +1 -0
  125. package/dist/schedule-script/index.js +18 -0
  126. package/dist/schedule-script/index.js.map +1 -0
  127. package/dist/schedule-script/scheduled-script-plugin.d.ts +2 -0
  128. package/dist/schedule-script/scheduled-script-plugin.js +551 -0
  129. package/dist/schedule-script/scheduled-script-plugin.js.map +1 -0
  130. package/dist/schedule-script/timeZoneConverter.d.ts +61 -0
  131. package/dist/schedule-script/timeZoneConverter.js +170 -0
  132. package/dist/schedule-script/timeZoneConverter.js.map +1 -0
  133. package/dist/script-action-plugin.js +2 -0
  134. package/dist/script-action-plugin.js.map +1 -1
  135. package/dist/script-include-plugin.js +2 -0
  136. package/dist/script-include-plugin.js.map +1 -1
  137. package/dist/server-module-plugin/index.js +13 -2
  138. package/dist/server-module-plugin/index.js.map +1 -1
  139. package/dist/service-catalog/catalog-clientscript-plugin.js +2 -0
  140. package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
  141. package/dist/service-catalog/catalog-item-plugin.js +2 -0
  142. package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
  143. package/dist/service-catalog/catalog-ui-policy-plugin.js +2 -0
  144. package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
  145. package/dist/service-catalog/sc-record-producer-plugin.js +2 -0
  146. package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
  147. package/dist/service-catalog/service-catalog-diagnostics.d.ts +6 -0
  148. package/dist/service-catalog/service-catalog-diagnostics.js +20 -0
  149. package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -1
  150. package/dist/service-catalog/shape-to-record.js +7 -2
  151. package/dist/service-catalog/shape-to-record.js.map +1 -1
  152. package/dist/service-catalog/variable-set-plugin.js +2 -0
  153. package/dist/service-catalog/variable-set-plugin.js.map +1 -1
  154. package/dist/service-portal/angular-provider-plugin.js +2 -0
  155. package/dist/service-portal/angular-provider-plugin.js.map +1 -1
  156. package/dist/service-portal/dependency-plugin.js +5 -31
  157. package/dist/service-portal/dependency-plugin.js.map +1 -1
  158. package/dist/service-portal/menu-plugin.d.ts +2 -0
  159. package/dist/service-portal/menu-plugin.js +353 -0
  160. package/dist/service-portal/menu-plugin.js.map +1 -0
  161. package/dist/service-portal/page-plugin.d.ts +2 -0
  162. package/dist/service-portal/page-plugin.js +702 -0
  163. package/dist/service-portal/page-plugin.js.map +1 -0
  164. package/dist/service-portal/portal-plugin.d.ts +2 -0
  165. package/dist/service-portal/portal-plugin.js +296 -0
  166. package/dist/service-portal/portal-plugin.js.map +1 -0
  167. package/dist/service-portal/theme-plugin.d.ts +2 -0
  168. package/dist/service-portal/theme-plugin.js +112 -0
  169. package/dist/service-portal/theme-plugin.js.map +1 -0
  170. package/dist/service-portal/utils.d.ts +8 -0
  171. package/dist/service-portal/utils.js +50 -0
  172. package/dist/service-portal/utils.js.map +1 -0
  173. package/dist/service-portal/widget-plugin.js +45 -8
  174. package/dist/service-portal/widget-plugin.js.map +1 -1
  175. package/dist/sla-plugin.js +2 -0
  176. package/dist/sla-plugin.js.map +1 -1
  177. package/dist/static-content-plugin.js +1 -0
  178. package/dist/static-content-plugin.js.map +1 -1
  179. package/dist/table-plugin.js +1 -0
  180. package/dist/table-plugin.js.map +1 -1
  181. package/dist/ui-action-plugin.js +2 -0
  182. package/dist/ui-action-plugin.js.map +1 -1
  183. package/dist/ui-page-plugin.js +33 -8
  184. package/dist/ui-page-plugin.js.map +1 -1
  185. package/dist/ui-policy-plugin.js +1 -0
  186. package/dist/ui-policy-plugin.js.map +1 -1
  187. package/dist/user-preference-plugin.js +2 -0
  188. package/dist/user-preference-plugin.js.map +1 -1
  189. package/dist/utils.d.ts +20 -2
  190. package/dist/utils.js +34 -3
  191. package/dist/utils.js.map +1 -1
  192. package/dist/ux-list-menu-config-plugin.js +2 -0
  193. package/dist/ux-list-menu-config-plugin.js.map +1 -1
  194. package/dist/view-plugin.js +1 -0
  195. package/dist/view-plugin.js.map +1 -1
  196. package/dist/workspace-plugin.js +2 -0
  197. package/dist/workspace-plugin.js.map +1 -1
  198. package/package.json +10 -11
  199. package/src/_types/eslint-community-eslint-utils.d.ts +15 -0
  200. package/src/acl-plugin.ts +97 -8
  201. package/src/applicability-plugin.ts +2 -0
  202. package/src/application-menu-plugin.ts +2 -0
  203. package/src/arrow-function-plugin.ts +128 -13
  204. package/src/atf/test-plugin.ts +2 -0
  205. package/src/basic-syntax-plugin.ts +21 -0
  206. package/src/call-expression-plugin.ts +1 -0
  207. package/src/claims-plugin.ts +1 -0
  208. package/src/client-script-plugin.ts +2 -1
  209. package/src/column-plugin.ts +1 -0
  210. package/src/cross-scope-privilege-plugin.ts +2 -1
  211. package/src/dashboard/dashboard-plugin.ts +2 -0
  212. package/src/data-plugin.ts +1 -0
  213. package/src/email-notification-plugin.ts +3 -23
  214. package/src/flow/constants/flow-plugin-constants.ts +1 -1
  215. package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +47 -45
  216. package/src/flow/flow-logic/flow-logic-plugin.ts +1 -0
  217. package/src/flow/plugins/approval-rules-plugin.ts +1 -0
  218. package/src/flow/plugins/flow-action-definition-plugin.ts +4 -2
  219. package/src/flow/plugins/flow-data-pill-plugin.ts +1 -0
  220. package/src/flow/plugins/flow-definition-plugin.ts +10 -4
  221. package/src/flow/plugins/flow-diagnostics-plugin.ts +1 -0
  222. package/src/flow/plugins/flow-instance-plugin.ts +103 -14
  223. package/src/flow/plugins/flow-trigger-instance-plugin.ts +1 -0
  224. package/src/flow/plugins/inline-script-plugin.ts +1 -0
  225. package/src/flow/plugins/step-definition-plugin.ts +3 -2
  226. package/src/flow/plugins/step-instance-plugin.ts +1 -0
  227. package/src/flow/plugins/trigger-plugin.ts +2 -0
  228. package/src/flow/plugins/wfa-datapill-plugin.ts +1 -0
  229. package/src/flow/post-install.ts +92 -0
  230. package/src/flow/utils/complex-objects.ts +10 -2
  231. package/src/flow/utils/flow-constants.ts +30 -1
  232. package/src/flow/utils/flow-to-xml.ts +4 -4
  233. package/src/flow/utils/label-cache-processor.ts +14 -2
  234. package/src/flow/utils/service-catalog.ts +5 -2
  235. package/src/form-plugin.ts +1411 -0
  236. package/src/html-import-plugin.ts +1 -0
  237. package/src/import-sets-plugin.ts +2 -0
  238. package/src/index.ts +9 -0
  239. package/src/instance-scan-plugin.ts +318 -0
  240. package/src/json-plugin.ts +1 -0
  241. package/src/list-plugin.ts +2 -1
  242. package/src/now-attach-plugin.ts +1 -0
  243. package/src/now-config-plugin.ts +833 -53
  244. package/src/now-id-plugin.ts +1 -0
  245. package/src/now-include-plugin.ts +1 -0
  246. package/src/now-ref-plugin.ts +1 -0
  247. package/src/now-unresolved-plugin.ts +1 -0
  248. package/src/package-json-plugin.ts +1 -0
  249. package/src/property-plugin.ts +3 -1
  250. package/src/record-plugin.ts +42 -2
  251. package/src/repack/lint/Rules.ts +171 -22
  252. package/src/repack/lint/index.ts +80 -56
  253. package/src/rest-api-plugin.ts +21 -1
  254. package/src/role-plugin.ts +2 -1
  255. package/src/schedule-script/index.ts +1 -0
  256. package/src/schedule-script/scheduled-script-plugin.ts +679 -0
  257. package/src/schedule-script/timeZoneConverter.ts +188 -0
  258. package/src/script-action-plugin.ts +2 -0
  259. package/src/script-include-plugin.ts +2 -0
  260. package/src/server-module-plugin/index.ts +14 -2
  261. package/src/service-catalog/catalog-clientscript-plugin.ts +2 -0
  262. package/src/service-catalog/catalog-item-plugin.ts +2 -0
  263. package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -0
  264. package/src/service-catalog/sc-record-producer-plugin.ts +2 -0
  265. package/src/service-catalog/service-catalog-diagnostics.ts +30 -0
  266. package/src/service-catalog/shape-to-record.ts +8 -2
  267. package/src/service-catalog/variable-set-plugin.ts +2 -0
  268. package/src/service-portal/angular-provider-plugin.ts +2 -0
  269. package/src/service-portal/dependency-plugin.ts +6 -53
  270. package/src/service-portal/menu-plugin.ts +435 -0
  271. package/src/service-portal/page-plugin.ts +830 -0
  272. package/src/service-portal/portal-plugin.ts +319 -0
  273. package/src/service-portal/theme-plugin.ts +135 -0
  274. package/src/service-portal/utils.ts +69 -0
  275. package/src/service-portal/widget-plugin.ts +79 -9
  276. package/src/sla-plugin.ts +2 -0
  277. package/src/static-content-plugin.ts +1 -0
  278. package/src/table-plugin.ts +2 -1
  279. package/src/ui-action-plugin.ts +2 -0
  280. package/src/ui-page-plugin.ts +34 -8
  281. package/src/ui-policy-plugin.ts +2 -1
  282. package/src/user-preference-plugin.ts +2 -0
  283. package/src/utils.ts +42 -2
  284. package/src/ux-list-menu-config-plugin.ts +2 -0
  285. package/src/view-plugin.ts +1 -0
  286. package/src/workspace-plugin.ts +2 -0
  287. 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: {
@@ -91,6 +91,7 @@ const toNoOpShape = (record: Record) => {
91
91
 
92
92
  export const StaticContentPlugin = Plugin.create({
93
93
  name: 'StaticContentPlugin',
94
+ docs: [],
94
95
  records: {
95
96
  // TODO: remove when we have generic attachment support
96
97
  sys_attachment: {
@@ -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$/,
@@ -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: {
@@ -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: ['endpoint'],
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
- if (scope !== 'global' && !isSNScope(scope) && !endpoint.getValue().startsWith(`${scope}_`)) {
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
- const name = endpoint.asString().getValue().replace(`${scope}_`, '').replace(/\.do$/, '')
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(endpoint)},
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 = endpoint.replace('.do', '.now.ts')
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)}`,
@@ -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: {
@@ -2,6 +2,7 @@ import { Plugin, Record, RecordId, Shape } from '@servicenow/sdk-build-core'
2
2
 
3
3
  export const ViewPlugin = Plugin.create({
4
4
  name: 'ViewPlugin',
5
+ docs: [],
5
6
  records: {
6
7
  sys_ui_view: {
7
8
  coalesce: ['name'],
@@ -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
- }