@interop/was-client 0.99.1 → 0.100.1

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 (111) hide show
  1. package/README.md +127 -69
  2. package/dist/Collection.d.ts +17 -9
  3. package/dist/Collection.d.ts.map +1 -1
  4. package/dist/Collection.js +85 -70
  5. package/dist/Collection.js.map +1 -1
  6. package/dist/Resource.d.ts +11 -4
  7. package/dist/Resource.d.ts.map +1 -1
  8. package/dist/Resource.js +34 -28
  9. package/dist/Resource.js.map +1 -1
  10. package/dist/Space.d.ts +20 -5
  11. package/dist/Space.d.ts.map +1 -1
  12. package/dist/Space.js +69 -65
  13. package/dist/Space.js.map +1 -1
  14. package/dist/WasClient.d.ts +185 -57
  15. package/dist/WasClient.d.ts.map +1 -1
  16. package/dist/WasClient.js +340 -140
  17. package/dist/WasClient.js.map +1 -1
  18. package/dist/codec.d.ts +3 -2
  19. package/dist/codec.d.ts.map +1 -1
  20. package/dist/edv/EdvCodec.js +1 -1
  21. package/dist/edv/EdvCodec.js.map +1 -1
  22. package/dist/edv/WasTransport.d.ts +7 -4
  23. package/dist/edv/WasTransport.d.ts.map +1 -1
  24. package/dist/edv/WasTransport.js +39 -20
  25. package/dist/edv/WasTransport.js.map +1 -1
  26. package/dist/edv/acquire.d.ts +3 -3
  27. package/dist/edv/acquire.d.ts.map +1 -1
  28. package/dist/edv/acquire.js +3 -3
  29. package/dist/edv/acquire.js.map +1 -1
  30. package/dist/edv/cipher.d.ts +1 -1
  31. package/dist/edv/cipher.js +1 -1
  32. package/dist/edv/docCipher.d.ts +6 -5
  33. package/dist/edv/docCipher.d.ts.map +1 -1
  34. package/dist/edv/docCipher.js +6 -5
  35. package/dist/edv/docCipher.js.map +1 -1
  36. package/dist/edv/encryption.d.ts +2 -2
  37. package/dist/edv/encryption.d.ts.map +1 -1
  38. package/dist/edv/encryption.js +8 -6
  39. package/dist/edv/encryption.js.map +1 -1
  40. package/dist/edv/refreshingDocCipher.d.ts +3 -3
  41. package/dist/edv/refreshingDocCipher.d.ts.map +1 -1
  42. package/dist/edv/refreshingDocCipher.js +3 -3
  43. package/dist/edv/refreshingDocCipher.js.map +1 -1
  44. package/dist/edv/transportFactory.d.ts +3 -3
  45. package/dist/edv/transportFactory.d.ts.map +1 -1
  46. package/dist/edv/transportFactory.js +3 -3
  47. package/dist/edv/transportFactory.js.map +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/internal/codec.d.ts +7 -7
  53. package/dist/internal/codec.d.ts.map +1 -1
  54. package/dist/internal/codec.js +19 -18
  55. package/dist/internal/codec.js.map +1 -1
  56. package/dist/internal/conditional.d.ts +3 -3
  57. package/dist/internal/conditional.d.ts.map +1 -1
  58. package/dist/internal/conditional.js +5 -5
  59. package/dist/internal/conditional.js.map +1 -1
  60. package/dist/internal/grant.d.ts +15 -26
  61. package/dist/internal/grant.d.ts.map +1 -1
  62. package/dist/internal/grant.js +95 -29
  63. package/dist/internal/grant.js.map +1 -1
  64. package/dist/internal/meta.d.ts +8 -8
  65. package/dist/internal/meta.d.ts.map +1 -1
  66. package/dist/internal/meta.js +13 -10
  67. package/dist/internal/meta.js.map +1 -1
  68. package/dist/internal/paths.d.ts +423 -195
  69. package/dist/internal/paths.d.ts.map +1 -1
  70. package/dist/internal/paths.js +582 -369
  71. package/dist/internal/paths.js.map +1 -1
  72. package/dist/internal/policy.d.ts +23 -23
  73. package/dist/internal/policy.d.ts.map +1 -1
  74. package/dist/internal/policy.js +20 -20
  75. package/dist/internal/policy.js.map +1 -1
  76. package/dist/internal/request.d.ts +17 -21
  77. package/dist/internal/request.d.ts.map +1 -1
  78. package/dist/internal/request.js +10 -21
  79. package/dist/internal/request.js.map +1 -1
  80. package/dist/internal/reserved.d.ts +15 -3
  81. package/dist/internal/reserved.d.ts.map +1 -1
  82. package/dist/internal/reserved.js +37 -8
  83. package/dist/internal/reserved.js.map +1 -1
  84. package/dist/internal/revoke.d.ts +34 -13
  85. package/dist/internal/revoke.d.ts.map +1 -1
  86. package/dist/internal/revoke.js +97 -28
  87. package/dist/internal/revoke.js.map +1 -1
  88. package/dist/internal/service.d.ts +27 -7
  89. package/dist/internal/service.d.ts.map +1 -1
  90. package/dist/internal/service.js +51 -45
  91. package/dist/internal/service.js.map +1 -1
  92. package/dist/internal/write.d.ts +18 -18
  93. package/dist/internal/write.d.ts.map +1 -1
  94. package/dist/internal/write.js +27 -27
  95. package/dist/internal/write.js.map +1 -1
  96. package/dist/paths.d.ts +32 -25
  97. package/dist/paths.d.ts.map +1 -1
  98. package/dist/paths.js +32 -25
  99. package/dist/paths.js.map +1 -1
  100. package/dist/sync/port.d.ts +3 -3
  101. package/dist/sync/port.d.ts.map +1 -1
  102. package/dist/sync/port.js +12 -12
  103. package/dist/sync/port.js.map +1 -1
  104. package/dist/sync/provisioning.d.ts +10 -9
  105. package/dist/sync/provisioning.d.ts.map +1 -1
  106. package/dist/sync/provisioning.js +19 -18
  107. package/dist/sync/provisioning.js.map +1 -1
  108. package/dist/sync/types.d.ts +2 -2
  109. package/dist/types.d.ts +13 -5
  110. package/dist/types.d.ts.map +1 -1
  111. package/package.json +3 -3
@@ -1,307 +1,535 @@
1
1
  /**
2
- * `/space/:spaceId/` -- the Space container in canonical form: the target a
3
- * Space root capability names, the URL whose `GET` lists the Space's
4
- * Collections, whose `POST` creates one, and whose `DELETE` removes the Space.
5
- * The Space is an ordinary container, so its members are listed and created at
6
- * the container itself -- there is no second builder for that.
2
+ * Parses an absolute `http(s)` URL, or returns `null`. The one rule for which
3
+ * URLs may name a server, a Spaces Repository, or a container here; the
4
+ * callers that need more (no query, a path) narrow it.
7
5
  *
8
- * @param spaceId {string}
6
+ * @param url {string}
7
+ * @returns {URL | null}
8
+ */
9
+ export declare function parseAbsoluteHttpUrl(url: string): URL | null;
10
+ /**
11
+ * Whether a canonical container URL is an origin root (`https://h/`).
12
+ *
13
+ * @param canonical {string}
14
+ * @returns {boolean}
15
+ */
16
+ export declare function isOriginRoot(canonical: string): boolean;
17
+ /**
18
+ * The base server URL in canonical form: the URL under which a server lays
19
+ * out `service`, `spaces/` and `space/{space_id}/`. An absolute `http(s)` URL
20
+ * with no query or fragment; a missing trailing slash is supplied rather than
21
+ * refused, since `https://h/pws` and `https://h/pws/` can only mean the same
22
+ * mount.
23
+ *
24
+ * @param baseServerUrl {string}
25
+ * @returns {string}
26
+ * @throws {ValidationError} when the value is not an absolute `http(s)` URL,
27
+ * or carries a query or fragment
28
+ */
29
+ export declare function canonicalBaseServerUrl(baseServerUrl: string): string;
30
+ /**
31
+ * `{base}service` -- the service description of the server at
32
+ * `baseServerUrl`.
33
+ *
34
+ * @param options {object}
35
+ * @param options.baseServerUrl {string}
36
+ * @returns {string}
37
+ */
38
+ export declare function serviceDescriptionUrl({ baseServerUrl }: {
39
+ baseServerUrl: string;
40
+ }): string;
41
+ /**
42
+ * `{base}spaces/` -- the Spaces Repository of the server at `baseServerUrl`,
43
+ * in canonical container form. The server may not implement one; its service
44
+ * description says.
45
+ *
46
+ * @param options {object}
47
+ * @param options.baseServerUrl {string}
48
+ * @returns {string}
49
+ */
50
+ export declare function spacesRepositoryUrl({ baseServerUrl }: {
51
+ baseServerUrl: string;
52
+ }): string;
53
+ /**
54
+ * `{base}space/{space_id}/` -- the Space with id `spaceId` on the server at
55
+ * `baseServerUrl`, in canonical form. The one place a Space URL is built
56
+ * rather than received; the spec's Server Layout fixes this shape.
57
+ *
58
+ * @param options {object}
59
+ * @param options.baseServerUrl {string}
60
+ * @param options.spaceId {string}
9
61
  * @returns {string}
62
+ * @throws {ValidationError} when `spaceId` is empty or a dot segment
10
63
  */
11
- export declare function spacePath(spaceId: string): string;
64
+ export declare function spaceUrlById({ baseServerUrl, spaceId }: {
65
+ baseServerUrl: string;
66
+ spaceId: string;
67
+ }): string;
12
68
  /**
13
- * `/space/:spaceId/meta` -- the Space Metadata object: the Space's description
69
+ * The base server URL a server-level URL sits under: the inverse of
70
+ * {@link serviceDescriptionUrl}, {@link spacesRepositoryUrl} and
71
+ * {@link spaceUrlById}. Accepts the service description URL (`{base}service`),
72
+ * the Spaces Repository URL (`{base}spaces/`, slash optional) or a Space URL
73
+ * (`{base}space/{space_id}/`, slash optional) and strips exactly the segments
74
+ * the layout adds. Anything else is refused, including a Collection or
75
+ * Resource URL, whose depth cannot be told from the string alone, and the
76
+ * URL of a single fixed Space, which has no base server URL.
77
+ *
78
+ * @param url {string}
79
+ * @returns {string}
80
+ * @throws {ValidationError} when `url` is not an absolute `http(s)` URL
81
+ * without query or fragment in one of the three forms
82
+ */
83
+ export declare function baseServerUrlOf(url: string): string;
84
+ /**
85
+ * Splits an absolute Collection URL into the Space URL it sits under and the
86
+ * Collection id: the parent container and the last segment, percent-decoded.
87
+ * A Collection URL is always the Space URL plus one segment, so no layout
88
+ * knowledge is needed. The bare form (no trailing slash) is accepted, as for
89
+ * any container URL received from outside.
90
+ *
91
+ * @param collectionUrl {string}
92
+ * @returns {{ spaceUrl: string; collectionId: string }}
93
+ * @throws {ValidationError} when `collectionUrl` is not an absolute `http(s)`
94
+ * URL without query or fragment, has no path segment, or its last segment
95
+ * is a malformed percent escape
96
+ */
97
+ export declare function splitCollectionUrl(collectionUrl: string): {
98
+ spaceUrl: string;
99
+ collectionId: string;
100
+ };
101
+ /**
102
+ * The Space URL in canonical form (see `canonicalContainer`). A server names
103
+ * a Space in this form (the `Location` of the create response, a listing
104
+ * item's `url`), and every URL beneath the Space, and every zcap
105
+ * `invocationTarget`, is derived from it, so a caller's own serialization of
106
+ * the same Space must reduce to the same string. An origin root is a valid
107
+ * Space URL: a single fixed Space (one with no Space id and no base server
108
+ * URL) may be served there.
109
+ *
110
+ * @param spaceUrl {string} a Space URL, as the server named it or as the
111
+ * caller stored it
112
+ * @returns {string}
113
+ * @throws {ValidationError} when `spaceUrl` is not an absolute `http(s)`
114
+ * URL, carries a query or fragment, or has an empty path segment
115
+ */
116
+ export declare function canonicalSpaceUrl(spaceUrl: string): string;
117
+ /**
118
+ * The Space's id as its URL names it: the last path segment of the Space
119
+ * URL, percent-decoded. The spec's hierarchy and its did:webvh profile both
120
+ * place the id there (`.../space/{space_id}/`), and it is the value the Space
121
+ * Metadata object's `id` carries. A single fixed Space at an origin root has
122
+ * no id, so that URL is refused here.
123
+ *
124
+ * @param spaceUrl {string} a Space URL
125
+ * @returns {string}
126
+ * @throws {ValidationError} when `spaceUrl` is not a Space URL (see
127
+ * {@link canonicalSpaceUrl}), is an origin root, or its last segment is a
128
+ * malformed percent escape
129
+ */
130
+ export declare function spaceIdOfUrl(spaceUrl: string): string;
131
+ /**
132
+ * {@link spaceIdOfUrl} for a Space URL already in canonical form (a handle's
133
+ * `url`, the result of {@link canonicalSpaceUrl}), sparing the second parse.
134
+ * Returns `undefined` for an origin root, which has no id segment.
135
+ *
136
+ * @param canonical {string} a canonical Space URL
137
+ * @returns {string | undefined}
138
+ * @throws {ValidationError} when the last segment is a malformed percent
139
+ * escape
140
+ */
141
+ export declare function spaceIdOfCanonicalUrl(canonical: string): string | undefined;
142
+ /**
143
+ * `{spaceUrl}meta` -- the Space Metadata object: the Space's description
14
144
  * (`name`, `controller`, `type`), read with `GET` and replaced with `PUT`.
145
+ * The Space container itself (the canonical Space URL) is the target a Space
146
+ * root capability names, the URL whose `GET` lists the Space's Collections,
147
+ * whose `POST` creates one, and whose `DELETE` removes the Space; it has no
148
+ * builder, since the caller holds it.
15
149
  *
16
- * @param spaceId {string}
150
+ * @param options {object}
151
+ * @param options.spaceUrl {string}
17
152
  * @returns {string}
18
153
  */
19
- export declare function spaceMeta(spaceId: string): string;
154
+ export declare function spaceMetaUrl({ spaceUrl }: {
155
+ spaceUrl: string;
156
+ }): string;
20
157
  /**
21
- * `/space/:spaceId/export` -- export a space as a tar archive.
158
+ * `{spaceUrl}export` -- export a space as a tar archive.
159
+ *
160
+ * @param options {object}
161
+ * @param options.spaceUrl {string}
162
+ * @returns {string}
22
163
  */
23
- export declare function spaceExport(spaceId: string): string;
164
+ export declare function spaceExportUrl({ spaceUrl }: {
165
+ spaceUrl: string;
166
+ }): string;
24
167
  /**
25
- * `/space/:spaceId/import` -- import a tar archive into a space.
168
+ * `{spaceUrl}import` -- import a tar archive into a space.
169
+ *
170
+ * @param options {object}
171
+ * @param options.spaceUrl {string}
172
+ * @returns {string}
26
173
  */
27
- export declare function spaceImport(spaceId: string): string;
174
+ export declare function spaceImportUrl({ spaceUrl }: {
175
+ spaceUrl: string;
176
+ }): string;
28
177
  /**
29
- * `/space/:spaceId/backends` -- the backends available within a space (list, and
178
+ * `{spaceUrl}backends` -- the backends available within a space (list, and
30
179
  * register a new `external` backend).
180
+ *
181
+ * @param options {object}
182
+ * @param options.spaceUrl {string}
183
+ * @returns {string}
31
184
  */
32
- export declare function spaceBackends(spaceId: string): string;
185
+ export declare function spaceBackendsUrl({ spaceUrl }: {
186
+ spaceUrl: string;
187
+ }): string;
33
188
  /**
34
- * `/space/:spaceId/backends/:backendId` -- a single registered `external`
35
- * backend (replace / deregister by id).
189
+ * `{spaceUrl}backends/{backendId}` -- a single registered `external` backend
190
+ * (replace / deregister by id).
191
+ *
192
+ * @param options {object}
193
+ * @param options.spaceUrl {string}
194
+ * @param options.backendId {string}
195
+ * @returns {string}
36
196
  */
37
- export declare function registeredBackend(spaceId: string, backendId: string): string;
197
+ export declare function registeredBackendUrl({ spaceUrl, backendId }: {
198
+ spaceUrl: string;
199
+ backendId: string;
200
+ }): string;
38
201
  /**
39
- * `/space/:spaceId/quotas` -- the space-level storage quota report.
202
+ * `{spaceUrl}quotas` -- the space-level storage quota report.
203
+ *
204
+ * @param options {object}
205
+ * @param options.spaceUrl {string}
206
+ * @returns {string}
40
207
  */
41
- export declare function spaceQuotas(spaceId: string): string;
208
+ export declare function spaceQuotasUrl({ spaceUrl }: {
209
+ spaceUrl: string;
210
+ }): string;
42
211
  /**
43
- * `/space/:spaceId/policy` -- the space-level access-control policy resource.
212
+ * `{spaceUrl}policy` -- the space-level access-control policy resource.
213
+ *
214
+ * @param options {object}
215
+ * @param options.spaceUrl {string}
216
+ * @returns {string}
44
217
  */
45
- export declare function spacePolicy(spaceId: string): string;
218
+ export declare function spacePolicyUrl({ spaceUrl }: {
219
+ spaceUrl: string;
220
+ }): string;
46
221
  /**
47
- * `/space/:spaceId/linkset` -- the space-level linkset (policy discovery).
222
+ * `{spaceUrl}linkset` -- the space-level linkset (policy discovery).
223
+ *
224
+ * @param options {object}
225
+ * @param options.spaceUrl {string}
226
+ * @returns {string}
48
227
  */
49
- export declare function spaceLinkset(spaceId: string): string;
228
+ export declare function spaceLinksetUrl({ spaceUrl }: {
229
+ spaceUrl: string;
230
+ }): string;
50
231
  /**
51
- * `/space/:spaceId/replicas` -- the Space's replica registrations: `GET` lists
52
- * them and `POST` registers one. Controller-only, both forms.
232
+ * `{spaceUrl}replicas` -- the Space's replica registrations: `GET` lists them
233
+ * and `POST` registers one. Controller-only, both forms.
234
+ *
235
+ * @param options {object}
236
+ * @param options.spaceUrl {string}
237
+ * @returns {string}
53
238
  */
54
- export declare function spaceReplicas(spaceId: string): string;
239
+ export declare function spaceReplicasUrl({ spaceUrl }: {
240
+ spaceUrl: string;
241
+ }): string;
55
242
  /**
56
- * `/space/:spaceId/replicas/:replicaId` -- one replica registration (read and
243
+ * `{spaceUrl}replicas/{replicaId}` -- one replica registration (read and
57
244
  * delete by id).
245
+ *
246
+ * @param options {object}
247
+ * @param options.spaceUrl {string}
248
+ * @param options.replicaId {string}
249
+ * @returns {string}
58
250
  */
59
- export declare function replicaRegistration(spaceId: string, replicaId: string): string;
251
+ export declare function replicaRegistrationUrl({ spaceUrl, replicaId }: {
252
+ spaceUrl: string;
253
+ replicaId: string;
254
+ }): string;
60
255
  /**
61
- * `/space/:spaceId/replicas/:replicaId/status` -- the pull loop's runtime
62
- * state for one registration.
256
+ * `{spaceUrl}replicas/{replicaId}/status` -- the pull loop's runtime state
257
+ * for one registration.
258
+ *
259
+ * @param options {object}
260
+ * @param options.spaceUrl {string}
261
+ * @param options.replicaId {string}
262
+ * @returns {string}
63
263
  */
64
- export declare function replicaStatus(spaceId: string, replicaId: string): string;
264
+ export declare function replicaStatusUrl({ spaceUrl, replicaId }: {
265
+ spaceUrl: string;
266
+ replicaId: string;
267
+ }): string;
65
268
  /**
66
- * `/space/:spaceId/zcaps/revocations/:capabilityId` -- submit a revocation of a
269
+ * `{spaceUrl}zcaps/revocations/{capabilityId}` -- submit a revocation of a
67
270
  * Space-rooted capability. The capability's `id` (typically a `urn:uuid:`) is
68
271
  * percent-encoded into the single final segment. `zcaps` is in the Reserved
69
272
  * Path Segment Registry, so no Collection can take that slot.
273
+ *
274
+ * @param options {object}
275
+ * @param options.spaceUrl {string}
276
+ * @param options.capabilityId {string}
277
+ * @returns {string}
70
278
  */
71
- export declare function spaceRevocation(spaceId: string, capabilityId: string): string;
279
+ export declare function spaceRevocationUrl({ spaceUrl, capabilityId }: {
280
+ spaceUrl: string;
281
+ capabilityId: string;
282
+ }): string;
72
283
  /**
73
- * `/space/:spaceId/:collectionId/` -- the Collection container in canonical
74
- * form: the target a "share this collection" capability names, the URL whose
75
- * `GET` lists its Resources, whose `POST` adds one, and whose `DELETE` removes
76
- * the Collection.
284
+ * `{spaceUrl}{collectionId}/` -- the Collection container in canonical form:
285
+ * the target a "share this collection" capability names, the URL whose `GET`
286
+ * lists its Resources, whose `POST` adds one, and whose `DELETE` removes the
287
+ * Collection.
77
288
  *
78
- * @param spaceId {string}
79
- * @param collectionId {string}
289
+ * @param options {object}
290
+ * @param options.spaceUrl {string}
291
+ * @param options.collectionId {string}
80
292
  * @returns {string}
81
293
  */
82
- export declare function collectionPath(spaceId: string, collectionId: string): string;
294
+ export declare function collectionUrl({ spaceUrl, collectionId }: {
295
+ spaceUrl: string;
296
+ collectionId: string;
297
+ }): string;
83
298
  /**
84
- * `/space/:spaceId/:collectionId/policy` -- the collection-level access-control
299
+ * `{spaceUrl}{collectionId}/policy` -- the collection-level access-control
85
300
  * policy resource.
301
+ *
302
+ * @param options {object}
303
+ * @param options.spaceUrl {string}
304
+ * @param options.collectionId {string}
305
+ * @returns {string}
86
306
  */
87
- export declare function collectionPolicy(spaceId: string, collectionId: string): string;
307
+ export declare function collectionPolicyUrl({ spaceUrl, collectionId }: {
308
+ spaceUrl: string;
309
+ collectionId: string;
310
+ }): string;
88
311
  /**
89
- * `/space/:spaceId/:collectionId/linkset` -- the collection-level linkset
90
- * (policy discovery).
312
+ * `{spaceUrl}{collectionId}/linkset` -- the collection-level linkset (policy
313
+ * discovery).
314
+ *
315
+ * @param options {object}
316
+ * @param options.spaceUrl {string}
317
+ * @param options.collectionId {string}
318
+ * @returns {string}
91
319
  */
92
- export declare function collectionLinkset(spaceId: string, collectionId: string): string;
320
+ export declare function collectionLinksetUrl({ spaceUrl, collectionId }: {
321
+ spaceUrl: string;
322
+ collectionId: string;
323
+ }): string;
93
324
  /**
94
- * `/space/:spaceId/:collectionId/backend` -- the "Collection Backend Selected"
325
+ * `{spaceUrl}{collectionId}/backend` -- the "Collection Backend Selected"
95
326
  * descriptor (the backend this collection is stored on).
327
+ *
328
+ * @param options {object}
329
+ * @param options.spaceUrl {string}
330
+ * @param options.collectionId {string}
331
+ * @returns {string}
96
332
  */
97
- export declare function collectionBackend(spaceId: string, collectionId: string): string;
333
+ export declare function collectionBackendUrl({ spaceUrl, collectionId }: {
334
+ spaceUrl: string;
335
+ collectionId: string;
336
+ }): string;
98
337
  /**
99
- * `/space/:spaceId/:collectionId/quota` -- the per-collection storage quota
100
- * report (spec "Quotas").
338
+ * `{spaceUrl}{collectionId}/quota` -- the per-collection storage quota report
339
+ * (spec "Quotas").
340
+ *
341
+ * @param options {object}
342
+ * @param options.spaceUrl {string}
343
+ * @param options.collectionId {string}
344
+ * @returns {string}
101
345
  */
102
- export declare function collectionQuota(spaceId: string, collectionId: string): string;
346
+ export declare function collectionQuotaUrl({ spaceUrl, collectionId }: {
347
+ spaceUrl: string;
348
+ collectionId: string;
349
+ }): string;
103
350
  /**
104
- * `/space/:spaceId/:collectionId/meta` -- the Collection Metadata object: the
351
+ * `{spaceUrl}{collectionId}/meta` -- the Collection Metadata object: the
105
352
  * Collection's configuration (`name`, `backend`, `encryption`, `generator`)
106
353
  * together with the server-managed timestamps / `createdBy` and the
107
354
  * user-writable `custom` and `epoch`, as one object under one validator.
355
+ *
356
+ * @param options {object}
357
+ * @param options.spaceUrl {string}
358
+ * @param options.collectionId {string}
359
+ * @returns {string}
108
360
  */
109
- export declare function collectionMeta(spaceId: string, collectionId: string): string;
361
+ export declare function collectionMetaUrl({ spaceUrl, collectionId }: {
362
+ spaceUrl: string;
363
+ collectionId: string;
364
+ }): string;
110
365
  /**
111
- * `/space/:spaceId/:collectionId/meta/log` -- the Collection's governing
112
- * history log sub-resource (JSON Lines). Not a Resource of the Collection:
113
- * absent from listings and the `changes` feed, and versioned by its own ETag.
366
+ * `{spaceUrl}{collectionId}/meta/log` -- the Collection's governing history
367
+ * log sub-resource (JSON Lines). Not a Resource of the Collection: absent from
368
+ * listings and the `changes` feed, and versioned by its own ETag.
369
+ *
370
+ * @param options {object}
371
+ * @param options.spaceUrl {string}
372
+ * @param options.collectionId {string}
373
+ * @returns {string}
114
374
  */
115
- export declare function collectionLog(spaceId: string, collectionId: string): string;
375
+ export declare function collectionLogUrl({ spaceUrl, collectionId }: {
376
+ spaceUrl: string;
377
+ collectionId: string;
378
+ }): string;
116
379
  /**
117
- * `/space/:spaceId/:collectionId/query` -- the collection-level query endpoint,
380
+ * `{spaceUrl}{collectionId}/query` -- the collection-level query endpoint,
118
381
  * whose body's `profile` selects the query (e.g. `changes`, `blinded-index`).
382
+ *
383
+ * @param options {object}
384
+ * @param options.spaceUrl {string}
385
+ * @param options.collectionId {string}
386
+ * @returns {string}
119
387
  */
120
- export declare function collectionQuery(spaceId: string, collectionId: string): string;
388
+ export declare function collectionQueryUrl({ spaceUrl, collectionId }: {
389
+ spaceUrl: string;
390
+ collectionId: string;
391
+ }): string;
121
392
  /**
122
- * `/space/:spaceId/:collectionId/:resourceId` -- get / put / delete a resource
393
+ * `{spaceUrl}{collectionId}/{resourceId}` -- get / put / delete a resource
123
394
  * (no trailing slash).
124
- */
125
- export declare function resourcePath(spaceId: string, collectionId: string, resourceId: string): string;
126
- /**
127
- * `/space/:spaceId/:collectionId/:resourceId/meta` -- the resource metadata
128
- * object (server-managed properties plus the user-writable `custom` object).
129
- */
130
- export declare function resourceMeta(spaceId: string, collectionId: string, resourceId: string): string;
131
- /**
132
- * `/space/:spaceId/:collectionId/:resourceId/policy` -- the resource-level
133
- * access-control policy resource.
134
- */
135
- export declare function resourcePolicy(spaceId: string, collectionId: string, resourceId: string): string;
136
- /**
137
- * `/space/:spaceId/:collectionId/:resourceId/chunks/:chunkIndex` -- a single
138
- * stored chunk of a chunked Resource. Member
139
- * form, no trailing slash: get / put / delete one chunk by its ordinal index.
140
- * The `chunkIndex` is a non-negative integer, emitted verbatim (it is never a
141
- * reserved or dot segment, so it needs no percent-encoding).
142
395
  *
143
- * @param spaceId {string}
144
- * @param collectionId {string}
145
- * @param resourceId {string}
146
- * @param chunkIndex {number}
396
+ * @param options {object}
397
+ * @param options.spaceUrl {string}
398
+ * @param options.collectionId {string}
399
+ * @param options.resourceId {string}
147
400
  * @returns {string}
148
401
  */
149
- export declare function resourceChunkPath(spaceId: string, collectionId: string, resourceId: string, chunkIndex: number): string;
402
+ export declare function resourceUrl({ spaceUrl, collectionId, resourceId }: {
403
+ spaceUrl: string;
404
+ collectionId: string;
405
+ resourceId: string;
406
+ }): string;
150
407
  /**
151
- * `/space/:spaceId/:collectionId/:resourceId/chunks/` -- the chunk container
152
- * of a chunked Resource: its stored chunks, listed. Container form, trailing
153
- * slash (the member form, {@link resourceChunkPath}, has none).
408
+ * `{spaceUrl}{collectionId}/{resourceId}/meta` -- the resource metadata
409
+ * object (server-managed properties plus the user-writable `custom` object).
154
410
  *
155
- * @param spaceId {string}
156
- * @param collectionId {string}
157
- * @param resourceId {string}
411
+ * @param options {object}
412
+ * @param options.spaceUrl {string}
413
+ * @param options.collectionId {string}
414
+ * @param options.resourceId {string}
158
415
  * @returns {string}
159
416
  */
160
- export declare function resourceChunksPath(spaceId: string, collectionId: string, resourceId: string): string;
417
+ export declare function resourceMetaUrl({ spaceUrl, collectionId, resourceId }: {
418
+ spaceUrl: string;
419
+ collectionId: string;
420
+ resourceId: string;
421
+ }): string;
161
422
  /**
162
- * The Spaces Repository URL beneath a server base URL: the reserved `spaces`
163
- * segment at the server root, in canonical trailing-slash form. This is the
164
- * URL a `WasClient` is constructed with (its `serverUrl`), so a consumer that
165
- * holds only a Space or Collection URL forms the client's `serverUrl` from the
166
- * base `parseAbsoluteSpaceTarget` reads off it.
423
+ * `{spaceUrl}{collectionId}/{resourceId}/policy` -- the resource-level
424
+ * access-control policy resource.
167
425
  *
168
426
  * @param options {object}
169
- * @param options.baseUrl {string} the server base URL
427
+ * @param options.spaceUrl {string}
428
+ * @param options.collectionId {string}
429
+ * @param options.resourceId {string}
170
430
  * @returns {string}
171
431
  */
172
- export declare function spacesUrl({ baseUrl }: {
173
- baseUrl: string;
432
+ export declare function resourcePolicyUrl({ spaceUrl, collectionId, resourceId }: {
433
+ spaceUrl: string;
434
+ collectionId: string;
435
+ resourceId: string;
174
436
  }): string;
175
437
  /**
176
- * The server base URL a Spaces Repository URL sits beneath: everything before
177
- * its final `spaces` segment, without a trailing slash, so
178
- * `https://host/was/spaces/` yields `https://host/was` and
179
- * `https://host/spaces/` yields `https://host`. A trailing run of slashes is
180
- * collapsed first, so `https://host/spaces` and `https://host/spaces//` read
181
- * the same. The result is in `URL` canonical form (lower-case host, default
182
- * port dropped), so two serializations of one URL compare equal.
438
+ * `{spaceUrl}{collectionId}/{resourceId}/chunks/{chunkIndex}` -- a single
439
+ * stored chunk of a chunked Resource. Member form, no trailing slash: get /
440
+ * put / delete one chunk by its ordinal index. The `chunkIndex` is a
441
+ * non-negative integer, emitted verbatim (it is never a reserved or dot
442
+ * segment, so it needs no percent-encoding).
183
443
  *
184
- * Returns `null` when `url` is not an absolute `http(s)` URL, its last path
185
- * segment is not `spaces`, it has an empty path segment (`https://host//spaces`),
186
- * or it carries a query or fragment; the caller chooses the error.
187
- *
188
- * @param url {string} a Spaces Repository URL
189
- * @returns {string | null}
444
+ * @param options {object}
445
+ * @param options.spaceUrl {string}
446
+ * @param options.collectionId {string}
447
+ * @param options.resourceId {string}
448
+ * @param options.chunkIndex {number}
449
+ * @returns {string}
190
450
  */
191
- export declare function baseUrlOfSpacesUrl(url: string): string | null;
451
+ export declare function resourceChunkUrl({ spaceUrl, collectionId, resourceId, chunkIndex }: {
452
+ spaceUrl: string;
453
+ collectionId: string;
454
+ resourceId: string;
455
+ chunkIndex: number;
456
+ }): string;
192
457
  /**
193
- * Resolves a path against the server base URL, producing an absolute URL
194
- * string suitable for zcap `invocationTarget`s.
195
- *
196
- * The path is joined onto `baseUrl`'s path rather than its origin, so a WAS
197
- * deployment mounted under a sub-path (e.g. `https://host/was`) keeps that
198
- * prefix. A bare-origin `baseUrl` behaves as before.
458
+ * `{spaceUrl}{collectionId}/{resourceId}/chunks/` -- the chunk container of a
459
+ * chunked Resource: its stored chunks, listed. Container form, trailing slash
460
+ * (the member form, {@link resourceChunkUrl}, has none).
199
461
  *
200
462
  * @param options {object}
201
- * @param options.baseUrl {string} the server base URL
202
- * @param options.path {string} a leading-slash path (e.g. `/space/x`)
463
+ * @param options.spaceUrl {string}
464
+ * @param options.collectionId {string}
465
+ * @param options.resourceId {string}
203
466
  * @returns {string}
204
467
  */
205
- export declare function toUrl({ baseUrl, path }: {
206
- baseUrl: string;
207
- path: string;
468
+ export declare function resourceChunksUrl({ spaceUrl, collectionId, resourceId }: {
469
+ spaceUrl: string;
470
+ collectionId: string;
471
+ resourceId: string;
208
472
  }): string;
209
473
  /**
210
- * Canonicalizes an absolute collection URL to its items/listing endpoint --
211
- * the trailing-slash form (`/space/:id/:collectionId/`). This module owns the
212
- * trailing-slash rules, so callers that receive a collection URL from outside
213
- * (e.g. a public link) normalize it here rather than re-encoding the rule.
474
+ * The canonical (trailing-slash) form of a container URL received from
475
+ * outside and requested as given: the Spaces Repository URL a service
476
+ * description advertises, a public Collection link. The bare form only
477
+ * 308-redirects, and a signed invocation does not survive the redirect, so
478
+ * the slash is added here before the URL is ever requested. This module owns
479
+ * the trailing-slash rules; callers normalize here rather than re-encoding
480
+ * the rule.
214
481
  *
215
- * @param collectionUrl {string} an absolute collection URL
482
+ * @param url {string} an absolute container URL, in either form
216
483
  * @returns {string}
217
484
  */
218
- export declare function collectionItemsUrl(collectionUrl: string): string;
485
+ export declare function canonicalContainerUrl(url: string): string;
219
486
  /**
220
- * The classification of a WAS pathname by the depth it addresses. The three
221
- * containment kinds map onto navigational handles; `sub-resource` covers every
222
- * reserved sub-endpoint the builders above produce (`/space/:id/policy`,
223
- * `/space/:id/:c/backend`, `/space/:id/:c/:r/meta`, ...), which has no handle of
224
- * its own.
487
+ * The classification of a URL beneath a Space by the depth it addresses. The
488
+ * three containment kinds map onto navigational handles; `sub-resource`
489
+ * covers every reserved sub-endpoint the builders above produce (`policy`,
490
+ * `{c}/backend`, `{c}/{r}/meta`, ...), which has no handle of its own.
225
491
  */
226
492
  export type ParsedSpacePath = {
227
493
  kind: 'space';
228
- spaceId: string;
229
494
  } | {
230
495
  kind: 'collection';
231
- spaceId: string;
232
496
  collectionId: string;
233
497
  } | {
234
498
  kind: 'resource';
235
- spaceId: string;
236
499
  collectionId: string;
237
500
  resourceId: string;
238
501
  } | {
239
502
  kind: 'sub-resource';
240
- spaceId: string;
241
503
  segments: string[];
242
504
  };
243
505
  /**
244
- * Classifies an absolute `target` URL that is expected to live on this server,
245
- * relative to `baseUrl`'s base path -- so a WAS mounted under a sub-path (e.g.
246
- * `https://host/was/`) resolves just as a bare-origin deployment does, which
247
- * `parseSpacePath` alone cannot do (it would see a leading `was` segment).
506
+ * Classifies an absolute `target` URL by where it sits beneath `spaceUrl`:
507
+ * the Space itself, one of its Collections, a Resource, or a reserved
508
+ * sub-endpoint. The inverse of the builders above, kept next to them so the
509
+ * grammar is owned in one place: `WasClient.fromCapability` reads a
510
+ * capability's `invocationTarget` through it, and the builders stay in
511
+ * lockstep.
512
+ *
513
+ * Both URLs are compared in parsed form, so a target serialized by another
514
+ * party (an upper-case host, a default port) still matches. Segments are
515
+ * percent-decoded (the builders re-encode them). Empty segments are dropped,
516
+ * so a container addressed in either form classifies the same: the bare and
517
+ * the trailing-slash form of a Collection are both the Collection. That is
518
+ * deliberate: the builders emit only the canonical form, but the targets
519
+ * parsed here come from capabilities minted elsewhere, and a client that
520
+ * reads only one form would refuse valid ones.
248
521
  *
249
- * Returns `null` when `target` is not beneath `baseUrl` (another origin, or
250
- * another base path), carries a query or fragment, or addresses something
251
- * outside the `/space` tree (e.g. `/kms`). The caller chooses whether that is
252
- * an error.
522
+ * Returns `null` when `target` is not beneath `spaceUrl` (another origin, or
523
+ * another path), carries a query or fragment, or either URL is malformed.
524
+ * The caller chooses whether that is an error.
253
525
  *
254
526
  * @param options {object}
255
- * @param options.baseUrl {string} the client's server base URL
256
- * @param options.target {string} an absolute URL on that server
527
+ * @param options.spaceUrl {string} the Space URL
528
+ * @param options.target {string} an absolute URL expected beneath it
257
529
  * @returns {ParsedSpacePath | null}
258
530
  */
259
- export declare function parseSpaceTarget({ baseUrl, target }: {
260
- baseUrl: string;
531
+ export declare function parseSpaceTarget({ spaceUrl, target }: {
532
+ spaceUrl: string;
261
533
  target: string;
262
534
  }): ParsedSpacePath | null;
263
- /**
264
- * Classifies an absolute `target` URL whose server is not known in advance:
265
- * the base URL is read off the target itself, as everything before its first
266
- * `space` path segment, so a WAS mounted under a sub-path
267
- * (`https://host/was/space/...`) yields `https://host/was`. For a target on a
268
- * known server, `parseSpaceTarget` is the stricter check (it refuses a target
269
- * beneath any other base). This is the one for a capability received from
270
- * another party, whose `invocationTarget` may name any host.
271
- *
272
- * Returns `null` when `target` is not an absolute `http(s)` URL, has no
273
- * `space` segment, carries a query or fragment, or has an empty segment in
274
- * the base before it (`https://host//was/space/x`); these are the rules
275
- * `baseUrlOfSpacesUrl` applies too. Also `null` from the path grammar for a
276
- * path it cannot classify. The caller chooses whether that is an error.
277
- *
278
- * @param target {string} an absolute WAS URL
279
- * @returns {{ baseUrl: string; path: ParsedSpacePath } | null} the server
280
- * base URL (no trailing slash) and the parsed target beneath it
281
- */
282
- export declare function parseAbsoluteSpaceTarget(target: string): {
283
- baseUrl: string;
284
- path: ParsedSpacePath;
285
- } | null;
286
- /**
287
- * Parses a server pathname back into the containment depth it addresses -- the
288
- * inverse of the builders above, kept next to them so the grammar is owned in
289
- * one place. Segments are percent-decoded (the builders re-encode them).
290
- * Returns `null` for a pathname outside the `/space/...` tree; the caller
291
- * chooses the error. A path that addresses a reserved sub-endpoint rather than
292
- * a space/collection/resource -- e.g. `/space/s/policy`, `/space/s/c/backend`,
293
- * or any 5-segment target like `/space/s/c/r/meta` -- is classified
294
- * `sub-resource`, never silently truncated to the nearest handle.
295
- *
296
- * Empty segments are dropped, so a container addressed in either form
297
- * classifies the same: `/space/s` and `/space/s/` are both the Space, and
298
- * `/space/s/c` and `/space/s/c/` both the Collection. That is deliberate. The
299
- * builders emit only the canonical trailing-slash form, but the targets parsed
300
- * here come from capabilities minted elsewhere, and a client that reads only
301
- * one spelling would refuse valid ones.
302
- *
303
- * @param pathname {string} a URL pathname (e.g. from `new URL(...).pathname`)
304
- * @returns {ParsedSpacePath | null}
305
- */
306
- export declare function parseSpacePath(pathname: string): ParsedSpacePath | null;
307
535
  //# sourceMappingURL=paths.d.ts.map