@routier/core 0.1.0-rc.2 → 0.2.0

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 (38) hide show
  1. package/dist/assertions/index.js +4 -15
  2. package/dist/assertions/index.js.map +1 -1
  3. package/dist/capabilities/index.js +58 -97
  4. package/dist/capabilities/index.js.map +1 -1
  5. package/dist/codegen/index.js +21 -36
  6. package/dist/codegen/index.js.map +1 -1
  7. package/dist/collections/index.js +49 -92
  8. package/dist/collections/index.js.map +1 -1
  9. package/dist/errors/index.js +4 -15
  10. package/dist/errors/index.js.map +1 -1
  11. package/dist/expressions/index.js +62 -93
  12. package/dist/expressions/index.js.map +1 -1
  13. package/dist/index.js +1683 -2302
  14. package/dist/index.js.map +1 -1
  15. package/dist/performance/index.js +4 -15
  16. package/dist/performance/index.js.map +1 -1
  17. package/dist/pipeline/index.js +30 -53
  18. package/dist/pipeline/index.js.map +1 -1
  19. package/dist/plugins/index.js +260 -361
  20. package/dist/plugins/index.js.map +1 -1
  21. package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +6 -5
  22. package/dist/plugins/replication/ReplicationDbPlugin.d.ts +5 -5
  23. package/dist/plugins/replication/types.d.ts +1 -0
  24. package/dist/plugins/types.d.ts +1 -1
  25. package/dist/results/index.js +11 -26
  26. package/dist/results/index.js.map +1 -1
  27. package/dist/schema/SchemaDefinition.d.ts +7 -6
  28. package/dist/schema/index.js +1073 -1490
  29. package/dist/schema/index.js.map +1 -1
  30. package/dist/schema/testSchemas.test.d.ts +14 -14
  31. package/dist/schema/types.d.ts +5 -3
  32. package/dist/types/index.js +0 -6
  33. package/dist/types/index.js.map +1 -1
  34. package/dist/utilities/index.js +61 -124
  35. package/dist/utilities/index.js.map +1 -1
  36. package/dist/utilities/types.d.ts +17 -2
  37. package/package.json +1 -1
  38. package/readme.md +1 -1
@@ -1,9 +1,5 @@
1
1
  var __webpack_modules__ = ({
2
- "./src/assertions/index.ts":
3
- /*!*********************************!*\
4
- !*** ./src/assertions/index.ts ***!
5
- \*********************************/
6
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2
+ "./src/assertions/index.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
7
3
  __webpack_require__.r(__webpack_exports__);
8
4
  __webpack_require__.d(__webpack_exports__, {
9
5
  assertDate: () => (assertDate),
@@ -12,10 +8,10 @@ __webpack_require__.d(__webpack_exports__, {
12
8
  assertIsNotNull: () => (assertIsNotNull),
13
9
  assertString: () => (assertString)
14
10
  });
15
- /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities */ "./src/utilities/dates.ts");
11
+ /* import */ var _utilities__rspack_import_0 = __webpack_require__("./src/utilities/dates.ts");
16
12
 
17
13
  function assertDate(data) {
18
- if ((0,_utilities__WEBPACK_IMPORTED_MODULE_0__.isDate)(data) === false) {
14
+ if ((0,_utilities__rspack_import_0.isDate)(data) === false) {
19
15
  throw new TypeError('Value is not a Date');
20
16
  }
21
17
  }
@@ -51,20 +47,16 @@ function assertInstanceOf(value, Instance) {
51
47
  }
52
48
 
53
49
 
54
- }),
55
- "./src/expressions/parser.ts":
56
- /*!***********************************!*\
57
- !*** ./src/expressions/parser.ts ***!
58
- \***********************************/
59
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
50
+ },
51
+ "./src/expressions/parser.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
60
52
  __webpack_require__.r(__webpack_exports__);
61
53
  __webpack_require__.d(__webpack_exports__, {
62
54
  combineExpressions: () => (combineExpressions),
63
55
  toExpression: () => (toExpression)
64
56
  });
65
- /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utilities */ "./src/utilities/logger.ts");
66
- /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
67
- /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/expressions/types.ts");
57
+ /* import */ var _utilities__rspack_import_2 = __webpack_require__("./src/utilities/logger.ts");
58
+ /* import */ var _assertions__rspack_import_1 = __webpack_require__("./src/assertions/index.ts");
59
+ /* import */ var _types__rspack_import_0 = __webpack_require__("./src/expressions/types.ts");
68
60
 
69
61
 
70
62
 
@@ -80,67 +72,67 @@ const MULTI_LINE_COMMENT_REGEX = /\/\*[\s\S]*?\*\//g;
80
72
  const WHITESPACE_REGEX = /\s+/g;
81
73
  // need to have negated + strict
82
74
  const comparators = {
83
- startsWith: new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
75
+ startsWith: new _types__rspack_import_0.ComparatorExpression({
84
76
  comparator: "starts-with",
85
77
  negated: false,
86
78
  strict: false
87
79
  }),
88
- endsWith: new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
80
+ endsWith: new _types__rspack_import_0.ComparatorExpression({
89
81
  comparator: "ends-with",
90
82
  negated: false,
91
83
  strict: false
92
84
  }),
93
- includes: new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
85
+ includes: new _types__rspack_import_0.ComparatorExpression({
94
86
  comparator: "includes",
95
87
  negated: false,
96
88
  strict: false
97
89
  }),
98
- "==": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
90
+ "==": new _types__rspack_import_0.ComparatorExpression({
99
91
  comparator: "equals",
100
92
  negated: false,
101
93
  strict: false
102
94
  }),
103
- "===": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
95
+ "===": new _types__rspack_import_0.ComparatorExpression({
104
96
  comparator: "equals",
105
97
  negated: false,
106
98
  strict: true
107
99
  }),
108
- "!=": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
100
+ "!=": new _types__rspack_import_0.ComparatorExpression({
109
101
  comparator: "equals",
110
102
  negated: true,
111
103
  strict: false
112
104
  }),
113
- "!==": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
105
+ "!==": new _types__rspack_import_0.ComparatorExpression({
114
106
  comparator: "equals",
115
107
  negated: true,
116
108
  strict: true
117
109
  }),
118
- ">=": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
110
+ ">=": new _types__rspack_import_0.ComparatorExpression({
119
111
  comparator: "greater-than-equals",
120
112
  negated: false,
121
113
  strict: false
122
114
  }),
123
- ">==": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
115
+ ">==": new _types__rspack_import_0.ComparatorExpression({
124
116
  comparator: "greater-than-equals",
125
117
  negated: false,
126
118
  strict: true
127
119
  }),
128
- "<=": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
120
+ "<=": new _types__rspack_import_0.ComparatorExpression({
129
121
  comparator: "less-than-equals",
130
122
  negated: false,
131
123
  strict: false
132
124
  }),
133
- "<==": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
125
+ "<==": new _types__rspack_import_0.ComparatorExpression({
134
126
  comparator: "less-than-equals",
135
127
  negated: false,
136
128
  strict: true
137
129
  }),
138
- ">": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
130
+ ">": new _types__rspack_import_0.ComparatorExpression({
139
131
  comparator: "greater-than",
140
132
  negated: false,
141
133
  strict: false
142
134
  }),
143
- "<": new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
135
+ "<": new _types__rspack_import_0.ComparatorExpression({
144
136
  comparator: "less-than",
145
137
  negated: false,
146
138
  strict: false
@@ -156,7 +148,7 @@ const ERROR_MESSAGES = {
156
148
  };
157
149
  const STRINGIFIED_COMPARE_OPERATORS = ["true", "false"];
158
150
  const parseUnknown = (value) => {
159
- (0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertString)(value);
151
+ (0,_assertions__rspack_import_1.assertString)(value);
160
152
  return JSON.parse(value);
161
153
  };
162
154
  const combineExpressions = (...expressions) => {
@@ -170,7 +162,7 @@ const combineExpressions = (...expressions) => {
170
162
  let result = expressions[0];
171
163
  // Loop through remaining expressions and combine them
172
164
  for (let i = 1; i < expressions.length; i++) {
173
- result = new _types__WEBPACK_IMPORTED_MODULE_0__.OperatorExpression({
165
+ result = new _types__rspack_import_0.OperatorExpression({
174
166
  operator: "&&",
175
167
  left: result,
176
168
  right: expressions[i]
@@ -215,13 +207,13 @@ const toExpression = (schema, fn, params) => {
215
207
  return parseExpressionToTree(schema, expression, parameterData);
216
208
  }
217
209
  catch (error) {
218
- _utilities__WEBPACK_IMPORTED_MODULE_2__.logger.warn("Error parsing expression", {
210
+ _utilities__rspack_import_2.logger.warn("Error parsing expression", {
219
211
  error,
220
212
  collectionName: schema.collectionName,
221
213
  params,
222
214
  selector: stringifiedFunction
223
215
  });
224
- return _types__WEBPACK_IMPORTED_MODULE_0__.Expression.NOT_PARSABLE;
216
+ return _types__rspack_import_0.Expression.NOT_PARSABLE;
225
217
  }
226
218
  };
227
219
  const parseExpressionToTree = (schema, expression, params) => {
@@ -280,7 +272,7 @@ const parseExpressionToTree = (schema, expression, params) => {
280
272
  if (operator) {
281
273
  const left = exp.slice(0, splitIndex).trim();
282
274
  const right = exp.slice(splitIndex + 2).trim();
283
- return new _types__WEBPACK_IMPORTED_MODULE_0__.OperatorExpression({
275
+ return new _types__rspack_import_0.OperatorExpression({
284
276
  operator,
285
277
  left: parse(left),
286
278
  right: parse(right)
@@ -394,7 +386,7 @@ const parseCondition = (schema, expression, params) => {
394
386
  }
395
387
  else {
396
388
  // For other methods, return NOT_PARSABLE for now
397
- return _types__WEBPACK_IMPORTED_MODULE_0__.Expression.NOT_PARSABLE;
389
+ return _types__rspack_import_0.Expression.NOT_PARSABLE;
398
390
  }
399
391
  }
400
392
  else {
@@ -471,7 +463,7 @@ const parseCondition = (schema, expression, params) => {
471
463
  const valueTransformMatch = transformMethodMatch[4].match(/^([^)]+)\.(toLowerCase|toUpperCase|toLocaleLowerCase|toLocaleUpperCase)\(\)$/);
472
464
  if (valueTransformMatch) {
473
465
  // Create a new ValueExpression with the base value and transformer
474
- value = new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({
466
+ value = new _types__rspack_import_0.ValueExpression({
475
467
  value: valueTransformMatch[1].replace(/^["']|["']$/g, '') // Remove quotes
476
468
  });
477
469
  // Set transformer and locale based on the method
@@ -600,7 +592,7 @@ const getComparator = (value) => {
600
592
  throw new Error(ERROR_MESSAGES.COMPARATOR_NOT_FOUND(value));
601
593
  }
602
594
  // Return a new instance to avoid modifying the cached one
603
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ComparatorExpression({
595
+ return new _types__rspack_import_0.ComparatorExpression({
604
596
  comparator: comparator.comparator,
605
597
  negated: comparator.negated,
606
598
  strict: comparator.strict
@@ -609,27 +601,27 @@ const getComparator = (value) => {
609
601
  const getValue = (value, params) => {
610
602
  // Early return for string literals
611
603
  if (value.startsWith("\'") || value.startsWith("\"")) {
612
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({
604
+ return new _types__rspack_import_0.ValueExpression({
613
605
  value: value.replace(/\"|\'/g, "")
614
606
  });
615
607
  }
616
608
  // Early return for null/undefined
617
609
  if (value === "null") {
618
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({ value: null });
610
+ return new _types__rspack_import_0.ValueExpression({ value: null });
619
611
  }
620
612
  if (value === "undefined" || value === "void 0") {
621
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({ value: undefined });
613
+ return new _types__rspack_import_0.ValueExpression({ value: undefined });
622
614
  }
623
615
  // Optimized number parsing with early return
624
616
  const numValue = +value;
625
617
  if (!isNaN(numValue) && isFinite(numValue)) {
626
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({ value: numValue });
618
+ return new _types__rspack_import_0.ValueExpression({ value: numValue });
627
619
  }
628
620
  // Handle parameter paths if params are provided
629
621
  if (params != null) {
630
622
  // Check if this is a parameter path (starts with params.name)
631
623
  if (value.startsWith(params.name)) {
632
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({
624
+ return new _types__rspack_import_0.ValueExpression({
633
625
  value: getValueFromParams(value, params)
634
626
  });
635
627
  }
@@ -641,7 +633,7 @@ const getValue = (value, params) => {
641
633
  const potentialParamPath = paramMatch[1];
642
634
  try {
643
635
  const paramValue = getValueFromParams(`${params.name}.${potentialParamPath}`, params);
644
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({ value: paramValue });
636
+ return new _types__rspack_import_0.ValueExpression({ value: paramValue });
645
637
  }
646
638
  catch (e) {
647
639
  // Not a parameter path, continue with normal parsing
@@ -650,7 +642,7 @@ const getValue = (value, params) => {
650
642
  }
651
643
  }
652
644
  if (STRINGIFIED_COMPARE_OPERATORS.includes(value)) {
653
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({ value });
645
+ return new _types__rspack_import_0.ValueExpression({ value });
654
646
  }
655
647
  if (isNaN(numValue)) {
656
648
  // value is a variable passed in by the dev, we cannot evaluate it's value
@@ -661,7 +653,7 @@ Example: .where(([x, params]) => x.id === params.id, { id: someVar.id })
661
653
  Issue At: ${value}`);
662
654
  }
663
655
  // Default case: return as-is
664
- return new _types__WEBPACK_IMPORTED_MODULE_0__.ValueExpression({ value });
656
+ return new _types__rspack_import_0.ValueExpression({ value });
665
657
  };
666
658
  const getValueFromParams = (value, params) => {
667
659
  const split = value.split('.');
@@ -764,16 +756,12 @@ const getProperty = (schema, value, params) => {
764
756
  if (found == null) {
765
757
  throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
766
758
  }
767
- return new _types__WEBPACK_IMPORTED_MODULE_0__.PropertyExpression({ property: found });
759
+ return new _types__rspack_import_0.PropertyExpression({ property: found });
768
760
  };
769
761
 
770
762
 
771
- }),
772
- "./src/expressions/types.ts":
773
- /*!**********************************!*\
774
- !*** ./src/expressions/types.ts ***!
775
- \**********************************/
776
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
763
+ },
764
+ "./src/expressions/types.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
777
765
  __webpack_require__.r(__webpack_exports__);
778
766
  __webpack_require__.d(__webpack_exports__, {
779
767
  ComparatorExpression: () => (ComparatorExpression),
@@ -879,12 +867,8 @@ class ValueExpression extends Expression {
879
867
  }
880
868
 
881
869
 
882
- }),
883
- "./src/expressions/utils.ts":
884
- /*!**********************************!*\
885
- !*** ./src/expressions/utils.ts ***!
886
- \**********************************/
887
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
870
+ },
871
+ "./src/expressions/utils.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
888
872
  __webpack_require__.r(__webpack_exports__);
889
873
  __webpack_require__.d(__webpack_exports__, {
890
874
  forEach: () => (forEach),
@@ -941,12 +925,8 @@ function forEach(expression, callback) {
941
925
  }
942
926
 
943
927
 
944
- }),
945
- "./src/utilities/dates.ts":
946
- /*!********************************!*\
947
- !*** ./src/utilities/dates.ts ***!
948
- \********************************/
949
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
928
+ },
929
+ "./src/utilities/dates.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
950
930
  __webpack_require__.r(__webpack_exports__);
951
931
  __webpack_require__.d(__webpack_exports__, {
952
932
  isDate: () => (isDate)
@@ -962,12 +942,8 @@ const isDate = (data) => {
962
942
  };
963
943
 
964
944
 
965
- }),
966
- "./src/utilities/logger.ts":
967
- /*!*********************************!*\
968
- !*** ./src/utilities/logger.ts ***!
969
- \*********************************/
970
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
945
+ },
946
+ "./src/utilities/logger.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
971
947
  __webpack_require__.r(__webpack_exports__);
972
948
  __webpack_require__.d(__webpack_exports__, {
973
949
  logger: () => (logger)
@@ -1007,10 +983,9 @@ const logger = {
1007
983
  };
1008
984
 
1009
985
 
1010
- }),
986
+ },
1011
987
 
1012
988
  });
1013
- /************************************************************************/
1014
989
  // The module cache
1015
990
  var __webpack_module_cache__ = {};
1016
991
 
@@ -1034,7 +1009,6 @@ return module.exports;
1034
1009
 
1035
1010
  }
1036
1011
 
1037
- /************************************************************************/
1038
1012
  // webpack/runtime/define_property_getters
1039
1013
  (() => {
1040
1014
  __webpack_require__.d = (exports, definition) => {
@@ -1059,32 +1033,27 @@ __webpack_require__.r = (exports) => {
1059
1033
  Object.defineProperty(exports, '__esModule', { value: true });
1060
1034
  };
1061
1035
  })();
1062
- /************************************************************************/
1063
1036
  var __webpack_exports__ = {};
1064
1037
  // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
1065
1038
  (() => {
1066
-
1067
- /*!**********************************!*\
1068
- !*** ./src/expressions/index.ts ***!
1069
- \**********************************/
1070
1039
  __webpack_require__.r(__webpack_exports__);
1071
1040
  __webpack_require__.d(__webpack_exports__, {
1072
- ComparatorExpression: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_1__.ComparatorExpression),
1073
- EmptyExpression: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_1__.EmptyExpression),
1074
- Expression: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_1__.Expression),
1075
- NotParsableExpression: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_1__.NotParsableExpression),
1076
- OperatorExpression: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_1__.OperatorExpression),
1077
- PropertyExpression: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_1__.PropertyExpression),
1078
- ValueExpression: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_1__.ValueExpression),
1079
- combineExpressions: () => (/* reexport safe */ _parser__WEBPACK_IMPORTED_MODULE_0__.combineExpressions),
1080
- forEach: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_2__.forEach),
1081
- getProperties: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_2__.getProperties),
1082
- isPropertyExpression: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_2__.isPropertyExpression),
1083
- toExpression: () => (/* reexport safe */ _parser__WEBPACK_IMPORTED_MODULE_0__.toExpression)
1041
+ ComparatorExpression: () => (/* reexport safe */ _types__rspack_import_1.ComparatorExpression),
1042
+ EmptyExpression: () => (/* reexport safe */ _types__rspack_import_1.EmptyExpression),
1043
+ Expression: () => (/* reexport safe */ _types__rspack_import_1.Expression),
1044
+ NotParsableExpression: () => (/* reexport safe */ _types__rspack_import_1.NotParsableExpression),
1045
+ OperatorExpression: () => (/* reexport safe */ _types__rspack_import_1.OperatorExpression),
1046
+ PropertyExpression: () => (/* reexport safe */ _types__rspack_import_1.PropertyExpression),
1047
+ ValueExpression: () => (/* reexport safe */ _types__rspack_import_1.ValueExpression),
1048
+ combineExpressions: () => (/* reexport safe */ _parser__rspack_import_0.combineExpressions),
1049
+ forEach: () => (/* reexport safe */ _utils__rspack_import_2.forEach),
1050
+ getProperties: () => (/* reexport safe */ _utils__rspack_import_2.getProperties),
1051
+ isPropertyExpression: () => (/* reexport safe */ _utils__rspack_import_2.isPropertyExpression),
1052
+ toExpression: () => (/* reexport safe */ _parser__rspack_import_0.toExpression)
1084
1053
  });
1085
- /* ESM import */var _parser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parser */ "./src/expressions/parser.ts");
1086
- /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./src/expressions/types.ts");
1087
- /* ESM import */var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/expressions/utils.ts");
1054
+ /* import */ var _parser__rspack_import_0 = __webpack_require__("./src/expressions/parser.ts");
1055
+ /* import */ var _types__rspack_import_1 = __webpack_require__("./src/expressions/types.ts");
1056
+ /* import */ var _utils__rspack_import_2 = __webpack_require__("./src/expressions/utils.ts");
1088
1057
 
1089
1058
 
1090
1059