@qrvey/formula-lang 0.4.0 → 0.5.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 (316) hide show
  1. package/.vscode/launch.json +15 -0
  2. package/CHANGELOG.md +12 -0
  3. package/dist/{constants → cjs/constants}/index.d.ts +11 -2
  4. package/dist/cjs/constants/index.js +117 -0
  5. package/dist/cjs/constants/index.js.map +1 -0
  6. package/dist/{constants → cjs/constants}/interfaces.d.ts +14 -4
  7. package/dist/cjs/constants/interfaces.js +3 -0
  8. package/dist/{constants → cjs/constants}/interfaces.js.map +1 -1
  9. package/dist/{errors → cjs/errors}/definitions.d.ts +20 -3
  10. package/dist/cjs/errors/definitions.js +91 -0
  11. package/dist/cjs/errors/definitions.js.map +1 -0
  12. package/dist/cjs/errors/elasticsearch.js +30 -0
  13. package/dist/cjs/errors/elasticsearch.js.map +1 -0
  14. package/dist/cjs/errors/engineErrors.js +25 -0
  15. package/dist/cjs/errors/engineErrors.js.map +1 -0
  16. package/dist/cjs/errors/index.js +21 -0
  17. package/dist/cjs/errors/index.js.map +1 -0
  18. package/dist/cjs/errors/snowflake.js +20 -0
  19. package/dist/cjs/errors/snowflake.js.map +1 -0
  20. package/dist/cjs/functions/abs.js +38 -0
  21. package/dist/cjs/functions/abs.js.map +1 -0
  22. package/dist/cjs/functions/datedif.js +64 -0
  23. package/dist/cjs/functions/datedif.js.map +1 -0
  24. package/dist/cjs/functions/day.js +39 -0
  25. package/dist/cjs/functions/day.js.map +1 -0
  26. package/dist/cjs/functions/hour.js +39 -0
  27. package/dist/cjs/functions/hour.js.map +1 -0
  28. package/dist/cjs/functions/if.js +52 -0
  29. package/dist/cjs/functions/if.js.map +1 -0
  30. package/dist/cjs/functions/ifs.js +74 -0
  31. package/dist/cjs/functions/ifs.js.map +1 -0
  32. package/dist/cjs/functions/index.js +33 -0
  33. package/dist/cjs/functions/index.js.map +1 -0
  34. package/dist/cjs/functions/mid.js +54 -0
  35. package/dist/cjs/functions/mid.js.map +1 -0
  36. package/dist/cjs/functions/minute.js +39 -0
  37. package/dist/cjs/functions/minute.js.map +1 -0
  38. package/dist/cjs/functions/month.js +39 -0
  39. package/dist/cjs/functions/month.js.map +1 -0
  40. package/dist/cjs/functions/second.js +39 -0
  41. package/dist/cjs/functions/second.js.map +1 -0
  42. package/dist/cjs/functions/year.js +39 -0
  43. package/dist/cjs/functions/year.js.map +1 -0
  44. package/dist/cjs/grammar/generated/qformula.lang.d.ts +13 -0
  45. package/dist/cjs/grammar/generated/qformula.lang.js +50 -0
  46. package/dist/cjs/grammar/generated/qformula.lang.js.map +1 -0
  47. package/dist/cjs/grammar/qformula.grammar.js +18 -0
  48. package/dist/cjs/grammar/qformula.grammar.js.map +1 -0
  49. package/dist/{index.d.ts → cjs/index.d.ts} +3 -2
  50. package/dist/cjs/index.js +33 -0
  51. package/dist/cjs/index.js.map +1 -0
  52. package/dist/cjs/main.d.ts +1 -0
  53. package/dist/cjs/main.js +69 -0
  54. package/dist/cjs/main.js.map +1 -0
  55. package/dist/cjs/parser/json-parser.js +201 -0
  56. package/dist/cjs/parser/json-parser.js.map +1 -0
  57. package/dist/cjs/parser/syntax-errors.d.ts +3 -0
  58. package/dist/cjs/parser/syntax-errors.js +28 -0
  59. package/dist/cjs/parser/syntax-errors.js.map +1 -0
  60. package/dist/cjs/transpiler/columnTranspilation.d.ts +3 -0
  61. package/dist/cjs/transpiler/columnTranspilation.js +29 -0
  62. package/dist/cjs/transpiler/columnTranspilation.js.map +1 -0
  63. package/dist/{transpiler → cjs/transpiler}/index.d.ts +4 -4
  64. package/dist/cjs/transpiler/index.js +107 -0
  65. package/dist/cjs/transpiler/index.js.map +1 -0
  66. package/dist/cjs/transpiler/unshiftCustomFunctions.d.ts +2 -0
  67. package/dist/cjs/transpiler/unshiftCustomFunctions.js +14 -0
  68. package/dist/cjs/transpiler/unshiftCustomFunctions.js.map +1 -0
  69. package/dist/cjs/transpiler/validateFuncStructure.js +41 -0
  70. package/dist/cjs/transpiler/validateFuncStructure.js.map +1 -0
  71. package/dist/{utils → cjs/utils}/customFunctions.d.ts +1 -0
  72. package/dist/cjs/utils/customFunctions.js +35 -0
  73. package/dist/cjs/utils/customFunctions.js.map +1 -0
  74. package/dist/{utils → cjs/utils}/elasticsearch/index.d.ts +1 -1
  75. package/dist/cjs/utils/elasticsearch/index.js +22 -0
  76. package/dist/cjs/utils/elasticsearch/index.js.map +1 -0
  77. package/dist/{utils → cjs/utils}/elasticsearch/scripts.d.ts +1 -0
  78. package/dist/cjs/utils/elasticsearch/scripts.js +57 -0
  79. package/dist/cjs/utils/elasticsearch/scripts.js.map +1 -0
  80. package/dist/cjs/utils/getMonthMaxDayAllowed.js +26 -0
  81. package/dist/cjs/utils/getMonthMaxDayAllowed.js.map +1 -0
  82. package/dist/cjs/utils/getNodeValue.js +13 -0
  83. package/dist/cjs/utils/getNodeValue.js.map +1 -0
  84. package/dist/cjs/utils/getVariableType.js +19 -0
  85. package/dist/cjs/utils/getVariableType.js.map +1 -0
  86. package/dist/cjs/utils/index.js +29 -0
  87. package/dist/cjs/utils/index.js.map +1 -0
  88. package/dist/cjs/utils/isDateParam.js +12 -0
  89. package/dist/cjs/utils/isDateParam.js.map +1 -0
  90. package/dist/cjs/utils/isNumberParam.js +12 -0
  91. package/dist/cjs/utils/isNumberParam.js.map +1 -0
  92. package/dist/cjs/utils/isPositiveNumberParam.js +12 -0
  93. package/dist/cjs/utils/isPositiveNumberParam.js.map +1 -0
  94. package/dist/cjs/utils/isStringParam.js +12 -0
  95. package/dist/cjs/utils/isStringParam.js.map +1 -0
  96. package/dist/cjs/utils/isValidDate.js +8 -0
  97. package/dist/cjs/utils/isValidDate.js.map +1 -0
  98. package/dist/cjs/utils/sql/index.js +6 -0
  99. package/dist/cjs/utils/sql/index.js.map +1 -0
  100. package/dist/cjs/utils/sql/scripts.js +44 -0
  101. package/dist/cjs/utils/sql/scripts.js.map +1 -0
  102. package/dist/module/constants/index.d.ts +53 -0
  103. package/dist/{constants → module/constants}/index.js +26 -0
  104. package/dist/module/constants/index.js.map +1 -0
  105. package/dist/module/constants/interfaces.d.ts +91 -0
  106. package/dist/module/constants/interfaces.js.map +1 -0
  107. package/dist/module/errors/definitions.d.ts +43 -0
  108. package/dist/module/errors/definitions.js +78 -0
  109. package/dist/module/errors/definitions.js.map +1 -0
  110. package/dist/module/errors/elasticsearch.d.ts +24 -0
  111. package/dist/module/errors/elasticsearch.js.map +1 -0
  112. package/dist/module/errors/engineErrors.d.ts +2 -0
  113. package/dist/module/errors/engineErrors.js.map +1 -0
  114. package/dist/module/errors/index.d.ts +2 -0
  115. package/dist/module/errors/index.js.map +1 -0
  116. package/dist/module/errors/snowflake.d.ts +15 -0
  117. package/dist/module/errors/snowflake.js.map +1 -0
  118. package/dist/module/functions/abs.d.ts +5 -0
  119. package/dist/module/functions/abs.js.map +1 -0
  120. package/dist/module/functions/datedif.d.ts +5 -0
  121. package/dist/module/functions/datedif.js.map +1 -0
  122. package/dist/module/functions/day.d.ts +5 -0
  123. package/dist/module/functions/day.js.map +1 -0
  124. package/dist/module/functions/hour.d.ts +5 -0
  125. package/dist/module/functions/hour.js.map +1 -0
  126. package/dist/module/functions/if.d.ts +5 -0
  127. package/dist/module/functions/if.js.map +1 -0
  128. package/dist/module/functions/ifs.d.ts +5 -0
  129. package/dist/module/functions/ifs.js.map +1 -0
  130. package/dist/module/functions/index.d.ts +4 -0
  131. package/dist/module/functions/index.js.map +1 -0
  132. package/dist/module/functions/mid.d.ts +5 -0
  133. package/dist/module/functions/mid.js.map +1 -0
  134. package/dist/module/functions/minute.d.ts +5 -0
  135. package/dist/module/functions/minute.js.map +1 -0
  136. package/dist/module/functions/month.d.ts +5 -0
  137. package/dist/module/functions/month.js.map +1 -0
  138. package/dist/module/functions/second.d.ts +5 -0
  139. package/dist/module/functions/second.js.map +1 -0
  140. package/dist/module/functions/year.d.ts +5 -0
  141. package/dist/module/functions/year.js.map +1 -0
  142. package/dist/module/grammar/generated/qformula.lang.d.ts +13 -0
  143. package/dist/{grammar → module/grammar}/generated/qformula.lang.js +5 -4
  144. package/dist/module/grammar/generated/qformula.lang.js.map +1 -0
  145. package/dist/module/grammar/qformula.grammar.d.ts +1 -0
  146. package/dist/module/grammar/qformula.grammar.js.map +1 -0
  147. package/dist/module/index.d.ts +10 -0
  148. package/dist/{index.js → module/index.js} +3 -2
  149. package/dist/module/index.js.map +1 -0
  150. package/dist/module/main.d.ts +1 -0
  151. package/dist/module/main.js +67 -0
  152. package/dist/module/main.js.map +1 -0
  153. package/dist/module/parser/json-parser.d.ts +3 -0
  154. package/dist/module/parser/json-parser.js +197 -0
  155. package/dist/module/parser/json-parser.js.map +1 -0
  156. package/dist/module/parser/syntax-errors.d.ts +3 -0
  157. package/dist/module/parser/syntax-errors.js +24 -0
  158. package/dist/module/parser/syntax-errors.js.map +1 -0
  159. package/dist/module/transpiler/columnTranspilation.d.ts +3 -0
  160. package/dist/module/transpiler/columnTranspilation.js +25 -0
  161. package/dist/module/transpiler/columnTranspilation.js.map +1 -0
  162. package/dist/module/transpiler/index.d.ts +18 -0
  163. package/dist/{transpiler → module/transpiler}/index.js +29 -21
  164. package/dist/module/transpiler/index.js.map +1 -0
  165. package/dist/module/transpiler/unshiftCustomFunctions.d.ts +2 -0
  166. package/dist/module/transpiler/unshiftCustomFunctions.js +10 -0
  167. package/dist/module/transpiler/unshiftCustomFunctions.js.map +1 -0
  168. package/dist/module/transpiler/validateFuncStructure.d.ts +2 -0
  169. package/dist/module/transpiler/validateFuncStructure.js.map +1 -0
  170. package/dist/module/utils/customFunctions.d.ts +4 -0
  171. package/dist/{utils → module/utils}/customFunctions.js +10 -2
  172. package/dist/module/utils/customFunctions.js.map +1 -0
  173. package/dist/module/utils/elasticsearch/index.d.ts +2 -0
  174. package/dist/{utils → module/utils}/elasticsearch/index.js +1 -1
  175. package/dist/module/utils/elasticsearch/index.js.map +1 -0
  176. package/dist/module/utils/elasticsearch/scripts.d.ts +11 -0
  177. package/dist/{utils → module/utils}/elasticsearch/scripts.js +14 -4
  178. package/dist/module/utils/elasticsearch/scripts.js.map +1 -0
  179. package/dist/module/utils/getMonthMaxDayAllowed.d.ts +7 -0
  180. package/dist/module/utils/getMonthMaxDayAllowed.js.map +1 -0
  181. package/dist/module/utils/getNodeValue.d.ts +2 -0
  182. package/dist/module/utils/getNodeValue.js.map +1 -0
  183. package/dist/module/utils/getVariableType.d.ts +3 -0
  184. package/dist/{utils → module/utils}/getVariableType.js +3 -2
  185. package/dist/module/utils/getVariableType.js.map +1 -0
  186. package/dist/module/utils/index.d.ts +10 -0
  187. package/dist/module/utils/index.js.map +1 -0
  188. package/dist/module/utils/isDateParam.d.ts +2 -0
  189. package/dist/module/utils/isDateParam.js.map +1 -0
  190. package/dist/module/utils/isNumberParam.d.ts +2 -0
  191. package/dist/module/utils/isNumberParam.js.map +1 -0
  192. package/dist/module/utils/isPositiveNumberParam.d.ts +2 -0
  193. package/dist/module/utils/isPositiveNumberParam.js.map +1 -0
  194. package/dist/module/utils/isStringParam.d.ts +2 -0
  195. package/dist/module/utils/isStringParam.js.map +1 -0
  196. package/dist/module/utils/isValidDate.d.ts +1 -0
  197. package/dist/module/utils/isValidDate.js.map +1 -0
  198. package/dist/module/utils/sql/index.d.ts +1 -0
  199. package/dist/module/utils/sql/index.js.map +1 -0
  200. package/dist/module/utils/sql/scripts.d.ts +3 -0
  201. package/dist/module/utils/sql/scripts.js.map +1 -0
  202. package/jest.config.ts +6 -0
  203. package/package.json +21 -6
  204. package/__tests__/integration/__mocks__/context.ts +0 -23
  205. package/__tests__/integration/__mocks__/elasticsearchScripts.ts +0 -28
  206. package/__tests__/integration/__mocks__/sqlScripts.ts +0 -21
  207. package/__tests__/integration/elasticsearch.test.ts +0 -172
  208. package/__tests__/integration/expression.test.ts +0 -56
  209. package/__tests__/integration/redshift.test.ts +0 -142
  210. package/__tests__/integration/sonwflake.test.ts +0 -138
  211. package/__tests__/unit/parser.test.ts +0 -236
  212. package/__tests__/unit/transpiler.test.ts +0 -128
  213. package/bitbucket-pipelines.yml +0 -63
  214. package/dist/constants/index.js.map +0 -1
  215. package/dist/errors/definitions.js +0 -42
  216. package/dist/errors/definitions.js.map +0 -1
  217. package/dist/errors/elasticsearch.js.map +0 -1
  218. package/dist/errors/engineErrors.js.map +0 -1
  219. package/dist/errors/index.js.map +0 -1
  220. package/dist/errors/snowflake.js.map +0 -1
  221. package/dist/functions/abs.js.map +0 -1
  222. package/dist/functions/datedif.js.map +0 -1
  223. package/dist/functions/day.js.map +0 -1
  224. package/dist/functions/hour.js.map +0 -1
  225. package/dist/functions/if.js.map +0 -1
  226. package/dist/functions/ifs.js.map +0 -1
  227. package/dist/functions/index.js.map +0 -1
  228. package/dist/functions/mid.js.map +0 -1
  229. package/dist/functions/minute.js.map +0 -1
  230. package/dist/functions/month.js.map +0 -1
  231. package/dist/functions/second.js.map +0 -1
  232. package/dist/functions/year.js.map +0 -1
  233. package/dist/grammar/generated/qformula.lang.d.ts +0 -4
  234. package/dist/grammar/generated/qformula.lang.js.map +0 -1
  235. package/dist/grammar/qformula.grammar.js.map +0 -1
  236. package/dist/index.js.map +0 -1
  237. package/dist/parser/json-parser.js +0 -147
  238. package/dist/parser/json-parser.js.map +0 -1
  239. package/dist/transpiler/columnTranspilation.d.ts +0 -3
  240. package/dist/transpiler/columnTranspilation.js +0 -19
  241. package/dist/transpiler/columnTranspilation.js.map +0 -1
  242. package/dist/transpiler/index.js.map +0 -1
  243. package/dist/transpiler/validateFuncStructure.js.map +0 -1
  244. package/dist/utils/customFunctions.js.map +0 -1
  245. package/dist/utils/elasticsearch/index.js.map +0 -1
  246. package/dist/utils/elasticsearch/scripts.js.map +0 -1
  247. package/dist/utils/getMonthMaxDayAllowed.js.map +0 -1
  248. package/dist/utils/getNodeValue.js.map +0 -1
  249. package/dist/utils/getVariableType.js.map +0 -1
  250. package/dist/utils/index.js.map +0 -1
  251. package/dist/utils/isDateParam.js.map +0 -1
  252. package/dist/utils/isNumberParam.js.map +0 -1
  253. package/dist/utils/isPositiveNumberParam.js.map +0 -1
  254. package/dist/utils/isStringParam.js.map +0 -1
  255. package/dist/utils/isValidDate.js.map +0 -1
  256. package/dist/utils/sql/index.js.map +0 -1
  257. package/dist/utils/sql/scripts.js.map +0 -1
  258. /package/dist/{errors → cjs/errors}/elasticsearch.d.ts +0 -0
  259. /package/dist/{errors → cjs/errors}/engineErrors.d.ts +0 -0
  260. /package/dist/{errors → cjs/errors}/index.d.ts +0 -0
  261. /package/dist/{errors → cjs/errors}/snowflake.d.ts +0 -0
  262. /package/dist/{functions → cjs/functions}/abs.d.ts +0 -0
  263. /package/dist/{functions → cjs/functions}/datedif.d.ts +0 -0
  264. /package/dist/{functions → cjs/functions}/day.d.ts +0 -0
  265. /package/dist/{functions → cjs/functions}/hour.d.ts +0 -0
  266. /package/dist/{functions → cjs/functions}/if.d.ts +0 -0
  267. /package/dist/{functions → cjs/functions}/ifs.d.ts +0 -0
  268. /package/dist/{functions → cjs/functions}/index.d.ts +0 -0
  269. /package/dist/{functions → cjs/functions}/mid.d.ts +0 -0
  270. /package/dist/{functions → cjs/functions}/minute.d.ts +0 -0
  271. /package/dist/{functions → cjs/functions}/month.d.ts +0 -0
  272. /package/dist/{functions → cjs/functions}/second.d.ts +0 -0
  273. /package/dist/{functions → cjs/functions}/year.d.ts +0 -0
  274. /package/dist/{grammar → cjs/grammar}/qformula.grammar.d.ts +0 -0
  275. /package/dist/{parser → cjs/parser}/json-parser.d.ts +0 -0
  276. /package/dist/{transpiler → cjs/transpiler}/validateFuncStructure.d.ts +0 -0
  277. /package/dist/{utils → cjs/utils}/getMonthMaxDayAllowed.d.ts +0 -0
  278. /package/dist/{utils → cjs/utils}/getNodeValue.d.ts +0 -0
  279. /package/dist/{utils → cjs/utils}/getVariableType.d.ts +0 -0
  280. /package/dist/{utils → cjs/utils}/index.d.ts +0 -0
  281. /package/dist/{utils → cjs/utils}/isDateParam.d.ts +0 -0
  282. /package/dist/{utils → cjs/utils}/isNumberParam.d.ts +0 -0
  283. /package/dist/{utils → cjs/utils}/isPositiveNumberParam.d.ts +0 -0
  284. /package/dist/{utils → cjs/utils}/isStringParam.d.ts +0 -0
  285. /package/dist/{utils → cjs/utils}/isValidDate.d.ts +0 -0
  286. /package/dist/{utils → cjs/utils}/sql/index.d.ts +0 -0
  287. /package/dist/{utils → cjs/utils}/sql/scripts.d.ts +0 -0
  288. /package/dist/{constants → module/constants}/interfaces.js +0 -0
  289. /package/dist/{errors → module/errors}/elasticsearch.js +0 -0
  290. /package/dist/{errors → module/errors}/engineErrors.js +0 -0
  291. /package/dist/{errors → module/errors}/index.js +0 -0
  292. /package/dist/{errors → module/errors}/snowflake.js +0 -0
  293. /package/dist/{functions → module/functions}/abs.js +0 -0
  294. /package/dist/{functions → module/functions}/datedif.js +0 -0
  295. /package/dist/{functions → module/functions}/day.js +0 -0
  296. /package/dist/{functions → module/functions}/hour.js +0 -0
  297. /package/dist/{functions → module/functions}/if.js +0 -0
  298. /package/dist/{functions → module/functions}/ifs.js +0 -0
  299. /package/dist/{functions → module/functions}/index.js +0 -0
  300. /package/dist/{functions → module/functions}/mid.js +0 -0
  301. /package/dist/{functions → module/functions}/minute.js +0 -0
  302. /package/dist/{functions → module/functions}/month.js +0 -0
  303. /package/dist/{functions → module/functions}/second.js +0 -0
  304. /package/dist/{functions → module/functions}/year.js +0 -0
  305. /package/dist/{grammar → module/grammar}/qformula.grammar.js +0 -0
  306. /package/dist/{transpiler → module/transpiler}/validateFuncStructure.js +0 -0
  307. /package/dist/{utils → module/utils}/getMonthMaxDayAllowed.js +0 -0
  308. /package/dist/{utils → module/utils}/getNodeValue.js +0 -0
  309. /package/dist/{utils → module/utils}/index.js +0 -0
  310. /package/dist/{utils → module/utils}/isDateParam.js +0 -0
  311. /package/dist/{utils → module/utils}/isNumberParam.js +0 -0
  312. /package/dist/{utils → module/utils}/isPositiveNumberParam.js +0 -0
  313. /package/dist/{utils → module/utils}/isStringParam.js +0 -0
  314. /package/dist/{utils → module/utils}/isValidDate.js +0 -0
  315. /package/dist/{utils → module/utils}/sql/index.js +0 -0
  316. /package/dist/{utils → module/utils}/sql/scripts.js +0 -0
@@ -1,138 +0,0 @@
1
- import { ENGINES, Transpile } from '../../src';
2
- import { datePart, dateDif } from './__mocks__/sqlScripts';
3
- import { basicContext } from './__mocks__/context';
4
- const currentEngine = ENGINES.SNOWFLAKE;
5
-
6
- describe('SNOWFLAKE Transpile program', () => {
7
- test('Basic case', () => {
8
- const result = Transpile('1 + 2', currentEngine);
9
- expect(result?.expression).toBe('(1 + 2)');
10
- });
11
-
12
- test('MID function', () => {
13
- const result = Transpile('MID("test", 1, 5)', currentEngine);
14
- expect(result?.expression).toBe(`SUBSTRING('test', 1, 5)`);
15
- });
16
-
17
- test('Should transpile a function inside another function', () => {
18
- const program = 'MID(MID("This is a test", 1, 5), 1, 2)';
19
- const result = Transpile(program, currentEngine);
20
- expect(result?.valid).toBe(true);
21
- expect(result?.expression).toBe(
22
- "SUBSTRING(SUBSTRING('This is a test', 1, 5), 1, 2)",
23
- );
24
- });
25
-
26
- test('ABS function', () => {
27
- const result = Transpile('ABS(5)', currentEngine);
28
- expect(result?.expression).toBe(`ABS(5)`);
29
- });
30
-
31
- test('Cast Date string', () => {
32
- const result = Transpile('"12/31/2022 13:35:45"', currentEngine);
33
- expect(result?.expression).toBe(
34
- `CAST('2022-12-31T13:35:45.000Z' AS TIMESTAMPTZ)`,
35
- );
36
- });
37
-
38
- test('DAY function', () => {
39
- const result = Transpile('DAY("12/31/2023")', currentEngine);
40
- expect(result?.expression).toBe(datePart('day'));
41
- });
42
-
43
- test('DAY function with a variable Column', () => {
44
- const result = Transpile('DAY([DateID1])', currentEngine, basicContext);
45
- const column = '"Origin_Date_Column_Test"';
46
- const mock = datePart('day', column).replace(/\n/g, '');
47
- expect(result?.expression?.replace(/\n/g, '')).toBe(mock);
48
- });
49
-
50
- test('MONTH function', () => {
51
- const result = Transpile('MONTH("12/31/2023")', currentEngine);
52
- expect(result?.expression).toBe(datePart('month'));
53
- });
54
-
55
- test('YEAR function', () => {
56
- const result = Transpile('YEAR("12/31/2023")', currentEngine);
57
- expect(result?.expression).toBe(datePart('year'));
58
- });
59
-
60
- test('HOUR function', () => {
61
- const result = Transpile('HOUR("12/31/2023")', currentEngine);
62
- expect(result?.expression).toBe(datePart('hour'));
63
- });
64
-
65
- test('MINUTE function', () => {
66
- const result = Transpile('MINUTE("12/31/2023")', currentEngine);
67
- expect(result?.expression).toBe(datePart('minute'));
68
- });
69
-
70
- test('SECOND function', () => {
71
- const result = Transpile('SECOND("12/31/2023")', currentEngine);
72
- expect(result?.expression).toBe(datePart('second'));
73
- });
74
-
75
- test('DATEDIF function with Y unit', () => {
76
- const result = Transpile(
77
- 'DATEDIF("12/31/2023", "12/31/2022", "Y")',
78
- currentEngine,
79
- );
80
- const mock = dateDif('year');
81
- expect(result?.expression).toBe(mock);
82
- });
83
-
84
- test('DATEDIF function with M unit', () => {
85
- const result = Transpile(
86
- 'DATEDIF("12/31/2023", "12/31/2022", "M")',
87
- currentEngine,
88
- );
89
- const mock = dateDif('month');
90
- expect(result?.expression).toBe(mock);
91
- });
92
-
93
- test('DATEDIF function with D unit', () => {
94
- const result = Transpile(
95
- 'DATEDIF("12/31/2023", "12/31/2022", "D")',
96
- currentEngine,
97
- );
98
- const mock = dateDif('day');
99
- expect(result?.expression).toBe(mock);
100
- });
101
-
102
- test('DATEDIF function with a not valid Unit', () => {
103
- const result = Transpile(
104
- 'DATEDIF("12/31/2023", "12/31/2022", "X")',
105
- currentEngine,
106
- );
107
- expect(result).not.toBeUndefined();
108
- expect(result?.valid).toBe(false);
109
- expect(result?.error).not.toBeUndefined();
110
- expect(result?.error?.code).toBe('DATE_DIF_UNIT_PARAM');
111
- });
112
-
113
- test('IF function full parameters', () => {
114
- const result = Transpile('IF(5 = 1, "True", "False")', currentEngine);
115
- expect(result).not.toBeUndefined();
116
- expect(result?.error).toBeUndefined();
117
- expect(result?.expression).toBe(`IFF((5 = 1), 'True', 'False')`);
118
- });
119
-
120
- test('IF function basic parameters', () => {
121
- const result = Transpile('IF(5 = 1, "True")', currentEngine);
122
- expect(result).not.toBeUndefined();
123
- expect(result?.error).toBeUndefined();
124
- expect(result?.expression).toBe(`IFF((5 = 1), 'True', FALSE)`);
125
- });
126
-
127
- test('IFS function basic parameters', () => {
128
- const result = Transpile(
129
- 'IFS(5>10, "Greater than 10", 5>5, "Greater than 5",5>0, "Greater than 0")',
130
- currentEngine,
131
- );
132
- expect(result).not.toBeUndefined();
133
- expect(result?.error).toBeUndefined();
134
- expect(result?.expression).toBe(
135
- `IFF((5 > 10), 'Greater than 10', IFF((5 > 5), 'Greater than 5', IFF((5 > 0), 'Greater than 0', NULL)))`,
136
- );
137
- });
138
- });
@@ -1,236 +0,0 @@
1
- import { AST_TYPES } from '../../src/constants';
2
- import { calculateAST, FormulaLang } from '../../src';
3
- import {
4
- BinaryExpressionAST,
5
- FormulaContext,
6
- LiteralAST,
7
- UnaryExpressionAST,
8
- VariableAST,
9
- } from '../../src/constants/interfaces';
10
-
11
- describe('Parser tests suite', () => {
12
- test('Should parse a single node', () => {
13
- const program = '1 + 2';
14
- const parser = FormulaLang.parser;
15
- const { topNode } = parser.parse(program);
16
- const ast = calculateAST(program, topNode);
17
- expect(ast?.body).not.toBeUndefined();
18
-
19
- const body = ast?.body as BinaryExpressionAST;
20
- expect(body.operator).toBe('+');
21
- expect(body.type).toBe(AST_TYPES.binaryExpression);
22
- });
23
-
24
- test('Should fail a logic operation', () => {
25
- const program = '1 <';
26
- const parser = FormulaLang.parser;
27
- const { topNode } = parser.parse(program);
28
- const ast = calculateAST(program, topNode);
29
- expect(ast?.body).not.toBeUndefined();
30
-
31
- const body = ast?.body as BinaryExpressionAST;
32
- expect(body.operator).toBe('<');
33
- expect(body.type).toBe(AST_TYPES.binaryExpression);
34
- });
35
-
36
- describe('Value types', () => {
37
- test('Should return a unary expression', () => {
38
- const program = '-2';
39
- const parser = FormulaLang.parser;
40
- const { topNode } = parser.parse(program);
41
- const ast = calculateAST(program, topNode);
42
- expect(ast?.body).not.toBeUndefined();
43
-
44
- const body = ast?.body as UnaryExpressionAST;
45
- expect(body.operator).toEqual('-');
46
- const numberResult = body.right as LiteralAST;
47
- expect(numberResult.type).toEqual('Literal');
48
- expect(numberResult.dataType).toEqual('number');
49
- expect(numberResult.value).toEqual(2);
50
- });
51
-
52
- test('Should return a boolean expression', () => {
53
- const program = 'false';
54
- const parser = FormulaLang.parser;
55
- const { topNode } = parser.parse(program);
56
- const ast = calculateAST(program, topNode);
57
- expect(ast?.body).not.toBeUndefined();
58
-
59
- const body = ast?.body as LiteralAST;
60
- expect(body.type).toEqual('Literal');
61
- expect(body.dataType).toEqual('boolean');
62
- expect(body.value).toEqual(false);
63
- });
64
-
65
- test('Should return a null expression', () => {
66
- const program = 'null';
67
- const parser = FormulaLang.parser;
68
- const { topNode } = parser.parse(program);
69
- const ast = calculateAST(program, topNode);
70
- expect(ast?.body).not.toBeUndefined();
71
-
72
- const body = ast?.body as LiteralAST;
73
- expect(body.type).toEqual('Literal');
74
- expect(body.dataType).toEqual('null');
75
- expect(body.value).toEqual(null);
76
- });
77
-
78
- test('Should return a array expression', () => {
79
- const program = '<1,2,3>';
80
- const parser = FormulaLang.parser;
81
- const { topNode } = parser.parse(program);
82
- const ast = calculateAST(program, topNode);
83
- expect(ast?.body).not.toBeUndefined();
84
-
85
- const body = ast?.body as LiteralAST;
86
- expect(body.type).toEqual('Literal');
87
- expect(body.dataType).toEqual('array');
88
- const arrayValue = body.value as Array<LiteralAST>;
89
-
90
- expect(arrayValue[0].type).toEqual('Literal');
91
- expect(arrayValue[0].dataType).toEqual('number');
92
- expect(arrayValue[0].value).toEqual(1);
93
- expect(arrayValue[1].type).toEqual('Literal');
94
- expect(arrayValue[1].dataType).toEqual('number');
95
- expect(arrayValue[1].value).toEqual(2);
96
- expect(arrayValue[2].type).toEqual('Literal');
97
- expect(arrayValue[2].dataType).toEqual('number');
98
- expect(arrayValue[2].value).toEqual(3);
99
- });
100
- });
101
-
102
- describe('Date literals', () => {
103
- test('Should fail with a date without time', () => {
104
- const program = '"31/12/2022"';
105
- const parser = FormulaLang.parser;
106
- const { topNode } = parser.parse(program);
107
- const ast = calculateAST(program, topNode);
108
- expect(ast?.body).not.toBeUndefined();
109
-
110
- const body = ast?.body as LiteralAST;
111
- expect(body.value).toEqual('31/12/2022');
112
- expect(body.dataType).toBe('string');
113
- });
114
-
115
- test('Should return a date without time', () => {
116
- const program = '"12/31/2022"';
117
- const parser = FormulaLang.parser;
118
- const { topNode } = parser.parse(program);
119
- const ast = calculateAST(program, topNode);
120
- expect(ast?.body).not.toBeUndefined();
121
-
122
- const body = ast?.body as LiteralAST;
123
- expect(body.value).toEqual('2022-12-31T00:00:00.000Z');
124
- expect(body.dataType).toBe('date');
125
- });
126
-
127
- test('Should return a date with time', () => {
128
- const program = '"12/31/2022 15:22:18"';
129
- const parser = FormulaLang.parser;
130
- const { topNode } = parser.parse(program);
131
- const ast = calculateAST(program, topNode);
132
- expect(ast?.body).not.toBeUndefined();
133
-
134
- const body = ast?.body as LiteralAST;
135
- expect(body.value).toEqual('2022-12-31T15:22:18.000Z');
136
- expect(body.dataType).toBe('date');
137
- });
138
-
139
- test('Should return a date with invalid time', () => {
140
- const program = '"12/31/2022 15:89:18"';
141
- const parser = FormulaLang.parser;
142
- const { topNode } = parser.parse(program);
143
- const ast = calculateAST(program, topNode);
144
- expect(ast?.body).not.toBeUndefined();
145
-
146
- const body = ast?.body as LiteralAST;
147
- expect(body.value).toEqual('12/31/2022 15:89:18');
148
- expect(body.dataType).toBe('string');
149
- });
150
-
151
- test('Should return string with invalid dates february with 31', () => {
152
- const program = '"02/31/2022 15:23:18"';
153
- const parser = FormulaLang.parser;
154
- const { topNode } = parser.parse(program);
155
- const ast = calculateAST(program, topNode);
156
- expect(ast?.body).not.toBeUndefined();
157
-
158
- const body = ast?.body as LiteralAST;
159
- expect(body.value).toEqual('02/31/2022 15:23:18');
160
- expect(body.dataType).toBe('string');
161
- });
162
-
163
- test('Should return date valid for leap years february with 29', () => {
164
- const program = '"02/29/2024"';
165
- const parser = FormulaLang.parser;
166
- const { topNode } = parser.parse(program);
167
- const ast = calculateAST(program, topNode);
168
- expect(ast?.body).not.toBeUndefined();
169
-
170
- const body = ast?.body as LiteralAST;
171
- expect(body.value).toEqual('2024-02-29T00:00:00.000Z');
172
- expect(body.dataType).toBe('date');
173
- });
174
- });
175
-
176
- describe('Parser with context', () => {
177
- const context: FormulaContext = {
178
- model: [
179
- {
180
- id: 'column.test',
181
- label: 'Column Test',
182
- column: 'Origin_Column_Test',
183
- type: 'string',
184
- },
185
- {
186
- id: 'NOW',
187
- label: 'NOW',
188
- type: 'string',
189
- },
190
- ],
191
- };
192
- test('Should return a column without context', () => {
193
- const program = '[columnNoContext]';
194
- const parser = FormulaLang.parser;
195
- const { topNode } = parser.parse(program);
196
- const ast = calculateAST(program, topNode, context);
197
- expect(ast?.body).not.toBeUndefined();
198
-
199
- const body = ast?.body as VariableAST;
200
- expect(body.value).toEqual('columnNoContext');
201
- expect(body.type).toEqual('Variable');
202
- expect(body.context).toBeUndefined();
203
- });
204
-
205
- test('Should return a column with context', () => {
206
- const program = '[column.test]';
207
- const parser = FormulaLang.parser;
208
- const { topNode } = parser.parse(program);
209
- const ast = calculateAST(program, topNode, context);
210
- expect(ast?.body).not.toBeUndefined();
211
-
212
- const body = ast?.body as VariableAST;
213
- expect(body.value).toEqual('column.test');
214
- expect(body.type).toEqual('Column');
215
- expect(body.context?.id).toEqual('column.test');
216
- expect(body.context?.type).toEqual('string');
217
- expect(body.context?.label).toEqual('Column Test');
218
- expect(body.context?.column).toEqual('Origin_Column_Test');
219
- });
220
-
221
- test('Should return a token with context', () => {
222
- const program = '[NOW]';
223
- const parser = FormulaLang.parser;
224
- const { topNode } = parser.parse(program);
225
- const ast = calculateAST(program, topNode, context);
226
- expect(ast?.body).not.toBeUndefined();
227
-
228
- const body = ast?.body as VariableAST;
229
- expect(body.value).toEqual('{{NOW}}');
230
- expect(body.type).toEqual('Token');
231
- expect(body.context?.id).toEqual('NOW');
232
- expect(body.context?.type).toEqual('string');
233
- expect(body.context?.label).toEqual('NOW');
234
- });
235
- });
236
- });
@@ -1,128 +0,0 @@
1
- import { ENGINES } from '../../src/constants';
2
- import { ProgramAST } from '../../src/constants/interfaces';
3
- import { Transpiler } from '../../src/transpiler';
4
-
5
- describe('Transpiler tests suit', () => {
6
- test('Should resolve basic arithmetic operation', () => {
7
- const AST: ProgramAST = {
8
- type: 'Program',
9
- exp: '1 + 1',
10
- lang: 'QrveyLang',
11
- version: '0.0.0',
12
- body: {
13
- operator: '+',
14
- type: 'BinaryExpression',
15
- left: {
16
- type: 'Literal',
17
- dataType: 'number',
18
- value: 1,
19
- },
20
- right: {
21
- type: 'Literal',
22
- dataType: 'number',
23
- value: 2,
24
- },
25
- },
26
- } as ProgramAST;
27
-
28
- const transpiler = new Transpiler(AST, ENGINES.ELASTICSEARCH);
29
- const result = transpiler.get();
30
- expect(result.expression).toBe('(1 + 2)');
31
- });
32
-
33
- test('Should resolve basic logic operation', () => {
34
- const AST: ProgramAST = {
35
- type: 'Program',
36
- exp: '1 <= 1',
37
- lang: 'QrveyLang',
38
- version: '0.0.0',
39
- body: {
40
- operator: '<=',
41
- type: 'BinaryExpression',
42
- left: {
43
- type: 'Literal',
44
- dataType: 'number',
45
- value: 1,
46
- },
47
- right: {
48
- type: 'Literal',
49
- dataType: 'number',
50
- value: 2,
51
- },
52
- },
53
- } as ProgramAST;
54
-
55
- const transpiler = new Transpiler(AST, ENGINES.ELASTICSEARCH);
56
- const result = transpiler.get();
57
- expect(result.expression).toBe('(1 <= 2)');
58
- });
59
-
60
- test('Should resolve MID function', () => {
61
- const AST: ProgramAST = {
62
- type: 'Program',
63
- exp: 'MID("string", 2, 3)',
64
- lang: 'QrveyLang',
65
- version: '0.0.0',
66
- body: {
67
- type: 'FunctionCall',
68
- name: 'MID',
69
- arguments: [
70
- {
71
- type: 'Literal',
72
- dataType: 'string',
73
- value: 'string',
74
- },
75
- {
76
- type: 'Literal',
77
- dataType: 'number',
78
- value: 2,
79
- },
80
- {
81
- type: 'Literal',
82
- dataType: 'number',
83
- value: 3,
84
- },
85
- ],
86
- },
87
- } as ProgramAST;
88
-
89
- const transpiler = new Transpiler(AST, ENGINES.ELASTICSEARCH);
90
- const result = transpiler.get();
91
- expect(result.expression).toBe(`'string'.substring(2, 3)`);
92
- });
93
-
94
- test('Should throw a exception because is a invalid expression (function does not exists)', () => {
95
- const AST: ProgramAST = {
96
- type: 'Program',
97
- exp: 'MID1("string", 2, 3)',
98
- lang: 'QrveyLang',
99
- version: '0.0.0',
100
- body: {
101
- type: 'FunctionCall',
102
- name: 'MID1',
103
- arguments: [
104
- {
105
- type: 'Literal',
106
- dataType: 'string',
107
- value: 'string',
108
- },
109
- {
110
- type: 'Literal',
111
- dataType: 'number',
112
- value: 2,
113
- },
114
- {
115
- type: 'Literal',
116
- dataType: 'number',
117
- value: 3,
118
- },
119
- ],
120
- },
121
- } as ProgramAST;
122
-
123
- const transpiler = new Transpiler(AST, ENGINES.ELASTICSEARCH);
124
- const result = transpiler.get();
125
- expect(result.valid).toBe(false);
126
- expect(result.error).not.toBeUndefined();
127
- });
128
- });
@@ -1,63 +0,0 @@
1
- image: node:16
2
-
3
- clone:
4
- depth: full # SonarCloud scanner needs the full history to assign issues properly
5
-
6
- unitTesting: &unitTesting
7
- name: Unit tests
8
- caches:
9
- - node
10
- - npm
11
- script:
12
- - npm run test:coverage
13
- artifacts:
14
- # store coverage report
15
- - coverage/**
16
-
17
- sonar: &sonar
18
- name: SonarQube analysis
19
- image: maven:3.3.9
20
- caches:
21
- - sonar
22
- script:
23
- - pipe: sonarsource/sonarqube-scan:1.2.0
24
- variables:
25
- SONAR_HOST_URL: ${SONAR_HOST_URL} # Get the value from the repository/workspace variable.
26
- SONAR_TOKEN: ${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here.
27
-
28
- pipelines:
29
- branches:
30
- develop:
31
- - step:
32
- name: 'Install, lint, and build'
33
- caches:
34
- - node
35
- - npm
36
- script:
37
- - npm ci --unsafe-perm
38
- - npm run lint
39
- - npm run build
40
- - step:
41
- <<: *unitTesting
42
- - step:
43
- <<: *sonar
44
- default:
45
- - step:
46
- name: 'Install, lint, and build'
47
- caches:
48
- - node
49
- - npm
50
- script:
51
- - npm ci --unsafe-perm
52
- - npm run lint
53
- - npm run build
54
- - step:
55
- <<: *unitTesting
56
-
57
- definitions:
58
- caches:
59
- npm: $HOME/.npm
60
- sonar: ~/.sonar
61
- services:
62
- docker:
63
- memory: 2048
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,OAIX;AAJD,WAAY,OAAO;IACf,0CAA+B,CAAA;IAC/B,kCAAuB,CAAA;IACvB,gCAAqB,CAAA;AACzB,CAAC,EAJW,OAAO,KAAP,OAAO,QAIlB;AAED,MAAM,CAAN,IAAY,SASX;AATD,WAAY,SAAS;IACjB,gCAAmB,CAAA;IACnB,kDAAqC,CAAA;IACrC,gDAAmC,CAAA;IACnC,0CAA6B,CAAA;IAC7B,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,4BAAe,CAAA;IACf,gCAAmB,CAAA;AACvB,CAAC,EATW,SAAS,KAAT,SAAS,QASpB;AAED,MAAM,CAAN,IAAY,UAaX;AAbD,WAAY,UAAU;IAClB,qCAAuB,CAAA;IACvB,6BAAe,CAAA;IACf,6CAA+B,CAAA;IAC/B,6CAA+B,CAAA;IAC/B,6CAA+B,CAAA;IAC/B,yCAA2B,CAAA;IAC3B,iDAAmC,CAAA;IACnC,uCAAyB,CAAA;IACzB,iDAAmC,CAAA;IACnC,iCAAmB,CAAA;IACnB,yDAA2C,CAAA;IAC3C,mDAAqC,CAAA;AACzC,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB;AA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B;KAC9B;CACJ,CAAC;AAMF,MAAM,CAAC,MAAM,eAAe,GAA0B;IAClD,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACrB,GAAG,EAAE,IAAI;KACZ;CACJ,CAAC"}
@@ -1,42 +0,0 @@
1
- import { ERROR_DICTIONARY, ERROR_LIST } from '../constants';
2
- export class BaseError extends Error {
3
- constructor(code, message, node) {
4
- super(message);
5
- this.code = code;
6
- this.node = node;
7
- }
8
- toString() {
9
- var _a;
10
- return `${this.code}: ${this.message} ${(_a = this.node) === null || _a === void 0 ? void 0 : _a.name}`;
11
- }
12
- }
13
- export class GenericError extends BaseError {
14
- constructor(message = ERROR_DICTIONARY[ERROR_LIST.unknown].message) {
15
- super(ERROR_DICTIONARY[ERROR_LIST.unknown].code, message);
16
- }
17
- }
18
- export class UnknownFunctionError extends BaseError {
19
- constructor(node) {
20
- super(ERROR_DICTIONARY[ERROR_LIST.unknownFunction].code, ERROR_DICTIONARY[ERROR_LIST.unknownFunction].message, node);
21
- this.node = node;
22
- }
23
- }
24
- export class MissingArgumentError extends BaseError {
25
- constructor(node) {
26
- super(ERROR_DICTIONARY[ERROR_LIST.missingArg].code, ERROR_DICTIONARY[ERROR_LIST.missingArg].message, node);
27
- this.node = node;
28
- }
29
- }
30
- export class TooManyArgumentsError extends BaseError {
31
- constructor(node) {
32
- super(ERROR_DICTIONARY[ERROR_LIST.tooManyArguments].code, ERROR_DICTIONARY[ERROR_LIST.tooManyArguments].message, node);
33
- this.node = node;
34
- }
35
- }
36
- export class InvalidArgumentError extends BaseError {
37
- constructor(node, validatorResponse) {
38
- super((validatorResponse === null || validatorResponse === void 0 ? void 0 : validatorResponse.code) || '', (validatorResponse === null || validatorResponse === void 0 ? void 0 : validatorResponse.message) || '', node);
39
- this.node = node;
40
- }
41
- }
42
- //# sourceMappingURL=definitions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/errors/definitions.ts"],"names":[],"mappings":"AA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@@ -1 +0,0 @@
1
- {"version":3,"file":"engineErrors.js","sourceRoot":"","sources":["../../src/errors/engineErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5D,MAAM,UAAU,YAAY,CACxB,QAAuB,EACvB,MAAqB;IAErB,MAAM,UAAU,GAAG,CAAC,GAAQ,EAAE,GAAW,EAAE,EAAE;QACzC,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;YACnB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAC9C,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACjB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;aACzB;SACJ;IACL,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC;IACV,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACzB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,KAAK;QAAE,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC;IACvC,uBAAS,KAAK,EAAE,KAAK,IAAK,gBAAgB,CAAC,KAAK,CAAC,EAAG;AACxD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,kCAAkC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,8BAA8B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"snowflake.js","sourceRoot":"","sources":["../../src/errors/snowflake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,YAAY,GAAG;IACjB,gBAAgB,EAAE;QACd,KAAK,EAAE,mCAAmC;QAC1C,KAAK,EAAE,UAAU,CAAC,SAAS;KAC9B;IACD,aAAa,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,KAAK,EAAE,UAAU,CAAC,aAAa;KAClC;IACD,eAAe,EAAE;QACb,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,UAAU,CAAC,eAAe;KACpC;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAY,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"abs.js","sourceRoot":"","sources":["../../src/functions/abs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAuB;IACnC,UAAU,EAAE,KAAK;IACjB,IAAI,EAAE,KAAK;IACX,UAAU,EAAE;QACR;YACI,UAAU,EAAE,OAAO;YACnB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,CAAC,aAAa,CAAC;SAC7B;KACJ;IACD,UAAU,EAAE;QACR,aAAa;QACb,SAAS;QACT,QAAQ;KACX;CACJ,CAAC;AAEF,SAAS,aAAa,CAAC,KAAa;IAChC,OAAO,YAAY,KAAK,GAAG,CAAC;AAChC,CAAC;AAED,SAAS,GAAG,CAAC,KAAa;IACtB,OAAO,OAAO,KAAK,GAAG,CAAC;AAC3B,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC3B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"datedif.js","sourceRoot":"","sources":["../../src/functions/datedif.ts"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,CAAC;AAED,SAAS,GAAG,CAAC,KAAa;IACtB,OAAO,oBAAoB,KAAK,GAAG,CAAC;AACxC,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC3B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"hour.js","sourceRoot":"","sources":["../../src/functions/hour.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAuB;IACpC,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE;QACR;YACI,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,CAAC,WAAW,CAAC;SAC3B;KACJ;IACD,UAAU,EAAE;QACR,aAAa;QACb,SAAS;QACT,QAAQ;KACX;CACJ,CAAC;AAEF,SAAS,aAAa,CAAC,KAAa;IAChC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,GAAG,CAAC,KAAa;IACtB,OAAO,qBAAqB,KAAK,GAAG,CAAC;AACzC,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC3B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"if.js","sourceRoot":"","sources":["../../src/functions/if.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,EA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