@servicenow/sdk-build-plugins 4.2.0 → 4.4.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 (349) hide show
  1. package/dist/acl-plugin.js +11 -0
  2. package/dist/acl-plugin.js.map +1 -1
  3. package/dist/applicability-plugin.d.ts +2 -0
  4. package/dist/applicability-plugin.js +72 -0
  5. package/dist/applicability-plugin.js.map +1 -0
  6. package/dist/atf/test-plugin.js +5 -2
  7. package/dist/atf/test-plugin.js.map +1 -1
  8. package/dist/basic-syntax-plugin.js +7 -1
  9. package/dist/basic-syntax-plugin.js.map +1 -1
  10. package/dist/business-rule-plugin.js +1 -0
  11. package/dist/business-rule-plugin.js.map +1 -1
  12. package/dist/call-expression-plugin.js +1 -107
  13. package/dist/call-expression-plugin.js.map +1 -1
  14. package/dist/column/column-to-record.d.ts +10 -3
  15. package/dist/column/column-to-record.js +44 -7
  16. package/dist/column/column-to-record.js.map +1 -1
  17. package/dist/column-plugin.d.ts +3 -1
  18. package/dist/column-plugin.js +12 -12
  19. package/dist/column-plugin.js.map +1 -1
  20. package/dist/dashboard/dashboard-component-property-defaults.d.ts +152 -0
  21. package/dist/dashboard/dashboard-component-property-defaults.js +264 -0
  22. package/dist/dashboard/dashboard-component-property-defaults.js.map +1 -0
  23. package/dist/dashboard/dashboard-component-resolver.d.ts +13 -0
  24. package/dist/dashboard/dashboard-component-resolver.js +69 -0
  25. package/dist/dashboard/dashboard-component-resolver.js.map +1 -0
  26. package/dist/dashboard/dashboard-plugin.d.ts +12 -0
  27. package/dist/dashboard/dashboard-plugin.js +397 -0
  28. package/dist/dashboard/dashboard-plugin.js.map +1 -0
  29. package/dist/data-plugin.d.ts +3 -0
  30. package/dist/data-plugin.js +61 -113
  31. package/dist/data-plugin.js.map +1 -1
  32. package/dist/email-notification-plugin.d.ts +2 -0
  33. package/dist/email-notification-plugin.js +541 -0
  34. package/dist/email-notification-plugin.js.map +1 -0
  35. package/dist/flow/constants/flow-plugin-constants.d.ts +58 -0
  36. package/dist/flow/constants/flow-plugin-constants.js +70 -0
  37. package/dist/flow/constants/flow-plugin-constants.js.map +1 -0
  38. package/dist/flow/flow-logic/flow-logic-constants.d.ts +38 -0
  39. package/dist/flow/flow-logic/flow-logic-constants.js +118 -0
  40. package/dist/flow/flow-logic/flow-logic-constants.js.map +1 -0
  41. package/dist/flow/flow-logic/flow-logic-diagnostics.d.ts +19 -0
  42. package/dist/flow/flow-logic/flow-logic-diagnostics.js +503 -0
  43. package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -0
  44. package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +62 -0
  45. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +2092 -0
  46. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -0
  47. package/dist/flow/flow-logic/flow-logic-plugin.d.ts +52 -0
  48. package/dist/flow/flow-logic/flow-logic-plugin.js +283 -0
  49. package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -0
  50. package/dist/flow/flow-logic/flow-logic-shapes.d.ts +104 -0
  51. package/dist/flow/flow-logic/flow-logic-shapes.js +201 -0
  52. package/dist/flow/flow-logic/flow-logic-shapes.js.map +1 -0
  53. package/dist/flow/plugins/approval-rules-plugin.d.ts +2 -0
  54. package/dist/flow/plugins/approval-rules-plugin.js +49 -0
  55. package/dist/flow/plugins/approval-rules-plugin.js.map +1 -0
  56. package/dist/flow/plugins/flow-action-definition-plugin.d.ts +2 -0
  57. package/dist/flow/plugins/flow-action-definition-plugin.js +286 -0
  58. package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -0
  59. package/dist/flow/plugins/flow-data-pill-plugin.d.ts +9 -0
  60. package/dist/flow/plugins/flow-data-pill-plugin.js +212 -0
  61. package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -0
  62. package/dist/flow/plugins/flow-definition-plugin.d.ts +2 -0
  63. package/dist/flow/plugins/flow-definition-plugin.js +1668 -0
  64. package/dist/flow/plugins/flow-definition-plugin.js.map +1 -0
  65. package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +26 -0
  66. package/dist/flow/plugins/flow-diagnostics-plugin.js +217 -0
  67. package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -0
  68. package/dist/flow/plugins/flow-instance-plugin.d.ts +12 -0
  69. package/dist/flow/plugins/flow-instance-plugin.js +1205 -0
  70. package/dist/flow/plugins/flow-instance-plugin.js.map +1 -0
  71. package/dist/flow/plugins/flow-trigger-instance-plugin.d.ts +2 -0
  72. package/dist/flow/plugins/flow-trigger-instance-plugin.js +338 -0
  73. package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -0
  74. package/dist/flow/plugins/inline-script-plugin.d.ts +39 -0
  75. package/dist/flow/plugins/inline-script-plugin.js +80 -0
  76. package/dist/flow/plugins/inline-script-plugin.js.map +1 -0
  77. package/dist/flow/plugins/step-definition-plugin.d.ts +5 -0
  78. package/dist/flow/plugins/step-definition-plugin.js +71 -0
  79. package/dist/flow/plugins/step-definition-plugin.js.map +1 -0
  80. package/dist/flow/plugins/step-instance-plugin.d.ts +31 -0
  81. package/dist/flow/plugins/step-instance-plugin.js +339 -0
  82. package/dist/flow/plugins/step-instance-plugin.js.map +1 -0
  83. package/dist/flow/plugins/trigger-plugin.d.ts +2 -0
  84. package/dist/flow/plugins/trigger-plugin.js +96 -0
  85. package/dist/flow/plugins/trigger-plugin.js.map +1 -0
  86. package/dist/flow/plugins/wfa-datapill-plugin.d.ts +15 -0
  87. package/dist/flow/plugins/wfa-datapill-plugin.js +178 -0
  88. package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -0
  89. package/dist/flow/utils/approval-rules-processor.d.ts +13 -0
  90. package/dist/flow/utils/approval-rules-processor.js +267 -0
  91. package/dist/flow/utils/approval-rules-processor.js.map +1 -0
  92. package/dist/flow/utils/built-in-complex-objects.d.ts +19 -0
  93. package/dist/flow/utils/built-in-complex-objects.js +62 -0
  94. package/dist/flow/utils/built-in-complex-objects.js.map +1 -0
  95. package/dist/flow/utils/complex-object-resolver.d.ts +8 -0
  96. package/dist/flow/utils/complex-object-resolver.js +614 -0
  97. package/dist/flow/utils/complex-object-resolver.js.map +1 -0
  98. package/dist/flow/utils/complex-objects.d.ts +36 -0
  99. package/dist/flow/utils/complex-objects.js +481 -0
  100. package/dist/flow/utils/complex-objects.js.map +1 -0
  101. package/dist/flow/utils/data-pill-shapes.d.ts +58 -0
  102. package/dist/flow/utils/data-pill-shapes.js +135 -0
  103. package/dist/flow/utils/data-pill-shapes.js.map +1 -0
  104. package/dist/flow/utils/datapill-transformer.d.ts +110 -0
  105. package/dist/flow/utils/datapill-transformer.js +503 -0
  106. package/dist/flow/utils/datapill-transformer.js.map +1 -0
  107. package/dist/flow/utils/flow-constants.d.ts +72 -0
  108. package/dist/flow/utils/flow-constants.js +230 -0
  109. package/dist/flow/utils/flow-constants.js.map +1 -0
  110. package/dist/flow/utils/flow-io-to-record.d.ts +44 -0
  111. package/dist/flow/utils/flow-io-to-record.js +409 -0
  112. package/dist/flow/utils/flow-io-to-record.js.map +1 -0
  113. package/dist/flow/utils/flow-shapes.d.ts +161 -0
  114. package/dist/flow/utils/flow-shapes.js +255 -0
  115. package/dist/flow/utils/flow-shapes.js.map +1 -0
  116. package/dist/flow/utils/flow-to-xml.d.ts +16 -0
  117. package/dist/flow/utils/flow-to-xml.js +237 -0
  118. package/dist/flow/utils/flow-to-xml.js.map +1 -0
  119. package/dist/flow/utils/flow-variable-processor.d.ts +51 -0
  120. package/dist/flow/utils/flow-variable-processor.js +69 -0
  121. package/dist/flow/utils/flow-variable-processor.js.map +1 -0
  122. package/dist/flow/utils/label-cache-parser.d.ts +7 -0
  123. package/dist/flow/utils/label-cache-parser.js +24 -0
  124. package/dist/flow/utils/label-cache-parser.js.map +1 -0
  125. package/dist/flow/utils/label-cache-processor.d.ts +119 -0
  126. package/dist/flow/utils/label-cache-processor.js +719 -0
  127. package/dist/flow/utils/label-cache-processor.js.map +1 -0
  128. package/dist/flow/utils/pill-string-parser.d.ts +88 -0
  129. package/dist/flow/utils/pill-string-parser.js +306 -0
  130. package/dist/flow/utils/pill-string-parser.js.map +1 -0
  131. package/dist/flow/utils/schema-to-flow-object.d.ts +22 -0
  132. package/dist/flow/utils/schema-to-flow-object.js +318 -0
  133. package/dist/flow/utils/schema-to-flow-object.js.map +1 -0
  134. package/dist/flow/utils/service-catalog.d.ts +47 -0
  135. package/dist/flow/utils/service-catalog.js +137 -0
  136. package/dist/flow/utils/service-catalog.js.map +1 -0
  137. package/dist/flow/utils/utils.d.ts +117 -0
  138. package/dist/flow/utils/utils.js +345 -0
  139. package/dist/flow/utils/utils.js.map +1 -0
  140. package/dist/index.d.ts +20 -1
  141. package/dist/index.js +21 -1
  142. package/dist/index.js.map +1 -1
  143. package/dist/list-plugin.js +1 -1
  144. package/dist/list-plugin.js.map +1 -1
  145. package/dist/now-attach-plugin.d.ts +1 -0
  146. package/dist/now-attach-plugin.js +10 -10
  147. package/dist/now-attach-plugin.js.map +1 -1
  148. package/dist/now-ref-plugin.js +1 -1
  149. package/dist/now-ref-plugin.js.map +1 -1
  150. package/dist/record-plugin.d.ts +29 -0
  151. package/dist/record-plugin.js +66 -7
  152. package/dist/record-plugin.js.map +1 -1
  153. package/dist/repack/index.d.ts +2 -0
  154. package/dist/repack/index.js +8 -0
  155. package/dist/repack/index.js.map +1 -1
  156. package/dist/rest-api-plugin.js +54 -44
  157. package/dist/rest-api-plugin.js.map +1 -1
  158. package/dist/server-module-plugin/index.d.ts +10 -0
  159. package/dist/server-module-plugin/index.js +83 -59
  160. package/dist/server-module-plugin/index.js.map +1 -1
  161. package/dist/service-catalog/catalog-clientscript-plugin.d.ts +2 -0
  162. package/dist/service-catalog/catalog-clientscript-plugin.js +117 -0
  163. package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -0
  164. package/dist/service-catalog/catalog-item-plugin.d.ts +2 -0
  165. package/dist/service-catalog/catalog-item-plugin.js +115 -0
  166. package/dist/service-catalog/catalog-item-plugin.js.map +1 -0
  167. package/dist/service-catalog/catalog-ui-policy-plugin.d.ts +2 -0
  168. package/dist/service-catalog/catalog-ui-policy-plugin.js +266 -0
  169. package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -0
  170. package/dist/service-catalog/index.d.ts +5 -0
  171. package/dist/service-catalog/index.js +22 -0
  172. package/dist/service-catalog/index.js.map +1 -0
  173. package/dist/service-catalog/record-to-shape.d.ts +6 -0
  174. package/dist/service-catalog/record-to-shape.js +93 -0
  175. package/dist/service-catalog/record-to-shape.js.map +1 -0
  176. package/dist/service-catalog/sc-record-producer-plugin.d.ts +2 -0
  177. package/dist/service-catalog/sc-record-producer-plugin.js +140 -0
  178. package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -0
  179. package/dist/service-catalog/service-catalog-base.d.ts +311 -0
  180. package/dist/service-catalog/service-catalog-base.js +542 -0
  181. package/dist/service-catalog/service-catalog-base.js.map +1 -0
  182. package/dist/service-catalog/service-catalog-diagnostics.d.ts +45 -0
  183. package/dist/service-catalog/service-catalog-diagnostics.js +172 -0
  184. package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -0
  185. package/dist/service-catalog/shape-to-record.d.ts +8 -0
  186. package/dist/service-catalog/shape-to-record.js +235 -0
  187. package/dist/service-catalog/shape-to-record.js.map +1 -0
  188. package/dist/service-catalog/utils.d.ts +323 -0
  189. package/dist/service-catalog/utils.js +1216 -0
  190. package/dist/service-catalog/utils.js.map +1 -0
  191. package/dist/service-catalog/variable-helper.d.ts +43 -0
  192. package/dist/service-catalog/variable-helper.js +92 -0
  193. package/dist/service-catalog/variable-helper.js.map +1 -0
  194. package/dist/service-catalog/variable-set-plugin.d.ts +2 -0
  195. package/dist/service-catalog/variable-set-plugin.js +175 -0
  196. package/dist/service-catalog/variable-set-plugin.js.map +1 -0
  197. package/dist/service-catalog/variables-transform.d.ts +139 -0
  198. package/dist/service-catalog/variables-transform.js +403 -0
  199. package/dist/service-catalog/variables-transform.js.map +1 -0
  200. package/dist/sla/sla-validators.d.ts +61 -0
  201. package/dist/sla/sla-validators.js +224 -0
  202. package/dist/sla/sla-validators.js.map +1 -0
  203. package/dist/sla-plugin.d.ts +5 -0
  204. package/dist/sla-plugin.js +280 -0
  205. package/dist/sla-plugin.js.map +1 -0
  206. package/dist/static-content-plugin.js +25 -2
  207. package/dist/static-content-plugin.js.map +1 -1
  208. package/dist/table-plugin.js +32 -15
  209. package/dist/table-plugin.js.map +1 -1
  210. package/dist/ui-page-plugin.js +832 -19
  211. package/dist/ui-page-plugin.js.map +1 -1
  212. package/dist/ui-policy-plugin.js +5 -7
  213. package/dist/ui-policy-plugin.js.map +1 -1
  214. package/dist/utils.d.ts +10 -1
  215. package/dist/utils.js +16 -0
  216. package/dist/utils.js.map +1 -1
  217. package/dist/ux-list-menu-config-plugin.d.ts +2 -0
  218. package/dist/ux-list-menu-config-plugin.js +292 -0
  219. package/dist/ux-list-menu-config-plugin.js.map +1 -0
  220. package/dist/workspace-plugin/chrome-tab.d.ts +2 -0
  221. package/dist/workspace-plugin/chrome-tab.js +46 -0
  222. package/dist/workspace-plugin/chrome-tab.js.map +1 -0
  223. package/dist/workspace-plugin/constants.d.ts +52 -0
  224. package/dist/workspace-plugin/constants.js +56 -0
  225. package/dist/workspace-plugin/constants.js.map +1 -0
  226. package/dist/workspace-plugin/fluent-utils.d.ts +9 -0
  227. package/dist/workspace-plugin/fluent-utils.js +60 -0
  228. package/dist/workspace-plugin/fluent-utils.js.map +1 -0
  229. package/dist/workspace-plugin/page.d.ts +8 -0
  230. package/dist/workspace-plugin/page.js +108 -0
  231. package/dist/workspace-plugin/page.js.map +1 -0
  232. package/dist/workspace-plugin/screen.d.ts +1 -0
  233. package/dist/workspace-plugin/screen.js +38 -0
  234. package/dist/workspace-plugin/screen.js.map +1 -0
  235. package/dist/workspace-plugin/templates/index.d.ts +10 -0
  236. package/dist/workspace-plugin/templates/index.js +20 -0
  237. package/dist/workspace-plugin/templates/index.js.map +1 -0
  238. package/dist/workspace-plugin/templates/record-page-composition.d.ts +1 -0
  239. package/dist/workspace-plugin/templates/record-page-composition.js +4043 -0
  240. package/dist/workspace-plugin/templates/record-page-composition.js.map +1 -0
  241. package/dist/workspace-plugin/templates/record-page-data.d.ts +1 -0
  242. package/dist/workspace-plugin/templates/record-page-data.js +527 -0
  243. package/dist/workspace-plugin/templates/record-page-data.js.map +1 -0
  244. package/dist/workspace-plugin/templates/record-page-interalEventMappings.d.ts +1 -0
  245. package/dist/workspace-plugin/templates/record-page-interalEventMappings.js +39 -0
  246. package/dist/workspace-plugin/templates/record-page-interalEventMappings.js.map +1 -0
  247. package/dist/workspace-plugin/templates/record-page-layoutModel.d.ts +1 -0
  248. package/dist/workspace-plugin/templates/record-page-layoutModel.js +55 -0
  249. package/dist/workspace-plugin/templates/record-page-layoutModel.js.map +1 -0
  250. package/dist/workspace-plugin/templates/record-page-properties.d.ts +1 -0
  251. package/dist/workspace-plugin/templates/record-page-properties.js +135 -0
  252. package/dist/workspace-plugin/templates/record-page-properties.js.map +1 -0
  253. package/dist/workspace-plugin/templates/record-page.d.ts +3 -0
  254. package/dist/workspace-plugin/templates/record-page.js +8 -0
  255. package/dist/workspace-plugin/templates/record-page.js.map +1 -0
  256. package/dist/workspace-plugin.d.ts +2 -0
  257. package/dist/workspace-plugin.js +453 -0
  258. package/dist/workspace-plugin.js.map +1 -0
  259. package/package.json +10 -12
  260. package/src/acl-plugin.ts +16 -1
  261. package/src/applicability-plugin.ts +82 -0
  262. package/src/atf/test-plugin.ts +6 -3
  263. package/src/basic-syntax-plugin.ts +10 -1
  264. package/src/business-rule-plugin.ts +2 -1
  265. package/src/call-expression-plugin.ts +2 -130
  266. package/src/column/column-to-record.ts +54 -8
  267. package/src/column-plugin.ts +29 -13
  268. package/src/dashboard/dashboard-component-property-defaults.ts +277 -0
  269. package/src/dashboard/dashboard-component-resolver.ts +69 -0
  270. package/src/dashboard/dashboard-plugin.ts +450 -0
  271. package/src/data-plugin.ts +67 -139
  272. package/src/email-notification-plugin.ts +850 -0
  273. package/src/flow/constants/flow-plugin-constants.ts +79 -0
  274. package/src/flow/flow-logic/flow-logic-constants.ts +120 -0
  275. package/src/flow/flow-logic/flow-logic-diagnostics.ts +591 -0
  276. package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +2550 -0
  277. package/src/flow/flow-logic/flow-logic-plugin.ts +337 -0
  278. package/src/flow/flow-logic/flow-logic-shapes.ts +215 -0
  279. package/src/flow/plugins/approval-rules-plugin.ts +48 -0
  280. package/src/flow/plugins/flow-action-definition-plugin.ts +295 -0
  281. package/src/flow/plugins/flow-data-pill-plugin.ts +258 -0
  282. package/src/flow/plugins/flow-definition-plugin.ts +2173 -0
  283. package/src/flow/plugins/flow-diagnostics-plugin.ts +280 -0
  284. package/src/flow/plugins/flow-instance-plugin.ts +1499 -0
  285. package/src/flow/plugins/flow-trigger-instance-plugin.ts +444 -0
  286. package/src/flow/plugins/inline-script-plugin.ts +83 -0
  287. package/src/flow/plugins/step-definition-plugin.ts +67 -0
  288. package/src/flow/plugins/step-instance-plugin.ts +431 -0
  289. package/src/flow/plugins/trigger-plugin.ts +95 -0
  290. package/src/flow/plugins/wfa-datapill-plugin.ts +213 -0
  291. package/src/flow/utils/approval-rules-processor.ts +298 -0
  292. package/src/flow/utils/built-in-complex-objects.ts +81 -0
  293. package/src/flow/utils/complex-object-resolver.ts +875 -0
  294. package/src/flow/utils/complex-objects.ts +656 -0
  295. package/src/flow/utils/data-pill-shapes.ts +165 -0
  296. package/src/flow/utils/datapill-transformer.ts +632 -0
  297. package/src/flow/utils/flow-constants.ts +285 -0
  298. package/src/flow/utils/flow-io-to-record.ts +533 -0
  299. package/src/flow/utils/flow-shapes.ts +296 -0
  300. package/src/flow/utils/flow-to-xml.ts +318 -0
  301. package/src/flow/utils/flow-variable-processor.ts +100 -0
  302. package/src/flow/utils/label-cache-parser.ts +37 -0
  303. package/src/flow/utils/label-cache-processor.ts +870 -0
  304. package/src/flow/utils/pill-string-parser.ts +375 -0
  305. package/src/flow/utils/schema-to-flow-object.ts +385 -0
  306. package/src/flow/utils/service-catalog.ts +174 -0
  307. package/src/flow/utils/utils.ts +395 -0
  308. package/src/index.ts +20 -1
  309. package/src/list-plugin.ts +1 -1
  310. package/src/now-attach-plugin.ts +14 -11
  311. package/src/now-ref-plugin.ts +1 -1
  312. package/src/record-plugin.ts +76 -11
  313. package/src/repack/index.ts +14 -0
  314. package/src/rest-api-plugin.ts +62 -50
  315. package/src/server-module-plugin/index.ts +112 -86
  316. package/src/service-catalog/catalog-clientscript-plugin.ts +140 -0
  317. package/src/service-catalog/catalog-item-plugin.ts +162 -0
  318. package/src/service-catalog/catalog-ui-policy-plugin.ts +324 -0
  319. package/src/service-catalog/index.ts +5 -0
  320. package/src/service-catalog/record-to-shape.ts +109 -0
  321. package/src/service-catalog/sc-record-producer-plugin.ts +201 -0
  322. package/src/service-catalog/service-catalog-base.ts +600 -0
  323. package/src/service-catalog/service-catalog-diagnostics.ts +254 -0
  324. package/src/service-catalog/shape-to-record.ts +279 -0
  325. package/src/service-catalog/utils.ts +1455 -0
  326. package/src/service-catalog/variable-helper.ts +135 -0
  327. package/src/service-catalog/variable-set-plugin.ts +197 -0
  328. package/src/service-catalog/variables-transform.ts +438 -0
  329. package/src/sla/sla-validators.ts +331 -0
  330. package/src/sla-plugin.ts +358 -0
  331. package/src/static-content-plugin.ts +25 -2
  332. package/src/table-plugin.ts +49 -16
  333. package/src/ui-page-plugin.ts +1063 -20
  334. package/src/ui-policy-plugin.ts +5 -9
  335. package/src/utils.ts +24 -1
  336. package/src/ux-list-menu-config-plugin.ts +312 -0
  337. package/src/workspace-plugin/chrome-tab.ts +44 -0
  338. package/src/workspace-plugin/constants.ts +53 -0
  339. package/src/workspace-plugin/fluent-utils.ts +60 -0
  340. package/src/workspace-plugin/page.ts +139 -0
  341. package/src/workspace-plugin/screen.ts +34 -0
  342. package/src/workspace-plugin/templates/index.ts +17 -0
  343. package/src/workspace-plugin/templates/record-page-composition.ts +4051 -0
  344. package/src/workspace-plugin/templates/record-page-data.ts +523 -0
  345. package/src/workspace-plugin/templates/record-page-interalEventMappings.ts +35 -0
  346. package/src/workspace-plugin/templates/record-page-layoutModel.ts +51 -0
  347. package/src/workspace-plugin/templates/record-page-properties.ts +131 -0
  348. package/src/workspace-plugin/templates/record-page.ts +6 -0
  349. package/src/workspace-plugin.ts +574 -0
@@ -0,0 +1,600 @@
1
+ import { Shape, DurationShape } from '@servicenow/sdk-build-core'
2
+ import type { Record, Database, Logger, ObjectShape, Factory, ShapeTransform } from '@servicenow/sdk-build-core'
3
+ import { NowIdShape } from '../now-id-plugin'
4
+ import { ModuleFunctionShape } from '../server-module-plugin'
5
+ import { variableToCallExpression } from './record-to-shape'
6
+ import {
7
+ convertToNumber,
8
+ convertRolesToString,
9
+ DEFAULT_DELIVERY_TIME,
10
+ parseString,
11
+ getFulfillmentAutomationLevelFromDb,
12
+ getFulfillmentAutomationLevelToDb,
13
+ getAvailabilityFromDb,
14
+ getAvailabilityToDb,
15
+ getMobilePictureTypeFromDb,
16
+ getMobilePictureTypeToDb,
17
+ } from './utils'
18
+
19
+ /**
20
+ * Shared relationship definitions for both CatalogItem and CatalogItemRecordProducer
21
+ * These relationships are identical since CatalogItemRecordProducer extends CatalogItem
22
+ */
23
+ export const CatalogItemBaseRelationships = {
24
+ //update
25
+ sc_cat_item_user_criteria_mtom: {
26
+ via: 'sc_cat_item',
27
+ descendant: true,
28
+ relationships: {
29
+ user_criteria: {
30
+ via: 'user_criteria',
31
+ inverse: true,
32
+ },
33
+ },
34
+ },
35
+ sc_cat_item_user_criteria_no_mtom: {
36
+ via: 'sc_cat_item',
37
+ descendant: true,
38
+ relationships: {
39
+ user_criteria: {
40
+ via: 'user_criteria',
41
+ inverse: true,
42
+ },
43
+ },
44
+ },
45
+ io_set_item: {
46
+ via: 'sc_cat_item',
47
+ descendant: true,
48
+ relationships: {
49
+ item_option_new_set: {
50
+ via: 'variable_set',
51
+ inverse: true,
52
+ },
53
+ },
54
+ },
55
+ sc_cat_item_catalog: {
56
+ via: 'sc_cat_item',
57
+ descendant: true,
58
+ relationships: {
59
+ sc_catalog: {
60
+ via: 'sc_catalog',
61
+ inverse: true,
62
+ },
63
+ },
64
+ },
65
+ sc_cat_item_category: {
66
+ via: 'sc_cat_item',
67
+ descendant: true,
68
+ relationships: {
69
+ sc_category: {
70
+ via: 'sc_category',
71
+ inverse: true,
72
+ },
73
+ },
74
+ },
75
+ m2m_connected_content: {
76
+ via: 'catalog_item',
77
+ descendant: true,
78
+ relationships: {
79
+ topic: {
80
+ via: 'topic',
81
+ inverse: true,
82
+ },
83
+ },
84
+ },
85
+ fx_price: {
86
+ via: 'id',
87
+ descendant: true,
88
+ },
89
+ item_option_new: {
90
+ via: 'cat_item',
91
+ descendant: true,
92
+ relationships: {
93
+ question_choice: {
94
+ via: 'question',
95
+ descendant: true,
96
+ relationships: {
97
+ fx_price: {
98
+ via: 'id',
99
+ descendant: true,
100
+ },
101
+ },
102
+ },
103
+ fx_price: {
104
+ via: 'id',
105
+ descendant: true,
106
+ },
107
+ },
108
+ },
109
+ } as const
110
+
111
+ /**
112
+ * Shared coalesce definitions for both CatalogItem and CatalogItemRecordProducer
113
+ * These define unique key combinations for M2M and related records
114
+ */
115
+ export const CatalogItemBaseCoalesce = {
116
+ sc_cat_item_user_criteria_mtom: {
117
+ coalesce: ['sc_cat_item', 'user_criteria'] as [string, string],
118
+ },
119
+ sc_cat_item_user_criteria_no_mtom: {
120
+ coalesce: ['sc_cat_item', 'user_criteria'] as [string, string],
121
+ },
122
+ io_set_item: {
123
+ coalesce: ['sc_cat_item', 'variable_set'] as [string, string],
124
+ },
125
+ sc_cat_item_catalog: {
126
+ coalesce: ['sc_cat_item', 'sc_catalog'] as [string, string],
127
+ },
128
+ sc_cat_item_category: {
129
+ coalesce: ['sc_cat_item', 'sc_category'] as [string, string],
130
+ },
131
+ m2m_connected_content: {
132
+ coalesce: ['catalog_item', 'topic'] as [string, string],
133
+ },
134
+ fx_price: {
135
+ coalesce: ['id', 'field'] as [string, string],
136
+ },
137
+ item_option_new: {
138
+ coalesce: ['cat_item', 'variable_set', 'name'] as [string, string, string],
139
+ },
140
+ question_choice: {
141
+ coalesce: ['question', 'value'] as [string, string],
142
+ },
143
+ }
144
+
145
+ /**
146
+ * Builds variables schema from item_option_new descendants
147
+ * Shared logic for both CatalogItem and CatalogItemRecordProducer
148
+ * Variables are sorted by order field (defaulting to 0 if empty) and empty names are skipped
149
+ */
150
+ export function buildVariablesSchema(descendants: Database, logger: Logger) {
151
+ const variables = descendants.query('item_option_new').sort((a, b) => {
152
+ const orderA = convertToNumber(a.get('order'), 0)
153
+ const orderB = convertToNumber(b.get('order'), 0)
154
+ return orderA - orderB
155
+ })
156
+
157
+ const variablesSchema: globalThis.Record<string, unknown> = {}
158
+ for (const variable of variables) {
159
+ const variableName = variable.get('name').ifString()?.getValue()
160
+
161
+ // Skip variables with empty names
162
+ if (!variableName || variableName.trim() === '') {
163
+ continue
164
+ }
165
+
166
+ variablesSchema[variableName] = variableToCallExpression(variable, descendants, logger)
167
+ }
168
+ return variablesSchema
169
+ }
170
+
171
+ /**
172
+ * Common field data extraction - fields with HIGH usage in BOTH CatalogItem AND CatalogItemRecordProducer
173
+ * These fields appear on both forms and are frequently used
174
+ */
175
+ export function buildCommonCatalogFields(descendants: Database) {
176
+ const categories = descendants.query('sc_cat_item_category').map((m2m) => m2m.get('sc_category'))
177
+ const availableFor = descendants.query('sc_cat_item_user_criteria_mtom').map((m2m) => m2m.get('user_criteria'))
178
+ const notAvailableFor = descendants
179
+ .query('sc_cat_item_user_criteria_no_mtom')
180
+ .map((m2m) => m2m.get('user_criteria'))
181
+ const variableSets = descendants
182
+ .query('io_set_item')
183
+ .map((m2m) => {
184
+ return {
185
+ variableSet: m2m.get('variable_set'),
186
+ order: convertToNumber(m2m.get('order'), 0),
187
+ }
188
+ })
189
+ .sort((a, b) => a.order - b.order)
190
+ const assignedTopics = descendants.query('m2m_connected_content').map((m2m) => m2m.get('topic'))
191
+
192
+ return {
193
+ categories,
194
+ availableFor,
195
+ notAvailableFor,
196
+ variableSets,
197
+ assignedTopics,
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Transforms common catalog fields from record to shape (record → fluent)
203
+ * These fields have HIGH usage in both CatalogItem and CatalogItemRecordProducer forms
204
+ */
205
+ export function transformCatalogBaseFieldsToShape(record: Record, $: ShapeTransform, descendants: Database) {
206
+ const { categories, availableFor, notAvailableFor, variableSets, assignedTopics } =
207
+ buildCommonCatalogFields(descendants)
208
+
209
+ return {
210
+ $id: $.val(NowIdShape.from(record)),
211
+ name: $,
212
+ active: $.toBoolean().def(true),
213
+ accessType: $.from('access_type').def('restricted'),
214
+ assignedTopics: $.val(assignedTopics).def([]),
215
+ availability: $.map((v: Shape) => getAvailabilityFromDb(v.toString().getValue())).def('desktopOnly'),
216
+ availableFor: $.val(availableFor).def([]),
217
+ catalogs: $.from('sc_catalogs')
218
+ .map((v: Shape) => {
219
+ const str = v.ifString()?.getValue()?.trim()
220
+ return str ? str.split(',').map((s) => s.trim()) : []
221
+ })
222
+ .def([]),
223
+ categories: $.from('category')
224
+ .map((c: Shape) => {
225
+ if (categories.length > 0) {
226
+ return categories
227
+ }
228
+ return c.ifString()?.ifNotEmpty()?.getValue()?.trim() ? [c.toString()] : []
229
+ })
230
+ .def([]),
231
+ checkedOut: $.from('checked_out')
232
+ .map((c: Shape) => (c.ifString()?.isEmpty() ? '' : c.toBoolean()))
233
+ .def(''),
234
+ description: $.def(''),
235
+ hideAttachment: $.from('no_attachment_v2').toBoolean().def(false),
236
+ hideSaveAsDraft: $.from('no_save_as_draft').toBoolean().def(false),
237
+ icon: $.def(''),
238
+ mandatoryAttachment: $.from('mandatory_attachment').toBoolean().def(false),
239
+ meta: $.map((v: Shape) => parseString(v)).def([]),
240
+ mobilePicture: $.from('mobile_picture').def(''),
241
+ notAvailableFor: $.val(notAvailableFor).def([]),
242
+ order: $.map((c: Shape) => convertToNumber(c, 0)).def(0),
243
+ owner: $.def(''),
244
+ picture: $.def(''),
245
+ roles: $.map((v: Shape) => parseString(v)).def([]),
246
+ shortDescription: $.from('short_description').def(''),
247
+ showVariableHelpOnLoad: $.from('show_variable_help_on_load').toBoolean().def(false),
248
+ startClosed: $.from('start_closed').toBoolean().def(false),
249
+ state: $.def(''),
250
+ type: $.def('item'),
251
+ useScLayout: $.from('use_sc_layout').toBoolean().def(true),
252
+ variableSets: $.val(variableSets).def([]),
253
+ version: $.map((c: Shape) => convertToNumber(c, 1)).def(1),
254
+ view: $.def(''),
255
+ visibleBundle: $.from('visible_bundle').toBoolean().def(true),
256
+ visibleGuide: $.from('visible_guide').toBoolean().def(true),
257
+ visibleStandalone: $.from('visible_standalone').toBoolean().def(true),
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Transforms common catalog fields from shape to record (fluent → platform)
263
+ * These fields have HIGH usage in both CatalogItem and CatalogItemRecordProducer forms
264
+ */
265
+ export function transformCatalogItemBaseFieldsToRecord($: ShapeTransform) {
266
+ return {
267
+ name: $,
268
+ active: $.def(true),
269
+ access_type: $.from('accessType').def('restricted'),
270
+ availability: $.from('availability')
271
+ .map((v: Shape) => getAvailabilityToDb(v.toString().getValue()))
272
+ .def('on_desktop'),
273
+ category: $.from('categories')
274
+ .map((v: Shape) => {
275
+ const elements = v.ifArray()?.getElements() ?? []
276
+ if (elements.length === 0) {
277
+ return undefined
278
+ }
279
+ const firstElement = elements[0]
280
+ return firstElement?.ifString()?.getValue() || firstElement?.ifRecord()?.getId()?.getValue()
281
+ })
282
+ .def(''),
283
+ checked_out: $.from('checkedOut'),
284
+ description: $.def('').toCdata(),
285
+ icon: $.def(''),
286
+ mandatory_attachment: $.from('mandatoryAttachment').def(false),
287
+ meta: $.map((v: Shape) =>
288
+ v
289
+ .ifArray()
290
+ ?.getElements()
291
+ .map((e: Shape) => e.getValue())
292
+ .join(',')
293
+ ).def(''),
294
+ mobile_picture: $.from('mobilePicture').def(''),
295
+ no_attachment_v2: $.from('hideAttachment').def(false),
296
+ no_save_as_draft: $.from('hideSaveAsDraft').def(false),
297
+ order: $.def(0),
298
+ owner: $.def(''),
299
+ picture: $.def(''),
300
+ roles: $.map(convertRolesToString).def(''),
301
+ sc_catalogs: $.from('catalogs')
302
+ .map((v: Shape) =>
303
+ v
304
+ .ifArray()
305
+ ?.map((r: Shape) => (r.ifRecord()?.getId() ?? r.toString()).getValue())
306
+ .join(',')
307
+ )
308
+ .def([]),
309
+ short_description: $.from('shortDescription').def(''),
310
+ show_variable_help_on_load: $.from('showVariableHelpOnLoad').def(false),
311
+ state: $.def(''),
312
+ start_closed: $.from('startClosed').def(false),
313
+ taxonomy_topic: $.from('assignedTopics')
314
+ .map((v: Shape) => {
315
+ const elements = v.ifArray()?.getElements() ?? []
316
+ if (elements.length === 0) {
317
+ return undefined
318
+ }
319
+ const firstElement = elements[0]
320
+ return firstElement?.ifString()?.getValue() || firstElement?.ifRecord()?.getId()?.getValue()
321
+ })
322
+ .def(''),
323
+ type: $.def('item'),
324
+ use_sc_layout: $.from('useScLayout').def(true),
325
+ version: $.def(1),
326
+ view: $.def(''),
327
+ visible_bundle: $.from('visibleBundle').def(true),
328
+ visible_guide: $.from('visibleGuide').def(true),
329
+ visible_standalone: $.from('visibleStandalone').def(true),
330
+ }
331
+ }
332
+
333
+ /**
334
+ * CatalogItem-ONLY field transformations (LOW/RARE usage in CatalogItemRecordProducer)
335
+ * These fields are not commonly shown on CatalogItemRecordProducer forms
336
+ */
337
+ export function transformCatalogItemSpecificFieldsToShape(record: Record, $: ShapeTransform, descendants: Database) {
338
+ const pricingDetails = descendants
339
+ .query('fx_price', {
340
+ id: record.getId().getValue(),
341
+ })
342
+ .map((m2m) => {
343
+ const amount = convertToNumber(m2m.get('amount'), 0)
344
+ const currencyType = m2m.get('currency').getValue()
345
+ const field = m2m.get('field').getValue()
346
+ return { amount, currencyType, field }
347
+ })
348
+
349
+ const rawDeliveryTimeValue = record.get('delivery_time').ifString()?.getValue()
350
+ const deliveryTime = rawDeliveryTimeValue
351
+ ? DurationShape.from(record, Shape.from(record, rawDeliveryTimeValue).asString()).getDuration()
352
+ : {}
353
+
354
+ return {
355
+ // Pricing fields
356
+ billable: $.toBoolean().def(false),
357
+ cost: $.map((c: Shape) => convertToNumber(c, 0)).def(0),
358
+ ignorePrice: $.from('ignore_price').toBoolean().def(true),
359
+ omitPrice: $.from('omit_price').toBoolean().def(false),
360
+ pricingDetails: $.val(pricingDetails).def([]),
361
+ mobileHidePrice: $.from('mobile_hide_price').toBoolean().def(false),
362
+
363
+ // Automation fields
364
+ executionPlan: $.from('delivery_plan').def(''),
365
+ flow: $.from('flow_designer_flow').def(''),
366
+ fulfillmentAutomationLevel: $.from('fulfillment_automation_level')
367
+ .map((v: Shape) => getFulfillmentAutomationLevelFromDb(v.toString().getValue()))
368
+ .def('unspecified'),
369
+ fulfillmentGroup: $.from('group').def(''),
370
+ workflow: $.def(''),
371
+
372
+ // Delivery fields
373
+ deliveryTime: $.val(deliveryTime).def({}),
374
+ displayPriceProperty: $.from('display_price_property').def('non_zero'),
375
+ requestMethod: $.from('request_method')
376
+ .map((v: Shape) => (v.ifString()?.isEmpty() ? undefined : v.getValue()))
377
+ .def('order'),
378
+ hideAddToCart: $.from('no_cart_v2').toBoolean().def(false),
379
+ hideQuantitySelector: $.from('no_quantity_v2').toBoolean().def(false),
380
+ hideDeliveryTime: $.from('no_delivery_time_v2').toBoolean().def(false),
381
+ customCart: $.from('custom_cart').def(''),
382
+ recurringFrequency: $.from('recurring_frequency').def(''),
383
+
384
+ // Legacy fields (backward compatibility)
385
+ noCart: $.from('no_cart').toBoolean().def(false),
386
+ noOrder: $.from('no_order').toBoolean().def(false),
387
+ noOrderNow: $.from('no_order_now').toBoolean().def(false),
388
+ noProceedCheckout: $.from('no_proceed_checkout').toBoolean().def(false),
389
+ noQuantity: $.from('no_quantity').toBoolean().def(false),
390
+ noSearch: $.from('no_search').toBoolean().def(false),
391
+ hideAddToWishList: $.from('no_wishlist_v2').toBoolean().def(false),
392
+
393
+ // Additional fields
394
+ hideSP: $.from('hide_sp').toBoolean().def(false),
395
+ image: $.def(''),
396
+ makeItemNonConversational: $.from('make_item_non_conversational').toBoolean().def(false),
397
+ mobilePictureType: $.from('mobile_picture_type')
398
+ .map((v: Shape) => getMobilePictureTypeFromDb(v.toString().getValue()))
399
+ .def('desktopPicture'),
400
+ model: $.def(''),
401
+ vendor: $.def(''),
402
+ location: $.def(''),
403
+ }
404
+ }
405
+
406
+ /**
407
+ * CatalogItem-ONLY field transformations for toRecord (fluent → platform)
408
+ */
409
+ export function transformCatalogItemSpecificFieldsToRecord(arg: ObjectShape, $: ShapeTransform) {
410
+ const rawDeliveryTime = arg.get('deliveryTime')
411
+ const deliveryTime = rawDeliveryTime.isUndefined()
412
+ ? DEFAULT_DELIVERY_TIME
413
+ : DurationShape.from(
414
+ rawDeliveryTime.getSource(),
415
+ rawDeliveryTime.asObject().isDefined() ? rawDeliveryTime.asObject() : rawDeliveryTime.asString()
416
+ )
417
+ .toString()
418
+ .getValue()
419
+
420
+ return {
421
+ // Pricing
422
+ billable: $.def(false),
423
+ cost: $.def(0),
424
+ ignore_price: $.from('ignorePrice').def(true),
425
+ omit_price: $.from('omitPrice').def(false),
426
+ mobile_hide_price: $.from('mobileHidePrice').def(false),
427
+
428
+ // Automation fields
429
+ delivery_plan: $.from('executionPlan').def(''),
430
+ flow_designer_flow: $.from('flow').def(''),
431
+ fulfillment_automation_level: $.from('fulfillmentAutomationLevel')
432
+ .map((v: Shape) => getFulfillmentAutomationLevelToDb(v.toString().getValue()))
433
+ .def('unspecified'),
434
+ group: $.from('fulfillmentGroup').def(''),
435
+ workflow: $.def(''),
436
+
437
+ // Delivery
438
+ delivery_time: $.val(deliveryTime).def({}),
439
+ delivery_plan_script: $.from('deliveryPlanScript')
440
+ .map((v: Shape) => v.if(ModuleFunctionShape)?.toString((n: string) => `${n}({{PARAMS}})`, ['current']) ?? v)
441
+ .toCdata()
442
+ .def(''),
443
+ display_price_property: $.from('displayPriceProperty').def('non_zero'),
444
+ entitlement_script: $.from('entitlementScript')
445
+ .map((v: Shape) => v.if(ModuleFunctionShape)?.toString((n: string) => `${n}({{PARAMS}})`, ['current']) ?? v)
446
+ .toCdata()
447
+ .def(''),
448
+ request_method: $.from('requestMethod')
449
+ .map((v: Shape) => (v.ifString()?.getValue() === 'order' ? '' : v.getValue()))
450
+ .def(''),
451
+ no_cart_v2: $.from('hideAddToCart').def(false),
452
+ no_quantity_v2: $.from('hideQuantitySelector').def(false),
453
+ no_delivery_time_v2: $.from('hideDeliveryTime').def(false),
454
+ custom_cart: $.from('customCart').def(''),
455
+ recurring_frequency: $.from('recurringFrequency').def(''),
456
+
457
+ // Legacy
458
+ no_cart: $.from('noCart').def(false),
459
+ no_order: $.from('noOrder').def(false),
460
+ no_order_now: $.from('noOrderNow').def(false),
461
+ no_proceed_checkout: $.from('noProceedCheckout').def(false),
462
+ no_quantity: $.from('noQuantity').def(false),
463
+ no_search: $.from('noSearch').def(false),
464
+ no_wishlist_v2: $.from('hideAddToWishList').def(false),
465
+
466
+ // Additional
467
+ hide_sp: $.from('hideSP').def(false),
468
+ image: $.def(''),
469
+ make_item_non_conversational: $.from('makeItemNonConversational').def(false),
470
+ mobile_picture_type: $.from('mobilePictureType')
471
+ .map((v: Shape) => getMobilePictureTypeToDb(v.toString().getValue()))
472
+ .def('use_desktop_picture'),
473
+ model: $.def(''),
474
+ vendor: $.def(''),
475
+ location: $.def(''),
476
+ }
477
+ }
478
+
479
+ /**
480
+ * Creates M2M records for catalogs, categories, variable sets, etc.
481
+ * This logic is shared between CatalogItem and CatalogItemRecordProducer
482
+ */
483
+ export async function createSharedM2MRecords(
484
+ callExpression: Shape,
485
+ arg: ObjectShape,
486
+ parentRecord: Record,
487
+ factory: Factory
488
+ ) {
489
+ const catalogs = arg.get('catalogs').ifArray()?.getElements() ?? []
490
+ const categories = arg.get('categories').ifArray()?.getElements() ?? []
491
+ const variableSets = arg.get('variableSets').ifArray()?.getElements() ?? []
492
+ const availableFor = arg.get('availableFor').ifArray()?.getElements() ?? []
493
+ const notAvailableFor = arg.get('notAvailableFor').ifArray()?.getElements() ?? []
494
+ const assignedTopics = arg.get('assignedTopics').ifArray()?.getElements() ?? []
495
+
496
+ const catalogsRecords: Record[] = []
497
+ for (const catalog of catalogs) {
498
+ catalogsRecords.push(
499
+ await factory.createRecord({
500
+ source: callExpression,
501
+ table: 'sc_cat_item_catalog',
502
+ properties: {
503
+ sc_cat_item: parentRecord,
504
+ sc_catalog: catalog.isString() ? catalog.getValue() : catalog,
505
+ },
506
+ })
507
+ )
508
+ }
509
+
510
+ const categoriesRecords: Record[] = []
511
+ for (const category of categories) {
512
+ categoriesRecords.push(
513
+ await factory.createRecord({
514
+ source: callExpression,
515
+ table: 'sc_cat_item_category',
516
+ properties: {
517
+ sc_cat_item: parentRecord,
518
+ sc_category: category.isString() ? category.getValue() : category,
519
+ },
520
+ })
521
+ )
522
+ }
523
+
524
+ const variableSetRecords: Record[] = []
525
+ for (const variableSet of variableSets) {
526
+ const varObj = variableSet.asObject()
527
+ variableSetRecords.push(
528
+ await factory.createRecord({
529
+ source: callExpression,
530
+ table: 'io_set_item',
531
+ properties: {
532
+ sc_cat_item: parentRecord,
533
+ variable_set: varObj.get('variableSet').isString()
534
+ ? varObj.get('variableSet').getValue()
535
+ : varObj.get('variableSet'),
536
+ order: (() => {
537
+ const orderShape = varObj.get('order')
538
+ return orderShape.ifString()?.isEmpty() || orderShape.isUndefined()
539
+ ? 100
540
+ : orderShape.toNumber().getValue()
541
+ })(),
542
+ },
543
+ })
544
+ )
545
+ }
546
+
547
+ const availableForRecords: Record[] = []
548
+ for (const item of availableFor) {
549
+ availableForRecords.push(
550
+ await factory.createRecord({
551
+ source: callExpression,
552
+ table: 'sc_cat_item_user_criteria_mtom',
553
+ properties: {
554
+ sc_cat_item: parentRecord,
555
+ user_criteria: item.isString() ? item.getValue() : item,
556
+ },
557
+ })
558
+ )
559
+ }
560
+
561
+ const notAvailableForRecords: Record[] = []
562
+ for (const item of notAvailableFor) {
563
+ notAvailableForRecords.push(
564
+ await factory.createRecord({
565
+ source: callExpression,
566
+ table: 'sc_cat_item_user_criteria_no_mtom',
567
+ properties: {
568
+ sc_cat_item: parentRecord,
569
+ user_criteria: item.isString() ? item.getValue() : item,
570
+ },
571
+ })
572
+ )
573
+ }
574
+
575
+ const assignedTopicsRecords: Record[] = []
576
+ for (const assignedTopic of assignedTopics) {
577
+ assignedTopicsRecords.push(
578
+ await factory.createRecord({
579
+ source: callExpression,
580
+ table: 'm2m_connected_content',
581
+ properties: {
582
+ content_type: '98f9a16553622010069addeeff7b1248', // catalog item is fixed
583
+ catalog_item: parentRecord,
584
+ topic: assignedTopic.isString() ? assignedTopic.getValue() : assignedTopic,
585
+ source: 'user',
586
+ order: '100',
587
+ },
588
+ })
589
+ )
590
+ }
591
+
592
+ return {
593
+ catalogsRecords,
594
+ categoriesRecords,
595
+ variableSetRecords,
596
+ availableForRecords,
597
+ notAvailableForRecords,
598
+ assignedTopicsRecords,
599
+ }
600
+ }