@interop/was-client 0.65.0 → 0.67.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 +59 -50
- package/dist/Collection.d.ts +41 -30
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +41 -69
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +28 -37
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +26 -52
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +14 -14
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +16 -16
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +3 -2
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +3 -2
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +8 -14
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js.map +1 -1
- package/dist/edv/EdvCodec.d.ts +3 -3
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +25 -74
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +30 -44
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +38 -119
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/descriptorStore.d.ts +13 -12
- package/dist/edv/descriptorStore.d.ts.map +1 -1
- package/dist/edv/descriptorStore.js +7 -6
- package/dist/edv/descriptorStore.js.map +1 -1
- package/dist/edv/docCipher.d.ts +10 -1
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +23 -6
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.d.ts.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.js +4 -2
- package/dist/edv/logGovernedDescriptorStore.js.map +1 -1
- package/dist/edv/refreshingDocCipher.d.ts +4 -1
- package/dist/edv/refreshingDocCipher.d.ts.map +1 -1
- package/dist/edv/refreshingDocCipher.js +7 -4
- package/dist/edv/refreshingDocCipher.js.map +1 -1
- package/dist/errors.d.ts +24 -7
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +27 -7
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/cas.d.ts +22 -10
- package/dist/internal/cas.d.ts.map +1 -1
- package/dist/internal/cas.js +37 -11
- package/dist/internal/cas.js.map +1 -1
- package/dist/internal/conditional.d.ts +29 -8
- package/dist/internal/conditional.d.ts.map +1 -1
- package/dist/internal/conditional.js +30 -6
- package/dist/internal/conditional.js.map +1 -1
- package/dist/internal/memo.d.ts +2 -2
- package/dist/internal/memo.js +2 -2
- package/dist/internal/meta.d.ts +12 -10
- package/dist/internal/meta.d.ts.map +1 -1
- package/dist/internal/meta.js +20 -13
- package/dist/internal/meta.js.map +1 -1
- package/dist/internal/paths.d.ts +1 -1
- package/dist/internal/paths.js +1 -1
- package/dist/internal/write.d.ts +12 -29
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +15 -74
- package/dist/internal/write.js.map +1 -1
- package/dist/log/logStore.d.ts +10 -6
- package/dist/log/logStore.d.ts.map +1 -1
- package/dist/log/logStore.js +16 -6
- package/dist/log/logStore.js.map +1 -1
- package/dist/sync/index.d.ts +12 -5
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +12 -5
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/plaintextCipher.d.ts +6 -4
- package/dist/sync/plaintextCipher.d.ts.map +1 -1
- package/dist/sync/plaintextCipher.js +19 -6
- package/dist/sync/plaintextCipher.js.map +1 -1
- package/dist/sync/port.d.ts +3 -1
- package/dist/sync/port.d.ts.map +1 -1
- package/dist/sync/port.js +3 -3
- package/dist/sync/port.js.map +1 -1
- package/dist/sync/predicates.d.ts +33 -3
- package/dist/sync/predicates.d.ts.map +1 -1
- package/dist/sync/predicates.js +37 -3
- package/dist/sync/predicates.js.map +1 -1
- package/dist/sync/types.d.ts +24 -5
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/internal/features.d.ts +0 -105
- package/dist/internal/features.d.ts.map +0 -1
- package/dist/internal/features.js +0 -168
- package/dist/internal/features.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACd,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACd,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AASjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEzD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,aAAa,EACtB,EACE,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EACb,EAAE;IACD,IA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AO,EAAE,aAAa,EACtB,EACE,IAAI,EACJ,KAAK,EACL,EAAE,EACF,IAAI,EACJ,WAAW,EACX,UAAU,EACV,YAAY,EAAE,kBAAkB,EACjC,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,aAAa,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,YAAY,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC,GACA,OAAO,CAAC,YAAY,CAAC,CA8EvB"}
|
package/dist/internal/write.js
CHANGED
|
@@ -34,10 +34,10 @@ export async function sendEncodedWrite(context, { path, method, encoded, capabil
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Builds the {@link CodecRequestContext} core hands a codec that drives its own
|
|
37
|
-
* I/O: the signed-request primitive bound to this handle's capability
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* I/O: the signed-request primitive bound to this handle's capability. The
|
|
38
|
+
* codec never sees the zcap machinery, and the raw `HttpResponse` it gets back
|
|
39
|
+
* matches the `was.request()` escape hatch, which is what `WasTransport`
|
|
40
|
+
* consumes.
|
|
41
41
|
*
|
|
42
42
|
* Requests go through the same mapped `send` path the core write paths use, so
|
|
43
43
|
* a codec-driven write fails with the typed `WasError` subclasses the calling
|
|
@@ -47,20 +47,17 @@ export async function sendEncodedWrite(context, { path, method, encoded, capabil
|
|
|
47
47
|
*
|
|
48
48
|
* @param context {ClientContext}
|
|
49
49
|
* @param options {object}
|
|
50
|
-
* @param options.features {FeatureProbe} the handle's memoized backend-feature
|
|
51
|
-
* probe
|
|
52
50
|
* @param [options.capability] {IZcap} capability attached to each request
|
|
53
51
|
* @returns {CodecRequestContext}
|
|
54
52
|
*/
|
|
55
|
-
export function codecRequestContext(context, {
|
|
53
|
+
export function codecRequestContext(context, { capability } = {}) {
|
|
56
54
|
return {
|
|
57
55
|
async request(input) {
|
|
58
56
|
// `send` only resolves `null` for the `read`/`idempotent` flags, which
|
|
59
57
|
// this surface never sets, so the response is always present.
|
|
60
58
|
const response = await send(context, { capability, ...input });
|
|
61
59
|
return response;
|
|
62
|
-
}
|
|
63
|
-
features
|
|
60
|
+
}
|
|
64
61
|
};
|
|
65
62
|
}
|
|
66
63
|
/**
|
|
@@ -71,7 +68,7 @@ export function codecRequestContext(context, { features, capability }) {
|
|
|
71
68
|
* A codec may also answer the encode with a multi-request plan (the EDV codec's
|
|
72
69
|
* chunked blob write). The plan is then executed over the handle's signed
|
|
73
70
|
* request context instead of being sent as one request; it owns its own
|
|
74
|
-
* preconditions
|
|
71
|
+
* preconditions.
|
|
75
72
|
*
|
|
76
73
|
* A codec that mints its own id (e.g. the encrypting codec's EDV id) writes it
|
|
77
74
|
* by `PUT` to that id's path; a codec that mints none (the identity codec)
|
|
@@ -92,17 +89,14 @@ export function codecRequestContext(context, { features, capability }) {
|
|
|
92
89
|
* codec-minted id
|
|
93
90
|
* @param options.codec {ResourceCodec} the collection's resolved codec
|
|
94
91
|
* @param options.data {ResourceData} the plaintext value
|
|
95
|
-
* @param options.features {FeatureProbe} the handle's shared backend-feature
|
|
96
|
-
* probe, handed to a codec's multi-request plan so its affordance gate costs
|
|
97
|
-
* no extra round trip
|
|
98
92
|
* @param [options.contentType] {string} caller-supplied content type
|
|
99
93
|
* @param [options.capability] {IZcap}
|
|
100
94
|
* @returns {Promise<InsertOutcome>}
|
|
101
95
|
*/
|
|
102
|
-
export async function insertResource(context, { itemsPath, pathForId, codec, data,
|
|
96
|
+
export async function insertResource(context, { itemsPath, pathForId, codec, data, contentType, capability }) {
|
|
103
97
|
const write = await codec.encode({ data, contentType });
|
|
104
98
|
if (isChunkedWrite(write)) {
|
|
105
|
-
const { id, etag } = await write.execute(codecRequestContext(context, {
|
|
99
|
+
const { id, etag } = await write.execute(codecRequestContext(context, { capability }));
|
|
106
100
|
return {
|
|
107
101
|
chunked: true,
|
|
108
102
|
id,
|
|
@@ -137,15 +131,10 @@ export async function insertResource(context, { itemsPath, pathForId, codec, dat
|
|
|
137
131
|
* - The pre-read cannot distinguish "absent" from "unreadable with this
|
|
138
132
|
* capability" (WAS masks unauthorized reads as 404), so a conditional codec
|
|
139
133
|
* encodes a fresh insert (`If-None-Match: *`) in both cases. When the target
|
|
140
|
-
* in fact exists,
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* - A backend that does NOT advertise `conditional-writes` ignores the
|
|
145
|
-
* `If-None-Match: *` guard, so the 412 safety net above never fires there: a
|
|
146
|
-
* masked-404 insert would silently overwrite the existing document and reset
|
|
147
|
-
* its sequence. The insert-after-null-pre-read is therefore refused (fail
|
|
148
|
-
* closed) unless the backend advertises the feature.
|
|
134
|
+
* in fact exists, the server rejects that insert with 412; that 412 is
|
|
135
|
+
* re-thrown here with a message naming the real cause, instead of surfacing
|
|
136
|
+
* as an inexplicable failed create. Conditional codecs therefore need read
|
|
137
|
+
* access to update an existing document.
|
|
149
138
|
*
|
|
150
139
|
* @param context {ClientContext}
|
|
151
140
|
* @param options {object}
|
|
@@ -153,16 +142,13 @@ export async function insertResource(context, { itemsPath, pathForId, codec, dat
|
|
|
153
142
|
* @param options.codec {ResourceCodec} the collection's resolved codec
|
|
154
143
|
* @param options.id {string} the resource id
|
|
155
144
|
* @param options.data {ResourceData} the plaintext value
|
|
156
|
-
* @param options.features {FeatureProbe} the handle's shared
|
|
157
|
-
* `BackendFeatures` probe; consulted only for a conditional codec's
|
|
158
|
-
* insert-after-null-pre-read
|
|
159
145
|
* @param [options.contentType] {string} caller-supplied content type
|
|
160
146
|
* @param [options.capability] {IZcap}
|
|
161
147
|
* @param [options.precondition] {WritePrecondition} the caller's explicit
|
|
162
148
|
* precondition (used only for a non-conditional codec)
|
|
163
149
|
* @returns {Promise<HttpResponse>}
|
|
164
150
|
*/
|
|
165
|
-
export async function upsertResource(context, { path, codec, id, data,
|
|
151
|
+
export async function upsertResource(context, { path, codec, id, data, contentType, capability, precondition: callerPrecondition }) {
|
|
166
152
|
// An empty precondition object (the handle's default) names no baseline.
|
|
167
153
|
const precondition = namedPrecondition(callerPrecondition);
|
|
168
154
|
// Checked before the pre-read, whose comparison would otherwise answer the
|
|
@@ -180,22 +166,6 @@ export async function upsertResource(context, { path, codec, id, data, features,
|
|
|
180
166
|
// pre-read just observed, so a lost race fails here rather than being
|
|
181
167
|
// encoded into a sequence advance the server would then reject.
|
|
182
168
|
assertPreconditionAgainstPreRead({ path, current, precondition });
|
|
183
|
-
if (current === null && !(await conditionalWrites({ path, features }))) {
|
|
184
|
-
// The write would be encoded as a fresh insert guarded only by
|
|
185
|
-
// `If-None-Match: *`, which this backend ignores -- so if the document in
|
|
186
|
-
// fact exists but is unreadable with this capability (the masked-404
|
|
187
|
-
// ambiguity), the PUT would silently destroy it. Refuse rather than risk
|
|
188
|
-
// the clobber.
|
|
189
|
-
throw new ValidationError(`Cannot create the document at "${path}": no current document is ` +
|
|
190
|
-
'readable there, which cannot distinguish "absent" from "exists ' +
|
|
191
|
-
'but unreadable with this capability" (WAS masks unauthorized ' +
|
|
192
|
-
"reads as 404), and the collection's backend does not advertise " +
|
|
193
|
-
"the 'conditional-writes' feature -- so the server could not " +
|
|
194
|
-
'reject the write either, and an existing document would be ' +
|
|
195
|
-
'silently overwritten. Use a backend with conditional writes, a ' +
|
|
196
|
-
'capability that can read the current document and the backend ' +
|
|
197
|
-
'descriptor, or add() to mint a fresh document id.');
|
|
198
|
-
}
|
|
199
169
|
}
|
|
200
170
|
const write = await codec.encode({
|
|
201
171
|
id,
|
|
@@ -244,40 +214,11 @@ export async function upsertResource(context, { path, codec, id, data, features,
|
|
|
244
214
|
throw new PreconditionFailedError(`Cannot update the document at "${path}": it exists, but its current ` +
|
|
245
215
|
'version is not readable with this capability (WAS masks ' +
|
|
246
216
|
'unauthorized reads as 404), so the write was encoded as a fresh ' +
|
|
247
|
-
'insert and the server rejected it. A conditional
|
|
217
|
+
'insert and the server rejected it. A conditional codec ' +
|
|
248
218
|
'(e.g. the EDV codec) needs read access to update an existing ' +
|
|
249
219
|
'document.', { status, type, title, details, requestUrl, cause: err });
|
|
250
220
|
}
|
|
251
221
|
throw err;
|
|
252
222
|
}
|
|
253
223
|
}
|
|
254
|
-
/**
|
|
255
|
-
* Whether the backend advertises `conditional-writes`, with a probe failure
|
|
256
|
-
* reported as the fail-closed refusal it leads to rather than raw.
|
|
257
|
-
*
|
|
258
|
-
* The probe rethrows transient failures on purpose (a network error, a `401`,
|
|
259
|
-
* a `429`, a non-`501` `5xx`), so a blip on `GET .../backend` would otherwise
|
|
260
|
-
* surface on a first write as an unrelated `WasServerError` or
|
|
261
|
-
* `AuthRequiredError`. The write is refused either way -- an unprobed backend
|
|
262
|
-
* is one whose guard cannot be relied on -- but the refusal says which
|
|
263
|
-
* question went unanswered, and keeps the probe's own error as its `cause`.
|
|
264
|
-
*
|
|
265
|
-
* @param options {object}
|
|
266
|
-
* @param options.path {string} the resource path being written
|
|
267
|
-
* @param options.features {FeatureProbe}
|
|
268
|
-
* @returns {Promise<boolean>}
|
|
269
|
-
*/
|
|
270
|
-
async function conditionalWrites({ path, features }) {
|
|
271
|
-
try {
|
|
272
|
-
return await features.has('conditional-writes');
|
|
273
|
-
}
|
|
274
|
-
catch (err) {
|
|
275
|
-
throw new ValidationError(`Cannot create the document at "${path}": no current document is ` +
|
|
276
|
-
"readable there, and the collection's backend descriptor could not " +
|
|
277
|
-
'be read, so whether the backend enforces the `If-None-Match: *` ' +
|
|
278
|
-
'guard is unknown. Retry once the backend descriptor is reachable, ' +
|
|
279
|
-
'use a capability that can read it, or add() to mint a fresh ' +
|
|
280
|
-
'document id.', { cause: err });
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
224
|
//# sourceMappingURL=write.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EACL,gCAAgC,EAChC,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AAGzB;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAsB,EACtB,EACE,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EAOb;IAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;QACnC,IAAI;QACJ,MAAM;QACN,UAAU;QACV,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,YAAY,CAAC;YACpB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,YAAY;YACZ,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC;KACH,CAAC,CAAA;IACF,OAAO,QAAwB,CAAA;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAsB,EACtB,EAAE,UAAU,KAA6B,EAAE;IAE3C,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,KAAK;YACjB,uEAAuE;YACvE,8DAA8D;YAC9D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAA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,IAAI,4BAA4B;YAC/D,sEAAsE;YACtE,sDAAsD;YACtD,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC,CAC/D,CAAA;IACH,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAA;IACrB,4EAA4E;IAC5E,6EAA6E;IAC7E,iDAAiD;IACjD,MAAM,MAAM,GAAG,KAAK,CAAC,iBAAiB;QACpC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC;QAC9B,CAAC,CAAC,YAAY,CAAA;IAChB,IAAI,CAAC;QACH,OAAO,MAAM,gBAAgB,CAAC,OAAO,EAAE;YACrC,IAAI;YACJ,MAAM,EAAE,KAAK;YACb,UAAU;YACV,OAAO;YACP,YAAY,EAAE,MAAM;SACrB,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IACE,GAAG,YAAY,uBAAuB;YACtC,KAAK,CAAC,iBAAiB;YACvB,OAAO,KAAK,IAAI,EAChB,CAAC;YACD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;YACxD,MAAM,IAAI,uBAAuB,CAC/B,kCAAkC,IAAI,gCAAgC;gBACpE,0DAA0D;gBAC1D,kEAAkE;gBAClE,yDAAyD;gBACzD,+DAA+D;gBAC/D,WAAW,EACb,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CACzD,CAAA;QACH,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC"}
|
package/dist/log/logStore.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* the two places a WAS server keeps a resource log. A log may be a WAS
|
|
7
7
|
* Resource's entire body (the user key roster's `key-map/user-key.jsonl`), or
|
|
8
8
|
* a Collection's governing history log at the `/meta/log` sub-resource (the
|
|
9
|
-
*
|
|
9
|
+
* encrypted-collections profile's `governed-history-logs` feature, from which the server derives
|
|
10
10
|
* the Collection's served `encryption` member). Either way the log is stored
|
|
11
11
|
* as `text/jsonl`, with the port's read-with-etag, compare-and-swap append,
|
|
12
12
|
* and guarded genesis create mapped onto the target's conditional writes.
|
|
@@ -19,11 +19,15 @@
|
|
|
19
19
|
* document under a human-readable id. A Collection's history log is never
|
|
20
20
|
* encrypted and runs no codec: the server reads its head itself.
|
|
21
21
|
*
|
|
22
|
-
* Both the append and the create
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* Both the append and the create depend on their precondition being enforced --
|
|
23
|
+
* the profile requires it (without it, concurrent appends silently overwrite
|
|
24
|
+
* one another instead of failing into the caller's rebase-and-retry loop).
|
|
25
|
+
* Conditional writes are a baseline server requirement on a Resource host, and
|
|
26
|
+
* a Collection's history log carries its own validator, which a server
|
|
27
|
+
* implementing the sub-resource honors. Either way an append is refused when
|
|
28
|
+
* the read it extends returned no validator.
|
|
29
|
+
* A lost race -- a stale `ifMatch`, or a guarded create against a log that
|
|
30
|
+
* already exists -- is rethrown as the library's
|
|
27
31
|
* `ResourceLogConflictError` with the transport's `PreconditionFailedError`
|
|
28
32
|
* as `cause`, which is the port's one conflict signal and what the library's
|
|
29
33
|
* rebase loop catches (by `name` rather than `instanceof`, since the error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logStore.d.ts","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"logStore.d.ts","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG9C,OAAO,EAAW,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAElE,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAwD3B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EACH;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAA;CAAE,GAC9C;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GACnD,gBAAgB,CA+FlB"}
|
package/dist/log/logStore.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* the two places a WAS server keeps a resource log. A log may be a WAS
|
|
7
7
|
* Resource's entire body (the user key roster's `key-map/user-key.jsonl`), or
|
|
8
8
|
* a Collection's governing history log at the `/meta/log` sub-resource (the
|
|
9
|
-
*
|
|
9
|
+
* encrypted-collections profile's `governed-history-logs` feature, from which the server derives
|
|
10
10
|
* the Collection's served `encryption` member). Either way the log is stored
|
|
11
11
|
* as `text/jsonl`, with the port's read-with-etag, compare-and-swap append,
|
|
12
12
|
* and guarded genesis create mapped onto the target's conditional writes.
|
|
@@ -19,11 +19,15 @@
|
|
|
19
19
|
* document under a human-readable id. A Collection's history log is never
|
|
20
20
|
* encrypted and runs no codec: the server reads its head itself.
|
|
21
21
|
*
|
|
22
|
-
* Both the append and the create
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* Both the append and the create depend on their precondition being enforced --
|
|
23
|
+
* the profile requires it (without it, concurrent appends silently overwrite
|
|
24
|
+
* one another instead of failing into the caller's rebase-and-retry loop).
|
|
25
|
+
* Conditional writes are a baseline server requirement on a Resource host, and
|
|
26
|
+
* a Collection's history log carries its own validator, which a server
|
|
27
|
+
* implementing the sub-resource honors. Either way an append is refused when
|
|
28
|
+
* the read it extends returned no validator.
|
|
29
|
+
* A lost race -- a stale `ifMatch`, or a guarded create against a log that
|
|
30
|
+
* already exists -- is rethrown as the library's
|
|
27
31
|
* `ResourceLogConflictError` with the transport's `PreconditionFailedError`
|
|
28
32
|
* as `cause`, which is the port's one conflict signal and what the library's
|
|
29
33
|
* rebase loop catches (by `name` rather than `instanceof`, since the error
|
|
@@ -31,6 +35,7 @@
|
|
|
31
35
|
*/
|
|
32
36
|
import { ResourceLogConflictError, parseResourceLog, serializeResourceLog, serializeResourceLogEntry } from '@interop/vh-resource-log';
|
|
33
37
|
import { PreconditionFailedError, ValidationError } from '../errors.js';
|
|
38
|
+
import { unenforcedPreconditionError } from '../internal/conditional.js';
|
|
34
39
|
import { ENCODER, LOG_CONTENT_TYPE } from '../internal/content.js';
|
|
35
40
|
export { LOG_CONTENT_TYPE };
|
|
36
41
|
/**
|
|
@@ -122,6 +127,11 @@ export function resourceLogStore(options) {
|
|
|
122
127
|
throw new ValidationError('Cannot append to resource log: append must follow a read on the ' +
|
|
123
128
|
'same store instance.');
|
|
124
129
|
}
|
|
130
|
+
if (ifMatch === undefined) {
|
|
131
|
+
throw unenforcedPreconditionError({
|
|
132
|
+
operation: 'Cannot append to the resource log'
|
|
133
|
+
});
|
|
134
|
+
}
|
|
125
135
|
const separator = lastReadBody.endsWith('\n') ? '' : '\n';
|
|
126
136
|
const extended = lastReadBody + separator + serializeResourceLogEntry(entry) + '\n';
|
|
127
137
|
await putOrConflict({
|
package/dist/log/logStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logStore.js","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"logStore.js","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;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|
* Collection provisioning, and its Space half alone (ensure the Space once,
|
|
18
18
|
* then thread the returned description through every collection).
|
|
19
19
|
* - `isSyncConflictError` / `isSyncNotFoundError` / `isSyncAuthError` /
|
|
20
|
-
* `isUnknownEpochError`
|
|
20
|
+
* `isUnknownEpochError` / `isKeyUnwrapError` / `isIntegrityError` /
|
|
21
|
+
* `isNotSupportedError` -- the classification contract for the signals
|
|
21
22
|
* below. A consumer matches by `err.name` and never with `instanceof`,
|
|
22
23
|
* because every one of these errors is raised inside a seam the app injects
|
|
23
24
|
* (the port, the caller's `DocCipher`) and that seam can resolve to a second
|
|
@@ -33,8 +34,14 @@
|
|
|
33
34
|
* signal (`UnknownEpochError`: the envelope's epoch is not on the descriptor at
|
|
34
35
|
* all, so re-read it and rebuild the cipher) and the membership signal
|
|
35
36
|
* (`KeyUnwrapError`: the epoch is on the descriptor but this reader holds no
|
|
36
|
-
* key for it, so a refresh cannot help).
|
|
37
|
-
*
|
|
37
|
+
* key for it, so a refresh cannot help). So is the tamper signal
|
|
38
|
+
* (`IntegrityError`: the stored body does not verify against the resource id
|
|
39
|
+
* it was read under). `EncryptionError`, the fail-closed umbrella both
|
|
40
|
+
* `KeyUnwrapError` and `IntegrityError` fall under, rides along. So does the
|
|
41
|
+
* affordance gate (`NotSupportedError`), which a guarded write raises before
|
|
42
|
+
* any request when the read it is pinned to returned no `ETag` validator -- a
|
|
43
|
+
* permanent refusal, so a replication driver stops rather than retries.
|
|
44
|
+
* The classes are exported
|
|
38
45
|
* for construction and for a caller inside one resolved copy; across a package
|
|
39
46
|
* boundary the predicates are the contract
|
|
40
47
|
* (`decisions/0001-cross-package-errors-match-by-name.md`).
|
|
@@ -45,7 +52,7 @@ export { contentCid, cidFrom, deriveSpaceId } from './cid.js';
|
|
|
45
52
|
export { isEncryptedEnvelope } from './envelope.js';
|
|
46
53
|
export { createPlaintextDocCipher } from './plaintextCipher.js';
|
|
47
54
|
export { ensureSpace, ensureSpaceAndCollection } from './provisioning.js';
|
|
48
|
-
export { isSyncAuthError, isSyncConflictError, isSyncNotFoundError, isKeyUnwrapError, isUnknownEpochError } from './predicates.js';
|
|
49
|
-
export { EncryptionError, KeyUnwrapError, UnknownEpochError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError } from '../errors.js';
|
|
55
|
+
export { isNotSupportedError, isSyncAuthError, isSyncConflictError, isSyncNotFoundError, isIntegrityError, isKeyUnwrapError, isUnknownEpochError } from './predicates.js';
|
|
56
|
+
export { EncryptionError, IntegrityError, KeyUnwrapError, NotSupportedError, UnknownEpochError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError } from '../errors.js';
|
|
50
57
|
export type { Json, SyncCheckpoint, WireDoc, SyncPage, MasterState, WriteAck, SyncStatus, WasSyncPort, DocCipher } from './types.js';
|
|
51
58
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/sync/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAI1E,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,IAAI,EACJ,cAAc,EACd,OAAO,EACP,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,UAAU,EACV,WAAW,EACX,SAAS,EACV,MAAM,YAAY,CAAA"}
|
package/dist/sync/index.js
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* Collection provisioning, and its Space half alone (ensure the Space once,
|
|
18
18
|
* then thread the returned description through every collection).
|
|
19
19
|
* - `isSyncConflictError` / `isSyncNotFoundError` / `isSyncAuthError` /
|
|
20
|
-
* `isUnknownEpochError`
|
|
20
|
+
* `isUnknownEpochError` / `isKeyUnwrapError` / `isIntegrityError` /
|
|
21
|
+
* `isNotSupportedError` -- the classification contract for the signals
|
|
21
22
|
* below. A consumer matches by `err.name` and never with `instanceof`,
|
|
22
23
|
* because every one of these errors is raised inside a seam the app injects
|
|
23
24
|
* (the port, the caller's `DocCipher`) and that seam can resolve to a second
|
|
@@ -33,8 +34,14 @@
|
|
|
33
34
|
* signal (`UnknownEpochError`: the envelope's epoch is not on the descriptor at
|
|
34
35
|
* all, so re-read it and rebuild the cipher) and the membership signal
|
|
35
36
|
* (`KeyUnwrapError`: the epoch is on the descriptor but this reader holds no
|
|
36
|
-
* key for it, so a refresh cannot help).
|
|
37
|
-
*
|
|
37
|
+
* key for it, so a refresh cannot help). So is the tamper signal
|
|
38
|
+
* (`IntegrityError`: the stored body does not verify against the resource id
|
|
39
|
+
* it was read under). `EncryptionError`, the fail-closed umbrella both
|
|
40
|
+
* `KeyUnwrapError` and `IntegrityError` fall under, rides along. So does the
|
|
41
|
+
* affordance gate (`NotSupportedError`), which a guarded write raises before
|
|
42
|
+
* any request when the read it is pinned to returned no `ETag` validator -- a
|
|
43
|
+
* permanent refusal, so a replication driver stops rather than retries.
|
|
44
|
+
* The classes are exported
|
|
38
45
|
* for construction and for a caller inside one resolved copy; across a package
|
|
39
46
|
* boundary the predicates are the contract
|
|
40
47
|
* (`decisions/0001-cross-package-errors-match-by-name.md`).
|
|
@@ -48,6 +55,6 @@ export { contentCid, cidFrom, deriveSpaceId } from './cid.js';
|
|
|
48
55
|
export { isEncryptedEnvelope } from './envelope.js';
|
|
49
56
|
export { createPlaintextDocCipher } from './plaintextCipher.js';
|
|
50
57
|
export { ensureSpace, ensureSpaceAndCollection } from './provisioning.js';
|
|
51
|
-
export { isSyncAuthError, isSyncConflictError, isSyncNotFoundError, isKeyUnwrapError, isUnknownEpochError } from './predicates.js';
|
|
52
|
-
export { EncryptionError, KeyUnwrapError, UnknownEpochError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError } from '../errors.js';
|
|
58
|
+
export { isNotSupportedError, isSyncAuthError, isSyncConflictError, isSyncNotFoundError, isIntegrityError, isKeyUnwrapError, isUnknownEpochError } from './predicates.js';
|
|
59
|
+
export { EncryptionError, IntegrityError, KeyUnwrapError, NotSupportedError, UnknownEpochError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError } from '../errors.js';
|
|
53
60
|
//# sourceMappingURL=index.js.map
|
package/dist/sync/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,SAAS;AACT,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAA"}
|
|
@@ -2,12 +2,14 @@ import type { DocCipher } from './types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Builds the identity {@link DocCipher} for a plaintext, content-addressed,
|
|
4
4
|
* insert-only collection. `encrypt` is the identity transform with a content-id
|
|
5
|
-
* key; `decrypt` returns the stored body unchanged
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* key; `decrypt` returns the stored body unchanged once its content id matches
|
|
6
|
+
* the resource id it was stored under, and throws {@link IntegrityError}
|
|
7
|
+
* otherwise (`ValidationError` when no id is passed); `encryptUpdate` throws -- a content-addressed document is never
|
|
8
|
+
* updated in place (a changed document is a different id).
|
|
8
9
|
*
|
|
9
10
|
* @param options {object}
|
|
10
|
-
* @param options.collectionId {string} labels the `encryptUpdate`
|
|
11
|
+
* @param options.collectionId {string} labels the `encryptUpdate` and
|
|
12
|
+
* `decrypt` errors
|
|
11
13
|
* @returns {DocCipher}
|
|
12
14
|
*/
|
|
13
15
|
export declare function createPlaintextDocCipher({ collectionId }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plaintextCipher.d.ts","sourceRoot":"","sources":["../../src/sync/plaintextCipher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plaintextCipher.d.ts","sourceRoot":"","sources":["../../src/sync/plaintextCipher.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,YAAY,CAAA;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,YAAY,EACb,EAAE;IACD,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,SAAS,CA2BZ"}
|
|
@@ -4,19 +4,24 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* The no-encryption (identity) {@link DocCipher} for a plaintext, content-
|
|
6
6
|
* addressed collection: the stored "envelope" IS the document, and the resource
|
|
7
|
-
* id is the document's content id
|
|
7
|
+
* id is the document's content id, so the content id is also the only
|
|
8
|
+
* integrity check a read has: `decrypt` recomputes it and refuses a document
|
|
9
|
+
* stored under an id it does not hash to. Kept free of the `@interop/was-client/edv`
|
|
8
10
|
* crypto graph so a plaintext-only consumer imports nothing it does not need.
|
|
9
11
|
*/
|
|
12
|
+
import { IntegrityError, requireResourceId } from '../errors.js';
|
|
10
13
|
import { contentCid } from './cid.js';
|
|
11
14
|
/**
|
|
12
15
|
* Builds the identity {@link DocCipher} for a plaintext, content-addressed,
|
|
13
16
|
* insert-only collection. `encrypt` is the identity transform with a content-id
|
|
14
|
-
* key; `decrypt` returns the stored body unchanged
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* key; `decrypt` returns the stored body unchanged once its content id matches
|
|
18
|
+
* the resource id it was stored under, and throws {@link IntegrityError}
|
|
19
|
+
* otherwise (`ValidationError` when no id is passed); `encryptUpdate` throws -- a content-addressed document is never
|
|
20
|
+
* updated in place (a changed document is a different id).
|
|
17
21
|
*
|
|
18
22
|
* @param options {object}
|
|
19
|
-
* @param options.collectionId {string} labels the `encryptUpdate`
|
|
23
|
+
* @param options.collectionId {string} labels the `encryptUpdate` and
|
|
24
|
+
* `decrypt` errors
|
|
20
25
|
* @returns {DocCipher}
|
|
21
26
|
*/
|
|
22
27
|
export function createPlaintextDocCipher({ collectionId }) {
|
|
@@ -28,7 +33,15 @@ export function createPlaintextDocCipher({ collectionId }) {
|
|
|
28
33
|
throw new Error(`Collection "${collectionId}" is content-addressed plaintext; ` +
|
|
29
34
|
'documents are never updated in place.');
|
|
30
35
|
},
|
|
31
|
-
async decrypt({ envelope }) {
|
|
36
|
+
async decrypt({ id, envelope }) {
|
|
37
|
+
requireResourceId({ id, collectionId });
|
|
38
|
+
const derived = contentCid(envelope);
|
|
39
|
+
if (derived !== id) {
|
|
40
|
+
throw new IntegrityError(`Cannot read resource "${id}" of collection "${collectionId}": its ` +
|
|
41
|
+
`content id is "${derived}", so the document was stored under an ` +
|
|
42
|
+
'id it was not written for. The server altered the document or ' +
|
|
43
|
+
'served it under another id.');
|
|
44
|
+
}
|
|
32
45
|
return envelope;
|
|
33
46
|
}
|
|
34
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plaintextCipher.js","sourceRoot":"","sources":["../../src/sync/plaintextCipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"plaintextCipher.js","sourceRoot":"","sources":["../../src/sync/plaintextCipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAGrC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACvC,YAAY,EAGb;IACC,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAkB;YACpC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;QACjD,CAAC;QAED,KAAK,CAAC,aAAa;YACjB,MAAM,IAAI,KAAK,CACb,eAAe,YAAY,oCAAoC;gBAC7D,uCAAuC,CAC1C,CAAA;QACH,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAkC;YAC5D,iBAAiB,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAA;YACvC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAA;YACpC,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;gBACnB,MAAM,IAAI,cAAc,CACtB,yBAAyB,EAAE,oBAAoB,YAAY,SAAS;oBAClE,kBAAkB,OAAO,yCAAyC;oBAClE,gEAAgE;oBAChE,6BAA6B,CAChC,CAAA;YACH,CAAC;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/sync/port.d.ts
CHANGED
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
* WriteAck} -- the write's raw `etag` (re-read only if the backend sent
|
|
29
29
|
* none) plus its `version` parsed out of it -- so a caller can record acked
|
|
30
30
|
* revisions immediately and echo `etag` back verbatim as a later write's
|
|
31
|
-
* `ifMatch`.
|
|
31
|
+
* `ifMatch`. Conditional writes are a baseline server requirement, so a write
|
|
32
|
+
* carrying `ifMatch` or `ifNoneMatch` goes out as given and the server answers
|
|
33
|
+
* a lost race with a `412`.
|
|
32
34
|
*
|
|
33
35
|
* Bypassing the codec is not bypassing the error mapper. Every failure caught
|
|
34
36
|
* here goes through the client's own `mapError` first, so the port's signals
|
package/dist/sync/port.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/sync/port.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/sync/port.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EACL,gBAAgB,EAGjB,MAAM,4BAA4B,CAAA;AAYnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,EAIV,WAAW,EAEZ,MAAM,YAAY,CAAA;AAEnB;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAyG3B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAW7E;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,OAAO,EACP,YAAY,EACZ,UAAU,EACV,aAAqB,EACtB,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,GAAG,WAAW,CA4Od"}
|
package/dist/sync/port.js
CHANGED
|
@@ -185,9 +185,9 @@ export function createWasSyncPort({ was, spaceId, collectionId, capability, mapA
|
|
|
185
185
|
// percent-encoding and reserved/dot-segment guards as the handle API.
|
|
186
186
|
const contentPath = (id) => resourcePath(spaceId, collectionId, id);
|
|
187
187
|
const metaPath = (id) => resourceMeta(spaceId, collectionId, id);
|
|
188
|
-
// Construction is I/O-free (the codec
|
|
189
|
-
//
|
|
190
|
-
//
|
|
188
|
+
// Construction is I/O-free (the codec is a lazy thunk) and `changes()`
|
|
189
|
+
// never resolves the codec, so it ships the stored bodies verbatim -- what
|
|
190
|
+
// this codec-bypassing port requires.
|
|
191
191
|
const changesCollection = was
|
|
192
192
|
.space(spaceId)
|
|
193
193
|
.collection(collectionId, { capability });
|
package/dist/sync/port.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"port.js","sourceRoot":"","sources":["../../src/sync/port.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"port.js","sourceRoot":"","sources":["../../src/sync/port.ts"],"names":[],"mappings":"AAyCA,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACb,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACf,MAAM,cAAc,CAAA;AAWrB;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAE3B;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AAEpD;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,MAA0B;IAC9C,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAA;AAC3D,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,aAAa,CAAC,MAAgB;IACrC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM;KAC9B,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,MAAgB;IACpC,O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