@interop/was-client 0.51.0 → 0.52.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 +23 -0
- package/dist/Collection.d.ts +19 -2
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +89 -53
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.js +2 -2
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +15 -11
- package/dist/Space.js.map +1 -1
- package/dist/codec.d.ts +54 -12
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +9 -8
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +65 -33
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/descriptorStore.d.ts.map +1 -1
- package/dist/edv/descriptorStore.js +2 -0
- package/dist/edv/descriptorStore.js.map +1 -1
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +1 -1
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/index.d.ts +2 -0
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +1 -0
- package/dist/edv/index.js.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.d.ts +164 -0
- package/dist/edv/logGovernedDescriptorStore.d.ts.map +1 -0
- package/dist/edv/logGovernedDescriptorStore.js +476 -0
- package/dist/edv/logGovernedDescriptorStore.js.map +1 -0
- package/dist/edv/recipients.d.ts.map +1 -1
- package/dist/edv/recipients.js +25 -82
- package/dist/edv/recipients.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/cas.d.ts +95 -0
- package/dist/internal/cas.d.ts.map +1 -0
- package/dist/internal/cas.js +116 -0
- package/dist/internal/cas.js.map +1 -0
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +6 -6
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/meta.d.ts +9 -9
- package/dist/internal/meta.d.ts.map +1 -1
- package/dist/internal/meta.js +13 -14
- package/dist/internal/meta.js.map +1 -1
- package/dist/log/logStore.d.ts +8 -5
- package/dist/log/logStore.d.ts.map +1 -1
- package/dist/log/logStore.js +22 -10
- package/dist/log/logStore.js.map +1 -1
- package/dist/sync/provisioning.d.ts.map +1 -1
- package/dist/sync/provisioning.js +49 -14
- package/dist/sync/provisioning.js.map +1 -1
- package/dist/types.d.ts +11 -12
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/internal/meta.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Shared `/meta` I/O for the Collection and Resource handles. The two read and
|
|
6
6
|
* write the same metadata document shape and differ only in the metadata type,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* the `/meta` slot the `custom` envelope is bound to, and whether the codec's
|
|
8
|
+
* key epoch travels in the PUT body. Each handle wraps these with its
|
|
9
9
|
* own JSDoc.
|
|
10
10
|
*/
|
|
11
11
|
import { WasServerError } from '../errors.js';
|
|
@@ -24,12 +24,12 @@ import { withCodec } from './withCodec.js';
|
|
|
24
24
|
* concurrently with the read
|
|
25
25
|
* @param options.subject {string} the metadata's owner as it reads in the
|
|
26
26
|
* malformed-response error message
|
|
27
|
-
* @param
|
|
28
|
-
*
|
|
27
|
+
* @param options.slot {MetaReadSlot} the `/meta` slot being read, for an
|
|
28
|
+
* encrypting codec's envelope-binding check
|
|
29
29
|
* @param [options.capability] {IZcap}
|
|
30
30
|
* @returns {Promise<(Metadata & { etag?: string }) | null>}
|
|
31
31
|
*/
|
|
32
|
-
export async function readMeta(context, { metaPath, codec: codecPromise, subject,
|
|
32
|
+
export async function readMeta(context, { metaPath, codec: codecPromise, subject, slot, capability }) {
|
|
33
33
|
// The metadata GET does not depend on the codec (only its `custom` decode
|
|
34
34
|
// below does), so the two overlap.
|
|
35
35
|
const [codec, response] = await withCodec(codecPromise, send(context, {
|
|
@@ -55,11 +55,10 @@ export async function readMeta(context, { metaPath, codec: codecPromise, subject
|
|
|
55
55
|
}
|
|
56
56
|
const metadata = response.data;
|
|
57
57
|
// Decode the user-writable `custom` (decrypting it on an encrypted
|
|
58
|
-
// collection) so callers uniformly see plaintext `{ name, tags }`.
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
const custom = await codec.decodeMeta({ custom: metadata.custom }, id);
|
|
58
|
+
// collection) so callers uniformly see plaintext `{ name, tags }`. The
|
|
59
|
+
// stated slot drives the encrypting codec's binding check: in the
|
|
60
|
+
// Collection slot it refuses a resource-bound envelope served there.
|
|
61
|
+
const custom = await codec.decodeMeta({ custom: metadata.custom }, slot);
|
|
63
62
|
const decoded = { ...metadata, custom };
|
|
64
63
|
const etag = readEtag(response);
|
|
65
64
|
return etag !== undefined ? { ...decoded, etag } : decoded;
|
|
@@ -80,16 +79,16 @@ export async function readMeta(context, { metaPath, codec: codecPromise, subject
|
|
|
80
79
|
* stamp describes the `custom` envelope itself; false at Resource level,
|
|
81
80
|
* where a Resource's epoch instead stamps its content write via the
|
|
82
81
|
* `Key-Epoch` header, so an epoch surfaced here is deliberately dropped.
|
|
83
|
-
* @param
|
|
84
|
-
*
|
|
82
|
+
* @param options.slot {MetaWriteSlot} the `/meta` slot being written, which
|
|
83
|
+
* an encrypting codec binds into the envelope
|
|
85
84
|
* @param [options.ifMatch] {string} update only if the `/meta` ETag matches
|
|
86
85
|
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
87
86
|
* @param [options.capability] {IZcap}
|
|
88
87
|
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
89
88
|
*/
|
|
90
|
-
export async function writeMeta(context, { metaPath, codec: codecPromise, custom, sendEpoch,
|
|
89
|
+
export async function writeMeta(context, { metaPath, codec: codecPromise, custom, sendEpoch, slot, ifMatch, ifNoneMatch, capability }) {
|
|
91
90
|
const codec = await codecPromise;
|
|
92
|
-
const { custom: encoded, epoch } = await codec.encodeMeta(
|
|
91
|
+
const { custom: encoded, epoch } = await codec.encodeMeta({ custom, slot });
|
|
93
92
|
const response = await send(context, {
|
|
94
93
|
path: metaPath,
|
|
95
94
|
method: 'PUT',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/internal/meta.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAO1C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAG5B,OAAsB,EACtB,EACE,QAAQ,EACR,KAAK,EAAE,YAAY,EACnB,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/internal/meta.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAO1C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAG5B,OAAsB,EACtB,EACE,QAAQ,EACR,KAAK,EAAE,YAAY,EACnB,OAAO,EACP,IAAI,EACJ,UAAU,EAOX;IAED,0EAA0E;IAC1E,mCAAmC;IACnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,MAAM,SAAS,CACvC,YAAY,EACZ,IAAI,CAAC,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AM,YAAY,CAAA;IAChC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IAC3E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;QACnC,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,KAAK;QACb,UAAU;QACV,yEAAyE;QACzE,oEAAoE;QACpE,0EAA0E;QAC1E,0EAA0E;QAC1E,sEAAsE;QACtE,6CAA6C;QAC7C,IAAI,EACF,SAAS,IAAI,KAAK,KAAK,SAAS;YAC9B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE;YAC5B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE;QACzB,OAAO,EAAE,YAAY,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC;KAClE,CAAC,CAAA;IACF,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;AACrC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAMC,EACD,KAA6B;IAE7B,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;IACnC,MAAM,MAAM,CAAC,OAAO,CAClB,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,EAC5C,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAC3B,CAAA;AACH,CAAC"}
|
package/dist/log/logStore.d.ts
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
* create against a log that already exists -- is rethrown as the library's
|
|
27
27
|
* `ResourceLogConflictError` with the transport's `PreconditionFailedError`
|
|
28
28
|
* as `cause`, which is the port's one conflict signal and what the library's
|
|
29
|
-
* rebase loop catches (by `name
|
|
30
|
-
* adapter-to-library package boundary).
|
|
29
|
+
* rebase loop catches (by `name` rather than `instanceof`, since the error
|
|
30
|
+
* crosses the adapter-to-library package boundary).
|
|
31
31
|
*/
|
|
32
32
|
import { type ResourceLogStore } from '@interop/vh-resource-log';
|
|
33
33
|
import type { Collection } from '../Collection.js';
|
|
@@ -39,13 +39,16 @@ export { LOG_CONTENT_TYPE };
|
|
|
39
39
|
* one of two hosts: `resource`, a WAS Resource whose whole body is the log,
|
|
40
40
|
* or `collection`, whose governing history log at `/meta/log` is the log.
|
|
41
41
|
* `append` carries the prior entries' bytes forward verbatim from the most
|
|
42
|
-
* recent read (an append
|
|
43
|
-
* `create` translate the transport's 412 into the library's conflict
|
|
42
|
+
* recent read (an append does not re-serialize history), and both `append`
|
|
43
|
+
* and `create` translate the transport's 412 into the library's conflict
|
|
44
|
+
* error. A served log with an empty body reads as absent (the pre-genesis
|
|
45
|
+
* `null`), the state a host that has no log for the slot should report as
|
|
46
|
+
* 404; under a held pin the library still refuses it as a rollback.
|
|
44
47
|
*
|
|
45
48
|
* @param options {object}
|
|
46
49
|
* @param [options.resource] {Resource} the Resource holding the log
|
|
47
50
|
* @param [options.collection] {Collection} the Collection whose history log
|
|
48
|
-
* is the log; exactly one of the two is given
|
|
51
|
+
* is the log; exactly one of the two is given, or `ValidationError`
|
|
49
52
|
* @returns {ResourceLogStore}
|
|
50
53
|
*/
|
|
51
54
|
export declare function resourceLogStore(options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logStore.d.ts","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG9C,OAAO,EAAW,gBAAgB,EAAU,MAAM,wBAAwB,CAAA;AAE1E,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAqE3B
|
|
1
|
+
{"version":3,"file":"logStore.d.ts","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG9C,OAAO,EAAW,gBAAgB,EAAU,MAAM,wBAAwB,CAAA;AAE1E,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAqE3B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EACH;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAA;CAAE,GAC9C;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GACnD,gBAAgB,CA0FlB"}
|
package/dist/log/logStore.js
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
* create against a log that already exists -- is rethrown as the library's
|
|
27
27
|
* `ResourceLogConflictError` with the transport's `PreconditionFailedError`
|
|
28
28
|
* as `cause`, which is the port's one conflict signal and what the library's
|
|
29
|
-
* rebase loop catches (by `name
|
|
30
|
-
* adapter-to-library package boundary).
|
|
29
|
+
* rebase loop catches (by `name` rather than `instanceof`, since the error
|
|
30
|
+
* crosses the adapter-to-library package boundary).
|
|
31
31
|
*/
|
|
32
32
|
import { ResourceLogConflictError, parseResourceLog, serializeResourceLog, serializeResourceLogEntry } from '@interop/vh-resource-log';
|
|
33
33
|
import { PreconditionFailedError, ValidationError } from '../errors.js';
|
|
@@ -89,28 +89,40 @@ function collectionTarget(collection) {
|
|
|
89
89
|
* one of two hosts: `resource`, a WAS Resource whose whole body is the log,
|
|
90
90
|
* or `collection`, whose governing history log at `/meta/log` is the log.
|
|
91
91
|
* `append` carries the prior entries' bytes forward verbatim from the most
|
|
92
|
-
* recent read (an append
|
|
93
|
-
* `create` translate the transport's 412 into the library's conflict
|
|
92
|
+
* recent read (an append does not re-serialize history), and both `append`
|
|
93
|
+
* and `create` translate the transport's 412 into the library's conflict
|
|
94
|
+
* error. A served log with an empty body reads as absent (the pre-genesis
|
|
95
|
+
* `null`), the state a host that has no log for the slot should report as
|
|
96
|
+
* 404; under a held pin the library still refuses it as a rollback.
|
|
94
97
|
*
|
|
95
98
|
* @param options {object}
|
|
96
99
|
* @param [options.resource] {Resource} the Resource holding the log
|
|
97
100
|
* @param [options.collection] {Collection} the Collection whose history log
|
|
98
|
-
* is the log; exactly one of the two is given
|
|
101
|
+
* is the log; exactly one of the two is given, or `ValidationError`
|
|
99
102
|
* @returns {ResourceLogStore}
|
|
100
103
|
*/
|
|
101
104
|
export function resourceLogStore(options) {
|
|
105
|
+
if (options.resource !== undefined && options.collection !== undefined) {
|
|
106
|
+
throw new ValidationError('Pass either `resource` (the Resource holding the log) or ' +
|
|
107
|
+
'`collection` (the Collection whose history log is the log), not both.');
|
|
108
|
+
}
|
|
109
|
+
if (options.resource === undefined && options.collection === undefined) {
|
|
110
|
+
throw new ValidationError('A resource log store needs its host: pass `resource` or `collection`.');
|
|
111
|
+
}
|
|
102
112
|
const target = options.resource !== undefined
|
|
103
113
|
? resourceTarget(options.resource)
|
|
104
114
|
: collectionTarget(options.collection);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
/**
|
|
116
|
+
* The raw body observed by the most recent read; an append extends these
|
|
117
|
+
* bytes verbatim instead of re-serializing the parsed entries. Safe to carry
|
|
118
|
+
* even if stale: the append is pinned to the same read's ETag, so a
|
|
119
|
+
* concurrent append fails the CAS instead.
|
|
120
|
+
*/
|
|
109
121
|
let lastReadBody;
|
|
110
122
|
return {
|
|
111
123
|
async read() {
|
|
112
124
|
const current = await target.read();
|
|
113
|
-
if (current === null) {
|
|
125
|
+
if (current === null || current.body === '') {
|
|
114
126
|
return null;
|
|
115
127
|
}
|
|
116
128
|
const entries = parseResourceLog(current.body);
|
package/dist/log/logStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logStore.js","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EAE1B,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAE1E,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAe3B;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAC,QAAkB;IACxC,OAAO;QACL,KAAK,CAAC,IAAI;YACR,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAA;YAC5C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAA;YACb,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC/B,CAAC,CAAC,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC9B,CAAC,CAAC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;oBAChC,CAAC,CAAC,OAAO,CAAC,IAAI;oBACd,CAAC,CAAC,SAAS,CAAA;YACf,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC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SAAS,GAAG,yBAAyB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;YACpE,MAAM,aAAa,CAAC;gBAClB,IAAI,EAAE,QAAQ;gBACd,YAAY,EAAE,EAAE,OAAO,EAAE;gBACzB,QAAQ,EACN,+DAA+D;oBAC/D,WAAW;aACd,CAAC,CAAA;YACF,YAAY,GAAG,QAAQ,CAAA;QACzB,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,KAAK;YAChB,MAAM,UAAU,GAAG,oBAAoB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;YAChD,MAAM,aAAa,CAAC;gBAClB,IAAI,EAAE,UAAU;gBAChB,YAAY,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;gBACnC,QAAQ,EACN,4DAA4D;oBAC5D,iBAAiB;aACpB,CAAC,CAAA;YACF,YAAY,GAAG,UAAU,CAAA;QAC3B,CAAC;KACF,CAAA;IAED;;;;;;OAMG;IACH,KAAK,UAAU,aAAa,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,QAAQ,EAKT;QACC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;QACtC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,uBAAuB,EAAE,CAAC;gBAC3C,MAAM,IAAI,wBAAwB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;YAC9D,CAAC;YACD,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisioning.d.ts","sourceRoot":"","sources":["../../src/sync/provisioning.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"provisioning.d.ts","sourceRoot":"","sources":["../../src/sync/provisioning.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAuChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,GAAG,EACH,OAAO,EACP,aAAa,EACb,YAAY,EACZ,UAAkB,EAClB,QAAgB,EAChB,SAA8B,EAC9B,cAA6B,EAC7B,gBAAgB,EACjB,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFhB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,WAAW,CAAC,EAChC,GAAG,EACH,OAAO,EACP,aAAa,EACb,SAA8B,EAC/B,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqB5B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// sync module does not pull the EDV crypto graph for one number.
|
|
3
3
|
import { EDV_SCHEME_VERSION } from '../edv/constants.js';
|
|
4
4
|
import { ValidationError, WasError } from '../errors.js';
|
|
5
|
+
import { compareAndSwap } from '../internal/cas.js';
|
|
5
6
|
/**
|
|
6
7
|
* The Space display name applied at creation when the caller names none.
|
|
7
8
|
*/
|
|
@@ -91,25 +92,56 @@ export async function ensureSpaceAndCollection({ was, spaceId, controllerDid, co
|
|
|
91
92
|
}
|
|
92
93
|
try {
|
|
93
94
|
const collection = space.collection(collectionId);
|
|
94
|
-
const
|
|
95
|
+
const read = await collection.describeWithEtag();
|
|
96
|
+
const current = read?.description ?? null;
|
|
95
97
|
if (current === null) {
|
|
98
|
+
// The create deliberately does not thread the `null` just read into
|
|
99
|
+
// `configure`: neither endpoint honors a create-if-absent precondition
|
|
100
|
+
// yet, so the re-read inside `configure` is the narrowest window
|
|
101
|
+
// available against a rival create landing in between (it would lose
|
|
102
|
+
// its `backend` to a merge from a stale `null`). This branch runs once
|
|
103
|
+
// per collection, so the extra request is a cold-path cost only.
|
|
96
104
|
await collection.configure(encryption === 'edv'
|
|
97
|
-
? {
|
|
98
|
-
|
|
99
|
-
current,
|
|
100
|
-
encryption: EDV_DESCRIPTOR
|
|
101
|
-
}
|
|
102
|
-
: { name: collectionName, current, force: true });
|
|
105
|
+
? { name: collectionName, encryption: EDV_DESCRIPTOR }
|
|
106
|
+
: { name: collectionName, force: true });
|
|
103
107
|
}
|
|
104
108
|
else if (encryption === 'edv' && current.encryption === undefined) {
|
|
105
109
|
// The late in-place declaration: adding a descriptor to a collection
|
|
106
110
|
// that lacks one is allowed (set-once), while re-sending one over an
|
|
107
111
|
// existing descriptor would drop its appended key epochs -- which is
|
|
108
|
-
// exactly why an existing descriptor is never touched.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
// exactly why an existing descriptor is never touched. The write is
|
|
113
|
+
// compare-and-swapped against the description just read, so a rival
|
|
114
|
+
// declaration landing in between is re-read and adopted as-is rather
|
|
115
|
+
// than tripping `encryption-immutable` or being overwritten.
|
|
116
|
+
let reusable = read;
|
|
117
|
+
await compareAndSwap({
|
|
118
|
+
store: {
|
|
119
|
+
read: async () => {
|
|
120
|
+
const latest = reusable !== null ? reusable : await collection.describeWithEtag();
|
|
121
|
+
reusable = null;
|
|
122
|
+
if (latest === null) {
|
|
123
|
+
throw new ValidationError(`Collection "${collectionId}" in space "${spaceId}" vanished ` +
|
|
124
|
+
'while its encryption was being declared.');
|
|
125
|
+
}
|
|
126
|
+
return { value: latest.description, etag: latest.etag };
|
|
127
|
+
},
|
|
128
|
+
// Replace semantics: every writable field is carried forward.
|
|
129
|
+
replace: async (next, { ifMatch }) => {
|
|
130
|
+
await collection.replaceDescription({
|
|
131
|
+
name: next.name,
|
|
132
|
+
backend: next.backend,
|
|
133
|
+
encryption: next.encryption
|
|
134
|
+
}, { ifMatch });
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
operation: 'Encryption declaration',
|
|
138
|
+
mutate: latest => latest.encryption === undefined
|
|
139
|
+
? {
|
|
140
|
+
...latest,
|
|
141
|
+
name: latest.name ?? collectionName,
|
|
142
|
+
encryption: EDV_DESCRIPTOR
|
|
143
|
+
}
|
|
144
|
+
: null
|
|
113
145
|
});
|
|
114
146
|
}
|
|
115
147
|
if (isPublic && !(await collection.isPublic())) {
|
|
@@ -149,10 +181,13 @@ export async function ensureSpace({ was, spaceId, controllerDid, spaceName = DEF
|
|
|
149
181
|
if (current !== null) {
|
|
150
182
|
return current;
|
|
151
183
|
}
|
|
184
|
+
// The create does not thread the `null` just read into `configure` (same
|
|
185
|
+
// reasoning as the collection create in `ensureSpaceAndCollection`): a
|
|
186
|
+
// Space created concurrently in the window would lose its `type` array,
|
|
187
|
+
// which the server accepts at creation only. Once per Space, cold path.
|
|
152
188
|
return await space.configure({
|
|
153
189
|
name: spaceName,
|
|
154
|
-
controller: controllerDid
|
|
155
|
-
current
|
|
190
|
+
controller: controllerDid
|
|
156
191
|
});
|
|
157
192
|
}
|
|
158
193
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisioning.js","sourceRoot":"","sources":["../../src/sync/provisioning.ts"],"names":[],"mappings":"AAoB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;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAChC,GAAG,EACH,OAAO,EACP,aAAa,EACb,SAAS,GAAG,kBAAkB,EAM/B;IACC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAA;QACtC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,yEAAyE;QACzE,uEAAuE;QACvE,wEAAwE;QACxE,wEAAwE;QACxE,OAAO,MAAM,KAAK,CAAC,SAAS,CAAC;YAC3B,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,aAAa;SAC1B,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,0BAA0B,CACxB,GAAG,EACH,kCAAkC,OAAO,UAAU,aAAa,IAAI,CACrE,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -136,23 +136,22 @@ export interface FindPage {
|
|
|
136
136
|
* path that takes precedence over the Collection's declared `encryption`
|
|
137
137
|
* descriptor AND skips the descriptor-discovery round-trip:
|
|
138
138
|
*
|
|
139
|
-
* - `
|
|
140
|
-
* keys from the client's keystore.
|
|
141
|
-
*
|
|
142
|
-
* `{ scheme: 'edv' }` is refused fail-closed: routing needs the
|
|
143
|
-
* roster).
|
|
144
|
-
* -
|
|
145
|
-
* core; the encryption provider interprets it per
|
|
146
|
-
* keystore.
|
|
139
|
+
* - a `CollectionEncryption` descriptor -- treat the collection as encrypted
|
|
140
|
+
* under it, pulling keys from the client's keystore. The descriptor is
|
|
141
|
+
* forwarded whole to the provider, so pass the full epoch-bearing form (a
|
|
142
|
+
* bare `{ scheme: 'edv' }` is refused fail-closed: routing needs the
|
|
143
|
+
* key-epoch roster).
|
|
144
|
+
* - the same descriptor with `keys` -- additionally supply the key material
|
|
145
|
+
* inline (opaque to core; the encryption provider interprets it per
|
|
146
|
+
* `scheme`) instead of the keystore.
|
|
147
147
|
* - `'plaintext'` -- force plaintext even if a descriptor / keystore would encrypt.
|
|
148
148
|
*
|
|
149
149
|
* The non-`'plaintext'` forms require the `WasClient` to be constructed with an
|
|
150
|
-
* `encryption` provider (which turns a
|
|
150
|
+
* `encryption` provider (which turns a descriptor + keys into a codec).
|
|
151
151
|
*/
|
|
152
|
-
export type EncryptionOverride = {
|
|
153
|
-
scheme: string;
|
|
152
|
+
export type EncryptionOverride = (CollectionEncryption & {
|
|
154
153
|
keys?: unknown;
|
|
155
|
-
} | 'plaintext';
|
|
154
|
+
}) | 'plaintext';
|
|
156
155
|
/**
|
|
157
156
|
* Options accepted by every handle factory (`space()`, `collection()`,
|
|
158
157
|
* `resource()`). A bound `capability` is attached to every request the handle
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,KAAK,EACL,cAAc,EACd,SAAS,EACV,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAE/D;;;;;GAKG;AACH,YAAY,EACV,MAAM,EACN,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,cAAc,EACd,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ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