@luvio/environments 0.70.0 → 0.73.1
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/DurableStore.d.ts +0 -1
- package/dist/es/es2018/environments.js +165 -168
- package/dist/es/es2018/makeDurable/cachepolicies/utils.d.ts +3 -2
- package/dist/umd/es2018/DurableStore.d.ts +0 -1
- package/dist/umd/es2018/environments.js +165 -168
- package/dist/umd/es2018/makeDurable/cachepolicies/utils.d.ts +3 -2
- package/dist/umd/es5/DurableStore.d.ts +0 -1
- package/dist/umd/es5/environments.js +165 -169
- package/dist/umd/es5/makeDurable/cachepolicies/utils.d.ts +3 -2
- package/package.json +2 -2
|
@@ -58,9 +58,13 @@
|
|
|
58
58
|
var isArray = Array.isArray;
|
|
59
59
|
|
|
60
60
|
function appendTTLStrategy(storeLookup, ttlStrategy) {
|
|
61
|
-
|
|
61
|
+
var returnStoreLookup = function (sel, refresh) {
|
|
62
62
|
return storeLookup(sel, refresh, ttlStrategy);
|
|
63
63
|
};
|
|
64
|
+
// append ttlStrategy to storeLookup function (in cases where custom adapter
|
|
65
|
+
// wants to perform it's own lookup)
|
|
66
|
+
returnStoreLookup.ttlStrategy = ttlStrategy;
|
|
67
|
+
return returnStoreLookup;
|
|
64
68
|
}
|
|
65
69
|
function buildNetworkSnapshot(args) {
|
|
66
70
|
var buildNetworkSnapshot = args.buildNetworkSnapshot, buildSnapshotContext = args.buildSnapshotContext, coercedAdapterRequestContext = args.coercedAdapterRequestContext;
|
|
@@ -86,102 +90,113 @@
|
|
|
86
90
|
}
|
|
87
91
|
return engine.StoreResolveResultState.Found;
|
|
88
92
|
};
|
|
93
|
+
}
|
|
94
|
+
// TODO - update userland-facing APIs to return `AvailableSnapshot` instead of `Snapshot`
|
|
95
|
+
// and then the signatures here can be updated as well
|
|
96
|
+
function buildAvailableSnapshotFromCachedSnapshotResponse(cachedSnapshot, availableSnapshotFunc) {
|
|
97
|
+
if (isPromise(cachedSnapshot)) {
|
|
98
|
+
return cachedSnapshot.then(availableSnapshotFunc);
|
|
99
|
+
}
|
|
100
|
+
return availableSnapshotFunc(cachedSnapshot);
|
|
101
|
+
}
|
|
102
|
+
function isPromise(value) {
|
|
103
|
+
if (value === undefined) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
// check for Thenable due to test frameworks using custom Promise impls
|
|
107
|
+
return value.then !== undefined;
|
|
89
108
|
}
|
|
90
109
|
|
|
91
110
|
function buildCacheAndNetworkImplementation(funcs, staleDurationSeconds) {
|
|
111
|
+
if (staleDurationSeconds === void 0) { staleDurationSeconds = 0; }
|
|
92
112
|
return function (args) {
|
|
93
113
|
funcs.validateNotDisposed();
|
|
94
|
-
var
|
|
95
|
-
var staleDurationMilliseconds = staleDurationSeconds
|
|
114
|
+
var buildCachedSnapshot = args.buildCachedSnapshot, buildNetworkSnapshot$1 = args.buildNetworkSnapshot, buildSnapshotContext = args.buildSnapshotContext, storeLookup = args.storeLookup, coercedAdapterRequestContext = args.coercedAdapterRequestContext;
|
|
115
|
+
var staleDurationMilliseconds = staleDurationSeconds * 1000;
|
|
96
116
|
var cachePolicyStoreLookup = appendTTLStrategy(storeLookup, buildTTLStrategy(staleDurationMilliseconds));
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return args
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (revivedSnapshot.state === 'Stale') {
|
|
139
|
-
// kick off network request, do not await it
|
|
140
|
-
buildNetworkSnapshot$1(buildSnapshotContext, coercedAdapterRequestContext);
|
|
141
|
-
// return the L2 cached snapshot to caller
|
|
142
|
-
return revivedSnapshot;
|
|
143
|
-
}
|
|
144
|
-
// data not found in L2 cache, go to the network
|
|
145
|
-
return buildNetworkSnapshot(args);
|
|
146
|
-
});
|
|
117
|
+
var cachedSnapshot = buildCachedSnapshot(buildSnapshotContext, cachePolicyStoreLookup);
|
|
118
|
+
return buildAvailableSnapshotFromCachedSnapshotResponse(cachedSnapshot, function (snapshot) {
|
|
119
|
+
if (snapshot !== undefined) {
|
|
120
|
+
// data found in L1 cache
|
|
121
|
+
if (snapshot.state === 'Fulfilled' ||
|
|
122
|
+
snapshot.state === 'Error' ||
|
|
123
|
+
snapshot.state === 'Stale') {
|
|
124
|
+
// kick off network request, do not await it
|
|
125
|
+
buildNetworkSnapshot$1(buildSnapshotContext, coercedAdapterRequestContext);
|
|
126
|
+
// return the cached snapshot to caller
|
|
127
|
+
return snapshot;
|
|
128
|
+
}
|
|
129
|
+
// network request outstanding
|
|
130
|
+
if (snapshot.state === 'Pending') {
|
|
131
|
+
// kick off another network request, do not await it
|
|
132
|
+
buildNetworkSnapshot$1(buildSnapshotContext, coercedAdapterRequestContext);
|
|
133
|
+
return args.resolvePendingSnapshot(snapshot);
|
|
134
|
+
}
|
|
135
|
+
// if unfulfilled we have enough info to do an L2 lookup
|
|
136
|
+
if (snapshot.state === 'Unfulfilled') {
|
|
137
|
+
return funcs
|
|
138
|
+
.reviveSnapshotWithCachePolicy(snapshot, cachePolicyStoreLookup)
|
|
139
|
+
.then(function (revivedSnapshot) {
|
|
140
|
+
// data found in L2 cache
|
|
141
|
+
if (revivedSnapshot.state === 'Fulfilled' ||
|
|
142
|
+
revivedSnapshot.state === 'Error' ||
|
|
143
|
+
revivedSnapshot.state === 'Stale') {
|
|
144
|
+
// kick off network request, do not await it
|
|
145
|
+
buildNetworkSnapshot$1(buildSnapshotContext, coercedAdapterRequestContext);
|
|
146
|
+
// return the L2 cached snapshot to caller
|
|
147
|
+
return revivedSnapshot;
|
|
148
|
+
}
|
|
149
|
+
if (revivedSnapshot.state === 'Pending') {
|
|
150
|
+
// kick off network request, do not await it
|
|
151
|
+
buildNetworkSnapshot$1(buildSnapshotContext, coercedAdapterRequestContext);
|
|
152
|
+
return args.resolvePendingSnapshot(revivedSnapshot);
|
|
153
|
+
}
|
|
154
|
+
// data not found in L2 cache, go to the network
|
|
155
|
+
return buildNetworkSnapshot(args);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
147
158
|
}
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
return buildNetworkSnapshot(args);
|
|
160
|
+
});
|
|
150
161
|
};
|
|
151
162
|
}
|
|
152
163
|
|
|
153
164
|
function buildCacheThenNetworkImplementation(funcs) {
|
|
154
165
|
return function (args) {
|
|
155
166
|
funcs.validateNotDisposed();
|
|
156
|
-
var
|
|
167
|
+
var buildCachedSnapshot = args.buildCachedSnapshot, buildSnapshotContext = args.buildSnapshotContext, storeLookup = args.storeLookup;
|
|
157
168
|
var cachePolicyStoreLookup = appendTTLStrategy(storeLookup, buildTTLStrategy());
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (snapshot.state === 'Pending') {
|
|
165
|
-
return args.resolvePendingSnapshot(snapshot);
|
|
166
|
-
}
|
|
167
|
-
// data not found in L1 cache, try L2 cache
|
|
168
|
-
return funcs
|
|
169
|
-
.reviveSnapshotWithCachePolicy(snapshot, cachePolicyStoreLookup)
|
|
170
|
-
.then(function (revivedSnapshot) {
|
|
171
|
-
// data found in L2 cache
|
|
172
|
-
if (revivedSnapshot.state === 'Fulfilled' ||
|
|
173
|
-
revivedSnapshot.state === 'Error') {
|
|
174
|
-
return revivedSnapshot;
|
|
169
|
+
var cachedSnapshot = buildCachedSnapshot(buildSnapshotContext, cachePolicyStoreLookup);
|
|
170
|
+
return buildAvailableSnapshotFromCachedSnapshotResponse(cachedSnapshot, function (snapshot) {
|
|
171
|
+
if (snapshot !== undefined) {
|
|
172
|
+
// data found in L1 cache
|
|
173
|
+
if (snapshot.state === 'Fulfilled' || snapshot.state === 'Error') {
|
|
174
|
+
return snapshot;
|
|
175
175
|
}
|
|
176
|
-
if (
|
|
177
|
-
return args.resolvePendingSnapshot(
|
|
176
|
+
if (snapshot.state === 'Pending') {
|
|
177
|
+
return args.resolvePendingSnapshot(snapshot);
|
|
178
178
|
}
|
|
179
|
-
//
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
179
|
+
// if unfulfilled we have enough info to do an L2 lookup
|
|
180
|
+
if (snapshot.state === 'Unfulfilled') {
|
|
181
|
+
return funcs
|
|
182
|
+
.reviveSnapshotWithCachePolicy(snapshot, cachePolicyStoreLookup)
|
|
183
|
+
.then(function (revivedSnapshot) {
|
|
184
|
+
// data found in L2 cache
|
|
185
|
+
if (revivedSnapshot.state === 'Fulfilled' ||
|
|
186
|
+
revivedSnapshot.state === 'Error') {
|
|
187
|
+
return revivedSnapshot;
|
|
188
|
+
}
|
|
189
|
+
if (revivedSnapshot.state === 'Pending') {
|
|
190
|
+
return args.resolvePendingSnapshot(revivedSnapshot);
|
|
191
|
+
}
|
|
192
|
+
// data not found in L2 cache, go to the network
|
|
193
|
+
return buildNetworkSnapshot(args);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// L1 lookup could not find enough information to even construct a snapshot, go to the network
|
|
198
|
+
return buildNetworkSnapshot(args);
|
|
199
|
+
});
|
|
185
200
|
};
|
|
186
201
|
}
|
|
187
202
|
|
|
@@ -225,84 +240,90 @@
|
|
|
225
240
|
error: error,
|
|
226
241
|
state: 'Error',
|
|
227
242
|
data: undefined,
|
|
228
|
-
// TODO[@W-10164067]: copy refresh data from the snapshot returned by
|
|
243
|
+
// TODO[@W-10164067]: copy refresh data from the snapshot returned by buildCachedSnapshot (if any)
|
|
229
244
|
// refresh: ...
|
|
230
245
|
};
|
|
231
246
|
}
|
|
232
247
|
function buildOnlyIfCachedImplementation(funcs) {
|
|
233
248
|
return function (args) {
|
|
234
249
|
funcs.validateNotDisposed();
|
|
235
|
-
var
|
|
250
|
+
var buildCachedSnapshot = args.buildCachedSnapshot, buildSnapshotContext = args.buildSnapshotContext, storeLookup = args.storeLookup;
|
|
236
251
|
var cachePolicyStoreLookup = appendTTLStrategy(storeLookup, buildTTLStrategy());
|
|
237
|
-
var
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// network request outstanding, data is not cached
|
|
244
|
-
if (snapshot.state === 'Pending') {
|
|
245
|
-
return buildNotCachedErrorSnapshot();
|
|
246
|
-
}
|
|
247
|
-
// data not found in L1 cache, try L2 cache
|
|
248
|
-
return funcs
|
|
249
|
-
.reviveSnapshotWithCachePolicy(snapshot, cachePolicyStoreLookup)
|
|
250
|
-
.then(function (revivedSnapshot) {
|
|
251
|
-
// data found in L2 cache
|
|
252
|
-
if (revivedSnapshot.state === 'Fulfilled' ||
|
|
253
|
-
revivedSnapshot.state === 'Error') {
|
|
254
|
-
return revivedSnapshot;
|
|
252
|
+
var cachedSnapshot = buildCachedSnapshot(buildSnapshotContext, cachePolicyStoreLookup);
|
|
253
|
+
return buildAvailableSnapshotFromCachedSnapshotResponse(cachedSnapshot, function (snapshot) {
|
|
254
|
+
if (snapshot !== undefined) {
|
|
255
|
+
// data found in L1 cache
|
|
256
|
+
if (snapshot.state === 'Fulfilled' || snapshot.state === 'Error') {
|
|
257
|
+
return snapshot;
|
|
255
258
|
}
|
|
256
|
-
// data is not cached
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
// network request outstanding, data is not cached
|
|
260
|
+
if (snapshot.state === 'Pending') {
|
|
261
|
+
return buildNotCachedErrorSnapshot();
|
|
262
|
+
}
|
|
263
|
+
// if unfulfilled we have enough info to do an L2 lookup
|
|
264
|
+
if (snapshot.state === 'Unfulfilled') {
|
|
265
|
+
return funcs
|
|
266
|
+
.reviveSnapshotWithCachePolicy(snapshot, cachePolicyStoreLookup)
|
|
267
|
+
.then(function (revivedSnapshot) {
|
|
268
|
+
// data found in L2 cache
|
|
269
|
+
if (revivedSnapshot.state === 'Fulfilled' ||
|
|
270
|
+
revivedSnapshot.state === 'Error') {
|
|
271
|
+
return revivedSnapshot;
|
|
272
|
+
}
|
|
273
|
+
// data is not cached
|
|
274
|
+
return buildNotCachedErrorSnapshot();
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return buildNotCachedErrorSnapshot();
|
|
279
|
+
});
|
|
261
280
|
};
|
|
262
281
|
}
|
|
263
282
|
|
|
264
283
|
function buildStaleWhileRevalidateImplementation(funcs, staleDurationSeconds) {
|
|
265
284
|
return function (args) {
|
|
266
285
|
funcs.validateNotDisposed();
|
|
267
|
-
var
|
|
286
|
+
var buildCachedSnapshot = args.buildCachedSnapshot, buildSnapshotContext = args.buildSnapshotContext, storeLookup = args.storeLookup;
|
|
268
287
|
var cachePolicyStoreLookup = appendTTLStrategy(storeLookup, buildTTLStrategy(staleDurationSeconds * 1000));
|
|
269
|
-
var
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
if (snapshot.state === 'Pending') {
|
|
276
|
-
return args.resolvePendingSnapshot(snapshot);
|
|
277
|
-
}
|
|
278
|
-
// stale data found in L1 cache
|
|
279
|
-
if (snapshot.state === 'Stale') {
|
|
280
|
-
buildNetworkSnapshot(args);
|
|
281
|
-
return snapshot;
|
|
282
|
-
}
|
|
283
|
-
// data not found in L1 cache, try L2 cache
|
|
284
|
-
return funcs
|
|
285
|
-
.reviveSnapshotWithCachePolicy(snapshot, cachePolicyStoreLookup)
|
|
286
|
-
.then(function (revivedSnapshot) {
|
|
287
|
-
// data found in L2 cache
|
|
288
|
-
if (revivedSnapshot.state === 'Fulfilled' ||
|
|
289
|
-
revivedSnapshot.state === 'Error') {
|
|
290
|
-
return revivedSnapshot;
|
|
288
|
+
var cachedSnapshot = buildCachedSnapshot(buildSnapshotContext, cachePolicyStoreLookup);
|
|
289
|
+
return buildAvailableSnapshotFromCachedSnapshotResponse(cachedSnapshot, function (snapshot) {
|
|
290
|
+
if (snapshot !== undefined) {
|
|
291
|
+
// data found in L1 cache
|
|
292
|
+
if (snapshot.state === 'Fulfilled' || snapshot.state === 'Error') {
|
|
293
|
+
return snapshot;
|
|
291
294
|
}
|
|
292
|
-
if (
|
|
293
|
-
return args.resolvePendingSnapshot(
|
|
295
|
+
if (snapshot.state === 'Pending') {
|
|
296
|
+
return args.resolvePendingSnapshot(snapshot);
|
|
294
297
|
}
|
|
295
|
-
// stale data found in
|
|
296
|
-
if (
|
|
298
|
+
// stale data found in L1 cache
|
|
299
|
+
if (snapshot.state === 'Stale') {
|
|
297
300
|
buildNetworkSnapshot(args);
|
|
298
|
-
return
|
|
301
|
+
return snapshot;
|
|
299
302
|
}
|
|
300
|
-
// data not found in
|
|
301
|
-
return
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
// data not found in L1 cache, try L2 cache
|
|
304
|
+
return funcs
|
|
305
|
+
.reviveSnapshotWithCachePolicy(snapshot, cachePolicyStoreLookup)
|
|
306
|
+
.then(function (revivedSnapshot) {
|
|
307
|
+
// data found in L2 cache
|
|
308
|
+
if (revivedSnapshot.state === 'Fulfilled' ||
|
|
309
|
+
revivedSnapshot.state === 'Error') {
|
|
310
|
+
return revivedSnapshot;
|
|
311
|
+
}
|
|
312
|
+
if (revivedSnapshot.state === 'Pending') {
|
|
313
|
+
return args.resolvePendingSnapshot(revivedSnapshot);
|
|
314
|
+
}
|
|
315
|
+
// stale data found in L2 cache
|
|
316
|
+
if (revivedSnapshot.state === 'Stale') {
|
|
317
|
+
buildNetworkSnapshot(args);
|
|
318
|
+
return revivedSnapshot;
|
|
319
|
+
}
|
|
320
|
+
// data not found in L2 cache, go to the network
|
|
321
|
+
return buildNetworkSnapshot(args);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
// L1 lookup could not find enough information to even construct a snapshot, go to the network
|
|
325
|
+
return buildNetworkSnapshot(args);
|
|
326
|
+
});
|
|
306
327
|
};
|
|
307
328
|
}
|
|
308
329
|
|
|
@@ -313,7 +334,7 @@
|
|
|
313
334
|
// TTLStrategy to use the the valid-at cache policy's timestamp. The flow goes:
|
|
314
335
|
//
|
|
315
336
|
// Environment.applyCachePolicy => validAtImplementation (this function) =>
|
|
316
|
-
// basePolicyImplementation => adapter's
|
|
337
|
+
// basePolicyImplementation => adapter's buildCachedSnapshot =>
|
|
317
338
|
// basePolicyImplementation's storeLookup => validAtStoreLookup (below) =>
|
|
318
339
|
// Environment.applyCachePolicy's storeLookup => Store/Reader code =>
|
|
319
340
|
// valid-at TTLStrategy (below) =>
|
|
@@ -854,7 +875,7 @@
|
|
|
854
875
|
if (ingestStagingStore !== null) {
|
|
855
876
|
return ingestStagingStore.lookup(sel, createSnapshot, refresh, ttlStrategy);
|
|
856
877
|
}
|
|
857
|
-
// otherwise this is from
|
|
878
|
+
// otherwise this is from buildCachedSnapshot and we should use the luvio
|
|
858
879
|
// L1 store
|
|
859
880
|
return environment.storeLookup(sel, createSnapshot, refresh, ttlStrategy);
|
|
860
881
|
};
|
|
@@ -879,30 +900,6 @@
|
|
|
879
900
|
}
|
|
880
901
|
return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
|
|
881
902
|
};
|
|
882
|
-
var resolveSnapshot = function (snapshot, refresh) {
|
|
883
|
-
validateNotDisposed();
|
|
884
|
-
// if the snapshot is already pending then no need to kick off another
|
|
885
|
-
// revive, just wait for the pending refresh to broadcast
|
|
886
|
-
if (snapshot.state === 'Pending') {
|
|
887
|
-
return environment.resolvePendingSnapshot(snapshot);
|
|
888
|
-
}
|
|
889
|
-
var resolve = refresh.resolve, config = refresh.config;
|
|
890
|
-
var refreshFunc = function () { return resolve(config); };
|
|
891
|
-
// if the snapshot is unfulfilled we can do an L2 lookup
|
|
892
|
-
if (snapshot.state === 'Unfulfilled') {
|
|
893
|
-
return reviveSnapshot(environment, durableStore, snapshot, durableStoreErrorHandler, function () {
|
|
894
|
-
return environment.storeLookup(snapshot.select, environment.createSnapshot, snapshot.refresh);
|
|
895
|
-
}).then(function (durableSnapshot) {
|
|
896
|
-
if (environment.snapshotAvailable(durableSnapshot)) {
|
|
897
|
-
// L2 cache hit
|
|
898
|
-
return durableSnapshot;
|
|
899
|
-
}
|
|
900
|
-
// else have to hit network
|
|
901
|
-
return refreshFunc();
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
return refreshFunc();
|
|
905
|
-
};
|
|
906
903
|
var rebuildSnapshot = function (snapshot, records, storeMetadataMap, redirects, onAsyncRebuild) {
|
|
907
904
|
validateNotDisposed();
|
|
908
905
|
// try rebuilding from memory
|
|
@@ -1018,7 +1015,7 @@
|
|
|
1018
1015
|
}
|
|
1019
1016
|
}
|
|
1020
1017
|
}
|
|
1021
|
-
var applyCachePolicy = function (adapterRequestContext, buildSnapshotContext,
|
|
1018
|
+
var applyCachePolicy = function (adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot) {
|
|
1022
1019
|
validateNotDisposed();
|
|
1023
1020
|
var cachePolicy = adapterRequestContext.cachePolicy;
|
|
1024
1021
|
var cachePolicyImpl = resolveCachePolicy(cachePolicy);
|
|
@@ -1028,7 +1025,7 @@
|
|
|
1028
1025
|
var storeLookup = function (sel, refresh, ttlStrategy) { return environment.storeLookup(sel, environment.createSnapshot, refresh, ttlStrategy); };
|
|
1029
1026
|
var applyCachePolicy = function () {
|
|
1030
1027
|
return cachePolicyImpl({
|
|
1031
|
-
|
|
1028
|
+
buildCachedSnapshot: buildCachedSnapshot,
|
|
1032
1029
|
buildNetworkSnapshot: buildNetworkSnapshot,
|
|
1033
1030
|
buildSnapshotContext: buildSnapshotContext,
|
|
1034
1031
|
resolvePendingSnapshot: resolvePendingSnapshot,
|
|
@@ -1081,7 +1078,6 @@
|
|
|
1081
1078
|
storeEvict: { value: storeEvict },
|
|
1082
1079
|
wrapNormalizedGraphNode: { value: wrapNormalizedGraphNode },
|
|
1083
1080
|
getNode: { value: getNode },
|
|
1084
|
-
resolveSnapshot: { value: resolveSnapshot },
|
|
1085
1081
|
rebuildSnapshot: { value: rebuildSnapshot },
|
|
1086
1082
|
withContext: { value: withContext },
|
|
1087
1083
|
storeSetTTLOverride: { value: storeSetTTLOverride },
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuildCachedSnapshot, CachePolicyImplementationArgs, Snapshot, StoreLookup, TTLStrategy, UnAvailableSnapshot } from '@luvio/engine';
|
|
2
2
|
export declare type DurableCachePolicyFunctions = {
|
|
3
3
|
validateNotDisposed: () => void;
|
|
4
4
|
reviveSnapshotWithCachePolicy: <D, V>(unavailableSnapshot: UnAvailableSnapshot<D, V>, storeLookup: StoreLookup<D, V>) => Promise<Snapshot<D, V>>;
|
|
5
5
|
};
|
|
6
|
-
export declare function appendTTLStrategy<C, D>(storeLookup: CachePolicyImplementationArgs<C, D>['storeLookup'], ttlStrategy: TTLStrategy): Parameters<
|
|
6
|
+
export declare function appendTTLStrategy<C, D>(storeLookup: CachePolicyImplementationArgs<C, D>['storeLookup'], ttlStrategy: TTLStrategy): Parameters<BuildCachedSnapshot<C, D>>[1];
|
|
7
7
|
export declare function buildNetworkSnapshot<C, D>(args: CachePolicyImplementationArgs<C, D>): Promise<Snapshot<D, unknown>>;
|
|
8
8
|
export declare function buildTTLStrategy(staleDurationMilliseconds?: number): TTLStrategy;
|
|
9
|
+
export declare function buildAvailableSnapshotFromCachedSnapshotResponse<C, D>(cachedSnapshot: ReturnType<BuildCachedSnapshot<C, D>>, availableSnapshotFunc: (snapshot: Snapshot<D> | undefined) => Snapshot<D> | Promise<Snapshot<D>>): Snapshot<D> | Promise<Snapshot<D>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/environments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.73.1",
|
|
4
4
|
"description": "Luvio Environments",
|
|
5
5
|
"main": "dist/umd/es2018/environments.js",
|
|
6
6
|
"module": "dist/es/es2018/environments.js",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"dist/"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@luvio/engine": "0.
|
|
29
|
+
"@luvio/engine": "0.73.1"
|
|
30
30
|
}
|
|
31
31
|
}
|