@servicenow/sdk-build-plugins 4.4.1 → 4.6.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 (337) 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 +4 -7
  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-diagnostics.js +5 -5
  34. package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -1
  35. package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +82 -2
  36. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +48 -40
  37. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
  38. package/dist/flow/flow-logic/flow-logic-plugin.js +1 -0
  39. package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
  40. package/dist/flow/plugins/approval-rules-plugin.js +1 -0
  41. package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
  42. package/dist/flow/plugins/flow-action-definition-plugin.js +1232 -55
  43. package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
  44. package/dist/flow/plugins/flow-data-pill-plugin.js +6 -2
  45. package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
  46. package/dist/flow/plugins/flow-definition-plugin.js +23 -44
  47. package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
  48. package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +2 -2
  49. package/dist/flow/plugins/flow-diagnostics-plugin.js +3 -2
  50. package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
  51. package/dist/flow/plugins/flow-instance-plugin.js +136 -34
  52. package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
  53. package/dist/flow/plugins/flow-trigger-instance-plugin.js +1 -0
  54. package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
  55. package/dist/flow/plugins/inline-script-plugin.js +1 -0
  56. package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
  57. package/dist/flow/plugins/step-definition-plugin.js +4 -2
  58. package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
  59. package/dist/flow/plugins/step-instance-plugin.d.ts +9 -1
  60. package/dist/flow/plugins/step-instance-plugin.js +649 -135
  61. package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
  62. package/dist/flow/plugins/trigger-plugin.js +2 -0
  63. package/dist/flow/plugins/trigger-plugin.js.map +1 -1
  64. package/dist/flow/plugins/wfa-datapill-plugin.js +21 -5
  65. package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
  66. package/dist/flow/post-install.d.ts +2 -0
  67. package/dist/flow/post-install.js +59 -0
  68. package/dist/flow/post-install.js.map +1 -0
  69. package/dist/flow/utils/complex-object-resolver.js +4 -1
  70. package/dist/flow/utils/complex-object-resolver.js.map +1 -1
  71. package/dist/flow/utils/complex-objects.js +5 -3
  72. package/dist/flow/utils/complex-objects.js.map +1 -1
  73. package/dist/flow/utils/flow-constants.d.ts +90 -2
  74. package/dist/flow/utils/flow-constants.js +430 -7
  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 +37 -16
  78. package/dist/flow/utils/flow-io-to-record.js.map +1 -1
  79. package/dist/flow/utils/flow-shapes.js +4 -0
  80. package/dist/flow/utils/flow-shapes.js.map +1 -1
  81. package/dist/flow/utils/flow-to-xml.d.ts +3 -2
  82. package/dist/flow/utils/flow-to-xml.js +3 -4
  83. package/dist/flow/utils/flow-to-xml.js.map +1 -1
  84. package/dist/flow/utils/label-cache-parser.d.ts +9 -2
  85. package/dist/flow/utils/label-cache-parser.js +32 -4
  86. package/dist/flow/utils/label-cache-parser.js.map +1 -1
  87. package/dist/flow/utils/label-cache-processor.d.ts +5 -0
  88. package/dist/flow/utils/label-cache-processor.js +14 -2
  89. package/dist/flow/utils/label-cache-processor.js.map +1 -1
  90. package/dist/flow/utils/pill-shape-helpers.d.ts +15 -0
  91. package/dist/flow/utils/pill-shape-helpers.js +35 -0
  92. package/dist/flow/utils/pill-shape-helpers.js.map +1 -0
  93. package/dist/flow/utils/pill-string-parser.js +1 -0
  94. package/dist/flow/utils/pill-string-parser.js.map +1 -1
  95. package/dist/flow/utils/schema-to-flow-object.d.ts +6 -1
  96. package/dist/flow/utils/schema-to-flow-object.js +131 -15
  97. package/dist/flow/utils/schema-to-flow-object.js.map +1 -1
  98. package/dist/flow/utils/service-catalog.js +5 -1
  99. package/dist/flow/utils/service-catalog.js.map +1 -1
  100. package/dist/flow/utils/utils.d.ts +1 -0
  101. package/dist/flow/utils/utils.js +6 -1
  102. package/dist/flow/utils/utils.js.map +1 -1
  103. package/dist/form-plugin.d.ts +2 -0
  104. package/dist/form-plugin.js +1132 -0
  105. package/dist/form-plugin.js.map +1 -0
  106. package/dist/html-import-plugin.js +1 -0
  107. package/dist/html-import-plugin.js.map +1 -1
  108. package/dist/import-sets-plugin.js +2 -0
  109. package/dist/import-sets-plugin.js.map +1 -1
  110. package/dist/inbound-email-action-plugin.d.ts +10 -0
  111. package/dist/inbound-email-action-plugin.js +128 -0
  112. package/dist/inbound-email-action-plugin.js.map +1 -0
  113. package/dist/index.d.ts +13 -0
  114. package/dist/index.js +17 -1
  115. package/dist/index.js.map +1 -1
  116. package/dist/instance-scan-plugin.d.ts +2 -0
  117. package/dist/instance-scan-plugin.js +293 -0
  118. package/dist/instance-scan-plugin.js.map +1 -0
  119. package/dist/json-plugin.js +1 -0
  120. package/dist/json-plugin.js.map +1 -1
  121. package/dist/list-plugin.js +1 -0
  122. package/dist/list-plugin.js.map +1 -1
  123. package/dist/now-attach-plugin.js +1 -0
  124. package/dist/now-attach-plugin.js.map +1 -1
  125. package/dist/now-config-plugin.js +659 -51
  126. package/dist/now-config-plugin.js.map +1 -1
  127. package/dist/now-id-plugin.js +1 -0
  128. package/dist/now-id-plugin.js.map +1 -1
  129. package/dist/now-include-plugin.js +1 -0
  130. package/dist/now-include-plugin.js.map +1 -1
  131. package/dist/now-ref-plugin.js +1 -0
  132. package/dist/now-ref-plugin.js.map +1 -1
  133. package/dist/now-unresolved-plugin.js +1 -0
  134. package/dist/now-unresolved-plugin.js.map +1 -1
  135. package/dist/package-json-plugin.js +1 -0
  136. package/dist/package-json-plugin.js.map +1 -1
  137. package/dist/property-plugin.js +3 -1
  138. package/dist/property-plugin.js.map +1 -1
  139. package/dist/record-plugin.d.ts +37 -0
  140. package/dist/record-plugin.js +47 -3
  141. package/dist/record-plugin.js.map +1 -1
  142. package/dist/repack/lint/Rules.d.ts +11 -2
  143. package/dist/repack/lint/Rules.js +160 -16
  144. package/dist/repack/lint/Rules.js.map +1 -1
  145. package/dist/repack/lint/index.d.ts +10 -5
  146. package/dist/repack/lint/index.js +76 -50
  147. package/dist/repack/lint/index.js.map +1 -1
  148. package/dist/rest-api-plugin.js +22 -1
  149. package/dist/rest-api-plugin.js.map +1 -1
  150. package/dist/role-plugin.js +1 -0
  151. package/dist/role-plugin.js.map +1 -1
  152. package/dist/schedule-script/index.d.ts +1 -0
  153. package/dist/schedule-script/index.js +18 -0
  154. package/dist/schedule-script/index.js.map +1 -0
  155. package/dist/schedule-script/scheduled-script-plugin.d.ts +2 -0
  156. package/dist/schedule-script/scheduled-script-plugin.js +556 -0
  157. package/dist/schedule-script/scheduled-script-plugin.js.map +1 -0
  158. package/dist/schedule-script/timeZoneConverter.d.ts +61 -0
  159. package/dist/schedule-script/timeZoneConverter.js +170 -0
  160. package/dist/schedule-script/timeZoneConverter.js.map +1 -0
  161. package/dist/script-action-plugin.js +2 -0
  162. package/dist/script-action-plugin.js.map +1 -1
  163. package/dist/script-include-plugin.js +2 -0
  164. package/dist/script-include-plugin.js.map +1 -1
  165. package/dist/server-module-plugin/index.js +13 -2
  166. package/dist/server-module-plugin/index.js.map +1 -1
  167. package/dist/service-catalog/catalog-clientscript-plugin.js +2 -0
  168. package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
  169. package/dist/service-catalog/catalog-item-plugin.js +2 -0
  170. package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
  171. package/dist/service-catalog/catalog-ui-policy-plugin.js +2 -0
  172. package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
  173. package/dist/service-catalog/sc-record-producer-plugin.js +2 -0
  174. package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
  175. package/dist/service-catalog/service-catalog-base.d.ts +18 -18
  176. package/dist/service-catalog/service-catalog-base.js +22 -22
  177. package/dist/service-catalog/service-catalog-base.js.map +1 -1
  178. package/dist/service-catalog/service-catalog-diagnostics.d.ts +6 -0
  179. package/dist/service-catalog/service-catalog-diagnostics.js +20 -0
  180. package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -1
  181. package/dist/service-catalog/shape-to-record.js +7 -2
  182. package/dist/service-catalog/shape-to-record.js.map +1 -1
  183. package/dist/service-catalog/variable-set-plugin.js +2 -0
  184. package/dist/service-catalog/variable-set-plugin.js.map +1 -1
  185. package/dist/service-portal/angular-provider-plugin.js +2 -0
  186. package/dist/service-portal/angular-provider-plugin.js.map +1 -1
  187. package/dist/service-portal/dependency-plugin.js +5 -31
  188. package/dist/service-portal/dependency-plugin.js.map +1 -1
  189. package/dist/service-portal/header-footer-plugin.d.ts +2 -0
  190. package/dist/service-portal/header-footer-plugin.js +50 -0
  191. package/dist/service-portal/header-footer-plugin.js.map +1 -0
  192. package/dist/service-portal/menu-plugin.d.ts +2 -0
  193. package/dist/service-portal/menu-plugin.js +334 -0
  194. package/dist/service-portal/menu-plugin.js.map +1 -0
  195. package/dist/service-portal/page-plugin.d.ts +2 -0
  196. package/dist/service-portal/page-plugin.js +681 -0
  197. package/dist/service-portal/page-plugin.js.map +1 -0
  198. package/dist/service-portal/page-route-map-plugin.d.ts +2 -0
  199. package/dist/service-portal/page-route-map-plugin.js +114 -0
  200. package/dist/service-portal/page-route-map-plugin.js.map +1 -0
  201. package/dist/service-portal/portal-plugin.d.ts +2 -0
  202. package/dist/service-portal/portal-plugin.js +309 -0
  203. package/dist/service-portal/portal-plugin.js.map +1 -0
  204. package/dist/service-portal/theme-plugin.d.ts +2 -0
  205. package/dist/service-portal/theme-plugin.js +112 -0
  206. package/dist/service-portal/theme-plugin.js.map +1 -0
  207. package/dist/service-portal/utils.d.ts +46 -0
  208. package/dist/service-portal/utils.js +331 -0
  209. package/dist/service-portal/utils.js.map +1 -0
  210. package/dist/service-portal/widget-plugin.js +10 -182
  211. package/dist/service-portal/widget-plugin.js.map +1 -1
  212. package/dist/sla-plugin.js +2 -0
  213. package/dist/sla-plugin.js.map +1 -1
  214. package/dist/static-content-plugin.js +5 -0
  215. package/dist/static-content-plugin.js.map +1 -1
  216. package/dist/table-plugin.js +191 -26
  217. package/dist/table-plugin.js.map +1 -1
  218. package/dist/ui-action-plugin.js +3 -4
  219. package/dist/ui-action-plugin.js.map +1 -1
  220. package/dist/ui-page-plugin.js +101 -21
  221. package/dist/ui-page-plugin.js.map +1 -1
  222. package/dist/ui-policy-plugin.js +1 -0
  223. package/dist/ui-policy-plugin.js.map +1 -1
  224. package/dist/user-preference-plugin.js +2 -0
  225. package/dist/user-preference-plugin.js.map +1 -1
  226. package/dist/utils.d.ts +20 -2
  227. package/dist/utils.js +34 -3
  228. package/dist/utils.js.map +1 -1
  229. package/dist/ux-list-menu-config-plugin.js +2 -0
  230. package/dist/ux-list-menu-config-plugin.js.map +1 -1
  231. package/dist/view-plugin.js +9 -3
  232. package/dist/view-plugin.js.map +1 -1
  233. package/dist/workspace-plugin.js +41 -36
  234. package/dist/workspace-plugin.js.map +1 -1
  235. package/package.json +11 -11
  236. package/src/_types/eslint-community-eslint-utils.d.ts +15 -0
  237. package/src/acl-plugin.ts +97 -8
  238. package/src/applicability-plugin.ts +2 -0
  239. package/src/application-menu-plugin.ts +2 -0
  240. package/src/arrow-function-plugin.ts +128 -13
  241. package/src/atf/test-plugin.ts +2 -0
  242. package/src/basic-syntax-plugin.ts +21 -0
  243. package/src/call-expression-plugin.ts +1 -0
  244. package/src/claims-plugin.ts +1 -0
  245. package/src/client-script-plugin.ts +2 -1
  246. package/src/column-plugin.ts +4 -8
  247. package/src/cross-scope-privilege-plugin.ts +2 -1
  248. package/src/dashboard/dashboard-plugin.ts +2 -0
  249. package/src/data-plugin.ts +1 -0
  250. package/src/email-notification-plugin.ts +3 -23
  251. package/src/flow/constants/flow-plugin-constants.ts +1 -1
  252. package/src/flow/flow-logic/flow-logic-diagnostics.ts +5 -6
  253. package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +47 -45
  254. package/src/flow/flow-logic/flow-logic-plugin.ts +1 -0
  255. package/src/flow/plugins/approval-rules-plugin.ts +1 -0
  256. package/src/flow/plugins/flow-action-definition-plugin.ts +1584 -62
  257. package/src/flow/plugins/flow-data-pill-plugin.ts +6 -2
  258. package/src/flow/plugins/flow-definition-plugin.ts +22 -51
  259. package/src/flow/plugins/flow-diagnostics-plugin.ts +3 -2
  260. package/src/flow/plugins/flow-instance-plugin.ts +201 -36
  261. package/src/flow/plugins/flow-trigger-instance-plugin.ts +1 -0
  262. package/src/flow/plugins/inline-script-plugin.ts +1 -0
  263. package/src/flow/plugins/step-definition-plugin.ts +4 -2
  264. package/src/flow/plugins/step-instance-plugin.ts +772 -155
  265. package/src/flow/plugins/trigger-plugin.ts +2 -0
  266. package/src/flow/plugins/wfa-datapill-plugin.ts +26 -5
  267. package/src/flow/post-install.ts +93 -0
  268. package/src/flow/utils/complex-object-resolver.ts +4 -1
  269. package/src/flow/utils/complex-objects.ts +11 -3
  270. package/src/flow/utils/flow-constants.ts +451 -6
  271. package/src/flow/utils/flow-io-to-record.ts +43 -17
  272. package/src/flow/utils/flow-shapes.ts +4 -0
  273. package/src/flow/utils/flow-to-xml.ts +4 -4
  274. package/src/flow/utils/label-cache-parser.ts +33 -4
  275. package/src/flow/utils/label-cache-processor.ts +14 -2
  276. package/src/flow/utils/pill-shape-helpers.ts +42 -0
  277. package/src/flow/utils/pill-string-parser.ts +1 -0
  278. package/src/flow/utils/schema-to-flow-object.ts +183 -15
  279. package/src/flow/utils/service-catalog.ts +5 -2
  280. package/src/flow/utils/utils.ts +12 -1
  281. package/src/form-plugin.ts +1409 -0
  282. package/src/html-import-plugin.ts +1 -0
  283. package/src/import-sets-plugin.ts +2 -0
  284. package/src/inbound-email-action-plugin.ts +145 -0
  285. package/src/index.ts +13 -0
  286. package/src/instance-scan-plugin.ts +313 -0
  287. package/src/json-plugin.ts +1 -0
  288. package/src/list-plugin.ts +2 -1
  289. package/src/now-attach-plugin.ts +1 -0
  290. package/src/now-config-plugin.ts +833 -53
  291. package/src/now-id-plugin.ts +1 -0
  292. package/src/now-include-plugin.ts +1 -0
  293. package/src/now-ref-plugin.ts +1 -0
  294. package/src/now-unresolved-plugin.ts +1 -0
  295. package/src/package-json-plugin.ts +1 -0
  296. package/src/property-plugin.ts +6 -1
  297. package/src/record-plugin.ts +56 -6
  298. package/src/repack/lint/Rules.ts +171 -22
  299. package/src/repack/lint/index.ts +80 -56
  300. package/src/rest-api-plugin.ts +28 -2
  301. package/src/role-plugin.ts +2 -1
  302. package/src/schedule-script/index.ts +1 -0
  303. package/src/schedule-script/scheduled-script-plugin.ts +690 -0
  304. package/src/schedule-script/timeZoneConverter.ts +188 -0
  305. package/src/script-action-plugin.ts +2 -0
  306. package/src/script-include-plugin.ts +2 -0
  307. package/src/server-module-plugin/index.ts +14 -2
  308. package/src/service-catalog/catalog-clientscript-plugin.ts +2 -0
  309. package/src/service-catalog/catalog-item-plugin.ts +2 -0
  310. package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -0
  311. package/src/service-catalog/sc-record-producer-plugin.ts +2 -0
  312. package/src/service-catalog/service-catalog-base.ts +22 -22
  313. package/src/service-catalog/service-catalog-diagnostics.ts +30 -0
  314. package/src/service-catalog/shape-to-record.ts +8 -2
  315. package/src/service-catalog/variable-set-plugin.ts +2 -0
  316. package/src/service-portal/angular-provider-plugin.ts +2 -0
  317. package/src/service-portal/dependency-plugin.ts +6 -53
  318. package/src/service-portal/header-footer-plugin.ts +57 -0
  319. package/src/service-portal/menu-plugin.ts +413 -0
  320. package/src/service-portal/page-plugin.ts +805 -0
  321. package/src/service-portal/page-route-map-plugin.ts +124 -0
  322. package/src/service-portal/portal-plugin.ts +342 -0
  323. package/src/service-portal/theme-plugin.ts +135 -0
  324. package/src/service-portal/utils.ts +470 -0
  325. package/src/service-portal/widget-plugin.ts +18 -224
  326. package/src/sla-plugin.ts +2 -0
  327. package/src/static-content-plugin.ts +4 -0
  328. package/src/table-plugin.ts +228 -37
  329. package/src/ui-action-plugin.ts +3 -8
  330. package/src/ui-page-plugin.ts +110 -21
  331. package/src/ui-policy-plugin.ts +2 -1
  332. package/src/user-preference-plugin.ts +2 -0
  333. package/src/utils.ts +42 -2
  334. package/src/ux-list-menu-config-plugin.ts +2 -0
  335. package/src/view-plugin.ts +11 -4
  336. package/src/workspace-plugin.ts +45 -43
  337. package/src/_types/eslint-plugin-es-x.d.ts +0 -17
@@ -1,17 +1,31 @@
1
- import { Plugin, Shape, type Source, ts, IdentifierShape, type StringShape } from '@servicenow/sdk-build-core'
1
+ import {
2
+ Plugin,
3
+ Shape,
4
+ type Source,
5
+ ts,
6
+ IdentifierShape,
7
+ type StringShape,
8
+ ObjectShape,
9
+ } from '@servicenow/sdk-build-core'
2
10
 
3
11
  export class ArrowFunctionShape extends Shape {
4
12
  private readonly parameters: IdentifierShape[]
5
13
  private readonly statements: Shape[]
14
+ private readonly returnValue: Shape | undefined
15
+ private readonly implicitReturn: boolean
6
16
 
7
17
  constructor({
8
18
  source,
9
19
  parameters,
10
20
  statements,
21
+ returnValue,
22
+ implicitReturn,
11
23
  }: {
12
24
  source: Source
13
25
  parameters?: (IdentifierShape | StringShape | string)[]
14
26
  statements?: Shape[]
27
+ returnValue?: Shape
28
+ implicitReturn?: boolean
15
29
  }) {
16
30
  super({ source })
17
31
  this.parameters = (parameters ?? []).map((s) =>
@@ -23,6 +37,8 @@ export class ArrowFunctionShape extends Shape {
23
37
  })
24
38
  )
25
39
  this.statements = statements ?? []
40
+ this.returnValue = returnValue
41
+ this.implicitReturn = implicitReturn ?? false
26
42
  }
27
43
 
28
44
  getParameters(): IdentifierShape[] {
@@ -51,18 +67,51 @@ export class ArrowFunctionShape extends Shape {
51
67
  return statement
52
68
  }
53
69
 
70
+ getReturnValue(): Shape | undefined {
71
+ return this.returnValue
72
+ }
73
+
54
74
  override getCode(): string {
55
- return `(${this.getParameters()
75
+ const params = `(${this.getParameters()
56
76
  .map((p) => p.getCode())
57
- .join(', ')}) => {\n ${this.getStatements()
58
- .map((s) => s.getCode())
59
- .join('\n ')}\n}`
77
+ .join(', ')})`
78
+
79
+ // Use concise arrow function syntax when there are no statements and only a return value
80
+ if (this.implicitReturn && this.returnValue) {
81
+ if (this.returnValue instanceof ObjectShape) {
82
+ return `${params} => (${this.returnValue.getCode()})`
83
+ }
84
+ return `${params} => ${this.returnValue.getCode()}`
85
+ }
86
+
87
+ // Block body syntax
88
+ const parts = this.getStatements().map((s) => s.getCode())
89
+ if (this.returnValue) {
90
+ parts.push(`return ${this.returnValue.getCode()}`)
91
+ }
92
+ return `${params} => {\n ${parts.join('\n ')}\n}`
60
93
  }
61
94
  }
62
95
 
63
96
  export const ArrowFunctionPlugin = Plugin.create({
64
97
  name: 'ArrowFunctionPlugin',
98
+ docs: [],
65
99
  nodes: [
100
+ /**
101
+ * Catch-all handler for ReturnStatement nodes encountered outside of arrow functions.
102
+ * Return statements within arrow functions are handled inline by the ArrowFunction
103
+ * node handler below, which extracts the return expression from the last statement.
104
+ * Any ReturnStatement that reaches this handler is outside an arrow function context
105
+ * and is not supported.
106
+ */
107
+ {
108
+ node: 'ReturnStatement',
109
+ fileTypes: ['fluent'],
110
+ toShape(node, { diagnostics }) {
111
+ diagnostics.error(node, 'Return statements are only supported inside arrow functions')
112
+ return { success: false }
113
+ },
114
+ },
66
115
  {
67
116
  node: 'ArrowFunction',
68
117
  fileTypes: ['fluent'],
@@ -78,24 +127,64 @@ export const ArrowFunctionPlugin = Plugin.create({
78
127
  }
79
128
  }
80
129
 
130
+ // Check if this is an expression-body arrow function (concise form) - () => 'value'
131
+ const body = node.getBody()
132
+ const isExpressionBody = body && !ts.Node.isBlock(body)
133
+
134
+ if (isExpressionBody) {
135
+ // Expression body: () => expr - treat the body as the return value
136
+ const result = await transform.toShape(body)
137
+ if (!result.success) {
138
+ diagnostics.error(body, 'Unsupported expression in arrow function body')
139
+ return { success: false }
140
+ }
141
+ return {
142
+ success: true,
143
+ value: new ArrowFunctionShape({
144
+ source: node,
145
+ parameters,
146
+ statements: [],
147
+ returnValue: result.value,
148
+ implicitReturn: true,
149
+ }),
150
+ }
151
+ }
152
+
153
+ const nodeStatements = node.getStatements()
154
+ const lastStatement = nodeStatements[nodeStatements.length - 1]
155
+ const hasReturn = lastStatement && ts.Node.isReturnStatement(lastStatement)
156
+ const bodyStatements = hasReturn ? nodeStatements.slice(0, -1) : nodeStatements
157
+
81
158
  const statements: Shape[] = []
82
- for (const statement of node.getStatements()) {
159
+ for (const statement of bodyStatements) {
83
160
  const result = await transform.toShape(statement)
84
161
  if (!result.success) {
85
162
  diagnostics.error(statement, 'Unsupported statement in arrow function body')
86
163
  return { success: false }
87
164
  }
88
-
89
165
  statements.push(result.value)
90
166
  }
91
167
 
168
+ let returnValue: Shape | undefined
169
+ if (hasReturn) {
170
+ const expr = lastStatement.getExpression()
171
+ if (expr) {
172
+ const result = await transform.toShape(expr)
173
+ if (!result.success) {
174
+ diagnostics.error(lastStatement, 'Unsupported expression in return statement')
175
+ return { success: false }
176
+ }
177
+ returnValue = result.value
178
+ }
179
+ }
180
+
181
+ const args = { source: node, parameters, statements }
182
+
92
183
  return {
93
184
  success: true,
94
- value: new ArrowFunctionShape({
95
- source: node,
96
- parameters,
97
- statements,
98
- }),
185
+ value: returnValue
186
+ ? new ArrowFunctionShape({ ...args, returnValue })
187
+ : new ArrowFunctionShape(args),
99
188
  }
100
189
  },
101
190
  },
@@ -110,7 +199,19 @@ export const ArrowFunctionPlugin = Plugin.create({
110
199
 
111
200
  const nodeStatements = arrowFunction.getStatements()
112
201
  const shapeStatements = shape.getStatements()
113
- const excess = nodeStatements.length - shapeStatements.length
202
+ const returnValue = shape.getReturnValue()
203
+
204
+ if (ts.Node.isArrowFunction(target)) {
205
+ const body = target.getBody()
206
+ if (!ts.Node.isBlock(body) && shapeStatements.length === 0 && returnValue) {
207
+ // Already inline form - commit directly to the expression
208
+ await commit(returnValue, body)
209
+ return { success: true }
210
+ }
211
+ }
212
+
213
+ const totalExpected = shapeStatements.length + (returnValue ? 1 : 0)
214
+ const excess = nodeStatements.length - totalExpected
114
215
  for (let i = 1; i <= excess; i++) {
115
216
  arrowFunction.removeStatement(nodeStatements.length - i)
116
217
  }
@@ -120,6 +221,20 @@ export const ArrowFunctionPlugin = Plugin.create({
120
221
  await commit(statement, targetStatement)
121
222
  }
122
223
 
224
+ if (returnValue) {
225
+ const returnIndex = shapeStatements.length
226
+ const targetReturn =
227
+ nodeStatements[returnIndex] ?? arrowFunction.addStatements('return undefined')[0]!
228
+ if (ts.Node.isReturnStatement(targetReturn)) {
229
+ const expr = targetReturn.getExpression()
230
+ if (expr) {
231
+ await commit(returnValue, expr)
232
+ }
233
+ } else {
234
+ targetReturn.replaceWithText(`return ${returnValue.getCode()}`)
235
+ }
236
+ }
237
+
123
238
  return { success: true }
124
239
  },
125
240
  },
@@ -19,6 +19,7 @@ import {
19
19
  } from '@servicenow/sdk-build-core'
20
20
  import { NowIdShape } from '../now-id-plugin'
21
21
  import { ArrowFunctionShape } from '../arrow-function-plugin'
22
+ import { createSdkDocEntry } from '../utils'
22
23
  import { create } from 'xmlbuilder2'
23
24
  import { Test } from '@servicenow/sdk-core/runtime/app'
24
25
  import {
@@ -33,6 +34,7 @@ import type { Duration } from '@servicenow/sdk/core'
33
34
 
34
35
  export const TestPlugin = Plugin.create({
35
36
  name: 'TestPlugin',
37
+ docs: [createSdkDocEntry('Test', ['sys_atf_test'])],
36
38
  records: {
37
39
  sys_atf_test: {
38
40
  relationships: {
@@ -30,9 +30,11 @@ import {
30
30
  } from '@servicenow/sdk-build-core'
31
31
  import { isDataHelper } from './data-plugin'
32
32
  import { getCallExpressionName } from './utils'
33
+ import { NowIncludePlugin, NowIncludeShape } from './now-include-plugin'
33
34
 
34
35
  export const BasicSyntaxPlugin = Plugin.create({
35
36
  name: 'BasicSyntaxPlugin',
37
+ docs: [],
36
38
  files: [
37
39
  {
38
40
  entryPoint: true,
@@ -309,6 +311,7 @@ export const BasicSyntaxPlugin = Plugin.create({
309
311
 
310
312
  const propsToRetain = new Set<string>(['$meta'])
311
313
  const propsToAdd: ts.PropertyAssignmentStructure[] = []
314
+ const nowIncludePropsToCommit = new Set<string>()
312
315
  for (const [name, value] of shape.entries({ resolve: false })) {
313
316
  const existingPropKey = [...shape.getAliases(name), name].find((aliasedKey) =>
314
317
  existingNames.has(aliasedKey)
@@ -324,6 +327,9 @@ export const BasicSyntaxPlugin = Plugin.create({
324
327
 
325
328
  await commit(value, existingNames.get(existingPropKey) as ts.Expression)
326
329
  } else if (!value.equals(shape.getDefault(name))) {
330
+ if (value.is(NowIncludeShape)) {
331
+ nowIncludePropsToCommit.add(name)
332
+ }
327
333
  propsToAdd.push({
328
334
  name: ObjectShape.quotePropertyNameIfNeeded(name),
329
335
  initializer: value.getCode(),
@@ -338,6 +344,15 @@ export const BasicSyntaxPlugin = Plugin.create({
338
344
  target.addPropertyAssignments(propsToAdd)
339
345
  }
340
346
 
347
+ // commit Now.include props to generate the include file.
348
+ for (const prop of nowIncludePropsToCommit) {
349
+ const includeInitializer = target
350
+ .getPropertyOrThrow(prop)
351
+ .asKindOrThrow(ts.SyntaxKind.PropertyAssignment)
352
+ .getInitializerOrThrow()
353
+ await commit(shape.get(prop, false), includeInitializer, NowIncludePlugin)
354
+ }
355
+
341
356
  const propsToRemove = [...existingNames.keys()].filter((key) => !propsToRetain.has(key))
342
357
  propsToRemove.forEach((prop) => {
343
358
  target.getProperty(prop)?.asKindOrThrow(ts.SyntaxKind.PropertyAssignment).remove()
@@ -544,6 +559,12 @@ export const BasicSyntaxPlugin = Plugin.create({
544
559
  return transform.toShape(node.getExpression())
545
560
  },
546
561
  },
562
+ {
563
+ node: 'ParenthesizedExpression',
564
+ toShape(node, { transform }) {
565
+ return transform.toShape(node.getExpression())
566
+ },
567
+ },
547
568
  {
548
569
  node: 'Identifier',
549
570
  async toShape(node, { transform }) {
@@ -3,6 +3,7 @@ import { getCallExpressionName } from './utils'
3
3
 
4
4
  export const CallExpressionPlugin = Plugin.create({
5
5
  name: 'CallExpressionPlugin',
6
+ docs: [],
6
7
  nodes: [
7
8
  {
8
9
  node: 'CallExpression',
@@ -8,6 +8,7 @@ function getClaimsPath(project: Project, config: NowConfig): string {
8
8
 
9
9
  export const ClaimsPlugin = Plugin.create({
10
10
  name: 'ClaimsPlugin',
11
+ docs: [],
11
12
  files: [
12
13
  {
13
14
  entryPoint: true,
@@ -1,6 +1,6 @@
1
1
  import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
2
2
  import { NowIdShape } from './now-id-plugin'
3
- import { generateDeprecatedDiagnostics, validateClientSideScript } from './utils'
3
+ import { createSdkDocEntry, generateDeprecatedDiagnostics, validateClientSideScript } from './utils'
4
4
  import { NowIncludeShape } from './now-include-plugin'
5
5
 
6
6
  enum UITypeMapping {
@@ -44,6 +44,7 @@ const clientScriptAliases = {
44
44
  */
45
45
  export const ClientScriptPlugin = Plugin.create({
46
46
  name: 'ClientScriptPlugin',
47
+ docs: [createSdkDocEntry('ClientScript', ['sys_script_client'])],
47
48
  records: {
48
49
  sys_script_client: {
49
50
  async toShape(record, { transform }) {
@@ -66,6 +66,7 @@ const documentationAliases = {
66
66
 
67
67
  export const ColumnPlugin = Plugin.create({
68
68
  name: 'ColumnPlugin',
69
+ docs: [],
69
70
  records: {
70
71
  sys_choice: {
71
72
  coalesce: ['name', 'element', 'value'],
@@ -91,11 +92,6 @@ export const ColumnPlugin = Plugin.create({
91
92
  value: `sys_choice_${record.get('name').getValue()}_${record.get('element').getValue()}`,
92
93
  }),
93
94
  async toFile(choiceSet, { config, descendants, transform }) {
94
- if (config.tableOutputFormat === 'bootstrap' && config.type === 'package') {
95
- // Defer to table plugin
96
- return { success: false }
97
- }
98
-
99
95
  const tableName = choiceSet.get('name').asString().getValue()
100
96
  const elementName = choiceSet.get('element').asString().getValue()
101
97
  const xml = create().ele('record_update')
@@ -164,14 +160,14 @@ export const ColumnPlugin = Plugin.create({
164
160
  factory,
165
161
  diagnostics,
166
162
  true,
167
- config.tableDefaultLanguage
163
+ config.defaultLanguage
168
164
  )
169
165
  const choiceRecords = await getChoiceRecords(
170
166
  callExpression,
171
167
  choiceAliases,
172
168
  factory,
173
169
  diagnostics,
174
- config.tableDefaultLanguage
170
+ config.defaultLanguage
175
171
  )
176
172
  const choiceSetRecords: Record[] = []
177
173
  if (choiceRecords.length > 0) {
@@ -355,7 +351,7 @@ export const ColumnPlugin = Plugin.create({
355
351
  .map((f) => f.isString() && f.getValue() !== '')
356
352
  .def(false),
357
353
  column_label: $.from('label')
358
- .map((label) => getLabelForDefaultLanguage(label, config.tableDefaultLanguage))
354
+ .map((label) => getLabelForDefaultLanguage(label, config.defaultLanguage))
359
355
  .def(column.get('name').asString()),
360
356
  mandatory: $.toBoolean().def(false),
361
357
  max_length: $.from('maxLength')
@@ -1,6 +1,6 @@
1
1
  import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
2
2
  import { NowIdShape } from './now-id-plugin'
3
- import { generateDeprecatedDiagnostics } from './utils'
3
+ import { createSdkDocEntry, generateDeprecatedDiagnostics } from './utils'
4
4
 
5
5
  const crossScopeAliases = {
6
6
  targetName: ['target_name'],
@@ -23,6 +23,7 @@ const crossScopeAliases = {
23
23
  */
24
24
  export const CrossScopePrivilegePlugin = Plugin.create({
25
25
  name: 'CrossScopePrivilegePlugin',
26
+ docs: [createSdkDocEntry('CrossScopePrivilege', ['sys_scope_privilege'])],
26
27
  records: {
27
28
  sys_scope_privilege: {
28
29
  relationships: {
@@ -1,6 +1,7 @@
1
1
  import { CallExpressionShape, type ObjectShape, Plugin, type Record as RecordType } from '@servicenow/sdk-build-core'
2
2
  import { NowIdShape } from '../now-id-plugin'
3
3
  import { resolveComponentToSysId, resolveComponentToName } from './dashboard-component-resolver'
4
+ import { createSdkDocEntry } from '../utils'
4
5
  import { DEFAULT_PROPERTY_VALUES, removeRestrictedValues } from './dashboard-component-property-defaults'
5
6
 
6
7
  const transformWidget = (widget: RecordType) =>
@@ -55,6 +56,7 @@ const createWidgetProperties = (widgetData: ObjectShape, canvas: ObjectShape) =>
55
56
  */
56
57
  export const DashboardPlugin = Plugin.create({
57
58
  name: 'DashboardPlugin',
59
+ docs: [createSdkDocEntry('Dashboard', ['par_dashboard'])],
58
60
  records: {
59
61
  par_dashboard: {
60
62
  relationships: {
@@ -41,6 +41,7 @@ const shapeCreators: Record<
41
41
 
42
42
  export const DataPlugin = Plugin.create({
43
43
  name: 'DataPlugin',
44
+ docs: [],
44
45
  shapes: [
45
46
  {
46
47
  shape: CallExpressionShape,
@@ -1,12 +1,6 @@
1
- import {
2
- CallExpressionShape,
3
- Plugin,
4
- isGUID,
5
- Shape,
6
- type ObjectShape,
7
- type Diagnostics,
8
- } from '@servicenow/sdk-build-core'
1
+ import { CallExpressionShape, Plugin, isGUID, Shape, type ObjectShape } from '@servicenow/sdk-build-core'
9
2
  import { NowIdShape } from './now-id-plugin'
3
+ import { showGuidFieldDiagnostic, createSdkDocEntry } from './utils'
10
4
  import type { EmailNotification } from '@servicenow/sdk-core/runtime/notification'
11
5
 
12
6
  // Use index access types instead of exported utility types
@@ -59,23 +53,9 @@ const isValidEmail = (email: string): boolean => {
59
53
  return emailRegex.test(email)
60
54
  }
61
55
 
62
- const showGuidFieldDiagnostic = (
63
- inputReceived: Shape | undefined,
64
- fieldName: string,
65
- tableName: string,
66
- diagnostics: Diagnostics
67
- ) => {
68
- if (inputReceived) {
69
- const receivedValue = inputReceived.getValue()
70
- diagnostics.error(
71
- inputReceived,
72
- `'${fieldName}' must be a valid GUID or a Record<'${tableName}'>. Received: '${receivedValue}'`
73
- )
74
- }
75
- }
76
-
77
56
  export const EmailNotificationPlugin = Plugin.create({
78
57
  name: 'EmailNotificationPlugin',
58
+ docs: [createSdkDocEntry('EmailNotification', ['sysevent_email_action'])],
79
59
  records: {
80
60
  sysevent_email_action: {
81
61
  toShape(record) {
@@ -15,7 +15,7 @@ export const FLOW_PRIORITY_DEFAULT = 'MEDIUM'
15
15
  /**
16
16
  * Default user context for flow execution
17
17
  */
18
- export const RUN_AS_DEFAULT = 'system'
18
+ export const RUN_AS_DEFAULT = 'user'
19
19
 
20
20
  /**
21
21
  * Default access level for flows
@@ -433,7 +433,7 @@ function validateSetFlowVariables(expr: FlowLogicInstanceShape): string | undefi
433
433
  * Performs comprehensive validation of arguments, types, structure, and placement.
434
434
  *
435
435
  * **Validations performed:**
436
- * 1. Placement: Must be within a Subflow or SubflowDefinition (not in regular Flow)
436
+ * 1. Placement: Must be within a Subflow() definition (not in regular Flow)
437
437
  * 2. Argument count: Must have exactly 3 arguments
438
438
  * 3. Config object: Must contain required $id property
439
439
  * 4. Schema argument: Must be params.outputs (schema reference)
@@ -450,7 +450,7 @@ function validateSetFlowVariables(expr: FlowLogicInstanceShape): string | undefi
450
450
  * - Datapills: params.action.result, params.complexObject (PropertyAccessShape)
451
451
  * - Template expressions: `Result: ${params.action.result}` (TemplateExpressionShape)
452
452
  *
453
- * **Important:** AssignSubflowOutputs can ONLY be used within Subflow or SubflowDefinition.
453
+ * **Important:** AssignSubflowOutputs can ONLY be used within a Subflow() definition.
454
454
  * Using it in a regular Flow will result in a validation error.
455
455
  *
456
456
  * @param expr - The AssignSubflowOutputs flow logic instance shape
@@ -473,12 +473,11 @@ function validateAssignSubflowOutputs(expr: FlowLogicInstanceShape): string | un
473
473
  return undefined
474
474
  }
475
475
 
476
- // Validate that this is called within a SubflowDefinition or Subflow
476
+ // Validate that this is called within a Subflow() definition
477
477
  const node = expr.getOriginalNode()
478
- const subflowAncestor =
479
- findAncestorByCalleeName(node, 'SubflowDefinition') || findAncestorByCalleeName(node, 'Subflow')
478
+ const subflowAncestor = findAncestorByCalleeName(node, 'Subflow')
480
479
  if (!subflowAncestor) {
481
- return 'AssignSubflowOutputs can only be used within a SubflowDefinition or Subflow'
480
+ return 'AssignSubflowOutputs can only be used within a Subflow'
482
481
  }
483
482
 
484
483
  // Validate argument count
@@ -130,7 +130,7 @@ type FlowLogicParseResult =
130
130
  * FlowLogicValueInput objects with name/value pairs that represent the
131
131
  * original TypeScript configuration properties.
132
132
  */
133
- namespace FlowLogicValueProcessor {
133
+ export namespace FlowLogicValueProcessor {
134
134
  /**
135
135
  * Generic factory function for creating flow logic entry objects.
136
136
  * All entry types (AssignSubflowOutput, SetFlowVariablesInput, FlowLogicValueInput)
@@ -766,8 +766,6 @@ namespace FlowLogicValueProcessor {
766
766
  // Constants for type handling
767
767
  const ARRAY_TYPE_PREFIX = 'array.' as const
768
768
  const ARRAY_TYPE_PREFIX_LENGTH = ARRAY_TYPE_PREFIX.length
769
- const EXCLUDED_TYPE_ANNOTATIONS = new Set(['string', 'glide_date_time'])
770
-
771
769
  /**
772
770
  * Interface for child entry structure used in parsing
773
771
  */
@@ -829,50 +827,29 @@ namespace FlowLogicValueProcessor {
829
827
  return value
830
828
  }
831
829
 
832
- /**
833
- * Adds type annotation to a datapill if needed based on label cache
834
- * @param pillName - Datapill name without braces
835
- * @param labelCacheMap - Map of datapill names to types
836
- * @returns Datapill with annotation if applicable
837
- */
838
- function addTypeAnnotationIfNeeded(pillName: string, labelCacheMap?: Map<string, string>): string {
839
- if (!labelCacheMap) {
840
- return `{{${pillName}}}`
841
- }
842
-
843
- const cachedType = labelCacheMap.get(pillName.trim())
844
- if (cachedType && !EXCLUDED_TYPE_ANNOTATIONS.has(cachedType)) {
845
- return `{{${pillName}|${cachedType}}}`
846
- }
847
-
848
- return `{{${pillName}}}`
849
- }
850
-
851
830
  /**
852
831
  * Processes a pure datapill value (starts and ends with {{}})
832
+ * Strips any existing |type annotation and returns a clean datapill.
833
+ * Type info is preserved via labelCacheMap in wrapWithWfaDataPillExpression downstream.
853
834
  * @param value - Pure datapill string
854
- * @param labelCacheMap - Map of datapill names to types
855
- * @returns Processed datapill with type annotation if needed
835
+ * @param _labelCacheMap - Unused (type resolution handled downstream by transformDataPill)
836
+ * @returns Clean datapill without type annotation
856
837
  */
857
- function processPureDatapill(value: string, labelCacheMap?: Map<string, string>): string {
858
- const strippedValue = stripDatapillTypeAnnotation(value)
859
- const pillName = strippedValue.slice(2, -2) // Remove {{ and }}
860
- return addTypeAnnotationIfNeeded(pillName, labelCacheMap)
838
+ function processPureDatapill(value: string, _labelCacheMap?: Map<string, string>): string {
839
+ return stripDatapillTypeAnnotation(value)
861
840
  }
862
841
 
863
842
  /**
864
- * Processes a template expression containing datapills mixed with text
843
+ * Processes a template expression containing datapills mixed with text.
844
+ * Strips any existing |type annotations and returns clean datapills.
845
+ * Type info is preserved via labelCacheMap in wrapWithWfaDataPillExpression downstream.
865
846
  * @param value - Template expression string
866
- * @param labelCacheMap - Map of datapill names to types
867
- * @returns Processed template with type annotations added to datapills
847
+ * @param _labelCacheMap - Unused (type resolution handled downstream by transformDataPill)
848
+ * @returns Processed template with type annotations stripped from datapills
868
849
  */
869
- function processTemplateExpression(value: string, labelCacheMap?: Map<string, string>): string {
870
- if (!labelCacheMap) {
871
- return value
872
- }
873
-
874
- const datapillRegex = /\{\{([^}|]+)(?:\|[^}]+)?\}\}/g
875
- return value.replace(datapillRegex, (_match, pillName) => addTypeAnnotationIfNeeded(pillName, labelCacheMap))
850
+ function processTemplateExpression(value: string, _labelCacheMap?: Map<string, string>): string {
851
+ const datapillRegex = /\{\{([^}|]+)\|[^}]+\}\}/g
852
+ return value.replace(datapillRegex, '{{$1}}')
876
853
  }
877
854
 
878
855
  /**
@@ -972,12 +949,26 @@ namespace FlowLogicValueProcessor {
972
949
  if (parsed.complexObjectSchema) {
973
950
  // Find the $COCollectionField.$type_facets
974
951
  for (const schemaKey in parsed.complexObjectSchema) {
952
+ // Skip top-level $type_facets entries (handled as fallback below)
953
+ if (schemaKey.endsWith('.$type_facets')) {
954
+ continue
955
+ }
975
956
  const schema = parsed.complexObjectSchema[schemaKey]
976
- if (schema && schema.$COCollectionField && schema['$COCollectionField.$type_facets']) {
977
- const typeFacets = schema['$COCollectionField.$type_facets']
978
- if (typeFacets.SimpleMapFacet) {
979
- const facetData = JSON.parse(typeFacets.SimpleMapFacet)
980
- return facetData.child_type
957
+ if (schema && schema.$COCollectionField) {
958
+ // Array.Object format: child_type nested as $COCollectionField.$type_facets
959
+ if (schema['$COCollectionField.$type_facets']?.SimpleMapFacet) {
960
+ const facetData = JSON.parse(schema['$COCollectionField.$type_facets'].SimpleMapFacet)
961
+ if (facetData.child_type) {
962
+ return facetData.child_type
963
+ }
964
+ }
965
+ // DEF0798866: Array.String format: child_type stored in top-level key "schemaKey.$type_facets"
966
+ const topLevelTypeFacets = parsed.complexObjectSchema[`${schemaKey}.$type_facets`]
967
+ if (topLevelTypeFacets?.SimpleMapFacet) {
968
+ const facetData = JSON.parse(topLevelTypeFacets.SimpleMapFacet)
969
+ if (facetData.child_type) {
970
+ return facetData.child_type
971
+ }
981
972
  }
982
973
  }
983
974
  }
@@ -1081,8 +1072,15 @@ namespace FlowLogicValueProcessor {
1081
1072
  const firstBaseName = getBaseName(childObj.name)
1082
1073
 
1083
1074
  // Check if all children have the same base name (indicating FlowArray with repeated childName)
1075
+ // When elementType is defined (i.e., the schema identifies this as a FlowArray — Array.Object,
1076
+ // Array.String, Array.Integer, Array.DateTime, etc.), a single child is still a valid array
1077
+ // element: the child is the childName wrapper whose inner value/children are the actual element.
1078
+ // Without this, single-element FlowArray assignments fall into the object path, generating
1079
+ // { childName: { fields } } or { childName: value } instead of [{ fields }] or [value].
1080
+ // DEF0798866: single-element Array.Object/String subflow outputs generated incorrect Fluent code.
1081
+ const minChildrenForArray = elementType !== undefined ? 1 : 2
1084
1082
  const allSameName =
1085
- children.length > 1 &&
1083
+ children.length >= minChildrenForArray &&
1086
1084
  children.every((c) => {
1087
1085
  const entry = c as ChildEntry
1088
1086
  return getBaseName(entry.name) === firstBaseName
@@ -1525,7 +1523,11 @@ namespace FlowLogicValueProcessor {
1525
1523
  // Ignore parse errors
1526
1524
  }
1527
1525
  }
1528
- const elementType = getArrayElementType(entry)
1526
+ // DEF0798866: Use typeMap as fallback when schema-based detection fails.
1527
+ // If entry.value doesn't contain complexObjectSchema (e.g., some ServiceNow XML
1528
+ // formats omit the schema), fall back to the typeMap which always contains the
1529
+ // output/variable type (e.g., 'array.string' -> 'string' element type).
1530
+ const elementType = getArrayElementType(entry) ?? extractArrayElementType(typeMap?.get(entry.name))
1529
1531
  const nestedTypeMap = extractNestedTypeSchema(entry)
1530
1532
  const parsedValue = parseChildrenArray(
1531
1533
  entry.children,
@@ -72,6 +72,7 @@ import type { ArrowFunctionShape } from '../../arrow-function-plugin'
72
72
  */
73
73
  export const FlowLogicPlugin = Plugin.create({
74
74
  name: 'FlowLogicPlugin',
75
+ docs: [],
75
76
  records: {
76
77
  sys_hub_flow_logic_instance_v2: {
77
78
  relationships: {
@@ -5,6 +5,7 @@ import { getCallExpressionName } from '../../utils'
5
5
 
6
6
  export const ApprovalRulesPlugin = Plugin.create({
7
7
  name: 'ApprovalRulesPlugin',
8
+ docs: [],
8
9
  nodes: [
9
10
  {
10
11
  node: 'CallExpression',