@interop/was-client 0.35.1 → 0.37.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 (50) hide show
  1. package/README.md +22 -5
  2. package/dist/Collection.d.ts +5 -0
  3. package/dist/Collection.d.ts.map +1 -1
  4. package/dist/Collection.js +37 -4
  5. package/dist/Collection.js.map +1 -1
  6. package/dist/Resource.d.ts +4 -3
  7. package/dist/Resource.d.ts.map +1 -1
  8. package/dist/Resource.js +31 -20
  9. package/dist/Resource.js.map +1 -1
  10. package/dist/codec.d.ts +91 -4
  11. package/dist/codec.d.ts.map +1 -1
  12. package/dist/codec.js +10 -1
  13. package/dist/codec.js.map +1 -1
  14. package/dist/edv/EdvCodec.d.ts +29 -9
  15. package/dist/edv/EdvCodec.d.ts.map +1 -1
  16. package/dist/edv/EdvCodec.js +421 -40
  17. package/dist/edv/EdvCodec.js.map +1 -1
  18. package/dist/edv/WasTransport.d.ts +39 -2
  19. package/dist/edv/WasTransport.d.ts.map +1 -1
  20. package/dist/edv/WasTransport.js +82 -26
  21. package/dist/edv/WasTransport.js.map +1 -1
  22. package/dist/edv/docCipher.d.ts +55 -4
  23. package/dist/edv/docCipher.d.ts.map +1 -1
  24. package/dist/edv/docCipher.js +51 -5
  25. package/dist/edv/docCipher.js.map +1 -1
  26. package/dist/edv/epochRoster.d.ts +53 -0
  27. package/dist/edv/epochRoster.d.ts.map +1 -0
  28. package/dist/edv/epochRoster.js +49 -0
  29. package/dist/edv/epochRoster.js.map +1 -0
  30. package/dist/edv/index.d.ts +6 -1
  31. package/dist/edv/index.d.ts.map +1 -1
  32. package/dist/edv/index.js +5 -0
  33. package/dist/edv/index.js.map +1 -1
  34. package/dist/errors.d.ts +11 -0
  35. package/dist/errors.d.ts.map +1 -1
  36. package/dist/errors.js +11 -0
  37. package/dist/errors.js.map +1 -1
  38. package/dist/index.d.ts +4 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/internal/features.d.ts +44 -1
  43. package/dist/internal/features.d.ts.map +1 -1
  44. package/dist/internal/features.js +39 -0
  45. package/dist/internal/features.js.map +1 -1
  46. package/dist/internal/write.d.ts +65 -12
  47. package/dist/internal/write.d.ts.map +1 -1
  48. package/dist/internal/write.js +71 -9
  49. package/dist/internal/write.js.map +1 -1
  50. package/package.json +1 -1
@@ -0,0 +1,53 @@
1
+ /*!
2
+ * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
+ */
4
+ /**
5
+ * Crypto-free predicates over a Collection's `encryption` descriptor: whether it
6
+ * carries a usable key-epoch roster, and whether two descriptors name the same
7
+ * roster. Neither touches key material, so a caller deciding what to do with a
8
+ * descriptor -- open it, refuse it fail-closed, rebuild a cipher for it -- does
9
+ * not have to pull in the epoch crypto to ask.
10
+ *
11
+ * These exist because every consumer that holds descriptors (a local replica
12
+ * deciding whether a collection is encrypted, a sync layer deciding whether a
13
+ * freshly-read descriptor invalidates the cipher it opened with) otherwise
14
+ * re-derives the same two checks, and the two definitions have to agree across
15
+ * consumers to be worth anything.
16
+ */
17
+ import type { CollectionEncryption, CollectionEncryptionEpoch } from '../types.js';
18
+ /**
19
+ * Whether a descriptor carries a usable key-epoch roster: it is present, its
20
+ * `currentEpoch` is a string, and its `epochs` list is a non-empty array. Both
21
+ * halves matter -- a roster with no `currentEpoch` names no epoch to write
22
+ * under, and a `currentEpoch` with no epochs names an entry that does not
23
+ * exist -- so only a descriptor passing both is one an epoch-aware cipher can
24
+ * be opened from.
25
+ *
26
+ * @param [encryption] {CollectionEncryption} the descriptor to test
27
+ * @returns {boolean}
28
+ */
29
+ export declare function hasKeyEpochs(encryption?: CollectionEncryption): encryption is CollectionEncryption & {
30
+ currentEpoch: string;
31
+ epochs: CollectionEncryptionEpoch[];
32
+ };
33
+ /**
34
+ * Whether two descriptors name the same key-epoch roster: their `currentEpoch`
35
+ * values are equal AND their `epochs` lists carry the same epoch ids in the same
36
+ * order. An `undefined` descriptor equals only another `undefined` one, so a
37
+ * caller holding nothing yet reads a freshly-read descriptor as a change.
38
+ *
39
+ * This is roster IDENTITY, not descriptor equality: the recipients wrapped
40
+ * inside each epoch are deliberately not compared. Adding or removing a reader
41
+ * within an existing epoch changes which recipients an epoch wraps its key to,
42
+ * but leaves every epoch id and the write epoch alone, so the keys this reader
43
+ * already resolved stay correct and a cipher built from the older descriptor
44
+ * stays valid. Only a rotation -- a new epoch appended and `currentEpoch` moved
45
+ * onto it -- changes what a reader must resolve, and that is exactly what an
46
+ * inequality here reports.
47
+ *
48
+ * @param [current] {CollectionEncryption} the descriptor in hand
49
+ * @param [next] {CollectionEncryption} the descriptor to compare it against
50
+ * @returns {boolean}
51
+ */
52
+ export declare function epochRostersEqual(current?: CollectionEncryption, next?: CollectionEncryption): boolean;
53
+ //# sourceMappingURL=epochRoster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"epochRoster.d.ts","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,UAAU,CAAC,EAAE,oBAAoB,GAChC,UAAU,IAAI,oBAAoB,GAAG;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,yBAAyB,EAAE,CAAA;CACpC,CAOA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,CAAC,EAAE,oBAAoB,EAC9B,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAaT"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Whether a descriptor carries a usable key-epoch roster: it is present, its
3
+ * `currentEpoch` is a string, and its `epochs` list is a non-empty array. Both
4
+ * halves matter -- a roster with no `currentEpoch` names no epoch to write
5
+ * under, and a `currentEpoch` with no epochs names an entry that does not
6
+ * exist -- so only a descriptor passing both is one an epoch-aware cipher can
7
+ * be opened from.
8
+ *
9
+ * @param [encryption] {CollectionEncryption} the descriptor to test
10
+ * @returns {boolean}
11
+ */
12
+ export function hasKeyEpochs(encryption) {
13
+ return (encryption !== undefined &&
14
+ typeof encryption.currentEpoch === 'string' &&
15
+ Array.isArray(encryption.epochs) &&
16
+ encryption.epochs.length > 0);
17
+ }
18
+ /**
19
+ * Whether two descriptors name the same key-epoch roster: their `currentEpoch`
20
+ * values are equal AND their `epochs` lists carry the same epoch ids in the same
21
+ * order. An `undefined` descriptor equals only another `undefined` one, so a
22
+ * caller holding nothing yet reads a freshly-read descriptor as a change.
23
+ *
24
+ * This is roster IDENTITY, not descriptor equality: the recipients wrapped
25
+ * inside each epoch are deliberately not compared. Adding or removing a reader
26
+ * within an existing epoch changes which recipients an epoch wraps its key to,
27
+ * but leaves every epoch id and the write epoch alone, so the keys this reader
28
+ * already resolved stay correct and a cipher built from the older descriptor
29
+ * stays valid. Only a rotation -- a new epoch appended and `currentEpoch` moved
30
+ * onto it -- changes what a reader must resolve, and that is exactly what an
31
+ * inequality here reports.
32
+ *
33
+ * @param [current] {CollectionEncryption} the descriptor in hand
34
+ * @param [next] {CollectionEncryption} the descriptor to compare it against
35
+ * @returns {boolean}
36
+ */
37
+ export function epochRostersEqual(current, next) {
38
+ if (current === undefined || next === undefined) {
39
+ return current === undefined && next === undefined;
40
+ }
41
+ if (current.currentEpoch !== next.currentEpoch) {
42
+ return false;
43
+ }
44
+ const currentIds = (current.epochs ?? []).map(epoch => epoch.id);
45
+ const nextIds = (next.epochs ?? []).map(epoch => epoch.id);
46
+ return (currentIds.length === nextIds.length &&
47
+ currentIds.every((id, index) => id === nextIds[index]));
48
+ }
49
+ //# sourceMappingURL=epochRoster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"epochRoster.js","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,UAAiC;IAKjC,OAAO,CACL,UAAU,KAAK,SAAS;QACxB,OAAO,UAAU,CAAC,YAAY,KAAK,QAAQ;QAC3C,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;QAChC,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAC7B,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA8B,EAC9B,IAA2B;IAE3B,IAAI,OAAO,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAChD,OAAO,OAAO,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,CAAA;IACpD,CAAC;IACD,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAChE,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC1D,OAAO,CACL,UAAU,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;QACpC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CACvD,CAAA;AACH,CAAC"}
@@ -33,6 +33,10 @@
33
33
  * epoch key (see `hmacKey.ts`). It is installed at provisioning or never, and
34
34
  * never rotates.
35
35
  *
36
+ * `hasKeyEpochs` and `epochRostersEqual` are the crypto-free predicates over a
37
+ * descriptor: whether it carries a usable roster, and whether two descriptors
38
+ * name the same one (roster identity, recipient sets deliberately excluded).
39
+ *
36
40
  * `x25519RecipientFromDidKey` is the one rule for turning a grantee named only
37
41
  * by its Ed25519 `did:key` controller into a `RecipientPublicKey`, so a
38
42
  * recipient key is always derived from an identifier both sides already hold
@@ -48,10 +52,11 @@ export { isEd25519DidKey, x25519RecipientFromDidKey } from './didKeyRecipient.js
48
52
  export { collectionDescriptorStore, resourceDescriptorStore } from './descriptorStore.js';
49
53
  export type { EncryptionDescriptorStore } from './descriptorStore.js';
50
54
  export { mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
55
+ export { hasKeyEpochs, epochRostersEqual } from './epochRoster.js';
51
56
  export { resolveEpochKeys } from './epochKeys.js';
52
57
  export type { ResolvedEpochKeys } from './epochKeys.js';
53
58
  export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
54
59
  export type { BlindingKey } from './hmacKey.js';
55
60
  export { createEdvDocCipher, ownerRecipient, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
56
- export type { DocCipher } from './docCipher.js';
61
+ export type { DocCipher, EdvDocCipher } from './docCipher.js';
57
62
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7D,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gB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AkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/edv/index.js CHANGED
@@ -33,6 +33,10 @@
33
33
  * epoch key (see `hmacKey.ts`). It is installed at provisioning or never, and
34
34
  * never rotates.
35
35
  *
36
+ * `hasKeyEpochs` and `epochRostersEqual` are the crypto-free predicates over a
37
+ * descriptor: whether it carries a usable roster, and whether two descriptors
38
+ * name the same one (roster identity, recipient sets deliberately excluded).
39
+ *
36
40
  * `x25519RecipientFromDidKey` is the one rule for turning a grantee named only
37
41
  * by its Ed25519 `did:key` controller into a `RecipientPublicKey`, so a
38
42
  * recipient key is always derived from an identifier both sides already hold
@@ -45,6 +49,7 @@ export { ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replac
45
49
  export { isEd25519DidKey, x25519RecipientFromDidKey } from './didKeyRecipient.js';
46
50
  export { collectionDescriptorStore, resourceDescriptorStore } from './descriptorStore.js';
47
51
  export { mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
52
+ export { hasKeyEpochs, epochRostersEqual } from './epochRoster.js';
48
53
  export { resolveEpochKeys } from './epochKeys.js';
49
54
  export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
50
55
  export { createEdvDocCipher, ownerRecipient, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
package/dist/errors.d.ts CHANGED
@@ -54,6 +54,17 @@ export declare class AuthRequiredError extends WasError {
54
54
  export declare class NotImplementedError extends WasError {
55
55
  name: string;
56
56
  }
57
+ /**
58
+ * A client-side, fail-closed affordance gate: the operation needs an optional
59
+ * backend feature the collection's backend does not advertise (e.g.
60
+ * `chunked-streams` for an auto-routed large encrypted blob). Raised before any
61
+ * request is sent, so it carries no HTTP status. Recover by writing to a
62
+ * collection whose backend advertises the feature, or by keeping the payload
63
+ * within what a single request can carry.
64
+ */
65
+ export declare class NotSupportedError extends WasError {
66
+ name: string;
67
+ }
57
68
  /**
58
69
  * A client-supplied id or backend conflicts with existing state (HTTP 409):
59
70
  * `id-conflict` (the id already exists), `reserved-id` (the id collides with a
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;gBAEP,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAU3D;AAED;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IAChC,IAAI,SAAkB;CAChC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAClC,IAAI,SAAoB;CAClC;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IACpC,IAAI,SAAsB;CACpC;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;IACtC,IAAI,SAAwB;CACtC;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IAChC,IAAI,SAAkB;CAChC;AAED;;;;;;;GAOG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IAC1C,IAAI,SAA4B;CAC1C;AAED;;;;;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;GAQG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CA2D/C"}
package/dist/errors.js CHANGED
@@ -57,6 +57,17 @@ export class AuthRequiredError extends WasError {
57
57
  export class NotImplementedError extends WasError {
58
58
  name = 'NotImplementedError';
59
59
  }
60
+ /**
61
+ * A client-side, fail-closed affordance gate: the operation needs an optional
62
+ * backend feature the collection's backend does not advertise (e.g.
63
+ * `chunked-streams` for an auto-routed large encrypted blob). Raised before any
64
+ * request is sent, so it carries no HTTP status. Recover by writing to a
65
+ * collection whose backend advertises the feature, or by keeping the payload
66
+ * within what a single request can carry.
67
+ */
68
+ export class NotSupportedError extends WasError {
69
+ name = 'NotSupportedError';
70
+ }
60
71
  /**
61
72
  * A client-supplied id or backend conflicts with existing state (HTTP 409):
62
73
  * `id-conflict` (the id already exists), `reserved-id` (the id collides with a
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAmBpD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAS;IACf,IAAI,CAAS;IACb,KAAK,CAAS;IACd,OAAO,CAAW;IAClB,UAAU,CAAS;IAEnB,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;QACnE,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAC3D,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;Q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N,OAAO,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACnD,KAAK,GAAG;YACN,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClD,KAAK,GAAG;YACN,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAChD,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAED,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -13,7 +13,9 @@ export { parseSpaceTarget } from './internal/paths.js';
13
13
  export type { ParsedSpacePath } from './internal/paths.js';
14
14
  export { readEtag, writeHeaders } from './internal/conditional.js';
15
15
  export type { WritePrecondition } from './internal/conditional.js';
16
- export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, ConflictError, PreconditionFailedError, LogNotConfirmedError, PayloadTooLargeError, QuotaExceededError, EncryptionError, KeyUnwrapError, IntegrityError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError, WasServerError, mapError } from './errors.js';
17
- export type { ResourceCodec, EncryptionProvider, EncodedWrite, ResponseLike, BlindedQuery, CodecIndexing, IndexDeclaration, IndexSchema } from './codec.js';
16
+ export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, NotSupportedError, ConflictError, PreconditionFailedError, LogNotConfirmedError, PayloadTooLargeError, QuotaExceededError, EncryptionError, KeyUnwrapError, IntegrityError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError, WasServerError, mapError } from './errors.js';
17
+ export type { FeatureProbe } from './internal/features.js';
18
+ export { isChunkedWrite } from './codec.js';
19
+ export type { ResourceCodec, EncryptionProvider, ChunkedWrite, CodecRequestContext, CodecWrite, EncodedWrite, ResponseLike, BlindedQuery, CodecIndexing, IndexDeclaration, IndexSchema } from './codec.js';
18
20
  export type { Json, JsonPrimitive, JsonObject, JsonArray, ResourceData, Action, ActionInput, SpaceDescription, CollectionDescription, CollectionWritableFields, CollectionEncryption, CollectionEncryptionEpoch, CollectionEncryptionRecipient, CollectionEncryptionHmac, EncryptionWithHmac, CollectionSummary, CollectionsList, SpaceSummary, SpaceListing, ResourceSummary, CollectionResourcesList, ResourceMetadata, ResourceMetadataCustom, CollectionMetadata, AddResult, FindPage, ImportStats, PolicyDocument, LinkSet, LinkSetEntry, HandleOptions, EncryptionOverride, BackendReference, BackendDescriptor, BackendRegistration, BackendConnectionInput, BackendConnectionPublic, StorageLimit, CollectionUsage, BackendUsage, SpaceQuotaReport, GrantOptions, RequestInput, IZcap, IDelegatedZcap, ISigner } from './types.js';
19
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,EACZ,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,IAAI,EACJ,aAAa,EACb,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,WAAW,EACX,cAAc,EACd,OAAO,EACP,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACR,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,YAAY,EAAE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,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACR,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -11,5 +11,6 @@ export { Collection } from './Collection.js';
11
11
  export { Resource } from './Resource.js';
12
12
  export { parseSpaceTarget } from './internal/paths.js';
13
13
  export { readEtag, writeHeaders } from './internal/conditional.js';
14
- export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, ConflictError, PreconditionFailedError, LogNotConfirmedError, PayloadTooLargeError, QuotaExceededError, EncryptionError, KeyUnwrapError, IntegrityError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError, WasServerError, mapError } from './errors.js';
14
+ export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, NotSupportedError, ConflictError, PreconditionFailedError, LogNotConfirmedError, PayloadTooLargeError, QuotaExceededError, EncryptionError, KeyUnwrapError, IntegrityError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError, WasServerError, mapError } from './errors.js';
15
+ export { isChunkedWrite } from './codec.js';
15
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA;AAIpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA"}
@@ -1,5 +1,40 @@
1
1
  import type { ClientContext } from './request.js';
2
2
  import type { IZcap } from '../types.js';
3
+ /**
4
+ * The read side of a backend-feature probe, so a consumer can be handed an
5
+ * already-memoized probe instead of building its own (and repeating the
6
+ * descriptor round trip). {@link BackendFeatures} is the implementation;
7
+ * {@link featureProbeFrom} adapts a bare "resolve the feature tokens" thunk --
8
+ * the shape a handle shares with its children -- to the same interface.
9
+ */
10
+ export interface FeatureProbe {
11
+ get(): Promise<string[]>;
12
+ has(feature: string): Promise<boolean>;
13
+ /**
14
+ * Whether the probe's answer came from a backend descriptor that could not be
15
+ * read at all (`404` / `405` / `501`) rather than from one that was read and
16
+ * advertises a feature set. Both answer "no features", but only the second is
17
+ * evidence about the server's capabilities: the first also covers a deleted
18
+ * collection and a capability that cannot read the descriptor (WAS masks
19
+ * unauthorized reads as 404). An affordance gate consults it so its error
20
+ * names the right cause.
21
+ *
22
+ * @returns {Promise<boolean>}
23
+ */
24
+ descriptorAbsent(): Promise<boolean>;
25
+ }
26
+ /**
27
+ * Adapts a resolve-the-feature-tokens thunk (a handle's shared, memoized probe)
28
+ * to the {@link FeatureProbe} interface, so a consumer that only needs to ask
29
+ * `has(...)` can be driven by someone else's memo.
30
+ *
31
+ * @param get {function} resolves the backend's advertised feature tokens
32
+ * @param [descriptorAbsent] {function} resolves whether the descriptor was
33
+ * unreadable; a bare thunk carries no such signal, so it defaults to `false`
34
+ * ("a descriptor was read, and it advertises these tokens")
35
+ * @returns {FeatureProbe}
36
+ */
37
+ export declare function featureProbeFrom(get: () => Promise<string[]>, descriptorAbsent?: () => Promise<boolean>): FeatureProbe;
3
38
  /**
4
39
  * A memoizing probe of one collection backend's advertised feature tokens.
5
40
  * Memoized once it produces a definitive answer: a successful read (including
@@ -14,7 +49,7 @@ import type { IZcap } from '../types.js';
14
49
  * degrading against a server that may well be capable. (A single transient
15
50
  * failure must not poison the probe for its lifetime.)
16
51
  */
17
- export declare class BackendFeatures {
52
+ export declare class BackendFeatures implements FeatureProbe {
18
53
  #private;
19
54
  /**
20
55
  * @param readDescriptor {function} reads and parses the backend descriptor
@@ -36,6 +71,14 @@ export declare class BackendFeatures {
36
71
  * @returns {Promise<boolean>}
37
72
  */
38
73
  has(feature: string): Promise<boolean>;
74
+ /**
75
+ * Whether the (definitive) answer came from an unreadable backend descriptor
76
+ * rather than from one that was read. Awaits the probe, so it reports the
77
+ * same answer `get()` resolved.
78
+ *
79
+ * @returns {Promise<boolean>}
80
+ */
81
+ descriptorAbsent(): Promise<boolean>;
39
82
  }
40
83
  /**
41
84
  * Builds the {@link BackendFeatures} probe for a collection, reading its
@@ -1 +1 @@
1
- {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/internal/features.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAcxC;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAe;;IAI1B;;;;OAIG;gBACS,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC;IAIlD;;;;;OAKG;IACH,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKxB;;;;;OAKG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAkC7C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,aAAa,EACtB,EACE,OAAO,EACP,YAAY,EACZ,UAAU,EACX,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GAC/D,eAAe,CAWjB"}
1
+ {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/internal/features.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAcxC;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACxB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC;;;;;;;;;;OAUG;IACH,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;CACrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,EAC5B,gBAAgB,GAAE,MAAM,OAAO,CAAC,OAAO,CAAqB,GAC3D,YAAY,CAQd;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAgB,YAAW,YAAY;;IAWlD;;;;OAIG;gBACS,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC;IAIlD;;;;;OAKG;IACH,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKxB;;;;;OAKG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5C;;;;;;OAMG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;CAoC3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,aAAa,EACtB,EACE,OAAO,EACP,YAAY,EACZ,UAAU,EACX,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GAC/D,eAAe,CAWjB"}
@@ -25,6 +25,26 @@ import { collectionBackend } from './paths.js';
25
25
  * transient/ambiguous and is re-probed instead of cached.
26
26
  */
27
27
  const DESCRIPTOR_ABSENT_STATUSES = new Set([404, 405, 501]);
28
+ /**
29
+ * Adapts a resolve-the-feature-tokens thunk (a handle's shared, memoized probe)
30
+ * to the {@link FeatureProbe} interface, so a consumer that only needs to ask
31
+ * `has(...)` can be driven by someone else's memo.
32
+ *
33
+ * @param get {function} resolves the backend's advertised feature tokens
34
+ * @param [descriptorAbsent] {function} resolves whether the descriptor was
35
+ * unreadable; a bare thunk carries no such signal, so it defaults to `false`
36
+ * ("a descriptor was read, and it advertises these tokens")
37
+ * @returns {FeatureProbe}
38
+ */
39
+ export function featureProbeFrom(get, descriptorAbsent = async () => false) {
40
+ return {
41
+ get,
42
+ async has(feature) {
43
+ return (await get()).includes(feature);
44
+ },
45
+ descriptorAbsent
46
+ };
47
+ }
28
48
  /**
29
49
  * A memoizing probe of one collection backend's advertised feature tokens.
30
50
  * Memoized once it produces a definitive answer: a successful read (including
@@ -41,6 +61,13 @@ const DESCRIPTOR_ABSENT_STATUSES = new Set([404, 405, 501]);
41
61
  */
42
62
  export class BackendFeatures {
43
63
  #promise;
64
+ /**
65
+ * Set when the probe's definitive answer was "the descriptor could not be
66
+ * read" rather than "the descriptor lists these features", so a gate can tell
67
+ * a server that lacks an affordance from one whose descriptor is absent (or
68
+ * whose collection is gone, or unreadable with this capability).
69
+ */
70
+ #descriptorAbsent = false;
44
71
  #readDescriptor;
45
72
  /**
46
73
  * @param readDescriptor {function} reads and parses the backend descriptor
@@ -69,6 +96,17 @@ export class BackendFeatures {
69
96
  async has(feature) {
70
97
  return (await this.get()).includes(feature);
71
98
  }
99
+ /**
100
+ * Whether the (definitive) answer came from an unreadable backend descriptor
101
+ * rather than from one that was read. Awaits the probe, so it reports the
102
+ * same answer `get()` resolved.
103
+ *
104
+ * @returns {Promise<boolean>}
105
+ */
106
+ async descriptorAbsent() {
107
+ await this.get();
108
+ return this.#descriptorAbsent;
109
+ }
72
110
  /**
73
111
  * Reads and parses the backend descriptor once. On a definitive answer
74
112
  * (success, or a `404` / `405` / `501` that means the endpoint is
@@ -88,6 +126,7 @@ export class BackendFeatures {
88
126
  catch (err) {
89
127
  const status = httpStatus(err);
90
128
  if (status !== undefined && DESCRIPTOR_ABSENT_STATUSES.has(status)) {
129
+ this.#descriptorAbsent = true;
91
130
  return [];
92
131
  }
93
132
  // Transient/ambiguous: do not cache this failure -- drop the memo so the
@@ -1 +1 @@
1
- {"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/internal/features.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,cAA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MAAM,KAAK,SAAS,IAAI,0BAA0B,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBACnE,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAA;gBAC7B,OAAO,EAAE,CAAA;YACX,CAAC;YACD,yEAAyE;YACzE,sCAAsC;YACtC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAA;YACzB,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;CACF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAsB,EACtB,EACE,OAAO,EACP,YAAY,EACZ,UAAU,EACoD;IAEhE,OAAO,IAAI,eAAe,CAAC,KAAK,IAAI,EAAE;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;YACnC,IAAI,EAAE,iBAAiB,CAAC,OAAO,EAAE,YAAY,CAAC;YAC9C,MAAM,EAAE,KAAK;YACb,UAAU;SACX,CAAC,CAAA;QACF,yEAAyE;QACzE,2EAA2E;QAC3E,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -12,11 +12,17 @@
12
12
  * conditional-codec pre-read of the current document, the codec-vs-caller
13
13
  * precondition selection, and the masked-404 policy for a document that exists
14
14
  * but is not readable with the bound capability).
15
+ *
16
+ * A codec may also answer `encode` with a multi-request `ChunkedWrite` plan
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.
15
20
  */
16
21
  import type { HttpResponse } from '@interop/http-client';
17
- import type { EncodedWrite, ResourceCodec } from '../codec.js';
22
+ import type { CodecRequestContext, EncodedWrite, ResourceCodec } from '../codec.js';
18
23
  import type { IZcap, ResourceData } from '../types.js';
19
24
  import type { ClientContext } from './request.js';
25
+ import type { FeatureProbe } from './features.js';
20
26
  import type { WritePrecondition } from './conditional.js';
21
27
  /**
22
28
  * Sends an encoded write (`PUT`/`POST`) to a resource path, applying the
@@ -40,11 +46,58 @@ export declare function sendEncodedWrite(context: ClientContext, { path, method,
40
46
  capability?: IZcap;
41
47
  precondition?: WritePrecondition;
42
48
  }): Promise<HttpResponse>;
49
+ /**
50
+ * Builds the {@link CodecRequestContext} core hands a codec that drives its own
51
+ * I/O: the signed-request primitive bound to this handle's capability, plus the
52
+ * handle's memoized backend-feature probe. The codec never sees the zcap
53
+ * machinery, and the raw `HttpResponse` it gets back matches the
54
+ * `was.request()` escape hatch, which is what `WasTransport` consumes.
55
+ *
56
+ * Requests go through the same mapped `send` path the core write paths use, so
57
+ * a codec-driven write fails with the typed `WasError` subclasses the calling
58
+ * method documents (a document `PUT` that 404s is a `NotFoundError`, not a raw
59
+ * ky/ezcap error). The typed errors carry the HTTP `status`, so a consumer that
60
+ * dispatches on status keeps working.
61
+ *
62
+ * @param context {ClientContext}
63
+ * @param options {object}
64
+ * @param options.features {FeatureProbe} the handle's memoized backend-feature
65
+ * probe
66
+ * @param [options.capability] {IZcap} capability attached to each request
67
+ * @returns {CodecRequestContext}
68
+ */
69
+ export declare function codecRequestContext(context: ClientContext, { features, capability }: {
70
+ features: FeatureProbe;
71
+ capability?: IZcap;
72
+ }): CodecRequestContext;
73
+ /**
74
+ * The outcome of {@link insertResource}: either the ordinary single-request
75
+ * write (the codec's encoding, the path written, and the response) or the
76
+ * result of a codec's multi-request {@link ChunkedWrite} plan, which has no one
77
+ * canonical response.
78
+ */
79
+ export type InsertOutcome = {
80
+ chunked?: false;
81
+ encoded: EncodedWrite;
82
+ path: string;
83
+ response: HttpResponse;
84
+ } | {
85
+ chunked: true;
86
+ id: string;
87
+ path: string;
88
+ contentType?: string;
89
+ etag?: string;
90
+ };
43
91
  /**
44
92
  * Creates a resource with a codec-minted or server-minted id (insert) through
45
93
  * its codec, owning the create orchestration in one place: the encode, the
46
94
  * `PUT`-vs-`POST` branch, and the precondition selection.
47
95
  *
96
+ * A codec may also answer the encode with a multi-request plan (the EDV codec's
97
+ * chunked blob write). The plan is then executed over the handle's signed
98
+ * request context instead of being sent as one request; it owns its own
99
+ * preconditions and feature gating.
100
+ *
48
101
  * A codec that mints its own id (e.g. the encrypting codec's EDV id) writes it
49
102
  * by `PUT` to that id's path; a codec that mints none (the identity codec)
50
103
  * `POST`s to the items path and lets the server mint one. As in
@@ -64,25 +117,25 @@ export declare function sendEncodedWrite(context: ClientContext, { path, method,
64
117
  * codec-minted id
65
118
  * @param options.codec {ResourceCodec} the collection's resolved codec
66
119
  * @param options.data {ResourceData} the plaintext value
120
+ * @param options.features {FeatureProbe} the handle's shared backend-feature
121
+ * probe, handed to a codec's multi-request plan so its affordance gate costs
122
+ * no extra round trip
67
123
  * @param [options.contentType] {string} caller-supplied content type
68
124
  * @param [options.capability] {IZcap}
69
125
  * @param [options.precondition] {WritePrecondition} the caller's explicit
70
126
  * precondition (used only for a non-conditional codec)
71
- * @returns {Promise<{ encoded: EncodedWrite; path: string; response: HttpResponse }>}
127
+ * @returns {Promise<InsertOutcome>}
72
128
  */
73
- export declare function insertResource(context: ClientContext, { itemsPath, pathForId, codec, data, contentType, capability, precondition }: {
129
+ export declare function insertResource(context: ClientContext, { itemsPath, pathForId, codec, data, features, contentType, capability, precondition }: {
74
130
  itemsPath: string;
75
131
  pathForId: (id: string) => string;
76
132
  codec: ResourceCodec;
77
133
  data: ResourceData;
134
+ features: FeatureProbe;
78
135
  contentType?: string;
79
136
  capability?: IZcap;
80
137
  precondition?: WritePrecondition;
81
- }): Promise<{
82
- encoded: EncodedWrite;
83
- path: string;
84
- response: HttpResponse;
85
- }>;
138
+ }): Promise<InsertOutcome>;
86
139
  /**
87
140
  * Creates or replaces a resource by id (upsert) through its codec, owning the
88
141
  * conditional-write orchestration in one place:
@@ -111,9 +164,9 @@ export declare function insertResource(context: ClientContext, { itemsPath, path
111
164
  * @param options.codec {ResourceCodec} the collection's resolved codec
112
165
  * @param options.id {string} the resource id
113
166
  * @param options.data {ResourceData} the plaintext value
114
- * @param options.features {function} resolves the backend's
115
- * advertised feature tokens (the handle's shared `BackendFeatures` probe);
116
- * consulted only for a conditional codec's insert-after-null-pre-read
167
+ * @param options.features {FeatureProbe} the handle's shared
168
+ * `BackendFeatures` probe; consulted only for a conditional codec's
169
+ * insert-after-null-pre-read
117
170
  * @param [options.contentType] {string} caller-supplied content type
118
171
  * @param [options.capability] {IZcap}
119
172
  * @param [options.precondition] {WritePrecondition} the caller's explicit
@@ -125,7 +178,7 @@ export declare function upsertResource(context: ClientContext, { path, codec, id
125
178
  codec: ResourceCodec;
126
179
  id: string;
127
180
  data: ResourceData;
128
- features: () => Promise<string[]>;
181
+ features: FeatureProbe;
129
182
  contentType?: string;
130
183
  capability?: IZcap;
131
184
  precondition?: WritePrecondition;
@@ -1 +1 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGjD,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,EAA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