@interop/was-client 0.1.1 → 0.3.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 +193 -25
- package/dist/Collection.d.ts +45 -1
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +80 -1
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +37 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +66 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +45 -1
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +80 -1
- package/dist/Space.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.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/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
[](https://npm.im/@interop/was-client)
|
|
4
4
|
|
|
5
5
|
> A developer-friendly client for Wallet Attached Storage (WAS) servers, with a
|
|
6
|
-
>
|
|
6
|
+
> database-driver-inspired navigational API over zcap-authorized HTTP.
|
|
7
7
|
|
|
8
8
|
## Table of Contents
|
|
9
9
|
|
|
10
10
|
- [Background](#background)
|
|
11
11
|
- [Install](#install)
|
|
12
12
|
- [Usage](#usage)
|
|
13
|
-
- [
|
|
13
|
+
- [Creating a client (signer + zcapClient)](#creating-a-client-signer--zcapclient)
|
|
14
14
|
- [The handle model](#the-handle-model)
|
|
15
|
+
- [Spaces](#spaces)
|
|
16
|
+
- [Collections](#collections)
|
|
15
17
|
- [Resources: JSON and binary](#resources-json-and-binary)
|
|
16
18
|
- [Delegation and sharing](#delegation-and-sharing)
|
|
19
|
+
- [Public sharing and access-control policies](#public-sharing-and-access-control-policies)
|
|
17
20
|
- [Export and import](#export-and-import)
|
|
18
21
|
- [The manual-request escape hatch](#the-manual-request-escape-hatch)
|
|
19
22
|
- [Errors and the 404/null caveat](#errors-and-the-404null-caveat)
|
|
@@ -22,23 +25,19 @@
|
|
|
22
25
|
|
|
23
26
|
## Background
|
|
24
27
|
|
|
25
|
-
The WAS protocol exposes a
|
|
28
|
+
The WAS protocol exposes a general purpose database-like container model --
|
|
26
29
|
`SpacesRepository > Space > Collection > Resource` -- over HTTP, authorized with
|
|
27
|
-
[Authorization Capabilities (zcaps)](https://w3c-ccg.github.io/zcap-spec/).
|
|
28
|
-
low-level transport is an
|
|
29
|
-
[`@interop/ezcap`](https://www.npmjs.com/package/@interop/ezcap) `ZcapClient`,
|
|
30
|
-
where every operation hand-builds a URL, picks a trailing-slash variant, threads
|
|
31
|
-
JSON vs binary bodies, and reasons about delegation inline.
|
|
30
|
+
[Authorization Capabilities (zcaps)](https://w3c-ccg.github.io/zcap-spec/).
|
|
32
31
|
|
|
33
32
|
`@interop/was-client` wraps that `ZcapClient` and exposes the containment model
|
|
34
|
-
through cheap, lazy navigational handles modeled on
|
|
33
|
+
through cheap, lazy navigational handles modeled on a document store's DX
|
|
35
34
|
(`client > db > collection`), using WAS-specific verbs
|
|
36
35
|
(`add`/`get`/`put`/`list`/`delete`) rather than `insertOne`/`findOne` (WAS has
|
|
37
36
|
no query-by-filter yet).
|
|
38
37
|
|
|
39
|
-
|
|
|
40
|
-
|
|
41
|
-
| `new
|
|
38
|
+
| Document db driver | WAS client |
|
|
39
|
+
|-------------------------------------| ------------------------------------------ |
|
|
40
|
+
| `new Client(url)` | `new WasClient({ serverUrl, zcapClient })` |
|
|
42
41
|
| `client.db('app')` | `was.space(spaceId)` |
|
|
43
42
|
| `db.collection('users')` | `space.collection(collectionId)` |
|
|
44
43
|
| `collection.insertOne(doc)` | `collection.add(doc)` |
|
|
@@ -57,34 +56,86 @@ pnpm install @interop/was-client
|
|
|
57
56
|
|
|
58
57
|
## Usage
|
|
59
58
|
|
|
60
|
-
###
|
|
59
|
+
### Creating a client (signer + zcapClient)
|
|
60
|
+
|
|
61
|
+
A `WasClient` signs every request with a key you control. The key is held by an
|
|
62
|
+
ezcap `ZcapClient`, which you build from a `did:key` identity. You will need two
|
|
63
|
+
companion packages alongside this one (this library already depends on
|
|
64
|
+
`@interop/ed25519-signature`):
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
pnpm install @interop/ezcap @interop/did-method-key @interop/ed25519-verification-key
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The primary form wraps a `ZcapClient` you build yourself. The `did:key` driver
|
|
71
|
+
generates a key pair and a matching DID document, wiring the signer's
|
|
72
|
+
`id`/`controller` correctly:
|
|
61
73
|
|
|
62
74
|
```ts
|
|
75
|
+
import { ZcapClient } from '@interop/ezcap'
|
|
76
|
+
import * as didKey from '@interop/did-method-key'
|
|
77
|
+
import { Ed25519Signature2020 } from '@interop/ed25519-signature'
|
|
78
|
+
import { Ed25519VerificationKey } from '@interop/ed25519-verification-key'
|
|
63
79
|
import { WasClient } from '@interop/was-client'
|
|
64
80
|
|
|
65
|
-
//
|
|
66
|
-
const
|
|
81
|
+
// 1. Generate a did:key identity (didDocument + keyPairs).
|
|
82
|
+
const didKeyDriver = didKey.driver()
|
|
83
|
+
didKeyDriver.use({ keyPairClass: Ed25519VerificationKey })
|
|
84
|
+
const { didDocument, keyPairs } = await didKeyDriver.generate()
|
|
67
85
|
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
// 2. Build the ezcap ZcapClient (it holds the signer and signs every request).
|
|
87
|
+
const zcapClient = new ZcapClient({
|
|
88
|
+
didDocument,
|
|
89
|
+
keyPairs,
|
|
90
|
+
SuiteClass: Ed25519Signature2020
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
// 3. Wrap it.
|
|
94
|
+
const was = new WasClient({ serverUrl: 'https://was.example', zcapClient })
|
|
71
95
|
```
|
|
72
96
|
|
|
97
|
+
If you already have a single signer, `WasClient.fromSigner()` builds the
|
|
98
|
+
`ZcapClient` internally (using the `Ed25519Signature2020` suite). A signer is
|
|
99
|
+
any object with `{ id, sign() }`; here we get one from a generated key. The
|
|
100
|
+
signer's `id` must be a `did:key` so the server can resolve and verify it:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { Ed25519VerificationKey } from '@interop/ed25519-verification-key'
|
|
104
|
+
import { WasClient } from '@interop/was-client'
|
|
105
|
+
|
|
106
|
+
// Pass a 32-byte `seed` for a deterministic key, or omit it for a random one.
|
|
107
|
+
const keyPair = await Ed25519VerificationKey.generate({ seed })
|
|
108
|
+
keyPair.controller = `did:key:${keyPair.fingerprint()}`
|
|
109
|
+
keyPair.id = `${keyPair.controller}#${keyPair.fingerprint()}`
|
|
110
|
+
|
|
111
|
+
const was = WasClient.fromSigner({
|
|
112
|
+
serverUrl: 'https://was.example',
|
|
113
|
+
signer: keyPair.signer()
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The `seed` is where a passphrase-, stored-secret-, or KMS-derived key plugs in:
|
|
118
|
+
deriving the same 32-byte seed yields the same DID, and therefore access to the
|
|
119
|
+
same spaces. (Apps with user accounts often derive the signer from a passphrase
|
|
120
|
+
via `CapabilityAgent.fromSecret()` from `@digitalbazaar/webkms-client` -- not
|
|
121
|
+
required, just a common alternative.)
|
|
122
|
+
|
|
73
123
|
`serverUrl` is the base for both URL building and zcap `invocationTarget`s, so
|
|
74
124
|
the "server URL must equal the invocation target host:port" constraint holds by
|
|
75
125
|
construction.
|
|
76
126
|
|
|
77
127
|
### The handle model
|
|
78
128
|
|
|
129
|
+
The client exposes the WAS containment model
|
|
130
|
+
(`SpacesRepository > Space > Collection > Resource`) as navigational handles.
|
|
79
131
|
Handles are lazy and synchronous to obtain -- only the verb methods hit the
|
|
80
132
|
network. Lazy chains never throw: `was.space(x).collection(y)` does no I/O and
|
|
81
133
|
just accumulates URL context. Existence is checked on the first network verb.
|
|
82
134
|
|
|
83
135
|
```ts
|
|
84
|
-
const space = await was.createSpace({ name: 'Home' })
|
|
136
|
+
const space = await was.createSpace({ name: 'Home' })
|
|
85
137
|
|
|
86
138
|
const collection = await space.createCollection({
|
|
87
|
-
id: 'credentials',
|
|
88
139
|
name: 'Verifiable Credentials'
|
|
89
140
|
})
|
|
90
141
|
|
|
@@ -94,18 +145,99 @@ await collection.put('vc-1', {
|
|
|
94
145
|
})
|
|
95
146
|
const vc = await collection.get('vc-1') // parsed JSON object, or null on a miss
|
|
96
147
|
|
|
97
|
-
const listing = await collection.list() // { id, url, totalItems, items, ... }
|
|
98
|
-
|
|
99
148
|
await collection.resource('vc-1').delete() // delete one resource by id
|
|
100
149
|
await space.delete() // delete the whole space (idempotent)
|
|
101
150
|
```
|
|
102
151
|
|
|
103
152
|
`delete()` is uniform at every level, takes no argument, and always deletes the
|
|
104
153
|
thing the handle points at -- so there is no "delete the collection" vs "delete
|
|
105
|
-
one item" footgun.
|
|
154
|
+
one item" footgun. The next sections cover each level in turn.
|
|
155
|
+
|
|
156
|
+
### Spaces
|
|
157
|
+
|
|
158
|
+
A Space is the top-level container, created from the spaces repository. The
|
|
159
|
+
server requires a `name`; `controller` defaults to the client's own DID, and the
|
|
160
|
+
server generates the id unless you pass one.
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
const space = await was.createSpace({ name: 'Home' }) // POST /spaces/
|
|
164
|
+
|
|
165
|
+
// Lazy handle to an existing space by id -- no I/O until a verb runs.
|
|
166
|
+
const same = was.space(space.id)
|
|
167
|
+
|
|
168
|
+
// Read the Space Description (null if missing or not visible to you).
|
|
169
|
+
const desc = await space.describe() // { id, type: ['Space'], name, controller } | null
|
|
170
|
+
|
|
171
|
+
// Upsert: merges the given fields over the current description.
|
|
172
|
+
await space.configure({ name: 'Home (renamed)' })
|
|
173
|
+
|
|
174
|
+
await space.delete() // idempotent
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Listing every space in the repository (`was.listSpaces()`) is specified but not
|
|
178
|
+
yet implemented by the reference server, so it currently throws
|
|
179
|
+
`NotImplementedError`. To enumerate what is _inside_ a space, use
|
|
180
|
+
`space.collections()` (below).
|
|
181
|
+
|
|
182
|
+
### Collections
|
|
183
|
+
|
|
184
|
+
A Collection lives inside a Space and holds resources. WAS does not auto-create
|
|
185
|
+
parents, so `createCollection` throws `NotFoundError` if the space does not
|
|
186
|
+
exist. The server generates the id unless you pass one (a handful of reserved
|
|
187
|
+
ids are rejected).
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
// Create.
|
|
191
|
+
const collection = await space.createCollection({
|
|
192
|
+
name: 'Verifiable Credentials'
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
// Lazy handle to an existing collection by id.
|
|
196
|
+
const same = space.collection(collection.id)
|
|
197
|
+
|
|
198
|
+
// Read the Collection Description (null if missing or not visible).
|
|
199
|
+
const desc = await collection.describe() // { id, type: ['Collection'], name } | null
|
|
200
|
+
|
|
201
|
+
// Update (upsert; merges over the current description).
|
|
202
|
+
await collection.configure({ name: 'Credentials' })
|
|
203
|
+
|
|
204
|
+
// List the collections in a space.
|
|
205
|
+
const collections = await space.collections()
|
|
206
|
+
// { url, totalItems, items: [{ id, name, url }, ...] } | null
|
|
207
|
+
|
|
208
|
+
// List the resources inside this collection.
|
|
209
|
+
const resources = await collection.list()
|
|
210
|
+
// { id, url, totalItems, items: [{ id, url, contentType }, ...], ... } | null
|
|
211
|
+
|
|
212
|
+
await collection.delete() // deletes the whole collection; idempotent
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
To delete a single resource instead of the whole collection, use
|
|
216
|
+
`collection.resource(id).delete()`.
|
|
106
217
|
|
|
107
218
|
### Resources: JSON and binary
|
|
108
219
|
|
|
220
|
+
A Resource is a JSON object or binary blob keyed by id within a Collection. Use
|
|
221
|
+
`add()` for a server-generated id or `put(id, ...)` to create-or-replace at a
|
|
222
|
+
known id (both throw `NotFoundError` if the parent collection is missing):
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
// Server-generated id; returns { id, url, contentType? }.
|
|
226
|
+
const added = await collection.add({
|
|
227
|
+
type: ['VerifiableCredential'],
|
|
228
|
+
name: 'Diploma'
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
// Create or replace at a known id (upsert).
|
|
232
|
+
await collection.put('vc-1', {
|
|
233
|
+
type: ['VerifiableCredential'],
|
|
234
|
+
name: 'Diploma'
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
const vc = await collection.get('vc-1') // parsed JSON object, or null on a miss
|
|
238
|
+
await collection.resource('vc-1').delete() // idempotent
|
|
239
|
+
```
|
|
240
|
+
|
|
109
241
|
Writes detect the payload: a plain object/array is sent as JSON; a
|
|
110
242
|
`Blob`/`Uint8Array`/`Buffer` is sent as binary, with the content-type taken from
|
|
111
243
|
`options.contentType`, the `Blob.type`, or `application/octet-stream`.
|
|
@@ -153,12 +285,48 @@ authorizes on these case-sensitively (uppercase), but `grant()` also accepts the
|
|
|
153
285
|
lowercase forms and normalizes them to uppercase in the signed zcap -- so
|
|
154
286
|
`actions: ['get']` still validates server-side.
|
|
155
287
|
|
|
288
|
+
### Public sharing and access-control policies
|
|
289
|
+
|
|
290
|
+
A Space, Collection, or Resource can carry an access-control **policy** that
|
|
291
|
+
grants read access beyond capabilities -- most commonly making it world-readable
|
|
292
|
+
("share via public link"). The policy methods live on all three handles:
|
|
293
|
+
|
|
294
|
+
```ts
|
|
295
|
+
// Make a whole collection world-readable (the "create public link" case).
|
|
296
|
+
await collection.setPublic() // sugar for setPolicy({ type: 'PublicCanRead' })
|
|
297
|
+
|
|
298
|
+
// Anyone (even unauthenticated) can now read its resources.
|
|
299
|
+
const link = added.url // hand this URL out; a plain GET resolves it
|
|
300
|
+
|
|
301
|
+
// Inspect or revoke.
|
|
302
|
+
const policy = await collection.getPolicy() // { type: 'PublicCanRead' } | null
|
|
303
|
+
const isPublic = await collection.isPublic() // true if its own policy is PublicCanRead
|
|
304
|
+
await collection.clearPolicy() // revert to capability-only access (idempotent)
|
|
305
|
+
|
|
306
|
+
// setPolicy() is the generic, forward-compatible primitive; setPublic() is sugar.
|
|
307
|
+
await space.setPolicy({ type: 'PublicCanRead' }) // inherited by all contents
|
|
308
|
+
await resource.setPublic() // a single public resource
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Policies are resolved most-specific-first (Resource over Collection over Space)
|
|
312
|
+
and are permissive-only -- they broaden access, never restrict a valid
|
|
313
|
+
capability holder. Managing a policy is a controller-level operation. Discover a
|
|
314
|
+
policy via `space.linkset()` / `collection.linkset()` (RFC9264) or the `linkset`
|
|
315
|
+
property on a description.
|
|
316
|
+
|
|
317
|
+
`isPublic()` is a read-only convenience that returns `true` when the Space,
|
|
318
|
+
Collection, or Resource has a `{ type: 'PublicCanRead' }` policy -- that is, when
|
|
319
|
+
it has been made public via `setPublic()` (or an equivalent `setPolicy()` call).
|
|
320
|
+
It's meant to drive data-browser style UI, to show a "This
|
|
321
|
+
space(/collection/resource) has been shared publicly" type of icon.
|
|
322
|
+
|
|
156
323
|
### Export and import
|
|
157
324
|
|
|
158
325
|
```ts
|
|
159
326
|
const archive = await space.export() // Uint8Array (application/x-tar)
|
|
160
327
|
const stats = await otherSpace.import(archive)
|
|
161
|
-
// { collectionsCreated, collectionsSkipped, resourcesCreated, resourcesSkipped
|
|
328
|
+
// { collectionsCreated, collectionsSkipped, resourcesCreated, resourcesSkipped,
|
|
329
|
+
// policiesCreated, policiesSkipped }
|
|
162
330
|
```
|
|
163
331
|
|
|
164
332
|
### The manual-request escape hatch
|
|
@@ -191,7 +359,7 @@ All error classes extend `WasError` (carrying `status`, `title`, `details`, and
|
|
|
191
359
|
`requestUrl`). `delete()` additionally treats a 404 as success, so it is
|
|
192
360
|
idempotent.
|
|
193
361
|
|
|
194
|
-
Some spec endpoints (`listSpaces()`, `
|
|
362
|
+
Some spec endpoints (`listSpaces()`, `meta`, `query`, ...) are not yet
|
|
195
363
|
implemented by the reference server and currently surface `NotImplementedError`.
|
|
196
364
|
|
|
197
365
|
## Contribute
|
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, ResourceListing } from './types.js';
|
|
3
|
+
import type { AddResult, BackendReference, CollectionDescription, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, Json, LinkSet, PolicyDocument, ResourceListing } from './types.js';
|
|
4
4
|
export declare class Collection {
|
|
5
5
|
readonly spaceId: string;
|
|
6
6
|
readonly id: string;
|
|
@@ -108,5 +108,49 @@ export declare class Collection {
|
|
|
108
108
|
* @returns {Promise<IDelegatedZcap>}
|
|
109
109
|
*/
|
|
110
110
|
grant(options: GrantOptions): Promise<IDelegatedZcap>;
|
|
111
|
+
/**
|
|
112
|
+
* Reads the collection's access-control policy. Returns `null` when no policy
|
|
113
|
+
* is set (or it is not visible to you). Managing a policy is a controller-level
|
|
114
|
+
* operation; a capability scoped to the collection does not cover its policy
|
|
115
|
+
* sub-resource.
|
|
116
|
+
*
|
|
117
|
+
* @returns {Promise<PolicyDocument | null>}
|
|
118
|
+
*/
|
|
119
|
+
getPolicy(): Promise<PolicyDocument | null>;
|
|
120
|
+
/**
|
|
121
|
+
* Sets (creates or replaces) the collection's access-control policy.
|
|
122
|
+
*
|
|
123
|
+
* @param policy {PolicyDocument}
|
|
124
|
+
* @returns {Promise<void>}
|
|
125
|
+
*/
|
|
126
|
+
setPolicy(policy: PolicyDocument): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Returns `true` when this collection's policy is `PublicCanRead`.
|
|
129
|
+
*
|
|
130
|
+
* @returns {Promise<boolean>}
|
|
131
|
+
*/
|
|
132
|
+
isPublic(): Promise<boolean>;
|
|
133
|
+
/**
|
|
134
|
+
* Makes the collection world-readable: every resource in it becomes readable
|
|
135
|
+
* without authorization (unless overridden by a more specific policy). Sugar
|
|
136
|
+
* for `setPolicy({ type: 'PublicCanRead' })`.
|
|
137
|
+
*
|
|
138
|
+
* @returns {Promise<void>}
|
|
139
|
+
*/
|
|
140
|
+
setPublic(): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Removes the collection's access-control policy, reverting it to
|
|
143
|
+
* capability-only access. Idempotent.
|
|
144
|
+
*
|
|
145
|
+
* @returns {Promise<void>}
|
|
146
|
+
*/
|
|
147
|
+
clearPolicy(): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Reads the collection's linkset (RFC9264 policy discovery). Returns `null`
|
|
150
|
+
* if the collection is missing or not visible to you.
|
|
151
|
+
*
|
|
152
|
+
* @returns {Promise<LinkSet | null>}
|
|
153
|
+
*/
|
|
154
|
+
linkset(): Promise<LinkSet | null>;
|
|
111
155
|
}
|
|
112
156
|
//# 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":"AAkBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,EACL,IAAI,EACJ,OAAO,EACP,cAAc,EACd,eAAe,EAChB,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,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AC;IAU7C;;;;;;OAMG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IAU3D;;;;;;;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/Collection.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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, resourcePath, toUrl } from './internal/paths.js';
|
|
9
|
+
import { collectionPath, collectionItems, collectionPolicy, collectionLinkset, resourcePath, toUrl } from './internal/paths.js';
|
|
10
10
|
import { prepareBody, parseResource } from './internal/content.js';
|
|
11
11
|
import { delegateGrant } from './internal/grant.js';
|
|
12
12
|
import { send } from './internal/request.js';
|
|
@@ -205,5 +205,84 @@ export class Collection {
|
|
|
205
205
|
capability: options.capability ?? this._capability
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Reads the collection's access-control policy. Returns `null` when no policy
|
|
210
|
+
* is set (or it is not visible to you). Managing a policy is a controller-level
|
|
211
|
+
* operation; a capability scoped to the collection does not cover its policy
|
|
212
|
+
* sub-resource.
|
|
213
|
+
*
|
|
214
|
+
* @returns {Promise<PolicyDocument | null>}
|
|
215
|
+
*/
|
|
216
|
+
async getPolicy() {
|
|
217
|
+
const response = await send(this._context, {
|
|
218
|
+
path: collectionPolicy(this.spaceId, this.id),
|
|
219
|
+
method: 'GET',
|
|
220
|
+
capability: this._capability,
|
|
221
|
+
read: true
|
|
222
|
+
});
|
|
223
|
+
return response === null ? null : response.data;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Sets (creates or replaces) the collection's access-control policy.
|
|
227
|
+
*
|
|
228
|
+
* @param policy {PolicyDocument}
|
|
229
|
+
* @returns {Promise<void>}
|
|
230
|
+
*/
|
|
231
|
+
async setPolicy(policy) {
|
|
232
|
+
await send(this._context, {
|
|
233
|
+
path: collectionPolicy(this.spaceId, this.id),
|
|
234
|
+
method: 'PUT',
|
|
235
|
+
capability: this._capability,
|
|
236
|
+
json: policy
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Returns `true` when this collection's policy is `PublicCanRead`.
|
|
241
|
+
*
|
|
242
|
+
* @returns {Promise<boolean>}
|
|
243
|
+
*/
|
|
244
|
+
async isPublic() {
|
|
245
|
+
const policy = await this.getPolicy();
|
|
246
|
+
return policy?.type === 'PublicCanRead';
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Makes the collection world-readable: every resource in it becomes readable
|
|
250
|
+
* without authorization (unless overridden by a more specific policy). Sugar
|
|
251
|
+
* for `setPolicy({ type: 'PublicCanRead' })`.
|
|
252
|
+
*
|
|
253
|
+
* @returns {Promise<void>}
|
|
254
|
+
*/
|
|
255
|
+
async setPublic() {
|
|
256
|
+
await this.setPolicy({ type: 'PublicCanRead' });
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Removes the collection's access-control policy, reverting it to
|
|
260
|
+
* capability-only access. Idempotent.
|
|
261
|
+
*
|
|
262
|
+
* @returns {Promise<void>}
|
|
263
|
+
*/
|
|
264
|
+
async clearPolicy() {
|
|
265
|
+
await send(this._context, {
|
|
266
|
+
path: collectionPolicy(this.spaceId, this.id),
|
|
267
|
+
method: 'DELETE',
|
|
268
|
+
capability: this._capability,
|
|
269
|
+
idempotent: true
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Reads the collection's linkset (RFC9264 policy discovery). Returns `null`
|
|
274
|
+
* if the collection is missing or not visible to you.
|
|
275
|
+
*
|
|
276
|
+
* @returns {Promise<LinkSet | null>}
|
|
277
|
+
*/
|
|
278
|
+
async linkset() {
|
|
279
|
+
const response = await send(this._context, {
|
|
280
|
+
path: collectionLinkset(this.spaceId, this.id),
|
|
281
|
+
method: 'GET',
|
|
282
|
+
capability: this._capability,
|
|
283
|
+
read: true
|
|
284
|
+
});
|
|
285
|
+
return response === null ? null : response.data;
|
|
286
|
+
}
|
|
208
287
|
}
|
|
209
288
|
//# 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;;;;GAIG;AACH,OAAO,EACL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,KAAK,EACN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Collection.js","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,KAAK,EACN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA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AC,EAAE,CAAC;YAC9C,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,IAAgB,CAAA;IAC9D,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 } from './types.js';
|
|
2
|
+
import type { IZcap, Json, PolicyDocument } from './types.js';
|
|
3
3
|
export declare class Resource {
|
|
4
4
|
readonly spaceId: string;
|
|
5
5
|
readonly collectionId: string;
|
|
@@ -63,5 +63,41 @@ export declare class Resource {
|
|
|
63
63
|
* @returns {Promise<void>}
|
|
64
64
|
*/
|
|
65
65
|
delete(): Promise<void>;
|
|
66
|
+
private get _policyPath();
|
|
67
|
+
/**
|
|
68
|
+
* Reads the resource's access-control policy. Returns `null` when no policy is
|
|
69
|
+
* set (or it is not visible to you). Managing a policy is a controller-level
|
|
70
|
+
* operation.
|
|
71
|
+
*
|
|
72
|
+
* @returns {Promise<PolicyDocument | null>}
|
|
73
|
+
*/
|
|
74
|
+
getPolicy(): Promise<PolicyDocument | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Sets (creates or replaces) the resource's access-control policy.
|
|
77
|
+
*
|
|
78
|
+
* @param policy {PolicyDocument}
|
|
79
|
+
* @returns {Promise<void>}
|
|
80
|
+
*/
|
|
81
|
+
setPolicy(policy: PolicyDocument): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Makes this single resource world-readable: it becomes readable without
|
|
84
|
+
* authorization. Sugar for `setPolicy({ type: 'PublicCanRead' })`.
|
|
85
|
+
*
|
|
86
|
+
* @returns {Promise<void>}
|
|
87
|
+
*/
|
|
88
|
+
setPublic(): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Returns `true` when this resource policy is `PublicCanRead`.
|
|
91
|
+
*
|
|
92
|
+
* @returns {Promise<boolean>}
|
|
93
|
+
*/
|
|
94
|
+
isPublic(): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Removes the resource's access-control policy, reverting it to
|
|
97
|
+
* capability-only access. Idempotent.
|
|
98
|
+
*
|
|
99
|
+
* @returns {Promise<void>}
|
|
100
|
+
*/
|
|
101
|
+
clearPolicy(): Promise<void>;
|
|
66
102
|
}
|
|
67
103
|
//# sourceMappingURL=Resource.d.ts.map
|
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,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
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,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE7D,qBAAa,QAAQ;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,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,EACV,UAAU,EACX,EAAE;QACD,OAAO,EAAE,aAAa,CAAA;QACtB,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;QACpB,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,CAAC,EAAE,KAAK,CAAA;KACnB;IAQD,OAAO,KAAK,KAAK,GAEhB;IAED;;;;;;OAMG;IACG,GAAG,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAUxC;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAUvC;;;;;OAKG;IACG,QAAQ,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAa5C;;;;;;;;;OASG;IACG,GAAG,CACP,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,UAAU,EAC9B,OAAO,GAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAO,GACrC,OAAO,CAAC,IAAI,CAAC;IAehB;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAS7B,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 } from './internal/paths.js';
|
|
9
|
+
import { resourcePath, resourcePolicy } 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,5 +120,70 @@ export class Resource {
|
|
|
120
120
|
idempotent: true
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
+
get _policyPath() {
|
|
124
|
+
return resourcePolicy(this.spaceId, this.collectionId, this.id);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Reads the resource's access-control policy. Returns `null` when no policy is
|
|
128
|
+
* set (or it is not visible to you). Managing a policy is a controller-level
|
|
129
|
+
* operation.
|
|
130
|
+
*
|
|
131
|
+
* @returns {Promise<PolicyDocument | null>}
|
|
132
|
+
*/
|
|
133
|
+
async getPolicy() {
|
|
134
|
+
const response = await send(this._context, {
|
|
135
|
+
path: this._policyPath,
|
|
136
|
+
method: 'GET',
|
|
137
|
+
capability: this._capability,
|
|
138
|
+
read: true
|
|
139
|
+
});
|
|
140
|
+
return response === null ? null : response.data;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Sets (creates or replaces) the resource's access-control policy.
|
|
144
|
+
*
|
|
145
|
+
* @param policy {PolicyDocument}
|
|
146
|
+
* @returns {Promise<void>}
|
|
147
|
+
*/
|
|
148
|
+
async setPolicy(policy) {
|
|
149
|
+
await send(this._context, {
|
|
150
|
+
path: this._policyPath,
|
|
151
|
+
method: 'PUT',
|
|
152
|
+
capability: this._capability,
|
|
153
|
+
json: policy
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Makes this single resource world-readable: it becomes readable without
|
|
158
|
+
* authorization. Sugar for `setPolicy({ type: 'PublicCanRead' })`.
|
|
159
|
+
*
|
|
160
|
+
* @returns {Promise<void>}
|
|
161
|
+
*/
|
|
162
|
+
async setPublic() {
|
|
163
|
+
await this.setPolicy({ type: 'PublicCanRead' });
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns `true` when this resource policy is `PublicCanRead`.
|
|
167
|
+
*
|
|
168
|
+
* @returns {Promise<boolean>}
|
|
169
|
+
*/
|
|
170
|
+
async isPublic() {
|
|
171
|
+
const policy = await this.getPolicy();
|
|
172
|
+
return policy?.type === 'PublicCanRead';
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Removes the resource's access-control policy, reverting it to
|
|
176
|
+
* capability-only access. Idempotent.
|
|
177
|
+
*
|
|
178
|
+
* @returns {Promise<void>}
|
|
179
|
+
*/
|
|
180
|
+
async clearPolicy() {
|
|
181
|
+
await send(this._context, {
|
|
182
|
+
path: this._policyPath,
|
|
183
|
+
method: 'DELETE',
|
|
184
|
+
capability: this._capability,
|
|
185
|
+
idempotent: true
|
|
186
|
+
});
|
|
187
|
+
}
|
|
123
188
|
}
|
|
124
189
|
//# sourceMappingURL=Resource.js.map
|
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,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,MAAM,qBAAqB,CAAA;AAClE,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;AAG5C,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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I,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, CollectionListing, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, ImportStats, SpaceDescription } from './types.js';
|
|
3
|
+
import type { BackendReference, CollectionListing, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, ImportStats, LinkSet, PolicyDocument, SpaceDescription } from './types.js';
|
|
4
4
|
export declare class Space {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
private readonly _context;
|
|
@@ -95,5 +95,49 @@ export declare class Space {
|
|
|
95
95
|
* @returns {Promise<ImportStats>}
|
|
96
96
|
*/
|
|
97
97
|
import(tar: Uint8Array | Blob): Promise<ImportStats>;
|
|
98
|
+
/**
|
|
99
|
+
* Reads the space's access-control policy. Returns `null` when no policy is
|
|
100
|
+
* set (or it is not visible to you). A space-level policy is inherited by all
|
|
101
|
+
* collections and resources unless overridden by a more specific one. Managing
|
|
102
|
+
* a policy is a controller-level operation.
|
|
103
|
+
*
|
|
104
|
+
* @returns {Promise<PolicyDocument | null>}
|
|
105
|
+
*/
|
|
106
|
+
getPolicy(): Promise<PolicyDocument | null>;
|
|
107
|
+
/**
|
|
108
|
+
* Sets (creates or replaces) the space's access-control policy.
|
|
109
|
+
*
|
|
110
|
+
* @param policy {PolicyDocument}
|
|
111
|
+
* @returns {Promise<void>}
|
|
112
|
+
*/
|
|
113
|
+
setPolicy(policy: PolicyDocument): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Returns `true` when this space's policy is `PublicCanRead`.
|
|
116
|
+
*
|
|
117
|
+
* @returns {Promise<boolean>}
|
|
118
|
+
*/
|
|
119
|
+
isPublic(): Promise<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* Makes the whole space world-readable: every collection and resource under
|
|
122
|
+
* it becomes readable without authorization (unless overridden by a more
|
|
123
|
+
* specific policy). Sugar for `setPolicy({ type: 'PublicCanRead' })`.
|
|
124
|
+
*
|
|
125
|
+
* @returns {Promise<void>}
|
|
126
|
+
*/
|
|
127
|
+
setPublic(): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Removes the space's access-control policy, reverting it to capability-only
|
|
130
|
+
* access. Idempotent.
|
|
131
|
+
*
|
|
132
|
+
* @returns {Promise<void>}
|
|
133
|
+
*/
|
|
134
|
+
clearPolicy(): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Reads the space's linkset (RFC9264 policy discovery). Returns `null` if the
|
|
137
|
+
* space is missing or not visible to you.
|
|
138
|
+
*
|
|
139
|
+
* @returns {Promise<LinkSet | null>}
|
|
140
|
+
*/
|
|
141
|
+
linkset(): Promise<LinkSet | null>;
|
|
98
142
|
}
|
|
99
143
|
//# sourceMappingURL=Space.d.ts.map
|
package/dist/Space.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EACV,gBAAgB,EAEhB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,EACL,WAAW,EACX,OAAO,EACP,cAAc,EACd,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;;;;;OAKG;IACG,QAAQ,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAUlD;;;;;;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
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, toUrl } from './internal/paths.js';
|
|
10
|
+
import { spacePath, spaceItems, spaceCollections, spaceExport, spaceImport, 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';
|
|
@@ -198,5 +198,84 @@ export class Space {
|
|
|
198
198
|
});
|
|
199
199
|
return response.data;
|
|
200
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Reads the space's access-control policy. Returns `null` when no policy is
|
|
203
|
+
* set (or it is not visible to you). A space-level policy is inherited by all
|
|
204
|
+
* collections and resources unless overridden by a more specific one. Managing
|
|
205
|
+
* a policy is a controller-level operation.
|
|
206
|
+
*
|
|
207
|
+
* @returns {Promise<PolicyDocument | null>}
|
|
208
|
+
*/
|
|
209
|
+
async getPolicy() {
|
|
210
|
+
const response = await send(this._context, {
|
|
211
|
+
path: spacePolicy(this.id),
|
|
212
|
+
method: 'GET',
|
|
213
|
+
capability: this._capability,
|
|
214
|
+
read: true
|
|
215
|
+
});
|
|
216
|
+
return response === null ? null : response.data;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Sets (creates or replaces) the space's access-control policy.
|
|
220
|
+
*
|
|
221
|
+
* @param policy {PolicyDocument}
|
|
222
|
+
* @returns {Promise<void>}
|
|
223
|
+
*/
|
|
224
|
+
async setPolicy(policy) {
|
|
225
|
+
await send(this._context, {
|
|
226
|
+
path: spacePolicy(this.id),
|
|
227
|
+
method: 'PUT',
|
|
228
|
+
capability: this._capability,
|
|
229
|
+
json: policy
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Returns `true` when this space's policy is `PublicCanRead`.
|
|
234
|
+
*
|
|
235
|
+
* @returns {Promise<boolean>}
|
|
236
|
+
*/
|
|
237
|
+
async isPublic() {
|
|
238
|
+
const policy = await this.getPolicy();
|
|
239
|
+
return policy?.type === 'PublicCanRead';
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Makes the whole space world-readable: every collection and resource under
|
|
243
|
+
* it becomes readable without authorization (unless overridden by a more
|
|
244
|
+
* specific policy). Sugar for `setPolicy({ type: 'PublicCanRead' })`.
|
|
245
|
+
*
|
|
246
|
+
* @returns {Promise<void>}
|
|
247
|
+
*/
|
|
248
|
+
async setPublic() {
|
|
249
|
+
await this.setPolicy({ type: 'PublicCanRead' });
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Removes the space's access-control policy, reverting it to capability-only
|
|
253
|
+
* access. Idempotent.
|
|
254
|
+
*
|
|
255
|
+
* @returns {Promise<void>}
|
|
256
|
+
*/
|
|
257
|
+
async clearPolicy() {
|
|
258
|
+
await send(this._context, {
|
|
259
|
+
path: spacePolicy(this.id),
|
|
260
|
+
method: 'DELETE',
|
|
261
|
+
capability: this._capability,
|
|
262
|
+
idempotent: true
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Reads the space's linkset (RFC9264 policy discovery). Returns `null` if the
|
|
267
|
+
* space is missing or not visible to you.
|
|
268
|
+
*
|
|
269
|
+
* @returns {Promise<LinkSet | null>}
|
|
270
|
+
*/
|
|
271
|
+
async linkset() {
|
|
272
|
+
const response = await send(this._context, {
|
|
273
|
+
path: spaceLinkset(this.id),
|
|
274
|
+
method: 'GET',
|
|
275
|
+
capability: this._capability,
|
|
276
|
+
read: true
|
|
277
|
+
});
|
|
278
|
+
return response === null ? null : response.data;
|
|
279
|
+
}
|
|
201
280
|
}
|
|
202
281
|
//# 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,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,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;AAe5C,MAAM,OAAO,KAAK;IACP,EAAE,CAAQ;IAEF,QAAQ,CAAe;IACvB,WAAW,CAAQ;IAEpC;;;;;OAKG;IACH,YAAY,EACV,OAAO,EACP,OAAO,EACP,UAAU,EAKX;QACC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,EAAE,GAAG,OAAO,CAAA;QACjB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;IAC/B,CAAC;IAED,IAAY,KAAK;QACf,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;IAED;;;;;O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,CAAC,QAAQ;QACZ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;QACrC,OAAO,MAAM,EAAE,IAAI,KAAK,eAAe,CAAA;IACzC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAA;IACjD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACxB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACzC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,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,IAAgB,CAAA;IAC9D,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export { Space } from './Space.js';
|
|
|
10
10
|
export { Collection } from './Collection.js';
|
|
11
11
|
export { Resource } from './Resource.js';
|
|
12
12
|
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, WasServerError, mapError } from './errors.js';
|
|
13
|
-
export type { Json, JsonPrimitive, JsonObject, JsonArray, Action, ActionInput, SpaceDescription, CollectionDescription, CollectionSummary, CollectionListing, SpaceSummary, SpaceListing, ResourceSummary, ResourceListing, AddResult, ImportStats, HandleOptions, BackendReference, GrantOptions, RequestInput, IZcap, IDelegatedZcap, ISigner } from './types.js';
|
|
13
|
+
export type { Json, JsonPrimitive, JsonObject, JsonArray, Action, ActionInput, SpaceDescription, CollectionDescription, CollectionSummary, CollectionListing, SpaceSummary, SpaceListing, ResourceSummary, ResourceListing, AddResult, ImportStats, PolicyDocument, LinkSet, LinkSetEntry, HandleOptions, BackendReference, GrantOptions, RequestInput, IZcap, IDelegatedZcap, ISigner } from './types.js';
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,IAAI,EACJ,aAAa,EACb,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EACf,SAAS,EACT,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACR,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,IAAI,EACJ,aAAa,EACb,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EACf,SAAS,EACT,WAAW,EACX,cAAc,EACd,OAAO,EACP,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACR,MAAM,YAAY,CAAA"}
|
package/dist/internal/paths.d.ts
CHANGED
|
@@ -39,6 +39,14 @@ export declare function spaceExport(spaceId: string): string;
|
|
|
39
39
|
* `/space/:spaceId/import` -- import a tar archive into a space.
|
|
40
40
|
*/
|
|
41
41
|
export declare function spaceImport(spaceId: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* `/space/:spaceId/policy` -- the space-level access-control policy resource.
|
|
44
|
+
*/
|
|
45
|
+
export declare function spacePolicy(spaceId: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* `/space/:spaceId/linkset` -- the space-level linkset (policy discovery).
|
|
48
|
+
*/
|
|
49
|
+
export declare function spaceLinkset(spaceId: string): string;
|
|
42
50
|
/**
|
|
43
51
|
* `/space/:spaceId/:collectionId` -- get / update / delete a collection
|
|
44
52
|
* (no trailing slash).
|
|
@@ -49,11 +57,26 @@ export declare function collectionPath(spaceId: string, collectionId: string): s
|
|
|
49
57
|
* (trailing slash).
|
|
50
58
|
*/
|
|
51
59
|
export declare function collectionItems(spaceId: string, collectionId: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* `/space/:spaceId/:collectionId/policy` -- the collection-level access-control
|
|
62
|
+
* policy resource.
|
|
63
|
+
*/
|
|
64
|
+
export declare function collectionPolicy(spaceId: string, collectionId: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* `/space/:spaceId/:collectionId/linkset` -- the collection-level linkset
|
|
67
|
+
* (policy discovery).
|
|
68
|
+
*/
|
|
69
|
+
export declare function collectionLinkset(spaceId: string, collectionId: string): string;
|
|
52
70
|
/**
|
|
53
71
|
* `/space/:spaceId/:collectionId/:resourceId` -- get / put / delete a resource
|
|
54
72
|
* (no trailing slash).
|
|
55
73
|
*/
|
|
56
74
|
export declare function resourcePath(spaceId: string, collectionId: string, resourceId: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* `/space/:spaceId/:collectionId/:resourceId/policy` -- the resource-level
|
|
77
|
+
* access-control policy resource.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resourcePolicy(spaceId: string, collectionId: string, resourceId: string): string;
|
|
57
80
|
/**
|
|
58
81
|
* Resolves a path against the server base URL, producing an absolute URL
|
|
59
82
|
* string suitable for zcap `invocationTarget`s.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/internal/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AAMH;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAA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AAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,EACpB,SAAS,EACT,IAAI,EACL,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,MAAM,CAET"}
|
package/dist/internal/paths.js
CHANGED
|
@@ -56,6 +56,18 @@ export function spaceExport(spaceId) {
|
|
|
56
56
|
export function spaceImport(spaceId) {
|
|
57
57
|
return `/space/${encode(spaceId)}/import`;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* `/space/:spaceId/policy` -- the space-level access-control policy resource.
|
|
61
|
+
*/
|
|
62
|
+
export function spacePolicy(spaceId) {
|
|
63
|
+
return `/space/${encode(spaceId)}/policy`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* `/space/:spaceId/linkset` -- the space-level linkset (policy discovery).
|
|
67
|
+
*/
|
|
68
|
+
export function spaceLinkset(spaceId) {
|
|
69
|
+
return `/space/${encode(spaceId)}/linkset`;
|
|
70
|
+
}
|
|
59
71
|
/**
|
|
60
72
|
* `/space/:spaceId/:collectionId` -- get / update / delete a collection
|
|
61
73
|
* (no trailing slash).
|
|
@@ -70,6 +82,20 @@ export function collectionPath(spaceId, collectionId) {
|
|
|
70
82
|
export function collectionItems(spaceId, collectionId) {
|
|
71
83
|
return `/space/${encode(spaceId)}/${encode(collectionId)}/`;
|
|
72
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* `/space/:spaceId/:collectionId/policy` -- the collection-level access-control
|
|
87
|
+
* policy resource.
|
|
88
|
+
*/
|
|
89
|
+
export function collectionPolicy(spaceId, collectionId) {
|
|
90
|
+
return `/space/${encode(spaceId)}/${encode(collectionId)}/policy`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* `/space/:spaceId/:collectionId/linkset` -- the collection-level linkset
|
|
94
|
+
* (policy discovery).
|
|
95
|
+
*/
|
|
96
|
+
export function collectionLinkset(spaceId, collectionId) {
|
|
97
|
+
return `/space/${encode(spaceId)}/${encode(collectionId)}/linkset`;
|
|
98
|
+
}
|
|
73
99
|
/**
|
|
74
100
|
* `/space/:spaceId/:collectionId/:resourceId` -- get / put / delete a resource
|
|
75
101
|
* (no trailing slash).
|
|
@@ -77,6 +103,13 @@ export function collectionItems(spaceId, collectionId) {
|
|
|
77
103
|
export function resourcePath(spaceId, collectionId, resourceId) {
|
|
78
104
|
return `/space/${encode(spaceId)}/${encode(collectionId)}/${encode(resourceId)}`;
|
|
79
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* `/space/:spaceId/:collectionId/:resourceId/policy` -- the resource-level
|
|
108
|
+
* access-control policy resource.
|
|
109
|
+
*/
|
|
110
|
+
export function resourcePolicy(spaceId, collectionId, resourceId) {
|
|
111
|
+
return `/space/${encode(spaceId)}/${encode(collectionId)}/${encode(resourceId)}/policy`;
|
|
112
|
+
}
|
|
80
113
|
/**
|
|
81
114
|
* Resolves a path against the server base URL, producing an absolute URL
|
|
82
115
|
* string suitable for zcap `invocationTarget`s.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/internal/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AAEH,SAAS,MAAM,CAAC,OAAe;IAC7B,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,WAAW,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,GAAG,CAAA;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,eAAe,CAAA;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,SAAS,CAAA;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,SAAS,CAAA;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM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,UAAU,CAAA;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAe,EACf,YAAoB,EACpB,UAAkB;IAElB,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE,CAAA;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,YAAoB,EACpB,UAAkB;IAElB,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,CAAA;AACzF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,SAAS,EACT,IAAI,EAIL;IACC,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAA;AAC5C,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export interface SpaceDescription {
|
|
|
39
39
|
type: string[];
|
|
40
40
|
name?: string;
|
|
41
41
|
controller: string;
|
|
42
|
+
/** URL of the Space's linkset (policy discovery), if the server advertises it. */
|
|
43
|
+
linkset?: string;
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* A Collection Description object, as returned by the server.
|
|
@@ -47,6 +49,33 @@ export interface CollectionDescription {
|
|
|
47
49
|
id: string;
|
|
48
50
|
type: string[];
|
|
49
51
|
name?: string;
|
|
52
|
+
/** URL of the Collection's linkset (policy discovery), if advertised. */
|
|
53
|
+
linkset?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* An access-control policy document attached to a Space, Collection, or
|
|
57
|
+
* Resource. A `type`-discriminated, open/extensible shape: the reference server
|
|
58
|
+
* recognizes `{ "type": "PublicCanRead" }` for world-readable access (see
|
|
59
|
+
* `setPublic()`); other types are server-defined.
|
|
60
|
+
*/
|
|
61
|
+
export interface PolicyDocument {
|
|
62
|
+
type: string;
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* One member of a {@link LinkSet} (RFC9264): an `anchor` plus relation keys
|
|
67
|
+
* (e.g. `https://wallet.storage/spec#policy`) mapping to arrays of link targets.
|
|
68
|
+
*/
|
|
69
|
+
export interface LinkSetEntry {
|
|
70
|
+
anchor?: string;
|
|
71
|
+
[relation: string]: unknown;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Return shape of `space.linkset()` / `collection.linkset()`: an RFC9264
|
|
75
|
+
* `application/linkset+json` document.
|
|
76
|
+
*/
|
|
77
|
+
export interface LinkSet {
|
|
78
|
+
linkset: LinkSetEntry[];
|
|
50
79
|
}
|
|
51
80
|
/**
|
|
52
81
|
* One entry in a `CollectionListing` (a collection within a space).
|
|
@@ -116,6 +145,8 @@ export interface ImportStats {
|
|
|
116
145
|
collectionsSkipped: number;
|
|
117
146
|
resourcesCreated: number;
|
|
118
147
|
resourcesSkipped: number;
|
|
148
|
+
policiesCreated: number;
|
|
149
|
+
policiesSkipped: number;
|
|
119
150
|
}
|
|
120
151
|
/**
|
|
121
152
|
* Options accepted by every handle factory (`space()`, `collection()`,
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAE3D,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,CAAA;AAE9C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AAC5D,MAAM,WAAW,UAAU;IAC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