@baukit/sync-client 0.1.2 → 0.2.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/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/transport.d.ts
CHANGED
|
@@ -8,10 +8,14 @@ export interface SyncRequestInit {
|
|
|
8
8
|
export type SyncFetch = (input: string, init?: SyncRequestInit) => Promise<SyncFetchResponse>;
|
|
9
9
|
/** A product API client's decoded request function. */
|
|
10
10
|
export type SyncPrebuiltRequest = <T>(input: string, init?: SyncRequestInit) => Promise<T>;
|
|
11
|
+
export interface SyncResponseHeaders {
|
|
12
|
+
get(name: string): string | null;
|
|
13
|
+
}
|
|
11
14
|
/** Minimal `Response` shape the transport depends on. */
|
|
12
15
|
export interface SyncFetchResponse {
|
|
13
16
|
readonly ok: boolean;
|
|
14
17
|
readonly status: number;
|
|
18
|
+
readonly headers?: SyncResponseHeaders;
|
|
15
19
|
text(): Promise<string>;
|
|
16
20
|
}
|
|
17
21
|
export interface SyncFetchTransportOptions {
|
|
@@ -30,6 +34,10 @@ export interface SyncFetchTransportOptions {
|
|
|
30
34
|
* exists. Defaults to `partition_identity_mismatch`.
|
|
31
35
|
*/
|
|
32
36
|
partitionMismatchCode?: string;
|
|
37
|
+
/** Milliseconds used when `Retry-After` is missing or unusable. Defaults to 60 seconds. */
|
|
38
|
+
retryAfterFallbackMs?: number;
|
|
39
|
+
/** Clock used to resolve `Retry-After`. Defaults to `Date.now`. */
|
|
40
|
+
now?: () => number;
|
|
33
41
|
}
|
|
34
42
|
export interface SyncPrebuiltRequestTransportOptions {
|
|
35
43
|
/**
|
|
@@ -49,6 +57,29 @@ export interface SyncRequestOptions {
|
|
|
49
57
|
partitionId?: string | null;
|
|
50
58
|
signal?: AbortSignal;
|
|
51
59
|
}
|
|
60
|
+
export declare const DEFAULT_RETRY_AFTER_FALLBACK_MS = 60000;
|
|
61
|
+
export interface ParseRetryAfterOptions {
|
|
62
|
+
/** Unix time in milliseconds. Defaults to `Date.now()`. */
|
|
63
|
+
now?: number;
|
|
64
|
+
/** Milliseconds added to `now` for missing, invalid, negative, or past values. */
|
|
65
|
+
fallbackMs?: number;
|
|
66
|
+
}
|
|
67
|
+
/** Resolves an HTTP `Retry-After` delta or date to an ISO timestamp. */
|
|
68
|
+
export declare function parseRetryAfter(value: string | null | undefined, options?: ParseRetryAfterOptions): string;
|
|
69
|
+
export type SyncCursorComparator<TCursor> = (left: TCursor, right: TCursor) => number;
|
|
70
|
+
export interface PullPagePosition<TCursor> {
|
|
71
|
+
nextCursor: TCursor;
|
|
72
|
+
hasMore: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** Checks cursor monotonicity and pagination progress, then returns the page. */
|
|
75
|
+
export declare function validatePullPage<TCursor, TPage extends PullPagePosition<TCursor>>(currentCursor: TCursor, page: TPage, compare: SyncCursorComparator<TCursor>): TPage;
|
|
76
|
+
export interface CursorCommitOptions<TCursor, TResult> {
|
|
77
|
+
nextCursor: TCursor;
|
|
78
|
+
transaction: () => Promise<TResult>;
|
|
79
|
+
commitCursor: (cursor: TCursor) => Promise<void> | void;
|
|
80
|
+
}
|
|
81
|
+
/** Commits a pull cursor only after the local transaction succeeds. */
|
|
82
|
+
export declare function commitCursorAfterLocalTransaction<TCursor, TResult>({ nextCursor, transaction, commitCursor, }: CursorCommitOptions<TCursor, TResult>): Promise<TResult>;
|
|
52
83
|
/**
|
|
53
84
|
* Sync request plumbing for either a raw fetch or a product API client.
|
|
54
85
|
*
|
|
@@ -60,6 +91,8 @@ export declare class SyncTransport {
|
|
|
60
91
|
private readonly baseUrl;
|
|
61
92
|
private readonly partitionHeader;
|
|
62
93
|
private readonly partitionMismatchCode;
|
|
94
|
+
private readonly retryAfterFallbackMs;
|
|
95
|
+
private readonly now;
|
|
63
96
|
constructor(options: SyncTransportOptions);
|
|
64
97
|
/**
|
|
65
98
|
* Sends one sync request and decodes its JSON response.
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAWA,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE9F,uDAAuD;AACvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3F,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,IAAI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ACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAgB;IACtD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAEN,OAAO,EAAE,oBAAoB;IAiB1D;;;;;;OAMG;IACG,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,CAAC,CAAC;YAY9D,IAAI;IAalB,OAAO,CAAC,IAAI;YAwBE,QAAQ;IAQtB,OAAO,CAAC,MAAM;IAWd,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,gBAAgB;CAyBzB"}
|
package/dist/transport.js
CHANGED
|
@@ -1,10 +1,77 @@
|
|
|
1
|
-
import { SyncAuthError, SyncPartitionMismatchError,
|
|
1
|
+
import { SyncAuthError, SyncLocalApplyError, SyncNetworkError, SyncPartitionMismatchError, SyncPayloadCompatibilityError, SyncRateLimitError, SyncServerError, } from './error.js';
|
|
2
2
|
const DEFAULT_PARTITION_HEADER = 'X-Partition-Id';
|
|
3
3
|
const DEFAULT_PARTITION_MISMATCH_CODE = 'partition_identity_mismatch';
|
|
4
4
|
const RETRYABLE_STATUSES = new Set([408, 429]);
|
|
5
|
+
export const DEFAULT_RETRY_AFTER_FALLBACK_MS = 60_000;
|
|
5
6
|
function isRetryableStatus(status) {
|
|
6
7
|
return RETRYABLE_STATUSES.has(status) || status >= 500;
|
|
7
8
|
}
|
|
9
|
+
/** Resolves an HTTP `Retry-After` delta or date to an ISO timestamp. */
|
|
10
|
+
export function parseRetryAfter(value, options = {}) {
|
|
11
|
+
const now = options.now ?? Date.now();
|
|
12
|
+
const fallbackMs = options.fallbackMs ?? DEFAULT_RETRY_AFTER_FALLBACK_MS;
|
|
13
|
+
if (!Number.isFinite(now))
|
|
14
|
+
throw new RangeError('now must be finite');
|
|
15
|
+
if (!Number.isFinite(fallbackMs) || fallbackMs < 0) {
|
|
16
|
+
throw new RangeError('retryAfterFallbackMs must be finite and non-negative');
|
|
17
|
+
}
|
|
18
|
+
const fallbackAt = now + fallbackMs;
|
|
19
|
+
const trimmed = value?.trim() ?? '';
|
|
20
|
+
let candidate = Number.NaN;
|
|
21
|
+
if (/^\d+$/.test(trimmed)) {
|
|
22
|
+
candidate = now + Number(trimmed) * 1_000;
|
|
23
|
+
}
|
|
24
|
+
else if (trimmed.length > 0) {
|
|
25
|
+
candidate = Date.parse(trimmed);
|
|
26
|
+
}
|
|
27
|
+
return toIsoTimestamp(isSupportedTimestamp(candidate) && candidate >= now ? candidate : fallbackAt);
|
|
28
|
+
}
|
|
29
|
+
function isSupportedTimestamp(milliseconds) {
|
|
30
|
+
return Number.isFinite(milliseconds) && !Number.isNaN(new Date(milliseconds).getTime());
|
|
31
|
+
}
|
|
32
|
+
function toIsoTimestamp(milliseconds) {
|
|
33
|
+
try {
|
|
34
|
+
return new Date(milliseconds).toISOString();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
throw new RangeError('resolved Retry-After time is outside the supported date range');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Checks cursor monotonicity and pagination progress, then returns the page. */
|
|
41
|
+
export function validatePullPage(currentCursor, page, compare) {
|
|
42
|
+
const order = compare(page.nextCursor, currentCursor);
|
|
43
|
+
if (!Number.isFinite(order)) {
|
|
44
|
+
throw new SyncPayloadCompatibilityError('The pull cursor comparison was not finite.');
|
|
45
|
+
}
|
|
46
|
+
if (order < 0) {
|
|
47
|
+
throw new SyncPayloadCompatibilityError('The pull cursor moved backwards.');
|
|
48
|
+
}
|
|
49
|
+
if (page.hasMore && order === 0) {
|
|
50
|
+
throw new SyncPayloadCompatibilityError('The pull page did not advance its cursor.');
|
|
51
|
+
}
|
|
52
|
+
return page;
|
|
53
|
+
}
|
|
54
|
+
/** Commits a pull cursor only after the local transaction succeeds. */
|
|
55
|
+
export async function commitCursorAfterLocalTransaction({ nextCursor, transaction, commitCursor, }) {
|
|
56
|
+
let result;
|
|
57
|
+
try {
|
|
58
|
+
result = await transaction();
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error instanceof SyncLocalApplyError)
|
|
62
|
+
throw error;
|
|
63
|
+
throw new SyncLocalApplyError('The local pull transaction failed.', error);
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
await commitCursor(nextCursor);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error instanceof SyncLocalApplyError)
|
|
70
|
+
throw error;
|
|
71
|
+
throw new SyncLocalApplyError('The pull cursor could not be committed.', error);
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
8
75
|
function parseErrorBody(body) {
|
|
9
76
|
try {
|
|
10
77
|
const decoded = JSON.parse(body);
|
|
@@ -25,6 +92,8 @@ export class SyncTransport {
|
|
|
25
92
|
baseUrl;
|
|
26
93
|
partitionHeader;
|
|
27
94
|
partitionMismatchCode;
|
|
95
|
+
retryAfterFallbackMs;
|
|
96
|
+
now;
|
|
28
97
|
constructor(options) {
|
|
29
98
|
this.options = options;
|
|
30
99
|
this.baseUrl = 'fetch' in options ? options.baseUrl.replace(/\/+$/, '') : null;
|
|
@@ -33,6 +102,14 @@ export class SyncTransport {
|
|
|
33
102
|
'fetch' in options
|
|
34
103
|
? (options.partitionMismatchCode ?? DEFAULT_PARTITION_MISMATCH_CODE)
|
|
35
104
|
: null;
|
|
105
|
+
this.retryAfterFallbackMs =
|
|
106
|
+
'fetch' in options
|
|
107
|
+
? (options.retryAfterFallbackMs ?? DEFAULT_RETRY_AFTER_FALLBACK_MS)
|
|
108
|
+
: DEFAULT_RETRY_AFTER_FALLBACK_MS;
|
|
109
|
+
this.now = 'fetch' in options ? (options.now ?? Date.now) : Date.now;
|
|
110
|
+
if (!Number.isFinite(this.retryAfterFallbackMs) || this.retryAfterFallbackMs < 0) {
|
|
111
|
+
throw new RangeError('retryAfterFallbackMs must be finite and non-negative');
|
|
112
|
+
}
|
|
36
113
|
}
|
|
37
114
|
/**
|
|
38
115
|
* Sends one sync request and decodes its JSON response.
|
|
@@ -48,7 +125,7 @@ export class SyncTransport {
|
|
|
48
125
|
const response = await this.send(path, options);
|
|
49
126
|
const body = await this.readBody(response);
|
|
50
127
|
if (!response.ok) {
|
|
51
|
-
throw this.asTransportError(response.status, body);
|
|
128
|
+
throw this.asTransportError(response.status, body, response.headers?.get('Retry-After'));
|
|
52
129
|
}
|
|
53
130
|
return this.decode(body);
|
|
54
131
|
}
|
|
@@ -62,7 +139,7 @@ export class SyncTransport {
|
|
|
62
139
|
return await this.options.fetch(this.url(path, options.query), init);
|
|
63
140
|
}
|
|
64
141
|
catch (error) {
|
|
65
|
-
throw new
|
|
142
|
+
throw new SyncNetworkError(errorMessage(error), error);
|
|
66
143
|
}
|
|
67
144
|
}
|
|
68
145
|
init(options, initialHeaders) {
|
|
@@ -90,7 +167,7 @@ export class SyncTransport {
|
|
|
90
167
|
return await response.text();
|
|
91
168
|
}
|
|
92
169
|
catch (error) {
|
|
93
|
-
throw new
|
|
170
|
+
throw new SyncNetworkError(errorMessage(error), error);
|
|
94
171
|
}
|
|
95
172
|
}
|
|
96
173
|
decode(body) {
|
|
@@ -101,7 +178,7 @@ export class SyncTransport {
|
|
|
101
178
|
return JSON.parse(body);
|
|
102
179
|
}
|
|
103
180
|
catch (error) {
|
|
104
|
-
throw new
|
|
181
|
+
throw new SyncPayloadCompatibilityError('The sync response was not valid JSON.', error);
|
|
105
182
|
}
|
|
106
183
|
}
|
|
107
184
|
url(path, query) {
|
|
@@ -111,7 +188,7 @@ export class SyncTransport {
|
|
|
111
188
|
const suffix = query ? `?${new URLSearchParams(query).toString()}` : '';
|
|
112
189
|
return `${path}${suffix}`;
|
|
113
190
|
}
|
|
114
|
-
asTransportError(status, body) {
|
|
191
|
+
asTransportError(status, body, retryAfter) {
|
|
115
192
|
const decoded = parseErrorBody(body);
|
|
116
193
|
const message = typeof decoded.message === 'string' && decoded.message.length > 0
|
|
117
194
|
? decoded.message
|
|
@@ -122,7 +199,14 @@ export class SyncTransport {
|
|
|
122
199
|
if (status === 401) {
|
|
123
200
|
return new SyncAuthError(message);
|
|
124
201
|
}
|
|
125
|
-
|
|
202
|
+
if (status === 429) {
|
|
203
|
+
const retryAt = parseRetryAfter(retryAfter, {
|
|
204
|
+
now: this.now(),
|
|
205
|
+
fallbackMs: this.retryAfterFallbackMs,
|
|
206
|
+
});
|
|
207
|
+
return new SyncRateLimitError(message, retryAt, retryAfter ?? null);
|
|
208
|
+
}
|
|
209
|
+
return new SyncServerError(message, isRetryableStatus(status));
|
|
126
210
|
}
|
|
127
211
|
}
|
|
128
212
|
function errorMessage(error) {
|
package/dist/transport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,6BAA6B,EAC7B,kBAAkB,EAClB,eAAe,GAEhB,MAAM,YAAY,CAAC;AAsEpB,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAClD,MAAM,+BAA+B,GAAG,6BAA6B,CAAC;AACtE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC;AAOtD,SAAS,iBAAiB,CAAC,MAAc;IACvC,OAAO,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,GAAG,CAAC;AACzD,CAAC;AASD,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAC7B,KAAgC,EACh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,CAAC;YAC/D,CAAC,CAAC,OAAO,CAAC,OAAO;YACjB,CAAC,CAAC,mCAAmC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,IAAI,IAAI,CAAC,qBAAqB,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,qBAAqB,EAAE,CAAC;YACvF,OAAO,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,EAAE;gBAC1C,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;gBACf,UAAU,EAAE,IAAI,CAAC,oBAAoB;aACtC,CAAC,CAAC;YACH,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,IAAI,IAAI,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,CAAC;CACF;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baukit/sync-client",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Client-side scheduling, transport, status reporting, and ordering for offline-capable sync loops.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Patrick Koss",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"./expo": {
|
|
30
30
|
"types": "./dist/expo.d.ts",
|
|
31
31
|
"import": "./dist/expo.js"
|
|
32
|
+
},
|
|
33
|
+
"./conformance": {
|
|
34
|
+
"types": "./dist/conformance.d.ts",
|
|
35
|
+
"import": "./dist/conformance.js"
|
|
32
36
|
}
|
|
33
37
|
},
|
|
34
38
|
"files": [
|