@interop/was-client 0.99.1 → 0.100.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 (107) hide show
  1. package/README.md +90 -70
  2. package/dist/Collection.d.ts +20 -8
  3. package/dist/Collection.d.ts.map +1 -1
  4. package/dist/Collection.js +89 -69
  5. package/dist/Collection.js.map +1 -1
  6. package/dist/Resource.d.ts +14 -3
  7. package/dist/Resource.d.ts.map +1 -1
  8. package/dist/Resource.js +38 -27
  9. package/dist/Resource.js.map +1 -1
  10. package/dist/Space.d.ts +18 -4
  11. package/dist/Space.d.ts.map +1 -1
  12. package/dist/Space.js +64 -61
  13. package/dist/Space.js.map +1 -1
  14. package/dist/WasClient.d.ts +102 -54
  15. package/dist/WasClient.d.ts.map +1 -1
  16. package/dist/WasClient.js +212 -133
  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 +2 -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 +332 -195
  69. package/dist/internal/paths.d.ts.map +1 -1
  70. package/dist/internal/paths.js +400 -367
  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/revoke.d.ts +34 -13
  81. package/dist/internal/revoke.d.ts.map +1 -1
  82. package/dist/internal/revoke.js +97 -28
  83. package/dist/internal/revoke.js.map +1 -1
  84. package/dist/internal/service.d.ts +25 -7
  85. package/dist/internal/service.d.ts.map +1 -1
  86. package/dist/internal/service.js +49 -45
  87. package/dist/internal/service.js.map +1 -1
  88. package/dist/internal/write.d.ts +18 -18
  89. package/dist/internal/write.d.ts.map +1 -1
  90. package/dist/internal/write.js +27 -27
  91. package/dist/internal/write.js.map +1 -1
  92. package/dist/paths.d.ts +32 -25
  93. package/dist/paths.d.ts.map +1 -1
  94. package/dist/paths.js +32 -25
  95. package/dist/paths.js.map +1 -1
  96. package/dist/sync/port.d.ts +3 -3
  97. package/dist/sync/port.d.ts.map +1 -1
  98. package/dist/sync/port.js +12 -12
  99. package/dist/sync/port.js.map +1 -1
  100. package/dist/sync/provisioning.d.ts +10 -9
  101. package/dist/sync/provisioning.d.ts.map +1 -1
  102. package/dist/sync/provisioning.js +19 -18
  103. package/dist/sync/provisioning.js.map +1 -1
  104. package/dist/sync/types.d.ts +2 -2
  105. package/dist/types.d.ts +13 -5
  106. package/dist/types.d.ts.map +1 -1
  107. package/package.json +1 -1
@@ -1,307 +1,444 @@
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
+ * The Space URL in canonical form: an absolute `http(s)` URL, serialized by
12
+ * `URL` (lower-case host, default port dropped), ending in exactly one
13
+ * slash. A server names a Space in this form (the `Location` of the create
14
+ * response, a listing item's `url`), and every URL beneath the Space, and
15
+ * every zcap `invocationTarget`, is derived from it, so a caller's own
16
+ * serialization of the same Space must reduce to the same string. A missing
17
+ * trailing slash is added, since the bare form names the same container; a
18
+ * run of trailing slashes is collapsed to one.
19
+ *
20
+ * @param spaceUrl {string} a Space URL, as the server named it or as the
21
+ * caller stored it
22
+ * @returns {string}
23
+ * @throws {ValidationError} when `spaceUrl` is not an absolute `http(s)`
24
+ * URL, carries a query or fragment, or has no path segment (an origin is
25
+ * not a Space)
26
+ */
27
+ export declare function canonicalSpaceUrl(spaceUrl: string): string;
28
+ /**
29
+ * The Space's id as its URL names it: the last path segment of the Space
30
+ * URL, percent-decoded. The spec's hierarchy and its did:webvh profile both
31
+ * place the id there (`.../space/{space_id}/`), and it is the value the Space
32
+ * Metadata object's `id` carries.
33
+ *
34
+ * @param spaceUrl {string} a Space URL
35
+ * @returns {string}
36
+ * @throws {ValidationError} when `spaceUrl` is not a Space URL (see
37
+ * {@link canonicalSpaceUrl}) or its last segment is a malformed percent
38
+ * escape
39
+ */
40
+ export declare function spaceIdOfUrl(spaceUrl: string): string;
41
+ /**
42
+ * {@link spaceIdOfUrl} for a Space URL already in canonical form (a handle's
43
+ * `url`, the result of {@link canonicalSpaceUrl}), sparing the second parse.
44
+ *
45
+ * @param canonical {string} a canonical Space URL
9
46
  * @returns {string}
47
+ * @throws {ValidationError} when the last segment is a malformed percent
48
+ * escape
10
49
  */
11
- export declare function spacePath(spaceId: string): string;
50
+ export declare function spaceIdOfCanonicalUrl(canonical: string): string;
12
51
  /**
13
- * `/space/:spaceId/meta` -- the Space Metadata object: the Space's description
52
+ * `{spaceUrl}meta` -- the Space Metadata object: the Space's description
14
53
  * (`name`, `controller`, `type`), read with `GET` and replaced with `PUT`.
54
+ * The Space container itself (the canonical Space URL) is the target a Space
55
+ * root capability names, the URL whose `GET` lists the Space's Collections,
56
+ * whose `POST` creates one, and whose `DELETE` removes the Space; it has no
57
+ * builder, since the caller holds it.
15
58
  *
16
- * @param spaceId {string}
59
+ * @param options {object}
60
+ * @param options.spaceUrl {string}
17
61
  * @returns {string}
18
62
  */
19
- export declare function spaceMeta(spaceId: string): string;
63
+ export declare function spaceMetaUrl({ spaceUrl }: {
64
+ spaceUrl: string;
65
+ }): string;
20
66
  /**
21
- * `/space/:spaceId/export` -- export a space as a tar archive.
67
+ * `{spaceUrl}export` -- export a space as a tar archive.
68
+ *
69
+ * @param options {object}
70
+ * @param options.spaceUrl {string}
71
+ * @returns {string}
22
72
  */
23
- export declare function spaceExport(spaceId: string): string;
73
+ export declare function spaceExportUrl({ spaceUrl }: {
74
+ spaceUrl: string;
75
+ }): string;
24
76
  /**
25
- * `/space/:spaceId/import` -- import a tar archive into a space.
77
+ * `{spaceUrl}import` -- import a tar archive into a space.
78
+ *
79
+ * @param options {object}
80
+ * @param options.spaceUrl {string}
81
+ * @returns {string}
26
82
  */
27
- export declare function spaceImport(spaceId: string): string;
83
+ export declare function spaceImportUrl({ spaceUrl }: {
84
+ spaceUrl: string;
85
+ }): string;
28
86
  /**
29
- * `/space/:spaceId/backends` -- the backends available within a space (list, and
87
+ * `{spaceUrl}backends` -- the backends available within a space (list, and
30
88
  * register a new `external` backend).
89
+ *
90
+ * @param options {object}
91
+ * @param options.spaceUrl {string}
92
+ * @returns {string}
31
93
  */
32
- export declare function spaceBackends(spaceId: string): string;
94
+ export declare function spaceBackendsUrl({ spaceUrl }: {
95
+ spaceUrl: string;
96
+ }): string;
33
97
  /**
34
- * `/space/:spaceId/backends/:backendId` -- a single registered `external`
35
- * backend (replace / deregister by id).
98
+ * `{spaceUrl}backends/{backendId}` -- a single registered `external` backend
99
+ * (replace / deregister by id).
100
+ *
101
+ * @param options {object}
102
+ * @param options.spaceUrl {string}
103
+ * @param options.backendId {string}
104
+ * @returns {string}
36
105
  */
37
- export declare function registeredBackend(spaceId: string, backendId: string): string;
106
+ export declare function registeredBackendUrl({ spaceUrl, backendId }: {
107
+ spaceUrl: string;
108
+ backendId: string;
109
+ }): string;
38
110
  /**
39
- * `/space/:spaceId/quotas` -- the space-level storage quota report.
111
+ * `{spaceUrl}quotas` -- the space-level storage quota report.
112
+ *
113
+ * @param options {object}
114
+ * @param options.spaceUrl {string}
115
+ * @returns {string}
40
116
  */
41
- export declare function spaceQuotas(spaceId: string): string;
117
+ export declare function spaceQuotasUrl({ spaceUrl }: {
118
+ spaceUrl: string;
119
+ }): string;
42
120
  /**
43
- * `/space/:spaceId/policy` -- the space-level access-control policy resource.
121
+ * `{spaceUrl}policy` -- the space-level access-control policy resource.
122
+ *
123
+ * @param options {object}
124
+ * @param options.spaceUrl {string}
125
+ * @returns {string}
44
126
  */
45
- export declare function spacePolicy(spaceId: string): string;
127
+ export declare function spacePolicyUrl({ spaceUrl }: {
128
+ spaceUrl: string;
129
+ }): string;
46
130
  /**
47
- * `/space/:spaceId/linkset` -- the space-level linkset (policy discovery).
131
+ * `{spaceUrl}linkset` -- the space-level linkset (policy discovery).
132
+ *
133
+ * @param options {object}
134
+ * @param options.spaceUrl {string}
135
+ * @returns {string}
48
136
  */
49
- export declare function spaceLinkset(spaceId: string): string;
137
+ export declare function spaceLinksetUrl({ spaceUrl }: {
138
+ spaceUrl: string;
139
+ }): string;
50
140
  /**
51
- * `/space/:spaceId/replicas` -- the Space's replica registrations: `GET` lists
52
- * them and `POST` registers one. Controller-only, both forms.
141
+ * `{spaceUrl}replicas` -- the Space's replica registrations: `GET` lists them
142
+ * and `POST` registers one. Controller-only, both forms.
143
+ *
144
+ * @param options {object}
145
+ * @param options.spaceUrl {string}
146
+ * @returns {string}
53
147
  */
54
- export declare function spaceReplicas(spaceId: string): string;
148
+ export declare function spaceReplicasUrl({ spaceUrl }: {
149
+ spaceUrl: string;
150
+ }): string;
55
151
  /**
56
- * `/space/:spaceId/replicas/:replicaId` -- one replica registration (read and
152
+ * `{spaceUrl}replicas/{replicaId}` -- one replica registration (read and
57
153
  * delete by id).
154
+ *
155
+ * @param options {object}
156
+ * @param options.spaceUrl {string}
157
+ * @param options.replicaId {string}
158
+ * @returns {string}
58
159
  */
59
- export declare function replicaRegistration(spaceId: string, replicaId: string): string;
160
+ export declare function replicaRegistrationUrl({ spaceUrl, replicaId }: {
161
+ spaceUrl: string;
162
+ replicaId: string;
163
+ }): string;
60
164
  /**
61
- * `/space/:spaceId/replicas/:replicaId/status` -- the pull loop's runtime
62
- * state for one registration.
165
+ * `{spaceUrl}replicas/{replicaId}/status` -- the pull loop's runtime state
166
+ * for one registration.
167
+ *
168
+ * @param options {object}
169
+ * @param options.spaceUrl {string}
170
+ * @param options.replicaId {string}
171
+ * @returns {string}
63
172
  */
64
- export declare function replicaStatus(spaceId: string, replicaId: string): string;
173
+ export declare function replicaStatusUrl({ spaceUrl, replicaId }: {
174
+ spaceUrl: string;
175
+ replicaId: string;
176
+ }): string;
65
177
  /**
66
- * `/space/:spaceId/zcaps/revocations/:capabilityId` -- submit a revocation of a
178
+ * `{spaceUrl}zcaps/revocations/{capabilityId}` -- submit a revocation of a
67
179
  * Space-rooted capability. The capability's `id` (typically a `urn:uuid:`) is
68
180
  * percent-encoded into the single final segment. `zcaps` is in the Reserved
69
181
  * Path Segment Registry, so no Collection can take that slot.
182
+ *
183
+ * @param options {object}
184
+ * @param options.spaceUrl {string}
185
+ * @param options.capabilityId {string}
186
+ * @returns {string}
70
187
  */
71
- export declare function spaceRevocation(spaceId: string, capabilityId: string): string;
188
+ export declare function spaceRevocationUrl({ spaceUrl, capabilityId }: {
189
+ spaceUrl: string;
190
+ capabilityId: string;
191
+ }): string;
72
192
  /**
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.
193
+ * `{spaceUrl}{collectionId}/` -- the Collection container in canonical form:
194
+ * the target a "share this collection" capability names, the URL whose `GET`
195
+ * lists its Resources, whose `POST` adds one, and whose `DELETE` removes the
196
+ * Collection.
77
197
  *
78
- * @param spaceId {string}
79
- * @param collectionId {string}
198
+ * @param options {object}
199
+ * @param options.spaceUrl {string}
200
+ * @param options.collectionId {string}
80
201
  * @returns {string}
81
202
  */
82
- export declare function collectionPath(spaceId: string, collectionId: string): string;
203
+ export declare function collectionUrl({ spaceUrl, collectionId }: {
204
+ spaceUrl: string;
205
+ collectionId: string;
206
+ }): string;
83
207
  /**
84
- * `/space/:spaceId/:collectionId/policy` -- the collection-level access-control
208
+ * `{spaceUrl}{collectionId}/policy` -- the collection-level access-control
85
209
  * policy resource.
210
+ *
211
+ * @param options {object}
212
+ * @param options.spaceUrl {string}
213
+ * @param options.collectionId {string}
214
+ * @returns {string}
86
215
  */
87
- export declare function collectionPolicy(spaceId: string, collectionId: string): string;
216
+ export declare function collectionPolicyUrl({ spaceUrl, collectionId }: {
217
+ spaceUrl: string;
218
+ collectionId: string;
219
+ }): string;
88
220
  /**
89
- * `/space/:spaceId/:collectionId/linkset` -- the collection-level linkset
90
- * (policy discovery).
221
+ * `{spaceUrl}{collectionId}/linkset` -- the collection-level linkset (policy
222
+ * discovery).
223
+ *
224
+ * @param options {object}
225
+ * @param options.spaceUrl {string}
226
+ * @param options.collectionId {string}
227
+ * @returns {string}
91
228
  */
92
- export declare function collectionLinkset(spaceId: string, collectionId: string): string;
229
+ export declare function collectionLinksetUrl({ spaceUrl, collectionId }: {
230
+ spaceUrl: string;
231
+ collectionId: string;
232
+ }): string;
93
233
  /**
94
- * `/space/:spaceId/:collectionId/backend` -- the "Collection Backend Selected"
234
+ * `{spaceUrl}{collectionId}/backend` -- the "Collection Backend Selected"
95
235
  * descriptor (the backend this collection is stored on).
236
+ *
237
+ * @param options {object}
238
+ * @param options.spaceUrl {string}
239
+ * @param options.collectionId {string}
240
+ * @returns {string}
96
241
  */
97
- export declare function collectionBackend(spaceId: string, collectionId: string): string;
242
+ export declare function collectionBackendUrl({ spaceUrl, collectionId }: {
243
+ spaceUrl: string;
244
+ collectionId: string;
245
+ }): string;
98
246
  /**
99
- * `/space/:spaceId/:collectionId/quota` -- the per-collection storage quota
100
- * report (spec "Quotas").
247
+ * `{spaceUrl}{collectionId}/quota` -- the per-collection storage quota report
248
+ * (spec "Quotas").
249
+ *
250
+ * @param options {object}
251
+ * @param options.spaceUrl {string}
252
+ * @param options.collectionId {string}
253
+ * @returns {string}
101
254
  */
102
- export declare function collectionQuota(spaceId: string, collectionId: string): string;
255
+ export declare function collectionQuotaUrl({ spaceUrl, collectionId }: {
256
+ spaceUrl: string;
257
+ collectionId: string;
258
+ }): string;
103
259
  /**
104
- * `/space/:spaceId/:collectionId/meta` -- the Collection Metadata object: the
260
+ * `{spaceUrl}{collectionId}/meta` -- the Collection Metadata object: the
105
261
  * Collection's configuration (`name`, `backend`, `encryption`, `generator`)
106
262
  * together with the server-managed timestamps / `createdBy` and the
107
263
  * user-writable `custom` and `epoch`, as one object under one validator.
264
+ *
265
+ * @param options {object}
266
+ * @param options.spaceUrl {string}
267
+ * @param options.collectionId {string}
268
+ * @returns {string}
108
269
  */
109
- export declare function collectionMeta(spaceId: string, collectionId: string): string;
270
+ export declare function collectionMetaUrl({ spaceUrl, collectionId }: {
271
+ spaceUrl: string;
272
+ collectionId: string;
273
+ }): string;
110
274
  /**
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.
275
+ * `{spaceUrl}{collectionId}/meta/log` -- the Collection's governing history
276
+ * log sub-resource (JSON Lines). Not a Resource of the Collection: absent from
277
+ * listings and the `changes` feed, and versioned by its own ETag.
278
+ *
279
+ * @param options {object}
280
+ * @param options.spaceUrl {string}
281
+ * @param options.collectionId {string}
282
+ * @returns {string}
114
283
  */
115
- export declare function collectionLog(spaceId: string, collectionId: string): string;
284
+ export declare function collectionLogUrl({ spaceUrl, collectionId }: {
285
+ spaceUrl: string;
286
+ collectionId: string;
287
+ }): string;
116
288
  /**
117
- * `/space/:spaceId/:collectionId/query` -- the collection-level query endpoint,
289
+ * `{spaceUrl}{collectionId}/query` -- the collection-level query endpoint,
118
290
  * whose body's `profile` selects the query (e.g. `changes`, `blinded-index`).
291
+ *
292
+ * @param options {object}
293
+ * @param options.spaceUrl {string}
294
+ * @param options.collectionId {string}
295
+ * @returns {string}
119
296
  */
120
- export declare function collectionQuery(spaceId: string, collectionId: string): string;
297
+ export declare function collectionQueryUrl({ spaceUrl, collectionId }: {
298
+ spaceUrl: string;
299
+ collectionId: string;
300
+ }): string;
121
301
  /**
122
- * `/space/:spaceId/:collectionId/:resourceId` -- get / put / delete a resource
302
+ * `{spaceUrl}{collectionId}/{resourceId}` -- get / put / delete a resource
123
303
  * (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
304
  *
143
- * @param spaceId {string}
144
- * @param collectionId {string}
145
- * @param resourceId {string}
146
- * @param chunkIndex {number}
305
+ * @param options {object}
306
+ * @param options.spaceUrl {string}
307
+ * @param options.collectionId {string}
308
+ * @param options.resourceId {string}
147
309
  * @returns {string}
148
310
  */
149
- export declare function resourceChunkPath(spaceId: string, collectionId: string, resourceId: string, chunkIndex: number): string;
311
+ export declare function resourceUrl({ spaceUrl, collectionId, resourceId }: {
312
+ spaceUrl: string;
313
+ collectionId: string;
314
+ resourceId: string;
315
+ }): string;
150
316
  /**
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).
317
+ * `{spaceUrl}{collectionId}/{resourceId}/meta` -- the resource metadata
318
+ * object (server-managed properties plus the user-writable `custom` object).
154
319
  *
155
- * @param spaceId {string}
156
- * @param collectionId {string}
157
- * @param resourceId {string}
320
+ * @param options {object}
321
+ * @param options.spaceUrl {string}
322
+ * @param options.collectionId {string}
323
+ * @param options.resourceId {string}
158
324
  * @returns {string}
159
325
  */
160
- export declare function resourceChunksPath(spaceId: string, collectionId: string, resourceId: string): string;
326
+ export declare function resourceMetaUrl({ spaceUrl, collectionId, resourceId }: {
327
+ spaceUrl: string;
328
+ collectionId: string;
329
+ resourceId: string;
330
+ }): string;
161
331
  /**
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.
332
+ * `{spaceUrl}{collectionId}/{resourceId}/policy` -- the resource-level
333
+ * access-control policy resource.
167
334
  *
168
335
  * @param options {object}
169
- * @param options.baseUrl {string} the server base URL
336
+ * @param options.spaceUrl {string}
337
+ * @param options.collectionId {string}
338
+ * @param options.resourceId {string}
170
339
  * @returns {string}
171
340
  */
172
- export declare function spacesUrl({ baseUrl }: {
173
- baseUrl: string;
341
+ export declare function resourcePolicyUrl({ spaceUrl, collectionId, resourceId }: {
342
+ spaceUrl: string;
343
+ collectionId: string;
344
+ resourceId: string;
174
345
  }): string;
175
346
  /**
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.
347
+ * `{spaceUrl}{collectionId}/{resourceId}/chunks/{chunkIndex}` -- a single
348
+ * stored chunk of a chunked Resource. Member form, no trailing slash: get /
349
+ * put / delete one chunk by its ordinal index. The `chunkIndex` is a
350
+ * non-negative integer, emitted verbatim (it is never a reserved or dot
351
+ * segment, so it needs no percent-encoding).
183
352
  *
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}
353
+ * @param options {object}
354
+ * @param options.spaceUrl {string}
355
+ * @param options.collectionId {string}
356
+ * @param options.resourceId {string}
357
+ * @param options.chunkIndex {number}
358
+ * @returns {string}
190
359
  */
191
- export declare function baseUrlOfSpacesUrl(url: string): string | null;
360
+ export declare function resourceChunkUrl({ spaceUrl, collectionId, resourceId, chunkIndex }: {
361
+ spaceUrl: string;
362
+ collectionId: string;
363
+ resourceId: string;
364
+ chunkIndex: number;
365
+ }): string;
192
366
  /**
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.
367
+ * `{spaceUrl}{collectionId}/{resourceId}/chunks/` -- the chunk container of a
368
+ * chunked Resource: its stored chunks, listed. Container form, trailing slash
369
+ * (the member form, {@link resourceChunkUrl}, has none).
199
370
  *
200
371
  * @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`)
372
+ * @param options.spaceUrl {string}
373
+ * @param options.collectionId {string}
374
+ * @param options.resourceId {string}
203
375
  * @returns {string}
204
376
  */
205
- export declare function toUrl({ baseUrl, path }: {
206
- baseUrl: string;
207
- path: string;
377
+ export declare function resourceChunksUrl({ spaceUrl, collectionId, resourceId }: {
378
+ spaceUrl: string;
379
+ collectionId: string;
380
+ resourceId: string;
208
381
  }): string;
209
382
  /**
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.
383
+ * The canonical (trailing-slash) form of a container URL received from
384
+ * outside and requested as given: the Spaces Repository URL a service
385
+ * description advertises, a public Collection link. The bare form only
386
+ * 308-redirects, and a signed invocation does not survive the redirect, so
387
+ * the slash is added here before the URL is ever requested. This module owns
388
+ * the trailing-slash rules; callers normalize here rather than re-encoding
389
+ * the rule.
214
390
  *
215
- * @param collectionUrl {string} an absolute collection URL
391
+ * @param url {string} an absolute container URL, in either form
216
392
  * @returns {string}
217
393
  */
218
- export declare function collectionItemsUrl(collectionUrl: string): string;
394
+ export declare function canonicalContainerUrl(url: string): string;
219
395
  /**
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.
396
+ * The classification of a URL beneath a Space by the depth it addresses. The
397
+ * three containment kinds map onto navigational handles; `sub-resource`
398
+ * covers every reserved sub-endpoint the builders above produce (`policy`,
399
+ * `{c}/backend`, `{c}/{r}/meta`, ...), which has no handle of its own.
225
400
  */
226
401
  export type ParsedSpacePath = {
227
402
  kind: 'space';
228
- spaceId: string;
229
403
  } | {
230
404
  kind: 'collection';
231
- spaceId: string;
232
405
  collectionId: string;
233
406
  } | {
234
407
  kind: 'resource';
235
- spaceId: string;
236
408
  collectionId: string;
237
409
  resourceId: string;
238
410
  } | {
239
411
  kind: 'sub-resource';
240
- spaceId: string;
241
412
  segments: string[];
242
413
  };
243
414
  /**
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).
415
+ * Classifies an absolute `target` URL by where it sits beneath `spaceUrl`:
416
+ * the Space itself, one of its Collections, a Resource, or a reserved
417
+ * sub-endpoint. The inverse of the builders above, kept next to them so the
418
+ * grammar is owned in one place: `WasClient.fromCapability` reads a
419
+ * capability's `invocationTarget` through it, and the builders stay in
420
+ * lockstep.
421
+ *
422
+ * Both URLs are compared in parsed form, so a target serialized by another
423
+ * party (an upper-case host, a default port) still matches. Segments are
424
+ * percent-decoded (the builders re-encode them). Empty segments are dropped,
425
+ * so a container addressed in either form classifies the same: the bare and
426
+ * the trailing-slash form of a Collection are both the Collection. That is
427
+ * deliberate: the builders emit only the canonical form, but the targets
428
+ * parsed here come from capabilities minted elsewhere, and a client that
429
+ * reads only one form would refuse valid ones.
248
430
  *
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.
431
+ * Returns `null` when `target` is not beneath `spaceUrl` (another origin, or
432
+ * another path), carries a query or fragment, or either URL is malformed.
433
+ * The caller chooses whether that is an error.
253
434
  *
254
435
  * @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
436
+ * @param options.spaceUrl {string} the Space URL
437
+ * @param options.target {string} an absolute URL expected beneath it
257
438
  * @returns {ParsedSpacePath | null}
258
439
  */
259
- export declare function parseSpaceTarget({ baseUrl, target }: {
260
- baseUrl: string;
440
+ export declare function parseSpaceTarget({ spaceUrl, target }: {
441
+ spaceUrl: string;
261
442
  target: string;
262
443
  }): 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
444
  //# sourceMappingURL=paths.d.ts.map