@luvio/environments 0.99.0 → 0.100.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { emitAdapterEvent, buildStaleWhileRevalidateImplementation, InMemoryStore } from '@luvio/engine';
|
|
1
|
+
import { emitAdapterEvent, buildStaleWhileRevalidateImplementation, InMemoryStore, Reader } from '@luvio/engine';
|
|
2
2
|
|
|
3
3
|
function isDeprecatedDurableStoreEntry(durableRecord) {
|
|
4
4
|
if (durableRecord.expiration !== undefined) {
|
|
@@ -515,7 +515,8 @@ function makeDurable(environment, { durableStore, instrumentation }) {
|
|
|
515
515
|
validateNotDisposed();
|
|
516
516
|
// if this lookup is right after an ingest there will be a staging store
|
|
517
517
|
if (ingestStagingStore !== null) {
|
|
518
|
-
|
|
518
|
+
const reader = new Reader(ingestStagingStore, sel.variables, refresh, undefined, ttlStrategy);
|
|
519
|
+
return reader.read(sel);
|
|
519
520
|
}
|
|
520
521
|
// otherwise this is from buildCachedSnapshot and we should use the luvio
|
|
521
522
|
// L1 store
|
|
@@ -542,10 +543,10 @@ function makeDurable(environment, { durableStore, instrumentation }) {
|
|
|
542
543
|
}
|
|
543
544
|
return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
|
|
544
545
|
};
|
|
545
|
-
const rebuildSnapshot = function (snapshot,
|
|
546
|
+
const rebuildSnapshot = function (snapshot, onAsyncRebuild) {
|
|
546
547
|
validateNotDisposed();
|
|
547
548
|
// try rebuilding from memory
|
|
548
|
-
const rebuilt = environment.rebuildSnapshot(snapshot,
|
|
549
|
+
const rebuilt = environment.rebuildSnapshot(snapshot, onAsyncRebuild);
|
|
549
550
|
// only try reviving from durable store if snapshot is unfulfilled
|
|
550
551
|
if (rebuilt.state !== 'Unfulfilled') {
|
|
551
552
|
return rebuilt;
|
|
@@ -554,7 +555,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
|
|
|
554
555
|
reviveSnapshot(environment, durableStore, rebuilt, durableStoreErrorHandler, () =>
|
|
555
556
|
// reviveSnapshot will revive into L1, and since "records" is a reference
|
|
556
557
|
// (and not a copy) to the L1 records we can use it for rebuild
|
|
557
|
-
environment.rebuildSnapshot(snapshot,
|
|
558
|
+
environment.rebuildSnapshot(snapshot, () => { })).then((result) => {
|
|
558
559
|
onAsyncRebuild(result.snapshot);
|
|
559
560
|
});
|
|
560
561
|
// synchronously return the base snapshot as Pending if not already
|
|
@@ -519,7 +519,8 @@
|
|
|
519
519
|
validateNotDisposed();
|
|
520
520
|
// if this lookup is right after an ingest there will be a staging store
|
|
521
521
|
if (ingestStagingStore !== null) {
|
|
522
|
-
|
|
522
|
+
const reader = new engine.Reader(ingestStagingStore, sel.variables, refresh, undefined, ttlStrategy);
|
|
523
|
+
return reader.read(sel);
|
|
523
524
|
}
|
|
524
525
|
// otherwise this is from buildCachedSnapshot and we should use the luvio
|
|
525
526
|
// L1 store
|
|
@@ -546,10 +547,10 @@
|
|
|
546
547
|
}
|
|
547
548
|
return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
|
|
548
549
|
};
|
|
549
|
-
const rebuildSnapshot = function (snapshot,
|
|
550
|
+
const rebuildSnapshot = function (snapshot, onAsyncRebuild) {
|
|
550
551
|
validateNotDisposed();
|
|
551
552
|
// try rebuilding from memory
|
|
552
|
-
const rebuilt = environment.rebuildSnapshot(snapshot,
|
|
553
|
+
const rebuilt = environment.rebuildSnapshot(snapshot, onAsyncRebuild);
|
|
553
554
|
// only try reviving from durable store if snapshot is unfulfilled
|
|
554
555
|
if (rebuilt.state !== 'Unfulfilled') {
|
|
555
556
|
return rebuilt;
|
|
@@ -558,7 +559,7 @@
|
|
|
558
559
|
reviveSnapshot(environment, durableStore, rebuilt, durableStoreErrorHandler, () =>
|
|
559
560
|
// reviveSnapshot will revive into L1, and since "records" is a reference
|
|
560
561
|
// (and not a copy) to the L1 records we can use it for rebuild
|
|
561
|
-
environment.rebuildSnapshot(snapshot,
|
|
562
|
+
environment.rebuildSnapshot(snapshot, () => { })).then((result) => {
|
|
562
563
|
onAsyncRebuild(result.snapshot);
|
|
563
564
|
});
|
|
564
565
|
// synchronously return the base snapshot as Pending if not already
|
|
@@ -564,7 +564,8 @@
|
|
|
564
564
|
validateNotDisposed();
|
|
565
565
|
// if this lookup is right after an ingest there will be a staging store
|
|
566
566
|
if (ingestStagingStore !== null) {
|
|
567
|
-
|
|
567
|
+
var reader = new engine.Reader(ingestStagingStore, sel.variables, refresh, undefined, ttlStrategy);
|
|
568
|
+
return reader.read(sel);
|
|
568
569
|
}
|
|
569
570
|
// otherwise this is from buildCachedSnapshot and we should use the luvio
|
|
570
571
|
// L1 store
|
|
@@ -591,10 +592,10 @@
|
|
|
591
592
|
}
|
|
592
593
|
return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
|
|
593
594
|
};
|
|
594
|
-
var rebuildSnapshot = function (snapshot,
|
|
595
|
+
var rebuildSnapshot = function (snapshot, onAsyncRebuild) {
|
|
595
596
|
validateNotDisposed();
|
|
596
597
|
// try rebuilding from memory
|
|
597
|
-
var rebuilt = environment.rebuildSnapshot(snapshot,
|
|
598
|
+
var rebuilt = environment.rebuildSnapshot(snapshot, onAsyncRebuild);
|
|
598
599
|
// only try reviving from durable store if snapshot is unfulfilled
|
|
599
600
|
if (rebuilt.state !== 'Unfulfilled') {
|
|
600
601
|
return rebuilt;
|
|
@@ -603,7 +604,7 @@
|
|
|
603
604
|
reviveSnapshot(environment, durableStore, rebuilt, durableStoreErrorHandler, function () {
|
|
604
605
|
// reviveSnapshot will revive into L1, and since "records" is a reference
|
|
605
606
|
// (and not a copy) to the L1 records we can use it for rebuild
|
|
606
|
-
return environment.rebuildSnapshot(snapshot,
|
|
607
|
+
return environment.rebuildSnapshot(snapshot, function () { });
|
|
607
608
|
}).then(function (result) {
|
|
608
609
|
onAsyncRebuild(result.snapshot);
|
|
609
610
|
});
|
package/package.json
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/environments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.100.0",
|
|
4
4
|
"description": "Luvio Environments",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/salesforce/luvio.git",
|
|
8
|
+
"directory": "packages/@luvio/environments"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
5
11
|
"main": "dist/umd/es2018/environments.js",
|
|
6
12
|
"module": "dist/es/es2018/environments.js",
|
|
7
13
|
"types": "dist/es/es2018/main.d.ts",
|
|
8
|
-
"
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/"
|
|
16
|
+
],
|
|
9
17
|
"scripts": {
|
|
10
|
-
"clean": "rm -rf dist",
|
|
11
18
|
"build": "rollup --config rollup.config.js",
|
|
12
|
-
"
|
|
19
|
+
"clean": "rm -rf dist",
|
|
13
20
|
"test": "jest",
|
|
14
21
|
"test:debug": "node --inspect-brk ../../../node_modules/jest/bin/jest.js --config ./jest.config.js --runInBand",
|
|
15
|
-
"test:size": "bundlesize"
|
|
22
|
+
"test:size": "bundlesize",
|
|
23
|
+
"watch": "yarn build --watch"
|
|
16
24
|
},
|
|
17
|
-
"nx": {
|
|
18
|
-
"targets": {
|
|
19
|
-
"build": {
|
|
20
|
-
"outputs": [
|
|
21
|
-
"packages/@luvio/environments/dist"
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"files": [
|
|
27
|
-
"dist/"
|
|
28
|
-
],
|
|
29
25
|
"dependencies": {
|
|
30
|
-
"@luvio/engine": "0.
|
|
26
|
+
"@luvio/engine": "0.100.0"
|
|
31
27
|
},
|
|
32
28
|
"bundlesize": [
|
|
33
29
|
{
|
|
@@ -35,5 +31,14 @@
|
|
|
35
31
|
"maxSize": "9 kB",
|
|
36
32
|
"compression": "brotli"
|
|
37
33
|
}
|
|
38
|
-
]
|
|
34
|
+
],
|
|
35
|
+
"nx": {
|
|
36
|
+
"targets": {
|
|
37
|
+
"build": {
|
|
38
|
+
"outputs": [
|
|
39
|
+
"packages/@luvio/environments/dist"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
39
44
|
}
|