@interop/was-client 0.66.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 +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 +7 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -6
- 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
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Helpers for conditional writes (
|
|
5
|
+
* Helpers for conditional writes (a baseline WAS server requirement):
|
|
6
6
|
* assembling a write's request headers from an optional content-type plus the
|
|
7
7
|
* `If-Match` / `If-None-Match: *` preconditions, reading the `ETag` a write
|
|
8
8
|
* response returns, checking a caller's precondition against the document a
|
|
9
|
-
* conditional codec's write path pre-read, and refusing a
|
|
10
|
-
*
|
|
9
|
+
* conditional codec's write path pre-read, and refusing a write whose pin the
|
|
10
|
+
* read it is based on never supplied.
|
|
11
11
|
*/
|
|
12
12
|
import type { EncodedWrite, ResponseLike } from '../codec.js';
|
|
13
13
|
import { NotSupportedError } from '../errors.js';
|
|
14
|
-
import type { FeatureProbe } from './features.js';
|
|
15
14
|
/**
|
|
16
15
|
* The request header the server reads a content write's key-epoch id from,
|
|
17
16
|
* stamping it onto the Resource's metadata (an absent header clears any prior
|
|
@@ -85,73 +84,28 @@ export declare function writeHeaders({ contentType, precondition, epoch }: {
|
|
|
85
84
|
epoch?: string;
|
|
86
85
|
}): Record<string, string> | undefined;
|
|
87
86
|
/**
|
|
88
|
-
* The refusal for a guarded write whose
|
|
89
|
-
*
|
|
90
|
-
*
|
|
87
|
+
* The refusal for a guarded write whose pin the read it is based on never
|
|
88
|
+
* supplied: the read returned no `ETag` validator, so the write would go out
|
|
89
|
+
* with no `If-Match` at all. Every such gate builds its error here, so the
|
|
90
|
+
* messages do not drift apart.
|
|
91
91
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* `conditional-writes`. Such a backend may serve an `ETag` on reads and still
|
|
96
|
-
* ignore `If-Match` / `If-None-Match` on writes.
|
|
92
|
+
* A WAS server versions every resource, so a missing validator is a transport
|
|
93
|
+
* or deployment problem, not a server declining to version. Most often it is a
|
|
94
|
+
* browser client whose CORS configuration does not expose `ETag` to script.
|
|
97
95
|
*
|
|
98
96
|
* @param options {object}
|
|
99
97
|
* @param options.operation {string} what was refused, as the message's
|
|
100
98
|
* opening clause (e.g. `Cannot append to the resource log`)
|
|
101
|
-
* @param options.reason {'no-validator' | 'no-feature'}
|
|
102
99
|
* @returns {NotSupportedError}
|
|
103
100
|
*/
|
|
104
|
-
export declare function unenforcedPreconditionError({ operation
|
|
101
|
+
export declare function unenforcedPreconditionError({ operation }: {
|
|
105
102
|
operation: string;
|
|
106
|
-
reason: 'no-validator' | 'no-feature';
|
|
107
103
|
}): NotSupportedError;
|
|
108
|
-
/**
|
|
109
|
-
* Refuses a write that names a precondition the backend cannot be shown to
|
|
110
|
-
* enforce, throwing {@link unenforcedPreconditionError}. A write that names
|
|
111
|
-
* none (see {@link namedPrecondition}) never probes the backend.
|
|
112
|
-
*
|
|
113
|
-
* A descriptor that could not be read at all is not evidence either way, and
|
|
114
|
-
* the write proceeds. The probe reads a collection-level path
|
|
115
|
-
* (`GET .../backend`), so a capability whose `invocationTarget` sits below the
|
|
116
|
-
* Collection -- one delegated for a single Resource -- can never read it, and
|
|
117
|
-
* WAS masks that as a 404. Refusing there would lock every such capability out
|
|
118
|
-
* of conditional writes for the handle's lifetime, and would do the same to a
|
|
119
|
-
* handle whose collection was briefly absent, since the probe caches a
|
|
120
|
-
* definitive answer. The server still answers the write on its own terms: a
|
|
121
|
-
* 412 where the precondition fails, a 404 where the collection is gone.
|
|
122
|
-
*
|
|
123
|
-
* A transient probe failure (a network error, a `401`, a `5xx`) propagates as
|
|
124
|
-
* the probe's own error, so a retrying caller still sees it as transient.
|
|
125
|
-
*
|
|
126
|
-
* @param options {object}
|
|
127
|
-
* @param options.features {FeatureProbe} the handle's backend-feature probe
|
|
128
|
-
* @param [options.precondition] {WritePrecondition} the write's precondition
|
|
129
|
-
* @param options.operation {string} what would be refused, as the message's
|
|
130
|
-
* opening clause
|
|
131
|
-
* @returns {Promise<void>}
|
|
132
|
-
*/
|
|
133
|
-
export declare function assertPreconditionEnforced({ features, precondition, operation }: {
|
|
134
|
-
features: FeatureProbe;
|
|
135
|
-
precondition?: WritePrecondition;
|
|
136
|
-
operation: string;
|
|
137
|
-
}): Promise<void>;
|
|
138
|
-
/**
|
|
139
|
-
* Whether a precondition sent to this backend can be relied on: it advertises
|
|
140
|
-
* `conditional-writes`, or its descriptor could not be read at all and is
|
|
141
|
-
* therefore no evidence against it (see {@link assertPreconditionEnforced}).
|
|
142
|
-
*
|
|
143
|
-
* The predicate behind the refusal, for the one caller that degrades instead
|
|
144
|
-
* of refusing: `patchCustom`'s compare-and-swap, whose pin is its own and
|
|
145
|
-
* whose documented fallback is a last-write-wins update.
|
|
146
|
-
*
|
|
147
|
-
* @param features {FeatureProbe}
|
|
148
|
-
* @returns {Promise<boolean>}
|
|
149
|
-
*/
|
|
150
|
-
export declare function preconditionsEnforced(features: FeatureProbe): Promise<boolean>;
|
|
151
104
|
/**
|
|
152
105
|
* Reads the strong `ETag` validator a write/read response returned, or
|
|
153
|
-
* `undefined` when
|
|
154
|
-
*
|
|
106
|
+
* `undefined` when none reached the client (a WAS server serves one on every
|
|
107
|
+
* resource; a browser client can still be denied it by a CORS configuration
|
|
108
|
+
* that does not expose the header).
|
|
155
109
|
*
|
|
156
110
|
* @param response {ResponseLike | null}
|
|
157
111
|
* @returns {string | undefined}
|
|
@@ -172,9 +126,9 @@ export declare function readEtag(response: ResponseLike | null): string | undefi
|
|
|
172
126
|
*
|
|
173
127
|
* The thrown error is the same `PreconditionFailedError` (412) the server
|
|
174
128
|
* would answer with, so a compare-and-swap retry loop needs no special case
|
|
175
|
-
* for an encrypted collection. A
|
|
176
|
-
*
|
|
177
|
-
*
|
|
129
|
+
* for an encrypted collection. A pre-read that carried no `ETag` leaves
|
|
130
|
+
* nothing to compare against locally, and the caller's `ifMatch` is left to
|
|
131
|
+
* the server.
|
|
178
132
|
*
|
|
179
133
|
* @param options {object}
|
|
180
134
|
* @param options.path {string} the resource path written
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional.d.ts","sourceRoot":"","sources":["../../src/internal/conditional.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EACL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"conditional.d.ts","sourceRoot":"","sources":["../../src/internal/conditional.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EACL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;AAErB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,iBAAiB,CAE5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,CAAC,EAAE,iBAAiB,GAC/B,iBAAiB,GAAG,SAAS,CAK/B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,CAAC,EAAE,iBAAiB,GAC/B,IAAI,CAQN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,WAAW,EACX,YAAiB,EACjB,KAAK,EACN,EAAE;IACD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAiBrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,SAAS,EACV,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,iBAAiB,CASpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAE1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gCAAgC,CAAC,EAC/C,IAAI,EACJ,OAAO,EACP,YAAY,EACb,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC,GAAG,IAAI,CAkCP"}
|
|
@@ -88,89 +88,33 @@ export function writeHeaders({ contentType, precondition = {}, epoch }) {
|
|
|
88
88
|
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
|
-
* The refusal for a guarded write whose
|
|
92
|
-
*
|
|
93
|
-
*
|
|
91
|
+
* The refusal for a guarded write whose pin the read it is based on never
|
|
92
|
+
* supplied: the read returned no `ETag` validator, so the write would go out
|
|
93
|
+
* with no `If-Match` at all. Every such gate builds its error here, so the
|
|
94
|
+
* messages do not drift apart.
|
|
94
95
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* `conditional-writes`. Such a backend may serve an `ETag` on reads and still
|
|
99
|
-
* ignore `If-Match` / `If-None-Match` on writes.
|
|
96
|
+
* A WAS server versions every resource, so a missing validator is a transport
|
|
97
|
+
* or deployment problem, not a server declining to version. Most often it is a
|
|
98
|
+
* browser client whose CORS configuration does not expose `ETag` to script.
|
|
100
99
|
*
|
|
101
100
|
* @param options {object}
|
|
102
101
|
* @param options.operation {string} what was refused, as the message's
|
|
103
102
|
* opening clause (e.g. `Cannot append to the resource log`)
|
|
104
|
-
* @param options.reason {'no-validator' | 'no-feature'}
|
|
105
103
|
* @returns {NotSupportedError}
|
|
106
104
|
*/
|
|
107
|
-
export function unenforcedPreconditionError({ operation
|
|
108
|
-
|
|
109
|
-
'
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
return new NotSupportedError(`${operation}: the write carries a precondition, but the collection's ` +
|
|
116
|
-
"backend does not advertise the 'conditional-writes' feature and may " +
|
|
117
|
-
`ignore it, ${consequence} Use a backend that advertises conditional ` +
|
|
118
|
-
'writes.');
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Refuses a write that names a precondition the backend cannot be shown to
|
|
122
|
-
* enforce, throwing {@link unenforcedPreconditionError}. A write that names
|
|
123
|
-
* none (see {@link namedPrecondition}) never probes the backend.
|
|
124
|
-
*
|
|
125
|
-
* A descriptor that could not be read at all is not evidence either way, and
|
|
126
|
-
* the write proceeds. The probe reads a collection-level path
|
|
127
|
-
* (`GET .../backend`), so a capability whose `invocationTarget` sits below the
|
|
128
|
-
* Collection -- one delegated for a single Resource -- can never read it, and
|
|
129
|
-
* WAS masks that as a 404. Refusing there would lock every such capability out
|
|
130
|
-
* of conditional writes for the handle's lifetime, and would do the same to a
|
|
131
|
-
* handle whose collection was briefly absent, since the probe caches a
|
|
132
|
-
* definitive answer. The server still answers the write on its own terms: a
|
|
133
|
-
* 412 where the precondition fails, a 404 where the collection is gone.
|
|
134
|
-
*
|
|
135
|
-
* A transient probe failure (a network error, a `401`, a `5xx`) propagates as
|
|
136
|
-
* the probe's own error, so a retrying caller still sees it as transient.
|
|
137
|
-
*
|
|
138
|
-
* @param options {object}
|
|
139
|
-
* @param options.features {FeatureProbe} the handle's backend-feature probe
|
|
140
|
-
* @param [options.precondition] {WritePrecondition} the write's precondition
|
|
141
|
-
* @param options.operation {string} what would be refused, as the message's
|
|
142
|
-
* opening clause
|
|
143
|
-
* @returns {Promise<void>}
|
|
144
|
-
*/
|
|
145
|
-
export async function assertPreconditionEnforced({ features, precondition, operation }) {
|
|
146
|
-
if (namedPrecondition(precondition) === undefined) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
if (await preconditionsEnforced(features)) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
throw unenforcedPreconditionError({ operation, reason: 'no-feature' });
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Whether a precondition sent to this backend can be relied on: it advertises
|
|
156
|
-
* `conditional-writes`, or its descriptor could not be read at all and is
|
|
157
|
-
* therefore no evidence against it (see {@link assertPreconditionEnforced}).
|
|
158
|
-
*
|
|
159
|
-
* The predicate behind the refusal, for the one caller that degrades instead
|
|
160
|
-
* of refusing: `patchCustom`'s compare-and-swap, whose pin is its own and
|
|
161
|
-
* whose documented fallback is a last-write-wins update.
|
|
162
|
-
*
|
|
163
|
-
* @param features {FeatureProbe}
|
|
164
|
-
* @returns {Promise<boolean>}
|
|
165
|
-
*/
|
|
166
|
-
export async function preconditionsEnforced(features) {
|
|
167
|
-
return ((await features.has('conditional-writes')) ||
|
|
168
|
-
(await features.descriptorAbsent()));
|
|
105
|
+
export function unenforcedPreconditionError({ operation }) {
|
|
106
|
+
return new NotSupportedError(`${operation}: the read it is pinned to returned no ETag validator, so ` +
|
|
107
|
+
'the write would go out unconditionally, and a concurrent change could ' +
|
|
108
|
+
'be silently overwritten instead of failing with a 412. A WAS server ' +
|
|
109
|
+
'serves an ETag on every resource read; check that the response is not ' +
|
|
110
|
+
'losing the header on the way (a browser client needs `ETag` in the ' +
|
|
111
|
+
"server's `Access-Control-Expose-Headers`).");
|
|
169
112
|
}
|
|
170
113
|
/**
|
|
171
114
|
* Reads the strong `ETag` validator a write/read response returned, or
|
|
172
|
-
* `undefined` when
|
|
173
|
-
*
|
|
115
|
+
* `undefined` when none reached the client (a WAS server serves one on every
|
|
116
|
+
* resource; a browser client can still be denied it by a CORS configuration
|
|
117
|
+
* that does not expose the header).
|
|
174
118
|
*
|
|
175
119
|
* @param response {ResponseLike | null}
|
|
176
120
|
* @returns {string | undefined}
|
|
@@ -193,9 +137,9 @@ export function readEtag(response) {
|
|
|
193
137
|
*
|
|
194
138
|
* The thrown error is the same `PreconditionFailedError` (412) the server
|
|
195
139
|
* would answer with, so a compare-and-swap retry loop needs no special case
|
|
196
|
-
* for an encrypted collection. A
|
|
197
|
-
*
|
|
198
|
-
*
|
|
140
|
+
* for an encrypted collection. A pre-read that carried no `ETag` leaves
|
|
141
|
+
* nothing to compare against locally, and the caller's `ifMatch` is left to
|
|
142
|
+
* the server.
|
|
199
143
|
*
|
|
200
144
|
* @param options {object}
|
|
201
145
|
* @param options.path {string} the resource path written
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../src/internal/conditional.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EAChB,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../src/internal/conditional.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EAChB,MAAM,cAAc,CAAA;AAErB;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAA;AAa3C;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAqB;IACvD,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAA;AACvE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,YAAgC;IAEhC,OAAO,YAAY,KAAK,SAAS;QAC/B,CAAC,YAAY,CAAC,OAAO,KAAK,SAAS,IAAI,YAAY,CAAC,WAAW,CAAC;QAChE,CAA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
package/dist/internal/memo.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* The shared "memoize an in-flight promise, but only cache a success" helper.
|
|
6
|
-
* Several lazily-resolved singletons across the client -- a handle's codec,
|
|
7
|
-
*
|
|
6
|
+
* Several lazily-resolved singletons across the client -- a handle's codec,
|
|
7
|
+
* the service description, a lazily-unwrapped epoch key -- want the same three
|
|
8
8
|
* properties: concurrent callers share one round-trip, a rejection is not
|
|
9
9
|
* cached (so the next call retries rather than replaying a stale failure), and
|
|
10
10
|
* a reset drops whatever is held. Written once here so the three cannot drift
|
package/dist/internal/memo.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* The shared "memoize an in-flight promise, but only cache a success" helper.
|
|
6
|
-
* Several lazily-resolved singletons across the client -- a handle's codec,
|
|
7
|
-
*
|
|
6
|
+
* Several lazily-resolved singletons across the client -- a handle's codec,
|
|
7
|
+
* the service description, a lazily-unwrapped epoch key -- want the same three
|
|
8
8
|
* properties: concurrent callers share one round-trip, a rejection is not
|
|
9
9
|
* cached (so the next call retries rather than replaying a stale failure), and
|
|
10
10
|
* a reset drops whatever is held. Written once here so the three cannot drift
|
package/dist/internal/meta.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MetaReadSlot, MetaWriteSlot, ResourceCodec } from '../codec.js';
|
|
2
2
|
import type { ClientContext } from './request.js';
|
|
3
|
-
import type { FeatureProbe } from './features.js';
|
|
4
3
|
import type { IZcap, ResourceMetadataCustom, ResourceMetadataCustomInput } from '../types.js';
|
|
5
4
|
/**
|
|
6
5
|
* Reads a metadata document and decodes its user-writable `custom` value.
|
|
@@ -53,22 +52,16 @@ export declare function readMeta<Metadata extends {
|
|
|
53
52
|
* properties, as a full replacement
|
|
54
53
|
* @param options.slot {MetaWriteSlot} the `meta` slot being written, which
|
|
55
54
|
* an encrypting codec binds into the envelope
|
|
56
|
-
* @param options.features {FeatureProbe} the handle's backend-feature probe.
|
|
57
|
-
* A Resource's metadata validator is a Resource-level validator, so a named
|
|
58
|
-
* precondition is refused when the backend advertises no `conditional-writes`
|
|
59
|
-
* (unlike the Collection Metadata object's `metaVersion`, which a server
|
|
60
|
-
* maintains regardless and `Collection.setMeta` therefore does not gate)
|
|
61
55
|
* @param [options.ifMatch] {string} update only if the `meta` ETag matches
|
|
62
56
|
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
63
57
|
* @param [options.capability] {IZcap}
|
|
64
58
|
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
65
59
|
*/
|
|
66
|
-
export declare function writeMeta(context: ClientContext, { metaPath, codec: codecPromise, custom, slot,
|
|
60
|
+
export declare function writeMeta(context: ClientContext, { metaPath, codec: codecPromise, custom, slot, ifMatch, ifNoneMatch, capability }: {
|
|
67
61
|
metaPath: string;
|
|
68
62
|
codec: Promise<ResourceCodec>;
|
|
69
63
|
custom: ResourceMetadataCustomInput;
|
|
70
64
|
slot: MetaWriteSlot;
|
|
71
|
-
features: FeatureProbe;
|
|
72
65
|
ifMatch?: string;
|
|
73
66
|
ifNoneMatch?: boolean;
|
|
74
67
|
capability?: IZcap;
|
|
@@ -78,35 +71,26 @@ export declare function writeMeta(context: ClientContext, { metaPath, codec: cod
|
|
|
78
71
|
/**
|
|
79
72
|
* The shared read-then-CAS body of the handles' `setName` / `setTags`: reads
|
|
80
73
|
* the current metadata, merges `patch` over its `custom`, and writes it back
|
|
81
|
-
* pinned to the read's `etag
|
|
82
|
-
*
|
|
83
|
-
* the full-replacement write.
|
|
74
|
+
* pinned to the read's `etag`, so a concurrent metadata write is rebased on
|
|
75
|
+
* rather than silently erased by the full-replacement write.
|
|
84
76
|
*
|
|
85
77
|
* A lost race (`412`) re-reads and re-applies the patch, up to the shared
|
|
86
|
-
* compare-and-swap attempt limit.
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* one `metaVersion` covers the configuration members and the annotations
|
|
91
|
-
* alike, so a concurrent `configure` -- or an epoch rotation -- legitimately
|
|
92
|
-
* invalidates an in-flight annotation write.
|
|
78
|
+
* compare-and-swap attempt limit. That is not a rare event at Collection
|
|
79
|
+
* level: one `metaVersion` covers the configuration members and the
|
|
80
|
+
* annotations alike, so a concurrent `configure` -- or an epoch rotation --
|
|
81
|
+
* legitimately invalidates an in-flight annotation write.
|
|
93
82
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `setMeta` does for a precondition the caller named itself. The Collection
|
|
100
|
-
* side passes none: its `metaVersion` is maintained regardless of the backend
|
|
101
|
-
* feature, so its pin always stands.
|
|
83
|
+
* A handle whose metadata cannot be read at all is refused with
|
|
84
|
+
* `NotFoundError` rather than patched onto an empty object, so a masked 404
|
|
85
|
+
* cannot turn a rename into a create. A read that carried no validator is
|
|
86
|
+
* refused by the compare-and-swap loop: the full-replacement write would go
|
|
87
|
+
* out with no `If-Match` at all.
|
|
102
88
|
*
|
|
103
89
|
* @param handle {object} the Collection or Resource handle to patch
|
|
104
90
|
* @param patch {ResourceMetadataCustom} the properties to merge over the
|
|
105
91
|
* current `custom`
|
|
106
92
|
* @param operation {string} what the caller is doing, for the exhaustion
|
|
107
93
|
* error (e.g. `Metadata update`)
|
|
108
|
-
* @param [features] {FeatureProbe} the handle's backend-feature probe, when
|
|
109
|
-
* its metadata validator is gated on `conditional-writes`
|
|
110
94
|
* @returns {Promise<void>}
|
|
111
95
|
*/
|
|
112
96
|
export declare function patchCustom(handle: {
|
|
@@ -121,5 +105,5 @@ export declare function patchCustom(handle: {
|
|
|
121
105
|
}): Promise<{
|
|
122
106
|
etag?: string;
|
|
123
107
|
}>;
|
|
124
|
-
}, patch: ResourceMetadataCustom, operation?: string
|
|
108
|
+
}, patch: ResourceMetadataCustom, operation?: string): Promise<void>;
|
|
125
109
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/internal/meta.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/internal/meta.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EACV,KAAK,EACL,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,SAAS;IAAE,MAAM,CAAC,EAAE,sBAAsB,CAAA;CAAE,EAEpD,OAAO,EAAE,aAAa,EACtB,EACE,QAAQ,EACR,KAAK,EAAE,YAAY,EACnB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,YAAY,CAAA;IAClB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACjC,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,KAAK,IAAI,CAAA;CACX,GACA,OAAO,CAAC,CAAC,QAAQ,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,IAAI,CAAC,CA4ChD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,aAAa,EACtB,EACE,QAAQ,EACR,KAAK,EAAE,YAAY,EACnB,MAAM,EACN,IAAI,EACJ,OAAO,EACP,WAAW,EACX,UAAU,EACX,EAAE;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC7B,MAAM,EAAE,2BAA2B,CAAA;IACnC,IAAI,EAAE,aAAa,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GACA,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAW5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,IAAI,OAAO,CAAC;QAAE,MAAM,CAAC,EAAE,sBAAsB,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IAC1E,OAAO,CACL,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,sBAAsB,CAAA;KAAE,EACzC,OAAO,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5B,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9B,EACD,KAAK,EAAE,sBAAsB,EAC7B,SAAS,SAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
package/dist/internal/meta.js
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
* `Collection`, and `patchCustom` below drives both handles' read-modify-write
|
|
13
13
|
* helpers through a bounded compare-and-swap.
|
|
14
14
|
*/
|
|
15
|
-
import { WasServerError } from '../errors.js';
|
|
15
|
+
import { NotFoundError, WasServerError } from '../errors.js';
|
|
16
16
|
import { compareAndSwap } from './cas.js';
|
|
17
17
|
import { send } from './request.js';
|
|
18
|
-
import {
|
|
18
|
+
import { readEtag, writeHeaders } from './conditional.js';
|
|
19
19
|
import { withCodec } from './withCodec.js';
|
|
20
20
|
/**
|
|
21
21
|
* Reads a metadata document and decodes its user-writable `custom` value.
|
|
@@ -93,22 +93,12 @@ export async function readMeta(context, { metaPath, codec: codecPromise, subject
|
|
|
93
93
|
* properties, as a full replacement
|
|
94
94
|
* @param options.slot {MetaWriteSlot} the `meta` slot being written, which
|
|
95
95
|
* an encrypting codec binds into the envelope
|
|
96
|
-
* @param options.features {FeatureProbe} the handle's backend-feature probe.
|
|
97
|
-
* A Resource's metadata validator is a Resource-level validator, so a named
|
|
98
|
-
* precondition is refused when the backend advertises no `conditional-writes`
|
|
99
|
-
* (unlike the Collection Metadata object's `metaVersion`, which a server
|
|
100
|
-
* maintains regardless and `Collection.setMeta` therefore does not gate)
|
|
101
96
|
* @param [options.ifMatch] {string} update only if the `meta` ETag matches
|
|
102
97
|
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
103
98
|
* @param [options.capability] {IZcap}
|
|
104
99
|
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
105
100
|
*/
|
|
106
|
-
export async function writeMeta(context, { metaPath, codec: codecPromise, custom, slot,
|
|
107
|
-
await assertPreconditionEnforced({
|
|
108
|
-
features,
|
|
109
|
-
precondition: { ifMatch, ifNoneMatch },
|
|
110
|
-
operation: `Cannot write the metadata at "${metaPath}"`
|
|
111
|
-
});
|
|
101
|
+
export async function writeMeta(context, { metaPath, codec: codecPromise, custom, slot, ifMatch, ifNoneMatch, capability }) {
|
|
112
102
|
const codec = await codecPromise;
|
|
113
103
|
const { custom: encoded } = await codec.encodeMeta({ custom, slot });
|
|
114
104
|
const response = await send(context, {
|
|
@@ -123,47 +113,41 @@ export async function writeMeta(context, { metaPath, codec: codecPromise, custom
|
|
|
123
113
|
/**
|
|
124
114
|
* The shared read-then-CAS body of the handles' `setName` / `setTags`: reads
|
|
125
115
|
* the current metadata, merges `patch` over its `custom`, and writes it back
|
|
126
|
-
* pinned to the read's `etag
|
|
127
|
-
*
|
|
128
|
-
* the full-replacement write.
|
|
116
|
+
* pinned to the read's `etag`, so a concurrent metadata write is rebased on
|
|
117
|
+
* rather than silently erased by the full-replacement write.
|
|
129
118
|
*
|
|
130
119
|
* A lost race (`412`) re-reads and re-applies the patch, up to the shared
|
|
131
|
-
* compare-and-swap attempt limit.
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* one `metaVersion` covers the configuration members and the annotations
|
|
136
|
-
* alike, so a concurrent `configure` -- or an epoch rotation -- legitimately
|
|
137
|
-
* invalidates an in-flight annotation write.
|
|
120
|
+
* compare-and-swap attempt limit. That is not a rare event at Collection
|
|
121
|
+
* level: one `metaVersion` covers the configuration members and the
|
|
122
|
+
* annotations alike, so a concurrent `configure` -- or an epoch rotation --
|
|
123
|
+
* legitimately invalidates an in-flight annotation write.
|
|
138
124
|
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* `setMeta` does for a precondition the caller named itself. The Collection
|
|
145
|
-
* side passes none: its `metaVersion` is maintained regardless of the backend
|
|
146
|
-
* feature, so its pin always stands.
|
|
125
|
+
* A handle whose metadata cannot be read at all is refused with
|
|
126
|
+
* `NotFoundError` rather than patched onto an empty object, so a masked 404
|
|
127
|
+
* cannot turn a rename into a create. A read that carried no validator is
|
|
128
|
+
* refused by the compare-and-swap loop: the full-replacement write would go
|
|
129
|
+
* out with no `If-Match` at all.
|
|
147
130
|
*
|
|
148
131
|
* @param handle {object} the Collection or Resource handle to patch
|
|
149
132
|
* @param patch {ResourceMetadataCustom} the properties to merge over the
|
|
150
133
|
* current `custom`
|
|
151
134
|
* @param operation {string} what the caller is doing, for the exhaustion
|
|
152
135
|
* error (e.g. `Metadata update`)
|
|
153
|
-
* @param [features] {FeatureProbe} the handle's backend-feature probe, when
|
|
154
|
-
* its metadata validator is gated on `conditional-writes`
|
|
155
136
|
* @returns {Promise<void>}
|
|
156
137
|
*/
|
|
157
|
-
export async function patchCustom(handle, patch, operation = 'Metadata update'
|
|
138
|
+
export async function patchCustom(handle, patch, operation = 'Metadata update') {
|
|
158
139
|
await compareAndSwap({
|
|
159
140
|
store: {
|
|
160
141
|
read: async () => {
|
|
161
142
|
const current = await handle.meta();
|
|
162
|
-
|
|
163
|
-
|
|
143
|
+
if (current === null) {
|
|
144
|
+
throw new NotFoundError(`${operation} failed: the metadata is not readable, so there is ` +
|
|
145
|
+
'nothing to patch -- the target does not exist, or it is not ' +
|
|
146
|
+
'visible with this capability (WAS returns 404 for both).');
|
|
147
|
+
}
|
|
164
148
|
return {
|
|
165
|
-
value: current
|
|
166
|
-
...(etag !== undefined && { etag })
|
|
149
|
+
value: current.custom ?? {},
|
|
150
|
+
...(current.etag !== undefined && { etag: current.etag })
|
|
167
151
|
};
|
|
168
152
|
},
|
|
169
153
|
replace: async (custom, { ifMatch }) => {
|
|
@@ -171,9 +155,6 @@ export async function patchCustom(handle, patch, operation = 'Metadata update',
|
|
|
171
155
|
}
|
|
172
156
|
},
|
|
173
157
|
operation,
|
|
174
|
-
// A handle's name and tags stay writable on a backend that serves no
|
|
175
|
-
// metadata validator; the write is then last-write-wins.
|
|
176
|
-
allowUnconditional: true,
|
|
177
158
|
mutate: custom => ({ ...custom, ...patch })
|
|
178
159
|
});
|
|
179
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/internal/meta.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/internal/meta.ts"],"names":[],"m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,CAAA;AACrC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAMC,EACD,KAA6B,EAC7B,SAAS,GAAG,iBAAiB;IAE7B,MAAM,cAAc,CAAyB;QAC3C,KAAK,EAAE;YACL,IAAI,EAAE,KAAK,IAAI,EAAE;gBACf,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;gBACnC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;oBACrB,MAAM,IAAI,aAAa,CACrB,GAAG,SAAS,qDAAqD;wBAC/D,8DAA8D;wBAC9D,0DAA0D,CAC7D,CAAA;gBACH,CAAC;gBACD,OAAO;oBACL,KAAK,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;oBAC3B,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;iBAC1D,CAAA;YACH,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;gBACrC,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;YAC/C,CAAC;SACF;QACD,SAAS;QACT,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;KAC5C,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/internal/paths.d.ts
CHANGED
|
@@ -122,7 +122,7 @@ export declare function resourceMeta(spaceId: string, collectionId: string, reso
|
|
|
122
122
|
export declare function resourcePolicy(spaceId: string, collectionId: string, resourceId: string): string;
|
|
123
123
|
/**
|
|
124
124
|
* `/space/:spaceId/:collectionId/:resourceId/chunks/:chunkIndex` -- a single
|
|
125
|
-
* stored chunk of a chunked Resource
|
|
125
|
+
* stored chunk of a chunked Resource. Member
|
|
126
126
|
* form, no trailing slash: get / put / delete one chunk by its ordinal index.
|
|
127
127
|
* The `chunkIndex` is a non-negative integer, emitted verbatim (it is never a
|
|
128
128
|
* reserved or dot segment, so it needs no percent-encoding).
|
package/dist/internal/paths.js
CHANGED
|
@@ -274,7 +274,7 @@ export function resourcePolicy(spaceId, collectionId, resourceId) {
|
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
276
|
* `/space/:spaceId/:collectionId/:resourceId/chunks/:chunkIndex` -- a single
|
|
277
|
-
* stored chunk of a chunked Resource
|
|
277
|
+
* stored chunk of a chunked Resource. Member
|
|
278
278
|
* form, no trailing slash: get / put / delete one chunk by its ordinal index.
|
|
279
279
|
* The `chunkIndex` is a non-negative integer, emitted verbatim (it is never a
|
|
280
280
|
* reserved or dot segment, so it needs no percent-encoding).
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
import type { ZcapClient } from '@interop/ezcap';
|
|
14
14
|
import type { HttpResponse } from '@interop/http-client';
|
|
15
15
|
import type { EncryptionProvider } from '../codec.js';
|
|
16
|
-
import type { BackendFeatures } from './features.js';
|
|
17
16
|
import type { IZcap, RequestInput, ServiceInfo } from '../types.js';
|
|
18
17
|
/**
|
|
19
18
|
* The shared context threaded through every handle: the server base URL, the
|
|
@@ -28,15 +27,6 @@ export interface ClientContext {
|
|
|
28
27
|
controllerDid: string;
|
|
29
28
|
encryption?: EncryptionProvider;
|
|
30
29
|
service: () => Promise<ServiceInfo>;
|
|
31
|
-
/**
|
|
32
|
-
* The client's shared backend-feature probes, keyed by descriptor request
|
|
33
|
-
* (collection path plus bound capability id). Handles built separately --
|
|
34
|
-
* `fromCapability` per resource, `collection(id)` in a loop -- then share one
|
|
35
|
-
* `GET .../backend` instead of repeating it per handle. Optional: a context
|
|
36
|
-
* assembled without one (a test fixture, `WasTransport`'s own requester)
|
|
37
|
-
* simply builds an unshared probe per handle, as before.
|
|
38
|
-
*/
|
|
39
|
-
backendFeatures?: Map<string, BackendFeatures>;
|
|
40
30
|
}
|
|
41
31
|
/**
|
|
42
32
|
* A single signed request: the public `RequestInput` shape (either `path`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/internal/request.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/internal/request.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAYD;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,YAAY,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