@routier/core 0.1.0-rc.1 → 0.2.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/assertions/index.js +4 -15
- package/dist/assertions/index.js.map +1 -1
- package/dist/capabilities/index.js +99 -89
- package/dist/capabilities/index.js.map +1 -1
- package/dist/codegen/index.js +21 -36
- package/dist/codegen/index.js.map +1 -1
- package/dist/collections/index.js +49 -92
- package/dist/collections/index.js.map +1 -1
- package/dist/errors/index.js +4 -15
- package/dist/errors/index.js.map +1 -1
- package/dist/expressions/index.js +102 -86
- package/dist/expressions/index.js.map +1 -1
- package/dist/index.js +1737 -2418
- package/dist/index.js.map +1 -1
- package/dist/performance/index.js +73 -9
- package/dist/performance/index.js.map +1 -1
- package/dist/pipeline/TrampolinePipeline.d.ts +0 -8
- package/dist/pipeline/index.js +71 -174
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugins/index.js +302 -479
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +6 -5
- package/dist/plugins/replication/ReplicationDbPlugin.d.ts +5 -5
- package/dist/plugins/replication/types.d.ts +1 -0
- package/dist/plugins/types.d.ts +1 -1
- package/dist/results/index.js +11 -26
- package/dist/results/index.js.map +1 -1
- package/dist/schema/SchemaDefinition.d.ts +7 -6
- package/dist/schema/index.js +1119 -1483
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/property/types/SchemaNumber.d.ts +1 -0
- package/dist/schema/property/types/SchemaString.d.ts +1 -0
- package/dist/schema/testSchemas.test.d.ts +37 -16
- package/dist/schema/types.d.ts +5 -3
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +103 -117
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/logger.d.ts +8 -0
- package/dist/utilities/types.d.ts +17 -2
- package/package.json +3 -2
- package/readme.md +1 -1
package/dist/plugins/index.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
var __webpack_modules__ = ({
|
|
2
|
-
"./src/assertions/index.ts"
|
|
3
|
-
/*!*********************************!*\
|
|
4
|
-
!*** ./src/assertions/index.ts ***!
|
|
5
|
-
\*********************************/
|
|
6
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2
|
+
"./src/assertions/index.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
3
|
__webpack_require__.r(__webpack_exports__);
|
|
8
4
|
__webpack_require__.d(__webpack_exports__, {
|
|
9
5
|
assertDate: () => (assertDate),
|
|
@@ -12,10 +8,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
12
8
|
assertIsNotNull: () => (assertIsNotNull),
|
|
13
9
|
assertString: () => (assertString)
|
|
14
10
|
});
|
|
15
|
-
/*
|
|
11
|
+
/* import */ var _utilities__rspack_import_0 = __webpack_require__("./src/utilities/dates.ts");
|
|
16
12
|
|
|
17
13
|
function assertDate(data) {
|
|
18
|
-
if ((0,
|
|
14
|
+
if ((0,_utilities__rspack_import_0.isDate)(data) === false) {
|
|
19
15
|
throw new TypeError('Value is not a Date');
|
|
20
16
|
}
|
|
21
17
|
}
|
|
@@ -51,12 +47,8 @@ function assertInstanceOf(value, Instance) {
|
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
|
|
54
|
-
}
|
|
55
|
-
"./src/collections/Changes.ts"
|
|
56
|
-
/*!************************************!*\
|
|
57
|
-
!*** ./src/collections/Changes.ts ***!
|
|
58
|
-
\************************************/
|
|
59
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
50
|
+
},
|
|
51
|
+
"./src/collections/Changes.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
60
52
|
__webpack_require__.r(__webpack_exports__);
|
|
61
53
|
__webpack_require__.d(__webpack_exports__, {
|
|
62
54
|
BulkPersistChanges: () => (BulkPersistChanges),
|
|
@@ -64,7 +56,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
64
56
|
SchemaPersistChanges: () => (SchemaPersistChanges),
|
|
65
57
|
SchemaPersistResult: () => (SchemaPersistResult)
|
|
66
58
|
});
|
|
67
|
-
/*
|
|
59
|
+
/* import */ var _TagCollection__rspack_import_0 = __webpack_require__("./src/collections/TagCollection.ts");
|
|
68
60
|
|
|
69
61
|
class BulkPersistResult extends Map {
|
|
70
62
|
resolve(schemaId) {
|
|
@@ -177,7 +169,7 @@ class SchemaPersistChanges {
|
|
|
177
169
|
adds = [];
|
|
178
170
|
updates = [];
|
|
179
171
|
removes = [];
|
|
180
|
-
tags = new
|
|
172
|
+
tags = new _TagCollection__rspack_import_0.TagCollection();
|
|
181
173
|
get hasItems() {
|
|
182
174
|
return this.total > 0;
|
|
183
175
|
}
|
|
@@ -198,12 +190,8 @@ class SchemaPersistResult {
|
|
|
198
190
|
}
|
|
199
191
|
|
|
200
192
|
|
|
201
|
-
}
|
|
202
|
-
"./src/collections/TagCollection.ts"
|
|
203
|
-
/*!******************************************!*\
|
|
204
|
-
!*** ./src/collections/TagCollection.ts ***!
|
|
205
|
-
\******************************************/
|
|
206
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
193
|
+
},
|
|
194
|
+
"./src/collections/TagCollection.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
207
195
|
__webpack_require__.r(__webpack_exports__);
|
|
208
196
|
__webpack_require__.d(__webpack_exports__, {
|
|
209
197
|
TagCollection: () => (TagCollection)
|
|
@@ -258,12 +246,8 @@ class TagCollection {
|
|
|
258
246
|
}
|
|
259
247
|
|
|
260
248
|
|
|
261
|
-
}
|
|
262
|
-
"./src/expressions/utils.ts"
|
|
263
|
-
/*!**********************************!*\
|
|
264
|
-
!*** ./src/expressions/utils.ts ***!
|
|
265
|
-
\**********************************/
|
|
266
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
249
|
+
},
|
|
250
|
+
"./src/expressions/utils.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
267
251
|
__webpack_require__.r(__webpack_exports__);
|
|
268
252
|
__webpack_require__.d(__webpack_exports__, {
|
|
269
253
|
forEach: () => (forEach),
|
|
@@ -320,17 +304,15 @@ function forEach(expression, callback) {
|
|
|
320
304
|
}
|
|
321
305
|
|
|
322
306
|
|
|
323
|
-
}
|
|
324
|
-
"./src/performance/index.ts"
|
|
325
|
-
/*!**********************************!*\
|
|
326
|
-
!*** ./src/performance/index.ts ***!
|
|
327
|
-
\**********************************/
|
|
328
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
307
|
+
},
|
|
308
|
+
"./src/performance/index.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
329
309
|
__webpack_require__.r(__webpack_exports__);
|
|
330
310
|
__webpack_require__.d(__webpack_exports__, {
|
|
331
311
|
measure: () => (measure),
|
|
332
312
|
now: () => (now)
|
|
333
313
|
});
|
|
314
|
+
/* import */ var _utilities__rspack_import_0 = __webpack_require__("./src/utilities/logger.ts");
|
|
315
|
+
|
|
334
316
|
const measurements = {};
|
|
335
317
|
const now = () => {
|
|
336
318
|
if (typeof performance !== 'undefined' && performance.now) {
|
|
@@ -348,24 +330,21 @@ const measure = {
|
|
|
348
330
|
const start = measurements[name];
|
|
349
331
|
delete measurements[name];
|
|
350
332
|
const delta = now() - start;
|
|
351
|
-
|
|
333
|
+
_utilities__rspack_import_0.logger.log(`[ROUTIER] - Performance: ${name} took ${delta}`);
|
|
352
334
|
}
|
|
353
335
|
};
|
|
354
336
|
|
|
355
337
|
|
|
356
|
-
}
|
|
357
|
-
"./src/pipeline/TrampolinePipeline.ts"
|
|
358
|
-
/*!********************************************!*\
|
|
359
|
-
!*** ./src/pipeline/TrampolinePipeline.ts ***!
|
|
360
|
-
\********************************************/
|
|
361
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
338
|
+
},
|
|
339
|
+
"./src/pipeline/TrampolinePipeline.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
362
340
|
__webpack_require__.r(__webpack_exports__);
|
|
363
341
|
__webpack_require__.d(__webpack_exports__, {
|
|
364
|
-
AsyncPipeline: () => (AsyncPipeline),
|
|
365
342
|
TrampolinePipeline: () => (TrampolinePipeline),
|
|
366
343
|
WorkPipeline: () => (WorkPipeline)
|
|
367
344
|
});
|
|
368
|
-
/*
|
|
345
|
+
/* import */ var _utilities__rspack_import_0 = __webpack_require__("./src/utilities/logger.ts");
|
|
346
|
+
/* import */ var _results__rspack_import_1 = __webpack_require__("./src/results/Result.ts");
|
|
347
|
+
|
|
369
348
|
|
|
370
349
|
class TrampolinePipeline {
|
|
371
350
|
_list = [];
|
|
@@ -373,7 +352,7 @@ class TrampolinePipeline {
|
|
|
373
352
|
filter(initialData, done) {
|
|
374
353
|
this._hasErrored = false; // Reset error flag on new execution
|
|
375
354
|
if (this._list.length === 0) {
|
|
376
|
-
|
|
355
|
+
done(initialData);
|
|
377
356
|
return;
|
|
378
357
|
}
|
|
379
358
|
let index = 0;
|
|
@@ -384,7 +363,7 @@ class TrampolinePipeline {
|
|
|
384
363
|
const finalStepSentinel = () => {
|
|
385
364
|
// Only call done if no error has occurred
|
|
386
365
|
if (!this._hasErrored) {
|
|
387
|
-
|
|
366
|
+
done(currentData);
|
|
388
367
|
}
|
|
389
368
|
return null; // Stop the trampoline
|
|
390
369
|
};
|
|
@@ -403,7 +382,7 @@ class TrampolinePipeline {
|
|
|
403
382
|
processor(currentData, (result, error) => {
|
|
404
383
|
// --- Error Handling ---
|
|
405
384
|
if (error) {
|
|
406
|
-
|
|
385
|
+
_utilities__rspack_import_0.logger.error(`Error reported by processor at index ${idx}:`, error);
|
|
407
386
|
this._hasErrored = true; // Set flag
|
|
408
387
|
// Throw the error to be caught by outer try...catch blocks
|
|
409
388
|
throw error;
|
|
@@ -426,7 +405,7 @@ class TrampolinePipeline {
|
|
|
426
405
|
}
|
|
427
406
|
catch (error) {
|
|
428
407
|
if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
|
|
429
|
-
|
|
408
|
+
_utilities__rspack_import_0.logger.error(`Error thrown by processor at index ${idx} or its callback:`, error);
|
|
430
409
|
this._hasErrored = true;
|
|
431
410
|
}
|
|
432
411
|
// Rethrow to be caught by the trampoline's catch block
|
|
@@ -449,7 +428,7 @@ class TrampolinePipeline {
|
|
|
449
428
|
}
|
|
450
429
|
isRunning = true;
|
|
451
430
|
let currentStep = step;
|
|
452
|
-
while (
|
|
431
|
+
while (currentStep !== null) {
|
|
453
432
|
try {
|
|
454
433
|
// Stop immediately if an error was flagged elsewhere
|
|
455
434
|
if (this._hasErrored) {
|
|
@@ -461,7 +440,7 @@ class TrampolinePipeline {
|
|
|
461
440
|
catch (trampolineError) {
|
|
462
441
|
// Catch errors propagated from step execution (processor or callback errors)
|
|
463
442
|
if (!this._hasErrored) { // Avoid double logging
|
|
464
|
-
|
|
443
|
+
_utilities__rspack_import_0.logger.error("Error during trampoline step execution:", trampolineError);
|
|
465
444
|
this._hasErrored = true;
|
|
466
445
|
}
|
|
467
446
|
currentStep = null; // Stop the loop
|
|
@@ -490,135 +469,11 @@ class TrampolinePipeline {
|
|
|
490
469
|
pipeEach(items, fn, map) {
|
|
491
470
|
for (let i = 0, length = items.length; i < length; i++) {
|
|
492
471
|
this.pipe((previous, done) => {
|
|
493
|
-
fn(map(previous,
|
|
472
|
+
fn(map(previous, _results__rspack_import_1.Result.success(items[i])), done);
|
|
494
473
|
});
|
|
495
474
|
}
|
|
496
475
|
}
|
|
497
476
|
}
|
|
498
|
-
class AsyncPipeline {
|
|
499
|
-
_list = [];
|
|
500
|
-
_hasErrored = false; // Flag to prevent calling done on error
|
|
501
|
-
filter(done) {
|
|
502
|
-
this._hasErrored = false; // Reset error flag on new execution
|
|
503
|
-
let currentData = [];
|
|
504
|
-
if (this._list.length === 0) {
|
|
505
|
-
queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
let index = 0;
|
|
509
|
-
let isRunning = false; // Guard against overlapping trampoline calls
|
|
510
|
-
try {
|
|
511
|
-
// --- Revised Completion Logic --- (Moved up for clarity)
|
|
512
|
-
const finalStepSentinel = () => {
|
|
513
|
-
// Only call done if no error has occurred
|
|
514
|
-
if (!this._hasErrored) {
|
|
515
|
-
queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success(currentData)));
|
|
516
|
-
}
|
|
517
|
-
return null; // Stop the trampoline
|
|
518
|
-
};
|
|
519
|
-
const createStepRevised = (idx) => {
|
|
520
|
-
return () => {
|
|
521
|
-
if (this._hasErrored)
|
|
522
|
-
return null; // Stop if an error occurred elsewhere
|
|
523
|
-
if (idx >= this._list.length) {
|
|
524
|
-
return finalStepSentinel(); // Execute the dedicated final step
|
|
525
|
-
}
|
|
526
|
-
const [payload, processor] = this._list[idx];
|
|
527
|
-
// Initialize syncCallbackResult to null to satisfy StepResult type
|
|
528
|
-
let syncCallbackResult = null;
|
|
529
|
-
let calledSync = false;
|
|
530
|
-
try {
|
|
531
|
-
processor(payload, (result) => {
|
|
532
|
-
// --- Error Handling ---
|
|
533
|
-
if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
|
|
534
|
-
console.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
|
|
535
|
-
this._hasErrored = true; // Set flag
|
|
536
|
-
// Throw the error to be caught by outer try...catch blocks
|
|
537
|
-
throw result.error;
|
|
538
|
-
}
|
|
539
|
-
// --- /Error Handling ---
|
|
540
|
-
// If no error, proceed as before
|
|
541
|
-
currentData.push(result.data);
|
|
542
|
-
index = idx + 1; // Update index for the next step
|
|
543
|
-
const nextStep = createStepRevised(index); // Use updated index
|
|
544
|
-
if (isRunning) {
|
|
545
|
-
// Callback was synchronous
|
|
546
|
-
syncCallbackResult = nextStep; // Store next step function
|
|
547
|
-
calledSync = true;
|
|
548
|
-
}
|
|
549
|
-
else {
|
|
550
|
-
// Callback was asynchronous, restart trampoline
|
|
551
|
-
trampoline(nextStep);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
catch (error) {
|
|
556
|
-
if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
|
|
557
|
-
console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
|
|
558
|
-
this._hasErrored = true;
|
|
559
|
-
}
|
|
560
|
-
// Rethrow to be caught by the trampoline's catch block
|
|
561
|
-
throw error;
|
|
562
|
-
}
|
|
563
|
-
if (calledSync) {
|
|
564
|
-
// Return the next step function for the sync loop
|
|
565
|
-
return syncCallbackResult;
|
|
566
|
-
}
|
|
567
|
-
else {
|
|
568
|
-
// Pause trampoline for async, loop will stop as step returns null
|
|
569
|
-
return null;
|
|
570
|
-
}
|
|
571
|
-
};
|
|
572
|
-
};
|
|
573
|
-
// The trampoline loop
|
|
574
|
-
const trampoline = (step) => {
|
|
575
|
-
if (isRunning) {
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
isRunning = true;
|
|
579
|
-
let currentStep = step;
|
|
580
|
-
while (typeof currentStep === 'function') {
|
|
581
|
-
try {
|
|
582
|
-
// Stop immediately if an error was flagged elsewhere
|
|
583
|
-
if (this._hasErrored) {
|
|
584
|
-
currentStep = null;
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
currentStep = currentStep(); // Execute step, get next step or null
|
|
588
|
-
}
|
|
589
|
-
catch (trampolineError) {
|
|
590
|
-
// Catch errors propagated from step execution (processor or callback errors)
|
|
591
|
-
if (!this._hasErrored) { // Avoid double logging
|
|
592
|
-
console.error("Error during trampoline step execution:", trampolineError);
|
|
593
|
-
this._hasErrored = true;
|
|
594
|
-
}
|
|
595
|
-
currentStep = null; // Stop the loop
|
|
596
|
-
// We don't call `done` here because an error occurred.
|
|
597
|
-
// The application should handle the uncaught exception if desired.
|
|
598
|
-
break; // Explicitly break loop on error
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
// Loop ends when currentStep is null or loop is broken by error
|
|
602
|
-
isRunning = false;
|
|
603
|
-
// Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.
|
|
604
|
-
};
|
|
605
|
-
// --- Start the process ---
|
|
606
|
-
index = 0; // Reset index
|
|
607
|
-
trampoline(createStepRevised(0)); // Start with the revised step creator
|
|
608
|
-
}
|
|
609
|
-
catch (error) {
|
|
610
|
-
done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
pipe(data, processor) {
|
|
614
|
-
this._list.push([data, processor]);
|
|
615
|
-
}
|
|
616
|
-
pipeEach(items, processor) {
|
|
617
|
-
for (let i = 0, length = items.length; i < length; i++) {
|
|
618
|
-
this.pipe(items[i], processor);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
477
|
/**
|
|
623
478
|
* Processes functions with callbacks asynchronously.
|
|
624
479
|
*
|
|
@@ -632,7 +487,7 @@ class WorkPipeline {
|
|
|
632
487
|
filter(done) {
|
|
633
488
|
this._hasErrored = false; // Reset error flag on new execution
|
|
634
489
|
if (this.unitsOfWork.length === 0) {
|
|
635
|
-
|
|
490
|
+
done(_results__rspack_import_1.Result.success());
|
|
636
491
|
return;
|
|
637
492
|
}
|
|
638
493
|
let index = 0;
|
|
@@ -642,7 +497,7 @@ class WorkPipeline {
|
|
|
642
497
|
const finalStepSentinel = () => {
|
|
643
498
|
// Only call done if no error has occurred
|
|
644
499
|
if (!this._hasErrored) {
|
|
645
|
-
|
|
500
|
+
done(_results__rspack_import_1.Result.success());
|
|
646
501
|
}
|
|
647
502
|
return null; // Stop the trampoline
|
|
648
503
|
};
|
|
@@ -660,8 +515,8 @@ class WorkPipeline {
|
|
|
660
515
|
try {
|
|
661
516
|
processor((result) => {
|
|
662
517
|
// --- Error Handling ---
|
|
663
|
-
if (result.ok ===
|
|
664
|
-
|
|
518
|
+
if (result.ok === _results__rspack_import_1.Result.ERROR) {
|
|
519
|
+
_utilities__rspack_import_0.logger.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
|
|
665
520
|
this._hasErrored = true; // Set flag
|
|
666
521
|
// Throw the error to be caught by outer try...catch blocks
|
|
667
522
|
throw result.error;
|
|
@@ -683,7 +538,7 @@ class WorkPipeline {
|
|
|
683
538
|
}
|
|
684
539
|
catch (error) {
|
|
685
540
|
if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
|
|
686
|
-
|
|
541
|
+
_utilities__rspack_import_0.logger.error(`Error thrown by processor at index ${idx} or its callback:`, error);
|
|
687
542
|
this._hasErrored = true;
|
|
688
543
|
}
|
|
689
544
|
// Rethrow to be caught by the trampoline's catch block
|
|
@@ -706,7 +561,7 @@ class WorkPipeline {
|
|
|
706
561
|
}
|
|
707
562
|
isRunning = true;
|
|
708
563
|
let currentStep = step;
|
|
709
|
-
while (
|
|
564
|
+
while (currentStep !== null) {
|
|
710
565
|
try {
|
|
711
566
|
// Stop immediately if an error was flagged elsewhere
|
|
712
567
|
if (this._hasErrored) {
|
|
@@ -718,7 +573,7 @@ class WorkPipeline {
|
|
|
718
573
|
catch (trampolineError) {
|
|
719
574
|
// Catch errors propagated from step execution (processor or callback errors)
|
|
720
575
|
if (!this._hasErrored) { // Avoid double logging
|
|
721
|
-
|
|
576
|
+
_utilities__rspack_import_0.logger.error("Error during trampoline step execution:", trampolineError);
|
|
722
577
|
this._hasErrored = true;
|
|
723
578
|
}
|
|
724
579
|
currentStep = null; // Stop the loop
|
|
@@ -736,7 +591,7 @@ class WorkPipeline {
|
|
|
736
591
|
trampoline(createStepRevised(0)); // Start with the revised step creator
|
|
737
592
|
}
|
|
738
593
|
catch (error) {
|
|
739
|
-
done(
|
|
594
|
+
done(_results__rspack_import_1.Result.error(error));
|
|
740
595
|
}
|
|
741
596
|
}
|
|
742
597
|
pipe(work) {
|
|
@@ -745,20 +600,16 @@ class WorkPipeline {
|
|
|
745
600
|
}
|
|
746
601
|
|
|
747
602
|
|
|
748
|
-
}
|
|
749
|
-
"./src/plugins/EphemeralDataPlugin.ts"
|
|
750
|
-
/*!********************************************!*\
|
|
751
|
-
!*** ./src/plugins/EphemeralDataPlugin.ts ***!
|
|
752
|
-
\********************************************/
|
|
753
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
603
|
+
},
|
|
604
|
+
"./src/plugins/EphemeralDataPlugin.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
754
605
|
__webpack_require__.r(__webpack_exports__);
|
|
755
606
|
__webpack_require__.d(__webpack_exports__, {
|
|
756
607
|
EphemeralDataPlugin: () => (EphemeralDataPlugin)
|
|
757
608
|
});
|
|
758
|
-
/*
|
|
759
|
-
/*
|
|
760
|
-
/*
|
|
761
|
-
/*
|
|
609
|
+
/* import */ var _assertions__rspack_import_1 = __webpack_require__("./src/assertions/index.ts");
|
|
610
|
+
/* import */ var _pipeline__rspack_import_0 = __webpack_require__("./src/pipeline/TrampolinePipeline.ts");
|
|
611
|
+
/* import */ var ___rspack_import_3 = __webpack_require__("./src/plugins/translators/JsonTranslator.ts");
|
|
612
|
+
/* import */ var _results__rspack_import_2 = __webpack_require__("./src/results/Result.ts");
|
|
762
613
|
|
|
763
614
|
|
|
764
615
|
|
|
@@ -772,7 +623,7 @@ class EphemeralDataPlugin {
|
|
|
772
623
|
try {
|
|
773
624
|
const bulkPersistResult = event.operation.toResult();
|
|
774
625
|
const schemas = event.schemas;
|
|
775
|
-
const pipeline = new
|
|
626
|
+
const pipeline = new _pipeline__rspack_import_0.WorkPipeline();
|
|
776
627
|
let hasWork = false;
|
|
777
628
|
for (const [schemaId, changes] of event.operation) {
|
|
778
629
|
const { adds, hasItems, removes, updates } = changes;
|
|
@@ -782,18 +633,17 @@ class EphemeralDataPlugin {
|
|
|
782
633
|
hasWork = true;
|
|
783
634
|
const result = bulkPersistResult.get(schemaId);
|
|
784
635
|
const schema = schemas.get(schemaId);
|
|
785
|
-
(0,
|
|
636
|
+
(0,_assertions__rspack_import_1.assertIsNotNull)(schema);
|
|
786
637
|
pipeline.pipe((d) => {
|
|
787
638
|
try {
|
|
788
639
|
const collection = this.resolveCollection(schema);
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
const removesLength = removes.length;
|
|
640
|
+
const addsLength = adds.length;
|
|
641
|
+
const updatesLength = updates.length;
|
|
642
|
+
const removesLength = removes.length;
|
|
643
|
+
// Only need to load if we have updates or removes (need existing data)
|
|
644
|
+
// For adds-only operations, we can skip load for better performance
|
|
645
|
+
const needsLoad = updatesLength > 0 || removesLength > 0;
|
|
646
|
+
const processChanges = () => {
|
|
797
647
|
result.adds = new Array(addsLength);
|
|
798
648
|
result.updates = new Array(updatesLength);
|
|
799
649
|
result.removes = new Array(removesLength);
|
|
@@ -812,45 +662,58 @@ class EphemeralDataPlugin {
|
|
|
812
662
|
result.removes[j] = removes[j];
|
|
813
663
|
}
|
|
814
664
|
collection.save(saveResult => {
|
|
815
|
-
if (saveResult.ok ===
|
|
665
|
+
if (saveResult.ok === _results__rspack_import_2.Result.ERROR) {
|
|
816
666
|
d(saveResult);
|
|
817
667
|
return;
|
|
818
668
|
}
|
|
819
|
-
d(
|
|
669
|
+
d(_results__rspack_import_2.Result.success());
|
|
820
670
|
});
|
|
821
|
-
}
|
|
671
|
+
};
|
|
672
|
+
if (needsLoad) {
|
|
673
|
+
collection.load(readResult => {
|
|
674
|
+
if (readResult.ok === _results__rspack_import_2.Result.ERROR) {
|
|
675
|
+
d(readResult);
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
processChanges();
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
else {
|
|
682
|
+
// Skip load for adds-only operations
|
|
683
|
+
processChanges();
|
|
684
|
+
}
|
|
822
685
|
}
|
|
823
686
|
catch (e) {
|
|
824
|
-
d(
|
|
687
|
+
d(_results__rspack_import_2.Result.error(e));
|
|
825
688
|
}
|
|
826
689
|
});
|
|
827
690
|
}
|
|
828
691
|
// If there is no work, just return the result
|
|
829
692
|
if (!hasWork) {
|
|
830
|
-
done(
|
|
693
|
+
done(_results__rspack_import_2.PluginEventResult.success(event.id, bulkPersistResult));
|
|
831
694
|
return;
|
|
832
695
|
}
|
|
833
696
|
pipeline.filter((result) => {
|
|
834
|
-
if (result.ok ===
|
|
835
|
-
done(
|
|
697
|
+
if (result.ok === _results__rspack_import_2.Result.ERROR) {
|
|
698
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, result.error));
|
|
836
699
|
return;
|
|
837
700
|
}
|
|
838
|
-
done(
|
|
701
|
+
done(_results__rspack_import_2.PluginEventResult.success(event.id, bulkPersistResult));
|
|
839
702
|
});
|
|
840
703
|
}
|
|
841
704
|
catch (e) {
|
|
842
|
-
done(
|
|
705
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, e));
|
|
843
706
|
}
|
|
844
707
|
}
|
|
845
708
|
query(event, done) {
|
|
846
709
|
try {
|
|
847
710
|
const operation = event.operation;
|
|
848
711
|
const schema = operation.schema;
|
|
849
|
-
const translator = new
|
|
712
|
+
const translator = new ___rspack_import_3.JsonTranslator(operation);
|
|
850
713
|
const collection = this.resolveCollection(schema);
|
|
851
714
|
collection.load(r => {
|
|
852
|
-
if (r.ok ===
|
|
853
|
-
done(
|
|
715
|
+
if (r.ok === _results__rspack_import_2.Result.ERROR) {
|
|
716
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, r.error));
|
|
854
717
|
return;
|
|
855
718
|
}
|
|
856
719
|
const records = collection.records;
|
|
@@ -859,27 +722,23 @@ class EphemeralDataPlugin {
|
|
|
859
722
|
for (let i = 0; i < length; i++) {
|
|
860
723
|
cloned[i] = schema.clone(records[i]);
|
|
861
724
|
}
|
|
862
|
-
done(
|
|
725
|
+
done(_results__rspack_import_2.PluginEventResult.success(event.id, translator.translate(cloned)));
|
|
863
726
|
});
|
|
864
727
|
}
|
|
865
728
|
catch (e) {
|
|
866
|
-
done(
|
|
729
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, e));
|
|
867
730
|
}
|
|
868
731
|
}
|
|
869
732
|
}
|
|
870
733
|
|
|
871
734
|
|
|
872
|
-
}
|
|
873
|
-
"./src/plugins/query/Query.ts"
|
|
874
|
-
/*!************************************!*\
|
|
875
|
-
!*** ./src/plugins/query/Query.ts ***!
|
|
876
|
-
\************************************/
|
|
877
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
735
|
+
},
|
|
736
|
+
"./src/plugins/query/Query.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
878
737
|
__webpack_require__.r(__webpack_exports__);
|
|
879
738
|
__webpack_require__.d(__webpack_exports__, {
|
|
880
739
|
Query: () => (Query)
|
|
881
740
|
});
|
|
882
|
-
/*
|
|
741
|
+
/* import */ var _QueryOptionsCollection__rspack_import_0 = __webpack_require__("./src/plugins/query/QueryOptionsCollection.ts");
|
|
883
742
|
|
|
884
743
|
class Query {
|
|
885
744
|
options;
|
|
@@ -912,10 +771,10 @@ class Query {
|
|
|
912
771
|
return true;
|
|
913
772
|
}
|
|
914
773
|
static EMPTY(schema) {
|
|
915
|
-
return new Query(
|
|
774
|
+
return new Query(_QueryOptionsCollection__rspack_import_0.QueryOptionsCollection.EMPTY(), schema);
|
|
916
775
|
}
|
|
917
776
|
static isEmpty(query) {
|
|
918
|
-
return
|
|
777
|
+
return _QueryOptionsCollection__rspack_import_0.QueryOptionsCollection.isEmpty(query.options);
|
|
919
778
|
}
|
|
920
779
|
static toString(query) {
|
|
921
780
|
return JSON.stringify({
|
|
@@ -930,17 +789,13 @@ class Query {
|
|
|
930
789
|
}
|
|
931
790
|
|
|
932
791
|
|
|
933
|
-
}
|
|
934
|
-
"./src/plugins/query/QueryOptionsCollection.ts"
|
|
935
|
-
/*!*****************************************************!*\
|
|
936
|
-
!*** ./src/plugins/query/QueryOptionsCollection.ts ***!
|
|
937
|
-
\*****************************************************/
|
|
938
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
792
|
+
},
|
|
793
|
+
"./src/plugins/query/QueryOptionsCollection.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
939
794
|
__webpack_require__.r(__webpack_exports__);
|
|
940
795
|
__webpack_require__.d(__webpack_exports__, {
|
|
941
796
|
QueryOptionsCollection: () => (QueryOptionsCollection)
|
|
942
797
|
});
|
|
943
|
-
/*
|
|
798
|
+
/* import */ var _expressions_utils__rspack_import_0 = __webpack_require__("./src/expressions/utils.ts");
|
|
944
799
|
|
|
945
800
|
class QueryOptionsCollection {
|
|
946
801
|
options = new Map();
|
|
@@ -977,8 +832,8 @@ class QueryOptionsCollection {
|
|
|
977
832
|
this.nextExecutionTarget = "memory";
|
|
978
833
|
}
|
|
979
834
|
else {
|
|
980
|
-
(0,
|
|
981
|
-
if ((0,
|
|
835
|
+
(0,_expressions_utils__rspack_import_0.forEach)(filterValue.expression, (expression) => {
|
|
836
|
+
if ((0,_expressions_utils__rspack_import_0.isPropertyExpression)(expression) && expression.property.isUnmapped) {
|
|
982
837
|
// Cut over to memory execution, unmapped properties are not in the database and
|
|
983
838
|
// cannot be queried
|
|
984
839
|
this.nextExecutionTarget = "memory";
|
|
@@ -1058,32 +913,24 @@ class QueryOptionsCollection {
|
|
|
1058
913
|
}
|
|
1059
914
|
|
|
1060
915
|
|
|
1061
|
-
}
|
|
1062
|
-
"./src/plugins/query/index.ts"
|
|
1063
|
-
/*!************************************!*\
|
|
1064
|
-
!*** ./src/plugins/query/index.ts ***!
|
|
1065
|
-
\************************************/
|
|
1066
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
916
|
+
},
|
|
917
|
+
"./src/plugins/query/index.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1067
918
|
__webpack_require__.r(__webpack_exports__);
|
|
1068
919
|
__webpack_require__.d(__webpack_exports__, {
|
|
1069
|
-
Query: () => (/* reexport safe */
|
|
1070
|
-
QueryOptionsCollection: () => (/* reexport safe */
|
|
1071
|
-
QueryOrdering: () => (/* reexport safe */
|
|
920
|
+
Query: () => (/* reexport safe */ _Query__rspack_import_0.Query),
|
|
921
|
+
QueryOptionsCollection: () => (/* reexport safe */ _QueryOptionsCollection__rspack_import_1.QueryOptionsCollection),
|
|
922
|
+
QueryOrdering: () => (/* reexport safe */ _types__rspack_import_2.QueryOrdering)
|
|
1072
923
|
});
|
|
1073
|
-
/*
|
|
1074
|
-
/*
|
|
1075
|
-
/*
|
|
924
|
+
/* import */ var _Query__rspack_import_0 = __webpack_require__("./src/plugins/query/Query.ts");
|
|
925
|
+
/* import */ var _QueryOptionsCollection__rspack_import_1 = __webpack_require__("./src/plugins/query/QueryOptionsCollection.ts");
|
|
926
|
+
/* import */ var _types__rspack_import_2 = __webpack_require__("./src/plugins/query/types.ts");
|
|
1076
927
|
|
|
1077
928
|
|
|
1078
929
|
|
|
1079
930
|
|
|
1080
931
|
|
|
1081
|
-
}
|
|
1082
|
-
"./src/plugins/query/types.ts"
|
|
1083
|
-
/*!************************************!*\
|
|
1084
|
-
!*** ./src/plugins/query/types.ts ***!
|
|
1085
|
-
\************************************/
|
|
1086
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
932
|
+
},
|
|
933
|
+
"./src/plugins/query/types.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1087
934
|
__webpack_require__.r(__webpack_exports__);
|
|
1088
935
|
__webpack_require__.d(__webpack_exports__, {
|
|
1089
936
|
QueryOrdering: () => (QueryOrdering)
|
|
@@ -1095,23 +942,19 @@ var QueryOrdering;
|
|
|
1095
942
|
})(QueryOrdering || (QueryOrdering = {}));
|
|
1096
943
|
|
|
1097
944
|
|
|
1098
|
-
}
|
|
1099
|
-
"./src/plugins/replication/OptimisticReplicationDbPlugin.ts"
|
|
1100
|
-
/*!******************************************************************!*\
|
|
1101
|
-
!*** ./src/plugins/replication/OptimisticReplicationDbPlugin.ts ***!
|
|
1102
|
-
\******************************************************************/
|
|
1103
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
945
|
+
},
|
|
946
|
+
"./src/plugins/replication/OptimisticReplicationDbPlugin.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1104
947
|
__webpack_require__.r(__webpack_exports__);
|
|
1105
948
|
__webpack_require__.d(__webpack_exports__, {
|
|
1106
949
|
OptimisticReplicationDbPlugin: () => (OptimisticReplicationDbPlugin)
|
|
1107
950
|
});
|
|
1108
|
-
/*
|
|
1109
|
-
/*
|
|
1110
|
-
/*
|
|
1111
|
-
/*
|
|
1112
|
-
/*
|
|
1113
|
-
/*
|
|
1114
|
-
/*
|
|
951
|
+
/* import */ var _results__rspack_import_2 = __webpack_require__("./src/results/Result.ts");
|
|
952
|
+
/* import */ var _pipeline__rspack_import_5 = __webpack_require__("./src/pipeline/TrampolinePipeline.ts");
|
|
953
|
+
/* import */ var _query__rspack_import_1 = __webpack_require__("./src/plugins/query/Query.ts");
|
|
954
|
+
/* import */ var _utilities__rspack_import_0 = __webpack_require__("./src/utilities/uuid.ts");
|
|
955
|
+
/* import */ var _utilities__rspack_import_6 = __webpack_require__("./src/utilities/replication.ts");
|
|
956
|
+
/* import */ var _collections__rspack_import_3 = __webpack_require__("./src/collections/Changes.ts");
|
|
957
|
+
/* import */ var _performance__rspack_import_4 = __webpack_require__("./src/performance/index.ts");
|
|
1115
958
|
|
|
1116
959
|
|
|
1117
960
|
7;
|
|
@@ -1127,21 +970,21 @@ const getMemoryPluginCollectionSize = (plugin, schema) => {
|
|
|
1127
970
|
};
|
|
1128
971
|
const MAX_HYDRATION_WAIT_MS = 60_000; // 60 seconds max wait
|
|
1129
972
|
const HYDRATION_POLL_INTERVAL_MS = 10; // Check ever 10 ms
|
|
1130
|
-
let hydrationStatus = "hydration-not-started";
|
|
1131
973
|
class OptimisticReplicationDbPlugin {
|
|
1132
974
|
plugins;
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
975
|
+
// Give more control over hydration, if the plugin is destroyed, so is the in memory data.
|
|
976
|
+
// It is up to the dev to control the lifecycle
|
|
977
|
+
collectionHydrationStatuses = new Map();
|
|
1136
978
|
/**
|
|
1137
979
|
* Creates a new OptimisticDbPluginReplicator that coordinates operations between a source database and its replicas.
|
|
1138
980
|
*
|
|
1139
|
-
* @param
|
|
1140
|
-
* @param
|
|
1141
|
-
* @
|
|
981
|
+
* @param plugins Configuration object containing the source, read, and replica database plugins
|
|
982
|
+
* @param plugins.source The primary database plugin that will receive all operations first
|
|
983
|
+
* @param plugins.read The read-optimized plugin (typically a memory plugin) used for fast queries
|
|
984
|
+
* @param plugins.replicas Additional database plugins that will replicate operations from the source
|
|
1142
985
|
*/
|
|
1143
|
-
|
|
1144
|
-
|
|
986
|
+
constructor(plugins) {
|
|
987
|
+
this.plugins = plugins;
|
|
1145
988
|
}
|
|
1146
989
|
/**
|
|
1147
990
|
* Will query the read plugin if there is one, otherwise the source plugin will be queried
|
|
@@ -1151,78 +994,78 @@ class OptimisticReplicationDbPlugin {
|
|
|
1151
994
|
const readPlugin = this.plugins.read;
|
|
1152
995
|
const sourcePlugin = this.plugins.source;
|
|
1153
996
|
const collectionSize = getMemoryPluginCollectionSize(this.plugins.read, event.operation.schema);
|
|
1154
|
-
if (collectionSize === 0 &&
|
|
997
|
+
if (collectionSize === 0 && this.collectionHydrationStatuses.get(event.operation.schema.collectionName) == null) {
|
|
1155
998
|
// Notify the cache that the db was hydrated right away
|
|
1156
|
-
|
|
999
|
+
this.collectionHydrationStatuses.set(event.operation.schema.collectionName, "pending");
|
|
1157
1000
|
// nothing is hydrated, let's try and hydrate before querying
|
|
1158
1001
|
// Memory plugin might not be hydrated, lets hydrate it for the targeted schema only,
|
|
1159
1002
|
// Other queries will do the same and hydrate if needed
|
|
1160
1003
|
// We want to select all data here
|
|
1161
1004
|
sourcePlugin.query({
|
|
1162
|
-
id: (0,
|
|
1005
|
+
id: (0,_utilities__rspack_import_0.uuid)(8),
|
|
1163
1006
|
schemas: event.schemas,
|
|
1164
1007
|
source: "collection",
|
|
1165
1008
|
// Select All Data
|
|
1166
|
-
operation:
|
|
1009
|
+
operation: _query__rspack_import_1.Query.EMPTY(event.operation.schema)
|
|
1167
1010
|
}, (sourceResult) => {
|
|
1168
|
-
if (sourceResult.ok ===
|
|
1011
|
+
if (sourceResult.ok === _results__rspack_import_2.Result.ERROR) {
|
|
1169
1012
|
// Notify that hydration failed
|
|
1170
|
-
|
|
1013
|
+
this.collectionHydrationStatuses.set(event.operation.schema.collectionName, "rejected");
|
|
1171
1014
|
done(sourceResult);
|
|
1172
1015
|
return;
|
|
1173
1016
|
}
|
|
1174
1017
|
// Source plugin can have no data, still should succeed
|
|
1175
1018
|
if (Array.isArray(sourceResult.data.value) === false) {
|
|
1176
1019
|
// Notify that hydration failed
|
|
1177
|
-
|
|
1178
|
-
done(
|
|
1020
|
+
this.collectionHydrationStatuses.set(event.operation.schema.collectionName, "rejected");
|
|
1021
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, "Query result is not an array"));
|
|
1179
1022
|
return;
|
|
1180
1023
|
}
|
|
1181
|
-
const changesCollection = new
|
|
1024
|
+
const changesCollection = new _collections__rspack_import_3.BulkPersistChanges();
|
|
1182
1025
|
const schemaChanges = changesCollection.resolve(event.operation.schema.id);
|
|
1183
1026
|
// Add the existing items into the persist payload as adds
|
|
1184
1027
|
schemaChanges.adds = sourceResult.data.value;
|
|
1185
1028
|
readPlugin.bulkPersist({
|
|
1186
|
-
id: (0,
|
|
1029
|
+
id: (0,_utilities__rspack_import_0.uuid)(8),
|
|
1187
1030
|
schemas: event.schemas,
|
|
1188
1031
|
operation: changesCollection,
|
|
1189
1032
|
source: "collection",
|
|
1190
1033
|
}, (readPersistResult) => {
|
|
1191
|
-
if (readPersistResult.ok ===
|
|
1034
|
+
if (readPersistResult.ok === _results__rspack_import_2.Result.ERROR) {
|
|
1192
1035
|
// Notify that hydration failed
|
|
1193
|
-
|
|
1036
|
+
this.collectionHydrationStatuses.set(event.operation.schema.collectionName, "rejected");
|
|
1194
1037
|
done(readPersistResult);
|
|
1195
1038
|
return;
|
|
1196
1039
|
}
|
|
1197
|
-
|
|
1040
|
+
this.collectionHydrationStatuses.set(event.operation.schema.collectionName, "fulfilled");
|
|
1198
1041
|
// requery the read plugin
|
|
1199
1042
|
readPlugin.query(event, done);
|
|
1200
1043
|
});
|
|
1201
1044
|
});
|
|
1202
1045
|
return;
|
|
1203
1046
|
}
|
|
1204
|
-
if (
|
|
1205
|
-
done(
|
|
1047
|
+
if (this.collectionHydrationStatuses.get(event.operation.schema.collectionName) === "rejected") {
|
|
1048
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, "Hydration failed, unable to query read plugin"));
|
|
1206
1049
|
return;
|
|
1207
1050
|
}
|
|
1208
1051
|
// If hydration is pending, do not query empty collection, wait for hydration
|
|
1209
|
-
if (
|
|
1210
|
-
const start = (0,
|
|
1052
|
+
if (this.collectionHydrationStatuses.get(event.operation.schema.collectionName) === "pending") {
|
|
1053
|
+
const start = (0,_performance__rspack_import_4.now)();
|
|
1211
1054
|
const pollHydrationStatus = () => {
|
|
1212
|
-
const delta = (0,
|
|
1055
|
+
const delta = (0,_performance__rspack_import_4.now)() - start;
|
|
1213
1056
|
if (delta > MAX_HYDRATION_WAIT_MS) {
|
|
1214
|
-
|
|
1215
|
-
done(
|
|
1057
|
+
this.collectionHydrationStatuses.set(event.operation.schema.collectionName, "rejected");
|
|
1058
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, `Hydration timeout: exceeded maximum wait time of ${MAX_HYDRATION_WAIT_MS}ms`));
|
|
1216
1059
|
return;
|
|
1217
1060
|
}
|
|
1218
|
-
if (
|
|
1219
|
-
done(
|
|
1061
|
+
if (this.collectionHydrationStatuses.get(event.operation.schema.collectionName) === "rejected") {
|
|
1062
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, "Hydration failed, unable to query read plugin"));
|
|
1220
1063
|
return;
|
|
1221
1064
|
}
|
|
1222
|
-
if (
|
|
1065
|
+
if (this.collectionHydrationStatuses.get(event.operation.schema.collectionName) === "fulfilled") {
|
|
1223
1066
|
// Hydration completed successfully, proceed with query
|
|
1224
1067
|
readPlugin.query(event, (readResult) => {
|
|
1225
|
-
if (readResult.ok ===
|
|
1068
|
+
if (readResult.ok === _results__rspack_import_2.Result.ERROR) {
|
|
1226
1069
|
done(readResult);
|
|
1227
1070
|
return;
|
|
1228
1071
|
}
|
|
@@ -1238,7 +1081,7 @@ class OptimisticReplicationDbPlugin {
|
|
|
1238
1081
|
}
|
|
1239
1082
|
// Collection is hydrated for the targeted collection and should be in sync
|
|
1240
1083
|
readPlugin.query(event, (readResult) => {
|
|
1241
|
-
if (readResult.ok ===
|
|
1084
|
+
if (readResult.ok === _results__rspack_import_2.Result.ERROR) {
|
|
1242
1085
|
done(readResult);
|
|
1243
1086
|
return;
|
|
1244
1087
|
}
|
|
@@ -1247,65 +1090,65 @@ class OptimisticReplicationDbPlugin {
|
|
|
1247
1090
|
});
|
|
1248
1091
|
}
|
|
1249
1092
|
catch (e) {
|
|
1250
|
-
done(
|
|
1093
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, e));
|
|
1251
1094
|
}
|
|
1252
1095
|
}
|
|
1253
1096
|
destroy(event, done) {
|
|
1254
1097
|
try {
|
|
1255
|
-
const workPipeline = new
|
|
1098
|
+
const workPipeline = new _pipeline__rspack_import_5.WorkPipeline();
|
|
1256
1099
|
const plugins = [this.plugins.source, ...this.plugins.replicas];
|
|
1257
1100
|
for (let i = 0, length = plugins.length; i < length; i++) {
|
|
1258
1101
|
workPipeline.pipe((done) => plugins[i].destroy(event, done));
|
|
1259
1102
|
}
|
|
1260
1103
|
workPipeline.filter((result) => {
|
|
1261
|
-
if (result.ok ===
|
|
1262
|
-
done(
|
|
1104
|
+
if (result.ok === _results__rspack_import_2.Result.ERROR) {
|
|
1105
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, result.error));
|
|
1263
1106
|
return;
|
|
1264
1107
|
}
|
|
1265
|
-
done(
|
|
1108
|
+
done(_results__rspack_import_2.PluginEventResult.success(event.id));
|
|
1266
1109
|
});
|
|
1267
1110
|
}
|
|
1268
1111
|
catch (e) {
|
|
1269
|
-
done(
|
|
1112
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, e));
|
|
1270
1113
|
}
|
|
1271
1114
|
}
|
|
1272
1115
|
bulkPersist(event, done) {
|
|
1273
1116
|
try {
|
|
1274
|
-
const workPipeline = new
|
|
1117
|
+
const workPipeline = new _pipeline__rspack_import_5.WorkPipeline();
|
|
1275
1118
|
const deferredPlugins = [this.plugins.source, ...this.plugins.replicas];
|
|
1276
1119
|
// Since we are doing optimistic, we insert into the read plugin first and assume later plugins will succeed
|
|
1277
1120
|
// This means the read plugin will generate ids for the source plugin
|
|
1278
1121
|
this.plugins.read.bulkPersist({
|
|
1279
|
-
id: (0,
|
|
1122
|
+
id: (0,_utilities__rspack_import_0.uuid)(8),
|
|
1280
1123
|
operation: event.operation,
|
|
1281
1124
|
schemas: event.schemas,
|
|
1282
1125
|
source: "data-store",
|
|
1283
1126
|
}, (r) => {
|
|
1284
|
-
if (r.ok !==
|
|
1127
|
+
if (r.ok !== _results__rspack_import_2.Result.SUCCESS) {
|
|
1285
1128
|
done(r);
|
|
1286
1129
|
return;
|
|
1287
1130
|
}
|
|
1288
1131
|
// optimistically call done and still continue saving the rest of the data. We read from the memory
|
|
1289
1132
|
// db anyways
|
|
1290
1133
|
done(r);
|
|
1291
|
-
const optimisticBulkPersistChanges = new
|
|
1134
|
+
const optimisticBulkPersistChanges = new _collections__rspack_import_3.BulkPersistChanges();
|
|
1292
1135
|
// make sure we swap the adds here, that way we can make sure other persist events
|
|
1293
1136
|
// don't take their additions and try to change subsequent calls
|
|
1294
|
-
(0,
|
|
1137
|
+
(0,_utilities__rspack_import_6.resolveBulkPersistChanges)(event, r.data, optimisticBulkPersistChanges);
|
|
1295
1138
|
for (let i = 0, length = deferredPlugins.length; i < length; i++) {
|
|
1296
1139
|
workPipeline.pipe((d) => {
|
|
1297
1140
|
const plugin = deferredPlugins[i];
|
|
1298
1141
|
plugin.bulkPersist({
|
|
1299
|
-
id: (0,
|
|
1142
|
+
id: (0,_utilities__rspack_import_0.uuid)(8),
|
|
1300
1143
|
operation: optimisticBulkPersistChanges,
|
|
1301
1144
|
schemas: event.schemas,
|
|
1302
1145
|
source: "data-store",
|
|
1303
1146
|
}, (r) => {
|
|
1304
|
-
if (r.ok ===
|
|
1147
|
+
if (r.ok === _results__rspack_import_2.Result.ERROR) {
|
|
1305
1148
|
d(r);
|
|
1306
1149
|
return;
|
|
1307
1150
|
}
|
|
1308
|
-
d(
|
|
1151
|
+
d(_results__rspack_import_2.Result.success());
|
|
1309
1152
|
});
|
|
1310
1153
|
});
|
|
1311
1154
|
}
|
|
@@ -1317,44 +1160,38 @@ class OptimisticReplicationDbPlugin {
|
|
|
1317
1160
|
});
|
|
1318
1161
|
}
|
|
1319
1162
|
catch (e) {
|
|
1320
|
-
done(
|
|
1163
|
+
done(_results__rspack_import_2.PluginEventResult.error(event.id, e));
|
|
1321
1164
|
}
|
|
1322
1165
|
}
|
|
1323
1166
|
}
|
|
1324
1167
|
|
|
1325
1168
|
|
|
1326
|
-
}
|
|
1327
|
-
"./src/plugins/replication/ReplicationDbPlugin.ts"
|
|
1328
|
-
/*!********************************************************!*\
|
|
1329
|
-
!*** ./src/plugins/replication/ReplicationDbPlugin.ts ***!
|
|
1330
|
-
\********************************************************/
|
|
1331
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1169
|
+
},
|
|
1170
|
+
"./src/plugins/replication/ReplicationDbPlugin.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1332
1171
|
__webpack_require__.r(__webpack_exports__);
|
|
1333
1172
|
__webpack_require__.d(__webpack_exports__, {
|
|
1334
1173
|
ReplicationDbPlugin: () => (ReplicationDbPlugin)
|
|
1335
1174
|
});
|
|
1336
|
-
/*
|
|
1337
|
-
/*
|
|
1338
|
-
/*
|
|
1339
|
-
/*
|
|
1175
|
+
/* import */ var _results__rspack_import_0 = __webpack_require__("./src/results/Result.ts");
|
|
1176
|
+
/* import */ var _pipeline__rspack_import_1 = __webpack_require__("./src/pipeline/TrampolinePipeline.ts");
|
|
1177
|
+
/* import */ var _collections__rspack_import_2 = __webpack_require__("./src/collections/Changes.ts");
|
|
1178
|
+
/* import */ var _utilities__rspack_import_3 = __webpack_require__("./src/utilities/replication.ts");
|
|
1340
1179
|
|
|
1341
1180
|
|
|
1342
1181
|
|
|
1343
1182
|
|
|
1344
1183
|
class ReplicationDbPlugin {
|
|
1345
1184
|
plugins;
|
|
1346
|
-
constructor(plugins) {
|
|
1347
|
-
this.plugins = plugins;
|
|
1348
|
-
}
|
|
1349
1185
|
/**
|
|
1350
1186
|
* Creates a new DbPluginReplicator that coordinates operations between a source database and its replicas.
|
|
1351
1187
|
*
|
|
1352
|
-
* @param
|
|
1353
|
-
* @param
|
|
1354
|
-
* @
|
|
1188
|
+
* @param plugins Configuration object containing the source, read (optional), and replica database plugins
|
|
1189
|
+
* @param plugins.source The primary database plugin that will receive all operations first
|
|
1190
|
+
* @param plugins.read Optional read-optimized plugin (typically a memory plugin) used for fast queries
|
|
1191
|
+
* @param plugins.replicas Additional database plugins that will replicate operations from the source
|
|
1355
1192
|
*/
|
|
1356
|
-
|
|
1357
|
-
|
|
1193
|
+
constructor(plugins) {
|
|
1194
|
+
this.plugins = plugins;
|
|
1358
1195
|
}
|
|
1359
1196
|
/**
|
|
1360
1197
|
* Will query the read plugin if there is one, otherwise the source plugin will be queried
|
|
@@ -1365,115 +1202,107 @@ class ReplicationDbPlugin {
|
|
|
1365
1202
|
plugin.query(event, done);
|
|
1366
1203
|
}
|
|
1367
1204
|
catch (e) {
|
|
1368
|
-
done(
|
|
1205
|
+
done(_results__rspack_import_0.PluginEventResult.error(event.id, e));
|
|
1369
1206
|
}
|
|
1370
1207
|
}
|
|
1371
1208
|
destroy(event, done) {
|
|
1372
1209
|
try {
|
|
1373
|
-
const pipeline = new
|
|
1210
|
+
const pipeline = new _pipeline__rspack_import_1.WorkPipeline();
|
|
1374
1211
|
const plugins = [this.plugins.source, ...this.plugins.replicas];
|
|
1375
1212
|
for (let i = 0, length = plugins.length; i < length; i++) {
|
|
1376
|
-
pipeline.pipe(
|
|
1213
|
+
pipeline.pipe((done) => plugins[i].destroy(event, done));
|
|
1377
1214
|
}
|
|
1378
1215
|
pipeline.filter((result) => {
|
|
1379
|
-
if (result.ok ===
|
|
1380
|
-
done(
|
|
1216
|
+
if (result.ok === _results__rspack_import_0.Result.ERROR) {
|
|
1217
|
+
done(_results__rspack_import_0.PluginEventResult.error(event.id, result.error));
|
|
1381
1218
|
return;
|
|
1382
1219
|
}
|
|
1383
|
-
done(
|
|
1220
|
+
done(_results__rspack_import_0.PluginEventResult.success(event.id));
|
|
1384
1221
|
});
|
|
1385
1222
|
}
|
|
1386
1223
|
catch (e) {
|
|
1387
|
-
done(
|
|
1224
|
+
done(_results__rspack_import_0.PluginEventResult.error(event.id, e));
|
|
1388
1225
|
}
|
|
1389
1226
|
}
|
|
1390
1227
|
bulkPersist(event, done) {
|
|
1391
1228
|
try {
|
|
1392
1229
|
// insert into the source first to generate any ids, then take the result and persist that into the replicas
|
|
1393
|
-
const pipeline = new
|
|
1230
|
+
const pipeline = new _pipeline__rspack_import_1.WorkPipeline();
|
|
1394
1231
|
const plugins = [this.plugins.source, ...this.plugins.replicas];
|
|
1395
1232
|
if (this.plugins.read != null) {
|
|
1396
1233
|
plugins.push(this.plugins.read);
|
|
1397
1234
|
}
|
|
1398
|
-
const result = new
|
|
1235
|
+
const result = new _collections__rspack_import_2.BulkPersistResult();
|
|
1399
1236
|
for (let i = 0, length = plugins.length; i < length; i++) {
|
|
1400
1237
|
pipeline.pipe((d) => {
|
|
1401
1238
|
const plugin = plugins[i];
|
|
1402
1239
|
// source is first
|
|
1403
1240
|
if (i === 0) {
|
|
1404
1241
|
plugin.bulkPersist(event, (r) => {
|
|
1405
|
-
if (r.ok ===
|
|
1242
|
+
if (r.ok === _results__rspack_import_0.Result.ERROR) {
|
|
1406
1243
|
d(r);
|
|
1407
1244
|
return;
|
|
1408
1245
|
}
|
|
1409
1246
|
// make sure we swap the adds here, that way we can make sure other persist events
|
|
1410
1247
|
// don't take their additions and try to change subsequent calls
|
|
1411
|
-
(0,
|
|
1412
|
-
d(
|
|
1248
|
+
(0,_utilities__rspack_import_3.resolveBulkPersistChanges)(event, r.data, event.operation);
|
|
1249
|
+
d(_results__rspack_import_0.Result.success());
|
|
1413
1250
|
});
|
|
1414
1251
|
return;
|
|
1415
1252
|
}
|
|
1416
1253
|
plugin.bulkPersist(event, (r) => {
|
|
1417
|
-
if (r.ok ===
|
|
1254
|
+
if (r.ok === _results__rspack_import_0.Result.ERROR) {
|
|
1418
1255
|
d(r);
|
|
1419
1256
|
return;
|
|
1420
1257
|
}
|
|
1421
|
-
d(
|
|
1258
|
+
d(_results__rspack_import_0.Result.success());
|
|
1422
1259
|
});
|
|
1423
1260
|
});
|
|
1424
1261
|
}
|
|
1425
1262
|
let successCount = 0;
|
|
1426
1263
|
pipeline.filter((r) => {
|
|
1427
|
-
if (r.ok ===
|
|
1264
|
+
if (r.ok === _results__rspack_import_0.Result.ERROR) {
|
|
1428
1265
|
if (successCount > 0) {
|
|
1429
|
-
done(
|
|
1266
|
+
done(_results__rspack_import_0.PluginEventResult.partial(event.id, result, r.error));
|
|
1430
1267
|
return;
|
|
1431
1268
|
}
|
|
1432
|
-
done(
|
|
1269
|
+
done(_results__rspack_import_0.PluginEventResult.error(event.id, r.error));
|
|
1433
1270
|
return;
|
|
1434
1271
|
}
|
|
1435
1272
|
successCount++;
|
|
1436
|
-
done(
|
|
1273
|
+
done(_results__rspack_import_0.PluginEventResult.success(event.id, result));
|
|
1437
1274
|
});
|
|
1438
1275
|
}
|
|
1439
1276
|
catch (e) {
|
|
1440
|
-
done(
|
|
1277
|
+
done(_results__rspack_import_0.PluginEventResult.error(event.id, e));
|
|
1441
1278
|
}
|
|
1442
1279
|
}
|
|
1443
1280
|
}
|
|
1444
1281
|
|
|
1445
1282
|
|
|
1446
|
-
}
|
|
1447
|
-
"./src/plugins/replication/index.ts"
|
|
1448
|
-
/*!******************************************!*\
|
|
1449
|
-
!*** ./src/plugins/replication/index.ts ***!
|
|
1450
|
-
\******************************************/
|
|
1451
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1283
|
+
},
|
|
1284
|
+
"./src/plugins/replication/index.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1452
1285
|
__webpack_require__.r(__webpack_exports__);
|
|
1453
1286
|
__webpack_require__.d(__webpack_exports__, {
|
|
1454
|
-
OptimisticReplicationDbPlugin: () => (/* reexport safe */
|
|
1455
|
-
ReplicationDbPlugin: () => (/* reexport safe */
|
|
1287
|
+
OptimisticReplicationDbPlugin: () => (/* reexport safe */ _OptimisticReplicationDbPlugin__rspack_import_1.OptimisticReplicationDbPlugin),
|
|
1288
|
+
ReplicationDbPlugin: () => (/* reexport safe */ _ReplicationDbPlugin__rspack_import_0.ReplicationDbPlugin)
|
|
1456
1289
|
});
|
|
1457
|
-
/*
|
|
1458
|
-
/*
|
|
1290
|
+
/* import */ var _ReplicationDbPlugin__rspack_import_0 = __webpack_require__("./src/plugins/replication/ReplicationDbPlugin.ts");
|
|
1291
|
+
/* import */ var _OptimisticReplicationDbPlugin__rspack_import_1 = __webpack_require__("./src/plugins/replication/OptimisticReplicationDbPlugin.ts");
|
|
1459
1292
|
|
|
1460
1293
|
|
|
1461
1294
|
|
|
1462
1295
|
|
|
1463
1296
|
|
|
1464
|
-
}
|
|
1465
|
-
"./src/plugins/translators/DataTranslator.ts"
|
|
1466
|
-
/*!***************************************************!*\
|
|
1467
|
-
!*** ./src/plugins/translators/DataTranslator.ts ***!
|
|
1468
|
-
\***************************************************/
|
|
1469
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1297
|
+
},
|
|
1298
|
+
"./src/plugins/translators/DataTranslator.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1470
1299
|
__webpack_require__.r(__webpack_exports__);
|
|
1471
1300
|
__webpack_require__.d(__webpack_exports__, {
|
|
1472
1301
|
DataTranslator: () => (DataTranslator)
|
|
1473
1302
|
});
|
|
1474
|
-
/*
|
|
1475
|
-
/*
|
|
1476
|
-
/*
|
|
1303
|
+
/* import */ var _TranslatedArrayValue__rspack_import_0 = __webpack_require__("./src/plugins/translators/TranslatedArrayValue.ts");
|
|
1304
|
+
/* import */ var _TranslatedGroupValue__rspack_import_1 = __webpack_require__("./src/plugins/translators/TranslatedGroupValue.ts");
|
|
1305
|
+
/* import */ var _TranslatedSingleValue__rspack_import_2 = __webpack_require__("./src/plugins/translators/TranslatedSingleValue.ts");
|
|
1477
1306
|
|
|
1478
1307
|
|
|
1479
1308
|
|
|
@@ -1500,35 +1329,31 @@ class DataTranslator {
|
|
|
1500
1329
|
data = this.functionMap[item.name](data, item);
|
|
1501
1330
|
});
|
|
1502
1331
|
if (Array.isArray(data)) {
|
|
1503
|
-
return new
|
|
1332
|
+
return new _TranslatedArrayValue__rspack_import_0.TranslatedArrayValue(data);
|
|
1504
1333
|
}
|
|
1505
1334
|
if (this.query.options.has("group")) {
|
|
1506
|
-
return new
|
|
1335
|
+
return new _TranslatedGroupValue__rspack_import_1.TranslatedGroupValue(data);
|
|
1507
1336
|
}
|
|
1508
|
-
return new
|
|
1337
|
+
return new _TranslatedSingleValue__rspack_import_2.TranslatedSingleValue(data);
|
|
1509
1338
|
}
|
|
1510
1339
|
}
|
|
1511
1340
|
|
|
1512
1341
|
|
|
1513
|
-
}
|
|
1514
|
-
"./src/plugins/translators/JsonTranslator.ts"
|
|
1515
|
-
/*!***************************************************!*\
|
|
1516
|
-
!*** ./src/plugins/translators/JsonTranslator.ts ***!
|
|
1517
|
-
\***************************************************/
|
|
1518
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1342
|
+
},
|
|
1343
|
+
"./src/plugins/translators/JsonTranslator.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1519
1344
|
__webpack_require__.r(__webpack_exports__);
|
|
1520
1345
|
__webpack_require__.d(__webpack_exports__, {
|
|
1521
1346
|
JsonTranslator: () => (JsonTranslator)
|
|
1522
1347
|
});
|
|
1523
|
-
/*
|
|
1524
|
-
/*
|
|
1525
|
-
/*
|
|
1348
|
+
/* import */ var _DataTranslator__rspack_import_0 = __webpack_require__("./src/plugins/translators/DataTranslator.ts");
|
|
1349
|
+
/* import */ var _assertions__rspack_import_1 = __webpack_require__("./src/assertions/index.ts");
|
|
1350
|
+
/* import */ var _utilities__rspack_import_2 = __webpack_require__("./src/utilities/dates.ts");
|
|
1526
1351
|
|
|
1527
1352
|
|
|
1528
1353
|
|
|
1529
|
-
class JsonTranslator extends
|
|
1354
|
+
class JsonTranslator extends _DataTranslator__rspack_import_0.DataTranslator {
|
|
1530
1355
|
filter(data, option) {
|
|
1531
|
-
(0,
|
|
1356
|
+
(0,_assertions__rspack_import_1.assertIsArray)(data);
|
|
1532
1357
|
if (option.value.filter) {
|
|
1533
1358
|
if (option.value.params == null) {
|
|
1534
1359
|
// standard filtering
|
|
@@ -1616,7 +1441,7 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
|
|
|
1616
1441
|
return data;
|
|
1617
1442
|
}
|
|
1618
1443
|
sum(data, _) {
|
|
1619
|
-
(0,
|
|
1444
|
+
(0,_assertions__rspack_import_1.assertIsArray)(data, this._formatDataNotArrayError("sum"));
|
|
1620
1445
|
if (data.length === 0) {
|
|
1621
1446
|
throw new Error("Cannot perform operation on empty array, result query contains no data");
|
|
1622
1447
|
}
|
|
@@ -1633,7 +1458,7 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
|
|
|
1633
1458
|
return sum;
|
|
1634
1459
|
}
|
|
1635
1460
|
distinct(data, _) {
|
|
1636
|
-
(0,
|
|
1461
|
+
(0,_assertions__rspack_import_1.assertIsArray)(data, this._formatDataNotArrayError("distinct"));
|
|
1637
1462
|
const result = new Set();
|
|
1638
1463
|
// would be nice to have property info here for type detection
|
|
1639
1464
|
let needsDateConversion = false;
|
|
@@ -1643,7 +1468,7 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
|
|
|
1643
1468
|
result.add(value);
|
|
1644
1469
|
continue;
|
|
1645
1470
|
}
|
|
1646
|
-
if ((0,
|
|
1471
|
+
if ((0,_utilities__rspack_import_2.isDate)(value)) {
|
|
1647
1472
|
needsDateConversion = true;
|
|
1648
1473
|
result.add(value.toISOString());
|
|
1649
1474
|
continue;
|
|
@@ -1688,7 +1513,7 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
|
|
|
1688
1513
|
return mapOption.value.fields[0];
|
|
1689
1514
|
}
|
|
1690
1515
|
_minMax(data, name, sort) {
|
|
1691
|
-
(0,
|
|
1516
|
+
(0,_assertions__rspack_import_1.assertIsArray)(data, this._formatDataNotArrayError(name));
|
|
1692
1517
|
data.sort(sort);
|
|
1693
1518
|
if (data.length === 0) {
|
|
1694
1519
|
throw new Error("Cannot perform operation on empty array, result query contains no data");
|
|
@@ -1701,19 +1526,15 @@ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTr
|
|
|
1701
1526
|
}
|
|
1702
1527
|
|
|
1703
1528
|
|
|
1704
|
-
}
|
|
1705
|
-
"./src/plugins/translators/SqlTranslator.ts"
|
|
1706
|
-
/*!**************************************************!*\
|
|
1707
|
-
!*** ./src/plugins/translators/SqlTranslator.ts ***!
|
|
1708
|
-
\**************************************************/
|
|
1709
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1529
|
+
},
|
|
1530
|
+
"./src/plugins/translators/SqlTranslator.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1710
1531
|
__webpack_require__.r(__webpack_exports__);
|
|
1711
1532
|
__webpack_require__.d(__webpack_exports__, {
|
|
1712
1533
|
SqlTranslator: () => (SqlTranslator)
|
|
1713
1534
|
});
|
|
1714
|
-
/*
|
|
1535
|
+
/* import */ var _DataTranslator__rspack_import_0 = __webpack_require__("./src/plugins/translators/DataTranslator.ts");
|
|
1715
1536
|
|
|
1716
|
-
class SqlTranslator extends
|
|
1537
|
+
class SqlTranslator extends _DataTranslator__rspack_import_0.DataTranslator {
|
|
1717
1538
|
count(data, _) {
|
|
1718
1539
|
if (Array.isArray(data) && data.length > 0) {
|
|
1719
1540
|
// Count should be returned as the property alias on the query
|
|
@@ -1803,12 +1624,8 @@ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTra
|
|
|
1803
1624
|
}
|
|
1804
1625
|
|
|
1805
1626
|
|
|
1806
|
-
}
|
|
1807
|
-
"./src/plugins/translators/TranslatedArrayValue.ts"
|
|
1808
|
-
/*!*********************************************************!*\
|
|
1809
|
-
!*** ./src/plugins/translators/TranslatedArrayValue.ts ***!
|
|
1810
|
-
\*********************************************************/
|
|
1811
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1627
|
+
},
|
|
1628
|
+
"./src/plugins/translators/TranslatedArrayValue.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1812
1629
|
__webpack_require__.r(__webpack_exports__);
|
|
1813
1630
|
__webpack_require__.d(__webpack_exports__, {
|
|
1814
1631
|
TranslatedArrayValue: () => (TranslatedArrayValue)
|
|
@@ -1831,12 +1648,8 @@ class TranslatedArrayValue {
|
|
|
1831
1648
|
}
|
|
1832
1649
|
|
|
1833
1650
|
|
|
1834
|
-
}
|
|
1835
|
-
"./src/plugins/translators/TranslatedGroupValue.ts"
|
|
1836
|
-
/*!*********************************************************!*\
|
|
1837
|
-
!*** ./src/plugins/translators/TranslatedGroupValue.ts ***!
|
|
1838
|
-
\*********************************************************/
|
|
1839
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1651
|
+
},
|
|
1652
|
+
"./src/plugins/translators/TranslatedGroupValue.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1840
1653
|
__webpack_require__.r(__webpack_exports__);
|
|
1841
1654
|
__webpack_require__.d(__webpack_exports__, {
|
|
1842
1655
|
TranslatedGroupValue: () => (TranslatedGroupValue)
|
|
@@ -1864,12 +1677,8 @@ class TranslatedGroupValue {
|
|
|
1864
1677
|
}
|
|
1865
1678
|
|
|
1866
1679
|
|
|
1867
|
-
}
|
|
1868
|
-
"./src/plugins/translators/TranslatedSingleValue.ts"
|
|
1869
|
-
/*!**********************************************************!*\
|
|
1870
|
-
!*** ./src/plugins/translators/TranslatedSingleValue.ts ***!
|
|
1871
|
-
\**********************************************************/
|
|
1872
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1680
|
+
},
|
|
1681
|
+
"./src/plugins/translators/TranslatedSingleValue.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1873
1682
|
__webpack_require__.r(__webpack_exports__);
|
|
1874
1683
|
__webpack_require__.d(__webpack_exports__, {
|
|
1875
1684
|
TranslatedSingleValue: () => (TranslatedSingleValue)
|
|
@@ -1888,27 +1697,23 @@ class TranslatedSingleValue {
|
|
|
1888
1697
|
}
|
|
1889
1698
|
|
|
1890
1699
|
|
|
1891
|
-
}
|
|
1892
|
-
"./src/plugins/translators/index.ts"
|
|
1893
|
-
/*!******************************************!*\
|
|
1894
|
-
!*** ./src/plugins/translators/index.ts ***!
|
|
1895
|
-
\******************************************/
|
|
1896
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1700
|
+
},
|
|
1701
|
+
"./src/plugins/translators/index.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1897
1702
|
__webpack_require__.r(__webpack_exports__);
|
|
1898
1703
|
__webpack_require__.d(__webpack_exports__, {
|
|
1899
|
-
DataTranslator: () => (/* reexport safe */
|
|
1900
|
-
JsonTranslator: () => (/* reexport safe */
|
|
1901
|
-
SqlTranslator: () => (/* reexport safe */
|
|
1902
|
-
TranslatedArrayValue: () => (/* reexport safe */
|
|
1903
|
-
TranslatedGroupValue: () => (/* reexport safe */
|
|
1904
|
-
TranslatedSingleValue: () => (/* reexport safe */
|
|
1704
|
+
DataTranslator: () => (/* reexport safe */ _DataTranslator__rspack_import_0.DataTranslator),
|
|
1705
|
+
JsonTranslator: () => (/* reexport safe */ _JsonTranslator__rspack_import_1.JsonTranslator),
|
|
1706
|
+
SqlTranslator: () => (/* reexport safe */ _SqlTranslator__rspack_import_2.SqlTranslator),
|
|
1707
|
+
TranslatedArrayValue: () => (/* reexport safe */ _TranslatedArrayValue__rspack_import_3.TranslatedArrayValue),
|
|
1708
|
+
TranslatedGroupValue: () => (/* reexport safe */ _TranslatedGroupValue__rspack_import_4.TranslatedGroupValue),
|
|
1709
|
+
TranslatedSingleValue: () => (/* reexport safe */ _TranslatedSingleValue__rspack_import_5.TranslatedSingleValue)
|
|
1905
1710
|
});
|
|
1906
|
-
/*
|
|
1907
|
-
/*
|
|
1908
|
-
/*
|
|
1909
|
-
/*
|
|
1910
|
-
/*
|
|
1911
|
-
/*
|
|
1711
|
+
/* import */ var _DataTranslator__rspack_import_0 = __webpack_require__("./src/plugins/translators/DataTranslator.ts");
|
|
1712
|
+
/* import */ var _JsonTranslator__rspack_import_1 = __webpack_require__("./src/plugins/translators/JsonTranslator.ts");
|
|
1713
|
+
/* import */ var _SqlTranslator__rspack_import_2 = __webpack_require__("./src/plugins/translators/SqlTranslator.ts");
|
|
1714
|
+
/* import */ var _TranslatedArrayValue__rspack_import_3 = __webpack_require__("./src/plugins/translators/TranslatedArrayValue.ts");
|
|
1715
|
+
/* import */ var _TranslatedGroupValue__rspack_import_4 = __webpack_require__("./src/plugins/translators/TranslatedGroupValue.ts");
|
|
1716
|
+
/* import */ var _TranslatedSingleValue__rspack_import_5 = __webpack_require__("./src/plugins/translators/TranslatedSingleValue.ts");
|
|
1912
1717
|
|
|
1913
1718
|
|
|
1914
1719
|
|
|
@@ -1918,12 +1723,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1918
1723
|
|
|
1919
1724
|
|
|
1920
1725
|
|
|
1921
|
-
}
|
|
1922
|
-
"./src/results/Result.ts"
|
|
1923
|
-
/*!*******************************!*\
|
|
1924
|
-
!*** ./src/results/Result.ts ***!
|
|
1925
|
-
\*******************************/
|
|
1926
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1726
|
+
},
|
|
1727
|
+
"./src/results/Result.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1927
1728
|
__webpack_require__.r(__webpack_exports__);
|
|
1928
1729
|
__webpack_require__.d(__webpack_exports__, {
|
|
1929
1730
|
PluginEventResult: () => (PluginEventResult),
|
|
@@ -2005,12 +1806,8 @@ class PluginEventResult extends BaseResult {
|
|
|
2005
1806
|
}
|
|
2006
1807
|
|
|
2007
1808
|
|
|
2008
|
-
}
|
|
2009
|
-
"./src/utilities/dates.ts"
|
|
2010
|
-
/*!********************************!*\
|
|
2011
|
-
!*** ./src/utilities/dates.ts ***!
|
|
2012
|
-
\********************************/
|
|
2013
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1809
|
+
},
|
|
1810
|
+
"./src/utilities/dates.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
2014
1811
|
__webpack_require__.r(__webpack_exports__);
|
|
2015
1812
|
__webpack_require__.d(__webpack_exports__, {
|
|
2016
1813
|
isDate: () => (isDate)
|
|
@@ -2026,12 +1823,49 @@ const isDate = (data) => {
|
|
|
2026
1823
|
};
|
|
2027
1824
|
|
|
2028
1825
|
|
|
2029
|
-
}
|
|
2030
|
-
"./src/utilities/
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
1826
|
+
},
|
|
1827
|
+
"./src/utilities/logger.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1828
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1829
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1830
|
+
logger: () => (logger)
|
|
1831
|
+
});
|
|
1832
|
+
const isDevelopment = () => {
|
|
1833
|
+
if (typeof process === 'undefined' || process.env == null) {
|
|
1834
|
+
return false;
|
|
1835
|
+
}
|
|
1836
|
+
const env = "development"?.toLowerCase();
|
|
1837
|
+
return env === 'dev' || env === 'development' || env === 'test';
|
|
1838
|
+
};
|
|
1839
|
+
const shouldLog = isDevelopment();
|
|
1840
|
+
const tryLog = (type, ...args) => {
|
|
1841
|
+
if (shouldLog) {
|
|
1842
|
+
console[type](...args);
|
|
1843
|
+
}
|
|
1844
|
+
};
|
|
1845
|
+
const logger = {
|
|
1846
|
+
log: (...args) => {
|
|
1847
|
+
tryLog("log", ...args);
|
|
1848
|
+
},
|
|
1849
|
+
info: (...args) => {
|
|
1850
|
+
tryLog("info", ...args);
|
|
1851
|
+
},
|
|
1852
|
+
warn: (...args) => {
|
|
1853
|
+
tryLog("warn", ...args);
|
|
1854
|
+
},
|
|
1855
|
+
error: (...args) => {
|
|
1856
|
+
tryLog("error", ...args);
|
|
1857
|
+
},
|
|
1858
|
+
debug: (...args) => {
|
|
1859
|
+
tryLog("debug", ...args);
|
|
1860
|
+
},
|
|
1861
|
+
table: (...args) => {
|
|
1862
|
+
tryLog("table", ...args);
|
|
1863
|
+
},
|
|
1864
|
+
};
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
},
|
|
1868
|
+
"./src/utilities/replication.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
2035
1869
|
__webpack_require__.r(__webpack_exports__);
|
|
2036
1870
|
__webpack_require__.d(__webpack_exports__, {
|
|
2037
1871
|
resolveBulkPersistChanges: () => (resolveBulkPersistChanges)
|
|
@@ -2054,12 +1888,8 @@ const resolveBulkPersistChanges = (event, result, bulkPersistChanges) => {
|
|
|
2054
1888
|
};
|
|
2055
1889
|
|
|
2056
1890
|
|
|
2057
|
-
}
|
|
2058
|
-
"./src/utilities/uuid.ts"
|
|
2059
|
-
/*!*******************************!*\
|
|
2060
|
-
!*** ./src/utilities/uuid.ts ***!
|
|
2061
|
-
\*******************************/
|
|
2062
|
-
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1891
|
+
},
|
|
1892
|
+
"./src/utilities/uuid.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
2063
1893
|
__webpack_require__.r(__webpack_exports__);
|
|
2064
1894
|
__webpack_require__.d(__webpack_exports__, {
|
|
2065
1895
|
uuid: () => (uuid),
|
|
@@ -2116,10 +1946,9 @@ const uuidv4 = () => {
|
|
|
2116
1946
|
};
|
|
2117
1947
|
|
|
2118
1948
|
|
|
2119
|
-
}
|
|
1949
|
+
},
|
|
2120
1950
|
|
|
2121
1951
|
});
|
|
2122
|
-
/************************************************************************/
|
|
2123
1952
|
// The module cache
|
|
2124
1953
|
var __webpack_module_cache__ = {};
|
|
2125
1954
|
|
|
@@ -2143,7 +1972,6 @@ return module.exports;
|
|
|
2143
1972
|
|
|
2144
1973
|
}
|
|
2145
1974
|
|
|
2146
|
-
/************************************************************************/
|
|
2147
1975
|
// webpack/runtime/define_property_getters
|
|
2148
1976
|
(() => {
|
|
2149
1977
|
__webpack_require__.d = (exports, definition) => {
|
|
@@ -2168,33 +1996,28 @@ __webpack_require__.r = (exports) => {
|
|
|
2168
1996
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2169
1997
|
};
|
|
2170
1998
|
})();
|
|
2171
|
-
/************************************************************************/
|
|
2172
1999
|
var __webpack_exports__ = {};
|
|
2173
2000
|
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
2174
2001
|
(() => {
|
|
2175
|
-
|
|
2176
|
-
/*!******************************!*\
|
|
2177
|
-
!*** ./src/plugins/index.ts ***!
|
|
2178
|
-
\******************************/
|
|
2179
2002
|
__webpack_require__.r(__webpack_exports__);
|
|
2180
2003
|
__webpack_require__.d(__webpack_exports__, {
|
|
2181
|
-
DataTranslator: () => (/* reexport safe */
|
|
2182
|
-
EphemeralDataPlugin: () => (/* reexport safe */
|
|
2183
|
-
JsonTranslator: () => (/* reexport safe */
|
|
2184
|
-
OptimisticReplicationDbPlugin: () => (/* reexport safe */
|
|
2185
|
-
Query: () => (/* reexport safe */
|
|
2186
|
-
QueryOptionsCollection: () => (/* reexport safe */
|
|
2187
|
-
QueryOrdering: () => (/* reexport safe */
|
|
2188
|
-
ReplicationDbPlugin: () => (/* reexport safe */
|
|
2189
|
-
SqlTranslator: () => (/* reexport safe */
|
|
2190
|
-
TranslatedArrayValue: () => (/* reexport safe */
|
|
2191
|
-
TranslatedGroupValue: () => (/* reexport safe */
|
|
2192
|
-
TranslatedSingleValue: () => (/* reexport safe */
|
|
2004
|
+
DataTranslator: () => (/* reexport safe */ _translators__rspack_import_0.DataTranslator),
|
|
2005
|
+
EphemeralDataPlugin: () => (/* reexport safe */ _EphemeralDataPlugin__rspack_import_3.EphemeralDataPlugin),
|
|
2006
|
+
JsonTranslator: () => (/* reexport safe */ _translators__rspack_import_0.JsonTranslator),
|
|
2007
|
+
OptimisticReplicationDbPlugin: () => (/* reexport safe */ _replication__rspack_import_1.OptimisticReplicationDbPlugin),
|
|
2008
|
+
Query: () => (/* reexport safe */ _query__rspack_import_2.Query),
|
|
2009
|
+
QueryOptionsCollection: () => (/* reexport safe */ _query__rspack_import_2.QueryOptionsCollection),
|
|
2010
|
+
QueryOrdering: () => (/* reexport safe */ _query__rspack_import_2.QueryOrdering),
|
|
2011
|
+
ReplicationDbPlugin: () => (/* reexport safe */ _replication__rspack_import_1.ReplicationDbPlugin),
|
|
2012
|
+
SqlTranslator: () => (/* reexport safe */ _translators__rspack_import_0.SqlTranslator),
|
|
2013
|
+
TranslatedArrayValue: () => (/* reexport safe */ _translators__rspack_import_0.TranslatedArrayValue),
|
|
2014
|
+
TranslatedGroupValue: () => (/* reexport safe */ _translators__rspack_import_0.TranslatedGroupValue),
|
|
2015
|
+
TranslatedSingleValue: () => (/* reexport safe */ _translators__rspack_import_0.TranslatedSingleValue)
|
|
2193
2016
|
});
|
|
2194
|
-
/*
|
|
2195
|
-
/*
|
|
2196
|
-
/*
|
|
2197
|
-
/*
|
|
2017
|
+
/* import */ var _translators__rspack_import_0 = __webpack_require__("./src/plugins/translators/index.ts");
|
|
2018
|
+
/* import */ var _replication__rspack_import_1 = __webpack_require__("./src/plugins/replication/index.ts");
|
|
2019
|
+
/* import */ var _query__rspack_import_2 = __webpack_require__("./src/plugins/query/index.ts");
|
|
2020
|
+
/* import */ var _EphemeralDataPlugin__rspack_import_3 = __webpack_require__("./src/plugins/EphemeralDataPlugin.ts");
|
|
2198
2021
|
|
|
2199
2022
|
|
|
2200
2023
|
|