@baukit/sync-client 0.1.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/README.md +102 -12
- package/dist/conformance.d.ts +80 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +251 -0
- package/dist/conformance.js.map +1 -0
- package/dist/error.d.ts +55 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +72 -1
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/push-batch.d.ts +11 -0
- package/dist/push-batch.d.ts.map +1 -1
- package/dist/push-batch.js +15 -0
- package/dist/push-batch.js.map +1 -1
- package/dist/store.d.ts +50 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +95 -24
- package/dist/store.js.map +1 -1
- package/dist/transport.d.ts +33 -0
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +91 -7
- package/dist/transport.js.map +1 -1
- package/package.json +5 -1
package/dist/error.js
CHANGED
|
@@ -17,15 +17,86 @@ export class SyncAuthError extends SyncTransportError {
|
|
|
17
17
|
this.name = 'SyncAuthError';
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
/** The request did not reach a usable HTTP response. */
|
|
21
|
+
export class SyncNetworkError extends SyncTransportError {
|
|
22
|
+
kind = 'network';
|
|
23
|
+
constructor(message, cause) {
|
|
24
|
+
super(message, true, cause);
|
|
25
|
+
this.name = 'SyncNetworkError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** The server returned an HTTP failure other than authentication or rate limiting. */
|
|
29
|
+
export class SyncServerError extends SyncTransportError {
|
|
30
|
+
kind = 'server';
|
|
31
|
+
constructor(message, retryable, cause) {
|
|
32
|
+
super(message, retryable, cause);
|
|
33
|
+
this.name = 'SyncServerError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** HTTP 429 with its raw `Retry-After` value and resolved retry time. */
|
|
37
|
+
export class SyncRateLimitError extends SyncTransportError {
|
|
38
|
+
retryAt;
|
|
39
|
+
retryAfter;
|
|
40
|
+
kind = 'rate_limited';
|
|
41
|
+
constructor(message, retryAt, retryAfter, cause) {
|
|
42
|
+
super(message, true, cause);
|
|
43
|
+
this.retryAt = retryAt;
|
|
44
|
+
this.retryAfter = retryAfter;
|
|
45
|
+
this.name = 'SyncRateLimitError';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
20
48
|
/**
|
|
21
49
|
* The server rejected the caller's local-data partition, so the local database
|
|
22
50
|
* belongs to an erased or replaced owner and must not be reused.
|
|
23
51
|
*/
|
|
24
52
|
export class SyncPartitionMismatchError extends SyncTransportError {
|
|
25
|
-
kind = '
|
|
53
|
+
kind = 'partition_mismatch';
|
|
26
54
|
constructor(message, cause) {
|
|
27
55
|
super(message, false, cause);
|
|
28
56
|
this.name = 'SyncPartitionMismatchError';
|
|
29
57
|
}
|
|
30
58
|
}
|
|
59
|
+
/** A decoded response violates the sync payload contract. */
|
|
60
|
+
export class SyncPayloadCompatibilityError extends SyncTransportError {
|
|
61
|
+
kind = 'payload_compatibility';
|
|
62
|
+
constructor(message, cause) {
|
|
63
|
+
super(message, false, cause);
|
|
64
|
+
this.name = 'SyncPayloadCompatibilityError';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Remote data or a cursor could not be committed to local storage. */
|
|
68
|
+
export class SyncLocalApplyError extends Error {
|
|
69
|
+
kind = 'local_apply';
|
|
70
|
+
constructor(message, cause) {
|
|
71
|
+
super(message, { cause });
|
|
72
|
+
this.name = 'SyncLocalApplyError';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Maps package errors onto store failure metadata. */
|
|
76
|
+
export function syncFailureFromError(error) {
|
|
77
|
+
if (error instanceof SyncRateLimitError) {
|
|
78
|
+
return { kind: 'rate_limited', retryAt: error.retryAt };
|
|
79
|
+
}
|
|
80
|
+
if (error instanceof SyncAuthError)
|
|
81
|
+
return { kind: 'auth' };
|
|
82
|
+
if (error instanceof SyncPartitionMismatchError)
|
|
83
|
+
return { kind: 'partition_mismatch' };
|
|
84
|
+
if (error instanceof SyncNetworkError)
|
|
85
|
+
return { kind: 'network' };
|
|
86
|
+
if (error instanceof SyncServerError)
|
|
87
|
+
return { kind: 'server' };
|
|
88
|
+
if (error instanceof SyncPayloadCompatibilityError)
|
|
89
|
+
return { kind: 'payload_compatibility' };
|
|
90
|
+
if (error instanceof SyncLocalApplyError)
|
|
91
|
+
return { kind: 'local_apply' };
|
|
92
|
+
if (error instanceof SyncTransportError) {
|
|
93
|
+
return error.retryable ? { kind: 'network' } : { kind: 'server' };
|
|
94
|
+
}
|
|
95
|
+
return { kind: 'local_apply' };
|
|
96
|
+
}
|
|
97
|
+
export function toSnakeCaseFailure(failure) {
|
|
98
|
+
return failure.kind === 'rate_limited'
|
|
99
|
+
? { kind: failure.kind, retry_at: failure.retryAt }
|
|
100
|
+
: failure;
|
|
101
|
+
}
|
|
31
102
|
//# sourceMappingURL=error.js.map
|
package/dist/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAeA,kFAAkF;AAClF,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGhC;IACS;IAHpB,YACE,OAAe,EACN,SAAkB,EACT,KAAe;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,cAAS,GAAT,SAAS,CAAS;QACT,UAAK,GAAL,KAAK,CAAU;QAGjC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,4EAA4E;AAC5E,MAAM,OAAO,aAAc,SAAQ,kBAAkB;IAC1C,IAAI,GAAG,MAAM,CAAC;IAEvB,YAAY,OAAe,EA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,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACrD,OAAO,OAAO,CAAC,IAAI,KAAK,cAAc;QACpC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE;QACnD,CAAC,CAAC,OAAO,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { SyncAuthError, SyncPartitionMismatchError, SyncTransportError } from './error.js';
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
export { SyncAuthError, SyncLocalApplyError, SyncNetworkError, SyncPartitionMismatchError, SyncPayloadCompatibilityError, SyncRateLimitError, SyncServerError, SyncTransportError, syncFailureFromError, toSnakeCaseFailure, } from './error.js';
|
|
2
|
+
export type { SnakeCaseSyncFailure, SyncFailure } from './error.js';
|
|
3
|
+
export { dependencyRankByOrder, rankPushBatch, validatePushOutcomeCoverage } from './push-batch.js';
|
|
4
|
+
export type { PushCandidate, PushOutcomeCoverageOptions, RankedPushItem, RankPushBatchOptions, } from './push-batch.js';
|
|
4
5
|
export { SyncScheduler } from './scheduler.js';
|
|
5
6
|
export type { SyncSchedulerEnvironment, SyncSchedulerOptions, SyncSchedulerTimer, } from './scheduler.js';
|
|
6
7
|
export { deriveInitialSyncState, deriveLocalStoreReadiness, SyncStatusStore, toSnakeCaseSnapshot, } from './store.js';
|
|
7
|
-
export type { InitialPullStatus, InitialSyncState, LocalStoreReadiness, LocalStoreReadinessInput, SnakeCaseSyncStatusSnapshot, SyncAttentionItem, SyncStatus, SyncStatusSink, SyncStatusSnapshot, } from './store.js';
|
|
8
|
-
export { SyncTransport } from './transport.js';
|
|
9
|
-
export type { SyncFetch, SyncFetchResponse, SyncPrebuiltRequest, SyncPrebuiltRequestTransportOptions, SyncRequestOptions, SyncRequestInit, SyncFetchTransportOptions, SyncTransportOptions, } from './transport.js';
|
|
8
|
+
export type { InitialPullStatus, InitialSyncState, LocalStoreReadiness, LocalStoreReadinessInput, SnakeCaseSyncStatusSnapshot, SyncAttentionItem, SyncFailureUpdate, SyncStatus, SyncStatusHydration, SyncStatusSink, SyncStatusSnapshot, SyncStatusStoreOptions, } from './store.js';
|
|
9
|
+
export { commitCursorAfterLocalTransaction, DEFAULT_RETRY_AFTER_FALLBACK_MS, parseRetryAfter, SyncTransport, validatePullPage, } from './transport.js';
|
|
10
|
+
export type { CursorCommitOptions, ParseRetryAfterOptions, PullPagePosition, SyncCursorComparator, SyncFetch, SyncFetchResponse, SyncResponseHeaders, SyncPrebuiltRequest, SyncPrebuiltRequestTransportOptions, SyncRequestOptions, SyncRequestInit, SyncFetchTransportOptions, SyncTransportOptions, } from './transport.js';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,6BAA6B,EAC7B,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACpG,YAAY,EACV,aAAa,EACb,0BAA0B,EAC1B,cAAc,EACd,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iCAAiC,EACjC,+BAA+B,EAC/B,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,mCAAmC,EACnC,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { SyncAuthError, SyncPartitionMismatchError, SyncTransportError } from './error.js';
|
|
2
|
-
export { dependencyRankByOrder, rankPushBatch } from './push-batch.js';
|
|
1
|
+
export { SyncAuthError, SyncLocalApplyError, SyncNetworkError, SyncPartitionMismatchError, SyncPayloadCompatibilityError, SyncRateLimitError, SyncServerError, SyncTransportError, syncFailureFromError, toSnakeCaseFailure, } from './error.js';
|
|
2
|
+
export { dependencyRankByOrder, rankPushBatch, validatePushOutcomeCoverage } from './push-batch.js';
|
|
3
3
|
export { SyncScheduler } from './scheduler.js';
|
|
4
4
|
export { deriveInitialSyncState, deriveLocalStoreReadiness, SyncStatusStore, toSnakeCaseSnapshot, } from './store.js';
|
|
5
|
-
export { SyncTransport } from './transport.js';
|
|
5
|
+
export { commitCursorAfterLocalTransaction, DEFAULT_RETRY_AFTER_FALLBACK_MS, parseRetryAfter, SyncTransport, validatePullPage, } from './transport.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,6BAA6B,EAC7B,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAOpG,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAM/C,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAepB,OAAO,EACL,iCAAiC,EACjC,+BAA+B,EAC/B,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
package/dist/push-batch.d.ts
CHANGED
|
@@ -35,6 +35,17 @@ export interface RankPushBatchOptions<T extends PushCandidate> {
|
|
|
35
35
|
*/
|
|
36
36
|
isHeldBack?: (change: T) => boolean;
|
|
37
37
|
}
|
|
38
|
+
export interface PushOutcomeCoverageOptions<TSubmitted, TOutcome> {
|
|
39
|
+
submittedKey: (submitted: TSubmitted) => string;
|
|
40
|
+
outcomeKey: (outcome: TOutcome) => string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Rejects a response that omits an outcome for any submitted entity.
|
|
44
|
+
*
|
|
45
|
+
* Call this before acknowledging accepted or rejected changes. Products supply
|
|
46
|
+
* key readers because their wire field names remain product-owned.
|
|
47
|
+
*/
|
|
48
|
+
export declare function validatePushOutcomeCoverage<TSubmitted, TOutcome>(submitted: readonly TSubmitted[], outcomes: readonly TOutcome[], { submittedKey, outcomeKey }: PushOutcomeCoverageOptions<TSubmitted, TOutcome>): readonly TOutcome[];
|
|
38
49
|
/**
|
|
39
50
|
* Orders a push batch parent-before-child and coalesces per entity.
|
|
40
51
|
*
|
package/dist/push-batch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-batch.d.ts","sourceRoot":"","sources":["../src/push-batch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"push-batch.d.ts","sourceRoot":"","sources":["../src/push-batch.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,sEAAsE;AACtE,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,aAAa;IACrD,gFAAgF;IAChF,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,aAAa;IAC3D;;;OAGG;IACH,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,0BAA0B,CAAC,UAAU,EAAE,QAAQ;IAC9D,YAAY,EAAE,CAAC,SAAS,EAAE,UAAU,KAAK,MAAM,CAAC;IAChD,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,MAAM,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,QAAQ,EAC9D,SAAS,EAAE,SAAS,UAAU,EAAE,EAChC,QAAQ,EAAE,SAAS,QAAQ,EAAE,EAC7B,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,0BAA0B,CAAC,UAAU,EAAE,QAAQ,CAAC,GAC7E,SAAS,QAAQ,EAAE,CASrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,aAAa,EACnD,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC,GACvD,cAAc,CAAC,CAAC,CAAC,EAAE,CAqBrB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAG9F"}
|
package/dist/push-batch.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import { SyncPayloadCompatibilityError } from './error.js';
|
|
2
|
+
/**
|
|
3
|
+
* Rejects a response that omits an outcome for any submitted entity.
|
|
4
|
+
*
|
|
5
|
+
* Call this before acknowledging accepted or rejected changes. Products supply
|
|
6
|
+
* key readers because their wire field names remain product-owned.
|
|
7
|
+
*/
|
|
8
|
+
export function validatePushOutcomeCoverage(submitted, outcomes, { submittedKey, outcomeKey }) {
|
|
9
|
+
const outcomeKeys = new Set(outcomes.map(outcomeKey));
|
|
10
|
+
const missing = new Set(submitted.map(submittedKey).filter((key) => !outcomeKeys.has(key)));
|
|
11
|
+
if (missing.size > 0) {
|
|
12
|
+
throw new SyncPayloadCompatibilityError(`The push response omitted outcomes for ${String(missing.size)} submitted entities.`);
|
|
13
|
+
}
|
|
14
|
+
return outcomes;
|
|
15
|
+
}
|
|
1
16
|
/**
|
|
2
17
|
* Orders a push batch parent-before-child and coalesces per entity.
|
|
3
18
|
*
|
package/dist/push-batch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-batch.js","sourceRoot":"","sources":["../src/push-batch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"push-batch.js","sourceRoot":"","sources":["../src/push-batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AA+C3D;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,SAAgC,EAChC,QAA6B,EAC7B,EAAE,YAAY,EAAE,UAAU,EAAoD;IAE9E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5F,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,6BAA6B,CACrC,0CAA0C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CACrF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAqB,EACrB,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAA2B;IAExD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoE,CAAC;IAE5F,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAChC,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtD,MAAM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-1,3 +1,4 @@
|
|
|
1
|
+
import { type SnakeCaseSyncFailure, type SyncFailure } from './error.js';
|
|
1
2
|
/** Sync activity, as named by the offline-readiness contract. */
|
|
2
3
|
export type SyncStatus = 'idle' | 'syncing' | 'pending' | 'attention' | 'auth' | 'error';
|
|
3
4
|
/** Progress of the initial pull that a cold start must complete. */
|
|
@@ -5,7 +6,7 @@ export type InitialPullStatus = 'uninitialized' | 'pulling' | 'settled';
|
|
|
5
6
|
/** Readiness of the local store, derived from pull progress and delivery. */
|
|
6
7
|
export type LocalStoreReadiness = 'uninitialized' | 'pulling' | 'hydrated-empty' | 'hydrated-populated';
|
|
7
8
|
/** Initial readiness as the offline-readiness contract names it. */
|
|
8
|
-
export type InitialSyncState = 'unknown' | 'syncing' | 'offline-cached' | 'settled';
|
|
9
|
+
export type InitialSyncState = 'unknown' | 'syncing' | 'offline-cached' | 'sync-error-cached' | 'settled';
|
|
9
10
|
/**
|
|
10
11
|
* One rejection that needs product or user action. `entityType` and `entityId`
|
|
11
12
|
* are opaque to baukit; products name their own entities.
|
|
@@ -16,8 +17,14 @@ export type SyncAttentionItem<T = {
|
|
|
16
17
|
}> = T;
|
|
17
18
|
export interface SyncStatusSnapshot<TAttention = SyncAttentionItem> {
|
|
18
19
|
status: SyncStatus;
|
|
20
|
+
lastAttemptAt: string | null;
|
|
21
|
+
lastSuccessAt: string | null;
|
|
22
|
+
/** @deprecated Use `lastSuccessAt`. This field will be removed after one release cycle. */
|
|
19
23
|
lastSyncAt: string | null;
|
|
20
24
|
error: string | null;
|
|
25
|
+
failure: SyncFailure | null;
|
|
26
|
+
retrying: boolean;
|
|
27
|
+
retryAt: string | null;
|
|
21
28
|
attention: readonly TAttention[];
|
|
22
29
|
pendingCount: number;
|
|
23
30
|
initialPullStatus: InitialPullStatus;
|
|
@@ -34,14 +41,37 @@ export interface LocalStoreReadinessInput {
|
|
|
34
41
|
}
|
|
35
42
|
export interface SnakeCaseSyncStatusSnapshot<TAttention = SyncAttentionItem> {
|
|
36
43
|
status: SyncStatus;
|
|
44
|
+
last_attempt_at: string | null;
|
|
45
|
+
last_success_at: string | null;
|
|
46
|
+
/** @deprecated Use `last_success_at`. This field will be removed after one release cycle. */
|
|
37
47
|
last_sync_at: string | null;
|
|
38
48
|
error: string | null;
|
|
49
|
+
failure: SnakeCaseSyncFailure | null;
|
|
50
|
+
retrying: boolean;
|
|
51
|
+
retry_at: string | null;
|
|
39
52
|
attention: readonly TAttention[];
|
|
40
53
|
pending_count: number;
|
|
41
54
|
initial_pull_status: InitialPullStatus;
|
|
42
55
|
refresh_revision: number;
|
|
43
56
|
security_block: string | null;
|
|
44
57
|
}
|
|
58
|
+
export interface SyncStatusHydration<TAttention = SyncAttentionItem> {
|
|
59
|
+
lastAttemptAt: string | null;
|
|
60
|
+
lastSuccessAt: string | null;
|
|
61
|
+
attention?: readonly TAttention[];
|
|
62
|
+
pendingCount?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface SyncFailureUpdate {
|
|
65
|
+
/** Defaults to the store's current pending count. */
|
|
66
|
+
pendingCount?: number;
|
|
67
|
+
/** Defaults to the current time. */
|
|
68
|
+
attemptAt?: string;
|
|
69
|
+
/** Marks a retry as scheduled. Rate-limit failures use their own `retryAt`. */
|
|
70
|
+
retryAt?: string | null;
|
|
71
|
+
}
|
|
72
|
+
export interface SyncStatusStoreOptions {
|
|
73
|
+
clock?: () => string;
|
|
74
|
+
}
|
|
45
75
|
/** Projects a status snapshot onto API-style snake_case field names. */
|
|
46
76
|
export declare function toSnakeCaseSnapshot<TAttention>(snapshot: SyncStatusSnapshot<TAttention>): SnakeCaseSyncStatusSnapshot<TAttention>;
|
|
47
77
|
/**
|
|
@@ -52,7 +82,7 @@ export declare function toSnakeCaseSnapshot<TAttention>(snapshot: SyncStatusSnap
|
|
|
52
82
|
*/
|
|
53
83
|
export declare function deriveLocalStoreReadiness({ initialPullStatus, refreshRevision, deliveredRevision, hasData, }: LocalStoreReadinessInput): LocalStoreReadiness;
|
|
54
84
|
/** Maps a snapshot onto the contract's initial-readiness vocabulary. */
|
|
55
|
-
export declare function deriveInitialSyncState({ initialPullStatus,
|
|
85
|
+
export declare function deriveInitialSyncState({ initialPullStatus, lastSuccessAt, status, failure, }: Pick<SyncStatusSnapshot, 'failure' | 'initialPullStatus' | 'lastSuccessAt' | 'status'>): InitialSyncState;
|
|
56
86
|
/**
|
|
57
87
|
* Observable sync status, with no React and no state library.
|
|
58
88
|
*
|
|
@@ -62,26 +92,36 @@ export declare function deriveInitialSyncState({ initialPullStatus, lastSyncAt,
|
|
|
62
92
|
export declare class SyncStatusStore<TAttention = SyncAttentionItem> {
|
|
63
93
|
private snapshot;
|
|
64
94
|
private readonly listeners;
|
|
95
|
+
private readonly clock;
|
|
96
|
+
constructor(options?: SyncStatusStoreOptions);
|
|
65
97
|
getSnapshot(): SyncStatusSnapshot<TAttention>;
|
|
66
98
|
subscribe(listener: (snapshot: SyncStatusSnapshot<TAttention>) => void): () => void;
|
|
67
|
-
setSyncing(): void;
|
|
68
|
-
setIdle(
|
|
99
|
+
setSyncing(attemptAt?: string): void;
|
|
100
|
+
setIdle(successAt: string): void;
|
|
69
101
|
setAttention(items: readonly TAttention[], pendingCount: number): void;
|
|
70
|
-
setAuth(message: string): void;
|
|
102
|
+
setAuth(message: string, update?: SyncFailureUpdate): void;
|
|
103
|
+
setFailure(failure: SyncFailure, message: string, update?: SyncFailureUpdate): void;
|
|
104
|
+
setRetrying(retryAt: string, pendingCount?: number): void;
|
|
105
|
+
/** @deprecated Use `setFailure` with typed metadata. */
|
|
71
106
|
setError(message: string, pendingCount?: number): void;
|
|
72
107
|
/** Restores persisted status on a cold start, before the first run. */
|
|
108
|
+
hydrate(hydration: SyncStatusHydration<TAttention>): void;
|
|
109
|
+
/** @deprecated Pass a `SyncStatusHydration` object with both timestamps. */
|
|
73
110
|
hydrate(lastSyncAt: string | null, items?: readonly TAttention[], pendingCount?: number): void;
|
|
74
111
|
reset(): void;
|
|
75
|
-
setSecurityBlock(message: string
|
|
112
|
+
setSecurityBlock(message: string, failure?: Extract<SyncFailure, {
|
|
113
|
+
kind: 'partition_mismatch' | 'local_apply';
|
|
114
|
+
}>): void;
|
|
76
115
|
resumeAfterAuth(): void;
|
|
77
116
|
private set;
|
|
78
117
|
}
|
|
79
118
|
/** Write-only view a sync run uses to report progress. */
|
|
80
119
|
export interface SyncStatusSink<TAttention = SyncAttentionItem> {
|
|
81
|
-
setSyncing(): void;
|
|
82
|
-
setIdle(
|
|
120
|
+
setSyncing(attemptAt?: string): void;
|
|
121
|
+
setIdle(successAt: string): void;
|
|
83
122
|
setAttention(items: readonly TAttention[], pendingCount: number): void;
|
|
84
|
-
setAuth(message: string): void;
|
|
85
|
-
|
|
123
|
+
setAuth(message: string, update?: SyncFailureUpdate): void;
|
|
124
|
+
setFailure(failure: SyncFailure, message: string, update?: SyncFailureUpdate): void;
|
|
125
|
+
setRetrying(retryAt: string, pendingCount?: number): void;
|
|
86
126
|
}
|
|
87
127
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzF,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,SAAS,GAAG,SAAS,CAAC;AAExE,6EAA6E;AAC7E,MAAM,MAAM,mBAAmB,GAC7B,eAAe,GAAG,SAAS,GAAG,gBAAgB,GAAG,oBAAoB,CAAC;AAExE,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAA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2
3
|
return {
|
|
3
4
|
status: 'idle',
|
|
5
|
+
lastAttemptAt: null,
|
|
6
|
+
lastSuccessAt: null,
|
|
4
7
|
lastSyncAt: null,
|
|
5
8
|
error: null,
|
|
9
|
+
failure: null,
|
|
10
|
+
retrying: false,
|
|
11
|
+
retryAt: null,
|
|
6
12
|
attention: [],
|
|
7
13
|
pendingCount: 0,
|
|
8
14
|
initialPullStatus: 'uninitialized',
|
|
@@ -14,8 +20,13 @@ function initialSnapshot() {
|
|
|
14
20
|
export function toSnakeCaseSnapshot(snapshot) {
|
|
15
21
|
return {
|
|
16
22
|
status: snapshot.status,
|
|
17
|
-
|
|
23
|
+
last_attempt_at: snapshot.lastAttemptAt,
|
|
24
|
+
last_success_at: snapshot.lastSuccessAt,
|
|
25
|
+
last_sync_at: snapshot.lastSuccessAt,
|
|
18
26
|
error: snapshot.error,
|
|
27
|
+
failure: snapshot.failure === null ? null : toSnakeCaseFailure(snapshot.failure),
|
|
28
|
+
retrying: snapshot.retrying,
|
|
29
|
+
retry_at: snapshot.retryAt,
|
|
19
30
|
attention: snapshot.attention,
|
|
20
31
|
pending_count: snapshot.pendingCount,
|
|
21
32
|
initial_pull_status: snapshot.initialPullStatus,
|
|
@@ -37,13 +48,16 @@ export function deriveLocalStoreReadiness({ initialPullStatus, refreshRevision,
|
|
|
37
48
|
return hasData ? 'hydrated-populated' : 'hydrated-empty';
|
|
38
49
|
}
|
|
39
50
|
/** Maps a snapshot onto the contract's initial-readiness vocabulary. */
|
|
40
|
-
export function deriveInitialSyncState({ initialPullStatus,
|
|
51
|
+
export function deriveInitialSyncState({ initialPullStatus, lastSuccessAt, status, failure, }) {
|
|
41
52
|
if (initialPullStatus === 'uninitialized')
|
|
42
53
|
return 'unknown';
|
|
43
54
|
if (initialPullStatus === 'pulling')
|
|
44
55
|
return 'syncing';
|
|
45
|
-
if (
|
|
46
|
-
return 'offline-cached';
|
|
56
|
+
if (lastSuccessAt === null && failure !== null) {
|
|
57
|
+
return failure.kind === 'network' ? 'offline-cached' : 'sync-error-cached';
|
|
58
|
+
}
|
|
59
|
+
if (status === 'error' && lastSuccessAt === null)
|
|
60
|
+
return 'sync-error-cached';
|
|
47
61
|
return 'settled';
|
|
48
62
|
}
|
|
49
63
|
function settledStatus(attentionCount, pendingCount) {
|
|
@@ -60,6 +74,10 @@ function settledStatus(attentionCount, pendingCount) {
|
|
|
60
74
|
export class SyncStatusStore {
|
|
61
75
|
snapshot = initialSnapshot();
|
|
62
76
|
listeners = new Set();
|
|
77
|
+
clock;
|
|
78
|
+
constructor(options = {}) {
|
|
79
|
+
this.clock = options.clock ?? (() => new Date().toISOString());
|
|
80
|
+
}
|
|
63
81
|
getSnapshot() {
|
|
64
82
|
return this.snapshot;
|
|
65
83
|
}
|
|
@@ -69,18 +87,24 @@ export class SyncStatusStore {
|
|
|
69
87
|
this.listeners.delete(listener);
|
|
70
88
|
};
|
|
71
89
|
}
|
|
72
|
-
setSyncing() {
|
|
90
|
+
setSyncing(attemptAt = this.clock()) {
|
|
73
91
|
this.set((state) => ({
|
|
74
92
|
status: 'syncing',
|
|
93
|
+
lastAttemptAt: attemptAt,
|
|
75
94
|
error: null,
|
|
76
|
-
|
|
95
|
+
retryAt: null,
|
|
96
|
+
initialPullStatus: state.lastSuccessAt === null ? 'pulling' : 'settled',
|
|
77
97
|
}));
|
|
78
98
|
}
|
|
79
|
-
setIdle(
|
|
99
|
+
setIdle(successAt) {
|
|
80
100
|
this.set((state) => ({
|
|
81
101
|
status: 'idle',
|
|
82
|
-
|
|
102
|
+
lastAttemptAt: successAt,
|
|
103
|
+
lastSuccessAt: successAt,
|
|
83
104
|
error: null,
|
|
105
|
+
failure: null,
|
|
106
|
+
retrying: false,
|
|
107
|
+
retryAt: null,
|
|
84
108
|
attention: [],
|
|
85
109
|
pendingCount: 0,
|
|
86
110
|
initialPullStatus: 'settled',
|
|
@@ -91,51 +115,94 @@ export class SyncStatusStore {
|
|
|
91
115
|
this.set((state) => ({
|
|
92
116
|
status: items.length > 0 ? 'attention' : 'pending',
|
|
93
117
|
error: null,
|
|
118
|
+
failure: null,
|
|
119
|
+
retrying: false,
|
|
120
|
+
retryAt: null,
|
|
94
121
|
attention: [...items],
|
|
95
122
|
pendingCount,
|
|
96
123
|
initialPullStatus: 'settled',
|
|
97
124
|
refreshRevision: state.refreshRevision + 1,
|
|
98
125
|
}));
|
|
99
126
|
}
|
|
100
|
-
setAuth(message) {
|
|
101
|
-
this.
|
|
102
|
-
status: 'auth',
|
|
103
|
-
error: message,
|
|
104
|
-
initialPullStatus: 'settled',
|
|
105
|
-
refreshRevision: state.refreshRevision + 1,
|
|
106
|
-
}));
|
|
127
|
+
setAuth(message, update = {}) {
|
|
128
|
+
this.setFailure({ kind: 'auth' }, message, update);
|
|
107
129
|
}
|
|
108
|
-
|
|
130
|
+
setFailure(failure, message, update = {}) {
|
|
109
131
|
this.set((state) => {
|
|
110
|
-
const nextPendingCount = pendingCount ?? state.pendingCount;
|
|
132
|
+
const nextPendingCount = update.pendingCount ?? state.pendingCount;
|
|
133
|
+
const retryAt = failure.kind === 'rate_limited' ? failure.retryAt : (update.retryAt ?? null);
|
|
111
134
|
return {
|
|
112
|
-
status:
|
|
135
|
+
status: failure.kind === 'auth'
|
|
136
|
+
? 'auth'
|
|
137
|
+
: state.attention.length > 0
|
|
138
|
+
? 'attention'
|
|
139
|
+
: nextPendingCount > 0
|
|
140
|
+
? 'pending'
|
|
141
|
+
: 'error',
|
|
142
|
+
lastAttemptAt: update.attemptAt ?? this.clock(),
|
|
113
143
|
error: message,
|
|
144
|
+
failure,
|
|
145
|
+
retrying: retryAt !== null,
|
|
146
|
+
retryAt,
|
|
114
147
|
pendingCount: nextPendingCount,
|
|
115
148
|
initialPullStatus: 'settled',
|
|
116
149
|
refreshRevision: state.refreshRevision + 1,
|
|
117
150
|
};
|
|
118
151
|
});
|
|
119
152
|
}
|
|
120
|
-
|
|
121
|
-
|
|
153
|
+
setRetrying(retryAt, pendingCount) {
|
|
154
|
+
this.set((state) => {
|
|
155
|
+
const nextPendingCount = pendingCount ?? state.pendingCount;
|
|
156
|
+
return {
|
|
157
|
+
status: state.attention.length > 0 ? 'attention' : nextPendingCount > 0 ? 'pending' : 'error',
|
|
158
|
+
retrying: true,
|
|
159
|
+
retryAt,
|
|
160
|
+
pendingCount: nextPendingCount,
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/** @deprecated Use `setFailure` with typed metadata. */
|
|
165
|
+
setError(message, pendingCount) {
|
|
166
|
+
this.setFailure({ kind: 'network' }, message, pendingCount === undefined ? {} : { pendingCount });
|
|
167
|
+
}
|
|
168
|
+
hydrate(hydrationOrLastSyncAt, legacyItems = [], legacyPendingCount = 0) {
|
|
169
|
+
const hydration = typeof hydrationOrLastSyncAt === 'object' && hydrationOrLastSyncAt !== null
|
|
170
|
+
? hydrationOrLastSyncAt
|
|
171
|
+
: {
|
|
172
|
+
lastAttemptAt: hydrationOrLastSyncAt,
|
|
173
|
+
lastSuccessAt: hydrationOrLastSyncAt,
|
|
174
|
+
attention: legacyItems,
|
|
175
|
+
pendingCount: legacyPendingCount,
|
|
176
|
+
};
|
|
177
|
+
const items = hydration.attention ?? [];
|
|
178
|
+
const pendingCount = hydration.pendingCount ?? 0;
|
|
122
179
|
this.set((state) => ({
|
|
123
180
|
status: settledStatus(items.length, pendingCount),
|
|
124
|
-
|
|
181
|
+
lastAttemptAt: hydration.lastAttemptAt,
|
|
182
|
+
lastSuccessAt: hydration.lastSuccessAt,
|
|
125
183
|
error: null,
|
|
184
|
+
failure: null,
|
|
185
|
+
retrying: false,
|
|
186
|
+
retryAt: null,
|
|
126
187
|
attention: [...items],
|
|
127
188
|
pendingCount,
|
|
128
|
-
initialPullStatus:
|
|
189
|
+
initialPullStatus: hydration.lastSuccessAt === null ? 'uninitialized' : 'settled',
|
|
129
190
|
refreshRevision: state.refreshRevision + 1,
|
|
130
191
|
}));
|
|
131
192
|
}
|
|
132
193
|
reset() {
|
|
133
194
|
this.set(() => initialSnapshot());
|
|
134
195
|
}
|
|
135
|
-
setSecurityBlock(message
|
|
196
|
+
setSecurityBlock(message, failure = {
|
|
197
|
+
kind: 'local_apply',
|
|
198
|
+
}) {
|
|
136
199
|
this.set(() => ({
|
|
137
200
|
status: 'error',
|
|
201
|
+
lastAttemptAt: this.clock(),
|
|
138
202
|
error: message,
|
|
203
|
+
failure,
|
|
204
|
+
retrying: false,
|
|
205
|
+
retryAt: null,
|
|
139
206
|
initialPullStatus: 'settled',
|
|
140
207
|
securityBlock: message,
|
|
141
208
|
}));
|
|
@@ -144,10 +211,14 @@ export class SyncStatusStore {
|
|
|
144
211
|
this.set((state) => ({
|
|
145
212
|
status: settledStatus(state.attention.length, state.pendingCount),
|
|
146
213
|
error: null,
|
|
214
|
+
failure: null,
|
|
215
|
+
retrying: false,
|
|
216
|
+
retryAt: null,
|
|
147
217
|
}));
|
|
148
218
|
}
|
|
149
219
|
set(update) {
|
|
150
|
-
|
|
220
|
+
const next = { ...this.snapshot, ...update(this.snapshot) };
|
|
221
|
+
this.snapshot = { ...next, lastSyncAt: next.lastSuccessAt };
|
|
151
222
|
this.listeners.forEach((listener) => {
|
|
152
223
|
listener(this.snapshot);
|
|
153
224
|
});
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA+C,MAAM,YAAY,CAAC;AA0F7F,SAAS,eAAe;IACtB,OAAO;QACL,MAAM,EAAE,MAAM;QACd,aAAa,EAAE,IAAI;QACnB,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,IAAI;QACb,SAAS,EAAE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