@routier/core 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +88 -438
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +94 -443
- package/dist/index.js.map +1 -1
- package/dist/plugins/TelemetryDbPlugin.d.ts +43 -0
- package/dist/plugins/index.cjs +82 -1
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +88 -3
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/resultShape.d.ts +35 -0
- package/dist/transfer/ChunkEncoder.d.ts +60 -0
- package/dist/transfer/decoder.d.ts +29 -0
- package/dist/transfer/fillers.d.ts +36 -0
- package/dist/transfer/index.cjs +873 -0
- package/dist/transfer/index.cjs.map +1 -0
- package/dist/transfer/index.d.ts +47 -0
- package/dist/transfer/index.js +872 -0
- package/dist/transfer/index.js.map +1 -0
- package/dist/transfer/plan.d.ts +94 -0
- package/dist/transfer/types.d.ts +138 -0
- package/package.json +9 -9
- package/dist/capabilities/Capability.d.ts +0 -11
- package/dist/capabilities/PerformanceCapability.d.ts +0 -13
- package/dist/capabilities/TracingCapability.d.ts +0 -11
- package/dist/capabilities/index.cjs +0 -820
- package/dist/capabilities/index.cjs.map +0 -1
- package/dist/capabilities/index.d.ts +0 -4
- package/dist/capabilities/index.js +0 -808
- package/dist/capabilities/index.js.map +0 -1
- package/dist/capabilities/performance/PerformanceTracker.d.ts +0 -11
- package/dist/capabilities/tracing/CallTraceManager.d.ts +0 -12
- package/dist/capabilities/types.d.ts +0 -17
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ class AppContext extends DataStore {
|
|
|
50
50
|
const ctx = new AppContext();
|
|
51
51
|
|
|
52
52
|
// Add data
|
|
53
|
-
await ctx.users.addAsync({ name: "
|
|
53
|
+
await ctx.users.addAsync({ name: "James", email: "james@example.com" });
|
|
54
54
|
await ctx.saveChangesAsync();
|
|
55
55
|
|
|
56
56
|
// Query with live updates
|
package/dist/index.cjs
CHANGED
|
@@ -101,436 +101,6 @@ function isObjectWithType(value) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
},
|
|
105
|
-
599(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
106
|
-
|
|
107
|
-
// EXPORTS
|
|
108
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
109
|
-
TracingCapability: () => (/* reexport */ TracingCapability),
|
|
110
|
-
Capability: () => (/* reexport */ Capability),
|
|
111
|
-
PerformanceCapability: () => (/* reexport */ PerformanceCapability)
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
;// CONCATENATED MODULE: ./src/capabilities/Capability.ts
|
|
115
|
-
class Capability {
|
|
116
|
-
excludedNames = new Set([
|
|
117
|
-
"Array",
|
|
118
|
-
"Set",
|
|
119
|
-
"Map",
|
|
120
|
-
"AbortController",
|
|
121
|
-
"AbortSignal",
|
|
122
|
-
"SchemaString",
|
|
123
|
-
"SchemaNumber",
|
|
124
|
-
"SchemaArray",
|
|
125
|
-
"SchemaBoolean",
|
|
126
|
-
"SchemaDate",
|
|
127
|
-
"SchemaObject",
|
|
128
|
-
"SchemaDefault",
|
|
129
|
-
"SchemaDeserialize",
|
|
130
|
-
"SchemaDistinct",
|
|
131
|
-
"SchemaSearchable",
|
|
132
|
-
"SchemaFrom",
|
|
133
|
-
"SchemaIdentity",
|
|
134
|
-
"SchemaIndex",
|
|
135
|
-
"SchemaKey",
|
|
136
|
-
"SchemaNullable",
|
|
137
|
-
"SchemaOptional",
|
|
138
|
-
"SchemaReadonly",
|
|
139
|
-
"SchemaSerialize",
|
|
140
|
-
"SchemaTracked",
|
|
141
|
-
"SchemaComputed",
|
|
142
|
-
"SchemaFunction",
|
|
143
|
-
"SchemaBase",
|
|
144
|
-
"SchemaDefinition"
|
|
145
|
-
]);
|
|
146
|
-
isValidObject(obj) {
|
|
147
|
-
return typeof obj === "object" && obj !== null;
|
|
148
|
-
}
|
|
149
|
-
isCallableMethod(descriptor, key) {
|
|
150
|
-
return descriptor?.value && typeof descriptor.value === 'function' && key !== 'constructor' && key !== 'undefined';
|
|
151
|
-
}
|
|
152
|
-
canExplore(descriptor) {
|
|
153
|
-
if (typeof descriptor.value !== "object") {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
if (descriptor.value == null) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
const name = this.getName(descriptor.value);
|
|
160
|
-
if (name == null) {
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
return this.excludedNames.has(name) === false;
|
|
164
|
-
}
|
|
165
|
-
getName(value) {
|
|
166
|
-
if (value.constructor != null) {
|
|
167
|
-
return value.constructor.name;
|
|
168
|
-
}
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
getPath(info, propertyName) {
|
|
172
|
-
let parent = info.parent;
|
|
173
|
-
const path = [
|
|
174
|
-
info.propertyName,
|
|
175
|
-
propertyName
|
|
176
|
-
];
|
|
177
|
-
while(parent != null){
|
|
178
|
-
path.unshift(parent.propertyName);
|
|
179
|
-
parent = parent.parent;
|
|
180
|
-
}
|
|
181
|
-
return path.join(".");
|
|
182
|
-
}
|
|
183
|
-
explore(instance, onDiscover) {
|
|
184
|
-
if (!this.isValidObject(instance)) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const explore = [
|
|
188
|
-
{
|
|
189
|
-
instance,
|
|
190
|
-
propertyName: this.getName(instance)
|
|
191
|
-
}
|
|
192
|
-
];
|
|
193
|
-
const visited = new Set();
|
|
194
|
-
for(let i = 0; i < explore.length; i++){
|
|
195
|
-
const info = explore[i];
|
|
196
|
-
const item = info.instance;
|
|
197
|
-
if (visited.has(item)) {
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
const allKeys = [
|
|
201
|
-
...Object.getOwnPropertyNames(item),
|
|
202
|
-
...Object.getOwnPropertySymbols(item)
|
|
203
|
-
];
|
|
204
|
-
for (const key of allKeys){
|
|
205
|
-
const descriptor = Object.getOwnPropertyDescriptor(item, key);
|
|
206
|
-
const isCallable = this.isCallableMethod(descriptor, key);
|
|
207
|
-
onDiscover(info, {
|
|
208
|
-
name: key,
|
|
209
|
-
isCallable
|
|
210
|
-
});
|
|
211
|
-
if (this.canExplore(descriptor) === false) {
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
const path = this.getPath(info, key);
|
|
215
|
-
explore.push({
|
|
216
|
-
instance: descriptor.value,
|
|
217
|
-
parent: info,
|
|
218
|
-
propertyName: key,
|
|
219
|
-
path
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
visited.add(item);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// EXTERNAL MODULE: ./src/utilities/strings.ts
|
|
228
|
-
var strings = __webpack_require__(615);
|
|
229
|
-
;// CONCATENATED MODULE: ./src/capabilities/performance/PerformanceTracker.ts
|
|
230
|
-
class PerformanceTracker {
|
|
231
|
-
methodTimings = new Map();
|
|
232
|
-
operationStartTimes = new Map();
|
|
233
|
-
startMethodTiming(operationId, methodPath) {
|
|
234
|
-
const startTime = performance.now();
|
|
235
|
-
const key = `${operationId}:${methodPath}`;
|
|
236
|
-
// Track operation start time for delta calculations
|
|
237
|
-
if (!this.operationStartTimes.has(operationId)) {
|
|
238
|
-
this.operationStartTimes.set(operationId, startTime);
|
|
239
|
-
}
|
|
240
|
-
this.methodTimings.set(key, {
|
|
241
|
-
startTime
|
|
242
|
-
});
|
|
243
|
-
return startTime;
|
|
244
|
-
}
|
|
245
|
-
recordNextMethodStart(operationId, methodPath) {
|
|
246
|
-
const key = `${operationId}:${methodPath}`;
|
|
247
|
-
const timing = this.methodTimings.get(key);
|
|
248
|
-
if (timing) {
|
|
249
|
-
timing.nextMethodStartTime = performance.now();
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
endMethodTiming(operationId, methodPath) {
|
|
253
|
-
const endTime = performance.now();
|
|
254
|
-
const key = `${operationId}:${methodPath}`;
|
|
255
|
-
const timing = this.methodTimings.get(key);
|
|
256
|
-
if (!timing) {
|
|
257
|
-
return {
|
|
258
|
-
startTime: endTime
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
const duration = endTime - timing.startTime;
|
|
262
|
-
const timeToNextCall = timing.nextMethodStartTime ? timing.nextMethodStartTime - timing.startTime : undefined;
|
|
263
|
-
// Clean up
|
|
264
|
-
this.methodTimings.delete(key);
|
|
265
|
-
return {
|
|
266
|
-
startTime: timing.startTime,
|
|
267
|
-
endTime,
|
|
268
|
-
duration,
|
|
269
|
-
nextMethodStartTime: timing.nextMethodStartTime,
|
|
270
|
-
timeToNextCall
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
formatDuration(milliseconds) {
|
|
274
|
-
if (milliseconds < 1) {
|
|
275
|
-
return `${(milliseconds * 1000).toFixed(1)}μs`;
|
|
276
|
-
} else if (milliseconds < 1000) {
|
|
277
|
-
return `${milliseconds.toFixed(2)}ms`;
|
|
278
|
-
} else {
|
|
279
|
-
return `${(milliseconds / 1000).toFixed(2)}s`;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
getDeltaFromOperationStart(operationId, currentTime) {
|
|
283
|
-
const operationStartTime = this.operationStartTimes.get(operationId);
|
|
284
|
-
return operationStartTime ? currentTime - operationStartTime : 0;
|
|
285
|
-
}
|
|
286
|
-
cleanupOperation(operationId) {
|
|
287
|
-
this.operationStartTimes.delete(operationId);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// EXTERNAL MODULE: ./src/utilities/uuid.ts
|
|
292
|
-
var uuid = __webpack_require__(618);
|
|
293
|
-
;// CONCATENATED MODULE: ./src/capabilities/tracing/CallTraceManager.ts
|
|
294
|
-
|
|
295
|
-
class CallTraceManager {
|
|
296
|
-
activeOperationId = null;
|
|
297
|
-
activeCallStack = [];
|
|
298
|
-
startNewOperation() {
|
|
299
|
-
const operationId = (0,uuid/* .uuid */.u)(8);
|
|
300
|
-
this.activeOperationId = operationId;
|
|
301
|
-
this.activeCallStack = [];
|
|
302
|
-
return operationId;
|
|
303
|
-
}
|
|
304
|
-
isNewOperation() {
|
|
305
|
-
return this.activeOperationId === null;
|
|
306
|
-
}
|
|
307
|
-
getActiveOperationId() {
|
|
308
|
-
if (!this.activeOperationId) {
|
|
309
|
-
throw new Error('No active operation context');
|
|
310
|
-
}
|
|
311
|
-
return this.activeOperationId;
|
|
312
|
-
}
|
|
313
|
-
addMethodToTrace(methodPath) {
|
|
314
|
-
if (this.isNewOperation()) {
|
|
315
|
-
this.activeCallStack = [
|
|
316
|
-
methodPath
|
|
317
|
-
];
|
|
318
|
-
} else {
|
|
319
|
-
this.activeCallStack.push(methodPath);
|
|
320
|
-
}
|
|
321
|
-
return [
|
|
322
|
-
...this.activeCallStack
|
|
323
|
-
];
|
|
324
|
-
}
|
|
325
|
-
removeMethodFromTrace() {
|
|
326
|
-
if (!this.isNewOperation()) {
|
|
327
|
-
this.activeCallStack.pop();
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
endOperation() {
|
|
331
|
-
this.activeOperationId = null;
|
|
332
|
-
this.activeCallStack = [];
|
|
333
|
-
}
|
|
334
|
-
formatMethodPaths(methodPaths) {
|
|
335
|
-
return methodPaths.map((path)=>path.replace(/ → /g, '.'));
|
|
336
|
-
}
|
|
337
|
-
getCurrentTrace() {
|
|
338
|
-
return [
|
|
339
|
-
...this.activeCallStack
|
|
340
|
-
];
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// EXTERNAL MODULE: ./src/utilities/logger.ts
|
|
345
|
-
var logger = __webpack_require__(581);
|
|
346
|
-
;// CONCATENATED MODULE: ./src/capabilities/PerformanceCapability.ts
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
class PerformanceCapability extends Capability {
|
|
353
|
-
callTraceManager;
|
|
354
|
-
performanceTracker;
|
|
355
|
-
filter;
|
|
356
|
-
childDurations = new Map();
|
|
357
|
-
constructor(options){
|
|
358
|
-
super();
|
|
359
|
-
this.filter = options?.filter ?? (()=>true);
|
|
360
|
-
this.callTraceManager = new CallTraceManager();
|
|
361
|
-
this.performanceTracker = new PerformanceTracker();
|
|
362
|
-
}
|
|
363
|
-
apply(instance) {
|
|
364
|
-
this.explore(instance, (meta, info)=>{
|
|
365
|
-
if (info.isCallable) {
|
|
366
|
-
const originalMethod = meta.instance[info.name].bind(meta.instance);
|
|
367
|
-
meta.instance[info.name] = (...args)=>{
|
|
368
|
-
const path = `${meta.path}.${String(info.name)}()`;
|
|
369
|
-
if (this.filter(path, info, meta) === false) {
|
|
370
|
-
return originalMethod(...args);
|
|
371
|
-
}
|
|
372
|
-
const isNewOperation = this.callTraceManager.isNewOperation();
|
|
373
|
-
let operationId;
|
|
374
|
-
let callTrace;
|
|
375
|
-
let depth;
|
|
376
|
-
if (isNewOperation) {
|
|
377
|
-
operationId = this.callTraceManager.startNewOperation();
|
|
378
|
-
this.childDurations.set(operationId, []);
|
|
379
|
-
callTrace = this.callTraceManager.addMethodToTrace(path);
|
|
380
|
-
depth = callTrace.length - 1;
|
|
381
|
-
const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
|
|
382
|
-
this.performanceTracker.startMethodTiming(operationId, path);
|
|
383
|
-
logger/* .logger.log */.vF.log(`\n${'═'.repeat(60)}`);
|
|
384
|
-
logger/* .logger.log */.vF.log(`▶ ORIGIN [${operationId}] ${path}`);
|
|
385
|
-
if (args.length > 0) {
|
|
386
|
-
logger/* .logger.log */.vF.log(` Args:`, (0,strings/* .stringifyObject */.Zm)(args, 4, 0));
|
|
387
|
-
}
|
|
388
|
-
logger/* .logger.log */.vF.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
|
|
389
|
-
} else {
|
|
390
|
-
operationId = this.callTraceManager.getActiveOperationId();
|
|
391
|
-
callTrace = this.callTraceManager.addMethodToTrace(path);
|
|
392
|
-
depth = callTrace.length - 1;
|
|
393
|
-
const indent = ' '.repeat(Math.min(depth, 4));
|
|
394
|
-
// Track children for this child method too
|
|
395
|
-
const childMethodKey = `${operationId}:${path}`;
|
|
396
|
-
this.childDurations.set(childMethodKey, []);
|
|
397
|
-
this.performanceTracker.startMethodTiming(operationId, path);
|
|
398
|
-
logger/* .logger.log */.vF.log(`${indent}└─ CHILD [${operationId}] ${path}`);
|
|
399
|
-
if (args.length > 0) {
|
|
400
|
-
logger/* .logger.log */.vF.log(`${indent} Args:`, (0,strings/* .stringifyObject */.Zm)(args, 4, 0));
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
try {
|
|
404
|
-
return originalMethod(...args);
|
|
405
|
-
} finally{
|
|
406
|
-
const metrics = this.performanceTracker.endMethodTiming(operationId, path);
|
|
407
|
-
const duration = metrics.duration ?? 0;
|
|
408
|
-
const formattedDuration = this.performanceTracker.formatDuration(duration);
|
|
409
|
-
if (isNewOperation) {
|
|
410
|
-
const childDurations = this.childDurations.get(operationId) ?? [];
|
|
411
|
-
const totalChildTime = childDurations.reduce((sum, d)=>sum + d, 0);
|
|
412
|
-
const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
|
|
413
|
-
const overhead = duration - totalChildTime;
|
|
414
|
-
const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
|
|
415
|
-
logger/* .logger.log */.vF.log(`\n${'═'.repeat(60)}`);
|
|
416
|
-
logger/* .logger.log */.vF.log(`◀ COMPLETE [${operationId}] ${path}`);
|
|
417
|
-
logger/* .logger.log */.vF.log(` Total Duration: ${formattedDuration}`);
|
|
418
|
-
if (childDurations.length > 0) {
|
|
419
|
-
logger/* .logger.log */.vF.log(` Children Duration: ${formattedTotalChildTime} (${childDurations.length} calls)`);
|
|
420
|
-
logger/* .logger.log */.vF.log(` Overhead: ${formattedOverhead}`);
|
|
421
|
-
}
|
|
422
|
-
logger/* .logger.log */.vF.log(`${'═'.repeat(60)}\n`);
|
|
423
|
-
this.childDurations.delete(operationId);
|
|
424
|
-
this.performanceTracker.cleanupOperation(operationId);
|
|
425
|
-
this.callTraceManager.endOperation();
|
|
426
|
-
} else {
|
|
427
|
-
const indent = ' '.repeat(Math.min(depth, 4));
|
|
428
|
-
const childMethodKey = `${operationId}:${path}`;
|
|
429
|
-
const childDurations = this.childDurations.get(childMethodKey) ?? [];
|
|
430
|
-
const totalChildTime = childDurations.reduce((sum, d)=>sum + d, 0);
|
|
431
|
-
const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
|
|
432
|
-
const overhead = duration - totalChildTime;
|
|
433
|
-
const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
|
|
434
|
-
logger/* .logger.log */.vF.log(`${indent} ✓ ${formattedDuration}`);
|
|
435
|
-
if (childDurations.length > 0) {
|
|
436
|
-
logger/* .logger.log */.vF.log(`${indent} Children: ${formattedTotalChildTime} (${childDurations.length} calls), Overhead: ${formattedOverhead}`);
|
|
437
|
-
}
|
|
438
|
-
// Clean up child method tracking
|
|
439
|
-
this.childDurations.delete(childMethodKey);
|
|
440
|
-
// Find the parent method and add this duration to its children list
|
|
441
|
-
// The parent is the method one level up in the call trace
|
|
442
|
-
const currentTrace = this.callTraceManager.getCurrentTrace();
|
|
443
|
-
if (currentTrace.length > 1) {
|
|
444
|
-
// Parent is the second-to-last item in the trace (before we remove current)
|
|
445
|
-
const parentPath = currentTrace[currentTrace.length - 2];
|
|
446
|
-
// Check if parent is the root operation (trace length 2 means root + this child)
|
|
447
|
-
if (currentTrace.length === 2) {
|
|
448
|
-
// Direct child of root - add to root's children list
|
|
449
|
-
const rootChildDurations = this.childDurations.get(operationId);
|
|
450
|
-
if (rootChildDurations) {
|
|
451
|
-
rootChildDurations.push(duration);
|
|
452
|
-
}
|
|
453
|
-
} else {
|
|
454
|
-
// Nested child - add to parent method's children list
|
|
455
|
-
const parentMethodKey = `${operationId}:${parentPath}`;
|
|
456
|
-
const parentChildDurations = this.childDurations.get(parentMethodKey);
|
|
457
|
-
if (parentChildDurations) {
|
|
458
|
-
parentChildDurations.push(duration);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
this.callTraceManager.removeMethodFromTrace();
|
|
464
|
-
}
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
;// CONCATENATED MODULE: ./src/capabilities/TracingCapability.ts
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
class TracingCapability extends Capability {
|
|
476
|
-
callTraceManager;
|
|
477
|
-
filter;
|
|
478
|
-
constructor(options){
|
|
479
|
-
super();
|
|
480
|
-
this.filter = options?.filter ?? (()=>true);
|
|
481
|
-
this.callTraceManager = new CallTraceManager();
|
|
482
|
-
}
|
|
483
|
-
apply(instance) {
|
|
484
|
-
this.explore(instance, (meta, info)=>{
|
|
485
|
-
if (info.isCallable) {
|
|
486
|
-
const originalMethod = meta.instance[info.name].bind(meta.instance);
|
|
487
|
-
meta.instance[info.name] = (...args)=>{
|
|
488
|
-
const path = `${meta.path}.${String(info.name)}()`;
|
|
489
|
-
if (this.filter(path, info, meta) === false) {
|
|
490
|
-
return originalMethod(...args);
|
|
491
|
-
}
|
|
492
|
-
const isNewOperation = this.callTraceManager.isNewOperation();
|
|
493
|
-
let operationId;
|
|
494
|
-
if (isNewOperation) {
|
|
495
|
-
operationId = this.callTraceManager.startNewOperation();
|
|
496
|
-
const callTrace = this.callTraceManager.addMethodToTrace(path);
|
|
497
|
-
const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
|
|
498
|
-
console.log(`\n${'═'.repeat(60)}`);
|
|
499
|
-
console.log(`▶ ORIGIN [${operationId}] ${path}`);
|
|
500
|
-
if (args.length > 0) {
|
|
501
|
-
console.log(` Args:`, (0,strings/* .stringifyObject */.Zm)(args, 4, 0));
|
|
502
|
-
}
|
|
503
|
-
console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
|
|
504
|
-
} else {
|
|
505
|
-
operationId = this.callTraceManager.getActiveOperationId();
|
|
506
|
-
const callTrace = this.callTraceManager.addMethodToTrace(path);
|
|
507
|
-
const indent = ' '.repeat(Math.min(callTrace.length - 1, 4));
|
|
508
|
-
console.log(`${indent}└─ CHILD [${operationId}] ${path}`);
|
|
509
|
-
if (args.length > 0) {
|
|
510
|
-
console.log(`${indent} Args:`, (0,strings/* .stringifyObject */.Zm)(args, 4, 0));
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
try {
|
|
514
|
-
return originalMethod(...args);
|
|
515
|
-
} finally{
|
|
516
|
-
this.callTraceManager.removeMethodFromTrace();
|
|
517
|
-
if (isNewOperation) {
|
|
518
|
-
this.callTraceManager.endOperation();
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
;// CONCATENATED MODULE: ./src/capabilities/index.ts
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
104
|
},
|
|
535
105
|
980(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
536
106
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -3687,12 +3257,13 @@ var TrampolinePipeline = __webpack_require__(416);
|
|
|
3687
3257
|
|
|
3688
3258
|
|
|
3689
3259
|
},
|
|
3690
|
-
|
|
3260
|
+
10(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
3691
3261
|
|
|
3692
3262
|
// EXPORTS
|
|
3693
3263
|
__webpack_require__.d(__webpack_exports__, {
|
|
3694
3264
|
DEFAULT_SEMI_JOIN_KEY_THRESHOLD: () => (/* reexport */ DEFAULT_SEMI_JOIN_KEY_THRESHOLD),
|
|
3695
3265
|
TranslatedArrayValue: () => (/* reexport */ TranslatedArrayValue),
|
|
3266
|
+
collectingSink: () => (/* reexport */ collectingSink),
|
|
3696
3267
|
semiJoinFilter: () => (/* reexport */ semiJoinFilter),
|
|
3697
3268
|
CacheDbPlugin: () => (/* reexport */ CacheDbPlugin),
|
|
3698
3269
|
Query: () => (/* reexport */ Query),
|
|
@@ -3700,6 +3271,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3700
3271
|
executeJoin: () => (/* reexport */ executeJoin),
|
|
3701
3272
|
formatExplanation: () => (/* reexport */ formatExplanation),
|
|
3702
3273
|
serializePersistResult: () => (/* reexport */ serializePersistResult),
|
|
3274
|
+
mappedResultColumns: () => (/* reexport */ mappedResultColumns),
|
|
3703
3275
|
explainQuery: () => (/* reexport */ explainQuery),
|
|
3704
3276
|
cosineDistance: () => (/* reexport */ cosineDistance),
|
|
3705
3277
|
RetryDbPlugin: () => (/* reexport */ RetryDbPlugin),
|
|
@@ -3714,16 +3286,18 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3714
3286
|
EXECUTED_QUERIES_UNSUPPORTED: () => (/* reexport */ EXECUTED_QUERIES_UNSUPPORTED),
|
|
3715
3287
|
joinInPlugin: () => (/* reexport */ joinInPlugin),
|
|
3716
3288
|
deserializePersistResult: () => (/* reexport */ deserializePersistResult),
|
|
3289
|
+
loggerSink: () => (/* reexport */ loggerSink),
|
|
3717
3290
|
nearestBy: () => (/* reexport */ nearestBy),
|
|
3718
3291
|
readJoinKey: () => (/* reexport */ readJoinKey),
|
|
3719
|
-
serializeBulkPersist: () => (/* reexport */ serializeBulkPersist),
|
|
3720
3292
|
hashJoin: () => (/* reexport */ hashJoin),
|
|
3721
3293
|
EphemeralDataPlugin: () => (/* reexport */ EphemeralDataPlugin),
|
|
3722
3294
|
QueryOptionsCollection: () => (/* reexport */ QueryOptionsCollection/* .QueryOptionsCollection */.H),
|
|
3295
|
+
serializeBulkPersist: () => (/* reexport */ serializeBulkPersist),
|
|
3723
3296
|
toEntityShape: () => (/* reexport */ toEntityShape),
|
|
3724
3297
|
loadJoinInnerSide: () => (/* reexport */ loadJoinInnerSide),
|
|
3725
3298
|
DataTranslator: () => (/* reexport */ DataTranslator),
|
|
3726
3299
|
withExecutedQueries: () => (/* reexport */ withExecutedQueries),
|
|
3300
|
+
TelemetryDbPlugin: () => (/* reexport */ TelemetryDbPlugin),
|
|
3727
3301
|
createRequestHandler: () => (/* reexport */ createRequestHandler),
|
|
3728
3302
|
SqlTranslator: () => (/* reexport */ SqlTranslator),
|
|
3729
3303
|
QueryOrdering: () => (/* reexport */ types_QueryOrdering),
|
|
@@ -3733,6 +3307,18 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3733
3307
|
deserializeQueryOptions: () => (/* reexport */ deserializeQueryOptions)
|
|
3734
3308
|
});
|
|
3735
3309
|
|
|
3310
|
+
;// CONCATENATED MODULE: ./src/plugins/resultShape.ts
|
|
3311
|
+
/**
|
|
3312
|
+
* The columns a `map` projection selects.
|
|
3313
|
+
*
|
|
3314
|
+
* Named by `sourceName`, which is what the statement actually emits; the rename to
|
|
3315
|
+
* `destinationName` happens in the translator, after the rows come back. A field with no
|
|
3316
|
+
* `property` is an expression.
|
|
3317
|
+
*/ const mappedResultColumns = (fields)=>fields.map((field)=>({
|
|
3318
|
+
name: field.sourceName,
|
|
3319
|
+
property: field.property ?? null
|
|
3320
|
+
}));
|
|
3321
|
+
|
|
3736
3322
|
;// CONCATENATED MODULE: ./src/plugins/translators/TranslatedArrayValue.ts
|
|
3737
3323
|
class TranslatedArrayValue {
|
|
3738
3324
|
value;
|
|
@@ -6714,6 +6300,69 @@ class RetryDbPlugin {
|
|
|
6714
6300
|
}
|
|
6715
6301
|
}
|
|
6716
6302
|
|
|
6303
|
+
;// CONCATENATED MODULE: ./src/plugins/TelemetryDbPlugin.ts
|
|
6304
|
+
|
|
6305
|
+
/** Default sink: writes through the levelled logger, so ROUTIER_LOG_LEVEL governs it. */ const loggerSink = ()=>(e)=>{
|
|
6306
|
+
const line = `[routier] ${e.operation} ${e.schemas.join(",")} ${e.durationMs.toFixed(1)}ms`;
|
|
6307
|
+
if (e.ok === "error") {
|
|
6308
|
+
logger/* .logger.error */.vF.error(line, e.error);
|
|
6309
|
+
return;
|
|
6310
|
+
}
|
|
6311
|
+
logger/* .logger.info */.vF.info(line);
|
|
6312
|
+
};
|
|
6313
|
+
/** Pushes every event into `into`. For tests and custom buffering. */ const collectingSink = (into)=>(e)=>{
|
|
6314
|
+
into.push(e);
|
|
6315
|
+
};
|
|
6316
|
+
class TelemetryDbPlugin {
|
|
6317
|
+
plugin;
|
|
6318
|
+
onEvent;
|
|
6319
|
+
constructor(plugin, options = {}){
|
|
6320
|
+
this.plugin = plugin;
|
|
6321
|
+
this.onEvent = options.onEvent ?? loggerSink();
|
|
6322
|
+
}
|
|
6323
|
+
get databaseName() {
|
|
6324
|
+
return this.plugin.databaseName;
|
|
6325
|
+
}
|
|
6326
|
+
query(event, done) {
|
|
6327
|
+
const start = performance.now();
|
|
6328
|
+
this.plugin.query(event, (result)=>{
|
|
6329
|
+
this.emit("query", event, result, start);
|
|
6330
|
+
done(result);
|
|
6331
|
+
});
|
|
6332
|
+
}
|
|
6333
|
+
bulkPersist(event, done) {
|
|
6334
|
+
const start = performance.now();
|
|
6335
|
+
this.plugin.bulkPersist(event, (result)=>{
|
|
6336
|
+
this.emit("bulkPersist", event, result, start);
|
|
6337
|
+
done(result);
|
|
6338
|
+
});
|
|
6339
|
+
}
|
|
6340
|
+
destroy(event, done) {
|
|
6341
|
+
const start = performance.now();
|
|
6342
|
+
this.plugin.destroy(event, (result)=>{
|
|
6343
|
+
this.emit("destroy", event, result, start);
|
|
6344
|
+
done(result);
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6347
|
+
emit(operation, event, result, start) {
|
|
6348
|
+
try {
|
|
6349
|
+
this.onEvent({
|
|
6350
|
+
operation,
|
|
6351
|
+
eventId: event.id,
|
|
6352
|
+
source: event.source,
|
|
6353
|
+
schemas: [
|
|
6354
|
+
...event.schemas.values()
|
|
6355
|
+
].map((s)=>s.collectionName),
|
|
6356
|
+
durationMs: performance.now() - start,
|
|
6357
|
+
ok: result.ok,
|
|
6358
|
+
error: result.ok === "success" ? undefined : result.error
|
|
6359
|
+
});
|
|
6360
|
+
} catch {
|
|
6361
|
+
// A broken sink must never fail the data operation.
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
|
|
6717
6366
|
;// CONCATENATED MODULE: ./src/plugins/CacheDbPlugin.ts
|
|
6718
6367
|
|
|
6719
6368
|
/**
|
|
@@ -7178,6 +6827,8 @@ const DEFAULT_MAX_BATCH_SIZE = 100;
|
|
|
7178
6827
|
|
|
7179
6828
|
|
|
7180
6829
|
|
|
6830
|
+
|
|
6831
|
+
|
|
7181
6832
|
},
|
|
7182
6833
|
198(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7183
6834
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -14183,7 +13834,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14183
13834
|
BulkPersistChanges: () => (/* reexport safe */ _collections__rspack_import_2.BulkPersistChanges),
|
|
14184
13835
|
BulkPersistResult: () => (/* reexport safe */ _collections__rspack_import_2.BulkPersistResult),
|
|
14185
13836
|
CacheDbPlugin: () => (/* reexport safe */ _plugins__rspack_import_7.CacheDbPlugin),
|
|
14186
|
-
Capability: () => (/* reexport safe */ _capabilities__rspack_import_11.Capability),
|
|
14187
13837
|
CodeBuilder: () => (/* reexport safe */ _codegen__rspack_import_1.CodeBuilder),
|
|
14188
13838
|
ComparatorExpression: () => (/* reexport safe */ _expressions__rspack_import_4.ComparatorExpression),
|
|
14189
13839
|
ConcurrencyDbPlugin: () => (/* reexport safe */ _plugins__rspack_import_7.ConcurrencyDbPlugin),
|
|
@@ -14208,7 +13858,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14208
13858
|
ObjectBuilder: () => (/* reexport safe */ _codegen__rspack_import_1.ObjectBuilder),
|
|
14209
13859
|
OperatorExpression: () => (/* reexport safe */ _expressions__rspack_import_4.OperatorExpression),
|
|
14210
13860
|
OptimisticConcurrencyError: () => (/* reexport safe */ _errors__rspack_import_3.OptimisticConcurrencyError),
|
|
14211
|
-
PerformanceCapability: () => (/* reexport safe */ _capabilities__rspack_import_11.PerformanceCapability),
|
|
14212
13861
|
PluginDestroyedError: () => (/* reexport safe */ _errors__rspack_import_3.PluginDestroyedError),
|
|
14213
13862
|
PluginEventResult: () => (/* reexport safe */ _results__rspack_import_8.PluginEventResult),
|
|
14214
13863
|
PropertyExpression: () => (/* reexport safe */ _expressions__rspack_import_4.PropertyExpression),
|
|
@@ -14258,7 +13907,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14258
13907
|
StringBuilder: () => (/* reexport safe */ _codegen__rspack_import_1.StringBuilder),
|
|
14259
13908
|
SyncronousQueue: () => (/* reexport safe */ _pipeline__rspack_import_6.SyncronousQueue),
|
|
14260
13909
|
TagCollection: () => (/* reexport safe */ _collections__rspack_import_2.TagCollection),
|
|
14261
|
-
|
|
13910
|
+
TelemetryDbPlugin: () => (/* reexport safe */ _plugins__rspack_import_7.TelemetryDbPlugin),
|
|
14262
13911
|
TrampolinePipeline: () => (/* reexport safe */ _pipeline__rspack_import_6.TrampolinePipeline),
|
|
14263
13912
|
TranslatedArrayValue: () => (/* reexport safe */ _plugins__rspack_import_7.TranslatedArrayValue),
|
|
14264
13913
|
TranslatedGroupValue: () => (/* reexport safe */ _plugins__rspack_import_7.TranslatedGroupValue),
|
|
@@ -14276,6 +13925,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14276
13925
|
assertString: () => (/* reexport safe */ _assertions__rspack_import_0.assertString),
|
|
14277
13926
|
cast: () => (/* reexport safe */ _utilities__rspack_import_10.cast),
|
|
14278
13927
|
clone: () => (/* reexport safe */ _utilities__rspack_import_10.clone),
|
|
13928
|
+
collectingSink: () => (/* reexport safe */ _plugins__rspack_import_7.collectingSink),
|
|
14279
13929
|
combineExpressions: () => (/* reexport safe */ _expressions__rspack_import_4.combineExpressions),
|
|
14280
13930
|
combineQueryOptionsCollections: () => (/* reexport safe */ _utilities__rspack_import_10.combineQueryOptionsCollections),
|
|
14281
13931
|
compiledSchemaToJsonSchema: () => (/* reexport safe */ _schema__rspack_import_9.compiledSchemaToJsonSchema),
|
|
@@ -14312,6 +13962,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14312
13962
|
joinInPlugin: () => (/* reexport safe */ _plugins__rspack_import_7.joinInPlugin),
|
|
14313
13963
|
loadJoinInnerSide: () => (/* reexport safe */ _plugins__rspack_import_7.loadJoinInnerSide),
|
|
14314
13964
|
logger: () => (/* reexport safe */ _utilities__rspack_import_10.logger),
|
|
13965
|
+
loggerSink: () => (/* reexport safe */ _plugins__rspack_import_7.loggerSink),
|
|
13966
|
+
mappedResultColumns: () => (/* reexport safe */ _plugins__rspack_import_7.mappedResultColumns),
|
|
14315
13967
|
measure: () => (/* reexport safe */ _performance__rspack_import_5.measure),
|
|
14316
13968
|
nearestBy: () => (/* reexport safe */ _plugins__rspack_import_7.nearestBy),
|
|
14317
13969
|
noop: () => (/* reexport safe */ _utilities__rspack_import_10.noop),
|
|
@@ -14350,12 +14002,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14350
14002
|
/* import */ var _expressions__rspack_import_4 = __webpack_require__(138);
|
|
14351
14003
|
/* import */ var _performance__rspack_import_5 = __webpack_require__(971);
|
|
14352
14004
|
/* import */ var _pipeline__rspack_import_6 = __webpack_require__(314);
|
|
14353
|
-
/* import */ var _plugins__rspack_import_7 = __webpack_require__(
|
|
14005
|
+
/* import */ var _plugins__rspack_import_7 = __webpack_require__(10);
|
|
14354
14006
|
/* import */ var _results__rspack_import_8 = __webpack_require__(264);
|
|
14355
14007
|
/* import */ var _schema__rspack_import_9 = __webpack_require__(755);
|
|
14356
14008
|
/* import */ var _utilities__rspack_import_10 = __webpack_require__(222);
|
|
14357
|
-
/* import */ var _capabilities__rspack_import_11 = __webpack_require__(599);
|
|
14358
|
-
|
|
14359
14009
|
|
|
14360
14010
|
|
|
14361
14011
|
|