@routier/core 0.8.1 → 0.8.2
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 +45 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +49 -3
- package/dist/index.js.map +1 -1
- package/dist/results/index.cjs +40 -0
- package/dist/results/index.cjs.map +1 -1
- package/dist/results/index.d.ts +1 -0
- package/dist/results/index.js +44 -1
- package/dist/results/index.js.map +1 -1
- package/dist/results/liveQuery.d.ts +26 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9661,12 +9661,15 @@ class PluginEventResult extends BaseResult {
|
|
|
9661
9661
|
|
|
9662
9662
|
|
|
9663
9663
|
},
|
|
9664
|
-
|
|
9664
|
+
881(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
9665
9665
|
|
|
9666
9666
|
// EXPORTS
|
|
9667
9667
|
__webpack_require__.d(__webpack_exports__, {
|
|
9668
9668
|
PluginEventResult: () => (/* reexport */ Result/* .PluginEventResult */.D),
|
|
9669
9669
|
toPromise: () => (/* reexport */ toPromise),
|
|
9670
|
+
pendingLiveQueryState: () => (/* reexport */ pendingLiveQueryState),
|
|
9671
|
+
subscribeLiveQuery: () => (/* reexport */ subscribeLiveQuery),
|
|
9672
|
+
toLiveQueryState: () => (/* reexport */ toLiveQueryState),
|
|
9670
9673
|
Result: () => (/* reexport */ Result/* .Result */.Q)
|
|
9671
9674
|
});
|
|
9672
9675
|
|
|
@@ -9686,12 +9689,49 @@ function toPromise(fn) {
|
|
|
9686
9689
|
});
|
|
9687
9690
|
}
|
|
9688
9691
|
|
|
9692
|
+
;// CONCATENATED MODULE: ./src/results/liveQuery.ts
|
|
9693
|
+
|
|
9694
|
+
const pendingLiveQueryState = ()=>({
|
|
9695
|
+
status: "pending",
|
|
9696
|
+
loading: true,
|
|
9697
|
+
isSuccess: false,
|
|
9698
|
+
isError: false
|
|
9699
|
+
});
|
|
9700
|
+
const toLiveQueryState = (result)=>result.ok === Result/* .Result.SUCCESS */.Q.SUCCESS ? {
|
|
9701
|
+
status: "success",
|
|
9702
|
+
loading: false,
|
|
9703
|
+
data: result.data,
|
|
9704
|
+
isSuccess: true,
|
|
9705
|
+
isError: false
|
|
9706
|
+
} : {
|
|
9707
|
+
status: "error",
|
|
9708
|
+
loading: false,
|
|
9709
|
+
error: new Error(result.error?.message || "Unknown error"),
|
|
9710
|
+
isSuccess: false,
|
|
9711
|
+
isError: true
|
|
9712
|
+
};
|
|
9713
|
+
const subscribeLiveQuery = (query, onState)=>{
|
|
9714
|
+
let active = true;
|
|
9715
|
+
const unsubscribe = query((result)=>{
|
|
9716
|
+
if (active) {
|
|
9717
|
+
onState(toLiveQueryState(result));
|
|
9718
|
+
}
|
|
9719
|
+
});
|
|
9720
|
+
return ()=>{
|
|
9721
|
+
active = false;
|
|
9722
|
+
if (typeof unsubscribe === "function") {
|
|
9723
|
+
unsubscribe();
|
|
9724
|
+
}
|
|
9725
|
+
};
|
|
9726
|
+
};
|
|
9727
|
+
|
|
9689
9728
|
;// CONCATENATED MODULE: ./src/results/index.ts
|
|
9690
9729
|
|
|
9691
9730
|
|
|
9692
9731
|
|
|
9693
9732
|
|
|
9694
9733
|
|
|
9734
|
+
|
|
9695
9735
|
},
|
|
9696
9736
|
862(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
9697
9737
|
|
|
@@ -16425,6 +16465,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
16425
16465
|
parseFragment: () => (/* reexport safe */ _expressions__rspack_import_4.parseFragment),
|
|
16426
16466
|
parseSelector: () => (/* reexport safe */ _expressions__rspack_import_4.parseSelector),
|
|
16427
16467
|
peelCalls: () => (/* reexport safe */ _expressions__rspack_import_4.peelCalls),
|
|
16468
|
+
pendingLiveQueryState: () => (/* reexport safe */ _results__rspack_import_8.pendingLiveQueryState),
|
|
16428
16469
|
propertyInfoToJsonSchema: () => (/* reexport safe */ _schema__rspack_import_9.propertyInfoToJsonSchema),
|
|
16429
16470
|
readJoinKey: () => (/* reexport safe */ _plugins__rspack_import_7.readJoinKey),
|
|
16430
16471
|
rehydrateSchemaFromJsonSchema: () => (/* reexport safe */ _schema__rspack_import_9.rehydrateSchemaFromJsonSchema),
|
|
@@ -16441,9 +16482,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
16441
16482
|
setLogLevel: () => (/* reexport safe */ _utilities__rspack_import_10.setLogLevel),
|
|
16442
16483
|
splitSendableOptions: () => (/* reexport safe */ _plugins__rspack_import_7.splitSendableOptions),
|
|
16443
16484
|
stringifyObject: () => (/* reexport safe */ _utilities__rspack_import_10.stringifyObject),
|
|
16485
|
+
subscribeLiveQuery: () => (/* reexport safe */ _results__rspack_import_8.subscribeLiveQuery),
|
|
16444
16486
|
toEntityShape: () => (/* reexport safe */ _plugins__rspack_import_7.toEntityShape),
|
|
16445
16487
|
toEventArray: () => (/* reexport safe */ _utilities__rspack_import_10.toEventArray),
|
|
16446
16488
|
toExpression: () => (/* reexport safe */ _expressions__rspack_import_4.toExpression),
|
|
16489
|
+
toLiveQueryState: () => (/* reexport safe */ _results__rspack_import_8.toLiveQueryState),
|
|
16447
16490
|
toMap: () => (/* reexport safe */ _utilities__rspack_import_10.toMap),
|
|
16448
16491
|
toPredicate: () => (/* reexport safe */ _expressions__rspack_import_4.toPredicate),
|
|
16449
16492
|
toPromise: () => (/* reexport safe */ _results__rspack_import_8.toPromise),
|
|
@@ -16462,7 +16505,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
16462
16505
|
/* import */ var _performance__rspack_import_5 = __webpack_require__(971);
|
|
16463
16506
|
/* import */ var _pipeline__rspack_import_6 = __webpack_require__(314);
|
|
16464
16507
|
/* import */ var _plugins__rspack_import_7 = __webpack_require__(756);
|
|
16465
|
-
/* import */ var _results__rspack_import_8 = __webpack_require__(
|
|
16508
|
+
/* import */ var _results__rspack_import_8 = __webpack_require__(881);
|
|
16466
16509
|
/* import */ var _schema__rspack_import_9 = __webpack_require__(862);
|
|
16467
16510
|
/* import */ var _utilities__rspack_import_10 = __webpack_require__(222);
|
|
16468
16511
|
|