@interop/was-client 0.3.0 → 0.5.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 +103 -22
- package/dist/Collection.d.ts +21 -3
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +38 -2
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +41 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +62 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +19 -3
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +37 -3
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +36 -7
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +50 -7
- package/dist/WasClient.js.map +1 -1
- package/dist/errors.d.ts +34 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +101 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/paths.d.ts +23 -0
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +33 -0
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/request.d.ts +20 -0
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +41 -0
- package/dist/internal/request.js.map +1 -1
- package/dist/types.d.ts +11 -131
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Wallet Attached Storage Client _(@interop/was-client)_
|
|
2
2
|
|
|
3
|
+
[](https://github.com/interop-alliance/was-client/actions?query=workflow%3A%22CI%22)
|
|
3
4
|
[](https://npm.im/@interop/was-client)
|
|
4
5
|
|
|
5
6
|
> A developer-friendly client for Wallet Attached Storage (WAS) servers, with a
|
|
@@ -17,6 +18,8 @@
|
|
|
17
18
|
- [Resources: JSON and binary](#resources-json-and-binary)
|
|
18
19
|
- [Delegation and sharing](#delegation-and-sharing)
|
|
19
20
|
- [Public sharing and access-control policies](#public-sharing-and-access-control-policies)
|
|
21
|
+
- [Resource metadata](#resource-metadata)
|
|
22
|
+
- [Storage introspection: backends and quotas](#storage-introspection-backends-and-quotas)
|
|
20
23
|
- [Export and import](#export-and-import)
|
|
21
24
|
- [The manual-request escape hatch](#the-manual-request-escape-hatch)
|
|
22
25
|
- [Errors and the 404/null caveat](#errors-and-the-404null-caveat)
|
|
@@ -36,7 +39,7 @@ through cheap, lazy navigational handles modeled on a document store's DX
|
|
|
36
39
|
no query-by-filter yet).
|
|
37
40
|
|
|
38
41
|
| Document db driver | WAS client |
|
|
39
|
-
|
|
42
|
+
| ----------------------------------- | ------------------------------------------ |
|
|
40
43
|
| `new Client(url)` | `new WasClient({ serverUrl, zcapClient })` |
|
|
41
44
|
| `client.db('app')` | `was.space(spaceId)` |
|
|
42
45
|
| `db.collection('users')` | `space.collection(collectionId)` |
|
|
@@ -174,10 +177,16 @@ await space.configure({ name: 'Home (renamed)' })
|
|
|
174
177
|
await space.delete() // idempotent
|
|
175
178
|
```
|
|
176
179
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
List the spaces in the repository visible to your signer with
|
|
181
|
+
`was.listSpaces()`. It returns a `{ url, totalItems, items }` listing holding
|
|
182
|
+
only the spaces whose controller your invocation is authorized for; an
|
|
183
|
+
unauthorized caller gets an empty list rather than an error. To enumerate what
|
|
184
|
+
is _inside_ a space, use `space.collections()` (below).
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
const { totalItems, items } = await was.listSpaces()
|
|
188
|
+
// items: [{ id, url, name? }, ...]
|
|
189
|
+
```
|
|
181
190
|
|
|
182
191
|
### Collections
|
|
183
192
|
|
|
@@ -315,11 +324,75 @@ policy via `space.linkset()` / `collection.linkset()` (RFC9264) or the `linkset`
|
|
|
315
324
|
property on a description.
|
|
316
325
|
|
|
317
326
|
`isPublic()` is a read-only convenience that returns `true` when the Space,
|
|
318
|
-
Collection, or Resource has a `{ type: 'PublicCanRead' }` policy -- that is,
|
|
319
|
-
it has been made public via `setPublic()` (or an equivalent `setPolicy()`
|
|
320
|
-
It's meant to drive data-browser style UI, to show a "This
|
|
327
|
+
Collection, or Resource has a `{ type: 'PublicCanRead' }` policy -- that is,
|
|
328
|
+
when it has been made public via `setPublic()` (or an equivalent `setPolicy()`
|
|
329
|
+
call). It's meant to drive data-browser style UI, to show a "This
|
|
321
330
|
space(/collection/resource) has been shared publicly" type of icon.
|
|
322
331
|
|
|
332
|
+
#### Consuming public links (unauthenticated reads)
|
|
333
|
+
|
|
334
|
+
The flip side of `setPublic()`: reading a `PublicCanRead` resource or collection
|
|
335
|
+
with no authorization, by its URL. These use an unsigned plain `fetch` (no
|
|
336
|
+
capability invocation), so they work for a consumer who only holds the link.
|
|
337
|
+
|
|
338
|
+
```ts
|
|
339
|
+
// Fetch a single public resource (auto-parses JSON, returns binary as a Blob).
|
|
340
|
+
const doc = await was.publicRead({
|
|
341
|
+
resourceUrl: 'https://was.example/space/s/c/r'
|
|
342
|
+
}) // Json | Blob | null
|
|
343
|
+
|
|
344
|
+
// List a public collection -- e.g. a blog published as a public-read collection.
|
|
345
|
+
const listing = await was.publicListCollection({
|
|
346
|
+
collectionUrl: 'https://was.example/space/s/c'
|
|
347
|
+
}) // ResourceListing | null
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Both follow the read-method 404/null caveat: a missing or non-public target
|
|
351
|
+
resolves to `null`.
|
|
352
|
+
|
|
353
|
+
### Resource metadata
|
|
354
|
+
|
|
355
|
+
Each Resource has a metadata object at its reserved `/meta` path: server-managed
|
|
356
|
+
properties (`contentType`, `size`, optional `createdAt` / `updatedAt`) plus a
|
|
357
|
+
user-writable `custom` object (`name` and `tags`).
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
const resource = collection.resource('vc-1')
|
|
361
|
+
|
|
362
|
+
const meta = await resource.meta() // ResourceMetadata | null (null on a miss)
|
|
363
|
+
|
|
364
|
+
// setMeta() is a full replacement of `custom`; omitted properties are cleared.
|
|
365
|
+
await resource.setMeta({ custom: { name: 'Diploma', tags: { year: '2026' } } })
|
|
366
|
+
|
|
367
|
+
// setName() / setTags() are read-modify-write sugar that preserve the other.
|
|
368
|
+
await resource.setName('Renamed diploma') // keeps existing tags
|
|
369
|
+
await resource.setTags({ status: 'verified' }) // keeps existing name
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
The `custom.name` is the same value surfaced as a resource's `name` in
|
|
373
|
+
collection listings; updating one updates the other.
|
|
374
|
+
|
|
375
|
+
### Storage introspection: backends and quotas
|
|
376
|
+
|
|
377
|
+
A Space can report the storage backends available to it and a per-backend usage
|
|
378
|
+
report. Both are optional server features (a server without them surfaces a
|
|
379
|
+
`NotImplementedError`); both follow the read-method 404/null caveat.
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
const backends = await space.backends() // BackendDescriptor[] | null
|
|
383
|
+
const report = await space.quotas() // SpaceQuotaReport | null
|
|
384
|
+
// report.backends[i]: { id, state, usageBytes, limit, restrictedActions, ... }
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
A Collection can likewise report the backend it is stored on and its own usage,
|
|
388
|
+
scoped to that backend (same optional-feature and 404/null caveats).
|
|
389
|
+
|
|
390
|
+
```ts
|
|
391
|
+
const backend = await collection.backend() // BackendDescriptor | null
|
|
392
|
+
const usage = await collection.quota() // BackendUsage | null
|
|
393
|
+
// usage: { id, state, usageBytes, limit, restrictedActions, measuredAt, ... }
|
|
394
|
+
```
|
|
395
|
+
|
|
323
396
|
### Export and import
|
|
324
397
|
|
|
325
398
|
```ts
|
|
@@ -347,20 +420,28 @@ MongoDB's `findOne` semantics. **WAS returns 404 for both not-found and
|
|
|
347
420
|
unauthorized**, so `null` means "not visible to you" rather than strictly "does
|
|
348
421
|
not exist". Write/delete methods throw a typed error instead.
|
|
349
422
|
|
|
350
|
-
| Status | Read methods
|
|
351
|
-
| ------ |
|
|
352
|
-
| 404 | `null`
|
|
353
|
-
| 400 | `ValidationError`
|
|
354
|
-
| 401 | `AuthRequiredError`
|
|
355
|
-
|
|
|
356
|
-
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
`
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
423
|
+
| Status | Read methods | Write / delete methods |
|
|
424
|
+
| ------ | ---------------------- | ---------------------- |
|
|
425
|
+
| 404 | `null` | `NotFoundError` |
|
|
426
|
+
| 400 | `ValidationError` | `ValidationError` |
|
|
427
|
+
| 401 | `AuthRequiredError` | `AuthRequiredError` |
|
|
428
|
+
| 409 | `ConflictError` | `ConflictError` |
|
|
429
|
+
| 413 | `PayloadTooLargeError` | `PayloadTooLargeError` |
|
|
430
|
+
| 501 | `NotImplementedError` | `NotImplementedError` |
|
|
431
|
+
| 507 | `QuotaExceededError` | `QuotaExceededError` |
|
|
432
|
+
| 5xx | `WasServerError` | `WasServerError` |
|
|
433
|
+
|
|
434
|
+
All error classes extend `WasError` (carrying `status`, the problem-kind `type`
|
|
435
|
+
URI, `title`, `details`, and `requestUrl`). When the server sends a
|
|
436
|
+
`problem+json` `type` (the spec's Error Type Registry), `mapError()` dispatches
|
|
437
|
+
on that kind first and falls back to the HTTP status -- so, for example, a 409
|
|
438
|
+
`id-conflict` from `createSpace({ id })` is catchable as a `ConflictError`, and
|
|
439
|
+
a 507 `quota-exceeded` (a client-actionable storage-full condition, not a server
|
|
440
|
+
fault) as a `QuotaExceededError`. `delete()` additionally treats a 404 as
|
|
441
|
+
success, so it is idempotent.
|
|
442
|
+
|
|
443
|
+
Spec endpoints a given server has not yet implemented surface as
|
|
444
|
+
`NotImplementedError` (the server's 501).
|
|
364
445
|
|
|
365
446
|
## Contribute
|
|
366
447
|
|
package/dist/Collection.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientContext } from './internal/request.js';
|
|
2
2
|
import { Resource } from './Resource.js';
|
|
3
|
-
import type { AddResult, BackendReference, CollectionDescription, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, Json, LinkSet, PolicyDocument,
|
|
3
|
+
import type { AddResult, BackendDescriptor, BackendReference, BackendUsage, CollectionDescription, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, Json, LinkSet, PolicyDocument, CollectionResourcesList } from './types.js';
|
|
4
4
|
export declare class Collection {
|
|
5
5
|
readonly spaceId: string;
|
|
6
6
|
readonly id: string;
|
|
@@ -97,9 +97,9 @@ export declare class Collection {
|
|
|
97
97
|
* Lists the items in the collection. Returns `null` if the collection is
|
|
98
98
|
* missing or not visible to you (404 conflation caveat).
|
|
99
99
|
*
|
|
100
|
-
* @returns {Promise<
|
|
100
|
+
* @returns {Promise<CollectionResourcesList | null>}
|
|
101
101
|
*/
|
|
102
|
-
list(): Promise<
|
|
102
|
+
list(): Promise<CollectionResourcesList | null>;
|
|
103
103
|
/**
|
|
104
104
|
* Delegates access to this collection. Prefills the grant `target` with this
|
|
105
105
|
* collection's URL (and the bound `capability`, if any, for re-delegation).
|
|
@@ -152,5 +152,23 @@ export declare class Collection {
|
|
|
152
152
|
* @returns {Promise<LinkSet | null>}
|
|
153
153
|
*/
|
|
154
154
|
linkset(): Promise<LinkSet | null>;
|
|
155
|
+
/**
|
|
156
|
+
* Reads the storage backend this collection is stored on ("Collection Backend
|
|
157
|
+
* Selected"). Returns `null` if the collection is missing or not visible to
|
|
158
|
+
* you (404 conflation caveat). A server without backend support surfaces its
|
|
159
|
+
* 501 as `NotImplementedError`.
|
|
160
|
+
*
|
|
161
|
+
* @returns {Promise<BackendDescriptor | null>}
|
|
162
|
+
*/
|
|
163
|
+
backend(): Promise<BackendDescriptor | null>;
|
|
164
|
+
/**
|
|
165
|
+
* Reads the collection's storage usage report, scoped to its backend (spec
|
|
166
|
+
* "Quotas"). Returns `null` if the collection is missing or not visible to you
|
|
167
|
+
* (404 conflation caveat). A backend that cannot account per-collection
|
|
168
|
+
* surfaces its 501 as `NotImplementedError`.
|
|
169
|
+
*
|
|
170
|
+
* @returns {Promise<BackendUsage | null>}
|
|
171
|
+
*/
|
|
172
|
+
quota(): Promise<BackendUsage | null>;
|
|
155
173
|
}
|
|
156
174
|
//# sourceMappingURL=Collection.d.ts.map
|
package/dist/Collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,EACL,IAAI,EACJ,OAAO,EACP,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAEnB,qBAAa,UAAU;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAEnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAO;IAEpC;;;;;;;OAOG;gBACS,EACV,OAAO,EACP,OAAO,EACP,YAAY,EACZ,UAAU,EACX,EAAE;QACD,OAAO,EAAE,aAAa,CAAA;QACtB,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;QACpB,UAAU,CAAC,EAAE,KAAK,CAAA;KACnB;IAOD,OAAO,KAAK,KAAK,GAEhB;IAED,OAAO,KAAK,UAAU,GAErB;IAED;;;;;;OAMG;IACG,QAAQ,IAAI,OAAO,CAA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OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IASlC;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAUxC;;;;;;;OAOG;IACG,OAAO,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAUlD;;;;;;;OAOG;IACG,KAAK,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CAS5C"}
|
package/dist/Collection.js
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* lifecycle (`describe`/`configure`/`delete`) and contained-resource operations
|
|
7
7
|
* (`add`/`get`/`put`/`list`, plus `resource(id)` for delete-by-id).
|
|
8
8
|
*/
|
|
9
|
-
import { collectionPath, collectionItems, collectionPolicy, collectionLinkset, resourcePath, toUrl } from './internal/paths.js';
|
|
9
|
+
import { collectionPath, collectionItems, collectionPolicy, collectionLinkset, collectionBackend, collectionQuota, resourcePath, toUrl } from './internal/paths.js';
|
|
10
10
|
import { prepareBody, parseResource } from './internal/content.js';
|
|
11
|
+
import { assertNotReserved } from './internal/reserved.js';
|
|
11
12
|
import { delegateGrant } from './internal/grant.js';
|
|
12
13
|
import { send } from './internal/request.js';
|
|
13
14
|
import { Resource } from './Resource.js';
|
|
@@ -62,6 +63,7 @@ export class Collection {
|
|
|
62
63
|
* @returns {Promise<CollectionDescription>}
|
|
63
64
|
*/
|
|
64
65
|
async configure(desc) {
|
|
66
|
+
assertNotReserved(this.id, 'collection');
|
|
65
67
|
const current = await this.describe();
|
|
66
68
|
const name = desc.name ?? current?.name;
|
|
67
69
|
const body = { id: this.id, name };
|
|
@@ -179,7 +181,7 @@ export class Collection {
|
|
|
179
181
|
* Lists the items in the collection. Returns `null` if the collection is
|
|
180
182
|
* missing or not visible to you (404 conflation caveat).
|
|
181
183
|
*
|
|
182
|
-
* @returns {Promise<
|
|
184
|
+
* @returns {Promise<CollectionResourcesList | null>}
|
|
183
185
|
*/
|
|
184
186
|
async list() {
|
|
185
187
|
const response = await send(this._context, {
|
|
@@ -284,5 +286,39 @@ export class Collection {
|
|
|
284
286
|
});
|
|
285
287
|
return response === null ? null : response.data;
|
|
286
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Reads the storage backend this collection is stored on ("Collection Backend
|
|
291
|
+
* Selected"). Returns `null` if the collection is missing or not visible to
|
|
292
|
+
* you (404 conflation caveat). A server without backend support surfaces its
|
|
293
|
+
* 501 as `NotImplementedError`.
|
|
294
|
+
*
|
|
295
|
+
* @returns {Promise<BackendDescriptor | null>}
|
|
296
|
+
*/
|
|
297
|
+
async backend() {
|
|
298
|
+
const response = await send(this._context, {
|
|
299
|
+
path: collectionBackend(this.spaceId, this.id),
|
|
300
|
+
method: 'GET',
|
|
301
|
+
capability: this._capability,
|
|
302
|
+
read: true
|
|
303
|
+
});
|
|
304
|
+
return response === null ? null : response.data;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Reads the collection's storage usage report, scoped to its backend (spec
|
|
308
|
+
* "Quotas"). Returns `null` if the collection is missing or not visible to you
|
|
309
|
+
* (404 conflation caveat). A backend that cannot account per-collection
|
|
310
|
+
* surfaces its 501 as `NotImplementedError`.
|
|
311
|
+
*
|
|
312
|
+
* @returns {Promise<BackendUsage | null>}
|
|
313
|
+
*/
|
|
314
|
+
async quota() {
|
|
315
|
+
const response = await send(this._context, {
|
|
316
|
+
path: collectionQuota(this.spaceId, this.id),
|
|
317
|
+
method: 'GET',
|
|
318
|
+
capability: this._capability,
|
|
319
|
+
read: true
|
|
320
|
+
});
|
|
321
|
+
return response === null ? null : response.data;
|
|
322
|
+
}
|
|
287
323
|
}
|
|
288
324
|
//# sourceMappingURL=Collection.js.map
|
package/dist/Collection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.js","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;G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C5B,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACF,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,QAAQ,CAAC,IAA0B,CAAA;IACxE,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACzC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;YAC5C,MAAM,EAAE,KAAK;YACb,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACF,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,QAAQ,CAAC,IAAqB,CAAA;IACnE,CAAC;CACF"}
|
package/dist/Resource.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClientContext } from './internal/request.js';
|
|
2
|
-
import type { IZcap, Json, PolicyDocument } from './types.js';
|
|
2
|
+
import type { IZcap, Json, PolicyDocument, ResourceMetadata, ResourceMetadataCustom } from './types.js';
|
|
3
3
|
export declare class Resource {
|
|
4
4
|
readonly spaceId: string;
|
|
5
5
|
readonly collectionId: string;
|
|
@@ -63,6 +63,46 @@ export declare class Resource {
|
|
|
63
63
|
* @returns {Promise<void>}
|
|
64
64
|
*/
|
|
65
65
|
delete(): Promise<void>;
|
|
66
|
+
private get _metaPath();
|
|
67
|
+
/**
|
|
68
|
+
* Reads the resource's metadata object (server-managed `contentType` / `size`
|
|
69
|
+
* / timestamps plus the user-writable `custom` object). Returns `null` if the
|
|
70
|
+
* resource is missing or not visible to you (404 conflation caveat). A server
|
|
71
|
+
* without metadata support surfaces its 501 as `NotImplementedError`.
|
|
72
|
+
*
|
|
73
|
+
* @returns {Promise<ResourceMetadata | null>}
|
|
74
|
+
*/
|
|
75
|
+
meta(): Promise<ResourceMetadata | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Replaces the resource's user-writable metadata (`custom`). This is a full
|
|
78
|
+
* replacement: any property omitted from `custom` is cleared, and an omitted
|
|
79
|
+
* `custom` clears them all. Does not create the resource -- a `PUT` to the
|
|
80
|
+
* metadata of a nonexistent resource throws `NotFoundError`. Servers without
|
|
81
|
+
* metadata support surface their 501 as `NotImplementedError`.
|
|
82
|
+
*
|
|
83
|
+
* @param meta {object}
|
|
84
|
+
* @param [meta.custom] {ResourceMetadataCustom} the user-writable properties
|
|
85
|
+
* @returns {Promise<void>}
|
|
86
|
+
*/
|
|
87
|
+
setMeta(meta?: {
|
|
88
|
+
custom?: ResourceMetadataCustom;
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Sets the resource's human-readable `name` (the value surfaced in collection
|
|
92
|
+
* listings), preserving any existing `tags`. Convenience over `setMeta()`.
|
|
93
|
+
*
|
|
94
|
+
* @param name {string}
|
|
95
|
+
* @returns {Promise<void>}
|
|
96
|
+
*/
|
|
97
|
+
setName(name: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Sets the resource's `tags`, preserving any existing `name`. Convenience over
|
|
100
|
+
* `setMeta()`.
|
|
101
|
+
*
|
|
102
|
+
* @param tags {Record<string, string>}
|
|
103
|
+
* @returns {Promise<void>}
|
|
104
|
+
*/
|
|
105
|
+
setTags(tags: Record<string, string>): Promise<void>;
|
|
66
106
|
private get _policyPath();
|
|
67
107
|
/**
|
|
68
108
|
* Reads the resource's access-control policy. Returns `null` when no policy is
|
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;AAE1D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources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AI,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAU9C;;;;;;;;;;OAUG;IACG,OAAO,CAAC,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,sBAAsB,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5E;;;;;;OAMG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1C;;;;;;OAMG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1D,OAAO,KAAK,WAAW,GAEtB;IAED;;;;;;OAMG;IACG,SAAS,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAUjD;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAStD;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAKlC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAQnC"}
|
package/dist/Resource.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* keyed by id within a Collection). Sugar over the Collection item operations,
|
|
7
7
|
* with explicit `getText()` / `getBytes()` escape hatches.
|
|
8
8
|
*/
|
|
9
|
-
import { resourcePath, resourcePolicy } from './internal/paths.js';
|
|
9
|
+
import { resourcePath, resourcePolicy, resourceMeta } from './internal/paths.js';
|
|
10
10
|
import { prepareBody, parseResource } from './internal/content.js';
|
|
11
11
|
import { assertNotReserved } from './internal/reserved.js';
|
|
12
12
|
import { send } from './internal/request.js';
|
|
@@ -120,6 +120,67 @@ export class Resource {
|
|
|
120
120
|
idempotent: true
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
+
get _metaPath() {
|
|
124
|
+
return resourceMeta(this.spaceId, this.collectionId, this.id);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Reads the resource's metadata object (server-managed `contentType` / `size`
|
|
128
|
+
* / timestamps plus the user-writable `custom` object). Returns `null` if the
|
|
129
|
+
* resource is missing or not visible to you (404 conflation caveat). A server
|
|
130
|
+
* without metadata support surfaces its 501 as `NotImplementedError`.
|
|
131
|
+
*
|
|
132
|
+
* @returns {Promise<ResourceMetadata | null>}
|
|
133
|
+
*/
|
|
134
|
+
async meta() {
|
|
135
|
+
const response = await send(this._context, {
|
|
136
|
+
path: this._metaPath,
|
|
137
|
+
method: 'GET',
|
|
138
|
+
capability: this._capability,
|
|
139
|
+
read: true
|
|
140
|
+
});
|
|
141
|
+
return response === null ? null : response.data;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Replaces the resource's user-writable metadata (`custom`). This is a full
|
|
145
|
+
* replacement: any property omitted from `custom` is cleared, and an omitted
|
|
146
|
+
* `custom` clears them all. Does not create the resource -- a `PUT` to the
|
|
147
|
+
* metadata of a nonexistent resource throws `NotFoundError`. Servers without
|
|
148
|
+
* metadata support surface their 501 as `NotImplementedError`.
|
|
149
|
+
*
|
|
150
|
+
* @param meta {object}
|
|
151
|
+
* @param [meta.custom] {ResourceMetadataCustom} the user-writable properties
|
|
152
|
+
* @returns {Promise<void>}
|
|
153
|
+
*/
|
|
154
|
+
async setMeta(meta = {}) {
|
|
155
|
+
await send(this._context, {
|
|
156
|
+
path: this._metaPath,
|
|
157
|
+
method: 'PUT',
|
|
158
|
+
capability: this._capability,
|
|
159
|
+
json: { custom: meta.custom ?? {} }
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Sets the resource's human-readable `name` (the value surfaced in collection
|
|
164
|
+
* listings), preserving any existing `tags`. Convenience over `setMeta()`.
|
|
165
|
+
*
|
|
166
|
+
* @param name {string}
|
|
167
|
+
* @returns {Promise<void>}
|
|
168
|
+
*/
|
|
169
|
+
async setName(name) {
|
|
170
|
+
const current = await this.meta();
|
|
171
|
+
await this.setMeta({ custom: { ...current?.custom, name } });
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Sets the resource's `tags`, preserving any existing `name`. Convenience over
|
|
175
|
+
* `setMeta()`.
|
|
176
|
+
*
|
|
177
|
+
* @param tags {Record<string, string>}
|
|
178
|
+
* @returns {Promise<void>}
|
|
179
|
+
*/
|
|
180
|
+
async setTags(tags) {
|
|
181
|
+
const current = await this.meta();
|
|
182
|
+
await this.setMeta({ custom: { ...current?.custom, tags } });
|
|
183
|
+
}
|
|
123
184
|
get _policyPath() {
|
|
124
185
|
return resourcePolicy(this.spaceId, this.collectionId, this.id);
|
|
125
186
|
}
|
package/dist/Resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAS5C,MAAM,OAAO,QAAQ;IACV,OAAO,CAAQ;IACf,YAAY,CAAQ;IACpB,EAAE,CAAQ;IAEF,QAAQ,CAAe;IACvB,WAAW,CAAQ;IAEpC;;;;;;;OAOG;IACH,YAAY,EACV,OAAO,EACP,OAAO,EACP,YAAY,EACZ,UAAU,EACV,UAAU,EAOX;QACC,IAAI,CAAC,QAAQ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AQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACzC,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,MAAM,EAAE,KAAK;YACb,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACF,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,QAAQ,CAAC,IAAuB,CAAA;IACrE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CAAC,MAAsB;QACpC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACxB,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,MAAM,EAAE,KAAK;YACb,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,IAAI,EAAE,MAAM;SACb,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAA;IACjD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;QACrC,OAAO,MAAM,EAAE,IAAI,KAAK,eAAe,CAAA;IACzC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACxB,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/Space.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientContext } from './internal/request.js';
|
|
2
2
|
import { Collection } from './Collection.js';
|
|
3
|
-
import type { BackendReference,
|
|
3
|
+
import type { BackendDescriptor, BackendReference, CollectionsList, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, ImportStats, LinkSet, PolicyDocument, SpaceDescription, SpaceQuotaReport } from './types.js';
|
|
4
4
|
export declare class Space {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
private readonly _context;
|
|
@@ -71,9 +71,25 @@ export declare class Space {
|
|
|
71
71
|
* Lists the collections in the space. Returns `null` if the space is missing
|
|
72
72
|
* or not visible to you (404 conflation caveat).
|
|
73
73
|
*
|
|
74
|
-
* @returns {Promise<
|
|
74
|
+
* @returns {Promise<CollectionsList | null>}
|
|
75
75
|
*/
|
|
76
|
-
collections(): Promise<
|
|
76
|
+
collections(): Promise<CollectionsList | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Lists the storage backends available within this space. Returns `null` if
|
|
79
|
+
* the space is missing or not visible to you (404 conflation caveat). A
|
|
80
|
+
* server without backend support surfaces its 501 as `NotImplementedError`.
|
|
81
|
+
*
|
|
82
|
+
* @returns {Promise<BackendDescriptor[] | null>}
|
|
83
|
+
*/
|
|
84
|
+
backends(): Promise<BackendDescriptor[] | null>;
|
|
85
|
+
/**
|
|
86
|
+
* Reads the space's storage quota report, grouped by backend. Returns `null`
|
|
87
|
+
* if the space is missing or not visible to you (404 conflation caveat). A
|
|
88
|
+
* server without quota support surfaces its 501 as `NotImplementedError`.
|
|
89
|
+
*
|
|
90
|
+
* @returns {Promise<SpaceQuotaReport | null>}
|
|
91
|
+
*/
|
|
92
|
+
quotas(): Promise<SpaceQuotaReport | null>;
|
|
77
93
|
/**
|
|
78
94
|
* Delegates access to this space. Prefills the grant `target` with this
|
|
79
95
|
* space's URL (and the bound `capability`, if any, for re-delegation).
|
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.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OAAO,CAAC,UAAU,CAAC;IAyBtB;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAUpD;;;;;;OAMG;IACG,QAAQ,IAAI,OAAO,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC;IAUrD;;;;;;OAMG;IACG,MAAM,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAUhD;;;;;;OAMG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IAU3D;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC;IAanC;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC;IAe1D;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAUjD;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAStD;;;;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;IASlC;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CASzC"}
|
package/dist/Space.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* (`collection`/`createCollection`/`collections`), delegation (`grant`), and
|
|
8
8
|
* whole-space `export`/`import`.
|
|
9
9
|
*/
|
|
10
|
-
import { spacePath, spaceItems, spaceCollections, spaceExport, spaceImport, spacePolicy, spaceLinkset, toUrl } from './internal/paths.js';
|
|
10
|
+
import { spacePath, spaceItems, spaceCollections, spaceExport, spaceImport, spaceBackends, spaceQuotas, spacePolicy, spaceLinkset, toUrl } from './internal/paths.js';
|
|
11
11
|
import { assertNotReserved } from './internal/reserved.js';
|
|
12
12
|
import { delegateGrant } from './internal/grant.js';
|
|
13
13
|
import { send } from './internal/request.js';
|
|
@@ -68,7 +68,9 @@ export class Space {
|
|
|
68
68
|
id: this.id,
|
|
69
69
|
type: current?.type ?? ['Space'],
|
|
70
70
|
...(name !== undefined ? { name } : {}),
|
|
71
|
-
controller
|
|
71
|
+
// `controller` is a user-supplied DID string; assert it as the branded
|
|
72
|
+
// `IDID` the wire type now uses (the server validates the DID form).
|
|
73
|
+
controller: controller
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
76
|
/**
|
|
@@ -138,7 +140,7 @@ export class Space {
|
|
|
138
140
|
* Lists the collections in the space. Returns `null` if the space is missing
|
|
139
141
|
* or not visible to you (404 conflation caveat).
|
|
140
142
|
*
|
|
141
|
-
* @returns {Promise<
|
|
143
|
+
* @returns {Promise<CollectionsList | null>}
|
|
142
144
|
*/
|
|
143
145
|
async collections() {
|
|
144
146
|
const response = await send(this._context, {
|
|
@@ -149,6 +151,38 @@ export class Space {
|
|
|
149
151
|
});
|
|
150
152
|
return response === null ? null : response.data;
|
|
151
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Lists the storage backends available within this space. Returns `null` if
|
|
156
|
+
* the space is missing or not visible to you (404 conflation caveat). A
|
|
157
|
+
* server without backend support surfaces its 501 as `NotImplementedError`.
|
|
158
|
+
*
|
|
159
|
+
* @returns {Promise<BackendDescriptor[] | null>}
|
|
160
|
+
*/
|
|
161
|
+
async backends() {
|
|
162
|
+
const response = await send(this._context, {
|
|
163
|
+
path: spaceBackends(this.id),
|
|
164
|
+
method: 'GET',
|
|
165
|
+
capability: this._capability,
|
|
166
|
+
read: true
|
|
167
|
+
});
|
|
168
|
+
return response === null ? null : response.data;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Reads the space's storage quota report, grouped by backend. Returns `null`
|
|
172
|
+
* if the space is missing or not visible to you (404 conflation caveat). A
|
|
173
|
+
* server without quota support surfaces its 501 as `NotImplementedError`.
|
|
174
|
+
*
|
|
175
|
+
* @returns {Promise<SpaceQuotaReport | null>}
|
|
176
|
+
*/
|
|
177
|
+
async quotas() {
|
|
178
|
+
const response = await send(this._context, {
|
|
179
|
+
path: spaceQuotas(this.id),
|
|
180
|
+
method: 'GET',
|
|
181
|
+
capability: this._capability,
|
|
182
|
+
read: true
|
|
183
|
+
});
|
|
184
|
+
return response === null ? null : response.data;
|
|
185
|
+
}
|
|
152
186
|
/**
|
|
153
187
|
* Delegates access to this space. Prefills the grant `target` with this
|
|
154
188
|
* space's URL (and the bound `capability`, if any, for re-delegation).
|
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,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,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,CAA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