@luvio/environments 0.73.5 → 0.74.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/es/es2018/DurableTTLStore.d.ts +1 -1
- package/dist/es/es2018/environments.js +15 -70
- package/dist/es/es2018/makeDurable/error.d.ts +1 -1
- package/dist/es/es2018/makeDurable/flush.d.ts +3 -3
- package/dist/es/es2018/makeDurable/revive.d.ts +3 -3
- package/dist/es/es2018/makeDurable/utils.d.ts +1 -1
- package/dist/es/es2018/makeDurable.d.ts +5 -4
- package/dist/umd/es2018/DurableTTLStore.d.ts +1 -1
- package/dist/umd/es2018/environments.js +15 -70
- package/dist/umd/es2018/makeDurable/error.d.ts +1 -1
- package/dist/umd/es2018/makeDurable/flush.d.ts +3 -3
- package/dist/umd/es2018/makeDurable/revive.d.ts +3 -3
- package/dist/umd/es2018/makeDurable/utils.d.ts +1 -1
- package/dist/umd/es2018/makeDurable.d.ts +5 -4
- package/dist/umd/es5/DurableTTLStore.d.ts +1 -1
- package/dist/umd/es5/environments.js +15 -64
- package/dist/umd/es5/makeDurable/error.d.ts +1 -1
- package/dist/umd/es5/makeDurable/flush.d.ts +3 -3
- package/dist/umd/es5/makeDurable/revive.d.ts +3 -3
- package/dist/umd/es5/makeDurable/utils.d.ts +1 -1
- package/dist/umd/es5/makeDurable.d.ts +5 -4
- package/package.json +12 -4
- package/dist/es/es2018/utils/selectors.d.ts +0 -2
- package/dist/umd/es2018/utils/selectors.d.ts +0 -2
- package/dist/umd/es5/utils/selectors.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DurableStore } from './DurableStore';
|
|
1
|
+
import type { DurableStore } from './DurableStore';
|
|
2
2
|
export declare const TTL_DURABLE_SEGMENT = "TTL_DURABLE_SEGMENT";
|
|
3
3
|
export interface DefaultDurableTTLOverride extends DurableTTLOverride {
|
|
4
4
|
namespace: 'TTL_DEFAULT_KEY';
|
|
@@ -60,70 +60,6 @@ function deepFreeze(value) {
|
|
|
60
60
|
freeze(value);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const SELECTOR_PAGINATION_TOKEN = 'tokenDataKey';
|
|
64
|
-
function isFragmentUnionSelection(sel) {
|
|
65
|
-
return sel.union === true;
|
|
66
|
-
}
|
|
67
|
-
function getSelections(selections) {
|
|
68
|
-
if (selections === undefined) {
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
let nestedSelections = [];
|
|
72
|
-
let nonNestedSelections = [];
|
|
73
|
-
// get nested selections first
|
|
74
|
-
for (let i = 0, len = selections.length; i < len; i++) {
|
|
75
|
-
const selection = selections[i];
|
|
76
|
-
if (selection.kind === 'Object') {
|
|
77
|
-
nestedSelections = [
|
|
78
|
-
...nestedSelections,
|
|
79
|
-
...getSelections(selection.selections),
|
|
80
|
-
];
|
|
81
|
-
}
|
|
82
|
-
else if (selection.kind === 'Link') {
|
|
83
|
-
nestedSelections = [
|
|
84
|
-
...nestedSelections,
|
|
85
|
-
...getSelectionsFromFragment(selection.fragment),
|
|
86
|
-
];
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
nonNestedSelections.push(selection);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return [...nestedSelections, ...nonNestedSelections];
|
|
93
|
-
}
|
|
94
|
-
function getSelectionsFromFragment(fragment) {
|
|
95
|
-
let selections = [];
|
|
96
|
-
// if union fragment then get selections from all unions
|
|
97
|
-
if (isFragmentUnionSelection(fragment)) {
|
|
98
|
-
const { unionSelections } = fragment;
|
|
99
|
-
const unionKeys = keys(unionSelections);
|
|
100
|
-
for (let i = 0, len = unionKeys.length; i < len; i++) {
|
|
101
|
-
const key = unionKeys[i];
|
|
102
|
-
selections = [...selections, ...unionSelections[key].selections];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
// if fragment has selections properties then get them
|
|
106
|
-
const { selections: fragmentSelections } = fragment;
|
|
107
|
-
if (fragmentSelections !== undefined) {
|
|
108
|
-
selections = getSelections(fragmentSelections);
|
|
109
|
-
}
|
|
110
|
-
return selections;
|
|
111
|
-
}
|
|
112
|
-
function readPaginationKeysFromSelector(select) {
|
|
113
|
-
if (select === undefined) {
|
|
114
|
-
return [];
|
|
115
|
-
}
|
|
116
|
-
const selections = getSelectionsFromFragment(select.node);
|
|
117
|
-
const keys$1 = create(null);
|
|
118
|
-
for (let i = 0; i < selections.length; i++) {
|
|
119
|
-
const paginationKey = selections[i][SELECTOR_PAGINATION_TOKEN];
|
|
120
|
-
if (paginationKey) {
|
|
121
|
-
keys$1[paginationKey] = true;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return keys(keys$1);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
63
|
function isStoreEntryError(storeRecord) {
|
|
128
64
|
return storeRecord.__type === 'error';
|
|
129
65
|
}
|
|
@@ -201,11 +137,6 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot) {
|
|
|
201
137
|
// we attempt to read all keys from L2 - so combine recordId with any seenRecords
|
|
202
138
|
const keysToReviveSet = assign({ [recordId]: true }, seenRecords);
|
|
203
139
|
const keysToRevive = keys(keysToReviveSet);
|
|
204
|
-
const paginationKeys = readPaginationKeysFromSelector(select);
|
|
205
|
-
for (let i = 0, len = paginationKeys.length; i < len; i++) {
|
|
206
|
-
const paginationKey = paginationKeys[i];
|
|
207
|
-
keysToRevive.push(paginationKey);
|
|
208
|
-
}
|
|
209
140
|
const canonicalKeys = keysToRevive.map((x) => baseEnvironment.storeGetCanonicalKey(x));
|
|
210
141
|
return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then((durableRecords) => {
|
|
211
142
|
const { revivedKeys, hadUnexpectedShape } = publishDurableStoreEntries(durableRecords,
|
|
@@ -713,7 +644,20 @@ function makeDurable(environment, { durableStore, instrumentation }) {
|
|
|
713
644
|
return snapshotFromMemoryIngest;
|
|
714
645
|
});
|
|
715
646
|
};
|
|
716
|
-
|
|
647
|
+
const getNotifyChangeStoreEntries = function (keys) {
|
|
648
|
+
validateNotDisposed();
|
|
649
|
+
return durableStore.getEntries(keys, DefaultDurableSegment).then((durableRecords) => {
|
|
650
|
+
const entries = {};
|
|
651
|
+
publishDurableStoreEntries(durableRecords, (key, record) => {
|
|
652
|
+
entries[key] = record;
|
|
653
|
+
}, () => { });
|
|
654
|
+
return entries;
|
|
655
|
+
});
|
|
656
|
+
};
|
|
657
|
+
environment.defaultCachePolicy = {
|
|
658
|
+
type: 'stale-while-revalidate',
|
|
659
|
+
implementation: buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER),
|
|
660
|
+
};
|
|
717
661
|
return create(environment, {
|
|
718
662
|
publishStoreMetadata: { value: publishStoreMetadata },
|
|
719
663
|
storeIngest: { value: storeIngest },
|
|
@@ -737,6 +681,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
|
|
|
737
681
|
getIngestStagingStoreMetadata: { value: getIngestStagingStoreMetadata },
|
|
738
682
|
handleSuccessResponse: { value: handleSuccessResponse },
|
|
739
683
|
handleErrorResponse: { value: handleErrorResponse },
|
|
684
|
+
getNotifyChangeStoreEntries: { value: getNotifyChangeStoreEntries },
|
|
740
685
|
});
|
|
741
686
|
}
|
|
742
687
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Luvio } from '@luvio/engine';
|
|
1
|
+
import type { Luvio } from '@luvio/engine';
|
|
2
2
|
export declare const DURABLE_STORE_ERROR = "durable-store-error";
|
|
3
3
|
export declare type InstrumentationFunction = Luvio['instrument'];
|
|
4
4
|
export declare type DurableStoreRejectionHandler = (e: any) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Store } from '@luvio/engine';
|
|
2
|
-
import { DurableStore } from '../DurableStore';
|
|
3
|
-
import { DurableStoreRejectionHandler } from './error';
|
|
1
|
+
import type { Store } from '@luvio/engine';
|
|
2
|
+
import type { DurableStore } from '../DurableStore';
|
|
3
|
+
import type { DurableStoreRejectionHandler } from './error';
|
|
4
4
|
export declare function flushStoreValuesToDurableStore(store: Store, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
|
|
2
|
-
import { DurableStore, DurableStoreEntries } from '../DurableStore';
|
|
3
|
-
import { DurableStoreRejectionHandler } from './error';
|
|
1
|
+
import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
|
|
2
|
+
import type { DurableStore, DurableStoreEntries } from '../DurableStore';
|
|
3
|
+
import type { DurableStoreRejectionHandler } from './error';
|
|
4
4
|
declare type ObjectAsSet = {
|
|
5
5
|
[key: string]: true;
|
|
6
6
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StoreRecordError } from '@luvio/engine';
|
|
1
|
+
import type { StoreRecordError } from '@luvio/engine';
|
|
2
2
|
export declare function isStoreEntryError(storeRecord: unknown): storeRecord is StoreRecordError;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CacheKeySet, Environment, RecordSource, Snapshot
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { CacheKeySet, Environment, RecordSource, Snapshot } from '@luvio/engine';
|
|
2
|
+
import { Store } from '@luvio/engine';
|
|
3
|
+
import type { DurableStore } from './DurableStore';
|
|
4
|
+
import type { InstrumentationFunction } from './makeDurable/error';
|
|
5
|
+
import type { TTLOverridesMap } from './DurableTTLStore';
|
|
5
6
|
export interface DurableEnvironment extends Environment {
|
|
6
7
|
/**
|
|
7
8
|
* Disposes the environment and detaches the durable store listener
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DurableStore } from './DurableStore';
|
|
1
|
+
import type { DurableStore } from './DurableStore';
|
|
2
2
|
export declare const TTL_DURABLE_SEGMENT = "TTL_DURABLE_SEGMENT";
|
|
3
3
|
export interface DefaultDurableTTLOverride extends DurableTTLOverride {
|
|
4
4
|
namespace: 'TTL_DEFAULT_KEY';
|
|
@@ -64,70 +64,6 @@
|
|
|
64
64
|
freeze(value);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
const SELECTOR_PAGINATION_TOKEN = 'tokenDataKey';
|
|
68
|
-
function isFragmentUnionSelection(sel) {
|
|
69
|
-
return sel.union === true;
|
|
70
|
-
}
|
|
71
|
-
function getSelections(selections) {
|
|
72
|
-
if (selections === undefined) {
|
|
73
|
-
return [];
|
|
74
|
-
}
|
|
75
|
-
let nestedSelections = [];
|
|
76
|
-
let nonNestedSelections = [];
|
|
77
|
-
// get nested selections first
|
|
78
|
-
for (let i = 0, len = selections.length; i < len; i++) {
|
|
79
|
-
const selection = selections[i];
|
|
80
|
-
if (selection.kind === 'Object') {
|
|
81
|
-
nestedSelections = [
|
|
82
|
-
...nestedSelections,
|
|
83
|
-
...getSelections(selection.selections),
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
else if (selection.kind === 'Link') {
|
|
87
|
-
nestedSelections = [
|
|
88
|
-
...nestedSelections,
|
|
89
|
-
...getSelectionsFromFragment(selection.fragment),
|
|
90
|
-
];
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
nonNestedSelections.push(selection);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return [...nestedSelections, ...nonNestedSelections];
|
|
97
|
-
}
|
|
98
|
-
function getSelectionsFromFragment(fragment) {
|
|
99
|
-
let selections = [];
|
|
100
|
-
// if union fragment then get selections from all unions
|
|
101
|
-
if (isFragmentUnionSelection(fragment)) {
|
|
102
|
-
const { unionSelections } = fragment;
|
|
103
|
-
const unionKeys = keys(unionSelections);
|
|
104
|
-
for (let i = 0, len = unionKeys.length; i < len; i++) {
|
|
105
|
-
const key = unionKeys[i];
|
|
106
|
-
selections = [...selections, ...unionSelections[key].selections];
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
// if fragment has selections properties then get them
|
|
110
|
-
const { selections: fragmentSelections } = fragment;
|
|
111
|
-
if (fragmentSelections !== undefined) {
|
|
112
|
-
selections = getSelections(fragmentSelections);
|
|
113
|
-
}
|
|
114
|
-
return selections;
|
|
115
|
-
}
|
|
116
|
-
function readPaginationKeysFromSelector(select) {
|
|
117
|
-
if (select === undefined) {
|
|
118
|
-
return [];
|
|
119
|
-
}
|
|
120
|
-
const selections = getSelectionsFromFragment(select.node);
|
|
121
|
-
const keys$1 = create(null);
|
|
122
|
-
for (let i = 0; i < selections.length; i++) {
|
|
123
|
-
const paginationKey = selections[i][SELECTOR_PAGINATION_TOKEN];
|
|
124
|
-
if (paginationKey) {
|
|
125
|
-
keys$1[paginationKey] = true;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return keys(keys$1);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
67
|
function isStoreEntryError(storeRecord) {
|
|
132
68
|
return storeRecord.__type === 'error';
|
|
133
69
|
}
|
|
@@ -205,11 +141,6 @@
|
|
|
205
141
|
// we attempt to read all keys from L2 - so combine recordId with any seenRecords
|
|
206
142
|
const keysToReviveSet = assign({ [recordId]: true }, seenRecords);
|
|
207
143
|
const keysToRevive = keys(keysToReviveSet);
|
|
208
|
-
const paginationKeys = readPaginationKeysFromSelector(select);
|
|
209
|
-
for (let i = 0, len = paginationKeys.length; i < len; i++) {
|
|
210
|
-
const paginationKey = paginationKeys[i];
|
|
211
|
-
keysToRevive.push(paginationKey);
|
|
212
|
-
}
|
|
213
144
|
const canonicalKeys = keysToRevive.map((x) => baseEnvironment.storeGetCanonicalKey(x));
|
|
214
145
|
return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then((durableRecords) => {
|
|
215
146
|
const { revivedKeys, hadUnexpectedShape } = publishDurableStoreEntries(durableRecords,
|
|
@@ -717,7 +648,20 @@
|
|
|
717
648
|
return snapshotFromMemoryIngest;
|
|
718
649
|
});
|
|
719
650
|
};
|
|
720
|
-
|
|
651
|
+
const getNotifyChangeStoreEntries = function (keys) {
|
|
652
|
+
validateNotDisposed();
|
|
653
|
+
return durableStore.getEntries(keys, DefaultDurableSegment).then((durableRecords) => {
|
|
654
|
+
const entries = {};
|
|
655
|
+
publishDurableStoreEntries(durableRecords, (key, record) => {
|
|
656
|
+
entries[key] = record;
|
|
657
|
+
}, () => { });
|
|
658
|
+
return entries;
|
|
659
|
+
});
|
|
660
|
+
};
|
|
661
|
+
environment.defaultCachePolicy = {
|
|
662
|
+
type: 'stale-while-revalidate',
|
|
663
|
+
implementation: engine.buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER),
|
|
664
|
+
};
|
|
721
665
|
return create(environment, {
|
|
722
666
|
publishStoreMetadata: { value: publishStoreMetadata },
|
|
723
667
|
storeIngest: { value: storeIngest },
|
|
@@ -741,6 +685,7 @@
|
|
|
741
685
|
getIngestStagingStoreMetadata: { value: getIngestStagingStoreMetadata },
|
|
742
686
|
handleSuccessResponse: { value: handleSuccessResponse },
|
|
743
687
|
handleErrorResponse: { value: handleErrorResponse },
|
|
688
|
+
getNotifyChangeStoreEntries: { value: getNotifyChangeStoreEntries },
|
|
744
689
|
});
|
|
745
690
|
}
|
|
746
691
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Luvio } from '@luvio/engine';
|
|
1
|
+
import type { Luvio } from '@luvio/engine';
|
|
2
2
|
export declare const DURABLE_STORE_ERROR = "durable-store-error";
|
|
3
3
|
export declare type InstrumentationFunction = Luvio['instrument'];
|
|
4
4
|
export declare type DurableStoreRejectionHandler = (e: any) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Store } from '@luvio/engine';
|
|
2
|
-
import { DurableStore } from '../DurableStore';
|
|
3
|
-
import { DurableStoreRejectionHandler } from './error';
|
|
1
|
+
import type { Store } from '@luvio/engine';
|
|
2
|
+
import type { DurableStore } from '../DurableStore';
|
|
3
|
+
import type { DurableStoreRejectionHandler } from './error';
|
|
4
4
|
export declare function flushStoreValuesToDurableStore(store: Store, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
|
|
2
|
-
import { DurableStore, DurableStoreEntries } from '../DurableStore';
|
|
3
|
-
import { DurableStoreRejectionHandler } from './error';
|
|
1
|
+
import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
|
|
2
|
+
import type { DurableStore, DurableStoreEntries } from '../DurableStore';
|
|
3
|
+
import type { DurableStoreRejectionHandler } from './error';
|
|
4
4
|
declare type ObjectAsSet = {
|
|
5
5
|
[key: string]: true;
|
|
6
6
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StoreRecordError } from '@luvio/engine';
|
|
1
|
+
import type { StoreRecordError } from '@luvio/engine';
|
|
2
2
|
export declare function isStoreEntryError(storeRecord: unknown): storeRecord is StoreRecordError;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CacheKeySet, Environment, RecordSource, Snapshot
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { CacheKeySet, Environment, RecordSource, Snapshot } from '@luvio/engine';
|
|
2
|
+
import { Store } from '@luvio/engine';
|
|
3
|
+
import type { DurableStore } from './DurableStore';
|
|
4
|
+
import type { InstrumentationFunction } from './makeDurable/error';
|
|
5
|
+
import type { TTLOverridesMap } from './DurableTTLStore';
|
|
5
6
|
export interface DurableEnvironment extends Environment {
|
|
6
7
|
/**
|
|
7
8
|
* Disposes the environment and detaches the durable store listener
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DurableStore } from './DurableStore';
|
|
1
|
+
import type { DurableStore } from './DurableStore';
|
|
2
2
|
export declare const TTL_DURABLE_SEGMENT = "TTL_DURABLE_SEGMENT";
|
|
3
3
|
export interface DefaultDurableTTLOverride extends DurableTTLOverride {
|
|
4
4
|
namespace: 'TTL_DEFAULT_KEY';
|
|
@@ -101,64 +101,6 @@
|
|
|
101
101
|
freeze(value);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
var SELECTOR_PAGINATION_TOKEN = 'tokenDataKey';
|
|
105
|
-
function isFragmentUnionSelection(sel) {
|
|
106
|
-
return sel.union === true;
|
|
107
|
-
}
|
|
108
|
-
function getSelections(selections) {
|
|
109
|
-
if (selections === undefined) {
|
|
110
|
-
return [];
|
|
111
|
-
}
|
|
112
|
-
var nestedSelections = [];
|
|
113
|
-
var nonNestedSelections = [];
|
|
114
|
-
// get nested selections first
|
|
115
|
-
for (var i = 0, len = selections.length; i < len; i++) {
|
|
116
|
-
var selection = selections[i];
|
|
117
|
-
if (selection.kind === 'Object') {
|
|
118
|
-
nestedSelections = __spreadArray(__spreadArray([], nestedSelections, true), getSelections(selection.selections), true);
|
|
119
|
-
}
|
|
120
|
-
else if (selection.kind === 'Link') {
|
|
121
|
-
nestedSelections = __spreadArray(__spreadArray([], nestedSelections, true), getSelectionsFromFragment(selection.fragment), true);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
nonNestedSelections.push(selection);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return __spreadArray(__spreadArray([], nestedSelections, true), nonNestedSelections, true);
|
|
128
|
-
}
|
|
129
|
-
function getSelectionsFromFragment(fragment) {
|
|
130
|
-
var selections = [];
|
|
131
|
-
// if union fragment then get selections from all unions
|
|
132
|
-
if (isFragmentUnionSelection(fragment)) {
|
|
133
|
-
var unionSelections = fragment.unionSelections;
|
|
134
|
-
var unionKeys = keys(unionSelections);
|
|
135
|
-
for (var i = 0, len = unionKeys.length; i < len; i++) {
|
|
136
|
-
var key = unionKeys[i];
|
|
137
|
-
selections = __spreadArray(__spreadArray([], selections, true), unionSelections[key].selections, true);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// if fragment has selections properties then get them
|
|
141
|
-
var fragmentSelections = fragment.selections;
|
|
142
|
-
if (fragmentSelections !== undefined) {
|
|
143
|
-
selections = getSelections(fragmentSelections);
|
|
144
|
-
}
|
|
145
|
-
return selections;
|
|
146
|
-
}
|
|
147
|
-
function readPaginationKeysFromSelector(select) {
|
|
148
|
-
if (select === undefined) {
|
|
149
|
-
return [];
|
|
150
|
-
}
|
|
151
|
-
var selections = getSelectionsFromFragment(select.node);
|
|
152
|
-
var keys$1 = create(null);
|
|
153
|
-
for (var i = 0; i < selections.length; i++) {
|
|
154
|
-
var paginationKey = selections[i][SELECTOR_PAGINATION_TOKEN];
|
|
155
|
-
if (paginationKey) {
|
|
156
|
-
keys$1[paginationKey] = true;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return keys(keys$1);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
104
|
function isStoreEntryError(storeRecord) {
|
|
163
105
|
return storeRecord.__type === 'error';
|
|
164
106
|
}
|
|
@@ -237,11 +179,6 @@
|
|
|
237
179
|
// we attempt to read all keys from L2 - so combine recordId with any seenRecords
|
|
238
180
|
var keysToReviveSet = assign((_a = {}, _a[recordId] = true, _a), seenRecords);
|
|
239
181
|
var keysToRevive = keys(keysToReviveSet);
|
|
240
|
-
var paginationKeys = readPaginationKeysFromSelector(select);
|
|
241
|
-
for (var i = 0, len = paginationKeys.length; i < len; i++) {
|
|
242
|
-
var paginationKey = paginationKeys[i];
|
|
243
|
-
keysToRevive.push(paginationKey);
|
|
244
|
-
}
|
|
245
182
|
var canonicalKeys = keysToRevive.map(function (x) { return baseEnvironment.storeGetCanonicalKey(x); });
|
|
246
183
|
return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then(function (durableRecords) {
|
|
247
184
|
var _a;
|
|
@@ -756,7 +693,20 @@
|
|
|
756
693
|
return snapshotFromMemoryIngest;
|
|
757
694
|
});
|
|
758
695
|
};
|
|
759
|
-
|
|
696
|
+
var getNotifyChangeStoreEntries = function (keys) {
|
|
697
|
+
validateNotDisposed();
|
|
698
|
+
return durableStore.getEntries(keys, DefaultDurableSegment).then(function (durableRecords) {
|
|
699
|
+
var entries = {};
|
|
700
|
+
publishDurableStoreEntries(durableRecords, function (key, record) {
|
|
701
|
+
entries[key] = record;
|
|
702
|
+
}, function () { });
|
|
703
|
+
return entries;
|
|
704
|
+
});
|
|
705
|
+
};
|
|
706
|
+
environment.defaultCachePolicy = {
|
|
707
|
+
type: 'stale-while-revalidate',
|
|
708
|
+
implementation: engine.buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER),
|
|
709
|
+
};
|
|
760
710
|
return create(environment, {
|
|
761
711
|
publishStoreMetadata: { value: publishStoreMetadata },
|
|
762
712
|
storeIngest: { value: storeIngest },
|
|
@@ -780,6 +730,7 @@
|
|
|
780
730
|
getIngestStagingStoreMetadata: { value: getIngestStagingStoreMetadata },
|
|
781
731
|
handleSuccessResponse: { value: handleSuccessResponse },
|
|
782
732
|
handleErrorResponse: { value: handleErrorResponse },
|
|
733
|
+
getNotifyChangeStoreEntries: { value: getNotifyChangeStoreEntries },
|
|
783
734
|
});
|
|
784
735
|
}
|
|
785
736
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Luvio } from '@luvio/engine';
|
|
1
|
+
import type { Luvio } from '@luvio/engine';
|
|
2
2
|
export declare const DURABLE_STORE_ERROR = "durable-store-error";
|
|
3
3
|
export declare type InstrumentationFunction = Luvio['instrument'];
|
|
4
4
|
export declare type DurableStoreRejectionHandler = (e: any) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Store } from '@luvio/engine';
|
|
2
|
-
import { DurableStore } from '../DurableStore';
|
|
3
|
-
import { DurableStoreRejectionHandler } from './error';
|
|
1
|
+
import type { Store } from '@luvio/engine';
|
|
2
|
+
import type { DurableStore } from '../DurableStore';
|
|
3
|
+
import type { DurableStoreRejectionHandler } from './error';
|
|
4
4
|
export declare function flushStoreValuesToDurableStore(store: Store, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
|
|
2
|
-
import { DurableStore, DurableStoreEntries } from '../DurableStore';
|
|
3
|
-
import { DurableStoreRejectionHandler } from './error';
|
|
1
|
+
import type { Environment, Snapshot, UnAvailableSnapshot, StoreMetadata } from '@luvio/engine';
|
|
2
|
+
import type { DurableStore, DurableStoreEntries } from '../DurableStore';
|
|
3
|
+
import type { DurableStoreRejectionHandler } from './error';
|
|
4
4
|
declare type ObjectAsSet = {
|
|
5
5
|
[key: string]: true;
|
|
6
6
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StoreRecordError } from '@luvio/engine';
|
|
1
|
+
import type { StoreRecordError } from '@luvio/engine';
|
|
2
2
|
export declare function isStoreEntryError(storeRecord: unknown): storeRecord is StoreRecordError;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CacheKeySet, Environment, RecordSource, Snapshot
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { CacheKeySet, Environment, RecordSource, Snapshot } from '@luvio/engine';
|
|
2
|
+
import { Store } from '@luvio/engine';
|
|
3
|
+
import type { DurableStore } from './DurableStore';
|
|
4
|
+
import type { InstrumentationFunction } from './makeDurable/error';
|
|
5
|
+
import type { TTLOverridesMap } from './DurableTTLStore';
|
|
5
6
|
export interface DurableEnvironment extends Environment {
|
|
6
7
|
/**
|
|
7
8
|
* Disposes the environment and detaches the durable store listener
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/environments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.74.0",
|
|
4
4
|
"description": "Luvio Environments",
|
|
5
5
|
"main": "dist/umd/es2018/environments.js",
|
|
6
6
|
"module": "dist/es/es2018/environments.js",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"build": "rollup --config rollup.config.js",
|
|
12
12
|
"watch": "yarn build --watch",
|
|
13
13
|
"test": "jest",
|
|
14
|
-
"test:debug": "node --inspect-brk ../../../node_modules/jest/bin/jest.js --config ./jest.config.js --runInBand"
|
|
14
|
+
"test:debug": "node --inspect-brk ../../../node_modules/jest/bin/jest.js --config ./jest.config.js --runInBand",
|
|
15
|
+
"test:size": "bundlesize"
|
|
15
16
|
},
|
|
16
17
|
"nx": {
|
|
17
18
|
"targets": {
|
|
@@ -26,6 +27,13 @@
|
|
|
26
27
|
"dist/"
|
|
27
28
|
],
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@luvio/engine": "0.
|
|
30
|
-
}
|
|
30
|
+
"@luvio/engine": "0.74.0"
|
|
31
|
+
},
|
|
32
|
+
"bundlesize": [
|
|
33
|
+
{
|
|
34
|
+
"path": "./dist/es/es2018/environments.js",
|
|
35
|
+
"maxSize": "9 kB",
|
|
36
|
+
"compression": "brotli"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
31
39
|
}
|