@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
@@ -1,551 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- /* eslint-disable no-undef */
3
- // copied from https://code.devsnc.com/dev/uxf-formula-parser/blob/ci/master/src/uxf-formula-parser/grammar-parser/grammar-parser.js
4
-
5
- // Generated automatically by nearley, version 2.20.1
6
- // http://github.com/Hardmath123/nearley
7
- ;(function () {
8
- function id(x) {
9
- return x[0]
10
- }
11
-
12
- const { api } = require('./api.js')
13
-
14
- const moo = require('moo')
15
-
16
- const lexer = moo.compile({
17
- lte: '<=',
18
- lt: '<',
19
- gte: '>=',
20
- gt: '>',
21
- eq: '==',
22
- neq: '!=',
23
- lparan: '(',
24
- rparan: ')',
25
- comma: ',',
26
- colon: ':',
27
- lbracket: '[',
28
- rbracket: ']',
29
- lbrace: '{',
30
- rbrace: '}',
31
- plus: '+',
32
- minus: '-',
33
- multiply: '*',
34
- divide: '/',
35
- modulo: '%',
36
- bash: '!',
37
- true: 'true',
38
- false: 'false',
39
- and: '&&',
40
- or: '||',
41
- nullishCoalesce: '??',
42
- dot: '.',
43
- stateBinding: '@state.',
44
- dataBinding: '@data.',
45
- propBinding: '@context.props.',
46
- sessionBinding: '@context.session.',
47
- appBinding: '@context.app.',
48
- syspropBinding: '@context.sysprop.',
49
- itemBinding: '@item.',
50
- eventPayloadBinding: '@payload.',
51
- elementBinding: '@elements.',
52
- envBinding: '@vars.',
53
- unknownBinding: /@[a-z]+\./,
54
- whitespace: {
55
- match: /[ \t\r\n]+/,
56
- lineBreaks: true,
57
- },
58
- number_literal: {
59
- match: /[0-9]+(?:\.[0-9]+)?/,
60
- value: (s) => Number(s),
61
- },
62
- name: /[a-zA-Z_][a-zA-Z0-9_]*/,
63
- string_literal: {
64
- match: /"(?:[^\n\\"]|\\["\\ntbfr])*"/,
65
- value: (s) => JSON.parse(s),
66
- },
67
- quoted_binding_string_literal: {
68
- match: /'(?:[^\n\\']|\\['\\ntbfr])*'/,
69
- value: (s) => JSON.parse(s),
70
- },
71
- myError: moo.error,
72
- })
73
- const grammar = {
74
- Lexer: lexer,
75
- ParserRules: [
76
- {
77
- name: 'main',
78
- symbols: ['_', 'EXP', '_'],
79
- postprocess: function (d) {
80
- return api.completeParse(d[1])
81
- },
82
- },
83
- { name: 'EXP', symbols: ['NULLISH_COALESCING_EXP'], postprocess: id },
84
- {
85
- name: 'NULLISH_COALESCING_EXP',
86
- symbols: [
87
- 'LOGICAL_OR_EXP',
88
- '_',
89
- lexer.has('nullishCoalesce') ? { type: 'nullishCoalesce' } : nullishCoalesce,
90
- '_',
91
- 'LOGICAL_OR_EXP',
92
- ],
93
- postprocess: function (d) {
94
- return api.binaryOperator('DEFAULT', d[0], d[4])
95
- },
96
- },
97
- { name: 'NULLISH_COALESCING_EXP', symbols: ['LOGICAL_OR_EXP'], postprocess: id },
98
- {
99
- name: 'LOGICAL_OR_EXP',
100
- symbols: ['LOGICAL_OR_EXP', '_', lexer.has('or') ? { type: 'or' } : or, '_', 'LOGICAL_AND_EXP'],
101
- postprocess: function (d) {
102
- return api.binaryOperator('OR', d[0], d[4])
103
- },
104
- },
105
- { name: 'LOGICAL_OR_EXP', symbols: ['LOGICAL_AND_EXP'], postprocess: id },
106
- {
107
- name: 'LOGICAL_AND_EXP',
108
- symbols: ['LOGICAL_AND_EXP', '_', lexer.has('and') ? { type: 'and' } : and, '_', 'EQUALITY_EXP'],
109
- postprocess: function (d) {
110
- return api.binaryOperator('AND', d[0], d[4])
111
- },
112
- },
113
- { name: 'LOGICAL_AND_EXP', symbols: ['EQUALITY_EXP'], postprocess: id },
114
- {
115
- name: 'EQUALITY_EXP',
116
- symbols: ['EQUALITY_EXP', '_', lexer.has('eq') ? { type: 'eq' } : eq, '_', 'RELATIONAL_EXP'],
117
- postprocess: function (d) {
118
- return api.binaryOperator('EQUAL', d[0], d[4])
119
- },
120
- },
121
- {
122
- name: 'EQUALITY_EXP',
123
- symbols: ['EQUALITY_EXP', '_', lexer.has('neq') ? { type: 'neq' } : neq, '_', 'RELATIONAL_EXP'],
124
- postprocess: function (d) {
125
- return api.binaryOperator('NOT_EQUAL', d[0], d[4])
126
- },
127
- },
128
- { name: 'EQUALITY_EXP', symbols: ['RELATIONAL_EXP'], postprocess: id },
129
- {
130
- name: 'RELATIONAL_EXP',
131
- symbols: ['RELATIONAL_EXP', '_', lexer.has('gt') ? { type: 'gt' } : gt, '_', 'ADDITIVE_EXP'],
132
- postprocess: function (d) {
133
- return api.binaryOperator('>', d[0], d[4])
134
- },
135
- },
136
- {
137
- name: 'RELATIONAL_EXP',
138
- symbols: ['RELATIONAL_EXP', '_', lexer.has('lt') ? { type: 'lt' } : lt, '_', 'ADDITIVE_EXP'],
139
- postprocess: function (d) {
140
- return api.binaryOperator('<', d[0], d[4])
141
- },
142
- },
143
- {
144
- name: 'RELATIONAL_EXP',
145
- symbols: ['RELATIONAL_EXP', '_', lexer.has('gte') ? { type: 'gte' } : gte, '_', 'ADDITIVE_EXP'],
146
- postprocess: function (d) {
147
- return api.binaryOperator('>=', d[0], d[4])
148
- },
149
- },
150
- {
151
- name: 'RELATIONAL_EXP',
152
- symbols: ['RELATIONAL_EXP', '_', lexer.has('lte') ? { type: 'lte' } : lte, '_', 'ADDITIVE_EXP'],
153
- postprocess: function (d) {
154
- return api.binaryOperator('<=', d[0], d[4])
155
- },
156
- },
157
- { name: 'RELATIONAL_EXP', symbols: ['ADDITIVE_EXP'], postprocess: id },
158
- {
159
- name: 'ADDITIVE_EXP',
160
- symbols: ['ADDITIVE_EXP', '_', lexer.has('plus') ? { type: 'plus' } : plus, '_', 'MULTIPLICATIVE_EXP'],
161
- postprocess: function (d) {
162
- return api.binaryOperator('ADD', d[0], d[4])
163
- },
164
- },
165
- {
166
- name: 'ADDITIVE_EXP',
167
- symbols: [
168
- 'ADDITIVE_EXP',
169
- '_',
170
- lexer.has('minus') ? { type: 'minus' } : minus,
171
- '_',
172
- 'MULTIPLICATIVE_EXP',
173
- ],
174
- postprocess: function (d) {
175
- return api.binaryOperator('SUB', d[0], d[4])
176
- },
177
- },
178
- { name: 'ADDITIVE_EXP', symbols: ['MULTIPLICATIVE_EXP'], postprocess: id },
179
- {
180
- name: 'MULTIPLICATIVE_EXP',
181
- symbols: [
182
- 'MULTIPLICATIVE_EXP',
183
- '_',
184
- lexer.has('multiply') ? { type: 'multiply' } : multiply,
185
- '_',
186
- 'UNARY_EXP',
187
- ],
188
- postprocess: function (d) {
189
- return api.binaryOperator('MULTIPLY', d[0], d[4])
190
- },
191
- },
192
- {
193
- name: 'MULTIPLICATIVE_EXP',
194
- symbols: [
195
- 'MULTIPLICATIVE_EXP',
196
- '_',
197
- lexer.has('divide') ? { type: 'divide' } : divide,
198
- '_',
199
- 'UNARY_EXP',
200
- ],
201
- postprocess: function (d) {
202
- return api.binaryOperator('DIVIDE', d[0], d[4])
203
- },
204
- },
205
- {
206
- name: 'MULTIPLICATIVE_EXP',
207
- symbols: [
208
- 'MULTIPLICATIVE_EXP',
209
- '_',
210
- lexer.has('modulo') ? { type: 'modulo' } : modulo,
211
- '_',
212
- 'UNARY_EXP',
213
- ],
214
- postprocess: function (d) {
215
- return api.binaryOperator('MOD', d[0], d[4])
216
- },
217
- },
218
- { name: 'MULTIPLICATIVE_EXP', symbols: ['UNARY_EXP'], postprocess: id },
219
- {
220
- name: 'UNARY_EXP',
221
- symbols: [lexer.has('minus') ? { type: 'minus' } : minus, 'UNARY_EXP'],
222
- postprocess: function (d) {
223
- return api.unaryOperator('NEGATE', d[1], d[0])
224
- },
225
- },
226
- {
227
- name: 'UNARY_EXP',
228
- symbols: [lexer.has('bash') ? { type: 'bash' } : bash, 'UNARY_EXP'],
229
- postprocess: function (d) {
230
- return api.unaryOperator('NOT', d[1], d[0])
231
- },
232
- },
233
- { name: 'UNARY_EXP', symbols: ['TERM'], postprocess: id },
234
- {
235
- name: 'TERM',
236
- symbols: [
237
- 'NAME',
238
- lexer.has('lparan') ? { type: 'lparan' } : lparan,
239
- '_',
240
- 'EXP_LIST',
241
- '_',
242
- lexer.has('rparan') ? { type: 'rparan' } : rparan,
243
- ],
244
- postprocess: function (d) {
245
- return api.transformFunc(d[0], api.listContainer(d[3]), d[5])
246
- },
247
- },
248
- {
249
- name: 'TERM',
250
- symbols: [
251
- lexer.has('lparan') ? { type: 'lparan' } : lparan,
252
- '_',
253
- 'EXP',
254
- '_',
255
- lexer.has('rparan') ? { type: 'rparan' } : rparan,
256
- ],
257
- postprocess: function (d) {
258
- return d[2]
259
- },
260
- },
261
- {
262
- name: 'TERM',
263
- symbols: [
264
- lexer.has('lbracket') ? { type: 'lbracket' } : lbracket,
265
- '_',
266
- 'EXP_LIST',
267
- '_',
268
- lexer.has('rbracket') ? { type: 'rbracket' } : rbracket,
269
- ],
270
- postprocess: function (d) {
271
- return api.listContainer(d[2], d[0], d[4])
272
- },
273
- },
274
- {
275
- name: 'TERM',
276
- symbols: [
277
- lexer.has('lbrace') ? { type: 'lbrace' } : lbrace,
278
- '_',
279
- 'MAP_PARAM_LIST',
280
- '_',
281
- lexer.has('rbrace') ? { type: 'rbrace' } : rbrace,
282
- ],
283
- postprocess: function (d) {
284
- return api.mapContainer(d[2], d[0], d[4])
285
- },
286
- },
287
- { name: 'TERM', symbols: ['STRING'], postprocess: id },
288
- { name: 'TERM', symbols: ['NUMBER'], postprocess: id },
289
- { name: 'TERM', symbols: ['BINDING'], postprocess: id },
290
- {
291
- name: 'TERM',
292
- symbols: [lexer.has('true') ? { type: 'true' } : true],
293
- postprocess: function (d) {
294
- return api.boolean(d[0])
295
- },
296
- },
297
- {
298
- name: 'TERM',
299
- symbols: [lexer.has('false') ? { type: 'false' } : false],
300
- postprocess: function (d) {
301
- return api.boolean(d[0])
302
- },
303
- },
304
- { name: 'EXP_LIST', symbols: [], postprocess: () => [] },
305
- {
306
- name: 'EXP_LIST',
307
- symbols: ['EXP_LIST', '_', { literal: ',' }, '_', 'EXP'],
308
- postprocess: function (d) {
309
- return d[0].concat(d[4])
310
- },
311
- },
312
- {
313
- name: 'EXP_LIST',
314
- symbols: ['EXP'],
315
- postprocess: function (d) {
316
- return [d[0]]
317
- },
318
- },
319
- {
320
- name: 'MAP_PARAM_LIST',
321
- symbols: [],
322
- postprocess: function (d) {
323
- return []
324
- },
325
- },
326
- {
327
- name: 'MAP_PARAM_LIST',
328
- symbols: ['MAP_PARAM_LIST', '_', { literal: ',' }, '_', 'MAP_PARAM'],
329
- postprocess: function (d) {
330
- d[0].push(d[4])
331
- return d[0]
332
- },
333
- },
334
- {
335
- name: 'MAP_PARAM_LIST',
336
- symbols: ['MAP_PARAM'],
337
- postprocess: function (d) {
338
- return [d[0]]
339
- },
340
- },
341
- {
342
- name: 'MAP_PARAM',
343
- symbols: ['NAME', '_', { literal: ':' }, '_', 'EXP'],
344
- postprocess: function (d) {
345
- return { name: d[0].value, value: d[4] }
346
- },
347
- },
348
- {
349
- name: 'BINDING',
350
- symbols: [lexer.has('stateBinding') ? { type: 'stateBinding' } : stateBinding, '_BINDING'],
351
- postprocess: function (d) {
352
- return api.binding('STATE_BINDING', d[1], d[0])
353
- },
354
- },
355
- {
356
- name: 'BINDING',
357
- symbols: [lexer.has('dataBinding') ? { type: 'dataBinding' } : dataBinding, '_BINDING'],
358
- postprocess: function (d) {
359
- return api.binding('DATA_OUTPUT_BINDING', d[1], d[0])
360
- },
361
- },
362
- {
363
- name: 'BINDING',
364
- symbols: [lexer.has('sessionBinding') ? { type: 'sessionBinding' } : sessionBinding, '_BINDING'],
365
- postprocess: function (d) {
366
- return api.binding('CONTEXT_BINDING', d[1], d[0], 'session')
367
- },
368
- },
369
- {
370
- name: 'BINDING',
371
- symbols: [lexer.has('propBinding') ? { type: 'propBinding' } : propBinding, '_BINDING'],
372
- postprocess: function (d) {
373
- return api.binding('CONTEXT_BINDING', d[1], d[0], 'props')
374
- },
375
- },
376
- {
377
- name: 'BINDING',
378
- symbols: [lexer.has('appBinding') ? { type: 'appBinding' } : appBinding, '_BINDING'],
379
- postprocess: function (d) {
380
- return api.binding('CONTEXT_BINDING', d[1], d[0], 'app')
381
- },
382
- },
383
- {
384
- name: 'BINDING',
385
- symbols: [lexer.has('syspropBinding') ? { type: 'syspropBinding' } : syspropBinding, '_BINDING'],
386
- postprocess: function (d) {
387
- return api.binding('CONTEXT_BINDING', d[1], d[0], 'sysprop')
388
- },
389
- },
390
- {
391
- name: 'BINDING',
392
- symbols: [
393
- lexer.has('itemBinding') ? { type: 'itemBinding' } : itemBinding,
394
- 'NAME',
395
- { literal: '.' },
396
- '_BINDING',
397
- ],
398
- postprocess: function (d) {
399
- return api.binding('REPEATER_ITEM_BINDING', d[3], d[0], d[1].value)
400
- },
401
- },
402
- {
403
- name: 'BINDING',
404
- symbols: [lexer.has('itemBinding') ? { type: 'itemBinding' } : itemBinding, 'NAME'],
405
- postprocess: function (d) {
406
- return api.binding('REPEATER_ITEM_BINDING', [], d[0], d[1].value)
407
- },
408
- },
409
- {
410
- name: 'BINDING',
411
- symbols: [
412
- lexer.has('eventPayloadBinding') ? { type: 'eventPayloadBinding' } : eventPayloadBinding,
413
- '_BINDING',
414
- ],
415
- postprocess: function (d) {
416
- return api.binding('EVENT_PAYLOAD_BINDING', d[1], d[0])
417
- },
418
- },
419
- {
420
- name: 'BINDING',
421
- symbols: [lexer.has('elementBinding') ? { type: 'elementBinding' } : elementBinding, '_BINDING'],
422
- postprocess: function (d) {
423
- return api.binding('ELEMENT_BINDING', d[1], d[0])
424
- },
425
- },
426
- {
427
- name: 'BINDING',
428
- symbols: [lexer.has('envBinding') ? { type: 'envBinding' } : envBinding, '_BINDING'],
429
- postprocess: function (d) {
430
- return api.binding('ENV_BINDING', d[1], d[0])
431
- },
432
- },
433
- {
434
- name: 'BINDING',
435
- symbols: [lexer.has('unknownBinding') ? { type: 'unknownBinding' } : unknownBinding, '_BINDING'],
436
- postprocess: function (d) {
437
- return api.unknownBinding(d[0].value.slice(1, d[0].value.length - 1), d[1], d[0])
438
- },
439
- },
440
- {
441
- name: '_BINDING',
442
- symbols: ['_BINDING', { literal: '.' }, '_STRING'],
443
- postprocess: function (d) {
444
- return d[0].concat(d[2].value)
445
- },
446
- },
447
- {
448
- name: '_BINDING',
449
- symbols: ['_BINDING', { literal: '.' }, 'NAME'],
450
- postprocess: function (d) {
451
- return d[0].concat(d[2].value)
452
- },
453
- },
454
- {
455
- name: '_BINDING',
456
- symbols: ['_BINDING', { literal: '.' }, 'INDEX'],
457
- postprocess: function (d) {
458
- return d[0].concat(d[2])
459
- },
460
- },
461
- {
462
- name: '_BINDING',
463
- symbols: ['_STRING'],
464
- postprocess: function (d) {
465
- return [d[0].value]
466
- },
467
- },
468
- {
469
- name: '_BINDING',
470
- symbols: ['NAME'],
471
- postprocess: function (d) {
472
- return [d[0].value]
473
- },
474
- },
475
- {
476
- name: '_BINDING',
477
- symbols: ['INDEX'],
478
- postprocess: function (d) {
479
- return [d[0]]
480
- },
481
- },
482
- {
483
- name: 'NAME',
484
- symbols: [lexer.has('name') ? { type: 'name' } : name],
485
- postprocess: ([nameToken]) => {
486
- return nameToken
487
- },
488
- },
489
- {
490
- name: 'QUOTED_NAME',
491
- symbols: [
492
- lexer.has('quoted_binding_string_literal')
493
- ? { type: 'quoted_binding_string_literal' }
494
- : quoted_binding_string_literal,
495
- ],
496
- postprocess: ([nameToken]) => {
497
- return nameToken.value
498
- },
499
- },
500
- {
501
- name: 'STRING',
502
- symbols: ['_STRING'],
503
- postprocess: function (d) {
504
- return api.literal(d[0])
505
- },
506
- },
507
- {
508
- name: '_STRING',
509
- symbols: [lexer.has('string_literal') ? { type: 'string_literal' } : string_literal],
510
- postprocess: function (d) {
511
- return d[0]
512
- },
513
- },
514
- {
515
- name: 'INDEX',
516
- symbols: [lexer.has('number_literal') ? { type: 'number_literal' } : number_literal],
517
- postprocess: function (d) {
518
- return `${d[0].value}`
519
- },
520
- },
521
- {
522
- name: 'NUMBER',
523
- symbols: [lexer.has('number_literal') ? { type: 'number_literal' } : number_literal],
524
- postprocess: function (d) {
525
- return api.literal(d[0])
526
- },
527
- },
528
- { name: '_$ebnf$1', symbols: [] },
529
- {
530
- name: '_$ebnf$1',
531
- symbols: ['_$ebnf$1', lexer.has('whitespace') ? { type: 'whitespace' } : whitespace],
532
- postprocess: function arrpush(d) {
533
- return d[0].concat([d[1]])
534
- },
535
- },
536
- {
537
- name: '_',
538
- symbols: ['_$ebnf$1'],
539
- postprocess: function (d) {
540
- return null
541
- },
542
- },
543
- ],
544
- ParserStart: 'main',
545
- }
546
- if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
547
- module.exports = grammar
548
- } else {
549
- window.grammar = grammar
550
- }
551
- })()
@@ -1,65 +0,0 @@
1
- // Copied from sn-uxf-formula-parser-library - https://code.devsnc.com/dev/uxf-formula-parser
2
-
3
- /**
4
- * https://code.devsnc.com/dev/uxf-formula-parser/blob/ci/master/src/uxf-formula-parser/grammar-parser/spanHelpers.js
5
- */
6
-
7
- // given a token, gets the line and col where it starts (helper function, no need to export)
8
- function tokenStart(token) {
9
- return {
10
- line: token.line,
11
- col: token.col,
12
- }
13
- }
14
-
15
- // given a token, gets the line and col where it ends (helper function, no need to export)
16
- function tokenEnd(token) {
17
- const lastNewLine = token.text?.lastIndexOf('\n') ?? -1
18
- if (lastNewLine !== -1) {
19
- throw new Error('Unsupported case: token with line breaks')
20
- }
21
- return {
22
- line: token.line,
23
- col: token.col + token.text.length,
24
- }
25
- }
26
-
27
- // given two tokens, returns the span of the two tokens
28
- export function tokenSpan(token, endToken = null) {
29
- const start = tokenStart(token)
30
- const end = tokenEnd(endToken ?? token)
31
-
32
- return { start, end }
33
- }
34
-
35
- // given two ux values (left and right operands in a binary expression), return the span of the entire expression
36
- export function getBinarySpan(left, right) {
37
- const start = left._span.start
38
- const end = right._span.end
39
- return { start, end }
40
- }
41
-
42
- // given the token of the unary operator and the operand ux value, returns the span of a unary expression
43
- export function getUnarySpan(token, operand) {
44
- const start = tokenStart(token)
45
- const end = operand._span.end
46
- return { start, end }
47
- }
48
-
49
- // given the binding token and the address of a binding, returns the span of the binding
50
- export function getBindingSpan(token, address) {
51
- const start = tokenStart(token)
52
- const { line, col } = start
53
- var totalLength = 0
54
- if (address) {
55
- for (let i = 0; i < address.length; i++) {
56
- totalLength += address[i].length
57
- if (i !== 0) {
58
- totalLength += 1
59
- }
60
- }
61
- }
62
- const endCol = col + token.value.length + totalLength
63
- const end = { line, col: endCol }
64
- return { start, end }
65
- }
@@ -1,4 +0,0 @@
1
- import UxfFormulaParser from './parser'
2
- import { cleanUxValue } from './cleanUxValue'
3
-
4
- export { UxfFormulaParser as parser, cleanUxValue }
@@ -1,64 +0,0 @@
1
- // Copied from sn-uxf-formula-parser-library - https://code.devsnc.com/dev/uxf-formula-parser
2
-
3
- /**
4
- * https://code.devsnc.com/dev/uxf-formula-parser/blob/ci/master/src/uxf-formula-parser/parser/expressionParser.js
5
- */
6
-
7
- import nearley from 'nearley'
8
- import * as grammar from './grammerParser/grammarParser.js'
9
- import { getErrorMsg } from './utils/getErrorMsg'
10
-
11
- class UxfFormulaParser {
12
- constructor() {}
13
-
14
- parse(expression) {
15
- let ans
16
- const parser = new nearley.Parser(nearley.Grammar.fromCompiled(grammar))
17
-
18
- parser.reportError = function (token) {
19
- const message = token.value
20
- ? `Invalid Syntax: did not expect the token "${token.value}" when parsing expression.`
21
- : 'Invalid Syntax: unparsable expression entered'
22
- throw getErrorMsg(message, {
23
- start: { line: token.line, col: token.col },
24
- end: { line: token.line, col: token.col + token.value.length },
25
- })
26
- }
27
-
28
- try {
29
- // Make a parser and feed the input
30
- ans = parser.feed(expression)
31
-
32
- // Check if there are any results
33
- if (ans.results.length) {
34
- return {
35
- result: ans.results[0],
36
- errors: [],
37
- }
38
- } else {
39
- // This means the input is incomplete.
40
- const out = 'Error: incomplete input, parse failed. :('
41
- return {
42
- result: out,
43
- errors: [
44
- {
45
- message: 'Syntax error: Incomplete formula.',
46
- severity: '8',
47
- startLineNumber: ans.lexerState.line,
48
- startColumn: ans.lexerState.col,
49
- endLineNumber: ans.lexerState.line,
50
- endColumn: ans.lexerState.col + 1,
51
- },
52
- ],
53
- }
54
- }
55
- } catch (e: any) {
56
- return {
57
- result: e.message,
58
- errors: [e],
59
- }
60
- }
61
- }
62
- }
63
-
64
- export default UxfFormulaParser