@interop/was-client 0.99.1 → 0.100.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -69
- package/dist/Collection.d.ts +17 -9
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +85 -70
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +11 -4
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +34 -28
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +20 -5
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +69 -65
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +185 -57
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +340 -140
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +3 -2
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +1 -1
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +7 -4
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +39 -20
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/acquire.d.ts +3 -3
- package/dist/edv/acquire.d.ts.map +1 -1
- package/dist/edv/acquire.js +3 -3
- package/dist/edv/acquire.js.map +1 -1
- package/dist/edv/cipher.d.ts +1 -1
- package/dist/edv/cipher.js +1 -1
- package/dist/edv/docCipher.d.ts +6 -5
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +6 -5
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/encryption.d.ts +2 -2
- package/dist/edv/encryption.d.ts.map +1 -1
- package/dist/edv/encryption.js +8 -6
- package/dist/edv/encryption.js.map +1 -1
- package/dist/edv/refreshingDocCipher.d.ts +3 -3
- package/dist/edv/refreshingDocCipher.d.ts.map +1 -1
- package/dist/edv/refreshingDocCipher.js +3 -3
- package/dist/edv/refreshingDocCipher.js.map +1 -1
- package/dist/edv/transportFactory.d.ts +3 -3
- package/dist/edv/transportFactory.d.ts.map +1 -1
- package/dist/edv/transportFactory.js +3 -3
- package/dist/edv/transportFactory.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/codec.d.ts +7 -7
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +19 -18
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/conditional.d.ts +3 -3
- package/dist/internal/conditional.d.ts.map +1 -1
- package/dist/internal/conditional.js +5 -5
- package/dist/internal/conditional.js.map +1 -1
- package/dist/internal/grant.d.ts +15 -26
- package/dist/internal/grant.d.ts.map +1 -1
- package/dist/internal/grant.js +95 -29
- package/dist/internal/grant.js.map +1 -1
- package/dist/internal/meta.d.ts +8 -8
- package/dist/internal/meta.d.ts.map +1 -1
- package/dist/internal/meta.js +13 -10
- package/dist/internal/meta.js.map +1 -1
- package/dist/internal/paths.d.ts +423 -195
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +582 -369
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/policy.d.ts +23 -23
- package/dist/internal/policy.d.ts.map +1 -1
- package/dist/internal/policy.js +20 -20
- package/dist/internal/policy.js.map +1 -1
- package/dist/internal/request.d.ts +17 -21
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +10 -21
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/reserved.d.ts +15 -3
- package/dist/internal/reserved.d.ts.map +1 -1
- package/dist/internal/reserved.js +37 -8
- package/dist/internal/reserved.js.map +1 -1
- package/dist/internal/revoke.d.ts +34 -13
- package/dist/internal/revoke.d.ts.map +1 -1
- package/dist/internal/revoke.js +97 -28
- package/dist/internal/revoke.js.map +1 -1
- package/dist/internal/service.d.ts +27 -7
- package/dist/internal/service.d.ts.map +1 -1
- package/dist/internal/service.js +51 -45
- package/dist/internal/service.js.map +1 -1
- package/dist/internal/write.d.ts +18 -18
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +27 -27
- package/dist/internal/write.js.map +1 -1
- package/dist/paths.d.ts +32 -25
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +32 -25
- package/dist/paths.js.map +1 -1
- package/dist/sync/port.d.ts +3 -3
- package/dist/sync/port.d.ts.map +1 -1
- package/dist/sync/port.js +12 -12
- package/dist/sync/port.js.map +1 -1
- package/dist/sync/provisioning.d.ts +10 -9
- package/dist/sync/provisioning.d.ts.map +1 -1
- package/dist/sync/provisioning.js +19 -18
- package/dist/sync/provisioning.js.map +1 -1
- package/dist/sync/types.d.ts +2 -2
- package/dist/types.d.ts +13 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/Resource.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { canonicalSpaceUrl, resourceUrl, resourcePolicyUrl, resourceMetaUrl } from './internal/paths.js';
|
|
2
2
|
import { assertNotReserved } from './internal/reserved.js';
|
|
3
3
|
import { send } from './internal/request.js';
|
|
4
4
|
import { collectionCodecHolder } from './internal/codec.js';
|
|
@@ -24,9 +24,16 @@ function preParsedJson(response) {
|
|
|
24
24
|
return response.data !== undefined ? JSON.stringify(response.data) : undefined;
|
|
25
25
|
}
|
|
26
26
|
export class Resource {
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The URL of the Space this Resource lives in, in canonical form.
|
|
29
|
+
*/
|
|
30
|
+
spaceUrl;
|
|
28
31
|
collectionId;
|
|
29
32
|
id;
|
|
33
|
+
/**
|
|
34
|
+
* The Resource's absolute URL (no trailing slash): get / put / delete.
|
|
35
|
+
*/
|
|
36
|
+
url;
|
|
30
37
|
#context;
|
|
31
38
|
#capability;
|
|
32
39
|
/**
|
|
@@ -51,7 +58,7 @@ export class Resource {
|
|
|
51
58
|
/**
|
|
52
59
|
* @param options {object}
|
|
53
60
|
* @param options.context {ClientContext}
|
|
54
|
-
* @param options.
|
|
61
|
+
* @param options.spaceUrl {string} the Space's URL, as the server named it
|
|
55
62
|
* @param options.collectionId {string}
|
|
56
63
|
* @param options.resourceId {string}
|
|
57
64
|
* @param [options.capability] {IZcap} capability attached to every request
|
|
@@ -63,27 +70,33 @@ export class Resource {
|
|
|
63
70
|
* override for a standalone resource (ignored when `codec` is supplied --
|
|
64
71
|
* the shared parent codec wins)
|
|
65
72
|
*/
|
|
66
|
-
constructor({ context,
|
|
73
|
+
constructor({ context, spaceUrl, collectionId, resourceId, capability, codec, encryption }) {
|
|
67
74
|
// Guard the id against the Reserved Path Segment Registry up front, so a
|
|
68
75
|
// reserved id from caller input can never be mis-targeted at a
|
|
69
|
-
// collection-level endpoint. `
|
|
70
|
-
// byte-identical to the collection policy
|
|
76
|
+
// collection-level endpoint. `resourceUrl` of `'policy'` is
|
|
77
|
+
// byte-identical to the collection policy URL, so an unguarded
|
|
71
78
|
// `resource('policy').delete()` would silently wipe the collection's
|
|
72
79
|
// access-control policy; the same collision exists for `backend` / `quota`
|
|
73
80
|
// / `linkset` / `meta`. Guarding in the constructor covers every operation
|
|
74
81
|
// (read, delete, meta, policy, put), not just writes.
|
|
75
82
|
assertNotReserved({ id: resourceId, kind: 'resource' });
|
|
76
83
|
this.#context = context;
|
|
77
|
-
this.
|
|
84
|
+
this.spaceUrl = canonicalSpaceUrl(spaceUrl);
|
|
78
85
|
this.collectionId = collectionId;
|
|
79
86
|
this.id = resourceId;
|
|
87
|
+
// Every URL this handle addresses is derived once: `spaceUrl` is
|
|
88
|
+
// canonical already, so the builders have nothing left to normalize.
|
|
89
|
+
const beneath = { spaceUrl: this.spaceUrl, collectionId, resourceId };
|
|
90
|
+
this.url = resourceUrl(beneath);
|
|
91
|
+
this.#metaUrl = resourceMetaUrl(beneath);
|
|
92
|
+
this.#policyUrl = resourcePolicyUrl(beneath);
|
|
80
93
|
this.#capability = capability;
|
|
81
94
|
if (codec) {
|
|
82
95
|
this.#codec = codec;
|
|
83
96
|
}
|
|
84
97
|
else {
|
|
85
98
|
const holder = collectionCodecHolder(context, {
|
|
86
|
-
|
|
99
|
+
spaceUrl: this.spaceUrl,
|
|
87
100
|
collectionId,
|
|
88
101
|
override: encryption,
|
|
89
102
|
capability
|
|
@@ -91,9 +104,6 @@ export class Resource {
|
|
|
91
104
|
this.#codec = () => holder.get();
|
|
92
105
|
}
|
|
93
106
|
}
|
|
94
|
-
get #path() {
|
|
95
|
-
return resourcePath(this.spaceId, this.collectionId, this.id);
|
|
96
|
-
}
|
|
97
107
|
/**
|
|
98
108
|
* The signed-request context handed to a codec that drives its own I/O (the
|
|
99
109
|
* EDV codec reading a chunked blob back), bound to this handle's capability.
|
|
@@ -113,7 +123,7 @@ export class Resource {
|
|
|
113
123
|
*/
|
|
114
124
|
async #read() {
|
|
115
125
|
return send(this.#context, {
|
|
116
|
-
|
|
126
|
+
url: this.url,
|
|
117
127
|
method: 'GET',
|
|
118
128
|
capability: this.#capability,
|
|
119
129
|
read: true
|
|
@@ -279,7 +289,7 @@ export class Resource {
|
|
|
279
289
|
async put(data, options = {}) {
|
|
280
290
|
const codec = await this.#codec();
|
|
281
291
|
return await upsertResource(this.#context, {
|
|
282
|
-
|
|
292
|
+
url: this.url,
|
|
283
293
|
codec,
|
|
284
294
|
id: this.id,
|
|
285
295
|
data,
|
|
@@ -302,7 +312,7 @@ export class Resource {
|
|
|
302
312
|
*/
|
|
303
313
|
async delete(options = {}) {
|
|
304
314
|
await send(this.#context, {
|
|
305
|
-
|
|
315
|
+
url: this.url,
|
|
306
316
|
method: 'DELETE',
|
|
307
317
|
capability: this.#capability,
|
|
308
318
|
// A conditional delete is not idempotent: a stale `If-Match` must surface
|
|
@@ -311,9 +321,7 @@ export class Resource {
|
|
|
311
321
|
headers: writeHeaders({ precondition: { ifMatch: options.ifMatch } })
|
|
312
322
|
});
|
|
313
323
|
}
|
|
314
|
-
|
|
315
|
-
return resourceMeta(this.spaceId, this.collectionId, this.id);
|
|
316
|
-
}
|
|
324
|
+
#metaUrl;
|
|
317
325
|
/**
|
|
318
326
|
* Reads the resource's metadata object (server-managed `contentType` / `size`
|
|
319
327
|
* / timestamps plus the user-writable `custom` object). Returns `null` if the
|
|
@@ -338,7 +346,7 @@ export class Resource {
|
|
|
338
346
|
*/
|
|
339
347
|
async meta() {
|
|
340
348
|
return readMeta(this.#context, {
|
|
341
|
-
|
|
349
|
+
metaUrl: this.#metaUrl,
|
|
342
350
|
codec: this.#codec(),
|
|
343
351
|
subject: `"${this.id}"`,
|
|
344
352
|
slot: { kind: 'resource', id: this.id },
|
|
@@ -373,7 +381,7 @@ export class Resource {
|
|
|
373
381
|
*/
|
|
374
382
|
async setMeta(meta = {}, options = {}) {
|
|
375
383
|
return writeMeta(this.#context, {
|
|
376
|
-
|
|
384
|
+
metaUrl: this.#metaUrl,
|
|
377
385
|
codec: this.#codec(),
|
|
378
386
|
custom: meta.custom ?? {},
|
|
379
387
|
slot: { kind: 'resource', id: this.id },
|
|
@@ -405,9 +413,7 @@ export class Resource {
|
|
|
405
413
|
async setTags(tags) {
|
|
406
414
|
return patchCustom(this, { tags }, { create: true });
|
|
407
415
|
}
|
|
408
|
-
|
|
409
|
-
return resourcePolicy(this.spaceId, this.collectionId, this.id);
|
|
410
|
-
}
|
|
416
|
+
#policyUrl;
|
|
411
417
|
/**
|
|
412
418
|
* Reads the resource's access-control policy. Returns `null` when no policy is
|
|
413
419
|
* set (or it is not visible to you). Managing a policy is a controller-level
|
|
@@ -421,7 +427,7 @@ export class Resource {
|
|
|
421
427
|
*/
|
|
422
428
|
async getPolicy() {
|
|
423
429
|
return readPolicy(this.#context, {
|
|
424
|
-
|
|
430
|
+
policyUrl: this.#policyUrl,
|
|
425
431
|
capability: this.#capability
|
|
426
432
|
});
|
|
427
433
|
}
|
|
@@ -437,7 +443,7 @@ export class Resource {
|
|
|
437
443
|
*/
|
|
438
444
|
async getPolicyWithEtag() {
|
|
439
445
|
return readPolicyWithEtag(this.#context, {
|
|
440
|
-
|
|
446
|
+
policyUrl: this.#policyUrl,
|
|
441
447
|
capability: this.#capability
|
|
442
448
|
});
|
|
443
449
|
}
|
|
@@ -458,7 +464,7 @@ export class Resource {
|
|
|
458
464
|
*/
|
|
459
465
|
async setPolicy(policy, { ifMatch, ifNoneMatch } = {}) {
|
|
460
466
|
return writePolicy(this.#context, {
|
|
461
|
-
|
|
467
|
+
policyUrl: this.#policyUrl,
|
|
462
468
|
policy,
|
|
463
469
|
ifMatch,
|
|
464
470
|
ifNoneMatch,
|
|
@@ -477,7 +483,7 @@ export class Resource {
|
|
|
477
483
|
*/
|
|
478
484
|
async setPublic({ ifMatch, ifNoneMatch } = {}) {
|
|
479
485
|
return setPublicPolicy(this.#context, {
|
|
480
|
-
|
|
486
|
+
policyUrl: this.#policyUrl,
|
|
481
487
|
ifMatch,
|
|
482
488
|
ifNoneMatch,
|
|
483
489
|
capability: this.#capability
|
|
@@ -492,7 +498,7 @@ export class Resource {
|
|
|
492
498
|
*/
|
|
493
499
|
async isPublic() {
|
|
494
500
|
return isPublicPolicy(this.#context, {
|
|
495
|
-
|
|
501
|
+
policyUrl: this.#policyUrl,
|
|
496
502
|
capability: this.#capability
|
|
497
503
|
});
|
|
498
504
|
}
|
|
@@ -511,7 +517,7 @@ export class Resource {
|
|
|
511
517
|
*/
|
|
512
518
|
async clearPolicy({ ifMatch } = {}) {
|
|
513
519
|
return deletePolicy(this.#context, {
|
|
514
|
-
|
|
520
|
+
policyUrl: this.#policyUrl,
|
|
515
521
|
ifMatch,
|
|
516
522
|
capability: this.#capability
|
|
517
523
|
});
|
package/dist/Resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AASA,OAAO,
|
|
1
|
+
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AASA,OAAO,EACL,iBAAiB,EACjB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I,CAAC,UAAU;YAC1B,OAAO;YACP,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/Space.d.ts
CHANGED
|
@@ -4,18 +4,33 @@ import { Collection } from './Collection.js';
|
|
|
4
4
|
import type { BackendDescriptor, BackendReference, BackendRegistration, CollectionEncryption, CollectionGenerator, CollectionMetadata, CollectionsList, EncryptionOverride, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, ImportStats, LinkSet, PolicyDocument, ReplicaListing, ReplicaRegistration, ReplicaStatus, SpaceMetadata, SpaceQuotaReport } from './types.js';
|
|
5
5
|
export declare class Space {
|
|
6
6
|
#private;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The Space's absolute URL in canonical (trailing-slash) form, as the
|
|
9
|
+
* server named it: the URL whose `GET` lists the Space's Collections, whose
|
|
10
|
+
* `POST` creates one, and whose `DELETE` removes the Space. It is also the
|
|
11
|
+
* target the Space's root capability names, so a grant prefilled from it
|
|
12
|
+
* covers the whole Space by prefix -- `meta` and every Collection included.
|
|
13
|
+
*/
|
|
14
|
+
readonly url: string;
|
|
15
|
+
/**
|
|
16
|
+
* The Space's id: the last path segment of {@link url}, the value the Space
|
|
17
|
+
* Metadata object's `id` carries. `undefined` for a single fixed Space
|
|
18
|
+
* served from an origin root, which has no id.
|
|
19
|
+
*/
|
|
20
|
+
readonly id: string | undefined;
|
|
8
21
|
/**
|
|
9
22
|
* @param options {object}
|
|
10
23
|
* @param options.context {ClientContext}
|
|
11
|
-
* @param options.
|
|
24
|
+
* @param options.spaceUrl {string} the Space's absolute URL, as the
|
|
25
|
+
* server named it; canonicalized (see `canonicalSpaceUrl`)
|
|
12
26
|
* @param [options.capability] {IZcap} capability attached to every request
|
|
13
27
|
* @param [options.encryption] {EncryptionOverride} default encryption
|
|
14
28
|
* override for the Collections reached through this handle
|
|
29
|
+
* @throws {ValidationError} when `spaceUrl` is not a Space URL
|
|
15
30
|
*/
|
|
16
|
-
constructor({ context,
|
|
31
|
+
constructor({ context, spaceUrl, capability, encryption }: {
|
|
17
32
|
context: ClientContext;
|
|
18
|
-
|
|
33
|
+
spaceUrl: string;
|
|
19
34
|
capability?: IZcap;
|
|
20
35
|
encryption?: EncryptionOverride;
|
|
21
36
|
});
|
|
@@ -160,7 +175,7 @@ export declare class Space {
|
|
|
160
175
|
* with its own prior discovery may read it as absence.
|
|
161
176
|
*
|
|
162
177
|
* The capability is the one the handle was opened with
|
|
163
|
-
* (`was.
|
|
178
|
+
* (`was.spaceAt(url, { capability })`), so a delegated DELETE-only capability
|
|
164
179
|
* is supplied by opening the handle with it.
|
|
165
180
|
*
|
|
166
181
|
* @returns {Promise<{ outcome: 'deleted' | 'not-found' }>}
|
package/dist/Space.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAiBlE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,EACL,WAAW,EACX,OAAO,EACP,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EACjB,MAAM,YAAY,CAAA;AAyGnB,qBAAa,KAAK;;IAChB;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,QA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