@interop/was-client 0.35.0 → 0.36.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 +22 -5
- package/dist/Collection.d.ts +5 -0
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +37 -4
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +4 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +31 -20
- package/dist/Resource.js.map +1 -1
- package/dist/codec.d.ts +91 -4
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +10 -1
- package/dist/codec.js.map +1 -1
- package/dist/edv/EdvCodec.d.ts +33 -9
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +471 -52
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +39 -2
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +82 -26
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/docCipher.d.ts +59 -7
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +63 -13
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/index.d.ts +1 -1
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/errors.d.ts +31 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +35 -14
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/features.d.ts +44 -1
- package/dist/internal/features.d.ts.map +1 -1
- package/dist/internal/features.js +39 -0
- package/dist/internal/features.js.map +1 -1
- package/dist/internal/write.d.ts +65 -12
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +71 -9
- package/dist/internal/write.js.map +1 -1
- package/dist/sync/index.d.ts +9 -5
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +9 -5
- package/dist/sync/index.js.map +1 -1
- package/package.json +1 -1
package/dist/edv/docCipher.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { isChunkedWrite } from '../codec.js';
|
|
1
2
|
import { storedResponse } from '../internal/content.js';
|
|
2
|
-
import {
|
|
3
|
+
import { EMPTY_INDEX_SCHEMA, readIndexSchema } from '../internal/indexSchema.js';
|
|
4
|
+
import { KeyUnwrapError, ValidationError } from '../errors.js';
|
|
3
5
|
import { createEdvEncryption } from './EdvCodec.js';
|
|
4
6
|
// `isEncryptedEnvelope` and the `DocCipher` interface live in the crypto-free
|
|
5
|
-
// `../sync` module, and `UnknownEpochError`
|
|
6
|
-
//
|
|
7
|
-
//
|
|
7
|
+
// `../sync` module, and the decrypt-routing signals (`UnknownEpochError` for a
|
|
8
|
+
// stale descriptor, `KeyUnwrapError` for a reader that is not a recipient of
|
|
9
|
+
// the envelope's epoch) in the errors module; re-exported here so an
|
|
10
|
+
// encrypted-collection consumer that imports this subpath gets them without a
|
|
11
|
+
// second import.
|
|
8
12
|
export { isEncryptedEnvelope } from '../sync/envelope.js';
|
|
9
|
-
export { UnknownEpochError } from '../errors.js';
|
|
13
|
+
export { KeyUnwrapError, UnknownEpochError } from '../errors.js';
|
|
10
14
|
/**
|
|
11
15
|
* A wallet's own key-agreement key as a `RecipientPublicKey` -- the "recipient
|
|
12
16
|
* zero" entry a caller passes to `initRecipients` when it first makes a
|
|
@@ -57,8 +61,9 @@ function envelopeResponse(envelope) {
|
|
|
57
61
|
* the descriptor's `currentEpoch` and decrypts any epoch this reader still
|
|
58
62
|
* holds a key for. One codec owns both axes -- decrypt routing (matching an
|
|
59
63
|
* envelope's JWE recipient `kid`s against the reader's candidate keys, raising
|
|
60
|
-
* `UnknownEpochError` for an envelope
|
|
61
|
-
*
|
|
64
|
+
* `UnknownEpochError` for an envelope stamped with an epoch the descriptor
|
|
65
|
+
* does not list, and `KeyUnwrapError` for one whose listed epoch this reader
|
|
66
|
+
* is not a recipient of) lives in the codec, not here.
|
|
62
67
|
*
|
|
63
68
|
* The reader must be a recipient of every epoch on the descriptor (the owner is
|
|
64
69
|
* "recipient zero"). If it is a recipient of none, building the cipher
|
|
@@ -68,14 +73,26 @@ function envelopeResponse(envelope) {
|
|
|
68
73
|
* @param options {object}
|
|
69
74
|
* @param options.keyAgreementKey {IKeyAgreementKey}
|
|
70
75
|
* @param options.keyResolver {IKeyResolver}
|
|
71
|
-
* @param options.collectionId {string}
|
|
76
|
+
* @param options.collectionId {string} the collection's WAS id. It must be
|
|
77
|
+
* the real id, not a label: the collection's metadata envelope is
|
|
78
|
+
* AEAD-bound to it (`was.collection`), so `applyMeta` refuses an envelope
|
|
79
|
+
* bound elsewhere.
|
|
72
80
|
* @param [options.idDerivation] {'content' | 'random'} defaults to `'content'`
|
|
73
81
|
* @param options.encryption {CollectionEncryption} the collection's
|
|
74
82
|
* encryption descriptor; must carry the key-epoch roster (every encrypted
|
|
75
83
|
* collection has one from birth)
|
|
76
|
-
* @
|
|
84
|
+
* @param [options.meta] {object} the collection's stored `/meta` value as the
|
|
85
|
+
* replica holds it; on an encrypted collection its `custom` is the opaque
|
|
86
|
+
* encrypted metadata envelope, decrypted here with the collection keys. When
|
|
87
|
+
* supplied and the descriptor declares a blinded-index `hmac` key, the
|
|
88
|
+
* persisted index schema is installed so writes emit blinded `indexed`
|
|
89
|
+
* entries matching direct-path writes. Without it (or without an `hmac`)
|
|
90
|
+
* writes emit no `indexed` entries, and are invisible to `collection.find()`
|
|
91
|
+
* until rewritten -- an offline replica that holds no metadata works exactly
|
|
92
|
+
* as before.
|
|
93
|
+
* @returns {Promise<EdvDocCipher>}
|
|
77
94
|
*/
|
|
78
|
-
export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collectionId, idDerivation = 'content', encryption }) {
|
|
95
|
+
export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collectionId, idDerivation = 'content', encryption, meta }) {
|
|
79
96
|
const provider = createEdvEncryption({
|
|
80
97
|
resolveKeys: async () => null,
|
|
81
98
|
idDerivation
|
|
@@ -110,7 +127,20 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
|
|
|
110
127
|
const codec = resolved;
|
|
111
128
|
// Parses the codec's `EncodedWrite` (id + envelope body bytes) to the stored
|
|
112
129
|
// `{ id, envelope, epoch? }` shape. Shared by the create and update paths.
|
|
113
|
-
const readEncoded = (
|
|
130
|
+
const readEncoded = (write) => {
|
|
131
|
+
// A payload over the codec's single-document threshold answers with a
|
|
132
|
+
// multi-request plan (a document plus chunk resources on a live server),
|
|
133
|
+
// which has no one envelope to hand a replica. This seam is
|
|
134
|
+
// envelope-in/envelope-out, so it refuses the payload instead.
|
|
135
|
+
if (isChunkedWrite(write)) {
|
|
136
|
+
throw new ValidationError(`Cannot encrypt this value for collection "${collectionId}": the ` +
|
|
137
|
+
'binary payload exceeds the single-document threshold, so it can ' +
|
|
138
|
+
'only be stored as a document plus chunk resources -- a ' +
|
|
139
|
+
'multi-request server write with no single envelope, which this ' +
|
|
140
|
+
'local-replica cipher does not support. Store a large blob through ' +
|
|
141
|
+
'a Collection handle, or split it before encrypting.');
|
|
142
|
+
}
|
|
143
|
+
const encoded = write;
|
|
114
144
|
if (typeof encoded.id !== 'string' ||
|
|
115
145
|
!(encoded.body instanceof Uint8Array)) {
|
|
116
146
|
throw new Error(`EDV encrypt for collection "${collectionId}" returned no id/envelope body.`);
|
|
@@ -126,7 +156,26 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
|
|
|
126
156
|
...(typeof encoded.epoch === 'string' && { epoch: encoded.epoch })
|
|
127
157
|
};
|
|
128
158
|
};
|
|
159
|
+
// Decodes the collection's stored metadata and installs the index schema it
|
|
160
|
+
// carries. A codec with no search capability (no blinding key on the
|
|
161
|
+
// descriptor) has nothing to install, so it never decrypts anything. A
|
|
162
|
+
// decode failure -- garbage, an envelope bound to another collection, an
|
|
163
|
+
// epoch this reader cannot unwrap -- propagates: a caller-supplied metadata
|
|
164
|
+
// value that cannot be read is a wiring bug, and must be loud.
|
|
165
|
+
const applyMeta = async (stored) => {
|
|
166
|
+
const { indexing } = codec;
|
|
167
|
+
if (!indexing) {
|
|
168
|
+
return EMPTY_INDEX_SCHEMA;
|
|
169
|
+
}
|
|
170
|
+
const schema = readIndexSchema(await codec.decodeMeta(stored));
|
|
171
|
+
indexing.applySchema(schema);
|
|
172
|
+
return schema;
|
|
173
|
+
};
|
|
174
|
+
if (meta !== undefined) {
|
|
175
|
+
await applyMeta(meta);
|
|
176
|
+
}
|
|
129
177
|
return {
|
|
178
|
+
applyMeta,
|
|
130
179
|
async encrypt({ data }) {
|
|
131
180
|
// `encode` with no caller id is the add() path: encrypt, then either
|
|
132
181
|
// derive and stamp the content-hash id (`'content'`) or use the minted
|
|
@@ -149,8 +198,9 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
|
|
|
149
198
|
},
|
|
150
199
|
async decrypt({ envelope }) {
|
|
151
200
|
// Routing by the envelope's JWE recipient kids -- including the
|
|
152
|
-
// stale-descriptor `UnknownEpochError`
|
|
153
|
-
//
|
|
201
|
+
// stale-descriptor `UnknownEpochError` (epoch not on the descriptor)
|
|
202
|
+
// and the membership `KeyUnwrapError` (listed epoch this reader is not
|
|
203
|
+
// a recipient of) -- is owned by the codec's decrypt.
|
|
154
204
|
return (await codec.decode(envelopeResponse(envelope)));
|
|
155
205
|
}
|
|
156
206
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docCipher.js","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"docCipher.js","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM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CAAC,CAAA;QAC7B,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,EAClB,EAAE,EACF,IAAI,EACJ,OAAO,EAKR;YACC,wEAAwE;YACxE,0EAA0E;YAC1E,qBAAqB;YACrB,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;gBACjC,EAAE;gBACF,IAAI,EAAE,IAA6B;gBACnC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;aACnC,CAAC,CAAA;YACF,OAAO,WAAW,CAAC,OAAO,CAAC,CAAA;QAC7B,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAsB;YAC5C,gEAAgE;YAChE,qEAAqE;YACrE,uEAAuE;YACvE,sDAAsD;YACtD,OAAO,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAS,CAAA;QACjE,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/edv/index.d.ts
CHANGED
|
@@ -53,5 +53,5 @@ export type { ResolvedEpochKeys } from './epochKeys.js';
|
|
|
53
53
|
export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
|
|
54
54
|
export type { BlindingKey } from './hmacKey.js';
|
|
55
55
|
export { createEdvDocCipher, ownerRecipient, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
|
|
56
|
-
export type { DocCipher } from './docCipher.js';
|
|
56
|
+
export type { DocCipher, EdvDocCipher } from './docCipher.js';
|
|
57
57
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/edv/index.d.ts.map
CHANGED
|
@@ -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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AC5C,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;AACxB,YAAY,EAAE,kBAAkB,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,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/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
|
|
@@ -113,11 +124,15 @@ export declare class EncryptionError extends WasError {
|
|
|
113
124
|
name: string;
|
|
114
125
|
}
|
|
115
126
|
/**
|
|
116
|
-
* A fail-closed key-epoch error: a reader
|
|
117
|
-
*
|
|
118
|
-
* of the descriptor's `recipients` entries
|
|
119
|
-
* key-agreement key (it
|
|
120
|
-
*
|
|
127
|
+
* A fail-closed key-epoch error: a reader holds no key for an epoch it needs
|
|
128
|
+
* on a multi-recipient encrypted Collection. Raised on two paths. Building a
|
|
129
|
+
* codec raises it when none of the descriptor's `recipients` entries yield a
|
|
130
|
+
* key for this reader's key-agreement key (it is a recipient of no epoch at
|
|
131
|
+
* all). Decrypt routing raises it when a stored envelope's epoch IS on the
|
|
132
|
+
* descriptor but wraps to no key this reader holds (it was never a recipient
|
|
133
|
+
* of that epoch, or has been removed and the epoch rotated) -- the descriptor
|
|
134
|
+
* is current, so re-reading it cannot help; contrast {@link UnknownEpochError},
|
|
135
|
+
* where it can. A subtype of {@link EncryptionError}, so existing
|
|
121
136
|
* `catch (EncryptionError)` fail-closed handling still catches it.
|
|
122
137
|
*
|
|
123
138
|
* This is the **read** axis only. It says nothing about **pull**: the reader may
|
|
@@ -191,11 +206,17 @@ export declare class WasServerError extends WasError {
|
|
|
191
206
|
}
|
|
192
207
|
/**
|
|
193
208
|
* Thrown on decrypt when a stored envelope names JWE recipient (`kid`) ids
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
209
|
+
* whose epochs the Collection Description does not list at all. It signals
|
|
210
|
+
* that the caller's cached descriptor may be stale and should be re-read
|
|
211
|
+
* before retrying: an epoch rotation emits no change-feed entry, so a codec
|
|
212
|
+
* built from a pre-rotation descriptor meets envelopes stamped with a newer
|
|
213
|
+
* epoch it has never seen.
|
|
214
|
+
*
|
|
215
|
+
* Distinct from {@link KeyUnwrapError}: when the descriptor DOES list the
|
|
216
|
+
* envelope's epoch but this reader holds no key for it (it was never a
|
|
217
|
+
* recipient of that epoch, or it was removed and the epoch rotated), decrypt
|
|
218
|
+
* raises `KeyUnwrapError` instead -- the descriptor is current and re-reading
|
|
219
|
+
* it cannot help.
|
|
199
220
|
*/
|
|
200
221
|
export declare class UnknownEpochError extends Error {
|
|
201
222
|
constructor({ collectionId, kids }: {
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -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;CACh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Q,aAAa;gBAEnD,OAAO,SAA4B,EACnC,OAAO,GAAE,eAAoB;CAKhC;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB;gBACzC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAO1D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IACjC,IAAI,SAAmB;CACjC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,EACV,YAAY,EACZ,IAAI,EACL,EAAE;QACD,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,EAAE,CAAA;KACf;CAUF;AA4DD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAG3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED;;;;;;;;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
|
|
@@ -116,11 +127,15 @@ export class EncryptionError extends WasError {
|
|
|
116
127
|
name = 'EncryptionError';
|
|
117
128
|
}
|
|
118
129
|
/**
|
|
119
|
-
* A fail-closed key-epoch error: a reader
|
|
120
|
-
*
|
|
121
|
-
* of the descriptor's `recipients` entries
|
|
122
|
-
* key-agreement key (it
|
|
123
|
-
*
|
|
130
|
+
* A fail-closed key-epoch error: a reader holds no key for an epoch it needs
|
|
131
|
+
* on a multi-recipient encrypted Collection. Raised on two paths. Building a
|
|
132
|
+
* codec raises it when none of the descriptor's `recipients` entries yield a
|
|
133
|
+
* key for this reader's key-agreement key (it is a recipient of no epoch at
|
|
134
|
+
* all). Decrypt routing raises it when a stored envelope's epoch IS on the
|
|
135
|
+
* descriptor but wraps to no key this reader holds (it was never a recipient
|
|
136
|
+
* of that epoch, or has been removed and the epoch rotated) -- the descriptor
|
|
137
|
+
* is current, so re-reading it cannot help; contrast {@link UnknownEpochError},
|
|
138
|
+
* where it can. A subtype of {@link EncryptionError}, so existing
|
|
124
139
|
* `catch (EncryptionError)` fail-closed handling still catches it.
|
|
125
140
|
*
|
|
126
141
|
* This is the **read** axis only. It says nothing about **pull**: the reader may
|
|
@@ -206,19 +221,25 @@ export class WasServerError extends WasError {
|
|
|
206
221
|
}
|
|
207
222
|
/**
|
|
208
223
|
* Thrown on decrypt when a stored envelope names JWE recipient (`kid`) ids
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
224
|
+
* whose epochs the Collection Description does not list at all. It signals
|
|
225
|
+
* that the caller's cached descriptor may be stale and should be re-read
|
|
226
|
+
* before retrying: an epoch rotation emits no change-feed entry, so a codec
|
|
227
|
+
* built from a pre-rotation descriptor meets envelopes stamped with a newer
|
|
228
|
+
* epoch it has never seen.
|
|
229
|
+
*
|
|
230
|
+
* Distinct from {@link KeyUnwrapError}: when the descriptor DOES list the
|
|
231
|
+
* envelope's epoch but this reader holds no key for it (it was never a
|
|
232
|
+
* recipient of that epoch, or it was removed and the epoch rotated), decrypt
|
|
233
|
+
* raises `KeyUnwrapError` instead -- the descriptor is current and re-reading
|
|
234
|
+
* it cannot help.
|
|
214
235
|
*/
|
|
215
236
|
export class UnknownEpochError extends Error {
|
|
216
237
|
constructor({ collectionId, kids }) {
|
|
217
238
|
super(`Cannot decrypt a resource in collection "${collectionId}": its ` +
|
|
218
|
-
`envelope names recipient key id(s) [${kids.join(', ')}]
|
|
219
|
-
'
|
|
220
|
-
'
|
|
221
|
-
'entry); re-read it and rebuild the cipher.');
|
|
239
|
+
`envelope names recipient key id(s) [${kids.join(', ')}] whose key ` +
|
|
240
|
+
'epoch is not on the Collection Description this reader holds. The ' +
|
|
241
|
+
'cached descriptor may be stale (an epoch rotation emits no ' +
|
|
242
|
+
'change-feed entry); re-read it and rebuild the cipher.');
|
|
222
243
|
this.name = 'UnknownEpochError';
|
|
223
244
|
}
|
|
224
245
|
}
|
package/dist/errors.js.map
CHANGED
|
@@ -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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GED
|
@@ -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 {
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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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CAAA;AAEpB,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,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"}
|
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,
|
|
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"],"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