@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
@@ -0,0 +1,763 @@
1
+ var __webpack_modules__ = ({
2
+ "./src/capabilities/Capability.ts":
3
+ /*!****************************************!*\
4
+ !*** ./src/capabilities/Capability.ts ***!
5
+ \****************************************/
6
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ Capability: () => (Capability)
10
+ });
11
+ class Capability {
12
+ excludedNames = new Set([
13
+ "Array",
14
+ "Set",
15
+ "Map",
16
+ "AbortController",
17
+ "AbortSignal",
18
+ "SchemaString",
19
+ "SchemaNumber",
20
+ "SchemaArray",
21
+ "SchemaBoolean",
22
+ "SchemaDate",
23
+ "SchemaObject",
24
+ "SchemaDefault",
25
+ "SchemaDeserialize",
26
+ "SchemaDistinct",
27
+ "SchemaFrom",
28
+ "SchemaIdentity",
29
+ "SchemaIndex",
30
+ "SchemaKey",
31
+ "SchemaNullable",
32
+ "SchemaOptional",
33
+ "SchemaReadonly",
34
+ "SchemaSerialize",
35
+ "SchemaTracked",
36
+ "SchemaComputed",
37
+ "SchemaFunction",
38
+ "SchemaBase",
39
+ "SchemaDefinition"
40
+ ]);
41
+ isValidObject(obj) {
42
+ return typeof obj === "object" && obj !== null;
43
+ }
44
+ isCallableMethod(descriptor, key) {
45
+ return (descriptor?.value &&
46
+ typeof descriptor.value === 'function' &&
47
+ key !== 'constructor' &&
48
+ key !== 'undefined');
49
+ }
50
+ canExplore(descriptor) {
51
+ if (typeof descriptor.value !== "object") {
52
+ return false;
53
+ }
54
+ if (descriptor.value == null) {
55
+ return false;
56
+ }
57
+ const name = this.getName(descriptor.value);
58
+ if (name == null) {
59
+ return true;
60
+ }
61
+ return this.excludedNames.has(name) === false;
62
+ }
63
+ getName(value) {
64
+ if (value.constructor != null) {
65
+ return value.constructor.name;
66
+ }
67
+ return null;
68
+ }
69
+ getPath(info, propertyName) {
70
+ let parent = info.parent;
71
+ const path = [info.propertyName, propertyName];
72
+ while (parent != null) {
73
+ path.unshift(parent.propertyName);
74
+ parent = parent.parent;
75
+ }
76
+ return path.join(".");
77
+ }
78
+ explore(instance, onDiscover) {
79
+ if (!this.isValidObject(instance)) {
80
+ return;
81
+ }
82
+ const explore = [{ instance, propertyName: this.getName(instance) }];
83
+ const visited = new Set();
84
+ for (let i = 0; i < explore.length; i++) {
85
+ const info = explore[i];
86
+ const item = info.instance;
87
+ if (visited.has(item)) {
88
+ continue;
89
+ }
90
+ const allKeys = [
91
+ ...Object.getOwnPropertyNames(item),
92
+ ...Object.getOwnPropertySymbols(item),
93
+ ];
94
+ for (const key of allKeys) {
95
+ const descriptor = Object.getOwnPropertyDescriptor(item, key);
96
+ const isCallable = this.isCallableMethod(descriptor, key);
97
+ onDiscover(info, {
98
+ name: key,
99
+ isCallable
100
+ });
101
+ if (this.canExplore(descriptor) === false) {
102
+ continue;
103
+ }
104
+ const path = this.getPath(info, key);
105
+ explore.push({ instance: descriptor.value, parent: info, propertyName: key, path });
106
+ }
107
+ visited.add(item);
108
+ }
109
+ }
110
+ }
111
+
112
+
113
+ }),
114
+ "./src/capabilities/PerformanceCapability.ts":
115
+ /*!***************************************************!*\
116
+ !*** ./src/capabilities/PerformanceCapability.ts ***!
117
+ \***************************************************/
118
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
119
+ __webpack_require__.r(__webpack_exports__);
120
+ __webpack_require__.d(__webpack_exports__, {
121
+ PerformanceCapability: () => (PerformanceCapability)
122
+ });
123
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities */ "./src/utilities/strings.ts");
124
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
125
+ /* ESM import */var _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./performance/PerformanceTracker */ "./src/capabilities/performance/PerformanceTracker.ts");
126
+ /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
127
+
128
+
129
+
130
+
131
+ class PerformanceCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability {
132
+ callTraceManager;
133
+ performanceTracker;
134
+ filter;
135
+ childDurations = new Map();
136
+ constructor(options) {
137
+ super();
138
+ this.filter = options?.filter ?? (() => true);
139
+ this.callTraceManager = new _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__.CallTraceManager();
140
+ this.performanceTracker = new _performance_PerformanceTracker__WEBPACK_IMPORTED_MODULE_2__.PerformanceTracker();
141
+ }
142
+ apply(instance) {
143
+ this.explore(instance, (meta, info) => {
144
+ if (info.isCallable) {
145
+ const originalMethod = meta.instance[info.name].bind(meta.instance);
146
+ meta.instance[info.name] = (...args) => {
147
+ const path = `${meta.path}.${String(info.name)}()`;
148
+ if (this.filter(path, info, meta) === false) {
149
+ return originalMethod(...args);
150
+ }
151
+ const isNewOperation = this.callTraceManager.isNewOperation();
152
+ let operationId;
153
+ let callTrace;
154
+ let depth;
155
+ if (isNewOperation) {
156
+ operationId = this.callTraceManager.startNewOperation();
157
+ this.childDurations.set(operationId, []);
158
+ callTrace = this.callTraceManager.addMethodToTrace(path);
159
+ depth = callTrace.length - 1;
160
+ const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
161
+ this.performanceTracker.startMethodTiming(operationId, path);
162
+ console.log(`\n${'═'.repeat(60)}`);
163
+ console.log(`▶ ORIGIN [${operationId}] ${path}`);
164
+ if (args.length > 0) {
165
+ console.log(` Args:`, (0,_utilities__WEBPACK_IMPORTED_MODULE_3__.stringifyObject)(args, 4, 0));
166
+ }
167
+ console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
168
+ }
169
+ else {
170
+ operationId = this.callTraceManager.getActiveOperationId();
171
+ callTrace = this.callTraceManager.addMethodToTrace(path);
172
+ depth = callTrace.length - 1;
173
+ const indent = ' '.repeat(Math.min(depth, 4));
174
+ // Track children for this child method too
175
+ const childMethodKey = `${operationId}:${path}`;
176
+ this.childDurations.set(childMethodKey, []);
177
+ this.performanceTracker.startMethodTiming(operationId, path);
178
+ console.log(`${indent}└─ CHILD [${operationId}] ${path}`);
179
+ if (args.length > 0) {
180
+ console.log(`${indent} Args:`, (0,_utilities__WEBPACK_IMPORTED_MODULE_3__.stringifyObject)(args, 4, 0));
181
+ }
182
+ }
183
+ try {
184
+ return originalMethod(...args);
185
+ }
186
+ finally {
187
+ const metrics = this.performanceTracker.endMethodTiming(operationId, path);
188
+ const duration = metrics.duration ?? 0;
189
+ const formattedDuration = this.performanceTracker.formatDuration(duration);
190
+ if (isNewOperation) {
191
+ const childDurations = this.childDurations.get(operationId) ?? [];
192
+ const totalChildTime = childDurations.reduce((sum, d) => sum + d, 0);
193
+ const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
194
+ const overhead = duration - totalChildTime;
195
+ const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
196
+ console.log(`\n${'═'.repeat(60)}`);
197
+ console.log(`◀ COMPLETE [${operationId}] ${path}`);
198
+ console.log(` Total Duration: ${formattedDuration}`);
199
+ if (childDurations.length > 0) {
200
+ console.log(` Children Duration: ${formattedTotalChildTime} (${childDurations.length} calls)`);
201
+ console.log(` Overhead: ${formattedOverhead}`);
202
+ }
203
+ console.log(`${'═'.repeat(60)}\n`);
204
+ this.childDurations.delete(operationId);
205
+ this.performanceTracker.cleanupOperation(operationId);
206
+ this.callTraceManager.endOperation();
207
+ }
208
+ else {
209
+ const indent = ' '.repeat(Math.min(depth, 4));
210
+ const childMethodKey = `${operationId}:${path}`;
211
+ const childDurations = this.childDurations.get(childMethodKey) ?? [];
212
+ const totalChildTime = childDurations.reduce((sum, d) => sum + d, 0);
213
+ const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
214
+ const overhead = duration - totalChildTime;
215
+ const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
216
+ console.log(`${indent} ✓ ${formattedDuration}`);
217
+ if (childDurations.length > 0) {
218
+ console.log(`${indent} Children: ${formattedTotalChildTime} (${childDurations.length} calls), Overhead: ${formattedOverhead}`);
219
+ }
220
+ // Clean up child method tracking
221
+ this.childDurations.delete(childMethodKey);
222
+ // Find the parent method and add this duration to its children list
223
+ // The parent is the method one level up in the call trace
224
+ const currentTrace = this.callTraceManager.getCurrentTrace();
225
+ if (currentTrace.length > 1) {
226
+ // Parent is the second-to-last item in the trace (before we remove current)
227
+ const parentPath = currentTrace[currentTrace.length - 2];
228
+ // Check if parent is the root operation (trace length 2 means root + this child)
229
+ if (currentTrace.length === 2) {
230
+ // Direct child of root - add to root's children list
231
+ const rootChildDurations = this.childDurations.get(operationId);
232
+ if (rootChildDurations) {
233
+ rootChildDurations.push(duration);
234
+ }
235
+ }
236
+ else {
237
+ // Nested child - add to parent method's children list
238
+ const parentMethodKey = `${operationId}:${parentPath}`;
239
+ const parentChildDurations = this.childDurations.get(parentMethodKey);
240
+ if (parentChildDurations) {
241
+ parentChildDurations.push(duration);
242
+ }
243
+ }
244
+ }
245
+ }
246
+ this.callTraceManager.removeMethodFromTrace();
247
+ }
248
+ };
249
+ }
250
+ });
251
+ }
252
+ }
253
+
254
+
255
+ }),
256
+ "./src/capabilities/TracingCapability.ts":
257
+ /*!***********************************************!*\
258
+ !*** ./src/capabilities/TracingCapability.ts ***!
259
+ \***********************************************/
260
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
261
+ __webpack_require__.r(__webpack_exports__);
262
+ __webpack_require__.d(__webpack_exports__, {
263
+ TracingCapability: () => (TracingCapability)
264
+ });
265
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
266
+ /* ESM import */var _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tracing/CallTraceManager */ "./src/capabilities/tracing/CallTraceManager.ts");
267
+ /* ESM import */var _utilities_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utilities/strings */ "./src/utilities/strings.ts");
268
+
269
+
270
+
271
+ class TracingCapability extends _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability {
272
+ callTraceManager;
273
+ filter;
274
+ constructor(options) {
275
+ super();
276
+ this.filter = options?.filter ?? (() => true);
277
+ this.callTraceManager = new _tracing_CallTraceManager__WEBPACK_IMPORTED_MODULE_1__.CallTraceManager();
278
+ }
279
+ apply(instance) {
280
+ this.explore(instance, (meta, info) => {
281
+ if (info.isCallable) {
282
+ const originalMethod = meta.instance[info.name].bind(meta.instance);
283
+ meta.instance[info.name] = (...args) => {
284
+ const path = `${meta.path}.${String(info.name)}()`;
285
+ if (this.filter(path, info, meta) === false) {
286
+ return originalMethod(...args);
287
+ }
288
+ const isNewOperation = this.callTraceManager.isNewOperation();
289
+ let operationId;
290
+ if (isNewOperation) {
291
+ operationId = this.callTraceManager.startNewOperation();
292
+ const callTrace = this.callTraceManager.addMethodToTrace(path);
293
+ const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
294
+ console.log(`\n${'═'.repeat(60)}`);
295
+ console.log(`▶ ORIGIN [${operationId}] ${path}`);
296
+ if (args.length > 0) {
297
+ console.log(` Args:`, (0,_utilities_strings__WEBPACK_IMPORTED_MODULE_2__.stringifyObject)(args, 4, 0));
298
+ }
299
+ console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
300
+ }
301
+ else {
302
+ operationId = this.callTraceManager.getActiveOperationId();
303
+ const callTrace = this.callTraceManager.addMethodToTrace(path);
304
+ const indent = ' '.repeat(Math.min(callTrace.length - 1, 4));
305
+ console.log(`${indent}└─ CHILD [${operationId}] ${path}`);
306
+ if (args.length > 0) {
307
+ console.log(`${indent} Args:`, (0,_utilities_strings__WEBPACK_IMPORTED_MODULE_2__.stringifyObject)(args, 4, 0));
308
+ }
309
+ }
310
+ try {
311
+ return originalMethod(...args);
312
+ }
313
+ finally {
314
+ this.callTraceManager.removeMethodFromTrace();
315
+ if (isNewOperation) {
316
+ this.callTraceManager.endOperation();
317
+ }
318
+ }
319
+ };
320
+ }
321
+ });
322
+ }
323
+ }
324
+
325
+
326
+ }),
327
+ "./src/capabilities/performance/PerformanceTracker.ts":
328
+ /*!************************************************************!*\
329
+ !*** ./src/capabilities/performance/PerformanceTracker.ts ***!
330
+ \************************************************************/
331
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
332
+ __webpack_require__.r(__webpack_exports__);
333
+ __webpack_require__.d(__webpack_exports__, {
334
+ PerformanceTracker: () => (PerformanceTracker)
335
+ });
336
+ class PerformanceTracker {
337
+ methodTimings = new Map();
338
+ operationStartTimes = new Map();
339
+ startMethodTiming(operationId, methodPath) {
340
+ const startTime = performance.now();
341
+ const key = `${operationId}:${methodPath}`;
342
+ // Track operation start time for delta calculations
343
+ if (!this.operationStartTimes.has(operationId)) {
344
+ this.operationStartTimes.set(operationId, startTime);
345
+ }
346
+ this.methodTimings.set(key, { startTime });
347
+ return startTime;
348
+ }
349
+ recordNextMethodStart(operationId, methodPath) {
350
+ const key = `${operationId}:${methodPath}`;
351
+ const timing = this.methodTimings.get(key);
352
+ if (timing) {
353
+ timing.nextMethodStartTime = performance.now();
354
+ }
355
+ }
356
+ endMethodTiming(operationId, methodPath) {
357
+ const endTime = performance.now();
358
+ const key = `${operationId}:${methodPath}`;
359
+ const timing = this.methodTimings.get(key);
360
+ if (!timing) {
361
+ return { startTime: endTime };
362
+ }
363
+ const duration = endTime - timing.startTime;
364
+ const timeToNextCall = timing.nextMethodStartTime ?
365
+ timing.nextMethodStartTime - timing.startTime : undefined;
366
+ // Clean up
367
+ this.methodTimings.delete(key);
368
+ return {
369
+ startTime: timing.startTime,
370
+ endTime,
371
+ duration,
372
+ nextMethodStartTime: timing.nextMethodStartTime,
373
+ timeToNextCall
374
+ };
375
+ }
376
+ formatDuration(milliseconds) {
377
+ if (milliseconds < 1) {
378
+ return `${(milliseconds * 1000).toFixed(1)}μs`;
379
+ }
380
+ else if (milliseconds < 1000) {
381
+ return `${milliseconds.toFixed(2)}ms`;
382
+ }
383
+ else {
384
+ return `${(milliseconds / 1000).toFixed(2)}s`;
385
+ }
386
+ }
387
+ getDeltaFromOperationStart(operationId, currentTime) {
388
+ const operationStartTime = this.operationStartTimes.get(operationId);
389
+ return operationStartTime ? currentTime - operationStartTime : 0;
390
+ }
391
+ cleanupOperation(operationId) {
392
+ this.operationStartTimes.delete(operationId);
393
+ }
394
+ }
395
+
396
+
397
+ }),
398
+ "./src/capabilities/tracing/CallTraceManager.ts":
399
+ /*!******************************************************!*\
400
+ !*** ./src/capabilities/tracing/CallTraceManager.ts ***!
401
+ \******************************************************/
402
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
403
+ __webpack_require__.r(__webpack_exports__);
404
+ __webpack_require__.d(__webpack_exports__, {
405
+ CallTraceManager: () => (CallTraceManager)
406
+ });
407
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities */ "./src/utilities/uuid.ts");
408
+
409
+ class CallTraceManager {
410
+ activeOperationId = null;
411
+ activeCallStack = [];
412
+ startNewOperation() {
413
+ const operationId = (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)(8);
414
+ this.activeOperationId = operationId;
415
+ this.activeCallStack = [];
416
+ return operationId;
417
+ }
418
+ isNewOperation() {
419
+ return this.activeOperationId === null;
420
+ }
421
+ getActiveOperationId() {
422
+ if (!this.activeOperationId) {
423
+ throw new Error('No active operation context');
424
+ }
425
+ return this.activeOperationId;
426
+ }
427
+ addMethodToTrace(methodPath) {
428
+ if (this.isNewOperation()) {
429
+ this.activeCallStack = [methodPath];
430
+ }
431
+ else {
432
+ this.activeCallStack.push(methodPath);
433
+ }
434
+ return [...this.activeCallStack];
435
+ }
436
+ removeMethodFromTrace() {
437
+ if (!this.isNewOperation()) {
438
+ this.activeCallStack.pop();
439
+ }
440
+ }
441
+ endOperation() {
442
+ this.activeOperationId = null;
443
+ this.activeCallStack = [];
444
+ }
445
+ formatMethodPaths(methodPaths) {
446
+ return methodPaths.map(path => path.replace(/ → /g, '.'));
447
+ }
448
+ getCurrentTrace() {
449
+ return [...this.activeCallStack];
450
+ }
451
+ }
452
+
453
+
454
+ }),
455
+ "./src/utilities/strings.ts":
456
+ /*!**********************************!*\
457
+ !*** ./src/utilities/strings.ts ***!
458
+ \**********************************/
459
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
460
+ __webpack_require__.r(__webpack_exports__);
461
+ __webpack_require__.d(__webpack_exports__, {
462
+ fastHash: () => (fastHash),
463
+ hash: () => (hash),
464
+ stringifyObject: () => (stringifyObject)
465
+ });
466
+ const hash = (value, seed = 0) => {
467
+ // From Stack Overflow
468
+ // https://stackoverflow.com/a/52171480/3329760
469
+ let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
470
+ for (let i = 0, ch; i < value.length; i++) {
471
+ ch = value.charCodeAt(i);
472
+ h1 = Math.imul(h1 ^ ch, 2654435761);
473
+ h2 = Math.imul(h2 ^ ch, 1597334677);
474
+ }
475
+ h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
476
+ h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
477
+ h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
478
+ h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
479
+ return 4294967296 * (2097151 & h2) + (h1 >>> 0);
480
+ };
481
+ /**
482
+ * Fast string hash optimized for comparisons.
483
+ * Uses djb2 algorithm - very fast and good distribution for short to medium strings.
484
+ * Same input always produces same output (deterministic).
485
+ *
486
+ * @param value - The string to hash
487
+ * @param seed - Optional seed value (default: 5381)
488
+ * @returns A positive 32-bit integer hash value
489
+ *
490
+ * @example
491
+ * ```ts
492
+ * fastHash("test") === fastHash("test") // true
493
+ * fastHash("test") !== fastHash("test2") // true
494
+ * ```
495
+ */
496
+ const fastHash = (value, seed = 5381) => {
497
+ let hash = seed;
498
+ for (let i = 0; i < value.length; i++) {
499
+ hash = ((hash << 5) + hash) + value.charCodeAt(i);
500
+ }
501
+ return hash >>> 0; // Convert to unsigned 32-bit integer
502
+ };
503
+ /**
504
+ * Converts any value to a readable string representation.
505
+ * Handles primitives, objects, arrays, classes, dates, errors, and functions.
506
+ * Supports depth limiting to prevent infinite recursion on circular references.
507
+ *
508
+ * @param obj - The value to stringify
509
+ * @param maxDepth - Maximum depth for nested objects (default: 3)
510
+ * @param currentDepth - Current recursion depth (default: 0)
511
+ * @returns String representation of the value
512
+ *
513
+ * @example
514
+ * ```ts
515
+ * stringifyObject({ name: "test", count: 5 }) // '{ name: "test", count: 5 }'
516
+ * stringifyObject([1, 2, 3]) // '[1, 2, 3]'
517
+ * stringifyObject(new Date()) // 'Date(2024-01-01T00:00:00.000Z)'
518
+ * ```
519
+ */
520
+ function stringifyObject(obj, maxDepth = 3, currentDepth = 0) {
521
+ if (obj === null)
522
+ return 'null';
523
+ if (obj === undefined)
524
+ return 'undefined';
525
+ const type = typeof obj;
526
+ switch (type) {
527
+ case 'string':
528
+ return `"${obj}"`;
529
+ case 'number':
530
+ case 'boolean':
531
+ return String(obj);
532
+ case 'function':
533
+ return `[Function: ${getFunctionName(obj)}]`;
534
+ case 'object':
535
+ if (currentDepth >= maxDepth) {
536
+ return '[Max Depth Reached]';
537
+ }
538
+ return stringifyObjectValue(obj, maxDepth, currentDepth);
539
+ default:
540
+ return `[${type}]`;
541
+ }
542
+ }
543
+ function getFunctionName(fn) {
544
+ const name = fn.name;
545
+ return name || 'anonymous';
546
+ }
547
+ function getObjectProperties(obj) {
548
+ const properties = {};
549
+ for (const key in obj) {
550
+ if (obj.hasOwnProperty(key)) {
551
+ properties[key] = obj[key];
552
+ }
553
+ }
554
+ return properties;
555
+ }
556
+ function stringifyObjectValue(obj, maxDepth, currentDepth) {
557
+ if (obj === null)
558
+ return 'null';
559
+ if (obj instanceof Date) {
560
+ return `Date(${obj.toISOString()})`;
561
+ }
562
+ if (obj instanceof Error) {
563
+ return `Error(${obj.message})`;
564
+ }
565
+ if (obj instanceof RegExp) {
566
+ return obj.toString();
567
+ }
568
+ if (Array.isArray(obj)) {
569
+ return stringifyArray(obj, maxDepth, currentDepth);
570
+ }
571
+ if (obj.constructor && obj.constructor.name !== 'Object') {
572
+ return stringifyClassInstance(obj, maxDepth, currentDepth);
573
+ }
574
+ return stringifyPlainObject(obj, maxDepth, currentDepth);
575
+ }
576
+ function stringifyArray(arr, maxDepth, currentDepth) {
577
+ if (arr.length === 0)
578
+ return '[]';
579
+ const items = arr.slice(0, 5).map(item => stringifyObject(item, maxDepth, currentDepth + 1));
580
+ const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';
581
+ return `[${items.join(', ')}${suffix}]`;
582
+ }
583
+ function stringifyClassInstance(obj, maxDepth, currentDepth) {
584
+ const className = obj.constructor.name;
585
+ const properties = getObjectProperties(obj);
586
+ if (Object.keys(properties).length === 0) {
587
+ return `${className} {}`;
588
+ }
589
+ const props = Object.entries(properties)
590
+ .slice(0, 5)
591
+ .map(([key, value]) => {
592
+ const isPrimitive = value === null || value === undefined ||
593
+ (typeof value !== 'object' && typeof value !== 'function');
594
+ const depth = isPrimitive ? currentDepth : currentDepth + 1;
595
+ return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
596
+ });
597
+ const suffix = Object.keys(properties).length > 5 ?
598
+ `... (+${Object.keys(properties).length - 5} more)` : '';
599
+ return `${className} { ${props.join(', ')}${suffix} }`;
600
+ }
601
+ function stringifyPlainObject(obj, maxDepth, currentDepth) {
602
+ const properties = getObjectProperties(obj);
603
+ if (Object.keys(properties).length === 0) {
604
+ return '{}';
605
+ }
606
+ const props = Object.entries(properties)
607
+ .slice(0, 5)
608
+ .map(([key, value]) => {
609
+ const isPrimitive = value === null || value === undefined ||
610
+ (typeof value !== 'object' && typeof value !== 'function');
611
+ const depth = isPrimitive ? currentDepth : currentDepth + 1;
612
+ return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
613
+ });
614
+ const suffix = Object.keys(properties).length > 5 ?
615
+ `... (+${Object.keys(properties).length - 5} more)` : '';
616
+ return `{ ${props.join(', ')}${suffix} }`;
617
+ }
618
+
619
+
620
+ }),
621
+ "./src/utilities/uuid.ts":
622
+ /*!*******************************!*\
623
+ !*** ./src/utilities/uuid.ts ***!
624
+ \*******************************/
625
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
626
+ __webpack_require__.r(__webpack_exports__);
627
+ __webpack_require__.d(__webpack_exports__, {
628
+ uuid: () => (uuid),
629
+ uuidv4: () => (uuidv4)
630
+ });
631
+ const uuid = (length = 16) => {
632
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
633
+ const charLength = chars.length;
634
+ let result = '';
635
+ for (let i = 0; i < length; i++) {
636
+ result += chars[Math.random() * charLength | 0];
637
+ }
638
+ return result;
639
+ };
640
+ const HEX_CHARS = '0123456789abcdef';
641
+ const UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
642
+ const hasCrypto = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';
643
+ const uuidv4 = () => {
644
+ let randomBytes = null;
645
+ if (hasCrypto) {
646
+ randomBytes = crypto.getRandomValues(new Uint8Array(16));
647
+ }
648
+ let byteIndex = 0;
649
+ let uuid = '';
650
+ for (let i = 0; i < UUID_TEMPLATE.length; i++) {
651
+ const c = UUID_TEMPLATE[i];
652
+ if (c === '-') {
653
+ uuid += '-';
654
+ continue;
655
+ }
656
+ let r;
657
+ if (hasCrypto && randomBytes) {
658
+ // Each byte gives two hex digits (nibbles)
659
+ r =
660
+ (i % 2 === 0
661
+ ? randomBytes[byteIndex] >> 4
662
+ : randomBytes[byteIndex++] & 0x0f);
663
+ }
664
+ else {
665
+ r = Math.floor(Math.random() * 16);
666
+ }
667
+ if (c === 'x') {
668
+ uuid += HEX_CHARS[r];
669
+ }
670
+ else if (c === 'y') {
671
+ // Variant bits: 8, 9, A, or B
672
+ uuid += HEX_CHARS[(r & 0x3) | 0x8];
673
+ }
674
+ else if (c === '4') {
675
+ uuid += '4';
676
+ }
677
+ }
678
+ return uuid;
679
+ };
680
+
681
+
682
+ }),
683
+
684
+ });
685
+ /************************************************************************/
686
+ // The module cache
687
+ var __webpack_module_cache__ = {};
688
+
689
+ // The require function
690
+ function __webpack_require__(moduleId) {
691
+
692
+ // Check if module is in cache
693
+ var cachedModule = __webpack_module_cache__[moduleId];
694
+ if (cachedModule !== undefined) {
695
+ return cachedModule.exports;
696
+ }
697
+ // Create a new module (and put it into the cache)
698
+ var module = (__webpack_module_cache__[moduleId] = {
699
+ exports: {}
700
+ });
701
+ // Execute the module function
702
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
703
+
704
+ // Return the exports of the module
705
+ return module.exports;
706
+
707
+ }
708
+
709
+ /************************************************************************/
710
+ // webpack/runtime/define_property_getters
711
+ (() => {
712
+ __webpack_require__.d = (exports, definition) => {
713
+ for(var key in definition) {
714
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
715
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
716
+ }
717
+ }
718
+ };
719
+ })();
720
+ // webpack/runtime/has_own_property
721
+ (() => {
722
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
723
+ })();
724
+ // webpack/runtime/make_namespace_object
725
+ (() => {
726
+ // define __esModule on exports
727
+ __webpack_require__.r = (exports) => {
728
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
729
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
730
+ }
731
+ Object.defineProperty(exports, '__esModule', { value: true });
732
+ };
733
+ })();
734
+ /************************************************************************/
735
+ var __webpack_exports__ = {};
736
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
737
+ (() => {
738
+
739
+ /*!***********************************!*\
740
+ !*** ./src/capabilities/index.ts ***!
741
+ \***********************************/
742
+ __webpack_require__.r(__webpack_exports__);
743
+ __webpack_require__.d(__webpack_exports__, {
744
+ Capability: () => (/* reexport safe */ _Capability__WEBPACK_IMPORTED_MODULE_0__.Capability),
745
+ PerformanceCapability: () => (/* reexport safe */ _PerformanceCapability__WEBPACK_IMPORTED_MODULE_1__.PerformanceCapability),
746
+ TracingCapability: () => (/* reexport safe */ _TracingCapability__WEBPACK_IMPORTED_MODULE_2__.TracingCapability)
747
+ });
748
+ /* ESM import */var _Capability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Capability */ "./src/capabilities/Capability.ts");
749
+ /* ESM import */var _PerformanceCapability__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PerformanceCapability */ "./src/capabilities/PerformanceCapability.ts");
750
+ /* ESM import */var _TracingCapability__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TracingCapability */ "./src/capabilities/TracingCapability.ts");
751
+
752
+
753
+
754
+
755
+
756
+ })();
757
+
758
+ var __webpack_exports__Capability = __webpack_exports__.Capability;
759
+ var __webpack_exports__PerformanceCapability = __webpack_exports__.PerformanceCapability;
760
+ var __webpack_exports__TracingCapability = __webpack_exports__.TracingCapability;
761
+ export { __webpack_exports__Capability as Capability, __webpack_exports__PerformanceCapability as PerformanceCapability, __webpack_exports__TracingCapability as TracingCapability };
762
+
763
+ //# sourceMappingURL=index.js.map