@routier/core 0.0.4 → 0.0.6

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.
package/dist/index.js CHANGED
@@ -51,6 +51,590 @@ 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
+ isValidObject(obj) {
66
+ return typeof obj === "object" && obj !== null;
67
+ }
68
+ getObjectName(obj) {
69
+ return obj?.constructor?.name || 'root';
70
+ }
71
+ exploreObjectMethods(obj, callback, options = {}) {
72
+ if (!this.isValidObject(obj)) {
73
+ return;
74
+ }
75
+ const { maxDepth = 10, includeNonEnumerable = false, filter = () => true } = options;
76
+ const rootName = this.getObjectName(obj);
77
+ const visited = new Set();
78
+ // Explore root methods
79
+ this.exploreRootMethods(obj, callback, filter);
80
+ // Explore nested methods
81
+ this.exploreNestedMethods(obj, callback, filter, [rootName], visited, maxDepth, includeNonEnumerable);
82
+ }
83
+ exploreRootMethods(obj, callback, filter) {
84
+ const methodNames = this.extractMethodNames(obj);
85
+ for (const methodName of methodNames) {
86
+ const methodInfo = {
87
+ methodName,
88
+ instance: obj,
89
+ methodPath: [String(methodName)],
90
+ parent: null
91
+ };
92
+ if (filter(methodInfo)) {
93
+ callback(methodInfo);
94
+ }
95
+ }
96
+ }
97
+ extractMethodNames(obj) {
98
+ const methodNames = new Set();
99
+ let prototype = obj;
100
+ while (prototype && prototype !== Object.prototype) {
101
+ const allKeys = [
102
+ ...Object.getOwnPropertyNames(prototype),
103
+ ...Object.getOwnPropertySymbols(prototype),
104
+ ];
105
+ for (const key of allKeys) {
106
+ const descriptor = Object.getOwnPropertyDescriptor(prototype, key);
107
+ if (this.isCallableMethod(descriptor, key)) {
108
+ methodNames.add(key);
109
+ }
110
+ }
111
+ prototype = Object.getPrototypeOf(prototype);
112
+ }
113
+ return Array.from(methodNames);
114
+ }
115
+ isCallableMethod(descriptor, key) {
116
+ return (descriptor?.value &&
117
+ typeof descriptor.value === 'function' &&
118
+ key !== 'constructor' &&
119
+ key !== 'undefined');
120
+ }
121
+ isCustomClassInstance(value) {
122
+ if (value === null || (typeof value !== "object" && typeof value !== "function")) {
123
+ return false;
124
+ }
125
+ const objectTag = Object.prototype.toString.call(value);
126
+ // Most built-ins have distinct tags; user classes default to "[object Object]"
127
+ // Caveat: Symbol.toStringTag can spoof this.
128
+ return objectTag === "[object Object]";
129
+ }
130
+ shouldProcessProperty(property) {
131
+ return (this.isCustomClassInstance(property) &&
132
+ property?.constructor.name !== "Object");
133
+ }
134
+ exploreNestedMethods(obj, callback, filter, initialPath, visited, maxDepth, includeNonEnumerable) {
135
+ if (visited.has(obj) || initialPath.length > maxDepth) {
136
+ return;
137
+ }
138
+ visited.add(obj);
139
+ if (!this.isValidObject(obj)) {
140
+ return;
141
+ }
142
+ const properties = includeNonEnumerable
143
+ ? Object.getOwnPropertyNames(obj)
144
+ : Object.keys(obj);
145
+ for (const propertyName of properties) {
146
+ const property = obj[propertyName];
147
+ if (!this.shouldProcessProperty(property)) {
148
+ continue;
149
+ }
150
+ const newPath = [...initialPath, propertyName];
151
+ // Explore methods on this property
152
+ this.explorePropertyMethods(property, callback, filter, newPath, obj);
153
+ // Recursively explore nested objects
154
+ this.exploreNestedMethods(property, callback, filter, newPath, visited, maxDepth, includeNonEnumerable);
155
+ }
156
+ }
157
+ explorePropertyMethods(property, callback, filter, methodPath, parent) {
158
+ const methodNames = this.extractMethodNames(property);
159
+ for (const methodName of methodNames) {
160
+ const fullMethodPath = [...methodPath, String(methodName)];
161
+ const methodInfo = {
162
+ methodName,
163
+ instance: property,
164
+ methodPath: fullMethodPath,
165
+ parent
166
+ };
167
+ if (filter(methodInfo)) {
168
+ callback(methodInfo);
169
+ }
170
+ }
171
+ }
172
+ stringifyValue(value, maxDepth = 3, currentDepth = 0) {
173
+ if (value === null)
174
+ return 'null';
175
+ if (value === undefined)
176
+ return 'undefined';
177
+ const type = typeof value;
178
+ switch (type) {
179
+ case 'string':
180
+ return `"${value}"`;
181
+ case 'number':
182
+ case 'boolean':
183
+ return String(value);
184
+ case 'function':
185
+ return `[Function: ${this.getFunctionName(value)}]`;
186
+ case 'object':
187
+ if (currentDepth >= maxDepth) {
188
+ return '[Max Depth Reached]';
189
+ }
190
+ return this.stringifyObject(value, maxDepth, currentDepth);
191
+ default:
192
+ return `[${type}]`;
193
+ }
194
+ }
195
+ getFunctionName(fn) {
196
+ const name = fn.name;
197
+ return name || 'anonymous';
198
+ }
199
+ stringifyObject(obj, maxDepth, currentDepth) {
200
+ if (obj === null)
201
+ return 'null';
202
+ // Handle special object types
203
+ if (obj instanceof Date) {
204
+ return `Date(${obj.toISOString()})`;
205
+ }
206
+ if (obj instanceof Error) {
207
+ return `Error(${obj.message})`;
208
+ }
209
+ if (obj instanceof RegExp) {
210
+ return obj.toString();
211
+ }
212
+ if (Array.isArray(obj)) {
213
+ return this.stringifyArray(obj, maxDepth, currentDepth);
214
+ }
215
+ if (obj.constructor && obj.constructor.name !== 'Object') {
216
+ return this.stringifyClassInstance(obj, maxDepth, currentDepth);
217
+ }
218
+ return this.stringifyPlainObject(obj, maxDepth, currentDepth);
219
+ }
220
+ stringifyArray(arr, maxDepth, currentDepth) {
221
+ if (arr.length === 0)
222
+ return '[]';
223
+ const items = arr.slice(0, 5).map(item => this.stringifyValue(item, maxDepth, currentDepth + 1));
224
+ const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';
225
+ return `[${items.join(', ')}${suffix}]`;
226
+ }
227
+ stringifyClassInstance(obj, maxDepth, currentDepth) {
228
+ const className = obj.constructor.name;
229
+ const properties = this.getObjectProperties(obj);
230
+ if (Object.keys(properties).length === 0) {
231
+ return `${className} {}`;
232
+ }
233
+ const props = Object.entries(properties)
234
+ .slice(0, 5)
235
+ .map(([key, value]) => {
236
+ // For primitive values, don't increase depth
237
+ const isPrimitive = value === null || value === undefined ||
238
+ (typeof value !== 'object' && typeof value !== 'function');
239
+ const depth = isPrimitive ? currentDepth : currentDepth + 1;
240
+ return `${key}: ${this.stringifyValue(value, maxDepth, depth)}`;
241
+ });
242
+ const suffix = Object.keys(properties).length > 5 ?
243
+ `... (+${Object.keys(properties).length - 5} more)` : '';
244
+ return `${className} { ${props.join(', ')}${suffix} }`;
245
+ }
246
+ stringifyPlainObject(obj, maxDepth, currentDepth) {
247
+ const properties = this.getObjectProperties(obj);
248
+ if (Object.keys(properties).length === 0) {
249
+ return '{}';
250
+ }
251
+ const props = Object.entries(properties)
252
+ .slice(0, 5)
253
+ .map(([key, value]) => {
254
+ // For primitive values, don't increase depth
255
+ const isPrimitive = value === null || value === undefined ||
256
+ (typeof value !== 'object' && typeof value !== 'function');
257
+ const depth = isPrimitive ? currentDepth : currentDepth + 1;
258
+ return `${key}: ${this.stringifyValue(value, maxDepth, depth)}`;
259
+ });
260
+ const suffix = Object.keys(properties).length > 5 ?
261
+ `... (+${Object.keys(properties).length - 5} more)` : '';
262
+ return `{ ${props.join(', ')}${suffix} }`;
263
+ }
264
+ getObjectProperties(obj) {
265
+ const properties = {};
266
+ // Get enumerable properties
267
+ for (const key in obj) {
268
+ if (obj.hasOwnProperty(key)) {
269
+ properties[key] = obj[key];
270
+ }
271
+ }
272
+ return properties;
273
+ }
274
+ }
275
+
276
+
277
+ }),
278
+ "./src/capabilities/PerformanceCapability.ts":
279
+ /*!***************************************************!*\
280
+ !*** ./src/capabilities/PerformanceCapability.ts ***!
281
+ \***************************************************/
282
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
283
+ __webpack_require__.r(__webpack_exports__);
284
+ __webpack_require__.d(__webpack_exports__, {
285
+ PerformanceCapability: () => (PerformanceCapability)
286
+ });
287
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
288
+ /* ESM import */var _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./performance/PerformanceTracker */ "./src/capabilities/performance/PerformanceTracker.ts");
289
+ /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
290
+
291
+
292
+
293
+ class PerformanceCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability {
294
+ callTraceManager;
295
+ performanceTracker;
296
+ log;
297
+ shouldLog;
298
+ constructor(options) {
299
+ super();
300
+ this.log = options?.log ?? ((type, operationId, methodName, methodPath, performanceMetrics, isCompleted) => {
301
+ if (isCompleted) {
302
+ if (!performanceMetrics.duration)
303
+ return;
304
+ const deltaFromStart = this.performanceTracker.getDeltaFromOperationStart(operationId, performanceMetrics.endTime || performanceMetrics.startTime);
305
+ console.log(`[${type} ${operationId}] ${methodName} COMPLETED`, {
306
+ methodPath,
307
+ performance: {
308
+ deltaFromStart: this.performanceTracker.formatDuration(deltaFromStart),
309
+ executionTime: this.performanceTracker.formatDuration(performanceMetrics.duration),
310
+ timeToNextCall: performanceMetrics.timeToNextCall ?
311
+ this.performanceTracker.formatDuration(performanceMetrics.timeToNextCall) : 'N/A'
312
+ }
313
+ });
314
+ return;
315
+ }
316
+ const deltaFromStart = this.performanceTracker.getDeltaFromOperationStart(operationId, performanceMetrics.startTime);
317
+ console.log(`[${type} ${operationId}] ${methodName}`, {
318
+ methodPath,
319
+ performance: {
320
+ deltaFromStart: this.performanceTracker.formatDuration(deltaFromStart)
321
+ }
322
+ });
323
+ });
324
+ this.shouldLog = options?.shouldLog ?? (() => true);
325
+ this.callTraceManager = new _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__.CallTraceManager();
326
+ this.performanceTracker = new _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__.PerformanceTracker();
327
+ }
328
+ createPerformanceInterceptor(originalMethod, methodName, methodPath, instance) {
329
+ return (...args) => {
330
+ const isNewOperation = this.callTraceManager.isNewOperation();
331
+ let operationId;
332
+ if (isNewOperation) {
333
+ operationId = this.callTraceManager.startNewOperation();
334
+ const startTime = this.performanceTracker.startMethodTiming(operationId, methodPath);
335
+ this.log('ORIGIN', operationId, methodName, methodPath, { startTime }, false);
336
+ }
337
+ else {
338
+ operationId = this.callTraceManager.getActiveOperationId();
339
+ // Record that the previous method is about to call this one
340
+ const callTrace = this.callTraceManager.getCurrentTrace();
341
+ const previousMethodPath = callTrace[callTrace.length - 2];
342
+ if (previousMethodPath) {
343
+ this.performanceTracker.recordNextMethodStart(operationId, previousMethodPath);
344
+ }
345
+ const startTime = this.performanceTracker.startMethodTiming(operationId, methodPath);
346
+ this.log('CHILD', operationId, methodName, methodPath, { startTime }, false);
347
+ }
348
+ try {
349
+ const result = originalMethod.apply(instance, args);
350
+ return result;
351
+ }
352
+ finally {
353
+ // End performance tracking
354
+ const performanceMetrics = this.performanceTracker.endMethodTiming(operationId, methodPath);
355
+ // Log completion with performance metrics
356
+ this.log(isNewOperation ? 'ORIGIN' : 'CHILD', operationId, methodName, methodPath, performanceMetrics, true);
357
+ if (isNewOperation) {
358
+ this.callTraceManager.endOperation();
359
+ this.performanceTracker.cleanupOperation(operationId);
360
+ }
361
+ }
362
+ };
363
+ }
364
+ apply(instance) {
365
+ if (!this.isValidObject(instance)) {
366
+ return;
367
+ }
368
+ // Create a performance wrapper
369
+ const wrapper = {
370
+ wrapMethod: (originalMethod, methodInfo) => {
371
+ return this.createPerformanceInterceptor(originalMethod, String(methodInfo.methodName), methodInfo.methodPath.join(' → '), methodInfo.instance);
372
+ }
373
+ };
374
+ // Use the generic interception utility
375
+ this.exploreObjectMethods(instance, (methodInfo) => {
376
+ const originalMethod = methodInfo.instance[methodInfo.methodName].bind(methodInfo.instance);
377
+ const wrappedMethod = wrapper.wrapMethod(originalMethod, methodInfo);
378
+ methodInfo.instance[methodInfo.methodName] = wrappedMethod;
379
+ }, {});
380
+ }
381
+ }
382
+
383
+
384
+ }),
385
+ "./src/capabilities/TracingCapability.ts":
386
+ /*!***********************************************!*\
387
+ !*** ./src/capabilities/TracingCapability.ts ***!
388
+ \***********************************************/
389
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
390
+ __webpack_require__.r(__webpack_exports__);
391
+ __webpack_require__.d(__webpack_exports__, {
392
+ TracingCapability: () => (TracingCapability)
393
+ });
394
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
395
+ /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
396
+
397
+
398
+ class TracingCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability {
399
+ callTraceManager;
400
+ log;
401
+ shouldLogMethod;
402
+ constructor(options) {
403
+ super();
404
+ this.log = options?.log ?? ((type, operationId, methodName, methodPath, _callTrace, formattedCallTrace, args) => {
405
+ const stringifiedArgs = args.map(arg => this.stringifyValue(arg, 4));
406
+ const logData = {
407
+ methodPath,
408
+ callStack: formattedCallTrace,
409
+ args: stringifiedArgs
410
+ };
411
+ console.log(`[${type} ${operationId}] ${methodName}`, logData);
412
+ });
413
+ this.shouldLogMethod = options?.shouldLog ?? (() => true);
414
+ this.callTraceManager = new _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__.CallTraceManager();
415
+ }
416
+ createTracingInterceptor(originalMethod, methodName, methodPath, instance) {
417
+ return (...args) => {
418
+ const isNewOperation = this.callTraceManager.isNewOperation();
419
+ let operationId;
420
+ let callTrace;
421
+ if (isNewOperation) {
422
+ operationId = this.callTraceManager.startNewOperation();
423
+ callTrace = this.callTraceManager.addMethodToTrace(methodPath);
424
+ const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
425
+ this.log('ORIGIN', operationId, methodName, methodPath, callTrace, formattedCallTrace, args);
426
+ }
427
+ else {
428
+ operationId = this.callTraceManager.getActiveOperationId();
429
+ callTrace = this.callTraceManager.addMethodToTrace(methodPath);
430
+ const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
431
+ this.log('CHILD', operationId, methodName, methodPath, callTrace, formattedCallTrace, args);
432
+ }
433
+ try {
434
+ const result = originalMethod.apply(instance, args);
435
+ return result;
436
+ }
437
+ finally {
438
+ if (isNewOperation) {
439
+ this.callTraceManager.endOperation();
440
+ }
441
+ else {
442
+ this.callTraceManager.removeMethodFromTrace();
443
+ }
444
+ }
445
+ };
446
+ }
447
+ apply(instance) {
448
+ if (!this.isValidObject(instance)) {
449
+ return;
450
+ }
451
+ const logMethodCall = (type, operationId, methodName, methodPath, callTrace, formattedCallTrace, args) => {
452
+ if (this.log) {
453
+ this.log(type, operationId, methodName, methodPath, callTrace, formattedCallTrace, args);
454
+ return;
455
+ }
456
+ const stringifiedArgs = args.map(arg => this.stringifyValue(arg, 4));
457
+ const logData = {
458
+ methodPath,
459
+ callStack: formattedCallTrace,
460
+ args: stringifiedArgs
461
+ };
462
+ console.log(`[${type} ${operationId}] ${methodName}`, logData);
463
+ };
464
+ // Create a tracing wrapper
465
+ const wrapper = {
466
+ wrapMethod: (originalMethod, methodInfo) => {
467
+ const metadata = {
468
+ parent: methodInfo.parent,
469
+ instance: methodInfo.instance,
470
+ methodPath: methodInfo.methodPath
471
+ };
472
+ const shouldLog = this.shouldLogMethod(methodInfo.methodName, metadata);
473
+ if (!shouldLog) {
474
+ return originalMethod; // Return unwrapped method if not logging
475
+ }
476
+ return this.createTracingInterceptor(originalMethod, String(methodInfo.methodName), methodInfo.methodPath.join(' → '), methodInfo.instance);
477
+ }
478
+ };
479
+ // Use the generic interception utility
480
+ this.exploreObjectMethods(instance, (methodInfo) => {
481
+ const originalMethod = methodInfo.instance[methodInfo.methodName].bind(methodInfo.instance);
482
+ const wrappedMethod = wrapper.wrapMethod(originalMethod, methodInfo);
483
+ methodInfo.instance[methodInfo.methodName] = wrappedMethod;
484
+ }, {});
485
+ }
486
+ }
487
+
488
+
489
+ }),
490
+ "./src/capabilities/index.ts":
491
+ /*!***********************************!*\
492
+ !*** ./src/capabilities/index.ts ***!
493
+ \***********************************/
494
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
495
+ __webpack_require__.r(__webpack_exports__);
496
+ __webpack_require__.d(__webpack_exports__, {
497
+ Capability: () => (/* reexport safe */ _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability),
498
+ PerformanceCapability: () => (/* reexport safe */ _PerformanceCapability__WEBPACK_IMPORTED_MODULE_1__.PerformanceCapability),
499
+ TracingCapability: () => (/* reexport safe */ _TracingCapability__WEBPACK_IMPORTED_MODULE_2__.TracingCapability)
500
+ });
501
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
502
+ /* ESM import */var _PerformanceCapability__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PerformanceCapability */ "./src/capabilities/PerformanceCapability.ts");
503
+ /* ESM import */var _TracingCapability__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TracingCapability */ "./src/capabilities/TracingCapability.ts");
504
+
505
+
506
+
507
+
508
+
509
+
510
+ }),
511
+ "./src/capabilities/performance/PerformanceTracker.ts":
512
+ /*!************************************************************!*\
513
+ !*** ./src/capabilities/performance/PerformanceTracker.ts ***!
514
+ \************************************************************/
515
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
516
+ __webpack_require__.r(__webpack_exports__);
517
+ __webpack_require__.d(__webpack_exports__, {
518
+ PerformanceTracker: () => (PerformanceTracker)
519
+ });
520
+ class PerformanceTracker {
521
+ methodTimings = new Map();
522
+ operationStartTimes = new Map();
523
+ startMethodTiming(operationId, methodPath) {
524
+ const startTime = performance.now();
525
+ const key = `${operationId}:${methodPath}`;
526
+ // Track operation start time for delta calculations
527
+ if (!this.operationStartTimes.has(operationId)) {
528
+ this.operationStartTimes.set(operationId, startTime);
529
+ }
530
+ this.methodTimings.set(key, { startTime });
531
+ return startTime;
532
+ }
533
+ recordNextMethodStart(operationId, methodPath) {
534
+ const key = `${operationId}:${methodPath}`;
535
+ const timing = this.methodTimings.get(key);
536
+ if (timing) {
537
+ timing.nextMethodStartTime = performance.now();
538
+ }
539
+ }
540
+ endMethodTiming(operationId, methodPath) {
541
+ const endTime = performance.now();
542
+ const key = `${operationId}:${methodPath}`;
543
+ const timing = this.methodTimings.get(key);
544
+ if (!timing) {
545
+ return { startTime: endTime };
546
+ }
547
+ const duration = endTime - timing.startTime;
548
+ const timeToNextCall = timing.nextMethodStartTime ?
549
+ timing.nextMethodStartTime - timing.startTime : undefined;
550
+ // Clean up
551
+ this.methodTimings.delete(key);
552
+ return {
553
+ startTime: timing.startTime,
554
+ endTime,
555
+ duration,
556
+ nextMethodStartTime: timing.nextMethodStartTime,
557
+ timeToNextCall
558
+ };
559
+ }
560
+ formatDuration(milliseconds) {
561
+ if (milliseconds < 1) {
562
+ return `${(milliseconds * 1000).toFixed(1)}μs`;
563
+ }
564
+ else if (milliseconds < 1000) {
565
+ return `${milliseconds.toFixed(2)}ms`;
566
+ }
567
+ else {
568
+ return `${(milliseconds / 1000).toFixed(2)}s`;
569
+ }
570
+ }
571
+ getDeltaFromOperationStart(operationId, currentTime) {
572
+ const operationStartTime = this.operationStartTimes.get(operationId);
573
+ return operationStartTime ? currentTime - operationStartTime : 0;
574
+ }
575
+ cleanupOperation(operationId) {
576
+ this.operationStartTimes.delete(operationId);
577
+ }
578
+ }
579
+
580
+
581
+ }),
582
+ "./src/capabilities/tracing/CallTraceManager.ts":
583
+ /*!******************************************************!*\
584
+ !*** ./src/capabilities/tracing/CallTraceManager.ts ***!
585
+ \******************************************************/
586
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
587
+ __webpack_require__.r(__webpack_exports__);
588
+ __webpack_require__.d(__webpack_exports__, {
589
+ CallTraceManager: () => (CallTraceManager)
590
+ });
591
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities */ "./src/utilities/uuid.ts");
592
+
593
+ class CallTraceManager {
594
+ activeOperationId = null;
595
+ activeCallStack = [];
596
+ startNewOperation() {
597
+ const operationId = (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)();
598
+ this.activeOperationId = operationId;
599
+ this.activeCallStack = [];
600
+ return operationId;
601
+ }
602
+ isNewOperation() {
603
+ return this.activeOperationId === null;
604
+ }
605
+ getActiveOperationId() {
606
+ if (!this.activeOperationId) {
607
+ throw new Error('No active operation context');
608
+ }
609
+ return this.activeOperationId;
610
+ }
611
+ addMethodToTrace(methodPath) {
612
+ if (this.isNewOperation()) {
613
+ this.activeCallStack = [methodPath];
614
+ }
615
+ else {
616
+ this.activeCallStack.push(methodPath);
617
+ }
618
+ return [...this.activeCallStack];
619
+ }
620
+ removeMethodFromTrace() {
621
+ if (!this.isNewOperation()) {
622
+ this.activeCallStack.pop();
623
+ }
624
+ }
625
+ endOperation() {
626
+ this.activeOperationId = null;
627
+ this.activeCallStack = [];
628
+ }
629
+ formatMethodPaths(methodPaths) {
630
+ return methodPaths.map(path => path.replace(/ → /g, '.'));
631
+ }
632
+ getCurrentTrace() {
633
+ return [...this.activeCallStack];
634
+ }
635
+ }
636
+
637
+
54
638
  }),
55
639
  "./src/codegen/SlotPath.ts":
56
640
  /*!*********************************!*\
@@ -953,10 +1537,11 @@ class CloneArrayHandler extends _types__WEBPACK_IMPORTED_MODULE_0__.PropertyInfo
953
1537
  // Child properties will take care of this
954
1538
  return builder;
955
1539
  }
956
- const slot = builder.get("assignments");
957
- const resultAssignmentPath = property.getAssignmentPath({ parent: "result" });
1540
+ const entitySelectorPath = property.getSelectrorPath({ parent: "entity" });
958
1541
  if (property.parent == null) {
959
- slot.assign(`${resultAssignmentPath}`).value("{}");
1542
+ const resultAssignmentPath = property.getAssignmentPath({ parent: "result" });
1543
+ const slot = builder.get("if");
1544
+ slot.if(`${entitySelectorPath} != null`).appendBody(`${resultAssignmentPath} = [...${entitySelectorPath}]`);
960
1545
  return builder;
961
1546
  }
962
1547
  // slotPath.push(...property.getParentPathArray());
@@ -4289,8 +4874,8 @@ class TrampolinePipeline {
4289
4874
  this._hasErrored = true;
4290
4875
  }
4291
4876
  currentStep = null; // Stop the loop
4292
- // We don't call `done` here because an error occurred.
4293
- // The application should handle the uncaught exception if desired.
4877
+ // Call done with the error to properly notify the caller
4878
+ queueMicrotask(() => done(currentData, trampolineError));
4294
4879
  break; // Explicitly break loop on error
4295
4880
  }
4296
4881
  }
@@ -4417,8 +5002,8 @@ class AsyncPipeline {
4417
5002
  this._hasErrored = true;
4418
5003
  }
4419
5004
  currentStep = null; // Stop the loop
4420
- // We don't call `done` here because an error occurred.
4421
- // The application should handle the uncaught exception if desired.
5005
+ // Call done with the error to properly notify the caller
5006
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(trampolineError)));
4422
5007
  break; // Explicitly break loop on error
4423
5008
  }
4424
5009
  }
@@ -4452,112 +5037,88 @@ class AsyncPipeline {
4452
5037
  */
4453
5038
  class WorkPipeline {
4454
5039
  unitsOfWork = [];
4455
- _hasErrored = false; // Flag to prevent calling done on error
4456
5040
  filter(done) {
4457
- this._hasErrored = false; // Reset error flag on new execution
4458
- if (this.unitsOfWork.length === 0) {
5041
+ const units = this.unitsOfWork;
5042
+ const unitsLength = units.length;
5043
+ // Fast path for empty pipeline
5044
+ if (unitsLength === 0) {
4459
5045
  queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
4460
5046
  return;
4461
5047
  }
4462
- let index = 0;
4463
- let isRunning = false; // Guard against overlapping trampoline calls
5048
+ // Fast path for single work unit
5049
+ if (unitsLength === 1) {
5050
+ try {
5051
+ units[0]((result) => {
5052
+ queueMicrotask(() => done(result));
5053
+ });
5054
+ }
5055
+ catch (error) {
5056
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
5057
+ }
5058
+ return;
5059
+ }
5060
+ let isRunning = false;
5061
+ let hasErrored = false;
4464
5062
  try {
4465
- // --- Revised Completion Logic --- (Moved up for clarity)
4466
- const finalStepSentinel = () => {
4467
- // Only call done if no error has occurred
4468
- if (!this._hasErrored) {
4469
- queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
4470
- }
4471
- return null; // Stop the trampoline
4472
- };
4473
- const createStepRevised = (idx) => {
5063
+ const createStep = (idx) => {
4474
5064
  return () => {
4475
- if (this._hasErrored)
4476
- return null; // Stop if an error occurred elsewhere
4477
- if (idx >= this.unitsOfWork.length) {
4478
- return finalStepSentinel(); // Execute the dedicated final step
5065
+ if (hasErrored)
5066
+ return null;
5067
+ if (idx >= unitsLength) {
5068
+ if (!hasErrored) {
5069
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
5070
+ }
5071
+ return null;
4479
5072
  }
4480
- const processor = this.unitsOfWork[idx];
4481
- // Initialize syncCallbackResult to null to satisfy StepResult type
4482
- let syncCallbackResult = null;
5073
+ const processor = units[idx];
5074
+ let syncResult = null;
4483
5075
  let calledSync = false;
4484
5076
  try {
4485
5077
  processor((result) => {
4486
- // --- Error Handling ---
4487
5078
  if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
4488
- console.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
4489
- this._hasErrored = true; // Set flag
4490
- // Throw the error to be caught by outer try...catch blocks
5079
+ hasErrored = true;
4491
5080
  throw result.error;
4492
5081
  }
4493
- // --- /Error Handling ---
4494
- // If no error, proceed as before
4495
- index = idx + 1; // Update index for the next step
4496
- const nextStep = createStepRevised(index); // Use updated index
5082
+ const nextStep = createStep(idx + 1);
4497
5083
  if (isRunning) {
4498
- // Callback was synchronous
4499
- syncCallbackResult = nextStep; // Store next step function
5084
+ syncResult = nextStep;
4500
5085
  calledSync = true;
4501
5086
  }
4502
5087
  else {
4503
- // Callback was asynchronous, restart trampoline
4504
5088
  trampoline(nextStep);
4505
5089
  }
4506
5090
  });
4507
5091
  }
4508
5092
  catch (error) {
4509
- if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
4510
- console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
4511
- this._hasErrored = true;
4512
- }
4513
- // Rethrow to be caught by the trampoline's catch block
5093
+ hasErrored = true;
4514
5094
  throw error;
4515
5095
  }
4516
- if (calledSync) {
4517
- // Return the next step function for the sync loop
4518
- return syncCallbackResult;
4519
- }
4520
- else {
4521
- // Pause trampoline for async, loop will stop as step returns null
4522
- return null;
4523
- }
5096
+ return calledSync ? syncResult : null;
4524
5097
  };
4525
5098
  };
4526
- // The trampoline loop
4527
5099
  const trampoline = (step) => {
4528
- if (isRunning) {
5100
+ if (isRunning)
4529
5101
  return;
4530
- }
4531
5102
  isRunning = true;
4532
5103
  let currentStep = step;
4533
- while (typeof currentStep === 'function') {
5104
+ while (currentStep) {
4534
5105
  try {
4535
- // Stop immediately if an error was flagged elsewhere
4536
- if (this._hasErrored) {
5106
+ if (hasErrored) {
4537
5107
  currentStep = null;
4538
5108
  break;
4539
5109
  }
4540
- currentStep = currentStep(); // Execute step, get next step or null
5110
+ currentStep = currentStep();
4541
5111
  }
4542
- catch (trampolineError) {
4543
- // Catch errors propagated from step execution (processor or callback errors)
4544
- if (!this._hasErrored) { // Avoid double logging
4545
- console.error("Error during trampoline step execution:", trampolineError);
4546
- this._hasErrored = true;
4547
- }
4548
- currentStep = null; // Stop the loop
4549
- // We don't call `done` here because an error occurred.
4550
- // The application should handle the uncaught exception if desired.
4551
- break; // Explicitly break loop on error
5112
+ catch (error) {
5113
+ hasErrored = true;
5114
+ currentStep = null;
5115
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error)));
5116
+ break;
4552
5117
  }
4553
5118
  }
4554
- // Loop ends when currentStep is null or loop is broken by error
4555
5119
  isRunning = false;
4556
- // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.
4557
5120
  };
4558
- // --- Start the process ---
4559
- index = 0; // Reset index
4560
- trampoline(createStepRevised(0)); // Start with the revised step creator
5121
+ trampoline(createStep(0));
4561
5122
  }
4562
5123
  catch (error) {
4563
5124
  done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
@@ -4598,10 +5159,10 @@ __webpack_require__.r(__webpack_exports__);
4598
5159
  __webpack_require__.d(__webpack_exports__, {
4599
5160
  EphemeralDataPlugin: () => (EphemeralDataPlugin)
4600
5161
  });
4601
- /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
5162
+ /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
4602
5163
  /* ESM import */var _pipeline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../pipeline */ "./src/pipeline/TrampolinePipeline.ts");
4603
5164
  /* 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");
5165
+ /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../results */ "./src/results/Result.ts");
4605
5166
 
4606
5167
 
4607
5168
 
@@ -4613,470 +5174,104 @@ class EphemeralDataPlugin {
4613
5174
  }
4614
5175
  bulkPersist(event, done) {
4615
5176
  try {
4616
- const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_0__.WorkPipeline();
4617
5177
  const bulkPersistResult = event.operation.toResult();
5178
+ const schemas = event.schemas;
5179
+ const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_0__.WorkPipeline();
5180
+ let hasWork = false;
4618
5181
  for (const [schemaId, changes] of event.operation) {
5182
+ const { adds, hasItems, removes, updates } = changes;
5183
+ if (!hasItems) {
5184
+ continue;
5185
+ }
5186
+ hasWork = true;
5187
+ const result = bulkPersistResult.get(schemaId);
5188
+ const schema = schemas.get(schemaId);
5189
+ (0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertIsNotNull)(schema);
4619
5190
  pipeline.pipe((d) => {
4620
5191
  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
5192
  const collection = this.resolveCollection(schema);
4630
5193
  collection.load(readResult => {
4631
- if (readResult.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
5194
+ if (readResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
4632
5195
  d(readResult);
4633
5196
  return;
4634
5197
  }
4635
- for (let i = 0, length = adds.length; i < length; i++) {
4636
- collection.add(adds[i]);
4637
- result.adds.push(adds[i]);
5198
+ const addsLength = adds.length;
5199
+ const updatesLength = updates.length;
5200
+ const removesLength = removes.length;
5201
+ result.adds = new Array(addsLength);
5202
+ result.updates = new Array(updatesLength);
5203
+ result.removes = new Array(removesLength);
5204
+ for (let j = 0; j < addsLength; j++) {
5205
+ const item = adds[j];
5206
+ collection.add(item);
5207
+ result.adds[j] = item;
4638
5208
  }
4639
- for (let i = 0, length = updates.length; i < length; i++) {
4640
- collection.update(updates[i].entity);
4641
- result.updates.push(updates[i].entity);
5209
+ for (let j = 0; j < updatesLength; j++) {
5210
+ const item = updates[j].entity;
5211
+ collection.update(item);
5212
+ result.updates[j] = item;
4642
5213
  }
4643
- for (let i = 0, length = removes.length; i < length; i++) {
4644
- collection.remove(removes[i]);
4645
- result.removes.push(removes[i]);
5214
+ for (let j = 0; j < removesLength; j++) {
5215
+ collection.remove(removes[j]);
5216
+ result.removes[j] = removes[j];
4646
5217
  }
4647
5218
  collection.save(saveResult => {
4648
- if (saveResult.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
5219
+ if (saveResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
4649
5220
  d(saveResult);
4650
5221
  return;
4651
5222
  }
4652
- d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.success());
5223
+ d(_results__WEBPACK_IMPORTED_MODULE_2__.Result.success());
4653
5224
  });
4654
5225
  });
4655
5226
  }
4656
5227
  catch (e) {
4657
- d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.error(e));
5228
+ d(_results__WEBPACK_IMPORTED_MODULE_2__.Result.error(e));
4658
5229
  }
4659
5230
  });
4660
5231
  }
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));
5232
+ if (!hasWork) {
5233
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, bulkPersistResult));
5234
+ return;
5235
+ }
5236
+ pipeline.filter((result) => {
5237
+ if (result.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
5238
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, result.error));
4669
5239
  return;
4670
5240
  }
4671
- successCount++;
4672
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.success(event.id, bulkPersistResult));
5241
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, bulkPersistResult));
4673
5242
  });
4674
5243
  }
4675
5244
  catch (e) {
4676
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, e));
5245
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
4677
5246
  }
4678
5247
  }
4679
5248
  query(event, done) {
4680
5249
  try {
4681
- const { operation } = event;
5250
+ const operation = event.operation;
5251
+ const schema = operation.schema;
4682
5252
  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
5253
+ const collection = this.resolveCollection(schema);
4685
5254
  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));
5255
+ if (r.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
5256
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, r.error));
4688
5257
  return;
4689
5258
  }
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]));
5259
+ const records = collection.records;
5260
+ const length = records.length;
5261
+ const cloned = new Array(length);
5262
+ for (let i = 0; i < length; i++) {
5263
+ cloned[i] = schema.clone(records[i]);
4693
5264
  }
4694
- const translated = translator.translate(cloned);
4695
- done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.success(event.id, translated));
5265
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, translator.translate(cloned)));
4696
5266
  });
4697
5267
  }
4698
5268
  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
- \*******************************************/
4802
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4803
- __webpack_require__.r(__webpack_exports__);
4804
- __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)
4807
- });
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");
4810
-
4811
-
4812
-
4813
-
4814
- }),
4815
- "./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts":
4816
- /*!***********************************************************************!*\
4817
- !*** ./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts ***!
4818
- \***********************************************************************/
4819
- (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4820
- __webpack_require__.r(__webpack_exports__);
4821
- __webpack_require__.d(__webpack_exports__, {
4822
- DbPluginLoggingCapability: () => (DbPluginLoggingCapability)
4823
- });
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");
4826
-
4827
-
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()
4915
- });
4916
- }
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
- });
4927
- }
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()
4938
- });
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;
5010
- }
5011
- catch (e) {
5012
- // Skip if option type not supported
5013
- }
5014
- });
5015
- }
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);
5269
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
5051
5270
  }
5052
5271
  }
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
5272
  }
5064
5273
 
5065
5274
 
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
5275
  }),
5081
5276
  "./src/plugins/index.ts":
5082
5277
  /*!******************************!*\
@@ -5086,23 +5281,19 @@ __webpack_require__.d(__webpack_exports__, {
5086
5281
  __webpack_require__.r(__webpack_exports__);
5087
5282
  __webpack_require__.d(__webpack_exports__, {
5088
5283
  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),
5284
+ EphemeralDataPlugin: () => (/* reexport safe */ _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_3__.EphemeralDataPlugin),
5092
5285
  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),
5286
+ OptimisticReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_1__.OptimisticReplicationDbPlugin),
5287
+ Query: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.Query),
5288
+ QueryOptionsCollection: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOptionsCollection),
5289
+ QueryOrdering: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOrdering),
5290
+ ReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_1__.ReplicationDbPlugin),
5098
5291
  SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator)
5099
5292
  });
5100
5293
  /* 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
-
5294
+ /* ESM import */var _replication__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./replication */ "./src/plugins/replication/index.ts");
5295
+ /* ESM import */var _query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./query */ "./src/plugins/query/index.ts");
5296
+ /* ESM import */var _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./EphemeralDataPlugin */ "./src/plugins/EphemeralDataPlugin.ts");
5106
5297
 
5107
5298
 
5108
5299
 
@@ -5364,8 +5555,10 @@ const getMemoryPluginCollectionSize = (plugin, schema) => {
5364
5555
  }
5365
5556
  throw new Error("Cannot get size of collection for MemoryPlugin, not an instance of MemoryPlugin");
5366
5557
  };
5367
- const WAS_OPTIMISTIC_DB_HYDRATED_KEY = "was-hydrated";
5368
- const cache = new Set();
5558
+ const HYDRATION_STATUS_PENDING = "hydration-pending";
5559
+ const HYDRATION_STATUS_ERROR = "hydration-error";
5560
+ const HYDRATION_STATUS_SUCCESS = "hydration-success";
5561
+ let hydrationStatus = "hydration-not-started";
5369
5562
  class OptimisticReplicationDbPlugin {
5370
5563
  plugins;
5371
5564
  constructor(plugins) {
@@ -5389,10 +5582,10 @@ class OptimisticReplicationDbPlugin {
5389
5582
  const readPlugin = this.plugins.read;
5390
5583
  const sourcePlugin = this.plugins.source;
5391
5584
  const collectionSize = getMemoryPluginCollectionSize(this.plugins.read, event.operation.schema);
5392
- if (collectionSize === 0 && cache.has(WAS_OPTIMISTIC_DB_HYDRATED_KEY) === false) {
5585
+ if (collectionSize === 0 && hydrationStatus === "hydration-not-started") {
5393
5586
  // Notify the cache that the db was hydrated right away
5394
- cache.add(WAS_OPTIMISTIC_DB_HYDRATED_KEY);
5395
- console.log('[ROUTIER] - Optimistic Query', cache);
5587
+ hydrationStatus = "hydration-pending";
5588
+ console.log('[ROUTIER] - Optimistic Query', hydrationStatus);
5396
5589
  // nothing is hydrated, let's try and hydrate before querying
5397
5590
  // Memory plugin might not be hydrated, lets hydrate it for the targeted schema only,
5398
5591
  // Other queries will do the same and hydrate if needed
@@ -5406,19 +5599,22 @@ class OptimisticReplicationDbPlugin {
5406
5599
  }, (sourceResult) => {
5407
5600
  if (sourceResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
5408
5601
  // Notify that hydration failed
5409
- cache.delete(WAS_OPTIMISTIC_DB_HYDRATED_KEY);
5602
+ hydrationStatus = "hydration-error";
5603
+ console.log("[ROUTIER] - Hydration Error - Source Query", sourceResult);
5410
5604
  done(sourceResult);
5411
5605
  return;
5412
5606
  }
5413
5607
  if (sourceResult == null || (Array.isArray(sourceResult.data) && sourceResult.data.length === 0)) {
5414
5608
  // Notify that hydration had no data
5415
- cache.delete(WAS_OPTIMISTIC_DB_HYDRATED_KEY);
5609
+ hydrationStatus = "hydration-error";
5610
+ console.log("[ROUTIER] - Hydration Error - No Data", sourceResult);
5416
5611
  done(sourceResult);
5417
5612
  return;
5418
5613
  }
5419
5614
  if (Array.isArray(sourceResult.data) === false) {
5420
5615
  // Notify that hydration failed
5421
- cache.delete(WAS_OPTIMISTIC_DB_HYDRATED_KEY);
5616
+ hydrationStatus = "hydration-error";
5617
+ console.log("[ROUTIER] - Hydration Error - Bad Result", sourceResult);
5422
5618
  done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, "Query result is not an array"));
5423
5619
  return;
5424
5620
  }
@@ -5434,10 +5630,12 @@ class OptimisticReplicationDbPlugin {
5434
5630
  }, (readPersistResult) => {
5435
5631
  if (readPersistResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
5436
5632
  // Notify that hydration failed
5437
- cache.delete(WAS_OPTIMISTIC_DB_HYDRATED_KEY);
5633
+ hydrationStatus = "hydration-error";
5634
+ console.log("[ROUTIER] - Hydration Error - Could Not Save", readPersistResult);
5438
5635
  done(readPersistResult);
5439
5636
  return;
5440
5637
  }
5638
+ hydrationStatus = "hydration-success";
5441
5639
  // requery the read plugin
5442
5640
  readPlugin.query(event, done);
5443
5641
  });
@@ -8601,12 +8799,11 @@ __webpack_require__.d(__webpack_exports__, {
8601
8799
  Block: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.Block),
8602
8800
  BulkPersistChanges: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.BulkPersistChanges),
8603
8801
  BulkPersistResult: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.BulkPersistResult),
8802
+ Capability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_11__.Capability),
8604
8803
  CodeBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.CodeBuilder),
8605
8804
  ComparatorExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.ComparatorExpression),
8606
8805
  ContainerBlock: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.ContainerBlock),
8607
8806
  DataTranslator: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.DataTranslator),
8608
- DbPluginCapability: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.DbPluginCapability),
8609
- DbPluginLoggingCapability: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.DbPluginLoggingCapability),
8610
8807
  EmptyExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.EmptyExpression),
8611
8808
  EphemeralDataPlugin: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.EphemeralDataPlugin),
8612
8809
  Expression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.Expression),
@@ -8621,6 +8818,7 @@ __webpack_require__.d(__webpack_exports__, {
8621
8818
  ObjectBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.ObjectBuilder),
8622
8819
  OperatorExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.OperatorExpression),
8623
8820
  OptimisticReplicationDbPlugin: () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_7__.OptimisticReplicationDbPlugin),
8821
+ PerformanceCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_11__.PerformanceCapability),
8624
8822
  PluginEventResult: () => (/* reexport safe */ _results__WEBPACK_IMPORTED_MODULE_8__.PluginEventResult),
8625
8823
  PropertyExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.PropertyExpression),
8626
8824
  PropertyInfo: () => (/* reexport safe */ _schema__WEBPACK_IMPORTED_MODULE_9__.PropertyInfo),
@@ -8662,6 +8860,7 @@ __webpack_require__.d(__webpack_exports__, {
8662
8860
  StringBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.StringBuilder),
8663
8861
  SyncronousQueue: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.SyncronousQueue),
8664
8862
  TagCollection: () => (/* reexport safe */ _collections__WEBPACK_IMPORTED_MODULE_2__.TagCollection),
8863
+ TracingCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_11__.TracingCapability),
8665
8864
  TrampolinePipeline: () => (/* reexport safe */ _pipeline__WEBPACK_IMPORTED_MODULE_6__.TrampolinePipeline),
8666
8865
  ValueExpression: () => (/* reexport safe */ _expressions__WEBPACK_IMPORTED_MODULE_4__.ValueExpression),
8667
8866
  VariableBuilder: () => (/* reexport safe */ _codegen__WEBPACK_IMPORTED_MODULE_1__.VariableBuilder),
@@ -8704,6 +8903,8 @@ __webpack_require__.d(__webpack_exports__, {
8704
8903
  /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./results */ "./src/results/index.ts");
8705
8904
  /* ESM import */var _schema__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./schema */ "./src/schema/index.ts");
8706
8905
  /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utilities */ "./src/utilities/index.ts");
8906
+ /* ESM import */var _capabilities__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./capabilities */ "./src/capabilities/index.ts");
8907
+
8707
8908
 
8708
8909
 
8709
8910
 
@@ -8726,12 +8927,11 @@ var __webpack_exports__AsyncPipeline = __webpack_exports__.AsyncPipeline;
8726
8927
  var __webpack_exports__Block = __webpack_exports__.Block;
8727
8928
  var __webpack_exports__BulkPersistChanges = __webpack_exports__.BulkPersistChanges;
8728
8929
  var __webpack_exports__BulkPersistResult = __webpack_exports__.BulkPersistResult;
8930
+ var __webpack_exports__Capability = __webpack_exports__.Capability;
8729
8931
  var __webpack_exports__CodeBuilder = __webpack_exports__.CodeBuilder;
8730
8932
  var __webpack_exports__ComparatorExpression = __webpack_exports__.ComparatorExpression;
8731
8933
  var __webpack_exports__ContainerBlock = __webpack_exports__.ContainerBlock;
8732
8934
  var __webpack_exports__DataTranslator = __webpack_exports__.DataTranslator;
8733
- var __webpack_exports__DbPluginCapability = __webpack_exports__.DbPluginCapability;
8734
- var __webpack_exports__DbPluginLoggingCapability = __webpack_exports__.DbPluginLoggingCapability;
8735
8935
  var __webpack_exports__EmptyExpression = __webpack_exports__.EmptyExpression;
8736
8936
  var __webpack_exports__EphemeralDataPlugin = __webpack_exports__.EphemeralDataPlugin;
8737
8937
  var __webpack_exports__Expression = __webpack_exports__.Expression;
@@ -8746,6 +8946,7 @@ var __webpack_exports__NotParsableExpression = __webpack_exports__.NotParsableEx
8746
8946
  var __webpack_exports__ObjectBuilder = __webpack_exports__.ObjectBuilder;
8747
8947
  var __webpack_exports__OperatorExpression = __webpack_exports__.OperatorExpression;
8748
8948
  var __webpack_exports__OptimisticReplicationDbPlugin = __webpack_exports__.OptimisticReplicationDbPlugin;
8949
+ var __webpack_exports__PerformanceCapability = __webpack_exports__.PerformanceCapability;
8749
8950
  var __webpack_exports__PluginEventResult = __webpack_exports__.PluginEventResult;
8750
8951
  var __webpack_exports__PropertyExpression = __webpack_exports__.PropertyExpression;
8751
8952
  var __webpack_exports__PropertyInfo = __webpack_exports__.PropertyInfo;
@@ -8787,6 +8988,7 @@ var __webpack_exports__SqlTranslator = __webpack_exports__.SqlTranslator;
8787
8988
  var __webpack_exports__StringBuilder = __webpack_exports__.StringBuilder;
8788
8989
  var __webpack_exports__SyncronousQueue = __webpack_exports__.SyncronousQueue;
8789
8990
  var __webpack_exports__TagCollection = __webpack_exports__.TagCollection;
8991
+ var __webpack_exports__TracingCapability = __webpack_exports__.TracingCapability;
8790
8992
  var __webpack_exports__TrampolinePipeline = __webpack_exports__.TrampolinePipeline;
8791
8993
  var __webpack_exports__ValueExpression = __webpack_exports__.ValueExpression;
8792
8994
  var __webpack_exports__VariableBuilder = __webpack_exports__.VariableBuilder;
@@ -8817,6 +9019,6 @@ var __webpack_exports__toMap = __webpack_exports__.toMap;
8817
9019
  var __webpack_exports__toPromise = __webpack_exports__.toPromise;
8818
9020
  var __webpack_exports__uuid = __webpack_exports__.uuid;
8819
9021
  var __webpack_exports__uuidv4 = __webpack_exports__.uuidv4;
8820
- 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 };
9022
+ export { __webpack_exports__AndBuilder as AndBuilder, __webpack_exports__ArrayBuilder as ArrayBuilder, __webpack_exports__AssignmentBuilder as AssignmentBuilder, __webpack_exports__AsyncPipeline as AsyncPipeline, __webpack_exports__Block as Block, __webpack_exports__BulkPersistChanges as BulkPersistChanges, __webpack_exports__BulkPersistResult as BulkPersistResult, __webpack_exports__Capability as Capability, __webpack_exports__CodeBuilder as CodeBuilder, __webpack_exports__ComparatorExpression as ComparatorExpression, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EmptyExpression as EmptyExpression, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__Expression as Expression, __webpack_exports__FunctionBuilder as FunctionBuilder, __webpack_exports__FunctionFactoryBuilder as FunctionFactoryBuilder, __webpack_exports__HashType as HashType, __webpack_exports__IdSet as IdSet, __webpack_exports__IfBuilder as IfBuilder, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__MemoryDataCollection as MemoryDataCollection, __webpack_exports__NotParsableExpression as NotParsableExpression, __webpack_exports__ObjectBuilder as ObjectBuilder, __webpack_exports__OperatorExpression as OperatorExpression, __webpack_exports__OptimisticReplicationDbPlugin as OptimisticReplicationDbPlugin, __webpack_exports__PerformanceCapability as PerformanceCapability, __webpack_exports__PluginEventResult as PluginEventResult, __webpack_exports__PropertyExpression as PropertyExpression, __webpack_exports__PropertyInfo as PropertyInfo, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__RawBuilder as RawBuilder, __webpack_exports__ReadonlySchemaCollection as ReadonlySchemaCollection, __webpack_exports__ReplicationDbPlugin as ReplicationDbPlugin, __webpack_exports__Result as Result, __webpack_exports__SchemaArray as SchemaArray, __webpack_exports__SchemaBase as SchemaBase, __webpack_exports__SchemaBoolean as SchemaBoolean, __webpack_exports__SchemaCollection as SchemaCollection, __webpack_exports__SchemaComputed as SchemaComputed, __webpack_exports__SchemaDate as SchemaDate, __webpack_exports__SchemaDefault as SchemaDefault, __webpack_exports__SchemaDeserialize as SchemaDeserialize, __webpack_exports__SchemaDistinct as SchemaDistinct, __webpack_exports__SchemaError as SchemaError, __webpack_exports__SchemaFrom as SchemaFrom, __webpack_exports__SchemaFunction as SchemaFunction, __webpack_exports__SchemaIdentity as SchemaIdentity, __webpack_exports__SchemaIndex as SchemaIndex, __webpack_exports__SchemaKey as SchemaKey, __webpack_exports__SchemaNullable as SchemaNullable, __webpack_exports__SchemaNumber as SchemaNumber, __webpack_exports__SchemaObject as SchemaObject, __webpack_exports__SchemaOptional as SchemaOptional, __webpack_exports__SchemaPersistChanges as SchemaPersistChanges, __webpack_exports__SchemaPersistResult as SchemaPersistResult, __webpack_exports__SchemaReadonly as SchemaReadonly, __webpack_exports__SchemaSerialize as SchemaSerialize, __webpack_exports__SchemaString as SchemaString, __webpack_exports__SchemaTracked as SchemaTracked, __webpack_exports__SchemaTypes as SchemaTypes, __webpack_exports__SlotBlock as SlotBlock, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__StringBuilder as StringBuilder, __webpack_exports__SyncronousQueue as SyncronousQueue, __webpack_exports__TagCollection as TagCollection, __webpack_exports__TracingCapability as TracingCapability, __webpack_exports__TrampolinePipeline as TrampolinePipeline, __webpack_exports__ValueExpression as ValueExpression, __webpack_exports__VariableBuilder as VariableBuilder, __webpack_exports__WorkPipeline as WorkPipeline, __webpack_exports__assertDate as assertDate, __webpack_exports__assertInstanceOf as assertInstanceOf, __webpack_exports__assertIsArray as assertIsArray, __webpack_exports__assertIsNotNull as assertIsNotNull, __webpack_exports__assertString as assertString, __webpack_exports__cast as cast, __webpack_exports__clone as clone, __webpack_exports__combineExpressions as combineExpressions, __webpack_exports__combineQueryOptionsCollections as combineQueryOptionsCollections, __webpack_exports__forEach as forEach, __webpack_exports__getProperties as getProperties, __webpack_exports__hash as hash, __webpack_exports__isDate as isDate, __webpack_exports__isNodeRuntime as isNodeRuntime, __webpack_exports__isPropertyExpression as isPropertyExpression, __webpack_exports__measure as measure, __webpack_exports__noop as noop, __webpack_exports__now as now, __webpack_exports__resolveBulkPersistChanges as resolveBulkPersistChanges, __webpack_exports__s as s, __webpack_exports__toEventArray as toEventArray, __webpack_exports__toExpression as toExpression, __webpack_exports__toMap as toMap, __webpack_exports__toPromise as toPromise, __webpack_exports__uuid as uuid, __webpack_exports__uuidv4 as uuidv4 };
8821
9023
 
8822
9024
  //# sourceMappingURL=index.js.map