@interop/was-client 0.79.0 → 0.81.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.
Files changed (57) hide show
  1. package/README.md +31 -15
  2. package/dist/Resource.d.ts +9 -0
  3. package/dist/Resource.d.ts.map +1 -1
  4. package/dist/Resource.js +10 -2
  5. package/dist/Resource.js.map +1 -1
  6. package/dist/Space.d.ts +8 -4
  7. package/dist/Space.d.ts.map +1 -1
  8. package/dist/Space.js +8 -4
  9. package/dist/Space.js.map +1 -1
  10. package/dist/WasClient.d.ts +6 -2
  11. package/dist/WasClient.d.ts.map +1 -1
  12. package/dist/WasClient.js +6 -2
  13. package/dist/WasClient.js.map +1 -1
  14. package/dist/codec.d.ts +8 -6
  15. package/dist/codec.d.ts.map +1 -1
  16. package/dist/codec.js.map +1 -1
  17. package/dist/edv/EdvCodec.d.ts +55 -4
  18. package/dist/edv/EdvCodec.d.ts.map +1 -1
  19. package/dist/edv/EdvCodec.js +255 -55
  20. package/dist/edv/EdvCodec.js.map +1 -1
  21. package/dist/edv/WasTransport.d.ts +11 -1
  22. package/dist/edv/WasTransport.d.ts.map +1 -1
  23. package/dist/edv/WasTransport.js +18 -3
  24. package/dist/edv/WasTransport.js.map +1 -1
  25. package/dist/edv/cipher.d.ts +6 -1
  26. package/dist/edv/cipher.d.ts.map +1 -1
  27. package/dist/edv/cipher.js +5 -0
  28. package/dist/edv/cipher.js.map +1 -1
  29. package/dist/edv/core.d.ts +2 -2
  30. package/dist/edv/core.d.ts.map +1 -1
  31. package/dist/edv/core.js +1 -1
  32. package/dist/edv/core.js.map +1 -1
  33. package/dist/edv/docCipher.d.ts +56 -7
  34. package/dist/edv/docCipher.d.ts.map +1 -1
  35. package/dist/edv/docCipher.js +17 -10
  36. package/dist/edv/docCipher.js.map +1 -1
  37. package/dist/edv/index.d.ts +2 -2
  38. package/dist/edv/index.d.ts.map +1 -1
  39. package/dist/edv/index.js +1 -1
  40. package/dist/edv/index.js.map +1 -1
  41. package/dist/edv/recipients.d.ts.map +1 -1
  42. package/dist/edv/recipients.js +5 -3
  43. package/dist/edv/recipients.js.map +1 -1
  44. package/dist/edv/refreshingDocCipher.d.ts +6 -5
  45. package/dist/edv/refreshingDocCipher.d.ts.map +1 -1
  46. package/dist/edv/refreshingDocCipher.js +72 -51
  47. package/dist/edv/refreshingDocCipher.js.map +1 -1
  48. package/dist/internal/revoke.d.ts.map +1 -1
  49. package/dist/internal/revoke.js +4 -0
  50. package/dist/internal/revoke.js.map +1 -1
  51. package/dist/internal/write.d.ts +14 -4
  52. package/dist/internal/write.d.ts.map +1 -1
  53. package/dist/internal/write.js +82 -19
  54. package/dist/internal/write.js.map +1 -1
  55. package/dist/sync/types.d.ts +7 -4
  56. package/dist/sync/types.d.ts.map +1 -1
  57. package/package.json +2 -2
@@ -2,9 +2,10 @@ import { UnknownEpochError } from '../errors.js';
2
2
  import { createEdvDocCipher } from './docCipher.js';
3
3
  import { acquireDescriptor } from './acquire.js';
4
4
  /**
5
- * Builds a {@link DocCipher} whose descriptor is acquired through the
5
+ * Builds an {@link EdvDocCipher} whose descriptor is acquired through the
6
6
  * source/cache seams and refreshed (once per instance) on an unknown-epoch
7
- * decrypt.
7
+ * decrypt or `isPendingStub`. The metadata last installed with `applyMeta` is
8
+ * re-applied to the rebuilt cipher, so a refresh keeps the index schema.
8
9
  *
9
10
  * With no `source` the descriptor is served from the cache alone and the
10
11
  * refresh path is inert (an unknown-epoch decrypt propagates immediately) --
@@ -23,9 +24,12 @@ import { acquireDescriptor } from './acquire.js';
23
24
  * @param options.cache {EncryptionDescriptorCache}
24
25
  * @param [options.onFetchError] {function} observes swallowed
25
26
  * descriptor-fetch failures
26
- * @returns {Promise<DocCipher>}
27
+ * @returns {Promise<EdvDocCipher>}
27
28
  */
28
29
  export async function createRefreshingEdvDocCipher({ keyAgreementKey, keyResolver, collectionId, spaceId, idDerivation, source, cache, onFetchError }) {
30
+ // The `/meta` value last installed with `applyMeta`, replayed onto a rebuilt
31
+ // cipher so a refresh does not drop the collection's index schema.
32
+ let appliedMeta;
29
33
  const build = async () => {
30
34
  const encryption = await acquireDescriptor({
31
35
  source,
@@ -38,7 +42,7 @@ export async function createRefreshingEdvDocCipher({ keyAgreementKey, keyResolve
38
42
  '(fetched or cached). Every encrypted collection carries its key ' +
39
43
  'epochs from provisioning; refusing to build a cipher without them.');
40
44
  }
41
- return createEdvDocCipher({
45
+ const cipher = await createEdvDocCipher({
42
46
  keyAgreementKey,
43
47
  keyResolver,
44
48
  collectionId,
@@ -46,12 +50,71 @@ export async function createRefreshingEdvDocCipher({ keyAgreementKey, keyResolve
46
50
  idDerivation,
47
51
  encryption
48
52
  });
53
+ if (appliedMeta !== undefined) {
54
+ await cipher.applyMeta(appliedMeta);
55
+ }
56
+ return cipher;
49
57
  };
50
58
  let inner = await build();
51
59
  // The one descriptor refresh this cipher instance (= this collection this
52
60
  // session) may spend, shared so concurrent unknown-epoch decrypts ride a
53
61
  // single re-read instead of each spending one.
54
62
  let refreshed = null;
63
+ /**
64
+ * Runs a read on the current inner cipher, refreshing the descriptor and
65
+ * retrying once when it throws `UnknownEpochError`.
66
+ *
67
+ * @param read {function} the read to run against a cipher
68
+ * @returns {Promise<T>}
69
+ */
70
+ async function withRefresh(read) {
71
+ try {
72
+ return await read(inner);
73
+ }
74
+ catch (err) {
75
+ // `instanceof` is safe here and only here: `inner` is built in this
76
+ // package by `createEdvDocCipher`, which raises this package's own
77
+ // class, so no injected seam is crossed. A caller classifying what
78
+ // THIS cipher throws is crossing one, and uses `isUnknownEpochError` /
79
+ // `isKeyUnwrapError` instead.
80
+ if (!(err instanceof UnknownEpochError) || !source) {
81
+ throw err;
82
+ }
83
+ if (!refreshed) {
84
+ const attempt = build().then(cipher => {
85
+ inner = cipher;
86
+ });
87
+ refreshed = attempt;
88
+ // Only a COMPLETED refresh is spent. A rejected one (the description
89
+ // could not be read and no cached copy answered either) un-arms the
90
+ // guard so a later unknown-epoch decrypt may try again; a successful
91
+ // refresh that still cannot route the envelope stays spent for the
92
+ // session, which is what keeps a genuinely foreign envelope from
93
+ // driving a refetch loop.
94
+ attempt.catch(() => {
95
+ if (refreshed === attempt) {
96
+ refreshed = null;
97
+ }
98
+ });
99
+ }
100
+ try {
101
+ await refreshed;
102
+ }
103
+ catch {
104
+ // The refresh failed, so nothing was learned about this envelope's
105
+ // epoch: surface the original UnknownEpochError rather than the
106
+ // build failure, so callers classifying on it (the create-loss
107
+ // re-mint) still see the row they exist to repair.
108
+ throw err;
109
+ }
110
+ // One retry under the swapped cipher. If the refresh was already
111
+ // spent before this decrypt began, this re-attempt is a local
112
+ // no-network decrypt that fails the same way -- so a genuinely
113
+ // foreign envelope still surfaces UnknownEpochError, and never a
114
+ // second description read.
115
+ return read(inner);
116
+ }
117
+ }
55
118
  return {
56
119
  encrypt: options => inner.encrypt(options),
57
120
  encryptUpdate: options => {
@@ -60,53 +123,11 @@ export async function createRefreshingEdvDocCipher({ keyAgreementKey, keyResolve
60
123
  }
61
124
  return inner.encryptUpdate(options);
62
125
  },
63
- async decrypt(options) {
64
- try {
65
- return await inner.decrypt(options);
66
- }
67
- catch (err) {
68
- // `instanceof` is safe here and only here: `inner` is built in this
69
- // package by `createEdvDocCipher`, which raises this package's own
70
- // class, so no injected seam is crossed. A caller classifying what
71
- // THIS cipher throws is crossing one, and uses `isUnknownEpochError` /
72
- // `isKeyUnwrapError` instead.
73
- if (!(err instanceof UnknownEpochError) || !source) {
74
- throw err;
75
- }
76
- if (!refreshed) {
77
- const attempt = build().then(cipher => {
78
- inner = cipher;
79
- });
80
- refreshed = attempt;
81
- // Only a COMPLETED refresh is spent. A rejected one (the description
82
- // could not be read and no cached copy answered either) un-arms the
83
- // guard so a later unknown-epoch decrypt may try again; a successful
84
- // refresh that still cannot route the envelope stays spent for the
85
- // session, which is what keeps a genuinely foreign envelope from
86
- // driving a refetch loop.
87
- attempt.catch(() => {
88
- if (refreshed === attempt) {
89
- refreshed = null;
90
- }
91
- });
92
- }
93
- try {
94
- await refreshed;
95
- }
96
- catch {
97
- // The refresh failed, so nothing was learned about this envelope's
98
- // epoch: surface the original UnknownEpochError rather than the
99
- // build failure, so callers classifying on it (the create-loss
100
- // re-mint) still see the row they exist to repair.
101
- throw err;
102
- }
103
- // One retry under the swapped cipher. If the refresh was already
104
- // spent before this decrypt began, this re-attempt is a local
105
- // no-network decrypt that fails the same way -- so a genuinely
106
- // foreign envelope still surfaces UnknownEpochError, and never a
107
- // second description read.
108
- return inner.decrypt(options);
109
- }
126
+ decrypt: options => withRefresh(cipher => cipher.decrypt(options)),
127
+ isPendingStub: options => withRefresh(cipher => cipher.isPendingStub(options)),
128
+ async applyMeta(options) {
129
+ appliedMeta = options;
130
+ return inner.applyMeta(options);
110
131
  }
111
132
  };
112
133
  }
@@ -1 +1 @@
1
- {"version":3,"file":"refreshingDocCipher.js","sourceRoot":"","sources":["../../src/edv/refreshingDocCipher.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAkB,MAAM,gBAAgB,CAAA;AACnE,OAAO,EACL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,eAAe,EACf,WAAW,EACX,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,MAAM,EACN,KAAK,EACL,YAAY,EAUb;IACC,MAAM,KAAK,GAAG,KAAK,IAAwB,EAAE;QAC3C,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC;YACzC,MAAM;YACN,KAAK;YACL,YAAY;YACZ,YAAY;SACb,CAAC,CAAA;QACF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,eAAe,YAAY,2CAA2C;gBACpE,kEAAkE;gBAClE,oEAAoE,CACvE,CAAA;QACH,CAAC;QACD,OAAO,kBAA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GAAG,EAAE;wBACjB,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;4BAC1B,SAAS,GAAG,IAAI,CAAA;wBAClB,CAAC;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC;gBACD,IAAI,CAAC;oBACH,MAAM,SAAS,CAAA;gBACjB,CAAC;gBAAC,MAAM,CAAC;oBACP,mEAAmE;oBACnE,gEAAgE;oBAChE,+DAA+D;oBAC/D,mDAAmD;oBACnD,MAAM,GAAG,CAAA;gBACX,CAAC;gBACD,iEAAiE;gBACjE,8DAA8D;gBAC9D,+DAA+D;gBAC/D,iEAAiE;gBACjE,2BAA2B;gBAC3B,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YAC/B,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"refreshingDocCipher.js","sourceRoot":"","sources":["../../src/edv/refreshingDocCipher.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAqB,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,eAAe,EACf,WAAW,EACX,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,MAAM,EACN,KAAK,EACL,YAAY,EAUb;IACC,6EAA6E;IAC7E,mEAAmE;IACnE,IAAI,WAA6C,CAAA;IAEjD,MAAM,KAAK,GAAG,KAAK,IAA2B,EAAE;QAC9C,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC;YACzC,MAAM;YACN,KAAK;YACL,YAAY;YACZ,YAAY;SACb,CAAC,CAAA;QACF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,eAAe,YAAY,2CAA2C;gBACpE,kEAAkE;gBAClE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gB,CACpC,OAAO,EAAE,aAAa,EACtB,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,cAAc,CAAA;CAAE,GAC3D,OAAO,CAAC,IAAI,CAAC,CAmBf"}
@@ -15,6 +15,10 @@
15
15
  * A single invocation therefore authorizes both legitimate callers of the
16
16
  * server's dual-root rule ("the delegator revokes" and "a delegee revokes its
17
17
  * own capability"), with no need to know which one this client is.
18
+ *
19
+ * A chain that no longer verifies (tampered, expired, or a delegating key
20
+ * gone from its controller document) synthesizes an empty controller set, so
21
+ * the invocation is denied.
18
22
  */
19
23
  import { spaceRevocation, toUrl, parseSpaceTarget } from './paths.js';
20
24
  import { send } from './request.js';
@@ -1 +1 @@
1
- {"version":3,"file":"revoke.js","sourceRoot":"","sources":["../../src/internal/revoke.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAErE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;GAEG;AACH,MAAM,gBAAgB,GAAG,0BAA0B,CAAA;AAEnD;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,iBAAiB,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAA;AACtD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,MAAM,EACN,UAAU,EAIX;IACC,OAAO;QACL,UAAU,EAAE,gBAAgB;QAC5B,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC;QAC5B,gBAAgB,EAAE,MAAM;QACxB,UAAU;KACX,CAAA;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,OAAsB,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AAE,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;KACxC,CAAC,CAAA;IACF,MAAM,IAAI,CAAC,OAAO,EAAE;QAClB,GAAG;QACH,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,cAAc,CAAC;YACzB,MAAM,EAAE,GAAG;YACX,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC,CAAC;QACF,IAAI,EAAE,IAAI;KACX,CAAC,CAAA;AACJ,CAAC"}
@@ -15,8 +15,9 @@
15
15
  *
16
16
  * A codec may also answer `encode` with a multi-request `ChunkedWrite` plan
17
17
  * rather than an `EncodedWrite`. `insertResource` runs the plan over the
18
- * signed-request context built here (`codecRequestContext`); `upsertResource`
19
- * refuses one, since auto-routing is an insert-path affordance.
18
+ * signed-request context built here (`codecRequestContext`). `upsertResource`
19
+ * runs one only to create a resource at an id that holds none, and refuses it
20
+ * over an existing document, since a plan cannot replace one.
20
21
  */
21
22
  import type { HttpResponse } from '@interop/http-client';
22
23
  import type { CodecRequestContext, EncodedWrite, ResourceCodec } from '../codec.js';
@@ -141,6 +142,13 @@ export declare function insertResource(context: ClientContext, { itemsPath, path
141
142
  * re-thrown here with a message naming the real cause, instead of surfacing
142
143
  * as an inexplicable failed create. Conditional codecs therefore need read
143
144
  * access to update an existing document.
145
+ * - A codec may answer with a multi-request `ChunkedWrite` plan (the EDV
146
+ * codec's large binary write). When the pre-read found no document, the
147
+ * plan runs over the handle's signed-request context and creates the
148
+ * resource at this id, guarded like any fresh insert: a 412 surfaces as
149
+ * `PreconditionFailedError`, under the same masked-404 message. Over an
150
+ * existing document the plan is refused with `ValidationError`, since a
151
+ * plan cannot replace a document.
144
152
  *
145
153
  * @param context {ClientContext}
146
154
  * @param options {object}
@@ -152,7 +160,7 @@ export declare function insertResource(context: ClientContext, { itemsPath, path
152
160
  * @param [options.capability] {IZcap}
153
161
  * @param [options.precondition] {WritePrecondition} the caller's explicit
154
162
  * precondition (used only for a non-conditional codec)
155
- * @returns {Promise<HttpResponse>}
163
+ * @returns {Promise<{ etag?: string }>} the stored resource's new ETag
156
164
  */
157
165
  export declare function upsertResource(context: ClientContext, { path, codec, id, data, contentType, capability, precondition: callerPrecondition }: {
158
166
  path: string;
@@ -162,5 +170,7 @@ export declare function upsertResource(context: ClientContext, { path, codec, id
162
170
  contentType?: string;
163
171
  capability?: IZcap;
164
172
  precondition?: WritePrecondition;
165
- }): Promise<HttpResponse>;
173
+ }): Promise<{
174
+ etag?: string;
175
+ }>;
166
176
  //# sourceMappingURL=write.d.ts.map
@@ -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;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,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,YAAY,CAAA;IACrB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC,GACA,OAAO,CAAC,YAAY,CAAC,CAcvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,EAAE,UAAU,EAAE,GAA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IACE,OAAO,EAAE,IAAI,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,aAAa,EACtB,EACE,SAAS,EACT,SAAS,EACT,KAAK,EACL,IAAI,EACJ,WAAW,EACX,UAAU,EACX,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC,KAAK,EAAE,aAAa,CAAA;IACpB,IAAI,EAAE,YAAY,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GACA,OAAO,CAAC,aAAa,CAAC,CA2BxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,cAAc,CAClC,OAAO,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;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAiE5B"}
@@ -1,7 +1,7 @@
1
1
  import { isChunkedWrite } from '../codec.js';
2
2
  import { PreconditionFailedError, ValidationError } from '../errors.js';
3
3
  import { send } from './request.js';
4
- import { assertPreconditionAgainstPreRead, assertSinglePrecondition, encodedPrecondition, writeHeaders, namedPrecondition } from './conditional.js';
4
+ import { assertPreconditionAgainstPreRead, assertSinglePrecondition, encodedPrecondition, readEtag, writeHeaders, namedPrecondition } from './conditional.js';
5
5
  /**
6
6
  * Sends an encoded write (`PUT`/`POST`) to a resource path, applying the
7
7
  * encoded body (`json` or `body`), its content-type, and the conditional-write
@@ -135,6 +135,13 @@ export async function insertResource(context, { itemsPath, pathForId, codec, dat
135
135
  * re-thrown here with a message naming the real cause, instead of surfacing
136
136
  * as an inexplicable failed create. Conditional codecs therefore need read
137
137
  * access to update an existing document.
138
+ * - A codec may answer with a multi-request `ChunkedWrite` plan (the EDV
139
+ * codec's large binary write). When the pre-read found no document, the
140
+ * plan runs over the handle's signed-request context and creates the
141
+ * resource at this id, guarded like any fresh insert: a 412 surfaces as
142
+ * `PreconditionFailedError`, under the same masked-404 message. Over an
143
+ * existing document the plan is refused with `ValidationError`, since a
144
+ * plan cannot replace a document.
138
145
  *
139
146
  * @param context {ClientContext}
140
147
  * @param options {object}
@@ -146,7 +153,7 @@ export async function insertResource(context, { itemsPath, pathForId, codec, dat
146
153
  * @param [options.capability] {IZcap}
147
154
  * @param [options.precondition] {WritePrecondition} the caller's explicit
148
155
  * precondition (used only for a non-conditional codec)
149
- * @returns {Promise<HttpResponse>}
156
+ * @returns {Promise<{ etag?: string }>} the stored resource's new ETag
150
157
  */
151
158
  export async function upsertResource(context, { path, codec, id, data, contentType, capability, precondition: callerPrecondition }) {
152
159
  // An empty precondition object (the handle's default) names no baseline.
@@ -180,15 +187,12 @@ export async function upsertResource(context, { path, codec, id, data, contentTy
180
187
  })
181
188
  });
182
189
  if (isChunkedWrite(write)) {
183
- // Auto-routing is an insert-path affordance: a write by id would have to
184
- // reconcile the existing stored parts (and the codec's sequence) with the
185
- // new payload, which this path does not do. Refuse instead of
186
- // half-performing the update. The codec supplies the scheme-specific
187
- // recovery advice; this layer knows nothing about how it stores things.
188
- throw new ValidationError(`Cannot write this payload to "${path}": the collection's codec ` +
189
- 'answered with a multi-request write plan, which is only auto-routed ' +
190
- 'on the insert path (add()). Add it as a new resource' +
191
- (write.guidance === undefined ? '.' : `. ${write.guidance}`));
190
+ return await runChunkedCreate(context, {
191
+ path,
192
+ write,
193
+ capability,
194
+ current
195
+ });
192
196
  }
193
197
  const encoded = write;
194
198
  // A conditional codec computes the precondition itself (from the sequence /
@@ -198,27 +202,86 @@ export async function upsertResource(context, { path, codec, id, data, contentTy
198
202
  ? encodedPrecondition(encoded)
199
203
  : precondition;
200
204
  try {
201
- return await sendEncodedWrite(context, {
205
+ const response = await sendEncodedWrite(context, {
202
206
  path,
203
207
  method: 'PUT',
204
208
  capability,
205
209
  encoded,
206
210
  precondition: chosen
207
211
  });
212
+ return { etag: readEtag(response) };
208
213
  }
209
214
  catch (err) {
210
215
  if (err instanceof PreconditionFailedError &&
211
216
  codec.conditionalWrites &&
212
217
  current === null) {
213
- const { status, type, title, details, requestUrl } = err;
214
- throw new PreconditionFailedError(`Cannot update the document at "${path}": it exists, but its current ` +
215
- 'version is not readable with this capability (WAS masks ' +
216
- 'unauthorized reads as 404), so the write was encoded as a fresh ' +
217
- 'insert and the server rejected it. A conditional codec ' +
218
- '(e.g. the EDV codec) needs read access to update an existing ' +
219
- 'document.', { status, type, title, details, requestUrl, cause: err });
218
+ throw maskedInsertRejected({ err, path });
219
+ }
220
+ throw err;
221
+ }
222
+ }
223
+ /**
224
+ * Runs a codec's multi-request plan for a write by id, which creates the
225
+ * resource at that id. Only a pre-read that found no document (`current`
226
+ * is `null`) lets it run: over an existing document, and after no pre-read at
227
+ * all, the plan is refused, since a plan writes a fresh document and cannot
228
+ * reconcile an existing one's stored parts with the new payload. The codec
229
+ * supplies the scheme-specific recovery advice; this layer knows nothing
230
+ * about how it stores things.
231
+ *
232
+ * The plan guards its own first write as create-if-absent, so a 412 means
233
+ * the id was taken after the pre-read, or is held by a document the
234
+ * capability cannot read. It surfaces as `PreconditionFailedError` with the
235
+ * masked-404 message of any other fresh insert by id.
236
+ *
237
+ * @param context {ClientContext}
238
+ * @param options {object}
239
+ * @param options.path {string} the resource path the plan writes
240
+ * @param options.write {ChunkedWrite} the codec's plan
241
+ * @param [options.capability] {IZcap}
242
+ * @param options.current {HttpResponse | null | undefined} the pre-read's
243
+ * result, `undefined` when the codec asked for none
244
+ * @returns {Promise<{ etag?: string }>} the stored resource's new ETag
245
+ */
246
+ async function runChunkedCreate(context, { path, write, capability, current }) {
247
+ if (current !== null) {
248
+ throw new ValidationError(`Cannot write this payload to "${path}": the collection's codec ` +
249
+ 'answered with a multi-request write plan, which can only create a ' +
250
+ 'resource at an id that holds none, and a document is stored here. ' +
251
+ 'Delete the resource first, or add the payload as a new resource ' +
252
+ '(add())' +
253
+ (write.guidance === undefined ? '.' : `. ${write.guidance}`));
254
+ }
255
+ try {
256
+ const { etag } = await write.execute(codecRequestContext(context, { capability }));
257
+ return { etag };
258
+ }
259
+ catch (err) {
260
+ // `current` is `null`, so a conditional codec pre-read and found nothing.
261
+ if (err instanceof PreconditionFailedError) {
262
+ throw maskedInsertRejected({ err, path });
220
263
  }
221
264
  throw err;
222
265
  }
223
266
  }
267
+ /**
268
+ * The error for a fresh insert by id the server rejected with 412 after the
269
+ * pre-read found nothing: the document exists, but its current version is not
270
+ * readable with this capability (a masked 404), or it appeared since the
271
+ * pre-read. The server's error is kept as the cause.
272
+ *
273
+ * @param options {object}
274
+ * @param options.err {PreconditionFailedError} the server's 412
275
+ * @param options.path {string} the resource path written
276
+ * @returns {PreconditionFailedError}
277
+ */
278
+ function maskedInsertRejected({ err, path }) {
279
+ const { status, type, title, details, requestUrl } = err;
280
+ return new PreconditionFailedError(`Cannot update the document at "${path}": it exists, but its current ` +
281
+ 'version is not readable with this capability (WAS masks ' +
282
+ 'unauthorized reads as 404), so the write was encoded as a fresh ' +
283
+ 'insert and the server rejected it. A conditional codec ' +
284
+ '(e.g. the EDV codec) needs read access to update an existing ' +
285
+ 'document.', { status, type, title, details, requestUrl, cause: err });
286
+ }
224
287
  //# 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;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,OAAO,EAAE,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;YAC9D,OAAO,QAAwB,CAAA;QACjC,CAAC;KACF,CAAA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AAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;IACxD,OAAO,IAAI,uBAAuB,CAChC,kCAAkC,IAAI,gCAAgC;QACpE,0DAA0D;QAC1D,kEAAkE;QAClE,yDAAyD;QACzD,+DAA+D;QAC/D,WAAW,EACb,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CACzD,CAAA;AACH,CAAC"}
@@ -218,10 +218,13 @@ export interface WasSyncPort {
218
218
  * server controls.
219
219
  * - `decrypt` also takes an optional `context`, the signed-request surface a
220
220
  * codec reads a multi-resource document through. With it, an EDV cipher
221
- * reassembles a chunked envelope from its chunk resources. Without it, such
222
- * an envelope throws `EncryptionError`. A cipher built without a `spaceId`
223
- * throws `NotSupportedError`. A replica gets one from its Collection handle
224
- * (`collection.codecContext()`). A binary document decrypts to a `Blob`, and
221
+ * built with a `spaceId` reassembles a chunked envelope from its chunk
222
+ * resources (one built without a `spaceId` throws `NotSupportedError`). A
223
+ * replica gets one from its Collection handle (`collection.codecContext()`).
224
+ * A context is not the only way to read a chunked envelope: the EDV cipher
225
+ * (`EdvDocCipher`) also takes a `chunkSource` in its place, which serves the
226
+ * chunks from bytes the caller holds. With neither, a chunked envelope
227
+ * throws `EncryptionError`. A binary document decrypts to a `Blob`, and
225
228
  * everything else to `Json`.
226
229
  */
227
230
  export interface DocCipher {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sync/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,WAAW,EACZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,YAAY,EA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) servers.",
4
- "version": "0.79.0",
4
+ "version": "0.81.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "pnpm run clear && tsc",
@@ -86,7 +86,7 @@
86
86
  "@interop/ezcap": "^7.5.0",
87
87
  "@interop/http-client": "^1.0.5",
88
88
  "@interop/minimal-cipher": "^7.10.3",
89
- "@interop/storage-core": "^0.22.0",
89
+ "@interop/storage-core": "^0.25.0",
90
90
  "@interop/vh-resource-log": "^0.5.4",
91
91
  "@interop/x25519-key-agreement-key": "^5.4.1",
92
92
  "@noble/hashes": "^2.3.0",