@routier/core 0.0.6 → 0.1.0-rc.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 (57) hide show
  1. package/dist/capabilities/Capability.d.ts +6 -16
  2. package/dist/capabilities/PerformanceCapability.d.ts +4 -6
  3. package/dist/capabilities/TracingCapability.d.ts +3 -6
  4. package/dist/capabilities/index.js +399 -343
  5. package/dist/capabilities/index.js.map +1 -1
  6. package/dist/capabilities/types.d.ts +10 -19
  7. package/dist/codegen/blocks.d.ts +8 -0
  8. package/dist/codegen/handlers/CompareIdsHandlerBuilder.d.ts +4 -0
  9. package/dist/codegen/handlers/compare/CompareArrayHandler.d.ts +6 -0
  10. package/dist/codegen/handlers/compare/CompareDateHandler.d.ts +6 -0
  11. package/dist/codegen/handlers/compareIds/CompareIdsKeyHandler.d.ts +6 -0
  12. package/dist/codegen/handlers/index.d.ts +1 -0
  13. package/dist/codegen/handlers/serialize/SerializeDateHandler.d.ts +2 -1
  14. package/dist/codegen/handlers/serialize/SerializeFunctionHandler.d.ts +6 -0
  15. package/dist/codegen/index.js +39 -0
  16. package/dist/codegen/index.js.map +1 -1
  17. package/dist/collections/index.js +1 -1
  18. package/dist/collections/index.js.map +1 -1
  19. package/dist/expressions/index.js +203 -29
  20. package/dist/expressions/index.js.map +1 -1
  21. package/dist/index.js +1147 -507
  22. package/dist/index.js.map +1 -1
  23. package/dist/pipeline/TrampolinePipeline.d.ts +1 -0
  24. package/dist/pipeline/index.js +71 -47
  25. package/dist/pipeline/index.js.map +1 -1
  26. package/dist/plugins/EphemeralDataPlugin.d.ts +2 -2
  27. package/dist/plugins/index.js +252 -62
  28. package/dist/plugins/index.js.map +1 -1
  29. package/dist/plugins/query/types.d.ts +5 -0
  30. package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +2 -1
  31. package/dist/plugins/replication/ReplicationDbPlugin.d.ts +2 -1
  32. package/dist/plugins/translators/DataTranslator.d.ts +3 -1
  33. package/dist/plugins/translators/JsonTranslator.d.ts +1 -0
  34. package/dist/plugins/translators/SqlTranslator.d.ts +1 -0
  35. package/dist/plugins/translators/TranslatedArrayValue.d.ts +6 -0
  36. package/dist/plugins/translators/TranslatedGroupValue.d.ts +6 -0
  37. package/dist/plugins/translators/TranslatedSingleValue.d.ts +6 -0
  38. package/dist/plugins/translators/index.d.ts +4 -0
  39. package/dist/plugins/translators/types.d.ts +10 -0
  40. package/dist/plugins/types.d.ts +2 -1
  41. package/dist/schema/PropertyInfo.d.ts +7 -2
  42. package/dist/schema/SchemaDefinition.d.ts +1 -1
  43. package/dist/schema/communication/broadcast.d.ts +3 -3
  44. package/dist/schema/index.js +504 -73
  45. package/dist/schema/index.js.map +1 -1
  46. package/dist/schema/property/modifiers/SchemaTracked.d.ts +3 -1
  47. package/dist/schema/table/SchemaComputed.d.ts +1 -1
  48. package/dist/schema/testSchemas.test.d.ts +60 -36
  49. package/dist/schema/types.d.ts +16 -1
  50. package/dist/utilities/index.d.ts +1 -0
  51. package/dist/utilities/index.js +164 -2
  52. package/dist/utilities/index.js.map +1 -1
  53. package/dist/utilities/strings.d.ts +34 -0
  54. package/dist/utilities/strings.test.d.ts +1 -0
  55. package/dist/utilities/unsafeCast.d.ts +1 -0
  56. package/package.json +1 -1
  57. package/readme.md +1 -1
package/dist/index.js CHANGED
@@ -62,214 +62,103 @@ __webpack_require__.d(__webpack_exports__, {
62
62
  Capability: () => (Capability)
63
63
  });
64
64
  class Capability {
65
+ excludedNames = new Set([
66
+ "Array",
67
+ "Set",
68
+ "Map",
69
+ "AbortController",
70
+ "AbortSignal",
71
+ "SchemaString",
72
+ "SchemaNumber",
73
+ "SchemaArray",
74
+ "SchemaBoolean",
75
+ "SchemaDate",
76
+ "SchemaObject",
77
+ "SchemaDefault",
78
+ "SchemaDeserialize",
79
+ "SchemaDistinct",
80
+ "SchemaFrom",
81
+ "SchemaIdentity",
82
+ "SchemaIndex",
83
+ "SchemaKey",
84
+ "SchemaNullable",
85
+ "SchemaOptional",
86
+ "SchemaReadonly",
87
+ "SchemaSerialize",
88
+ "SchemaTracked",
89
+ "SchemaComputed",
90
+ "SchemaFunction",
91
+ "SchemaBase",
92
+ "SchemaDefinition"
93
+ ]);
65
94
  isValidObject(obj) {
66
95
  return typeof obj === "object" && obj !== null;
67
96
  }
68
- getObjectName(obj) {
69
- return obj?.constructor?.name || 'root';
70
- }
71
- exploreObjectMethods(obj, callback, options = {}) {
72
- if (!this.isValidObject(obj)) {
73
- return;
74
- }
75
- const { maxDepth = 10, includeNonEnumerable = false, filter = () => true } = options;
76
- const rootName = this.getObjectName(obj);
77
- const visited = new Set();
78
- // Explore root methods
79
- this.exploreRootMethods(obj, callback, filter);
80
- // Explore nested methods
81
- this.exploreNestedMethods(obj, callback, filter, [rootName], visited, maxDepth, includeNonEnumerable);
82
- }
83
- exploreRootMethods(obj, callback, filter) {
84
- const methodNames = this.extractMethodNames(obj);
85
- for (const methodName of methodNames) {
86
- const methodInfo = {
87
- methodName,
88
- instance: obj,
89
- methodPath: [String(methodName)],
90
- parent: null
91
- };
92
- if (filter(methodInfo)) {
93
- callback(methodInfo);
94
- }
95
- }
96
- }
97
- extractMethodNames(obj) {
98
- const methodNames = new Set();
99
- let prototype = obj;
100
- while (prototype && prototype !== Object.prototype) {
101
- const allKeys = [
102
- ...Object.getOwnPropertyNames(prototype),
103
- ...Object.getOwnPropertySymbols(prototype),
104
- ];
105
- for (const key of allKeys) {
106
- const descriptor = Object.getOwnPropertyDescriptor(prototype, key);
107
- if (this.isCallableMethod(descriptor, key)) {
108
- methodNames.add(key);
109
- }
110
- }
111
- prototype = Object.getPrototypeOf(prototype);
112
- }
113
- return Array.from(methodNames);
114
- }
115
97
  isCallableMethod(descriptor, key) {
116
98
  return (descriptor?.value &&
117
99
  typeof descriptor.value === 'function' &&
118
100
  key !== 'constructor' &&
119
101
  key !== 'undefined');
120
102
  }
121
- isCustomClassInstance(value) {
122
- if (value === null || (typeof value !== "object" && typeof value !== "function")) {
103
+ canExplore(descriptor) {
104
+ if (typeof descriptor.value !== "object") {
105
+ return false;
106
+ }
107
+ if (descriptor.value == null) {
123
108
  return false;
124
109
  }
125
- const objectTag = Object.prototype.toString.call(value);
126
- // Most built-ins have distinct tags; user classes default to "[object Object]"
127
- // Caveat: Symbol.toStringTag can spoof this.
128
- return objectTag === "[object Object]";
110
+ const name = this.getName(descriptor.value);
111
+ if (name == null) {
112
+ return true;
113
+ }
114
+ return this.excludedNames.has(name) === false;
129
115
  }
130
- shouldProcessProperty(property) {
131
- return (this.isCustomClassInstance(property) &&
132
- property?.constructor.name !== "Object");
116
+ getName(value) {
117
+ if (value.constructor != null) {
118
+ return value.constructor.name;
119
+ }
120
+ return null;
133
121
  }
134
- exploreNestedMethods(obj, callback, filter, initialPath, visited, maxDepth, includeNonEnumerable) {
135
- if (visited.has(obj) || initialPath.length > maxDepth) {
136
- return;
122
+ getPath(info, propertyName) {
123
+ let parent = info.parent;
124
+ const path = [info.propertyName, propertyName];
125
+ while (parent != null) {
126
+ path.unshift(parent.propertyName);
127
+ parent = parent.parent;
137
128
  }
138
- visited.add(obj);
139
- if (!this.isValidObject(obj)) {
129
+ return path.join(".");
130
+ }
131
+ explore(instance, onDiscover) {
132
+ if (!this.isValidObject(instance)) {
140
133
  return;
141
134
  }
142
- const properties = includeNonEnumerable
143
- ? Object.getOwnPropertyNames(obj)
144
- : Object.keys(obj);
145
- for (const propertyName of properties) {
146
- const property = obj[propertyName];
147
- if (!this.shouldProcessProperty(property)) {
135
+ const explore = [{ instance, propertyName: this.getName(instance) }];
136
+ const visited = new Set();
137
+ for (let i = 0; i < explore.length; i++) {
138
+ const info = explore[i];
139
+ const item = info.instance;
140
+ if (visited.has(item)) {
148
141
  continue;
149
142
  }
150
- const newPath = [...initialPath, propertyName];
151
- // Explore methods on this property
152
- this.explorePropertyMethods(property, callback, filter, newPath, obj);
153
- // Recursively explore nested objects
154
- this.exploreNestedMethods(property, callback, filter, newPath, visited, maxDepth, includeNonEnumerable);
155
- }
156
- }
157
- explorePropertyMethods(property, callback, filter, methodPath, parent) {
158
- const methodNames = this.extractMethodNames(property);
159
- for (const methodName of methodNames) {
160
- const fullMethodPath = [...methodPath, String(methodName)];
161
- const methodInfo = {
162
- methodName,
163
- instance: property,
164
- methodPath: fullMethodPath,
165
- parent
166
- };
167
- if (filter(methodInfo)) {
168
- callback(methodInfo);
169
- }
170
- }
171
- }
172
- stringifyValue(value, maxDepth = 3, currentDepth = 0) {
173
- if (value === null)
174
- return 'null';
175
- if (value === undefined)
176
- return 'undefined';
177
- const type = typeof value;
178
- switch (type) {
179
- case 'string':
180
- return `"${value}"`;
181
- case 'number':
182
- case 'boolean':
183
- return String(value);
184
- case 'function':
185
- return `[Function: ${this.getFunctionName(value)}]`;
186
- case 'object':
187
- if (currentDepth >= maxDepth) {
188
- return '[Max Depth Reached]';
143
+ const allKeys = [
144
+ ...Object.getOwnPropertyNames(item),
145
+ ...Object.getOwnPropertySymbols(item),
146
+ ];
147
+ for (const key of allKeys) {
148
+ const descriptor = Object.getOwnPropertyDescriptor(item, key);
149
+ const isCallable = this.isCallableMethod(descriptor, key);
150
+ onDiscover(info, {
151
+ name: key,
152
+ isCallable
153
+ });
154
+ if (this.canExplore(descriptor) === false) {
155
+ continue;
189
156
  }
190
- return this.stringifyObject(value, maxDepth, currentDepth);
191
- default:
192
- return `[${type}]`;
193
- }
194
- }
195
- getFunctionName(fn) {
196
- const name = fn.name;
197
- return name || 'anonymous';
198
- }
199
- stringifyObject(obj, maxDepth, currentDepth) {
200
- if (obj === null)
201
- return 'null';
202
- // Handle special object types
203
- if (obj instanceof Date) {
204
- return `Date(${obj.toISOString()})`;
205
- }
206
- if (obj instanceof Error) {
207
- return `Error(${obj.message})`;
208
- }
209
- if (obj instanceof RegExp) {
210
- return obj.toString();
211
- }
212
- if (Array.isArray(obj)) {
213
- return this.stringifyArray(obj, maxDepth, currentDepth);
214
- }
215
- if (obj.constructor && obj.constructor.name !== 'Object') {
216
- return this.stringifyClassInstance(obj, maxDepth, currentDepth);
217
- }
218
- return this.stringifyPlainObject(obj, maxDepth, currentDepth);
219
- }
220
- stringifyArray(arr, maxDepth, currentDepth) {
221
- if (arr.length === 0)
222
- return '[]';
223
- const items = arr.slice(0, 5).map(item => this.stringifyValue(item, maxDepth, currentDepth + 1));
224
- const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';
225
- return `[${items.join(', ')}${suffix}]`;
226
- }
227
- stringifyClassInstance(obj, maxDepth, currentDepth) {
228
- const className = obj.constructor.name;
229
- const properties = this.getObjectProperties(obj);
230
- if (Object.keys(properties).length === 0) {
231
- return `${className} {}`;
232
- }
233
- const props = Object.entries(properties)
234
- .slice(0, 5)
235
- .map(([key, value]) => {
236
- // For primitive values, don't increase depth
237
- const isPrimitive = value === null || value === undefined ||
238
- (typeof value !== 'object' && typeof value !== 'function');
239
- const depth = isPrimitive ? currentDepth : currentDepth + 1;
240
- return `${key}: ${this.stringifyValue(value, maxDepth, depth)}`;
241
- });
242
- const suffix = Object.keys(properties).length > 5 ?
243
- `... (+${Object.keys(properties).length - 5} more)` : '';
244
- return `${className} { ${props.join(', ')}${suffix} }`;
245
- }
246
- stringifyPlainObject(obj, maxDepth, currentDepth) {
247
- const properties = this.getObjectProperties(obj);
248
- if (Object.keys(properties).length === 0) {
249
- return '{}';
250
- }
251
- const props = Object.entries(properties)
252
- .slice(0, 5)
253
- .map(([key, value]) => {
254
- // For primitive values, don't increase depth
255
- const isPrimitive = value === null || value === undefined ||
256
- (typeof value !== 'object' && typeof value !== 'function');
257
- const depth = isPrimitive ? currentDepth : currentDepth + 1;
258
- return `${key}: ${this.stringifyValue(value, maxDepth, depth)}`;
259
- });
260
- const suffix = Object.keys(properties).length > 5 ?
261
- `... (+${Object.keys(properties).length - 5} more)` : '';
262
- return `{ ${props.join(', ')}${suffix} }`;
263
- }
264
- getObjectProperties(obj) {
265
- const properties = {};
266
- // Get enumerable properties
267
- for (const key in obj) {
268
- if (obj.hasOwnProperty(key)) {
269
- properties[key] = obj[key];
157
+ const path = this.getPath(info, key);
158
+ explore.push({ instance: descriptor.value, parent: info, propertyName: key, path });
270
159
  }
160
+ visited.add(item);
271
161
  }
272
- return properties;
273
162
  }
274
163
  }
275
164
 
@@ -284,99 +173,134 @@ __webpack_require__.r(__webpack_exports__);
284
173
  __webpack_require__.d(__webpack_exports__, {
285
174
  PerformanceCapability: () => (PerformanceCapability)
286
175
  });
176
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities */ "./src/utilities/strings.ts");
287
177
  /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
288
178
  /* ESM import */var _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./performance/PerformanceTracker */ "./src/capabilities/performance/PerformanceTracker.ts");
289
179
  /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
290
180
 
291
181
 
292
182
 
183
+
293
184
  class PerformanceCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability {
294
185
  callTraceManager;
295
186
  performanceTracker;
296
- log;
297
- shouldLog;
187
+ filter;
188
+ childDurations = new Map();
298
189
  constructor(options) {
299
190
  super();
300
- this.log = options?.log ?? ((type, operationId, methodName, methodPath, performanceMetrics, isCompleted) => {
301
- if (isCompleted) {
302
- if (!performanceMetrics.duration)
303
- return;
304
- const deltaFromStart = this.performanceTracker.getDeltaFromOperationStart(operationId, performanceMetrics.endTime || performanceMetrics.startTime);
305
- console.log(`[${type} ${operationId}] ${methodName} COMPLETED`, {
306
- methodPath,
307
- performance: {
308
- deltaFromStart: this.performanceTracker.formatDuration(deltaFromStart),
309
- executionTime: this.performanceTracker.formatDuration(performanceMetrics.duration),
310
- timeToNextCall: performanceMetrics.timeToNextCall ?
311
- this.performanceTracker.formatDuration(performanceMetrics.timeToNextCall) : 'N/A'
312
- }
313
- });
314
- return;
315
- }
316
- const deltaFromStart = this.performanceTracker.getDeltaFromOperationStart(operationId, performanceMetrics.startTime);
317
- console.log(`[${type} ${operationId}] ${methodName}`, {
318
- methodPath,
319
- performance: {
320
- deltaFromStart: this.performanceTracker.formatDuration(deltaFromStart)
321
- }
322
- });
323
- });
324
- this.shouldLog = options?.shouldLog ?? (() => true);
191
+ this.filter = options?.filter ?? (() => true);
325
192
  this.callTraceManager = new _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__.CallTraceManager();
326
193
  this.performanceTracker = new _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__.PerformanceTracker();
327
194
  }
328
- createPerformanceInterceptor(originalMethod, methodName, methodPath, instance) {
329
- return (...args) => {
330
- const isNewOperation = this.callTraceManager.isNewOperation();
331
- let operationId;
332
- if (isNewOperation) {
333
- operationId = this.callTraceManager.startNewOperation();
334
- const startTime = this.performanceTracker.startMethodTiming(operationId, methodPath);
335
- this.log('ORIGIN', operationId, methodName, methodPath, { startTime }, false);
336
- }
337
- else {
338
- operationId = this.callTraceManager.getActiveOperationId();
339
- // Record that the previous method is about to call this one
340
- const callTrace = this.callTraceManager.getCurrentTrace();
341
- const previousMethodPath = callTrace[callTrace.length - 2];
342
- if (previousMethodPath) {
343
- this.performanceTracker.recordNextMethodStart(operationId, previousMethodPath);
344
- }
345
- const startTime = this.performanceTracker.startMethodTiming(operationId, methodPath);
346
- this.log('CHILD', operationId, methodName, methodPath, { startTime }, false);
347
- }
348
- try {
349
- const result = originalMethod.apply(instance, args);
350
- return result;
351
- }
352
- finally {
353
- // End performance tracking
354
- const performanceMetrics = this.performanceTracker.endMethodTiming(operationId, methodPath);
355
- // Log completion with performance metrics
356
- this.log(isNewOperation ? 'ORIGIN' : 'CHILD', operationId, methodName, methodPath, performanceMetrics, true);
357
- if (isNewOperation) {
358
- this.callTraceManager.endOperation();
359
- this.performanceTracker.cleanupOperation(operationId);
360
- }
361
- }
362
- };
363
- }
364
195
  apply(instance) {
365
- if (!this.isValidObject(instance)) {
366
- return;
367
- }
368
- // Create a performance wrapper
369
- const wrapper = {
370
- wrapMethod: (originalMethod, methodInfo) => {
371
- return this.createPerformanceInterceptor(originalMethod, String(methodInfo.methodName), methodInfo.methodPath.join(' → '), methodInfo.instance);
196
+ this.explore(instance, (meta, info) => {
197
+ if (info.isCallable) {
198
+ const originalMethod = meta.instance[info.name].bind(meta.instance);
199
+ meta.instance[info.name] = (...args) => {
200
+ const path = `${meta.path}.${String(info.name)}()`;
201
+ if (this.filter(path, info, meta) === false) {
202
+ return originalMethod(...args);
203
+ }
204
+ const isNewOperation = this.callTraceManager.isNewOperation();
205
+ let operationId;
206
+ let callTrace;
207
+ let depth;
208
+ if (isNewOperation) {
209
+ operationId = this.callTraceManager.startNewOperation();
210
+ this.childDurations.set(operationId, []);
211
+ callTrace = this.callTraceManager.addMethodToTrace(path);
212
+ depth = callTrace.length - 1;
213
+ const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
214
+ this.performanceTracker.startMethodTiming(operationId, path);
215
+ console.log(`\n${'═'.repeat(60)}`);
216
+ console.log(`▶ ORIGIN [${operationId}] ${path}`);
217
+ if (args.length > 0) {
218
+ console.log(` Args:`, (0,_utilities__WEBPACK_IMPORTED_MODULE_3__.stringifyObject)(args, 4, 0));
219
+ }
220
+ console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
221
+ }
222
+ else {
223
+ operationId = this.callTraceManager.getActiveOperationId();
224
+ callTrace = this.callTraceManager.addMethodToTrace(path);
225
+ depth = callTrace.length - 1;
226
+ const indent = ' '.repeat(Math.min(depth, 4));
227
+ // Track children for this child method too
228
+ const childMethodKey = `${operationId}:${path}`;
229
+ this.childDurations.set(childMethodKey, []);
230
+ this.performanceTracker.startMethodTiming(operationId, path);
231
+ console.log(`${indent}└─ CHILD [${operationId}] ${path}`);
232
+ if (args.length > 0) {
233
+ console.log(`${indent} Args:`, (0,_utilities__WEBPACK_IMPORTED_MODULE_3__.stringifyObject)(args, 4, 0));
234
+ }
235
+ }
236
+ try {
237
+ return originalMethod(...args);
238
+ }
239
+ finally {
240
+ const metrics = this.performanceTracker.endMethodTiming(operationId, path);
241
+ const duration = metrics.duration ?? 0;
242
+ const formattedDuration = this.performanceTracker.formatDuration(duration);
243
+ if (isNewOperation) {
244
+ const childDurations = this.childDurations.get(operationId) ?? [];
245
+ const totalChildTime = childDurations.reduce((sum, d) => sum + d, 0);
246
+ const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
247
+ const overhead = duration - totalChildTime;
248
+ const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
249
+ console.log(`\n${'═'.repeat(60)}`);
250
+ console.log(`◀ COMPLETE [${operationId}] ${path}`);
251
+ console.log(` Total Duration: ${formattedDuration}`);
252
+ if (childDurations.length > 0) {
253
+ console.log(` Children Duration: ${formattedTotalChildTime} (${childDurations.length} calls)`);
254
+ console.log(` Overhead: ${formattedOverhead}`);
255
+ }
256
+ console.log(`${'═'.repeat(60)}\n`);
257
+ this.childDurations.delete(operationId);
258
+ this.performanceTracker.cleanupOperation(operationId);
259
+ this.callTraceManager.endOperation();
260
+ }
261
+ else {
262
+ const indent = ' '.repeat(Math.min(depth, 4));
263
+ const childMethodKey = `${operationId}:${path}`;
264
+ const childDurations = this.childDurations.get(childMethodKey) ?? [];
265
+ const totalChildTime = childDurations.reduce((sum, d) => sum + d, 0);
266
+ const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
267
+ const overhead = duration - totalChildTime;
268
+ const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
269
+ console.log(`${indent} ✓ ${formattedDuration}`);
270
+ if (childDurations.length > 0) {
271
+ console.log(`${indent} Children: ${formattedTotalChildTime} (${childDurations.length} calls), Overhead: ${formattedOverhead}`);
272
+ }
273
+ // Clean up child method tracking
274
+ this.childDurations.delete(childMethodKey);
275
+ // Find the parent method and add this duration to its children list
276
+ // The parent is the method one level up in the call trace
277
+ const currentTrace = this.callTraceManager.getCurrentTrace();
278
+ if (currentTrace.length > 1) {
279
+ // Parent is the second-to-last item in the trace (before we remove current)
280
+ const parentPath = currentTrace[currentTrace.length - 2];
281
+ // Check if parent is the root operation (trace length 2 means root + this child)
282
+ if (currentTrace.length === 2) {
283
+ // Direct child of root - add to root's children list
284
+ const rootChildDurations = this.childDurations.get(operationId);
285
+ if (rootChildDurations) {
286
+ rootChildDurations.push(duration);
287
+ }
288
+ }
289
+ else {
290
+ // Nested child - add to parent method's children list
291
+ const parentMethodKey = `${operationId}:${parentPath}`;
292
+ const parentChildDurations = this.childDurations.get(parentMethodKey);
293
+ if (parentChildDurations) {
294
+ parentChildDurations.push(duration);
295
+ }
296
+ }
297
+ }
298
+ }
299
+ this.callTraceManager.removeMethodFromTrace();
300
+ }
301
+ };
372
302
  }
373
- };
374
- // Use the generic interception utility
375
- this.exploreObjectMethods(instance, (methodInfo) => {
376
- const originalMethod = methodInfo.instance[methodInfo.methodName].bind(methodInfo.instance);
377
- const wrappedMethod = wrapper.wrapMethod(originalMethod, methodInfo);
378
- methodInfo.instance[methodInfo.methodName] = wrappedMethod;
379
- }, {});
303
+ });
380
304
  }
381
305
  }
382
306
 
@@ -393,95 +317,61 @@ __webpack_require__.d(__webpack_exports__, {
393
317
  });
394
318
  /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
395
319
  /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
320
+ /* ESM import */var _utilities_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utilities/strings */ "./src/utilities/strings.ts");
321
+
396
322
 
397
323
 
398
324
  class TracingCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability {
399
325
  callTraceManager;
400
- log;
401
- shouldLogMethod;
326
+ filter;
402
327
  constructor(options) {
403
328
  super();
404
- this.log = options?.log ?? ((type, operationId, methodName, methodPath, _callTrace, formattedCallTrace, args) => {
405
- const stringifiedArgs = args.map(arg => this.stringifyValue(arg, 4));
406
- const logData = {
407
- methodPath,
408
- callStack: formattedCallTrace,
409
- args: stringifiedArgs
410
- };
411
- console.log(`[${type} ${operationId}] ${methodName}`, logData);
412
- });
413
- this.shouldLogMethod = options?.shouldLog ?? (() => true);
329
+ this.filter = options?.filter ?? (() => true);
414
330
  this.callTraceManager = new _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__.CallTraceManager();
415
331
  }
416
- createTracingInterceptor(originalMethod, methodName, methodPath, instance) {
417
- return (...args) => {
418
- const isNewOperation = this.callTraceManager.isNewOperation();
419
- let operationId;
420
- let callTrace;
421
- if (isNewOperation) {
422
- operationId = this.callTraceManager.startNewOperation();
423
- callTrace = this.callTraceManager.addMethodToTrace(methodPath);
424
- const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
425
- this.log('ORIGIN', operationId, methodName, methodPath, callTrace, formattedCallTrace, args);
426
- }
427
- else {
428
- operationId = this.callTraceManager.getActiveOperationId();
429
- callTrace = this.callTraceManager.addMethodToTrace(methodPath);
430
- const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
431
- this.log('CHILD', operationId, methodName, methodPath, callTrace, formattedCallTrace, args);
432
- }
433
- try {
434
- const result = originalMethod.apply(instance, args);
435
- return result;
436
- }
437
- finally {
438
- if (isNewOperation) {
439
- this.callTraceManager.endOperation();
440
- }
441
- else {
442
- this.callTraceManager.removeMethodFromTrace();
443
- }
444
- }
445
- };
446
- }
447
332
  apply(instance) {
448
- if (!this.isValidObject(instance)) {
449
- return;
450
- }
451
- const logMethodCall = (type, operationId, methodName, methodPath, callTrace, formattedCallTrace, args) => {
452
- if (this.log) {
453
- this.log(type, operationId, methodName, methodPath, callTrace, formattedCallTrace, args);
454
- return;
455
- }
456
- const stringifiedArgs = args.map(arg => this.stringifyValue(arg, 4));
457
- const logData = {
458
- methodPath,
459
- callStack: formattedCallTrace,
460
- args: stringifiedArgs
461
- };
462
- console.log(`[${type} ${operationId}] ${methodName}`, logData);
463
- };
464
- // Create a tracing wrapper
465
- const wrapper = {
466
- wrapMethod: (originalMethod, methodInfo) => {
467
- const metadata = {
468
- parent: methodInfo.parent,
469
- instance: methodInfo.instance,
470
- methodPath: methodInfo.methodPath
333
+ this.explore(instance, (meta, info) => {
334
+ if (info.isCallable) {
335
+ const originalMethod = meta.instance[info.name].bind(meta.instance);
336
+ meta.instance[info.name] = (...args) => {
337
+ const path = `${meta.path}.${String(info.name)}()`;
338
+ if (this.filter(path, info, meta) === false) {
339
+ return originalMethod(...args);
340
+ }
341
+ const isNewOperation = this.callTraceManager.isNewOperation();
342
+ let operationId;
343
+ if (isNewOperation) {
344
+ operationId = this.callTraceManager.startNewOperation();
345
+ const callTrace = this.callTraceManager.addMethodToTrace(path);
346
+ const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
347
+ console.log(`\n${'═'.repeat(60)}`);
348
+ console.log(`▶ ORIGIN [${operationId}] ${path}`);
349
+ if (args.length > 0) {
350
+ console.log(` Args:`, (0,_utilities_strings__WEBPACK_IMPORTED_MODULE_2__.stringifyObject)(args, 4, 0));
351
+ }
352
+ console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
353
+ }
354
+ else {
355
+ operationId = this.callTraceManager.getActiveOperationId();
356
+ const callTrace = this.callTraceManager.addMethodToTrace(path);
357
+ const indent = ' '.repeat(Math.min(callTrace.length - 1, 4));
358
+ console.log(`${indent}└─ CHILD [${operationId}] ${path}`);
359
+ if (args.length > 0) {
360
+ console.log(`${indent} Args:`, (0,_utilities_strings__WEBPACK_IMPORTED_MODULE_2__.stringifyObject)(args, 4, 0));
361
+ }
362
+ }
363
+ try {
364
+ return originalMethod(...args);
365
+ }
366
+ finally {
367
+ this.callTraceManager.removeMethodFromTrace();
368
+ if (isNewOperation) {
369
+ this.callTraceManager.endOperation();
370
+ }
371
+ }
471
372
  };
472
- const shouldLog = this.shouldLogMethod(methodInfo.methodName, metadata);
473
- if (!shouldLog) {
474
- return originalMethod; // Return unwrapped method if not logging
475
- }
476
- return this.createTracingInterceptor(originalMethod, String(methodInfo.methodName), methodInfo.methodPath.join(' → '), methodInfo.instance);
477
373
  }
478
- };
479
- // Use the generic interception utility
480
- this.exploreObjectMethods(instance, (methodInfo) => {
481
- const originalMethod = methodInfo.instance[methodInfo.methodName].bind(methodInfo.instance);
482
- const wrappedMethod = wrapper.wrapMethod(originalMethod, methodInfo);
483
- methodInfo.instance[methodInfo.methodName] = wrappedMethod;
484
- }, {});
374
+ });
485
375
  }
486
376
  }
487
377
 
@@ -594,7 +484,7 @@ class CallTraceManager {
594
484
  activeOperationId = null;
595
485
  activeCallStack = [];
596
486
  startNewOperation() {
597
- const operationId = (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)();
487
+ const operationId = (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)(8);
598
488
  this.activeOperationId = operationId;
599
489
  this.activeCallStack = [];
600
490
  return operationId;
@@ -700,6 +590,24 @@ class Block {
700
590
  indexOf(name) {
701
591
  return this._lines.findIndex(w => typeof w !== "string" && w.name === name);
702
592
  }
593
+ getLines() {
594
+ return this._lines;
595
+ }
596
+ getParent() {
597
+ return this._parent;
598
+ }
599
+ getIndent() {
600
+ return this._indent;
601
+ }
602
+ setLines(lines) {
603
+ this._lines = lines;
604
+ }
605
+ setParent(block) {
606
+ this._parent = block;
607
+ }
608
+ setIndent(indent) {
609
+ this._indent = indent;
610
+ }
703
611
  getOrDefault(name) {
704
612
  if (name.includes('.') === false) {
705
613
  return this._lines.find(w => typeof w !== "string" && w.name === name);
@@ -729,6 +637,27 @@ class Block {
729
637
  has(name) {
730
638
  return this._lines.some(w => typeof w !== "string" && w.name === name);
731
639
  }
640
+ remove(name) {
641
+ this._lines = this._lines.filter(x => typeof x === "object" && typeof x.name === "string" && x.name !== name);
642
+ }
643
+ replace(name, line) {
644
+ const foundIndex = this._lines.findIndex(x => typeof x !== "string" && x.name === name);
645
+ if (foundIndex === -1) {
646
+ throw new Error(`Cannot find line by name. Name: ${name}`);
647
+ }
648
+ const found = this._lines[foundIndex];
649
+ if (typeof found === "string") {
650
+ // Replace the line
651
+ this._lines.splice(foundIndex, 1, line);
652
+ return;
653
+ }
654
+ line.setLines(found.getLines());
655
+ line.setIndent(found.getIndent());
656
+ line.setParent(found.getParent());
657
+ // Replace the line
658
+ this._lines.splice(foundIndex, 1, line);
659
+ return;
660
+ }
732
661
  push(line) {
733
662
  this._lines.push(line);
734
663
  }
@@ -1159,15 +1088,40 @@ __webpack_require__.r(__webpack_exports__);
1159
1088
  __webpack_require__.d(__webpack_exports__, {
1160
1089
  CompareHandlerBuilder: () => (CompareHandlerBuilder)
1161
1090
  });
1091
+ /* ESM import */var _compare_CompareArrayHandler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./compare/CompareArrayHandler */ "./src/codegen/handlers/compare/CompareArrayHandler.ts");
1092
+ /* ESM import */var _compare_CompareDateHandler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./compare/CompareDateHandler */ "./src/codegen/handlers/compare/CompareDateHandler.ts");
1162
1093
  /* ESM import */var _compare_CompareObjectHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./compare/CompareObjectHandler */ "./src/codegen/handlers/compare/CompareObjectHandler.ts");
1163
- /* ESM import */var _compare_CompareValueHandler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./compare/CompareValueHandler */ "./src/codegen/handlers/compare/CompareValueHandler.ts");
1094
+ /* ESM import */var _compare_CompareValueHandler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./compare/CompareValueHandler */ "./src/codegen/handlers/compare/CompareValueHandler.ts");
1095
+
1096
+
1164
1097
 
1165
1098
 
1166
- /// Purpose:
1167
1099
  class CompareHandlerBuilder {
1168
1100
  build() {
1169
1101
  const handler = new _compare_CompareObjectHandler__WEBPACK_IMPORTED_MODULE_0__.CompareObjectHandler();
1170
- handler.setNext(new _compare_CompareValueHandler__WEBPACK_IMPORTED_MODULE_1__.CompareValueHandler());
1102
+ handler.setNext(new _compare_CompareArrayHandler__WEBPACK_IMPORTED_MODULE_1__.CompareArrayHandler())
1103
+ .setNext(new _compare_CompareDateHandler__WEBPACK_IMPORTED_MODULE_2__.CompareDateHandler())
1104
+ .setNext(new _compare_CompareValueHandler__WEBPACK_IMPORTED_MODULE_3__.CompareValueHandler());
1105
+ return handler;
1106
+ }
1107
+ }
1108
+
1109
+
1110
+ }),
1111
+ "./src/codegen/handlers/CompareIdsHandlerBuilder.ts":
1112
+ /*!**********************************************************!*\
1113
+ !*** ./src/codegen/handlers/CompareIdsHandlerBuilder.ts ***!
1114
+ \**********************************************************/
1115
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1116
+ __webpack_require__.r(__webpack_exports__);
1117
+ __webpack_require__.d(__webpack_exports__, {
1118
+ CompareIdsHandlerBuilder: () => (CompareIdsHandlerBuilder)
1119
+ });
1120
+ /* ESM import */var _compareIds_CompareIdsKeyHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./compareIds/CompareIdsKeyHandler */ "./src/codegen/handlers/compareIds/CompareIdsKeyHandler.ts");
1121
+
1122
+ class CompareIdsHandlerBuilder {
1123
+ build() {
1124
+ const handler = new _compareIds_CompareIdsKeyHandler__WEBPACK_IMPORTED_MODULE_0__.CompareIdsKeyHandler();
1171
1125
  return handler;
1172
1126
  }
1173
1127
  }
@@ -1465,10 +1419,12 @@ __webpack_require__.r(__webpack_exports__);
1465
1419
  __webpack_require__.d(__webpack_exports__, {
1466
1420
  SerializeHandlerBuilder: () => (SerializeHandlerBuilder)
1467
1421
  });
1468
- /* ESM import */var _serialize_SerializeDateHandler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./serialize/SerializeDateHandler */ "./src/codegen/handlers/serialize/SerializeDateHandler.ts");
1469
- /* ESM import */var _serialize_SerializeObjectHandler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./serialize/SerializeObjectHandler */ "./src/codegen/handlers/serialize/SerializeObjectHandler.ts");
1470
- /* ESM import */var _serialize_SerializeValueHandler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./serialize/SerializeValueHandler */ "./src/codegen/handlers/serialize/SerializeValueHandler.ts");
1422
+ /* ESM import */var _serialize_SerializeDateHandler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./serialize/SerializeDateHandler */ "./src/codegen/handlers/serialize/SerializeDateHandler.ts");
1423
+ /* ESM import */var _serialize_SerializeObjectHandler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./serialize/SerializeObjectHandler */ "./src/codegen/handlers/serialize/SerializeObjectHandler.ts");
1424
+ /* ESM import */var _serialize_SerializeValueHandler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./serialize/SerializeValueHandler */ "./src/codegen/handlers/serialize/SerializeValueHandler.ts");
1471
1425
  /* ESM import */var _serialize_SerializeSerializerHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./serialize/SerializeSerializerHandler */ "./src/codegen/handlers/serialize/SerializeSerializerHandler.ts");
1426
+ /* ESM import */var _serialize_SerializeFunctionHandler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./serialize/SerializeFunctionHandler */ "./src/codegen/handlers/serialize/SerializeFunctionHandler.ts");
1427
+
1472
1428
 
1473
1429
 
1474
1430
 
@@ -1478,9 +1434,10 @@ class SerializeHandlerBuilder {
1478
1434
  build() {
1479
1435
  const handler = new _serialize_SerializeSerializerHandler__WEBPACK_IMPORTED_MODULE_0__.SerializeSerializerHandler();
1480
1436
  handler
1481
- .setNext(new _serialize_SerializeDateHandler__WEBPACK_IMPORTED_MODULE_1__.SerializeDateHandler())
1482
- .setNext(new _serialize_SerializeValueHandler__WEBPACK_IMPORTED_MODULE_2__.SerializeValueHandler())
1483
- .setNext(new _serialize_SerializeObjectHandler__WEBPACK_IMPORTED_MODULE_3__.SerializeObjectHandler());
1437
+ .setNext(new _serialize_SerializeFunctionHandler__WEBPACK_IMPORTED_MODULE_1__.SerializeFunctionHandler())
1438
+ .setNext(new _serialize_SerializeDateHandler__WEBPACK_IMPORTED_MODULE_2__.SerializeDateHandler())
1439
+ .setNext(new _serialize_SerializeValueHandler__WEBPACK_IMPORTED_MODULE_3__.SerializeValueHandler())
1440
+ .setNext(new _serialize_SerializeObjectHandler__WEBPACK_IMPORTED_MODULE_4__.SerializeObjectHandler());
1484
1441
  return handler;
1485
1442
  }
1486
1443
  }
@@ -1618,6 +1575,74 @@ class CloneValueHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfo
1618
1575
  }
1619
1576
 
1620
1577
 
1578
+ }),
1579
+ "./src/codegen/handlers/compare/CompareArrayHandler.ts":
1580
+ /*!*************************************************************!*\
1581
+ !*** ./src/codegen/handlers/compare/CompareArrayHandler.ts ***!
1582
+ \*************************************************************/
1583
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1584
+ __webpack_require__.r(__webpack_exports__);
1585
+ __webpack_require__.d(__webpack_exports__, {
1586
+ CompareArrayHandler: () => (CompareArrayHandler)
1587
+ });
1588
+ /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../types */ "./src/codegen/handlers/types.ts");
1589
+ /* ESM import */var _schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../schema */ "./src/schema/types.ts");
1590
+
1591
+
1592
+ class CompareArrayHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfoHandler {
1593
+ handle(property, builder) {
1594
+ if (property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Array) {
1595
+ let compare = builder.getOrDefault("result.variable.compare");
1596
+ const leftCompare = property.getSelectrorPath({ parent: "a" });
1597
+ const rightCompare = property.getSelectrorPath({ parent: "b" });
1598
+ if (compare == null) {
1599
+ compare = builder.get("result")
1600
+ .assign("const result", { name: "variable" })
1601
+ .and(`JSON.stringify(${leftCompare}) === JSON.stringify(${rightCompare})`, { name: "compareArray" });
1602
+ return builder;
1603
+ }
1604
+ compare.and(`JSON.stringify(${leftCompare}) === JSON.stringify(${rightCompare})`);
1605
+ return builder;
1606
+ }
1607
+ return super.handle(property, builder);
1608
+ }
1609
+ }
1610
+
1611
+
1612
+ }),
1613
+ "./src/codegen/handlers/compare/CompareDateHandler.ts":
1614
+ /*!************************************************************!*\
1615
+ !*** ./src/codegen/handlers/compare/CompareDateHandler.ts ***!
1616
+ \************************************************************/
1617
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1618
+ __webpack_require__.r(__webpack_exports__);
1619
+ __webpack_require__.d(__webpack_exports__, {
1620
+ CompareDateHandler: () => (CompareDateHandler)
1621
+ });
1622
+ /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../types */ "./src/codegen/handlers/types.ts");
1623
+ /* ESM import */var _schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../schema */ "./src/schema/types.ts");
1624
+
1625
+
1626
+ class CompareDateHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfoHandler {
1627
+ handle(property, builder) {
1628
+ if (property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
1629
+ let compare = builder.getOrDefault("result.variable.compare");
1630
+ const leftCompare = property.getSelectrorPath({ parent: "a" });
1631
+ const rightCompare = property.getSelectrorPath({ parent: "b" });
1632
+ if (compare == null) {
1633
+ compare = builder.get("result")
1634
+ .assign("const result", { name: "variable" })
1635
+ .and(`${leftCompare}?.toISOString() === ${rightCompare}?.toISOString()`, { name: "compareDate" });
1636
+ return builder;
1637
+ }
1638
+ compare.and(`${leftCompare}?.toISOString() === ${rightCompare}?.toISOString()`);
1639
+ return builder;
1640
+ }
1641
+ return super.handle(property, builder);
1642
+ }
1643
+ }
1644
+
1645
+
1621
1646
  }),
1622
1647
  "./src/codegen/handlers/compare/CompareObjectHandler.ts":
1623
1648
  /*!**************************************************************!*\
@@ -1676,6 +1701,32 @@ class CompareValueHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyIn
1676
1701
  }
1677
1702
 
1678
1703
 
1704
+ }),
1705
+ "./src/codegen/handlers/compareIds/CompareIdsKeyHandler.ts":
1706
+ /*!*****************************************************************!*\
1707
+ !*** ./src/codegen/handlers/compareIds/CompareIdsKeyHandler.ts ***!
1708
+ \*****************************************************************/
1709
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1710
+ __webpack_require__.r(__webpack_exports__);
1711
+ __webpack_require__.d(__webpack_exports__, {
1712
+ CompareIdsKeyHandler: () => (CompareIdsKeyHandler)
1713
+ });
1714
+ /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../types */ "./src/codegen/handlers/types.ts");
1715
+
1716
+ class CompareIdsKeyHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfoHandler {
1717
+ handle(property, builder) {
1718
+ if (property.isKey) {
1719
+ const slot = builder.get("ifs");
1720
+ const leftCompare = property.getSelectrorPath({ parent: "a" });
1721
+ const rightCompare = property.getSelectrorPath({ parent: "b" });
1722
+ slot.if(`${leftCompare} != ${rightCompare}`).appendBody("return false;");
1723
+ return builder;
1724
+ }
1725
+ return super.handle(property, builder);
1726
+ }
1727
+ }
1728
+
1729
+
1679
1730
  }),
1680
1731
  "./src/codegen/handlers/deserialize/DeserializeComputedValueHandler.ts":
1681
1732
  /*!*****************************************************************************!*\
@@ -1725,8 +1776,8 @@ class DeserializeDateHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Propert
1725
1776
  if (property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
1726
1777
  const slotPath = new _SlotPath__WEBPACK_IMPORTED_MODULE_2__.SlotPath("result.variable.object");
1727
1778
  let objectBuilder = builder.get(slotPath.get());
1728
- const entitySelectorPath = property.getSelectrorPath({ parent: "entity" });
1729
- const entityAssignmentPath = property.getAssignmentPath({ parent: "result" });
1779
+ const entitySelectorPath = property.getSelectrorPath({ parent: "unserialized" });
1780
+ const entityAssignmentPath = property.getAssignmentPath({ parent: "entity", useFromPropertyName: property.isRenamed });
1730
1781
  const assignment = `${property.name}: typeof ${entitySelectorPath} === "string" ? new Date(${entitySelectorPath}) : ${entitySelectorPath}`;
1731
1782
  // if it is nullable or optional, assign in an if block, otherwise we
1732
1783
  // could unintentionally assign null/undefined to a property that does not exist
@@ -1770,10 +1821,10 @@ class DeserializeDeserializerHandler extends _types__WEBPACK_IMPORTED_MODULE_0__
1770
1821
  if (property.valueDeserializer != null) {
1771
1822
  let objectBuilder = builder.getOrDefault("result.variable.object");
1772
1823
  const assignmentBuilder = builder.getOrDefault("functions");
1773
- const entitySelectorPath = property.getSelectrorPath({ parent: "entity" });
1824
+ const entitySelectorPath = property.getSelectrorPath({ parent: "unserialized" });
1774
1825
  if (objectBuilder == null) {
1775
1826
  objectBuilder = builder.get("result")
1776
- .assign("const result", { name: "variable" })
1827
+ .assign("const entity", { name: "variable" })
1777
1828
  .object({ name: "object" });
1778
1829
  }
1779
1830
  const defaultFunctionWithParameters = this.toNamedFunction(property.valueDeserializer.toString(), assignmentBuilder);
@@ -1839,12 +1890,12 @@ class DeserializeObjectHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Prope
1839
1890
  const slotPath = new _SlotPath__WEBPACK_IMPORTED_MODULE_2__.SlotPath("result.variable.object");
1840
1891
  let objectBuilder = builder.get(slotPath.get());
1841
1892
  if (property.parent == null) {
1842
- objectBuilder.nested(property.name, property.name);
1893
+ objectBuilder.nested(property.getResolvedName(), property.name);
1843
1894
  return builder;
1844
1895
  }
1845
1896
  slotPath.push(...property.getParentPathArray());
1846
1897
  const nestedObjectBuilder = builder.get(slotPath.get());
1847
- nestedObjectBuilder.nested(property.name, property.name);
1898
+ nestedObjectBuilder.nested(property.getResolvedName(), property.name);
1848
1899
  return builder;
1849
1900
  }
1850
1901
  return super.handle(property, builder);
@@ -1872,10 +1923,10 @@ class DeserializeValueHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Proper
1872
1923
  handle(property, builder) {
1873
1924
  if (property.type != _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Object && property.type != _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
1874
1925
  let objectBuilder = builder.getOrDefault("result.variable.object");
1875
- const entitySelectorPath = property.getAssignmentPath({ parent: "entity" });
1926
+ const entitySelectorPath = property.getAssignmentPath({ parent: "unserialized", useFromPropertyName: property.isRenamed });
1876
1927
  if (objectBuilder == null) {
1877
1928
  objectBuilder = builder.get("result")
1878
- .assign("const result", { name: "variable" })
1929
+ .assign("const entity", { name: "variable" })
1879
1930
  .object({ name: "object" });
1880
1931
  }
1881
1932
  if (property.parent == null) {
@@ -2888,14 +2939,17 @@ __webpack_require__.d(__webpack_exports__, {
2888
2939
 
2889
2940
 
2890
2941
  /**
2891
- * Handles converting a Date value from JavaScript to a string value
2942
+ * Handles converting a Date value from JavaScript to a string value. Should handle remapping here because it is the lowest level in the code here.
2943
+ * Remapping higher up could break lower level code
2892
2944
  */
2893
2945
  class SerializeDateHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfoHandler {
2894
2946
  handle(property, builder) {
2895
2947
  if (property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
2896
2948
  let objectBuilder = builder.get("if");
2897
- const entitySelectorPath = property.getSelectrorPath({ parent: "entity" });
2898
- const entityAssignmentPath = property.getAssignmentPath({ parent: "result" });
2949
+ const entitySelectorPath = property.getSelectrorPath({ parent: "entity", useFromPropertyName: property.isRenamed });
2950
+ const entityAssignmentPath = property.getAssignmentPath({
2951
+ parent: "result"
2952
+ });
2899
2953
  const assignment = `${property.name}: ${entitySelectorPath} instanceof Date ? ${entitySelectorPath}.toISOString() : ${entitySelectorPath}`;
2900
2954
  // if it is nullable or optional, assign in an if block, otherwise we
2901
2955
  // could unintentionally assign null/undefined to a property that does not exist
@@ -2922,6 +2976,31 @@ class SerializeDateHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyI
2922
2976
  }
2923
2977
 
2924
2978
 
2979
+ }),
2980
+ "./src/codegen/handlers/serialize/SerializeFunctionHandler.ts":
2981
+ /*!********************************************************************!*\
2982
+ !*** ./src/codegen/handlers/serialize/SerializeFunctionHandler.ts ***!
2983
+ \********************************************************************/
2984
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2985
+ __webpack_require__.r(__webpack_exports__);
2986
+ __webpack_require__.d(__webpack_exports__, {
2987
+ SerializeFunctionHandler: () => (SerializeFunctionHandler)
2988
+ });
2989
+ /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../types */ "./src/codegen/handlers/types.ts");
2990
+ /* ESM import */var _schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../schema */ "./src/schema/types.ts");
2991
+
2992
+
2993
+ class SerializeFunctionHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfoHandler {
2994
+ handle(property, builder) {
2995
+ if (property.functionBody != null && property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Function) {
2996
+ // Functions should not be serialized
2997
+ return builder;
2998
+ }
2999
+ return super.handle(property, builder);
3000
+ }
3001
+ }
3002
+
3003
+
2925
3004
  }),
2926
3005
  "./src/codegen/handlers/serialize/SerializeObjectHandler.ts":
2927
3006
  /*!******************************************************************!*\
@@ -2942,7 +3021,9 @@ class SerializeObjectHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Propert
2942
3021
  handle(property, builder) {
2943
3022
  if (property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Object) {
2944
3023
  const slotPath = new _SlotPath__WEBPACK_IMPORTED_MODULE_2__.SlotPath("assignments");
2945
- const childPath = property.getAssignmentPath({ parent: "result" });
3024
+ const childPath = property.getAssignmentPath({
3025
+ parent: "result"
3026
+ });
2946
3027
  if (property.isNullable || property.isOptional) {
2947
3028
  // Do nothing if it's nullable or optional as property assignments will check
2948
3029
  // and create if it does not exist. This way we can handle null/optional
@@ -2974,7 +3055,7 @@ class SerializeSerializerHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Pro
2974
3055
  if (property.valueSerializer != null) {
2975
3056
  const objectBuilder = builder.getOrDefault("if");
2976
3057
  const assignmentBuilder = builder.getOrDefault("functions");
2977
- const entitySelectorPath = property.getAssignmentPath({ parent: "entity" });
3058
+ const entitySelectorPath = property.getAssignmentPath({ parent: "entity", useFromPropertyName: property.isRenamed });
2978
3059
  const resultSelectorPath = property.getAssignmentPath({ parent: "result" });
2979
3060
  const defaultFunctionWithParameters = this.toNamedFunction(property.valueSerializer.toString(), assignmentBuilder);
2980
3061
  defaultFunctionWithParameters.builder.parameters(...defaultFunctionWithParameters.parameters.map((_, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: entitySelectorPath })));
@@ -3014,7 +3095,7 @@ class SerializeValueHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Property
3014
3095
  handle(property, builder) {
3015
3096
  if (property.type != _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Object && property.type != _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
3016
3097
  const slot = builder.getOrDefault("if");
3017
- const entitySelectorPath = property.getAssignmentPath({ parent: "entity" });
3098
+ const entitySelectorPath = property.getAssignmentPath({ parent: "entity", useFromPropertyName: property.isRenamed });
3018
3099
  const resultSelectorPath = property.getAssignmentPath({ parent: "result" });
3019
3100
  if (property.parent == null) {
3020
3101
  // Only assign if the incoming entity has the property, this allows partial serialization
@@ -3213,14 +3294,13 @@ class PropertyInfoHandler {
3213
3294
  return result;
3214
3295
  }
3215
3296
  setEnrichedProperty(property, root) {
3216
- const useFromPropertyName = property.from != null;
3217
- const entitySelectorPath = property.getAssignmentPath({ parent: "entity", useFromPropertyName });
3297
+ const entitySelectorPath = property.getAssignmentPath({ parent: "entity" });
3218
3298
  if (property.parent != null) {
3219
3299
  const slotPath = new _SlotPath__WEBPACK_IMPORTED_MODULE_1__.SlotPath("factory", "function", "enriched", "object", "enriched");
3220
3300
  const path = property.parent.getAssignmentPath({ parent: "enriched" });
3221
3301
  slotPath.push(`[${path}]`);
3222
3302
  const objectBuilder = root.get(slotPath.get());
3223
- const childEntityPathSelector = property.getSelectrorPath({ parent: "entity", useFromPropertyName });
3303
+ const childEntityPathSelector = property.getSelectrorPath({ parent: "entity" });
3224
3304
  objectBuilder.property(`${property.name}: ${childEntityPathSelector}`);
3225
3305
  return;
3226
3306
  }
@@ -3807,7 +3887,7 @@ class TagCollection {
3807
3887
  return this.data.keys();
3808
3888
  }
3809
3889
  [Symbol.dispose]() {
3810
- this.data = null;
3890
+ this.data.clear();
3811
3891
  }
3812
3892
  [Symbol.iterator]() {
3813
3893
  return this.data[Symbol.iterator]();
@@ -3918,8 +3998,10 @@ __webpack_require__.d(__webpack_exports__, {
3918
3998
  combineExpressions: () => (combineExpressions),
3919
3999
  toExpression: () => (toExpression)
3920
4000
  });
4001
+ /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
3921
4002
  /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/expressions/types.ts");
3922
4003
 
4004
+
3923
4005
  // Pre-compiled regex patterns for better performance
3924
4006
  const METHOD_REGEX = /([a-zA-Z0-9_.]+)\.(startsWith|endsWith|includes)\(([^)]+)\)(\s*(===|==|!==|!=)\s*(true|false))?/;
3925
4007
  const TRANSFORM_METHOD_REGEX = /([a-zA-Z0-9_.]+)\.(toLowerCase|toUpperCase|toLocaleLowerCase|toLocaleUpperCase)\(\)\.(startsWith|endsWith|includes)\(((?:[^()]|\([^)]*\))*)\)(\s*(===|==|!==|!=)\s*(true|false))?/;
@@ -4007,6 +4089,10 @@ const ERROR_MESSAGES = {
4007
4089
  PARAM_PATH_NOT_FOUND: (value, params) => `Cannot find path in params for .where(). Make sure parameters are not used inline.\r\nPath: ${value}, Params: ${JSON.stringify(params)}`
4008
4090
  };
4009
4091
  const STRINGIFIED_COMPARE_OPERATORS = ["true", "false"];
4092
+ const parseUnknown = (value) => {
4093
+ (0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertString)(value);
4094
+ return JSON.parse(value);
4095
+ };
4010
4096
  const combineExpressions = (...expressions) => {
4011
4097
  if (expressions.length === 0) {
4012
4098
  throw new Error("combineExpressions requires at least 1 expression");
@@ -4027,8 +4113,8 @@ const combineExpressions = (...expressions) => {
4027
4113
  return result;
4028
4114
  };
4029
4115
  const toExpression = (schema, fn, params) => {
4116
+ const stringifiedFunction = fn.toString();
4030
4117
  try {
4031
- const stringifiedFunction = fn.toString();
4032
4118
  // Optimized string parsing
4033
4119
  const arrowIndex = stringifiedFunction.indexOf('=>');
4034
4120
  if (arrowIndex === -1) {
@@ -4062,8 +4148,13 @@ const toExpression = (schema, fn, params) => {
4062
4148
  }
4063
4149
  return parseExpressionToTree(schema, expression, parameterData);
4064
4150
  }
4065
- catch (e) {
4066
- console.warn("Error parsing expression", e);
4151
+ catch (error) {
4152
+ console.warn("Error parsing expression", {
4153
+ error,
4154
+ collectionName: schema.collectionName,
4155
+ params,
4156
+ selector: stringifiedFunction
4157
+ });
4067
4158
  return _types__WEBPACK_IMPORTED_MODULE_0__.Expression.NOT_PARSABLE;
4068
4159
  }
4069
4160
  };
@@ -4172,8 +4263,29 @@ function assertIsValueExpression(value) {
4172
4263
  }
4173
4264
  }
4174
4265
  // Helper function to detect if a string is a property path
4175
- const isPropertyPath = (value) => {
4176
- return value.includes('.') && value.match(/^[a-zA-Z0-9_.]+$/) !== null;
4266
+ const isPropertyPath = (value, params) => {
4267
+ // Check for dot notation (e.g., entity.name)
4268
+ if (value.includes('.') && value.match(/^[a-zA-Z0-9_.]+$/) !== null) {
4269
+ return true;
4270
+ }
4271
+ // Check for bracket notation with literal strings (e.g., entity["name"], entity['name'], or entity[\"name\"] with escaped quotes)
4272
+ const literalBracketPattern = /^[a-zA-Z_$][a-zA-Z0-9_$]*(\[\\?["'][^"']+\\?["']\])+$/;
4273
+ if (literalBracketPattern.test(value)) {
4274
+ return true;
4275
+ }
4276
+ // Check for bracket notation with parameter paths (e.g., entity[p.name], entity[params.property])
4277
+ if (params && value.includes('[') && value.includes(']')) {
4278
+ const bracketMatch = value.match(/\[([^\]]+)\]/);
4279
+ if (bracketMatch) {
4280
+ const bracketContent = bracketMatch[1].trim();
4281
+ // Check if it's a parameter path - should start with params.name followed by dot, or be just params.name
4282
+ const isParamPath = bracketContent.startsWith(params.name + '.') || bracketContent === params.name;
4283
+ if (isParamPath || (bracketContent.includes('.') && bracketContent.match(PARAM_PATH_REGEX))) {
4284
+ return true;
4285
+ }
4286
+ }
4287
+ }
4288
+ return false;
4177
4289
  };
4178
4290
  // Helper function to determine if we need to swap the operator for reversed comparisons
4179
4291
  const getSwappedOperator = (operator) => {
@@ -4208,10 +4320,10 @@ const parseCondition = (schema, expression, params) => {
4208
4320
  // This is a parameter path on the left side (e.g., params.distinctPlayers.includes(entity.playerId))
4209
4321
  // For includes method, we need to swap left and right sides
4210
4322
  if (methodMatch[2] === 'includes') {
4211
- const property = getProperty(schema, rightSide);
4323
+ const property = getProperty(schema, rightSide, params);
4212
4324
  const value = getValue(leftSide, params); // retrieve the original value
4213
4325
  const serializer = property.property.valueSerializer;
4214
- comparator.left = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
4326
+ comparator.left = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;
4215
4327
  comparator.right = property;
4216
4328
  }
4217
4329
  else {
@@ -4221,11 +4333,11 @@ const parseCondition = (schema, expression, params) => {
4221
4333
  }
4222
4334
  else {
4223
4335
  // Normal case: property on left, value on right
4224
- const property = getProperty(schema, leftSide);
4336
+ const property = getProperty(schema, leftSide, params);
4225
4337
  const serializer = property.property.valueSerializer;
4226
4338
  const value = getValue(rightSide, params); // retrieve the original value
4227
4339
  comparator.left = property;
4228
- comparator.right = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
4340
+ comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;
4229
4341
  }
4230
4342
  // If the comparison is explicitly to false, mark it as negated
4231
4343
  if (methodMatch[6] === "false") {
@@ -4240,13 +4352,13 @@ const parseCondition = (schema, expression, params) => {
4240
4352
  if (isNegation) {
4241
4353
  comparator.negated = isNegation;
4242
4354
  }
4243
- const property = getProperty(schema, valueTransformMatch[1].trim());
4355
+ const property = getProperty(schema, valueTransformMatch[1].trim(), params);
4244
4356
  const serializer = property.property.valueSerializer;
4245
4357
  const value = getValue(valueTransformMatch[3], params); // retrieve the original value
4246
4358
  // Create the property expression for the left side (no transformer)
4247
4359
  const propertyExpression = property;
4248
4360
  // Create a ValueExpression for the right side with transformer
4249
- const valueExpression = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
4361
+ const valueExpression = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;
4250
4362
  // Set transformer and locale based on the method
4251
4363
  const method = valueTransformMatch[4];
4252
4364
  if (method === 'toLowerCase' || method === 'toLocaleLowerCase') {
@@ -4272,7 +4384,7 @@ const parseCondition = (schema, expression, params) => {
4272
4384
  comparator.negated = isNegation;
4273
4385
  }
4274
4386
  // Create the property expression for the left side with transformer
4275
- const property = getProperty(schema, transformMethodMatch[1]);
4387
+ const property = getProperty(schema, transformMethodMatch[1], params);
4276
4388
  // Set transformer and locale based on the method
4277
4389
  const method = transformMethodMatch[2];
4278
4390
  if (method === 'toLowerCase' || method === 'toLocaleLowerCase') {
@@ -4313,7 +4425,7 @@ const parseCondition = (schema, expression, params) => {
4313
4425
  }
4314
4426
  const serializer = property.property.valueSerializer;
4315
4427
  comparator.left = property;
4316
- comparator.right = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
4428
+ comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;
4317
4429
  // If the comparison is explicitly to false, mark it as negated
4318
4430
  if (transformMethodMatch[7] === "false") {
4319
4431
  comparator.negated = true;
@@ -4324,8 +4436,8 @@ const parseCondition = (schema, expression, params) => {
4324
4436
  const left = equalityMatch[1].trim();
4325
4437
  const operator = equalityMatch[2];
4326
4438
  const right = equalityMatch[3].trim();
4327
- const leftIsProperty = isPropertyPath(left);
4328
- const rightIsProperty = isPropertyPath(right);
4439
+ const leftIsProperty = isPropertyPath(left, params);
4440
+ const rightIsProperty = isPropertyPath(right, params);
4329
4441
  // Determine which side is the property and which is the value
4330
4442
  let propertySide, valueSide, finalOperator;
4331
4443
  if (leftIsProperty && !rightIsProperty) {
@@ -4350,11 +4462,11 @@ const parseCondition = (schema, expression, params) => {
4350
4462
  if (isNegation) {
4351
4463
  comparator.negated = isNegation;
4352
4464
  }
4353
- const property = getProperty(schema, propertySide);
4465
+ const property = getProperty(schema, propertySide, params);
4354
4466
  const value = getValue(valueSide, params);
4355
4467
  const serializer = property.property.valueSerializer;
4356
4468
  comparator.left = property;
4357
- comparator.right = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
4469
+ comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;
4358
4470
  convertAndAssignValue(comparator.right, comparator.left);
4359
4471
  return comparator;
4360
4472
  }
@@ -4362,8 +4474,8 @@ const parseCondition = (schema, expression, params) => {
4362
4474
  const left = comparisonMatch[1].trim();
4363
4475
  const operator = comparisonMatch[2];
4364
4476
  const right = comparisonMatch[3].trim();
4365
- const leftIsProperty = isPropertyPath(left);
4366
- const rightIsProperty = isPropertyPath(right);
4477
+ const leftIsProperty = isPropertyPath(left, params);
4478
+ const rightIsProperty = isPropertyPath(right, params);
4367
4479
  // Determine which side is the property and which is the value
4368
4480
  let propertySide, valueSide, finalOperator;
4369
4481
  if (leftIsProperty && !rightIsProperty) {
@@ -4388,28 +4500,28 @@ const parseCondition = (schema, expression, params) => {
4388
4500
  if (isNegation) {
4389
4501
  comparator.negated = isNegation;
4390
4502
  }
4391
- const property = getProperty(schema, propertySide);
4503
+ const property = getProperty(schema, propertySide, params);
4392
4504
  const value = getValue(valueSide, params);
4393
4505
  const serializer = property.property.valueSerializer;
4394
4506
  comparator.left = property;
4395
- comparator.right = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
4507
+ comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;
4396
4508
  convertAndAssignValue(comparator.right, comparator.left);
4397
4509
  return comparator;
4398
4510
  }
4399
4511
  // Check for standalone property reference (truthy comparison)
4400
4512
  // Pattern: property name only (e.g., "w.inStock" -> w.inStock === true)
4401
4513
  const standalonePropertyMatch = finalExpression.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$/);
4402
- if (standalonePropertyMatch && isPropertyPath(finalExpression)) {
4514
+ if (standalonePropertyMatch && isPropertyPath(finalExpression, params)) {
4403
4515
  const comparator = getComparator('===');
4404
4516
  if (isNegation) {
4405
4517
  comparator.negated = isNegation;
4406
4518
  }
4407
- const property = getProperty(schema, finalExpression);
4519
+ const property = getProperty(schema, finalExpression, params);
4408
4520
  const value = getValue('true', params);
4409
4521
  const serializer = property.property.valueSerializer;
4410
4522
  comparator.left = property;
4411
4523
  // need to parse the value so it matches what the serializer expects
4412
- comparator.right = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
4524
+ comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;
4413
4525
  return comparator;
4414
4526
  }
4415
4527
  // If we get here, the expression is too complex for the current parser
@@ -4503,13 +4615,81 @@ const getValueFromParams = (value, params) => {
4503
4615
  }
4504
4616
  return result;
4505
4617
  };
4506
- const getProperty = (schema, value) => {
4507
- // Optimized string splitting - only split if we have the expected pattern
4508
- if (!value.includes('.')) {
4618
+ const getProperty = (schema, value, params) => {
4619
+ let pathString;
4620
+ // Handle bracket notation (e.g., entity["name"], entity['name'], entity[p.name], or entity[\"name\"] with escaped quotes)
4621
+ if (value.includes('[') && value.includes(']')) {
4622
+ // First try to match literal string brackets: ["name"], ['name'], [\"name\"], [\'name\']
4623
+ const literalBracketMatches = value.matchAll(/\[\\?["']([^"']+)\\?["']\]/g);
4624
+ const pathParts = [];
4625
+ let foundLiteral = false;
4626
+ for (const match of literalBracketMatches) {
4627
+ // match[1] is the property name inside the brackets
4628
+ const propName = match[1];
4629
+ if (propName) {
4630
+ pathParts.push(propName);
4631
+ foundLiteral = true;
4632
+ }
4633
+ }
4634
+ // If no literal matches found, try parameter path in brackets (e.g., [p.name])
4635
+ if (!foundLiteral && params) {
4636
+ // Match brackets containing parameter paths: [p.name], [params.property], etc.
4637
+ const bracketParamMatch = value.match(/\[([^\]]+)\]/);
4638
+ if (bracketParamMatch) {
4639
+ const bracketContent = bracketParamMatch[1].trim();
4640
+ // Check if this is a parameter path
4641
+ // It should start with params.name (e.g., "p") followed by a dot, or be just params.name
4642
+ const isParamPath = bracketContent.startsWith(params.name + '.') || bracketContent === params.name;
4643
+ if (isParamPath || (bracketContent.includes('.') && bracketContent.match(PARAM_PATH_REGEX))) {
4644
+ try {
4645
+ // Try to resolve as a parameter path
4646
+ let paramPath;
4647
+ if (bracketContent.startsWith(params.name + '.') || bracketContent === params.name) {
4648
+ // Already has params.name prefix
4649
+ paramPath = bracketContent;
4650
+ }
4651
+ else {
4652
+ // Add params.name prefix
4653
+ const paramMatch = bracketContent.match(PARAM_PATH_REGEX);
4654
+ paramPath = paramMatch
4655
+ ? `${params.name}.${paramMatch[1]}`
4656
+ : `${params.name}.${bracketContent}`;
4657
+ }
4658
+ const resolvedValue = getValueFromParams(paramPath, params);
4659
+ // The resolved value should be the property name
4660
+ if (typeof resolvedValue === 'string') {
4661
+ pathParts.push(resolvedValue);
4662
+ }
4663
+ else {
4664
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4665
+ }
4666
+ }
4667
+ catch (e) {
4668
+ // Not a valid parameter path, continue to error
4669
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4670
+ }
4671
+ }
4672
+ else {
4673
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4674
+ }
4675
+ }
4676
+ else {
4677
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4678
+ }
4679
+ }
4680
+ if (pathParts.length === 0) {
4681
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4682
+ }
4683
+ pathString = pathParts.join(".");
4684
+ }
4685
+ else if (value.includes('.')) {
4686
+ // Handle dot notation (e.g., entity.name)
4687
+ const pathSplit = value.split(/[?!.]/g).slice(1);
4688
+ pathString = pathSplit.join(".");
4689
+ }
4690
+ else {
4509
4691
  throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4510
4692
  }
4511
- const pathSplit = value.split(/[?!.]/g).slice(1);
4512
- const pathString = pathSplit.join(".");
4513
4693
  // Early exit if no path found
4514
4694
  if (!pathString) {
4515
4695
  throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
@@ -4874,8 +5054,8 @@ class TrampolinePipeline {
4874
5054
  this._hasErrored = true;
4875
5055
  }
4876
5056
  currentStep = null; // Stop the loop
4877
- // Call done with the error to properly notify the caller
4878
- queueMicrotask(() => done(currentData, trampolineError));
5057
+ // We don't call `done` here because an error occurred.
5058
+ // The application should handle the uncaught exception if desired.
4879
5059
  break; // Explicitly break loop on error
4880
5060
  }
4881
5061
  }
@@ -5002,8 +5182,8 @@ class AsyncPipeline {
5002
5182
  this._hasErrored = true;
5003
5183
  }
5004
5184
  currentStep = null; // Stop the loop
5005
- // Call done with the error to properly notify the caller
5006
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(trampolineError)));
5185
+ // We don't call `done` here because an error occurred.
5186
+ // The application should handle the uncaught exception if desired.
5007
5187
  break; // Explicitly break loop on error
5008
5188
  }
5009
5189
  }
@@ -5037,88 +5217,112 @@ class AsyncPipeline {
5037
5217
  */
5038
5218
  class WorkPipeline {
5039
5219
  unitsOfWork = [];
5220
+ _hasErrored = false; // Flag to prevent calling done on error
5040
5221
  filter(done) {
5041
- const units = this.unitsOfWork;
5042
- const unitsLength = units.length;
5043
- // Fast path for empty pipeline
5044
- if (unitsLength === 0) {
5222
+ this._hasErrored = false; // Reset error flag on new execution
5223
+ if (this.unitsOfWork.length === 0) {
5045
5224
  queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5046
5225
  return;
5047
5226
  }
5048
- // Fast path for single work unit
5049
- if (unitsLength === 1) {
5050
- try {
5051
- units[0]((result) => {
5052
- queueMicrotask(() => done(result));
5053
- });
5054
- }
5055
- catch (error) {
5056
- done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
5057
- }
5058
- return;
5059
- }
5060
- let isRunning = false;
5061
- let hasErrored = false;
5227
+ let index = 0;
5228
+ let isRunning = false; // Guard against overlapping trampoline calls
5062
5229
  try {
5063
- const createStep = (idx) => {
5230
+ // --- Revised Completion Logic --- (Moved up for clarity)
5231
+ const finalStepSentinel = () => {
5232
+ // Only call done if no error has occurred
5233
+ if (!this._hasErrored) {
5234
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5235
+ }
5236
+ return null; // Stop the trampoline
5237
+ };
5238
+ const createStepRevised = (idx) => {
5064
5239
  return () => {
5065
- if (hasErrored)
5066
- return null;
5067
- if (idx >= unitsLength) {
5068
- if (!hasErrored) {
5069
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5070
- }
5071
- return null;
5240
+ if (this._hasErrored)
5241
+ return null; // Stop if an error occurred elsewhere
5242
+ if (idx >= this.unitsOfWork.length) {
5243
+ return finalStepSentinel(); // Execute the dedicated final step
5072
5244
  }
5073
- const processor = units[idx];
5074
- let syncResult = null;
5245
+ const processor = this.unitsOfWork[idx];
5246
+ // Initialize syncCallbackResult to null to satisfy StepResult type
5247
+ let syncCallbackResult = null;
5075
5248
  let calledSync = false;
5076
5249
  try {
5077
5250
  processor((result) => {
5251
+ // --- Error Handling ---
5078
5252
  if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
5079
- hasErrored = true;
5253
+ console.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
5254
+ this._hasErrored = true; // Set flag
5255
+ // Throw the error to be caught by outer try...catch blocks
5080
5256
  throw result.error;
5081
5257
  }
5082
- const nextStep = createStep(idx + 1);
5258
+ // --- /Error Handling ---
5259
+ // If no error, proceed as before
5260
+ index = idx + 1; // Update index for the next step
5261
+ const nextStep = createStepRevised(index); // Use updated index
5083
5262
  if (isRunning) {
5084
- syncResult = nextStep;
5263
+ // Callback was synchronous
5264
+ syncCallbackResult = nextStep; // Store next step function
5085
5265
  calledSync = true;
5086
5266
  }
5087
5267
  else {
5268
+ // Callback was asynchronous, restart trampoline
5088
5269
  trampoline(nextStep);
5089
5270
  }
5090
5271
  });
5091
5272
  }
5092
5273
  catch (error) {
5093
- hasErrored = true;
5274
+ if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
5275
+ console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
5276
+ this._hasErrored = true;
5277
+ }
5278
+ // Rethrow to be caught by the trampoline's catch block
5094
5279
  throw error;
5095
5280
  }
5096
- return calledSync ? syncResult : null;
5281
+ if (calledSync) {
5282
+ // Return the next step function for the sync loop
5283
+ return syncCallbackResult;
5284
+ }
5285
+ else {
5286
+ // Pause trampoline for async, loop will stop as step returns null
5287
+ return null;
5288
+ }
5097
5289
  };
5098
5290
  };
5291
+ // The trampoline loop
5099
5292
  const trampoline = (step) => {
5100
- if (isRunning)
5293
+ if (isRunning) {
5101
5294
  return;
5295
+ }
5102
5296
  isRunning = true;
5103
5297
  let currentStep = step;
5104
- while (currentStep) {
5298
+ while (typeof currentStep === 'function') {
5105
5299
  try {
5106
- if (hasErrored) {
5300
+ // Stop immediately if an error was flagged elsewhere
5301
+ if (this._hasErrored) {
5107
5302
  currentStep = null;
5108
5303
  break;
5109
5304
  }
5110
- currentStep = currentStep();
5305
+ currentStep = currentStep(); // Execute step, get next step or null
5111
5306
  }
5112
- catch (error) {
5113
- hasErrored = true;
5114
- currentStep = null;
5115
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error)));
5116
- break;
5307
+ catch (trampolineError) {
5308
+ // Catch errors propagated from step execution (processor or callback errors)
5309
+ if (!this._hasErrored) { // Avoid double logging
5310
+ console.error("Error during trampoline step execution:", trampolineError);
5311
+ this._hasErrored = true;
5312
+ }
5313
+ currentStep = null; // Stop the loop
5314
+ // We don't call `done` here because an error occurred.
5315
+ // The application should handle the uncaught exception if desired.
5316
+ break; // Explicitly break loop on error
5117
5317
  }
5118
5318
  }
5319
+ // Loop ends when currentStep is null or loop is broken by error
5119
5320
  isRunning = false;
5321
+ // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.
5120
5322
  };
5121
- trampoline(createStep(0));
5323
+ // --- Start the process ---
5324
+ index = 0; // Reset index
5325
+ trampoline(createStepRevised(0)); // Start with the revised step creator
5122
5326
  }
5123
5327
  catch (error) {
5124
5328
  done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
@@ -5229,6 +5433,7 @@ class EphemeralDataPlugin {
5229
5433
  }
5230
5434
  });
5231
5435
  }
5436
+ // If there is no work, just return the result
5232
5437
  if (!hasWork) {
5233
5438
  done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, bulkPersistResult));
5234
5439
  return;
@@ -5288,7 +5493,10 @@ __webpack_require__.d(__webpack_exports__, {
5288
5493
  QueryOptionsCollection: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOptionsCollection),
5289
5494
  QueryOrdering: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOrdering),
5290
5495
  ReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_1__.ReplicationDbPlugin),
5291
- SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator)
5496
+ SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator),
5497
+ TranslatedArrayValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedArrayValue),
5498
+ TranslatedGroupValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedGroupValue),
5499
+ TranslatedSingleValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedSingleValue)
5292
5500
  });
5293
5501
  /* ESM import */var _translators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./translators */ "./src/plugins/translators/index.ts");
5294
5502
  /* ESM import */var _replication__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./replication */ "./src/plugins/replication/index.ts");
@@ -5555,9 +5763,6 @@ const getMemoryPluginCollectionSize = (plugin, schema) => {
5555
5763
  }
5556
5764
  throw new Error("Cannot get size of collection for MemoryPlugin, not an instance of MemoryPlugin");
5557
5765
  };
5558
- const HYDRATION_STATUS_PENDING = "hydration-pending";
5559
- const HYDRATION_STATUS_ERROR = "hydration-error";
5560
- const HYDRATION_STATUS_SUCCESS = "hydration-success";
5561
5766
  let hydrationStatus = "hydration-not-started";
5562
5767
  class OptimisticReplicationDbPlugin {
5563
5768
  plugins;
@@ -5877,6 +6082,12 @@ __webpack_require__.r(__webpack_exports__);
5877
6082
  __webpack_require__.d(__webpack_exports__, {
5878
6083
  DataTranslator: () => (DataTranslator)
5879
6084
  });
6085
+ /* ESM import */var _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TranslatedArrayValue */ "./src/plugins/translators/TranslatedArrayValue.ts");
6086
+ /* ESM import */var _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TranslatedGroupValue */ "./src/plugins/translators/TranslatedGroupValue.ts");
6087
+ /* ESM import */var _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TranslatedSingleValue */ "./src/plugins/translators/TranslatedSingleValue.ts");
6088
+
6089
+
6090
+
5880
6091
  class DataTranslator {
5881
6092
  query;
5882
6093
  functionMap = {
@@ -5889,7 +6100,8 @@ class DataTranslator {
5889
6100
  skip: (data, option) => this.skip(data, option),
5890
6101
  sort: (data, option) => this.sort(data, option),
5891
6102
  sum: (data, option) => this.sum(data, option),
5892
- take: (data, option) => this.take(data, option)
6103
+ take: (data, option) => this.take(data, option),
6104
+ group: (data, option) => this.group(data, option)
5893
6105
  };
5894
6106
  constructor(query) {
5895
6107
  this.query = query;
@@ -5898,7 +6110,13 @@ class DataTranslator {
5898
6110
  this.query.options.forEach(item => {
5899
6111
  data = this.functionMap[item.name](data, item);
5900
6112
  });
5901
- return data;
6113
+ if (Array.isArray(data)) {
6114
+ return new _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_0__.TranslatedArrayValue(data);
6115
+ }
6116
+ if (this.query.options.has("group")) {
6117
+ return new _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_1__.TranslatedGroupValue(data);
6118
+ }
6119
+ return new _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_2__.TranslatedSingleValue(data);
5902
6120
  }
5903
6121
  }
5904
6122
 
@@ -5937,24 +6155,54 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
5937
6155
  if (Array.isArray(data) == false) {
5938
6156
  throw new Error("Can only map an array of data");
5939
6157
  }
5940
- const response = [];
5941
- // We want deserialization to flow through mappings
5942
- // TODO: Speed this up!
5943
- // Generate a function on the fly?
6158
+ const response = new Array(data.length);
5944
6159
  for (let i = 0, length = data.length; i < length; i++) {
5945
6160
  for (let j = 0, l = option.value.fields.length; j < l; j++) {
5946
6161
  const field = option.value.fields[j];
5947
6162
  if (field.property != null) {
5948
6163
  const value = field.property.getValue(data[i]);
5949
6164
  if (value != null) {
5950
- field.property.setValue(data[i], field.property.deserialize(value));
6165
+ // Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value
6166
+ const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;
6167
+ field.property.setValue(data[i], resolvedValue);
5951
6168
  }
5952
6169
  }
5953
6170
  }
5954
- response.push(option.value.selector(data[i]));
6171
+ response[i] = option.value.selector(data[i]);
5955
6172
  }
5956
6173
  return response;
5957
6174
  }
6175
+ group(data, option) {
6176
+ if (Array.isArray(data) == false) {
6177
+ throw new Error("Can only group an array of data");
6178
+ }
6179
+ const group = {};
6180
+ for (let i = 0, length = data.length; i < length; i++) {
6181
+ const keyValue = option.value.selector(data[i]);
6182
+ if (!group[keyValue]) {
6183
+ group[keyValue] = [];
6184
+ }
6185
+ const item = {};
6186
+ for (let j = 0, l = option.value.fields.length; j < l; j++) {
6187
+ const field = option.value.fields[j];
6188
+ if (field.property != null) {
6189
+ const value = field.property.getValue(data[i]);
6190
+ if (value != null) {
6191
+ // Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value
6192
+ const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;
6193
+ field.property.setValue(item, resolvedValue);
6194
+ continue;
6195
+ }
6196
+ // The property exists, lets set it to the value (null/undefined)
6197
+ if (Object.hasOwn(data[i], field.destinationName)) {
6198
+ field.property.setValue(item, value);
6199
+ }
6200
+ }
6201
+ }
6202
+ group[keyValue].push(item);
6203
+ }
6204
+ return group;
6205
+ }
5958
6206
  count(data, _) {
5959
6207
  if (Array.isArray(data)) {
5960
6208
  return data.length;
@@ -6115,6 +6363,30 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
6115
6363
  sort(data, _) {
6116
6364
  return data;
6117
6365
  }
6366
+ group(data, option) {
6367
+ if (Array.isArray(data) == false) {
6368
+ throw new Error("Can only group an array of data");
6369
+ }
6370
+ const group = {};
6371
+ for (let i = 0, length = data.length; i < length; i++) {
6372
+ const keyValue = option.value.selector(data[i]);
6373
+ if (!group[keyValue]) {
6374
+ group[keyValue] = [];
6375
+ }
6376
+ const item = {};
6377
+ for (let j = 0, l = option.value.fields.length; j < l; j++) {
6378
+ const field = option.value.fields[j];
6379
+ if (field.property != null) {
6380
+ const value = field.property.getValue(data[i]);
6381
+ if (value != null) {
6382
+ field.property.setValue(item, field.property.deserialize(value));
6383
+ }
6384
+ }
6385
+ }
6386
+ group[keyValue].push(item);
6387
+ }
6388
+ return group;
6389
+ }
6118
6390
  map(data, option) {
6119
6391
  if (Array.isArray(data) == false) {
6120
6392
  throw new Error("Can only map an array of data");
@@ -6142,6 +6414,91 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
6142
6414
  }
6143
6415
 
6144
6416
 
6417
+ }),
6418
+ "./src/plugins/translators/TranslatedArrayValue.ts":
6419
+ /*!*********************************************************!*\
6420
+ !*** ./src/plugins/translators/TranslatedArrayValue.ts ***!
6421
+ \*********************************************************/
6422
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6423
+ __webpack_require__.r(__webpack_exports__);
6424
+ __webpack_require__.d(__webpack_exports__, {
6425
+ TranslatedArrayValue: () => (TranslatedArrayValue)
6426
+ });
6427
+ class TranslatedArrayValue {
6428
+ value;
6429
+ constructor(value) {
6430
+ this.value = value;
6431
+ }
6432
+ forEach(callback) {
6433
+ const data = this.value;
6434
+ for (let i = 0, length = data.length; i < length; i++) {
6435
+ const result = callback(data[i]);
6436
+ if (result) {
6437
+ // reassign if the callback returns a result
6438
+ data[i] = result;
6439
+ }
6440
+ }
6441
+ }
6442
+ }
6443
+
6444
+
6445
+ }),
6446
+ "./src/plugins/translators/TranslatedGroupValue.ts":
6447
+ /*!*********************************************************!*\
6448
+ !*** ./src/plugins/translators/TranslatedGroupValue.ts ***!
6449
+ \*********************************************************/
6450
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6451
+ __webpack_require__.r(__webpack_exports__);
6452
+ __webpack_require__.d(__webpack_exports__, {
6453
+ TranslatedGroupValue: () => (TranslatedGroupValue)
6454
+ });
6455
+ class TranslatedGroupValue {
6456
+ value;
6457
+ constructor(value) {
6458
+ this.value = value;
6459
+ }
6460
+ forEach(callback) {
6461
+ const group = this.value;
6462
+ const keys = Object.keys(group);
6463
+ for (let i = 0, length = keys.length; i < length; i++) {
6464
+ const key = keys[i];
6465
+ const data = group[key];
6466
+ for (let j = 0, len = data.length; j < len; j++) {
6467
+ const result = callback(data[j]);
6468
+ if (result) {
6469
+ // reassign if the callback returns a result
6470
+ data[j] = result;
6471
+ }
6472
+ }
6473
+ }
6474
+ }
6475
+ }
6476
+
6477
+
6478
+ }),
6479
+ "./src/plugins/translators/TranslatedSingleValue.ts":
6480
+ /*!**********************************************************!*\
6481
+ !*** ./src/plugins/translators/TranslatedSingleValue.ts ***!
6482
+ \**********************************************************/
6483
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6484
+ __webpack_require__.r(__webpack_exports__);
6485
+ __webpack_require__.d(__webpack_exports__, {
6486
+ TranslatedSingleValue: () => (TranslatedSingleValue)
6487
+ });
6488
+ class TranslatedSingleValue {
6489
+ value;
6490
+ constructor(value) {
6491
+ this.value = value;
6492
+ }
6493
+ forEach(callback) {
6494
+ const result = callback(this.value);
6495
+ if (result) {
6496
+ this.value = result;
6497
+ }
6498
+ }
6499
+ }
6500
+
6501
+
6145
6502
  }),
6146
6503
  "./src/plugins/translators/index.ts":
6147
6504
  /*!******************************************!*\
@@ -6152,11 +6509,21 @@ __webpack_require__.r(__webpack_exports__);
6152
6509
  __webpack_require__.d(__webpack_exports__, {
6153
6510
  DataTranslator: () => (/* reexport safe */ _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTranslator),
6154
6511
  JsonTranslator: () => (/* reexport safe */ _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__.JsonTranslator),
6155
- SqlTranslator: () => (/* reexport safe */ _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__.SqlTranslator)
6512
+ SqlTranslator: () => (/* reexport safe */ _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__.SqlTranslator),
6513
+ TranslatedArrayValue: () => (/* reexport safe */ _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_3__.TranslatedArrayValue),
6514
+ TranslatedGroupValue: () => (/* reexport safe */ _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_4__.TranslatedGroupValue),
6515
+ TranslatedSingleValue: () => (/* reexport safe */ _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_5__.TranslatedSingleValue)
6156
6516
  });
6157
6517
  /* ESM import */var _DataTranslator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DataTranslator */ "./src/plugins/translators/DataTranslator.ts");
6158
6518
  /* ESM import */var _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JsonTranslator */ "./src/plugins/translators/JsonTranslator.ts");
6159
6519
  /* ESM import */var _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SqlTranslator */ "./src/plugins/translators/SqlTranslator.ts");
6520
+ /* ESM import */var _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TranslatedArrayValue */ "./src/plugins/translators/TranslatedArrayValue.ts");
6521
+ /* ESM import */var _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TranslatedGroupValue */ "./src/plugins/translators/TranslatedGroupValue.ts");
6522
+ /* ESM import */var _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TranslatedSingleValue */ "./src/plugins/translators/TranslatedSingleValue.ts");
6523
+
6524
+
6525
+
6526
+
6160
6527
 
6161
6528
 
6162
6529
 
@@ -6303,10 +6670,16 @@ __webpack_require__.r(__webpack_exports__);
6303
6670
  __webpack_require__.d(__webpack_exports__, {
6304
6671
  PropertyInfo: () => (PropertyInfo)
6305
6672
  });
6306
- /* ESM import */var _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./property/types/SchemaArray */ "./src/schema/property/types/SchemaArray.ts");
6307
- /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./src/schema/types.ts");
6673
+ /* ESM import */var _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./property/types/SchemaArray */ "./src/schema/property/types/SchemaArray.ts");
6674
+ /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/schema/types.ts");
6308
6675
 
6309
6676
 
6677
+ const SUPPORTED_DESERIALIZATION_TYPES = new Set([
6678
+ _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Boolean,
6679
+ _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Date,
6680
+ _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Number,
6681
+ _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.String,
6682
+ ]);
6310
6683
  /**
6311
6684
  * Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.
6312
6685
  */
@@ -6372,7 +6745,7 @@ class PropertyInfo {
6372
6745
  this.name = name;
6373
6746
  this.type = schema.type;
6374
6747
  this.literals = schema.literals;
6375
- if (schema instanceof _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_0__.SchemaArray) {
6748
+ if (schema instanceof _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_1__.SchemaArray) {
6376
6749
  this.innerSchema = schema.innerSchema;
6377
6750
  }
6378
6751
  this.isNullable = schema.isNullable;
@@ -6416,6 +6789,12 @@ class PropertyInfo {
6416
6789
  this._levelCache = level;
6417
6790
  return level;
6418
6791
  }
6792
+ get isRenamed() {
6793
+ return !!this.from;
6794
+ }
6795
+ get supportsDeserialization() {
6796
+ return this.valueDeserializer != null || SUPPORTED_DESERIALIZATION_TYPES.has(this.type);
6797
+ }
6419
6798
  _getPropertyChain() {
6420
6799
  if (this._propertyChainCache) {
6421
6800
  return this._propertyChainCache;
@@ -6445,6 +6824,9 @@ class PropertyInfo {
6445
6824
  }
6446
6825
  return path;
6447
6826
  }
6827
+ getResolvedName() {
6828
+ return this.from ?? this.name;
6829
+ }
6448
6830
  /**
6449
6831
  * Returns an array of property names representing the path from the root to this property.
6450
6832
  *
@@ -6529,12 +6911,17 @@ class PropertyInfo {
6529
6911
  return null;
6530
6912
  }
6531
6913
  const pathArray = this.getPathArray();
6914
+ const length = pathArray.length;
6915
+ // Fast path for single level properties
6916
+ if (length === 1) {
6917
+ return instance[pathArray[0]];
6918
+ }
6532
6919
  let current = instance;
6533
- for (const prop of pathArray) {
6920
+ for (let i = 0; i < length; i++) {
6534
6921
  if (current == null) {
6535
6922
  return null;
6536
6923
  }
6537
- current = current[prop];
6924
+ current = current[pathArray[i]];
6538
6925
  }
6539
6926
  return current;
6540
6927
  }
@@ -6581,8 +6968,8 @@ class PropertyInfo {
6581
6968
  getSelectrorPath(options) {
6582
6969
  const parts = this._resolvePathArray({
6583
6970
  root: options.parent,
6584
- assignmentType: options.assignmentType,
6585
- useFromPropertyName: options.useFromPropertyName
6971
+ assignmentType: options?.assignmentType,
6972
+ useFromPropertyName: options?.useFromPropertyName
6586
6973
  });
6587
6974
  return parts.join("");
6588
6975
  }
@@ -6607,16 +6994,16 @@ class PropertyInfo {
6607
6994
  if (this.valueDeserializer != null) {
6608
6995
  return this.valueDeserializer(value);
6609
6996
  }
6610
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
6997
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Date) {
6611
6998
  return new Date(value);
6612
6999
  }
6613
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.String) {
7000
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.String) {
6614
7001
  return String(value);
6615
7002
  }
6616
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Number) {
7003
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Number) {
6617
7004
  return Number(value);
6618
7005
  }
6619
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Boolean) {
7006
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Boolean) {
6620
7007
  return Boolean(value);
6621
7008
  }
6622
7009
  throw new Error(`Unsupported deserialization for type. Type: ${this.type}`);
@@ -6638,7 +7025,7 @@ __webpack_require__.d(__webpack_exports__, {
6638
7025
  /* ESM import */var _table_SchemaComputed__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./table/SchemaComputed */ "./src/schema/table/SchemaComputed.ts");
6639
7026
  /* ESM import */var _property_base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./property/base/SchemaBase */ "./src/schema/property/base/SchemaBase.ts");
6640
7027
  /* ESM import */var _PropertyInfo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PropertyInfo */ "./src/schema/PropertyInfo.ts");
6641
- /* ESM import */var _codegen__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../codegen */ "./src/codegen/blocks.ts");
7028
+ /* ESM import */var _codegen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../codegen */ "./src/codegen/blocks.ts");
6642
7029
  /* ESM import */var _codegen_handlers_EnrichmentHandlerBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../codegen/handlers/EnrichmentHandlerBuilder */ "./src/codegen/handlers/EnrichmentHandlerBuilder.ts");
6643
7030
  /* ESM import */var _codegen_handlers_MergeHandlerBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../codegen/handlers/MergeHandlerBuilder */ "./src/codegen/handlers/MergeHandlerBuilder.ts");
6644
7031
  /* ESM import */var _codegen_handlers_PrepareHandlerBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../codegen/handlers/PrepareHandlerBuilder */ "./src/codegen/handlers/PrepareHandlerBuilder.ts");
@@ -6651,11 +7038,13 @@ __webpack_require__.d(__webpack_exports__, {
6651
7038
  /* ESM import */var _codegen_handlers_HashHandlerBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../codegen/handlers/HashHandlerBuilder */ "./src/codegen/handlers/HashHandlerBuilder.ts");
6652
7039
  /* ESM import */var _codegen_handlers_EnableChangeTrackingHandlerBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../codegen/handlers/EnableChangeTrackingHandlerBuilder */ "./src/codegen/handlers/EnableChangeTrackingHandlerBuilder.ts");
6653
7040
  /* ESM import */var _codegen_handlers_FreezeHandlerBuilder__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../codegen/handlers/FreezeHandlerBuilder */ "./src/codegen/handlers/FreezeHandlerBuilder.ts");
6654
- /* ESM import */var _errors_SchemaError__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../errors/SchemaError */ "./src/errors/SchemaError.ts");
7041
+ /* ESM import */var _errors_SchemaError__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../errors/SchemaError */ "./src/errors/SchemaError.ts");
6655
7042
  /* ESM import */var _codegen_handlers_SerializeHandlerBuilder__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../codegen/handlers/SerializeHandlerBuilder */ "./src/codegen/handlers/SerializeHandlerBuilder.ts");
6656
- /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../utilities */ "./src/utilities/strings.ts");
7043
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../utilities */ "./src/utilities/strings.ts");
6657
7044
  /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./src/schema/types.ts");
6658
- /* ESM import */var _communication_broadcast__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./communication/broadcast */ "./src/schema/communication/broadcast.ts");
7045
+ /* ESM import */var _communication_broadcast__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./communication/broadcast */ "./src/schema/communication/broadcast.ts");
7046
+ /* ESM import */var _codegen_handlers_CompareIdsHandlerBuilder__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../codegen/handlers/CompareIdsHandlerBuilder */ "./src/codegen/handlers/CompareIdsHandlerBuilder.ts");
7047
+
6659
7048
 
6660
7049
 
6661
7050
 
@@ -6840,6 +7229,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6840
7229
  const enableChangeTrackingHandlerBuilder = new _codegen_handlers_EnableChangeTrackingHandlerBuilder__WEBPACK_IMPORTED_MODULE_15__.EnableChangeTrackingHandlerBuilder();
6841
7230
  const freezeHandlerBuilder = new _codegen_handlers_FreezeHandlerBuilder__WEBPACK_IMPORTED_MODULE_16__.FreezeHandlerBuilder();
6842
7231
  const serializeHandlerBuilder = new _codegen_handlers_SerializeHandlerBuilder__WEBPACK_IMPORTED_MODULE_17__.SerializeHandlerBuilder();
7232
+ const compareIdsHandlerBuilder = new _codegen_handlers_CompareIdsHandlerBuilder__WEBPACK_IMPORTED_MODULE_18__.CompareIdsHandlerBuilder();
6843
7233
  const enricher = enrichmentHandlerBuilder.build();
6844
7234
  const merge = mergeHandlerFactory.build();
6845
7235
  const prepare = prepareHandlerBuilder.build();
@@ -6853,26 +7243,36 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6853
7243
  const enableChangeTrackingHandler = enableChangeTrackingHandlerBuilder.build();
6854
7244
  const freezeHandler = freezeHandlerBuilder.build();
6855
7245
  const serializeHandler = serializeHandlerBuilder.build();
6856
- const changeTrackingCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7246
+ const compareIdsHandler = compareIdsHandlerBuilder.build();
7247
+ const changeTrackingCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6857
7248
  changeTrackingCodeBuilder.raw(`function ${this.createChangeTracker.toString()}`);
6858
7249
  changeTrackingCodeBuilder.slot("declarations").variable("enableChangeTracking").value('createChangeTracker()');
6859
7250
  changeTrackingCodeBuilder.slot("assignment");
6860
7251
  changeTrackingCodeBuilder.slot("return").raw('\treturn enableChangeTracking(entity);');
6861
- const freezeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7252
+ const freezeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6862
7253
  freezeCodeBuilder.slot("assignment");
6863
7254
  freezeCodeBuilder.slot("return").raw('\treturn Object.freeze(entity);');
6864
- const enricherCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7255
+ const enricherCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6865
7256
  const enricherFunctionRoot = enricherCodeBuilder.factory("factory", { name: "factory" }).parameters({ name: "collectionName", value: this.collectionName });
6866
7257
  const enricherFunctionBody = enricherFunctionRoot.function(undefined, { name: "function" }).parameters("entity", "changeTrackingType").return();
6867
- enricherFunctionBody.raw(`function ${this.createChangeTracker.toString()}`);
6868
- enricherFunctionBody.variable("enableChangeTracking").value('changeTrackingType === "proxy" ? createChangeTracker() : e => e');
7258
+ enricherFunctionBody.slot("changeTracker").raw(`\tfunction ${this.createChangeTracker.toString()}`);
7259
+ enricherFunctionBody.slot("enableChangeTracking")
7260
+ .variable("enableChangeTracking")
7261
+ .value('changeTrackingType === "proxy" ? createChangeTracker() : e => e');
7262
+ enricherFunctionBody.slot("append");
6869
7263
  enricherFunctionBody.slot("enriched");
6870
7264
  enricherFunctionBody.slot("declarations");
6871
7265
  enricherFunctionBody.slot("assignment");
6872
7266
  enricherFunctionBody.slot("ifs");
6873
7267
  enricherFunctionBody.slot("tracking").if('changeTrackingType === "immutable"', { name: "freeze" });
6874
- enricherFunctionBody.raw('\treturn enableChangeTracking(enriched);');
6875
- const mergeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7268
+ enricherFunctionBody.slot("return").raw('\treturn enableChangeTracking(enriched);');
7269
+ const preprocessCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
7270
+ preprocessCodeBuilder.slot("main");
7271
+ preprocessCodeBuilder.slot("return").raw(` return result;`);
7272
+ const postprocessCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
7273
+ postprocessCodeBuilder.slot("main");
7274
+ postprocessCodeBuilder.slot("return").raw(` return result;`);
7275
+ const mergeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6876
7276
  const mergeFunctionRoot = mergeCodeBuilder.factory("factory", { name: "factory" }).parameters({ name: "collectionName", value: this.collectionName });
6877
7277
  const mergeFunctionBody = mergeFunctionRoot.function(undefined, { name: "function" }).parameters("destination", "source").return();
6878
7278
  const pauseFunctionBody = mergeFunctionBody.function("pause")
@@ -6891,40 +7291,43 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6891
7291
  unpause();
6892
7292
 
6893
7293
  return destination;`);
6894
- const prepareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7294
+ const prepareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6895
7295
  prepareCodeBuilder.slot("result");
6896
7296
  prepareCodeBuilder.slot("assignments");
6897
7297
  prepareCodeBuilder.slot("return").raw(` return result;`);
6898
- const stripCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7298
+ const stripCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6899
7299
  stripCodeBuilder.slot("result");
6900
7300
  stripCodeBuilder.slot("return").raw(` return result;`);
6901
- const cloneCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7301
+ const cloneCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6902
7302
  cloneCodeBuilder.slot("result").raw("const result = {};");
6903
7303
  ;
6904
7304
  cloneCodeBuilder.slot("assignments");
6905
7305
  cloneCodeBuilder.slot("if");
6906
7306
  cloneCodeBuilder.slot("return").raw(` return result;`);
6907
- const compareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7307
+ const compareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6908
7308
  compareCodeBuilder.slot("result");
6909
7309
  compareCodeBuilder.slot("return").raw(` return result;`);
6910
- const deserializeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7310
+ const compareIdsCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
7311
+ compareIdsCodeBuilder.slot("ifs");
7312
+ compareIdsCodeBuilder.slot("return").raw(` return true;`);
7313
+ const deserializeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6911
7314
  deserializeCodeBuilder.slot("functions");
6912
7315
  deserializeCodeBuilder.slot("result");
6913
7316
  deserializeCodeBuilder.slot("if");
6914
- deserializeCodeBuilder.slot("return").raw(` return result;`);
6915
- const serializeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7317
+ deserializeCodeBuilder.slot("return").raw(` return entity;`);
7318
+ const serializeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6916
7319
  serializeCodeBuilder.slot("result").raw("const result = {};");
6917
7320
  serializeCodeBuilder.slot("assignments");
6918
7321
  serializeCodeBuilder.slot("functions");
6919
7322
  serializeCodeBuilder.slot("if");
6920
7323
  serializeCodeBuilder.slot("return").raw(` return result;`);
6921
- const idSelectorCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7324
+ const idSelectorCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6922
7325
  idSelectorCodeBuilder.slot("result");
6923
7326
  idSelectorCodeBuilder.slot("return").raw(` return result;`);
6924
- const hashTypeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7327
+ const hashTypeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6925
7328
  hashTypeCodeBuilder.slot("ifs");
6926
7329
  hashTypeCodeBuilder.slot("return").raw(` return "Ids";`);
6927
- const hashCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7330
+ const hashCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6928
7331
  hashCodeBuilder.slot("functions").raw(`
6929
7332
  function stringifyDate(d) {
6930
7333
 
@@ -6979,6 +7382,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6979
7382
  hashHandler.handle(property, hashCodeBuilder);
6980
7383
  enableChangeTrackingHandler.handle(property, changeTrackingCodeBuilder);
6981
7384
  freezeHandler.handle(property, freezeCodeBuilder);
7385
+ compareIdsHandler.handle(property, compareIdsCodeBuilder);
6982
7386
  });
6983
7387
  if (idProperties.length === 0) {
6984
7388
  throw new Error(`Schema must have a key. Use .key() to mark a property as a key. Collection Name: ${this.collectionName}`);
@@ -6987,20 +7391,36 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6987
7391
  const mergeParams = mergeFunctionRoot.getParameters();
6988
7392
  const enrichGenerator = Function(`return ${enricherCodeBuilder.toString()}`);
6989
7393
  const mergeGenerator = Function(`return ${mergeCodeBuilder.toString()}`);
7394
+ // After enricher is used, we modify it to be deserialize and enrich
7395
+ enricherFunctionBody.get("append").insert(deserializeCodeBuilder.get("functions"));
7396
+ enricherFunctionBody.get("append").insert(deserializeCodeBuilder.get("result"));
7397
+ enricherFunctionBody.get("append").insert(deserializeCodeBuilder.get("if"));
7398
+ enricherFunctionRoot.replace("function", new _codegen__WEBPACK_IMPORTED_MODULE_19__.FunctionBuilder(undefined).parameters("unserialized", "changeTrackingType").return());
7399
+ const postProcessGenerator = Function(`return ${enricherCodeBuilder.toString()}`);
7400
+ const postProcessParams = enricherFunctionRoot.getParameters();
7401
+ // Combine prepare and serialize
7402
+ preprocessCodeBuilder.get("main").insert(prepareCodeBuilder.get("result"));
7403
+ preprocessCodeBuilder.get("main").insert(prepareCodeBuilder.get("assignments"));
7404
+ preprocessCodeBuilder.get("main").insert(serializeCodeBuilder.get("assignments"));
7405
+ preprocessCodeBuilder.get("main").insert(serializeCodeBuilder.get("functions"));
7406
+ preprocessCodeBuilder.get("main").insert(serializeCodeBuilder.get("if"));
6990
7407
  const getIdsFunction = Function("entity", idSelectorCodeBuilder.toString());
6991
7408
  const getHashTypeFunction = Function("entity", hashTypeCodeBuilder.toString());
6992
7409
  const prepareFunction = Function("entity", prepareCodeBuilder.toString());
6993
7410
  const cloneFunction = Function("entity", cloneCodeBuilder.toString());
6994
- const deserializeFunction = Function("entity", deserializeCodeBuilder.toString());
7411
+ const deserializeFunction = Function("unserialized", deserializeCodeBuilder.toString());
6995
7412
  const serializeFunction = Function("entity", serializeCodeBuilder.toString());
6996
7413
  const compareFunction = Function("a", "b", compareCodeBuilder.toString());
6997
- ;
6998
7414
  const stripFunction = Function("entity", stripCodeBuilder.toString());
6999
7415
  const hashFunction = Function("entity", "type", hashCodeBuilder.toString());
7000
7416
  const enableChangeTrackingFunction = Function("entity", changeTrackingCodeBuilder.toString());
7001
7417
  const freezeFunction = Function("entity", freezeCodeBuilder.toString());
7418
+ const compareIdsFunction = Function("a", "b", compareIdsCodeBuilder.toString());
7419
+ const preprocessFunction = Function("entity", preprocessCodeBuilder.toString());
7002
7420
  const enricherFactoryFunction = enrichGenerator();
7421
+ const postProcessFactoryFunction = postProcessGenerator();
7003
7422
  const mergeFactoryFunction = mergeGenerator();
7423
+ const postProcessFunction = postProcessFactoryFunction(...postProcessParams.map(w => w.value));
7004
7424
  const enricherFunction = enricherFactoryFunction(...enrichParams.map(w => w.value));
7005
7425
  const mergeFunction = mergeFactoryFunction(...mergeParams.map(w => w.value));
7006
7426
  const idPropertyNames = idProperties.map(w => w.name);
@@ -7011,7 +7431,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
7011
7431
  return getIdsFunction(entity)[0];
7012
7432
  };
7013
7433
  const getProperty = (id) => propertyMap.get(id);
7014
- const id = (0,_utilities__WEBPACK_IMPORTED_MODULE_19__.hash)([...allPropertyNamesAndPaths, this.collectionName].join(","));
7434
+ const id = (0,_utilities__WEBPACK_IMPORTED_MODULE_20__.hash)([...allPropertyNamesAndPaths, this.collectionName].join(","));
7015
7435
  // memoize this by the validProperties
7016
7436
  // TODO: See if we can generate a function to do this and eliminate loops
7017
7437
  const deserializePartial = (item, properties) => {
@@ -7026,8 +7446,9 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
7026
7446
  }
7027
7447
  return item;
7028
7448
  };
7029
- return {
7030
- createSubscription: (signal) => new _communication_broadcast__WEBPACK_IMPORTED_MODULE_20__.SchemaSubscription(id, signal),
7449
+ const result = {
7450
+ preprocess: preprocessFunction,
7451
+ postprocess: postProcessFunction,
7031
7452
  getId,
7032
7453
  getProperty,
7033
7454
  properties,
@@ -7042,6 +7463,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
7042
7463
  deserialize: deserializeFunction,
7043
7464
  serialize: serializeFunction,
7044
7465
  compare: compareFunction,
7466
+ compareIds: compareIdsFunction,
7045
7467
  strip: stripFunction,
7046
7468
  hash: hashFunction,
7047
7469
  id,
@@ -7103,9 +7525,13 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
7103
7525
  return indexes;
7104
7526
  }
7105
7527
  };
7528
+ return {
7529
+ createSubscription: (signal) => new _communication_broadcast__WEBPACK_IMPORTED_MODULE_21__.SchemaSubscription(result, signal),
7530
+ ...result
7531
+ };
7106
7532
  }
7107
7533
  catch (e) {
7108
- throw new _errors_SchemaError__WEBPACK_IMPORTED_MODULE_21__.SchemaError(e, `Error compiling schema for collection: ${this.collectionName}`);
7534
+ throw new _errors_SchemaError__WEBPACK_IMPORTED_MODULE_22__.SchemaError(e, `Error compiling schema for collection: ${this.collectionName}`);
7109
7535
  }
7110
7536
  }
7111
7537
  }
@@ -7221,43 +7647,81 @@ class SubscriptionListener {
7221
7647
  }
7222
7648
  class SchemaSubscription {
7223
7649
  id;
7224
- schemaId;
7650
+ schema;
7225
7651
  createdAt;
7226
- constructor(schemaId, signal) {
7652
+ constructor(schema, signal) {
7227
7653
  this.createdAt = (0,_performance__WEBPACK_IMPORTED_MODULE_0__.now)();
7228
7654
  this.id = (0,_utilities__WEBPACK_IMPORTED_MODULE_1__.uuid)(8);
7229
- this.schemaId = schemaId;
7655
+ this.schema = schema;
7230
7656
  signal?.addEventListener("abort", () => {
7231
7657
  this.dispose();
7232
7658
  }, { once: true });
7233
7659
  }
7234
7660
  send(changes) {
7235
- const regisry = getChannelRegistry(this.schemaId);
7661
+ const regisry = getChannelRegistry(this.schema.id);
7662
+ // cannot send raw data, needs to be preprocessed
7663
+ const preprocessedChanges = {
7664
+ adds: new Array(changes.adds.length),
7665
+ removals: new Array(changes.removals.length),
7666
+ unknown: new Array(changes.unknown.length),
7667
+ updates: new Array(changes.updates.length),
7668
+ };
7669
+ for (let i = 0, length = changes.adds.length; i < length; i++) {
7670
+ preprocessedChanges.adds[i] = this.schema.preprocess(changes.adds[i]);
7671
+ }
7672
+ for (let i = 0, length = changes.removals.length; i < length; i++) {
7673
+ preprocessedChanges.removals[i] = this.schema.preprocess(changes.removals[i]);
7674
+ }
7675
+ for (let i = 0, length = changes.unknown.length; i < length; i++) {
7676
+ preprocessedChanges.unknown[i] = this.schema.preprocess(changes.unknown[i]);
7677
+ }
7678
+ for (let i = 0, length = changes.updates.length; i < length; i++) {
7679
+ preprocessedChanges.updates[i] = this.schema.preprocess(changes.updates[i]);
7680
+ }
7236
7681
  // Send message to all listeners.
7237
7682
  // Since we create a new listener when we do onMessage,
7238
7683
  // we don't need to worry about sending to ourselves, it
7239
7684
  // can't happen
7240
7685
  regisry.sender.send({
7241
- data: changes,
7686
+ data: preprocessedChanges,
7242
7687
  timestamp: (0,_performance__WEBPACK_IMPORTED_MODULE_0__.now)()
7243
7688
  });
7244
7689
  }
7245
7690
  onMessage(callback) {
7246
- const regisry = getChannelRegistry(this.schemaId);
7691
+ const regisry = getChannelRegistry(this.schema.id);
7247
7692
  // Link the callback to an instance
7248
7693
  regisry.receiver.addListener(this.id, ({ data, timestamp }) => {
7249
7694
  if (timestamp < this.createdAt) {
7250
7695
  // Sent before the receiver was even created
7251
7696
  return;
7252
7697
  }
7253
- callback(data);
7698
+ // Changes were preprocessed before they were sent, need to postprocess them
7699
+ const postProcessedChanges = {
7700
+ adds: new Array(data.adds.length),
7701
+ removals: new Array(data.removals.length),
7702
+ unknown: new Array(data.unknown.length),
7703
+ updates: new Array(data.updates.length),
7704
+ };
7705
+ for (let i = 0, length = data.adds.length; i < length; i++) {
7706
+ postProcessedChanges.adds[i] = this.schema.preprocess(data.adds[i]);
7707
+ }
7708
+ for (let i = 0, length = data.removals.length; i < length; i++) {
7709
+ postProcessedChanges.removals[i] = this.schema.preprocess(data.removals[i]);
7710
+ }
7711
+ for (let i = 0, length = data.unknown.length; i < length; i++) {
7712
+ postProcessedChanges.unknown[i] = this.schema.preprocess(data.unknown[i]);
7713
+ }
7714
+ for (let i = 0, length = data.updates.length; i < length; i++) {
7715
+ postProcessedChanges.updates[i] = this.schema.preprocess(data.updates[i]);
7716
+ }
7717
+ callback(postProcessedChanges);
7254
7718
  });
7255
7719
  }
7256
7720
  dispose() {
7257
7721
  this[Symbol.dispose]();
7258
7722
  }
7259
7723
  [Symbol.dispose]() {
7260
- const regisry = getChannelRegistry(this.schemaId);
7724
+ const regisry = getChannelRegistry(this.schema.id);
7261
7725
  // Remove listeners for this instance only
7262
7726
  regisry.receiver.removeListeners(this.id);
7263
7727
  }
@@ -7805,6 +8269,8 @@ __webpack_require__.d(__webpack_exports__, {
7805
8269
  SchemaTracked: () => (SchemaTracked)
7806
8270
  });
7807
8271
  /* ESM import */var _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../base/SchemaBase */ "./src/schema/property/base/SchemaBase.ts");
8272
+ /* ESM import */var _SchemaKey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SchemaKey */ "./src/schema/property/modifiers/SchemaKey.ts");
8273
+
7808
8274
 
7809
8275
  class SchemaTracked extends _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__.SchemaBase {
7810
8276
  instance;
@@ -7814,6 +8280,9 @@ class SchemaTracked extends _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__.Schema
7814
8280
  this.instance = current.instance;
7815
8281
  this.isUnmapped = false;
7816
8282
  }
8283
+ key() {
8284
+ return new _SchemaKey__WEBPACK_IMPORTED_MODULE_1__.SchemaKey(this);
8285
+ }
7817
8286
  }
7818
8287
 
7819
8288
 
@@ -8521,13 +8990,16 @@ __webpack_require__.d(__webpack_exports__, {
8521
8990
  cast: () => (/* reexport safe */ _objects__WEBPACK_IMPORTED_MODULE_3__.cast),
8522
8991
  clone: () => (/* reexport safe */ _objects__WEBPACK_IMPORTED_MODULE_3__.clone),
8523
8992
  combineQueryOptionsCollections: () => (/* reexport safe */ _queryOptionsCollection__WEBPACK_IMPORTED_MODULE_7__.combineQueryOptionsCollections),
8993
+ fastHash: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.fastHash),
8524
8994
  hash: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.hash),
8525
8995
  isDate: () => (/* reexport safe */ _dates__WEBPACK_IMPORTED_MODULE_2__.isDate),
8526
8996
  isNodeRuntime: () => (/* reexport safe */ _runtime__WEBPACK_IMPORTED_MODULE_4__.isNodeRuntime),
8527
8997
  noop: () => (/* reexport safe */ _functions__WEBPACK_IMPORTED_MODULE_9__.noop),
8528
8998
  resolveBulkPersistChanges: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_6__.resolveBulkPersistChanges),
8999
+ stringifyObject: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.stringifyObject),
8529
9000
  toEventArray: () => (/* reexport safe */ _dbPluginEventUtils__WEBPACK_IMPORTED_MODULE_8__.toEventArray),
8530
9001
  toMap: () => (/* reexport safe */ _arrays__WEBPACK_IMPORTED_MODULE_0__.toMap),
9002
+ unsafeCast: () => (/* reexport safe */ _unsafeCast__WEBPACK_IMPORTED_MODULE_10__.unsafeCast),
8531
9003
  uuid: () => (/* reexport safe */ _uuid__WEBPACK_IMPORTED_MODULE_5__.uuid),
8532
9004
  uuidv4: () => (/* reexport safe */ _uuid__WEBPACK_IMPORTED_MODULE_5__.uuidv4)
8533
9005
  });
@@ -8541,6 +9013,8 @@ __webpack_require__.d(__webpack_exports__, {
8541
9013
  /* ESM import */var _queryOptionsCollection__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./queryOptionsCollection */ "./src/utilities/queryOptionsCollection.ts");
8542
9014
  /* ESM import */var _dbPluginEventUtils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dbPluginEventUtils */ "./src/utilities/dbPluginEventUtils.ts");
8543
9015
  /* ESM import */var _functions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./functions */ "./src/utilities/functions.ts");
9016
+ /* ESM import */var _unsafeCast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./unsafeCast */ "./src/utilities/unsafeCast.ts");
9017
+
8544
9018
 
8545
9019
 
8546
9020
 
@@ -8649,7 +9123,9 @@ const isNodeRuntime = () => typeof process !== 'undefined' &&
8649
9123
  (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8650
9124
  __webpack_require__.r(__webpack_exports__);
8651
9125
  __webpack_require__.d(__webpack_exports__, {
8652
- hash: () => (hash)
9126
+ fastHash: () => (fastHash),
9127
+ hash: () => (hash),
9128
+ stringifyObject: () => (stringifyObject)
8653
9129
  });
8654
9130
  const hash = (value, seed = 0) => {
8655
9131
  // From Stack Overflow
@@ -8666,6 +9142,158 @@ const hash = (value, seed = 0) => {
8666
9142
  h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
8667
9143
  return 4294967296 * (2097151 & h2) + (h1 >>> 0);
8668
9144
  };
9145
+ /**
9146
+ * Fast string hash optimized for comparisons.
9147
+ * Uses djb2 algorithm - very fast and good distribution for short to medium strings.
9148
+ * Same input always produces same output (deterministic).
9149
+ *
9150
+ * @param value - The string to hash
9151
+ * @param seed - Optional seed value (default: 5381)
9152
+ * @returns A positive 32-bit integer hash value
9153
+ *
9154
+ * @example
9155
+ * ```ts
9156
+ * fastHash("test") === fastHash("test") // true
9157
+ * fastHash("test") !== fastHash("test2") // true
9158
+ * ```
9159
+ */
9160
+ const fastHash = (value, seed = 5381) => {
9161
+ let hash = seed;
9162
+ for (let i = 0; i < value.length; i++) {
9163
+ hash = ((hash << 5) + hash) + value.charCodeAt(i);
9164
+ }
9165
+ return hash >>> 0; // Convert to unsigned 32-bit integer
9166
+ };
9167
+ /**
9168
+ * Converts any value to a readable string representation.
9169
+ * Handles primitives, objects, arrays, classes, dates, errors, and functions.
9170
+ * Supports depth limiting to prevent infinite recursion on circular references.
9171
+ *
9172
+ * @param obj - The value to stringify
9173
+ * @param maxDepth - Maximum depth for nested objects (default: 3)
9174
+ * @param currentDepth - Current recursion depth (default: 0)
9175
+ * @returns String representation of the value
9176
+ *
9177
+ * @example
9178
+ * ```ts
9179
+ * stringifyObject({ name: "test", count: 5 }) // '{ name: "test", count: 5 }'
9180
+ * stringifyObject([1, 2, 3]) // '[1, 2, 3]'
9181
+ * stringifyObject(new Date()) // 'Date(2024-01-01T00:00:00.000Z)'
9182
+ * ```
9183
+ */
9184
+ function stringifyObject(obj, maxDepth = 3, currentDepth = 0) {
9185
+ if (obj === null)
9186
+ return 'null';
9187
+ if (obj === undefined)
9188
+ return 'undefined';
9189
+ const type = typeof obj;
9190
+ switch (type) {
9191
+ case 'string':
9192
+ return `"${obj}"`;
9193
+ case 'number':
9194
+ case 'boolean':
9195
+ return String(obj);
9196
+ case 'function':
9197
+ return `[Function: ${getFunctionName(obj)}]`;
9198
+ case 'object':
9199
+ if (currentDepth >= maxDepth) {
9200
+ return '[Max Depth Reached]';
9201
+ }
9202
+ return stringifyObjectValue(obj, maxDepth, currentDepth);
9203
+ default:
9204
+ return `[${type}]`;
9205
+ }
9206
+ }
9207
+ function getFunctionName(fn) {
9208
+ const name = fn.name;
9209
+ return name || 'anonymous';
9210
+ }
9211
+ function getObjectProperties(obj) {
9212
+ const properties = {};
9213
+ for (const key in obj) {
9214
+ if (obj.hasOwnProperty(key)) {
9215
+ properties[key] = obj[key];
9216
+ }
9217
+ }
9218
+ return properties;
9219
+ }
9220
+ function stringifyObjectValue(obj, maxDepth, currentDepth) {
9221
+ if (obj === null)
9222
+ return 'null';
9223
+ if (obj instanceof Date) {
9224
+ return `Date(${obj.toISOString()})`;
9225
+ }
9226
+ if (obj instanceof Error) {
9227
+ return `Error(${obj.message})`;
9228
+ }
9229
+ if (obj instanceof RegExp) {
9230
+ return obj.toString();
9231
+ }
9232
+ if (Array.isArray(obj)) {
9233
+ return stringifyArray(obj, maxDepth, currentDepth);
9234
+ }
9235
+ if (obj.constructor && obj.constructor.name !== 'Object') {
9236
+ return stringifyClassInstance(obj, maxDepth, currentDepth);
9237
+ }
9238
+ return stringifyPlainObject(obj, maxDepth, currentDepth);
9239
+ }
9240
+ function stringifyArray(arr, maxDepth, currentDepth) {
9241
+ if (arr.length === 0)
9242
+ return '[]';
9243
+ const items = arr.slice(0, 5).map(item => stringifyObject(item, maxDepth, currentDepth + 1));
9244
+ const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';
9245
+ return `[${items.join(', ')}${suffix}]`;
9246
+ }
9247
+ function stringifyClassInstance(obj, maxDepth, currentDepth) {
9248
+ const className = obj.constructor.name;
9249
+ const properties = getObjectProperties(obj);
9250
+ if (Object.keys(properties).length === 0) {
9251
+ return `${className} {}`;
9252
+ }
9253
+ const props = Object.entries(properties)
9254
+ .slice(0, 5)
9255
+ .map(([key, value]) => {
9256
+ const isPrimitive = value === null || value === undefined ||
9257
+ (typeof value !== 'object' && typeof value !== 'function');
9258
+ const depth = isPrimitive ? currentDepth : currentDepth + 1;
9259
+ return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
9260
+ });
9261
+ const suffix = Object.keys(properties).length > 5 ?
9262
+ `... (+${Object.keys(properties).length - 5} more)` : '';
9263
+ return `${className} { ${props.join(', ')}${suffix} }`;
9264
+ }
9265
+ function stringifyPlainObject(obj, maxDepth, currentDepth) {
9266
+ const properties = getObjectProperties(obj);
9267
+ if (Object.keys(properties).length === 0) {
9268
+ return '{}';
9269
+ }
9270
+ const props = Object.entries(properties)
9271
+ .slice(0, 5)
9272
+ .map(([key, value]) => {
9273
+ const isPrimitive = value === null || value === undefined ||
9274
+ (typeof value !== 'object' && typeof value !== 'function');
9275
+ const depth = isPrimitive ? currentDepth : currentDepth + 1;
9276
+ return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
9277
+ });
9278
+ const suffix = Object.keys(properties).length > 5 ?
9279
+ `... (+${Object.keys(properties).length - 5} more)` : '';
9280
+ return `{ ${props.join(', ')}${suffix} }`;
9281
+ }
9282
+
9283
+
9284
+ }),
9285
+ "./src/utilities/unsafeCast.ts":
9286
+ /*!*************************************!*\
9287
+ !*** ./src/utilities/unsafeCast.ts ***!
9288
+ \*************************************/
9289
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9290
+ __webpack_require__.r(__webpack_exports__);
9291
+ __webpack_require__.d(__webpack_exports__, {
9292
+ unsafeCast: () => (unsafeCast)
9293
+ });
9294
+ const unsafeCast = (value) => {
9295
+ return value;
9296
+ };
8669
9297
 
8670
9298
 
8671
9299
  }),
@@ -8862,6 +9490,9 @@ __webpack_require__.d(__webpack_exports__, {
8862
9490
  TagCollection: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.TagCollection),
8863
9491
  TracingCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_11__.TracingCapability),
8864
9492
  TrampolinePipeline: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.TrampolinePipeline),
9493
+ TranslatedArrayValue: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.TranslatedArrayValue),
9494
+ TranslatedGroupValue: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.TranslatedGroupValue),
9495
+ TranslatedSingleValue: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.TranslatedSingleValue),
8865
9496
  ValueExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.ValueExpression),
8866
9497
  VariableBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.VariableBuilder),
8867
9498
  WorkPipeline: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.WorkPipeline),
@@ -8874,6 +9505,7 @@ __webpack_require__.d(__webpack_exports__, {
8874
9505
  clone: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.clone),
8875
9506
  combineExpressions: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.combineExpressions),
8876
9507
  combineQueryOptionsCollections: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.combineQueryOptionsCollections),
9508
+ fastHash: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.fastHash),
8877
9509
  forEach: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.forEach),
8878
9510
  getProperties: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.getProperties),
8879
9511
  hash: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.hash),
@@ -8885,10 +9517,12 @@ __webpack_require__.d(__webpack_exports__, {
8885
9517
  now: () => (/* reexport safe */ _performance__WEBPACK_IMPORTED_MODULE_5__.now),
8886
9518
  resolveBulkPersistChanges: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.resolveBulkPersistChanges),
8887
9519
  s: () => (/* reexport safe */ _schema__WEBPACK_IMPORTED_MODULE_9__.s),
9520
+ stringifyObject: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.stringifyObject),
8888
9521
  toEventArray: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.toEventArray),
8889
9522
  toExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.toExpression),
8890
9523
  toMap: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.toMap),
8891
9524
  toPromise: () => (/* reexport safe */ _results__WEBPACK_IMPORTED_MODULE_8__.toPromise),
9525
+ unsafeCast: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.unsafeCast),
8892
9526
  uuid: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.uuid),
8893
9527
  uuidv4: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.uuidv4)
8894
9528
  });
@@ -8990,6 +9624,9 @@ var __webpack_exports__SyncronousQueue = __webpack_exports__.SyncronousQueue;
8990
9624
  var __webpack_exports__TagCollection = __webpack_exports__.TagCollection;
8991
9625
  var __webpack_exports__TracingCapability = __webpack_exports__.TracingCapability;
8992
9626
  var __webpack_exports__TrampolinePipeline = __webpack_exports__.TrampolinePipeline;
9627
+ var __webpack_exports__TranslatedArrayValue = __webpack_exports__.TranslatedArrayValue;
9628
+ var __webpack_exports__TranslatedGroupValue = __webpack_exports__.TranslatedGroupValue;
9629
+ var __webpack_exports__TranslatedSingleValue = __webpack_exports__.TranslatedSingleValue;
8993
9630
  var __webpack_exports__ValueExpression = __webpack_exports__.ValueExpression;
8994
9631
  var __webpack_exports__VariableBuilder = __webpack_exports__.VariableBuilder;
8995
9632
  var __webpack_exports__WorkPipeline = __webpack_exports__.WorkPipeline;
@@ -9002,6 +9639,7 @@ var __webpack_exports__cast = __webpack_exports__.cast;
9002
9639
  var __webpack_exports__clone = __webpack_exports__.clone;
9003
9640
  var __webpack_exports__combineExpressions = __webpack_exports__.combineExpressions;
9004
9641
  var __webpack_exports__combineQueryOptionsCollections = __webpack_exports__.combineQueryOptionsCollections;
9642
+ var __webpack_exports__fastHash = __webpack_exports__.fastHash;
9005
9643
  var __webpack_exports__forEach = __webpack_exports__.forEach;
9006
9644
  var __webpack_exports__getProperties = __webpack_exports__.getProperties;
9007
9645
  var __webpack_exports__hash = __webpack_exports__.hash;
@@ -9013,12 +9651,14 @@ var __webpack_exports__noop = __webpack_exports__.noop;
9013
9651
  var __webpack_exports__now = __webpack_exports__.now;
9014
9652
  var __webpack_exports__resolveBulkPersistChanges = __webpack_exports__.resolveBulkPersistChanges;
9015
9653
  var __webpack_exports__s = __webpack_exports__.s;
9654
+ var __webpack_exports__stringifyObject = __webpack_exports__.stringifyObject;
9016
9655
  var __webpack_exports__toEventArray = __webpack_exports__.toEventArray;
9017
9656
  var __webpack_exports__toExpression = __webpack_exports__.toExpression;
9018
9657
  var __webpack_exports__toMap = __webpack_exports__.toMap;
9019
9658
  var __webpack_exports__toPromise = __webpack_exports__.toPromise;
9659
+ var __webpack_exports__unsafeCast = __webpack_exports__.unsafeCast;
9020
9660
  var __webpack_exports__uuid = __webpack_exports__.uuid;
9021
9661
  var __webpack_exports__uuidv4 = __webpack_exports__.uuidv4;
9022
- export { __webpack_exports__AndBuilder as AndBuilder, __webpack_exports__ArrayBuilder as ArrayBuilder, __webpack_exports__AssignmentBuilder as AssignmentBuilder, __webpack_exports__AsyncPipeline as AsyncPipeline, __webpack_exports__Block as Block, __webpack_exports__BulkPersistChanges as BulkPersistChanges, __webpack_exports__BulkPersistResult as BulkPersistResult, __webpack_exports__Capability as Capability, __webpack_exports__CodeBuilder as CodeBuilder, __webpack_exports__ComparatorExpression as ComparatorExpression, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EmptyExpression as EmptyExpression, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__Expression as Expression, __webpack_exports__FunctionBuilder as FunctionBuilder, __webpack_exports__FunctionFactoryBuilder as FunctionFactoryBuilder, __webpack_exports__HashType as HashType, __webpack_exports__IdSet as IdSet, __webpack_exports__IfBuilder as IfBuilder, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__MemoryDataCollection as MemoryDataCollection, __webpack_exports__NotParsableExpression as NotParsableExpression, __webpack_exports__ObjectBuilder as ObjectBuilder, __webpack_exports__OperatorExpression as OperatorExpression, __webpack_exports__OptimisticReplicationDbPlugin as OptimisticReplicationDbPlugin, __webpack_exports__PerformanceCapability as PerformanceCapability, __webpack_exports__PluginEventResult as PluginEventResult, __webpack_exports__PropertyExpression as PropertyExpression, __webpack_exports__PropertyInfo as PropertyInfo, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__RawBuilder as RawBuilder, __webpack_exports__ReadonlySchemaCollection as ReadonlySchemaCollection, __webpack_exports__ReplicationDbPlugin as ReplicationDbPlugin, __webpack_exports__Result as Result, __webpack_exports__SchemaArray as SchemaArray, __webpack_exports__SchemaBase as SchemaBase, __webpack_exports__SchemaBoolean as SchemaBoolean, __webpack_exports__SchemaCollection as SchemaCollection, __webpack_exports__SchemaComputed as SchemaComputed, __webpack_exports__SchemaDate as SchemaDate, __webpack_exports__SchemaDefault as SchemaDefault, __webpack_exports__SchemaDeserialize as SchemaDeserialize, __webpack_exports__SchemaDistinct as SchemaDistinct, __webpack_exports__SchemaError as SchemaError, __webpack_exports__SchemaFrom as SchemaFrom, __webpack_exports__SchemaFunction as SchemaFunction, __webpack_exports__SchemaIdentity as SchemaIdentity, __webpack_exports__SchemaIndex as SchemaIndex, __webpack_exports__SchemaKey as SchemaKey, __webpack_exports__SchemaNullable as SchemaNullable, __webpack_exports__SchemaNumber as SchemaNumber, __webpack_exports__SchemaObject as SchemaObject, __webpack_exports__SchemaOptional as SchemaOptional, __webpack_exports__SchemaPersistChanges as SchemaPersistChanges, __webpack_exports__SchemaPersistResult as SchemaPersistResult, __webpack_exports__SchemaReadonly as SchemaReadonly, __webpack_exports__SchemaSerialize as SchemaSerialize, __webpack_exports__SchemaString as SchemaString, __webpack_exports__SchemaTracked as SchemaTracked, __webpack_exports__SchemaTypes as SchemaTypes, __webpack_exports__SlotBlock as SlotBlock, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__StringBuilder as StringBuilder, __webpack_exports__SyncronousQueue as SyncronousQueue, __webpack_exports__TagCollection as TagCollection, __webpack_exports__TracingCapability as TracingCapability, __webpack_exports__TrampolinePipeline as TrampolinePipeline, __webpack_exports__ValueExpression as ValueExpression, __webpack_exports__VariableBuilder as VariableBuilder, __webpack_exports__WorkPipeline as WorkPipeline, __webpack_exports__assertDate as assertDate, __webpack_exports__assertInstanceOf as assertInstanceOf, __webpack_exports__assertIsArray as assertIsArray, __webpack_exports__assertIsNotNull as assertIsNotNull, __webpack_exports__assertString as assertString, __webpack_exports__cast as cast, __webpack_exports__clone as clone, __webpack_exports__combineExpressions as combineExpressions, __webpack_exports__combineQueryOptionsCollections as combineQueryOptionsCollections, __webpack_exports__forEach as forEach, __webpack_exports__getProperties as getProperties, __webpack_exports__hash as hash, __webpack_exports__isDate as isDate, __webpack_exports__isNodeRuntime as isNodeRuntime, __webpack_exports__isPropertyExpression as isPropertyExpression, __webpack_exports__measure as measure, __webpack_exports__noop as noop, __webpack_exports__now as now, __webpack_exports__resolveBulkPersistChanges as resolveBulkPersistChanges, __webpack_exports__s as s, __webpack_exports__toEventArray as toEventArray, __webpack_exports__toExpression as toExpression, __webpack_exports__toMap as toMap, __webpack_exports__toPromise as toPromise, __webpack_exports__uuid as uuid, __webpack_exports__uuidv4 as uuidv4 };
9662
+ export { __webpack_exports__AndBuilder as AndBuilder, __webpack_exports__ArrayBuilder as ArrayBuilder, __webpack_exports__AssignmentBuilder as AssignmentBuilder, __webpack_exports__AsyncPipeline as AsyncPipeline, __webpack_exports__Block as Block, __webpack_exports__BulkPersistChanges as BulkPersistChanges, __webpack_exports__BulkPersistResult as BulkPersistResult, __webpack_exports__Capability as Capability, __webpack_exports__CodeBuilder as CodeBuilder, __webpack_exports__ComparatorExpression as ComparatorExpression, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EmptyExpression as EmptyExpression, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__Expression as Expression, __webpack_exports__FunctionBuilder as FunctionBuilder, __webpack_exports__FunctionFactoryBuilder as FunctionFactoryBuilder, __webpack_exports__HashType as HashType, __webpack_exports__IdSet as IdSet, __webpack_exports__IfBuilder as IfBuilder, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__MemoryDataCollection as MemoryDataCollection, __webpack_exports__NotParsableExpression as NotParsableExpression, __webpack_exports__ObjectBuilder as ObjectBuilder, __webpack_exports__OperatorExpression as OperatorExpression, __webpack_exports__OptimisticReplicationDbPlugin as OptimisticReplicationDbPlugin, __webpack_exports__PerformanceCapability as PerformanceCapability, __webpack_exports__PluginEventResult as PluginEventResult, __webpack_exports__PropertyExpression as PropertyExpression, __webpack_exports__PropertyInfo as PropertyInfo, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__RawBuilder as RawBuilder, __webpack_exports__ReadonlySchemaCollection as ReadonlySchemaCollection, __webpack_exports__ReplicationDbPlugin as ReplicationDbPlugin, __webpack_exports__Result as Result, __webpack_exports__SchemaArray as SchemaArray, __webpack_exports__SchemaBase as SchemaBase, __webpack_exports__SchemaBoolean as SchemaBoolean, __webpack_exports__SchemaCollection as SchemaCollection, __webpack_exports__SchemaComputed as SchemaComputed, __webpack_exports__SchemaDate as SchemaDate, __webpack_exports__SchemaDefault as SchemaDefault, __webpack_exports__SchemaDeserialize as SchemaDeserialize, __webpack_exports__SchemaDistinct as SchemaDistinct, __webpack_exports__SchemaError as SchemaError, __webpack_exports__SchemaFrom as SchemaFrom, __webpack_exports__SchemaFunction as SchemaFunction, __webpack_exports__SchemaIdentity as SchemaIdentity, __webpack_exports__SchemaIndex as SchemaIndex, __webpack_exports__SchemaKey as SchemaKey, __webpack_exports__SchemaNullable as SchemaNullable, __webpack_exports__SchemaNumber as SchemaNumber, __webpack_exports__SchemaObject as SchemaObject, __webpack_exports__SchemaOptional as SchemaOptional, __webpack_exports__SchemaPersistChanges as SchemaPersistChanges, __webpack_exports__SchemaPersistResult as SchemaPersistResult, __webpack_exports__SchemaReadonly as SchemaReadonly, __webpack_exports__SchemaSerialize as SchemaSerialize, __webpack_exports__SchemaString as SchemaString, __webpack_exports__SchemaTracked as SchemaTracked, __webpack_exports__SchemaTypes as SchemaTypes, __webpack_exports__SlotBlock as SlotBlock, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__StringBuilder as StringBuilder, __webpack_exports__SyncronousQueue as SyncronousQueue, __webpack_exports__TagCollection as TagCollection, __webpack_exports__TracingCapability as TracingCapability, __webpack_exports__TrampolinePipeline as TrampolinePipeline, __webpack_exports__TranslatedArrayValue as TranslatedArrayValue, __webpack_exports__TranslatedGroupValue as TranslatedGroupValue, __webpack_exports__TranslatedSingleValue as TranslatedSingleValue, __webpack_exports__ValueExpression as ValueExpression, __webpack_exports__VariableBuilder as VariableBuilder, __webpack_exports__WorkPipeline as WorkPipeline, __webpack_exports__assertDate as assertDate, __webpack_exports__assertInstanceOf as assertInstanceOf, __webpack_exports__assertIsArray as assertIsArray, __webpack_exports__assertIsNotNull as assertIsNotNull, __webpack_exports__assertString as assertString, __webpack_exports__cast as cast, __webpack_exports__clone as clone, __webpack_exports__combineExpressions as combineExpressions, __webpack_exports__combineQueryOptionsCollections as combineQueryOptionsCollections, __webpack_exports__fastHash as fastHash, __webpack_exports__forEach as forEach, __webpack_exports__getProperties as getProperties, __webpack_exports__hash as hash, __webpack_exports__isDate as isDate, __webpack_exports__isNodeRuntime as isNodeRuntime, __webpack_exports__isPropertyExpression as isPropertyExpression, __webpack_exports__measure as measure, __webpack_exports__noop as noop, __webpack_exports__now as now, __webpack_exports__resolveBulkPersistChanges as resolveBulkPersistChanges, __webpack_exports__s as s, __webpack_exports__stringifyObject as stringifyObject, __webpack_exports__toEventArray as toEventArray, __webpack_exports__toExpression as toExpression, __webpack_exports__toMap as toMap, __webpack_exports__toPromise as toPromise, __webpack_exports__unsafeCast as unsafeCast, __webpack_exports__uuid as uuid, __webpack_exports__uuidv4 as uuidv4 };
9023
9663
 
9024
9664
  //# sourceMappingURL=index.js.map