@interop/was-client 0.65.0 → 0.66.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 +29 -22
- package/dist/Collection.d.ts +23 -1
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +17 -2
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +7 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +18 -8
- package/dist/Resource.js.map +1 -1
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +5 -1
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +6 -5
- 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.map +1 -1
- package/dist/edv/EdvCodec.js +3 -2
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/descriptorStore.d.ts +14 -11
- package/dist/edv/descriptorStore.d.ts.map +1 -1
- package/dist/edv/descriptorStore.js +7 -5
- package/dist/edv/descriptorStore.js.map +1 -1
- package/dist/edv/docCipher.d.ts +11 -1
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +24 -6
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.d.ts.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.js +5 -2
- package/dist/edv/logGovernedDescriptorStore.js.map +1 -1
- package/dist/edv/refreshingDocCipher.d.ts +4 -1
- package/dist/edv/refreshingDocCipher.d.ts.map +1 -1
- package/dist/edv/refreshingDocCipher.js +7 -4
- package/dist/edv/refreshingDocCipher.js.map +1 -1
- package/dist/errors.d.ts +17 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +20 -1
- package/dist/errors.js.map +1 -1
- package/dist/internal/cas.d.ts +14 -2
- package/dist/internal/cas.d.ts.map +1 -1
- package/dist/internal/cas.js +21 -2
- package/dist/internal/cas.js.map +1 -1
- package/dist/internal/conditional.d.ts +69 -2
- package/dist/internal/conditional.d.ts.map +1 -1
- package/dist/internal/conditional.js +81 -1
- package/dist/internal/conditional.js.map +1 -1
- package/dist/internal/features.d.ts +9 -3
- package/dist/internal/features.d.ts.map +1 -1
- package/dist/internal/features.js +33 -4
- package/dist/internal/features.js.map +1 -1
- package/dist/internal/meta.d.ts +20 -2
- package/dist/internal/meta.d.ts.map +1 -1
- package/dist/internal/meta.js +30 -4
- package/dist/internal/meta.js.map +1 -1
- package/dist/internal/request.d.ts +10 -0
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/write.d.ts +9 -2
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +15 -3
- package/dist/internal/write.js.map +1 -1
- package/dist/log/logStore.d.ts +11 -5
- package/dist/log/logStore.d.ts.map +1 -1
- package/dist/log/logStore.js +18 -5
- package/dist/log/logStore.js.map +1 -1
- package/dist/sync/index.d.ts +8 -5
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -5
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/plaintextCipher.d.ts +6 -4
- package/dist/sync/plaintextCipher.d.ts.map +1 -1
- package/dist/sync/plaintextCipher.js +19 -6
- package/dist/sync/plaintextCipher.js.map +1 -1
- package/dist/sync/port.d.ts +7 -1
- package/dist/sync/port.d.ts.map +1 -1
- package/dist/sync/port.js +18 -2
- package/dist/sync/port.js.map +1 -1
- package/dist/sync/predicates.d.ts +14 -3
- package/dist/sync/predicates.d.ts.map +1 -1
- package/dist/sync/predicates.js +16 -3
- package/dist/sync/predicates.js.map +1 -1
- package/dist/sync/types.d.ts +21 -1
- package/dist/sync/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/errors.js
CHANGED
|
@@ -184,7 +184,10 @@ export class KeyUnwrapError extends EncryptionError {
|
|
|
184
184
|
/**
|
|
185
185
|
* A fail-closed integrity error: a stored EDV envelope this reader DOES hold a
|
|
186
186
|
* key for failed to authenticate on decrypt -- its AEAD tag did not verify, so
|
|
187
|
-
* the ciphertext is corrupt or has been tampered with
|
|
187
|
+
* the ciphertext is corrupt or has been tampered with -- or a stored body does
|
|
188
|
+
* not verify against the resource id it was read under (an envelope bound to
|
|
189
|
+
* another resource, or a content-addressed document whose content id differs
|
|
190
|
+
* from its resource id). Distinct from
|
|
188
191
|
* {@link KeyUnwrapError}: that is the read/membership axis ("no key for this
|
|
189
192
|
* epoch"), whereas this is a data-integrity failure by a legitimate recipient.
|
|
190
193
|
* A subtype of {@link EncryptionError}, so existing `catch (EncryptionError)`
|
|
@@ -353,6 +356,22 @@ export function httpStatus(err) {
|
|
|
353
356
|
export function errorMessage(err) {
|
|
354
357
|
return err instanceof Error ? err.message : String(err);
|
|
355
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Refuses a `DocCipher.decrypt` call that carries no resource id. Both
|
|
361
|
+
* built-in ciphers verify the stored body against that id, and a missing one
|
|
362
|
+
* would silently skip the check.
|
|
363
|
+
*
|
|
364
|
+
* @param options {object}
|
|
365
|
+
* @param options.id {string} the resource id the replica read the body under
|
|
366
|
+
* @param options.collectionId {string} labels the error
|
|
367
|
+
*/
|
|
368
|
+
export function requireResourceId({ id, collectionId }) {
|
|
369
|
+
if (typeof id !== 'string' || id === '') {
|
|
370
|
+
throw new ValidationError(`Cannot decrypt a resource of collection "${collectionId}" without its ` +
|
|
371
|
+
'resource id: pass the id the replica read it under, so the stored ' +
|
|
372
|
+
'body can be verified against it.');
|
|
373
|
+
}
|
|
374
|
+
}
|
|
356
375
|
/**
|
|
357
376
|
* Translates a thrown ky/ezcap error into the appropriate `WasError` subclass,
|
|
358
377
|
* carrying through the server's `problem+json` fields. Dispatches on the
|
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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C9C,KAAK,GAAG;YACN,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC5C,KAAK,GAAG;YACN,OAAO,IAAI,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACtD,KAAK,GAAG;YACN,OAAO,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACnD,KAAK,GAAG;YACN,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClD,KAAK,GAAG;YACN,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAChD,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAED,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC"}
|
package/dist/internal/cas.d.ts
CHANGED
|
@@ -70,6 +70,13 @@ export declare function isPreconditionFailed(err: unknown): boolean;
|
|
|
70
70
|
* retry): nothing is written and the current value is returned as-is. Any other error `mutate` throws
|
|
71
71
|
* propagates unchanged.
|
|
72
72
|
*
|
|
73
|
+
* A read that returns a value with no validator is refused before the write
|
|
74
|
+
* with `NotSupportedError`: the replace would carry no `If-Match`, so a lost
|
|
75
|
+
* race would silently overwrite the rival write instead of rebasing on it. A
|
|
76
|
+
* caller whose host legitimately offers only the unconditional write passes
|
|
77
|
+
* `allowUnconditional`. A `mutate` that resolves `null` writes nothing and so
|
|
78
|
+
* is never refused.
|
|
79
|
+
*
|
|
73
80
|
* When the store reports no value yet (`read()` resolves `null`), the optional
|
|
74
81
|
* `onAbsent` supplies the seed to mutate instead, and the result is written
|
|
75
82
|
* with the store's create-if-absent guard. Without `onAbsent`, or on a store
|
|
@@ -86,14 +93,17 @@ export declare function isPreconditionFailed(err: unknown): boolean;
|
|
|
86
93
|
* @param [options.onAbsent] {function} returns the seed to mutate when the
|
|
87
94
|
* store holds no value yet; may throw a caller-specific refusal
|
|
88
95
|
* @param [options.maxAttempts] {number} defaults to {@link DEFAULT_CAS_ATTEMPTS}
|
|
96
|
+
* @param [options.allowUnconditional] {boolean} send the replace without
|
|
97
|
+
* `If-Match` when the read returned no validator, instead of refusing
|
|
89
98
|
* @returns {Promise<T>} the written (or current) value
|
|
90
99
|
*/
|
|
91
|
-
export declare function compareAndSwap<T>({ store, mutate, operation, onAbsent, maxAttempts }: {
|
|
100
|
+
export declare function compareAndSwap<T>({ store, mutate, operation, onAbsent, maxAttempts, allowUnconditional }: {
|
|
92
101
|
store: CasStore<T>;
|
|
93
102
|
mutate: (value: T) => T | null | Promise<T | null>;
|
|
94
103
|
operation: string;
|
|
95
104
|
onAbsent?: () => T;
|
|
96
105
|
maxAttempts?: number;
|
|
106
|
+
allowUnconditional?: boolean;
|
|
97
107
|
}): Promise<T>;
|
|
98
108
|
/**
|
|
99
109
|
* A merging write over a versioned object, run through {@link compareAndSwap}.
|
|
@@ -102,7 +112,9 @@ export declare function compareAndSwap<T>({ store, mutate, operation, onAbsent,
|
|
|
102
112
|
* re-reads, re-composes, and re-sends, so a merge is only applied over a
|
|
103
113
|
* version this write observed. A baseline carrying no validator makes its
|
|
104
114
|
* attempt an unconditional write (`ifMatch` is `undefined`), which is all a
|
|
105
|
-
* backend without `conditional-writes` offers.
|
|
115
|
+
* backend without `conditional-writes` offers. This is the loop's
|
|
116
|
+
* `allowUnconditional` opt-out: the Collection and Space Metadata writes that
|
|
117
|
+
* drive it keep working on such a backend.
|
|
106
118
|
*
|
|
107
119
|
* Unlike a plain {@link CasStore}, the body is not the stored value itself.
|
|
108
120
|
* The stored value may be `null` (an absent or unreadable object), and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas.d.ts","sourceRoot":"","sources":["../../src/internal/cas.ts"],"names":[],"mappings":"
|
|
1
|
+
{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;;;GA8BG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,EAC3D,IAAI,EACJ,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,WAAW,EACZ,EAAE;IACD,IAAI,EAAE,MAAM,OAAO,CAAC;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAChD,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACrC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACxC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,YAAY,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;IAClE,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,CAAC,CAAC,CA0Bb"}
|
package/dist/internal/cas.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* than hand-rolling another loop.
|
|
13
13
|
*/
|
|
14
14
|
import { PreconditionFailedError, ValidationError } from '../errors.js';
|
|
15
|
+
import { unenforcedPreconditionError } from './conditional.js';
|
|
15
16
|
/**
|
|
16
17
|
* How many times {@link compareAndSwap} retries a stale (`412`) write before
|
|
17
18
|
* surfacing `PreconditionFailedError`. One shared default, so two callers do
|
|
@@ -45,6 +46,13 @@ export function isPreconditionFailed(err) {
|
|
|
45
46
|
* retry): nothing is written and the current value is returned as-is. Any other error `mutate` throws
|
|
46
47
|
* propagates unchanged.
|
|
47
48
|
*
|
|
49
|
+
* A read that returns a value with no validator is refused before the write
|
|
50
|
+
* with `NotSupportedError`: the replace would carry no `If-Match`, so a lost
|
|
51
|
+
* race would silently overwrite the rival write instead of rebasing on it. A
|
|
52
|
+
* caller whose host legitimately offers only the unconditional write passes
|
|
53
|
+
* `allowUnconditional`. A `mutate` that resolves `null` writes nothing and so
|
|
54
|
+
* is never refused.
|
|
55
|
+
*
|
|
48
56
|
* When the store reports no value yet (`read()` resolves `null`), the optional
|
|
49
57
|
* `onAbsent` supplies the seed to mutate instead, and the result is written
|
|
50
58
|
* with the store's create-if-absent guard. Without `onAbsent`, or on a store
|
|
@@ -61,9 +69,11 @@ export function isPreconditionFailed(err) {
|
|
|
61
69
|
* @param [options.onAbsent] {function} returns the seed to mutate when the
|
|
62
70
|
* store holds no value yet; may throw a caller-specific refusal
|
|
63
71
|
* @param [options.maxAttempts] {number} defaults to {@link DEFAULT_CAS_ATTEMPTS}
|
|
72
|
+
* @param [options.allowUnconditional] {boolean} send the replace without
|
|
73
|
+
* `If-Match` when the read returned no validator, instead of refusing
|
|
64
74
|
* @returns {Promise<T>} the written (or current) value
|
|
65
75
|
*/
|
|
66
|
-
export async function compareAndSwap({ store, mutate, operation, onAbsent, maxAttempts = DEFAULT_CAS_ATTEMPTS }) {
|
|
76
|
+
export async function compareAndSwap({ store, mutate, operation, onAbsent, maxAttempts = DEFAULT_CAS_ATTEMPTS, allowUnconditional = false }) {
|
|
67
77
|
let lastError;
|
|
68
78
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
69
79
|
let current;
|
|
@@ -112,6 +122,12 @@ export async function compareAndSwap({ store, mutate, operation, onAbsent, maxAt
|
|
|
112
122
|
// The value already reflects the desired state: nothing to write.
|
|
113
123
|
return current.value;
|
|
114
124
|
}
|
|
125
|
+
if (current.etag === undefined && !allowUnconditional) {
|
|
126
|
+
throw unenforcedPreconditionError({
|
|
127
|
+
operation: `${operation} was refused`,
|
|
128
|
+
reason: 'no-validator'
|
|
129
|
+
});
|
|
130
|
+
}
|
|
115
131
|
try {
|
|
116
132
|
await store.replace(next, { ifMatch: current.etag });
|
|
117
133
|
return next;
|
|
@@ -136,7 +152,9 @@ export async function compareAndSwap({ store, mutate, operation, onAbsent, maxAt
|
|
|
136
152
|
* re-reads, re-composes, and re-sends, so a merge is only applied over a
|
|
137
153
|
* version this write observed. A baseline carrying no validator makes its
|
|
138
154
|
* attempt an unconditional write (`ifMatch` is `undefined`), which is all a
|
|
139
|
-
* backend without `conditional-writes` offers.
|
|
155
|
+
* backend without `conditional-writes` offers. This is the loop's
|
|
156
|
+
* `allowUnconditional` opt-out: the Collection and Space Metadata writes that
|
|
157
|
+
* drive it keep working on such a backend.
|
|
140
158
|
*
|
|
141
159
|
* Unlike a plain {@link CasStore}, the body is not the stored value itself.
|
|
142
160
|
* The stored value may be `null` (an absent or unreadable object), and
|
|
@@ -176,6 +194,7 @@ export async function composeAndSwap({ read, current, compose, write, operation,
|
|
|
176
194
|
// The store only ever reads a baseline and only ever replaces a body.
|
|
177
195
|
mutate: value => compose(value),
|
|
178
196
|
operation,
|
|
197
|
+
allowUnconditional: true,
|
|
179
198
|
...(maxAttempts !== undefined && { maxAttempts })
|
|
180
199
|
});
|
|
181
200
|
if (written === undefined) {
|
package/dist/internal/cas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas.js","sourceRoot":"","sources":["../../src/internal/cas.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"cas.js","sourceRoot":"","sources":["../../src/internal/cas.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AA0CrC;;;;;;;;;;;GAWG;AACH,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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
|
-
* response returns,
|
|
9
|
-
* conditional codec's write path pre-read
|
|
8
|
+
* response returns, checking a caller's precondition against the document a
|
|
9
|
+
* conditional codec's write path pre-read, and refusing a precondition the
|
|
10
|
+
* backend cannot be shown to enforce.
|
|
10
11
|
*/
|
|
11
12
|
import type { EncodedWrite, ResponseLike } from '../codec.js';
|
|
13
|
+
import { NotSupportedError } from '../errors.js';
|
|
14
|
+
import type { FeatureProbe } from './features.js';
|
|
12
15
|
/**
|
|
13
16
|
* The request header the server reads a content write's key-epoch id from,
|
|
14
17
|
* stamping it onto the Resource's metadata (an absent header clears any prior
|
|
@@ -81,6 +84,70 @@ export declare function writeHeaders({ contentType, precondition, epoch }: {
|
|
|
81
84
|
precondition?: WritePrecondition;
|
|
82
85
|
epoch?: string;
|
|
83
86
|
}): Record<string, string> | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The refusal for a guarded write whose guard the backend cannot be shown to
|
|
89
|
+
* enforce. Every such gate builds its error here, so the messages do not
|
|
90
|
+
* drift apart. The reasons:
|
|
91
|
+
*
|
|
92
|
+
* - `no-validator`: the read the write is pinned to returned no `ETag`, so the
|
|
93
|
+
* write would go out with no `If-Match` at all.
|
|
94
|
+
* - `no-feature`: the backend descriptor was read and does not list
|
|
95
|
+
* `conditional-writes`. Such a backend may serve an `ETag` on reads and still
|
|
96
|
+
* ignore `If-Match` / `If-None-Match` on writes.
|
|
97
|
+
*
|
|
98
|
+
* @param options {object}
|
|
99
|
+
* @param options.operation {string} what was refused, as the message's
|
|
100
|
+
* opening clause (e.g. `Cannot append to the resource log`)
|
|
101
|
+
* @param options.reason {'no-validator' | 'no-feature'}
|
|
102
|
+
* @returns {NotSupportedError}
|
|
103
|
+
*/
|
|
104
|
+
export declare function unenforcedPreconditionError({ operation, reason }: {
|
|
105
|
+
operation: string;
|
|
106
|
+
reason: 'no-validator' | 'no-feature';
|
|
107
|
+
}): 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>;
|
|
84
151
|
/**
|
|
85
152
|
* Reads the strong `ETag` validator a write/read response returned, or
|
|
86
153
|
* `undefined` when the backend sent none (it does not advertise the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional.d.ts","sourceRoot":"","sources":["../../src/internal/conditional.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
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;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;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;;;;;;;;;;;;;;;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ationError } from '../errors.js';
|
|
1
|
+
import { NotSupportedError, PreconditionFailedError, ValidationError } from '../errors.js';
|
|
2
2
|
/**
|
|
3
3
|
* The request header the server reads a content write's key-epoch id from,
|
|
4
4
|
* stamping it onto the Resource's metadata (an absent header clears any prior
|
|
@@ -87,6 +87,86 @@ export function writeHeaders({ contentType, precondition = {}, epoch }) {
|
|
|
87
87
|
}
|
|
88
88
|
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The refusal for a guarded write whose guard the backend cannot be shown to
|
|
92
|
+
* enforce. Every such gate builds its error here, so the messages do not
|
|
93
|
+
* drift apart. The reasons:
|
|
94
|
+
*
|
|
95
|
+
* - `no-validator`: the read the write is pinned to returned no `ETag`, so the
|
|
96
|
+
* write would go out with no `If-Match` at all.
|
|
97
|
+
* - `no-feature`: the backend descriptor was read and does not list
|
|
98
|
+
* `conditional-writes`. Such a backend may serve an `ETag` on reads and still
|
|
99
|
+
* ignore `If-Match` / `If-None-Match` on writes.
|
|
100
|
+
*
|
|
101
|
+
* @param options {object}
|
|
102
|
+
* @param options.operation {string} what was refused, as the message's
|
|
103
|
+
* opening clause (e.g. `Cannot append to the resource log`)
|
|
104
|
+
* @param options.reason {'no-validator' | 'no-feature'}
|
|
105
|
+
* @returns {NotSupportedError}
|
|
106
|
+
*/
|
|
107
|
+
export function unenforcedPreconditionError({ operation, reason }) {
|
|
108
|
+
const consequence = 'so a concurrent change could be silently overwritten instead of ' +
|
|
109
|
+
'failing with a 412.';
|
|
110
|
+
if (reason === 'no-validator') {
|
|
111
|
+
return new NotSupportedError(`${operation}: the read it is pinned to returned no ETag validator, ` +
|
|
112
|
+
`so the write would go out unconditionally, ${consequence} Use a ` +
|
|
113
|
+
"backend that advertises the 'conditional-writes' feature.");
|
|
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()));
|
|
169
|
+
}
|
|
90
170
|
/**
|
|
91
171
|
* Reads the strong `ETag` validator a write/read response returned, or
|
|
92
172
|
* `undefined` when the backend sent none (it does not advertise the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../src/internal/conditional.ts"],"names":[],"mappings":"
|
|
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;AAGrB;;;;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,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,SAAS,CA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CAAC;QACjD,MAAM,IAAI,uBAAuB,CAC/B,kCAAkC,IAAI,0BAA0B;YAC9D,mEAAmE;YACnE,yCAAyC,EAC3C,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB,CAAA;IACH,CAAC;IACD,IAAI,YAAY,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACvC,OAAM;IACR,CAAC;IACD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,uBAAuB,CAC/B,kCAAkC,IAAI,8BAA8B;YAClE,gEAAgE;YAChE,iEAAiE;YACjE,mEAAmE,EACrE,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB,CAAA;IACH,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC9B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,YAAY,CAAC,OAAO,EAAE,CAAC;QACxD,MAAM,IAAI,uBAAuB,CAC/B,kCAAkC,IAAI,yBAAyB;YAC7D,IAAI,IAAI,2CAA2C;YACnD,IAAI,YAAY,CAAC,OAAO,8CAA8C;YACtE,yCAAyC,EAC3C,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -81,15 +81,21 @@ export declare class BackendFeatures implements FeatureProbe {
|
|
|
81
81
|
descriptorAbsent(): Promise<boolean>;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* the
|
|
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
87
|
* `WasTransport` builds over its own requester. A descriptor that is not
|
|
88
88
|
* readable with the bound capability surfaces as a 404 (WAS masks unauthorized
|
|
89
89
|
* reads), which the probe treats as "no features advertised" -- so every
|
|
90
90
|
* affordance gate falls closed for a capability that cannot read the
|
|
91
91
|
* descriptor.
|
|
92
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
|
+
*
|
|
93
99
|
* @param context {ClientContext}
|
|
94
100
|
* @param options {object}
|
|
95
101
|
* @param options.spaceId {string}
|
|
@@ -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;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;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,EAAE,KAAK,CAAA;CAAE,GAC/D,eAAe,CAkBjB"}
|
|
@@ -137,15 +137,37 @@ export class BackendFeatures {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* the probe
|
|
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
|
|
143
159
|
* `WasTransport` builds over its own requester. A descriptor that is not
|
|
144
160
|
* readable with the bound capability surfaces as a 404 (WAS masks unauthorized
|
|
145
161
|
* reads), which the probe treats as "no features advertised" -- so every
|
|
146
162
|
* affordance gate falls closed for a capability that cannot read the
|
|
147
163
|
* descriptor.
|
|
148
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
|
+
*
|
|
149
171
|
* @param context {ClientContext}
|
|
150
172
|
* @param options {object}
|
|
151
173
|
* @param options.spaceId {string}
|
|
@@ -154,7 +176,12 @@ export class BackendFeatures {
|
|
|
154
176
|
* @returns {BackendFeatures}
|
|
155
177
|
*/
|
|
156
178
|
export function collectionBackendFeatures(context, { spaceId, collectionId, capability }) {
|
|
157
|
-
|
|
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 () => {
|
|
158
185
|
const response = await send(context, {
|
|
159
186
|
path: collectionBackend(spaceId, collectionId),
|
|
160
187
|
method: 'GET',
|
|
@@ -164,5 +191,7 @@ export function collectionBackendFeatures(context, { spaceId, collectionId, capa
|
|
|
164
191
|
// the probe maps it to "absent"), so this null-guard is for the type only.
|
|
165
192
|
return response === null ? null : readJsonData(response);
|
|
166
193
|
});
|
|
194
|
+
context.backendFeatures?.set(key, probe);
|
|
195
|
+
return probe;
|
|
167
196
|
}
|
|
168
197
|
//# sourceMappingURL=features.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/internal/features.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,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,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@ -1,5 +1,6 @@
|
|
|
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';
|
|
3
4
|
import type { IZcap, ResourceMetadataCustom, ResourceMetadataCustomInput } from '../types.js';
|
|
4
5
|
/**
|
|
5
6
|
* Reads a metadata document and decodes its user-writable `custom` value.
|
|
@@ -52,16 +53,22 @@ export declare function readMeta<Metadata extends {
|
|
|
52
53
|
* properties, as a full replacement
|
|
53
54
|
* @param options.slot {MetaWriteSlot} the `meta` slot being written, which
|
|
54
55
|
* 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)
|
|
55
61
|
* @param [options.ifMatch] {string} update only if the `meta` ETag matches
|
|
56
62
|
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
57
63
|
* @param [options.capability] {IZcap}
|
|
58
64
|
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
59
65
|
*/
|
|
60
|
-
export declare function writeMeta(context: ClientContext, { metaPath, codec: codecPromise, custom, slot, ifMatch, ifNoneMatch, capability }: {
|
|
66
|
+
export declare function writeMeta(context: ClientContext, { metaPath, codec: codecPromise, custom, slot, features, ifMatch, ifNoneMatch, capability }: {
|
|
61
67
|
metaPath: string;
|
|
62
68
|
codec: Promise<ResourceCodec>;
|
|
63
69
|
custom: ResourceMetadataCustomInput;
|
|
64
70
|
slot: MetaWriteSlot;
|
|
71
|
+
features: FeatureProbe;
|
|
65
72
|
ifMatch?: string;
|
|
66
73
|
ifNoneMatch?: boolean;
|
|
67
74
|
capability?: IZcap;
|
|
@@ -84,11 +91,22 @@ export declare function writeMeta(context: ClientContext, { metaPath, codec: cod
|
|
|
84
91
|
* alike, so a concurrent `configure` -- or an epoch rotation -- legitimately
|
|
85
92
|
* invalidates an in-flight annotation write.
|
|
86
93
|
*
|
|
94
|
+
* `features` is the Resource side's: a Resource's metadata validator is
|
|
95
|
+
* gated on `conditional-writes`, so on a backend that advertises none the read
|
|
96
|
+
* reports no validator and the loop takes its `allowUnconditional` path -- the
|
|
97
|
+
* same last-write-wins update a backend serving no validator at all gets. That
|
|
98
|
+
* keeps `setName` / `setTags` working there rather than refusing, which is what
|
|
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.
|
|
102
|
+
*
|
|
87
103
|
* @param handle {object} the Collection or Resource handle to patch
|
|
88
104
|
* @param patch {ResourceMetadataCustom} the properties to merge over the
|
|
89
105
|
* current `custom`
|
|
90
106
|
* @param operation {string} what the caller is doing, for the exhaustion
|
|
91
107
|
* 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`
|
|
92
110
|
* @returns {Promise<void>}
|
|
93
111
|
*/
|
|
94
112
|
export declare function patchCustom(handle: {
|
|
@@ -103,5 +121,5 @@ export declare function patchCustom(handle: {
|
|
|
103
121
|
}): Promise<{
|
|
104
122
|
etag?: string;
|
|
105
123
|
}>;
|
|
106
|
-
}, patch: ResourceMetadataCustom, operation?: string): Promise<void>;
|
|
124
|
+
}, patch: ResourceMetadataCustom, operation?: string, features?: FeatureProbe): Promise<void>;
|
|
107
125
|
//# 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,MAA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