@interop/was-client 0.100.0 → 0.101.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.
Files changed (76) hide show
  1. package/README.md +123 -53
  2. package/dist/Collection.d.ts +21 -9
  3. package/dist/Collection.d.ts.map +1 -1
  4. package/dist/Collection.js +39 -37
  5. package/dist/Collection.js.map +1 -1
  6. package/dist/Resource.d.ts +0 -4
  7. package/dist/Resource.d.ts.map +1 -1
  8. package/dist/Resource.js +1 -6
  9. package/dist/Resource.js.map +1 -1
  10. package/dist/Space.d.ts +97 -24
  11. package/dist/Space.d.ts.map +1 -1
  12. package/dist/Space.js +168 -84
  13. package/dist/Space.js.map +1 -1
  14. package/dist/WasClient.d.ts +135 -55
  15. package/dist/WasClient.d.ts.map +1 -1
  16. package/dist/WasClient.js +220 -100
  17. package/dist/WasClient.js.map +1 -1
  18. package/dist/edv/EdvCodec.d.ts.map +1 -1
  19. package/dist/edv/EdvCodec.js +7 -4
  20. package/dist/edv/EdvCodec.js.map +1 -1
  21. package/dist/edv/docCipher.js +2 -2
  22. package/dist/edv/docCipher.js.map +1 -1
  23. package/dist/index.d.ts +0 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/internal/codec.d.ts +11 -1
  27. package/dist/internal/codec.d.ts.map +1 -1
  28. package/dist/internal/codec.js +11 -1
  29. package/dist/internal/codec.js.map +1 -1
  30. package/dist/internal/describe.d.ts +6 -0
  31. package/dist/internal/describe.d.ts.map +1 -1
  32. package/dist/internal/describe.js +18 -1
  33. package/dist/internal/describe.js.map +1 -1
  34. package/dist/internal/grant.js +1 -1
  35. package/dist/internal/grant.js.map +1 -1
  36. package/dist/internal/indexSchema.d.ts +19 -4
  37. package/dist/internal/indexSchema.d.ts.map +1 -1
  38. package/dist/internal/indexSchema.js +33 -6
  39. package/dist/internal/indexSchema.js.map +1 -1
  40. package/dist/internal/paths.d.ts +113 -18
  41. package/dist/internal/paths.d.ts.map +1 -1
  42. package/dist/internal/paths.js +224 -40
  43. package/dist/internal/paths.js.map +1 -1
  44. package/dist/internal/request.d.ts +47 -14
  45. package/dist/internal/request.d.ts.map +1 -1
  46. package/dist/internal/request.js +64 -44
  47. package/dist/internal/request.js.map +1 -1
  48. package/dist/internal/reserved.d.ts +15 -3
  49. package/dist/internal/reserved.d.ts.map +1 -1
  50. package/dist/internal/reserved.js +37 -8
  51. package/dist/internal/reserved.js.map +1 -1
  52. package/dist/internal/revoke.d.ts +1 -65
  53. package/dist/internal/revoke.d.ts.map +1 -1
  54. package/dist/internal/revoke.js +5 -136
  55. package/dist/internal/revoke.js.map +1 -1
  56. package/dist/internal/rootCapability.d.ts +66 -0
  57. package/dist/internal/rootCapability.d.ts.map +1 -0
  58. package/dist/internal/rootCapability.js +144 -0
  59. package/dist/internal/rootCapability.js.map +1 -0
  60. package/dist/internal/service.d.ts +5 -3
  61. package/dist/internal/service.d.ts.map +1 -1
  62. package/dist/internal/service.js +5 -3
  63. package/dist/internal/service.js.map +1 -1
  64. package/dist/internal/withCodec.d.ts +19 -4
  65. package/dist/internal/withCodec.d.ts.map +1 -1
  66. package/dist/internal/withCodec.js +18 -2
  67. package/dist/internal/withCodec.js.map +1 -1
  68. package/dist/internal/write.js +13 -9
  69. package/dist/internal/write.js.map +1 -1
  70. package/dist/paths.d.ts +5 -3
  71. package/dist/paths.d.ts.map +1 -1
  72. package/dist/paths.js +5 -3
  73. package/dist/paths.js.map +1 -1
  74. package/dist/sync/provisioning.js +1 -1
  75. package/dist/sync/provisioning.js.map +1 -1
  76. package/package.json +3 -3
package/dist/WasClient.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { isValidTarget } from '@interop/zcap';
2
- import { canonicalContainerUrl, parseAbsoluteHttpUrl, parseSpaceTarget } from './internal/paths.js';
2
+ import { canonicalBaseServerUrl, canonicalContainerUrl, canonicalSpaceUrl, parseAbsoluteHttpUrl, parseSpaceTarget, serviceDescriptionUrl, spacesRepositoryUrl, spaceUrlById, splitCollectionUrl } from './internal/paths.js';
3
3
  import { send, rawRequest, unsignedRequest } from './internal/request.js';
4
4
  import { parseResource, readJsonData } from './internal/content.js';
5
5
  import { buildPageWalk, collectPages, collectWalk, signedPageWalk, walkItems, walkPagesOrEmpty } from './internal/pagination.js';
6
6
  import { delegateGrant } from './internal/grant.js';
7
- import { spaceUrlOf, submitRevocation } from './internal/revoke.js';
7
+ import { submitRevocation } from './internal/revoke.js';
8
+ import { spaceUrlOf } from './internal/rootCapability.js';
8
9
  import { Memo } from './internal/memo.js';
9
10
  import { discoverService, readServiceDescription, selectServiceVersion } from './internal/service.js';
10
11
  import { IncompatibleServerError, NotSupportedError, ValidationError, WasServerError } from './errors.js';
@@ -13,47 +14,34 @@ import { Space } from './Space.js';
13
14
  import { Collection } from './Collection.js';
14
15
  import { Resource } from './Resource.js';
15
16
  /**
16
- * Checks that `value` is an absolute `http(s)` URL and returns it as `URL`
17
- * serializes it, or throws.
18
- *
19
- * @param options {object}
20
- * @param options.name {string} the option's name, for the error
21
- * @param options.value {string}
22
- * @returns {string}
23
- * @throws {ValidationError}
17
+ * The module-private key under which {@link WasClient.forSpace} hands the
18
+ * constructor a Space URL in place of a base server URL. A `unique symbol`
19
+ * keeps that arm off the public constructor: a caller holding a Space URL goes
20
+ * through `forSpace`, which documents what such a client can and cannot do.
24
21
  */
25
- function absoluteHttpUrl({ name, value }) {
26
- const parsed = parseAbsoluteHttpUrl(value);
27
- if (parsed === null) {
28
- throw new ValidationError(`${name} "${value}" is not an absolute http(s) URL.`);
29
- }
30
- return parsed.toString();
31
- }
22
+ const fixedSpace = Symbol('WasClient.forSpace');
32
23
  export class WasClient {
33
24
  /**
34
- * The service description's URL, when the client was built from one. Read
35
- * directly by discovery.
25
+ * The base server URL the client was built from, in canonical form
26
+ * (trailing slash supplied): the URL under which the server lays out
27
+ * `service`, `spaces/` and `space/{space_id}/`. `undefined` for a client
28
+ * built by {@link WasClient.forSpace}, which has none.
36
29
  */
37
- serviceUrl;
30
+ baseServerUrl;
38
31
  /**
39
- * The Spaces Repository URL the client was built from, when it was built
40
- * from one, in canonical container form (trailing slash supplied).
41
- * Discovery probes it for the `service` link. The URL `createSpace` and
42
- * `listSpaces` address is the service description's `spaces` member, not
43
- * this value.
32
+ * The Space URL a client built by {@link WasClient.forSpace} was opened on,
33
+ * in canonical form. `undefined` for a client built from a base server URL.
44
34
  */
45
- spacesUrl;
35
+ spaceUrl;
46
36
  zcapClient;
47
37
  encryption;
48
38
  /**
49
39
  * @param options {object}
50
- * @param [options.serviceUrl] {string} the URL of the server's service
51
- * description. Discovery reads it with an unsigned `GET`. Exactly one of
52
- * `serviceUrl` and `spacesUrl` is given
53
- * @param [options.spacesUrl] {string} the server's Spaces Repository
54
- * URL, for a caller that holds that rather than the service URL.
55
- * Discovery sends an unsigned `HEAD` to it and follows the `service`
56
- * link every response carries
40
+ * @param options.baseServerUrl {string} the server's base server URL: an
41
+ * absolute http(s) URL with no query or fragment, under which the server
42
+ * serves `service`, `spaces/` and `space/{space_id}/`. A missing trailing
43
+ * slash is supplied. For a server that is one fixed Space with no base,
44
+ * use {@link WasClient.forSpace} instead
57
45
  * @param options.zcapClient {ZcapClient} an ezcap client holding the signer
58
46
  * @param [options.encryption] {EncryptionProvider} the keystore that
59
47
  * supplies keys for collections declared encrypted (by their `encryption`
@@ -66,32 +54,63 @@ export class WasClient {
66
54
  * description the caller already holds (from a cache, say). The client
67
55
  * selects its version from this copy instead of discovering the document,
68
56
  * and still refuses it with `IncompatibleServerError` if it names no
69
- * version this client speaks, or (for a client built from `serviceUrl`)
70
- * if its `url` is another server's service URL. `service({ refresh:
71
- * true })` discards it and discovers afresh.
72
- * @throws {ValidationError} when neither or both of `serviceUrl` and
73
- * `spacesUrl` are given, or the one given is not an absolute http(s) URL
57
+ * version this client speaks, or (for a client built from a base server
58
+ * URL) if it describes another server (see {@link service}).
59
+ * `service({ refresh: true })` discards it and discovers afresh.
60
+ * @throws {ValidationError} when `baseServerUrl` is not an absolute
61
+ * http(s) URL, or carries a query or fragment
74
62
  */
75
- constructor({ serviceUrl, spacesUrl, zcapClient, encryption, serviceDescription }) {
76
- if ((serviceUrl === undefined) === (spacesUrl === undefined)) {
77
- throw new ValidationError('A WasClient is built from exactly one of `serviceUrl` (the service ' +
78
- 'description URL) and `spacesUrl` (the Spaces Repository URL).');
79
- }
80
- if (serviceUrl !== undefined) {
81
- this.serviceUrl = absoluteHttpUrl({
82
- name: 'serviceUrl',
83
- value: serviceUrl
84
- });
63
+ constructor(options) {
64
+ if (fixedSpace in options) {
65
+ this.spaceUrl = canonicalSpaceUrl(options[fixedSpace]);
85
66
  }
86
67
  else {
87
- // Canonical container form, so the probe addresses the container
88
- // itself rather than its redirect, and `was.spacesUrl` reads the same
89
- // as the `spacesUrl` discovery reports for the same repository.
90
- this.spacesUrl = canonicalContainerUrl(absoluteHttpUrl({ name: 'spacesUrl', value: spacesUrl }));
68
+ this.baseServerUrl = canonicalBaseServerUrl(options.baseServerUrl);
91
69
  }
92
- this.zcapClient = zcapClient;
93
- this.encryption = encryption;
94
- this.#serviceDescription = serviceDescription;
70
+ this.zcapClient = options.zcapClient;
71
+ this.encryption = options.encryption;
72
+ this.#serviceDescription = options.serviceDescription;
73
+ }
74
+ /**
75
+ * Opens a client on a single fixed Space: a server that is one Space with
76
+ * no Space id and no base server URL (a personal site whose Collections are
77
+ * `https://alice.example/posts/`, `https://alice.example/images/`, ...).
78
+ * The service description is found by following the `service` link on an
79
+ * unsigned `HEAD` of the Space URL. The Space itself is
80
+ * `was.spaceAt(was.spaceUrl)`, and `collectionAt(url)` opens one of its
81
+ * Collections directly.
82
+ *
83
+ * Such a client has no base server URL, so `space(id)`, `createSpace()` and
84
+ * `listSpaces()` throw `NotSupportedError`. Everything Space-scoped
85
+ * (`spaceAt`, `collectionAt`, `fromCapability`, `grant`, `revoke`, the
86
+ * public reads) works as on any client. Whether the server lets a client
87
+ * create Collections is read from its `collection-management` feature
88
+ * token, as for every server.
89
+ *
90
+ * @param options {object}
91
+ * @param options.spaceUrl {string} the Space's absolute URL, which may be
92
+ * an origin root
93
+ * @param [options.zcapClient] {ZcapClient} an ezcap client holding the
94
+ * signer; one of `zcapClient` and `signer` is given
95
+ * @param [options.signer] {ISigner} a signer to build the `ZcapClient`
96
+ * from, as {@link fromSigner} does
97
+ * @param [options.encryption] {EncryptionProvider} see the constructor
98
+ * @param [options.serviceDescription] {ServiceDescription} see the
99
+ * constructor; not checked against the Space URL, which names no server
100
+ * @returns {WasClient}
101
+ * @throws {ValidationError} when `spaceUrl` is not a Space URL, or neither
102
+ * or both of `zcapClient` and `signer` are given
103
+ */
104
+ static forSpace({ spaceUrl, zcapClient, signer, encryption, serviceDescription }) {
105
+ if ((zcapClient === undefined) === (signer === undefined)) {
106
+ throw new ValidationError('WasClient.forSpace takes exactly one of `zcapClient` and `signer`.');
107
+ }
108
+ return new WasClient({
109
+ [fixedSpace]: spaceUrl,
110
+ zcapClient: zcapClient ?? zcapClientForSigner({ signer: signer }),
111
+ encryption,
112
+ serviceDescription
113
+ });
95
114
  }
96
115
  /**
97
116
  * Convenience constructor that builds the ezcap `ZcapClient` internally from
@@ -103,17 +122,16 @@ export class WasClient {
103
122
  * and never needs a JSON-LD document loader to serve the suite's context.
104
123
  *
105
124
  * @param options {object}
106
- * @param [options.serviceUrl] {string} see the constructor
107
- * @param [options.spacesUrl] {string} see the constructor
125
+ * @param options.baseServerUrl {string} see the constructor
108
126
  * @param options.signer {ISigner}
109
127
  * @param [options.encryption] {EncryptionProvider} see the constructor
110
128
  * @param [options.serviceDescription] {ServiceDescription} see the
111
129
  * constructor
112
130
  * @returns {WasClient}
113
131
  */
114
- static fromSigner({ signer, encryption, serviceDescription, ...locator }) {
132
+ static fromSigner({ baseServerUrl, signer, encryption, serviceDescription }) {
115
133
  return new WasClient({
116
- ...locator,
134
+ baseServerUrl,
117
135
  zcapClient: zcapClientForSigner({ signer }),
118
136
  encryption,
119
137
  serviceDescription
@@ -134,46 +152,71 @@ export class WasClient {
134
152
  }
135
153
  #serviceDescription;
136
154
  #service = new Memo(async () => {
155
+ let info;
137
156
  if (this.#serviceDescription !== undefined) {
138
- const info = selectServiceVersion(this.#serviceDescription);
139
- this.#assertDescribesThisServer(info);
140
- return info;
157
+ info = selectServiceVersion(this.#serviceDescription);
141
158
  }
142
- return this.serviceUrl !== undefined
143
- ? readServiceDescription({ serviceUrl: this.serviceUrl })
144
- : discoverService({ url: this.spacesUrl });
159
+ else if (this.baseServerUrl !== undefined) {
160
+ info = await readServiceDescription({
161
+ serviceUrl: serviceDescriptionUrl({
162
+ baseServerUrl: this.baseServerUrl
163
+ })
164
+ });
165
+ }
166
+ else {
167
+ info = await discoverService({ url: this.spaceUrl });
168
+ }
169
+ this.#assertDescribesThisServer(info);
170
+ return info;
145
171
  });
146
172
  /**
147
- * Refuses a caller-supplied service description of another server than
148
- * the one this client was built for: a cache entry keyed wrongly, or kept
149
- * across deployments, would otherwise route `createSpace` and `listSpaces`
150
- * to the other server's Spaces Repository. A server is identified by its
151
- * service URL, so the description's `url` must be the `serviceUrl` given.
152
- * A client built from `spacesUrl` names no service URL and is not checked;
153
- * nor is a discovered description, which came from the server named.
173
+ * Refuses a service description that does not describe the server at this
174
+ * client's base server URL: its `url` must be `{base}service` and its
175
+ * `spaces` member, when present, `{base}spaces/`. A caller-supplied copy
176
+ * keyed wrongly or kept across deployments, or a base that names a
177
+ * different mount than the server's, would otherwise fail later with a 404
178
+ * deep in a Space; refusing here names both values. A client built by
179
+ * {@link forSpace} has no base and is not checked.
154
180
  *
155
181
  * @param info {ServiceInfo}
156
182
  * @throws {IncompatibleServerError}
157
183
  */
158
184
  #assertDescribesThisServer(info) {
159
- if (this.serviceUrl === undefined) {
185
+ if (this.baseServerUrl === undefined) {
186
+ return;
187
+ }
188
+ const expectedUrl = serviceDescriptionUrl({
189
+ baseServerUrl: this.baseServerUrl
190
+ });
191
+ const describedUrl = parseAbsoluteHttpUrl(info.description.url)?.toString();
192
+ if (describedUrl !== expectedUrl) {
193
+ throw new IncompatibleServerError(`The service description names itself "${info.description.url}", ` +
194
+ `but the base server URL "${this.baseServerUrl}" places it at ` +
195
+ `"${expectedUrl}".`);
196
+ }
197
+ if (info.spacesUrl === undefined) {
160
198
  return;
161
199
  }
162
- const described = parseAbsoluteHttpUrl(info.description.url)?.toString();
163
- if (described !== this.serviceUrl) {
164
- throw new IncompatibleServerError(`The service description given is of ` +
165
- `"${info.description.url}", but this client was built for ` +
166
- `"${this.serviceUrl}".`);
200
+ const expectedSpaces = spacesRepositoryUrl({
201
+ baseServerUrl: this.baseServerUrl
202
+ });
203
+ // `selectServiceVersion` stores `spacesUrl` in canonical container form.
204
+ if (info.spacesUrl !== expectedSpaces) {
205
+ throw new IncompatibleServerError(`The service description names the Spaces Repository ` +
206
+ `"${info.spacesUrl}", but the base server URL ` +
207
+ `"${this.baseServerUrl}" places it at "${expectedSpaces}".`);
167
208
  }
168
209
  }
169
210
  /**
170
- * Discovers the server's service description and the WAS version this
171
- * client speaks with it. A client built from `serviceUrl` reads the document
172
- * with an unsigned `GET`; one built from `spacesUrl` first follows the
173
- * `rel="service"` link on the response to an unsigned `HEAD` of that URL.
174
- * No capability is invoked. The result is memoized for the life of the
175
- * client and shared by every handle; concurrent callers share one
176
- * discovery, and a failure is not memoized, so the next call retries.
211
+ * Reads the server's service description and selects the WAS version this
212
+ * client speaks with it. A client built from a base server URL reads
213
+ * `{base}service` with an unsigned `GET` and checks that the document
214
+ * describes that base (its `url` and `spaces` members agree with the
215
+ * layout); one built by {@link forSpace} follows the `rel="service"` link on
216
+ * the response to an unsigned `HEAD` of the Space URL. No capability is
217
+ * invoked. The result is memoized for the life of the client and shared by
218
+ * every handle; concurrent callers share one discovery, and a failure is
219
+ * not memoized, so the next call retries.
177
220
  *
178
221
  * Every signed request waits on this discovery, so a caller rarely needs to
179
222
  * call it first. It is the way to read the server-wide affordances:
@@ -191,7 +234,8 @@ export class WasClient {
191
234
  * @returns {Promise<ServiceInfo>}
192
235
  * @throws {IncompatibleServerError} when the probed response carries no
193
236
  * `service` link (the server predates v0.5), the document is malformed,
194
- * or it lists no version this client speaks
237
+ * it lists no version this client speaks, or it does not describe the
238
+ * server at this client's base server URL
195
239
  */
196
240
  async service(options = {}) {
197
241
  if (options.refresh) {
@@ -201,14 +245,32 @@ export class WasClient {
201
245
  return this.#service.get();
202
246
  }
203
247
  /**
204
- * Waits for discovery and returns the Spaces Repository URL the service
205
- * description names, refusing a server whose description has none.
248
+ * The base server URL, or the `NotSupportedError` a client built by
249
+ * {@link forSpace} throws from every id-addressed operation.
206
250
  *
251
+ * @param operation {string} the operation's name, for the error
252
+ * @returns {string}
253
+ * @throws {NotSupportedError}
254
+ */
255
+ #requireBase(operation) {
256
+ if (this.baseServerUrl === undefined) {
257
+ throw new NotSupportedError(`${operation} needs a base server URL, and this client was opened ` +
258
+ `on the single fixed Space "${this.spaceUrl}", which has none.`);
259
+ }
260
+ return this.baseServerUrl;
261
+ }
262
+ /**
263
+ * The Spaces Repository URL the service description names, which the
264
+ * layout check in discovery has already confirmed is `{base}spaces/`
265
+ * (every signed request waits on discovery anyway).
266
+ *
267
+ * @param operation {string} the operation's name, for the error
207
268
  * @returns {Promise<string>}
208
- * @throws {NotSupportedError} when the server does not implement the
209
- * Spaces Repository
269
+ * @throws {NotSupportedError} when the client has no base server URL, or
270
+ * the server does not implement the Spaces Repository
210
271
  */
211
- async #spacesRepositoryUrl() {
272
+ async #spacesRepositoryUrl(operation) {
273
+ this.#requireBase(operation);
212
274
  const { spacesUrl, version, description } = await this.service();
213
275
  if (spacesUrl === undefined) {
214
276
  throw new NotSupportedError(`The server at "${description.url}" does not implement the Spaces ` +
@@ -265,13 +327,71 @@ export class WasClient {
265
327
  encryption: options.encryption
266
328
  });
267
329
  }
330
+ /**
331
+ * Returns a lazy handle to the Space with id `spaceId` on this client's
332
+ * server, at `{base}space/{spaceId}/` as the spec's Server Layout places
333
+ * it. No I/O. The same handle as `spaceAt` opened on that URL; the Space
334
+ * need not exist yet (`space.configure(...)` with `ifNoneMatch` creates it
335
+ * by id).
336
+ *
337
+ * @param spaceId {string}
338
+ * @param options {object}
339
+ * @param [options.capability] {IZcap}
340
+ * @param [options.encryption] {EncryptionOverride} see {@link spaceAt}
341
+ * @returns {Space}
342
+ * @throws {NotSupportedError} on a client built by {@link forSpace}, which
343
+ * has no base server URL
344
+ * @throws {ValidationError} when `spaceId` is empty or a dot segment
345
+ */
346
+ space(spaceId, options = {}) {
347
+ const baseServerUrl = this.#requireBase('space(id)');
348
+ return this.spaceAt(spaceUrlById({ baseServerUrl, spaceId }), options);
349
+ }
350
+ /**
351
+ * Returns a lazy handle to a Collection by its absolute URL: the parent
352
+ * container is its Space and the last segment its id, so the handle is
353
+ * what `spaceAt(parent).collection(id)` would produce. No I/O. The direct
354
+ * route for a single fixed Space, where a caller typically holds the
355
+ * Collection URLs (`https://alice.example/posts/`) and nothing else.
356
+ *
357
+ * @param collectionUrl {string}
358
+ * @param options {object}
359
+ * @param [options.capability] {IZcap}
360
+ * @param [options.encryption] {EncryptionOverride}
361
+ * @returns {Collection}
362
+ * @throws {ValidationError} when `collectionUrl` is not a Collection URL
363
+ * (no path segment beneath its origin, a query or fragment), its last
364
+ * segment is a reserved Collection id, or it is not in canonical form
365
+ * (so the handle's requests would address a different URL)
366
+ */
367
+ collectionAt(collectionUrl, options = {}) {
368
+ const { spaceUrl, collectionId } = splitCollectionUrl(collectionUrl);
369
+ const handle = new Collection({
370
+ context: this.#context,
371
+ spaceUrl,
372
+ collectionId,
373
+ capability: options.capability,
374
+ encryption: options.encryption
375
+ });
376
+ // The handle re-encodes the decoded id, so a URL whose last segment is
377
+ // serialized differently (`%21` for `!`, lower-case hex) would build a
378
+ // handle at another URL: one a bound capability does not cover, and
379
+ // whose root capability id the server never minted. Refuse it, by name,
380
+ // as `fromCapability` does for a non-canonical target.
381
+ const expected = canonicalContainerUrl(collectionUrl);
382
+ if (handle.url !== expected) {
383
+ throw new ValidationError(`"${collectionUrl}" is not in canonical form: the handle would ` +
384
+ `address "${handle.url}" instead.`);
385
+ }
386
+ return handle;
387
+ }
268
388
  /**
269
389
  * Creates a space (server-generated id unless `id` is given). `name` is
270
390
  * optional (both in the spec and on the reference server); `controller` must
271
391
  * match the wrapped signer's DID (which is the default). The request goes
272
- * to the Spaces Repository URL the service description names, and the
273
- * returned handle is opened on the Space URL the response's `Location`
274
- * names: the server chooses where the Space lives.
392
+ * to the Spaces Repository, `{base}spaces/`, and the returned handle is
393
+ * opened on the Space URL the response's `Location` names, as the server
394
+ * states it.
275
395
  *
276
396
  * @param desc {object}
277
397
  * @param [desc.id] {string}
@@ -282,7 +402,8 @@ export class WasClient {
282
402
  * 'Space']`). The server defaults it to `['Space']` and treats it as
283
403
  * immutable after creation
284
404
  * @returns {Promise<Space>}
285
- * @throws {NotSupportedError} when the server has no Spaces Repository
405
+ * @throws {NotSupportedError} when the server has no Spaces Repository, or
406
+ * the client was built by {@link forSpace}
286
407
  * @throws {WasServerError} when the create response carries no `Location`
287
408
  */
288
409
  async createSpace(desc = {}) {
@@ -293,7 +414,7 @@ export class WasClient {
293
414
  ...(desc.name !== undefined && { name: desc.name }),
294
415
  ...(desc.type !== undefined && { type: desc.type })
295
416
  };
296
- const spacesUrl = await this.#spacesRepositoryUrl();
417
+ const spacesUrl = await this.#spacesRepositoryUrl('createSpace');
297
418
  const response = await send(this.#context, {
298
419
  url: spacesUrl,
299
420
  method: 'POST',
@@ -328,11 +449,12 @@ export class WasClient {
328
449
  * `totalItems` counts the collected items.
329
450
  *
330
451
  * @returns {Promise<SpaceListing>}
331
- * @throws {NotSupportedError} when the server has no Spaces Repository
452
+ * @throws {NotSupportedError} when the server has no Spaces Repository, or
453
+ * the client was built by {@link forSpace}
332
454
  * @throws {WasServerError} when the listing cannot be read in full
333
455
  */
334
456
  async listSpaces() {
335
- const spacesUrl = await this.#spacesRepositoryUrl();
457
+ const spacesUrl = await this.#spacesRepositoryUrl('listSpaces');
336
458
  const walk = await signedPageWalk(this.#context, {
337
459
  firstUrl: spacesUrl
338
460
  });
@@ -383,8 +505,6 @@ export class WasClient {
383
505
  method: 'GET',
384
506
  read: true
385
507
  });
386
- // An unsigned response is a raw `fetch` `Response` (no pre-parsed
387
- // `data`), so the page body is read via `readJsonData`.
388
508
  return pageResponse === null
389
509
  ? null
390
510
  : (await readJsonData(pageResponse));
@@ -1 +1 @@
1
- {"version":3,"file":"WasClient.js","sourceRoot":"","sources":["../src/WasClient.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAG7C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,EACd,SAAS,EACT,gBAAgB,EACjB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAyBxC;;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C,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAA;CACpD,CASA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,CAAC,EAAE,oBAAoB,GAChC,MAAM,GAAG,IAAI,CA4Bf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,YAAY,EACZ,YAAY,EACZ,UAAU,EACX,EAAE;IACD,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,SAAS,GAAG,QAAQ,CAAA;IAClC,UAAU,EAAE,oBAAoB,CAAA;CACjC,GAAG,OAAO,CAAC,QAAQ,CAAC,CA2BpB"}
@@ -72,7 +72,7 @@
72
72
  */
73
73
  import { base64, base64urlnopad } from '@scure/base';
74
74
  import { EdvClientCore, Transport, assertDocId } from '@interop/edv-client/core';
75
- import { EMPTY_INDEX_SCHEMA, assertQueryAttributes } from '../internal/indexSchema.js';
75
+ import { cloneIndexSchema, emptyIndexSchema, assertQueryAttributes } from '../internal/indexSchema.js';
76
76
  import { ConflictError, EncryptionError, IntegrityError, KeyUnwrapError, NotFoundError, NotSupportedError, PreconditionFailedError, QuotaExceededError, UnknownEpochError, ValidationError, WasError } from '../errors.js';
77
77
  import { blobBytes, bytesToBlob, bytesToStream, streamToBlob } from '../internal/blob.js';
78
78
  import { readEtag, writeHeaders } from '../internal/conditional.js';
@@ -307,7 +307,7 @@ export class EdvCodec {
307
307
  * a `declareIndex` installs one -- and while it is empty the write seam emits
308
308
  * no `indexed` entries, since there is nothing declared to index.
309
309
  */
310
- #schema = EMPTY_INDEX_SCHEMA;
310
+ #schema = emptyIndexSchema();
311
311
  /**
312
312
  * The scheme-agnostic search capability handed to the handle layer, present
313
313
  * exactly when this collection declares a blinding key.
@@ -393,13 +393,16 @@ export class EdvCodec {
393
393
  * Installs the persisted schema: records it, then registers each declared
394
394
  * attribute with the EDV core, whose index helper is what actually blinds
395
395
  * attributes on write and builds query terms. Registration is idempotent, so
396
- * re-applying the same schema (or a superset of it) is safe.
396
+ * re-applying the same schema (or a superset of it) is safe. The codec keeps
397
+ * its own copy: a caller that goes on mutating the object it passed in (or
398
+ * the array it declared a compound index with) does not change what this
399
+ * codec blinds and queries by.
397
400
  *
398
401
  * @param schema {IndexSchema}
399
402
  * @returns {void}
400
403
  */
401
404
  #applySchema(schema) {
402
- this.#schema = schema;
405
+ this.#schema = cloneIndexSchema(schema);
403
406
  for (const entry of schema.indexes) {
404
407
  this.#edv.ensureIndex({
405
408
  attribute: entry.attribute,