@interop/was-client 0.9.2 → 0.11.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 +32 -4
- package/dist/Collection.d.ts +49 -10
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +161 -61
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +41 -12
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +87 -54
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +1 -0
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +24 -27
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +43 -2
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +90 -14
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +48 -9
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +96 -37
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +245 -90
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +6 -12
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +6 -21
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/constants.d.ts +30 -0
- package/dist/edv/constants.d.ts.map +1 -0
- package/dist/edv/constants.js +30 -0
- package/dist/edv/constants.js.map +1 -0
- package/dist/edv/index.d.ts +1 -1
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +1 -1
- package/dist/edv/index.js.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -5
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/codec.d.ts +71 -5
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +102 -7
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/content.d.ts +74 -3
- package/dist/internal/content.d.ts.map +1 -1
- package/dist/internal/content.js +78 -7
- package/dist/internal/content.js.map +1 -1
- package/dist/internal/describe.d.ts.map +1 -1
- package/dist/internal/describe.js +2 -1
- package/dist/internal/describe.js.map +1 -1
- package/dist/internal/pagination.d.ts +45 -0
- package/dist/internal/pagination.d.ts.map +1 -0
- package/dist/internal/pagination.js +53 -0
- package/dist/internal/pagination.js.map +1 -0
- package/dist/internal/paths.d.ts +4 -0
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +10 -1
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/policy.d.ts +54 -0
- package/dist/internal/policy.d.ts.map +1 -0
- package/dist/internal/policy.js +58 -0
- package/dist/internal/policy.js.map +1 -0
- package/dist/internal/request.d.ts +4 -2
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +9 -2
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/reserved.d.ts +3 -8
- package/dist/internal/reserved.d.ts.map +1 -1
- package/dist/internal/reserved.js +10 -20
- package/dist/internal/reserved.js.map +1 -1
- package/dist/internal/write.d.ts +37 -0
- package/dist/internal/write.d.ts.map +1 -0
- package/dist/internal/write.js +29 -0
- package/dist/internal/write.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/Resource.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientContext } from './internal/request.js';
|
|
2
2
|
import type { ResourceCodec } from './codec.js';
|
|
3
|
-
import type { EncryptionOverride, IZcap, Json, PolicyDocument, ResourceMetadata, ResourceMetadataCustom } from './types.js';
|
|
3
|
+
import type { EncryptionOverride, IZcap, Json, ResourceData, PolicyDocument, ResourceMetadata, ResourceMetadataCustom } from './types.js';
|
|
4
4
|
export declare class Resource {
|
|
5
5
|
readonly spaceId: string;
|
|
6
6
|
readonly collectionId: string;
|
|
@@ -9,7 +9,7 @@ export declare class Resource {
|
|
|
9
9
|
private readonly _capability?;
|
|
10
10
|
private readonly _codecThunk?;
|
|
11
11
|
private readonly _encryptionOverride?;
|
|
12
|
-
private
|
|
12
|
+
private readonly _codecHolder;
|
|
13
13
|
/**
|
|
14
14
|
* @param options {object}
|
|
15
15
|
* @param options.context {ClientContext}
|
|
@@ -42,7 +42,15 @@ export declare class Resource {
|
|
|
42
42
|
* standalone resource discovers its collection's `encryption` marker (one GET
|
|
43
43
|
* on the collection, cached per handle) unless a per-handle override is set,
|
|
44
44
|
* and fails closed if it cannot key an encrypted collection. A fresh
|
|
45
|
-
* standalone handle re-reads the marker, so retain the handle to reuse it.
|
|
45
|
+
* standalone handle re-reads the marker, so retain the handle to reuse it. A
|
|
46
|
+
* failed resolution (e.g. a transient 500/network error during marker
|
|
47
|
+
* discovery) is not memoized: the cache is cleared so the next call retries
|
|
48
|
+
* rather than re-throwing the stale error forever.
|
|
49
|
+
*
|
|
50
|
+
* A handle obtained via `collection.resource(id)` delegates to the parent's
|
|
51
|
+
* shared thunk on every call rather than memoizing locally: the parent already
|
|
52
|
+
* memoizes (so this adds no round-trip), and delegating lets a parent reset
|
|
53
|
+
* (e.g. after `configure()` adds the encryption marker) propagate here.
|
|
46
54
|
*
|
|
47
55
|
* @returns {Promise<ResourceCodec>}
|
|
48
56
|
*/
|
|
@@ -91,14 +99,14 @@ export declare class Resource {
|
|
|
91
99
|
* automatically by the codec (the EDV `sequence` becomes the enforced ETag), so
|
|
92
100
|
* the explicit options are for plaintext collections. Returns the new `etag`.
|
|
93
101
|
*
|
|
94
|
-
* @param data {
|
|
102
|
+
* @param data {ResourceData}
|
|
95
103
|
* @param options {object}
|
|
96
104
|
* @param [options.contentType] {string} content-type for binary data
|
|
97
105
|
* @param [options.ifMatch] {string} update only if the ETag matches
|
|
98
106
|
* @param [options.ifNoneMatch] {boolean} create only if absent
|
|
99
107
|
* @returns {Promise<{ etag?: string }>} the stored resource's new ETag
|
|
100
108
|
*/
|
|
101
|
-
put(data:
|
|
109
|
+
put(data: ResourceData, options?: {
|
|
102
110
|
contentType?: string;
|
|
103
111
|
ifMatch?: string;
|
|
104
112
|
ifNoneMatch?: boolean;
|
|
@@ -124,9 +132,14 @@ export declare class Resource {
|
|
|
124
132
|
* resource is missing or not visible to you (404 conflation caveat). A server
|
|
125
133
|
* without metadata support surfaces its 501 as `NotImplementedError`.
|
|
126
134
|
*
|
|
135
|
+
* On an encrypted collection the stored `custom` is an opaque envelope; this
|
|
136
|
+
* decodes it (decrypts, via the codec) so a caller always sees plaintext
|
|
137
|
+
* `{ name, tags }`. A resource with no user metadata reports `custom` as `{}`.
|
|
138
|
+
*
|
|
127
139
|
* Against a backend with the `conditional-writes` feature the result also
|
|
128
|
-
* carries the
|
|
129
|
-
* `
|
|
140
|
+
* carries the metadata's current `etag` (the `/meta` `metaVersion` validator)
|
|
141
|
+
* -- pass it as `setMeta(meta, { ifMatch })` for a lost-update-safe metadata
|
|
142
|
+
* update.
|
|
130
143
|
*
|
|
131
144
|
* @returns {Promise<(ResourceMetadata & { etag?: string }) | null>}
|
|
132
145
|
*/
|
|
@@ -140,17 +153,33 @@ export declare class Resource {
|
|
|
140
153
|
* metadata of a nonexistent resource throws `NotFoundError`. Servers without
|
|
141
154
|
* metadata support surface their 501 as `NotImplementedError`.
|
|
142
155
|
*
|
|
143
|
-
* On an encrypted collection
|
|
144
|
-
*
|
|
145
|
-
*
|
|
156
|
+
* On an encrypted collection `custom` is encrypted into an opaque envelope by
|
|
157
|
+
* the codec before it is sent, so `name` / `tags` are never stored as
|
|
158
|
+
* server-visible plaintext -- transparently, the same call works on plaintext
|
|
159
|
+
* and encrypted collections alike.
|
|
160
|
+
*
|
|
161
|
+
* Conditional metadata writes (the backend's `conditional-writes` feature):
|
|
162
|
+
* pass `ifMatch` (the `etag` from a prior `meta()`) for an
|
|
163
|
+
* update-if-unchanged, or `ifNoneMatch: true` for a write-only-if-no-metadata.
|
|
164
|
+
* A failed precondition throws `PreconditionFailedError` (412). The `/meta`
|
|
165
|
+
* ETag (`metaVersion`) is independent of the content ETag. Returns the new
|
|
166
|
+
* `etag`.
|
|
146
167
|
*
|
|
147
168
|
* @param meta {object}
|
|
148
169
|
* @param [meta.custom] {ResourceMetadataCustom} the user-writable properties
|
|
149
|
-
* @
|
|
170
|
+
* @param options {object}
|
|
171
|
+
* @param [options.ifMatch] {string} update only if the `/meta` ETag matches
|
|
172
|
+
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
173
|
+
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
150
174
|
*/
|
|
151
175
|
setMeta(meta?: {
|
|
152
176
|
custom?: ResourceMetadataCustom;
|
|
153
|
-
}
|
|
177
|
+
}, options?: {
|
|
178
|
+
ifMatch?: string;
|
|
179
|
+
ifNoneMatch?: boolean;
|
|
180
|
+
}): Promise<{
|
|
181
|
+
etag?: string;
|
|
182
|
+
}>;
|
|
154
183
|
/**
|
|
155
184
|
* Sets the resource's human-readable `name` (the value surfaced in collection
|
|
156
185
|
* listings), preserving any existing `tags`. Convenience over `setMeta()`.
|
package/dist/Resource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAU1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,YAAY,CAAA;AAEnB,qBAAa,QAAQ;IACnB,QAAQ,CAAC,OAAO,EAAE,M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"}
|
package/dist/Resource.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { resourcePath, resourcePolicy, resourceMeta } from './internal/paths.js';
|
|
2
2
|
import { assertNotReserved } from './internal/reserved.js';
|
|
3
3
|
import { send } from './internal/request.js';
|
|
4
|
-
import { resolveCodec } from './internal/codec.js';
|
|
5
|
-
import { describeCollection } from './internal/describe.js';
|
|
4
|
+
import { CodecHolder, resolveCodec, readCollectionMarker } from './internal/codec.js';
|
|
6
5
|
import { writeHeaders, readEtag } from './internal/conditional.js';
|
|
7
|
-
import {
|
|
6
|
+
import { sendEncodedWrite } from './internal/write.js';
|
|
7
|
+
import { readPolicy, writePolicy, deletePolicy } from './internal/policy.js';
|
|
8
8
|
export class Resource {
|
|
9
9
|
spaceId;
|
|
10
10
|
collectionId;
|
|
@@ -13,7 +13,7 @@ export class Resource {
|
|
|
13
13
|
_capability;
|
|
14
14
|
_codecThunk;
|
|
15
15
|
_encryptionOverride;
|
|
16
|
-
|
|
16
|
+
_codecHolder;
|
|
17
17
|
/**
|
|
18
18
|
* @param options {object}
|
|
19
19
|
* @param options.context {ClientContext}
|
|
@@ -30,6 +30,15 @@ export class Resource {
|
|
|
30
30
|
* the shared parent codec wins)
|
|
31
31
|
*/
|
|
32
32
|
constructor({ context, spaceId, collectionId, resourceId, capability, codec, encryption }) {
|
|
33
|
+
// Guard the id against the Reserved Path Segment Registry up front, so a
|
|
34
|
+
// reserved id from caller input can never be mis-targeted at a
|
|
35
|
+
// collection-level endpoint. `resourcePath(s, c, 'policy')` is byte-identical
|
|
36
|
+
// to the collection policy path, so an unguarded `resource('policy').delete()`
|
|
37
|
+
// would silently wipe the collection's access-control policy; the same
|
|
38
|
+
// collision exists for `backend` / `quota` / `linkset` / `meta`. Guarding in
|
|
39
|
+
// the constructor covers every operation (read, delete, meta, policy, put),
|
|
40
|
+
// not just writes.
|
|
41
|
+
assertNotReserved(resourceId, 'resource');
|
|
33
42
|
this._context = context;
|
|
34
43
|
this.spaceId = spaceId;
|
|
35
44
|
this.collectionId = collectionId;
|
|
@@ -37,6 +46,16 @@ export class Resource {
|
|
|
37
46
|
this._capability = capability;
|
|
38
47
|
this._codecThunk = codec;
|
|
39
48
|
this._encryptionOverride = encryption;
|
|
49
|
+
this._codecHolder = new CodecHolder(() => resolveCodec(this._context, {
|
|
50
|
+
spaceId: this.spaceId,
|
|
51
|
+
collectionId: this.collectionId,
|
|
52
|
+
override: this._encryptionOverride,
|
|
53
|
+
readMarker: () => readCollectionMarker(this._context, {
|
|
54
|
+
spaceId: this.spaceId,
|
|
55
|
+
collectionId: this.collectionId,
|
|
56
|
+
capability: this._capability
|
|
57
|
+
})
|
|
58
|
+
}));
|
|
40
59
|
}
|
|
41
60
|
get _path() {
|
|
42
61
|
return resourcePath(this.spaceId, this.collectionId, this.id);
|
|
@@ -48,23 +67,23 @@ export class Resource {
|
|
|
48
67
|
* standalone resource discovers its collection's `encryption` marker (one GET
|
|
49
68
|
* on the collection, cached per handle) unless a per-handle override is set,
|
|
50
69
|
* and fails closed if it cannot key an encrypted collection. A fresh
|
|
51
|
-
* standalone handle re-reads the marker, so retain the handle to reuse it.
|
|
70
|
+
* standalone handle re-reads the marker, so retain the handle to reuse it. A
|
|
71
|
+
* failed resolution (e.g. a transient 500/network error during marker
|
|
72
|
+
* discovery) is not memoized: the cache is cleared so the next call retries
|
|
73
|
+
* rather than re-throwing the stale error forever.
|
|
74
|
+
*
|
|
75
|
+
* A handle obtained via `collection.resource(id)` delegates to the parent's
|
|
76
|
+
* shared thunk on every call rather than memoizing locally: the parent already
|
|
77
|
+
* memoizes (so this adds no round-trip), and delegating lets a parent reset
|
|
78
|
+
* (e.g. after `configure()` adds the encryption marker) propagate here.
|
|
52
79
|
*
|
|
53
80
|
* @returns {Promise<ResourceCodec>}
|
|
54
81
|
*/
|
|
55
82
|
_codec() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
collectionId: this.collectionId,
|
|
61
|
-
override: this._encryptionOverride,
|
|
62
|
-
readMarker: async () => (await describeCollection(this._context, {
|
|
63
|
-
spaceId: this.spaceId,
|
|
64
|
-
collectionId: this.collectionId,
|
|
65
|
-
capability: this._capability
|
|
66
|
-
}))?.encryption
|
|
67
|
-
}));
|
|
83
|
+
if (this._codecThunk) {
|
|
84
|
+
return this._codecThunk();
|
|
85
|
+
}
|
|
86
|
+
return this._codecHolder.get();
|
|
68
87
|
}
|
|
69
88
|
/**
|
|
70
89
|
* Reads the resource, auto-parsing JSON to an object and returning binary as
|
|
@@ -138,7 +157,7 @@ export class Resource {
|
|
|
138
157
|
* automatically by the codec (the EDV `sequence` becomes the enforced ETag), so
|
|
139
158
|
* the explicit options are for plaintext collections. Returns the new `etag`.
|
|
140
159
|
*
|
|
141
|
-
* @param data {
|
|
160
|
+
* @param data {ResourceData}
|
|
142
161
|
* @param options {object}
|
|
143
162
|
* @param [options.contentType] {string} content-type for binary data
|
|
144
163
|
* @param [options.ifMatch] {string} update only if the ETag matches
|
|
@@ -146,7 +165,6 @@ export class Resource {
|
|
|
146
165
|
* @returns {Promise<{ etag?: string }>} the stored resource's new ETag
|
|
147
166
|
*/
|
|
148
167
|
async put(data, options = {}) {
|
|
149
|
-
assertNotReserved(this.id, 'resource');
|
|
150
168
|
const codec = await this._codec();
|
|
151
169
|
// A conditional codec (e.g. the EDV codec) needs the current stored envelope
|
|
152
170
|
// to advance its sequence and pin the write to the current ETag, so pre-read
|
|
@@ -171,13 +189,12 @@ export class Resource {
|
|
|
171
189
|
const precondition = codec.conditionalWrites
|
|
172
190
|
? { ifMatch: encoded.ifMatch, ifNoneMatch: encoded.ifNoneMatch }
|
|
173
191
|
: { ifMatch: options.ifMatch, ifNoneMatch: options.ifNoneMatch };
|
|
174
|
-
const response = await
|
|
192
|
+
const response = await sendEncodedWrite(this._context, {
|
|
175
193
|
path: this._path,
|
|
176
194
|
method: 'PUT',
|
|
177
195
|
capability: this._capability,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
headers: writeHeaders(encoded.contentType, precondition)
|
|
196
|
+
encoded,
|
|
197
|
+
precondition
|
|
181
198
|
});
|
|
182
199
|
return { etag: readEtag(response) };
|
|
183
200
|
}
|
|
@@ -210,13 +227,19 @@ export class Resource {
|
|
|
210
227
|
* resource is missing or not visible to you (404 conflation caveat). A server
|
|
211
228
|
* without metadata support surfaces its 501 as `NotImplementedError`.
|
|
212
229
|
*
|
|
230
|
+
* On an encrypted collection the stored `custom` is an opaque envelope; this
|
|
231
|
+
* decodes it (decrypts, via the codec) so a caller always sees plaintext
|
|
232
|
+
* `{ name, tags }`. A resource with no user metadata reports `custom` as `{}`.
|
|
233
|
+
*
|
|
213
234
|
* Against a backend with the `conditional-writes` feature the result also
|
|
214
|
-
* carries the
|
|
215
|
-
* `
|
|
235
|
+
* carries the metadata's current `etag` (the `/meta` `metaVersion` validator)
|
|
236
|
+
* -- pass it as `setMeta(meta, { ifMatch })` for a lost-update-safe metadata
|
|
237
|
+
* update.
|
|
216
238
|
*
|
|
217
239
|
* @returns {Promise<(ResourceMetadata & { etag?: string }) | null>}
|
|
218
240
|
*/
|
|
219
241
|
async meta() {
|
|
242
|
+
const codec = await this._codec();
|
|
220
243
|
const response = await send(this._context, {
|
|
221
244
|
path: this._metaPath,
|
|
222
245
|
method: 'GET',
|
|
@@ -227,8 +250,12 @@ export class Resource {
|
|
|
227
250
|
return null;
|
|
228
251
|
}
|
|
229
252
|
const metadata = response.data;
|
|
253
|
+
// Decode the user-writable `custom` (decrypting it on an encrypted
|
|
254
|
+
// collection) so callers uniformly see plaintext `{ name, tags }`.
|
|
255
|
+
const custom = await codec.decodeMeta({ custom: metadata.custom });
|
|
256
|
+
const decoded = { ...metadata, custom };
|
|
230
257
|
const etag = readEtag(response);
|
|
231
|
-
return etag !== undefined ? { ...
|
|
258
|
+
return etag !== undefined ? { ...decoded, etag } : decoded;
|
|
232
259
|
}
|
|
233
260
|
/**
|
|
234
261
|
* Replaces the resource's user-writable metadata (`custom`). This is a full
|
|
@@ -237,27 +264,39 @@ export class Resource {
|
|
|
237
264
|
* metadata of a nonexistent resource throws `NotFoundError`. Servers without
|
|
238
265
|
* metadata support surface their 501 as `NotImplementedError`.
|
|
239
266
|
*
|
|
240
|
-
* On an encrypted collection
|
|
241
|
-
*
|
|
242
|
-
*
|
|
267
|
+
* On an encrypted collection `custom` is encrypted into an opaque envelope by
|
|
268
|
+
* the codec before it is sent, so `name` / `tags` are never stored as
|
|
269
|
+
* server-visible plaintext -- transparently, the same call works on plaintext
|
|
270
|
+
* and encrypted collections alike.
|
|
271
|
+
*
|
|
272
|
+
* Conditional metadata writes (the backend's `conditional-writes` feature):
|
|
273
|
+
* pass `ifMatch` (the `etag` from a prior `meta()`) for an
|
|
274
|
+
* update-if-unchanged, or `ifNoneMatch: true` for a write-only-if-no-metadata.
|
|
275
|
+
* A failed precondition throws `PreconditionFailedError` (412). The `/meta`
|
|
276
|
+
* ETag (`metaVersion`) is independent of the content ETag. Returns the new
|
|
277
|
+
* `etag`.
|
|
243
278
|
*
|
|
244
279
|
* @param meta {object}
|
|
245
280
|
* @param [meta.custom] {ResourceMetadataCustom} the user-writable properties
|
|
246
|
-
* @
|
|
281
|
+
* @param options {object}
|
|
282
|
+
* @param [options.ifMatch] {string} update only if the `/meta` ETag matches
|
|
283
|
+
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
284
|
+
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
247
285
|
*/
|
|
248
|
-
async setMeta(meta = {}) {
|
|
286
|
+
async setMeta(meta = {}, options = {}) {
|
|
249
287
|
const codec = await this._codec();
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
'collection -- it would be stored as plaintext. Carry these values ' +
|
|
253
|
-
'inside the encrypted content instead.');
|
|
254
|
-
}
|
|
255
|
-
await send(this._context, {
|
|
288
|
+
const { custom } = await codec.encodeMeta({ custom: meta.custom ?? {} });
|
|
289
|
+
const response = await send(this._context, {
|
|
256
290
|
path: this._metaPath,
|
|
257
291
|
method: 'PUT',
|
|
258
292
|
capability: this._capability,
|
|
259
|
-
json: { custom
|
|
293
|
+
json: { custom },
|
|
294
|
+
headers: writeHeaders(undefined, {
|
|
295
|
+
ifMatch: options.ifMatch,
|
|
296
|
+
ifNoneMatch: options.ifNoneMatch
|
|
297
|
+
})
|
|
260
298
|
});
|
|
299
|
+
return { etag: readEtag(response) };
|
|
261
300
|
}
|
|
262
301
|
/**
|
|
263
302
|
* Sets the resource's human-readable `name` (the value surfaced in collection
|
|
@@ -292,13 +331,10 @@ export class Resource {
|
|
|
292
331
|
* @returns {Promise<PolicyDocument | null>}
|
|
293
332
|
*/
|
|
294
333
|
async getPolicy() {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
capability: this._capability,
|
|
299
|
-
read: true
|
|
334
|
+
return readPolicy(this._context, {
|
|
335
|
+
policyPath: this._policyPath,
|
|
336
|
+
capability: this._capability
|
|
300
337
|
});
|
|
301
|
-
return response === null ? null : response.data;
|
|
302
338
|
}
|
|
303
339
|
/**
|
|
304
340
|
* Sets (creates or replaces) the resource's access-control policy.
|
|
@@ -307,11 +343,10 @@ export class Resource {
|
|
|
307
343
|
* @returns {Promise<void>}
|
|
308
344
|
*/
|
|
309
345
|
async setPolicy(policy) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
capability: this._capability
|
|
314
|
-
json: policy
|
|
346
|
+
return writePolicy(this._context, {
|
|
347
|
+
policyPath: this._policyPath,
|
|
348
|
+
policy,
|
|
349
|
+
capability: this._capability
|
|
315
350
|
});
|
|
316
351
|
}
|
|
317
352
|
/**
|
|
@@ -339,11 +374,9 @@ export class Resource {
|
|
|
339
374
|
* @returns {Promise<void>}
|
|
340
375
|
*/
|
|
341
376
|
async clearPolicy() {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
capability: this._capability,
|
|
346
|
-
idempotent: true
|
|
377
|
+
return deletePolicy(this._context, {
|
|
378
|
+
policyPath: this._policyPath,
|
|
379
|
+
capability: this._capability
|
|
347
380
|
});
|
|
348
381
|
}
|
|
349
382
|
}
|
package/dist/Resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAY5E,MAAM,OAAO,QAAQ;IACV,OAAO,CAAQ;IACf,YAAY,CAAQ;IACpB,EAAE,CAAQ;IAEF,QAAQ,CAAe;IACvB,WAAW,CAAQ;IACnB,WAAW,CAA+B;IAC1C,mBAAmB,CAAqB;IACxC,YAAY,CAAa;IAE1C;;;;;;;;;;;;;;OAcG;IACH,YAAY,EACV,OAAO,EACP,OAAO,EACP,YAAY,EACZ,UAAU,EACV,UAAU,EACV,KAAK,EACL,UAAU,EASX;QACC,yEAAyE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_path();
|
|
20
|
+
private get _policyPath();
|
|
20
21
|
/**
|
|
21
22
|
* Reads the Space Description. Returns `null` if the space is missing or not
|
|
22
23
|
* visible to you (WAS returns 404 for both not-found and unauthorized).
|
package/dist/Space.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAI1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,EACL,WAAW,EACX,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,YAAY,CAAA;AAEnB,qBAAa,KAAK;IAChB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAEnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAO;IAEpC;;;;;OAKG;gBACS,EACV,OAAO,EACP,OAAO,EACP,UAAU,EACX,EAAE;QACD,OAAO,EAAE,aAAa,CAAA;QACtB,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,CAAC,EAAE,KAAK,CAAA;KACnB;IAMD,OAAO,KAAK,KAAK,GAEhB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED;;;;;OAKG;IACG,QAAQ,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAUlD;;;;;;;;OAQG;IACG,SAAS,CAAC,IAAI,EAAE;QACpB,IAAI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I,OAAO,CAAC,UAAU,CAAC;IAanC;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC;IAY1D;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAOjD;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAKlC;;;;;;OAMG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAOlC;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CASzC"}
|
package/dist/Space.js
CHANGED
|
@@ -11,6 +11,8 @@ import { spacePath, spaceItems, spaceCollections, spaceExport, spaceImport, spac
|
|
|
11
11
|
import { assertNotReserved } from './internal/reserved.js';
|
|
12
12
|
import { delegateGrant } from './internal/grant.js';
|
|
13
13
|
import { send } from './internal/request.js';
|
|
14
|
+
import { createdId, dataOrNull, toPlainBytes } from './internal/content.js';
|
|
15
|
+
import { readPolicy, writePolicy, deletePolicy } from './internal/policy.js';
|
|
14
16
|
import { Collection } from './Collection.js';
|
|
15
17
|
export class Space {
|
|
16
18
|
id;
|
|
@@ -30,6 +32,9 @@ export class Space {
|
|
|
30
32
|
get _path() {
|
|
31
33
|
return spacePath(this.id);
|
|
32
34
|
}
|
|
35
|
+
get _policyPath() {
|
|
36
|
+
return spacePolicy(this.id);
|
|
37
|
+
}
|
|
33
38
|
/**
|
|
34
39
|
* Reads the Space Description. Returns `null` if the space is missing or not
|
|
35
40
|
* visible to you (WAS returns 404 for both not-found and unauthorized).
|
|
@@ -43,7 +48,7 @@ export class Space {
|
|
|
43
48
|
capability: this._capability,
|
|
44
49
|
read: true
|
|
45
50
|
});
|
|
46
|
-
return response
|
|
51
|
+
return dataOrNull(response);
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
49
54
|
* Creates or updates the space by id (upsert). Merges the given fields over
|
|
@@ -140,13 +145,13 @@ export class Space {
|
|
|
140
145
|
capability: this._capability,
|
|
141
146
|
json: body
|
|
142
147
|
});
|
|
143
|
-
const created = response
|
|
144
|
-
.data;
|
|
145
148
|
// Pre-seed the handle with an override matching the just-declared scheme so
|
|
146
149
|
// the first write encrypts immediately (keys come from the keystore); no
|
|
147
150
|
// describe() round-trip needed before the marker is locally known. A
|
|
148
151
|
// `CollectionEncryption` marker is itself a valid `EncryptionOverride`.
|
|
149
|
-
return this.collection(
|
|
152
|
+
return this.collection(createdId(response), {
|
|
153
|
+
encryption: desc.encryption
|
|
154
|
+
});
|
|
150
155
|
}
|
|
151
156
|
/**
|
|
152
157
|
* Lists the collections in the space. Returns `null` if the space is missing
|
|
@@ -161,7 +166,7 @@ export class Space {
|
|
|
161
166
|
capability: this._capability,
|
|
162
167
|
read: true
|
|
163
168
|
});
|
|
164
|
-
return response
|
|
169
|
+
return dataOrNull(response);
|
|
165
170
|
}
|
|
166
171
|
/**
|
|
167
172
|
* Lists the storage backends available within this space. Returns `null` if
|
|
@@ -181,7 +186,7 @@ export class Space {
|
|
|
181
186
|
capability: this._capability,
|
|
182
187
|
read: true
|
|
183
188
|
});
|
|
184
|
-
return response
|
|
189
|
+
return dataOrNull(response);
|
|
185
190
|
}
|
|
186
191
|
/**
|
|
187
192
|
* Registers a new `external` ("Bring Your Own Storage") backend against this
|
|
@@ -280,7 +285,7 @@ export class Space {
|
|
|
280
285
|
capability: this._capability,
|
|
281
286
|
read: true
|
|
282
287
|
});
|
|
283
|
-
return response
|
|
288
|
+
return dataOrNull(response);
|
|
284
289
|
}
|
|
285
290
|
/**
|
|
286
291
|
* Delegates access to this space. Prefills the grant `target` with this
|
|
@@ -319,9 +324,7 @@ export class Space {
|
|
|
319
324
|
* @returns {Promise<ImportStats>}
|
|
320
325
|
*/
|
|
321
326
|
async import(tar) {
|
|
322
|
-
const body = tar instanceof Uint8Array
|
|
323
|
-
? new Uint8Array(tar.buffer, tar.byteOffset, tar.byteLength)
|
|
324
|
-
: tar;
|
|
327
|
+
const body = tar instanceof Uint8Array ? toPlainBytes(tar) : tar;
|
|
325
328
|
const response = await send(this._context, {
|
|
326
329
|
path: spaceImport(this.id),
|
|
327
330
|
method: 'POST',
|
|
@@ -340,13 +343,10 @@ export class Space {
|
|
|
340
343
|
* @returns {Promise<PolicyDocument | null>}
|
|
341
344
|
*/
|
|
342
345
|
async getPolicy() {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
capability: this._capability,
|
|
347
|
-
read: true
|
|
346
|
+
return readPolicy(this._context, {
|
|
347
|
+
policyPath: this._policyPath,
|
|
348
|
+
capability: this._capability
|
|
348
349
|
});
|
|
349
|
-
return response === null ? null : response.data;
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
352
352
|
* Sets (creates or replaces) the space's access-control policy.
|
|
@@ -355,11 +355,10 @@ export class Space {
|
|
|
355
355
|
* @returns {Promise<void>}
|
|
356
356
|
*/
|
|
357
357
|
async setPolicy(policy) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
capability: this._capability
|
|
362
|
-
json: policy
|
|
358
|
+
return writePolicy(this._context, {
|
|
359
|
+
policyPath: this._policyPath,
|
|
360
|
+
policy,
|
|
361
|
+
capability: this._capability
|
|
363
362
|
});
|
|
364
363
|
}
|
|
365
364
|
/**
|
|
@@ -388,11 +387,9 @@ export class Space {
|
|
|
388
387
|
* @returns {Promise<void>}
|
|
389
388
|
*/
|
|
390
389
|
async clearPolicy() {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
capability: this._capability,
|
|
395
|
-
idempotent: true
|
|
390
|
+
return deletePolicy(this._context, {
|
|
391
|
+
policyPath: this._policyPath,
|
|
392
|
+
capability: this._capability
|
|
396
393
|
});
|
|
397
394
|
}
|
|
398
395
|
/**
|
|
@@ -408,7 +405,7 @@ export class Space {
|
|
|
408
405
|
capability: this._capability,
|
|
409
406
|
read: true
|
|
410
407
|
});
|
|
411
|
-
return response
|
|
408
|
+
return dataOrNull(response);
|
|
412
409
|
}
|
|
413
410
|
}
|
|
414
411
|
//# sourceMappingURL=Space.js.map
|
package/dist/Space.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Space.js","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,KAAK,EACN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"Space.js","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,KAAK,EACN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uBAAuB,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