@contello/store 4.5.0 → 4.5.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/fragments.d.ts +0 -2
- package/dist/fragments.d.ts.map +1 -1
- package/dist/fragments.js +1 -2
- package/dist/index.cjs +75 -57
- package/dist/index.d.cts +0 -22
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +0 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +75 -57
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ConnectionEvents, ContelloClient, DownloadResult, ProxyResult, Schema, SourceCardinality, SourceDef, UploadData, UploadMetadata, UploadOptions } from "@contello/client";
|
|
2
2
|
import "@entwico/dash/async";
|
|
3
3
|
import { MaybePromise, ReadonlyDeep } from "@entwico/dash";
|
|
4
|
-
//#region src/routes-mapping.d.ts
|
|
5
4
|
type StoreRouteCustomHeader = {
|
|
6
5
|
name: string;
|
|
7
6
|
value: string;
|
|
@@ -33,8 +32,6 @@ type StoreRoute = {
|
|
|
33
32
|
type: 'sitemap';
|
|
34
33
|
sitemapId: string;
|
|
35
34
|
});
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/watcher.d.ts
|
|
38
35
|
type UpdateEvent<TEntityType extends string = string> = {
|
|
39
36
|
id: string;
|
|
40
37
|
mutation: 'create';
|
|
@@ -79,8 +76,6 @@ type UpdateBatch = {
|
|
|
79
76
|
/** route events grouped by target entity model (both after and before targets for updates) */
|
|
80
77
|
readonly routeByEntityModel: Map<string, UpdateEventFor<'route'>[]>;
|
|
81
78
|
};
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/dependency-collector.d.ts
|
|
84
79
|
/**
|
|
85
80
|
* passed to `map()` so the mapper can declare which external entities this item depends on.
|
|
86
81
|
* calls are collected during mapping and indexed once the item key is known.
|
|
@@ -104,8 +99,6 @@ type MapperContext<TModels extends string = string> = {
|
|
|
104
99
|
trackAsset(id: string): void;
|
|
105
100
|
trackRoute(id: string): void;
|
|
106
101
|
};
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/types.d.ts
|
|
109
102
|
/** Extracts the typed fragment result from a SourceDef. */
|
|
110
103
|
type ExtractSourceResult<S extends SourceDef<string, 'entity' | 'singleton'>> = NonNullable<S['__result']>;
|
|
111
104
|
/** Keys of `schema.sources` whose entries match the given cardinality. */
|
|
@@ -322,8 +315,6 @@ type LazyCollection<T> = {
|
|
|
322
315
|
refresh(): void;
|
|
323
316
|
clear(): void;
|
|
324
317
|
};
|
|
325
|
-
//#endregion
|
|
326
|
-
//#region src/lazy-assets.d.ts
|
|
327
318
|
type StoreFileMetadata = {
|
|
328
319
|
width: number;
|
|
329
320
|
height: number;
|
|
@@ -353,8 +344,6 @@ type LazyAssets = {
|
|
|
353
344
|
refresh(): void;
|
|
354
345
|
clear(): void;
|
|
355
346
|
};
|
|
356
|
-
//#endregion
|
|
357
|
-
//#region src/assets.d.ts
|
|
358
347
|
type AssetsOptions = {
|
|
359
348
|
cache?: CacheOptions | undefined;
|
|
360
349
|
onLoad?: ((ids: string[]) => void) | undefined;
|
|
@@ -389,8 +378,6 @@ type AssetsSync<TWrites = unknown> = {
|
|
|
389
378
|
proxyHls(path: string, signal?: AbortSignal | undefined): Promise<ProxyResult>;
|
|
390
379
|
refresh(): void;
|
|
391
380
|
} & CollectionWrites<StoreAsset, TWrites>;
|
|
392
|
-
//#endregion
|
|
393
|
-
//#region src/i18n.d.ts
|
|
394
381
|
type I18nTranslation = {
|
|
395
382
|
language: string;
|
|
396
383
|
value: string;
|
|
@@ -434,8 +421,6 @@ type I18nMessages = {
|
|
|
434
421
|
/** Completes refresh$ and detaches from the watcher — called by `Store.destroy()`. */
|
|
435
422
|
destroy(): void;
|
|
436
423
|
};
|
|
437
|
-
//#endregion
|
|
438
|
-
//#region src/lazy-routes.d.ts
|
|
439
424
|
type LazyRoutesOptions = {
|
|
440
425
|
cache?: LazyCacheOptions | undefined;
|
|
441
426
|
onRefresh?: ((event: RefreshEvent) => void) | undefined;
|
|
@@ -449,8 +434,6 @@ type LazyRoutes = {
|
|
|
449
434
|
refresh(): void;
|
|
450
435
|
clear(): void;
|
|
451
436
|
};
|
|
452
|
-
//#endregion
|
|
453
|
-
//#region src/routes.d.ts
|
|
454
437
|
type RoutesOptions = {
|
|
455
438
|
cache?: CacheOptions | undefined;
|
|
456
439
|
onLoad?: ((ids: string[]) => void) | undefined;
|
|
@@ -483,8 +466,6 @@ type RoutesSync<TWrites = unknown> = {
|
|
|
483
466
|
getByPath(paths: readonly string[]): ReadonlyArray<ReadonlyDeep<StoreRoute>>;
|
|
484
467
|
refresh(): void;
|
|
485
468
|
} & CollectionWrites<StoreRoute, TWrites>;
|
|
486
|
-
//#endregion
|
|
487
|
-
//#region src/store.d.ts
|
|
488
469
|
/** Project the model-reference-name union out of a Schema generic, falling back to `string`. */
|
|
489
470
|
type ModelsOf<TSchema> = TSchema extends {
|
|
490
471
|
models: infer M;
|
|
@@ -542,8 +523,6 @@ export declare class Store<TSchema extends Schema | undefined = undefined> {
|
|
|
542
523
|
defineI18nMessages(def: I18nMessageDef): I18nMessages;
|
|
543
524
|
}
|
|
544
525
|
export declare function createStore<TSchema extends Schema | undefined = undefined>(options: CreateStoreOptions<TSchema>): Store<TSchema>;
|
|
545
|
-
//#endregion
|
|
546
|
-
//#region src/route-path.d.ts
|
|
547
526
|
/**
|
|
548
527
|
* The one form a route path is stored and looked up in: percent escapes decoded and unicode
|
|
549
528
|
* composed (NFC), as core normalizes it. A request arrives percent-encoded (`/%C3%BCber-uns`),
|
|
@@ -551,6 +530,5 @@ export declare function createStore<TSchema extends Schema | undefined = undefin
|
|
|
551
530
|
* escape of a character a path cannot hold decoded stays encoded, with uppercase hex.
|
|
552
531
|
*/
|
|
553
532
|
export declare function normalizeRoutePath(path: string): string;
|
|
554
|
-
//#endregion
|
|
555
533
|
export type { Assets, AssetsOptions, AssetsSync, AssetsSyncOptions, BuiltInWrites, CacheOptions, Collection, CollectionOptions, CollectionSync, CollectionSyncOptions, CollectionWrites, CreateStoreOptions, DeleteOptions, ExtractSourceResult, ExtractSourceWrites, I18nInitialTranslation, I18nMessage, I18nMessageDef, I18nMessageRegistrationDefinition, I18nMessages, I18nTranslation, I18nVariableInput, LazyAssets, LazyAssetsOptions, LazyCacheOptions, LazyCollection, LazyCollectionOptions, LazyRoutes, LazyRoutesOptions, Loadable, MapperContext, ResolveSource, Routes, RoutesOptions, RoutesSync, RoutesSyncOptions, Singleton, SingletonOptions, SingletonSync, SingletonSyncOptions, SourceAt, SourceKeysOf, StoreAsset, StoreFile, StoreFileMetadata, StoreRoute, StoreRouteCustomHeader, SyncCacheOptions, UpdateBatch, UpdateEvent, UpdateEventFor, UpdateMutationType };
|
|
556
534
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/routes-mapping.ts","../src/watcher.ts","../src/dependency-collector.ts","../src/types.ts","../src/lazy-assets.ts","../src/assets.ts","../src/i18n.ts","../src/lazy-routes.ts","../src/routes.ts","../src/store.ts","../src/route-path.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/routes-mapping.ts","../src/watcher.ts","../src/dependency-collector.ts","../src/types.ts","../src/lazy-assets.ts","../src/assets.ts","../src/i18n.ts","../src/lazy-routes.ts","../src/routes.ts","../src/store.ts","../src/route-path.ts"],"mappings":";;;KAGY;EACV;EACA;;KAGU;EACV;EACA;EACA,eAAe;;EAEX;EAAkB;EAAkB;;EACpC;EAAc;EAAiB;;EAC/B;EAAe;EAAiB;EAAgB;EAA6C;;EAC7F;EAAgB;EAAe;EAAoB;;EACnD;EAAiB;;KCJX,YAAY;EAClB;EAAY;EAAoB;EAAiB,OAAO;;EACxD;EAAY;EAAoB;EAAiB,OAAO;EAAY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TO,mBAAmB"}
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,10 @@ import { BUILT_IN_MUTATIONS, createContelloClient, createSourceMutation, createS
|
|
|
2
2
|
import { concatAsync, createAsyncIterableSubject, firstAsync, keepalive, mapAsync, retryWithBackoff } from "@entwico/dash/async";
|
|
3
3
|
import { ProjectedLazyMap, ProjectedMap, ProjectedValue } from "@entwico/projected";
|
|
4
4
|
import { createOperationTelemetry } from "@contello/opentelemetry";
|
|
5
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
6
|
import { maybeAll, maybeThen } from "@entwico/dash";
|
|
6
7
|
import { LRUCache } from "lru-cache";
|
|
7
|
-
|
|
8
|
+
// src/generated/graphql.ts
|
|
8
9
|
const MediaAssetFragmentSchema = `fragment MediaAsset on ContelloAsset {
|
|
9
10
|
id
|
|
10
11
|
original {
|
|
@@ -217,11 +218,9 @@ const schema = {
|
|
|
217
218
|
},
|
|
218
219
|
models: { dummy: "DummyEntity" }
|
|
219
220
|
};
|
|
220
|
-
|
|
221
|
-
//#region src/telemetry.ts
|
|
221
|
+
// src/telemetry.ts
|
|
222
222
|
const { wrap } = createOperationTelemetry("@contello/store");
|
|
223
|
-
|
|
224
|
-
//#region src/utils.ts
|
|
223
|
+
// src/utils.ts
|
|
225
224
|
/**
|
|
226
225
|
* default `cache.ttl` applied across all store kinds. eager stores (collections, singletons)
|
|
227
226
|
* use it as the interval for a periodic full refresh; lazy stores use it as the per-item
|
|
@@ -237,6 +236,22 @@ function resolveTtl(ttl) {
|
|
|
237
236
|
if (ttl === false || ttl <= 0) return void 0;
|
|
238
237
|
return ttl;
|
|
239
238
|
}
|
|
239
|
+
function createRefreshRetry() {
|
|
240
|
+
const controller = new AbortController();
|
|
241
|
+
return {
|
|
242
|
+
async run(fn) {
|
|
243
|
+
try {
|
|
244
|
+
await retryWithBackoff(fn, { signal: controller.signal });
|
|
245
|
+
return true;
|
|
246
|
+
} catch {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
stop() {
|
|
251
|
+
controller.abort();
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
240
255
|
/**
|
|
241
256
|
* creates a coalescing refresh scheduler with exponential-backoff retry on failure.
|
|
242
257
|
*
|
|
@@ -245,11 +260,11 @@ function resolveTtl(ttl) {
|
|
|
245
260
|
* scheduleRefresh. once the in-flight refresh completes, at most one queued refresh
|
|
246
261
|
* starts, with that latest kind — collapsing any number of intermediate requests into one.
|
|
247
262
|
*
|
|
248
|
-
* on error, retries
|
|
263
|
+
* on error, retries with exponential backoff until `retry` is stopped. the projected value keeps serving
|
|
249
264
|
* the stale cached value throughout (SWR). the `onRefreshed` callback receives the kind that
|
|
250
265
|
* triggered the just-completed refresh.
|
|
251
266
|
*/
|
|
252
|
-
function createRefresher(fn, onRefreshed,
|
|
267
|
+
function createRefresher(fn, onRefreshed, retry) {
|
|
253
268
|
let refreshing = false;
|
|
254
269
|
let inFlightKind;
|
|
255
270
|
let pendingKind;
|
|
@@ -260,8 +275,8 @@ function createRefresher(fn, onRefreshed, onStart) {
|
|
|
260
275
|
}
|
|
261
276
|
refreshing = true;
|
|
262
277
|
inFlightKind = kind;
|
|
263
|
-
|
|
264
|
-
|
|
278
|
+
retry.run(fn).then((refreshed) => {
|
|
279
|
+
if (!refreshed) return;
|
|
265
280
|
const finished = inFlightKind;
|
|
266
281
|
refreshing = false;
|
|
267
282
|
inFlightKind = void 0;
|
|
@@ -288,17 +303,21 @@ function createRefreshChannel(onRefresh) {
|
|
|
288
303
|
};
|
|
289
304
|
}
|
|
290
305
|
function createTtlOrchestrator(options) {
|
|
306
|
+
const runInOwnContext = AsyncLocalStorage.snapshot();
|
|
291
307
|
let timer;
|
|
308
|
+
let cleared = false;
|
|
292
309
|
return {
|
|
293
310
|
mark() {
|
|
311
|
+
if (cleared) return;
|
|
294
312
|
if (timer !== void 0) {
|
|
295
313
|
clearTimeout(timer);
|
|
296
314
|
timer = void 0;
|
|
297
315
|
}
|
|
298
316
|
if (options.ttl === void 0) return;
|
|
299
|
-
timer = setTimeout(options.run, options.ttl);
|
|
317
|
+
timer = runInOwnContext(() => setTimeout(options.run, options.ttl));
|
|
300
318
|
},
|
|
301
319
|
clear() {
|
|
320
|
+
cleared = true;
|
|
302
321
|
if (timer === void 0) return;
|
|
303
322
|
clearTimeout(timer);
|
|
304
323
|
timer = void 0;
|
|
@@ -327,8 +346,7 @@ function createRefreshByTtlQueue() {
|
|
|
327
346
|
next();
|
|
328
347
|
} };
|
|
329
348
|
}
|
|
330
|
-
|
|
331
|
-
//#region src/write-buffer.ts
|
|
349
|
+
// src/write-buffer.ts
|
|
332
350
|
function createWriteBuffer() {
|
|
333
351
|
const parked = /* @__PURE__ */ new Map();
|
|
334
352
|
const awaited = /* @__PURE__ */ new Map();
|
|
@@ -373,8 +391,7 @@ function createWriteBuffer() {
|
|
|
373
391
|
}
|
|
374
392
|
};
|
|
375
393
|
}
|
|
376
|
-
|
|
377
|
-
//#region src/assets.ts
|
|
394
|
+
// src/assets.ts
|
|
378
395
|
function mapFile$1(raw) {
|
|
379
396
|
return {
|
|
380
397
|
uid: raw.uid,
|
|
@@ -400,6 +417,7 @@ function createAssetsCollection(options, client, updates$, refreshByTtl) {
|
|
|
400
417
|
eviction: opts.cache?.eviction ?? "refresh"
|
|
401
418
|
};
|
|
402
419
|
const channel = createRefreshChannel(opts.onRefresh);
|
|
420
|
+
const retry = createRefreshRetry();
|
|
403
421
|
const ttl = createTtlOrchestrator({
|
|
404
422
|
ttl: cache.ttl,
|
|
405
423
|
run: () => runFullRefresh("ttl")
|
|
@@ -443,7 +461,7 @@ function createAssetsCollection(options, client, updates$, refreshByTtl) {
|
|
|
443
461
|
});
|
|
444
462
|
}
|
|
445
463
|
function runFullRefresh(kind) {
|
|
446
|
-
refreshByTtl.enqueue(() =>
|
|
464
|
+
refreshByTtl.enqueue(() => retry.run(async () => {
|
|
447
465
|
emit((await projected.refresh()).keys().toArray(), kind);
|
|
448
466
|
ttl.mark();
|
|
449
467
|
}));
|
|
@@ -455,7 +473,7 @@ function createAssetsCollection(options, client, updates$, refreshByTtl) {
|
|
|
455
473
|
return;
|
|
456
474
|
}
|
|
457
475
|
const settled = writeBuffer.awaitingUpstream(refreshIds);
|
|
458
|
-
|
|
476
|
+
retry.run(async () => {
|
|
459
477
|
await projected.refresh(refreshIds);
|
|
460
478
|
emit(changedIds, "upstream-update");
|
|
461
479
|
}).finally(settled);
|
|
@@ -529,6 +547,7 @@ function createAssetsCollection(options, client, updates$, refreshByTtl) {
|
|
|
529
547
|
},
|
|
530
548
|
destroy() {
|
|
531
549
|
unsubUpdates();
|
|
550
|
+
retry.stop();
|
|
532
551
|
ttl.clear();
|
|
533
552
|
channel.complete();
|
|
534
553
|
}
|
|
@@ -550,8 +569,7 @@ function createAssetsSyncCollection(options, client, updates$, refreshByTtl) {
|
|
|
550
569
|
destroy
|
|
551
570
|
};
|
|
552
571
|
}
|
|
553
|
-
|
|
554
|
-
//#region src/dependency-collector.ts
|
|
572
|
+
// src/dependency-collector.ts
|
|
555
573
|
const EMPTY_KEYS = /* @__PURE__ */ new Set();
|
|
556
574
|
function createDependencyKey(target, id) {
|
|
557
575
|
return `${target}\0${id}`;
|
|
@@ -698,8 +716,7 @@ var DependencyCollector = class {
|
|
|
698
716
|
for (const key of this.forwardIndex.keys()) if (!keys.has(key)) this.clearItem(key);
|
|
699
717
|
}
|
|
700
718
|
};
|
|
701
|
-
|
|
702
|
-
//#region src/collection.ts
|
|
719
|
+
// src/collection.ts
|
|
703
720
|
function fetchCollection(source, client, ids) {
|
|
704
721
|
return concatAsync(mapAsync(client.subscribe(createSourceSubscription(source), { ids }), (r) => r.source));
|
|
705
722
|
}
|
|
@@ -729,6 +746,7 @@ function createCollection(source, options, client, updates$, resolver, refreshBy
|
|
|
729
746
|
};
|
|
730
747
|
const dependencyCollector = new DependencyCollector(_def.model, resolver);
|
|
731
748
|
const channel = createRefreshChannel(opts.onRefresh);
|
|
749
|
+
const retry = createRefreshRetry();
|
|
732
750
|
const ttl = createTtlOrchestrator({
|
|
733
751
|
ttl: _def.cache.ttl,
|
|
734
752
|
run: () => runFullRefresh("ttl")
|
|
@@ -774,7 +792,7 @@ function createCollection(source, options, client, updates$, resolver, refreshBy
|
|
|
774
792
|
});
|
|
775
793
|
}
|
|
776
794
|
function runFullRefresh(kind) {
|
|
777
|
-
refreshByTtl.enqueue(() =>
|
|
795
|
+
refreshByTtl.enqueue(() => retry.run(async () => {
|
|
778
796
|
emit((await projected.refresh()).keys().toArray(), kind);
|
|
779
797
|
ttl.mark();
|
|
780
798
|
}));
|
|
@@ -786,7 +804,7 @@ function createCollection(source, options, client, updates$, resolver, refreshBy
|
|
|
786
804
|
return;
|
|
787
805
|
}
|
|
788
806
|
const settled = writeBuffer.awaitingUpstream(refreshIds);
|
|
789
|
-
|
|
807
|
+
retry.run(async () => {
|
|
790
808
|
await projected.refresh(refreshIds);
|
|
791
809
|
emit(changedIds, "upstream-update");
|
|
792
810
|
}).finally(settled);
|
|
@@ -872,6 +890,7 @@ function createCollection(source, options, client, updates$, resolver, refreshBy
|
|
|
872
890
|
},
|
|
873
891
|
destroy() {
|
|
874
892
|
unsubUpdates();
|
|
893
|
+
retry.stop();
|
|
875
894
|
ttl.clear();
|
|
876
895
|
channel.complete();
|
|
877
896
|
}
|
|
@@ -896,8 +915,7 @@ function createCollectionSync(source, options, client, updates$, resolver, refre
|
|
|
896
915
|
destroy
|
|
897
916
|
};
|
|
898
917
|
}
|
|
899
|
-
|
|
900
|
-
//#region src/i18n.ts
|
|
918
|
+
// src/i18n.ts
|
|
901
919
|
function toGqlMessageInput(msg) {
|
|
902
920
|
return {
|
|
903
921
|
token: msg.token,
|
|
@@ -920,6 +938,7 @@ function toGqlMessageInput(msg) {
|
|
|
920
938
|
}
|
|
921
939
|
function createI18nMessagesCollection(def, client, updates$, refreshByTtl) {
|
|
922
940
|
const channel = createRefreshChannel(def.onRefresh);
|
|
941
|
+
const retry = createRefreshRetry();
|
|
923
942
|
const ttl = createTtlOrchestrator({
|
|
924
943
|
ttl: resolveTtl(def.cache?.ttl),
|
|
925
944
|
run: () => runTtlRefresh()
|
|
@@ -957,7 +976,7 @@ function createI18nMessagesCollection(def, client, updates$, refreshByTtl) {
|
|
|
957
976
|
}
|
|
958
977
|
function runTtlRefresh() {
|
|
959
978
|
refreshByTtl.enqueue(async () => {
|
|
960
|
-
await
|
|
979
|
+
if (!await retry.run(() => projected.refresh())) return;
|
|
961
980
|
emitWithCurrentIds("ttl");
|
|
962
981
|
ttl.mark();
|
|
963
982
|
});
|
|
@@ -965,7 +984,7 @@ function createI18nMessagesCollection(def, client, updates$, refreshByTtl) {
|
|
|
965
984
|
const scheduleRefresh = createRefresher(() => projected.refresh(), (kind) => {
|
|
966
985
|
emitWithCurrentIds(kind);
|
|
967
986
|
ttl.mark();
|
|
968
|
-
},
|
|
987
|
+
}, retry);
|
|
969
988
|
function runPartialRefresh(upsertedIds, deletedIds) {
|
|
970
989
|
const changedIds = [.../* @__PURE__ */ new Set([...upsertedIds, ...deletedIds])];
|
|
971
990
|
if (changedIds.length === 0) return;
|
|
@@ -973,7 +992,7 @@ function createI18nMessagesCollection(def, client, updates$, refreshByTtl) {
|
|
|
973
992
|
emit(changedIds, "upstream-update");
|
|
974
993
|
return;
|
|
975
994
|
}
|
|
976
|
-
|
|
995
|
+
retry.run(async () => {
|
|
977
996
|
await projected.refresh(upsertedIds);
|
|
978
997
|
emit(changedIds, "upstream-update");
|
|
979
998
|
});
|
|
@@ -1009,13 +1028,13 @@ function createI18nMessagesCollection(def, client, updates$, refreshByTtl) {
|
|
|
1009
1028
|
},
|
|
1010
1029
|
destroy() {
|
|
1011
1030
|
unsubUpdates();
|
|
1031
|
+
retry.stop();
|
|
1012
1032
|
ttl.clear();
|
|
1013
1033
|
channel.complete();
|
|
1014
1034
|
}
|
|
1015
1035
|
};
|
|
1016
1036
|
}
|
|
1017
|
-
|
|
1018
|
-
//#region src/lru.ts
|
|
1037
|
+
// src/lru.ts
|
|
1019
1038
|
function createLruCache(options) {
|
|
1020
1039
|
const { max, ttl, onEvict: dispose } = options;
|
|
1021
1040
|
const lru = new LRUCache({
|
|
@@ -1041,8 +1060,7 @@ function createLruCache(options) {
|
|
|
1041
1060
|
keys: () => lru.keys().toArray()
|
|
1042
1061
|
};
|
|
1043
1062
|
}
|
|
1044
|
-
|
|
1045
|
-
//#region src/lazy-assets.ts
|
|
1063
|
+
// src/lazy-assets.ts
|
|
1046
1064
|
function mapFile(raw) {
|
|
1047
1065
|
return {
|
|
1048
1066
|
uid: raw.uid,
|
|
@@ -1087,13 +1105,14 @@ function createLazyAssetsCollection(def, client, updates$) {
|
|
|
1087
1105
|
});
|
|
1088
1106
|
}
|
|
1089
1107
|
let lastRefreshKeys = [];
|
|
1108
|
+
const retry = createRefreshRetry();
|
|
1090
1109
|
const scheduleRefresh = createRefresher(async () => {
|
|
1091
1110
|
lastRefreshKeys = cache.keys();
|
|
1092
1111
|
if (lastRefreshKeys.length === 0) return;
|
|
1093
1112
|
await projected.refresh(lastRefreshKeys);
|
|
1094
1113
|
}, (kind) => {
|
|
1095
1114
|
if (lastRefreshKeys.length > 0) emit(lastRefreshKeys, kind);
|
|
1096
|
-
},
|
|
1115
|
+
}, retry);
|
|
1097
1116
|
const unsubUpdates = updates$.subscribe((batch) => {
|
|
1098
1117
|
if (batch.asset.length === 0) return;
|
|
1099
1118
|
for (const event of batch.asset) projected.delete(event.id);
|
|
@@ -1123,12 +1142,12 @@ function createLazyAssetsCollection(def, client, updates$) {
|
|
|
1123
1142
|
},
|
|
1124
1143
|
destroy() {
|
|
1125
1144
|
unsubUpdates();
|
|
1145
|
+
retry.stop();
|
|
1126
1146
|
channel.complete();
|
|
1127
1147
|
}
|
|
1128
1148
|
};
|
|
1129
1149
|
}
|
|
1130
|
-
|
|
1131
|
-
//#region src/lazy-collection.ts
|
|
1150
|
+
// src/lazy-collection.ts
|
|
1132
1151
|
function createLazyCollection(source, options, client, updates$, resolver) {
|
|
1133
1152
|
const opts = options ?? {};
|
|
1134
1153
|
const mapFn = opts.map ?? ((item) => item);
|
|
@@ -1163,6 +1182,7 @@ function createLazyCollection(source, options, client, updates$, resolver) {
|
|
|
1163
1182
|
refresh$.next(event);
|
|
1164
1183
|
opts.onRefresh?.(event);
|
|
1165
1184
|
}
|
|
1185
|
+
const retry = createRefreshRetry();
|
|
1166
1186
|
let lastRefreshKeys = [];
|
|
1167
1187
|
const scheduleRefresh = createRefresher(async () => {
|
|
1168
1188
|
lastRefreshKeys = cache.keys();
|
|
@@ -1170,7 +1190,7 @@ function createLazyCollection(source, options, client, updates$, resolver) {
|
|
|
1170
1190
|
await projected.refresh(lastRefreshKeys);
|
|
1171
1191
|
}, (kind) => {
|
|
1172
1192
|
if (lastRefreshKeys.length > 0) emit(lastRefreshKeys, kind);
|
|
1173
|
-
},
|
|
1193
|
+
}, retry);
|
|
1174
1194
|
const unsubUpdates = updates$.subscribe((batch) => {
|
|
1175
1195
|
const evicted = /* @__PURE__ */ new Set();
|
|
1176
1196
|
const ownModelEvents = batch.entity.get(_def.model);
|
|
@@ -1200,12 +1220,12 @@ function createLazyCollection(source, options, client, updates$, resolver) {
|
|
|
1200
1220
|
},
|
|
1201
1221
|
destroy() {
|
|
1202
1222
|
unsubUpdates();
|
|
1223
|
+
retry.stop();
|
|
1203
1224
|
refresh$.complete();
|
|
1204
1225
|
}
|
|
1205
1226
|
};
|
|
1206
1227
|
}
|
|
1207
|
-
|
|
1208
|
-
//#region src/route-path.ts
|
|
1228
|
+
// src/route-path.ts
|
|
1209
1229
|
const ESCAPES = /(?:%[\dA-Fa-f]{2})+/g;
|
|
1210
1230
|
const STAYS_ENCODED = /[/%?#\s\p{Cc}]/u;
|
|
1211
1231
|
function decodeRun(run) {
|
|
@@ -1228,8 +1248,7 @@ function decodeRun(run) {
|
|
|
1228
1248
|
function normalizeRoutePath(path) {
|
|
1229
1249
|
return path.replaceAll(ESCAPES, decodeRun).normalize("NFC");
|
|
1230
1250
|
}
|
|
1231
|
-
|
|
1232
|
-
//#region src/routes-mapping.ts
|
|
1251
|
+
// src/routes-mapping.ts
|
|
1233
1252
|
function mapRoute(raw, resolver) {
|
|
1234
1253
|
const base = {
|
|
1235
1254
|
id: raw.id,
|
|
@@ -1279,8 +1298,7 @@ function mapRoute(raw, resolver) {
|
|
|
1279
1298
|
default: return;
|
|
1280
1299
|
}
|
|
1281
1300
|
}
|
|
1282
|
-
|
|
1283
|
-
//#region src/lazy-routes.ts
|
|
1301
|
+
// src/lazy-routes.ts
|
|
1284
1302
|
const ID_PREFIX = "1\0";
|
|
1285
1303
|
const PATH_PREFIX = "2\0";
|
|
1286
1304
|
const CACHE_KEY = Symbol("cacheKey");
|
|
@@ -1390,13 +1408,14 @@ function createLazyRoutesCollection(def, client, updates$, resolver) {
|
|
|
1390
1408
|
});
|
|
1391
1409
|
}
|
|
1392
1410
|
let lastRefreshKeys = [];
|
|
1411
|
+
const retry = createRefreshRetry();
|
|
1393
1412
|
const scheduleRefresh = createRefresher(async () => {
|
|
1394
1413
|
lastRefreshKeys = cache.keys();
|
|
1395
1414
|
if (lastRefreshKeys.length === 0) return;
|
|
1396
1415
|
await projected.refresh(lastRefreshKeys);
|
|
1397
1416
|
}, (kind) => {
|
|
1398
1417
|
if (lastRefreshKeys.length > 0) emit(lastRefreshKeys.map((key) => key.slice(2)), kind);
|
|
1399
|
-
},
|
|
1418
|
+
}, retry);
|
|
1400
1419
|
const unsubUpdates = updates$.subscribe((batch) => {
|
|
1401
1420
|
const evicted = [];
|
|
1402
1421
|
for (const event of batch.route) {
|
|
@@ -1444,12 +1463,12 @@ function createLazyRoutesCollection(def, client, updates$, resolver) {
|
|
|
1444
1463
|
},
|
|
1445
1464
|
destroy() {
|
|
1446
1465
|
unsubUpdates();
|
|
1466
|
+
retry.stop();
|
|
1447
1467
|
channel.complete();
|
|
1448
1468
|
}
|
|
1449
1469
|
};
|
|
1450
1470
|
}
|
|
1451
|
-
|
|
1452
|
-
//#region src/model-resolver.ts
|
|
1471
|
+
// src/model-resolver.ts
|
|
1453
1472
|
var ModelResolver = class {
|
|
1454
1473
|
_typeNames;
|
|
1455
1474
|
_toModel;
|
|
@@ -1486,8 +1505,7 @@ var ModelResolver = class {
|
|
|
1486
1505
|
return this._toModel.get(typeName) ?? typeName;
|
|
1487
1506
|
}
|
|
1488
1507
|
};
|
|
1489
|
-
|
|
1490
|
-
//#region src/routes.ts
|
|
1508
|
+
// src/routes.ts
|
|
1491
1509
|
function createRoutesCollection(options, client, updates$, resolver, refreshByTtl) {
|
|
1492
1510
|
const opts = options ?? {};
|
|
1493
1511
|
const cache = {
|
|
@@ -1495,6 +1513,7 @@ function createRoutesCollection(options, client, updates$, resolver, refreshByTt
|
|
|
1495
1513
|
eviction: opts.cache?.eviction ?? "refresh"
|
|
1496
1514
|
};
|
|
1497
1515
|
const channel = createRefreshChannel(opts.onRefresh);
|
|
1516
|
+
const retry = createRefreshRetry();
|
|
1498
1517
|
const ttl = createTtlOrchestrator({
|
|
1499
1518
|
ttl: cache.ttl,
|
|
1500
1519
|
run: () => runFullRefresh("ttl")
|
|
@@ -1567,7 +1586,7 @@ function createRoutesCollection(options, client, updates$, resolver, refreshByTt
|
|
|
1567
1586
|
});
|
|
1568
1587
|
}
|
|
1569
1588
|
function runFullRefresh(kind) {
|
|
1570
|
-
refreshByTtl.enqueue(() =>
|
|
1589
|
+
refreshByTtl.enqueue(() => retry.run(async () => {
|
|
1571
1590
|
emit((await projected.refresh()).keys().toArray(), kind);
|
|
1572
1591
|
ttl.mark();
|
|
1573
1592
|
}));
|
|
@@ -1579,7 +1598,7 @@ function createRoutesCollection(options, client, updates$, resolver, refreshByTt
|
|
|
1579
1598
|
return;
|
|
1580
1599
|
}
|
|
1581
1600
|
const settled = writeBuffer.awaitingUpstream(refreshIds);
|
|
1582
|
-
|
|
1601
|
+
retry.run(async () => {
|
|
1583
1602
|
await projected.refresh(refreshIds);
|
|
1584
1603
|
emit(changedIds, "upstream-update");
|
|
1585
1604
|
}).finally(settled);
|
|
@@ -1692,6 +1711,7 @@ function createRoutesCollection(options, client, updates$, resolver, refreshByTt
|
|
|
1692
1711
|
},
|
|
1693
1712
|
destroy() {
|
|
1694
1713
|
unsubUpdates();
|
|
1714
|
+
retry.stop();
|
|
1695
1715
|
ttl.clear();
|
|
1696
1716
|
channel.complete();
|
|
1697
1717
|
}
|
|
@@ -1716,8 +1736,7 @@ function createRoutesSyncCollection(options, client, updates$, resolver, refresh
|
|
|
1716
1736
|
destroy
|
|
1717
1737
|
};
|
|
1718
1738
|
}
|
|
1719
|
-
|
|
1720
|
-
//#region src/singleton.ts
|
|
1739
|
+
// src/singleton.ts
|
|
1721
1740
|
function createSingleton(source, options, client, updates$, resolver, refreshByTtl) {
|
|
1722
1741
|
const opts = options ?? {};
|
|
1723
1742
|
const mapFn = opts.map ?? ((item) => item);
|
|
@@ -1732,6 +1751,7 @@ function createSingleton(source, options, client, updates$, resolver, refreshByT
|
|
|
1732
1751
|
const dependencyCollector = new DependencyCollector(_def.model, resolver);
|
|
1733
1752
|
const itemKey = `singleton:${_def.name}`;
|
|
1734
1753
|
const channel = createRefreshChannel(opts.onRefresh);
|
|
1754
|
+
const retry = createRefreshRetry();
|
|
1735
1755
|
const ttl = createTtlOrchestrator({
|
|
1736
1756
|
ttl: _def.cache.ttl,
|
|
1737
1757
|
run: () => runTtlRefresh()
|
|
@@ -1751,7 +1771,7 @@ function createSingleton(source, options, client, updates$, resolver, refreshByT
|
|
|
1751
1771
|
}
|
|
1752
1772
|
function runTtlRefresh() {
|
|
1753
1773
|
refreshByTtl.enqueue(async () => {
|
|
1754
|
-
await
|
|
1774
|
+
if (!await retry.run(() => projected.refresh())) return;
|
|
1755
1775
|
emit("ttl");
|
|
1756
1776
|
ttl.mark();
|
|
1757
1777
|
});
|
|
@@ -1759,7 +1779,7 @@ function createSingleton(source, options, client, updates$, resolver, refreshByT
|
|
|
1759
1779
|
const scheduleRefresh = createRefresher(() => projected.refresh(), (kind) => {
|
|
1760
1780
|
emit(kind);
|
|
1761
1781
|
ttl.mark();
|
|
1762
|
-
},
|
|
1782
|
+
}, retry);
|
|
1763
1783
|
const unsubUpdates = updates$.subscribe((batch) => {
|
|
1764
1784
|
if (!loaded) return;
|
|
1765
1785
|
const hasOwnModel = batch.entity.has(_def.model);
|
|
@@ -1788,6 +1808,7 @@ function createSingleton(source, options, client, updates$, resolver, refreshByT
|
|
|
1788
1808
|
},
|
|
1789
1809
|
destroy() {
|
|
1790
1810
|
unsubUpdates();
|
|
1811
|
+
retry.stop();
|
|
1791
1812
|
ttl.clear();
|
|
1792
1813
|
channel.complete();
|
|
1793
1814
|
}
|
|
@@ -1807,8 +1828,7 @@ function createSingletonSync(source, options, client, updates$, resolver, refres
|
|
|
1807
1828
|
destroy
|
|
1808
1829
|
};
|
|
1809
1830
|
}
|
|
1810
|
-
|
|
1811
|
-
//#region src/watcher.ts
|
|
1831
|
+
// src/watcher.ts
|
|
1812
1832
|
function addRouteByModel(map, entityType, event) {
|
|
1813
1833
|
let list = map.get(entityType);
|
|
1814
1834
|
if (!list) {
|
|
@@ -1953,8 +1973,7 @@ function createInternalWatcher(client, resolver) {
|
|
|
1953
1973
|
}
|
|
1954
1974
|
};
|
|
1955
1975
|
}
|
|
1956
|
-
|
|
1957
|
-
//#region src/store.ts
|
|
1976
|
+
// src/store.ts
|
|
1958
1977
|
var Store = class {
|
|
1959
1978
|
_client;
|
|
1960
1979
|
_resolver;
|
|
@@ -2072,7 +2091,6 @@ var Store = class {
|
|
|
2072
2091
|
function createStore(options) {
|
|
2073
2092
|
return new Store(options);
|
|
2074
2093
|
}
|
|
2075
|
-
//#endregion
|
|
2076
2094
|
export { Store, createStore, normalizeRoutePath };
|
|
2077
2095
|
|
|
2078
2096
|
//# sourceMappingURL=index.js.map
|