flowquery 1.0.35 → 1.0.37

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 (144) hide show
  1. package/dist/flowquery.min.js +1 -1
  2. package/dist/parsing/data_structures/lookup.d.ts.map +1 -1
  3. package/dist/parsing/data_structures/lookup.js +5 -1
  4. package/dist/parsing/data_structures/lookup.js.map +1 -1
  5. package/dist/parsing/functions/coalesce.d.ts +16 -0
  6. package/dist/parsing/functions/coalesce.d.ts.map +1 -0
  7. package/dist/parsing/functions/coalesce.js +60 -0
  8. package/dist/parsing/functions/coalesce.js.map +1 -0
  9. package/dist/parsing/functions/date.d.ts +20 -0
  10. package/dist/parsing/functions/date.d.ts.map +1 -0
  11. package/dist/parsing/functions/date.js +69 -0
  12. package/dist/parsing/functions/date.js.map +1 -0
  13. package/dist/parsing/functions/datetime.d.ts +20 -0
  14. package/dist/parsing/functions/datetime.d.ts.map +1 -0
  15. package/dist/parsing/functions/datetime.js +69 -0
  16. package/dist/parsing/functions/datetime.js.map +1 -0
  17. package/dist/parsing/functions/duration.d.ts +7 -0
  18. package/dist/parsing/functions/duration.d.ts.map +1 -0
  19. package/dist/parsing/functions/duration.js +145 -0
  20. package/dist/parsing/functions/duration.js.map +1 -0
  21. package/dist/parsing/functions/element_id.d.ts +7 -0
  22. package/dist/parsing/functions/element_id.d.ts.map +1 -0
  23. package/dist/parsing/functions/element_id.js +58 -0
  24. package/dist/parsing/functions/element_id.js.map +1 -0
  25. package/dist/parsing/functions/function_factory.d.ts +20 -0
  26. package/dist/parsing/functions/function_factory.d.ts.map +1 -1
  27. package/dist/parsing/functions/function_factory.js +20 -0
  28. package/dist/parsing/functions/function_factory.js.map +1 -1
  29. package/dist/parsing/functions/head.d.ts +7 -0
  30. package/dist/parsing/functions/head.d.ts.map +1 -0
  31. package/dist/parsing/functions/head.js +53 -0
  32. package/dist/parsing/functions/head.js.map +1 -0
  33. package/dist/parsing/functions/id.d.ts +7 -0
  34. package/dist/parsing/functions/id.d.ts.map +1 -0
  35. package/dist/parsing/functions/id.js +58 -0
  36. package/dist/parsing/functions/id.js.map +1 -0
  37. package/dist/parsing/functions/last.d.ts +7 -0
  38. package/dist/parsing/functions/last.d.ts.map +1 -0
  39. package/dist/parsing/functions/last.js +53 -0
  40. package/dist/parsing/functions/last.js.map +1 -0
  41. package/dist/parsing/functions/localdatetime.d.ts +19 -0
  42. package/dist/parsing/functions/localdatetime.d.ts.map +1 -0
  43. package/dist/parsing/functions/localdatetime.js +69 -0
  44. package/dist/parsing/functions/localdatetime.js.map +1 -0
  45. package/dist/parsing/functions/localtime.d.ts +18 -0
  46. package/dist/parsing/functions/localtime.d.ts.map +1 -0
  47. package/dist/parsing/functions/localtime.js +65 -0
  48. package/dist/parsing/functions/localtime.js.map +1 -0
  49. package/dist/parsing/functions/max.d.ts +14 -0
  50. package/dist/parsing/functions/max.d.ts.map +1 -0
  51. package/dist/parsing/functions/max.js +51 -0
  52. package/dist/parsing/functions/max.js.map +1 -0
  53. package/dist/parsing/functions/min.d.ts +14 -0
  54. package/dist/parsing/functions/min.d.ts.map +1 -0
  55. package/dist/parsing/functions/min.js +51 -0
  56. package/dist/parsing/functions/min.js.map +1 -0
  57. package/dist/parsing/functions/nodes.d.ts +7 -0
  58. package/dist/parsing/functions/nodes.d.ts.map +1 -0
  59. package/dist/parsing/functions/nodes.js +63 -0
  60. package/dist/parsing/functions/nodes.js.map +1 -0
  61. package/dist/parsing/functions/properties.d.ts +7 -0
  62. package/dist/parsing/functions/properties.d.ts.map +1 -0
  63. package/dist/parsing/functions/properties.js +74 -0
  64. package/dist/parsing/functions/properties.js.map +1 -0
  65. package/dist/parsing/functions/relationships.d.ts +7 -0
  66. package/dist/parsing/functions/relationships.d.ts.map +1 -0
  67. package/dist/parsing/functions/relationships.js +61 -0
  68. package/dist/parsing/functions/relationships.js.map +1 -0
  69. package/dist/parsing/functions/tail.d.ts +7 -0
  70. package/dist/parsing/functions/tail.d.ts.map +1 -0
  71. package/dist/parsing/functions/tail.js +50 -0
  72. package/dist/parsing/functions/tail.js.map +1 -0
  73. package/dist/parsing/functions/temporal_utils.d.ts +39 -0
  74. package/dist/parsing/functions/temporal_utils.d.ts.map +1 -0
  75. package/dist/parsing/functions/temporal_utils.js +168 -0
  76. package/dist/parsing/functions/temporal_utils.js.map +1 -0
  77. package/dist/parsing/functions/time.d.ts +18 -0
  78. package/dist/parsing/functions/time.d.ts.map +1 -0
  79. package/dist/parsing/functions/time.js +65 -0
  80. package/dist/parsing/functions/time.js.map +1 -0
  81. package/dist/parsing/functions/timestamp.d.ts +15 -0
  82. package/dist/parsing/functions/timestamp.d.ts.map +1 -0
  83. package/dist/parsing/functions/timestamp.js +48 -0
  84. package/dist/parsing/functions/timestamp.js.map +1 -0
  85. package/dist/parsing/functions/to_float.d.ts +7 -0
  86. package/dist/parsing/functions/to_float.d.ts.map +1 -0
  87. package/dist/parsing/functions/to_float.js +61 -0
  88. package/dist/parsing/functions/to_float.js.map +1 -0
  89. package/dist/parsing/functions/to_integer.d.ts +7 -0
  90. package/dist/parsing/functions/to_integer.d.ts.map +1 -0
  91. package/dist/parsing/functions/to_integer.js +61 -0
  92. package/dist/parsing/functions/to_integer.js.map +1 -0
  93. package/docs/flowquery.min.js +1 -1
  94. package/flowquery-py/pyproject.toml +1 -1
  95. package/flowquery-py/src/parsing/data_structures/lookup.py +2 -0
  96. package/flowquery-py/src/parsing/functions/__init__.py +40 -2
  97. package/flowquery-py/src/parsing/functions/coalesce.py +43 -0
  98. package/flowquery-py/src/parsing/functions/date_.py +61 -0
  99. package/flowquery-py/src/parsing/functions/datetime_.py +62 -0
  100. package/flowquery-py/src/parsing/functions/duration.py +159 -0
  101. package/flowquery-py/src/parsing/functions/element_id.py +50 -0
  102. package/flowquery-py/src/parsing/functions/head.py +39 -0
  103. package/flowquery-py/src/parsing/functions/id_.py +49 -0
  104. package/flowquery-py/src/parsing/functions/last.py +39 -0
  105. package/flowquery-py/src/parsing/functions/localdatetime.py +60 -0
  106. package/flowquery-py/src/parsing/functions/localtime.py +57 -0
  107. package/flowquery-py/src/parsing/functions/max_.py +49 -0
  108. package/flowquery-py/src/parsing/functions/min_.py +49 -0
  109. package/flowquery-py/src/parsing/functions/nodes.py +48 -0
  110. package/flowquery-py/src/parsing/functions/properties.py +50 -0
  111. package/flowquery-py/src/parsing/functions/relationships.py +46 -0
  112. package/flowquery-py/src/parsing/functions/tail.py +37 -0
  113. package/flowquery-py/src/parsing/functions/temporal_utils.py +186 -0
  114. package/flowquery-py/src/parsing/functions/time_.py +57 -0
  115. package/flowquery-py/src/parsing/functions/timestamp.py +37 -0
  116. package/flowquery-py/src/parsing/functions/to_float.py +46 -0
  117. package/flowquery-py/src/parsing/functions/to_integer.py +46 -0
  118. package/flowquery-py/tests/compute/test_runner.py +834 -1
  119. package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
  120. package/package.json +1 -1
  121. package/src/parsing/data_structures/lookup.ts +8 -4
  122. package/src/parsing/functions/coalesce.ts +49 -0
  123. package/src/parsing/functions/date.ts +63 -0
  124. package/src/parsing/functions/datetime.ts +63 -0
  125. package/src/parsing/functions/duration.ts +143 -0
  126. package/src/parsing/functions/element_id.ts +51 -0
  127. package/src/parsing/functions/function_factory.ts +20 -0
  128. package/src/parsing/functions/head.ts +42 -0
  129. package/src/parsing/functions/id.ts +51 -0
  130. package/src/parsing/functions/last.ts +42 -0
  131. package/src/parsing/functions/localdatetime.ts +63 -0
  132. package/src/parsing/functions/localtime.ts +58 -0
  133. package/src/parsing/functions/max.ts +37 -0
  134. package/src/parsing/functions/min.ts +37 -0
  135. package/src/parsing/functions/nodes.ts +54 -0
  136. package/src/parsing/functions/properties.ts +56 -0
  137. package/src/parsing/functions/relationships.ts +52 -0
  138. package/src/parsing/functions/tail.ts +39 -0
  139. package/src/parsing/functions/temporal_utils.ts +180 -0
  140. package/src/parsing/functions/time.ts +58 -0
  141. package/src/parsing/functions/timestamp.ts +37 -0
  142. package/src/parsing/functions/to_float.ts +50 -0
  143. package/src/parsing/functions/to_integer.ts +50 -0
  144. package/tests/compute/runner.test.ts +726 -0
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../src/parsing/data_structures/lookup.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC;;;;;;;;;;;;GAYG;AACH,cAAM,MAAO,SAAQ,OAAO;;IAIxB,IAAW,KAAK,CAAC,KAAK,EAAE,OAAO,EAE9B;IACD,IAAW,KAAK,IAAI,OAAO,CAE1B;IACD,IAAW,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAEpC;IACD,IAAW,QAAQ,IAAI,OAAO,CAE7B;IACM,SAAS,IAAI,OAAO;IAGpB,KAAK,IAAI,GAAG;CAGtB;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../src/parsing/data_structures/lookup.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC;;;;;;;;;;;;GAYG;AACH,cAAM,MAAO,SAAQ,OAAO;;IAIxB,IAAW,KAAK,CAAC,KAAK,EAAE,OAAO,EAE9B;IACD,IAAW,KAAK,IAAI,OAAO,CAE1B;IACD,IAAW,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAEpC;IACD,IAAW,QAAQ,IAAI,OAAO,CAE7B;IACM,SAAS,IAAI,OAAO;IAGpB,KAAK,IAAI,GAAG;CAOtB;AAED,eAAe,MAAM,CAAC"}
@@ -37,7 +37,11 @@ class Lookup extends ast_node_1.default {
37
37
  return true;
38
38
  }
39
39
  value() {
40
- return this.variable.value()[this.index.value()];
40
+ const obj = this.variable.value();
41
+ if (obj === null || obj === undefined) {
42
+ return null;
43
+ }
44
+ return obj[this.index.value()];
41
45
  }
42
46
  }
43
47
  exports.default = Lookup;
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../src/parsing/data_structures/lookup.ts"],"names":[],"mappings":";;;;;AAAA,2DAAkC;AAElC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAO,SAAQ,kBAAO;IACxB;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;IACD,IAAW,KAAK,CAAC,KAAc;QAC3B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,IAAW,QAAQ,CAAC,QAAiB;QACjC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACM,SAAS;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;IACM,KAAK;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;CACJ;AAED,kBAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../src/parsing/data_structures/lookup.ts"],"names":[],"mappings":";;;;;AAAA,2DAAkC;AAElC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAO,SAAQ,kBAAO;IACxB;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;IACD,IAAW,KAAK,CAAC,KAAc;QAC3B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,IAAW,QAAQ,CAAC,QAAiB;QACjC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACM,SAAS;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;IACM,KAAK;QACR,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAClC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,CAAC;CACJ;AAED,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,16 @@
1
+ import Function from "./function";
2
+ /**
3
+ * Returns the first non-null value from a list of expressions.
4
+ *
5
+ * @example
6
+ * ```
7
+ * RETURN coalesce(null, null, 'hello', 'world') // returns 'hello'
8
+ * MATCH (n) RETURN coalesce(n.nickname, n.name) AS displayName
9
+ * ```
10
+ */
11
+ declare class Coalesce extends Function {
12
+ constructor();
13
+ value(): any;
14
+ }
15
+ export default Coalesce;
16
+ //# sourceMappingURL=coalesce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coalesce.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/coalesce.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC;;;;;;;;GAQG;AACH,cAeM,QAAS,SAAQ,QAAQ;;IAMpB,KAAK,IAAI,GAAG;CAatB;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const function_1 = __importDefault(require("./function"));
13
+ const function_metadata_1 = require("./function_metadata");
14
+ /**
15
+ * Returns the first non-null value from a list of expressions.
16
+ *
17
+ * @example
18
+ * ```
19
+ * RETURN coalesce(null, null, 'hello', 'world') // returns 'hello'
20
+ * MATCH (n) RETURN coalesce(n.nickname, n.name) AS displayName
21
+ * ```
22
+ */
23
+ let Coalesce = class Coalesce extends function_1.default {
24
+ constructor() {
25
+ super("coalesce");
26
+ this._expectedParameterCount = null; // variable number of parameters
27
+ }
28
+ value() {
29
+ const children = this.getChildren();
30
+ if (children.length === 0) {
31
+ throw new Error("coalesce() requires at least one argument");
32
+ }
33
+ for (const child of children) {
34
+ const val = child.value();
35
+ if (val !== null && val !== undefined) {
36
+ return val;
37
+ }
38
+ }
39
+ return null;
40
+ }
41
+ };
42
+ Coalesce = __decorate([
43
+ (0, function_metadata_1.FunctionDef)({
44
+ description: "Returns the first non-null value from a list of expressions",
45
+ category: "scalar",
46
+ parameters: [
47
+ { name: "expressions", description: "Two or more expressions to evaluate", type: "any" },
48
+ ],
49
+ output: {
50
+ description: "The first non-null value, or null if all values are null",
51
+ type: "any",
52
+ },
53
+ examples: [
54
+ "RETURN coalesce(null, 'hello', 'world')",
55
+ "MATCH (n) RETURN coalesce(n.nickname, n.name) AS displayName",
56
+ ],
57
+ })
58
+ ], Coalesce);
59
+ exports.default = Coalesce;
60
+ //# sourceMappingURL=coalesce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coalesce.js","sourceRoot":"","sources":["../../../src/parsing/functions/coalesce.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0DAAkC;AAClC,2DAAkD;AAElD;;;;;;;;GAQG;AAgBH,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,kBAAQ;IAC3B;QACI,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC,gCAAgC;IACzE,CAAC;IAEM,KAAK;QACR,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACjE,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;YAC1B,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACpC,OAAO,GAAG,CAAC;YACf,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAnBK,QAAQ;IAfb,IAAA,+BAAW,EAAC;QACT,WAAW,EAAE,6DAA6D;QAC1E,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE;YACR,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,qCAAqC,EAAE,IAAI,EAAE,KAAK,EAAE;SAC3F;QACD,MAAM,EAAE;YACJ,WAAW,EAAE,0DAA0D;YACvE,IAAI,EAAE,KAAK;SACd;QACD,QAAQ,EAAE;YACN,yCAAyC;YACzC,8DAA8D;SACjE;KACJ,CAAC;GACI,QAAQ,CAmBb;AAED,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import Function from "./function";
2
+ /**
3
+ * Returns a date value (no time component).
4
+ * When called with no arguments, returns the current date.
5
+ * When called with a string argument, parses it as an ISO 8601 date.
6
+ * When called with a map argument, constructs a date from components.
7
+ *
8
+ * @example
9
+ * ```
10
+ * RETURN date() AS today
11
+ * RETURN date('2025-06-15') AS d
12
+ * RETURN date({year: 2025, month: 6, day: 15}) AS d
13
+ * ```
14
+ */
15
+ declare class DateFunction extends Function {
16
+ constructor();
17
+ value(): any;
18
+ }
19
+ export default DateFunction;
20
+ //# sourceMappingURL=date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/date.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAIlC;;;;;;;;;;;;GAYG;AACH,cA0BM,YAAa,SAAQ,QAAQ;;IAMxB,KAAK,IAAI,GAAG;CAWtB;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const function_1 = __importDefault(require("./function"));
13
+ const function_metadata_1 = require("./function_metadata");
14
+ const temporal_utils_1 = require("./temporal_utils");
15
+ /**
16
+ * Returns a date value (no time component).
17
+ * When called with no arguments, returns the current date.
18
+ * When called with a string argument, parses it as an ISO 8601 date.
19
+ * When called with a map argument, constructs a date from components.
20
+ *
21
+ * @example
22
+ * ```
23
+ * RETURN date() AS today
24
+ * RETURN date('2025-06-15') AS d
25
+ * RETURN date({year: 2025, month: 6, day: 15}) AS d
26
+ * ```
27
+ */
28
+ let DateFunction = class DateFunction extends function_1.default {
29
+ constructor() {
30
+ super("date");
31
+ this._expectedParameterCount = null;
32
+ }
33
+ value() {
34
+ const children = this.getChildren();
35
+ if (children.length > 1) {
36
+ throw new Error("date() accepts at most one argument");
37
+ }
38
+ const d = children.length === 1 ? (0, temporal_utils_1.parseTemporalArg)(children[0].value(), "date") : new Date();
39
+ return (0, temporal_utils_1.buildDateObject)(d);
40
+ }
41
+ };
42
+ DateFunction = __decorate([
43
+ (0, function_metadata_1.FunctionDef)({
44
+ description: "Returns a date value. With no arguments returns the current date. " +
45
+ "Accepts an ISO 8601 date string or a map of components (year, month, day).",
46
+ category: "scalar",
47
+ parameters: [
48
+ {
49
+ name: "input",
50
+ description: "Optional. An ISO 8601 date string (YYYY-MM-DD) or a map of components.",
51
+ type: "string",
52
+ required: false,
53
+ },
54
+ ],
55
+ output: {
56
+ description: "A date object with properties: year, month, day, " +
57
+ "epochMillis, dayOfWeek, dayOfYear, quarter, formatted",
58
+ type: "object",
59
+ },
60
+ examples: [
61
+ "RETURN date() AS today",
62
+ "RETURN date('2025-06-15') AS d",
63
+ "RETURN date({year: 2025, month: 6, day: 15}) AS d",
64
+ "WITH date() AS d RETURN d.year, d.month, d.dayOfWeek",
65
+ ],
66
+ })
67
+ ], DateFunction);
68
+ exports.default = DateFunction;
69
+ //# sourceMappingURL=date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/parsing/functions/date.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0DAAkC;AAClC,2DAAkD;AAClD,qDAAqE;AAErE;;;;;;;;;;;;GAYG;AA2BH,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,kBAAQ;IAC/B;QACI,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC;IACxC,CAAC;IAEM,KAAK;QACR,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,CAAC,GACH,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAA,iCAAgB,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QAEvF,OAAO,IAAA,gCAAe,EAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;CACJ,CAAA;AAjBK,YAAY;IA1BjB,IAAA,+BAAW,EAAC;QACT,WAAW,EACP,oEAAoE;YACpE,4EAA4E;QAChF,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE;YACR;gBACI,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,wEAAwE;gBACrF,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;aAClB;SACJ;QACD,MAAM,EAAE;YACJ,WAAW,EACP,mDAAmD;gBACnD,uDAAuD;YAC3D,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,wBAAwB;YACxB,gCAAgC;YAChC,mDAAmD;YACnD,sDAAsD;SACzD;KACJ,CAAC;GACI,YAAY,CAiBjB;AAED,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,20 @@
1
+ import Function from "./function";
2
+ /**
3
+ * Returns a datetime value (date + time + timezone offset).
4
+ * When called with no arguments, returns the current UTC datetime.
5
+ * When called with a string argument, parses it as an ISO 8601 datetime.
6
+ * When called with a map argument, constructs a datetime from components.
7
+ *
8
+ * @example
9
+ * ```
10
+ * RETURN datetime() AS now
11
+ * RETURN datetime('2025-06-15T12:30:00Z') AS dt
12
+ * RETURN datetime({year: 2025, month: 6, day: 15}) AS dt
13
+ * ```
14
+ */
15
+ declare class Datetime extends Function {
16
+ constructor();
17
+ value(): any;
18
+ }
19
+ export default Datetime;
20
+ //# sourceMappingURL=datetime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAIlC;;;;;;;;;;;;GAYG;AACH,cA0BM,QAAS,SAAQ,QAAQ;;IAMpB,KAAK,IAAI,GAAG;CAWtB;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const function_1 = __importDefault(require("./function"));
13
+ const function_metadata_1 = require("./function_metadata");
14
+ const temporal_utils_1 = require("./temporal_utils");
15
+ /**
16
+ * Returns a datetime value (date + time + timezone offset).
17
+ * When called with no arguments, returns the current UTC datetime.
18
+ * When called with a string argument, parses it as an ISO 8601 datetime.
19
+ * When called with a map argument, constructs a datetime from components.
20
+ *
21
+ * @example
22
+ * ```
23
+ * RETURN datetime() AS now
24
+ * RETURN datetime('2025-06-15T12:30:00Z') AS dt
25
+ * RETURN datetime({year: 2025, month: 6, day: 15}) AS dt
26
+ * ```
27
+ */
28
+ let Datetime = class Datetime extends function_1.default {
29
+ constructor() {
30
+ super("datetime");
31
+ this._expectedParameterCount = null;
32
+ }
33
+ value() {
34
+ const children = this.getChildren();
35
+ if (children.length > 1) {
36
+ throw new Error("datetime() accepts at most one argument");
37
+ }
38
+ const d = children.length === 1 ? (0, temporal_utils_1.parseTemporalArg)(children[0].value(), "datetime") : new Date();
39
+ return (0, temporal_utils_1.buildDatetimeObject)(d, true);
40
+ }
41
+ };
42
+ Datetime = __decorate([
43
+ (0, function_metadata_1.FunctionDef)({
44
+ description: "Returns a datetime value. With no arguments returns the current UTC datetime. " +
45
+ "Accepts an ISO 8601 string or a map of components (year, month, day, hour, minute, second, millisecond).",
46
+ category: "scalar",
47
+ parameters: [
48
+ {
49
+ name: "input",
50
+ description: "Optional. An ISO 8601 datetime string or a map of components.",
51
+ type: "string",
52
+ required: false,
53
+ },
54
+ ],
55
+ output: {
56
+ description: "A datetime object with properties: year, month, day, hour, minute, second, millisecond, " +
57
+ "epochMillis, epochSeconds, dayOfWeek, dayOfYear, quarter, formatted",
58
+ type: "object",
59
+ },
60
+ examples: [
61
+ "RETURN datetime() AS now",
62
+ "RETURN datetime('2025-06-15T12:30:00Z') AS dt",
63
+ "RETURN datetime({year: 2025, month: 6, day: 15, hour: 12}) AS dt",
64
+ "WITH datetime() AS dt RETURN dt.year, dt.month, dt.day",
65
+ ],
66
+ })
67
+ ], Datetime);
68
+ exports.default = Datetime;
69
+ //# sourceMappingURL=datetime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetime.js","sourceRoot":"","sources":["../../../src/parsing/functions/datetime.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0DAAkC;AAClC,2DAAkD;AAClD,qDAAyE;AAEzE;;;;;;;;;;;;GAYG;AA2BH,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,kBAAQ;IAC3B;QACI,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC;IACxC,CAAC;IAEM,KAAK;QACR,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,CAAC,GACH,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAA,iCAAgB,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QAE3F,OAAO,IAAA,oCAAmB,EAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;CACJ,CAAA;AAjBK,QAAQ;IA1Bb,IAAA,+BAAW,EAAC;QACT,WAAW,EACP,gFAAgF;YAChF,0GAA0G;QAC9G,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE;YACR;gBACI,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,+DAA+D;gBAC5E,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;aAClB;SACJ;QACD,MAAM,EAAE;YACJ,WAAW,EACP,0FAA0F;gBAC1F,qEAAqE;YACzE,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,0BAA0B;YAC1B,+CAA+C;YAC/C,kEAAkE;YAClE,wDAAwD;SAC3D;KACJ,CAAC;GACI,QAAQ,CAiBb;AAED,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import Function from "./function";
2
+ declare class Duration extends Function {
3
+ constructor();
4
+ value(): any;
5
+ }
6
+ export default Duration;
7
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/duration.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AA0FlC,cA2BM,QAAS,SAAQ,QAAQ;;IAMpB,KAAK,IAAI,GAAG;CAiBtB;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const function_1 = __importDefault(require("./function"));
13
+ const function_metadata_1 = require("./function_metadata");
14
+ /**
15
+ * Regex for ISO 8601 duration strings: P[nY][nM][nW][nD][T[nH][nM][nS]]
16
+ */
17
+ const ISO_DURATION_REGEX = /^P(?:(\d+(?:\.\d+)?)Y)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/;
18
+ function parseDurationString(s) {
19
+ const match = s.match(ISO_DURATION_REGEX);
20
+ if (!match) {
21
+ throw new Error(`duration(): Invalid ISO 8601 duration string: '${s}'`);
22
+ }
23
+ return {
24
+ years: match[1] ? parseFloat(match[1]) : 0,
25
+ months: match[2] ? parseFloat(match[2]) : 0,
26
+ weeks: match[3] ? parseFloat(match[3]) : 0,
27
+ days: match[4] ? parseFloat(match[4]) : 0,
28
+ hours: match[5] ? parseFloat(match[5]) : 0,
29
+ minutes: match[6] ? parseFloat(match[6]) : 0,
30
+ seconds: match[7] ? parseFloat(match[7]) : 0,
31
+ };
32
+ }
33
+ function buildDurationObject(components) {
34
+ const years = components.years || 0;
35
+ const months = components.months || 0;
36
+ const weeks = components.weeks || 0;
37
+ const days = components.days || 0;
38
+ const hours = components.hours || 0;
39
+ const minutes = components.minutes || 0;
40
+ const seconds = Math.floor(components.seconds || 0);
41
+ const fractionalSeconds = (components.seconds || 0) - seconds;
42
+ const milliseconds = components.milliseconds
43
+ ? Math.floor(components.milliseconds)
44
+ : Math.round(fractionalSeconds * 1000);
45
+ const nanoseconds = components.nanoseconds
46
+ ? Math.floor(components.nanoseconds)
47
+ : Math.round(fractionalSeconds * 1000000000) % 1000000;
48
+ // Total days including weeks
49
+ const totalDays = days + weeks * 7;
50
+ // Total seconds for the time portion
51
+ const totalSeconds = hours * 3600 + minutes * 60 + seconds;
52
+ // Approximate total in various units (months approximated at 30 days)
53
+ const totalMonths = years * 12 + months;
54
+ // Build ISO 8601 formatted string
55
+ let formatted = "P";
56
+ if (years)
57
+ formatted += `${years}Y`;
58
+ if (months)
59
+ formatted += `${months}M`;
60
+ if (weeks)
61
+ formatted += `${weeks}W`;
62
+ if (totalDays - weeks * 7)
63
+ formatted += `${totalDays - weeks * 7}D`;
64
+ const hasTime = hours || minutes || seconds || milliseconds;
65
+ if (hasTime) {
66
+ formatted += "T";
67
+ if (hours)
68
+ formatted += `${hours}H`;
69
+ if (minutes)
70
+ formatted += `${minutes}M`;
71
+ if (seconds || milliseconds) {
72
+ if (milliseconds) {
73
+ formatted += `${seconds}.${String(milliseconds).padStart(3, "0")}S`;
74
+ }
75
+ else {
76
+ formatted += `${seconds}S`;
77
+ }
78
+ }
79
+ }
80
+ if (formatted === "P")
81
+ formatted = "PT0S";
82
+ return {
83
+ years,
84
+ months,
85
+ weeks,
86
+ days: totalDays,
87
+ hours,
88
+ minutes,
89
+ seconds,
90
+ milliseconds,
91
+ nanoseconds,
92
+ totalMonths,
93
+ totalDays,
94
+ totalSeconds,
95
+ formatted,
96
+ };
97
+ }
98
+ let Duration = class Duration extends function_1.default {
99
+ constructor() {
100
+ super("duration");
101
+ this._expectedParameterCount = 1;
102
+ }
103
+ value() {
104
+ const arg = this.getChildren()[0].value();
105
+ if (arg === null || arg === undefined) {
106
+ return null;
107
+ }
108
+ if (typeof arg === "string") {
109
+ const components = parseDurationString(arg);
110
+ return buildDurationObject(components);
111
+ }
112
+ if (typeof arg === "object" && !Array.isArray(arg)) {
113
+ return buildDurationObject(arg);
114
+ }
115
+ throw new Error("duration() expects a string or map argument");
116
+ }
117
+ };
118
+ Duration = __decorate([
119
+ (0, function_metadata_1.FunctionDef)({
120
+ description: "Creates a duration value representing a span of time. " +
121
+ "Accepts an ISO 8601 duration string (e.g., 'P1Y2M3DT4H5M6S') or a map of components " +
122
+ "(years, months, weeks, days, hours, minutes, seconds, milliseconds, nanoseconds).",
123
+ category: "scalar",
124
+ parameters: [
125
+ {
126
+ name: "input",
127
+ description: "An ISO 8601 duration string or a map of components (years, months, weeks, days, hours, minutes, seconds, milliseconds, nanoseconds)",
128
+ type: "any",
129
+ },
130
+ ],
131
+ output: {
132
+ description: "A duration object with properties: years, months, weeks, days, hours, minutes, seconds, " +
133
+ "milliseconds, nanoseconds, totalMonths, totalDays, totalSeconds, formatted",
134
+ type: "object",
135
+ },
136
+ examples: [
137
+ "RETURN duration('P1Y2M3D') AS d",
138
+ "RETURN duration('PT2H30M') AS d",
139
+ "RETURN duration({days: 14, hours: 16}) AS d",
140
+ "RETURN duration({months: 5, days: 1, hours: 12}) AS d",
141
+ ],
142
+ })
143
+ ], Duration);
144
+ exports.default = Duration;
145
+ //# sourceMappingURL=duration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.js","sourceRoot":"","sources":["../../../src/parsing/functions/duration.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0DAAkC;AAClC,2DAAkD;AAElD;;GAEG;AACH,MAAM,kBAAkB,GACpB,8JAA8J,CAAC;AAEnK,SAAS,mBAAmB,CAAC,CAAS;IAClC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,GAAG,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C1B,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;YAC5C,OAAO,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACnE,CAAC;CACJ,CAAA;AAvBK,QAAQ;IA3Bb,IAAA,+BAAW,EAAC;QACT,WAAW,EACP,wDAAwD;YACxD,sFAAsF;YACtF,mFAAmF;QACvF,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE;YACR;gBACI,IAAI,EAAE,OAAO;gBACb,WAAW,EACP,qIAAqI;gBACzI,IAAI,EAAE,KAAK;aACd;SACJ;QACD,MAAM,EAAE;YACJ,WAAW,EACP,0FAA0F;gBAC1F,4EAA4E;YAChF,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,iCAAiC;YACjC,iCAAiC;YACjC,6CAA6C;YAC7C,uDAAuD;SAC1D;KACJ,CAAC;GACI,QAAQ,CAuBb;AAED,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import Function from "./function";
2
+ declare class ElementId extends Function {
3
+ constructor();
4
+ value(): any;
5
+ }
6
+ export default ElementId;
7
+ //# sourceMappingURL=element_id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element_id.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/element_id.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,cAkBM,SAAU,SAAQ,QAAQ;;IAMrB,KAAK,IAAI,GAAG;CAqBtB;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const function_1 = __importDefault(require("./function"));
13
+ const function_metadata_1 = require("./function_metadata");
14
+ let ElementId = class ElementId extends function_1.default {
15
+ constructor() {
16
+ super("elementid");
17
+ this._expectedParameterCount = 1;
18
+ }
19
+ value() {
20
+ const obj = this.getChildren()[0].value();
21
+ if (obj === null || obj === undefined) {
22
+ return null;
23
+ }
24
+ if (typeof obj !== "object" || Array.isArray(obj)) {
25
+ throw new Error("elementId() expects a node or relationship");
26
+ }
27
+ // If it's a RelationshipMatchRecord (has type, startNode, endNode, properties)
28
+ if ("type" in obj && "startNode" in obj && "endNode" in obj && "properties" in obj) {
29
+ return String(obj.type);
30
+ }
31
+ // If it's a node record (has id field)
32
+ if ("id" in obj) {
33
+ return String(obj.id);
34
+ }
35
+ throw new Error("elementId() expects a node or relationship");
36
+ }
37
+ };
38
+ ElementId = __decorate([
39
+ (0, function_metadata_1.FunctionDef)({
40
+ description: "Returns the element id of a node or relationship as a string. For nodes, returns the string representation of the id property. For relationships, returns the type.",
41
+ category: "scalar",
42
+ parameters: [
43
+ {
44
+ name: "entity",
45
+ description: "A node or relationship to get the element id from",
46
+ type: "object",
47
+ },
48
+ ],
49
+ output: {
50
+ description: "The element id of the entity as a string",
51
+ type: "string",
52
+ example: '"1"',
53
+ },
54
+ examples: ["MATCH (n:Person) RETURN elementId(n)", "MATCH (a)-[r]->(b) RETURN elementId(r)"],
55
+ })
56
+ ], ElementId);
57
+ exports.default = ElementId;
58
+ //# sourceMappingURL=element_id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element_id.js","sourceRoot":"","sources":["../../../src/parsing/functions/element_id.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0DAAkC;AAClC,2DAAkD;AAoBlD,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,kBAAQ;IAC5B;QACI,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;IACrC,CAAC;IAEM,KAAK;QACR,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAC1C,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAClE,CAAC;QAED,+EAA+E;QAC/E,IAAI,MAAM,IAAI,GAAG,IAAI,WAAW,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,YAAY,IAAI,GAAG,EAAE,CAAC;YACjF,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAED,uCAAuC;QACvC,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;YACd,OAAO,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAClE,CAAC;CACJ,CAAA;AA3BK,SAAS;IAlBd,IAAA,+BAAW,EAAC;QACT,WAAW,EACP,qKAAqK;QACzK,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE;YACR;gBACI,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;gBAChE,IAAI,EAAE,QAAQ;aACjB;SACJ;QACD,MAAM,EAAE;YACJ,WAAW,EAAE,0CAA0C;YACvD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,KAAK;SACjB;QACD,QAAQ,EAAE,CAAC,sCAAsC,EAAE,wCAAwC,CAAC;KAC/F,CAAC;GACI,SAAS,CA2Bd;AAED,kBAAe,SAAS,CAAC"}
@@ -1,16 +1,31 @@
1
1
  import AsyncFunction from "./async_function";
2
2
  import "./avg";
3
+ import "./coalesce";
3
4
  import "./collect";
4
5
  import "./count";
6
+ import "./date";
7
+ import "./datetime";
8
+ import "./duration";
9
+ import "./element_id";
5
10
  import Function from "./function";
6
11
  import { AsyncDataProvider, FunctionMetadata } from "./function_metadata";
7
12
  import "./functions";
13
+ import "./head";
14
+ import "./id";
8
15
  import "./join";
9
16
  import "./keys";
17
+ import "./last";
18
+ import "./localdatetime";
19
+ import "./localtime";
20
+ import "./max";
21
+ import "./min";
22
+ import "./nodes";
10
23
  import PredicateFunction from "./predicate_function";
11
24
  import "./predicate_sum";
25
+ import "./properties";
12
26
  import "./rand";
13
27
  import "./range";
28
+ import "./relationships";
14
29
  import "./replace";
15
30
  import "./round";
16
31
  import "./schema";
@@ -19,6 +34,11 @@ import "./split";
19
34
  import "./string_distance";
20
35
  import "./stringify";
21
36
  import "./sum";
37
+ import "./tail";
38
+ import "./time";
39
+ import "./timestamp";
40
+ import "./to_float";
41
+ import "./to_integer";
22
42
  import "./to_json";
23
43
  import "./to_lower";
24
44
  import "./to_string";
@@ -1 +1 @@
1
- {"version":3,"file":"function_factory.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/function_factory.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,OAAO,CAAC;AACf,OAAO,WAAW,CAAC;AACnB,OAAO,SAAS,CAAC;AACjB,OAAO,QA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AE,MAAM,EAAE,CAAA;KAAE;IAQ/E;;;;;OAKG;WACW,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;IAY5C;;;;;;OAMG;WACW,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB;WAYhD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;CAQzD;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"function_factory.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/function_factory.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,OAAO,CAAC;AACf,OAAO,YAAY,CAAC;AACpB,OAAO,WAAW,CAAC;AACnB,OAAO,SAAS,CAAC;AACjB,OAAO,QAAQ,CAAC;AAChB,OAAO,YAAY,CAAC;AACpB,OAAO,YAAY,CAAC;AACpB,OAAO,cAAc,CAAC;AACtB,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EACH,iBAAiB,EACjB,gBAAgB,EAInB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,aAAa,CAAC;AACrB,OAAO,QAAQ,CAAC;AAChB,OAAO,MAAM,CAAC;AACd,OAAO,QAAQ,CAAC;AAChB,OAAO,QAAQ,CAAC;AAChB,OAAO,QAAQ,CAAC;AAChB,OAAO,iBAAiB,CAAC;AACzB,OAAO,aAAa,CAAC;AACrB,OAAO,OAAO,CAAC;AACf,OAAO,OAAO,CAAC;AACf,OAAO,SAAS,CAAC;AACjB,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,iBAAiB,CAAC;AACzB,OAAO,cAAc,CAAC;AACtB,OAAO,QAAQ,CAAC;AAChB,OAAO,SAAS,CAAC;AACjB,OAAO,iBAAiB,CAAC;AACzB,OAAO,WAAW,CAAC;AACnB,OAAO,SAAS,CAAC;AACjB,OAAO,UAAU,CAAC;AAClB,OAAO,QAAQ,CAAC;AAChB,OAAO,SAAS,CAAC;AACjB,OAA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