@routier/core 0.4.0 → 0.5.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/dist/index.cjs +73 -438
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +78 -443
- package/dist/index.js.map +1 -1
- package/dist/plugins/TelemetryDbPlugin.d.ts +43 -0
- package/dist/plugins/index.cjs +68 -1
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +73 -3
- package/dist/plugins/index.js.map +1 -1
- package/package.json +1 -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/dist/plugins/index.d.ts
CHANGED
package/dist/plugins/index.js
CHANGED
|
@@ -3045,8 +3045,8 @@ var __webpack_exports__ = {};
|
|
|
3045
3045
|
__webpack_require__.d(__webpack_exports__, {
|
|
3046
3046
|
jO: () => (/* reexport */ TupleTranslator),
|
|
3047
3047
|
Mr: () => (/* reexport */ deserializeBulkPersist),
|
|
3048
|
-
ae: () => (/* reexport */ explainQuery),
|
|
3049
3048
|
bX: () => (/* reexport */ ConcurrencyDbPlugin),
|
|
3049
|
+
ae: () => (/* reexport */ explainQuery),
|
|
3050
3050
|
_b: () => (/* reexport */ DEFAULT_SEMI_JOIN_KEY_THRESHOLD),
|
|
3051
3051
|
pt: () => (/* reexport */ types_QueryOrdering),
|
|
3052
3052
|
Ib: () => (/* reexport */ TranslatedSingleValue),
|
|
@@ -3060,9 +3060,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3060
3060
|
d0: () => (/* reexport */ JsonTranslator),
|
|
3061
3061
|
PP: () => (/* reexport */ splitSendableOptions),
|
|
3062
3062
|
f2: () => (/* reexport */ TranslatedGroupValue),
|
|
3063
|
-
|
|
3063
|
+
wN: () => (/* reexport */ collectingSink),
|
|
3064
3064
|
QB: () => (/* reexport */ RetryDbPlugin),
|
|
3065
3065
|
m6: () => (/* reexport */ executeJoin),
|
|
3066
|
+
__: () => (/* reexport */ toEntityShape),
|
|
3066
3067
|
VW: () => (/* reexport */ applyInnerOptions),
|
|
3067
3068
|
Jd: () => (/* reexport */ EphemeralDataPlugin),
|
|
3068
3069
|
Pl: () => (/* reexport */ deserializePersistResult),
|
|
@@ -3076,11 +3077,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3076
3077
|
lA: () => (/* reexport */ semiJoinFilter),
|
|
3077
3078
|
kX: () => (/* reexport */ BatchingDbPlugin),
|
|
3078
3079
|
DF: () => (/* reexport */ SqlTranslator),
|
|
3080
|
+
qj: () => (/* reexport */ loggerSink),
|
|
3079
3081
|
gH: () => (/* reexport */ MEMORY_EXECUTION_EXPLANATIONS),
|
|
3080
3082
|
BL: () => (/* reexport */ serializeQueryOptions),
|
|
3081
3083
|
Kg: () => (/* reexport */ withExecutedQueries),
|
|
3082
3084
|
xw: () => (/* reexport */ TranslatedArrayValue),
|
|
3083
3085
|
zH: () => (/* reexport */ joinInPlugin),
|
|
3086
|
+
Pr: () => (/* reexport */ TelemetryDbPlugin),
|
|
3084
3087
|
XK: () => (/* reexport */ Query),
|
|
3085
3088
|
jE: () => (/* reexport */ EXECUTED_QUERIES_UNSUPPORTED)
|
|
3086
3089
|
});
|
|
@@ -6066,6 +6069,69 @@ class RetryDbPlugin {
|
|
|
6066
6069
|
}
|
|
6067
6070
|
}
|
|
6068
6071
|
|
|
6072
|
+
;// CONCATENATED MODULE: ./src/plugins/TelemetryDbPlugin.ts
|
|
6073
|
+
|
|
6074
|
+
/** Default sink: writes through the levelled logger, so ROUTIER_LOG_LEVEL governs it. */ const loggerSink = ()=>(e)=>{
|
|
6075
|
+
const line = `[routier] ${e.operation} ${e.schemas.join(",")} ${e.durationMs.toFixed(1)}ms`;
|
|
6076
|
+
if (e.ok === "error") {
|
|
6077
|
+
logger/* .logger.error */.vF.error(line, e.error);
|
|
6078
|
+
return;
|
|
6079
|
+
}
|
|
6080
|
+
logger/* .logger.info */.vF.info(line);
|
|
6081
|
+
};
|
|
6082
|
+
/** Pushes every event into `into`. For tests and custom buffering. */ const collectingSink = (into)=>(e)=>{
|
|
6083
|
+
into.push(e);
|
|
6084
|
+
};
|
|
6085
|
+
class TelemetryDbPlugin {
|
|
6086
|
+
plugin;
|
|
6087
|
+
onEvent;
|
|
6088
|
+
constructor(plugin, options = {}){
|
|
6089
|
+
this.plugin = plugin;
|
|
6090
|
+
this.onEvent = options.onEvent ?? loggerSink();
|
|
6091
|
+
}
|
|
6092
|
+
get databaseName() {
|
|
6093
|
+
return this.plugin.databaseName;
|
|
6094
|
+
}
|
|
6095
|
+
query(event, done) {
|
|
6096
|
+
const start = performance.now();
|
|
6097
|
+
this.plugin.query(event, (result)=>{
|
|
6098
|
+
this.emit("query", event, result, start);
|
|
6099
|
+
done(result);
|
|
6100
|
+
});
|
|
6101
|
+
}
|
|
6102
|
+
bulkPersist(event, done) {
|
|
6103
|
+
const start = performance.now();
|
|
6104
|
+
this.plugin.bulkPersist(event, (result)=>{
|
|
6105
|
+
this.emit("bulkPersist", event, result, start);
|
|
6106
|
+
done(result);
|
|
6107
|
+
});
|
|
6108
|
+
}
|
|
6109
|
+
destroy(event, done) {
|
|
6110
|
+
const start = performance.now();
|
|
6111
|
+
this.plugin.destroy(event, (result)=>{
|
|
6112
|
+
this.emit("destroy", event, result, start);
|
|
6113
|
+
done(result);
|
|
6114
|
+
});
|
|
6115
|
+
}
|
|
6116
|
+
emit(operation, event, result, start) {
|
|
6117
|
+
try {
|
|
6118
|
+
this.onEvent({
|
|
6119
|
+
operation,
|
|
6120
|
+
eventId: event.id,
|
|
6121
|
+
source: event.source,
|
|
6122
|
+
schemas: [
|
|
6123
|
+
...event.schemas.values()
|
|
6124
|
+
].map((s)=>s.collectionName),
|
|
6125
|
+
durationMs: performance.now() - start,
|
|
6126
|
+
ok: result.ok,
|
|
6127
|
+
error: result.ok === "success" ? undefined : result.error
|
|
6128
|
+
});
|
|
6129
|
+
} catch {
|
|
6130
|
+
// A broken sink must never fail the data operation.
|
|
6131
|
+
}
|
|
6132
|
+
}
|
|
6133
|
+
}
|
|
6134
|
+
|
|
6069
6135
|
;// CONCATENATED MODULE: ./src/plugins/CacheDbPlugin.ts
|
|
6070
6136
|
|
|
6071
6137
|
/**
|
|
@@ -6529,6 +6595,7 @@ const DEFAULT_MAX_BATCH_SIZE = 100;
|
|
|
6529
6595
|
|
|
6530
6596
|
|
|
6531
6597
|
|
|
6598
|
+
|
|
6532
6599
|
})();
|
|
6533
6600
|
|
|
6534
6601
|
var __webpack_exports__BatchingDbPlugin = __webpack_exports__.kX;
|
|
@@ -6545,11 +6612,13 @@ var __webpack_exports__QueryOptionsCollection = __webpack_exports__.HM;
|
|
|
6545
6612
|
var __webpack_exports__QueryOrdering = __webpack_exports__.pt;
|
|
6546
6613
|
var __webpack_exports__RetryDbPlugin = __webpack_exports__.QB;
|
|
6547
6614
|
var __webpack_exports__SqlTranslator = __webpack_exports__.DF;
|
|
6615
|
+
var __webpack_exports__TelemetryDbPlugin = __webpack_exports__.Pr;
|
|
6548
6616
|
var __webpack_exports__TranslatedArrayValue = __webpack_exports__.xw;
|
|
6549
6617
|
var __webpack_exports__TranslatedGroupValue = __webpack_exports__.f2;
|
|
6550
6618
|
var __webpack_exports__TranslatedSingleValue = __webpack_exports__.Ib;
|
|
6551
6619
|
var __webpack_exports__TupleTranslator = __webpack_exports__.jO;
|
|
6552
6620
|
var __webpack_exports__applyInnerOptions = __webpack_exports__.VW;
|
|
6621
|
+
var __webpack_exports__collectingSink = __webpack_exports__.wN;
|
|
6553
6622
|
var __webpack_exports__cosineDistance = __webpack_exports__.lO;
|
|
6554
6623
|
var __webpack_exports__createRequestHandler = __webpack_exports__.KB;
|
|
6555
6624
|
var __webpack_exports__deserializeBulkPersist = __webpack_exports__.Mr;
|
|
@@ -6562,6 +6631,7 @@ var __webpack_exports__formatExplanation = __webpack_exports__.vZ;
|
|
|
6562
6631
|
var __webpack_exports__hashJoin = __webpack_exports__.Bg;
|
|
6563
6632
|
var __webpack_exports__joinInPlugin = __webpack_exports__.zH;
|
|
6564
6633
|
var __webpack_exports__loadJoinInnerSide = __webpack_exports__.as;
|
|
6634
|
+
var __webpack_exports__loggerSink = __webpack_exports__.qj;
|
|
6565
6635
|
var __webpack_exports__nearestBy = __webpack_exports__.iG;
|
|
6566
6636
|
var __webpack_exports__readJoinKey = __webpack_exports__.qy;
|
|
6567
6637
|
var __webpack_exports__semiJoinFilter = __webpack_exports__.lA;
|
|
@@ -6571,6 +6641,6 @@ var __webpack_exports__serializeQueryOptions = __webpack_exports__.BL;
|
|
|
6571
6641
|
var __webpack_exports__splitSendableOptions = __webpack_exports__.PP;
|
|
6572
6642
|
var __webpack_exports__toEntityShape = __webpack_exports__.__;
|
|
6573
6643
|
var __webpack_exports__withExecutedQueries = __webpack_exports__.Kg;
|
|
6574
|
-
export { __webpack_exports__BatchingDbPlugin as BatchingDbPlugin, __webpack_exports__CacheDbPlugin as CacheDbPlugin, __webpack_exports__ConcurrencyDbPlugin as ConcurrencyDbPlugin, __webpack_exports__DEFAULT_SEMI_JOIN_KEY_THRESHOLD as DEFAULT_SEMI_JOIN_KEY_THRESHOLD, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EXECUTED_QUERIES_UNSUPPORTED as EXECUTED_QUERIES_UNSUPPORTED, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__MEMORY_EXECUTION_EXPLANATIONS as MEMORY_EXECUTION_EXPLANATIONS, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__RetryDbPlugin as RetryDbPlugin, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__TranslatedArrayValue as TranslatedArrayValue, __webpack_exports__TranslatedGroupValue as TranslatedGroupValue, __webpack_exports__TranslatedSingleValue as TranslatedSingleValue, __webpack_exports__TupleTranslator as TupleTranslator, __webpack_exports__applyInnerOptions as applyInnerOptions, __webpack_exports__cosineDistance as cosineDistance, __webpack_exports__createRequestHandler as createRequestHandler, __webpack_exports__deserializeBulkPersist as deserializeBulkPersist, __webpack_exports__deserializePersistResult as deserializePersistResult, __webpack_exports__deserializeQueryOptions as deserializeQueryOptions, __webpack_exports__distinctJoinKeys as distinctJoinKeys, __webpack_exports__executeJoin as executeJoin, __webpack_exports__explainQuery as explainQuery, __webpack_exports__formatExplanation as formatExplanation, __webpack_exports__hashJoin as hashJoin, __webpack_exports__joinInPlugin as joinInPlugin, __webpack_exports__loadJoinInnerSide as loadJoinInnerSide, __webpack_exports__nearestBy as nearestBy, __webpack_exports__readJoinKey as readJoinKey, __webpack_exports__semiJoinFilter as semiJoinFilter, __webpack_exports__serializeBulkPersist as serializeBulkPersist, __webpack_exports__serializePersistResult as serializePersistResult, __webpack_exports__serializeQueryOptions as serializeQueryOptions, __webpack_exports__splitSendableOptions as splitSendableOptions, __webpack_exports__toEntityShape as toEntityShape, __webpack_exports__withExecutedQueries as withExecutedQueries };
|
|
6644
|
+
export { __webpack_exports__BatchingDbPlugin as BatchingDbPlugin, __webpack_exports__CacheDbPlugin as CacheDbPlugin, __webpack_exports__ConcurrencyDbPlugin as ConcurrencyDbPlugin, __webpack_exports__DEFAULT_SEMI_JOIN_KEY_THRESHOLD as DEFAULT_SEMI_JOIN_KEY_THRESHOLD, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EXECUTED_QUERIES_UNSUPPORTED as EXECUTED_QUERIES_UNSUPPORTED, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__MEMORY_EXECUTION_EXPLANATIONS as MEMORY_EXECUTION_EXPLANATIONS, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__RetryDbPlugin as RetryDbPlugin, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__TelemetryDbPlugin as TelemetryDbPlugin, __webpack_exports__TranslatedArrayValue as TranslatedArrayValue, __webpack_exports__TranslatedGroupValue as TranslatedGroupValue, __webpack_exports__TranslatedSingleValue as TranslatedSingleValue, __webpack_exports__TupleTranslator as TupleTranslator, __webpack_exports__applyInnerOptions as applyInnerOptions, __webpack_exports__collectingSink as collectingSink, __webpack_exports__cosineDistance as cosineDistance, __webpack_exports__createRequestHandler as createRequestHandler, __webpack_exports__deserializeBulkPersist as deserializeBulkPersist, __webpack_exports__deserializePersistResult as deserializePersistResult, __webpack_exports__deserializeQueryOptions as deserializeQueryOptions, __webpack_exports__distinctJoinKeys as distinctJoinKeys, __webpack_exports__executeJoin as executeJoin, __webpack_exports__explainQuery as explainQuery, __webpack_exports__formatExplanation as formatExplanation, __webpack_exports__hashJoin as hashJoin, __webpack_exports__joinInPlugin as joinInPlugin, __webpack_exports__loadJoinInnerSide as loadJoinInnerSide, __webpack_exports__loggerSink as loggerSink, __webpack_exports__nearestBy as nearestBy, __webpack_exports__readJoinKey as readJoinKey, __webpack_exports__semiJoinFilter as semiJoinFilter, __webpack_exports__serializeBulkPersist as serializeBulkPersist, __webpack_exports__serializePersistResult as serializePersistResult, __webpack_exports__serializeQueryOptions as serializeQueryOptions, __webpack_exports__splitSendableOptions as splitSendableOptions, __webpack_exports__toEntityShape as toEntityShape, __webpack_exports__withExecutedQueries as withExecutedQueries };
|
|
6575
6645
|
|
|
6576
6646
|
//# sourceMappingURL=index.js.map
|