@interop/was-client 0.9.1 → 0.10.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 +27 -1
- package/dist/Collection.d.ts +49 -10
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +161 -61
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +13 -5
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +50 -38
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +1 -0
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +24 -27
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +43 -2
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +90 -14
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +11 -4
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +64 -33
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +194 -86
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +6 -12
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +6 -21
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/constants.d.ts +30 -0
- package/dist/edv/constants.d.ts.map +1 -0
- package/dist/edv/constants.js +30 -0
- package/dist/edv/constants.js.map +1 -0
- package/dist/edv/index.d.ts +1 -1
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +1 -1
- package/dist/edv/index.js.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -5
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/codec.d.ts +69 -4
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +93 -5
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/content.d.ts +74 -3
- package/dist/internal/content.d.ts.map +1 -1
- package/dist/internal/content.js +78 -7
- package/dist/internal/content.js.map +1 -1
- package/dist/internal/describe.d.ts.map +1 -1
- package/dist/internal/describe.js +2 -1
- package/dist/internal/describe.js.map +1 -1
- package/dist/internal/pagination.d.ts +45 -0
- package/dist/internal/pagination.d.ts.map +1 -0
- package/dist/internal/pagination.js +53 -0
- package/dist/internal/pagination.js.map +1 -0
- package/dist/internal/paths.d.ts +4 -0
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +10 -1
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/policy.d.ts +54 -0
- package/dist/internal/policy.d.ts.map +1 -0
- package/dist/internal/policy.js +58 -0
- package/dist/internal/policy.js.map +1 -0
- package/dist/internal/request.d.ts +4 -2
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +9 -2
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/reserved.d.ts +3 -8
- package/dist/internal/reserved.d.ts.map +1 -1
- package/dist/internal/reserved.js +10 -20
- package/dist/internal/reserved.js.map +1 -1
- package/dist/internal/write.d.ts +37 -0
- package/dist/internal/write.d.ts.map +1 -0
- package/dist/internal/write.js +29 -0
- package/dist/internal/write.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -217,10 +217,18 @@ await collection.configure({ name: 'Credentials' })
|
|
|
217
217
|
const collections = await space.collections()
|
|
218
218
|
// { url, totalItems, items: [{ id, name, url }, ...] } | null
|
|
219
219
|
|
|
220
|
-
// List the resources inside this collection.
|
|
220
|
+
// List the resources inside this collection. Transparently follows the
|
|
221
|
+
// server's `next` pagination links, buffering every page into one listing.
|
|
221
222
|
const resources = await collection.list()
|
|
222
223
|
// { id, url, totalItems, items: [{ id, url, contentType }, ...], ... } | null
|
|
223
224
|
|
|
225
|
+
// For a large collection, stream one page (or item) at a time instead of
|
|
226
|
+
// buffering the whole thing -- follows `next` on demand, stops early on `break`.
|
|
227
|
+
for await (const item of collection.listItems()) {
|
|
228
|
+
// item: { id, url, contentType, name? }
|
|
229
|
+
}
|
|
230
|
+
// `collection.listPages()` yields whole pages if you'd rather page yourself.
|
|
231
|
+
|
|
224
232
|
await collection.delete() // deletes the whole collection; idempotent
|
|
225
233
|
```
|
|
226
234
|
|
|
@@ -271,6 +279,16 @@ await resource.getBytes() // Uint8Array
|
|
|
271
279
|
Reads auto-parse: `get()` returns a parsed object for a JSON content-type and a
|
|
272
280
|
`Blob` otherwise; `getText()` / `getBytes()` are explicit escape hatches.
|
|
273
281
|
|
|
282
|
+
A write value is a JSON object/array or binary (`Blob`/`Uint8Array`) -- the
|
|
283
|
+
`ResourceData` type. A top-level JSON primitive (a bare `string`, `number`,
|
|
284
|
+
`boolean`, or `null`) is **not** accepted; it is a compile-time error. To store
|
|
285
|
+
one, either wrap it in an object (`put('greeting', { value: 'hello' })`) or
|
|
286
|
+
write it as binary via a `Blob`:
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
await collection.put('greeting', new Blob(['hello'], { type: 'text/plain' }))
|
|
290
|
+
```
|
|
291
|
+
|
|
274
292
|
### Delegation and sharing
|
|
275
293
|
|
|
276
294
|
`was.grant(...)` is the general delegation primitive; `space.grant(...)` and
|
|
@@ -348,6 +366,14 @@ const doc = await was.publicRead({
|
|
|
348
366
|
const listing = await was.publicListCollection({
|
|
349
367
|
collectionUrl: 'https://was.example/space/s/c'
|
|
350
368
|
}) // ResourceListing | null
|
|
369
|
+
|
|
370
|
+
// Or stream a large public collection one item/page at a time:
|
|
371
|
+
for await (const item of was.publicListCollectionItems({
|
|
372
|
+
collectionUrl: 'https://was.example/space/s/c'
|
|
373
|
+
})) {
|
|
374
|
+
// item: { id, url, contentType, name? }
|
|
375
|
+
}
|
|
376
|
+
// (`was.publicListCollectionPages(...)` yields whole pages.)
|
|
351
377
|
```
|
|
352
378
|
|
|
353
379
|
Both follow the read-method 404/null caveat: a missing or non-public target
|
package/dist/Collection.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ClientContext } from './internal/request.js';
|
|
2
2
|
import { Resource } from './Resource.js';
|
|
3
|
-
import type { AddResult, BackendDescriptor, BackendReference, BackendUsage, CollectionDescription, CollectionEncryption, EncryptionOverride, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, Json, LinkSet, PolicyDocument, CollectionResourcesList } from './types.js';
|
|
3
|
+
import type { AddResult, BackendDescriptor, BackendReference, BackendUsage, CollectionDescription, CollectionEncryption, EncryptionOverride, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, Json, ResourceData, LinkSet, PolicyDocument, CollectionResourcesList, ResourceSummary } from './types.js';
|
|
4
4
|
export declare class Collection {
|
|
5
5
|
readonly spaceId: string;
|
|
6
6
|
readonly id: string;
|
|
7
7
|
private readonly _context;
|
|
8
8
|
private readonly _capability?;
|
|
9
9
|
private readonly _encryptionOverride?;
|
|
10
|
-
private
|
|
10
|
+
private readonly _codecHolder;
|
|
11
11
|
/**
|
|
12
12
|
* @param options {object}
|
|
13
13
|
* @param options.context {ClientContext} - Shared context (serverUrl, ezcap
|
|
@@ -28,14 +28,18 @@ export declare class Collection {
|
|
|
28
28
|
});
|
|
29
29
|
private get _path();
|
|
30
30
|
private get _itemsPath();
|
|
31
|
+
private get _policyPath();
|
|
31
32
|
/**
|
|
32
33
|
* Resolves (once, then caches) the codec for this collection's reads and
|
|
33
34
|
* writes: the identity codec for a plaintext collection, or the encrypting
|
|
34
35
|
* codec when this collection is declared encrypted -- by a per-handle override
|
|
35
36
|
* or its `encryption` marker -- and the client's keystore supplies its keys.
|
|
36
37
|
* An encrypted collection the client cannot key for fails closed (throws), and
|
|
37
|
-
*
|
|
38
|
-
* handle to the same collection re-reads it, so retain the handle to
|
|
38
|
+
* a successful marker read happens at most once per handle (memoized here) -- a
|
|
39
|
+
* fresh handle to the same collection re-reads it, so retain the handle to
|
|
40
|
+
* reuse it. A failed resolution (e.g. a transient 500/network error during
|
|
41
|
+
* marker discovery) is not memoized: the cache is cleared so the next call
|
|
42
|
+
* retries rather than re-throwing the stale error forever.
|
|
39
43
|
*
|
|
40
44
|
* @returns {Promise<ResourceCodec>}
|
|
41
45
|
*/
|
|
@@ -79,6 +83,9 @@ export declare class Collection {
|
|
|
79
83
|
* @param resourceId {string}
|
|
80
84
|
* @param options {object}
|
|
81
85
|
* @param [options.capability] {IZcap}
|
|
86
|
+
* @param [options.encryption] {EncryptionOverride} per-resource encryption
|
|
87
|
+
* override; wins over the Collection's codec and resolves a fresh one for
|
|
88
|
+
* this resource (see {@link EncryptionOverride})
|
|
82
89
|
* @returns {Resource}
|
|
83
90
|
*/
|
|
84
91
|
resource(resourceId: string, options?: HandleOptions): Resource;
|
|
@@ -87,12 +94,12 @@ export declare class Collection {
|
|
|
87
94
|
* binary for `Blob`/`Uint8Array`. Throws `NotFoundError` if the collection
|
|
88
95
|
* does not exist (WAS does not auto-create parents).
|
|
89
96
|
*
|
|
90
|
-
* @param data {
|
|
97
|
+
* @param data {ResourceData}
|
|
91
98
|
* @param options {object}
|
|
92
99
|
* @param [options.contentType] {string} content-type for binary data
|
|
93
100
|
* @returns {Promise<AddResult>}
|
|
94
101
|
*/
|
|
95
|
-
add(data:
|
|
102
|
+
add(data: ResourceData, options?: {
|
|
96
103
|
contentType?: string;
|
|
97
104
|
}): Promise<AddResult>;
|
|
98
105
|
/**
|
|
@@ -110,14 +117,14 @@ export declare class Collection {
|
|
|
110
117
|
* `conditional-writes` semantics. Returns the stored resource's new `etag`.
|
|
111
118
|
*
|
|
112
119
|
* @param resourceId {string}
|
|
113
|
-
* @param data {
|
|
120
|
+
* @param data {ResourceData}
|
|
114
121
|
* @param options {object}
|
|
115
122
|
* @param [options.contentType] {string} content-type for binary data
|
|
116
123
|
* @param [options.ifMatch] {string} update only if the ETag matches
|
|
117
124
|
* @param [options.ifNoneMatch] {boolean} create only if absent
|
|
118
125
|
* @returns {Promise<{ etag?: string }>}
|
|
119
126
|
*/
|
|
120
|
-
put(resourceId: string, data:
|
|
127
|
+
put(resourceId: string, data: ResourceData, options?: {
|
|
121
128
|
contentType?: string;
|
|
122
129
|
ifMatch?: string;
|
|
123
130
|
ifNoneMatch?: boolean;
|
|
@@ -125,12 +132,44 @@ export declare class Collection {
|
|
|
125
132
|
etag?: string;
|
|
126
133
|
}>;
|
|
127
134
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
135
|
+
* Reads the first page of the listing and packages the means to follow its
|
|
136
|
+
* `next` links (each page fetched with the same authorization). Returns `null`
|
|
137
|
+
* if the collection is missing or not visible to you (404 conflation caveat).
|
|
138
|
+
*
|
|
139
|
+
* @returns {Promise<PageWalk | null>}
|
|
140
|
+
*/
|
|
141
|
+
private _listWalk;
|
|
142
|
+
/**
|
|
143
|
+
* Lists the items in the collection. Transparently follows the server's `next`
|
|
144
|
+
* pagination links, buffering every page into a single list (the returned
|
|
145
|
+
* envelope omits `next`). Convenient, but holds the whole collection in memory
|
|
146
|
+
* -- for a large collection prefer `listPages()` or `listItems()`, which stream
|
|
147
|
+
* one page at a time and allow stopping early. Returns `null` if the collection
|
|
148
|
+
* is missing or not visible to you (404 conflation caveat).
|
|
130
149
|
*
|
|
131
150
|
* @returns {Promise<CollectionResourcesList | null>}
|
|
132
151
|
*/
|
|
133
152
|
list(): Promise<CollectionResourcesList | null>;
|
|
153
|
+
/**
|
|
154
|
+
* Lazily yields the listing one page at a time, following the server's `next`
|
|
155
|
+
* links on demand (each page fetched with the same authorization). Use this to
|
|
156
|
+
* stream a large collection in constant memory or to stop early. Yields nothing
|
|
157
|
+
* if the collection is missing or not visible to you (404 conflation caveat) --
|
|
158
|
+
* unlike `list()`, the iterator does not distinguish that from an empty
|
|
159
|
+
* collection.
|
|
160
|
+
*
|
|
161
|
+
* @returns {AsyncGenerator<CollectionResourcesList>}
|
|
162
|
+
*/
|
|
163
|
+
listPages(): AsyncGenerator<CollectionResourcesList>;
|
|
164
|
+
/**
|
|
165
|
+
* Lazily yields each item across every page, flattening `listPages()`. Yields
|
|
166
|
+
* the listing's `ResourceSummary` entries (id / url / contentType / name), not
|
|
167
|
+
* the resource bodies -- call `get(id)` to read a body. Yields nothing if the
|
|
168
|
+
* collection is missing or not visible to you (404 conflation caveat).
|
|
169
|
+
*
|
|
170
|
+
* @returns {AsyncGenerator<ResourceSummary>}
|
|
171
|
+
*/
|
|
172
|
+
listItems(): AsyncGenerator<ResourceSummary>;
|
|
134
173
|
/**
|
|
135
174
|
* Delegates access to this collection. Prefills the grant `target` with this
|
|
136
175
|
* collection's URL (and the bound `capability`, if any, for re-delegation).
|
package/dist/Collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":"AAoBA,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,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,cAAc,EACd,uBAAuB,EACvB,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,CAAC,WAAW,CAAC,CAAO;I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import { assertNotReserved } from './internal/reserved.js';
|
|
11
11
|
import { delegateGrant } from './internal/grant.js';
|
|
12
12
|
import { send } from './internal/request.js';
|
|
13
|
-
import { resolveCodec } from './internal/codec.js';
|
|
13
|
+
import { CodecHolder, resolveCodec, readCollectionMarker } from './internal/codec.js';
|
|
14
|
+
import { collectPages, walkPages } from './internal/pagination.js';
|
|
14
15
|
import { describeCollection } from './internal/describe.js';
|
|
15
|
-
import {
|
|
16
|
+
import { readEtag } from './internal/conditional.js';
|
|
17
|
+
import { sendEncodedWrite } from './internal/write.js';
|
|
18
|
+
import { readPolicy, writePolicy, deletePolicy } from './internal/policy.js';
|
|
19
|
+
import { createdId, dataOrNull } from './internal/content.js';
|
|
16
20
|
import { Resource } from './Resource.js';
|
|
17
21
|
export class Collection {
|
|
18
22
|
spaceId;
|
|
@@ -20,7 +24,7 @@ export class Collection {
|
|
|
20
24
|
_context;
|
|
21
25
|
_capability;
|
|
22
26
|
_encryptionOverride;
|
|
23
|
-
|
|
27
|
+
_codecHolder;
|
|
24
28
|
/**
|
|
25
29
|
* @param options {object}
|
|
26
30
|
* @param options.context {ClientContext} - Shared context (serverUrl, ezcap
|
|
@@ -38,6 +42,16 @@ export class Collection {
|
|
|
38
42
|
this.id = collectionId;
|
|
39
43
|
this._capability = capability;
|
|
40
44
|
this._encryptionOverride = encryption;
|
|
45
|
+
this._codecHolder = new CodecHolder(() => resolveCodec(this._context, {
|
|
46
|
+
spaceId: this.spaceId,
|
|
47
|
+
collectionId: this.id,
|
|
48
|
+
override: this._encryptionOverride,
|
|
49
|
+
readMarker: () => readCollectionMarker(this._context, {
|
|
50
|
+
spaceId: this.spaceId,
|
|
51
|
+
collectionId: this.id,
|
|
52
|
+
capability: this._capability
|
|
53
|
+
})
|
|
54
|
+
}));
|
|
41
55
|
}
|
|
42
56
|
get _path() {
|
|
43
57
|
return collectionPath(this.spaceId, this.id);
|
|
@@ -45,24 +59,25 @@ export class Collection {
|
|
|
45
59
|
get _itemsPath() {
|
|
46
60
|
return collectionItems(this.spaceId, this.id);
|
|
47
61
|
}
|
|
62
|
+
get _policyPath() {
|
|
63
|
+
return collectionPolicy(this.spaceId, this.id);
|
|
64
|
+
}
|
|
48
65
|
/**
|
|
49
66
|
* Resolves (once, then caches) the codec for this collection's reads and
|
|
50
67
|
* writes: the identity codec for a plaintext collection, or the encrypting
|
|
51
68
|
* codec when this collection is declared encrypted -- by a per-handle override
|
|
52
69
|
* or its `encryption` marker -- and the client's keystore supplies its keys.
|
|
53
70
|
* An encrypted collection the client cannot key for fails closed (throws), and
|
|
54
|
-
*
|
|
55
|
-
* handle to the same collection re-reads it, so retain the handle to
|
|
71
|
+
* a successful marker read happens at most once per handle (memoized here) -- a
|
|
72
|
+
* fresh handle to the same collection re-reads it, so retain the handle to
|
|
73
|
+
* reuse it. A failed resolution (e.g. a transient 500/network error during
|
|
74
|
+
* marker discovery) is not memoized: the cache is cleared so the next call
|
|
75
|
+
* retries rather than re-throwing the stale error forever.
|
|
56
76
|
*
|
|
57
77
|
* @returns {Promise<ResourceCodec>}
|
|
58
78
|
*/
|
|
59
79
|
_codec() {
|
|
60
|
-
return
|
|
61
|
-
spaceId: this.spaceId,
|
|
62
|
-
collectionId: this.id,
|
|
63
|
-
override: this._encryptionOverride,
|
|
64
|
-
readMarker: async () => (await this.describe())?.encryption
|
|
65
|
-
}));
|
|
80
|
+
return this._codecHolder.get();
|
|
66
81
|
}
|
|
67
82
|
/**
|
|
68
83
|
* Reads the Collection Description. Returns `null` if the collection is
|
|
@@ -94,13 +109,19 @@ export class Collection {
|
|
|
94
109
|
async configure(desc) {
|
|
95
110
|
assertNotReserved(this.id, 'collection');
|
|
96
111
|
const current = await this.describe();
|
|
112
|
+
// Merge every current field forward (mirror `Space.configure`): a
|
|
113
|
+
// replace-semantics server drops anything omitted from the PUT body, so
|
|
114
|
+
// `configure({ name })` on an EDV collection would otherwise wipe its
|
|
115
|
+
// `backend` or trip `encryption-immutable` by clearing the marker.
|
|
97
116
|
const name = desc.name ?? current?.name;
|
|
117
|
+
const backend = desc.backend ?? current?.backend;
|
|
118
|
+
const encryption = desc.encryption ?? current?.encryption;
|
|
98
119
|
const body = { id: this.id, name };
|
|
99
|
-
if (
|
|
100
|
-
body.backend =
|
|
120
|
+
if (backend) {
|
|
121
|
+
body.backend = backend;
|
|
101
122
|
}
|
|
102
|
-
if (
|
|
103
|
-
body.encryption =
|
|
123
|
+
if (encryption) {
|
|
124
|
+
body.encryption = encryption;
|
|
104
125
|
}
|
|
105
126
|
await send(this._context, {
|
|
106
127
|
path: this._path,
|
|
@@ -108,10 +129,21 @@ export class Collection {
|
|
|
108
129
|
capability: this._capability,
|
|
109
130
|
json: body
|
|
110
131
|
});
|
|
132
|
+
// Adding the encryption marker flips this collection from plaintext to
|
|
133
|
+
// encrypted server-side. Drop any codec memoized from the prior (plaintext)
|
|
134
|
+
// marker so the next read/write re-resolves it -- otherwise a `put` would
|
|
135
|
+
// reuse the cached identity codec and write server-visible plaintext into
|
|
136
|
+
// the now-encrypted collection. Child resource handles share this codec via
|
|
137
|
+
// their thunk, so resetting here propagates to them too.
|
|
138
|
+
if (desc.encryption) {
|
|
139
|
+
this._codecHolder.reset();
|
|
140
|
+
}
|
|
111
141
|
return {
|
|
112
142
|
id: this.id,
|
|
113
143
|
type: current?.type ?? ['Collection'],
|
|
114
|
-
...(name !== undefined ? { name } : {})
|
|
144
|
+
...(name !== undefined ? { name } : {}),
|
|
145
|
+
...(backend !== undefined ? { backend } : {}),
|
|
146
|
+
...(encryption !== undefined ? { encryption } : {})
|
|
115
147
|
};
|
|
116
148
|
}
|
|
117
149
|
/**
|
|
@@ -134,6 +166,9 @@ export class Collection {
|
|
|
134
166
|
* @param resourceId {string}
|
|
135
167
|
* @param options {object}
|
|
136
168
|
* @param [options.capability] {IZcap}
|
|
169
|
+
* @param [options.encryption] {EncryptionOverride} per-resource encryption
|
|
170
|
+
* override; wins over the Collection's codec and resolves a fresh one for
|
|
171
|
+
* this resource (see {@link EncryptionOverride})
|
|
137
172
|
* @returns {Resource}
|
|
138
173
|
*/
|
|
139
174
|
resource(resourceId, options = {}) {
|
|
@@ -143,9 +178,14 @@ export class Collection {
|
|
|
143
178
|
collectionId: this.id,
|
|
144
179
|
resourceId,
|
|
145
180
|
capability: options.capability ?? this._capability,
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
|
|
181
|
+
// A per-resource encryption override resolves its own codec (honoring the
|
|
182
|
+
// override); without one, share this collection's resolved codec so the
|
|
183
|
+
// resource handle does not repeat the marker-discovery round-trip. The two
|
|
184
|
+
// are mutually exclusive: the Resource ignores `encryption` when `codec`
|
|
185
|
+
// is supplied.
|
|
186
|
+
...(options.encryption !== undefined
|
|
187
|
+
? { encryption: options.encryption }
|
|
188
|
+
: { codec: () => this._codec() })
|
|
149
189
|
});
|
|
150
190
|
}
|
|
151
191
|
/**
|
|
@@ -153,7 +193,7 @@ export class Collection {
|
|
|
153
193
|
* binary for `Blob`/`Uint8Array`. Throws `NotFoundError` if the collection
|
|
154
194
|
* does not exist (WAS does not auto-create parents).
|
|
155
195
|
*
|
|
156
|
-
* @param data {
|
|
196
|
+
* @param data {ResourceData}
|
|
157
197
|
* @param options {object}
|
|
158
198
|
* @param [options.contentType] {string} content-type for binary data
|
|
159
199
|
* @returns {Promise<AddResult>}
|
|
@@ -167,49 +207,52 @@ export class Collection {
|
|
|
167
207
|
// A codec may attach a create-if-absent precondition for its minted id (the
|
|
168
208
|
// EDV codec guards a fresh insert with `If-None-Match: *`); plaintext add
|
|
169
209
|
// carries none.
|
|
170
|
-
const
|
|
210
|
+
const precondition = {
|
|
171
211
|
ifMatch: encoded.ifMatch,
|
|
172
212
|
ifNoneMatch: encoded.ifNoneMatch
|
|
173
|
-
}
|
|
213
|
+
};
|
|
174
214
|
// A codec that mints its own id (e.g. the encrypting codec's EDV id) writes
|
|
175
215
|
// by `PUT`; the identity codec returns no id and lets the server mint one
|
|
176
216
|
// via `POST`.
|
|
177
217
|
if (encoded.id !== undefined) {
|
|
178
218
|
const path = resourcePath(this.spaceId, this.id, encoded.id);
|
|
179
|
-
const response = await
|
|
219
|
+
const response = await sendEncodedWrite(this._context, {
|
|
180
220
|
path,
|
|
181
221
|
method: 'PUT',
|
|
182
222
|
capability: this._capability,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
headers
|
|
223
|
+
encoded,
|
|
224
|
+
precondition
|
|
186
225
|
});
|
|
187
226
|
return {
|
|
188
227
|
id: encoded.id,
|
|
189
228
|
url: toUrl({ serverUrl: this._context.serverUrl, path }),
|
|
190
|
-
|
|
229
|
+
// Report the plaintext resource type when the codec resolved one (the
|
|
230
|
+
// EDV codec's `resourceContentType`); otherwise the wire `contentType`,
|
|
231
|
+
// which for the identity codec already is the resource type.
|
|
232
|
+
contentType: encoded.resourceContentType ?? encoded.contentType,
|
|
191
233
|
etag: readEtag(response)
|
|
192
234
|
};
|
|
193
235
|
}
|
|
194
|
-
const response = await
|
|
236
|
+
const response = await sendEncodedWrite(this._context, {
|
|
195
237
|
path: this._itemsPath,
|
|
196
238
|
method: 'POST',
|
|
197
239
|
capability: this._capability,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
headers
|
|
240
|
+
encoded,
|
|
241
|
+
precondition
|
|
201
242
|
});
|
|
202
|
-
// POST always returns a response (404/errors throw via send()).
|
|
203
|
-
|
|
243
|
+
// POST always returns a response (404/errors throw via send()). The id is
|
|
244
|
+
// the body's `id`, or -- for a body-less 2xx -- the `Location` header.
|
|
245
|
+
const id = createdId(response);
|
|
246
|
+
const responseBody = response?.data;
|
|
204
247
|
const location = response.headers.get('location') ?? undefined;
|
|
205
248
|
return {
|
|
206
|
-
id
|
|
249
|
+
id,
|
|
207
250
|
url: location ??
|
|
208
251
|
toUrl({
|
|
209
252
|
serverUrl: this._context.serverUrl,
|
|
210
|
-
path: resourcePath(this.spaceId, this.id,
|
|
253
|
+
path: resourcePath(this.spaceId, this.id, id)
|
|
211
254
|
}),
|
|
212
|
-
contentType:
|
|
255
|
+
contentType: responseBody?.['content-type'],
|
|
213
256
|
etag: readEtag(response)
|
|
214
257
|
};
|
|
215
258
|
}
|
|
@@ -237,7 +280,7 @@ export class Collection {
|
|
|
237
280
|
* `conditional-writes` semantics. Returns the stored resource's new `etag`.
|
|
238
281
|
*
|
|
239
282
|
* @param resourceId {string}
|
|
240
|
-
* @param data {
|
|
283
|
+
* @param data {ResourceData}
|
|
241
284
|
* @param options {object}
|
|
242
285
|
* @param [options.contentType] {string} content-type for binary data
|
|
243
286
|
* @param [options.ifMatch] {string} update only if the ETag matches
|
|
@@ -248,19 +291,82 @@ export class Collection {
|
|
|
248
291
|
return this.resource(resourceId).put(data, options);
|
|
249
292
|
}
|
|
250
293
|
/**
|
|
251
|
-
*
|
|
252
|
-
*
|
|
294
|
+
* Reads the first page of the listing and packages the means to follow its
|
|
295
|
+
* `next` links (each page fetched with the same authorization). Returns `null`
|
|
296
|
+
* if the collection is missing or not visible to you (404 conflation caveat).
|
|
253
297
|
*
|
|
254
|
-
* @returns {Promise<
|
|
298
|
+
* @returns {Promise<PageWalk | null>}
|
|
255
299
|
*/
|
|
256
|
-
async
|
|
300
|
+
async _listWalk() {
|
|
257
301
|
const response = await send(this._context, {
|
|
258
302
|
path: this._itemsPath,
|
|
259
303
|
method: 'GET',
|
|
260
304
|
capability: this._capability,
|
|
261
305
|
read: true
|
|
262
306
|
});
|
|
263
|
-
|
|
307
|
+
if (response === null) {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
first: response.data,
|
|
312
|
+
firstUrl: toUrl({
|
|
313
|
+
serverUrl: this._context.serverUrl,
|
|
314
|
+
path: this._itemsPath
|
|
315
|
+
}),
|
|
316
|
+
fetchPage: async (url) => {
|
|
317
|
+
const pageResponse = await send(this._context, {
|
|
318
|
+
url,
|
|
319
|
+
method: 'GET',
|
|
320
|
+
capability: this._capability,
|
|
321
|
+
read: true
|
|
322
|
+
});
|
|
323
|
+
return dataOrNull(pageResponse);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Lists the items in the collection. Transparently follows the server's `next`
|
|
329
|
+
* pagination links, buffering every page into a single list (the returned
|
|
330
|
+
* envelope omits `next`). Convenient, but holds the whole collection in memory
|
|
331
|
+
* -- for a large collection prefer `listPages()` or `listItems()`, which stream
|
|
332
|
+
* one page at a time and allow stopping early. Returns `null` if the collection
|
|
333
|
+
* is missing or not visible to you (404 conflation caveat).
|
|
334
|
+
*
|
|
335
|
+
* @returns {Promise<CollectionResourcesList | null>}
|
|
336
|
+
*/
|
|
337
|
+
async list() {
|
|
338
|
+
const walk = await this._listWalk();
|
|
339
|
+
return walk === null ? null : collectPages(walk);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Lazily yields the listing one page at a time, following the server's `next`
|
|
343
|
+
* links on demand (each page fetched with the same authorization). Use this to
|
|
344
|
+
* stream a large collection in constant memory or to stop early. Yields nothing
|
|
345
|
+
* if the collection is missing or not visible to you (404 conflation caveat) --
|
|
346
|
+
* unlike `list()`, the iterator does not distinguish that from an empty
|
|
347
|
+
* collection.
|
|
348
|
+
*
|
|
349
|
+
* @returns {AsyncGenerator<CollectionResourcesList>}
|
|
350
|
+
*/
|
|
351
|
+
async *listPages() {
|
|
352
|
+
const walk = await this._listWalk();
|
|
353
|
+
if (walk === null) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
yield* walkPages(walk);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Lazily yields each item across every page, flattening `listPages()`. Yields
|
|
360
|
+
* the listing's `ResourceSummary` entries (id / url / contentType / name), not
|
|
361
|
+
* the resource bodies -- call `get(id)` to read a body. Yields nothing if the
|
|
362
|
+
* collection is missing or not visible to you (404 conflation caveat).
|
|
363
|
+
*
|
|
364
|
+
* @returns {AsyncGenerator<ResourceSummary>}
|
|
365
|
+
*/
|
|
366
|
+
async *listItems() {
|
|
367
|
+
for await (const page of this.listPages()) {
|
|
368
|
+
yield* page.items;
|
|
369
|
+
}
|
|
264
370
|
}
|
|
265
371
|
/**
|
|
266
372
|
* Delegates access to this collection. Prefills the grant `target` with this
|
|
@@ -286,13 +392,10 @@ export class Collection {
|
|
|
286
392
|
* @returns {Promise<PolicyDocument | null>}
|
|
287
393
|
*/
|
|
288
394
|
async getPolicy() {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
capability: this._capability,
|
|
293
|
-
read: true
|
|
395
|
+
return readPolicy(this._context, {
|
|
396
|
+
policyPath: this._policyPath,
|
|
397
|
+
capability: this._capability
|
|
294
398
|
});
|
|
295
|
-
return response === null ? null : response.data;
|
|
296
399
|
}
|
|
297
400
|
/**
|
|
298
401
|
* Sets (creates or replaces) the collection's access-control policy.
|
|
@@ -301,11 +404,10 @@ export class Collection {
|
|
|
301
404
|
* @returns {Promise<void>}
|
|
302
405
|
*/
|
|
303
406
|
async setPolicy(policy) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
capability: this._capability
|
|
308
|
-
json: policy
|
|
407
|
+
return writePolicy(this._context, {
|
|
408
|
+
policyPath: this._policyPath,
|
|
409
|
+
policy,
|
|
410
|
+
capability: this._capability
|
|
309
411
|
});
|
|
310
412
|
}
|
|
311
413
|
/**
|
|
@@ -334,11 +436,9 @@ export class Collection {
|
|
|
334
436
|
* @returns {Promise<void>}
|
|
335
437
|
*/
|
|
336
438
|
async clearPolicy() {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
capability: this._capability,
|
|
341
|
-
idempotent: true
|
|
439
|
+
return deletePolicy(this._context, {
|
|
440
|
+
policyPath: this._policyPath,
|
|
441
|
+
capability: this._capability
|
|
342
442
|
});
|
|
343
443
|
}
|
|
344
444
|
/**
|
|
@@ -354,7 +454,7 @@ export class Collection {
|
|
|
354
454
|
capability: this._capability,
|
|
355
455
|
read: true
|
|
356
456
|
});
|
|
357
|
-
return response
|
|
457
|
+
return dataOrNull(response);
|
|
358
458
|
}
|
|
359
459
|
/**
|
|
360
460
|
* Reads the storage backend this collection is stored on ("Collection Backend
|
|
@@ -378,7 +478,7 @@ export class Collection {
|
|
|
378
478
|
capability: this._capability,
|
|
379
479
|
read: true
|
|
380
480
|
});
|
|
381
|
-
return response
|
|
481
|
+
return dataOrNull(response);
|
|
382
482
|
}
|
|
383
483
|
/**
|
|
384
484
|
* Reads the collection's storage usage report, scoped to its backend (spec
|
|
@@ -395,7 +495,7 @@ export class Collection {
|
|
|
395
495
|
capability: this._capability,
|
|
396
496
|
read: true
|
|
397
497
|
});
|
|
398
|
-
return response
|
|
498
|
+
return dataOrNull(response);
|
|
399
499
|
}
|
|
400
500
|
}
|
|
401
501
|
//# 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,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,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,YAAY,EAAE,MAAM,
|
|
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,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,KAAK,EACN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE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