@interop/was-react 0.1.2 → 0.1.4
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 +9 -1
- package/dist/auth/chapi.d.ts +3 -1
- package/dist/auth/chapi.d.ts.map +1 -1
- package/dist/auth/chapi.js +6 -2
- package/dist/auth/chapi.js.map +1 -1
- package/dist/auth/loginFlow.d.ts +30 -10
- package/dist/auth/loginFlow.d.ts.map +1 -1
- package/dist/auth/loginFlow.js +3 -1
- package/dist/auth/loginFlow.js.map +1 -1
- package/dist/auth/loginRequest.d.ts +9 -3
- package/dist/auth/loginRequest.d.ts.map +1 -1
- package/dist/auth/loginRequest.js +9 -3
- package/dist/auth/loginRequest.js.map +1 -1
- package/dist/auth/verifyResponse.d.ts +9 -3
- package/dist/auth/verifyResponse.d.ts.map +1 -1
- package/dist/auth/verifyResponse.js +6 -2
- package/dist/auth/verifyResponse.js.map +1 -1
- package/dist/config.d.ts +60 -20
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -4
- package/dist/config.js.map +1 -1
- package/dist/dev/cli.d.ts.map +1 -1
- package/dist/dev/cli.js +4 -7
- package/dist/dev/cli.js.map +1 -1
- package/dist/dev/provisionDevGrants.d.ts +15 -5
- package/dist/dev/provisionDevGrants.d.ts.map +1 -1
- package/dist/dev/provisionDevGrants.js +2 -2
- package/dist/dev/provisionDevGrants.js.map +1 -1
- package/dist/grants.d.ts +7 -19
- package/dist/grants.d.ts.map +1 -1
- package/dist/grants.js +28 -7
- package/dist/grants.js.map +1 -1
- package/dist/identity/appSession.d.ts +9 -3
- package/dist/identity/appSession.d.ts.map +1 -1
- package/dist/identity/appSession.js +3 -1
- package/dist/identity/appSession.js.map +1 -1
- package/dist/identity/documentLoader.d.ts +3 -1
- package/dist/identity/documentLoader.d.ts.map +1 -1
- package/dist/identity/documentLoader.js +6 -2
- package/dist/identity/documentLoader.js.map +1 -1
- package/dist/identity/seedCredential.d.ts +9 -3
- package/dist/identity/seedCredential.d.ts.map +1 -1
- package/dist/identity/seedCredential.js +9 -15
- package/dist/identity/seedCredential.js.map +1 -1
- package/dist/identity/seedStore.d.ts +18 -6
- package/dist/identity/seedStore.d.ts.map +1 -1
- package/dist/identity/seedStore.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/react/WasSessionProvider.d.ts.map +1 -1
- package/dist/react/WasSessionProvider.js +10 -1
- package/dist/react/WasSessionProvider.js.map +1 -1
- package/dist/react/hooks.d.ts +10 -5
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/hooks.js +6 -30
- package/dist/react/hooks.js.map +1 -1
- package/dist/session/authStore.d.ts +29 -7
- package/dist/session/authStore.d.ts.map +1 -1
- package/dist/session/authStore.js +125 -64
- package/dist/session/authStore.js.map +1 -1
- package/dist/storage/entityStore.d.ts +32 -9
- package/dist/storage/entityStore.d.ts.map +1 -1
- package/dist/storage/entityStore.js +88 -48
- package/dist/storage/entityStore.js.map +1 -1
- package/dist/storage/localStore.d.ts +53 -0
- package/dist/storage/localStore.d.ts.map +1 -1
- package/dist/storage/localStore.js +140 -12
- package/dist/storage/localStore.js.map +1 -1
- package/dist/storage/rehydrate.d.ts +8 -0
- package/dist/storage/rehydrate.d.ts.map +1 -1
- package/dist/storage/rehydrate.js +31 -2
- package/dist/storage/rehydrate.js.map +1 -1
- package/dist/storage/syncController.d.ts +7 -3
- package/dist/storage/syncController.d.ts.map +1 -1
- package/dist/storage/syncController.js +28 -15
- package/dist/storage/syncController.js.map +1 -1
- package/dist/storage/syncStatusStore.d.ts +26 -1
- package/dist/storage/syncStatusStore.d.ts.map +1 -1
- package/dist/storage/syncStatusStore.js +40 -0
- package/dist/storage/syncStatusStore.js.map +1 -1
- package/dist/storage/wasRemoteStore.d.ts +3 -1
- package/dist/storage/wasRemoteStore.d.ts.map +1 -1
- package/dist/storage/wasRemoteStore.js +3 -3
- package/dist/storage/wasRemoteStore.js.map +1 -1
- package/dist/sync/feedMasterPort.d.ts +21 -19
- package/dist/sync/feedMasterPort.d.ts.map +1 -1
- package/dist/sync/feedMasterPort.js +18 -5
- package/dist/sync/feedMasterPort.js.map +1 -1
- package/dist/sync/index.d.ts +3 -3
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +2 -2
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/lwwConflictHandler.d.ts +35 -2
- package/dist/sync/lwwConflictHandler.d.ts.map +1 -1
- package/dist/sync/lwwConflictHandler.js +47 -9
- package/dist/sync/lwwConflictHandler.js.map +1 -1
- package/dist/sync/pushWrites.d.ts +27 -8
- package/dist/sync/pushWrites.d.ts.map +1 -1
- package/dist/sync/pushWrites.js +43 -15
- package/dist/sync/pushWrites.js.map +1 -1
- package/dist/sync/types.d.ts +49 -16
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +17 -0
- package/dist/sync/types.js.map +1 -1
- package/dist/sync/wasReplication.d.ts.map +1 -1
- package/dist/sync/wasReplication.js +38 -1
- package/dist/sync/wasReplication.js.map +1 -1
- package/dist/sync/wasSyncPort.d.ts +29 -6
- package/dist/sync/wasSyncPort.d.ts.map +1 -1
- package/dist/sync/wasSyncPort.js +105 -101
- package/dist/sync/wasSyncPort.js.map +1 -1
- package/package.json +4 -3
- package/dist/auth/verifyResponse.test.d.ts +0 -2
- package/dist/auth/verifyResponse.test.d.ts.map +0 -1
- package/dist/auth/verifyResponse.test.js +0 -282
- package/dist/auth/verifyResponse.test.js.map +0 -1
- package/dist/dev/cli.test.d.ts +0 -2
- package/dist/dev/cli.test.d.ts.map +0 -1
- package/dist/dev/cli.test.js +0 -39
- package/dist/dev/cli.test.js.map +0 -1
- package/dist/grants.test.d.ts +0 -2
- package/dist/grants.test.d.ts.map +0 -1
- package/dist/grants.test.js +0 -79
- package/dist/grants.test.js.map +0 -1
- package/dist/identity/seedCredential.test.d.ts +0 -2
- package/dist/identity/seedCredential.test.d.ts.map +0 -1
- package/dist/identity/seedCredential.test.js +0 -205
- package/dist/identity/seedCredential.test.js.map +0 -1
- package/dist/storage/rehydrate.test.d.ts +0 -2
- package/dist/storage/rehydrate.test.d.ts.map +0 -1
- package/dist/storage/rehydrate.test.js +0 -172
- package/dist/storage/rehydrate.test.js.map +0 -1
- package/dist/sync/changesQuery.test.d.ts +0 -2
- package/dist/sync/changesQuery.test.d.ts.map +0 -1
- package/dist/sync/changesQuery.test.js +0 -145
- package/dist/sync/changesQuery.test.js.map +0 -1
- package/dist/sync/lww.test.d.ts +0 -2
- package/dist/sync/lww.test.d.ts.map +0 -1
- package/dist/sync/lww.test.js +0 -28
- package/dist/sync/lww.test.js.map +0 -1
- package/dist/sync/lwwConflictHandler.test.d.ts +0 -2
- package/dist/sync/lwwConflictHandler.test.d.ts.map +0 -1
- package/dist/sync/lwwConflictHandler.test.js +0 -78
- package/dist/sync/lwwConflictHandler.test.js.map +0 -1
- package/dist/sync/pushWrites.test.d.ts +0 -2
- package/dist/sync/pushWrites.test.d.ts.map +0 -1
- package/dist/sync/pushWrites.test.js +0 -287
- package/dist/sync/pushWrites.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pushWrites.js","sourceRoot":"","sources":["../../src/sync/pushWrites.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pushWrites.js","sourceRoot":"","sources":["../../src/sync/pushWrites.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAcjD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,OAAO,IAAI,QAAQ,GAAG,CAAA;AACxB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,WAAW,CAAC,IAAsB,EAAE,KAAuB;IAClE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,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;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAiB,EACjB,eAAsD;IAEtD,OAAO,KAAK,UAAU,IAAI,CACxB,IAGE;QAEF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,IAAI,CAAC,GAAG,CAAC,KAAK,EAAC,GAAG,EAAC,EAAE;YACnB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;gBAC3B,IAAI;gBACJ,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;gBACtC,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;aAC3C,CAAC,CAAA;YACF,IAAI,MAAM,CAAC,GAAG,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;gBACzD,MAAM,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACnC,CAAC;YACD,OAAO,MAAM,CAAA;QACf,CAAC,CAAC,CACH,CAAA;QACD,OAAO,OAAO;aACX,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;aAC9B,MAAM,CACL,CAAC,QAAQ,EAAsC,EAAE,CAAC,QAAQ,KAAK,IAAI,CACpE,CAAA;IACL,CAAC,CAAA;AACH,CAAC"}
|
package/dist/sync/types.d.ts
CHANGED
|
@@ -87,18 +87,23 @@ export interface MasterState {
|
|
|
87
87
|
custom?: Json;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
* The injected WAS-access seam. An adapter (the app-side
|
|
91
|
-
* implements this over `@interop/was-client`; the core
|
|
92
|
-
* this interface, never on `was-client` itself. Every
|
|
93
|
-
* body verbatim -- no codec, no key handling -- so the
|
|
94
|
-
* plaintext and encrypted collections alike.
|
|
90
|
+
* The write/query half of the injected WAS-access seam. An adapter (the app-side
|
|
91
|
+
* `createWasSyncPort`) implements this over `@interop/was-client`; the core
|
|
92
|
+
* module depends only on this interface, never on `was-client` itself. Every
|
|
93
|
+
* method moves the stored body verbatim -- no codec, no key handling -- so the
|
|
94
|
+
* same port works for plaintext and encrypted collections alike.
|
|
95
95
|
*
|
|
96
96
|
* `putContent` / `deleteContent` / `putMeta` MUST throw
|
|
97
97
|
* {@link WasSyncConflictError} when the server rejects a conditional write with
|
|
98
98
|
* `412 precondition-failed`, and let every other error propagate so RxDB's
|
|
99
99
|
* retry/backoff handles it.
|
|
100
|
+
*
|
|
101
|
+
* The 412 conflict re-read (`get`) is deliberately NOT part of this base:
|
|
102
|
+
* `createWasSyncPort` returns a `WasSyncBasePort`, and `withFeedMasterRead`
|
|
103
|
+
* supplies a `get` that resolves the master state from the changes-feed body
|
|
104
|
+
* (origin-independent) to produce a full {@link WasSyncPort}.
|
|
100
105
|
*/
|
|
101
|
-
export interface
|
|
106
|
+
export interface WasSyncBasePort {
|
|
102
107
|
/**
|
|
103
108
|
* Pulls one page of the `changes` feed. Omit `checkpoint` for the first page.
|
|
104
109
|
* Returns the page's `documents` and its resume `checkpoint`, or
|
|
@@ -119,59 +124,74 @@ export interface WasSyncPort {
|
|
|
119
124
|
/**
|
|
120
125
|
* Conditionally writes the content body verbatim (`PUT /:id`). Pass
|
|
121
126
|
* `ifNoneMatch: true` for a create-if-absent, or `ifMatch` (a quoted ETag over
|
|
122
|
-
* the content `version`) for an update-if-unchanged.
|
|
127
|
+
* the content `version`) for an update-if-unchanged. Returns the new content
|
|
128
|
+
* `version` parsed from the response ETag (the acked master revision), or
|
|
129
|
+
* `undefined` when the server does not supply one.
|
|
123
130
|
*
|
|
124
131
|
* @param options {object}
|
|
125
132
|
* @param options.id {string}
|
|
126
133
|
* @param options.data {Json}
|
|
127
134
|
* @param [options.ifMatch] {string}
|
|
128
135
|
* @param [options.ifNoneMatch] {boolean}
|
|
129
|
-
* @returns {Promise<
|
|
136
|
+
* @returns {Promise<number | undefined>}
|
|
130
137
|
*/
|
|
131
138
|
putContent(options: {
|
|
132
139
|
id: string;
|
|
133
140
|
data: Json;
|
|
134
141
|
ifMatch?: string;
|
|
135
142
|
ifNoneMatch?: boolean;
|
|
136
|
-
}): Promise<
|
|
143
|
+
}): Promise<number | undefined>;
|
|
137
144
|
/**
|
|
138
145
|
* Conditionally deletes a resource (writes a tombstone; `DELETE /:id`). Pass
|
|
139
146
|
* `ifMatch` (a quoted ETag over the content `version`) to delete only if
|
|
140
|
-
* unchanged.
|
|
147
|
+
* unchanged. Returns the tombstone `version` parsed from the response ETag
|
|
148
|
+
* when the server supplies one (the reference server does not).
|
|
141
149
|
*
|
|
142
150
|
* @param options {object}
|
|
143
151
|
* @param options.id {string}
|
|
144
152
|
* @param [options.ifMatch] {string}
|
|
145
|
-
* @returns {Promise<
|
|
153
|
+
* @returns {Promise<number | undefined>}
|
|
146
154
|
*/
|
|
147
155
|
deleteContent(options: {
|
|
148
156
|
id: string;
|
|
149
157
|
ifMatch?: string;
|
|
150
|
-
}): Promise<
|
|
158
|
+
}): Promise<number | undefined>;
|
|
151
159
|
/**
|
|
152
160
|
* Conditionally writes the metadata body verbatim (`PUT /:id/meta`, body
|
|
153
161
|
* `{ custom }`). Pass `ifNoneMatch: true` when the resource has no metadata
|
|
154
162
|
* yet, or `ifMatch` (a quoted ETag over `metaVersion`) for an
|
|
155
163
|
* update-if-unchanged. The resource must already exist (the server does not
|
|
156
|
-
* create a resource from a `/meta` write).
|
|
164
|
+
* create a resource from a `/meta` write). Returns the new `metaVersion`
|
|
165
|
+
* parsed from the response ETag, or `undefined` when the server does not
|
|
166
|
+
* supply one.
|
|
157
167
|
*
|
|
158
168
|
* @param options {object}
|
|
159
169
|
* @param options.id {string}
|
|
160
170
|
* @param options.custom {Json}
|
|
161
171
|
* @param [options.ifMatch] {string}
|
|
162
172
|
* @param [options.ifNoneMatch] {boolean}
|
|
163
|
-
* @returns {Promise<
|
|
173
|
+
* @returns {Promise<number | undefined>}
|
|
164
174
|
*/
|
|
165
175
|
putMeta(options: {
|
|
166
176
|
id: string;
|
|
167
177
|
custom: Json;
|
|
168
178
|
ifMatch?: string;
|
|
169
179
|
ifNoneMatch?: boolean;
|
|
170
|
-
}): Promise<
|
|
180
|
+
}): Promise<number | undefined>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The full sync port the core consumes: a {@link WasSyncBasePort}'s write/query
|
|
184
|
+
* methods plus the `get` used by the 412 conflict assembler. The push handler
|
|
185
|
+
* and `createWasReplication` require this full port; build one by wrapping a
|
|
186
|
+
* base port with `withFeedMasterRead`, which supplies `get`.
|
|
187
|
+
*/
|
|
188
|
+
export interface WasSyncPort extends WasSyncBasePort {
|
|
171
189
|
/**
|
|
172
190
|
* Re-reads a single resource's current master state (content + metadata) for
|
|
173
191
|
* the 412 conflict assembler. Returns `null` when the resource is genuinely
|
|
174
|
-
* absent (a delete/delete race)
|
|
192
|
+
* absent (a delete/delete race); throws a retryable error when the master
|
|
193
|
+
* cannot be resolved (e.g. a feed re-read that exhausts its scan budget), so
|
|
194
|
+
* the replication cycle retries rather than fabricating a false tombstone.
|
|
175
195
|
*
|
|
176
196
|
* @param options {object}
|
|
177
197
|
* @param options.id {string}
|
|
@@ -191,4 +211,17 @@ export interface WasSyncPort {
|
|
|
191
211
|
export declare class WasSyncConflictError extends Error {
|
|
192
212
|
constructor(message?: string);
|
|
193
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Thrown by a {@link WasSyncPort} implementation when a request is rejected with
|
|
216
|
+
* `401 unauthorized` or `403 forbidden` -- the storage-access-expired/revoked
|
|
217
|
+
* signal. Mapping the raw HTTP status to a typed error at the port boundary (the
|
|
218
|
+
* same way `412` becomes {@link WasSyncConflictError}) lets the sync controller
|
|
219
|
+
* recognise expired access with an `instanceof` check rather than re-extracting
|
|
220
|
+
* status codes from a wrapped RxDB error graph. The offending HTTP status is
|
|
221
|
+
* kept on `status` for diagnostics.
|
|
222
|
+
*/
|
|
223
|
+
export declare class WasSyncAuthError extends Error {
|
|
224
|
+
readonly status: number;
|
|
225
|
+
constructor(status: number);
|
|
226
|
+
}
|
|
194
227
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/sync/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sync/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;GAIG;AACH,MAAM,MAAM,IAAI,GACd,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAA;AAErE;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,MAAM,CAAC,EAAE,IAAI,CAAA;CACd;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,MAAM,CAAC,EAAE,IAAI,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,MAAM,CAAC,EAAE,IAAI,CAAA;CACd;AAED
|
|
1
|
+
{"version":3,"file":"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MAAM;CAK3B"}
|
package/dist/sync/types.js
CHANGED
|
@@ -33,4 +33,21 @@ export class WasSyncConflictError extends Error {
|
|
|
33
33
|
this.name = 'WasSyncConflictError';
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Thrown by a {@link WasSyncPort} implementation when a request is rejected with
|
|
38
|
+
* `401 unauthorized` or `403 forbidden` -- the storage-access-expired/revoked
|
|
39
|
+
* signal. Mapping the raw HTTP status to a typed error at the port boundary (the
|
|
40
|
+
* same way `412` becomes {@link WasSyncConflictError}) lets the sync controller
|
|
41
|
+
* recognise expired access with an `instanceof` check rather than re-extracting
|
|
42
|
+
* status codes from a wrapped RxDB error graph. The offending HTTP status is
|
|
43
|
+
* kept on `status` for diagnostics.
|
|
44
|
+
*/
|
|
45
|
+
export class WasSyncAuthError extends Error {
|
|
46
|
+
status;
|
|
47
|
+
constructor(status) {
|
|
48
|
+
super(`WAS storage access denied (HTTP ${status}).`);
|
|
49
|
+
this.name = 'WasSyncAuthError';
|
|
50
|
+
this.status = status;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
36
53
|
//# sourceMappingURL=types.js.map
|
package/dist/sync/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sync/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sync/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AA2LH;;;;;;GAMG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAO,GAAG,4CAA4C;QAChE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;IACpC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,MAAM,CAAQ;IACvB,YAAY,MAAc;QACxB,KAAK,CAAC,mCAAmC,MAAM,IAAI,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasReplication.d.ts","sourceRoot":"","sources":["../../src/sync/wasReplication.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"wasReplication.d.ts","sourceRoot":"","sources":["../../src/sync/wasReplication.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AA2CxE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,YAAY,EACZ,OAAO,EACP,qBAAqB,EACrB,SAAe,EACf,SAAS,EACT,IAAW,EACX,SAAgB,EAChB,YAAyB,EAC1B,EAAE;IACD,YAAY,EAAE,YAAY,CAAC,SAAS,CAAC,CAAA;IACrC,OAAO,EAAE,WAAW,CAAA;IACpB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,kBAAkB,CAAC,SAAS,EAAE,cAAc,CAAC,CAiBhD"}
|
|
@@ -16,6 +16,43 @@
|
|
|
16
16
|
import { replicateRxCollection } from 'rxdb/plugins/replication';
|
|
17
17
|
import { createPullHandler } from './changesQuery.js';
|
|
18
18
|
import { createPushHandler } from './pushWrites.js';
|
|
19
|
+
/**
|
|
20
|
+
* Builds the push write-back: patches an accepted write's acked server
|
|
21
|
+
* revision(s) (`version` / `metaVersion`) into the local row so the next
|
|
22
|
+
* conditional write's `If-Match` matches the server. Skips rows that are gone
|
|
23
|
+
* or already current (a tombstoned row is invisible to `findOne` and needs no
|
|
24
|
+
* write-back -- nothing further is pushed for a deleted id). Failures are
|
|
25
|
+
* swallowed: the write itself succeeded, and a missed write-back only means
|
|
26
|
+
* the acked revision is adopted from the change feed's echo on a later pull.
|
|
27
|
+
*
|
|
28
|
+
* @param rxCollection {RxCollection<SyncedDoc>}
|
|
29
|
+
* @returns {(ack: PushWriteAck) => Promise<void>}
|
|
30
|
+
*/
|
|
31
|
+
function createAckWriteBack(rxCollection) {
|
|
32
|
+
return async function writeBack(ack) {
|
|
33
|
+
try {
|
|
34
|
+
const doc = await rxCollection.findOne(ack.id).exec();
|
|
35
|
+
if (doc === null) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const patch = {};
|
|
39
|
+
if (ack.version !== undefined && doc.get('version') !== ack.version) {
|
|
40
|
+
patch.version = ack.version;
|
|
41
|
+
}
|
|
42
|
+
if (ack.metaVersion !== undefined &&
|
|
43
|
+
doc.get('metaVersion') !== ack.metaVersion) {
|
|
44
|
+
patch.metaVersion = ack.metaVersion;
|
|
45
|
+
}
|
|
46
|
+
if (Object.keys(patch).length > 0) {
|
|
47
|
+
await doc.incrementalPatch(patch);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// Best-effort: the server write was accepted; the revision echo on the
|
|
52
|
+
// next pull corrects the row if this local patch could not be applied.
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
19
56
|
/**
|
|
20
57
|
* Starts (or configures) replication of one RxDB collection against a remote WAS
|
|
21
58
|
* Collection. Poll-based only -- no `pull.stream$` (live streaming is deferred
|
|
@@ -47,7 +84,7 @@ export function createWasReplication({ rxCollection, wasPort, replicationIdentif
|
|
|
47
84
|
batchSize
|
|
48
85
|
},
|
|
49
86
|
push: {
|
|
50
|
-
handler: createPushHandler(wasPort),
|
|
87
|
+
handler: createPushHandler(wasPort, createAckWriteBack(rxCollection)),
|
|
51
88
|
batchSize
|
|
52
89
|
}
|
|
53
90
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasReplication.js","sourceRoot":"","sources":["../../src/sync/wasReplication.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EACL,qBAAqB,EAEtB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"wasReplication.js","sourceRoot":"","sources":["../../src/sync/wasReplication.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EACL,qBAAqB,EAEtB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,iBAAiB,CAAA;AAEtE;;;;;;;;;;;GAWG;AACH,SAAS,kBAAkB,CAAC,YAAqC;IAC/D,OAAO,KAAK,UAAU,SAAS,CAAC,GAAiB;QAC/C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,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,OAAO,EAAE,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;YACrE,SAAS;SACV;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* The app-side seam between the generic sync adapter and `@interop/was-client`.
|
|
6
|
-
* Implements the `
|
|
7
|
-
* raw, signed `was.request()` escape hatch.
|
|
6
|
+
* Implements the `WasSyncBasePort` interface (query + conditional writes) for one
|
|
7
|
+
* remote WAS Collection using the raw, signed `was.request()` escape hatch. The
|
|
8
|
+
* 412 conflict re-read (`get`) is supplied separately by `withFeedMasterRead`,
|
|
9
|
+
* which resolves the master state from the changes-feed body -- origin-
|
|
10
|
+
* independent, unlike a cross-origin `GET` ETag header.
|
|
8
11
|
*
|
|
9
12
|
* Using `request()` (rather than the `Resource` / `Collection` handles) is
|
|
10
13
|
* deliberate: it moves the stored body VERBATIM, bypassing the encryption codec.
|
|
@@ -20,9 +23,29 @@
|
|
|
20
23
|
* for plaintext and encrypted resources alike -- so there is no plaintext-vs-
|
|
21
24
|
* encrypted fork here.
|
|
22
25
|
*/
|
|
23
|
-
import type
|
|
26
|
+
import { type WasClient } from '@interop/was-client';
|
|
24
27
|
import type { IZcap } from '@interop/data-integrity-core';
|
|
25
|
-
import { type
|
|
28
|
+
import { type WasSyncBasePort } from './types.js';
|
|
29
|
+
/**
|
|
30
|
+
* Extracts an HTTP status from a raw ky/ezcap error. `was.request()` rejects on
|
|
31
|
+
* any non-2xx with `err.status` set (see `@interop/http-client`'s error
|
|
32
|
+
* normaliser); this reads it defensively from either location. Shared with the
|
|
33
|
+
* remote store's marker PUT and the dev-grant provisioner, which need the raw
|
|
34
|
+
* status for diagnostics rather than the mapped sync error.
|
|
35
|
+
*
|
|
36
|
+
* @param err {unknown}
|
|
37
|
+
* @returns {number | undefined}
|
|
38
|
+
*/
|
|
39
|
+
export declare function errorStatus(err: unknown): number | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Normalizes an unknown caught error into a display string: the `Error`'s
|
|
42
|
+
* `message` when it is one, else its `String(...)` coercion. Shared by the
|
|
43
|
+
* remote store's marker PUT and the session activation error path.
|
|
44
|
+
*
|
|
45
|
+
* @param err {unknown}
|
|
46
|
+
* @returns {string}
|
|
47
|
+
*/
|
|
48
|
+
export declare function errorMessage(err: unknown): string;
|
|
26
49
|
/**
|
|
27
50
|
* Builds a `WasSyncPort` bound to a single Space + Collection on the remote WAS
|
|
28
51
|
* server, backed by the session's signed `WasClient`.
|
|
@@ -34,12 +57,12 @@ import { type WasSyncPort } from './types.js';
|
|
|
34
57
|
* @param [options.capability] {IZcap} the delegated session capability for
|
|
35
58
|
* this collection (a restored `delegated` tier session); absent in the full
|
|
36
59
|
* tier, where requests invoke root capabilities
|
|
37
|
-
* @returns {
|
|
60
|
+
* @returns {WasSyncBasePort}
|
|
38
61
|
*/
|
|
39
62
|
export declare function createWasSyncPort({ was, spaceId, collectionId, capability }: {
|
|
40
63
|
was: WasClient;
|
|
41
64
|
spaceId: string;
|
|
42
65
|
collectionId: string;
|
|
43
66
|
capability?: IZcap;
|
|
44
|
-
}):
|
|
67
|
+
}): WasSyncBasePort;
|
|
45
68
|
//# sourceMappingURL=wasSyncPort.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasSyncPort.d.ts","sourceRoot":"","sources":["../../src/sync/wasSyncPort.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"wasSyncPort.d.ts","sourceRoot":"","sources":["../../src/sync/wasSyncPort.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK5D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAEjD;AAuCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,OAAO,EACP,YAAY,EACZ,UAAU,EACX,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GAAG,eAAe,CAsFlB"}
|
package/dist/sync/wasSyncPort.js
CHANGED
|
@@ -1,25 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The app-side seam between the generic sync adapter and `@interop/was-client`.
|
|
6
|
+
* Implements the `WasSyncBasePort` interface (query + conditional writes) for one
|
|
7
|
+
* remote WAS Collection using the raw, signed `was.request()` escape hatch. The
|
|
8
|
+
* 412 conflict re-read (`get`) is supplied separately by `withFeedMasterRead`,
|
|
9
|
+
* which resolves the master state from the changes-feed body -- origin-
|
|
10
|
+
* independent, unlike a cross-origin `GET` ETag header.
|
|
11
|
+
*
|
|
12
|
+
* Using `request()` (rather than the `Resource` / `Collection` handles) is
|
|
13
|
+
* deliberate: it moves the stored body VERBATIM, bypassing the encryption codec.
|
|
14
|
+
* The `changes` feed already ships opaque stored bodies (plaintext for a
|
|
15
|
+
* plaintext collection, the EDV envelope for an encrypted one), and the push
|
|
16
|
+
* side must write those same bytes back unchanged -- running them through
|
|
17
|
+
* `resource.put()` would re-encrypt an already-encrypted envelope. Encrypt /
|
|
18
|
+
* decrypt stays a read/write-time concern above this layer; this port is
|
|
19
|
+
* collection-agnostic and never touches keys.
|
|
20
|
+
*
|
|
21
|
+
* Conditional writes ride the server's monotonic `version` (content) and
|
|
22
|
+
* `metaVersion` (metadata) ETags, which the reference server enforces uniformly
|
|
23
|
+
* for plaintext and encrypted resources alike -- so there is no plaintext-vs-
|
|
24
|
+
* encrypted fork here.
|
|
25
|
+
*/
|
|
26
|
+
import { readEtag, writeHeaders } from '@interop/was-client';
|
|
27
|
+
import { WasSyncAuthError, WasSyncConflictError } from './types.js';
|
|
2
28
|
/**
|
|
3
29
|
* Extracts an HTTP status from a raw ky/ezcap error. `was.request()` rejects on
|
|
4
30
|
* any non-2xx with `err.status` set (see `@interop/http-client`'s error
|
|
5
|
-
* normaliser); this reads it defensively from either location.
|
|
31
|
+
* normaliser); this reads it defensively from either location. Shared with the
|
|
32
|
+
* remote store's marker PUT and the dev-grant provisioner, which need the raw
|
|
33
|
+
* status for diagnostics rather than the mapped sync error.
|
|
6
34
|
*
|
|
7
35
|
* @param err {unknown}
|
|
8
36
|
* @returns {number | undefined}
|
|
9
37
|
*/
|
|
10
|
-
function errorStatus(err) {
|
|
38
|
+
export function errorStatus(err) {
|
|
11
39
|
return (err.status ??
|
|
12
40
|
err.response?.status);
|
|
13
41
|
}
|
|
14
42
|
/**
|
|
15
|
-
*
|
|
16
|
-
* when
|
|
43
|
+
* Normalizes an unknown caught error into a display string: the `Error`'s
|
|
44
|
+
* `message` when it is one, else its `String(...)` coercion. Shared by the
|
|
45
|
+
* remote store's marker PUT and the session activation error path.
|
|
46
|
+
*
|
|
47
|
+
* @param err {unknown}
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
export function errorMessage(err) {
|
|
51
|
+
return err instanceof Error ? err.message : String(err);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Maps a raw `was.request()` rejection to the sync layer's typed errors: `412`
|
|
55
|
+
* to {@link WasSyncConflictError} (a lost-update conflict) and `401` / `403` to
|
|
56
|
+
* {@link WasSyncAuthError} (expired/revoked storage access). Every other error
|
|
57
|
+
* is returned unchanged so RxDB's retry/backoff handles it. Returns the error to
|
|
58
|
+
* throw (the caller re-throws) rather than throwing itself.
|
|
59
|
+
*
|
|
60
|
+
* @param err {unknown}
|
|
61
|
+
* @returns {unknown}
|
|
62
|
+
*/
|
|
63
|
+
function toPortError(err) {
|
|
64
|
+
const status = errorStatus(err);
|
|
65
|
+
if (status === 412) {
|
|
66
|
+
return new WasSyncConflictError();
|
|
67
|
+
}
|
|
68
|
+
if (status === 401 || status === 403) {
|
|
69
|
+
return new WasSyncAuthError(status);
|
|
70
|
+
}
|
|
71
|
+
return err;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Parses a quoted strong ETag (`"3"`, as read by `readEtag`) into its numeric
|
|
75
|
+
* revision, or `undefined` when the header was absent (the resource has no such
|
|
76
|
+
* revision yet).
|
|
17
77
|
*
|
|
18
|
-
* @param etag {string |
|
|
78
|
+
* @param etag {string | undefined}
|
|
19
79
|
* @returns {number | undefined}
|
|
20
80
|
*/
|
|
21
81
|
function parseEtag(etag) {
|
|
22
|
-
if (
|
|
82
|
+
if (etag === undefined) {
|
|
23
83
|
return undefined;
|
|
24
84
|
}
|
|
25
85
|
const revision = Number(etag.replace(/"/g, ''));
|
|
@@ -36,134 +96,78 @@ function parseEtag(etag) {
|
|
|
36
96
|
* @param [options.capability] {IZcap} the delegated session capability for
|
|
37
97
|
* this collection (a restored `delegated` tier session); absent in the full
|
|
38
98
|
* tier, where requests invoke root capabilities
|
|
39
|
-
* @returns {
|
|
99
|
+
* @returns {WasSyncBasePort}
|
|
40
100
|
*/
|
|
41
101
|
export function createWasSyncPort({ was, spaceId, collectionId, capability }) {
|
|
42
102
|
const collectionPath = `/space/${spaceId}/${collectionId}`;
|
|
43
103
|
const resourcePath = (id) => `${collectionPath}/${encodeURIComponent(id)}`;
|
|
44
|
-
/**
|
|
45
|
-
* Builds the conditional-write headers from the port's precondition options.
|
|
46
|
-
*/
|
|
47
|
-
const writeHeaders = ({ ifMatch, ifNoneMatch }) => {
|
|
48
|
-
const headers = {};
|
|
49
|
-
if (ifMatch !== undefined) {
|
|
50
|
-
headers['if-match'] = ifMatch;
|
|
51
|
-
}
|
|
52
|
-
if (ifNoneMatch) {
|
|
53
|
-
headers['if-none-match'] = '*';
|
|
54
|
-
}
|
|
55
|
-
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
56
|
-
};
|
|
57
104
|
/**
|
|
58
105
|
* Runs a conditional write, mapping the server's `412 precondition-failed`
|
|
59
|
-
* into the core's `WasSyncConflictError` and
|
|
106
|
+
* into the core's `WasSyncConflictError` and a `401` / `403` into
|
|
107
|
+
* `WasSyncAuthError` (see {@link toPortError}), and letting all else propagate.
|
|
108
|
+
* Returns the accepted write's new revision parsed from the response ETag
|
|
109
|
+
* (`version` for content writes, `metaVersion` for `/meta` writes), or
|
|
110
|
+
* `undefined` when the response carries no ETag.
|
|
60
111
|
*/
|
|
61
|
-
const conditionalWrite = async (
|
|
112
|
+
const conditionalWrite = async (
|
|
113
|
+
// Typed off readEtag's parameter (was-client's HttpResponse) so the type
|
|
114
|
+
// needn't be imported from @interop/http-client, which is not a direct
|
|
115
|
+
// dependency here.
|
|
116
|
+
run) => {
|
|
62
117
|
try {
|
|
63
|
-
await run();
|
|
118
|
+
const response = await run();
|
|
119
|
+
return parseEtag(readEtag(response));
|
|
64
120
|
}
|
|
65
121
|
catch (err) {
|
|
66
|
-
|
|
67
|
-
throw new WasSyncConflictError();
|
|
68
|
-
}
|
|
69
|
-
throw err;
|
|
122
|
+
throw toPortError(err);
|
|
70
123
|
}
|
|
71
124
|
};
|
|
72
125
|
return {
|
|
73
126
|
async query({ checkpoint, limit }) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
127
|
+
try {
|
|
128
|
+
const response = await was.request({
|
|
129
|
+
capability,
|
|
130
|
+
path: `${collectionPath}/query`,
|
|
131
|
+
method: 'POST',
|
|
132
|
+
json: {
|
|
133
|
+
profile: 'changes',
|
|
134
|
+
...(checkpoint !== undefined && { checkpoint }),
|
|
135
|
+
limit
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return response.data;
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
// Map a pull-path 401/403 to WasSyncAuthError too, so expired access is
|
|
142
|
+
// recognised whether it surfaces on the pull or the push side.
|
|
143
|
+
throw toPortError(err);
|
|
144
|
+
}
|
|
85
145
|
},
|
|
86
146
|
async putContent({ id, data, ifMatch, ifNoneMatch }) {
|
|
87
|
-
|
|
147
|
+
return conditionalWrite(() => was.request({
|
|
88
148
|
capability,
|
|
89
149
|
path: resourcePath(id),
|
|
90
150
|
method: 'PUT',
|
|
91
151
|
json: data,
|
|
92
|
-
headers: writeHeaders({ ifMatch, ifNoneMatch })
|
|
152
|
+
headers: writeHeaders({ precondition: { ifMatch, ifNoneMatch } })
|
|
93
153
|
}));
|
|
94
154
|
},
|
|
95
155
|
async deleteContent({ id, ifMatch }) {
|
|
96
|
-
|
|
156
|
+
return conditionalWrite(() => was.request({
|
|
97
157
|
capability,
|
|
98
158
|
path: resourcePath(id),
|
|
99
159
|
method: 'DELETE',
|
|
100
|
-
headers: writeHeaders({ ifMatch })
|
|
160
|
+
headers: writeHeaders({ precondition: { ifMatch } })
|
|
101
161
|
}));
|
|
102
162
|
},
|
|
103
163
|
async putMeta({ id, custom, ifMatch, ifNoneMatch }) {
|
|
104
|
-
|
|
164
|
+
return conditionalWrite(() => was.request({
|
|
105
165
|
capability,
|
|
106
166
|
path: `${resourcePath(id)}/meta`,
|
|
107
167
|
method: 'PUT',
|
|
108
168
|
json: { custom },
|
|
109
|
-
headers: writeHeaders({ ifMatch, ifNoneMatch })
|
|
169
|
+
headers: writeHeaders({ precondition: { ifMatch, ifNoneMatch } })
|
|
110
170
|
}));
|
|
111
|
-
},
|
|
112
|
-
async get({ id }) {
|
|
113
|
-
// Content re-read: raw GET returns the stored body verbatim (no decrypt)
|
|
114
|
-
// and the content `version` in the ETag. A 404 means the resource is gone
|
|
115
|
-
// (or tombstoned) -- report absent so the core synthesizes a tombstone.
|
|
116
|
-
let contentResponse;
|
|
117
|
-
try {
|
|
118
|
-
contentResponse = await was.request({
|
|
119
|
-
capability,
|
|
120
|
-
path: resourcePath(id),
|
|
121
|
-
method: 'GET'
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
if (errorStatus(err) === 404) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
throw err;
|
|
129
|
-
}
|
|
130
|
-
const master = {
|
|
131
|
-
version: parseEtag(contentResponse.headers.get('etag')) ?? 0,
|
|
132
|
-
// Filled from the `/meta` body's server-managed `updatedAt` below; the
|
|
133
|
-
// change feed remains the authority on ordering, so this only feeds the
|
|
134
|
-
// one-off conflict entry and is corrected on the next pull.
|
|
135
|
-
updatedAt: '',
|
|
136
|
-
deleted: false,
|
|
137
|
-
data: contentResponse.data
|
|
138
|
-
};
|
|
139
|
-
// Metadata re-read: the `/meta` body carries the server-managed
|
|
140
|
-
// `updatedAt` plus the user-writable `custom` (opaque), and its own
|
|
141
|
-
// `metaVersion` ETag (absent until metadata has been written).
|
|
142
|
-
try {
|
|
143
|
-
const metaResponse = await was.request({
|
|
144
|
-
capability,
|
|
145
|
-
path: `${resourcePath(id)}/meta`,
|
|
146
|
-
method: 'GET'
|
|
147
|
-
});
|
|
148
|
-
const metaBody = metaResponse.data;
|
|
149
|
-
if (metaBody?.updatedAt) {
|
|
150
|
-
master.updatedAt = metaBody.updatedAt;
|
|
151
|
-
}
|
|
152
|
-
const metaVersion = parseEtag(metaResponse.headers.get('etag'));
|
|
153
|
-
if (metaVersion !== undefined) {
|
|
154
|
-
master.metaVersion = metaVersion;
|
|
155
|
-
}
|
|
156
|
-
if (metaBody?.custom !== undefined) {
|
|
157
|
-
master.custom = metaBody.custom;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
catch (err) {
|
|
161
|
-
// Metadata is optional; only a hard error (not 404) should propagate.
|
|
162
|
-
if (errorStatus(err) !== 404) {
|
|
163
|
-
throw err;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return master;
|
|
167
171
|
}
|
|
168
172
|
};
|
|
169
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasSyncPort.js","sourceRoot":"","sources":["../../src/sync/wasSyncPort.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wasSyncPort.js","sourceRoot":"","sources":["../../src/sync/wasSyncPort.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAA;AAE5E,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EAIrB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,OAAO,CACJ,GAA2B,CAAC,MAAM;QAClC,GAA0C,CAAC,QAAQ,EAAE,MAAM,CAC7D,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AACzD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,WAAW,CAAC,GAAY;IAC/B,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,IAAI,oBAAoB,EAAE,CAAA;IACnC,CAAC;IACD,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC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AG,CAAC,OAAO,CAAC;gBACV,UAAU;gBACV,IAAI,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC,OAAO;gBAChC,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,EAAE,MAAM,EAAE;gBAChB,OAAO,EAAE,YAAY,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC;aAClE,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/was-react",
|
|
3
3
|
"description": "React library for building 'Bring Your Own Everything' (BYOE) apps on Wallet Attached Storage: DID Auth login via CHAPI wallet, local-first encrypted storage, and background sync to a WAS server.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -55,9 +55,10 @@
|
|
|
55
55
|
"@interop/security-document-loader": "^9.4.1",
|
|
56
56
|
"@interop/vc": "^11.0.5",
|
|
57
57
|
"@interop/verifier-core": "^3.3.1",
|
|
58
|
-
"@interop/was-client": "^0.
|
|
58
|
+
"@interop/was-client": "^0.14.5",
|
|
59
59
|
"@interop/webkms-client": "^14.7.1",
|
|
60
|
-
"@interop/x25519-key-agreement-key": "^5.
|
|
60
|
+
"@interop/x25519-key-agreement-key": "^5.2.0",
|
|
61
|
+
"@scure/base": "^2.2.0",
|
|
61
62
|
"credential-handler-polyfill": "^4.1.0",
|
|
62
63
|
"uuidv7": "^1.2.1"
|
|
63
64
|
},
|