@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,266 @@
1
+ import { CallExpressionShape, type ObjectShape, Plugin, type ArrayShape, type Shape } from '@servicenow/sdk-build-core'
2
+ import { ModuleFunctionShape } from './server-module-plugin'
3
+ import { NowIdShape } from './now-id-plugin'
4
+ import { generateDeprecatedDiagnostics } from './utils'
5
+
6
+ // Similar to lodash's groupBy, but simply stores the last element of each group
7
+ function groupByExistence<T>(collection: T[] | undefined, keyProvider: (element: T) => string): { [key: string]: T } {
8
+ return (
9
+ collection?.reduce((groups, e) => {
10
+ groups[keyProvider(e)] = e
11
+ return groups
12
+ }, {}) ?? {}
13
+ )
14
+ }
15
+
16
+ const createBidiMap = (pairs: [string, string][]) => {
17
+ const map = new Map(pairs)
18
+ const reverseMap = new Map(pairs.map(([k, v]) => [v, k] as const))
19
+ return {
20
+ get: (key: string): string | undefined => map.get(key),
21
+ reverseLookUp: (value: string): string | undefined => reverseMap.get(value),
22
+ }
23
+ }
24
+
25
+ const whenBidiMap = createBidiMap([
26
+ ['async', 'async_always'],
27
+ ['async_deprecated', 'async'],
28
+ ['display', 'before_display'],
29
+ ['before', 'before'],
30
+ ['after', 'after'],
31
+ ])
32
+
33
+ const brAliases = {
34
+ addMessage: ['add_message'],
35
+ abortAction: ['abort_action'],
36
+ setFieldValue: ['set_field_value'],
37
+ filterCondition: ['filter_condition'],
38
+ roleConditions: ['role_conditions'],
39
+ protectionPolicy: ['sys_policy'],
40
+ }
41
+
42
+ export const BusinessRulePlugin = Plugin.create({
43
+ name: 'BusinessRulePlugin',
44
+ records: {
45
+ sys_script: {
46
+ toShape(record) {
47
+ return {
48
+ success: true,
49
+ value: new CallExpressionShape({
50
+ source: record,
51
+ callee: 'BusinessRule',
52
+ args: [
53
+ record
54
+ .transform(({ $ }) => ({
55
+ $id: $.val(NowIdShape.from(record)),
56
+ name: $,
57
+ table: $.from('collection'),
58
+ order: $.toNumber().def(100),
59
+ active: $.toBoolean().def(true),
60
+ when: $.map((v) => {
61
+ return v.ifString() ? whenBidiMap.reverseLookUp(v.asString().getValue()) : v
62
+ }),
63
+ action: $.val(getActionsArray(record)),
64
+ message: $.def(''),
65
+ addMessage: $.from('add_message').toBoolean().def(false),
66
+ condition: $.def(''),
67
+ filterCondition: $.from('filter_condition').def(''),
68
+ description: $.def(''),
69
+ setFieldValue: $.from('template').def(''),
70
+ abortAction: $.from('abort_action').toBoolean().def(false),
71
+ roleConditions: $.from('role_conditions').map((v) =>
72
+ v.ifString()?.ifNotEmpty()?.getValue().split(',')
73
+ ),
74
+ script: $.def(DEFAULT_SCRIPT),
75
+ priority: $.map((p) => p.ifNumber()?.asNumber()).def(100),
76
+
77
+ changeFields: $.from('change_fields').toBoolean().def(false),
78
+ clientCallable: $.from('client_callable').toBoolean().def(false),
79
+ executeFunction: $.from('execute_function').toBoolean().def(false),
80
+ access: $.toString().def('package_private'),
81
+
82
+ rest: $.from(
83
+ 'is_rest',
84
+ 'rest_variables',
85
+ 'rest_method',
86
+ 'rest_method_text',
87
+ 'rest_service',
88
+ 'rest_service_text'
89
+ )
90
+ .def({
91
+ webService: false,
92
+ variables: '',
93
+ method: '',
94
+ methodText: '',
95
+ service: '',
96
+ serviceText: '',
97
+ })
98
+ .map(
99
+ (
100
+ is_rest,
101
+ rest_variables,
102
+ rest_method,
103
+ rest_method_text,
104
+ rest_service,
105
+ rest_service_text
106
+ ) => ({
107
+ webService: is_rest.ifDefined()?.toBoolean(),
108
+ variables: rest_variables.toString(),
109
+ method: rest_method.toString(),
110
+ methodText: rest_method_text.toString(),
111
+ service: rest_service.toString(),
112
+ serviceText: rest_service_text.toString(),
113
+ })
114
+ ),
115
+
116
+ protectionPolicy: $.from('sys_policy').def(''),
117
+ }))
118
+ .withAliasedKeys(brAliases),
119
+ ],
120
+ }),
121
+ }
122
+ },
123
+ },
124
+ },
125
+ shapes: [
126
+ {
127
+ shape: CallExpressionShape,
128
+ fileTypes: ['fluent'],
129
+ async toRecord(callExpression, { factory, config, diagnostics }) {
130
+ if (callExpression.getCallee() !== 'BusinessRule') {
131
+ return { success: false }
132
+ }
133
+
134
+ const arg = callExpression.getArgument(0).asObject().withAliasedKeys(brAliases)
135
+ const rest = arg.get('rest').ifDefined()?.asObject()
136
+
137
+ generateDeprecatedDiagnostics(arg, diagnostics)
138
+
139
+ if (arg.get('script').isUnresolved()) {
140
+ diagnostics.error(
141
+ arg.get('script').getOriginalNode(),
142
+ `Unable to resolve the script reference, ensure the imported module is within the ${config.serverModulesDir} directory.`
143
+ )
144
+ }
145
+
146
+ return {
147
+ success: true,
148
+ value: arg.pipe((br) =>
149
+ factory.createRecord({
150
+ source: callExpression,
151
+ table: 'sys_script',
152
+ explicitId: br.get('$id'),
153
+ properties: br.transform(({ $, merge }) => ({
154
+ name: $,
155
+ order: $.def(100),
156
+ active: $.def(true),
157
+ message: $,
158
+ add_message: $.from('addMessage').map((v) => {
159
+ return (
160
+ v.ifBoolean()?.getValue() ??
161
+ (($._('message').val as Shape).getValue() !== undefined ? true : false)
162
+ )
163
+ }),
164
+ condition: $,
165
+ filter_condition: $.from('filterCondition'),
166
+ description: $,
167
+ advanced: $.val(
168
+ br
169
+ .get('script')
170
+ .pipe((script) => script.isDefined() && script.getValue() !== DEFAULT_SCRIPT)
171
+ ),
172
+ script: $.map(
173
+ (v) =>
174
+ v
175
+ .if(ModuleFunctionShape)
176
+ ?.toString((n) => `${n}({{PARAMS}})`, ['current', 'previous']) ?? v
177
+ )
178
+ .toCdata()
179
+ .def(DEFAULT_SCRIPT),
180
+ collection: $.from('table'),
181
+ when: $.map((v) => (v.ifString() ? whenBidiMap.get(v.asString().getValue()) : v)).def(
182
+ 'before'
183
+ ),
184
+ [merge]: $.from('action').map((v) => {
185
+ const { insertAction, updateAction, deleteAction, queryAction } = groupByExistence(
186
+ v.ifArray()?.getElements(),
187
+ (action) => `${action.asString().getValue()}Action`
188
+ )
189
+
190
+ return {
191
+ action_insert: !!insertAction,
192
+ action_update: !!updateAction,
193
+ action_query: !!queryAction,
194
+ action_delete: !!deleteAction,
195
+ }
196
+ }),
197
+ template: $.from('setFieldValue'),
198
+ role_conditions: $.from('roleConditions').map((v) => getRolesString(v.ifArray())),
199
+ abort_action: $.from('abortAction').def(false),
200
+ priority: $.def(100),
201
+
202
+ is_rest: $.val(rest?.get('webService')).def(false),
203
+ rest_variables: $.val(rest?.get('variables')),
204
+ rest_method: $.val(rest?.get('method')),
205
+ rest_method_text: $.val(rest?.get('methodText')),
206
+ rest_service: $.val(rest?.get('service')),
207
+ rest_service_text: $.val(rest?.get('serviceText')),
208
+
209
+ change_fields: $.from('changeFields').def(false),
210
+ client_callable: $.from('clientCallable').def(false),
211
+ execute_function: $.from('executeFunction').def(false),
212
+ access: $.def('package_private'),
213
+ sys_policy: $.from('protectionPolicy'),
214
+ })),
215
+ })
216
+ ),
217
+ }
218
+ },
219
+ },
220
+ ],
221
+ })
222
+
223
+ type Action = 'insert' | 'update' | 'delete' | 'query'
224
+ function getActionsArray(recordData: ObjectShape): Action[] {
225
+ const actions: Action[] = []
226
+ if (recordData.get('action_update').toBoolean().equals(true)) {
227
+ actions.push('update')
228
+ }
229
+
230
+ if (recordData.get('action_delete').toBoolean().equals(true)) {
231
+ actions.push('delete')
232
+ }
233
+
234
+ if (recordData.get('action_insert').toBoolean().equals(true)) {
235
+ actions.push('insert')
236
+ }
237
+
238
+ if (recordData.get('action_query').toBoolean().equals(true)) {
239
+ actions.push('query')
240
+ }
241
+
242
+ return actions
243
+ }
244
+
245
+ function getRolesString(roles: ArrayShape | undefined): string | undefined {
246
+ if (!roles) {
247
+ return undefined
248
+ }
249
+
250
+ const uniqueRoles = [
251
+ ...new Set(
252
+ roles
253
+ .getElements()
254
+ .map((role) => (role.isRecord() ? role.get('name').asString().getValue() : role.asString().getValue()))
255
+ ),
256
+ ]
257
+
258
+ return uniqueRoles.join(',')
259
+ }
260
+
261
+ // This is the default script on the instance. We should provide
262
+ // it in the case they don't define a script, as they may later want
263
+ // to add a script on the instance and it's a better experience to
264
+ // have a starting script available.
265
+ export const DEFAULT_SCRIPT =
266
+ '(function executeRule(current, previous /*null when async*/) {\n\n\t// Add your code here\n\n})(current, previous);'
@@ -0,0 +1,202 @@
1
+ import { ts, Plugin, CallExpressionShape, type Shape, type Compiler } from '@servicenow/sdk-build-core'
2
+ import { Record } from '@servicenow/sdk-core/runtime/db'
3
+ import { getCallExpressionName } from './utils'
4
+
5
+ export const CallExpressionPlugin = Plugin.create({
6
+ name: 'CallExpressionPlugin',
7
+ nodes: [
8
+ {
9
+ node: 'CallExpression',
10
+ fileTypes: ['fluent'],
11
+ entryPoint: true,
12
+ async toShape(node, { transform }) {
13
+ const args: Shape[] = []
14
+ for (const arg of node.getArguments()) {
15
+ const result = await transform.toShape(arg)
16
+ if (!result.success) {
17
+ return { success: false }
18
+ }
19
+
20
+ args.push(result.value)
21
+ }
22
+
23
+ return {
24
+ success: true,
25
+ value: new CallExpressionShape({
26
+ source: node,
27
+ callee: getCallExpressionName(node),
28
+ args,
29
+ }),
30
+ }
31
+ },
32
+ },
33
+ ],
34
+ shapes: [
35
+ {
36
+ shape: CallExpressionShape,
37
+ async commit(shape, target, { commit, compiler }) {
38
+ if (target.isKind(ts.SyntaxKind.ExpressionStatement)) {
39
+ target = target.getExpression()
40
+ }
41
+
42
+ if (!ts.Node.isCallExpression(target)) {
43
+ target.replaceWithText(shape.getCode())
44
+ return { success: true }
45
+ }
46
+
47
+ const callee = target.getExpression()
48
+ if (callee.getText() !== shape.getCallee()) {
49
+ callee.replaceWithText(shape.getCallee())
50
+ }
51
+
52
+ // Trim any excess arguments
53
+ const targetArguments = target.getArguments()
54
+ const shapeArguments = shape.getArguments(false)
55
+ const excess = targetArguments.length - shapeArguments.length
56
+ for (let i = 1; i <= excess; i++) {
57
+ target.removeArgument(targetArguments.length - i)
58
+ }
59
+
60
+ // Commit existing arguments after trimming
61
+ for (const [i, targetElement] of target.getArguments().entries()) {
62
+ await commit(shape.getArgument(i, false), targetElement)
63
+ }
64
+
65
+ // Add new arguments all at once
66
+ const argumentsToAdd = shapeArguments.slice(target.getArguments().length).map((e) => e.getCode())
67
+ if (argumentsToAdd.length > 0) {
68
+ target.addArguments(argumentsToAdd)
69
+ }
70
+
71
+ if (shape.getCallee() === Record.name) {
72
+ fixCallExpressionArgTypes(compiler, target)
73
+ }
74
+
75
+ return { success: true }
76
+ },
77
+ },
78
+ ],
79
+ })
80
+
81
+ function fixCallExpressionArgTypes(compiler: Compiler, node: ts.CallExpression) {
82
+ if (node.wasForgotten()) {
83
+ return
84
+ }
85
+
86
+ node.getSourceFile().fixMissingImports()
87
+ const signature = compiler.getTypeChecker().getResolvedSignature(node)
88
+ if (!signature) {
89
+ return
90
+ }
91
+
92
+ signature.getParameters().forEach((param, idx) => {
93
+ const argType = param.getTypeAtLocation(node)
94
+ const argNode = node.getArguments()[idx]?.asKind(ts.SyntaxKind.ObjectLiteralExpression)
95
+ if (!argType || !argNode) {
96
+ return
97
+ }
98
+ fixCallExpressionArgType(node, argNode, argType)
99
+ })
100
+ }
101
+
102
+ function fixCallExpressionArgType(
103
+ node: ts.CallExpression,
104
+ argNode: ts.ObjectLiteralExpression | ts.PropertyAssignment,
105
+ argType: ts.Type
106
+ ) {
107
+ if (argNode.getType().isObject()) {
108
+ const objectLiteral = argNode.isKind(ts.SyntaxKind.ObjectLiteralExpression)
109
+ ? argNode
110
+ : argNode.getInitializerIfKind(ts.SyntaxKind.ObjectLiteralExpression)
111
+ argType.getApparentProperties().forEach((prop) => {
112
+ const propNode = objectLiteral?.getProperty(prop.getName())?.asKind(ts.SyntaxKind.PropertyAssignment)
113
+ if (!propNode) {
114
+ return
115
+ }
116
+ fixCallExpressionArgType(node, propNode, prop.getTypeAtLocation(node))
117
+ })
118
+ } else if (argNode.isKind(ts.SyntaxKind.PropertyAssignment)) {
119
+ const nodeType = argNode.getType()
120
+ if (
121
+ nodeType.isAssignableTo(argType) ||
122
+ canAssignString(argNode, argType) ||
123
+ canCastAndAssignBoolean(argNode, argType) ||
124
+ canCastAndAssignNumber(argNode, argType)
125
+ ) {
126
+ return
127
+ }
128
+
129
+ // cast 'as any' for other types
130
+ const argValue = argNode.getInitializer()?.getText()
131
+ argNode.setInitializer(`${argValue} as any`)
132
+ }
133
+ }
134
+
135
+ function canCastAndAssignBoolean(argNode: ts.PropertyAssignment, argType: ts.Type): boolean {
136
+ const booleanTypes = getBooleanTypes(argType)
137
+ const booleanValue = getBooleanValue(argNode)
138
+ if (booleanValue && booleanTypes.length > 0) {
139
+ const isAssignable = booleanTypes.some((type) => {
140
+ return (
141
+ (type.isBoolean() && (booleanValue === 'true' || booleanValue === 'false')) ||
142
+ type.getText() === booleanValue
143
+ )
144
+ })
145
+ if (isAssignable) {
146
+ argNode.setInitializer(`${booleanValue}`)
147
+ return true
148
+ }
149
+ }
150
+ return false
151
+ }
152
+
153
+ function canCastAndAssignNumber(argNode: ts.PropertyAssignment, argType: ts.Type): boolean {
154
+ const numberTypes = getNumberTypes(argType)
155
+ const numberValue = getNumberValue(argNode)
156
+ if (numberValue && numberTypes.length > 0) {
157
+ const isAssignable = numberTypes.some((type) => {
158
+ return type.isNumber() || `${type.getLiteralValue()}` === numberValue
159
+ })
160
+ if (isAssignable) {
161
+ argNode.setInitializer(`${numberValue}`)
162
+ return true
163
+ }
164
+ }
165
+ return false
166
+ }
167
+
168
+ function canAssignString(argNode: ts.PropertyAssignment, argType: ts.Type): boolean {
169
+ const stringTypes = getStringTypes(argType)
170
+ const stringValue = getStringValue(argNode)
171
+ return stringTypes.some((type) => {
172
+ return type.isString() || type.getLiteralValue() === stringValue
173
+ })
174
+ }
175
+
176
+ function getBooleanValue(argNode: ts.PropertyAssignment): string | undefined {
177
+ return argNode.getInitializerIfKind(ts.SyntaxKind.StringLiteral)?.getLiteralValue()
178
+ }
179
+
180
+ function getBooleanTypes(argType: ts.Type) {
181
+ const type = argType.isUnion() ? argType.getUnionTypes() : [argType]
182
+ return type.filter((type) => type.isBoolean() || type.isBooleanLiteral())
183
+ }
184
+
185
+ function getNumberValue(argNode: ts.PropertyAssignment): string | undefined {
186
+ const numStrVal = argNode.getInitializerIfKind(ts.SyntaxKind.StringLiteral)?.getLiteralValue()
187
+ return numStrVal && !isNaN(Number(numStrVal)) ? `${numStrVal}` : undefined
188
+ }
189
+
190
+ function getNumberTypes(argType: ts.Type) {
191
+ const type = argType.isUnion() ? argType.getUnionTypes() : [argType]
192
+ return type.filter((type) => type.isNumber() || type.isNumberLiteral())
193
+ }
194
+
195
+ function getStringValue(argNode: ts.PropertyAssignment): string | undefined {
196
+ return argNode.getInitializerIfKind(ts.SyntaxKind.StringLiteral)?.getLiteralValue()
197
+ }
198
+
199
+ function getStringTypes(argType: ts.Type) {
200
+ const type = argType.isUnion() ? argType.getUnionTypes() : [argType]
201
+ return type.filter((type) => type.isString() || type.isStringLiteral())
202
+ }
@@ -0,0 +1,179 @@
1
+ import { type Compiler, ts, CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
2
+ import { NowIdShape } from './now-id-plugin'
3
+ import { generateDeprecatedDiagnostics } from './utils'
4
+
5
+ enum UITypeMapping {
6
+ desktop = 0,
7
+ mobile_or_service_portal = 1,
8
+ all = 10,
9
+ }
10
+
11
+ const clientScriptAliases = {
12
+ appliesExtended: ['applies_extended'],
13
+ isolateScript: ['isolate_script'],
14
+ uiType: ['ui_type'],
15
+ }
16
+
17
+ /**
18
+ * Creates a Client Script (`sys_script_client`).
19
+ *
20
+ * @see https://docs.servicenow.com/csh?topicname=client-script-api-now-ts.html&version=latest
21
+ *
22
+ * @param config - an object containing the following properties:
23
+ * * **$id** - unique id for the record, typically using `Now.ID["value"]`
24
+ * * **name** - name of the client script
25
+ * * **table** - name of the table on which the client script runs
26
+ * * **type** - type of client script, which defines when it runs
27
+ * * **uiType** - user interface to which the client script applies
28
+ * * **active**? - whether the record is enabled
29
+ * * **appliesExtended**? - indicates whether the client script applies to tables extended from the specified table
30
+ * * **description**? - description of the functionality and purpose of the client script
31
+ * * **field**? - field on the table that the client script applies to.
32
+ * This property applies only when the type property is set to `onChange` or `onCellEdit`.
33
+ * * **global**? - indicates which views of the table the client script runs.
34
+ * `true`: the script runs on all views
35
+ * `false`: the script runs only on specified views
36
+ * * **isolateScript**? - indicates whether scripts run in strict mode, with
37
+ * access to direct DOM, `jQuery`, `prototype`, and the `window` object turned off
38
+ * * **messages**? - strings that are available to the client script as localized messages using `getmessage('[message]')`.
39
+ * For more information, see [Translate a client script message](https://docs.servicenow.com/csh?topicname=t_TranslateAClientScriptMessage.html&version=latest)
40
+ * * **script**? - inline script preceded by a `script` tagged template literal.
41
+ * * **view**? - views of the table on which the client script runs. This
42
+ * property applies only when the `global` property is set to `false`
43
+ */
44
+ export const ClientScriptPlugin = Plugin.create({
45
+ name: 'ClientScriptPlugin',
46
+ records: {
47
+ sys_script_client: {
48
+ toShape(record) {
49
+ return {
50
+ success: true,
51
+ value: new CallExpressionShape({
52
+ source: record,
53
+ callee: 'ClientScript',
54
+ args: [
55
+ record
56
+ .transform(({ $, merge }) => ({
57
+ $id: $.val(NowIdShape.from(record)),
58
+ type: $.def(''),
59
+ table: $,
60
+ appliesExtended: $.from('applies_extended').toBoolean().def(false),
61
+ isolateScript: $.from('isolate_script').toBoolean().def(false),
62
+ script: $,
63
+ name: $,
64
+ description: $.def(''),
65
+ messages: $.def(''),
66
+ global: $.toBoolean().def(true),
67
+ active: $.toBoolean().def(true),
68
+ view: $.def(''),
69
+ uiType: $.from('ui_type')
70
+ .map((v) => getUITypeFromId(v.toNumber().getValue()))
71
+ .def('desktop'),
72
+ [merge]: $.from('field', 'type').map((field, type) => {
73
+ if (
74
+ type.isString() &&
75
+ ['onChange', 'onCellEdit'].includes(type.getValue()) &&
76
+ !field.ifString()?.isEmpty()
77
+ ) {
78
+ return { field }
79
+ }
80
+ return {}
81
+ }),
82
+ }))
83
+ .withAliasedKeys(clientScriptAliases),
84
+ ],
85
+ }),
86
+ }
87
+ },
88
+ },
89
+ },
90
+ shapes: [
91
+ {
92
+ shape: CallExpressionShape,
93
+ fileTypes: ['fluent'],
94
+ async toRecord(callExpression, { diagnostics, factory, compiler }) {
95
+ if (callExpression.getCallee() !== 'ClientScript') {
96
+ return { success: false }
97
+ }
98
+
99
+ const clientScript = callExpression.getArgument(0).asObject().withAliasedKeys(clientScriptAliases)
100
+ generateDeprecatedDiagnostics(clientScript, diagnostics)
101
+
102
+ const script = clientScript.get('script').ifDefined()?.toString().getValue()
103
+ const type = clientScript.get('type').ifString()?.getValue()
104
+ const field = clientScript.get('field').ifString()?.getValue()
105
+
106
+ if (field && !type) {
107
+ diagnostics.error(
108
+ clientScript.get('field'),
109
+ `Field values are allowed only when type is set to onChange or onCellEdit`
110
+ )
111
+ }
112
+
113
+ if (script && !validateClientSideScripts(script, compiler)) {
114
+ diagnostics.error(
115
+ clientScript.get('script'),
116
+ `Client side scripts cannot import or require modules.`
117
+ )
118
+ }
119
+
120
+ return {
121
+ success: true,
122
+ value: factory.createRecord({
123
+ source: callExpression,
124
+ table: 'sys_script_client',
125
+ explicitId: clientScript.get('$id'),
126
+ properties: clientScript.transform(({ $ }) => ({
127
+ table: $,
128
+ global: $.def(true),
129
+ view: $,
130
+ field: $,
131
+ script: $.toCdata(),
132
+ type: $,
133
+ name: $,
134
+ active: $.def(true),
135
+ applies_extended: $.from('appliesExtended').def(false),
136
+ description: $,
137
+ messages: $,
138
+ isolate_script: $.from('isolateScript').def(false),
139
+ ui_type: $.from('uiType')
140
+ .map((v) => (v.isString() ? getUITypeId(v.getValue()) : undefined))
141
+ .def(0),
142
+ })),
143
+ }),
144
+ }
145
+ },
146
+ },
147
+ ],
148
+ })
149
+
150
+ function validateClientSideScripts(script: string, compiler: Compiler) {
151
+ const source = compiler.createSourceFile('tmp-file.ts', script)
152
+ const importDeclarations = source.getDescendantsOfKind(ts.SyntaxKind.ImportDeclaration)
153
+ const requireCalls = source.getDescendantsOfKind(ts.SyntaxKind.CallExpression).filter((callExpression) => {
154
+ return isRequire(callExpression)
155
+ })
156
+ const isValid = !(importDeclarations.length > 0 || requireCalls.length > 0)
157
+ compiler.removeSourceFile(source)
158
+ return isValid
159
+ }
160
+
161
+ function getUITypeFromId(id: number) {
162
+ const type = UITypeMapping[id]
163
+ if (!type) {
164
+ throw Error('Invalid UI Type encountered, check XML data before transforming again.')
165
+ }
166
+ return type
167
+ }
168
+
169
+ function getUITypeId(value: string) {
170
+ if (value in UITypeMapping) {
171
+ return UITypeMapping[value]
172
+ }
173
+ throw Error('Invalid ui_type found in xml')
174
+ }
175
+
176
+ function isRequire(callExpression: ts.CallExpression): boolean {
177
+ const expression = callExpression.getExpression()
178
+ return ts.Node.isIdentifier(expression) && expression.getText() === 'require'
179
+ }