@routier/core 0.0.6 → 0.0.7

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 (54) 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.map +1 -1
  18. package/dist/expressions/index.js +108 -19
  19. package/dist/expressions/index.js.map +1 -1
  20. package/dist/index.js +1105 -496
  21. package/dist/index.js.map +1 -1
  22. package/dist/pipeline/TrampolinePipeline.d.ts +1 -0
  23. package/dist/pipeline/index.js +71 -47
  24. package/dist/pipeline/index.js.map +1 -1
  25. package/dist/plugins/EphemeralDataPlugin.d.ts +2 -2
  26. package/dist/plugins/index.js +251 -61
  27. package/dist/plugins/index.js.map +1 -1
  28. package/dist/plugins/query/types.d.ts +5 -0
  29. package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +2 -1
  30. package/dist/plugins/replication/ReplicationDbPlugin.d.ts +2 -1
  31. package/dist/plugins/translators/DataTranslator.d.ts +3 -1
  32. package/dist/plugins/translators/JsonTranslator.d.ts +1 -0
  33. package/dist/plugins/translators/SqlTranslator.d.ts +1 -0
  34. package/dist/plugins/translators/TranslatedArrayValue.d.ts +6 -0
  35. package/dist/plugins/translators/TranslatedGroupValue.d.ts +6 -0
  36. package/dist/plugins/translators/TranslatedSingleValue.d.ts +6 -0
  37. package/dist/plugins/translators/index.d.ts +4 -0
  38. package/dist/plugins/translators/types.d.ts +10 -0
  39. package/dist/plugins/types.d.ts +2 -1
  40. package/dist/schema/PropertyInfo.d.ts +6 -1
  41. package/dist/schema/SchemaDefinition.d.ts +1 -1
  42. package/dist/schema/communication/broadcast.d.ts +3 -3
  43. package/dist/schema/index.js +504 -73
  44. package/dist/schema/index.js.map +1 -1
  45. package/dist/schema/property/modifiers/SchemaTracked.d.ts +3 -1
  46. package/dist/schema/table/SchemaComputed.d.ts +1 -1
  47. package/dist/schema/testSchemas.test.d.ts +60 -36
  48. package/dist/schema/types.d.ts +16 -1
  49. package/dist/utilities/index.js +145 -2
  50. package/dist/utilities/index.js.map +1 -1
  51. package/dist/utilities/strings.d.ts +34 -0
  52. package/dist/utilities/strings.test.d.ts +1 -0
  53. package/package.json +1 -1
  54. 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") {
123
105
  return false;
124
106
  }
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]";
107
+ if (descriptor.value == null) {
108
+ return false;
109
+ }
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
  }
@@ -4172,8 +4252,29 @@ function assertIsValueExpression(value) {
4172
4252
  }
4173
4253
  }
4174
4254
  // 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;
4255
+ const isPropertyPath = (value, params) => {
4256
+ // Check for dot notation (e.g., entity.name)
4257
+ if (value.includes('.') && value.match(/^[a-zA-Z0-9_.]+$/) !== null) {
4258
+ return true;
4259
+ }
4260
+ // Check for bracket notation with literal strings (e.g., entity["name"], entity['name'], or entity[\"name\"] with escaped quotes)
4261
+ const literalBracketPattern = /^[a-zA-Z_$][a-zA-Z0-9_$]*(\[\\?["'][^"']+\\?["']\])+$/;
4262
+ if (literalBracketPattern.test(value)) {
4263
+ return true;
4264
+ }
4265
+ // Check for bracket notation with parameter paths (e.g., entity[p.name], entity[params.property])
4266
+ if (params && value.includes('[') && value.includes(']')) {
4267
+ const bracketMatch = value.match(/\[([^\]]+)\]/);
4268
+ if (bracketMatch) {
4269
+ const bracketContent = bracketMatch[1].trim();
4270
+ // Check if it's a parameter path - should start with params.name followed by dot, or be just params.name
4271
+ const isParamPath = bracketContent.startsWith(params.name + '.') || bracketContent === params.name;
4272
+ if (isParamPath || (bracketContent.includes('.') && bracketContent.match(PARAM_PATH_REGEX))) {
4273
+ return true;
4274
+ }
4275
+ }
4276
+ }
4277
+ return false;
4177
4278
  };
4178
4279
  // Helper function to determine if we need to swap the operator for reversed comparisons
4179
4280
  const getSwappedOperator = (operator) => {
@@ -4208,7 +4309,7 @@ const parseCondition = (schema, expression, params) => {
4208
4309
  // This is a parameter path on the left side (e.g., params.distinctPlayers.includes(entity.playerId))
4209
4310
  // For includes method, we need to swap left and right sides
4210
4311
  if (methodMatch[2] === 'includes') {
4211
- const property = getProperty(schema, rightSide);
4312
+ const property = getProperty(schema, rightSide, params);
4212
4313
  const value = getValue(leftSide, params); // retrieve the original value
4213
4314
  const serializer = property.property.valueSerializer;
4214
4315
  comparator.left = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
@@ -4221,7 +4322,7 @@ const parseCondition = (schema, expression, params) => {
4221
4322
  }
4222
4323
  else {
4223
4324
  // Normal case: property on left, value on right
4224
- const property = getProperty(schema, leftSide);
4325
+ const property = getProperty(schema, leftSide, params);
4225
4326
  const serializer = property.property.valueSerializer;
4226
4327
  const value = getValue(rightSide, params); // retrieve the original value
4227
4328
  comparator.left = property;
@@ -4240,7 +4341,7 @@ const parseCondition = (schema, expression, params) => {
4240
4341
  if (isNegation) {
4241
4342
  comparator.negated = isNegation;
4242
4343
  }
4243
- const property = getProperty(schema, valueTransformMatch[1].trim());
4344
+ const property = getProperty(schema, valueTransformMatch[1].trim(), params);
4244
4345
  const serializer = property.property.valueSerializer;
4245
4346
  const value = getValue(valueTransformMatch[3], params); // retrieve the original value
4246
4347
  // Create the property expression for the left side (no transformer)
@@ -4272,7 +4373,7 @@ const parseCondition = (schema, expression, params) => {
4272
4373
  comparator.negated = isNegation;
4273
4374
  }
4274
4375
  // Create the property expression for the left side with transformer
4275
- const property = getProperty(schema, transformMethodMatch[1]);
4376
+ const property = getProperty(schema, transformMethodMatch[1], params);
4276
4377
  // Set transformer and locale based on the method
4277
4378
  const method = transformMethodMatch[2];
4278
4379
  if (method === 'toLowerCase' || method === 'toLocaleLowerCase') {
@@ -4324,8 +4425,8 @@ const parseCondition = (schema, expression, params) => {
4324
4425
  const left = equalityMatch[1].trim();
4325
4426
  const operator = equalityMatch[2];
4326
4427
  const right = equalityMatch[3].trim();
4327
- const leftIsProperty = isPropertyPath(left);
4328
- const rightIsProperty = isPropertyPath(right);
4428
+ const leftIsProperty = isPropertyPath(left, params);
4429
+ const rightIsProperty = isPropertyPath(right, params);
4329
4430
  // Determine which side is the property and which is the value
4330
4431
  let propertySide, valueSide, finalOperator;
4331
4432
  if (leftIsProperty && !rightIsProperty) {
@@ -4350,7 +4451,7 @@ const parseCondition = (schema, expression, params) => {
4350
4451
  if (isNegation) {
4351
4452
  comparator.negated = isNegation;
4352
4453
  }
4353
- const property = getProperty(schema, propertySide);
4454
+ const property = getProperty(schema, propertySide, params);
4354
4455
  const value = getValue(valueSide, params);
4355
4456
  const serializer = property.property.valueSerializer;
4356
4457
  comparator.left = property;
@@ -4362,8 +4463,8 @@ const parseCondition = (schema, expression, params) => {
4362
4463
  const left = comparisonMatch[1].trim();
4363
4464
  const operator = comparisonMatch[2];
4364
4465
  const right = comparisonMatch[3].trim();
4365
- const leftIsProperty = isPropertyPath(left);
4366
- const rightIsProperty = isPropertyPath(right);
4466
+ const leftIsProperty = isPropertyPath(left, params);
4467
+ const rightIsProperty = isPropertyPath(right, params);
4367
4468
  // Determine which side is the property and which is the value
4368
4469
  let propertySide, valueSide, finalOperator;
4369
4470
  if (leftIsProperty && !rightIsProperty) {
@@ -4388,7 +4489,7 @@ const parseCondition = (schema, expression, params) => {
4388
4489
  if (isNegation) {
4389
4490
  comparator.negated = isNegation;
4390
4491
  }
4391
- const property = getProperty(schema, propertySide);
4492
+ const property = getProperty(schema, propertySide, params);
4392
4493
  const value = getValue(valueSide, params);
4393
4494
  const serializer = property.property.valueSerializer;
4394
4495
  comparator.left = property;
@@ -4399,12 +4500,12 @@ const parseCondition = (schema, expression, params) => {
4399
4500
  // Check for standalone property reference (truthy comparison)
4400
4501
  // Pattern: property name only (e.g., "w.inStock" -> w.inStock === true)
4401
4502
  const standalonePropertyMatch = finalExpression.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$/);
4402
- if (standalonePropertyMatch && isPropertyPath(finalExpression)) {
4503
+ if (standalonePropertyMatch && isPropertyPath(finalExpression, params)) {
4403
4504
  const comparator = getComparator('===');
4404
4505
  if (isNegation) {
4405
4506
  comparator.negated = isNegation;
4406
4507
  }
4407
- const property = getProperty(schema, finalExpression);
4508
+ const property = getProperty(schema, finalExpression, params);
4408
4509
  const value = getValue('true', params);
4409
4510
  const serializer = property.property.valueSerializer;
4410
4511
  comparator.left = property;
@@ -4503,13 +4604,81 @@ const getValueFromParams = (value, params) => {
4503
4604
  }
4504
4605
  return result;
4505
4606
  };
4506
- const getProperty = (schema, value) => {
4507
- // Optimized string splitting - only split if we have the expected pattern
4508
- if (!value.includes('.')) {
4607
+ const getProperty = (schema, value, params) => {
4608
+ let pathString;
4609
+ // Handle bracket notation (e.g., entity["name"], entity['name'], entity[p.name], or entity[\"name\"] with escaped quotes)
4610
+ if (value.includes('[') && value.includes(']')) {
4611
+ // First try to match literal string brackets: ["name"], ['name'], [\"name\"], [\'name\']
4612
+ const literalBracketMatches = value.matchAll(/\[\\?["']([^"']+)\\?["']\]/g);
4613
+ const pathParts = [];
4614
+ let foundLiteral = false;
4615
+ for (const match of literalBracketMatches) {
4616
+ // match[1] is the property name inside the brackets
4617
+ const propName = match[1];
4618
+ if (propName) {
4619
+ pathParts.push(propName);
4620
+ foundLiteral = true;
4621
+ }
4622
+ }
4623
+ // If no literal matches found, try parameter path in brackets (e.g., [p.name])
4624
+ if (!foundLiteral && params) {
4625
+ // Match brackets containing parameter paths: [p.name], [params.property], etc.
4626
+ const bracketParamMatch = value.match(/\[([^\]]+)\]/);
4627
+ if (bracketParamMatch) {
4628
+ const bracketContent = bracketParamMatch[1].trim();
4629
+ // Check if this is a parameter path
4630
+ // It should start with params.name (e.g., "p") followed by a dot, or be just params.name
4631
+ const isParamPath = bracketContent.startsWith(params.name + '.') || bracketContent === params.name;
4632
+ if (isParamPath || (bracketContent.includes('.') && bracketContent.match(PARAM_PATH_REGEX))) {
4633
+ try {
4634
+ // Try to resolve as a parameter path
4635
+ let paramPath;
4636
+ if (bracketContent.startsWith(params.name + '.') || bracketContent === params.name) {
4637
+ // Already has params.name prefix
4638
+ paramPath = bracketContent;
4639
+ }
4640
+ else {
4641
+ // Add params.name prefix
4642
+ const paramMatch = bracketContent.match(PARAM_PATH_REGEX);
4643
+ paramPath = paramMatch
4644
+ ? `${params.name}.${paramMatch[1]}`
4645
+ : `${params.name}.${bracketContent}`;
4646
+ }
4647
+ const resolvedValue = getValueFromParams(paramPath, params);
4648
+ // The resolved value should be the property name
4649
+ if (typeof resolvedValue === 'string') {
4650
+ pathParts.push(resolvedValue);
4651
+ }
4652
+ else {
4653
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4654
+ }
4655
+ }
4656
+ catch (e) {
4657
+ // Not a valid parameter path, continue to error
4658
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4659
+ }
4660
+ }
4661
+ else {
4662
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4663
+ }
4664
+ }
4665
+ else {
4666
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4667
+ }
4668
+ }
4669
+ if (pathParts.length === 0) {
4670
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4671
+ }
4672
+ pathString = pathParts.join(".");
4673
+ }
4674
+ else if (value.includes('.')) {
4675
+ // Handle dot notation (e.g., entity.name)
4676
+ const pathSplit = value.split(/[?!.]/g).slice(1);
4677
+ pathString = pathSplit.join(".");
4678
+ }
4679
+ else {
4509
4680
  throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
4510
4681
  }
4511
- const pathSplit = value.split(/[?!.]/g).slice(1);
4512
- const pathString = pathSplit.join(".");
4513
4682
  // Early exit if no path found
4514
4683
  if (!pathString) {
4515
4684
  throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
@@ -4874,8 +5043,8 @@ class TrampolinePipeline {
4874
5043
  this._hasErrored = true;
4875
5044
  }
4876
5045
  currentStep = null; // Stop the loop
4877
- // Call done with the error to properly notify the caller
4878
- queueMicrotask(() => done(currentData, trampolineError));
5046
+ // We don't call `done` here because an error occurred.
5047
+ // The application should handle the uncaught exception if desired.
4879
5048
  break; // Explicitly break loop on error
4880
5049
  }
4881
5050
  }
@@ -5002,8 +5171,8 @@ class AsyncPipeline {
5002
5171
  this._hasErrored = true;
5003
5172
  }
5004
5173
  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)));
5174
+ // We don't call `done` here because an error occurred.
5175
+ // The application should handle the uncaught exception if desired.
5007
5176
  break; // Explicitly break loop on error
5008
5177
  }
5009
5178
  }
@@ -5037,88 +5206,112 @@ class AsyncPipeline {
5037
5206
  */
5038
5207
  class WorkPipeline {
5039
5208
  unitsOfWork = [];
5209
+ _hasErrored = false; // Flag to prevent calling done on error
5040
5210
  filter(done) {
5041
- const units = this.unitsOfWork;
5042
- const unitsLength = units.length;
5043
- // Fast path for empty pipeline
5044
- if (unitsLength === 0) {
5211
+ this._hasErrored = false; // Reset error flag on new execution
5212
+ if (this.unitsOfWork.length === 0) {
5045
5213
  queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5046
5214
  return;
5047
5215
  }
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;
5216
+ let index = 0;
5217
+ let isRunning = false; // Guard against overlapping trampoline calls
5062
5218
  try {
5063
- const createStep = (idx) => {
5219
+ // --- Revised Completion Logic --- (Moved up for clarity)
5220
+ const finalStepSentinel = () => {
5221
+ // Only call done if no error has occurred
5222
+ if (!this._hasErrored) {
5223
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5224
+ }
5225
+ return null; // Stop the trampoline
5226
+ };
5227
+ const createStepRevised = (idx) => {
5064
5228
  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;
5229
+ if (this._hasErrored)
5230
+ return null; // Stop if an error occurred elsewhere
5231
+ if (idx >= this.unitsOfWork.length) {
5232
+ return finalStepSentinel(); // Execute the dedicated final step
5072
5233
  }
5073
- const processor = units[idx];
5074
- let syncResult = null;
5234
+ const processor = this.unitsOfWork[idx];
5235
+ // Initialize syncCallbackResult to null to satisfy StepResult type
5236
+ let syncCallbackResult = null;
5075
5237
  let calledSync = false;
5076
5238
  try {
5077
5239
  processor((result) => {
5240
+ // --- Error Handling ---
5078
5241
  if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
5079
- hasErrored = true;
5242
+ console.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
5243
+ this._hasErrored = true; // Set flag
5244
+ // Throw the error to be caught by outer try...catch blocks
5080
5245
  throw result.error;
5081
5246
  }
5082
- const nextStep = createStep(idx + 1);
5247
+ // --- /Error Handling ---
5248
+ // If no error, proceed as before
5249
+ index = idx + 1; // Update index for the next step
5250
+ const nextStep = createStepRevised(index); // Use updated index
5083
5251
  if (isRunning) {
5084
- syncResult = nextStep;
5252
+ // Callback was synchronous
5253
+ syncCallbackResult = nextStep; // Store next step function
5085
5254
  calledSync = true;
5086
5255
  }
5087
5256
  else {
5257
+ // Callback was asynchronous, restart trampoline
5088
5258
  trampoline(nextStep);
5089
5259
  }
5090
5260
  });
5091
5261
  }
5092
5262
  catch (error) {
5093
- hasErrored = true;
5263
+ if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
5264
+ console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
5265
+ this._hasErrored = true;
5266
+ }
5267
+ // Rethrow to be caught by the trampoline's catch block
5094
5268
  throw error;
5095
5269
  }
5096
- return calledSync ? syncResult : null;
5270
+ if (calledSync) {
5271
+ // Return the next step function for the sync loop
5272
+ return syncCallbackResult;
5273
+ }
5274
+ else {
5275
+ // Pause trampoline for async, loop will stop as step returns null
5276
+ return null;
5277
+ }
5097
5278
  };
5098
5279
  };
5280
+ // The trampoline loop
5099
5281
  const trampoline = (step) => {
5100
- if (isRunning)
5282
+ if (isRunning) {
5101
5283
  return;
5284
+ }
5102
5285
  isRunning = true;
5103
5286
  let currentStep = step;
5104
- while (currentStep) {
5287
+ while (typeof currentStep === 'function') {
5105
5288
  try {
5106
- if (hasErrored) {
5289
+ // Stop immediately if an error was flagged elsewhere
5290
+ if (this._hasErrored) {
5107
5291
  currentStep = null;
5108
5292
  break;
5109
5293
  }
5110
- currentStep = currentStep();
5294
+ currentStep = currentStep(); // Execute step, get next step or null
5111
5295
  }
5112
- catch (error) {
5113
- hasErrored = true;
5114
- currentStep = null;
5115
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error)));
5116
- break;
5296
+ catch (trampolineError) {
5297
+ // Catch errors propagated from step execution (processor or callback errors)
5298
+ if (!this._hasErrored) { // Avoid double logging
5299
+ console.error("Error during trampoline step execution:", trampolineError);
5300
+ this._hasErrored = true;
5301
+ }
5302
+ currentStep = null; // Stop the loop
5303
+ // We don't call `done` here because an error occurred.
5304
+ // The application should handle the uncaught exception if desired.
5305
+ break; // Explicitly break loop on error
5117
5306
  }
5118
5307
  }
5308
+ // Loop ends when currentStep is null or loop is broken by error
5119
5309
  isRunning = false;
5310
+ // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.
5120
5311
  };
5121
- trampoline(createStep(0));
5312
+ // --- Start the process ---
5313
+ index = 0; // Reset index
5314
+ trampoline(createStepRevised(0)); // Start with the revised step creator
5122
5315
  }
5123
5316
  catch (error) {
5124
5317
  done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
@@ -5229,6 +5422,7 @@ class EphemeralDataPlugin {
5229
5422
  }
5230
5423
  });
5231
5424
  }
5425
+ // If there is no work, just return the result
5232
5426
  if (!hasWork) {
5233
5427
  done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, bulkPersistResult));
5234
5428
  return;
@@ -5288,7 +5482,10 @@ __webpack_require__.d(__webpack_exports__, {
5288
5482
  QueryOptionsCollection: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOptionsCollection),
5289
5483
  QueryOrdering: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOrdering),
5290
5484
  ReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_1__.ReplicationDbPlugin),
5291
- SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator)
5485
+ SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator),
5486
+ TranslatedArrayValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedArrayValue),
5487
+ TranslatedGroupValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedGroupValue),
5488
+ TranslatedSingleValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedSingleValue)
5292
5489
  });
5293
5490
  /* ESM import */var _translators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./translators */ "./src/plugins/translators/index.ts");
5294
5491
  /* ESM import */var _replication__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./replication */ "./src/plugins/replication/index.ts");
@@ -5555,9 +5752,6 @@ const getMemoryPluginCollectionSize = (plugin, schema) => {
5555
5752
  }
5556
5753
  throw new Error("Cannot get size of collection for MemoryPlugin, not an instance of MemoryPlugin");
5557
5754
  };
5558
- const HYDRATION_STATUS_PENDING = "hydration-pending";
5559
- const HYDRATION_STATUS_ERROR = "hydration-error";
5560
- const HYDRATION_STATUS_SUCCESS = "hydration-success";
5561
5755
  let hydrationStatus = "hydration-not-started";
5562
5756
  class OptimisticReplicationDbPlugin {
5563
5757
  plugins;
@@ -5877,6 +6071,12 @@ __webpack_require__.r(__webpack_exports__);
5877
6071
  __webpack_require__.d(__webpack_exports__, {
5878
6072
  DataTranslator: () => (DataTranslator)
5879
6073
  });
6074
+ /* ESM import */var _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TranslatedArrayValue */ "./src/plugins/translators/TranslatedArrayValue.ts");
6075
+ /* ESM import */var _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TranslatedGroupValue */ "./src/plugins/translators/TranslatedGroupValue.ts");
6076
+ /* ESM import */var _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TranslatedSingleValue */ "./src/plugins/translators/TranslatedSingleValue.ts");
6077
+
6078
+
6079
+
5880
6080
  class DataTranslator {
5881
6081
  query;
5882
6082
  functionMap = {
@@ -5889,7 +6089,8 @@ class DataTranslator {
5889
6089
  skip: (data, option) => this.skip(data, option),
5890
6090
  sort: (data, option) => this.sort(data, option),
5891
6091
  sum: (data, option) => this.sum(data, option),
5892
- take: (data, option) => this.take(data, option)
6092
+ take: (data, option) => this.take(data, option),
6093
+ group: (data, option) => this.group(data, option)
5893
6094
  };
5894
6095
  constructor(query) {
5895
6096
  this.query = query;
@@ -5898,7 +6099,13 @@ class DataTranslator {
5898
6099
  this.query.options.forEach(item => {
5899
6100
  data = this.functionMap[item.name](data, item);
5900
6101
  });
5901
- return data;
6102
+ if (Array.isArray(data)) {
6103
+ return new _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_0__.TranslatedArrayValue(data);
6104
+ }
6105
+ if (this.query.options.has("group")) {
6106
+ return new _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_1__.TranslatedGroupValue(data);
6107
+ }
6108
+ return new _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_2__.TranslatedSingleValue(data);
5902
6109
  }
5903
6110
  }
5904
6111
 
@@ -5937,24 +6144,54 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
5937
6144
  if (Array.isArray(data) == false) {
5938
6145
  throw new Error("Can only map an array of data");
5939
6146
  }
5940
- const response = [];
5941
- // We want deserialization to flow through mappings
5942
- // TODO: Speed this up!
5943
- // Generate a function on the fly?
6147
+ const response = new Array(data.length);
5944
6148
  for (let i = 0, length = data.length; i < length; i++) {
5945
6149
  for (let j = 0, l = option.value.fields.length; j < l; j++) {
5946
6150
  const field = option.value.fields[j];
5947
6151
  if (field.property != null) {
5948
6152
  const value = field.property.getValue(data[i]);
5949
6153
  if (value != null) {
5950
- field.property.setValue(data[i], field.property.deserialize(value));
6154
+ // Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value
6155
+ const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;
6156
+ field.property.setValue(data[i], resolvedValue);
5951
6157
  }
5952
6158
  }
5953
6159
  }
5954
- response.push(option.value.selector(data[i]));
6160
+ response[i] = option.value.selector(data[i]);
5955
6161
  }
5956
6162
  return response;
5957
6163
  }
6164
+ group(data, option) {
6165
+ if (Array.isArray(data) == false) {
6166
+ throw new Error("Can only group an array of data");
6167
+ }
6168
+ const group = {};
6169
+ for (let i = 0, length = data.length; i < length; i++) {
6170
+ const keyValue = option.value.selector(data[i]);
6171
+ if (!group[keyValue]) {
6172
+ group[keyValue] = [];
6173
+ }
6174
+ const item = {};
6175
+ for (let j = 0, l = option.value.fields.length; j < l; j++) {
6176
+ const field = option.value.fields[j];
6177
+ if (field.property != null) {
6178
+ const value = field.property.getValue(data[i]);
6179
+ if (value != null) {
6180
+ // Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value
6181
+ const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;
6182
+ field.property.setValue(item, resolvedValue);
6183
+ continue;
6184
+ }
6185
+ // The property exists, lets set it to the value (null/undefined)
6186
+ if (Object.hasOwn(data[i], field.destinationName)) {
6187
+ field.property.setValue(item, value);
6188
+ }
6189
+ }
6190
+ }
6191
+ group[keyValue].push(item);
6192
+ }
6193
+ return group;
6194
+ }
5958
6195
  count(data, _) {
5959
6196
  if (Array.isArray(data)) {
5960
6197
  return data.length;
@@ -6115,6 +6352,30 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
6115
6352
  sort(data, _) {
6116
6353
  return data;
6117
6354
  }
6355
+ group(data, option) {
6356
+ if (Array.isArray(data) == false) {
6357
+ throw new Error("Can only group an array of data");
6358
+ }
6359
+ const group = {};
6360
+ for (let i = 0, length = data.length; i < length; i++) {
6361
+ const keyValue = option.value.selector(data[i]);
6362
+ if (!group[keyValue]) {
6363
+ group[keyValue] = [];
6364
+ }
6365
+ const item = {};
6366
+ for (let j = 0, l = option.value.fields.length; j < l; j++) {
6367
+ const field = option.value.fields[j];
6368
+ if (field.property != null) {
6369
+ const value = field.property.getValue(data[i]);
6370
+ if (value != null) {
6371
+ field.property.setValue(item, field.property.deserialize(value));
6372
+ }
6373
+ }
6374
+ }
6375
+ group[keyValue].push(item);
6376
+ }
6377
+ return group;
6378
+ }
6118
6379
  map(data, option) {
6119
6380
  if (Array.isArray(data) == false) {
6120
6381
  throw new Error("Can only map an array of data");
@@ -6142,6 +6403,91 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
6142
6403
  }
6143
6404
 
6144
6405
 
6406
+ }),
6407
+ "./src/plugins/translators/TranslatedArrayValue.ts":
6408
+ /*!*********************************************************!*\
6409
+ !*** ./src/plugins/translators/TranslatedArrayValue.ts ***!
6410
+ \*********************************************************/
6411
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6412
+ __webpack_require__.r(__webpack_exports__);
6413
+ __webpack_require__.d(__webpack_exports__, {
6414
+ TranslatedArrayValue: () => (TranslatedArrayValue)
6415
+ });
6416
+ class TranslatedArrayValue {
6417
+ value;
6418
+ constructor(value) {
6419
+ this.value = value;
6420
+ }
6421
+ forEach(callback) {
6422
+ const data = this.value;
6423
+ for (let i = 0, length = data.length; i < length; i++) {
6424
+ const result = callback(data[i]);
6425
+ if (result) {
6426
+ // reassign if the callback returns a result
6427
+ data[i] = result;
6428
+ }
6429
+ }
6430
+ }
6431
+ }
6432
+
6433
+
6434
+ }),
6435
+ "./src/plugins/translators/TranslatedGroupValue.ts":
6436
+ /*!*********************************************************!*\
6437
+ !*** ./src/plugins/translators/TranslatedGroupValue.ts ***!
6438
+ \*********************************************************/
6439
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6440
+ __webpack_require__.r(__webpack_exports__);
6441
+ __webpack_require__.d(__webpack_exports__, {
6442
+ TranslatedGroupValue: () => (TranslatedGroupValue)
6443
+ });
6444
+ class TranslatedGroupValue {
6445
+ value;
6446
+ constructor(value) {
6447
+ this.value = value;
6448
+ }
6449
+ forEach(callback) {
6450
+ const group = this.value;
6451
+ const keys = Object.keys(group);
6452
+ for (let i = 0, length = keys.length; i < length; i++) {
6453
+ const key = keys[i];
6454
+ const data = group[key];
6455
+ for (let j = 0, len = data.length; j < len; j++) {
6456
+ const result = callback(data[j]);
6457
+ if (result) {
6458
+ // reassign if the callback returns a result
6459
+ data[j] = result;
6460
+ }
6461
+ }
6462
+ }
6463
+ }
6464
+ }
6465
+
6466
+
6467
+ }),
6468
+ "./src/plugins/translators/TranslatedSingleValue.ts":
6469
+ /*!**********************************************************!*\
6470
+ !*** ./src/plugins/translators/TranslatedSingleValue.ts ***!
6471
+ \**********************************************************/
6472
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6473
+ __webpack_require__.r(__webpack_exports__);
6474
+ __webpack_require__.d(__webpack_exports__, {
6475
+ TranslatedSingleValue: () => (TranslatedSingleValue)
6476
+ });
6477
+ class TranslatedSingleValue {
6478
+ value;
6479
+ constructor(value) {
6480
+ this.value = value;
6481
+ }
6482
+ forEach(callback) {
6483
+ const result = callback(this.value);
6484
+ if (result) {
6485
+ this.value = result;
6486
+ }
6487
+ }
6488
+ }
6489
+
6490
+
6145
6491
  }),
6146
6492
  "./src/plugins/translators/index.ts":
6147
6493
  /*!******************************************!*\
@@ -6152,11 +6498,21 @@ __webpack_require__.r(__webpack_exports__);
6152
6498
  __webpack_require__.d(__webpack_exports__, {
6153
6499
  DataTranslator: () => (/* reexport safe */ _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTranslator),
6154
6500
  JsonTranslator: () => (/* reexport safe */ _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__.JsonTranslator),
6155
- SqlTranslator: () => (/* reexport safe */ _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__.SqlTranslator)
6501
+ SqlTranslator: () => (/* reexport safe */ _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__.SqlTranslator),
6502
+ TranslatedArrayValue: () => (/* reexport safe */ _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_3__.TranslatedArrayValue),
6503
+ TranslatedGroupValue: () => (/* reexport safe */ _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_4__.TranslatedGroupValue),
6504
+ TranslatedSingleValue: () => (/* reexport safe */ _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_5__.TranslatedSingleValue)
6156
6505
  });
6157
6506
  /* ESM import */var _DataTranslator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DataTranslator */ "./src/plugins/translators/DataTranslator.ts");
6158
6507
  /* ESM import */var _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JsonTranslator */ "./src/plugins/translators/JsonTranslator.ts");
6159
6508
  /* ESM import */var _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SqlTranslator */ "./src/plugins/translators/SqlTranslator.ts");
6509
+ /* ESM import */var _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TranslatedArrayValue */ "./src/plugins/translators/TranslatedArrayValue.ts");
6510
+ /* ESM import */var _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TranslatedGroupValue */ "./src/plugins/translators/TranslatedGroupValue.ts");
6511
+ /* ESM import */var _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TranslatedSingleValue */ "./src/plugins/translators/TranslatedSingleValue.ts");
6512
+
6513
+
6514
+
6515
+
6160
6516
 
6161
6517
 
6162
6518
 
@@ -6303,10 +6659,16 @@ __webpack_require__.r(__webpack_exports__);
6303
6659
  __webpack_require__.d(__webpack_exports__, {
6304
6660
  PropertyInfo: () => (PropertyInfo)
6305
6661
  });
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");
6662
+ /* ESM import */var _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./property/types/SchemaArray */ "./src/schema/property/types/SchemaArray.ts");
6663
+ /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/schema/types.ts");
6308
6664
 
6309
6665
 
6666
+ const SUPPORTED_DESERIALIZATION_TYPES = new Set([
6667
+ _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Boolean,
6668
+ _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Date,
6669
+ _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Number,
6670
+ _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.String,
6671
+ ]);
6310
6672
  /**
6311
6673
  * Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.
6312
6674
  */
@@ -6372,7 +6734,7 @@ class PropertyInfo {
6372
6734
  this.name = name;
6373
6735
  this.type = schema.type;
6374
6736
  this.literals = schema.literals;
6375
- if (schema instanceof _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_0__.SchemaArray) {
6737
+ if (schema instanceof _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_1__.SchemaArray) {
6376
6738
  this.innerSchema = schema.innerSchema;
6377
6739
  }
6378
6740
  this.isNullable = schema.isNullable;
@@ -6416,6 +6778,12 @@ class PropertyInfo {
6416
6778
  this._levelCache = level;
6417
6779
  return level;
6418
6780
  }
6781
+ get isRenamed() {
6782
+ return !!this.from;
6783
+ }
6784
+ get supportsDeserialization() {
6785
+ return this.valueDeserializer != null || SUPPORTED_DESERIALIZATION_TYPES.has(this.type);
6786
+ }
6419
6787
  _getPropertyChain() {
6420
6788
  if (this._propertyChainCache) {
6421
6789
  return this._propertyChainCache;
@@ -6445,6 +6813,9 @@ class PropertyInfo {
6445
6813
  }
6446
6814
  return path;
6447
6815
  }
6816
+ getResolvedName() {
6817
+ return this.from ?? this.name;
6818
+ }
6448
6819
  /**
6449
6820
  * Returns an array of property names representing the path from the root to this property.
6450
6821
  *
@@ -6529,12 +6900,17 @@ class PropertyInfo {
6529
6900
  return null;
6530
6901
  }
6531
6902
  const pathArray = this.getPathArray();
6903
+ const length = pathArray.length;
6904
+ // Fast path for single level properties
6905
+ if (length === 1) {
6906
+ return instance[pathArray[0]];
6907
+ }
6532
6908
  let current = instance;
6533
- for (const prop of pathArray) {
6909
+ for (let i = 0; i < length; i++) {
6534
6910
  if (current == null) {
6535
6911
  return null;
6536
6912
  }
6537
- current = current[prop];
6913
+ current = current[pathArray[i]];
6538
6914
  }
6539
6915
  return current;
6540
6916
  }
@@ -6581,8 +6957,8 @@ class PropertyInfo {
6581
6957
  getSelectrorPath(options) {
6582
6958
  const parts = this._resolvePathArray({
6583
6959
  root: options.parent,
6584
- assignmentType: options.assignmentType,
6585
- useFromPropertyName: options.useFromPropertyName
6960
+ assignmentType: options?.assignmentType,
6961
+ useFromPropertyName: options?.useFromPropertyName
6586
6962
  });
6587
6963
  return parts.join("");
6588
6964
  }
@@ -6607,16 +6983,16 @@ class PropertyInfo {
6607
6983
  if (this.valueDeserializer != null) {
6608
6984
  return this.valueDeserializer(value);
6609
6985
  }
6610
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
6986
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Date) {
6611
6987
  return new Date(value);
6612
6988
  }
6613
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.String) {
6989
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.String) {
6614
6990
  return String(value);
6615
6991
  }
6616
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Number) {
6992
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Number) {
6617
6993
  return Number(value);
6618
6994
  }
6619
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Boolean) {
6995
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Boolean) {
6620
6996
  return Boolean(value);
6621
6997
  }
6622
6998
  throw new Error(`Unsupported deserialization for type. Type: ${this.type}`);
@@ -6638,7 +7014,7 @@ __webpack_require__.d(__webpack_exports__, {
6638
7014
  /* ESM import */var _table_SchemaComputed__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./table/SchemaComputed */ "./src/schema/table/SchemaComputed.ts");
6639
7015
  /* ESM import */var _property_base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./property/base/SchemaBase */ "./src/schema/property/base/SchemaBase.ts");
6640
7016
  /* 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");
7017
+ /* ESM import */var _codegen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../codegen */ "./src/codegen/blocks.ts");
6642
7018
  /* ESM import */var _codegen_handlers_EnrichmentHandlerBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../codegen/handlers/EnrichmentHandlerBuilder */ "./src/codegen/handlers/EnrichmentHandlerBuilder.ts");
6643
7019
  /* ESM import */var _codegen_handlers_MergeHandlerBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../codegen/handlers/MergeHandlerBuilder */ "./src/codegen/handlers/MergeHandlerBuilder.ts");
6644
7020
  /* ESM import */var _codegen_handlers_PrepareHandlerBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../codegen/handlers/PrepareHandlerBuilder */ "./src/codegen/handlers/PrepareHandlerBuilder.ts");
@@ -6651,11 +7027,13 @@ __webpack_require__.d(__webpack_exports__, {
6651
7027
  /* ESM import */var _codegen_handlers_HashHandlerBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../codegen/handlers/HashHandlerBuilder */ "./src/codegen/handlers/HashHandlerBuilder.ts");
6652
7028
  /* ESM import */var _codegen_handlers_EnableChangeTrackingHandlerBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../codegen/handlers/EnableChangeTrackingHandlerBuilder */ "./src/codegen/handlers/EnableChangeTrackingHandlerBuilder.ts");
6653
7029
  /* 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");
7030
+ /* ESM import */var _errors_SchemaError__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../errors/SchemaError */ "./src/errors/SchemaError.ts");
6655
7031
  /* 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");
7032
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../utilities */ "./src/utilities/strings.ts");
6657
7033
  /* 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");
7034
+ /* ESM import */var _communication_broadcast__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./communication/broadcast */ "./src/schema/communication/broadcast.ts");
7035
+ /* ESM import */var _codegen_handlers_CompareIdsHandlerBuilder__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../codegen/handlers/CompareIdsHandlerBuilder */ "./src/codegen/handlers/CompareIdsHandlerBuilder.ts");
7036
+
6659
7037
 
6660
7038
 
6661
7039
 
@@ -6840,6 +7218,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6840
7218
  const enableChangeTrackingHandlerBuilder = new _codegen_handlers_EnableChangeTrackingHandlerBuilder__WEBPACK_IMPORTED_MODULE_15__.EnableChangeTrackingHandlerBuilder();
6841
7219
  const freezeHandlerBuilder = new _codegen_handlers_FreezeHandlerBuilder__WEBPACK_IMPORTED_MODULE_16__.FreezeHandlerBuilder();
6842
7220
  const serializeHandlerBuilder = new _codegen_handlers_SerializeHandlerBuilder__WEBPACK_IMPORTED_MODULE_17__.SerializeHandlerBuilder();
7221
+ const compareIdsHandlerBuilder = new _codegen_handlers_CompareIdsHandlerBuilder__WEBPACK_IMPORTED_MODULE_18__.CompareIdsHandlerBuilder();
6843
7222
  const enricher = enrichmentHandlerBuilder.build();
6844
7223
  const merge = mergeHandlerFactory.build();
6845
7224
  const prepare = prepareHandlerBuilder.build();
@@ -6853,26 +7232,36 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6853
7232
  const enableChangeTrackingHandler = enableChangeTrackingHandlerBuilder.build();
6854
7233
  const freezeHandler = freezeHandlerBuilder.build();
6855
7234
  const serializeHandler = serializeHandlerBuilder.build();
6856
- const changeTrackingCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7235
+ const compareIdsHandler = compareIdsHandlerBuilder.build();
7236
+ const changeTrackingCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6857
7237
  changeTrackingCodeBuilder.raw(`function ${this.createChangeTracker.toString()}`);
6858
7238
  changeTrackingCodeBuilder.slot("declarations").variable("enableChangeTracking").value('createChangeTracker()');
6859
7239
  changeTrackingCodeBuilder.slot("assignment");
6860
7240
  changeTrackingCodeBuilder.slot("return").raw('\treturn enableChangeTracking(entity);');
6861
- const freezeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7241
+ const freezeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6862
7242
  freezeCodeBuilder.slot("assignment");
6863
7243
  freezeCodeBuilder.slot("return").raw('\treturn Object.freeze(entity);');
6864
- const enricherCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7244
+ const enricherCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6865
7245
  const enricherFunctionRoot = enricherCodeBuilder.factory("factory", { name: "factory" }).parameters({ name: "collectionName", value: this.collectionName });
6866
7246
  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');
7247
+ enricherFunctionBody.slot("changeTracker").raw(`\tfunction ${this.createChangeTracker.toString()}`);
7248
+ enricherFunctionBody.slot("enableChangeTracking")
7249
+ .variable("enableChangeTracking")
7250
+ .value('changeTrackingType === "proxy" ? createChangeTracker() : e => e');
7251
+ enricherFunctionBody.slot("append");
6869
7252
  enricherFunctionBody.slot("enriched");
6870
7253
  enricherFunctionBody.slot("declarations");
6871
7254
  enricherFunctionBody.slot("assignment");
6872
7255
  enricherFunctionBody.slot("ifs");
6873
7256
  enricherFunctionBody.slot("tracking").if('changeTrackingType === "immutable"', { name: "freeze" });
6874
- enricherFunctionBody.raw('\treturn enableChangeTracking(enriched);');
6875
- const mergeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7257
+ enricherFunctionBody.slot("return").raw('\treturn enableChangeTracking(enriched);');
7258
+ const preprocessCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
7259
+ preprocessCodeBuilder.slot("main");
7260
+ preprocessCodeBuilder.slot("return").raw(` return result;`);
7261
+ const postprocessCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
7262
+ postprocessCodeBuilder.slot("main");
7263
+ postprocessCodeBuilder.slot("return").raw(` return result;`);
7264
+ const mergeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6876
7265
  const mergeFunctionRoot = mergeCodeBuilder.factory("factory", { name: "factory" }).parameters({ name: "collectionName", value: this.collectionName });
6877
7266
  const mergeFunctionBody = mergeFunctionRoot.function(undefined, { name: "function" }).parameters("destination", "source").return();
6878
7267
  const pauseFunctionBody = mergeFunctionBody.function("pause")
@@ -6891,40 +7280,43 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6891
7280
  unpause();
6892
7281
 
6893
7282
  return destination;`);
6894
- const prepareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7283
+ const prepareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6895
7284
  prepareCodeBuilder.slot("result");
6896
7285
  prepareCodeBuilder.slot("assignments");
6897
7286
  prepareCodeBuilder.slot("return").raw(` return result;`);
6898
- const stripCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7287
+ const stripCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6899
7288
  stripCodeBuilder.slot("result");
6900
7289
  stripCodeBuilder.slot("return").raw(` return result;`);
6901
- const cloneCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7290
+ const cloneCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6902
7291
  cloneCodeBuilder.slot("result").raw("const result = {};");
6903
7292
  ;
6904
7293
  cloneCodeBuilder.slot("assignments");
6905
7294
  cloneCodeBuilder.slot("if");
6906
7295
  cloneCodeBuilder.slot("return").raw(` return result;`);
6907
- const compareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7296
+ const compareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6908
7297
  compareCodeBuilder.slot("result");
6909
7298
  compareCodeBuilder.slot("return").raw(` return result;`);
6910
- const deserializeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7299
+ const compareIdsCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
7300
+ compareIdsCodeBuilder.slot("ifs");
7301
+ compareIdsCodeBuilder.slot("return").raw(` return true;`);
7302
+ const deserializeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6911
7303
  deserializeCodeBuilder.slot("functions");
6912
7304
  deserializeCodeBuilder.slot("result");
6913
7305
  deserializeCodeBuilder.slot("if");
6914
- deserializeCodeBuilder.slot("return").raw(` return result;`);
6915
- const serializeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7306
+ deserializeCodeBuilder.slot("return").raw(` return entity;`);
7307
+ const serializeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6916
7308
  serializeCodeBuilder.slot("result").raw("const result = {};");
6917
7309
  serializeCodeBuilder.slot("assignments");
6918
7310
  serializeCodeBuilder.slot("functions");
6919
7311
  serializeCodeBuilder.slot("if");
6920
7312
  serializeCodeBuilder.slot("return").raw(` return result;`);
6921
- const idSelectorCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7313
+ const idSelectorCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6922
7314
  idSelectorCodeBuilder.slot("result");
6923
7315
  idSelectorCodeBuilder.slot("return").raw(` return result;`);
6924
- const hashTypeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7316
+ const hashTypeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6925
7317
  hashTypeCodeBuilder.slot("ifs");
6926
7318
  hashTypeCodeBuilder.slot("return").raw(` return "Ids";`);
6927
- const hashCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7319
+ const hashCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6928
7320
  hashCodeBuilder.slot("functions").raw(`
6929
7321
  function stringifyDate(d) {
6930
7322
 
@@ -6979,6 +7371,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6979
7371
  hashHandler.handle(property, hashCodeBuilder);
6980
7372
  enableChangeTrackingHandler.handle(property, changeTrackingCodeBuilder);
6981
7373
  freezeHandler.handle(property, freezeCodeBuilder);
7374
+ compareIdsHandler.handle(property, compareIdsCodeBuilder);
6982
7375
  });
6983
7376
  if (idProperties.length === 0) {
6984
7377
  throw new Error(`Schema must have a key. Use .key() to mark a property as a key. Collection Name: ${this.collectionName}`);
@@ -6987,20 +7380,36 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6987
7380
  const mergeParams = mergeFunctionRoot.getParameters();
6988
7381
  const enrichGenerator = Function(`return ${enricherCodeBuilder.toString()}`);
6989
7382
  const mergeGenerator = Function(`return ${mergeCodeBuilder.toString()}`);
7383
+ // After enricher is used, we modify it to be deserialize and enrich
7384
+ enricherFunctionBody.get("append").insert(deserializeCodeBuilder.get("functions"));
7385
+ enricherFunctionBody.get("append").insert(deserializeCodeBuilder.get("result"));
7386
+ enricherFunctionBody.get("append").insert(deserializeCodeBuilder.get("if"));
7387
+ enricherFunctionRoot.replace("function", new _codegen__WEBPACK_IMPORTED_MODULE_19__.FunctionBuilder(undefined).parameters("unserialized", "changeTrackingType").return());
7388
+ const postProcessGenerator = Function(`return ${enricherCodeBuilder.toString()}`);
7389
+ const postProcessParams = enricherFunctionRoot.getParameters();
7390
+ // Combine prepare and serialize
7391
+ preprocessCodeBuilder.get("main").insert(prepareCodeBuilder.get("result"));
7392
+ preprocessCodeBuilder.get("main").insert(prepareCodeBuilder.get("assignments"));
7393
+ preprocessCodeBuilder.get("main").insert(serializeCodeBuilder.get("assignments"));
7394
+ preprocessCodeBuilder.get("main").insert(serializeCodeBuilder.get("functions"));
7395
+ preprocessCodeBuilder.get("main").insert(serializeCodeBuilder.get("if"));
6990
7396
  const getIdsFunction = Function("entity", idSelectorCodeBuilder.toString());
6991
7397
  const getHashTypeFunction = Function("entity", hashTypeCodeBuilder.toString());
6992
7398
  const prepareFunction = Function("entity", prepareCodeBuilder.toString());
6993
7399
  const cloneFunction = Function("entity", cloneCodeBuilder.toString());
6994
- const deserializeFunction = Function("entity", deserializeCodeBuilder.toString());
7400
+ const deserializeFunction = Function("unserialized", deserializeCodeBuilder.toString());
6995
7401
  const serializeFunction = Function("entity", serializeCodeBuilder.toString());
6996
7402
  const compareFunction = Function("a", "b", compareCodeBuilder.toString());
6997
- ;
6998
7403
  const stripFunction = Function("entity", stripCodeBuilder.toString());
6999
7404
  const hashFunction = Function("entity", "type", hashCodeBuilder.toString());
7000
7405
  const enableChangeTrackingFunction = Function("entity", changeTrackingCodeBuilder.toString());
7001
7406
  const freezeFunction = Function("entity", freezeCodeBuilder.toString());
7407
+ const compareIdsFunction = Function("a", "b", compareIdsCodeBuilder.toString());
7408
+ const preprocessFunction = Function("entity", preprocessCodeBuilder.toString());
7002
7409
  const enricherFactoryFunction = enrichGenerator();
7410
+ const postProcessFactoryFunction = postProcessGenerator();
7003
7411
  const mergeFactoryFunction = mergeGenerator();
7412
+ const postProcessFunction = postProcessFactoryFunction(...postProcessParams.map(w => w.value));
7004
7413
  const enricherFunction = enricherFactoryFunction(...enrichParams.map(w => w.value));
7005
7414
  const mergeFunction = mergeFactoryFunction(...mergeParams.map(w => w.value));
7006
7415
  const idPropertyNames = idProperties.map(w => w.name);
@@ -7011,7 +7420,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
7011
7420
  return getIdsFunction(entity)[0];
7012
7421
  };
7013
7422
  const getProperty = (id) => propertyMap.get(id);
7014
- const id = (0,_utilities__WEBPACK_IMPORTED_MODULE_19__.hash)([...allPropertyNamesAndPaths, this.collectionName].join(","));
7423
+ const id = (0,_utilities__WEBPACK_IMPORTED_MODULE_20__.hash)([...allPropertyNamesAndPaths, this.collectionName].join(","));
7015
7424
  // memoize this by the validProperties
7016
7425
  // TODO: See if we can generate a function to do this and eliminate loops
7017
7426
  const deserializePartial = (item, properties) => {
@@ -7026,8 +7435,9 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
7026
7435
  }
7027
7436
  return item;
7028
7437
  };
7029
- return {
7030
- createSubscription: (signal) => new _communication_broadcast__WEBPACK_IMPORTED_MODULE_20__.SchemaSubscription(id, signal),
7438
+ const result = {
7439
+ preprocess: preprocessFunction,
7440
+ postprocess: postProcessFunction,
7031
7441
  getId,
7032
7442
  getProperty,
7033
7443
  properties,
@@ -7042,6 +7452,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
7042
7452
  deserialize: deserializeFunction,
7043
7453
  serialize: serializeFunction,
7044
7454
  compare: compareFunction,
7455
+ compareIds: compareIdsFunction,
7045
7456
  strip: stripFunction,
7046
7457
  hash: hashFunction,
7047
7458
  id,
@@ -7103,9 +7514,13 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
7103
7514
  return indexes;
7104
7515
  }
7105
7516
  };
7517
+ return {
7518
+ createSubscription: (signal) => new _communication_broadcast__WEBPACK_IMPORTED_MODULE_21__.SchemaSubscription(result, signal),
7519
+ ...result
7520
+ };
7106
7521
  }
7107
7522
  catch (e) {
7108
- throw new _errors_SchemaError__WEBPACK_IMPORTED_MODULE_21__.SchemaError(e, `Error compiling schema for collection: ${this.collectionName}`);
7523
+ throw new _errors_SchemaError__WEBPACK_IMPORTED_MODULE_22__.SchemaError(e, `Error compiling schema for collection: ${this.collectionName}`);
7109
7524
  }
7110
7525
  }
7111
7526
  }
@@ -7221,43 +7636,81 @@ class SubscriptionListener {
7221
7636
  }
7222
7637
  class SchemaSubscription {
7223
7638
  id;
7224
- schemaId;
7639
+ schema;
7225
7640
  createdAt;
7226
- constructor(schemaId, signal) {
7641
+ constructor(schema, signal) {
7227
7642
  this.createdAt = (0,_performance__WEBPACK_IMPORTED_MODULE_0__.now)();
7228
7643
  this.id = (0,_utilities__WEBPACK_IMPORTED_MODULE_1__.uuid)(8);
7229
- this.schemaId = schemaId;
7644
+ this.schema = schema;
7230
7645
  signal?.addEventListener("abort", () => {
7231
7646
  this.dispose();
7232
7647
  }, { once: true });
7233
7648
  }
7234
7649
  send(changes) {
7235
- const regisry = getChannelRegistry(this.schemaId);
7650
+ const regisry = getChannelRegistry(this.schema.id);
7651
+ // cannot send raw data, needs to be preprocessed
7652
+ const preprocessedChanges = {
7653
+ adds: new Array(changes.adds.length),
7654
+ removals: new Array(changes.removals.length),
7655
+ unknown: new Array(changes.unknown.length),
7656
+ updates: new Array(changes.updates.length),
7657
+ };
7658
+ for (let i = 0, length = changes.adds.length; i < length; i++) {
7659
+ preprocessedChanges.adds[i] = this.schema.preprocess(changes.adds[i]);
7660
+ }
7661
+ for (let i = 0, length = changes.removals.length; i < length; i++) {
7662
+ preprocessedChanges.removals[i] = this.schema.preprocess(changes.removals[i]);
7663
+ }
7664
+ for (let i = 0, length = changes.unknown.length; i < length; i++) {
7665
+ preprocessedChanges.unknown[i] = this.schema.preprocess(changes.unknown[i]);
7666
+ }
7667
+ for (let i = 0, length = changes.updates.length; i < length; i++) {
7668
+ preprocessedChanges.updates[i] = this.schema.preprocess(changes.updates[i]);
7669
+ }
7236
7670
  // Send message to all listeners.
7237
7671
  // Since we create a new listener when we do onMessage,
7238
7672
  // we don't need to worry about sending to ourselves, it
7239
7673
  // can't happen
7240
7674
  regisry.sender.send({
7241
- data: changes,
7675
+ data: preprocessedChanges,
7242
7676
  timestamp: (0,_performance__WEBPACK_IMPORTED_MODULE_0__.now)()
7243
7677
  });
7244
7678
  }
7245
7679
  onMessage(callback) {
7246
- const regisry = getChannelRegistry(this.schemaId);
7680
+ const regisry = getChannelRegistry(this.schema.id);
7247
7681
  // Link the callback to an instance
7248
7682
  regisry.receiver.addListener(this.id, ({ data, timestamp }) => {
7249
7683
  if (timestamp < this.createdAt) {
7250
7684
  // Sent before the receiver was even created
7251
7685
  return;
7252
7686
  }
7253
- callback(data);
7687
+ // Changes were preprocessed before they were sent, need to postprocess them
7688
+ const postProcessedChanges = {
7689
+ adds: new Array(data.adds.length),
7690
+ removals: new Array(data.removals.length),
7691
+ unknown: new Array(data.unknown.length),
7692
+ updates: new Array(data.updates.length),
7693
+ };
7694
+ for (let i = 0, length = data.adds.length; i < length; i++) {
7695
+ postProcessedChanges.adds[i] = this.schema.preprocess(data.adds[i]);
7696
+ }
7697
+ for (let i = 0, length = data.removals.length; i < length; i++) {
7698
+ postProcessedChanges.removals[i] = this.schema.preprocess(data.removals[i]);
7699
+ }
7700
+ for (let i = 0, length = data.unknown.length; i < length; i++) {
7701
+ postProcessedChanges.unknown[i] = this.schema.preprocess(data.unknown[i]);
7702
+ }
7703
+ for (let i = 0, length = data.updates.length; i < length; i++) {
7704
+ postProcessedChanges.updates[i] = this.schema.preprocess(data.updates[i]);
7705
+ }
7706
+ callback(postProcessedChanges);
7254
7707
  });
7255
7708
  }
7256
7709
  dispose() {
7257
7710
  this[Symbol.dispose]();
7258
7711
  }
7259
7712
  [Symbol.dispose]() {
7260
- const regisry = getChannelRegistry(this.schemaId);
7713
+ const regisry = getChannelRegistry(this.schema.id);
7261
7714
  // Remove listeners for this instance only
7262
7715
  regisry.receiver.removeListeners(this.id);
7263
7716
  }
@@ -7805,6 +8258,8 @@ __webpack_require__.d(__webpack_exports__, {
7805
8258
  SchemaTracked: () => (SchemaTracked)
7806
8259
  });
7807
8260
  /* ESM import */var _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../base/SchemaBase */ "./src/schema/property/base/SchemaBase.ts");
8261
+ /* ESM import */var _SchemaKey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SchemaKey */ "./src/schema/property/modifiers/SchemaKey.ts");
8262
+
7808
8263
 
7809
8264
  class SchemaTracked extends _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__.SchemaBase {
7810
8265
  instance;
@@ -7814,6 +8269,9 @@ class SchemaTracked extends _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__.Schema
7814
8269
  this.instance = current.instance;
7815
8270
  this.isUnmapped = false;
7816
8271
  }
8272
+ key() {
8273
+ return new _SchemaKey__WEBPACK_IMPORTED_MODULE_1__.SchemaKey(this);
8274
+ }
7817
8275
  }
7818
8276
 
7819
8277
 
@@ -8521,11 +8979,13 @@ __webpack_require__.d(__webpack_exports__, {
8521
8979
  cast: () => (/* reexport safe */ _objects__WEBPACK_IMPORTED_MODULE_3__.cast),
8522
8980
  clone: () => (/* reexport safe */ _objects__WEBPACK_IMPORTED_MODULE_3__.clone),
8523
8981
  combineQueryOptionsCollections: () => (/* reexport safe */ _queryOptionsCollection__WEBPACK_IMPORTED_MODULE_7__.combineQueryOptionsCollections),
8982
+ fastHash: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.fastHash),
8524
8983
  hash: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.hash),
8525
8984
  isDate: () => (/* reexport safe */ _dates__WEBPACK_IMPORTED_MODULE_2__.isDate),
8526
8985
  isNodeRuntime: () => (/* reexport safe */ _runtime__WEBPACK_IMPORTED_MODULE_4__.isNodeRuntime),
8527
8986
  noop: () => (/* reexport safe */ _functions__WEBPACK_IMPORTED_MODULE_9__.noop),
8528
8987
  resolveBulkPersistChanges: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_6__.resolveBulkPersistChanges),
8988
+ stringifyObject: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.stringifyObject),
8529
8989
  toEventArray: () => (/* reexport safe */ _dbPluginEventUtils__WEBPACK_IMPORTED_MODULE_8__.toEventArray),
8530
8990
  toMap: () => (/* reexport safe */ _arrays__WEBPACK_IMPORTED_MODULE_0__.toMap),
8531
8991
  uuid: () => (/* reexport safe */ _uuid__WEBPACK_IMPORTED_MODULE_5__.uuid),
@@ -8649,7 +9109,9 @@ const isNodeRuntime = () => typeof process !== 'undefined' &&
8649
9109
  (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8650
9110
  __webpack_require__.r(__webpack_exports__);
8651
9111
  __webpack_require__.d(__webpack_exports__, {
8652
- hash: () => (hash)
9112
+ fastHash: () => (fastHash),
9113
+ hash: () => (hash),
9114
+ stringifyObject: () => (stringifyObject)
8653
9115
  });
8654
9116
  const hash = (value, seed = 0) => {
8655
9117
  // From Stack Overflow
@@ -8666,6 +9128,143 @@ const hash = (value, seed = 0) => {
8666
9128
  h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
8667
9129
  return 4294967296 * (2097151 & h2) + (h1 >>> 0);
8668
9130
  };
9131
+ /**
9132
+ * Fast string hash optimized for comparisons.
9133
+ * Uses djb2 algorithm - very fast and good distribution for short to medium strings.
9134
+ * Same input always produces same output (deterministic).
9135
+ *
9136
+ * @param value - The string to hash
9137
+ * @param seed - Optional seed value (default: 5381)
9138
+ * @returns A positive 32-bit integer hash value
9139
+ *
9140
+ * @example
9141
+ * ```ts
9142
+ * fastHash("test") === fastHash("test") // true
9143
+ * fastHash("test") !== fastHash("test2") // true
9144
+ * ```
9145
+ */
9146
+ const fastHash = (value, seed = 5381) => {
9147
+ let hash = seed;
9148
+ for (let i = 0; i < value.length; i++) {
9149
+ hash = ((hash << 5) + hash) + value.charCodeAt(i);
9150
+ }
9151
+ return hash >>> 0; // Convert to unsigned 32-bit integer
9152
+ };
9153
+ /**
9154
+ * Converts any value to a readable string representation.
9155
+ * Handles primitives, objects, arrays, classes, dates, errors, and functions.
9156
+ * Supports depth limiting to prevent infinite recursion on circular references.
9157
+ *
9158
+ * @param obj - The value to stringify
9159
+ * @param maxDepth - Maximum depth for nested objects (default: 3)
9160
+ * @param currentDepth - Current recursion depth (default: 0)
9161
+ * @returns String representation of the value
9162
+ *
9163
+ * @example
9164
+ * ```ts
9165
+ * stringifyObject({ name: "test", count: 5 }) // '{ name: "test", count: 5 }'
9166
+ * stringifyObject([1, 2, 3]) // '[1, 2, 3]'
9167
+ * stringifyObject(new Date()) // 'Date(2024-01-01T00:00:00.000Z)'
9168
+ * ```
9169
+ */
9170
+ function stringifyObject(obj, maxDepth = 3, currentDepth = 0) {
9171
+ if (obj === null)
9172
+ return 'null';
9173
+ if (obj === undefined)
9174
+ return 'undefined';
9175
+ const type = typeof obj;
9176
+ switch (type) {
9177
+ case 'string':
9178
+ return `"${obj}"`;
9179
+ case 'number':
9180
+ case 'boolean':
9181
+ return String(obj);
9182
+ case 'function':
9183
+ return `[Function: ${getFunctionName(obj)}]`;
9184
+ case 'object':
9185
+ if (currentDepth >= maxDepth) {
9186
+ return '[Max Depth Reached]';
9187
+ }
9188
+ return stringifyObjectValue(obj, maxDepth, currentDepth);
9189
+ default:
9190
+ return `[${type}]`;
9191
+ }
9192
+ }
9193
+ function getFunctionName(fn) {
9194
+ const name = fn.name;
9195
+ return name || 'anonymous';
9196
+ }
9197
+ function getObjectProperties(obj) {
9198
+ const properties = {};
9199
+ for (const key in obj) {
9200
+ if (obj.hasOwnProperty(key)) {
9201
+ properties[key] = obj[key];
9202
+ }
9203
+ }
9204
+ return properties;
9205
+ }
9206
+ function stringifyObjectValue(obj, maxDepth, currentDepth) {
9207
+ if (obj === null)
9208
+ return 'null';
9209
+ if (obj instanceof Date) {
9210
+ return `Date(${obj.toISOString()})`;
9211
+ }
9212
+ if (obj instanceof Error) {
9213
+ return `Error(${obj.message})`;
9214
+ }
9215
+ if (obj instanceof RegExp) {
9216
+ return obj.toString();
9217
+ }
9218
+ if (Array.isArray(obj)) {
9219
+ return stringifyArray(obj, maxDepth, currentDepth);
9220
+ }
9221
+ if (obj.constructor && obj.constructor.name !== 'Object') {
9222
+ return stringifyClassInstance(obj, maxDepth, currentDepth);
9223
+ }
9224
+ return stringifyPlainObject(obj, maxDepth, currentDepth);
9225
+ }
9226
+ function stringifyArray(arr, maxDepth, currentDepth) {
9227
+ if (arr.length === 0)
9228
+ return '[]';
9229
+ const items = arr.slice(0, 5).map(item => stringifyObject(item, maxDepth, currentDepth + 1));
9230
+ const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';
9231
+ return `[${items.join(', ')}${suffix}]`;
9232
+ }
9233
+ function stringifyClassInstance(obj, maxDepth, currentDepth) {
9234
+ const className = obj.constructor.name;
9235
+ const properties = getObjectProperties(obj);
9236
+ if (Object.keys(properties).length === 0) {
9237
+ return `${className} {}`;
9238
+ }
9239
+ const props = Object.entries(properties)
9240
+ .slice(0, 5)
9241
+ .map(([key, value]) => {
9242
+ const isPrimitive = value === null || value === undefined ||
9243
+ (typeof value !== 'object' && typeof value !== 'function');
9244
+ const depth = isPrimitive ? currentDepth : currentDepth + 1;
9245
+ return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
9246
+ });
9247
+ const suffix = Object.keys(properties).length > 5 ?
9248
+ `... (+${Object.keys(properties).length - 5} more)` : '';
9249
+ return `${className} { ${props.join(', ')}${suffix} }`;
9250
+ }
9251
+ function stringifyPlainObject(obj, maxDepth, currentDepth) {
9252
+ const properties = getObjectProperties(obj);
9253
+ if (Object.keys(properties).length === 0) {
9254
+ return '{}';
9255
+ }
9256
+ const props = Object.entries(properties)
9257
+ .slice(0, 5)
9258
+ .map(([key, value]) => {
9259
+ const isPrimitive = value === null || value === undefined ||
9260
+ (typeof value !== 'object' && typeof value !== 'function');
9261
+ const depth = isPrimitive ? currentDepth : currentDepth + 1;
9262
+ return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
9263
+ });
9264
+ const suffix = Object.keys(properties).length > 5 ?
9265
+ `... (+${Object.keys(properties).length - 5} more)` : '';
9266
+ return `{ ${props.join(', ')}${suffix} }`;
9267
+ }
8669
9268
 
8670
9269
 
8671
9270
  }),
@@ -8862,6 +9461,9 @@ __webpack_require__.d(__webpack_exports__, {
8862
9461
  TagCollection: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.TagCollection),
8863
9462
  TracingCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_11__.TracingCapability),
8864
9463
  TrampolinePipeline: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.TrampolinePipeline),
9464
+ TranslatedArrayValue: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.TranslatedArrayValue),
9465
+ TranslatedGroupValue: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.TranslatedGroupValue),
9466
+ TranslatedSingleValue: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.TranslatedSingleValue),
8865
9467
  ValueExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.ValueExpression),
8866
9468
  VariableBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.VariableBuilder),
8867
9469
  WorkPipeline: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.WorkPipeline),
@@ -8874,6 +9476,7 @@ __webpack_require__.d(__webpack_exports__, {
8874
9476
  clone: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.clone),
8875
9477
  combineExpressions: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.combineExpressions),
8876
9478
  combineQueryOptionsCollections: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.combineQueryOptionsCollections),
9479
+ fastHash: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.fastHash),
8877
9480
  forEach: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.forEach),
8878
9481
  getProperties: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.getProperties),
8879
9482
  hash: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.hash),
@@ -8885,6 +9488,7 @@ __webpack_require__.d(__webpack_exports__, {
8885
9488
  now: () => (/* reexport safe */ _performance__WEBPACK_IMPORTED_MODULE_5__.now),
8886
9489
  resolveBulkPersistChanges: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.resolveBulkPersistChanges),
8887
9490
  s: () => (/* reexport safe */ _schema__WEBPACK_IMPORTED_MODULE_9__.s),
9491
+ stringifyObject: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.stringifyObject),
8888
9492
  toEventArray: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.toEventArray),
8889
9493
  toExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.toExpression),
8890
9494
  toMap: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.toMap),
@@ -8990,6 +9594,9 @@ var __webpack_exports__SyncronousQueue = __webpack_exports__.SyncronousQueue;
8990
9594
  var __webpack_exports__TagCollection = __webpack_exports__.TagCollection;
8991
9595
  var __webpack_exports__TracingCapability = __webpack_exports__.TracingCapability;
8992
9596
  var __webpack_exports__TrampolinePipeline = __webpack_exports__.TrampolinePipeline;
9597
+ var __webpack_exports__TranslatedArrayValue = __webpack_exports__.TranslatedArrayValue;
9598
+ var __webpack_exports__TranslatedGroupValue = __webpack_exports__.TranslatedGroupValue;
9599
+ var __webpack_exports__TranslatedSingleValue = __webpack_exports__.TranslatedSingleValue;
8993
9600
  var __webpack_exports__ValueExpression = __webpack_exports__.ValueExpression;
8994
9601
  var __webpack_exports__VariableBuilder = __webpack_exports__.VariableBuilder;
8995
9602
  var __webpack_exports__WorkPipeline = __webpack_exports__.WorkPipeline;
@@ -9002,6 +9609,7 @@ var __webpack_exports__cast = __webpack_exports__.cast;
9002
9609
  var __webpack_exports__clone = __webpack_exports__.clone;
9003
9610
  var __webpack_exports__combineExpressions = __webpack_exports__.combineExpressions;
9004
9611
  var __webpack_exports__combineQueryOptionsCollections = __webpack_exports__.combineQueryOptionsCollections;
9612
+ var __webpack_exports__fastHash = __webpack_exports__.fastHash;
9005
9613
  var __webpack_exports__forEach = __webpack_exports__.forEach;
9006
9614
  var __webpack_exports__getProperties = __webpack_exports__.getProperties;
9007
9615
  var __webpack_exports__hash = __webpack_exports__.hash;
@@ -9013,12 +9621,13 @@ var __webpack_exports__noop = __webpack_exports__.noop;
9013
9621
  var __webpack_exports__now = __webpack_exports__.now;
9014
9622
  var __webpack_exports__resolveBulkPersistChanges = __webpack_exports__.resolveBulkPersistChanges;
9015
9623
  var __webpack_exports__s = __webpack_exports__.s;
9624
+ var __webpack_exports__stringifyObject = __webpack_exports__.stringifyObject;
9016
9625
  var __webpack_exports__toEventArray = __webpack_exports__.toEventArray;
9017
9626
  var __webpack_exports__toExpression = __webpack_exports__.toExpression;
9018
9627
  var __webpack_exports__toMap = __webpack_exports__.toMap;
9019
9628
  var __webpack_exports__toPromise = __webpack_exports__.toPromise;
9020
9629
  var __webpack_exports__uuid = __webpack_exports__.uuid;
9021
9630
  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 };
9631
+ 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__uuid as uuid, __webpack_exports__uuidv4 as uuidv4 };
9023
9632
 
9024
9633
  //# sourceMappingURL=index.js.map