@interop/was-client 0.18.0 → 0.19.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 +88 -0
- package/dist/Collection.d.ts +1 -46
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +77 -79
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +1 -51
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +55 -55
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +1 -27
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +65 -65
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +1 -12
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +15 -15
- package/dist/WasClient.js.map +1 -1
- package/dist/edv/EdvCodec.d.ts +1 -139
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +57 -58
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +1 -53
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +29 -29
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/docCipher.d.ts +111 -0
- package/dist/edv/docCipher.d.ts.map +1 -0
- package/dist/edv/docCipher.js +236 -0
- package/dist/edv/docCipher.js.map +1 -0
- package/dist/edv/epochKeys.js +2 -2
- package/dist/edv/epochKeys.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/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +28 -0
- package/dist/errors.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 +1 -2
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +10 -10
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/features.d.ts +1 -12
- package/dist/internal/features.d.ts.map +1 -1
- package/dist/internal/features.js +8 -8
- package/dist/internal/features.js.map +1 -1
- package/dist/internal/pagination.d.ts +1 -1
- package/dist/internal/pagination.js +1 -1
- package/dist/sync/cid.d.ts +31 -0
- package/dist/sync/cid.d.ts.map +1 -0
- package/dist/sync/cid.js +55 -0
- package/dist/sync/cid.js.map +1 -0
- package/dist/sync/envelope.d.ts +20 -0
- package/dist/sync/envelope.d.ts.map +1 -0
- package/dist/sync/envelope.js +17 -0
- package/dist/sync/envelope.js.map +1 -0
- package/dist/sync/index.d.ts +29 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +28 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/plaintextCipher.d.ts +16 -0
- package/dist/sync/plaintextCipher.d.ts.map +1 -0
- package/dist/sync/plaintextCipher.js +36 -0
- package/dist/sync/plaintextCipher.js.map +1 -0
- package/dist/sync/port.d.ts +78 -0
- package/dist/sync/port.d.ts.map +1 -0
- package/dist/sync/port.js +204 -0
- package/dist/sync/port.js.map +1 -0
- package/dist/sync/provisioning.d.ts +41 -0
- package/dist/sync/provisioning.d.ts.map +1 -0
- package/dist/sync/provisioning.js +44 -0
- package/dist/sync/provisioning.js.map +1 -0
- package/dist/sync/types.d.ts +166 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync/types.js +2 -0
- package/dist/sync/types.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/package.json +10 -2
package/dist/Resource.d.ts
CHANGED
|
@@ -2,36 +2,10 @@ import type { ClientContext } from './internal/request.js';
|
|
|
2
2
|
import type { ResourceCodec } from './codec.js';
|
|
3
3
|
import type { EncryptionOverride, IZcap, Json, ResourceData, PolicyDocument, ResourceMetadata, ResourceMetadataCustom } from './types.js';
|
|
4
4
|
export declare class Resource {
|
|
5
|
+
#private;
|
|
5
6
|
readonly spaceId: string;
|
|
6
7
|
readonly collectionId: string;
|
|
7
8
|
readonly id: string;
|
|
8
|
-
private readonly _context;
|
|
9
|
-
private readonly _capability?;
|
|
10
|
-
/**
|
|
11
|
-
* Resolves the codec for this resource: the parent collection's shared codec
|
|
12
|
-
* when this handle came from `collection.resource(id)`, otherwise one
|
|
13
|
-
* resolved (and memoized per handle) for its own collection. A standalone
|
|
14
|
-
* resource discovers its collection's `encryption` marker (one GET on the
|
|
15
|
-
* collection, cached per handle) unless a per-handle override is set, and
|
|
16
|
-
* fails closed if it cannot key an encrypted collection. A fresh standalone
|
|
17
|
-
* handle re-reads the marker, so retain the handle to reuse it. A failed
|
|
18
|
-
* resolution (e.g. a transient 500/network error during marker discovery) is
|
|
19
|
-
* not memoized: the cache is cleared so the next call retries rather than
|
|
20
|
-
* re-throwing the stale error forever.
|
|
21
|
-
*
|
|
22
|
-
* A handle obtained via `collection.resource(id)` delegates to the parent's
|
|
23
|
-
* shared resolver on every call rather than memoizing locally: the parent
|
|
24
|
-
* already memoizes (so this adds no round-trip), and delegating lets a parent
|
|
25
|
-
* reset (e.g. after `configure()` adds the encryption marker) propagate here.
|
|
26
|
-
*/
|
|
27
|
-
private readonly _codec;
|
|
28
|
-
/**
|
|
29
|
-
* Resolves the backend's advertised feature tokens: the parent collection's
|
|
30
|
-
* shared probe when this handle came from `collection.resource(id)`,
|
|
31
|
-
* otherwise one built (and memoized) for this handle. Consulted by the
|
|
32
|
-
* conditional-codec write path (see `upsertResource`).
|
|
33
|
-
*/
|
|
34
|
-
private readonly _features;
|
|
35
9
|
/**
|
|
36
10
|
* @param options {object}
|
|
37
11
|
* @param options.context {ClientContext}
|
|
@@ -59,15 +33,6 @@ export declare class Resource {
|
|
|
59
33
|
features?: () => Promise<string[]>;
|
|
60
34
|
encryption?: EncryptionOverride;
|
|
61
35
|
});
|
|
62
|
-
private get _path();
|
|
63
|
-
/**
|
|
64
|
-
* Sends the shared resource GET -- the byte-identical request the three public
|
|
65
|
-
* readers (`get` / `getText` / `getBytes`) issue -- resolving a missing or
|
|
66
|
-
* unauthorized resource (404) to `null` via the `read` flag.
|
|
67
|
-
*
|
|
68
|
-
* @returns {Promise<HttpResponse | null>}
|
|
69
|
-
*/
|
|
70
|
-
private _read;
|
|
71
36
|
/**
|
|
72
37
|
* Reads the resource, auto-parsing JSON to an object and returning binary as
|
|
73
38
|
* a `Blob`. Returns `null` if the resource is missing or not visible to you
|
|
@@ -154,7 +119,6 @@ export declare class Resource {
|
|
|
154
119
|
delete(options?: {
|
|
155
120
|
ifMatch?: string;
|
|
156
121
|
}): Promise<void>;
|
|
157
|
-
private get _metaPath();
|
|
158
122
|
/**
|
|
159
123
|
* Reads the resource's metadata object (server-managed `contentType` / `size`
|
|
160
124
|
* / timestamps plus the user-writable `custom` object). Returns `null` if the
|
|
@@ -209,19 +173,6 @@ export declare class Resource {
|
|
|
209
173
|
}): Promise<{
|
|
210
174
|
etag?: string;
|
|
211
175
|
}>;
|
|
212
|
-
/**
|
|
213
|
-
* The shared read-then-CAS body of {@link setName} / {@link setTags}: reads
|
|
214
|
-
* the current metadata, merges `patch` over its `custom`, and writes it back
|
|
215
|
-
* pinned to the read's `etag` (when the backend supports
|
|
216
|
-
* `conditional-writes`), so a concurrent metadata write surfaces as
|
|
217
|
-
* `PreconditionFailedError` instead of being silently erased by the
|
|
218
|
-
* full-replacement write.
|
|
219
|
-
*
|
|
220
|
-
* @param patch {ResourceMetadataCustom} the properties to merge over the
|
|
221
|
-
* current `custom`
|
|
222
|
-
* @returns {Promise<void>}
|
|
223
|
-
*/
|
|
224
|
-
private _patchCustom;
|
|
225
176
|
/**
|
|
226
177
|
* Sets the resource's human-readable `name` (the value surfaced in collection
|
|
227
178
|
* listings), preserving any existing `tags`. Convenience over `setMeta()`.
|
|
@@ -242,7 +193,6 @@ export declare class Resource {
|
|
|
242
193
|
* @returns {Promise<void>}
|
|
243
194
|
*/
|
|
244
195
|
setTags(tags: Record<string, string>): Promise<void>;
|
|
245
|
-
private get _policyPath();
|
|
246
196
|
/**
|
|
247
197
|
* Reads the resource's access-control policy. Returns `null` when no policy is
|
|
248
198
|
* set (or it is not visible to you). Managing a policy is a controller-level
|
package/dist/Resource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAc1D,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;AAkBnB,qBAAa,QAAQ
|
|
1
|
+
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAc1D,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;AAkBnB,qBAAa,QAAQ;;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IA8BnB;;;;;;;;;;;;;;;;OAgBG;gBACS,EACV,OAAO,EACP,OAAO,EACP,YAAY,EACZ,UAAU,EACV,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,EACX,EAAE;QACD,OAAO,EAAE,aAAa,CAAA;QACtB,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;QACpB,UAAU,EAAE,MAAM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AAO,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAyC7B;;;;;;;;;;OAUG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C;;;;;;OAMG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1D;;;;;;OAMG;IACG,SAAS,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAOjD;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAOhC;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAOlC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAMnC"}
|
package/dist/Resource.js
CHANGED
|
@@ -27,8 +27,8 @@ export class Resource {
|
|
|
27
27
|
spaceId;
|
|
28
28
|
collectionId;
|
|
29
29
|
id;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
#context;
|
|
31
|
+
#capability;
|
|
32
32
|
/**
|
|
33
33
|
* Resolves the codec for this resource: the parent collection's shared codec
|
|
34
34
|
* when this handle came from `collection.resource(id)`, otherwise one
|
|
@@ -46,14 +46,14 @@ export class Resource {
|
|
|
46
46
|
* already memoizes (so this adds no round-trip), and delegating lets a parent
|
|
47
47
|
* reset (e.g. after `configure()` adds the encryption marker) propagate here.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
#codec;
|
|
50
50
|
/**
|
|
51
51
|
* Resolves the backend's advertised feature tokens: the parent collection's
|
|
52
52
|
* shared probe when this handle came from `collection.resource(id)`,
|
|
53
53
|
* otherwise one built (and memoized) for this handle. Consulted by the
|
|
54
54
|
* conditional-codec write path (see `upsertResource`).
|
|
55
55
|
*/
|
|
56
|
-
|
|
56
|
+
#features;
|
|
57
57
|
/**
|
|
58
58
|
* @param options {object}
|
|
59
59
|
* @param options.context {ClientContext}
|
|
@@ -81,13 +81,13 @@ export class Resource {
|
|
|
81
81
|
// the constructor covers every operation (read, delete, meta, policy, put),
|
|
82
82
|
// not just writes.
|
|
83
83
|
assertNotReserved({ id: resourceId, kind: 'resource' });
|
|
84
|
-
this
|
|
84
|
+
this.#context = context;
|
|
85
85
|
this.spaceId = spaceId;
|
|
86
86
|
this.collectionId = collectionId;
|
|
87
87
|
this.id = resourceId;
|
|
88
|
-
this
|
|
88
|
+
this.#capability = capability;
|
|
89
89
|
if (codec) {
|
|
90
|
-
this
|
|
90
|
+
this.#codec = codec;
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
93
|
const holder = collectionCodecHolder(context, {
|
|
@@ -96,10 +96,10 @@ export class Resource {
|
|
|
96
96
|
override: encryption,
|
|
97
97
|
capability
|
|
98
98
|
});
|
|
99
|
-
this
|
|
99
|
+
this.#codec = () => holder.get();
|
|
100
100
|
}
|
|
101
101
|
if (features) {
|
|
102
|
-
this
|
|
102
|
+
this.#features = features;
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
105
105
|
const probe = collectionBackendFeatures(context, {
|
|
@@ -107,10 +107,10 @@ export class Resource {
|
|
|
107
107
|
collectionId,
|
|
108
108
|
capability
|
|
109
109
|
});
|
|
110
|
-
this
|
|
110
|
+
this.#features = () => probe.get();
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
get
|
|
113
|
+
get #path() {
|
|
114
114
|
return resourcePath(this.spaceId, this.collectionId, this.id);
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
@@ -120,11 +120,11 @@ export class Resource {
|
|
|
120
120
|
*
|
|
121
121
|
* @returns {Promise<HttpResponse | null>}
|
|
122
122
|
*/
|
|
123
|
-
async
|
|
124
|
-
return send(this
|
|
125
|
-
path: this
|
|
123
|
+
async #read() {
|
|
124
|
+
return send(this.#context, {
|
|
125
|
+
path: this.#path,
|
|
126
126
|
method: 'GET',
|
|
127
|
-
capability: this
|
|
127
|
+
capability: this.#capability,
|
|
128
128
|
read: true
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -136,8 +136,8 @@ export class Resource {
|
|
|
136
136
|
* @returns {Promise<Json | Blob | null>}
|
|
137
137
|
*/
|
|
138
138
|
async get() {
|
|
139
|
-
const codec = await this
|
|
140
|
-
const response = await this
|
|
139
|
+
const codec = await this.#codec();
|
|
140
|
+
const response = await this.#read();
|
|
141
141
|
return response === null ? null : codec.decode(response, this.id);
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
@@ -155,7 +155,7 @@ export class Resource {
|
|
|
155
155
|
* @returns {Promise<string | null>}
|
|
156
156
|
*/
|
|
157
157
|
async getText() {
|
|
158
|
-
const response = await this
|
|
158
|
+
const response = await this.#read();
|
|
159
159
|
if (response === null) {
|
|
160
160
|
return null;
|
|
161
161
|
}
|
|
@@ -177,7 +177,7 @@ export class Resource {
|
|
|
177
177
|
* @returns {Promise<Uint8Array | null>}
|
|
178
178
|
*/
|
|
179
179
|
async getBytes() {
|
|
180
|
-
const response = await this
|
|
180
|
+
const response = await this.#read();
|
|
181
181
|
if (response === null) {
|
|
182
182
|
return null;
|
|
183
183
|
}
|
|
@@ -216,15 +216,15 @@ export class Resource {
|
|
|
216
216
|
* @returns {Promise<{ etag?: string }>} the stored resource's new ETag
|
|
217
217
|
*/
|
|
218
218
|
async put(data, options = {}) {
|
|
219
|
-
const codec = await this
|
|
220
|
-
const response = await upsertResource(this
|
|
221
|
-
path: this
|
|
219
|
+
const codec = await this.#codec();
|
|
220
|
+
const response = await upsertResource(this.#context, {
|
|
221
|
+
path: this.#path,
|
|
222
222
|
codec,
|
|
223
223
|
id: this.id,
|
|
224
224
|
data,
|
|
225
|
-
features: this
|
|
225
|
+
features: this.#features,
|
|
226
226
|
contentType: options.contentType,
|
|
227
|
-
capability: this
|
|
227
|
+
capability: this.#capability,
|
|
228
228
|
precondition: {
|
|
229
229
|
ifMatch: options.ifMatch,
|
|
230
230
|
ifNoneMatch: options.ifNoneMatch
|
|
@@ -242,17 +242,17 @@ export class Resource {
|
|
|
242
242
|
* @returns {Promise<void>}
|
|
243
243
|
*/
|
|
244
244
|
async delete(options = {}) {
|
|
245
|
-
await send(this
|
|
246
|
-
path: this
|
|
245
|
+
await send(this.#context, {
|
|
246
|
+
path: this.#path,
|
|
247
247
|
method: 'DELETE',
|
|
248
|
-
capability: this
|
|
248
|
+
capability: this.#capability,
|
|
249
249
|
// A conditional delete is not idempotent: a stale `If-Match` must surface
|
|
250
250
|
// as a 412 rather than being swallowed as an absent-target success.
|
|
251
251
|
idempotent: options.ifMatch === undefined,
|
|
252
252
|
headers: writeHeaders({ precondition: { ifMatch: options.ifMatch } })
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
get
|
|
255
|
+
get #metaPath() {
|
|
256
256
|
return resourceMeta(this.spaceId, this.collectionId, this.id);
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
@@ -273,11 +273,11 @@ export class Resource {
|
|
|
273
273
|
* @returns {Promise<(ResourceMetadata & { etag?: string }) | null>}
|
|
274
274
|
*/
|
|
275
275
|
async meta() {
|
|
276
|
-
const codec = await this
|
|
277
|
-
const response = await send(this
|
|
278
|
-
path: this
|
|
276
|
+
const codec = await this.#codec();
|
|
277
|
+
const response = await send(this.#context, {
|
|
278
|
+
path: this.#metaPath,
|
|
279
279
|
method: 'GET',
|
|
280
|
-
capability: this
|
|
280
|
+
capability: this.#capability,
|
|
281
281
|
read: true
|
|
282
282
|
});
|
|
283
283
|
if (response === null) {
|
|
@@ -330,15 +330,15 @@ export class Resource {
|
|
|
330
330
|
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
331
331
|
*/
|
|
332
332
|
async setMeta(meta = {}, options = {}) {
|
|
333
|
-
const codec = await this
|
|
333
|
+
const codec = await this.#codec();
|
|
334
334
|
const { custom } = await codec.encodeMeta({
|
|
335
335
|
custom: meta.custom ?? {},
|
|
336
336
|
id: this.id
|
|
337
337
|
});
|
|
338
|
-
const response = await send(this
|
|
339
|
-
path: this
|
|
338
|
+
const response = await send(this.#context, {
|
|
339
|
+
path: this.#metaPath,
|
|
340
340
|
method: 'PUT',
|
|
341
|
-
capability: this
|
|
341
|
+
capability: this.#capability,
|
|
342
342
|
json: { custom },
|
|
343
343
|
headers: writeHeaders({
|
|
344
344
|
precondition: {
|
|
@@ -361,7 +361,7 @@ export class Resource {
|
|
|
361
361
|
* current `custom`
|
|
362
362
|
* @returns {Promise<void>}
|
|
363
363
|
*/
|
|
364
|
-
async
|
|
364
|
+
async #patchCustom(patch) {
|
|
365
365
|
const current = await this.meta();
|
|
366
366
|
await this.setMeta({ custom: { ...current?.custom, ...patch } }, { ifMatch: current?.etag });
|
|
367
367
|
}
|
|
@@ -377,7 +377,7 @@ export class Resource {
|
|
|
377
377
|
* @returns {Promise<void>}
|
|
378
378
|
*/
|
|
379
379
|
async setName(name) {
|
|
380
|
-
return this
|
|
380
|
+
return this.#patchCustom({ name });
|
|
381
381
|
}
|
|
382
382
|
/**
|
|
383
383
|
* Sets the resource's `tags`, preserving any existing `name`. Convenience over
|
|
@@ -387,9 +387,9 @@ export class Resource {
|
|
|
387
387
|
* @returns {Promise<void>}
|
|
388
388
|
*/
|
|
389
389
|
async setTags(tags) {
|
|
390
|
-
return this
|
|
390
|
+
return this.#patchCustom({ tags });
|
|
391
391
|
}
|
|
392
|
-
get
|
|
392
|
+
get #policyPath() {
|
|
393
393
|
return resourcePolicy(this.spaceId, this.collectionId, this.id);
|
|
394
394
|
}
|
|
395
395
|
/**
|
|
@@ -400,9 +400,9 @@ export class Resource {
|
|
|
400
400
|
* @returns {Promise<PolicyDocument | null>}
|
|
401
401
|
*/
|
|
402
402
|
async getPolicy() {
|
|
403
|
-
return readPolicy(this
|
|
404
|
-
policyPath: this
|
|
405
|
-
capability: this
|
|
403
|
+
return readPolicy(this.#context, {
|
|
404
|
+
policyPath: this.#policyPath,
|
|
405
|
+
capability: this.#capability
|
|
406
406
|
});
|
|
407
407
|
}
|
|
408
408
|
/**
|
|
@@ -412,10 +412,10 @@ export class Resource {
|
|
|
412
412
|
* @returns {Promise<void>}
|
|
413
413
|
*/
|
|
414
414
|
async setPolicy(policy) {
|
|
415
|
-
return writePolicy(this
|
|
416
|
-
policyPath: this
|
|
415
|
+
return writePolicy(this.#context, {
|
|
416
|
+
policyPath: this.#policyPath,
|
|
417
417
|
policy,
|
|
418
|
-
capability: this
|
|
418
|
+
capability: this.#capability
|
|
419
419
|
});
|
|
420
420
|
}
|
|
421
421
|
/**
|
|
@@ -425,9 +425,9 @@ export class Resource {
|
|
|
425
425
|
* @returns {Promise<void>}
|
|
426
426
|
*/
|
|
427
427
|
async setPublic() {
|
|
428
|
-
return setPublicPolicy(this
|
|
429
|
-
policyPath: this
|
|
430
|
-
capability: this
|
|
428
|
+
return setPublicPolicy(this.#context, {
|
|
429
|
+
policyPath: this.#policyPath,
|
|
430
|
+
capability: this.#capability
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
/**
|
|
@@ -436,9 +436,9 @@ export class Resource {
|
|
|
436
436
|
* @returns {Promise<boolean>}
|
|
437
437
|
*/
|
|
438
438
|
async isPublic() {
|
|
439
|
-
return isPublicPolicy(this
|
|
440
|
-
policyPath: this
|
|
441
|
-
capability: this
|
|
439
|
+
return isPublicPolicy(this.#context, {
|
|
440
|
+
policyPath: this.#policyPath,
|
|
441
|
+
capability: this.#capability
|
|
442
442
|
});
|
|
443
443
|
}
|
|
444
444
|
/**
|
|
@@ -448,9 +448,9 @@ export class Resource {
|
|
|
448
448
|
* @returns {Promise<void>}
|
|
449
449
|
*/
|
|
450
450
|
async clearPolicy() {
|
|
451
|
-
return deletePolicy(this
|
|
452
|
-
policyPath: this
|
|
453
|
-
capability: this
|
|
451
|
+
return deletePolicy(this.#context, {
|
|
452
|
+
policyPath: this.#policyPath,
|
|
453
|
+
capability: this.#capability
|
|
454
454
|
});
|
|
455
455
|
}
|
|
456
456
|
}
|
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;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAY7B;;;;;;;;;;;GAWG;AACH,SAAS,aAAa,CAAC,QAAsB;IAC3C,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAChF,CAAC;AAED,MAAM,OAAO,QAAQ;IACV,OAAO,CAAQ;IACf,YAAY,CAAQ;IACpB,EAAE,CAAQ;
|
|
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,wBAA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AMG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC/B,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CAAC,MAAsB;QACpC,OAAO,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,MAAM;YACN,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,OAAO,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE;YACnC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/Space.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ import type { ClientContext } from './internal/request.js';
|
|
|
2
2
|
import { Collection } from './Collection.js';
|
|
3
3
|
import type { BackendDescriptor, BackendReference, BackendRegistration, CollectionEncryption, CollectionsList, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, ImportStats, LinkSet, PolicyDocument, SpaceDescription, SpaceQuotaReport } from './types.js';
|
|
4
4
|
export declare class Space {
|
|
5
|
+
#private;
|
|
5
6
|
readonly id: string;
|
|
6
|
-
private readonly _context;
|
|
7
|
-
private readonly _capability?;
|
|
8
7
|
/**
|
|
9
8
|
* @param options {object}
|
|
10
9
|
* @param options.context {ClientContext}
|
|
@@ -16,8 +15,6 @@ export declare class Space {
|
|
|
16
15
|
spaceId: string;
|
|
17
16
|
capability?: IZcap;
|
|
18
17
|
});
|
|
19
|
-
private get _path();
|
|
20
|
-
private get _policyPath();
|
|
21
18
|
/**
|
|
22
19
|
* Reads the Space Description. Returns `null` if the space is missing or not
|
|
23
20
|
* visible to you (WAS returns 404 for both not-found and unauthorized).
|
|
@@ -87,15 +84,6 @@ export declare class Space {
|
|
|
87
84
|
backend?: BackendReference;
|
|
88
85
|
encryption?: CollectionEncryption;
|
|
89
86
|
}): Promise<Collection>;
|
|
90
|
-
/**
|
|
91
|
-
* Reads the first page of the collections listing and packages the means to
|
|
92
|
-
* follow its `next` links (each page fetched with the same authorization).
|
|
93
|
-
* Returns `null` if the space is missing or not visible to you (404 conflation
|
|
94
|
-
* caveat).
|
|
95
|
-
*
|
|
96
|
-
* @returns {Promise<PageWalk<CollectionsList> | null>}
|
|
97
|
-
*/
|
|
98
|
-
private _collectionsWalk;
|
|
99
87
|
/**
|
|
100
88
|
* Lists the collections in the space. Transparently follows the server's
|
|
101
89
|
* `next` pagination links, buffering every page into a single list (the
|
|
@@ -229,20 +217,6 @@ export declare class Space {
|
|
|
229
217
|
* @returns {Promise<void>}
|
|
230
218
|
*/
|
|
231
219
|
revoke(zcap: IDelegatedZcap): Promise<void>;
|
|
232
|
-
/**
|
|
233
|
-
* Sends the export request and returns the raw response with its body stream
|
|
234
|
-
* intact, shared by `export`/`exportBlob`/`exportStream`.
|
|
235
|
-
*
|
|
236
|
-
* Guards the JSON-mislabel edge: `@interop/http-client` pre-consumes a
|
|
237
|
-
* response body into `.data` for JSON content-types, so a non-conformant
|
|
238
|
-
* server that labels the tar archive `application/json` would leave us a dead
|
|
239
|
-
* stream. Detecting the consumed body here fails with a typed `WasServerError`
|
|
240
|
-
* naming the mislabeled content-type, rather than a raw "body stream already
|
|
241
|
-
* read" `TypeError` downstream.
|
|
242
|
-
*
|
|
243
|
-
* @returns {Promise<HttpResponse>}
|
|
244
|
-
*/
|
|
245
|
-
private _exportResponse;
|
|
246
220
|
/**
|
|
247
221
|
* Exports the whole space as a tar (`application/x-tar`) archive.
|
|
248
222
|
*
|
package/dist/Space.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAiB1D,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
|
|
1
|
+
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAiB1D,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;IAKnB;;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