@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
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* The `err.name` predicates that classify the errors a replication path can
|
|
6
6
|
* meet: the port's two wire signals (`WasSyncConflictError` /
|
|
7
7
|
* `WasSyncNotFoundError`), its opt-in revoked-access signal
|
|
8
|
-
* (`WasSyncAuthError`),
|
|
9
|
-
*
|
|
10
|
-
* (`
|
|
8
|
+
* (`WasSyncAuthError`), the cipher's two no-key signals (the stale-descriptor
|
|
9
|
+
* `UnknownEpochError` and the not-a-recipient `KeyUnwrapError`), its tamper
|
|
10
|
+
* signal (`IntegrityError`), and the client's affordance gate
|
|
11
|
+
* (`NotSupportedError`), raised before the request when the operation cannot
|
|
12
|
+
* be carried out as asked.
|
|
11
13
|
*
|
|
12
14
|
* They live beside the classes that assign the names they match (`errors.ts`)
|
|
13
15
|
* because every one of those errors is raised inside a seam the consuming app
|
|
@@ -19,6 +21,9 @@
|
|
|
19
21
|
* becomes a fatal cycle error, and a create-loss re-mint rethrows instead of
|
|
20
22
|
* re-minting. Each class assigns its `name` explicitly, which is what makes the
|
|
21
23
|
* string a contract (`decisions/0001-cross-package-errors-match-by-name.md`).
|
|
24
|
+
* The affordance gate is raised outside a seam, in this copy, but is matched
|
|
25
|
+
* the same way: one rule for the set, so a consumer needs no per-signal memory
|
|
26
|
+
* of which ones an `instanceof` would have survived.
|
|
22
27
|
*
|
|
23
28
|
* Each returns a plain boolean rather than a type guard: the guard would narrow
|
|
24
29
|
* to this copy's class, the very identity the rule declines to depend on. A
|
|
@@ -81,4 +86,29 @@ export declare function isUnknownEpochError(err: unknown): boolean;
|
|
|
81
86
|
* @returns {boolean}
|
|
82
87
|
*/
|
|
83
88
|
export declare function isKeyUnwrapError(err: unknown): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Whether an error is the cipher's tamper signal (`IntegrityError`): a stored
|
|
91
|
+
* body failed verification against the resource id it was read under, or an
|
|
92
|
+
* envelope this reader holds a key for failed to authenticate. The server
|
|
93
|
+
* altered the data or served it under another id. Retrying the read or
|
|
94
|
+
* refreshing the descriptor cannot fix it, and the row must not be applied.
|
|
95
|
+
*
|
|
96
|
+
* @param err {unknown} the caught error
|
|
97
|
+
* @returns {boolean}
|
|
98
|
+
*/
|
|
99
|
+
export declare function isIntegrityError(err: unknown): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Whether an error is the client's affordance-gate refusal
|
|
102
|
+
* (`NotSupportedError`): the operation cannot be carried out as asked. On a
|
|
103
|
+
* replication path it is the guarded write refused because the read it is
|
|
104
|
+
* pinned to returned no `ETag` validator, and a chunked envelope a cipher was
|
|
105
|
+
* built with no route to. Permanent, and the one refusal a replication driver
|
|
106
|
+
* must NOT retry: nothing about a later attempt changes the answer, so a retry
|
|
107
|
+
* loop would re-send the same batch forever. Raised before the request, so the
|
|
108
|
+
* matched value carries no `status`.
|
|
109
|
+
*
|
|
110
|
+
* @param err {unknown} the caught error
|
|
111
|
+
* @returns {boolean}
|
|
112
|
+
*/
|
|
113
|
+
export declare function isNotSupportedError(err: unknown): boolean;
|
|
84
114
|
//# sourceMappingURL=predicates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../../src/sync/predicates.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../../src/sync/predicates.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAaH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAErD;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEzD"}
|
package/dist/sync/predicates.js
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* The `err.name` predicates that classify the errors a replication path can
|
|
6
6
|
* meet: the port's two wire signals (`WasSyncConflictError` /
|
|
7
7
|
* `WasSyncNotFoundError`), its opt-in revoked-access signal
|
|
8
|
-
* (`WasSyncAuthError`),
|
|
9
|
-
*
|
|
10
|
-
* (`
|
|
8
|
+
* (`WasSyncAuthError`), the cipher's two no-key signals (the stale-descriptor
|
|
9
|
+
* `UnknownEpochError` and the not-a-recipient `KeyUnwrapError`), its tamper
|
|
10
|
+
* signal (`IntegrityError`), and the client's affordance gate
|
|
11
|
+
* (`NotSupportedError`), raised before the request when the operation cannot
|
|
12
|
+
* be carried out as asked.
|
|
11
13
|
*
|
|
12
14
|
* They live beside the classes that assign the names they match (`errors.ts`)
|
|
13
15
|
* because every one of those errors is raised inside a seam the consuming app
|
|
@@ -19,6 +21,9 @@
|
|
|
19
21
|
* becomes a fatal cycle error, and a create-loss re-mint rethrows instead of
|
|
20
22
|
* re-minting. Each class assigns its `name` explicitly, which is what makes the
|
|
21
23
|
* string a contract (`decisions/0001-cross-package-errors-match-by-name.md`).
|
|
24
|
+
* The affordance gate is raised outside a seam, in this copy, but is matched
|
|
25
|
+
* the same way: one rule for the set, so a consumer needs no per-signal memory
|
|
26
|
+
* of which ones an `instanceof` would have survived.
|
|
22
27
|
*
|
|
23
28
|
* Each returns a plain boolean rather than a type guard: the guard would narrow
|
|
24
29
|
* to this copy's class, the very identity the rule declines to depend on. A
|
|
@@ -101,4 +106,33 @@ export function isUnknownEpochError(err) {
|
|
|
101
106
|
export function isKeyUnwrapError(err) {
|
|
102
107
|
return nameOf(err) === 'KeyUnwrapError';
|
|
103
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Whether an error is the cipher's tamper signal (`IntegrityError`): a stored
|
|
111
|
+
* body failed verification against the resource id it was read under, or an
|
|
112
|
+
* envelope this reader holds a key for failed to authenticate. The server
|
|
113
|
+
* altered the data or served it under another id. Retrying the read or
|
|
114
|
+
* refreshing the descriptor cannot fix it, and the row must not be applied.
|
|
115
|
+
*
|
|
116
|
+
* @param err {unknown} the caught error
|
|
117
|
+
* @returns {boolean}
|
|
118
|
+
*/
|
|
119
|
+
export function isIntegrityError(err) {
|
|
120
|
+
return nameOf(err) === 'IntegrityError';
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Whether an error is the client's affordance-gate refusal
|
|
124
|
+
* (`NotSupportedError`): the operation cannot be carried out as asked. On a
|
|
125
|
+
* replication path it is the guarded write refused because the read it is
|
|
126
|
+
* pinned to returned no `ETag` validator, and a chunked envelope a cipher was
|
|
127
|
+
* built with no route to. Permanent, and the one refusal a replication driver
|
|
128
|
+
* must NOT retry: nothing about a later attempt changes the answer, so a retry
|
|
129
|
+
* loop would re-send the same batch forever. Raised before the request, so the
|
|
130
|
+
* matched value carries no `status`.
|
|
131
|
+
*
|
|
132
|
+
* @param err {unknown} the caught error
|
|
133
|
+
* @returns {boolean}
|
|
134
|
+
*/
|
|
135
|
+
export function isNotSupportedError(err) {
|
|
136
|
+
return nameOf(err) === 'NotSupportedError';
|
|
137
|
+
}
|
|
104
138
|
//# sourceMappingURL=predicates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../src/sync/predicates.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../src/sync/predicates.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;;;GAMG;AACH,SAAS,MAAM,CAAC,GAAY;IAC1B,OAAQ,GAAiC,EAAE,IAAI,CAAA;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,sBAAsB,CAAA;AAC/C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,sBAAsB,CAAA;AAC/C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,kBAAkB,CAAA;AAC3C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,mBAAmB,CAAA;AAC5C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,gBAAgB,CAAA;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,gBAAgB,CAAA;AACzC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,mBAAmB,CAAA;AAC5C,CAAC"}
|
package/dist/sync/types.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* every replication driver reports one feed's state through.
|
|
14
14
|
*/
|
|
15
15
|
import type { ChangeDocument, ChangesCheckpoint, ChangesPage } from '@interop/storage-core';
|
|
16
|
+
import type { CodecRequestContext } from '../codec.js';
|
|
16
17
|
import type { Json } from '../types.js';
|
|
17
18
|
export type { Json };
|
|
18
19
|
/**
|
|
@@ -62,8 +63,8 @@ export interface SyncPage extends Omit<ChangesPage, 'documents'> {
|
|
|
62
63
|
* the change feed remains the authority on ordering).
|
|
63
64
|
*
|
|
64
65
|
* `etag` and `metaEtag` are the raw, opaque `ETag` validators the content and
|
|
65
|
-
* `/meta` reads returned (absent
|
|
66
|
-
*
|
|
66
|
+
* `/meta` reads returned (absent only where the header did not reach the
|
|
67
|
+
* client) -- pass one back verbatim as a later write's `ifMatch`. `version`
|
|
67
68
|
* and `metaVersion` are the revision numbers parsed out of them, for
|
|
68
69
|
* comparison or display only.
|
|
69
70
|
*/
|
|
@@ -83,8 +84,8 @@ export interface MasterState {
|
|
|
83
84
|
* opaque `etag` validator it lives behind, exactly as the server sent it.
|
|
84
85
|
* Pass `etag` back verbatim as a later write's `ifMatch` -- it can no longer
|
|
85
86
|
* be synthesized from `version` alone, since the server's `ETag` also embeds a
|
|
86
|
-
* per-record generation marker ahead of the version. `etag` is absent
|
|
87
|
-
*
|
|
87
|
+
* per-record generation marker ahead of the version. `etag` is absent only
|
|
88
|
+
* where the header did not reach the client; read `version` only to compare
|
|
88
89
|
* or display a revision number.
|
|
89
90
|
*/
|
|
90
91
|
export interface WriteAck {
|
|
@@ -184,6 +185,22 @@ export interface WasSyncPort {
|
|
|
184
185
|
* (advancing the envelope `sequence`). A content-addressed cipher (plaintext
|
|
185
186
|
* or `idDerivation: 'content'`) either omits it or throws: a changed document
|
|
186
187
|
* is a different id, never an in-place update.
|
|
188
|
+
* - `decrypt` takes the resource id the envelope was stored under (the feed
|
|
189
|
+
* row's `id`, or the id a {@link WasSyncPort.get} addressed) and verifies the
|
|
190
|
+
* envelope against it, throwing `IntegrityError` when the envelope was
|
|
191
|
+
* written for a different id. A missing id throws `ValidationError` rather
|
|
192
|
+
* than skipping the check. An EDV cipher checks the AEAD-bound
|
|
193
|
+
* `was.resource` binding, or re-derives a content-derived id from the
|
|
194
|
+
* ciphertext. The plaintext cipher recomputes the content id. Pass the id
|
|
195
|
+
* the replica addressed, never the envelope's own cleartext `id`, which the
|
|
196
|
+
* server controls.
|
|
197
|
+
* - `decrypt` also takes an optional `context`, the signed-request surface a
|
|
198
|
+
* codec reads a multi-resource document through. With it, an EDV cipher
|
|
199
|
+
* reassembles a chunked envelope from its chunk resources. Without it, such
|
|
200
|
+
* an envelope throws `EncryptionError`. A cipher built without a `spaceId`
|
|
201
|
+
* throws `NotSupportedError`. A replica gets one from its Collection handle
|
|
202
|
+
* (`collection.codecContext()`). A binary document decrypts to a `Blob`, and
|
|
203
|
+
* everything else to `Json`.
|
|
187
204
|
*/
|
|
188
205
|
export interface DocCipher {
|
|
189
206
|
encrypt(options: {
|
|
@@ -203,8 +220,10 @@ export interface DocCipher {
|
|
|
203
220
|
epoch?: string;
|
|
204
221
|
}>;
|
|
205
222
|
decrypt(options: {
|
|
223
|
+
id: string;
|
|
206
224
|
envelope: Json;
|
|
207
|
-
|
|
225
|
+
context?: CodecRequestContext;
|
|
226
|
+
}): Promise<Json | Blob>;
|
|
208
227
|
}
|
|
209
228
|
/**
|
|
210
229
|
* Per-feed replication status, surfaced to the app's state layer. The
|
package/dist/sync/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sync/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,cAAc,EACd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;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -126,9 +126,10 @@ export interface AddResult {
|
|
|
126
126
|
url: string;
|
|
127
127
|
contentType?: string;
|
|
128
128
|
/**
|
|
129
|
-
* The created resource's strong `ETag` validator
|
|
130
|
-
*
|
|
131
|
-
*
|
|
129
|
+
* The created resource's strong `ETag` validator. Pass it to a later
|
|
130
|
+
* `put(id, data, { ifMatch })` for a lost-update-safe update. Absent only
|
|
131
|
+
* where the header did not reach the client (a browser client needs `ETag`
|
|
132
|
+
* in the server's `Access-Control-Expose-Headers`).
|
|
132
133
|
*/
|
|
133
134
|
etag?: string;
|
|
134
135
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,KAAK,EACL,cAAc,EACd,SAAS,EACV,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAE5E,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAE/D;;;;;;;;GAQG;AACH,YAAY,EACV,MAAM,EACN,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,cAAc,EACd,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,kB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AED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,IAAI,GAAG,UAAU,CAAA;IACxB,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/was-client",
|
|
3
3
|
"description": "A developer-friendly client for Wallet Attached Storage (WAS) servers.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.67.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@interop/ezcap": "^7.4.8",
|
|
75
75
|
"@interop/http-client": "^1.0.5",
|
|
76
76
|
"@interop/minimal-cipher": "^7.10.2",
|
|
77
|
-
"@interop/storage-core": "^0.
|
|
77
|
+
"@interop/storage-core": "^0.17.0",
|
|
78
78
|
"@interop/vh-resource-log": "^0.5.1",
|
|
79
79
|
"@interop/x25519-key-agreement-key": "^5.4.0",
|
|
80
80
|
"@noble/hashes": "^2.3.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@interop/data-integrity-proof": "3.4.5",
|
|
87
87
|
"@interop/ed25519-verification-key": "^8.2.0",
|
|
88
88
|
"@interop/jsonld-signatures": "11.8.5",
|
|
89
|
-
"@interop/zcap": "11.
|
|
89
|
+
"@interop/zcap": "11.3.0",
|
|
90
90
|
"@playwright/test": "^1.62.1",
|
|
91
91
|
"@types/node": "^26.1.2",
|
|
92
92
|
"@vitest/coverage-v8": "^4.1.10",
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { ClientContext } from './request.js';
|
|
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;
|
|
38
|
-
/**
|
|
39
|
-
* A memoizing probe of one collection backend's advertised feature tokens.
|
|
40
|
-
* Memoized once it produces a definitive answer: a successful read (including
|
|
41
|
-
* one that lists no features) and a definitive "endpoint absent"
|
|
42
|
-
* (`404` / `405` / `501`) both resolve to a cached feature list, so every
|
|
43
|
-
* affordance gate falls closed against a server that has no backend
|
|
44
|
-
* descriptors.
|
|
45
|
-
*
|
|
46
|
-
* A transient/ambiguous failure (network error, timeout, `401`, `429`, other
|
|
47
|
-
* `5xx`) is NOT cached: the memo is cleared so the next call re-probes, and
|
|
48
|
-
* the error is rethrown so the caller fails loud rather than silently
|
|
49
|
-
* degrading against a server that may well be capable. (A single transient
|
|
50
|
-
* failure must not poison the probe for its lifetime.)
|
|
51
|
-
*/
|
|
52
|
-
export declare class BackendFeatures implements FeatureProbe {
|
|
53
|
-
#private;
|
|
54
|
-
/**
|
|
55
|
-
* @param readDescriptor {function} reads and parses the backend descriptor
|
|
56
|
-
* JSON (`GET .../backend`); expected to throw an error carrying an HTTP
|
|
57
|
-
* status (readable via `httpStatus`) on failure
|
|
58
|
-
*/
|
|
59
|
-
constructor(readDescriptor: () => Promise<unknown>);
|
|
60
|
-
/**
|
|
61
|
-
* The feature tokens the backend advertises, probed once and cached on a
|
|
62
|
-
* definitive answer.
|
|
63
|
-
*
|
|
64
|
-
* @returns {Promise<string[]>}
|
|
65
|
-
*/
|
|
66
|
-
get(): Promise<string[]>;
|
|
67
|
-
/**
|
|
68
|
-
* Whether the backend advertises the given feature token.
|
|
69
|
-
*
|
|
70
|
-
* @param feature {string} the affordance token (e.g. `conditional-writes`)
|
|
71
|
-
* @returns {Promise<boolean>}
|
|
72
|
-
*/
|
|
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>;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Builds the {@link BackendFeatures} probe for a collection, reading its
|
|
85
|
-
* backend descriptor with a signed `GET` through the shared request layer --
|
|
86
|
-
* the probe the core handles (Collection/Resource) hold, mirroring the one
|
|
87
|
-
* `WasTransport` builds over its own requester. A descriptor that is not
|
|
88
|
-
* readable with the bound capability surfaces as a 404 (WAS masks unauthorized
|
|
89
|
-
* reads), which the probe treats as "no features advertised" -- so every
|
|
90
|
-
* affordance gate falls closed for a capability that cannot read the
|
|
91
|
-
* descriptor.
|
|
92
|
-
*
|
|
93
|
-
* @param context {ClientContext}
|
|
94
|
-
* @param options {object}
|
|
95
|
-
* @param options.spaceId {string}
|
|
96
|
-
* @param options.collectionId {string}
|
|
97
|
-
* @param [options.capability] {IZcap} capability attached to the probe
|
|
98
|
-
* @returns {BackendFeatures}
|
|
99
|
-
*/
|
|
100
|
-
export declare function collectionBackendFeatures(context: ClientContext, { spaceId, collectionId, capability }: {
|
|
101
|
-
spaceId: string;
|
|
102
|
-
collectionId: string;
|
|
103
|
-
capability?: IZcap;
|
|
104
|
-
}): BackendFeatures;
|
|
105
|
-
//# sourceMappingURL=features.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/internal/features.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAKjD,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;IAKlD;;;;;OAKG;IACH,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIxB;;;;;OAKG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5C;;;;;;OAMG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;CAmC3C;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,168 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The shared backend-feature probe: reads a collection backend's "Collection
|
|
6
|
-
* Backend Selected" descriptor once and answers which optional affordance
|
|
7
|
-
* tokens it advertises (e.g. `conditional-writes`, `blinded-index-query`,
|
|
8
|
-
* `chunked-streams`). Both EDV write paths -- the standalone `WasTransport`
|
|
9
|
-
* and the codec-seam write orchestration -- consult this one helper, so the
|
|
10
|
-
* backend-capability decision is made in a single place instead of being
|
|
11
|
-
* probed in one path and assumed away in the other.
|
|
12
|
-
*/
|
|
13
|
-
import { httpStatus } from '../errors.js';
|
|
14
|
-
import { send } from './request.js';
|
|
15
|
-
import { readJsonData } from './content.js';
|
|
16
|
-
import { Memo } from './memo.js';
|
|
17
|
-
import { collectionBackend } from './paths.js';
|
|
18
|
-
/**
|
|
19
|
-
* HTTP statuses that mean the backend-descriptor endpoint is legitimately
|
|
20
|
-
* absent (or explicitly unimplemented), as opposed to transiently failing:
|
|
21
|
-
* `404` (no such endpoint), `405` (endpoint does not answer `GET`), `501`
|
|
22
|
-
* (not implemented). These are a definitive "this server advertises no
|
|
23
|
-
* backend features" answer and are safe to cache -- every affordance gate
|
|
24
|
-
* then falls closed against a server that has no backend descriptors. Any
|
|
25
|
-
* other failure (network error, timeout, `401`, `429`, other `5xx`) is
|
|
26
|
-
* transient/ambiguous and is re-probed instead of cached.
|
|
27
|
-
*/
|
|
28
|
-
const DESCRIPTOR_ABSENT_STATUSES = new Set([404, 405, 501]);
|
|
29
|
-
/**
|
|
30
|
-
* Adapts a resolve-the-feature-tokens thunk (a handle's shared, memoized probe)
|
|
31
|
-
* to the {@link FeatureProbe} interface, so a consumer that only needs to ask
|
|
32
|
-
* `has(...)` can be driven by someone else's memo.
|
|
33
|
-
*
|
|
34
|
-
* @param get {function} resolves the backend's advertised feature tokens
|
|
35
|
-
* @param [descriptorAbsent] {function} resolves whether the descriptor was
|
|
36
|
-
* unreadable; a bare thunk carries no such signal, so it defaults to `false`
|
|
37
|
-
* ("a descriptor was read, and it advertises these tokens")
|
|
38
|
-
* @returns {FeatureProbe}
|
|
39
|
-
*/
|
|
40
|
-
export function featureProbeFrom(get, descriptorAbsent = async () => false) {
|
|
41
|
-
return {
|
|
42
|
-
get,
|
|
43
|
-
async has(feature) {
|
|
44
|
-
return (await get()).includes(feature);
|
|
45
|
-
},
|
|
46
|
-
descriptorAbsent
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* A memoizing probe of one collection backend's advertised feature tokens.
|
|
51
|
-
* Memoized once it produces a definitive answer: a successful read (including
|
|
52
|
-
* one that lists no features) and a definitive "endpoint absent"
|
|
53
|
-
* (`404` / `405` / `501`) both resolve to a cached feature list, so every
|
|
54
|
-
* affordance gate falls closed against a server that has no backend
|
|
55
|
-
* descriptors.
|
|
56
|
-
*
|
|
57
|
-
* A transient/ambiguous failure (network error, timeout, `401`, `429`, other
|
|
58
|
-
* `5xx`) is NOT cached: the memo is cleared so the next call re-probes, and
|
|
59
|
-
* the error is rethrown so the caller fails loud rather than silently
|
|
60
|
-
* degrading against a server that may well be capable. (A single transient
|
|
61
|
-
* failure must not poison the probe for its lifetime.)
|
|
62
|
-
*/
|
|
63
|
-
export class BackendFeatures {
|
|
64
|
-
#memo;
|
|
65
|
-
/**
|
|
66
|
-
* Set when the probe's definitive answer was "the descriptor could not be
|
|
67
|
-
* read" rather than "the descriptor lists these features", so a gate can tell
|
|
68
|
-
* a server that lacks an affordance from one whose descriptor is absent (or
|
|
69
|
-
* whose collection is gone, or unreadable with this capability).
|
|
70
|
-
*/
|
|
71
|
-
#descriptorAbsent = false;
|
|
72
|
-
#readDescriptor;
|
|
73
|
-
/**
|
|
74
|
-
* @param readDescriptor {function} reads and parses the backend descriptor
|
|
75
|
-
* JSON (`GET .../backend`); expected to throw an error carrying an HTTP
|
|
76
|
-
* status (readable via `httpStatus`) on failure
|
|
77
|
-
*/
|
|
78
|
-
constructor(readDescriptor) {
|
|
79
|
-
this.#readDescriptor = readDescriptor;
|
|
80
|
-
this.#memo = new Memo(() => this.#probe());
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* The feature tokens the backend advertises, probed once and cached on a
|
|
84
|
-
* definitive answer.
|
|
85
|
-
*
|
|
86
|
-
* @returns {Promise<string[]>}
|
|
87
|
-
*/
|
|
88
|
-
get() {
|
|
89
|
-
return this.#memo.get();
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Whether the backend advertises the given feature token.
|
|
93
|
-
*
|
|
94
|
-
* @param feature {string} the affordance token (e.g. `conditional-writes`)
|
|
95
|
-
* @returns {Promise<boolean>}
|
|
96
|
-
*/
|
|
97
|
-
async has(feature) {
|
|
98
|
-
return (await this.get()).includes(feature);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Whether the (definitive) answer came from an unreadable backend descriptor
|
|
102
|
-
* rather than from one that was read. Awaits the probe, so it reports the
|
|
103
|
-
* same answer `get()` resolved.
|
|
104
|
-
*
|
|
105
|
-
* @returns {Promise<boolean>}
|
|
106
|
-
*/
|
|
107
|
-
async descriptorAbsent() {
|
|
108
|
-
await this.get();
|
|
109
|
-
return this.#descriptorAbsent;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Reads and parses the backend descriptor once. On a definitive answer
|
|
113
|
-
* (success, or a `404` / `405` / `501` that means the endpoint is
|
|
114
|
-
* legitimately absent) resolves the feature list, which the memo then
|
|
115
|
-
* caches. On a transient failure it rethrows, which drops the memo so the
|
|
116
|
-
* next call re-probes.
|
|
117
|
-
*
|
|
118
|
-
* @returns {Promise<string[]>}
|
|
119
|
-
*/
|
|
120
|
-
async #probe() {
|
|
121
|
-
try {
|
|
122
|
-
const descriptor = (await this.#readDescriptor());
|
|
123
|
-
return Array.isArray(descriptor?.features)
|
|
124
|
-
? descriptor.features.filter((feature) => typeof feature === 'string')
|
|
125
|
-
: [];
|
|
126
|
-
}
|
|
127
|
-
catch (err) {
|
|
128
|
-
const status = httpStatus(err);
|
|
129
|
-
if (status !== undefined && DESCRIPTOR_ABSENT_STATUSES.has(status)) {
|
|
130
|
-
this.#descriptorAbsent = true;
|
|
131
|
-
return [];
|
|
132
|
-
}
|
|
133
|
-
// Transient/ambiguous: rethrow, which the memo reads as "do not cache
|
|
134
|
-
// this" -- it drops the rejected promise so the next call re-probes.
|
|
135
|
-
throw err;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Builds the {@link BackendFeatures} probe for a collection, reading its
|
|
141
|
-
* backend descriptor with a signed `GET` through the shared request layer --
|
|
142
|
-
* the probe the core handles (Collection/Resource) hold, mirroring the one
|
|
143
|
-
* `WasTransport` builds over its own requester. A descriptor that is not
|
|
144
|
-
* readable with the bound capability surfaces as a 404 (WAS masks unauthorized
|
|
145
|
-
* reads), which the probe treats as "no features advertised" -- so every
|
|
146
|
-
* affordance gate falls closed for a capability that cannot read the
|
|
147
|
-
* descriptor.
|
|
148
|
-
*
|
|
149
|
-
* @param context {ClientContext}
|
|
150
|
-
* @param options {object}
|
|
151
|
-
* @param options.spaceId {string}
|
|
152
|
-
* @param options.collectionId {string}
|
|
153
|
-
* @param [options.capability] {IZcap} capability attached to the probe
|
|
154
|
-
* @returns {BackendFeatures}
|
|
155
|
-
*/
|
|
156
|
-
export function collectionBackendFeatures(context, { spaceId, collectionId, capability }) {
|
|
157
|
-
return new BackendFeatures(async () => {
|
|
158
|
-
const response = await send(context, {
|
|
159
|
-
path: collectionBackend(spaceId, collectionId),
|
|
160
|
-
method: 'GET',
|
|
161
|
-
capability
|
|
162
|
-
});
|
|
163
|
-
// Without the `read` flag `send` never resolves `null` (a 404 throws and
|
|
164
|
-
// the probe maps it to "absent"), so this null-guard is for the type only.
|
|
165
|
-
return response === null ? null : readJsonData(response);
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
//# sourceMappingURL=features.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,cAAc,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA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