@interop/was-client 0.66.0 → 0.67.1
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 +30 -28
- package/dist/Collection.d.ts +30 -41
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +35 -78
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +28 -41
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +29 -65
- 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 +4 -7
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +2 -9
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +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 +22 -72
- 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 +5 -7
- package/dist/edv/descriptorStore.d.ts.map +1 -1
- package/dist/edv/descriptorStore.js +3 -4
- package/dist/edv/descriptorStore.js.map +1 -1
- package/dist/edv/docCipher.d.ts +1 -2
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +1 -2
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.d.ts.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.js +1 -2
- package/dist/edv/logGovernedDescriptorStore.js.map +1 -1
- package/dist/errors.d.ts +8 -7
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +8 -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 +19 -19
- package/dist/internal/cas.d.ts.map +1 -1
- package/dist/internal/cas.js +30 -23
- package/dist/internal/cas.js.map +1 -1
- package/dist/internal/conditional.d.ts +17 -63
- package/dist/internal/conditional.d.ts.map +1 -1
- package/dist/internal/conditional.js +20 -76
- 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 +13 -29
- package/dist/internal/meta.d.ts.map +1 -1
- package/dist/internal/meta.js +22 -41
- 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/request.d.ts +0 -10
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/write.d.ts +12 -36
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +16 -87
- package/dist/internal/write.js.map +1 -1
- package/dist/log/logStore.d.ts +6 -8
- package/dist/log/logStore.d.ts.map +1 -1
- package/dist/log/logStore.js +7 -10
- package/dist/log/logStore.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/dist/sync/port.d.ts +3 -7
- package/dist/sync/port.d.ts.map +1 -1
- package/dist/sync/port.js +4 -20
- package/dist/sync/port.js.map +1 -1
- package/dist/sync/predicates.d.ts +21 -2
- package/dist/sync/predicates.d.ts.map +1 -1
- package/dist/sync/predicates.js +23 -2
- package/dist/sync/predicates.js.map +1 -1
- package/dist/sync/types.d.ts +8 -9
- 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 -111
- package/dist/internal/features.d.ts.map +0 -1
- package/dist/internal/features.js +0 -197
- package/dist/internal/features.js.map +0 -1
package/dist/sync/port.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"port.js","sourceRoot":"","sources":["../../src/sync/port.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"port.js","sourceRoot":"","sources":["../../src/sync/port.ts"],"names":[],"mappings":"AAyCA,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACb,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACf,MAAM,cAAc,CAAA;AAWrB;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAE3B;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AAEpD;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,MAA0B;IAC9C,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAA;AAC3D,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,aAAa,CAAC,MAAgB;IACrC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM;KAC9B,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,MAAgB;IACpC,OAAO,CACL,MAAM,YAAY,oB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GAAG,aAAa,CAC5D,IAAI,CAAC,QAAQ,CACd,CAAA;YACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAA;YAC5B,CAAC;YACD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;YAClC,CAAC;YAED,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* meet: the port's two wire signals (`WasSyncConflictError` /
|
|
7
7
|
* `WasSyncNotFoundError`), its opt-in revoked-access signal
|
|
8
8
|
* (`WasSyncAuthError`), the cipher's two no-key signals (the stale-descriptor
|
|
9
|
-
* `UnknownEpochError` and the not-a-recipient `KeyUnwrapError`),
|
|
10
|
-
*
|
|
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
|
|
@@ -92,4 +97,18 @@ export declare function isKeyUnwrapError(err: unknown): boolean;
|
|
|
92
97
|
* @returns {boolean}
|
|
93
98
|
*/
|
|
94
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;
|
|
95
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
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* meet: the port's two wire signals (`WasSyncConflictError` /
|
|
7
7
|
* `WasSyncNotFoundError`), its opt-in revoked-access signal
|
|
8
8
|
* (`WasSyncAuthError`), the cipher's two no-key signals (the stale-descriptor
|
|
9
|
-
* `UnknownEpochError` and the not-a-recipient `KeyUnwrapError`),
|
|
10
|
-
*
|
|
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
|
|
@@ -114,4 +119,20 @@ export function isKeyUnwrapError(err) {
|
|
|
114
119
|
export function isIntegrityError(err) {
|
|
115
120
|
return nameOf(err) === 'IntegrityError';
|
|
116
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
|
+
}
|
|
117
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
|
@@ -63,8 +63,8 @@ export interface SyncPage extends Omit<ChangesPage, 'documents'> {
|
|
|
63
63
|
* the change feed remains the authority on ordering).
|
|
64
64
|
*
|
|
65
65
|
* `etag` and `metaEtag` are the raw, opaque `ETag` validators the content and
|
|
66
|
-
* `/meta` reads returned (absent
|
|
67
|
-
*
|
|
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`
|
|
68
68
|
* and `metaVersion` are the revision numbers parsed out of them, for
|
|
69
69
|
* comparison or display only.
|
|
70
70
|
*/
|
|
@@ -84,8 +84,8 @@ export interface MasterState {
|
|
|
84
84
|
* opaque `etag` validator it lives behind, exactly as the server sent it.
|
|
85
85
|
* Pass `etag` back verbatim as a later write's `ifMatch` -- it can no longer
|
|
86
86
|
* be synthesized from `version` alone, since the server's `ETag` also embeds a
|
|
87
|
-
* per-record generation marker ahead of the version. `etag` is absent
|
|
88
|
-
*
|
|
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
|
|
89
89
|
* or display a revision number.
|
|
90
90
|
*/
|
|
91
91
|
export interface WriteAck {
|
|
@@ -197,11 +197,10 @@ export interface WasSyncPort {
|
|
|
197
197
|
* - `decrypt` also takes an optional `context`, the signed-request surface a
|
|
198
198
|
* codec reads a multi-resource document through. With it, an EDV cipher
|
|
199
199
|
* reassembles a chunked envelope from its chunk resources. Without it, such
|
|
200
|
-
* an envelope throws `EncryptionError`. A cipher built without a `spaceId
|
|
201
|
-
*
|
|
202
|
-
* `
|
|
203
|
-
*
|
|
204
|
-
* decrypts to a `Blob`, and everything else to `Json`.
|
|
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`.
|
|
205
204
|
*/
|
|
206
205
|
export interface DocCipher {
|
|
207
206
|
encrypt(options: {
|
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,iBAAiB,EACjB,WAAW,EACZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,YAAY,EAAE,IAAI,EAAE,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAA;AAE9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,OAAQ,SAAQ,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,QAAQ,CAAC;IACtE,IAAI,CAAC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AAC,QAAQ,GAAG,SAAS,CAAC,CAAA;IAEjC;;;;;OAKG;IACH,GAAG,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,OAAO,EAAE;QACf,IAAI,EAAE,IAAI,CAAA;KACX,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC3D,aAAa,CAAC,CAAC,OAAO,EAAE;QACtB,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,IAAI,CAAA;QACV,OAAO,EAAE,IAAI,CAAA;KACd,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC3D,OAAO,CAAC,OAAO,EAAE;QACf,EAAE,EAAE,MAAM,CAAA;QACV,QAAQ,EAAE,IAAI,CAAA;QACd,OAAO,CAAC,EAAE,mBAAmB,CAAA;KAC9B,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;CACzB;AAED;;;;;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,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,8BAA8B,EAC9B,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,uBAAuB,CAAA;AAE9B;;;;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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.1",
|
|
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,111 +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
|
-
* The {@link BackendFeatures} probe for a collection, reading its backend
|
|
85
|
-
* descriptor with a signed `GET` through the shared request layer -- the probe
|
|
86
|
-
* 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
|
-
* Probes are shared across every handle on one client that would send the same
|
|
94
|
-
* descriptor request, so a caller that rebuilds handles (`fromCapability` per
|
|
95
|
-
* resource, or `collection(id)` in a loop) pays one `GET .../backend` per
|
|
96
|
-
* collection rather than one per handle. `Collection.resource()` still passes
|
|
97
|
-
* its own probe to its children directly, which needs no lookup at all.
|
|
98
|
-
*
|
|
99
|
-
* @param context {ClientContext}
|
|
100
|
-
* @param options {object}
|
|
101
|
-
* @param options.spaceId {string}
|
|
102
|
-
* @param options.collectionId {string}
|
|
103
|
-
* @param [options.capability] {IZcap} capability attached to the probe
|
|
104
|
-
* @returns {BackendFeatures}
|
|
105
|
-
*/
|
|
106
|
-
export declare function collectionBackendFeatures(context: ClientContext, { spaceId, collectionId, capability }: {
|
|
107
|
-
spaceId: string;
|
|
108
|
-
collectionId: string;
|
|
109
|
-
capability?: IZcap;
|
|
110
|
-
}): BackendFeatures;
|
|
111
|
-
//# 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;AA2BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,CAkBjB"}
|
|
@@ -1,197 +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
|
-
* The cache key for one collection's probe under one capability. A descriptor
|
|
141
|
-
* read is answered per-capability (WAS masks a read the capability cannot make
|
|
142
|
-
* as a 404, which the probe caches as a definitive answer), so two handles may
|
|
143
|
-
* share a probe only when they would send the same request. An unbound handle
|
|
144
|
-
* keys on the empty string, which no capability id can collide with.
|
|
145
|
-
*
|
|
146
|
-
* @param options {object}
|
|
147
|
-
* @param options.spaceId {string}
|
|
148
|
-
* @param options.collectionId {string}
|
|
149
|
-
* @param [options.capability] {IZcap}
|
|
150
|
-
* @returns {string}
|
|
151
|
-
*/
|
|
152
|
-
function probeKey({ spaceId, collectionId, capability }) {
|
|
153
|
-
return `${collectionBackend(spaceId, collectionId)}\n${capability?.id ?? ''}`;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* The {@link BackendFeatures} probe for a collection, reading its backend
|
|
157
|
-
* descriptor with a signed `GET` through the shared request layer -- the probe
|
|
158
|
-
* the core handles (Collection/Resource) hold, mirroring the one
|
|
159
|
-
* `WasTransport` builds over its own requester. A descriptor that is not
|
|
160
|
-
* readable with the bound capability surfaces as a 404 (WAS masks unauthorized
|
|
161
|
-
* reads), which the probe treats as "no features advertised" -- so every
|
|
162
|
-
* affordance gate falls closed for a capability that cannot read the
|
|
163
|
-
* descriptor.
|
|
164
|
-
*
|
|
165
|
-
* Probes are shared across every handle on one client that would send the same
|
|
166
|
-
* descriptor request, so a caller that rebuilds handles (`fromCapability` per
|
|
167
|
-
* resource, or `collection(id)` in a loop) pays one `GET .../backend` per
|
|
168
|
-
* collection rather than one per handle. `Collection.resource()` still passes
|
|
169
|
-
* its own probe to its children directly, which needs no lookup at all.
|
|
170
|
-
*
|
|
171
|
-
* @param context {ClientContext}
|
|
172
|
-
* @param options {object}
|
|
173
|
-
* @param options.spaceId {string}
|
|
174
|
-
* @param options.collectionId {string}
|
|
175
|
-
* @param [options.capability] {IZcap} capability attached to the probe
|
|
176
|
-
* @returns {BackendFeatures}
|
|
177
|
-
*/
|
|
178
|
-
export function collectionBackendFeatures(context, { spaceId, collectionId, capability }) {
|
|
179
|
-
const key = probeKey({ spaceId, collectionId, capability });
|
|
180
|
-
const cached = context.backendFeatures?.get(key);
|
|
181
|
-
if (cached !== undefined) {
|
|
182
|
-
return cached;
|
|
183
|
-
}
|
|
184
|
-
const probe = new BackendFeatures(async () => {
|
|
185
|
-
const response = await send(context, {
|
|
186
|
-
path: collectionBackend(spaceId, collectionId),
|
|
187
|
-
method: 'GET',
|
|
188
|
-
capability
|
|
189
|
-
});
|
|
190
|
-
// Without the `read` flag `send` never resolves `null` (a 404 throws and
|
|
191
|
-
// the probe maps it to "absent"), so this null-guard is for the type only.
|
|
192
|
-
return response === null ? null : readJsonData(response);
|
|
193
|
-
});
|
|
194
|
-
context.backendFeatures?.set(key, probe);
|
|
195
|
-
return probe;
|
|
196
|
-
}
|
|
197
|
-
//# 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;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAG9C;;;;;;;;;GASG;AACH,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AA0B3D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAA4B,EAC5B,mBAA2C,KAAK,IAAI,EAAE,CAAC,KAAK;IAE5D,OAAO;QACL,GAAG;QACH,KAAK,CAAC,GAAG,CAAC,OAAe;YACvB,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACxC,CAAC;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