@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.
Files changed (286) hide show
  1. package/dist/acl-plugin.js +3 -4
  2. package/dist/acl-plugin.js.map +1 -1
  3. package/dist/applicability-plugin.js +0 -2
  4. package/dist/applicability-plugin.js.map +1 -1
  5. package/dist/application-menu-plugin.js +0 -2
  6. package/dist/application-menu-plugin.js.map +1 -1
  7. package/dist/arrow-function-plugin.js +0 -1
  8. package/dist/arrow-function-plugin.js.map +1 -1
  9. package/dist/atf/test-plugin.js +6 -10
  10. package/dist/atf/test-plugin.js.map +1 -1
  11. package/dist/basic-syntax-plugin.js +10 -4
  12. package/dist/basic-syntax-plugin.js.map +1 -1
  13. package/dist/business-rule-plugin.js +0 -1
  14. package/dist/business-rule-plugin.js.map +1 -1
  15. package/dist/call-expression-plugin.js +0 -1
  16. package/dist/call-expression-plugin.js.map +1 -1
  17. package/dist/claims-plugin.js +0 -1
  18. package/dist/claims-plugin.js.map +1 -1
  19. package/dist/client-script-plugin.js +0 -1
  20. package/dist/client-script-plugin.js.map +1 -1
  21. package/dist/column-plugin.js +120 -49
  22. package/dist/column-plugin.js.map +1 -1
  23. package/dist/cross-scope-privilege-plugin.js +0 -1
  24. package/dist/cross-scope-privilege-plugin.js.map +1 -1
  25. package/dist/dashboard/dashboard-plugin.js +0 -2
  26. package/dist/dashboard/dashboard-plugin.js.map +1 -1
  27. package/dist/data-plugin.js +0 -1
  28. package/dist/data-plugin.js.map +1 -1
  29. package/dist/data-policy-plugin.d.ts +2 -0
  30. package/dist/data-policy-plugin.js +276 -0
  31. package/dist/data-policy-plugin.js.map +1 -0
  32. package/dist/email-notification-plugin.js +2 -3
  33. package/dist/email-notification-plugin.js.map +1 -1
  34. package/dist/flow/flow-logic/flow-logic-constants.d.ts +2 -0
  35. package/dist/flow/flow-logic/flow-logic-constants.js +6 -1
  36. package/dist/flow/flow-logic/flow-logic-constants.js.map +1 -1
  37. package/dist/flow/flow-logic/flow-logic-diagnostics.js +192 -56
  38. package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -1
  39. package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +2 -1
  40. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +44 -5
  41. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
  42. package/dist/flow/flow-logic/flow-logic-plugin.js +279 -29
  43. package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
  44. package/dist/flow/flow-logic/flow-logic-shapes.d.ts +15 -0
  45. package/dist/flow/flow-logic/flow-logic-shapes.js +25 -1
  46. package/dist/flow/flow-logic/flow-logic-shapes.js.map +1 -1
  47. package/dist/flow/plugins/approval-rules-plugin.js +0 -1
  48. package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
  49. package/dist/flow/plugins/flow-action-definition-plugin.js +804 -205
  50. package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
  51. package/dist/flow/plugins/flow-data-pill-plugin.js +3 -5
  52. package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
  53. package/dist/flow/plugins/flow-definition-plugin.js +84 -17
  54. package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
  55. package/dist/flow/plugins/flow-diagnostics-plugin.js +65 -3
  56. package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
  57. package/dist/flow/plugins/flow-instance-plugin.js +13 -5
  58. package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
  59. package/dist/flow/plugins/flow-trigger-instance-plugin.js +0 -1
  60. package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
  61. package/dist/flow/plugins/inline-script-plugin.js +0 -1
  62. package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
  63. package/dist/flow/plugins/step-definition-plugin.js +0 -2
  64. package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
  65. package/dist/flow/plugins/step-instance-plugin.js +216 -77
  66. package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
  67. package/dist/flow/plugins/trigger-plugin.js +0 -2
  68. package/dist/flow/plugins/trigger-plugin.js.map +1 -1
  69. package/dist/flow/plugins/wfa-datapill-plugin.js +0 -1
  70. package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
  71. package/dist/flow/utils/datapill-transformer.js +9 -5
  72. package/dist/flow/utils/datapill-transformer.js.map +1 -1
  73. package/dist/flow/utils/flow-constants.d.ts +12 -0
  74. package/dist/flow/utils/flow-constants.js +17 -3
  75. package/dist/flow/utils/flow-constants.js.map +1 -1
  76. package/dist/flow/utils/flow-io-to-record.d.ts +1 -1
  77. package/dist/flow/utils/flow-io-to-record.js +21 -13
  78. package/dist/flow/utils/flow-io-to-record.js.map +1 -1
  79. package/dist/flow/utils/flow-pill-utils.d.ts +26 -0
  80. package/dist/flow/utils/flow-pill-utils.js +50 -0
  81. package/dist/flow/utils/flow-pill-utils.js.map +1 -0
  82. package/dist/flow/utils/flow-stage-processor.d.ts +138 -0
  83. package/dist/flow/utils/flow-stage-processor.js +665 -0
  84. package/dist/flow/utils/flow-stage-processor.js.map +1 -0
  85. package/dist/flow/utils/pill-string-parser.js +28 -43
  86. package/dist/flow/utils/pill-string-parser.js.map +1 -1
  87. package/dist/flow/utils/utils.d.ts +11 -6
  88. package/dist/flow/utils/utils.js +37 -28
  89. package/dist/flow/utils/utils.js.map +1 -1
  90. package/dist/form-plugin.js +4 -14
  91. package/dist/form-plugin.js.map +1 -1
  92. package/dist/html-import-plugin.js +0 -1
  93. package/dist/html-import-plugin.js.map +1 -1
  94. package/dist/import-sets-plugin.js +0 -2
  95. package/dist/import-sets-plugin.js.map +1 -1
  96. package/dist/inbound-email-action-plugin.js +0 -1
  97. package/dist/inbound-email-action-plugin.js.map +1 -1
  98. package/dist/index.d.ts +2 -1
  99. package/dist/index.js +5 -1
  100. package/dist/index.js.map +1 -1
  101. package/dist/instance-scan-plugin.js +0 -7
  102. package/dist/instance-scan-plugin.js.map +1 -1
  103. package/dist/json-plugin.js +0 -1
  104. package/dist/json-plugin.js.map +1 -1
  105. package/dist/list-plugin.js +4 -1
  106. package/dist/list-plugin.js.map +1 -1
  107. package/dist/now-attach-plugin.js +0 -1
  108. package/dist/now-attach-plugin.js.map +1 -1
  109. package/dist/now-config-plugin.js +1 -1
  110. package/dist/now-config-plugin.js.map +1 -1
  111. package/dist/now-id-plugin.js +0 -1
  112. package/dist/now-id-plugin.js.map +1 -1
  113. package/dist/now-include-plugin.js +0 -1
  114. package/dist/now-include-plugin.js.map +1 -1
  115. package/dist/now-ref-plugin.js +0 -1
  116. package/dist/now-ref-plugin.js.map +1 -1
  117. package/dist/now-unresolved-plugin.js +0 -1
  118. package/dist/now-unresolved-plugin.js.map +1 -1
  119. package/dist/package-json-plugin.js +3 -2
  120. package/dist/package-json-plugin.js.map +1 -1
  121. package/dist/property-plugin.js +0 -2
  122. package/dist/property-plugin.js.map +1 -1
  123. package/dist/record-plugin.d.ts +2 -0
  124. package/dist/record-plugin.js +5 -4
  125. package/dist/record-plugin.js.map +1 -1
  126. package/dist/repack/lint/Rules.d.ts +1 -2
  127. package/dist/rest-api-plugin.js +6 -5
  128. package/dist/rest-api-plugin.js.map +1 -1
  129. package/dist/role-plugin.js +0 -1
  130. package/dist/role-plugin.js.map +1 -1
  131. package/dist/schedule-script/scheduled-script-plugin.js +5 -4
  132. package/dist/schedule-script/scheduled-script-plugin.js.map +1 -1
  133. package/dist/script-action-plugin.js +0 -2
  134. package/dist/script-action-plugin.js.map +1 -1
  135. package/dist/script-include-plugin.js +4 -4
  136. package/dist/script-include-plugin.js.map +1 -1
  137. package/dist/server-module-plugin/index.js +2 -3
  138. package/dist/server-module-plugin/index.js.map +1 -1
  139. package/dist/service-catalog/catalog-clientscript-plugin.js +2 -4
  140. package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
  141. package/dist/service-catalog/catalog-item-plugin.js +0 -2
  142. package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
  143. package/dist/service-catalog/catalog-ui-policy-plugin.js +2 -4
  144. package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
  145. package/dist/service-catalog/sc-record-producer-plugin.js +0 -2
  146. package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
  147. package/dist/service-catalog/service-catalog-base.d.ts +2 -2
  148. package/dist/service-catalog/service-catalog-base.js +2 -2
  149. package/dist/service-catalog/service-catalog-base.js.map +1 -1
  150. package/dist/service-catalog/utils.js +1 -1
  151. package/dist/service-catalog/utils.js.map +1 -1
  152. package/dist/service-catalog/variable-set-plugin.js +0 -2
  153. package/dist/service-catalog/variable-set-plugin.js.map +1 -1
  154. package/dist/service-portal/angular-provider-plugin.js +0 -2
  155. package/dist/service-portal/angular-provider-plugin.js.map +1 -1
  156. package/dist/service-portal/dependency-plugin.js +3 -5
  157. package/dist/service-portal/dependency-plugin.js.map +1 -1
  158. package/dist/service-portal/header-footer-plugin.js +3 -5
  159. package/dist/service-portal/header-footer-plugin.js.map +1 -1
  160. package/dist/service-portal/menu-plugin.js +0 -1
  161. package/dist/service-portal/menu-plugin.js.map +1 -1
  162. package/dist/service-portal/page-plugin.js +0 -1
  163. package/dist/service-portal/page-plugin.js.map +1 -1
  164. package/dist/service-portal/page-route-map-plugin.js +0 -1
  165. package/dist/service-portal/page-route-map-plugin.js.map +1 -1
  166. package/dist/service-portal/portal-plugin.js +0 -2
  167. package/dist/service-portal/portal-plugin.js.map +1 -1
  168. package/dist/service-portal/theme-plugin.js +0 -2
  169. package/dist/service-portal/theme-plugin.js.map +1 -1
  170. package/dist/service-portal/widget-plugin.js +3 -5
  171. package/dist/service-portal/widget-plugin.js.map +1 -1
  172. package/dist/sla-plugin.js +0 -2
  173. package/dist/sla-plugin.js.map +1 -1
  174. package/dist/static-content-plugin.js +32 -3
  175. package/dist/static-content-plugin.js.map +1 -1
  176. package/dist/table-plugin.js +303 -66
  177. package/dist/table-plugin.js.map +1 -1
  178. package/dist/ui-action-plugin.js +26 -17
  179. package/dist/ui-action-plugin.js.map +1 -1
  180. package/dist/ui-page-plugin.js +159 -17
  181. package/dist/ui-page-plugin.js.map +1 -1
  182. package/dist/ui-policy-plugin.js +28 -97
  183. package/dist/ui-policy-plugin.js.map +1 -1
  184. package/dist/user-preference-plugin.js +0 -2
  185. package/dist/user-preference-plugin.js.map +1 -1
  186. package/dist/utils.d.ts +5 -9
  187. package/dist/utils.js +38 -11
  188. package/dist/utils.js.map +1 -1
  189. package/dist/ux-list-menu-config-plugin.js +0 -2
  190. package/dist/ux-list-menu-config-plugin.js.map +1 -1
  191. package/dist/view-plugin.js +0 -1
  192. package/dist/view-plugin.js.map +1 -1
  193. package/dist/workspace-plugin.js +0 -2
  194. package/dist/workspace-plugin.js.map +1 -1
  195. package/package.json +6 -6
  196. package/src/acl-plugin.ts +4 -5
  197. package/src/applicability-plugin.ts +0 -2
  198. package/src/application-menu-plugin.ts +0 -2
  199. package/src/arrow-function-plugin.ts +0 -1
  200. package/src/atf/test-plugin.ts +6 -11
  201. package/src/basic-syntax-plugin.ts +11 -4
  202. package/src/business-rule-plugin.ts +1 -2
  203. package/src/call-expression-plugin.ts +0 -1
  204. package/src/claims-plugin.ts +0 -1
  205. package/src/client-script-plugin.ts +1 -2
  206. package/src/column-plugin.ts +163 -76
  207. package/src/cross-scope-privilege-plugin.ts +1 -2
  208. package/src/dashboard/dashboard-plugin.ts +0 -2
  209. package/src/data-plugin.ts +0 -1
  210. package/src/data-policy-plugin.ts +333 -0
  211. package/src/email-notification-plugin.ts +8 -4
  212. package/src/flow/flow-logic/flow-logic-constants.ts +6 -0
  213. package/src/flow/flow-logic/flow-logic-diagnostics.ts +236 -58
  214. package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +59 -6
  215. package/src/flow/flow-logic/flow-logic-plugin.ts +368 -38
  216. package/src/flow/flow-logic/flow-logic-shapes.ts +25 -0
  217. package/src/flow/plugins/approval-rules-plugin.ts +0 -1
  218. package/src/flow/plugins/flow-action-definition-plugin.ts +940 -208
  219. package/src/flow/plugins/flow-data-pill-plugin.ts +3 -5
  220. package/src/flow/plugins/flow-definition-plugin.ts +159 -26
  221. package/src/flow/plugins/flow-diagnostics-plugin.ts +89 -3
  222. package/src/flow/plugins/flow-instance-plugin.ts +26 -12
  223. package/src/flow/plugins/flow-trigger-instance-plugin.ts +0 -1
  224. package/src/flow/plugins/inline-script-plugin.ts +0 -1
  225. package/src/flow/plugins/step-definition-plugin.ts +0 -2
  226. package/src/flow/plugins/step-instance-plugin.ts +259 -65
  227. package/src/flow/plugins/trigger-plugin.ts +0 -2
  228. package/src/flow/plugins/wfa-datapill-plugin.ts +0 -1
  229. package/src/flow/utils/datapill-transformer.ts +13 -5
  230. package/src/flow/utils/flow-constants.ts +19 -1
  231. package/src/flow/utils/flow-io-to-record.ts +29 -19
  232. package/src/flow/utils/flow-pill-utils.ts +48 -0
  233. package/src/flow/utils/flow-stage-processor.ts +831 -0
  234. package/src/flow/utils/pill-string-parser.ts +29 -47
  235. package/src/flow/utils/utils.ts +39 -35
  236. package/src/form-plugin.ts +5 -15
  237. package/src/html-import-plugin.ts +0 -1
  238. package/src/import-sets-plugin.ts +0 -2
  239. package/src/inbound-email-action-plugin.ts +1 -2
  240. package/src/index.ts +7 -1
  241. package/src/instance-scan-plugin.ts +0 -7
  242. package/src/json-plugin.ts +0 -1
  243. package/src/list-plugin.ts +6 -2
  244. package/src/now-attach-plugin.ts +0 -1
  245. package/src/now-config-plugin.ts +1 -1
  246. package/src/now-id-plugin.ts +0 -1
  247. package/src/now-include-plugin.ts +0 -1
  248. package/src/now-ref-plugin.ts +0 -1
  249. package/src/now-unresolved-plugin.ts +0 -1
  250. package/src/package-json-plugin.ts +8 -3
  251. package/src/property-plugin.ts +0 -2
  252. package/src/record-plugin.ts +14 -6
  253. package/src/repack/lint/Rules.ts +1 -1
  254. package/src/rest-api-plugin.ts +7 -6
  255. package/src/role-plugin.ts +1 -2
  256. package/src/schedule-script/scheduled-script-plugin.ts +11 -5
  257. package/src/script-action-plugin.ts +0 -2
  258. package/src/script-include-plugin.ts +8 -4
  259. package/src/server-module-plugin/index.ts +2 -3
  260. package/src/service-catalog/catalog-clientscript-plugin.ts +2 -4
  261. package/src/service-catalog/catalog-item-plugin.ts +0 -2
  262. package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -4
  263. package/src/service-catalog/sc-record-producer-plugin.ts +0 -2
  264. package/src/service-catalog/service-catalog-base.ts +2 -2
  265. package/src/service-catalog/utils.ts +1 -1
  266. package/src/service-catalog/variable-set-plugin.ts +0 -2
  267. package/src/service-portal/angular-provider-plugin.ts +0 -2
  268. package/src/service-portal/dependency-plugin.ts +0 -2
  269. package/src/service-portal/header-footer-plugin.ts +0 -2
  270. package/src/service-portal/menu-plugin.ts +1 -2
  271. package/src/service-portal/page-plugin.ts +1 -2
  272. package/src/service-portal/page-route-map-plugin.ts +1 -2
  273. package/src/service-portal/portal-plugin.ts +0 -2
  274. package/src/service-portal/theme-plugin.ts +0 -2
  275. package/src/service-portal/widget-plugin.ts +0 -2
  276. package/src/sla-plugin.ts +0 -2
  277. package/src/static-content-plugin.ts +37 -4
  278. package/src/table-plugin.ts +371 -92
  279. package/src/ui-action-plugin.ts +30 -17
  280. package/src/ui-page-plugin.ts +188 -20
  281. package/src/ui-policy-plugin.ts +33 -130
  282. package/src/user-preference-plugin.ts +0 -2
  283. package/src/utils.ts +48 -11
  284. package/src/ux-list-menu-config-plugin.ts +0 -2
  285. package/src/view-plugin.ts +0 -1
  286. package/src/workspace-plugin.ts +0 -2
@@ -202,76 +202,58 @@ export function createTemplateExpressionFromPillString(
202
202
  allowSchemaReferences: boolean = false
203
203
  ): TemplateExpressionShape | null {
204
204
  const pillRegex = /\{\{[^}]+\}\}/g
205
- const spans: TemplateSpanShape[] = []
206
205
 
207
- let head = ''
208
- let isFirstPill = true
206
+ // Collect all recognized pills with their positions
207
+ const recognizedPills: { propAccess: PropertyAccessShape; matchStart: number; matchEnd: number }[] = []
209
208
  let match: RegExpExecArray | null
210
209
 
211
- // Split template by pills
212
210
  while ((match = pillRegex.exec(templateStr)) !== null) {
213
- // Parse the pill and create PropertyAccessShape
214
211
  const parsed = parseSinglePill(match[0], allowSchemaReferences)
215
-
216
212
  if (!parsed) {
217
- // Don't warn - invalid pills are silently ignored and treated as literals
218
213
  continue
219
214
  }
220
215
 
221
216
  const tsRoot = mapPillPrefixToTsRoot(parsed.prefix, parameterName)
222
-
223
- if (!tsRoot) {
224
- if (isUuidPrefix(parsed.prefix)) {
225
- // UUID-based pill - not supported in Phase 1, silently skip
226
- // (UUID pills will be added in Phase 3)
227
- continue
228
- } else {
229
- // Unknown prefix - silently skip and treat as literal
230
- continue
231
- }
232
- }
233
-
234
- const fullPath = `${tsRoot}.${parsed.path}`
235
- const propAccess = createPropertyAccessFromPath(fullPath, source)
236
-
237
- if (!propAccess) {
238
- // Failed to create shape - silently skip
239
- continue
240
- }
241
-
242
- // First pill: everything before it is the head
243
- if (isFirstPill) {
244
- head = templateStr.substring(0, match.index)
245
- isFirstPill = false
217
+ const fullPath = tsRoot ? (parsed.path === '' ? tsRoot : `${tsRoot}.${parsed.path}`) : null
218
+ const propAccess = fullPath ? createPropertyAccessFromPath(fullPath, source) : null
219
+
220
+ if (propAccess) {
221
+ recognizedPills.push({
222
+ propAccess,
223
+ matchStart: match.index ?? 0,
224
+ matchEnd: (match.index ?? 0) + match[0].length,
225
+ })
246
226
  }
227
+ // Unrecognized pills (step, UUID, unknown prefix) are not collected here.
228
+ // Their raw text is preserved in the literal text segments between recognized pills.
229
+ }
247
230
 
248
- // Text after this pill (until next pill or end of string)
249
- const nextMatchIndex = pillRegex.lastIndex
250
- let literalAfter = ''
231
+ if (recognizedPills.length === 0) {
232
+ return null
233
+ }
251
234
 
252
- // Look ahead to find next pill or use end of string
253
- const remainingStr = templateStr.substring(nextMatchIndex)
254
- const nextPillMatch = remainingStr.match(/\{\{[^}]+\}\}/)
235
+ // Build template: head is text before first pill, each span has expression + text after it
236
+ const firstPillStart = recognizedPills[0]?.matchStart ?? 0
237
+ const head = templateStr.substring(0, firstPillStart)
238
+ const spans: TemplateSpanShape[] = []
255
239
 
256
- if (nextPillMatch) {
257
- literalAfter = remainingStr.substring(0, nextPillMatch.index)
258
- } else {
259
- literalAfter = remainingStr
260
- }
240
+ for (const [i, pill] of recognizedPills.entries()) {
241
+ const nextPill = recognizedPills[i + 1]
242
+ // Literal text after this pill extends to the start of the next recognized pill
243
+ // (or end of string). This preserves raw text of any unrecognized pills in between.
244
+ const literalAfter = nextPill
245
+ ? templateStr.substring(pill.matchEnd, nextPill.matchStart)
246
+ : templateStr.substring(pill.matchEnd)
261
247
 
262
248
  spans.push(
263
249
  new TemplateSpanShape({
264
250
  source,
265
- expression: propAccess,
251
+ expression: pill.propAccess,
266
252
  literalText: literalAfter,
267
253
  })
268
254
  )
269
255
  }
270
256
 
271
- if (spans.length === 0) {
272
- return null // No valid pills found
273
- }
274
-
275
257
  return new TemplateExpressionShape({
276
258
  source,
277
259
  literalText: head,
@@ -13,7 +13,7 @@ import {
13
13
  ts,
14
14
  VariableStatementShape,
15
15
  } from '@servicenow/sdk-build-core'
16
- import { PillShape, PillTemplateShape } from '../utils/data-pill-shapes'
16
+ import { PillShape, PillTemplateShape } from './data-pill-shapes'
17
17
  import { DataPillPlugin } from '../plugins/flow-data-pill-plugin'
18
18
  import { TriggerInstancePlugin } from '../plugins/flow-trigger-instance-plugin'
19
19
  import { CallExpressionPlugin } from '../../call-expression-plugin'
@@ -27,6 +27,7 @@ import {
27
27
  BUILT_IN_STEP_SYS_ID_NAME_MAP,
28
28
  UNSUPPORTED_FLOW_DESCENDANTS,
29
29
  } from './flow-constants'
30
+ import { PARALLEL_ORDER_SEPARATOR } from '../constants/flow-plugin-constants'
30
31
 
31
32
  export function sysIdToUuid(id: string): string {
32
33
  return id.length === 32
@@ -293,32 +294,27 @@ export async function resolveDataPillShape(
293
294
  shape: PillShape | PropertyAccessShape | TemplateExpressionShape | IdentifierShape,
294
295
  transform: Transform
295
296
  ): Promise<unknown> {
296
- const mayBePills = await transform.toSubclass(shape, DataPillPlugin)
297
- if (mayBePills.success) {
298
- let processedShape = mayBePills.value
299
-
300
- // Magical code to handle trigger pills :) as they do not follow the same pattern as other pills
301
- // subflow inputs will be {{subflow.<pill-name>}}, flow variable {{flow_variable.<pill-name>}} but for triggers {{Created_1.<pill-name>}}
302
- if (processedShape instanceof PillShape && processedShape.getRootIdentifier() === 'trigger') {
303
- processedShape = await resolveTriggerPills(processedShape, transform)
304
- }
305
- // Magical code to handle PillTemplateShape with trigger pills
306
- else if (processedShape.is(PillTemplateShape)) {
307
- // Process each pill shape in the template
308
- const pillShapes = processedShape.getParts()
309
- const elements = pillShapes.getElements(false)
310
-
311
- for (const shapePart of elements) {
312
- if (shapePart instanceof PillShape && shapePart.getRootIdentifier() === 'trigger') {
313
- await resolveTriggerPills(shapePart, transform) // mutates shapePart
314
- }
297
+ let processedShape = await transform.toSubclass(shape, DataPillPlugin)
298
+
299
+ // Magical code to handle trigger pills :) as they do not follow the same pattern as other pills
300
+ // subflow inputs will be {{subflow.<pill-name>}}, flow variable {{flow_variable.<pill-name>}} but for triggers {{Created_1.<pill-name>}}
301
+ if (processedShape instanceof PillShape && processedShape.getRootIdentifier() === 'trigger') {
302
+ processedShape = await resolveTriggerPills(processedShape, transform)
303
+ }
304
+ // Magical code to handle PillTemplateShape with trigger pills
305
+ else if (processedShape.is(PillTemplateShape)) {
306
+ // Process each pill shape in the template
307
+ const pillShapes = processedShape.getParts()
308
+ const elements = pillShapes.getElements(false)
309
+
310
+ for (const shapePart of elements) {
311
+ if (shapePart instanceof PillShape && shapePart.getRootIdentifier() === 'trigger') {
312
+ await resolveTriggerPills(shapePart, transform) // mutates shapePart
315
313
  }
316
314
  }
317
-
318
- return processedShape.getValue()
319
315
  }
320
316
 
321
- return shape.getValue()
317
+ return processedShape.getValue()
322
318
  }
323
319
 
324
320
  async function resolveTriggerPills(shape: PillShape, transform: Transform) {
@@ -352,13 +348,9 @@ export async function getRecordFromFlowInstaceShape(shape: Shape, transform: Tra
352
348
  if (callExpressionShape.is(CallExpressionShape)) {
353
349
  //Get the Flow Instance Shape using toSubclass() utility
354
350
  const flowInstanceShape = await transform.toSubclass(callExpressionShape, FlowLogicPlugin, FlowInstancePlugin)
355
- if (flowInstanceShape.success && flowInstanceShape.value.is(FDInstanceShape)) {
351
+ if (flowInstanceShape.is(FDInstanceShape)) {
356
352
  //Get the Flow Instance Record using toRecord() utility
357
- const flowInstanceRecord = await transform.toRecord(
358
- flowInstanceShape.value,
359
- FlowLogicPlugin,
360
- FlowInstancePlugin
361
- )
353
+ const flowInstanceRecord = await transform.toRecord(flowInstanceShape, FlowLogicPlugin, FlowInstancePlugin)
362
354
  if (flowInstanceRecord.success) {
363
355
  instanceRecord = flowInstanceRecord.value
364
356
  }
@@ -395,12 +387,24 @@ export const getBuiltInStepIdentifier = (sysId: string) => {
395
387
  }
396
388
 
397
389
  /**
398
- * Extracts the order value from a record for sorting purposes.
399
- * Converts the 'order' field to a number, defaulting to 0 if not present or invalid.
400
- *
401
- * @param record - The record containing the order field
402
- * @returns The numeric order value
390
+ * Reads the record's `order` field as a number for sorting. Falls back to
391
+ * `0` when missing or non-numeric to keep `Array.sort` stable.
403
392
  */
404
393
  export function getOrder(x: ObjectShape) {
405
- return Number(x.get('order').asString()?.getValue() ?? 0)
394
+ return Number(getOrderSuffix(x.get('order').asString()?.getValue() ?? '0')) || 0
395
+ }
396
+
397
+ /**
398
+ * Actions inside a `DoInParallel` branch have composite order values like
399
+ * `"2➛3"` (parent order ➛ child order). Callers that sort numerically or
400
+ * build JS identifiers need the trailing segment — the raw value either
401
+ * parses to `NaN` or contains a non-identifier character. Non-composite
402
+ * values pass through unchanged.
403
+ */
404
+ export function getOrderSuffix(rawOrder: string): string {
405
+ if (!rawOrder.includes(PARALLEL_ORDER_SEPARATOR)) {
406
+ return rawOrder
407
+ }
408
+ const segments = rawOrder.split(PARALLEL_ORDER_SEPARATOR)
409
+ return segments[segments.length - 1] ?? rawOrder
406
410
  }
@@ -13,12 +13,12 @@ import {
13
13
  isGUID,
14
14
  } from '@servicenow/sdk-build-core'
15
15
  import { create } from 'xmlbuilder2'
16
- import { createSdkDocEntry, showGuidFieldDiagnostic } from './utils'
16
+ import { showGuidFieldDiagnostic } from './utils'
17
17
  import { NowIdShape } from './now-id-plugin'
18
18
  import { AnnotationType, Formatter } from '@servicenow/sdk-core/runtime/ui'
19
19
 
20
20
  const DEFAULT_VIEW = 'Default view'
21
- const DEFAULT_ANNOTATION_TYPE = '753f88a80f930000b12e6903cfe01206'
21
+ const DEFAULT_ANNOTATION_TYPE = ''
22
22
  const FORM_XML_TABLES = ['sys_ui_form', 'sys_ui_form_section']
23
23
 
24
24
  // Derive sys_id → key name maps from the source-of-truth constants
@@ -74,20 +74,19 @@ function convertElementToField(element: Record, descendants?: Database): FormEle
74
74
  if (annotation) {
75
75
  const isPlainText = annotation.get('is_plain_text').toBoolean()?.getValue() ?? true
76
76
  const annotationTypeSysId = getOptionalString(annotation, 'type')
77
- const annotationTypeKey = ANNOTATION_TYPE_MAP.get(annotationTypeSysId)
77
+ const annotationType = ANNOTATION_TYPE_MAP.get(annotationTypeSysId) ?? (annotationTypeSysId || undefined)
78
78
  return {
79
79
  type: 'annotation',
80
80
  annotationId: NowIdShape.from(annotation),
81
81
  text: getOptionalString(annotation, 'text'),
82
82
  isPlainText: isPlainText,
83
- annotationType: annotationTypeKey ?? annotationTypeSysId,
83
+ ...(annotationType !== undefined && { annotationType }),
84
84
  }
85
85
  }
86
86
  return {
87
87
  type: 'annotation',
88
88
  annotationId: new NowIdShape({ source: element, id: elementValue }),
89
89
  text: '',
90
- annotationType: 'Info_Box_Blue',
91
90
  }
92
91
  }
93
92
 
@@ -334,15 +333,6 @@ type LayoutBlock =
334
333
 
335
334
  export const FormPlugin = Plugin.create({
336
335
  name: 'FormPlugin',
337
- docs: [
338
- createSdkDocEntry('Form', [
339
- 'sys_ui_form',
340
- 'sys_ui_form_section',
341
- 'sys_ui_section',
342
- 'sys_ui_element',
343
- 'sys_ui_annotation',
344
- ]),
345
- ],
346
336
  records: {
347
337
  sys_ui_section: {
348
338
  composite: true,
@@ -1272,7 +1262,7 @@ async function processFormElement(
1272
1262
  properties: arg.transform(({ $ }) => ({
1273
1263
  text: $.val(textValue),
1274
1264
  is_plain_text: $.val(isPlainText).def(true),
1275
- type: $.val(annotationTypeValue),
1265
+ type: $.val(annotationTypeValue).def(''),
1276
1266
  })),
1277
1267
  })
1278
1268
  elementRecords.push(annotationRecord)
@@ -25,7 +25,6 @@ const getDeclarationAndModuleSpecifierIfHtml = (node: ts.Node): [ts.ImportDeclar
25
25
 
26
26
  export const HtmlImportPlugin = Plugin.create({
27
27
  name: 'HtmlImportPlugin',
28
- docs: [],
29
28
  shapes: [
30
29
  {
31
30
  shape: StringShape,
@@ -9,7 +9,6 @@ import {
9
9
  import { NowIdShape } from './now-id-plugin'
10
10
  import { ModuleFunctionShape } from './server-module-plugin'
11
11
  import { NowIncludeShape } from './now-include-plugin'
12
- import { createSdkDocEntry } from './utils'
13
12
 
14
13
  // ============================================================================
15
14
  // CONSTANTS & CONFIGURATION
@@ -224,7 +223,6 @@ async function mapTransformScriptsToShape(scripts: Record[], transform: Transfor
224
223
 
225
224
  export const ImportSetPlugin = Plugin.create({
226
225
  name: 'ImportSetPlugin',
227
- docs: [createSdkDocEntry('ImportSet', ['sys_transform_map'])],
228
226
  records: {
229
227
  sys_transform_entry: {
230
228
  coalesce: ['map', 'target_field'],
@@ -2,7 +2,7 @@ import { CallExpressionShape, Plugin, isGUID, type Shape, type ShapeTransform }
2
2
  import { NowIdShape } from './now-id-plugin'
3
3
  import { NowIncludeShape } from './now-include-plugin'
4
4
  import { ModuleFunctionShape } from './server-module-plugin'
5
- import { createSdkDocEntry, showGuidFieldDiagnostic } from './utils'
5
+ import { showGuidFieldDiagnostic } from './utils'
6
6
  import { parseString, convertRolesToString } from './service-catalog/utils'
7
7
 
8
8
  /**
@@ -15,7 +15,6 @@ import { parseString, convertRolesToString } from './service-catalog/utils'
15
15
  */
16
16
  export const InboundEmailActionPlugin = Plugin.create({
17
17
  name: 'InboundEmailActionPlugin',
18
- docs: [createSdkDocEntry('InboundEmailAction', ['sysevent_in_email_action'])],
19
18
  records: {
20
19
  sysevent_in_email_action: {
21
20
  async toShape(record, { transform }) {
package/src/index.ts CHANGED
@@ -56,6 +56,7 @@ export * from './flow/plugins/step-instance-plugin'
56
56
  export * from './flow/plugins/step-definition-plugin'
57
57
  export * from './flow/plugins/flow-diagnostics-plugin'
58
58
  export * from './ui-policy-plugin'
59
+ export * from './data-policy-plugin'
59
60
  export * from './import-sets-plugin'
60
61
  export * from './now-attach-plugin'
61
62
  export * from './sla-plugin'
@@ -72,5 +73,10 @@ export * from './instance-scan-plugin'
72
73
  export * from './atf/step-configs'
73
74
  export { REPACK_OUTPUT_DIR, checkModuleExists, resolveModule } from './repack'
74
75
  export { FlowLogicValueProcessor } from './flow/flow-logic/flow-logic-plugin-helpers'
75
- export { FLOW_LOGIC } from './flow/flow-logic/flow-logic-constants'
76
+ export {
77
+ FLOW_LOGIC,
78
+ FLOW_LOGIC_SYS_ID_MAP,
79
+ DO_IN_PARALLEL_BLOCK_SYS_ID,
80
+ TRY_CATCH_CATCH_SYS_ID,
81
+ } from './flow/flow-logic/flow-logic-constants'
76
82
  export { FlowActivationTask } from './flow/post-install'
@@ -2,7 +2,6 @@ import { CallExpressionShape, Plugin, type Record, type Context } from '@service
2
2
  import { ModuleFunctionShape } from './server-module-plugin'
3
3
  import { NowIdShape } from './now-id-plugin'
4
4
  import { NowIncludeShape } from './now-include-plugin'
5
- import { createSdkDocEntry } from './utils'
6
5
 
7
6
  const SCAN_COLUMN_TYPE_CHECK = 'scan_column_type_check'
8
7
  const SCAN_LINTER_CHECK = 'scan_linter_check'
@@ -11,12 +10,6 @@ const SCAN_TABLE_CHECK = 'scan_table_check'
11
10
 
12
11
  export const InstanceScanPlugin = Plugin.create({
13
12
  name: 'InstanceScanPlugin',
14
- docs: [
15
- createSdkDocEntry('ColumnTypeCheck', [SCAN_COLUMN_TYPE_CHECK]),
16
- createSdkDocEntry('LinterCheck', [SCAN_LINTER_CHECK]),
17
- createSdkDocEntry('ScriptOnlyCheck', [SCAN_SCRIPT_ONLY_CHECK]),
18
- createSdkDocEntry('TableCheck', [SCAN_TABLE_CHECK]),
19
- ],
20
13
 
21
14
  records: {
22
15
  [SCAN_COLUMN_TYPE_CHECK]: {
@@ -49,7 +49,6 @@ export class JsonFileShape extends SourceFileShape {
49
49
 
50
50
  export const JsonPlugin = Plugin.create({
51
51
  name: 'JsonPlugin',
52
- docs: [],
53
52
  shapes: [
54
53
  {
55
54
  shape: SourceFileShape,
@@ -9,7 +9,7 @@ import {
9
9
  Database,
10
10
  } from '@servicenow/sdk-build-core'
11
11
  import { create } from 'xmlbuilder2'
12
- import { createSdkDocEntry, generateDeprecatedDiagnostics } from './utils'
12
+ import { generateDeprecatedDiagnostics } from './utils'
13
13
 
14
14
  const DEFAULT_VIEW = 'Default view'
15
15
  const listElementAliases = {
@@ -65,7 +65,6 @@ function getListUpdateName(list: Record): string {
65
65
 
66
66
  export const ListPlugin = Plugin.create({
67
67
  name: 'ListPlugin',
68
- docs: [createSdkDocEntry('List', ['sys_ui_list'])],
69
68
  records: {
70
69
  sys_ui_list: {
71
70
  composite: true,
@@ -176,6 +175,11 @@ export const ListPlugin = Plugin.create({
176
175
  child.ele('name').txt(name.asString().getValue())
177
176
  }
178
177
 
178
+ const sysPolicy = list.get('sys_policy')
179
+ if (sysPolicy.ifString()?.ifNotEmpty()) {
180
+ child.ele('sys_policy').txt(sysPolicy.asString().getValue())
181
+ }
182
+
179
183
  const parent = list.get('parent')
180
184
  if (parent.isDefined()) {
181
185
  child.ele('parent').txt(parent.asString().getValue())
@@ -211,7 +211,6 @@ export class NowAttachShape extends CallExpressionShape implements AssociateReco
211
211
 
212
212
  export const NowAttachPlugin = Plugin.create({
213
213
  name: 'NowAttachPlugin',
214
- docs: [],
215
214
  records: {
216
215
  '*': {
217
216
  async toFile(record, { config, database, factory, transform }) {
@@ -449,7 +449,6 @@ async function createPerformancePolicyRecord(
449
449
 
450
450
  export const NowConfigPlugin = Plugin.create({
451
451
  name: 'NowConfigPlugin',
452
- docs: [],
453
452
  files: [
454
453
  {
455
454
  matcher: /\Wnow\.config\.json$/,
@@ -937,6 +936,7 @@ export const NowConfigPlugin = Plugin.create({
937
936
  package_resolver_version: $.from('packageResolverVersion').def(
938
937
  scope === 'global' ? MODULE_RESOLUTION.V2 : MODULE_RESOLUTION.V1
939
938
  ),
939
+ sys_code: $.from('scope'),
940
940
  })),
941
941
  })
942
942
 
@@ -22,7 +22,6 @@ export class NowIdShape extends ElementAccessExpressionShape {
22
22
 
23
23
  export const NowIdPlugin = Plugin.create({
24
24
  name: 'NowIdPlugin',
25
- docs: [],
26
25
  shapes: [
27
26
  {
28
27
  shape: ElementAccessExpressionShape,
@@ -60,7 +60,6 @@ export class NowIncludeShape extends CallExpressionShape {
60
60
 
61
61
  export const NowIncludePlugin = Plugin.create({
62
62
  name: 'NowIncludePlugin',
63
- docs: [],
64
63
  shapes: [
65
64
  {
66
65
  shape: CallExpressionShape,
@@ -3,7 +3,6 @@ import { CallExpressionPlugin } from './call-expression-plugin'
3
3
 
4
4
  export const NowRefPlugin = Plugin.create({
5
5
  name: 'NowRefPlugin',
6
- docs: [],
7
6
  nodes: [
8
7
  {
9
8
  node: 'CallExpression',
@@ -2,7 +2,6 @@ import { Plugin, UnresolvedShape } from '@servicenow/sdk-build-core'
2
2
 
3
3
  export const NowUnresolvedPlugin = Plugin.create({
4
4
  name: 'NowUnresolvedPlugin',
5
- docs: [],
6
5
  shapes: [
7
6
  {
8
7
  shape: UnresolvedShape,
@@ -6,13 +6,13 @@ import {
6
6
  type ObjectShape,
7
7
  Shape,
8
8
  NowConfig,
9
+ type Package,
9
10
  } from '@servicenow/sdk-build-core'
10
11
  import { RepackService } from './repack'
11
12
  import { JsonFileShape } from './json-plugin'
12
13
 
13
14
  export const PackageJsonPlugin = Plugin.create({
14
15
  name: 'PackageJsonPlugin',
15
- docs: [],
16
16
  shapes: [
17
17
  {
18
18
  shape: JsonFileShape,
@@ -50,6 +50,7 @@ export const PackageJsonPlugin = Plugin.create({
50
50
  fs,
51
51
  logger,
52
52
  rootDir: project.getRootDir(),
53
+ packageJson,
53
54
  })
54
55
  )
55
56
  .asString()
@@ -65,10 +66,13 @@ export const PackageJsonPlugin = Plugin.create({
65
66
  ],
66
67
  })
67
68
 
68
- async function fixDependencyVersion(json: ObjectShape, context: { fs: FileSystem; logger: Logger; rootDir: string }) {
69
+ async function fixDependencyVersion(
70
+ json: ObjectShape,
71
+ context: { fs: FileSystem; logger: Logger; rootDir: string; packageJson: Package }
72
+ ) {
69
73
  const deps = json.get('dependencies').ifObject()
70
74
  if (!deps) {
71
- return JSON.stringify(json.getValue(), null, 2)
75
+ return JSON.stringify({ ...json.getValue(), version: context.packageJson.version }, null, 2)
72
76
  }
73
77
 
74
78
  const repack = await RepackService.create(context.logger, context.fs, context.rootDir)
@@ -82,6 +86,7 @@ async function fixDependencyVersion(json: ObjectShape, context: { fs: FileSystem
82
86
  {
83
87
  ...json.getValue(),
84
88
  dependencies: resolvedDeps,
89
+ version: context.packageJson.version,
85
90
  },
86
91
  null,
87
92
  2
@@ -1,7 +1,6 @@
1
1
  import { isSNScope } from '@servicenow/sdk-build-core'
2
2
  import { CallExpressionShape, Plugin, type Shape } from '@servicenow/sdk-build-core'
3
3
  import { NowIdShape } from './now-id-plugin'
4
- import { createSdkDocEntry } from './utils'
5
4
 
6
5
  const getRolesArray = (roles: string): Array<string> => {
7
6
  return roles
@@ -12,7 +11,6 @@ const getRolesArray = (roles: string): Array<string> => {
12
11
 
13
12
  export const PropertyPlugin = Plugin.create({
14
13
  name: 'PropertyPlugin',
15
- docs: [createSdkDocEntry('Property', ['sys_properties'])],
16
14
  records: {
17
15
  sys_properties: {
18
16
  toShape(record, { config }) {
@@ -1,6 +1,12 @@
1
- import { CallExpressionShape, Database, Plugin, unloadBuilder, type Record } from '@servicenow/sdk-build-core'
1
+ import {
2
+ CallExpressionShape,
3
+ Database,
4
+ NowConfig,
5
+ Plugin,
6
+ unloadBuilder,
7
+ type Record,
8
+ } from '@servicenow/sdk-build-core'
2
9
  import { NowIdShape } from './now-id-plugin'
3
- import { createSdkDocEntry } from './utils'
4
10
  import {
5
11
  Acl,
6
12
  ApplicationMenu,
@@ -39,7 +45,7 @@ import { List, Form } from '@servicenow/sdk-core/runtime/ui'
39
45
  import { Table } from '@servicenow/sdk-core/runtime/db'
40
46
  import { RestApi } from '@servicenow/sdk-core/runtime/rest'
41
47
  import { EmailNotification, InboundEmailAction } from '@servicenow/sdk-core/runtime/notification'
42
- import { UiAction, UiPage, UiPolicy } from '@servicenow/sdk-core/runtime/ui'
48
+ import { UiAction, UiPage, UiPolicy, DataPolicy } from '@servicenow/sdk-core/runtime/ui'
43
49
  import { ActionStepDefinition } from '@servicenow/sdk-core/runtime/flow'
44
50
  import { Applicability, UxListMenuConfig, Workspace } from '@servicenow/sdk-core/runtime/uxf'
45
51
  import { Dashboard } from '@servicenow/sdk-core/runtime/dashboard'
@@ -47,7 +53,6 @@ import { ColumnTypeCheck, LinterCheck, ScriptOnlyCheck, TableCheck } from '@serv
47
53
 
48
54
  export const RecordPlugin = Plugin.create({
49
55
  name: 'RecordPlugin',
50
- docs: [createSdkDocEntry('Record', ['*'])],
51
56
  records: {
52
57
  '*': {
53
58
  getUpdateName(record) {
@@ -116,9 +121,10 @@ export const RecordPlugin = Plugin.create({
116
121
  }
117
122
  },
118
123
  async toFile(record, { config, database, transform }) {
124
+ const { scope, scopeId } = NowConfig.getRecordScope(config, record.getOriginalFilePath())
119
125
  const recordBuilder = unloadBuilder({
120
- scope: config.scope,
121
- scopeId: config.scopeId,
126
+ scope,
127
+ scopeId,
122
128
  table: record.getTable(),
123
129
  })
124
130
  const updateName = await transform.getUpdateName(record)
@@ -273,6 +279,8 @@ export const TableOwnership = {
273
279
  sys_ui_policy: UiPolicy.name,
274
280
  sys_ui_policy_action: UiPolicy.name,
275
281
  sys_ui_policy_rl_action: UiPolicy.name,
282
+ sys_data_policy2: DataPolicy.name,
283
+ sys_data_policy_rule: DataPolicy.name,
276
284
  sysevent_script_action: ScriptAction.name,
277
285
  sysauto_script: ScheduledScript.name,
278
286
  sysevent_email_action: EmailNotification.name,
@@ -8,7 +8,7 @@ const BROWSER_API_WARNING = 'Web APIs are not supported by the now platform'
8
8
  const GLIDE_API_WARNING = 'Glide APIs are not supported by the now platform when used from a 3rd party dependency'
9
9
  const NO_GLOBAL_THIS = 'ES2020 `globalThis` variable is not supported by the now platform'
10
10
 
11
- type LogLevel = 'warn' | 'error'
11
+ export type LogLevel = 'warn' | 'error'
12
12
 
13
13
  type ESLintPropertyRule = {
14
14
  message: string