@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.
- package/dist/capabilities/Capability.d.ts +11 -0
- package/dist/capabilities/PerformanceCapability.d.ts +13 -0
- package/dist/capabilities/TracingCapability.d.ts +11 -0
- package/dist/capabilities/index.d.ts +4 -0
- package/dist/capabilities/index.js +763 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/performance/PerformanceTracker.d.ts +11 -0
- package/dist/capabilities/tracing/CallTraceManager.d.ts +12 -0
- package/dist/capabilities/types.d.ts +17 -0
- package/dist/codegen/blocks.d.ts +8 -0
- package/dist/codegen/handlers/CompareIdsHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/compare/CompareArrayHandler.d.ts +6 -0
- package/dist/codegen/handlers/compare/CompareDateHandler.d.ts +6 -0
- package/dist/codegen/handlers/compareIds/CompareIdsKeyHandler.d.ts +6 -0
- package/dist/codegen/handlers/index.d.ts +1 -0
- package/dist/codegen/handlers/serialize/SerializeDateHandler.d.ts +2 -1
- package/dist/codegen/handlers/serialize/SerializeFunctionHandler.d.ts +6 -0
- package/dist/codegen/index.js +660 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/collections/index.js.map +1 -1
- package/dist/expressions/index.js +108 -19
- package/dist/expressions/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1406 -602
- package/dist/index.js.map +1 -1
- package/dist/pipeline/WorkPipeline.test.d.ts +1 -0
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugins/EphemeralDataPlugin.d.ts +2 -2
- package/dist/plugins/EphemeralDataPlugin.test.d.ts +1 -0
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/index.js +244 -483
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/query/types.d.ts +5 -0
- package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +2 -1
- package/dist/plugins/replication/ReplicationDbPlugin.d.ts +2 -1
- package/dist/plugins/translators/DataTranslator.d.ts +3 -1
- package/dist/plugins/translators/JsonTranslator.d.ts +1 -0
- package/dist/plugins/translators/SqlTranslator.d.ts +1 -0
- package/dist/plugins/translators/TranslatedArrayValue.d.ts +6 -0
- package/dist/plugins/translators/TranslatedGroupValue.d.ts +6 -0
- package/dist/plugins/translators/TranslatedSingleValue.d.ts +6 -0
- package/dist/plugins/translators/index.d.ts +4 -0
- package/dist/plugins/translators/types.d.ts +10 -0
- package/dist/plugins/types.d.ts +2 -1
- package/dist/schema/PropertyInfo.d.ts +6 -1
- package/dist/schema/SchemaDefinition.d.ts +1 -1
- package/dist/schema/communication/broadcast.d.ts +3 -3
- package/dist/schema/index.js +508 -76
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/property/modifiers/SchemaTracked.d.ts +3 -1
- package/dist/schema/table/SchemaComputed.d.ts +1 -1
- package/dist/schema/testSchemas.test.d.ts +60 -36
- package/dist/schema/types.d.ts +16 -1
- package/dist/utilities/index.js +145 -2
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/strings.d.ts +34 -0
- package/dist/utilities/strings.test.d.ts +1 -0
- package/package.json +5 -1
- package/readme.md +1 -1
- package/dist/plugins/capabilities/DbPluginCapability.d.ts +0 -23
- package/dist/plugins/capabilities/index.d.ts +0 -2
- package/dist/plugins/capabilities/logging/DbPluginLoggingCapability.d.ts +0 -28
- package/dist/plugins/capabilities/logging/index.d.ts +0 -1
package/dist/plugins/index.js
CHANGED
|
@@ -320,39 +320,6 @@ function forEach(expression, callback) {
|
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
|
|
323
|
-
}),
|
|
324
|
-
"./src/performance/index.ts":
|
|
325
|
-
/*!**********************************!*\
|
|
326
|
-
!*** ./src/performance/index.ts ***!
|
|
327
|
-
\**********************************/
|
|
328
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
329
|
-
__webpack_require__.r(__webpack_exports__);
|
|
330
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
331
|
-
measure: () => (measure),
|
|
332
|
-
now: () => (now)
|
|
333
|
-
});
|
|
334
|
-
const measurements = {};
|
|
335
|
-
const now = () => {
|
|
336
|
-
if (typeof performance !== 'undefined' && performance.now) {
|
|
337
|
-
// Browser or modern Node.js
|
|
338
|
-
return performance.now();
|
|
339
|
-
}
|
|
340
|
-
// Fallback for older environments
|
|
341
|
-
return Date.now();
|
|
342
|
-
};
|
|
343
|
-
const measure = {
|
|
344
|
-
start: (name) => {
|
|
345
|
-
measurements[name] = now();
|
|
346
|
-
},
|
|
347
|
-
end: (name) => {
|
|
348
|
-
const start = measurements[name];
|
|
349
|
-
delete measurements[name];
|
|
350
|
-
const delta = now() - start;
|
|
351
|
-
console.log(`[ROUTIER] - Performance: ${name} took ${delta}`);
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
|
|
356
323
|
}),
|
|
357
324
|
"./src/pipeline/TrampolinePipeline.ts":
|
|
358
325
|
/*!********************************************!*\
|
|
@@ -755,10 +722,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
755
722
|
__webpack_require__.d(__webpack_exports__, {
|
|
756
723
|
EphemeralDataPlugin: () => (EphemeralDataPlugin)
|
|
757
724
|
});
|
|
758
|
-
/* ESM import */var
|
|
725
|
+
/* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
|
|
759
726
|
/* ESM import */var _pipeline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../pipeline */ "./src/pipeline/TrampolinePipeline.ts");
|
|
760
727
|
/* ESM import */var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! . */ "./src/plugins/translators/JsonTranslator.ts");
|
|
761
|
-
/* ESM import */var
|
|
728
|
+
/* ESM import */var _results__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../results */ "./src/results/Result.ts");
|
|
762
729
|
|
|
763
730
|
|
|
764
731
|
|
|
@@ -770,470 +737,105 @@ class EphemeralDataPlugin {
|
|
|
770
737
|
}
|
|
771
738
|
bulkPersist(event, done) {
|
|
772
739
|
try {
|
|
773
|
-
const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_0__.WorkPipeline();
|
|
774
740
|
const bulkPersistResult = event.operation.toResult();
|
|
741
|
+
const schemas = event.schemas;
|
|
742
|
+
const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_0__.WorkPipeline();
|
|
743
|
+
let hasWork = false;
|
|
775
744
|
for (const [schemaId, changes] of event.operation) {
|
|
745
|
+
const { adds, hasItems, removes, updates } = changes;
|
|
746
|
+
if (!hasItems) {
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
hasWork = true;
|
|
750
|
+
const result = bulkPersistResult.get(schemaId);
|
|
751
|
+
const schema = schemas.get(schemaId);
|
|
752
|
+
(0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertIsNotNull)(schema);
|
|
776
753
|
pipeline.pipe((d) => {
|
|
777
754
|
try {
|
|
778
|
-
const { adds, hasItems, removes, updates } = changes;
|
|
779
|
-
if (hasItems === false) {
|
|
780
|
-
d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.success());
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
const result = bulkPersistResult.get(schemaId);
|
|
784
|
-
const schema = event.schemas.get(schemaId);
|
|
785
|
-
(0,_assertions__WEBPACK_IMPORTED_MODULE_2__.assertIsNotNull)(schema);
|
|
786
755
|
const collection = this.resolveCollection(schema);
|
|
787
756
|
collection.load(readResult => {
|
|
788
|
-
if (readResult.ok ===
|
|
757
|
+
if (readResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
|
|
789
758
|
d(readResult);
|
|
790
759
|
return;
|
|
791
760
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
761
|
+
const addsLength = adds.length;
|
|
762
|
+
const updatesLength = updates.length;
|
|
763
|
+
const removesLength = removes.length;
|
|
764
|
+
result.adds = new Array(addsLength);
|
|
765
|
+
result.updates = new Array(updatesLength);
|
|
766
|
+
result.removes = new Array(removesLength);
|
|
767
|
+
for (let j = 0; j < addsLength; j++) {
|
|
768
|
+
const item = adds[j];
|
|
769
|
+
collection.add(item);
|
|
770
|
+
result.adds[j] = item;
|
|
795
771
|
}
|
|
796
|
-
for (let
|
|
797
|
-
|
|
798
|
-
|
|
772
|
+
for (let j = 0; j < updatesLength; j++) {
|
|
773
|
+
const item = updates[j].entity;
|
|
774
|
+
collection.update(item);
|
|
775
|
+
result.updates[j] = item;
|
|
799
776
|
}
|
|
800
|
-
for (let
|
|
801
|
-
collection.remove(removes[
|
|
802
|
-
result.removes
|
|
777
|
+
for (let j = 0; j < removesLength; j++) {
|
|
778
|
+
collection.remove(removes[j]);
|
|
779
|
+
result.removes[j] = removes[j];
|
|
803
780
|
}
|
|
804
781
|
collection.save(saveResult => {
|
|
805
|
-
if (saveResult.ok ===
|
|
782
|
+
if (saveResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
|
|
806
783
|
d(saveResult);
|
|
807
784
|
return;
|
|
808
785
|
}
|
|
809
|
-
d(
|
|
786
|
+
d(_results__WEBPACK_IMPORTED_MODULE_2__.Result.success());
|
|
810
787
|
});
|
|
811
788
|
});
|
|
812
789
|
}
|
|
813
790
|
catch (e) {
|
|
814
|
-
d(
|
|
791
|
+
d(_results__WEBPACK_IMPORTED_MODULE_2__.Result.error(e));
|
|
815
792
|
}
|
|
816
793
|
});
|
|
817
794
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
done(
|
|
795
|
+
// If there is no work, just return the result
|
|
796
|
+
if (!hasWork) {
|
|
797
|
+
done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, bulkPersistResult));
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
pipeline.filter((result) => {
|
|
801
|
+
if (result.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
|
|
802
|
+
done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, result.error));
|
|
826
803
|
return;
|
|
827
804
|
}
|
|
828
|
-
|
|
829
|
-
done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.success(event.id, bulkPersistResult));
|
|
805
|
+
done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, bulkPersistResult));
|
|
830
806
|
});
|
|
831
807
|
}
|
|
832
808
|
catch (e) {
|
|
833
|
-
done(
|
|
809
|
+
done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
|
|
834
810
|
}
|
|
835
811
|
}
|
|
836
812
|
query(event, done) {
|
|
837
813
|
try {
|
|
838
|
-
const
|
|
814
|
+
const operation = event.operation;
|
|
815
|
+
const schema = operation.schema;
|
|
839
816
|
const translator = new ___WEBPACK_IMPORTED_MODULE_3__.JsonTranslator(operation);
|
|
840
|
-
const collection = this.resolveCollection(
|
|
841
|
-
// translate if we are doing any operations like count/sum/min/max/skip/take
|
|
817
|
+
const collection = this.resolveCollection(schema);
|
|
842
818
|
collection.load(r => {
|
|
843
|
-
if (r.ok ===
|
|
844
|
-
done(
|
|
819
|
+
if (r.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
|
|
820
|
+
done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, r.error));
|
|
845
821
|
return;
|
|
846
822
|
}
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
823
|
+
const records = collection.records;
|
|
824
|
+
const length = records.length;
|
|
825
|
+
const cloned = new Array(length);
|
|
826
|
+
for (let i = 0; i < length; i++) {
|
|
827
|
+
cloned[i] = schema.clone(records[i]);
|
|
850
828
|
}
|
|
851
|
-
|
|
852
|
-
done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.success(event.id, translated));
|
|
829
|
+
done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id, translator.translate(cloned)));
|
|
853
830
|
});
|
|
854
831
|
}
|
|
855
832
|
catch (e) {
|
|
856
|
-
done(
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
}),
|
|
863
|
-
"./src/plugins/capabilities/DbPluginCapability.ts":
|
|
864
|
-
/*!********************************************************!*\
|
|
865
|
-
!*** ./src/plugins/capabilities/DbPluginCapability.ts ***!
|
|
866
|
-
\********************************************************/
|
|
867
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
868
|
-
__webpack_require__.r(__webpack_exports__);
|
|
869
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
870
|
-
DbPluginCapability: () => (DbPluginCapability)
|
|
871
|
-
});
|
|
872
|
-
/**
|
|
873
|
-
* Extends plugin functionality through hooks and event handlers without
|
|
874
|
-
* changing the plugin's type (mixin). Essential for maintaining type safety
|
|
875
|
-
* in routier's core systems.
|
|
876
|
-
*/
|
|
877
|
-
class DbPluginCapability {
|
|
878
|
-
events = {};
|
|
879
|
-
add(name, callback) {
|
|
880
|
-
this.resolve(name);
|
|
881
|
-
switch (name) {
|
|
882
|
-
case "queryStart":
|
|
883
|
-
this.events["query"].before = callback;
|
|
884
|
-
break;
|
|
885
|
-
case "queryComplete":
|
|
886
|
-
this.events["query"].after = callback;
|
|
887
|
-
break;
|
|
888
|
-
case "destroyStart":
|
|
889
|
-
this.events["destroy"].before = callback;
|
|
890
|
-
break;
|
|
891
|
-
case "destroyComplete":
|
|
892
|
-
this.events["destroy"].after = callback;
|
|
893
|
-
break;
|
|
894
|
-
case "bulkPersistStart":
|
|
895
|
-
this.events["bulkPersist"].before = callback;
|
|
896
|
-
break;
|
|
897
|
-
case "bulkPersistComplete":
|
|
898
|
-
this.events["bulkPersist"].after = callback;
|
|
899
|
-
break;
|
|
900
|
-
}
|
|
901
|
-
return this;
|
|
902
|
-
}
|
|
903
|
-
resolve(name) {
|
|
904
|
-
switch (name) {
|
|
905
|
-
case "queryStart":
|
|
906
|
-
case "queryComplete":
|
|
907
|
-
if (!this.events["query"]) {
|
|
908
|
-
this.events["query"] = {};
|
|
909
|
-
}
|
|
910
|
-
return;
|
|
911
|
-
case "destroyStart":
|
|
912
|
-
case "destroyComplete":
|
|
913
|
-
if (!this.events["destroy"]) {
|
|
914
|
-
this.events["destroy"] = {};
|
|
915
|
-
}
|
|
916
|
-
return;
|
|
917
|
-
case "bulkPersistStart":
|
|
918
|
-
case "bulkPersistComplete":
|
|
919
|
-
if (!this.events["bulkPersist"]) {
|
|
920
|
-
this.events["bulkPersist"] = {};
|
|
921
|
-
}
|
|
922
|
-
return;
|
|
923
|
-
default:
|
|
924
|
-
throw new Error("Exhaustive check");
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
apply(plugin) {
|
|
928
|
-
const methodWrappers = [
|
|
929
|
-
{ method: 'query', events: this.events.query },
|
|
930
|
-
{ method: 'destroy', events: this.events.destroy },
|
|
931
|
-
{ method: 'bulkPersist', events: this.events.bulkPersist }
|
|
932
|
-
];
|
|
933
|
-
// apply the mixins
|
|
934
|
-
for (let i = 0, length = methodWrappers.length; i < length; i++) {
|
|
935
|
-
const { events, method } = methodWrappers[i];
|
|
936
|
-
if (events?.before || events?.after) {
|
|
937
|
-
const original = plugin[method].bind(plugin);
|
|
938
|
-
plugin[method] = ((event, done) => {
|
|
939
|
-
events.before?.(event, done);
|
|
940
|
-
if (events.after) {
|
|
941
|
-
return original(event, (result) => {
|
|
942
|
-
events.after(result);
|
|
943
|
-
done(result);
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
return original(event, done);
|
|
947
|
-
});
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
}),
|
|
955
|
-
"./src/plugins/capabilities/index.ts":
|
|
956
|
-
/*!*******************************************!*\
|
|
957
|
-
!*** ./src/plugins/capabilities/index.ts ***!
|
|
958
|
-
\*******************************************/
|
|
959
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
960
|
-
__webpack_require__.r(__webpack_exports__);
|
|
961
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
962
|
-
DbPluginCapability: () => (/* reexport safe */ _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginCapability),
|
|
963
|
-
DbPluginLoggingCapability: () => (/* reexport safe */ _logging__WEBPACK_IMPORTED_MODULE_1__.DbPluginLoggingCapability)
|
|
964
|
-
});
|
|
965
|
-
/* ESM import */var _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DbPluginCapability */ "./src/plugins/capabilities/DbPluginCapability.ts");
|
|
966
|
-
/* ESM import */var _logging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logging */ "./src/plugins/capabilities/logging/index.ts");
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}),
|
|
972
|
-
"./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts":
|
|
973
|
-
/*!***********************************************************************!*\
|
|
974
|
-
!*** ./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts ***!
|
|
975
|
-
\***********************************************************************/
|
|
976
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
977
|
-
__webpack_require__.r(__webpack_exports__);
|
|
978
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
979
|
-
DbPluginLoggingCapability: () => (DbPluginLoggingCapability)
|
|
980
|
-
});
|
|
981
|
-
/* ESM import */var _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../DbPluginCapability */ "./src/plugins/capabilities/DbPluginCapability.ts");
|
|
982
|
-
/* ESM import */var _performance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../performance */ "./src/performance/index.ts");
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
class DbPluginLoggingCapability {
|
|
986
|
-
logStyle = 'redux';
|
|
987
|
-
maxLogEntries = 100;
|
|
988
|
-
logHistory = [];
|
|
989
|
-
queryPerformance = new Map();
|
|
990
|
-
constructor(options) {
|
|
991
|
-
this.logStyle = options?.logStyle ?? 'redux';
|
|
992
|
-
this.maxLogEntries = options?.maxLogEntries ?? 100;
|
|
993
|
-
}
|
|
994
|
-
apply(plugin) {
|
|
995
|
-
const baseCapability = new _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginCapability();
|
|
996
|
-
const pluginName = plugin.constructor.name;
|
|
997
|
-
// Query logging
|
|
998
|
-
baseCapability
|
|
999
|
-
.add("queryStart", (event) => {
|
|
1000
|
-
this.logReduxAction('QUERY_REQUEST', event.id, {
|
|
1001
|
-
plugin: pluginName,
|
|
1002
|
-
collection: event.operation.schema.collectionName,
|
|
1003
|
-
schemaId: event.operation.schema.id,
|
|
1004
|
-
changeTracking: event.operation.changeTracking
|
|
1005
|
-
}, {
|
|
1006
|
-
timestamp: new Date().toISOString(),
|
|
1007
|
-
options: this.extractQueryOptions(event.operation)
|
|
1008
|
-
});
|
|
1009
|
-
this.addToHistory('QUERY_REQUEST', event);
|
|
1010
|
-
this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
|
|
1011
|
-
})
|
|
1012
|
-
.add("queryComplete", (result) => {
|
|
1013
|
-
const start = this.queryPerformance.get(result.id);
|
|
1014
|
-
this.queryPerformance.delete(result.id);
|
|
1015
|
-
const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
|
|
1016
|
-
const duration = start == null ? -1 : end - start;
|
|
1017
|
-
const performance = this.getPerformanceIndicator(duration);
|
|
1018
|
-
if (result.ok === 'success') {
|
|
1019
|
-
this.logReduxAction('QUERY_SUCCESS', result.id, {
|
|
1020
|
-
plugin: pluginName,
|
|
1021
|
-
resultCount: this.getResultCount(result.data),
|
|
1022
|
-
resultType: this.getResultType(result.data)
|
|
1023
|
-
}, {
|
|
1024
|
-
duration: `${duration.toFixed(4)}ms`,
|
|
1025
|
-
performance: performance.label,
|
|
1026
|
-
timestamp: new Date().toISOString()
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
else {
|
|
1030
|
-
this.logReduxAction('QUERY_ERROR', result.id, {
|
|
1031
|
-
plugin: pluginName,
|
|
1032
|
-
error: result.error?.message || result.error,
|
|
1033
|
-
isCritical: false
|
|
1034
|
-
}, {
|
|
1035
|
-
duration: `${duration.toFixed(4)}ms`,
|
|
1036
|
-
performance: performance.label,
|
|
1037
|
-
timestamp: new Date().toISOString()
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
|
-
this.addToHistory('QUERY_RESULT', { result, duration });
|
|
1041
|
-
});
|
|
1042
|
-
// Bulk operations logging
|
|
1043
|
-
baseCapability
|
|
1044
|
-
.add("bulkPersistStart", (event) => {
|
|
1045
|
-
const totalOperations = event.operation.aggregate.size;
|
|
1046
|
-
this.logReduxAction('BULK_OPERATIONS_REQUEST', event.id, {
|
|
1047
|
-
plugin: pluginName,
|
|
1048
|
-
totalOperations,
|
|
1049
|
-
schemaCount: event.schemas.size,
|
|
1050
|
-
operations: this.extractBulkOperations(event.operation)
|
|
1051
|
-
}, {
|
|
1052
|
-
timestamp: new Date().toISOString()
|
|
1053
|
-
});
|
|
1054
|
-
this.addToHistory('BULK_OPERATIONS_REQUEST', event);
|
|
1055
|
-
this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
|
|
1056
|
-
})
|
|
1057
|
-
.add("bulkPersistComplete", (result) => {
|
|
1058
|
-
const start = this.queryPerformance.get(result.id);
|
|
1059
|
-
this.queryPerformance.delete(result.id);
|
|
1060
|
-
const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
|
|
1061
|
-
const duration = start == null ? -1 : end - start;
|
|
1062
|
-
const performance = this.getPerformanceIndicator(duration);
|
|
1063
|
-
if (result.ok === 'success') {
|
|
1064
|
-
this.logReduxAction('BULK_OPERATIONS_SUCCESS', result.id, {
|
|
1065
|
-
plugin: pluginName,
|
|
1066
|
-
completedOperations: this.countCompletedOperations(result.data),
|
|
1067
|
-
schemaCount: result.data.size
|
|
1068
|
-
}, {
|
|
1069
|
-
duration: `${duration.toFixed(4)}ms`,
|
|
1070
|
-
performance: performance.label,
|
|
1071
|
-
timestamp: new Date().toISOString()
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
else {
|
|
1075
|
-
this.logReduxAction('BULK_OPERATIONS_ERROR', result.id, {
|
|
1076
|
-
plugin: pluginName,
|
|
1077
|
-
error: result.error?.message || result.error,
|
|
1078
|
-
isCritical: false
|
|
1079
|
-
}, {
|
|
1080
|
-
duration: `${duration.toFixed(4)}ms`,
|
|
1081
|
-
performance: performance.label,
|
|
1082
|
-
timestamp: new Date().toISOString()
|
|
1083
|
-
});
|
|
1084
|
-
}
|
|
1085
|
-
this.addToHistory('BULK_OPERATIONS_RESULT', { result, duration });
|
|
1086
|
-
});
|
|
1087
|
-
// Destroy logging
|
|
1088
|
-
baseCapability
|
|
1089
|
-
.add("destroyStart", (event) => {
|
|
1090
|
-
this.logReduxAction('DESTROY_REQUEST', event.id, {
|
|
1091
|
-
plugin: pluginName,
|
|
1092
|
-
schemaCount: event.schemas.size
|
|
1093
|
-
}, {
|
|
1094
|
-
timestamp: new Date().toISOString()
|
|
1095
|
-
});
|
|
1096
|
-
this.addToHistory('DESTROY_REQUEST', event);
|
|
1097
|
-
this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
|
|
1098
|
-
})
|
|
1099
|
-
.add("destroyComplete", (result) => {
|
|
1100
|
-
const start = this.queryPerformance.get(result.id);
|
|
1101
|
-
this.queryPerformance.delete(result.id);
|
|
1102
|
-
const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
|
|
1103
|
-
const duration = start == null ? -1 : end - start;
|
|
1104
|
-
const performance = this.getPerformanceIndicator(duration);
|
|
1105
|
-
if (result.ok === 'success') {
|
|
1106
|
-
this.logReduxAction('DESTROY_SUCCESS', result.id, {
|
|
1107
|
-
plugin: pluginName
|
|
1108
|
-
}, {
|
|
1109
|
-
duration: `${duration.toFixed(4)}ms`,
|
|
1110
|
-
performance: performance.label,
|
|
1111
|
-
timestamp: new Date().toISOString()
|
|
1112
|
-
});
|
|
1113
|
-
}
|
|
1114
|
-
else {
|
|
1115
|
-
this.logReduxAction('DESTROY_ERROR', result.id, {
|
|
1116
|
-
plugin: pluginName,
|
|
1117
|
-
error: result.error?.message || result.error
|
|
1118
|
-
}, {
|
|
1119
|
-
duration: `${duration.toFixed(4)}ms`,
|
|
1120
|
-
performance: performance.label,
|
|
1121
|
-
timestamp: new Date().toISOString()
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
this.addToHistory('DESTROY_RESULT', { result, duration });
|
|
1125
|
-
});
|
|
1126
|
-
baseCapability.apply(plugin);
|
|
1127
|
-
}
|
|
1128
|
-
getPerformanceIndicator(duration) {
|
|
1129
|
-
if (duration > 1000)
|
|
1130
|
-
return { emoji: '🐌', color: '#ef4444', label: 'SLOW', level: 'error' };
|
|
1131
|
-
if (duration > 500)
|
|
1132
|
-
return { emoji: '🐢', color: '#f97316', label: 'MEDIUM', level: 'warning' };
|
|
1133
|
-
if (duration > 100)
|
|
1134
|
-
return { emoji: '⚡', color: '#eab308', label: 'FAST', level: 'info' };
|
|
1135
|
-
return { emoji: '🚀', color: '#22c55e', label: 'INSTANT', level: 'success' };
|
|
1136
|
-
}
|
|
1137
|
-
logReduxAction(action, eventId, payload, meta) {
|
|
1138
|
-
if (this.logStyle !== 'redux')
|
|
1139
|
-
return;
|
|
1140
|
-
const timestamp = new Date().toISOString();
|
|
1141
|
-
console.groupCollapsed(`%c${action} %c@ ${timestamp}`, 'color: #3b82f6; font-weight: bold; font-size: 14px;', 'color: #6b7280; font-size: 12px;');
|
|
1142
|
-
console.group('Action');
|
|
1143
|
-
console.log('Type:', action);
|
|
1144
|
-
console.log('Event ID:', eventId);
|
|
1145
|
-
console.log('Timestamp:', timestamp);
|
|
1146
|
-
console.groupEnd();
|
|
1147
|
-
if (payload) {
|
|
1148
|
-
console.group('Payload');
|
|
1149
|
-
console.log(payload);
|
|
1150
|
-
console.groupEnd();
|
|
1151
|
-
}
|
|
1152
|
-
if (meta) {
|
|
1153
|
-
console.group('Meta');
|
|
1154
|
-
console.log(meta);
|
|
1155
|
-
console.groupEnd();
|
|
1156
|
-
}
|
|
1157
|
-
console.groupEnd();
|
|
1158
|
-
}
|
|
1159
|
-
extractQueryOptions(query) {
|
|
1160
|
-
const options = {};
|
|
1161
|
-
if (query.options) {
|
|
1162
|
-
['skip', 'take', 'sort', 'filter', 'map', 'distinct'].forEach(type => {
|
|
1163
|
-
try {
|
|
1164
|
-
const values = query.options.getValues(type);
|
|
1165
|
-
if (values.length > 0)
|
|
1166
|
-
options[type] = values;
|
|
1167
|
-
}
|
|
1168
|
-
catch (e) {
|
|
1169
|
-
// Skip if option type not supported
|
|
1170
|
-
}
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
return options;
|
|
1174
|
-
}
|
|
1175
|
-
getResultCount(result) {
|
|
1176
|
-
if (Array.isArray(result))
|
|
1177
|
-
return `${result.length} items`;
|
|
1178
|
-
if (result !== null && typeof result === 'object')
|
|
1179
|
-
return '1 object';
|
|
1180
|
-
return '1 primitive';
|
|
1181
|
-
}
|
|
1182
|
-
getResultType(result) {
|
|
1183
|
-
if (Array.isArray(result))
|
|
1184
|
-
return 'array';
|
|
1185
|
-
if (result !== null && typeof result === 'object')
|
|
1186
|
-
return 'object';
|
|
1187
|
-
return typeof result;
|
|
1188
|
-
}
|
|
1189
|
-
extractBulkOperations(operations) {
|
|
1190
|
-
const aggregate = operations.aggregate;
|
|
1191
|
-
return {
|
|
1192
|
-
adds: aggregate.adds,
|
|
1193
|
-
updates: aggregate.updates,
|
|
1194
|
-
removes: aggregate.removes
|
|
1195
|
-
};
|
|
1196
|
-
}
|
|
1197
|
-
countCompletedOperations(result) {
|
|
1198
|
-
return result?.aggregate.size || 0;
|
|
1199
|
-
}
|
|
1200
|
-
addToHistory(type, data) {
|
|
1201
|
-
this.logHistory.push({
|
|
1202
|
-
type,
|
|
1203
|
-
timestamp: Date.now(),
|
|
1204
|
-
data
|
|
1205
|
-
});
|
|
1206
|
-
if (this.logHistory.length > this.maxLogEntries) {
|
|
1207
|
-
this.logHistory = this.logHistory.slice(-this.maxLogEntries);
|
|
833
|
+
done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
|
|
1208
834
|
}
|
|
1209
835
|
}
|
|
1210
|
-
generateId() {
|
|
1211
|
-
return Math.random().toString(36).substr(2, 9);
|
|
1212
|
-
}
|
|
1213
|
-
// Public methods for debugging
|
|
1214
|
-
getLogHistory() {
|
|
1215
|
-
return [...this.logHistory];
|
|
1216
|
-
}
|
|
1217
|
-
clearLogHistory() {
|
|
1218
|
-
this.logHistory = [];
|
|
1219
|
-
}
|
|
1220
836
|
}
|
|
1221
837
|
|
|
1222
838
|
|
|
1223
|
-
}),
|
|
1224
|
-
"./src/plugins/capabilities/logging/index.ts":
|
|
1225
|
-
/*!***************************************************!*\
|
|
1226
|
-
!*** ./src/plugins/capabilities/logging/index.ts ***!
|
|
1227
|
-
\***************************************************/
|
|
1228
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1229
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1230
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
1231
|
-
DbPluginLoggingCapability: () => (/* reexport safe */ _DbPluginLoggingCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginLoggingCapability)
|
|
1232
|
-
});
|
|
1233
|
-
/* ESM import */var _DbPluginLoggingCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DbPluginLoggingCapability */ "./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts");
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
839
|
}),
|
|
1238
840
|
"./src/plugins/query/Query.ts":
|
|
1239
841
|
/*!************************************!*\
|
|
@@ -1488,9 +1090,6 @@ const getMemoryPluginCollectionSize = (plugin, schema) => {
|
|
|
1488
1090
|
}
|
|
1489
1091
|
throw new Error("Cannot get size of collection for MemoryPlugin, not an instance of MemoryPlugin");
|
|
1490
1092
|
};
|
|
1491
|
-
const HYDRATION_STATUS_PENDING = "hydration-pending";
|
|
1492
|
-
const HYDRATION_STATUS_ERROR = "hydration-error";
|
|
1493
|
-
const HYDRATION_STATUS_SUCCESS = "hydration-success";
|
|
1494
1093
|
let hydrationStatus = "hydration-not-started";
|
|
1495
1094
|
class OptimisticReplicationDbPlugin {
|
|
1496
1095
|
plugins;
|
|
@@ -1810,6 +1409,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1810
1409
|
__webpack_require__.d(__webpack_exports__, {
|
|
1811
1410
|
DataTranslator: () => (DataTranslator)
|
|
1812
1411
|
});
|
|
1412
|
+
/* ESM import */var _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TranslatedArrayValue */ "./src/plugins/translators/TranslatedArrayValue.ts");
|
|
1413
|
+
/* ESM import */var _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TranslatedGroupValue */ "./src/plugins/translators/TranslatedGroupValue.ts");
|
|
1414
|
+
/* ESM import */var _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TranslatedSingleValue */ "./src/plugins/translators/TranslatedSingleValue.ts");
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1813
1418
|
class DataTranslator {
|
|
1814
1419
|
query;
|
|
1815
1420
|
functionMap = {
|
|
@@ -1822,7 +1427,8 @@ class DataTranslator {
|
|
|
1822
1427
|
skip: (data, option) => this.skip(data, option),
|
|
1823
1428
|
sort: (data, option) => this.sort(data, option),
|
|
1824
1429
|
sum: (data, option) => this.sum(data, option),
|
|
1825
|
-
take: (data, option) => this.take(data, option)
|
|
1430
|
+
take: (data, option) => this.take(data, option),
|
|
1431
|
+
group: (data, option) => this.group(data, option)
|
|
1826
1432
|
};
|
|
1827
1433
|
constructor(query) {
|
|
1828
1434
|
this.query = query;
|
|
@@ -1831,7 +1437,13 @@ class DataTranslator {
|
|
|
1831
1437
|
this.query.options.forEach(item => {
|
|
1832
1438
|
data = this.functionMap[item.name](data, item);
|
|
1833
1439
|
});
|
|
1834
|
-
|
|
1440
|
+
if (Array.isArray(data)) {
|
|
1441
|
+
return new _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_0__.TranslatedArrayValue(data);
|
|
1442
|
+
}
|
|
1443
|
+
if (this.query.options.has("group")) {
|
|
1444
|
+
return new _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_1__.TranslatedGroupValue(data);
|
|
1445
|
+
}
|
|
1446
|
+
return new _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_2__.TranslatedSingleValue(data);
|
|
1835
1447
|
}
|
|
1836
1448
|
}
|
|
1837
1449
|
|
|
@@ -1870,24 +1482,54 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
|
|
|
1870
1482
|
if (Array.isArray(data) == false) {
|
|
1871
1483
|
throw new Error("Can only map an array of data");
|
|
1872
1484
|
}
|
|
1873
|
-
const response =
|
|
1874
|
-
// We want deserialization to flow through mappings
|
|
1875
|
-
// TODO: Speed this up!
|
|
1876
|
-
// Generate a function on the fly?
|
|
1485
|
+
const response = new Array(data.length);
|
|
1877
1486
|
for (let i = 0, length = data.length; i < length; i++) {
|
|
1878
1487
|
for (let j = 0, l = option.value.fields.length; j < l; j++) {
|
|
1879
1488
|
const field = option.value.fields[j];
|
|
1880
1489
|
if (field.property != null) {
|
|
1881
1490
|
const value = field.property.getValue(data[i]);
|
|
1882
1491
|
if (value != null) {
|
|
1883
|
-
|
|
1492
|
+
// Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value
|
|
1493
|
+
const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;
|
|
1494
|
+
field.property.setValue(data[i], resolvedValue);
|
|
1884
1495
|
}
|
|
1885
1496
|
}
|
|
1886
1497
|
}
|
|
1887
|
-
response
|
|
1498
|
+
response[i] = option.value.selector(data[i]);
|
|
1888
1499
|
}
|
|
1889
1500
|
return response;
|
|
1890
1501
|
}
|
|
1502
|
+
group(data, option) {
|
|
1503
|
+
if (Array.isArray(data) == false) {
|
|
1504
|
+
throw new Error("Can only group an array of data");
|
|
1505
|
+
}
|
|
1506
|
+
const group = {};
|
|
1507
|
+
for (let i = 0, length = data.length; i < length; i++) {
|
|
1508
|
+
const keyValue = option.value.selector(data[i]);
|
|
1509
|
+
if (!group[keyValue]) {
|
|
1510
|
+
group[keyValue] = [];
|
|
1511
|
+
}
|
|
1512
|
+
const item = {};
|
|
1513
|
+
for (let j = 0, l = option.value.fields.length; j < l; j++) {
|
|
1514
|
+
const field = option.value.fields[j];
|
|
1515
|
+
if (field.property != null) {
|
|
1516
|
+
const value = field.property.getValue(data[i]);
|
|
1517
|
+
if (value != null) {
|
|
1518
|
+
// Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value
|
|
1519
|
+
const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;
|
|
1520
|
+
field.property.setValue(item, resolvedValue);
|
|
1521
|
+
continue;
|
|
1522
|
+
}
|
|
1523
|
+
// The property exists, lets set it to the value (null/undefined)
|
|
1524
|
+
if (Object.hasOwn(data[i], field.destinationName)) {
|
|
1525
|
+
field.property.setValue(item, value);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
group[keyValue].push(item);
|
|
1530
|
+
}
|
|
1531
|
+
return group;
|
|
1532
|
+
}
|
|
1891
1533
|
count(data, _) {
|
|
1892
1534
|
if (Array.isArray(data)) {
|
|
1893
1535
|
return data.length;
|
|
@@ -2048,6 +1690,30 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
|
|
|
2048
1690
|
sort(data, _) {
|
|
2049
1691
|
return data;
|
|
2050
1692
|
}
|
|
1693
|
+
group(data, option) {
|
|
1694
|
+
if (Array.isArray(data) == false) {
|
|
1695
|
+
throw new Error("Can only group an array of data");
|
|
1696
|
+
}
|
|
1697
|
+
const group = {};
|
|
1698
|
+
for (let i = 0, length = data.length; i < length; i++) {
|
|
1699
|
+
const keyValue = option.value.selector(data[i]);
|
|
1700
|
+
if (!group[keyValue]) {
|
|
1701
|
+
group[keyValue] = [];
|
|
1702
|
+
}
|
|
1703
|
+
const item = {};
|
|
1704
|
+
for (let j = 0, l = option.value.fields.length; j < l; j++) {
|
|
1705
|
+
const field = option.value.fields[j];
|
|
1706
|
+
if (field.property != null) {
|
|
1707
|
+
const value = field.property.getValue(data[i]);
|
|
1708
|
+
if (value != null) {
|
|
1709
|
+
field.property.setValue(item, field.property.deserialize(value));
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
group[keyValue].push(item);
|
|
1714
|
+
}
|
|
1715
|
+
return group;
|
|
1716
|
+
}
|
|
2051
1717
|
map(data, option) {
|
|
2052
1718
|
if (Array.isArray(data) == false) {
|
|
2053
1719
|
throw new Error("Can only map an array of data");
|
|
@@ -2075,6 +1741,91 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
|
|
|
2075
1741
|
}
|
|
2076
1742
|
|
|
2077
1743
|
|
|
1744
|
+
}),
|
|
1745
|
+
"./src/plugins/translators/TranslatedArrayValue.ts":
|
|
1746
|
+
/*!*********************************************************!*\
|
|
1747
|
+
!*** ./src/plugins/translators/TranslatedArrayValue.ts ***!
|
|
1748
|
+
\*********************************************************/
|
|
1749
|
+
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1750
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1751
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1752
|
+
TranslatedArrayValue: () => (TranslatedArrayValue)
|
|
1753
|
+
});
|
|
1754
|
+
class TranslatedArrayValue {
|
|
1755
|
+
value;
|
|
1756
|
+
constructor(value) {
|
|
1757
|
+
this.value = value;
|
|
1758
|
+
}
|
|
1759
|
+
forEach(callback) {
|
|
1760
|
+
const data = this.value;
|
|
1761
|
+
for (let i = 0, length = data.length; i < length; i++) {
|
|
1762
|
+
const result = callback(data[i]);
|
|
1763
|
+
if (result) {
|
|
1764
|
+
// reassign if the callback returns a result
|
|
1765
|
+
data[i] = result;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
}),
|
|
1773
|
+
"./src/plugins/translators/TranslatedGroupValue.ts":
|
|
1774
|
+
/*!*********************************************************!*\
|
|
1775
|
+
!*** ./src/plugins/translators/TranslatedGroupValue.ts ***!
|
|
1776
|
+
\*********************************************************/
|
|
1777
|
+
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1778
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1779
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1780
|
+
TranslatedGroupValue: () => (TranslatedGroupValue)
|
|
1781
|
+
});
|
|
1782
|
+
class TranslatedGroupValue {
|
|
1783
|
+
value;
|
|
1784
|
+
constructor(value) {
|
|
1785
|
+
this.value = value;
|
|
1786
|
+
}
|
|
1787
|
+
forEach(callback) {
|
|
1788
|
+
const group = this.value;
|
|
1789
|
+
const keys = Object.keys(group);
|
|
1790
|
+
for (let i = 0, length = keys.length; i < length; i++) {
|
|
1791
|
+
const key = keys[i];
|
|
1792
|
+
const data = group[key];
|
|
1793
|
+
for (let j = 0, len = data.length; j < len; j++) {
|
|
1794
|
+
const result = callback(data[j]);
|
|
1795
|
+
if (result) {
|
|
1796
|
+
// reassign if the callback returns a result
|
|
1797
|
+
data[j] = result;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
}),
|
|
1806
|
+
"./src/plugins/translators/TranslatedSingleValue.ts":
|
|
1807
|
+
/*!**********************************************************!*\
|
|
1808
|
+
!*** ./src/plugins/translators/TranslatedSingleValue.ts ***!
|
|
1809
|
+
\**********************************************************/
|
|
1810
|
+
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1811
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1812
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1813
|
+
TranslatedSingleValue: () => (TranslatedSingleValue)
|
|
1814
|
+
});
|
|
1815
|
+
class TranslatedSingleValue {
|
|
1816
|
+
value;
|
|
1817
|
+
constructor(value) {
|
|
1818
|
+
this.value = value;
|
|
1819
|
+
}
|
|
1820
|
+
forEach(callback) {
|
|
1821
|
+
const result = callback(this.value);
|
|
1822
|
+
if (result) {
|
|
1823
|
+
this.value = result;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
|
|
2078
1829
|
}),
|
|
2079
1830
|
"./src/plugins/translators/index.ts":
|
|
2080
1831
|
/*!******************************************!*\
|
|
@@ -2085,11 +1836,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2085
1836
|
__webpack_require__.d(__webpack_exports__, {
|
|
2086
1837
|
DataTranslator: () => (/* reexport safe */ _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTranslator),
|
|
2087
1838
|
JsonTranslator: () => (/* reexport safe */ _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__.JsonTranslator),
|
|
2088
|
-
SqlTranslator: () => (/* reexport safe */ _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__.SqlTranslator)
|
|
1839
|
+
SqlTranslator: () => (/* reexport safe */ _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__.SqlTranslator),
|
|
1840
|
+
TranslatedArrayValue: () => (/* reexport safe */ _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_3__.TranslatedArrayValue),
|
|
1841
|
+
TranslatedGroupValue: () => (/* reexport safe */ _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_4__.TranslatedGroupValue),
|
|
1842
|
+
TranslatedSingleValue: () => (/* reexport safe */ _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_5__.TranslatedSingleValue)
|
|
2089
1843
|
});
|
|
2090
1844
|
/* ESM import */var _DataTranslator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DataTranslator */ "./src/plugins/translators/DataTranslator.ts");
|
|
2091
1845
|
/* ESM import */var _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JsonTranslator */ "./src/plugins/translators/JsonTranslator.ts");
|
|
2092
1846
|
/* ESM import */var _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SqlTranslator */ "./src/plugins/translators/SqlTranslator.ts");
|
|
1847
|
+
/* ESM import */var _TranslatedArrayValue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TranslatedArrayValue */ "./src/plugins/translators/TranslatedArrayValue.ts");
|
|
1848
|
+
/* ESM import */var _TranslatedGroupValue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TranslatedGroupValue */ "./src/plugins/translators/TranslatedGroupValue.ts");
|
|
1849
|
+
/* ESM import */var _TranslatedSingleValue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TranslatedSingleValue */ "./src/plugins/translators/TranslatedSingleValue.ts");
|
|
1850
|
+
|
|
1851
|
+
|
|
1852
|
+
|
|
1853
|
+
|
|
2093
1854
|
|
|
2094
1855
|
|
|
2095
1856
|
|
|
@@ -2356,23 +2117,22 @@ var __webpack_exports__ = {};
|
|
|
2356
2117
|
__webpack_require__.r(__webpack_exports__);
|
|
2357
2118
|
__webpack_require__.d(__webpack_exports__, {
|
|
2358
2119
|
DataTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.DataTranslator),
|
|
2359
|
-
|
|
2360
|
-
DbPluginLoggingCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_1__.DbPluginLoggingCapability),
|
|
2361
|
-
EphemeralDataPlugin: () => (/* reexport safe */ _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_4__.EphemeralDataPlugin),
|
|
2120
|
+
EphemeralDataPlugin: () => (/* reexport safe */ _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_3__.EphemeralDataPlugin),
|
|
2362
2121
|
JsonTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.JsonTranslator),
|
|
2363
|
-
OptimisticReplicationDbPlugin: () => (/* reexport safe */
|
|
2364
|
-
Query: () => (/* reexport safe */
|
|
2365
|
-
QueryOptionsCollection: () => (/* reexport safe */
|
|
2366
|
-
QueryOrdering: () => (/* reexport safe */
|
|
2367
|
-
ReplicationDbPlugin: () => (/* reexport safe */
|
|
2368
|
-
SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator)
|
|
2122
|
+
OptimisticReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_1__.OptimisticReplicationDbPlugin),
|
|
2123
|
+
Query: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.Query),
|
|
2124
|
+
QueryOptionsCollection: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOptionsCollection),
|
|
2125
|
+
QueryOrdering: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_2__.QueryOrdering),
|
|
2126
|
+
ReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_1__.ReplicationDbPlugin),
|
|
2127
|
+
SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator),
|
|
2128
|
+
TranslatedArrayValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedArrayValue),
|
|
2129
|
+
TranslatedGroupValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedGroupValue),
|
|
2130
|
+
TranslatedSingleValue: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.TranslatedSingleValue)
|
|
2369
2131
|
});
|
|
2370
2132
|
/* ESM import */var _translators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./translators */ "./src/plugins/translators/index.ts");
|
|
2371
|
-
/* ESM import */var
|
|
2372
|
-
/* ESM import */var
|
|
2373
|
-
/* ESM import */var
|
|
2374
|
-
/* ESM import */var _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EphemeralDataPlugin */ "./src/plugins/EphemeralDataPlugin.ts");
|
|
2375
|
-
|
|
2133
|
+
/* ESM import */var _replication__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./replication */ "./src/plugins/replication/index.ts");
|
|
2134
|
+
/* ESM import */var _query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./query */ "./src/plugins/query/index.ts");
|
|
2135
|
+
/* ESM import */var _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./EphemeralDataPlugin */ "./src/plugins/EphemeralDataPlugin.ts");
|
|
2376
2136
|
|
|
2377
2137
|
|
|
2378
2138
|
|
|
@@ -2382,8 +2142,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
2382
2142
|
})();
|
|
2383
2143
|
|
|
2384
2144
|
var __webpack_exports__DataTranslator = __webpack_exports__.DataTranslator;
|
|
2385
|
-
var __webpack_exports__DbPluginCapability = __webpack_exports__.DbPluginCapability;
|
|
2386
|
-
var __webpack_exports__DbPluginLoggingCapability = __webpack_exports__.DbPluginLoggingCapability;
|
|
2387
2145
|
var __webpack_exports__EphemeralDataPlugin = __webpack_exports__.EphemeralDataPlugin;
|
|
2388
2146
|
var __webpack_exports__JsonTranslator = __webpack_exports__.JsonTranslator;
|
|
2389
2147
|
var __webpack_exports__OptimisticReplicationDbPlugin = __webpack_exports__.OptimisticReplicationDbPlugin;
|
|
@@ -2392,6 +2150,9 @@ var __webpack_exports__QueryOptionsCollection = __webpack_exports__.QueryOptions
|
|
|
2392
2150
|
var __webpack_exports__QueryOrdering = __webpack_exports__.QueryOrdering;
|
|
2393
2151
|
var __webpack_exports__ReplicationDbPlugin = __webpack_exports__.ReplicationDbPlugin;
|
|
2394
2152
|
var __webpack_exports__SqlTranslator = __webpack_exports__.SqlTranslator;
|
|
2395
|
-
|
|
2153
|
+
var __webpack_exports__TranslatedArrayValue = __webpack_exports__.TranslatedArrayValue;
|
|
2154
|
+
var __webpack_exports__TranslatedGroupValue = __webpack_exports__.TranslatedGroupValue;
|
|
2155
|
+
var __webpack_exports__TranslatedSingleValue = __webpack_exports__.TranslatedSingleValue;
|
|
2156
|
+
export { __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__OptimisticReplicationDbPlugin as OptimisticReplicationDbPlugin, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__ReplicationDbPlugin as ReplicationDbPlugin, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__TranslatedArrayValue as TranslatedArrayValue, __webpack_exports__TranslatedGroupValue as TranslatedGroupValue, __webpack_exports__TranslatedSingleValue as TranslatedSingleValue };
|
|
2396
2157
|
|
|
2397
2158
|
//# sourceMappingURL=index.js.map
|