@interop/was-client 0.52.0 → 0.54.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 +54 -12
- package/dist/Collection.d.ts +11 -7
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +21 -23
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +15 -0
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +4 -15
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +54 -0
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +89 -7
- package/dist/Space.js.map +1 -1
- package/dist/edv/acquire.d.ts +98 -0
- package/dist/edv/acquire.d.ts.map +1 -0
- package/dist/edv/acquire.js +130 -0
- package/dist/edv/acquire.js.map +1 -0
- package/dist/edv/index.d.ts +35 -2
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +34 -2
- package/dist/edv/index.js.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.d.ts.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.js +4 -3
- package/dist/edv/logGovernedDescriptorStore.js.map +1 -1
- package/dist/edv/refresh.d.ts +62 -0
- package/dist/edv/refresh.d.ts.map +1 -0
- package/dist/edv/refresh.js +69 -0
- package/dist/edv/refresh.js.map +1 -0
- package/dist/edv/refreshingDocCipher.d.ts +70 -0
- package/dist/edv/refreshingDocCipher.d.ts.map +1 -0
- package/dist/edv/refreshingDocCipher.js +110 -0
- package/dist/edv/refreshingDocCipher.js.map +1 -0
- package/dist/errors.d.ts +4 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +4 -3
- package/dist/errors.js.map +1 -1
- package/dist/internal/content.d.ts +13 -0
- package/dist/internal/content.d.ts.map +1 -1
- package/dist/internal/content.js +16 -0
- package/dist/internal/content.js.map +1 -1
- package/dist/internal/describe.d.ts +16 -21
- package/dist/internal/describe.d.ts.map +1 -1
- package/dist/internal/describe.js +17 -25
- package/dist/internal/describe.js.map +1 -1
- package/dist/internal/request.d.ts +19 -0
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +26 -0
- package/dist/internal/request.js.map +1 -1
- package/dist/log/logStore.d.ts.map +1 -1
- package/dist/log/logStore.js +8 -20
- package/dist/log/logStore.js.map +1 -1
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +1 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/port.d.ts +5 -1
- package/dist/sync/port.d.ts.map +1 -1
- package/dist/sync/port.js +27 -11
- package/dist/sync/port.js.map +1 -1
- package/dist/sync/predicates.d.ts +21 -4
- package/dist/sync/predicates.d.ts.map +1 -1
- package/dist/sync/predicates.js +23 -4
- package/dist/sync/predicates.js.map +1 -1
- package/dist/sync/provisioning.d.ts +54 -18
- package/dist/sync/provisioning.d.ts.map +1 -1
- package/dist/sync/provisioning.js +123 -43
- package/dist/sync/provisioning.js.map +1 -1
- package/dist/sync/types.d.ts +23 -14
- package/dist/sync/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The unknown-epoch refresh policy: an epoch rotation emits no change-feed
|
|
6
|
+
* entry, so a cipher built from a cached descriptor can meet envelopes stamped
|
|
7
|
+
* with an epoch it has never seen. The remedy is one re-read of the
|
|
8
|
+
* Collection Description plus a cipher rebuild and a single retry -- and the
|
|
9
|
+
* policy guards that remedy to ONCE per collection per session, so a
|
|
10
|
+
* genuinely foreign envelope (one no descriptor will ever route) cannot drive
|
|
11
|
+
* a refetch loop, let alone a refetch per resource.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Tracks which collections have already spent their one refresh this session,
|
|
15
|
+
* and runs reads under the refresh-and-retry-once rule. One instance per
|
|
16
|
+
* session (it IS the session scope of the guard); the injected `refresh` does
|
|
17
|
+
* the host's whole swap -- re-acquire the descriptor(s), rebuild the
|
|
18
|
+
* cipher(s), and install them wherever the host keeps them.
|
|
19
|
+
*/
|
|
20
|
+
export declare class DescriptorRefreshPolicy {
|
|
21
|
+
#private;
|
|
22
|
+
constructor({ refresh }: {
|
|
23
|
+
refresh: (options: {
|
|
24
|
+
collectionId: string;
|
|
25
|
+
}) => Promise<void>;
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Whether a collection still has its one refresh this session.
|
|
29
|
+
*/
|
|
30
|
+
shouldRefresh({ collectionId }: {
|
|
31
|
+
collectionId: string;
|
|
32
|
+
}): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Runs a read that reports whether it skipped unknown-epoch rows; on the
|
|
35
|
+
* first such report for a collection this session, spends the collection's
|
|
36
|
+
* refresh (descriptor re-read + cipher swap, via the injected `refresh`) and
|
|
37
|
+
* re-reads once. A later unknown-epoch report for the same collection
|
|
38
|
+
* returns the read's value as-is.
|
|
39
|
+
*
|
|
40
|
+
* @param options {object}
|
|
41
|
+
* @param options.collectionId {string}
|
|
42
|
+
* @param options.read {function} the read, reporting `unknownEpoch`
|
|
43
|
+
* @returns {Promise<T>} the (possibly re-read) value
|
|
44
|
+
*/
|
|
45
|
+
readWithRefresh<T>({ collectionId, read }: {
|
|
46
|
+
collectionId: string;
|
|
47
|
+
read: () => Promise<{
|
|
48
|
+
value: T;
|
|
49
|
+
unknownEpoch: boolean;
|
|
50
|
+
}>;
|
|
51
|
+
}): Promise<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Re-arms the guard -- for one collection, or (with no argument) for all.
|
|
54
|
+
* Call when a fresh descriptor is installed by some other path (a share,
|
|
55
|
+
* unshare, or recipient rotation this session performed itself), since the
|
|
56
|
+
* next unknown-epoch read is then evidence of a NEW rotation elsewhere.
|
|
57
|
+
*/
|
|
58
|
+
reset(options?: {
|
|
59
|
+
collectionId?: string;
|
|
60
|
+
}): void;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=refresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/edv/refresh.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH,qBAAa,uBAAuB;;gBAKtB,EACV,OAAO,EACR,EAAE;QACD,OAAO,EAAE,CAAC,OAAO,EAAE;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KAC9D;IAID;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO;IAIlE;;;;;;;;;;;OAWG;IACG,eAAe,CAAC,CAAC,EAAE,EACvB,YAAY,EACZ,IAAI,EACL,EAAE;QACD,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,OAAO,CAAC;YAAE,KAAK,EAAE,CAAC,CAAC;YAAC,YAAY,EAAE,OAAO,CAAA;SAAE,CAAC,CAAA;KACzD,GAAG,OAAO,CAAC,CAAC,CAAC;IAUd;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAOjD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The unknown-epoch refresh policy: an epoch rotation emits no change-feed
|
|
6
|
+
* entry, so a cipher built from a cached descriptor can meet envelopes stamped
|
|
7
|
+
* with an epoch it has never seen. The remedy is one re-read of the
|
|
8
|
+
* Collection Description plus a cipher rebuild and a single retry -- and the
|
|
9
|
+
* policy guards that remedy to ONCE per collection per session, so a
|
|
10
|
+
* genuinely foreign envelope (one no descriptor will ever route) cannot drive
|
|
11
|
+
* a refetch loop, let alone a refetch per resource.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Tracks which collections have already spent their one refresh this session,
|
|
15
|
+
* and runs reads under the refresh-and-retry-once rule. One instance per
|
|
16
|
+
* session (it IS the session scope of the guard); the injected `refresh` does
|
|
17
|
+
* the host's whole swap -- re-acquire the descriptor(s), rebuild the
|
|
18
|
+
* cipher(s), and install them wherever the host keeps them.
|
|
19
|
+
*/
|
|
20
|
+
export class DescriptorRefreshPolicy {
|
|
21
|
+
#refresh;
|
|
22
|
+
// Collection ids whose one refresh this session is already spent.
|
|
23
|
+
#refreshed = new Set();
|
|
24
|
+
constructor({ refresh }) {
|
|
25
|
+
this.#refresh = refresh;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether a collection still has its one refresh this session.
|
|
29
|
+
*/
|
|
30
|
+
shouldRefresh({ collectionId }) {
|
|
31
|
+
return !this.#refreshed.has(collectionId);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Runs a read that reports whether it skipped unknown-epoch rows; on the
|
|
35
|
+
* first such report for a collection this session, spends the collection's
|
|
36
|
+
* refresh (descriptor re-read + cipher swap, via the injected `refresh`) and
|
|
37
|
+
* re-reads once. A later unknown-epoch report for the same collection
|
|
38
|
+
* returns the read's value as-is.
|
|
39
|
+
*
|
|
40
|
+
* @param options {object}
|
|
41
|
+
* @param options.collectionId {string}
|
|
42
|
+
* @param options.read {function} the read, reporting `unknownEpoch`
|
|
43
|
+
* @returns {Promise<T>} the (possibly re-read) value
|
|
44
|
+
*/
|
|
45
|
+
async readWithRefresh({ collectionId, read }) {
|
|
46
|
+
const first = await read();
|
|
47
|
+
if (first.unknownEpoch && this.shouldRefresh({ collectionId })) {
|
|
48
|
+
this.#refreshed.add(collectionId);
|
|
49
|
+
await this.#refresh({ collectionId });
|
|
50
|
+
return (await read()).value;
|
|
51
|
+
}
|
|
52
|
+
return first.value;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Re-arms the guard -- for one collection, or (with no argument) for all.
|
|
56
|
+
* Call when a fresh descriptor is installed by some other path (a share,
|
|
57
|
+
* unshare, or recipient rotation this session performed itself), since the
|
|
58
|
+
* next unknown-epoch read is then evidence of a NEW rotation elsewhere.
|
|
59
|
+
*/
|
|
60
|
+
reset(options) {
|
|
61
|
+
if (options?.collectionId === undefined) {
|
|
62
|
+
this.#refreshed.clear();
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this.#refreshed.delete(options.collectionId);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../src/edv/refresh.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH,MAAM,OAAO,uBAAuB;IACzB,QAAQ,CAAsD;IACvE,kEAAkE;IACzD,UAAU,GAAG,IAAI,GAAG,EAAU,CAAA;IAEvC,YAAY,EACV,OAAO,EAGR;QACC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,EAA4B;QACtD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IAC3C,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,eAAe,CAAI,EACvB,YAAY,EACZ,IAAI,EAIL;QACC,MAAM,KAAK,GAAG,MAAM,IAAI,EAAE,CAAA;QAC1B,IAAI,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;YAC/D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;YACjC,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;YACrC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,KAAK,CAAA;QAC7B,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAA;IACpB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAmC;QACvC,IAAI,OAAO,EAAE,YAAY,KAAK,SAAS,EAAE,CAAC;YACxC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* A self-refreshing EDV document cipher: `createEdvDocCipher` bound to
|
|
6
|
+
* descriptor acquisition and the once-per-session refresh rule, for a host
|
|
7
|
+
* whose decrypt seam is the cipher itself (a sync engine's `decryptDoc`, a
|
|
8
|
+
* conflict resolver) rather than a row-scanning store.
|
|
9
|
+
*
|
|
10
|
+
* Built, the cipher acquires the collection's descriptor (fetch, cache the
|
|
11
|
+
* success, cached fallback whenever the fetch yields none -- see
|
|
12
|
+
* `acquire.ts`) and constructs the underlying EDV cipher from it; with no
|
|
13
|
+
* descriptor, or a descriptor with no epochs, the build refuses fail-closed
|
|
14
|
+
* (every encrypted collection's descriptor carries an epoch roster from
|
|
15
|
+
* provisioning, so the absence can only mean the install has not landed or
|
|
16
|
+
* the host is lying). When a decrypt throws
|
|
17
|
+
* `UnknownEpochError`, the cipher re-acquires the descriptor, rebuilds itself,
|
|
18
|
+
* and retries that decrypt exactly once -- and only once per cipher instance,
|
|
19
|
+
* which the host scopes to one `(profile, collection)` session by dropping
|
|
20
|
+
* its cipher cache when the session ends. A second failure (or any unknown
|
|
21
|
+
* epoch after the one refresh is spent) propagates. A refresh that itself
|
|
22
|
+
* fails does not count as spent -- the original `UnknownEpochError` is
|
|
23
|
+
* rethrown and a later decrypt may try again.
|
|
24
|
+
*
|
|
25
|
+
* Only `UnknownEpochError` drives that refresh, and by design. The client
|
|
26
|
+
* splits the two ways a decrypt can find no key: an epoch the descriptor does
|
|
27
|
+
* not list at all raises `UnknownEpochError`, because a fresher descriptor may
|
|
28
|
+
* well list it; an epoch the descriptor does list but this reader holds no key
|
|
29
|
+
* for raises `KeyUnwrapError` (never a recipient, or removed and the epoch
|
|
30
|
+
* rotated). The second is rethrown immediately, with the refresh left
|
|
31
|
+
* untouched, since re-reading the same descriptor cannot produce a key the
|
|
32
|
+
* reader was not given.
|
|
33
|
+
*/
|
|
34
|
+
import type { IKeyAgreementKey, IKeyResolver } from '@interop/data-integrity-core';
|
|
35
|
+
import { type DocCipher } from './docCipher.js';
|
|
36
|
+
import { type EncryptionDescriptorCache, type EncryptionDescriptorSource } from './acquire.js';
|
|
37
|
+
/**
|
|
38
|
+
* Builds a {@link DocCipher} whose descriptor is acquired through the
|
|
39
|
+
* source/cache seams and refreshed (once per instance) on an unknown-epoch
|
|
40
|
+
* decrypt.
|
|
41
|
+
*
|
|
42
|
+
* With no `source` the descriptor is served from the cache alone and the
|
|
43
|
+
* refresh path is inert (an unknown-epoch decrypt propagates immediately) --
|
|
44
|
+
* the shape for a purely local code path that must never touch the network.
|
|
45
|
+
*
|
|
46
|
+
* @param options {object}
|
|
47
|
+
* @param options.keyAgreementKey {IKeyAgreementKey} the vault key pair this
|
|
48
|
+
* collection's envelopes are sealed to
|
|
49
|
+
* @param options.keyResolver {IKeyResolver}
|
|
50
|
+
* @param options.collectionId {string}
|
|
51
|
+
* @param [options.idDerivation] {'content' | 'random'} defaults to
|
|
52
|
+
* `'content'`
|
|
53
|
+
* @param [options.source] {EncryptionDescriptorSource}
|
|
54
|
+
* @param options.cache {EncryptionDescriptorCache}
|
|
55
|
+
* @param [options.onFetchError] {function} observes swallowed
|
|
56
|
+
* descriptor-fetch failures
|
|
57
|
+
* @returns {Promise<DocCipher>}
|
|
58
|
+
*/
|
|
59
|
+
export declare function createRefreshingEdvDocCipher({ keyAgreementKey, keyResolver, collectionId, idDerivation, source, cache, onFetchError }: {
|
|
60
|
+
keyAgreementKey: IKeyAgreementKey;
|
|
61
|
+
keyResolver: IKeyResolver;
|
|
62
|
+
collectionId: string;
|
|
63
|
+
idDerivation?: 'content' | 'random';
|
|
64
|
+
source?: EncryptionDescriptorSource;
|
|
65
|
+
cache: EncryptionDescriptorCache;
|
|
66
|
+
onFetchError?: (err: unknown, info: {
|
|
67
|
+
collectionId: string;
|
|
68
|
+
}) => void;
|
|
69
|
+
}): Promise<DocCipher>;
|
|
70
|
+
//# sourceMappingURL=refreshingDocCipher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refreshingDocCipher.d.ts","sourceRoot":"","sources":["../../src/edv/refreshingDocCipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,4BAA4B,CAAC,EACjD,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,KAAK,EACL,YAAY,EACb,EAAE;IACD,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IACnC,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,SAAS,CAAC,CAyFrB"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { UnknownEpochError } from '../errors.js';
|
|
2
|
+
import { createEdvDocCipher } from './docCipher.js';
|
|
3
|
+
import { acquireDescriptor } from './acquire.js';
|
|
4
|
+
/**
|
|
5
|
+
* Builds a {@link DocCipher} whose descriptor is acquired through the
|
|
6
|
+
* source/cache seams and refreshed (once per instance) on an unknown-epoch
|
|
7
|
+
* decrypt.
|
|
8
|
+
*
|
|
9
|
+
* With no `source` the descriptor is served from the cache alone and the
|
|
10
|
+
* refresh path is inert (an unknown-epoch decrypt propagates immediately) --
|
|
11
|
+
* the shape for a purely local code path that must never touch the network.
|
|
12
|
+
*
|
|
13
|
+
* @param options {object}
|
|
14
|
+
* @param options.keyAgreementKey {IKeyAgreementKey} the vault key pair this
|
|
15
|
+
* collection's envelopes are sealed to
|
|
16
|
+
* @param options.keyResolver {IKeyResolver}
|
|
17
|
+
* @param options.collectionId {string}
|
|
18
|
+
* @param [options.idDerivation] {'content' | 'random'} defaults to
|
|
19
|
+
* `'content'`
|
|
20
|
+
* @param [options.source] {EncryptionDescriptorSource}
|
|
21
|
+
* @param options.cache {EncryptionDescriptorCache}
|
|
22
|
+
* @param [options.onFetchError] {function} observes swallowed
|
|
23
|
+
* descriptor-fetch failures
|
|
24
|
+
* @returns {Promise<DocCipher>}
|
|
25
|
+
*/
|
|
26
|
+
export async function createRefreshingEdvDocCipher({ keyAgreementKey, keyResolver, collectionId, idDerivation, source, cache, onFetchError }) {
|
|
27
|
+
const build = async () => {
|
|
28
|
+
const encryption = await acquireDescriptor({
|
|
29
|
+
source,
|
|
30
|
+
cache,
|
|
31
|
+
collectionId,
|
|
32
|
+
onFetchError
|
|
33
|
+
});
|
|
34
|
+
if (!encryption) {
|
|
35
|
+
throw new Error(`Collection "${collectionId}" has no encryption descriptor available ` +
|
|
36
|
+
'(fetched or cached). Every encrypted collection carries its key ' +
|
|
37
|
+
'epochs from provisioning; refusing to build a cipher without them.');
|
|
38
|
+
}
|
|
39
|
+
return createEdvDocCipher({
|
|
40
|
+
keyAgreementKey,
|
|
41
|
+
keyResolver,
|
|
42
|
+
collectionId,
|
|
43
|
+
idDerivation,
|
|
44
|
+
encryption
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
let inner = await build();
|
|
48
|
+
// The one descriptor refresh this cipher instance (= this collection this
|
|
49
|
+
// session) may spend, shared so concurrent unknown-epoch decrypts ride a
|
|
50
|
+
// single re-read instead of each spending one.
|
|
51
|
+
let refreshed = null;
|
|
52
|
+
return {
|
|
53
|
+
encrypt: options => inner.encrypt(options),
|
|
54
|
+
encryptUpdate: options => {
|
|
55
|
+
if (!inner.encryptUpdate) {
|
|
56
|
+
throw new Error(`Collection "${collectionId}" cipher has no in-place update.`);
|
|
57
|
+
}
|
|
58
|
+
return inner.encryptUpdate(options);
|
|
59
|
+
},
|
|
60
|
+
async decrypt({ envelope }) {
|
|
61
|
+
try {
|
|
62
|
+
return await inner.decrypt({ envelope });
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
// `instanceof` is safe here and only here: `inner` is built in this
|
|
66
|
+
// package by `createEdvDocCipher`, which raises this package's own
|
|
67
|
+
// class, so no injected seam is crossed. A caller classifying what
|
|
68
|
+
// THIS cipher throws is crossing one, and uses `isUnknownEpochError` /
|
|
69
|
+
// `isKeyUnwrapError` instead.
|
|
70
|
+
if (!(err instanceof UnknownEpochError) || !source) {
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
if (!refreshed) {
|
|
74
|
+
const attempt = build().then(cipher => {
|
|
75
|
+
inner = cipher;
|
|
76
|
+
});
|
|
77
|
+
refreshed = attempt;
|
|
78
|
+
// Only a COMPLETED refresh is spent. A rejected one (the description
|
|
79
|
+
// could not be read and no cached copy answered either) un-arms the
|
|
80
|
+
// guard so a later unknown-epoch decrypt may try again; a successful
|
|
81
|
+
// refresh that still cannot route the envelope stays spent for the
|
|
82
|
+
// session, which is what keeps a genuinely foreign envelope from
|
|
83
|
+
// driving a refetch loop.
|
|
84
|
+
attempt.catch(() => {
|
|
85
|
+
if (refreshed === attempt) {
|
|
86
|
+
refreshed = null;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
await refreshed;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// The refresh failed, so nothing was learned about this envelope's
|
|
95
|
+
// epoch: surface the original UnknownEpochError rather than the
|
|
96
|
+
// build failure, so callers classifying on it (the create-loss
|
|
97
|
+
// re-mint) still see the row they exist to repair.
|
|
98
|
+
throw err;
|
|
99
|
+
}
|
|
100
|
+
// One retry under the swapped cipher. If the refresh was already
|
|
101
|
+
// spent before this decrypt began, this re-attempt is a local
|
|
102
|
+
// no-network decrypt that fails the same way -- so a genuinely
|
|
103
|
+
// foreign envelope still surfaces UnknownEpochError, and never a
|
|
104
|
+
// second description read.
|
|
105
|
+
return inner.decrypt({ envelope });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=refreshingDocCipher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refreshingDocCipher.js","sourceRoot":"","sources":["../../src/edv/refreshingDocCipher.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAkB,MAAM,gBAAgB,CAAA;AACnE,OAAO,EACL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD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AAiB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;oBACnD,MAAM,GAAG,CAAA;gBACX,CAAC;gBACD,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;wBACpC,KAAK,GAAG,MAAM,CAAA;oBAChB,CAAC,CAAC,CAAA;oBACF,SAAS,GAAG,OAAO,CAAA;oBACnB,qEAAqE;oBACrE,oEAAoE;oBACpE,qEAAqE;oBACrE,mEAAmE;oBACnE,iEAAiE;oBACjE,0BAA0B;oBAC1B,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;wBACjB,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;4BAC1B,SAAS,GAAG,IAAI,CAAA;wBAClB,CAAC;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC;gBACD,IAAI,CAAC;oBACH,MAAM,SAAS,CAAA;gBACjB,CAAC;gBAAC,MAAM,CAAC;oBACP,mEAAmE;oBACnE,gEAAgE;oBAChE,+DAA+D;oBAC/D,mDAAmD;oBACnD,MAAM,GAAG,CAAA;gBACX,CAAC;gBACD,iEAAiE;gBACjE,8DAA8D;gBAC9D,+DAA+D;gBAC/D,iEAAiE;gBACjE,2BAA2B;gBAC3B,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;YACpC,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -174,9 +174,10 @@ export declare class WasSyncConflictError extends PreconditionFailedError {
|
|
|
174
174
|
constructor(message?: string, options?: WasErrorOptions);
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
|
-
* The replication-port signal for a delete
|
|
178
|
-
* (HTTP 404). For a delete this is a settled outcome
|
|
179
|
-
* never reached the server)
|
|
177
|
+
* The replication-port signal for a delete or a metadata write whose target
|
|
178
|
+
* resource is absent (HTTP 404). For a delete this is a settled outcome
|
|
179
|
+
* (already gone, or the write never reached the server); for a metadata write
|
|
180
|
+
* it is a race with a remote delete. Neither is a conflict, so a `WasSyncPort`
|
|
180
181
|
* (`@interop/was-client/sync`) raises this distinct type rather than
|
|
181
182
|
* {@link WasSyncConflictError}. A subtype of {@link NotFoundError}.
|
|
182
183
|
*/
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;gBAEP,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAU3D;AAED;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IAChC,IAAI,SAAkB;CAChC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAClC,IAAI,SAAoB;CAClC;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IACpC,IAAI,SAAsB;CACpC;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;IACtC,IAAI,SAAwB;CACtC;AAED;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IACpC,IA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EACtD,OAAO,GAAE,eAAoB;CAKhC;AAED;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;gBAEnD,OAAO,SAA4B,EACnC,OAAO,GAAE,eAAoB;CAKhC;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB;gBACzC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAO1D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IACjC,IAAI,SAAmB;CACjC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,EACV,YAAY,EACZ,IAAI,EACL,EAAE;QACD,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,EAAE,CAAA;KACf;CAUF;AA8DD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAG3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CA2D/C"}
|
package/dist/errors.js
CHANGED
|
@@ -180,9 +180,10 @@ export class WasSyncConflictError extends PreconditionFailedError {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
|
-
* The replication-port signal for a delete
|
|
184
|
-
* (HTTP 404). For a delete this is a settled outcome
|
|
185
|
-
* never reached the server)
|
|
183
|
+
* The replication-port signal for a delete or a metadata write whose target
|
|
184
|
+
* resource is absent (HTTP 404). For a delete this is a settled outcome
|
|
185
|
+
* (already gone, or the write never reached the server); for a metadata write
|
|
186
|
+
* it is a race with a remote delete. Neither is a conflict, so a `WasSyncPort`
|
|
186
187
|
* (`@interop/was-client/sync`) raises this distinct type rather than
|
|
187
188
|
* {@link WasSyncConflictError}. A subtype of {@link NotFoundError}.
|
|
188
189
|
*/
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAmBpD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAS;IACf,IAAI,CAAS;IACb,KAAK,CAAS;IACd,OAAO,CAAW;IAClB,UAAU,CAAS;IAEnB,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;QACnE,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAC3D,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAQ;IAChC,IAAI,GAAG,eAAe,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAClC,IAAI,GAAG,iBAAiB,CAAA;CAClC;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IACpC,IAAI,GAAG,mBAAmB,CAAA;CACpC;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IACtC,IAAI,G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
|
|
@@ -208,5 +208,18 @@ export declare function storedResponse(body: unknown): ResponseLike;
|
|
|
208
208
|
* @returns {Promise<Json | Blob | null>}
|
|
209
209
|
*/
|
|
210
210
|
export declare function parseResource(response: HttpResponse | null): Promise<Json | Blob | null>;
|
|
211
|
+
/**
|
|
212
|
+
* Projects a decoded resource value (the `Json | Blob` a codec's `decode`
|
|
213
|
+
* produces, shaped by {@link parseResource}'s content-type rule) to its text
|
|
214
|
+
* body -- the inverse of that rule, kept beside it so the two change together.
|
|
215
|
+
* A `Blob` (any non-JSON content type, or an encrypted text-family payload)
|
|
216
|
+
* reads as UTF-8 text; a parsed JSON value is re-serialized, matching the
|
|
217
|
+
* `Resource.getText()` contract (semantically identical JSON, not guaranteed
|
|
218
|
+
* byte-identical).
|
|
219
|
+
*
|
|
220
|
+
* @param value {Json | Blob}
|
|
221
|
+
* @returns {Promise<string>}
|
|
222
|
+
*/
|
|
223
|
+
export declare function decodedText(value: Json | Blob): Promise<string>;
|
|
211
224
|
export {};
|
|
212
225
|
//# sourceMappingURL=content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/internal/content.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/internal/content.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAIrD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,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,MAAM,CAAA;CAAE,CAiCnE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,GAAG;IAC9D,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CA4BA;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,GAAG,MAAM,CAE/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAIrE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAE3E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAM1D;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,YAAY,GAAG,IAAI,GAC5B,OAAO,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAS7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAErE"}
|
package/dist/internal/content.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { blobText } from './blob.js';
|
|
1
2
|
import { ValidationError, WasServerError } from '../errors.js';
|
|
2
3
|
const OCTET_STREAM = 'application/octet-stream';
|
|
3
4
|
/**
|
|
@@ -326,4 +327,19 @@ export async function parseResource(response) {
|
|
|
326
327
|
}
|
|
327
328
|
return response.blob();
|
|
328
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* Projects a decoded resource value (the `Json | Blob` a codec's `decode`
|
|
332
|
+
* produces, shaped by {@link parseResource}'s content-type rule) to its text
|
|
333
|
+
* body -- the inverse of that rule, kept beside it so the two change together.
|
|
334
|
+
* A `Blob` (any non-JSON content type, or an encrypted text-family payload)
|
|
335
|
+
* reads as UTF-8 text; a parsed JSON value is re-serialized, matching the
|
|
336
|
+
* `Resource.getText()` contract (semantically identical JSON, not guaranteed
|
|
337
|
+
* byte-identical).
|
|
338
|
+
*
|
|
339
|
+
* @param value {Json | Blob}
|
|
340
|
+
* @returns {Promise<string>}
|
|
341
|
+
*/
|
|
342
|
+
export async function decodedText(value) {
|
|
343
|
+
return isBlob(value) ? blobText(value) : JSON.stringify(value);
|
|
344
|
+
}
|
|
329
345
|
//# sourceMappingURL=content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/internal/content.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG9D,MAAM,YAAY,GAAG,0BAA0B,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAExC;;;;;;;;;;;;GAYG;AACH,SAAS,iBAAiB,CAAC,WAAmB;IAC5C,OAAO,4CAA4C,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AACvE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,MAAM,IAAI,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACnE,OAAO,CACL,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACxB,IAAI,KAAK,iBAAi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,QAAQ,CAAC,IAAI,EAAE,CAAA;AACxB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAkB;IAClD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAChE,CAAC"}
|
|
@@ -12,10 +12,24 @@
|
|
|
12
12
|
* lives here too: it is the one inclusion rule for the writable description
|
|
13
13
|
* fields, shared by every path that builds a description body.
|
|
14
14
|
*/
|
|
15
|
-
import type { HttpResponse } from '@interop/http-client';
|
|
16
15
|
import type { ClientContext } from './request.js';
|
|
17
16
|
import type { WasError } from '../errors.js';
|
|
18
|
-
import type { CollectionDescription, CollectionWritableFields, IZcap } from '../types.js';
|
|
17
|
+
import type { CollectionDescription, CollectionEncryption, CollectionWritableFields, IZcap } from '../types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Whether a served encryption descriptor is the server-derived projection of
|
|
20
|
+
* a Collection governed by its history log (it carries the `history` pointer)
|
|
21
|
+
* rather than a client-written descriptor. The one place this distinction is
|
|
22
|
+
* drawn, shared by provisioning and the log-governed descriptor store.
|
|
23
|
+
*
|
|
24
|
+
* @param descriptor {CollectionEncryption}
|
|
25
|
+
* @returns {boolean}
|
|
26
|
+
*/
|
|
27
|
+
export declare function isGovernedDescriptor(descriptor: CollectionEncryption): descriptor is CollectionEncryption & {
|
|
28
|
+
history: {
|
|
29
|
+
method: string;
|
|
30
|
+
resource: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
19
33
|
/**
|
|
20
34
|
* Picks the writable Collection Description fields that are set. The one
|
|
21
35
|
* inclusion rule (`!== undefined`) behind every description body -- the
|
|
@@ -27,25 +41,6 @@ import type { CollectionDescription, CollectionWritableFields, IZcap } from '../
|
|
|
27
41
|
* @returns {CollectionWritableFields}
|
|
28
42
|
*/
|
|
29
43
|
export declare function collectionWritableFields(fields: CollectionWritableFields): CollectionWritableFields;
|
|
30
|
-
/**
|
|
31
|
-
* Sends the Collection Description GET, returning the raw response -- or
|
|
32
|
-
* `null` if the collection is missing or not visible to you (WAS returns 404
|
|
33
|
-
* for both not-found and unauthorized). The one request shape shared by
|
|
34
|
-
* {@link describeCollection} and `Collection.describeWithEtag` (which also
|
|
35
|
-
* needs the response's `ETag` header).
|
|
36
|
-
*
|
|
37
|
-
* @param context {ClientContext}
|
|
38
|
-
* @param options {object}
|
|
39
|
-
* @param options.spaceId {string}
|
|
40
|
-
* @param options.collectionId {string}
|
|
41
|
-
* @param [options.capability] {IZcap} capability attached to the request
|
|
42
|
-
* @returns {Promise<HttpResponse | null>}
|
|
43
|
-
*/
|
|
44
|
-
export declare function describeCollectionResponse(context: ClientContext, { spaceId, collectionId, capability }: {
|
|
45
|
-
spaceId: string;
|
|
46
|
-
collectionId: string;
|
|
47
|
-
capability?: IZcap;
|
|
48
|
-
}): Promise<HttpResponse | null>;
|
|
49
44
|
/**
|
|
50
45
|
* Reads the Collection Description. Returns `null` if the collection is missing
|
|
51
46
|
* or not visible to you (WAS returns 404 for both not-found and unauthorized).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,EACN,MAAM,aAAa,CAAA;AAEpB;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,oBAAoB,GAC/B,UAAU,IAAI,oBAAoB,GAAG;IACtC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAC9C,CAEA;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,wBAAwB,CAU1B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACrE,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAKvC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,WAAW,EACX,MAAM,EACN,UAA4B,EAC7B,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAA;CAC/C,GAAG,QAAQ,CAQX"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { dataOrNull } from './content.js';
|
|
1
|
+
import { readData } from './request.js';
|
|
3
2
|
import { collectionPath } from './paths.js';
|
|
4
3
|
import { ValidationError } from '../errors.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether a served encryption descriptor is the server-derived projection of
|
|
6
|
+
* a Collection governed by its history log (it carries the `history` pointer)
|
|
7
|
+
* rather than a client-written descriptor. The one place this distinction is
|
|
8
|
+
* drawn, shared by provisioning and the log-governed descriptor store.
|
|
9
|
+
*
|
|
10
|
+
* @param descriptor {CollectionEncryption}
|
|
11
|
+
* @returns {boolean}
|
|
12
|
+
*/
|
|
13
|
+
export function isGovernedDescriptor(descriptor) {
|
|
14
|
+
return descriptor.history !== undefined;
|
|
15
|
+
}
|
|
5
16
|
/**
|
|
6
17
|
* Picks the writable Collection Description fields that are set. The one
|
|
7
18
|
* inclusion rule (`!== undefined`) behind every description body -- the
|
|
@@ -23,28 +34,6 @@ export function collectionWritableFields(fields) {
|
|
|
23
34
|
})
|
|
24
35
|
};
|
|
25
36
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Sends the Collection Description GET, returning the raw response -- or
|
|
28
|
-
* `null` if the collection is missing or not visible to you (WAS returns 404
|
|
29
|
-
* for both not-found and unauthorized). The one request shape shared by
|
|
30
|
-
* {@link describeCollection} and `Collection.describeWithEtag` (which also
|
|
31
|
-
* needs the response's `ETag` header).
|
|
32
|
-
*
|
|
33
|
-
* @param context {ClientContext}
|
|
34
|
-
* @param options {object}
|
|
35
|
-
* @param options.spaceId {string}
|
|
36
|
-
* @param options.collectionId {string}
|
|
37
|
-
* @param [options.capability] {IZcap} capability attached to the request
|
|
38
|
-
* @returns {Promise<HttpResponse | null>}
|
|
39
|
-
*/
|
|
40
|
-
export async function describeCollectionResponse(context, { spaceId, collectionId, capability }) {
|
|
41
|
-
return send(context, {
|
|
42
|
-
path: collectionPath(spaceId, collectionId),
|
|
43
|
-
method: 'GET',
|
|
44
|
-
capability,
|
|
45
|
-
read: true
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
37
|
/**
|
|
49
38
|
* Reads the Collection Description. Returns `null` if the collection is missing
|
|
50
39
|
* or not visible to you (WAS returns 404 for both not-found and unauthorized).
|
|
@@ -57,7 +46,10 @@ export async function describeCollectionResponse(context, { spaceId, collectionI
|
|
|
57
46
|
* @returns {Promise<CollectionDescription | null>}
|
|
58
47
|
*/
|
|
59
48
|
export async function describeCollection(context, options) {
|
|
60
|
-
return
|
|
49
|
+
return readData(context, {
|
|
50
|
+
path: collectionPath(options.spaceId, options.collectionId),
|
|
51
|
+
capability: options.capability
|
|
52
|
+
});
|
|
61
53
|
}
|
|
62
54
|
/**
|
|
63
55
|
* Builds the fail-closed error for an operation that needs a description it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAS9C;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAgC;IAIhC,OAAO,UAAU,CAAC,OAAO,KAAK,SAAS,CAAA;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAgC;IAEhC,OAAO;QACL,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QACvD,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QAChE,GAAG,CAAC,MAAM,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;QACzE,GAAG,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;QACtE,GAAG,CAAC,MAAM,CAAC,eAAe,KAAK,SAAS,IAAI;YAC1C,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC,CAAC;KACH,CAAA;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAsB,EACtB,OAAsE;IAEtE,OA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