@routier/core 0.0.5 → 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 (63) hide show
  1. package/dist/capabilities/Capability.d.ts +11 -0
  2. package/dist/capabilities/PerformanceCapability.d.ts +13 -0
  3. package/dist/capabilities/TracingCapability.d.ts +11 -0
  4. package/dist/capabilities/index.d.ts +4 -0
  5. package/dist/capabilities/index.js +763 -0
  6. package/dist/capabilities/index.js.map +1 -0
  7. package/dist/capabilities/performance/PerformanceTracker.d.ts +11 -0
  8. package/dist/capabilities/tracing/CallTraceManager.d.ts +12 -0
  9. package/dist/capabilities/types.d.ts +17 -0
  10. package/dist/codegen/blocks.d.ts +8 -0
  11. package/dist/codegen/handlers/CompareIdsHandlerBuilder.d.ts +4 -0
  12. package/dist/codegen/handlers/compare/CompareArrayHandler.d.ts +6 -0
  13. package/dist/codegen/handlers/compare/CompareDateHandler.d.ts +6 -0
  14. package/dist/codegen/handlers/compareIds/CompareIdsKeyHandler.d.ts +6 -0
  15. package/dist/codegen/handlers/index.d.ts +1 -0
  16. package/dist/codegen/handlers/serialize/SerializeDateHandler.d.ts +2 -1
  17. package/dist/codegen/handlers/serialize/SerializeFunctionHandler.d.ts +6 -0
  18. package/dist/codegen/index.js +660 -0
  19. package/dist/codegen/index.js.map +1 -0
  20. package/dist/collections/index.js.map +1 -1
  21. package/dist/expressions/index.js +108 -19
  22. package/dist/expressions/index.js.map +1 -1
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.js +1406 -602
  25. package/dist/index.js.map +1 -1
  26. package/dist/pipeline/WorkPipeline.test.d.ts +1 -0
  27. package/dist/pipeline/index.js.map +1 -1
  28. package/dist/plugins/EphemeralDataPlugin.d.ts +2 -2
  29. package/dist/plugins/EphemeralDataPlugin.test.d.ts +1 -0
  30. package/dist/plugins/index.d.ts +0 -1
  31. package/dist/plugins/index.js +244 -483
  32. package/dist/plugins/index.js.map +1 -1
  33. package/dist/plugins/query/types.d.ts +5 -0
  34. package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +2 -1
  35. package/dist/plugins/replication/ReplicationDbPlugin.d.ts +2 -1
  36. package/dist/plugins/translators/DataTranslator.d.ts +3 -1
  37. package/dist/plugins/translators/JsonTranslator.d.ts +1 -0
  38. package/dist/plugins/translators/SqlTranslator.d.ts +1 -0
  39. package/dist/plugins/translators/TranslatedArrayValue.d.ts +6 -0
  40. package/dist/plugins/translators/TranslatedGroupValue.d.ts +6 -0
  41. package/dist/plugins/translators/TranslatedSingleValue.d.ts +6 -0
  42. package/dist/plugins/translators/index.d.ts +4 -0
  43. package/dist/plugins/translators/types.d.ts +10 -0
  44. package/dist/plugins/types.d.ts +2 -1
  45. package/dist/schema/PropertyInfo.d.ts +6 -1
  46. package/dist/schema/SchemaDefinition.d.ts +1 -1
  47. package/dist/schema/communication/broadcast.d.ts +3 -3
  48. package/dist/schema/index.js +508 -76
  49. package/dist/schema/index.js.map +1 -1
  50. package/dist/schema/property/modifiers/SchemaTracked.d.ts +3 -1
  51. package/dist/schema/table/SchemaComputed.d.ts +1 -1
  52. package/dist/schema/testSchemas.test.d.ts +60 -36
  53. package/dist/schema/types.d.ts +16 -1
  54. package/dist/utilities/index.js +145 -2
  55. package/dist/utilities/index.js.map +1 -1
  56. package/dist/utilities/strings.d.ts +34 -0
  57. package/dist/utilities/strings.test.d.ts +1 -0
  58. package/package.json +5 -1
  59. package/readme.md +1 -1
  60. package/dist/plugins/capabilities/DbPluginCapability.d.ts +0 -23
  61. package/dist/plugins/capabilities/index.d.ts +0 -2
  62. package/dist/plugins/capabilities/logging/DbPluginLoggingCapability.d.ts +0 -28
  63. package/dist/plugins/capabilities/logging/index.d.ts +0 -1
package/dist/index.js CHANGED
@@ -51,6 +51,480 @@ function assertInstanceOf(value, Instance) {
51
51
  }
52
52
 
53
53
 
54
+ }),
55
+ "./src/capabilities/Capability.ts":
56
+ /*!****************************************!*\
57
+ !*** ./src/capabilities/Capability.ts ***!
58
+ \****************************************/
59
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
60
+ __webpack_require__.r(__webpack_exports__);
61
+ __webpack_require__.d(__webpack_exports__, {
62
+ Capability: () => (Capability)
63
+ });
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
+ ]);
94
+ isValidObject(obj) {
95
+ return typeof obj === "object" && obj !== null;
96
+ }
97
+ isCallableMethod(descriptor, key) {
98
+ return (descriptor?.value &&
99
+ typeof descriptor.value === 'function' &&
100
+ key !== 'constructor' &&
101
+ key !== 'undefined');
102
+ }
103
+ canExplore(descriptor) {
104
+ if (typeof descriptor.value !== "object") {
105
+ return false;
106
+ }
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;
115
+ }
116
+ getName(value) {
117
+ if (value.constructor != null) {
118
+ return value.constructor.name;
119
+ }
120
+ return null;
121
+ }
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;
128
+ }
129
+ return path.join(".");
130
+ }
131
+ explore(instance, onDiscover) {
132
+ if (!this.isValidObject(instance)) {
133
+ return;
134
+ }
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)) {
141
+ continue;
142
+ }
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;
156
+ }
157
+ const path = this.getPath(info, key);
158
+ explore.push({ instance: descriptor.value, parent: info, propertyName: key, path });
159
+ }
160
+ visited.add(item);
161
+ }
162
+ }
163
+ }
164
+
165
+
166
+ }),
167
+ "./src/capabilities/PerformanceCapability.ts":
168
+ /*!***************************************************!*\
169
+ !*** ./src/capabilities/PerformanceCapability.ts ***!
170
+ \***************************************************/
171
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
172
+ __webpack_require__.r(__webpack_exports__);
173
+ __webpack_require__.d(__webpack_exports__, {
174
+ PerformanceCapability: () => (PerformanceCapability)
175
+ });
176
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities */ "./src/utilities/strings.ts");
177
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
178
+ /* ESM import */var _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./performance/PerformanceTracker */ "./src/capabilities/performance/PerformanceTracker.ts");
179
+ /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
180
+
181
+
182
+
183
+
184
+ class PerformanceCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability {
185
+ callTraceManager;
186
+ performanceTracker;
187
+ filter;
188
+ childDurations = new Map();
189
+ constructor(options) {
190
+ super();
191
+ this.filter = options?.filter ?? (() => true);
192
+ this.callTraceManager = new _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__.CallTraceManager();
193
+ this.performanceTracker = new _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__.PerformanceTracker();
194
+ }
195
+ apply(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
+ };
302
+ }
303
+ });
304
+ }
305
+ }
306
+
307
+
308
+ }),
309
+ "./src/capabilities/TracingCapability.ts":
310
+ /*!***********************************************!*\
311
+ !*** ./src/capabilities/TracingCapability.ts ***!
312
+ \***********************************************/
313
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
314
+ __webpack_require__.r(__webpack_exports__);
315
+ __webpack_require__.d(__webpack_exports__, {
316
+ TracingCapability: () => (TracingCapability)
317
+ });
318
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
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
+
322
+
323
+
324
+ class TracingCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability {
325
+ callTraceManager;
326
+ filter;
327
+ constructor(options) {
328
+ super();
329
+ this.filter = options?.filter ?? (() => true);
330
+ this.callTraceManager = new _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__.CallTraceManager();
331
+ }
332
+ apply(instance) {
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
+ }
372
+ };
373
+ }
374
+ });
375
+ }
376
+ }
377
+
378
+
379
+ }),
380
+ "./src/capabilities/index.ts":
381
+ /*!***********************************!*\
382
+ !*** ./src/capabilities/index.ts ***!
383
+ \***********************************/
384
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
385
+ __webpack_require__.r(__webpack_exports__);
386
+ __webpack_require__.d(__webpack_exports__, {
387
+ Capability: () => (/* reexport safe */ _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability),
388
+ PerformanceCapability: () => (/* reexport safe */ _PerformanceCapability__WEBPACK_IMPORTED_MODULE_1__.PerformanceCapability),
389
+ TracingCapability: () => (/* reexport safe */ _TracingCapability__WEBPACK_IMPORTED_MODULE_2__.TracingCapability)
390
+ });
391
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
392
+ /* ESM import */var _PerformanceCapability__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PerformanceCapability */ "./src/capabilities/PerformanceCapability.ts");
393
+ /* ESM import */var _TracingCapability__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TracingCapability */ "./src/capabilities/TracingCapability.ts");
394
+
395
+
396
+
397
+
398
+
399
+
400
+ }),
401
+ "./src/capabilities/performance/PerformanceTracker.ts":
402
+ /*!************************************************************!*\
403
+ !*** ./src/capabilities/performance/PerformanceTracker.ts ***!
404
+ \************************************************************/
405
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
406
+ __webpack_require__.r(__webpack_exports__);
407
+ __webpack_require__.d(__webpack_exports__, {
408
+ PerformanceTracker: () => (PerformanceTracker)
409
+ });
410
+ class PerformanceTracker {
411
+ methodTimings = new Map();
412
+ operationStartTimes = new Map();
413
+ startMethodTiming(operationId, methodPath) {
414
+ const startTime = performance.now();
415
+ const key = `${operationId}:${methodPath}`;
416
+ // Track operation start time for delta calculations
417
+ if (!this.operationStartTimes.has(operationId)) {
418
+ this.operationStartTimes.set(operationId, startTime);
419
+ }
420
+ this.methodTimings.set(key, { startTime });
421
+ return startTime;
422
+ }
423
+ recordNextMethodStart(operationId, methodPath) {
424
+ const key = `${operationId}:${methodPath}`;
425
+ const timing = this.methodTimings.get(key);
426
+ if (timing) {
427
+ timing.nextMethodStartTime = performance.now();
428
+ }
429
+ }
430
+ endMethodTiming(operationId, methodPath) {
431
+ const endTime = performance.now();
432
+ const key = `${operationId}:${methodPath}`;
433
+ const timing = this.methodTimings.get(key);
434
+ if (!timing) {
435
+ return { startTime: endTime };
436
+ }
437
+ const duration = endTime - timing.startTime;
438
+ const timeToNextCall = timing.nextMethodStartTime ?
439
+ timing.nextMethodStartTime - timing.startTime : undefined;
440
+ // Clean up
441
+ this.methodTimings.delete(key);
442
+ return {
443
+ startTime: timing.startTime,
444
+ endTime,
445
+ duration,
446
+ nextMethodStartTime: timing.nextMethodStartTime,
447
+ timeToNextCall
448
+ };
449
+ }
450
+ formatDuration(milliseconds) {
451
+ if (milliseconds < 1) {
452
+ return `${(milliseconds * 1000).toFixed(1)}μs`;
453
+ }
454
+ else if (milliseconds < 1000) {
455
+ return `${milliseconds.toFixed(2)}ms`;
456
+ }
457
+ else {
458
+ return `${(milliseconds / 1000).toFixed(2)}s`;
459
+ }
460
+ }
461
+ getDeltaFromOperationStart(operationId, currentTime) {
462
+ const operationStartTime = this.operationStartTimes.get(operationId);
463
+ return operationStartTime ? currentTime - operationStartTime : 0;
464
+ }
465
+ cleanupOperation(operationId) {
466
+ this.operationStartTimes.delete(operationId);
467
+ }
468
+ }
469
+
470
+
471
+ }),
472
+ "./src/capabilities/tracing/CallTraceManager.ts":
473
+ /*!******************************************************!*\
474
+ !*** ./src/capabilities/tracing/CallTraceManager.ts ***!
475
+ \******************************************************/
476
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
477
+ __webpack_require__.r(__webpack_exports__);
478
+ __webpack_require__.d(__webpack_exports__, {
479
+ CallTraceManager: () => (CallTraceManager)
480
+ });
481
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities */ "./src/utilities/uuid.ts");
482
+
483
+ class CallTraceManager {
484
+ activeOperationId = null;
485
+ activeCallStack = [];
486
+ startNewOperation() {
487
+ const operationId = (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)(8);
488
+ this.activeOperationId = operationId;
489
+ this.activeCallStack = [];
490
+ return operationId;
491
+ }
492
+ isNewOperation() {
493
+ return this.activeOperationId === null;
494
+ }
495
+ getActiveOperationId() {
496
+ if (!this.activeOperationId) {
497
+ throw new Error('No active operation context');
498
+ }
499
+ return this.activeOperationId;
500
+ }
501
+ addMethodToTrace(methodPath) {
502
+ if (this.isNewOperation()) {
503
+ this.activeCallStack = [methodPath];
504
+ }
505
+ else {
506
+ this.activeCallStack.push(methodPath);
507
+ }
508
+ return [...this.activeCallStack];
509
+ }
510
+ removeMethodFromTrace() {
511
+ if (!this.isNewOperation()) {
512
+ this.activeCallStack.pop();
513
+ }
514
+ }
515
+ endOperation() {
516
+ this.activeOperationId = null;
517
+ this.activeCallStack = [];
518
+ }
519
+ formatMethodPaths(methodPaths) {
520
+ return methodPaths.map(path => path.replace(/ → /g, '.'));
521
+ }
522
+ getCurrentTrace() {
523
+ return [...this.activeCallStack];
524
+ }
525
+ }
526
+
527
+
54
528
  }),
55
529
  "./src/codegen/SlotPath.ts":
56
530
  /*!*********************************!*\
@@ -116,6 +590,24 @@ class Block {
116
590
  indexOf(name) {
117
591
  return this._lines.findIndex(w => typeof w !== "string" && w.name === name);
118
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
+ }
119
611
  getOrDefault(name) {
120
612
  if (name.includes('.') === false) {
121
613
  return this._lines.find(w => typeof w !== "string" && w.name === name);
@@ -145,6 +637,27 @@ class Block {
145
637
  has(name) {
146
638
  return this._lines.some(w => typeof w !== "string" && w.name === name);
147
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
+ }
148
661
  push(line) {
149
662
  this._lines.push(line);
150
663
  }
@@ -575,15 +1088,40 @@ __webpack_require__.r(__webpack_exports__);
575
1088
  __webpack_require__.d(__webpack_exports__, {
576
1089
  CompareHandlerBuilder: () => (CompareHandlerBuilder)
577
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");
578
1093
  /* ESM import */var _compare_CompareObjectHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./compare/CompareObjectHandler */ "./src/codegen/handlers/compare/CompareObjectHandler.ts");
579
- /* 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
+
580
1097
 
581
1098
 
582
- /// Purpose:
583
1099
  class CompareHandlerBuilder {
584
1100
  build() {
585
1101
  const handler = new _compare_CompareObjectHandler__WEBPACK_IMPORTED_MODULE_0__.CompareObjectHandler();
586
- 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();
587
1125
  return handler;
588
1126
  }
589
1127
  }
@@ -881,10 +1419,12 @@ __webpack_require__.r(__webpack_exports__);
881
1419
  __webpack_require__.d(__webpack_exports__, {
882
1420
  SerializeHandlerBuilder: () => (SerializeHandlerBuilder)
883
1421
  });
884
- /* ESM import */var _serialize_SerializeDateHandler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./serialize/SerializeDateHandler */ "./src/codegen/handlers/serialize/SerializeDateHandler.ts");
885
- /* ESM import */var _serialize_SerializeObjectHandler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./serialize/SerializeObjectHandler */ "./src/codegen/handlers/serialize/SerializeObjectHandler.ts");
886
- /* 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");
887
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
+
888
1428
 
889
1429
 
890
1430
 
@@ -894,9 +1434,10 @@ class SerializeHandlerBuilder {
894
1434
  build() {
895
1435
  const handler = new _serialize_SerializeSerializerHandler__WEBPACK_IMPORTED_MODULE_0__.SerializeSerializerHandler();
896
1436
  handler
897
- .setNext(new _serialize_SerializeDateHandler__WEBPACK_IMPORTED_MODULE_1__.SerializeDateHandler())
898
- .setNext(new _serialize_SerializeValueHandler__WEBPACK_IMPORTED_MODULE_2__.SerializeValueHandler())
899
- .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());
900
1441
  return handler;
901
1442
  }
902
1443
  }
@@ -953,10 +1494,11 @@ class CloneArrayHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfo
953
1494
  // Child properties will take care of this
954
1495
  return builder;
955
1496
  }
956
- const slot = builder.get("assignments");
957
- const resultAssignmentPath = property.getAssignmentPath({ parent: "result" });
1497
+ const entitySelectorPath = property.getSelectrorPath({ parent: "entity" });
958
1498
  if (property.parent == null) {
959
- slot.assign(`${resultAssignmentPath}`).value("{}");
1499
+ const resultAssignmentPath = property.getAssignmentPath({ parent: "result" });
1500
+ const slot = builder.get("if");
1501
+ slot.if(`${entitySelectorPath} != null`).appendBody(`${resultAssignmentPath} = [...${entitySelectorPath}]`);
960
1502
  return builder;
961
1503
  }
962
1504
  // slotPath.push(...property.getParentPathArray());
@@ -1033,6 +1575,74 @@ class CloneValueHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfo
1033
1575
  }
1034
1576
 
1035
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
+
1036
1646
  }),
1037
1647
  "./src/codegen/handlers/compare/CompareObjectHandler.ts":
1038
1648
  /*!**************************************************************!*\
@@ -1091,6 +1701,32 @@ class CompareValueHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyIn
1091
1701
  }
1092
1702
 
1093
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
+
1094
1730
  }),
1095
1731
  "./src/codegen/handlers/deserialize/DeserializeComputedValueHandler.ts":
1096
1732
  /*!*****************************************************************************!*\
@@ -1140,8 +1776,8 @@ class DeserializeDateHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Propert
1140
1776
  if (property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
1141
1777
  const slotPath = new _SlotPath__WEBPACK_IMPORTED_MODULE_2__.SlotPath("result.variable.object");
1142
1778
  let objectBuilder = builder.get(slotPath.get());
1143
- const entitySelectorPath = property.getSelectrorPath({ parent: "entity" });
1144
- const entityAssignmentPath = property.getAssignmentPath({ parent: "result" });
1779
+ const entitySelectorPath = property.getSelectrorPath({ parent: "unserialized" });
1780
+ const entityAssignmentPath = property.getAssignmentPath({ parent: "entity", useFromPropertyName: property.isRenamed });
1145
1781
  const assignment = `${property.name}: typeof ${entitySelectorPath} === "string" ? new Date(${entitySelectorPath}) : ${entitySelectorPath}`;
1146
1782
  // if it is nullable or optional, assign in an if block, otherwise we
1147
1783
  // could unintentionally assign null/undefined to a property that does not exist
@@ -1185,10 +1821,10 @@ class DeserializeDeserializerHandler extends _types__WEBPACK_IMPORTED_MODULE_0__
1185
1821
  if (property.valueDeserializer != null) {
1186
1822
  let objectBuilder = builder.getOrDefault("result.variable.object");
1187
1823
  const assignmentBuilder = builder.getOrDefault("functions");
1188
- const entitySelectorPath = property.getSelectrorPath({ parent: "entity" });
1824
+ const entitySelectorPath = property.getSelectrorPath({ parent: "unserialized" });
1189
1825
  if (objectBuilder == null) {
1190
1826
  objectBuilder = builder.get("result")
1191
- .assign("const result", { name: "variable" })
1827
+ .assign("const entity", { name: "variable" })
1192
1828
  .object({ name: "object" });
1193
1829
  }
1194
1830
  const defaultFunctionWithParameters = this.toNamedFunction(property.valueDeserializer.toString(), assignmentBuilder);
@@ -1254,12 +1890,12 @@ class DeserializeObjectHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Prope
1254
1890
  const slotPath = new _SlotPath__WEBPACK_IMPORTED_MODULE_2__.SlotPath("result.variable.object");
1255
1891
  let objectBuilder = builder.get(slotPath.get());
1256
1892
  if (property.parent == null) {
1257
- objectBuilder.nested(property.name, property.name);
1893
+ objectBuilder.nested(property.getResolvedName(), property.name);
1258
1894
  return builder;
1259
1895
  }
1260
1896
  slotPath.push(...property.getParentPathArray());
1261
1897
  const nestedObjectBuilder = builder.get(slotPath.get());
1262
- nestedObjectBuilder.nested(property.name, property.name);
1898
+ nestedObjectBuilder.nested(property.getResolvedName(), property.name);
1263
1899
  return builder;
1264
1900
  }
1265
1901
  return super.handle(property, builder);
@@ -1287,10 +1923,10 @@ class DeserializeValueHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Proper
1287
1923
  handle(property, builder) {
1288
1924
  if (property.type != _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Object && property.type != _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
1289
1925
  let objectBuilder = builder.getOrDefault("result.variable.object");
1290
- const entitySelectorPath = property.getAssignmentPath({ parent: "entity" });
1926
+ const entitySelectorPath = property.getAssignmentPath({ parent: "unserialized", useFromPropertyName: property.isRenamed });
1291
1927
  if (objectBuilder == null) {
1292
1928
  objectBuilder = builder.get("result")
1293
- .assign("const result", { name: "variable" })
1929
+ .assign("const entity", { name: "variable" })
1294
1930
  .object({ name: "object" });
1295
1931
  }
1296
1932
  if (property.parent == null) {
@@ -2303,14 +2939,17 @@ __webpack_require__.d(__webpack_exports__, {
2303
2939
 
2304
2940
 
2305
2941
  /**
2306
- * 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
2307
2944
  */
2308
2945
  class SerializeDateHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfoHandler {
2309
2946
  handle(property, builder) {
2310
2947
  if (property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
2311
2948
  let objectBuilder = builder.get("if");
2312
- const entitySelectorPath = property.getSelectrorPath({ parent: "entity" });
2313
- 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
+ });
2314
2953
  const assignment = `${property.name}: ${entitySelectorPath} instanceof Date ? ${entitySelectorPath}.toISOString() : ${entitySelectorPath}`;
2315
2954
  // if it is nullable or optional, assign in an if block, otherwise we
2316
2955
  // could unintentionally assign null/undefined to a property that does not exist
@@ -2337,6 +2976,31 @@ class SerializeDateHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyI
2337
2976
  }
2338
2977
 
2339
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
+
2340
3004
  }),
2341
3005
  "./src/codegen/handlers/serialize/SerializeObjectHandler.ts":
2342
3006
  /*!******************************************************************!*\
@@ -2357,7 +3021,9 @@ class SerializeObjectHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Propert
2357
3021
  handle(property, builder) {
2358
3022
  if (property.type === _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Object) {
2359
3023
  const slotPath = new _SlotPath__WEBPACK_IMPORTED_MODULE_2__.SlotPath("assignments");
2360
- const childPath = property.getAssignmentPath({ parent: "result" });
3024
+ const childPath = property.getAssignmentPath({
3025
+ parent: "result"
3026
+ });
2361
3027
  if (property.isNullable || property.isOptional) {
2362
3028
  // Do nothing if it's nullable or optional as property assignments will check
2363
3029
  // and create if it does not exist. This way we can handle null/optional
@@ -2389,7 +3055,7 @@ class SerializeSerializerHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Pro
2389
3055
  if (property.valueSerializer != null) {
2390
3056
  const objectBuilder = builder.getOrDefault("if");
2391
3057
  const assignmentBuilder = builder.getOrDefault("functions");
2392
- const entitySelectorPath = property.getAssignmentPath({ parent: "entity" });
3058
+ const entitySelectorPath = property.getAssignmentPath({ parent: "entity", useFromPropertyName: property.isRenamed });
2393
3059
  const resultSelectorPath = property.getAssignmentPath({ parent: "result" });
2394
3060
  const defaultFunctionWithParameters = this.toNamedFunction(property.valueSerializer.toString(), assignmentBuilder);
2395
3061
  defaultFunctionWithParameters.builder.parameters(...defaultFunctionWithParameters.parameters.map((_, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: entitySelectorPath })));
@@ -2429,7 +3095,7 @@ class SerializeValueHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.Property
2429
3095
  handle(property, builder) {
2430
3096
  if (property.type != _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Object && property.type != _schema__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
2431
3097
  const slot = builder.getOrDefault("if");
2432
- const entitySelectorPath = property.getAssignmentPath({ parent: "entity" });
3098
+ const entitySelectorPath = property.getAssignmentPath({ parent: "entity", useFromPropertyName: property.isRenamed });
2433
3099
  const resultSelectorPath = property.getAssignmentPath({ parent: "result" });
2434
3100
  if (property.parent == null) {
2435
3101
  // Only assign if the incoming entity has the property, this allows partial serialization
@@ -2628,14 +3294,13 @@ class PropertyInfoHandler {
2628
3294
  return result;
2629
3295
  }
2630
3296
  setEnrichedProperty(property, root) {
2631
- const useFromPropertyName = property.from != null;
2632
- const entitySelectorPath = property.getAssignmentPath({ parent: "entity", useFromPropertyName });
3297
+ const entitySelectorPath = property.getAssignmentPath({ parent: "entity" });
2633
3298
  if (property.parent != null) {
2634
3299
  const slotPath = new _SlotPath__WEBPACK_IMPORTED_MODULE_1__.SlotPath("factory", "function", "enriched", "object", "enriched");
2635
3300
  const path = property.parent.getAssignmentPath({ parent: "enriched" });
2636
3301
  slotPath.push(`[${path}]`);
2637
3302
  const objectBuilder = root.get(slotPath.get());
2638
- const childEntityPathSelector = property.getSelectrorPath({ parent: "entity", useFromPropertyName });
3303
+ const childEntityPathSelector = property.getSelectrorPath({ parent: "entity" });
2639
3304
  objectBuilder.property(`${property.name}: ${childEntityPathSelector}`);
2640
3305
  return;
2641
3306
  }
@@ -3587,8 +4252,29 @@ function assertIsValueExpression(value) {
3587
4252
  }
3588
4253
  }
3589
4254
  // Helper function to detect if a string is a property path
3590
- const isPropertyPath = (value) => {
3591
- 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;
3592
4278
  };
3593
4279
  // Helper function to determine if we need to swap the operator for reversed comparisons
3594
4280
  const getSwappedOperator = (operator) => {
@@ -3623,7 +4309,7 @@ const parseCondition = (schema, expression, params) => {
3623
4309
  // This is a parameter path on the left side (e.g., params.distinctPlayers.includes(entity.playerId))
3624
4310
  // For includes method, we need to swap left and right sides
3625
4311
  if (methodMatch[2] === 'includes') {
3626
- const property = getProperty(schema, rightSide);
4312
+ const property = getProperty(schema, rightSide, params);
3627
4313
  const value = getValue(leftSide, params); // retrieve the original value
3628
4314
  const serializer = property.property.valueSerializer;
3629
4315
  comparator.left = serializer ? getValue(String(property.property.valueSerializer(JSON.parse(value.value)))) : value;
@@ -3636,7 +4322,7 @@ const parseCondition = (schema, expression, params) => {
3636
4322
  }
3637
4323
  else {
3638
4324
  // Normal case: property on left, value on right
3639
- const property = getProperty(schema, leftSide);
4325
+ const property = getProperty(schema, leftSide, params);
3640
4326
  const serializer = property.property.valueSerializer;
3641
4327
  const value = getValue(rightSide, params); // retrieve the original value
3642
4328
  comparator.left = property;
@@ -3655,7 +4341,7 @@ const parseCondition = (schema, expression, params) => {
3655
4341
  if (isNegation) {
3656
4342
  comparator.negated = isNegation;
3657
4343
  }
3658
- const property = getProperty(schema, valueTransformMatch[1].trim());
4344
+ const property = getProperty(schema, valueTransformMatch[1].trim(), params);
3659
4345
  const serializer = property.property.valueSerializer;
3660
4346
  const value = getValue(valueTransformMatch[3], params); // retrieve the original value
3661
4347
  // Create the property expression for the left side (no transformer)
@@ -3687,7 +4373,7 @@ const parseCondition = (schema, expression, params) => {
3687
4373
  comparator.negated = isNegation;
3688
4374
  }
3689
4375
  // Create the property expression for the left side with transformer
3690
- const property = getProperty(schema, transformMethodMatch[1]);
4376
+ const property = getProperty(schema, transformMethodMatch[1], params);
3691
4377
  // Set transformer and locale based on the method
3692
4378
  const method = transformMethodMatch[2];
3693
4379
  if (method === 'toLowerCase' || method === 'toLocaleLowerCase') {
@@ -3739,8 +4425,8 @@ const parseCondition = (schema, expression, params) => {
3739
4425
  const left = equalityMatch[1].trim();
3740
4426
  const operator = equalityMatch[2];
3741
4427
  const right = equalityMatch[3].trim();
3742
- const leftIsProperty = isPropertyPath(left);
3743
- const rightIsProperty = isPropertyPath(right);
4428
+ const leftIsProperty = isPropertyPath(left, params);
4429
+ const rightIsProperty = isPropertyPath(right, params);
3744
4430
  // Determine which side is the property and which is the value
3745
4431
  let propertySide, valueSide, finalOperator;
3746
4432
  if (leftIsProperty && !rightIsProperty) {
@@ -3765,7 +4451,7 @@ const parseCondition = (schema, expression, params) => {
3765
4451
  if (isNegation) {
3766
4452
  comparator.negated = isNegation;
3767
4453
  }
3768
- const property = getProperty(schema, propertySide);
4454
+ const property = getProperty(schema, propertySide, params);
3769
4455
  const value = getValue(valueSide, params);
3770
4456
  const serializer = property.property.valueSerializer;
3771
4457
  comparator.left = property;
@@ -3777,8 +4463,8 @@ const parseCondition = (schema, expression, params) => {
3777
4463
  const left = comparisonMatch[1].trim();
3778
4464
  const operator = comparisonMatch[2];
3779
4465
  const right = comparisonMatch[3].trim();
3780
- const leftIsProperty = isPropertyPath(left);
3781
- const rightIsProperty = isPropertyPath(right);
4466
+ const leftIsProperty = isPropertyPath(left, params);
4467
+ const rightIsProperty = isPropertyPath(right, params);
3782
4468
  // Determine which side is the property and which is the value
3783
4469
  let propertySide, valueSide, finalOperator;
3784
4470
  if (leftIsProperty && !rightIsProperty) {
@@ -3803,7 +4489,7 @@ const parseCondition = (schema, expression, params) => {
3803
4489
  if (isNegation) {
3804
4490
  comparator.negated = isNegation;
3805
4491
  }
3806
- const property = getProperty(schema, propertySide);
4492
+ const property = getProperty(schema, propertySide, params);
3807
4493
  const value = getValue(valueSide, params);
3808
4494
  const serializer = property.property.valueSerializer;
3809
4495
  comparator.left = property;
@@ -3814,12 +4500,12 @@ const parseCondition = (schema, expression, params) => {
3814
4500
  // Check for standalone property reference (truthy comparison)
3815
4501
  // Pattern: property name only (e.g., "w.inStock" -> w.inStock === true)
3816
4502
  const standalonePropertyMatch = finalExpression.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$/);
3817
- if (standalonePropertyMatch && isPropertyPath(finalExpression)) {
4503
+ if (standalonePropertyMatch && isPropertyPath(finalExpression, params)) {
3818
4504
  const comparator = getComparator('===');
3819
4505
  if (isNegation) {
3820
4506
  comparator.negated = isNegation;
3821
4507
  }
3822
- const property = getProperty(schema, finalExpression);
4508
+ const property = getProperty(schema, finalExpression, params);
3823
4509
  const value = getValue('true', params);
3824
4510
  const serializer = property.property.valueSerializer;
3825
4511
  comparator.left = property;
@@ -3918,13 +4604,81 @@ const getValueFromParams = (value, params) => {
3918
4604
  }
3919
4605
  return result;
3920
4606
  };
3921
- const getProperty = (schema, value) => {
3922
- // Optimized string splitting - only split if we have the expected pattern
3923
- 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 {
3924
4680
  throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
3925
4681
  }
3926
- const pathSplit = value.split(/[?!.]/g).slice(1);
3927
- const pathString = pathSplit.join(".");
3928
4682
  // Early exit if no path found
3929
4683
  if (!pathString) {
3930
4684
  throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));
@@ -4573,510 +5327,145 @@ class WorkPipeline {
4573
5327
  "./src/pipeline/index.ts":
4574
5328
  /*!*******************************!*\
4575
5329
  !*** ./src/pipeline/index.ts ***!
4576
- \*******************************/
4577
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4578
- __webpack_require__.r(__webpack_exports__);
4579
- __webpack_require__.d(__webpack_exports__, {
4580
- AsyncPipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.AsyncPipeline),
4581
- SyncronousQueue: () => (/* reexport safe */ _SyncronousQueue__WEBPACK_IMPORTED_MODULE_0__.SyncronousQueue),
4582
- TrampolinePipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.TrampolinePipeline),
4583
- WorkPipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.WorkPipeline)
4584
- });
4585
- /* ESM import */var _SyncronousQueue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SyncronousQueue */ "./src/pipeline/SyncronousQueue.ts");
4586
- /* ESM import */var _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TrampolinePipeline */ "./src/pipeline/TrampolinePipeline.ts");
4587
-
4588
-
4589
-
4590
-
4591
- }),
4592
- "./src/plugins/EphemeralDataPlugin.ts":
4593
- /*!********************************************!*\
4594
- !*** ./src/plugins/EphemeralDataPlugin.ts ***!
4595
- \********************************************/
4596
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4597
- __webpack_require__.r(__webpack_exports__);
4598
- __webpack_require__.d(__webpack_exports__, {
4599
- EphemeralDataPlugin: () => (EphemeralDataPlugin)
4600
- });
4601
- /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
4602
- /* ESM import */var _pipeline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../pipeline */ "./src/pipeline/TrampolinePipeline.ts");
4603
- /* ESM import */var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! . */ "./src/plugins/translators/JsonTranslator.ts");
4604
- /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../results */ "./src/results/Result.ts");
4605
-
4606
-
4607
-
4608
-
4609
- class EphemeralDataPlugin {
4610
- databaseName;
4611
- constructor(databaseName) {
4612
- this.databaseName = databaseName;
4613
- }
4614
- bulkPersist(event, done) {
4615
- try {
4616
- const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_0__.WorkPipeline();
4617
- const bulkPersistResult = event.operation.toResult();
4618
- for (const [schemaId, changes] of event.operation) {
4619
- pipeline.pipe((d) => {
4620
- try {
4621
- const { adds, hasItems, removes, updates } = changes;
4622
- if (hasItems === false) {
4623
- d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.success());
4624
- return;
4625
- }
4626
- const result = bulkPersistResult.get(schemaId);
4627
- const schema = event.schemas.get(schemaId);
4628
- (0,_assertions__WEBPACK_IMPORTED_MODULE_2__.assertIsNotNull)(schema);
4629
- const collection = this.resolveCollection(schema);
4630
- collection.load(readResult => {
4631
- if (readResult.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
4632
- d(readResult);
4633
- return;
4634
- }
4635
- for (let i = 0, length = adds.length; i < length; i++) {
4636
- collection.add(adds[i]);
4637
- result.adds.push(adds[i]);
4638
- }
4639
- for (let i = 0, length = updates.length; i < length; i++) {
4640
- collection.update(updates[i].entity);
4641
- result.updates.push(updates[i].entity);
4642
- }
4643
- for (let i = 0, length = removes.length; i < length; i++) {
4644
- collection.remove(removes[i]);
4645
- result.removes.push(removes[i]);
4646
- }
4647
- collection.save(saveResult => {
4648
- if (saveResult.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
4649
- d(saveResult);
4650
- return;
4651
- }
4652
- d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.success());
4653
- });
4654
- });
4655
- }
4656
- catch (e) {
4657
- d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.error(e));
4658
- }
4659
- });
4660
- }
4661
- let successCount = 0;
4662
- pipeline.filter((asyncResult) => {
4663
- if (asyncResult.ok !== _results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.SUCCESS) {
4664
- if (successCount === 0) {
4665
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, asyncResult.error));
4666
- return;
4667
- }
4668
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.partial(event.id, bulkPersistResult, asyncResult.error));
4669
- return;
4670
- }
4671
- successCount++;
4672
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.success(event.id, bulkPersistResult));
4673
- });
4674
- }
4675
- catch (e) {
4676
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, e));
4677
- }
4678
- }
4679
- query(event, done) {
4680
- try {
4681
- const { operation } = event;
4682
- const translator = new ___WEBPACK_IMPORTED_MODULE_3__.JsonTranslator(operation);
4683
- const collection = this.resolveCollection(operation.schema);
4684
- // translate if we are doing any operations like count/sum/min/max/skip/take
4685
- collection.load(r => {
4686
- if (r.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
4687
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, r.error));
4688
- return;
4689
- }
4690
- const cloned = [];
4691
- for (let i = 0, length = collection.records.length; i < length; i++) {
4692
- cloned.push(event.operation.schema.clone(collection.records[i]));
4693
- }
4694
- const translated = translator.translate(cloned);
4695
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.success(event.id, translated));
4696
- });
4697
- }
4698
- catch (e) {
4699
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, e));
4700
- }
4701
- }
4702
- }
4703
-
4704
-
4705
- }),
4706
- "./src/plugins/capabilities/DbPluginCapability.ts":
4707
- /*!********************************************************!*\
4708
- !*** ./src/plugins/capabilities/DbPluginCapability.ts ***!
4709
- \********************************************************/
4710
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4711
- __webpack_require__.r(__webpack_exports__);
4712
- __webpack_require__.d(__webpack_exports__, {
4713
- DbPluginCapability: () => (DbPluginCapability)
4714
- });
4715
- /**
4716
- * Extends plugin functionality through hooks and event handlers without
4717
- * changing the plugin's type (mixin). Essential for maintaining type safety
4718
- * in routier's core systems.
4719
- */
4720
- class DbPluginCapability {
4721
- events = {};
4722
- add(name, callback) {
4723
- this.resolve(name);
4724
- switch (name) {
4725
- case "queryStart":
4726
- this.events["query"].before = callback;
4727
- break;
4728
- case "queryComplete":
4729
- this.events["query"].after = callback;
4730
- break;
4731
- case "destroyStart":
4732
- this.events["destroy"].before = callback;
4733
- break;
4734
- case "destroyComplete":
4735
- this.events["destroy"].after = callback;
4736
- break;
4737
- case "bulkPersistStart":
4738
- this.events["bulkPersist"].before = callback;
4739
- break;
4740
- case "bulkPersistComplete":
4741
- this.events["bulkPersist"].after = callback;
4742
- break;
4743
- }
4744
- return this;
4745
- }
4746
- resolve(name) {
4747
- switch (name) {
4748
- case "queryStart":
4749
- case "queryComplete":
4750
- if (!this.events["query"]) {
4751
- this.events["query"] = {};
4752
- }
4753
- return;
4754
- case "destroyStart":
4755
- case "destroyComplete":
4756
- if (!this.events["destroy"]) {
4757
- this.events["destroy"] = {};
4758
- }
4759
- return;
4760
- case "bulkPersistStart":
4761
- case "bulkPersistComplete":
4762
- if (!this.events["bulkPersist"]) {
4763
- this.events["bulkPersist"] = {};
4764
- }
4765
- return;
4766
- default:
4767
- throw new Error("Exhaustive check");
4768
- }
4769
- }
4770
- apply(plugin) {
4771
- const methodWrappers = [
4772
- { method: 'query', events: this.events.query },
4773
- { method: 'destroy', events: this.events.destroy },
4774
- { method: 'bulkPersist', events: this.events.bulkPersist }
4775
- ];
4776
- // apply the mixins
4777
- for (let i = 0, length = methodWrappers.length; i < length; i++) {
4778
- const { events, method } = methodWrappers[i];
4779
- if (events?.before || events?.after) {
4780
- const original = plugin[method].bind(plugin);
4781
- plugin[method] = ((event, done) => {
4782
- events.before?.(event, done);
4783
- if (events.after) {
4784
- return original(event, (result) => {
4785
- events.after(result);
4786
- done(result);
4787
- });
4788
- }
4789
- return original(event, done);
4790
- });
4791
- }
4792
- }
4793
- }
4794
- }
4795
-
4796
-
4797
- }),
4798
- "./src/plugins/capabilities/index.ts":
4799
- /*!*******************************************!*\
4800
- !*** ./src/plugins/capabilities/index.ts ***!
4801
- \*******************************************/
5330
+ \*******************************/
4802
5331
  (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4803
5332
  __webpack_require__.r(__webpack_exports__);
4804
5333
  __webpack_require__.d(__webpack_exports__, {
4805
- DbPluginCapability: () => (/* reexport safe */ _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginCapability),
4806
- DbPluginLoggingCapability: () => (/* reexport safe */ _logging__WEBPACK_IMPORTED_MODULE_1__.DbPluginLoggingCapability)
5334
+ AsyncPipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.AsyncPipeline),
5335
+ SyncronousQueue: () => (/* reexport safe */ _SyncronousQueue__WEBPACK_IMPORTED_MODULE_0__.SyncronousQueue),
5336
+ TrampolinePipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.TrampolinePipeline),
5337
+ WorkPipeline: () => (/* reexport safe */ _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__.WorkPipeline)
4807
5338
  });
4808
- /* ESM import */var _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DbPluginCapability */ "./src/plugins/capabilities/DbPluginCapability.ts");
4809
- /* ESM import */var _logging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logging */ "./src/plugins/capabilities/logging/index.ts");
5339
+ /* ESM import */var _SyncronousQueue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SyncronousQueue */ "./src/pipeline/SyncronousQueue.ts");
5340
+ /* ESM import */var _TrampolinePipeline__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TrampolinePipeline */ "./src/pipeline/TrampolinePipeline.ts");
4810
5341
 
4811
5342
 
4812
5343
 
4813
5344
 
4814
5345
  }),
4815
- "./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts":
4816
- /*!***********************************************************************!*\
4817
- !*** ./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts ***!
4818
- \***********************************************************************/
5346
+ "./src/plugins/EphemeralDataPlugin.ts":
5347
+ /*!********************************************!*\
5348
+ !*** ./src/plugins/EphemeralDataPlugin.ts ***!
5349
+ \********************************************/
4819
5350
  (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4820
5351
  __webpack_require__.r(__webpack_exports__);
4821
5352
  __webpack_require__.d(__webpack_exports__, {
4822
- DbPluginLoggingCapability: () => (DbPluginLoggingCapability)
5353
+ EphemeralDataPlugin: () => (EphemeralDataPlugin)
4823
5354
  });
4824
- /* ESM import */var _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../DbPluginCapability */ "./src/plugins/capabilities/DbPluginCapability.ts");
4825
- /* ESM import */var _performance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../performance */ "./src/performance/index.ts");
5355
+ /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
5356
+ /* ESM import */var _pipeline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../pipeline */ "./src/pipeline/TrampolinePipeline.ts");
5357
+ /* ESM import */var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! . */ "./src/plugins/translators/JsonTranslator.ts");
5358
+ /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../results */ "./src/results/Result.ts");
4826
5359
 
4827
5360
 
4828
- class DbPluginLoggingCapability {
4829
- logStyle = 'redux';
4830
- maxLogEntries = 100;
4831
- logHistory = [];
4832
- queryPerformance = new Map();
4833
- constructor(options) {
4834
- this.logStyle = options?.logStyle ?? 'redux';
4835
- this.maxLogEntries = options?.maxLogEntries ?? 100;
4836
- }
4837
- apply(plugin) {
4838
- const baseCapability = new _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginCapability();
4839
- const pluginName = plugin.constructor.name;
4840
- // Query logging
4841
- baseCapability
4842
- .add("queryStart", (event) => {
4843
- this.logReduxAction('QUERY_REQUEST', event.id, {
4844
- plugin: pluginName,
4845
- collection: event.operation.schema.collectionName,
4846
- schemaId: event.operation.schema.id,
4847
- changeTracking: event.operation.changeTracking
4848
- }, {
4849
- timestamp: new Date().toISOString(),
4850
- options: this.extractQueryOptions(event.operation)
4851
- });
4852
- this.addToHistory('QUERY_REQUEST', event);
4853
- this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
4854
- })
4855
- .add("queryComplete", (result) => {
4856
- const start = this.queryPerformance.get(result.id);
4857
- this.queryPerformance.delete(result.id);
4858
- const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
4859
- const duration = start == null ? -1 : end - start;
4860
- const performance = this.getPerformanceIndicator(duration);
4861
- if (result.ok === 'success') {
4862
- this.logReduxAction('QUERY_SUCCESS', result.id, {
4863
- plugin: pluginName,
4864
- resultCount: this.getResultCount(result.data),
4865
- resultType: this.getResultType(result.data)
4866
- }, {
4867
- duration: `${duration.toFixed(4)}ms`,
4868
- performance: performance.label,
4869
- timestamp: new Date().toISOString()
4870
- });
4871
- }
4872
- else {
4873
- this.logReduxAction('QUERY_ERROR', result.id, {
4874
- plugin: pluginName,
4875
- error: result.error?.message || result.error,
4876
- isCritical: false
4877
- }, {
4878
- duration: `${duration.toFixed(4)}ms`,
4879
- performance: performance.label,
4880
- timestamp: new Date().toISOString()
4881
- });
4882
- }
4883
- this.addToHistory('QUERY_RESULT', { result, duration });
4884
- });
4885
- // Bulk operations logging
4886
- baseCapability
4887
- .add("bulkPersistStart", (event) => {
4888
- const totalOperations = event.operation.aggregate.size;
4889
- this.logReduxAction('BULK_OPERATIONS_REQUEST', event.id, {
4890
- plugin: pluginName,
4891
- totalOperations,
4892
- schemaCount: event.schemas.size,
4893
- operations: this.extractBulkOperations(event.operation)
4894
- }, {
4895
- timestamp: new Date().toISOString()
4896
- });
4897
- this.addToHistory('BULK_OPERATIONS_REQUEST', event);
4898
- this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
4899
- })
4900
- .add("bulkPersistComplete", (result) => {
4901
- const start = this.queryPerformance.get(result.id);
4902
- this.queryPerformance.delete(result.id);
4903
- const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
4904
- const duration = start == null ? -1 : end - start;
4905
- const performance = this.getPerformanceIndicator(duration);
4906
- if (result.ok === 'success') {
4907
- this.logReduxAction('BULK_OPERATIONS_SUCCESS', result.id, {
4908
- plugin: pluginName,
4909
- completedOperations: this.countCompletedOperations(result.data),
4910
- schemaCount: result.data.size
4911
- }, {
4912
- duration: `${duration.toFixed(4)}ms`,
4913
- performance: performance.label,
4914
- timestamp: new Date().toISOString()
5361
+
5362
+
5363
+ class EphemeralDataPlugin {
5364
+ databaseName;
5365
+ constructor(databaseName) {
5366
+ this.databaseName = databaseName;
5367
+ }
5368
+ bulkPersist(event, done) {
5369
+ try {
5370
+ const bulkPersistResult = event.operation.toResult();
5371
+ const schemas = event.schemas;
5372
+ const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_0__.WorkPipeline();
5373
+ let hasWork = false;
5374
+ for (const [schemaId, changes] of event.operation) {
5375
+ const { adds, hasItems, removes, updates } = changes;
5376
+ if (!hasItems) {
5377
+ continue;
5378
+ }
5379
+ hasWork = true;
5380
+ const result = bulkPersistResult.get(schemaId);
5381
+ const schema = schemas.get(schemaId);
5382
+ (0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertIsNotNull)(schema);
5383
+ pipeline.pipe((d) => {
5384
+ try {
5385
+ const collection = this.resolveCollection(schema);
5386
+ collection.load(readResult => {
5387
+ if (readResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
5388
+ d(readResult);
5389
+ return;
5390
+ }
5391
+ const addsLength = adds.length;
5392
+ const updatesLength = updates.length;
5393
+ const removesLength = removes.length;
5394
+ result.adds = new Array(addsLength);
5395
+ result.updates = new Array(updatesLength);
5396
+ result.removes = new Array(removesLength);
5397
+ for (let j = 0; j < addsLength; j++) {
5398
+ const item = adds[j];
5399
+ collection.add(item);
5400
+ result.adds[j] = item;
5401
+ }
5402
+ for (let j = 0; j < updatesLength; j++) {
5403
+ const item = updates[j].entity;
5404
+ collection.update(item);
5405
+ result.updates[j] = item;
5406
+ }
5407
+ for (let j = 0; j < removesLength; j++) {
5408
+ collection.remove(removes[j]);
5409
+ result.removes[j] = removes[j];
5410
+ }
5411
+ collection.save(saveResult => {
5412
+ if (saveResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
5413
+ d(saveResult);
5414
+ return;
5415
+ }
5416
+ d(_results__WEBPACK_IMPORTED_MODULE_2__.Result.success());
5417
+ });
5418
+ });
5419
+ }
5420
+ catch (e) {
5421
+ d(_results__WEBPACK_IMPORTED_MODULE_2__.Result.error(e));
5422
+ }
4915
5423
  });
4916
5424
  }
4917
- else {
4918
- this.logReduxAction('BULK_OPERATIONS_ERROR', result.id, {
4919
- plugin: pluginName,
4920
- error: result.error?.message || result.error,
4921
- isCritical: false
4922
- }, {
4923
- duration: `${duration.toFixed(4)}ms`,
4924
- performance: performance.label,
4925
- timestamp: new Date().toISOString()
4926
- });
5425
+ // If there is no work, just return the result
5426
+ if (!hasWork) {
5427
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, bulkPersistResult));
5428
+ return;
4927
5429
  }
4928
- this.addToHistory('BULK_OPERATIONS_RESULT', { result, duration });
4929
- });
4930
- // Destroy logging
4931
- baseCapability
4932
- .add("destroyStart", (event) => {
4933
- this.logReduxAction('DESTROY_REQUEST', event.id, {
4934
- plugin: pluginName,
4935
- schemaCount: event.schemas.size
4936
- }, {
4937
- timestamp: new Date().toISOString()
5430
+ pipeline.filter((result) => {
5431
+ if (result.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
5432
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, result.error));
5433
+ return;
5434
+ }
5435
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, bulkPersistResult));
4938
5436
  });
4939
- this.addToHistory('DESTROY_REQUEST', event);
4940
- this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
4941
- })
4942
- .add("destroyComplete", (result) => {
4943
- const start = this.queryPerformance.get(result.id);
4944
- this.queryPerformance.delete(result.id);
4945
- const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
4946
- const duration = start == null ? -1 : end - start;
4947
- const performance = this.getPerformanceIndicator(duration);
4948
- if (result.ok === 'success') {
4949
- this.logReduxAction('DESTROY_SUCCESS', result.id, {
4950
- plugin: pluginName
4951
- }, {
4952
- duration: `${duration.toFixed(4)}ms`,
4953
- performance: performance.label,
4954
- timestamp: new Date().toISOString()
4955
- });
4956
- }
4957
- else {
4958
- this.logReduxAction('DESTROY_ERROR', result.id, {
4959
- plugin: pluginName,
4960
- error: result.error?.message || result.error
4961
- }, {
4962
- duration: `${duration.toFixed(4)}ms`,
4963
- performance: performance.label,
4964
- timestamp: new Date().toISOString()
4965
- });
4966
- }
4967
- this.addToHistory('DESTROY_RESULT', { result, duration });
4968
- });
4969
- baseCapability.apply(plugin);
4970
- }
4971
- getPerformanceIndicator(duration) {
4972
- if (duration > 1000)
4973
- return { emoji: '🐌', color: '#ef4444', label: 'SLOW', level: 'error' };
4974
- if (duration > 500)
4975
- return { emoji: '🐢', color: '#f97316', label: 'MEDIUM', level: 'warning' };
4976
- if (duration > 100)
4977
- return { emoji: '⚡', color: '#eab308', label: 'FAST', level: 'info' };
4978
- return { emoji: '🚀', color: '#22c55e', label: 'INSTANT', level: 'success' };
4979
- }
4980
- logReduxAction(action, eventId, payload, meta) {
4981
- if (this.logStyle !== 'redux')
4982
- return;
4983
- const timestamp = new Date().toISOString();
4984
- console.groupCollapsed(`%c${action} %c@ ${timestamp}`, 'color: #3b82f6; font-weight: bold; font-size: 14px;', 'color: #6b7280; font-size: 12px;');
4985
- console.group('Action');
4986
- console.log('Type:', action);
4987
- console.log('Event ID:', eventId);
4988
- console.log('Timestamp:', timestamp);
4989
- console.groupEnd();
4990
- if (payload) {
4991
- console.group('Payload');
4992
- console.log(payload);
4993
- console.groupEnd();
4994
- }
4995
- if (meta) {
4996
- console.group('Meta');
4997
- console.log(meta);
4998
- console.groupEnd();
4999
- }
5000
- console.groupEnd();
5001
- }
5002
- extractQueryOptions(query) {
5003
- const options = {};
5004
- if (query.options) {
5005
- ['skip', 'take', 'sort', 'filter', 'map', 'distinct'].forEach(type => {
5006
- try {
5007
- const values = query.options.getValues(type);
5008
- if (values.length > 0)
5009
- options[type] = values;
5437
+ }
5438
+ catch (e) {
5439
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
5440
+ }
5441
+ }
5442
+ query(event, done) {
5443
+ try {
5444
+ const operation = event.operation;
5445
+ const schema = operation.schema;
5446
+ const translator = new ___WEBPACK_IMPORTED_MODULE_3__.JsonTranslator(operation);
5447
+ const collection = this.resolveCollection(schema);
5448
+ collection.load(r => {
5449
+ if (r.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
5450
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, r.error));
5451
+ return;
5010
5452
  }
5011
- catch (e) {
5012
- // Skip if option type not supported
5453
+ const records = collection.records;
5454
+ const length = records.length;
5455
+ const cloned = new Array(length);
5456
+ for (let i = 0; i < length; i++) {
5457
+ cloned[i] = schema.clone(records[i]);
5013
5458
  }
5459
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, translator.translate(cloned)));
5014
5460
  });
5015
5461
  }
5016
- return options;
5017
- }
5018
- getResultCount(result) {
5019
- if (Array.isArray(result))
5020
- return `${result.length} items`;
5021
- if (result !== null && typeof result === 'object')
5022
- return '1 object';
5023
- return '1 primitive';
5024
- }
5025
- getResultType(result) {
5026
- if (Array.isArray(result))
5027
- return 'array';
5028
- if (result !== null && typeof result === 'object')
5029
- return 'object';
5030
- return typeof result;
5031
- }
5032
- extractBulkOperations(operations) {
5033
- const aggregate = operations.aggregate;
5034
- return {
5035
- adds: aggregate.adds,
5036
- updates: aggregate.updates,
5037
- removes: aggregate.removes
5038
- };
5039
- }
5040
- countCompletedOperations(result) {
5041
- return result?.aggregate.size || 0;
5042
- }
5043
- addToHistory(type, data) {
5044
- this.logHistory.push({
5045
- type,
5046
- timestamp: Date.now(),
5047
- data
5048
- });
5049
- if (this.logHistory.length > this.maxLogEntries) {
5050
- this.logHistory = this.logHistory.slice(-this.maxLogEntries);
5462
+ catch (e) {
5463
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
5051
5464
  }
5052
5465
  }
5053
- generateId() {
5054
- return Math.random().toString(36).substr(2, 9);
5055
- }
5056
- // Public methods for debugging
5057
- getLogHistory() {
5058
- return [...this.logHistory];
5059
- }
5060
- clearLogHistory() {
5061
- this.logHistory = [];
5062
- }
5063
5466
  }
5064
5467
 
5065
5468
 
5066
- }),
5067
- "./src/plugins/capabilities/logging/index.ts":
5068
- /*!***************************************************!*\
5069
- !*** ./src/plugins/capabilities/logging/index.ts ***!
5070
- \***************************************************/
5071
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5072
- __webpack_require__.r(__webpack_exports__);
5073
- __webpack_require__.d(__webpack_exports__, {
5074
- DbPluginLoggingCapability: () => (/* reexport safe */ _DbPluginLoggingCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginLoggingCapability)
5075
- });
5076
- /* ESM import */var _DbPluginLoggingCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DbPluginLoggingCapability */ "./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts");
5077
-
5078
-
5079
-
5080
5469
  }),
5081
5470
  "./src/plugins/index.ts":
5082
5471
  /*!******************************!*\
@@ -5086,23 +5475,22 @@ __webpack_require__.d(__webpack_exports__, {
5086
5475
  __webpack_require__.r(__webpack_exports__);
5087
5476
  __webpack_require__.d(__webpack_exports__, {
5088
5477
  DataTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.DataTranslator),
5089
- DbPluginCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_1__.DbPluginCapability),
5090
- DbPluginLoggingCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_1__.DbPluginLoggingCapability),
5091
- EphemeralDataPlugin: () => (/* reexport safe */ _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_4__.EphemeralDataPlugin),
5478
+ EphemeralDataPlugin: () => (/* reexport safe */ _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_3__.EphemeralDataPlugin),
5092
5479
  JsonTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.JsonTranslator),
5093
- OptimisticReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_2__.OptimisticReplicationDbPlugin),
5094
- Query: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_3__.Query),
5095
- QueryOptionsCollection: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_3__.QueryOptionsCollection),
5096
- QueryOrdering: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_3__.QueryOrdering),
5097
- ReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_2__.ReplicationDbPlugin),
5098
- SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator)
5480
+ OptimisticReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_1__.OptimisticReplicationDbPlugin),
5481
+ Query: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.Query),
5482
+ QueryOptionsCollection: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOptionsCollection),
5483
+ QueryOrdering: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOrdering),
5484
+ ReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_1__.ReplicationDbPlugin),
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)
5099
5489
  });
5100
5490
  /* ESM import */var _translators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./translators */ "./src/plugins/translators/index.ts");
5101
- /* ESM import */var _capabilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./capabilities */ "./src/plugins/capabilities/index.ts");
5102
- /* ESM import */var _replication__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./replication */ "./src/plugins/replication/index.ts");
5103
- /* ESM import */var _query__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./query */ "./src/plugins/query/index.ts");
5104
- /* ESM import */var _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EphemeralDataPlugin */ "./src/plugins/EphemeralDataPlugin.ts");
5105
-
5491
+ /* ESM import */var _replication__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./replication */ "./src/plugins/replication/index.ts");
5492
+ /* ESM import */var _query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./query */ "./src/plugins/query/index.ts");
5493
+ /* ESM import */var _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./EphemeralDataPlugin */ "./src/plugins/EphemeralDataPlugin.ts");
5106
5494
 
5107
5495
 
5108
5496
 
@@ -5364,9 +5752,6 @@ const getMemoryPluginCollectionSize = (plugin, schema) => {
5364
5752
  }
5365
5753
  throw new Error("Cannot get size of collection for MemoryPlugin, not an instance of MemoryPlugin");
5366
5754
  };
5367
- const HYDRATION_STATUS_PENDING = "hydration-pending";
5368
- const HYDRATION_STATUS_ERROR = "hydration-error";
5369
- const HYDRATION_STATUS_SUCCESS = "hydration-success";
5370
5755
  let hydrationStatus = "hydration-not-started";
5371
5756
  class OptimisticReplicationDbPlugin {
5372
5757
  plugins;
@@ -5686,6 +6071,12 @@ __webpack_require__.r(__webpack_exports__);
5686
6071
  __webpack_require__.d(__webpack_exports__, {
5687
6072
  DataTranslator: () => (DataTranslator)
5688
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
+
5689
6080
  class DataTranslator {
5690
6081
  query;
5691
6082
  functionMap = {
@@ -5698,7 +6089,8 @@ class DataTranslator {
5698
6089
  skip: (data, option) => this.skip(data, option),
5699
6090
  sort: (data, option) => this.sort(data, option),
5700
6091
  sum: (data, option) => this.sum(data, option),
5701
- take: (data, option) => this.take(data, option)
6092
+ take: (data, option) => this.take(data, option),
6093
+ group: (data, option) => this.group(data, option)
5702
6094
  };
5703
6095
  constructor(query) {
5704
6096
  this.query = query;
@@ -5707,7 +6099,13 @@ class DataTranslator {
5707
6099
  this.query.options.forEach(item => {
5708
6100
  data = this.functionMap[item.name](data, item);
5709
6101
  });
5710
- 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);
5711
6109
  }
5712
6110
  }
5713
6111
 
@@ -5746,24 +6144,54 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
5746
6144
  if (Array.isArray(data) == false) {
5747
6145
  throw new Error("Can only map an array of data");
5748
6146
  }
5749
- const response = [];
5750
- // We want deserialization to flow through mappings
5751
- // TODO: Speed this up!
5752
- // Generate a function on the fly?
6147
+ const response = new Array(data.length);
5753
6148
  for (let i = 0, length = data.length; i < length; i++) {
5754
6149
  for (let j = 0, l = option.value.fields.length; j < l; j++) {
5755
6150
  const field = option.value.fields[j];
5756
6151
  if (field.property != null) {
5757
6152
  const value = field.property.getValue(data[i]);
5758
6153
  if (value != null) {
5759
- 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);
5760
6157
  }
5761
6158
  }
5762
6159
  }
5763
- response.push(option.value.selector(data[i]));
6160
+ response[i] = option.value.selector(data[i]);
5764
6161
  }
5765
6162
  return response;
5766
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
+ }
5767
6195
  count(data, _) {
5768
6196
  if (Array.isArray(data)) {
5769
6197
  return data.length;
@@ -5924,6 +6352,30 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
5924
6352
  sort(data, _) {
5925
6353
  return data;
5926
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
+ }
5927
6379
  map(data, option) {
5928
6380
  if (Array.isArray(data) == false) {
5929
6381
  throw new Error("Can only map an array of data");
@@ -5951,6 +6403,91 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
5951
6403
  }
5952
6404
 
5953
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
+
5954
6491
  }),
5955
6492
  "./src/plugins/translators/index.ts":
5956
6493
  /*!******************************************!*\
@@ -5961,11 +6498,21 @@ __webpack_require__.r(__webpack_exports__);
5961
6498
  __webpack_require__.d(__webpack_exports__, {
5962
6499
  DataTranslator: () => (/* reexport safe */ _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTranslator),
5963
6500
  JsonTranslator: () => (/* reexport safe */ _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__.JsonTranslator),
5964
- 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)
5965
6505
  });
5966
6506
  /* ESM import */var _DataTranslator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DataTranslator */ "./src/plugins/translators/DataTranslator.ts");
5967
6507
  /* ESM import */var _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JsonTranslator */ "./src/plugins/translators/JsonTranslator.ts");
5968
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
+
5969
6516
 
5970
6517
 
5971
6518
 
@@ -6112,10 +6659,16 @@ __webpack_require__.r(__webpack_exports__);
6112
6659
  __webpack_require__.d(__webpack_exports__, {
6113
6660
  PropertyInfo: () => (PropertyInfo)
6114
6661
  });
6115
- /* ESM import */var _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./property/types/SchemaArray */ "./src/schema/property/types/SchemaArray.ts");
6116
- /* 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");
6117
6664
 
6118
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
+ ]);
6119
6672
  /**
6120
6673
  * Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.
6121
6674
  */
@@ -6181,7 +6734,7 @@ class PropertyInfo {
6181
6734
  this.name = name;
6182
6735
  this.type = schema.type;
6183
6736
  this.literals = schema.literals;
6184
- if (schema instanceof _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_0__.SchemaArray) {
6737
+ if (schema instanceof _property_types_SchemaArray__WEBPACK_IMPORTED_MODULE_1__.SchemaArray) {
6185
6738
  this.innerSchema = schema.innerSchema;
6186
6739
  }
6187
6740
  this.isNullable = schema.isNullable;
@@ -6225,6 +6778,12 @@ class PropertyInfo {
6225
6778
  this._levelCache = level;
6226
6779
  return level;
6227
6780
  }
6781
+ get isRenamed() {
6782
+ return !!this.from;
6783
+ }
6784
+ get supportsDeserialization() {
6785
+ return this.valueDeserializer != null || SUPPORTED_DESERIALIZATION_TYPES.has(this.type);
6786
+ }
6228
6787
  _getPropertyChain() {
6229
6788
  if (this._propertyChainCache) {
6230
6789
  return this._propertyChainCache;
@@ -6254,6 +6813,9 @@ class PropertyInfo {
6254
6813
  }
6255
6814
  return path;
6256
6815
  }
6816
+ getResolvedName() {
6817
+ return this.from ?? this.name;
6818
+ }
6257
6819
  /**
6258
6820
  * Returns an array of property names representing the path from the root to this property.
6259
6821
  *
@@ -6338,12 +6900,17 @@ class PropertyInfo {
6338
6900
  return null;
6339
6901
  }
6340
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
+ }
6341
6908
  let current = instance;
6342
- for (const prop of pathArray) {
6909
+ for (let i = 0; i < length; i++) {
6343
6910
  if (current == null) {
6344
6911
  return null;
6345
6912
  }
6346
- current = current[prop];
6913
+ current = current[pathArray[i]];
6347
6914
  }
6348
6915
  return current;
6349
6916
  }
@@ -6390,8 +6957,8 @@ class PropertyInfo {
6390
6957
  getSelectrorPath(options) {
6391
6958
  const parts = this._resolvePathArray({
6392
6959
  root: options.parent,
6393
- assignmentType: options.assignmentType,
6394
- useFromPropertyName: options.useFromPropertyName
6960
+ assignmentType: options?.assignmentType,
6961
+ useFromPropertyName: options?.useFromPropertyName
6395
6962
  });
6396
6963
  return parts.join("");
6397
6964
  }
@@ -6416,16 +6983,16 @@ class PropertyInfo {
6416
6983
  if (this.valueDeserializer != null) {
6417
6984
  return this.valueDeserializer(value);
6418
6985
  }
6419
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Date) {
6986
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Date) {
6420
6987
  return new Date(value);
6421
6988
  }
6422
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.String) {
6989
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.String) {
6423
6990
  return String(value);
6424
6991
  }
6425
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Number) {
6992
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Number) {
6426
6993
  return Number(value);
6427
6994
  }
6428
- if (this.type === _types__WEBPACK_IMPORTED_MODULE_1__.SchemaTypes.Boolean) {
6995
+ if (this.type === _types__WEBPACK_IMPORTED_MODULE_0__.SchemaTypes.Boolean) {
6429
6996
  return Boolean(value);
6430
6997
  }
6431
6998
  throw new Error(`Unsupported deserialization for type. Type: ${this.type}`);
@@ -6447,7 +7014,7 @@ __webpack_require__.d(__webpack_exports__, {
6447
7014
  /* ESM import */var _table_SchemaComputed__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./table/SchemaComputed */ "./src/schema/table/SchemaComputed.ts");
6448
7015
  /* ESM import */var _property_base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./property/base/SchemaBase */ "./src/schema/property/base/SchemaBase.ts");
6449
7016
  /* ESM import */var _PropertyInfo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PropertyInfo */ "./src/schema/PropertyInfo.ts");
6450
- /* 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");
6451
7018
  /* ESM import */var _codegen_handlers_EnrichmentHandlerBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../codegen/handlers/EnrichmentHandlerBuilder */ "./src/codegen/handlers/EnrichmentHandlerBuilder.ts");
6452
7019
  /* ESM import */var _codegen_handlers_MergeHandlerBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../codegen/handlers/MergeHandlerBuilder */ "./src/codegen/handlers/MergeHandlerBuilder.ts");
6453
7020
  /* ESM import */var _codegen_handlers_PrepareHandlerBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../codegen/handlers/PrepareHandlerBuilder */ "./src/codegen/handlers/PrepareHandlerBuilder.ts");
@@ -6460,11 +7027,13 @@ __webpack_require__.d(__webpack_exports__, {
6460
7027
  /* ESM import */var _codegen_handlers_HashHandlerBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../codegen/handlers/HashHandlerBuilder */ "./src/codegen/handlers/HashHandlerBuilder.ts");
6461
7028
  /* ESM import */var _codegen_handlers_EnableChangeTrackingHandlerBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../codegen/handlers/EnableChangeTrackingHandlerBuilder */ "./src/codegen/handlers/EnableChangeTrackingHandlerBuilder.ts");
6462
7029
  /* ESM import */var _codegen_handlers_FreezeHandlerBuilder__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../codegen/handlers/FreezeHandlerBuilder */ "./src/codegen/handlers/FreezeHandlerBuilder.ts");
6463
- /* 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");
6464
7031
  /* ESM import */var _codegen_handlers_SerializeHandlerBuilder__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../codegen/handlers/SerializeHandlerBuilder */ "./src/codegen/handlers/SerializeHandlerBuilder.ts");
6465
- /* 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");
6466
7033
  /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./src/schema/types.ts");
6467
- /* 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
+
6468
7037
 
6469
7038
 
6470
7039
 
@@ -6649,6 +7218,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6649
7218
  const enableChangeTrackingHandlerBuilder = new _codegen_handlers_EnableChangeTrackingHandlerBuilder__WEBPACK_IMPORTED_MODULE_15__.EnableChangeTrackingHandlerBuilder();
6650
7219
  const freezeHandlerBuilder = new _codegen_handlers_FreezeHandlerBuilder__WEBPACK_IMPORTED_MODULE_16__.FreezeHandlerBuilder();
6651
7220
  const serializeHandlerBuilder = new _codegen_handlers_SerializeHandlerBuilder__WEBPACK_IMPORTED_MODULE_17__.SerializeHandlerBuilder();
7221
+ const compareIdsHandlerBuilder = new _codegen_handlers_CompareIdsHandlerBuilder__WEBPACK_IMPORTED_MODULE_18__.CompareIdsHandlerBuilder();
6652
7222
  const enricher = enrichmentHandlerBuilder.build();
6653
7223
  const merge = mergeHandlerFactory.build();
6654
7224
  const prepare = prepareHandlerBuilder.build();
@@ -6662,26 +7232,36 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6662
7232
  const enableChangeTrackingHandler = enableChangeTrackingHandlerBuilder.build();
6663
7233
  const freezeHandler = freezeHandlerBuilder.build();
6664
7234
  const serializeHandler = serializeHandlerBuilder.build();
6665
- const changeTrackingCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7235
+ const compareIdsHandler = compareIdsHandlerBuilder.build();
7236
+ const changeTrackingCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6666
7237
  changeTrackingCodeBuilder.raw(`function ${this.createChangeTracker.toString()}`);
6667
7238
  changeTrackingCodeBuilder.slot("declarations").variable("enableChangeTracking").value('createChangeTracker()');
6668
7239
  changeTrackingCodeBuilder.slot("assignment");
6669
7240
  changeTrackingCodeBuilder.slot("return").raw('\treturn enableChangeTracking(entity);');
6670
- const freezeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7241
+ const freezeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6671
7242
  freezeCodeBuilder.slot("assignment");
6672
7243
  freezeCodeBuilder.slot("return").raw('\treturn Object.freeze(entity);');
6673
- const enricherCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7244
+ const enricherCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6674
7245
  const enricherFunctionRoot = enricherCodeBuilder.factory("factory", { name: "factory" }).parameters({ name: "collectionName", value: this.collectionName });
6675
7246
  const enricherFunctionBody = enricherFunctionRoot.function(undefined, { name: "function" }).parameters("entity", "changeTrackingType").return();
6676
- enricherFunctionBody.raw(`function ${this.createChangeTracker.toString()}`);
6677
- 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");
6678
7252
  enricherFunctionBody.slot("enriched");
6679
7253
  enricherFunctionBody.slot("declarations");
6680
7254
  enricherFunctionBody.slot("assignment");
6681
7255
  enricherFunctionBody.slot("ifs");
6682
7256
  enricherFunctionBody.slot("tracking").if('changeTrackingType === "immutable"', { name: "freeze" });
6683
- enricherFunctionBody.raw('\treturn enableChangeTracking(enriched);');
6684
- 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();
6685
7265
  const mergeFunctionRoot = mergeCodeBuilder.factory("factory", { name: "factory" }).parameters({ name: "collectionName", value: this.collectionName });
6686
7266
  const mergeFunctionBody = mergeFunctionRoot.function(undefined, { name: "function" }).parameters("destination", "source").return();
6687
7267
  const pauseFunctionBody = mergeFunctionBody.function("pause")
@@ -6700,40 +7280,43 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6700
7280
  unpause();
6701
7281
 
6702
7282
  return destination;`);
6703
- const prepareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7283
+ const prepareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6704
7284
  prepareCodeBuilder.slot("result");
6705
7285
  prepareCodeBuilder.slot("assignments");
6706
7286
  prepareCodeBuilder.slot("return").raw(` return result;`);
6707
- const stripCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7287
+ const stripCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6708
7288
  stripCodeBuilder.slot("result");
6709
7289
  stripCodeBuilder.slot("return").raw(` return result;`);
6710
- const cloneCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7290
+ const cloneCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6711
7291
  cloneCodeBuilder.slot("result").raw("const result = {};");
6712
7292
  ;
6713
7293
  cloneCodeBuilder.slot("assignments");
6714
7294
  cloneCodeBuilder.slot("if");
6715
7295
  cloneCodeBuilder.slot("return").raw(` return result;`);
6716
- const compareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7296
+ const compareCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6717
7297
  compareCodeBuilder.slot("result");
6718
7298
  compareCodeBuilder.slot("return").raw(` return result;`);
6719
- 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();
6720
7303
  deserializeCodeBuilder.slot("functions");
6721
7304
  deserializeCodeBuilder.slot("result");
6722
7305
  deserializeCodeBuilder.slot("if");
6723
- deserializeCodeBuilder.slot("return").raw(` return result;`);
6724
- 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();
6725
7308
  serializeCodeBuilder.slot("result").raw("const result = {};");
6726
7309
  serializeCodeBuilder.slot("assignments");
6727
7310
  serializeCodeBuilder.slot("functions");
6728
7311
  serializeCodeBuilder.slot("if");
6729
7312
  serializeCodeBuilder.slot("return").raw(` return result;`);
6730
- const idSelectorCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7313
+ const idSelectorCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6731
7314
  idSelectorCodeBuilder.slot("result");
6732
7315
  idSelectorCodeBuilder.slot("return").raw(` return result;`);
6733
- const hashTypeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7316
+ const hashTypeCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6734
7317
  hashTypeCodeBuilder.slot("ifs");
6735
7318
  hashTypeCodeBuilder.slot("return").raw(` return "Ids";`);
6736
- const hashCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_18__.CodeBuilder();
7319
+ const hashCodeBuilder = new _codegen__WEBPACK_IMPORTED_MODULE_19__.CodeBuilder();
6737
7320
  hashCodeBuilder.slot("functions").raw(`
6738
7321
  function stringifyDate(d) {
6739
7322
 
@@ -6788,6 +7371,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6788
7371
  hashHandler.handle(property, hashCodeBuilder);
6789
7372
  enableChangeTrackingHandler.handle(property, changeTrackingCodeBuilder);
6790
7373
  freezeHandler.handle(property, freezeCodeBuilder);
7374
+ compareIdsHandler.handle(property, compareIdsCodeBuilder);
6791
7375
  });
6792
7376
  if (idProperties.length === 0) {
6793
7377
  throw new Error(`Schema must have a key. Use .key() to mark a property as a key. Collection Name: ${this.collectionName}`);
@@ -6796,20 +7380,36 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6796
7380
  const mergeParams = mergeFunctionRoot.getParameters();
6797
7381
  const enrichGenerator = Function(`return ${enricherCodeBuilder.toString()}`);
6798
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"));
6799
7396
  const getIdsFunction = Function("entity", idSelectorCodeBuilder.toString());
6800
7397
  const getHashTypeFunction = Function("entity", hashTypeCodeBuilder.toString());
6801
7398
  const prepareFunction = Function("entity", prepareCodeBuilder.toString());
6802
7399
  const cloneFunction = Function("entity", cloneCodeBuilder.toString());
6803
- const deserializeFunction = Function("entity", deserializeCodeBuilder.toString());
7400
+ const deserializeFunction = Function("unserialized", deserializeCodeBuilder.toString());
6804
7401
  const serializeFunction = Function("entity", serializeCodeBuilder.toString());
6805
7402
  const compareFunction = Function("a", "b", compareCodeBuilder.toString());
6806
- ;
6807
7403
  const stripFunction = Function("entity", stripCodeBuilder.toString());
6808
7404
  const hashFunction = Function("entity", "type", hashCodeBuilder.toString());
6809
7405
  const enableChangeTrackingFunction = Function("entity", changeTrackingCodeBuilder.toString());
6810
7406
  const freezeFunction = Function("entity", freezeCodeBuilder.toString());
7407
+ const compareIdsFunction = Function("a", "b", compareIdsCodeBuilder.toString());
7408
+ const preprocessFunction = Function("entity", preprocessCodeBuilder.toString());
6811
7409
  const enricherFactoryFunction = enrichGenerator();
7410
+ const postProcessFactoryFunction = postProcessGenerator();
6812
7411
  const mergeFactoryFunction = mergeGenerator();
7412
+ const postProcessFunction = postProcessFactoryFunction(...postProcessParams.map(w => w.value));
6813
7413
  const enricherFunction = enricherFactoryFunction(...enrichParams.map(w => w.value));
6814
7414
  const mergeFunction = mergeFactoryFunction(...mergeParams.map(w => w.value));
6815
7415
  const idPropertyNames = idProperties.map(w => w.name);
@@ -6820,7 +7420,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6820
7420
  return getIdsFunction(entity)[0];
6821
7421
  };
6822
7422
  const getProperty = (id) => propertyMap.get(id);
6823
- 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(","));
6824
7424
  // memoize this by the validProperties
6825
7425
  // TODO: See if we can generate a function to do this and eliminate loops
6826
7426
  const deserializePartial = (item, properties) => {
@@ -6835,8 +7435,9 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6835
7435
  }
6836
7436
  return item;
6837
7437
  };
6838
- return {
6839
- createSubscription: (signal) => new _communication_broadcast__WEBPACK_IMPORTED_MODULE_20__.SchemaSubscription(id, signal),
7438
+ const result = {
7439
+ preprocess: preprocessFunction,
7440
+ postprocess: postProcessFunction,
6840
7441
  getId,
6841
7442
  getProperty,
6842
7443
  properties,
@@ -6851,6 +7452,7 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6851
7452
  deserialize: deserializeFunction,
6852
7453
  serialize: serializeFunction,
6853
7454
  compare: compareFunction,
7455
+ compareIds: compareIdsFunction,
6854
7456
  strip: stripFunction,
6855
7457
  hash: hashFunction,
6856
7458
  id,
@@ -6912,9 +7514,13 @@ class SchemaDefinition extends _property_base_SchemaBase__WEBPACK_IMPORTED_MODUL
6912
7514
  return indexes;
6913
7515
  }
6914
7516
  };
7517
+ return {
7518
+ createSubscription: (signal) => new _communication_broadcast__WEBPACK_IMPORTED_MODULE_21__.SchemaSubscription(result, signal),
7519
+ ...result
7520
+ };
6915
7521
  }
6916
7522
  catch (e) {
6917
- 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}`);
6918
7524
  }
6919
7525
  }
6920
7526
  }
@@ -7030,43 +7636,81 @@ class SubscriptionListener {
7030
7636
  }
7031
7637
  class SchemaSubscription {
7032
7638
  id;
7033
- schemaId;
7639
+ schema;
7034
7640
  createdAt;
7035
- constructor(schemaId, signal) {
7641
+ constructor(schema, signal) {
7036
7642
  this.createdAt = (0,_performance__WEBPACK_IMPORTED_MODULE_0__.now)();
7037
7643
  this.id = (0,_utilities__WEBPACK_IMPORTED_MODULE_1__.uuid)(8);
7038
- this.schemaId = schemaId;
7644
+ this.schema = schema;
7039
7645
  signal?.addEventListener("abort", () => {
7040
7646
  this.dispose();
7041
7647
  }, { once: true });
7042
7648
  }
7043
7649
  send(changes) {
7044
- 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
+ }
7045
7670
  // Send message to all listeners.
7046
7671
  // Since we create a new listener when we do onMessage,
7047
7672
  // we don't need to worry about sending to ourselves, it
7048
7673
  // can't happen
7049
7674
  regisry.sender.send({
7050
- data: changes,
7675
+ data: preprocessedChanges,
7051
7676
  timestamp: (0,_performance__WEBPACK_IMPORTED_MODULE_0__.now)()
7052
7677
  });
7053
7678
  }
7054
7679
  onMessage(callback) {
7055
- const regisry = getChannelRegistry(this.schemaId);
7680
+ const regisry = getChannelRegistry(this.schema.id);
7056
7681
  // Link the callback to an instance
7057
7682
  regisry.receiver.addListener(this.id, ({ data, timestamp }) => {
7058
7683
  if (timestamp < this.createdAt) {
7059
7684
  // Sent before the receiver was even created
7060
7685
  return;
7061
7686
  }
7062
- 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);
7063
7707
  });
7064
7708
  }
7065
7709
  dispose() {
7066
7710
  this[Symbol.dispose]();
7067
7711
  }
7068
7712
  [Symbol.dispose]() {
7069
- const regisry = getChannelRegistry(this.schemaId);
7713
+ const regisry = getChannelRegistry(this.schema.id);
7070
7714
  // Remove listeners for this instance only
7071
7715
  regisry.receiver.removeListeners(this.id);
7072
7716
  }
@@ -7614,6 +8258,8 @@ __webpack_require__.d(__webpack_exports__, {
7614
8258
  SchemaTracked: () => (SchemaTracked)
7615
8259
  });
7616
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
+
7617
8263
 
7618
8264
  class SchemaTracked extends _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__.SchemaBase {
7619
8265
  instance;
@@ -7623,6 +8269,9 @@ class SchemaTracked extends _base_SchemaBase__WEBPACK_IMPORTED_MODULE_0__.Schema
7623
8269
  this.instance = current.instance;
7624
8270
  this.isUnmapped = false;
7625
8271
  }
8272
+ key() {
8273
+ return new _SchemaKey__WEBPACK_IMPORTED_MODULE_1__.SchemaKey(this);
8274
+ }
7626
8275
  }
7627
8276
 
7628
8277
 
@@ -8330,11 +8979,13 @@ __webpack_require__.d(__webpack_exports__, {
8330
8979
  cast: () => (/* reexport safe */ _objects__WEBPACK_IMPORTED_MODULE_3__.cast),
8331
8980
  clone: () => (/* reexport safe */ _objects__WEBPACK_IMPORTED_MODULE_3__.clone),
8332
8981
  combineQueryOptionsCollections: () => (/* reexport safe */ _queryOptionsCollection__WEBPACK_IMPORTED_MODULE_7__.combineQueryOptionsCollections),
8982
+ fastHash: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.fastHash),
8333
8983
  hash: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.hash),
8334
8984
  isDate: () => (/* reexport safe */ _dates__WEBPACK_IMPORTED_MODULE_2__.isDate),
8335
8985
  isNodeRuntime: () => (/* reexport safe */ _runtime__WEBPACK_IMPORTED_MODULE_4__.isNodeRuntime),
8336
8986
  noop: () => (/* reexport safe */ _functions__WEBPACK_IMPORTED_MODULE_9__.noop),
8337
8987
  resolveBulkPersistChanges: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_6__.resolveBulkPersistChanges),
8988
+ stringifyObject: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.stringifyObject),
8338
8989
  toEventArray: () => (/* reexport safe */ _dbPluginEventUtils__WEBPACK_IMPORTED_MODULE_8__.toEventArray),
8339
8990
  toMap: () => (/* reexport safe */ _arrays__WEBPACK_IMPORTED_MODULE_0__.toMap),
8340
8991
  uuid: () => (/* reexport safe */ _uuid__WEBPACK_IMPORTED_MODULE_5__.uuid),
@@ -8458,7 +9109,9 @@ const isNodeRuntime = () => typeof process !== 'undefined' &&
8458
9109
  (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8459
9110
  __webpack_require__.r(__webpack_exports__);
8460
9111
  __webpack_require__.d(__webpack_exports__, {
8461
- hash: () => (hash)
9112
+ fastHash: () => (fastHash),
9113
+ hash: () => (hash),
9114
+ stringifyObject: () => (stringifyObject)
8462
9115
  });
8463
9116
  const hash = (value, seed = 0) => {
8464
9117
  // From Stack Overflow
@@ -8475,6 +9128,143 @@ const hash = (value, seed = 0) => {
8475
9128
  h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
8476
9129
  return 4294967296 * (2097151 & h2) + (h1 >>> 0);
8477
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
+ }
8478
9268
 
8479
9269
 
8480
9270
  }),
@@ -8608,12 +9398,11 @@ __webpack_require__.d(__webpack_exports__, {
8608
9398
  Block: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.Block),
8609
9399
  BulkPersistChanges: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.BulkPersistChanges),
8610
9400
  BulkPersistResult: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.BulkPersistResult),
9401
+ Capability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_11__.Capability),
8611
9402
  CodeBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.CodeBuilder),
8612
9403
  ComparatorExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.ComparatorExpression),
8613
9404
  ContainerBlock: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.ContainerBlock),
8614
9405
  DataTranslator: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.DataTranslator),
8615
- DbPluginCapability: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.DbPluginCapability),
8616
- DbPluginLoggingCapability: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.DbPluginLoggingCapability),
8617
9406
  EmptyExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.EmptyExpression),
8618
9407
  EphemeralDataPlugin: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.EphemeralDataPlugin),
8619
9408
  Expression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.Expression),
@@ -8628,6 +9417,7 @@ __webpack_require__.d(__webpack_exports__, {
8628
9417
  ObjectBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.ObjectBuilder),
8629
9418
  OperatorExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.OperatorExpression),
8630
9419
  OptimisticReplicationDbPlugin: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.OptimisticReplicationDbPlugin),
9420
+ PerformanceCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_11__.PerformanceCapability),
8631
9421
  PluginEventResult: () => (/* reexport safe */ _results__WEBPACK_IMPORTED_MODULE_8__.PluginEventResult),
8632
9422
  PropertyExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.PropertyExpression),
8633
9423
  PropertyInfo: () => (/* reexport safe */ _schema__WEBPACK_IMPORTED_MODULE_9__.PropertyInfo),
@@ -8669,7 +9459,11 @@ __webpack_require__.d(__webpack_exports__, {
8669
9459
  StringBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.StringBuilder),
8670
9460
  SyncronousQueue: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.SyncronousQueue),
8671
9461
  TagCollection: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.TagCollection),
9462
+ TracingCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_11__.TracingCapability),
8672
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),
8673
9467
  ValueExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.ValueExpression),
8674
9468
  VariableBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.VariableBuilder),
8675
9469
  WorkPipeline: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.WorkPipeline),
@@ -8682,6 +9476,7 @@ __webpack_require__.d(__webpack_exports__, {
8682
9476
  clone: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.clone),
8683
9477
  combineExpressions: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.combineExpressions),
8684
9478
  combineQueryOptionsCollections: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.combineQueryOptionsCollections),
9479
+ fastHash: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.fastHash),
8685
9480
  forEach: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.forEach),
8686
9481
  getProperties: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.getProperties),
8687
9482
  hash: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.hash),
@@ -8693,6 +9488,7 @@ __webpack_require__.d(__webpack_exports__, {
8693
9488
  now: () => (/* reexport safe */ _performance__WEBPACK_IMPORTED_MODULE_5__.now),
8694
9489
  resolveBulkPersistChanges: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.resolveBulkPersistChanges),
8695
9490
  s: () => (/* reexport safe */ _schema__WEBPACK_IMPORTED_MODULE_9__.s),
9491
+ stringifyObject: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.stringifyObject),
8696
9492
  toEventArray: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.toEventArray),
8697
9493
  toExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.toExpression),
8698
9494
  toMap: () => (/* reexport safe */ _utilities__WEBPACK_IMPORTED_MODULE_10__.toMap),
@@ -8711,6 +9507,8 @@ __webpack_require__.d(__webpack_exports__, {
8711
9507
  /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./results */ "./src/results/index.ts");
8712
9508
  /* ESM import */var _schema__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./schema */ "./src/schema/index.ts");
8713
9509
  /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utilities */ "./src/utilities/index.ts");
9510
+ /* ESM import */var _capabilities__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./capabilities */ "./src/capabilities/index.ts");
9511
+
8714
9512
 
8715
9513
 
8716
9514
 
@@ -8733,12 +9531,11 @@ var __webpack_exports__AsyncPipeline = __webpack_exports__.AsyncPipeline;
8733
9531
  var __webpack_exports__Block = __webpack_exports__.Block;
8734
9532
  var __webpack_exports__BulkPersistChanges = __webpack_exports__.BulkPersistChanges;
8735
9533
  var __webpack_exports__BulkPersistResult = __webpack_exports__.BulkPersistResult;
9534
+ var __webpack_exports__Capability = __webpack_exports__.Capability;
8736
9535
  var __webpack_exports__CodeBuilder = __webpack_exports__.CodeBuilder;
8737
9536
  var __webpack_exports__ComparatorExpression = __webpack_exports__.ComparatorExpression;
8738
9537
  var __webpack_exports__ContainerBlock = __webpack_exports__.ContainerBlock;
8739
9538
  var __webpack_exports__DataTranslator = __webpack_exports__.DataTranslator;
8740
- var __webpack_exports__DbPluginCapability = __webpack_exports__.DbPluginCapability;
8741
- var __webpack_exports__DbPluginLoggingCapability = __webpack_exports__.DbPluginLoggingCapability;
8742
9539
  var __webpack_exports__EmptyExpression = __webpack_exports__.EmptyExpression;
8743
9540
  var __webpack_exports__EphemeralDataPlugin = __webpack_exports__.EphemeralDataPlugin;
8744
9541
  var __webpack_exports__Expression = __webpack_exports__.Expression;
@@ -8753,6 +9550,7 @@ var __webpack_exports__NotParsableExpression = __webpack_exports__.NotParsableEx
8753
9550
  var __webpack_exports__ObjectBuilder = __webpack_exports__.ObjectBuilder;
8754
9551
  var __webpack_exports__OperatorExpression = __webpack_exports__.OperatorExpression;
8755
9552
  var __webpack_exports__OptimisticReplicationDbPlugin = __webpack_exports__.OptimisticReplicationDbPlugin;
9553
+ var __webpack_exports__PerformanceCapability = __webpack_exports__.PerformanceCapability;
8756
9554
  var __webpack_exports__PluginEventResult = __webpack_exports__.PluginEventResult;
8757
9555
  var __webpack_exports__PropertyExpression = __webpack_exports__.PropertyExpression;
8758
9556
  var __webpack_exports__PropertyInfo = __webpack_exports__.PropertyInfo;
@@ -8794,7 +9592,11 @@ var __webpack_exports__SqlTranslator = __webpack_exports__.SqlTranslator;
8794
9592
  var __webpack_exports__StringBuilder = __webpack_exports__.StringBuilder;
8795
9593
  var __webpack_exports__SyncronousQueue = __webpack_exports__.SyncronousQueue;
8796
9594
  var __webpack_exports__TagCollection = __webpack_exports__.TagCollection;
9595
+ var __webpack_exports__TracingCapability = __webpack_exports__.TracingCapability;
8797
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;
8798
9600
  var __webpack_exports__ValueExpression = __webpack_exports__.ValueExpression;
8799
9601
  var __webpack_exports__VariableBuilder = __webpack_exports__.VariableBuilder;
8800
9602
  var __webpack_exports__WorkPipeline = __webpack_exports__.WorkPipeline;
@@ -8807,6 +9609,7 @@ var __webpack_exports__cast = __webpack_exports__.cast;
8807
9609
  var __webpack_exports__clone = __webpack_exports__.clone;
8808
9610
  var __webpack_exports__combineExpressions = __webpack_exports__.combineExpressions;
8809
9611
  var __webpack_exports__combineQueryOptionsCollections = __webpack_exports__.combineQueryOptionsCollections;
9612
+ var __webpack_exports__fastHash = __webpack_exports__.fastHash;
8810
9613
  var __webpack_exports__forEach = __webpack_exports__.forEach;
8811
9614
  var __webpack_exports__getProperties = __webpack_exports__.getProperties;
8812
9615
  var __webpack_exports__hash = __webpack_exports__.hash;
@@ -8818,12 +9621,13 @@ var __webpack_exports__noop = __webpack_exports__.noop;
8818
9621
  var __webpack_exports__now = __webpack_exports__.now;
8819
9622
  var __webpack_exports__resolveBulkPersistChanges = __webpack_exports__.resolveBulkPersistChanges;
8820
9623
  var __webpack_exports__s = __webpack_exports__.s;
9624
+ var __webpack_exports__stringifyObject = __webpack_exports__.stringifyObject;
8821
9625
  var __webpack_exports__toEventArray = __webpack_exports__.toEventArray;
8822
9626
  var __webpack_exports__toExpression = __webpack_exports__.toExpression;
8823
9627
  var __webpack_exports__toMap = __webpack_exports__.toMap;
8824
9628
  var __webpack_exports__toPromise = __webpack_exports__.toPromise;
8825
9629
  var __webpack_exports__uuid = __webpack_exports__.uuid;
8826
9630
  var __webpack_exports__uuidv4 = __webpack_exports__.uuidv4;
8827
- 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__CodeBuilder as CodeBuilder, __webpack_exports__ComparatorExpression as ComparatorExpression, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__DbPluginCapability as DbPluginCapability, __webpack_exports__DbPluginLoggingCapability as DbPluginLoggingCapability, __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__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__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 };
8828
9632
 
8829
9633
  //# sourceMappingURL=index.js.map