@servicenow/sdk-build-plugins 3.0.3 → 4.0.1

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 (359) hide show
  1. package/dist/acl-plugin.d.ts +19 -0
  2. package/dist/acl-plugin.js +210 -0
  3. package/dist/acl-plugin.js.map +1 -0
  4. package/dist/application-menu-plugin.d.ts +18 -0
  5. package/dist/application-menu-plugin.js +104 -0
  6. package/dist/application-menu-plugin.js.map +1 -0
  7. package/dist/arrow-function-plugin.d.ts +16 -0
  8. package/dist/arrow-function-plugin.js +107 -0
  9. package/dist/arrow-function-plugin.js.map +1 -0
  10. package/dist/atf/step-configs.d.ts +39 -0
  11. package/dist/atf/step-configs.js +2334 -0
  12. package/dist/atf/step-configs.js.map +1 -0
  13. package/dist/atf/test-plugin.d.ts +4 -0
  14. package/dist/atf/test-plugin.js +600 -0
  15. package/dist/atf/test-plugin.js.map +1 -0
  16. package/dist/basic-syntax-plugin.d.ts +2 -0
  17. package/dist/basic-syntax-plugin.js +636 -0
  18. package/dist/basic-syntax-plugin.js.map +1 -0
  19. package/dist/business-rule-plugin.d.ts +3 -0
  20. package/dist/business-rule-plugin.js +205 -0
  21. package/dist/business-rule-plugin.js.map +1 -0
  22. package/dist/call-expression-plugin.d.ts +2 -0
  23. package/dist/call-expression-plugin.js +175 -0
  24. package/dist/call-expression-plugin.js.map +1 -0
  25. package/dist/client-script-plugin.d.ts +29 -0
  26. package/dist/client-script-plugin.js +164 -0
  27. package/dist/client-script-plugin.js.map +1 -0
  28. package/dist/column/column-helper.d.ts +12 -0
  29. package/dist/column/column-helper.js +84 -0
  30. package/dist/column/column-helper.js.map +1 -0
  31. package/dist/column/column-to-record.d.ts +3 -0
  32. package/dist/column/column-to-record.js +105 -0
  33. package/dist/column/column-to-record.js.map +1 -0
  34. package/dist/column-plugin.d.ts +8 -0
  35. package/dist/column-plugin.js +453 -0
  36. package/dist/column-plugin.js.map +1 -0
  37. package/dist/cross-scope-privilege-plugin.d.ts +15 -0
  38. package/dist/cross-scope-privilege-plugin.js +82 -0
  39. package/dist/cross-scope-privilege-plugin.js.map +1 -0
  40. package/dist/html-import-plugin.d.ts +2 -0
  41. package/dist/html-import-plugin.js +72 -0
  42. package/dist/html-import-plugin.js.map +1 -0
  43. package/dist/index.d.ts +37 -21
  44. package/dist/index.js +40 -45
  45. package/dist/index.js.map +1 -1
  46. package/dist/json-plugin.d.ts +15 -0
  47. package/dist/json-plugin.js +104 -0
  48. package/dist/json-plugin.js.map +1 -0
  49. package/dist/list-plugin.d.ts +2 -0
  50. package/dist/list-plugin.js +191 -0
  51. package/dist/list-plugin.js.map +1 -0
  52. package/dist/now-config-plugin.d.ts +4 -0
  53. package/dist/now-config-plugin.js +154 -0
  54. package/dist/now-config-plugin.js.map +1 -0
  55. package/dist/now-id-plugin.d.ts +11 -0
  56. package/dist/now-id-plugin.js +71 -0
  57. package/dist/now-id-plugin.js.map +1 -0
  58. package/dist/now-include-plugin.d.ts +16 -0
  59. package/dist/now-include-plugin.js +118 -0
  60. package/dist/now-include-plugin.js.map +1 -0
  61. package/dist/now-ref-plugin.d.ts +2 -0
  62. package/dist/now-ref-plugin.js +43 -0
  63. package/dist/now-ref-plugin.js.map +1 -0
  64. package/dist/now-unresolved-plugin.d.ts +2 -0
  65. package/dist/now-unresolved-plugin.js +32 -0
  66. package/dist/now-unresolved-plugin.js.map +1 -0
  67. package/dist/package-json-plugin.d.ts +2 -0
  68. package/dist/package-json-plugin.js +70 -0
  69. package/dist/package-json-plugin.js.map +1 -0
  70. package/dist/property-plugin.d.ts +2 -0
  71. package/dist/property-plugin.js +105 -0
  72. package/dist/property-plugin.js.map +1 -0
  73. package/dist/record-plugin.d.ts +43 -0
  74. package/dist/record-plugin.js +147 -0
  75. package/dist/record-plugin.js.map +1 -0
  76. package/dist/repack/index.d.ts +1 -0
  77. package/dist/repack/index.js +10 -2
  78. package/dist/repack/index.js.map +1 -1
  79. package/dist/repack/lint/Rules.d.ts +1 -1
  80. package/dist/repack/lint/Rules.js +7 -3
  81. package/dist/repack/lint/Rules.js.map +1 -1
  82. package/dist/repack/lint/index.js +1 -1
  83. package/dist/rest-api-plugin.d.ts +2 -0
  84. package/dist/rest-api-plugin.js +469 -0
  85. package/dist/rest-api-plugin.js.map +1 -0
  86. package/dist/role-plugin.d.ts +2 -0
  87. package/dist/role-plugin.js +117 -0
  88. package/dist/role-plugin.js.map +1 -0
  89. package/dist/script-action-plugin.d.ts +2 -0
  90. package/dist/script-action-plugin.js +62 -0
  91. package/dist/script-action-plugin.js.map +1 -0
  92. package/dist/script-include-plugin.d.ts +2 -0
  93. package/dist/script-include-plugin.js +102 -0
  94. package/dist/script-include-plugin.js.map +1 -0
  95. package/dist/server-module-plugin/index.d.ts +14 -0
  96. package/dist/server-module-plugin/index.js +378 -0
  97. package/dist/server-module-plugin/index.js.map +1 -0
  98. package/dist/server-module-plugin/sbom-builder.d.ts +45 -0
  99. package/dist/server-module-plugin/sbom-builder.js +179 -0
  100. package/dist/server-module-plugin/sbom-builder.js.map +1 -0
  101. package/dist/service-portal/angular-provider-plugin.d.ts +2 -0
  102. package/dist/service-portal/angular-provider-plugin.js +78 -0
  103. package/dist/service-portal/angular-provider-plugin.js.map +1 -0
  104. package/dist/service-portal/dependency-plugin.d.ts +2 -0
  105. package/dist/service-portal/dependency-plugin.js +235 -0
  106. package/dist/service-portal/dependency-plugin.js.map +1 -0
  107. package/dist/service-portal/widget-plugin.d.ts +6 -0
  108. package/dist/service-portal/widget-plugin.js +230 -0
  109. package/dist/service-portal/widget-plugin.js.map +1 -0
  110. package/dist/static-content-plugin.d.ts +2 -0
  111. package/dist/static-content-plugin.js +272 -0
  112. package/dist/static-content-plugin.js.map +1 -0
  113. package/dist/table-plugin.d.ts +3 -0
  114. package/dist/table-plugin.js +1324 -0
  115. package/dist/table-plugin.js.map +1 -0
  116. package/dist/ui-action-plugin.d.ts +2 -0
  117. package/dist/ui-action-plugin.js +291 -0
  118. package/dist/ui-action-plugin.js.map +1 -0
  119. package/dist/ui-page-plugin.d.ts +2 -0
  120. package/dist/ui-page-plugin.js +165 -0
  121. package/dist/ui-page-plugin.js.map +1 -0
  122. package/dist/user-preference-plugin.d.ts +15 -0
  123. package/dist/user-preference-plugin.js +63 -0
  124. package/dist/user-preference-plugin.js.map +1 -0
  125. package/dist/utils.d.ts +17 -0
  126. package/dist/utils.js +72 -0
  127. package/dist/utils.js.map +1 -0
  128. package/dist/view-plugin.d.ts +2 -0
  129. package/dist/view-plugin.js +45 -0
  130. package/dist/view-plugin.js.map +1 -0
  131. package/package.json +17 -13
  132. package/src/acl-plugin.ts +256 -0
  133. package/src/application-menu-plugin.ts +109 -0
  134. package/src/arrow-function-plugin.ts +127 -0
  135. package/src/atf/step-configs.ts +2384 -0
  136. package/src/atf/test-plugin.ts +739 -0
  137. package/src/basic-syntax-plugin.ts +729 -0
  138. package/src/business-rule-plugin.ts +266 -0
  139. package/src/call-expression-plugin.ts +202 -0
  140. package/src/client-script-plugin.ts +179 -0
  141. package/src/column/column-helper.ts +119 -0
  142. package/src/column/column-to-record.ts +131 -0
  143. package/src/column-plugin.ts +506 -0
  144. package/src/cross-scope-privilege-plugin.ts +82 -0
  145. package/src/html-import-plugin.ts +79 -0
  146. package/src/index.ts +39 -21
  147. package/src/json-plugin.ts +128 -0
  148. package/src/list-plugin.ts +222 -0
  149. package/src/now-config-plugin.ts +194 -0
  150. package/src/now-id-plugin.ts +78 -0
  151. package/src/now-include-plugin.ts +140 -0
  152. package/src/now-ref-plugin.ts +48 -0
  153. package/src/now-unresolved-plugin.ts +30 -0
  154. package/src/package-json-plugin.ts +87 -0
  155. package/src/property-plugin.ts +118 -0
  156. package/src/record-plugin.ts +171 -0
  157. package/src/repack/index.ts +10 -1
  158. package/src/repack/lint/Rules.ts +5 -4
  159. package/src/repack/lint/index.ts +1 -1
  160. package/src/rest-api-plugin.ts +658 -0
  161. package/src/role-plugin.ts +128 -0
  162. package/src/script-action-plugin.ts +63 -0
  163. package/src/script-include-plugin.ts +110 -0
  164. package/src/server-module-plugin/index.ts +470 -0
  165. package/src/server-module-plugin/sbom-builder.ts +183 -0
  166. package/src/service-portal/angular-provider-plugin.ts +83 -0
  167. package/src/service-portal/dependency-plugin.ts +284 -0
  168. package/src/service-portal/widget-plugin.ts +263 -0
  169. package/src/static-content-plugin.ts +254 -0
  170. package/src/table-plugin.ts +1698 -0
  171. package/src/ui-action-plugin.ts +324 -0
  172. package/src/ui-page-plugin.ts +168 -0
  173. package/src/user-preference-plugin.ts +62 -0
  174. package/src/utils.ts +69 -0
  175. package/src/view-plugin.ts +46 -0
  176. package/dist/AttachmentPlugin.d.ts +0 -254
  177. package/dist/AttachmentPlugin.js +0 -220
  178. package/dist/AttachmentPlugin.js.map +0 -1
  179. package/dist/BusinessRulePlugin.d.ts +0 -30
  180. package/dist/BusinessRulePlugin.js +0 -149
  181. package/dist/BusinessRulePlugin.js.map +0 -1
  182. package/dist/CrossScopePrivilegePlugin.d.ts +0 -35
  183. package/dist/CrossScopePrivilegePlugin.js +0 -80
  184. package/dist/CrossScopePrivilegePlugin.js.map +0 -1
  185. package/dist/DefaultPlugin.d.ts +0 -86
  186. package/dist/DefaultPlugin.js +0 -226
  187. package/dist/DefaultPlugin.js.map +0 -1
  188. package/dist/HtmlTemplatePlugin.d.ts +0 -21
  189. package/dist/HtmlTemplatePlugin.js +0 -29
  190. package/dist/HtmlTemplatePlugin.js.map +0 -1
  191. package/dist/IdPlugin.d.ts +0 -28
  192. package/dist/IdPlugin.js +0 -68
  193. package/dist/IdPlugin.js.map +0 -1
  194. package/dist/IncludePlugin.d.ts +0 -34
  195. package/dist/IncludePlugin.js +0 -155
  196. package/dist/IncludePlugin.js.map +0 -1
  197. package/dist/JsonPlugin.d.ts +0 -28
  198. package/dist/JsonPlugin.js +0 -69
  199. package/dist/JsonPlugin.js.map +0 -1
  200. package/dist/ListPlugin.d.ts +0 -93
  201. package/dist/ListPlugin.js +0 -456
  202. package/dist/ListPlugin.js.map +0 -1
  203. package/dist/NowConfigPlugin.d.ts +0 -45
  204. package/dist/NowConfigPlugin.js +0 -64
  205. package/dist/NowConfigPlugin.js.map +0 -1
  206. package/dist/PackageJsonPlugin.d.ts +0 -34
  207. package/dist/PackageJsonPlugin.js +0 -63
  208. package/dist/PackageJsonPlugin.js.map +0 -1
  209. package/dist/PropertyPlugin.d.ts +0 -51
  210. package/dist/PropertyPlugin.js +0 -181
  211. package/dist/PropertyPlugin.js.map +0 -1
  212. package/dist/ScriptTemplatePlugin.d.ts +0 -13
  213. package/dist/ScriptTemplatePlugin.js +0 -55
  214. package/dist/ScriptTemplatePlugin.js.map +0 -1
  215. package/dist/ServerModulePlugin.d.ts +0 -75
  216. package/dist/ServerModulePlugin.js +0 -368
  217. package/dist/ServerModulePlugin.js.map +0 -1
  218. package/dist/UserPreferencePlugin.d.ts +0 -19
  219. package/dist/UserPreferencePlugin.js +0 -32
  220. package/dist/UserPreferencePlugin.js.map +0 -1
  221. package/dist/aclAndRole/AclPlugin.d.ts +0 -82
  222. package/dist/aclAndRole/AclPlugin.js +0 -262
  223. package/dist/aclAndRole/AclPlugin.js.map +0 -1
  224. package/dist/aclAndRole/RolePlugin.d.ts +0 -66
  225. package/dist/aclAndRole/RolePlugin.js +0 -179
  226. package/dist/aclAndRole/RolePlugin.js.map +0 -1
  227. package/dist/aclAndRole/Util.d.ts +0 -3
  228. package/dist/aclAndRole/Util.js +0 -90
  229. package/dist/aclAndRole/Util.js.map +0 -1
  230. package/dist/app/ApplicationMenuPlugin.d.ts +0 -34
  231. package/dist/app/ApplicationMenuPlugin.js +0 -112
  232. package/dist/app/ApplicationMenuPlugin.js.map +0 -1
  233. package/dist/db/ColumnPlugins.d.ts +0 -750
  234. package/dist/db/ColumnPlugins.js +0 -114
  235. package/dist/db/ColumnPlugins.js.map +0 -1
  236. package/dist/db/DBUtils.d.ts +0 -2
  237. package/dist/db/DBUtils.js +0 -27
  238. package/dist/db/DBUtils.js.map +0 -1
  239. package/dist/db/DocumentationPlugin.d.ts +0 -67
  240. package/dist/db/DocumentationPlugin.js +0 -258
  241. package/dist/db/DocumentationPlugin.js.map +0 -1
  242. package/dist/db/LicensingPlugin.d.ts +0 -60
  243. package/dist/db/LicensingPlugin.js +0 -117
  244. package/dist/db/LicensingPlugin.js.map +0 -1
  245. package/dist/db/RecordPlugin.d.ts +0 -133
  246. package/dist/db/RecordPlugin.js +0 -337
  247. package/dist/db/RecordPlugin.js.map +0 -1
  248. package/dist/db/TablePlugin.d.ts +0 -231
  249. package/dist/db/TablePlugin.js +0 -1630
  250. package/dist/db/TablePlugin.js.map +0 -1
  251. package/dist/db/index.d.ts +0 -6
  252. package/dist/db/index.js +0 -32
  253. package/dist/db/index.js.map +0 -1
  254. package/dist/scriptedRESTAPI/RESTDeserializationUtils.d.ts +0 -10
  255. package/dist/scriptedRESTAPI/RESTDeserializationUtils.js +0 -373
  256. package/dist/scriptedRESTAPI/RESTDeserializationUtils.js.map +0 -1
  257. package/dist/scriptedRESTAPI/RESTSerializationUtils.d.ts +0 -13
  258. package/dist/scriptedRESTAPI/RESTSerializationUtils.js +0 -177
  259. package/dist/scriptedRESTAPI/RESTSerializationUtils.js.map +0 -1
  260. package/dist/scriptedRESTAPI/RestApiPlugin.d.ts +0 -81
  261. package/dist/scriptedRESTAPI/RestApiPlugin.js +0 -345
  262. package/dist/scriptedRESTAPI/RestApiPlugin.js.map +0 -1
  263. package/dist/scriptedRESTAPI/RestSchemaUtils.d.ts +0 -190
  264. package/dist/scriptedRESTAPI/RestSchemaUtils.js +0 -53
  265. package/dist/scriptedRESTAPI/RestSchemaUtils.js.map +0 -1
  266. package/dist/scriptedRESTAPI/RestUtils.d.ts +0 -69
  267. package/dist/scriptedRESTAPI/RestUtils.js +0 -497
  268. package/dist/scriptedRESTAPI/RestUtils.js.map +0 -1
  269. package/dist/scripts/ClientScriptPlugin.d.ts +0 -64
  270. package/dist/scripts/ClientScriptPlugin.js +0 -170
  271. package/dist/scripts/ClientScriptPlugin.js.map +0 -1
  272. package/dist/scripts/scriptUtils.d.ts +0 -1
  273. package/dist/scripts/scriptUtils.js +0 -9
  274. package/dist/scripts/scriptUtils.js.map +0 -1
  275. package/dist/uxf/ExperiencePlugin.d.ts +0 -45
  276. package/dist/uxf/ExperiencePlugin.js +0 -61
  277. package/dist/uxf/ExperiencePlugin.js.map +0 -1
  278. package/dist/uxf/RoutesPlugin.d.ts +0 -29
  279. package/dist/uxf/RoutesPlugin.js +0 -181
  280. package/dist/uxf/RoutesPlugin.js.map +0 -1
  281. package/dist/uxf/UxfFormulaParser/cleanUxValue.d.ts +0 -4
  282. package/dist/uxf/UxfFormulaParser/cleanUxValue.js +0 -65
  283. package/dist/uxf/UxfFormulaParser/cleanUxValue.js.map +0 -1
  284. package/dist/uxf/UxfFormulaParser/grammerParser/api.d.ts +0 -189
  285. package/dist/uxf/UxfFormulaParser/grammerParser/api.js +0 -158
  286. package/dist/uxf/UxfFormulaParser/grammerParser/api.js.map +0 -1
  287. package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.d.ts +0 -13
  288. package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js +0 -604
  289. package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js.map +0 -1
  290. package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.d.ts +0 -12
  291. package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.js +0 -551
  292. package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.js.map +0 -1
  293. package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.d.ts +0 -31
  294. package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.js +0 -64
  295. package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.js.map +0 -1
  296. package/dist/uxf/UxfFormulaParser/index.d.ts +0 -3
  297. package/dist/uxf/UxfFormulaParser/index.js +0 -11
  298. package/dist/uxf/UxfFormulaParser/index.js.map +0 -1
  299. package/dist/uxf/UxfFormulaParser/parser.d.ts +0 -8
  300. package/dist/uxf/UxfFormulaParser/parser.js +0 -87
  301. package/dist/uxf/UxfFormulaParser/parser.js.map +0 -1
  302. package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.d.ts +0 -8
  303. package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.js +0 -17
  304. package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.js.map +0 -1
  305. package/dist/uxf/constants.d.ts +0 -2
  306. package/dist/uxf/constants.js +0 -8
  307. package/dist/uxf/constants.js.map +0 -1
  308. package/dist/uxf/index.d.ts +0 -2
  309. package/dist/uxf/index.js +0 -11
  310. package/dist/uxf/index.js.map +0 -1
  311. package/dist/uxf/tectonicIdGenerator.d.ts +0 -12
  312. package/dist/uxf/tectonicIdGenerator.js +0 -79
  313. package/dist/uxf/tectonicIdGenerator.js.map +0 -1
  314. package/src/AttachmentPlugin.ts +0 -268
  315. package/src/BusinessRulePlugin.ts +0 -238
  316. package/src/CrossScopePrivilegePlugin.ts +0 -115
  317. package/src/DefaultPlugin.ts +0 -288
  318. package/src/HtmlTemplatePlugin.ts +0 -31
  319. package/src/IdPlugin.ts +0 -74
  320. package/src/IncludePlugin.ts +0 -206
  321. package/src/JsonPlugin.ts +0 -76
  322. package/src/ListPlugin.ts +0 -570
  323. package/src/NowConfigPlugin.ts +0 -69
  324. package/src/PackageJsonPlugin.ts +0 -68
  325. package/src/PropertyPlugin.ts +0 -237
  326. package/src/ScriptTemplatePlugin.ts +0 -53
  327. package/src/ServerModulePlugin.ts +0 -480
  328. package/src/UserPreferencePlugin.ts +0 -45
  329. package/src/aclAndRole/AclPlugin.ts +0 -420
  330. package/src/aclAndRole/RolePlugin.ts +0 -254
  331. package/src/aclAndRole/Util.ts +0 -113
  332. package/src/app/ApplicationMenuPlugin.ts +0 -165
  333. package/src/db/ColumnPlugins.ts +0 -114
  334. package/src/db/DBUtils.ts +0 -36
  335. package/src/db/DocumentationPlugin.ts +0 -316
  336. package/src/db/LicensingPlugin.ts +0 -138
  337. package/src/db/RecordPlugin.ts +0 -459
  338. package/src/db/TablePlugin.ts +0 -2072
  339. package/src/db/index.ts +0 -6
  340. package/src/scriptedRESTAPI/RESTDeserializationUtils.ts +0 -419
  341. package/src/scriptedRESTAPI/RESTSerializationUtils.ts +0 -228
  342. package/src/scriptedRESTAPI/RestApiPlugin.ts +0 -469
  343. package/src/scriptedRESTAPI/RestSchemaUtils.ts +0 -72
  344. package/src/scriptedRESTAPI/RestUtils.ts +0 -569
  345. package/src/scripts/ClientScriptPlugin.ts +0 -257
  346. package/src/scripts/scriptUtils.ts +0 -5
  347. package/src/uxf/ExperiencePlugin.ts +0 -67
  348. package/src/uxf/RoutesPlugin.ts +0 -211
  349. package/src/uxf/UxfFormulaParser/cleanUxValue.ts +0 -73
  350. package/src/uxf/UxfFormulaParser/grammerParser/api.js +0 -166
  351. package/src/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js +0 -606
  352. package/src/uxf/UxfFormulaParser/grammerParser/grammarParser.js +0 -551
  353. package/src/uxf/UxfFormulaParser/grammerParser/spanHelpers.js +0 -65
  354. package/src/uxf/UxfFormulaParser/index.ts +0 -4
  355. package/src/uxf/UxfFormulaParser/parser.ts +0 -64
  356. package/src/uxf/UxfFormulaParser/utils/getErrorMsg.ts +0 -13
  357. package/src/uxf/constants.ts +0 -4
  358. package/src/uxf/index.ts +0 -2
  359. package/src/uxf/tectonicIdGenerator.ts +0 -78
@@ -0,0 +1,19 @@
1
+ import { Plugin } from '@servicenow/sdk-build-core';
2
+ /**
3
+ * @param config - an object containing the following properties:
4
+ * * **$id** - unique id for the record, typically using `Now.ID["value"]`
5
+ * * **operation** - the operation this ACL rule secure
6
+ * * **active**? - whether the ACL is enabled
7
+ * * **adminOverrides**? - indicates whether users with the admin role automatically pass the permissions check for this ACL rule
8
+ * * **condition**? - a filter query that specifies the fields and values that must be true for users to access the object
9
+ * * **decisionType**? - whether the ACL should allow or deny access
10
+ * * **description**? - description of the object or permissions this ACL rule secures
11
+ * * **localOrExisting**? - if `"Local"`: A security attribute based on the
12
+ * condition property that is saved only for the ACL it is created in\
13
+ * if `"Exisiting"`: An existing security attribute to reference in the `security_attribute` property
14
+ * * **roles**? - `Role` objects or sys_ids of roles that a user must have to access the object
15
+ * * **script**? - a function or inline script preceded by a `script` tagged
16
+ * template literal. The script should define the permissions required to access the object
17
+ * * **securityAttribute**? - pre-defined conditions to use. For example, whether a user is impersonating another user
18
+ */
19
+ export declare const AclPlugin: Plugin;
@@ -0,0 +1,210 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AclPlugin = void 0;
4
+ const sdk_build_core_1 = require("@servicenow/sdk-build-core");
5
+ const app_1 = require("@servicenow/sdk-core/runtime/app");
6
+ const server_module_plugin_1 = require("./server-module-plugin");
7
+ const now_id_plugin_1 = require("./now-id-plugin");
8
+ const utils_1 = require("./utils");
9
+ const ExecuteOnlyTypes = new Set([
10
+ 'client_callable_flow_object',
11
+ 'client_callable_script_include',
12
+ 'graphql',
13
+ 'processor',
14
+ 'rest_endpoint',
15
+ ]);
16
+ const aclAliases = {
17
+ adminOverrides: ['admin_overrides'],
18
+ decisionType: ['decision_type'],
19
+ localOrExisting: ['local_or_existing'],
20
+ securityAttribute: ['security_attribute'],
21
+ appliesTo: ['applies_to'],
22
+ };
23
+ /**
24
+ * @param config - an object containing the following properties:
25
+ * * **$id** - unique id for the record, typically using `Now.ID["value"]`
26
+ * * **operation** - the operation this ACL rule secure
27
+ * * **active**? - whether the ACL is enabled
28
+ * * **adminOverrides**? - indicates whether users with the admin role automatically pass the permissions check for this ACL rule
29
+ * * **condition**? - a filter query that specifies the fields and values that must be true for users to access the object
30
+ * * **decisionType**? - whether the ACL should allow or deny access
31
+ * * **description**? - description of the object or permissions this ACL rule secures
32
+ * * **localOrExisting**? - if `"Local"`: A security attribute based on the
33
+ * condition property that is saved only for the ACL it is created in\
34
+ * if `"Exisiting"`: An existing security attribute to reference in the `security_attribute` property
35
+ * * **roles**? - `Role` objects or sys_ids of roles that a user must have to access the object
36
+ * * **script**? - a function or inline script preceded by a `script` tagged
37
+ * template literal. The script should define the permissions required to access the object
38
+ * * **securityAttribute**? - pre-defined conditions to use. For example, whether a user is impersonating another user
39
+ */
40
+ exports.AclPlugin = sdk_build_core_1.Plugin.create({
41
+ name: 'AclPlugin',
42
+ records: {
43
+ sys_security_acl: {
44
+ relationships: {
45
+ sys_security_acl_role: {
46
+ via: 'sys_security_acl',
47
+ descendant: true,
48
+ relationships: {
49
+ sys_user_role: {
50
+ via: 'sys_user_role',
51
+ inverse: true,
52
+ },
53
+ },
54
+ },
55
+ },
56
+ toShape(record, { descendants }) {
57
+ const type = reverseLookup(app_1.AclTypes, record.get('type').getValue()) || record.get('type');
58
+ const roles = descendants.query('sys_security_acl_role').map((m2m) => m2m.get('sys_user_role'));
59
+ return {
60
+ success: true,
61
+ value: new sdk_build_core_1.CallExpressionShape({
62
+ source: record,
63
+ callee: 'Acl',
64
+ args: [
65
+ record
66
+ .transform(({ $, merge }) => ({
67
+ $id: $.val(now_id_plugin_1.NowIdShape.from(record)),
68
+ condition: $.def(''),
69
+ description: $.def(''),
70
+ localOrExisting: $.from('local_or_existing').def('Local'),
71
+ active: $.toBoolean().def(true),
72
+ decisionType: $.from('decision_type').def('allow'),
73
+ adminOverrides: $.from('admin_overrides').toBoolean().def(true),
74
+ appliesTo: $.from('applies_to').def(''),
75
+ type: $.val(type),
76
+ securityAttribute: $.from('security_attribute')
77
+ .map((v) => reverseLookup(app_1.AclAttributes, v.getValue()) || v)
78
+ .def(''),
79
+ operation: $.map((v) => reverseLookup(app_1.AclOperations, v.getValue()) || v),
80
+ script: $.map((v) => v.ifString()?.getValue()).def(''),
81
+ roles: $.val(roles.length > 0 ? roles : undefined),
82
+ [merge]: $.from('type', 'name').map((type, name) => getTableOrName(type.pipe((t) => reverseLookup(app_1.AclTypes, t.getValue())), name.asString().getValue())),
83
+ }))
84
+ .withAliasedKeys(aclAliases),
85
+ ],
86
+ }),
87
+ };
88
+ },
89
+ },
90
+ sys_security_acl_role: {
91
+ coalesce: ['sys_security_acl', 'sys_user_role'],
92
+ },
93
+ },
94
+ shapes: [
95
+ {
96
+ shape: sdk_build_core_1.CallExpressionShape,
97
+ fileTypes: ['fluent'],
98
+ async toRecord(callExpression, { config, diagnostics, factory }) {
99
+ if (callExpression.getCallee() !== 'Acl') {
100
+ return { success: false };
101
+ }
102
+ const arg = callExpression.getArgument(0).asObject().withAliasedKeys(aclAliases);
103
+ (0, utils_1.generateDeprecatedDiagnostics)(arg, diagnostics);
104
+ const operation = arg.get('operation');
105
+ const type = arg.get('type').asString();
106
+ if (!operation.equals('execute') && ExecuteOnlyTypes.has(type.getValue())) {
107
+ diagnostics.error(operation, `ACL must use operation 'execute', because it is of type '${type.getValue()}'`);
108
+ }
109
+ const script = arg.get('script');
110
+ const advanced = !script.isUndefined();
111
+ if (advanced && type.equals('graphql')) {
112
+ diagnostics.error(script, `ACL does not support scripts, because it is of type graphql`);
113
+ }
114
+ const appliesTo = arg.get('appliesTo').ifString();
115
+ if (appliesTo && !type.equals('record')) {
116
+ diagnostics.error(appliesTo, `ACL cannot set applies_to unless its type is 'record'`);
117
+ }
118
+ if (operation.equals('add_to_list')) {
119
+ const condition = arg.get('condition').ifString();
120
+ if (advanced) {
121
+ diagnostics.error(script, `ACL cannot have a script due to its 'add_to_list' operation`);
122
+ }
123
+ else if (condition) {
124
+ diagnostics.error(condition, `ACL cannot have a condition due to its 'add_to_list' operation`);
125
+ }
126
+ }
127
+ if (arg.get('script').isUnresolved()) {
128
+ diagnostics.error(arg.get('script').getOriginalNode(), `Unable to resolve the script reference, ensure the imported module is within the ${config.serverModulesDir} directory.`);
129
+ }
130
+ const acl = factory.createRecord({
131
+ source: callExpression,
132
+ table: 'sys_security_acl',
133
+ explicitId: arg.get('$id'),
134
+ properties: arg.transform(({ $ }) => ({
135
+ active: $.def(true),
136
+ decision_type: $.from('decisionType').def('allow'),
137
+ description: $.def(''),
138
+ local_or_existing: $.from('localOrExisting').def('Local'),
139
+ admin_overrides: $.from('adminOverrides').def(true),
140
+ condition: $.def(''),
141
+ applies_to: $.from('appliesTo').def(''),
142
+ name: $.from('name', 'table', 'field').map((n, t, f) => n.ifString() ?? (f.ifString() ? `${t.getValue()}.${f.getValue()}` : t)),
143
+ type: $.map((type) => app_1.AclTypes[type.asString().getValue()] ?? type),
144
+ operation: $.map((op) => app_1.AclOperations[op.asString().getValue()] ?? op),
145
+ advanced: $.val(advanced),
146
+ script: $.map((v) => v.if(server_module_plugin_1.ModuleFunctionShape)?.toString((n) => `answer = ${n}({{PARAMS}})`, ['current']) ??
147
+ v).toCdata(),
148
+ security_attribute: $.from('securityAttribute').map((v) => v.ifString()?.pipe((v) => app_1.AclAttributes[v.getValue()]) ?? v),
149
+ })),
150
+ });
151
+ const roles = arg.get('roles').ifArray()?.getElements() ?? [];
152
+ const securityAttribute = arg.get('securityAttribute');
153
+ const attributeRecord = securityAttribute.ifRecord();
154
+ if (roles.length < 1) {
155
+ if (!securityAttribute.getValue() && !advanced && !arg.get('condition').getValue()) {
156
+ diagnostics.warn(callExpression, 'ACLs must have at least one of the following: roles, security_attribute, condition, or script');
157
+ }
158
+ else if (attributeRecord) {
159
+ const localOrExisting = arg.get('localOrExisting').ifString()?.getValue();
160
+ if (localOrExisting === 'Existing' &&
161
+ (attributeRecord.get('type').getValue() !== 'compound' ||
162
+ attributeRecord.get('is_localized').getValue())) {
163
+ diagnostics.error(arg, `Invalid ACL with 'Existing' security_attribute: Must have a security_attribute with a type of 'compound' and is_localized set to false.`);
164
+ }
165
+ else if ((!localOrExisting || localOrExisting === 'Local') &&
166
+ !attributeRecord.get('is_localized').ifBoolean()?.getValue()) {
167
+ diagnostics.error(arg, `Invalid ACL with 'Local' security_attribute: security_attribute must have is_localized set to true`);
168
+ }
169
+ }
170
+ }
171
+ return {
172
+ success: true,
173
+ value: acl.with(...roles.map((role) => factory.createRecord({
174
+ source: callExpression,
175
+ table: 'sys_security_acl_role',
176
+ properties: {
177
+ sys_security_acl: acl,
178
+ sys_user_role: role.ifString()?.pipe((roleNameOrGuid) => (0, sdk_build_core_1.isGUID)(roleNameOrGuid.getValue())
179
+ ? factory.createReference({
180
+ source: roleNameOrGuid,
181
+ table: 'sys_user_role',
182
+ guid: roleNameOrGuid.getValue(),
183
+ })
184
+ : factory.createReference({
185
+ source: roleNameOrGuid,
186
+ table: 'sys_user_role',
187
+ keys: { name: roleNameOrGuid },
188
+ })) ?? role,
189
+ },
190
+ }))),
191
+ };
192
+ },
193
+ },
194
+ ],
195
+ });
196
+ function getTableOrName(type, name) {
197
+ if (app_1.AclNamedTypes[type]) {
198
+ return { name };
199
+ }
200
+ const split = name.indexOf('.');
201
+ const table = split === -1 ? name : name.substring(0, split);
202
+ const field = split === -1 ? '' : name.substring(split + 1);
203
+ return { table, ...(field ? { field } : {}) };
204
+ }
205
+ function reverseLookup(obj, sysId) {
206
+ return (Object.entries(obj)
207
+ .filter(([_, id]) => id === sysId)
208
+ .map(([key]) => key)[0] || '');
209
+ }
210
+ //# sourceMappingURL=acl-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acl-plugin.js","sourceRoot":"","sources":["../src/acl-plugin.ts"],"names":[],"mappings":";;;AAAA,+DAAgF;AAChF,0DAAwG;AACxG,iEAA4D;AAC5D,mDAA4C;AAC5C,mCAAuD;AAEvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC7B,6BAA6B;IAC7B,gCAAgC;IAChC,SAAS;IACT,WAAW;IACX,eAAe;CAClB,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG;IACf,cAAc,EAAE,CAAC,iBAAiB,CAAC;IACnC,YAAY,EAAE,CAAC,eAAe,CAAC;IAC/B,eAAe,EAAE,CAAC,mBAAmB,CAAC;IACtC,iBAAiB,EAAE,CAAC,oBAAoB,CAAC;IACzC,SAAS,EAAE,CAAC,YAAY,CAAC;CAC5B,CAAA;AAED;;;;;;;;;;;;;;;;G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h?topicname=app-menu-api-now-ts.html&version=latest
6
+ *
7
+ * @param config - an object containing the following properties:
8
+ * * **$id** - unique id for the record, typically using `Now.ID["value"]`
9
+ * * **category** - The variable identifier of a menu category that defines the navigation menu style.
10
+ * * **title** - The label for the menu in the application navigator.
11
+ * * **active**? - whether the record is enabled
12
+ * * **description**? - Additional information about what the application does.
13
+ * * **hint**? - The tooltip text that appears when a user hovers over the menu.
14
+ * * **name**? - An internal name to differentiate between applications with the same title.
15
+ * * **order**? - The relative position of the application menu in the application navigator.
16
+ * * **roles**? - A list of variable identifiers of `Role` objects or names of roles that can access the menu. @see {Role}
17
+ */
18
+ export declare const ApplicationMenuPlugin: Plugin;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationMenuPlugin = void 0;
4
+ const sdk_build_core_1 = require("@servicenow/sdk-build-core");
5
+ const now_id_plugin_1 = require("./now-id-plugin");
6
+ /**
7
+ * Creates an Application Menu (`sys_app_application`).
8
+ *
9
+ * @see https://docs.servicenow.com/csh?topicname=app-menu-api-now-ts.html&version=latest
10
+ *
11
+ * @param config - an object containing the following properties:
12
+ * * **$id** - unique id for the record, typically using `Now.ID["value"]`
13
+ * * **category** - The variable identifier of a menu category that defines the navigation menu style.
14
+ * * **title** - The label for the menu in the application navigator.
15
+ * * **active**? - whether the record is enabled
16
+ * * **description**? - Additional information about what the application does.
17
+ * * **hint**? - The tooltip text that appears when a user hovers over the menu.
18
+ * * **name**? - An internal name to differentiate between applications with the same title.
19
+ * * **order**? - The relative position of the application menu in the application navigator.
20
+ * * **roles**? - A list of variable identifiers of `Role` objects or names of roles that can access the menu. @see {Role}
21
+ */
22
+ exports.ApplicationMenuPlugin = sdk_build_core_1.Plugin.create({
23
+ name: 'ApplicationMenuPlugin',
24
+ records: {
25
+ sys_app_application: {
26
+ relationships: {
27
+ sys_app_category: {
28
+ via: 'category',
29
+ inverse: true,
30
+ },
31
+ sys_app_application: {
32
+ via: 'sys_overrides',
33
+ inverse: true,
34
+ },
35
+ },
36
+ toShape(record, { factory }) {
37
+ return {
38
+ success: true,
39
+ value: new sdk_build_core_1.CallExpressionShape({
40
+ source: record,
41
+ callee: 'ApplicationMenu',
42
+ args: [
43
+ record.transform(({ $ }) => ({
44
+ $id: $.val(now_id_plugin_1.NowIdShape.from(record)),
45
+ title: $,
46
+ category: $,
47
+ hint: $.def(''),
48
+ description: $.def(''),
49
+ name: $.def(''),
50
+ active: $.toBoolean().def(true),
51
+ order: $.map((v) => v.ifString()?.ifNotEmpty()?.toNumber()).def(100),
52
+ roles: $.map((v) => {
53
+ const roleNames = v.isString() && v.asString().getValue() !== '' ? v.asString().split(',') : [];
54
+ return roleNames.map((roleName) => factory.createReference({
55
+ source: v,
56
+ table: 'sys_user_role',
57
+ keys: { name: roleName },
58
+ }));
59
+ }).def([]),
60
+ })),
61
+ ],
62
+ }),
63
+ };
64
+ },
65
+ },
66
+ },
67
+ shapes: [
68
+ {
69
+ shape: sdk_build_core_1.CallExpressionShape,
70
+ fileTypes: ['fluent'],
71
+ async toRecord(callExpression, { factory }) {
72
+ if (callExpression.getCallee() !== 'ApplicationMenu') {
73
+ return { success: false };
74
+ }
75
+ return {
76
+ success: true,
77
+ value: callExpression
78
+ .getArgument(0)
79
+ .asObject()
80
+ .pipe((menu) => factory.createRecord({
81
+ source: callExpression,
82
+ table: 'sys_app_application',
83
+ explicitId: menu.get('$id'),
84
+ properties: menu.transform(({ $ }) => ({
85
+ title: $,
86
+ hint: $.def(''),
87
+ description: $.def(''),
88
+ name: $.def(''),
89
+ active: $.def(true),
90
+ order: $.def(100),
91
+ device_type: $.val('browser'),
92
+ roles: $.map((v) => v
93
+ .ifArray()
94
+ ?.map((r) => (r.ifRecord()?.get('name') ?? r.asString()).getValue())
95
+ .join(',')).def(''),
96
+ category: $,
97
+ })),
98
+ })),
99
+ };
100
+ },
101
+ },
102
+ ],
103
+ });
104
+ //# sourceMappingURL=application-menu-plugin.js.map
@@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UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;4BACnC,KAAK,EAAE,CAAC;4BACR,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;4BACf,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;4BACtB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;4BACf,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;4BACnB,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;4BACjB,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;4BAC7B,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACf,CAAC;iCACI,OAAO,EAAE;gCACV,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;iCACnE,IAAI,CAAC,GAAG,CAAC,CACjB,CAAC,GAAG,CAAC,EAAE,CAAC;4BACT,QAAQ,EAAE,CAAC;yBACd,CAAC,CAAC;qBACN,CAAC,CACL;iBACR,CAAA;YACL,CAAC;SACJ;KACJ;CACJ,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { Plugin, Shape, type Source, IdentifierShape, type StringShape } from '@servicenow/sdk-build-core';
2
+ export declare class ArrowFunctionShape extends Shape {
3
+ private readonly parameters;
4
+ private readonly statements;
5
+ constructor({ source, parameters, statements, }: {
6
+ source: Source;
7
+ parameters?: (IdentifierShape | StringShape | string)[];
8
+ statements?: Shape[];
9
+ });
10
+ getParameters(): IdentifierShape[];
11
+ getParameter(index: number): IdentifierShape;
12
+ getStatements(): Shape[];
13
+ getStatement(index: number): Shape;
14
+ getCode(): string;
15
+ }
16
+ export declare const ArrowFunctionPlugin: Plugin;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArrowFunctionPlugin = exports.ArrowFunctionShape = void 0;
4
+ const sdk_build_core_1 = require("@servicenow/sdk-build-core");
5
+ class ArrowFunctionShape extends sdk_build_core_1.Shape {
6
+ parameters;
7
+ statements;
8
+ constructor({ source, parameters, statements, }) {
9
+ super({ source });
10
+ this.parameters = (parameters ?? []).map((s) => s instanceof sdk_build_core_1.IdentifierShape
11
+ ? s
12
+ : new sdk_build_core_1.IdentifierShape({
13
+ source,
14
+ name: typeof s === 'string' ? s : s.getValue(),
15
+ }));
16
+ this.statements = statements ?? [];
17
+ }
18
+ getParameters() {
19
+ return this.parameters;
20
+ }
21
+ getParameter(index) {
22
+ const parameter = this.parameters[index];
23
+ if (!parameter) {
24
+ throw new Error(`Arrow function does not have a parameter at index: ${index}`);
25
+ }
26
+ return parameter;
27
+ }
28
+ getStatements() {
29
+ return this.statements;
30
+ }
31
+ getStatement(index) {
32
+ const statement = this.statements[index];
33
+ if (!statement) {
34
+ throw new Error(`Arrow function does not have a statement at index: ${index}`);
35
+ }
36
+ return statement;
37
+ }
38
+ getCode() {
39
+ return `(${this.getParameters()
40
+ .map((p) => p.getCode())
41
+ .join(', ')}) => {\n ${this.getStatements()
42
+ .map((s) => s.getCode())
43
+ .join('\n ')}\n}`;
44
+ }
45
+ }
46
+ exports.ArrowFunctionShape = ArrowFunctionShape;
47
+ exports.ArrowFunctionPlugin = sdk_build_core_1.Plugin.create({
48
+ name: 'ArrowFunctionPlugin',
49
+ nodes: [
50
+ {
51
+ node: 'ArrowFunction',
52
+ fileTypes: ['fluent'],
53
+ async toShape(node, { transform, diagnostics }) {
54
+ const parameters = [];
55
+ for (const param of node.getParameters()) {
56
+ const result = await transform.toShape(param);
57
+ if (result.success && result.value.isIdentifier()) {
58
+ parameters.push(result.value);
59
+ }
60
+ else {
61
+ diagnostics.error(param, 'Unsupported parameter in arrow function');
62
+ return { success: false };
63
+ }
64
+ }
65
+ const statements = [];
66
+ for (const statement of node.getStatements()) {
67
+ const result = await transform.toShape(statement);
68
+ if (!result.success) {
69
+ diagnostics.error(statement, 'Unsupported statement in arrow function body');
70
+ return { success: false };
71
+ }
72
+ statements.push(result.value);
73
+ }
74
+ return {
75
+ success: true,
76
+ value: new ArrowFunctionShape({
77
+ source: node,
78
+ parameters,
79
+ statements,
80
+ }),
81
+ };
82
+ },
83
+ },
84
+ ],
85
+ shapes: [
86
+ {
87
+ shape: ArrowFunctionShape,
88
+ async commit(shape, target, { commit }) {
89
+ const arrowFunction = sdk_build_core_1.ts.Node.isArrowFunction(target)
90
+ ? target
91
+ : target.replaceWithText('() => {}').asKindOrThrow(sdk_build_core_1.ts.SyntaxKind.ArrowFunction);
92
+ const nodeStatements = arrowFunction.getStatements();
93
+ const shapeStatements = shape.getStatements();
94
+ const excess = nodeStatements.length - shapeStatements.length;
95
+ for (let i = 1; i <= excess; i++) {
96
+ arrowFunction.removeStatement(nodeStatements.length - i);
97
+ }
98
+ for (const [i, statement] of shapeStatements.entries()) {
99
+ const targetStatement = nodeStatements[i] ?? arrowFunction.addStatements('undefined')[0];
100
+ await commit(statement, targetStatement);
101
+ }
102
+ return { success: true };
103
+ },
104
+ },
105
+ ],
106
+ });
107
+ //# sourceMappingURL=arrow-function-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-function-plugin.js","sourceRoot":"","sources":["../src/arrow-function-plugin.ts"],"names":[],"mappings":";;;AAAA,+DAA8G;AAE9G,MAAa,kBAAmB,SAAQ,sBAAK;IACxB,UAAU,CAAmB;IAC7B,UAAU,CAAS;IAEpC,YAAY,EACR,MAAM,EACN,UAAU,EACV,UAAU,GAKb;QACG,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;QACjB,IAAI,CAAC,UAAU,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG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+ import type { ATFType, StandardStepValues } from '@servicenow/sdk-core/runtime/app';
2
+ export type ATFVariableInfo = {
3
+ field: string;
4
+ inputVariableId: string;
5
+ type: string;
6
+ order: number;
7
+ default?: any;
8
+ mandatory?: boolean;
9
+ };
10
+ export type Category = keyof ATFType;
11
+ type FunctionParameters<F> = F extends (inputs: infer P) => any ? P extends object ? Exclude<keyof P, keyof StandardStepValues> : never : never;
12
+ type ToRecordStepMetadata = {
13
+ [C in keyof ATFType]: {
14
+ [FunctionName in keyof ATFType[C]]: {
15
+ name: string;
16
+ stepConfigId: string;
17
+ variables: {
18
+ [K in FunctionParameters<ATFType[C][FunctionName]>]: ATFVariableInfo;
19
+ };
20
+ defaultTimeout?: string;
21
+ };
22
+ };
23
+ };
24
+ export declare const ToRecordStepConfigs: ToRecordStepMetadata;
25
+ export type ToShapeStepMetadata = Record<string, {
26
+ name: string;
27
+ stepConfig: string;
28
+ callName: string;
29
+ fun: string;
30
+ variables: Record<string, {
31
+ name: string;
32
+ field: string;
33
+ type: string;
34
+ mandatory: boolean;
35
+ default?: any;
36
+ }>;
37
+ }>;
38
+ export declare const ToShapeStepConfigs: ToShapeStepMetadata;
39
+ export {};