@interop/was-client 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -22
- package/dist/Collection.d.ts +21 -3
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +38 -2
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +41 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +62 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +19 -3
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +37 -3
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +36 -7
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +50 -7
- package/dist/WasClient.js.map +1 -1
- package/dist/errors.d.ts +34 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +101 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/paths.d.ts +23 -0
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +33 -0
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/request.d.ts +20 -0
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +41 -0
- package/dist/internal/request.js.map +1 -1
- package/dist/types.d.ts +11 -131
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -6
package/dist/WasClient.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { HttpResponse } from '@interop/http-client';
|
|
|
14
14
|
import { Space } from './Space.js';
|
|
15
15
|
import { Collection } from './Collection.js';
|
|
16
16
|
import { Resource } from './Resource.js';
|
|
17
|
-
import type { GrantOptions, HandleOptions, IDelegatedZcap, ISigner, IZcap, RequestInput, SpaceListing } from './types.js';
|
|
17
|
+
import type { GrantOptions, HandleOptions, IDelegatedZcap, ISigner, IZcap, Json, RequestInput, CollectionResourcesList, SpaceListing } from './types.js';
|
|
18
18
|
export declare class WasClient {
|
|
19
19
|
readonly serverUrl: string;
|
|
20
20
|
readonly zcapClient: ZcapClient;
|
|
@@ -59,9 +59,9 @@ export declare class WasClient {
|
|
|
59
59
|
*/
|
|
60
60
|
space(spaceId: string, options?: HandleOptions): Space;
|
|
61
61
|
/**
|
|
62
|
-
* Creates a space (server-generated id unless `id` is given).
|
|
63
|
-
*
|
|
64
|
-
* (which is the default).
|
|
62
|
+
* Creates a space (server-generated id unless `id` is given). `name` is
|
|
63
|
+
* optional (both in the spec and on the reference server); `controller` must
|
|
64
|
+
* match the wrapped signer's DID (which is the default).
|
|
65
65
|
*
|
|
66
66
|
* @param desc {object}
|
|
67
67
|
* @param [desc.id] {string}
|
|
@@ -75,13 +75,42 @@ export declare class WasClient {
|
|
|
75
75
|
controller?: string;
|
|
76
76
|
}): Promise<Space>;
|
|
77
77
|
/**
|
|
78
|
-
* Lists the spaces in the repository
|
|
79
|
-
*
|
|
80
|
-
*
|
|
78
|
+
* Lists the spaces in the repository visible to the wrapped signer, as a
|
|
79
|
+
* `{ url, totalItems, items }` listing. Visibility is per-controller: the
|
|
80
|
+
* result holds only the spaces whose controller the signed invocation is
|
|
81
|
+
* authorized for. An unauthorized caller is not an error -- the server
|
|
82
|
+
* returns an empty `items` list (the spec's explicit exception to 404
|
|
83
|
+
* masking), so nothing is revealed about which spaces exist.
|
|
81
84
|
*
|
|
82
85
|
* @returns {Promise<SpaceListing>}
|
|
83
86
|
*/
|
|
84
87
|
listSpaces(): Promise<SpaceListing>;
|
|
88
|
+
/**
|
|
89
|
+
* Reads a public (`PublicCanRead`) resource by its URL with no authorization
|
|
90
|
+
* -- an unsigned `GET`, for consuming a shared public link. Auto-parses JSON
|
|
91
|
+
* to an object and returns binary as a `Blob`. Returns `null` if the resource
|
|
92
|
+
* is missing or not publicly readable (404 conflation caveat).
|
|
93
|
+
*
|
|
94
|
+
* @param options {object}
|
|
95
|
+
* @param options.resourceUrl {string} the absolute resource URL
|
|
96
|
+
* @returns {Promise<Json | Blob | null>}
|
|
97
|
+
*/
|
|
98
|
+
publicRead({ resourceUrl }: {
|
|
99
|
+
resourceUrl: string;
|
|
100
|
+
}): Promise<Json | Blob | null>;
|
|
101
|
+
/**
|
|
102
|
+
* Lists a public (`PublicCanRead`) collection by its URL with no authorization
|
|
103
|
+
* -- an unsigned `GET` -- e.g. to browse a blog published as a public-read
|
|
104
|
+
* collection. Returns `null` if the collection is missing or not publicly
|
|
105
|
+
* readable (404 conflation caveat).
|
|
106
|
+
*
|
|
107
|
+
* @param options {object}
|
|
108
|
+
* @param options.collectionUrl {string} the absolute collection URL
|
|
109
|
+
* @returns {Promise<CollectionResourcesList | null>}
|
|
110
|
+
*/
|
|
111
|
+
publicListCollection({ collectionUrl }: {
|
|
112
|
+
collectionUrl: string;
|
|
113
|
+
}): Promise<CollectionResourcesList | null>;
|
|
85
114
|
/**
|
|
86
115
|
* Rebuilds an access handle from a received capability, returning a handle at
|
|
87
116
|
* the depth implied by the capability's `invocationTarget` (space /
|
package/dist/WasClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WasClient.d.ts","sourceRoot":"","sources":["../src/WasClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"WasClient.d.ts","sourceRoot":"","sources":["../src/WasClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAOxD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU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oB,CAAC,EACzB,aAAa,EACd,EAAE;QACD,aAAa,EAAE,MAAM,CAAA;KACtB,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAY3C;;;;;;;OAOG;IACH,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ;IAmC1D;;;;;;;;OAQG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IAI3D;;;;;;;;OAQG;IACG,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;CAG5D"}
|
package/dist/WasClient.js
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
import { ZcapClient } from '@interop/ezcap';
|
|
13
13
|
import { Ed25519Signature2020 } from '@interop/ed25519-signature';
|
|
14
14
|
import { spacesRoot } from './internal/paths.js';
|
|
15
|
-
import { send, rawRequest } from './internal/request.js';
|
|
15
|
+
import { send, rawRequest, unsignedRequest } from './internal/request.js';
|
|
16
|
+
import { parseResource } from './internal/content.js';
|
|
16
17
|
import { delegateGrant } from './internal/grant.js';
|
|
17
18
|
import { ValidationError } from './errors.js';
|
|
18
19
|
import { Space } from './Space.js';
|
|
@@ -84,9 +85,9 @@ export class WasClient {
|
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
87
|
/**
|
|
87
|
-
* Creates a space (server-generated id unless `id` is given).
|
|
88
|
-
*
|
|
89
|
-
* (which is the default).
|
|
88
|
+
* Creates a space (server-generated id unless `id` is given). `name` is
|
|
89
|
+
* optional (both in the spec and on the reference server); `controller` must
|
|
90
|
+
* match the wrapped signer's DID (which is the default).
|
|
90
91
|
*
|
|
91
92
|
* @param desc {object}
|
|
92
93
|
* @param [desc.id] {string}
|
|
@@ -112,9 +113,12 @@ export class WasClient {
|
|
|
112
113
|
return this.space(created.id);
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
|
-
* Lists the spaces in the repository
|
|
116
|
-
*
|
|
117
|
-
*
|
|
116
|
+
* Lists the spaces in the repository visible to the wrapped signer, as a
|
|
117
|
+
* `{ url, totalItems, items }` listing. Visibility is per-controller: the
|
|
118
|
+
* result holds only the spaces whose controller the signed invocation is
|
|
119
|
+
* authorized for. An unauthorized caller is not an error -- the server
|
|
120
|
+
* returns an empty `items` list (the spec's explicit exception to 404
|
|
121
|
+
* masking), so nothing is revealed about which spaces exist.
|
|
118
122
|
*
|
|
119
123
|
* @returns {Promise<SpaceListing>}
|
|
120
124
|
*/
|
|
@@ -125,6 +129,45 @@ export class WasClient {
|
|
|
125
129
|
});
|
|
126
130
|
return response.data;
|
|
127
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Reads a public (`PublicCanRead`) resource by its URL with no authorization
|
|
134
|
+
* -- an unsigned `GET`, for consuming a shared public link. Auto-parses JSON
|
|
135
|
+
* to an object and returns binary as a `Blob`. Returns `null` if the resource
|
|
136
|
+
* is missing or not publicly readable (404 conflation caveat).
|
|
137
|
+
*
|
|
138
|
+
* @param options {object}
|
|
139
|
+
* @param options.resourceUrl {string} the absolute resource URL
|
|
140
|
+
* @returns {Promise<Json | Blob | null>}
|
|
141
|
+
*/
|
|
142
|
+
async publicRead({ resourceUrl }) {
|
|
143
|
+
const response = await unsignedRequest({
|
|
144
|
+
url: resourceUrl,
|
|
145
|
+
method: 'GET',
|
|
146
|
+
read: true
|
|
147
|
+
});
|
|
148
|
+
return parseResource(response);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Lists a public (`PublicCanRead`) collection by its URL with no authorization
|
|
152
|
+
* -- an unsigned `GET` -- e.g. to browse a blog published as a public-read
|
|
153
|
+
* collection. Returns `null` if the collection is missing or not publicly
|
|
154
|
+
* readable (404 conflation caveat).
|
|
155
|
+
*
|
|
156
|
+
* @param options {object}
|
|
157
|
+
* @param options.collectionUrl {string} the absolute collection URL
|
|
158
|
+
* @returns {Promise<CollectionResourcesList | null>}
|
|
159
|
+
*/
|
|
160
|
+
async publicListCollection({ collectionUrl }) {
|
|
161
|
+
// The collection listing endpoint is the trailing-slash items URL.
|
|
162
|
+
const url = collectionUrl.endsWith('/')
|
|
163
|
+
? collectionUrl
|
|
164
|
+
: `${collectionUrl}/`;
|
|
165
|
+
const response = await unsignedRequest({ url, method: 'GET', read: true });
|
|
166
|
+
if (response === null) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
return (response.data ?? (await response.json()));
|
|
170
|
+
}
|
|
128
171
|
/**
|
|
129
172
|
* Rebuilds an access handle from a received capability, returning a handle at
|
|
130
173
|
* the depth implied by the capability's `invocationTarget` (space /
|
package/dist/WasClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WasClient.js","sourceRoot":"","sources":["../src/WasClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"WasClient.js","sourceRoot":"","sources":["../src/WasClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MA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A;QAC7B,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,IAAI,QAAQ,CAAC;gBAClB,OAAO;gBACP,OAAO;gBACP,YAAY,EAAE,YAAsB;gBACpC,UAAU;gBACV,UAAU,EAAE,IAAI;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,IAAI,UAAU,CAAC;gBACpB,OAAO;gBACP,OAAO;gBACP,YAAY;gBACZ,UAAU,EAAE,IAAI;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,IAAI,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,CAAC,OAAqB;QAC/B,OAAO,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,OAAO,CAAC,OAAqB;QACjC,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;CACF"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Typed error hierarchy for the WAS client. A `WasError` base carries the
|
|
6
|
-
* server's `application/problem+json` fields (`status` / `title` / `details` /
|
|
7
|
-
* `requestUrl`); `mapError()` translates a thrown ky/ezcap error into the
|
|
8
|
-
* appropriate subclass.
|
|
9
|
-
*/
|
|
10
1
|
/**
|
|
11
2
|
* Structured fields attached to a `WasError`, sourced from the server's
|
|
12
3
|
* `application/problem+json` response body.
|
|
13
4
|
*/
|
|
14
5
|
export interface WasErrorOptions {
|
|
15
6
|
status?: number;
|
|
7
|
+
/**
|
|
8
|
+
* The problem-kind URI from the response body's `type` (e.g.
|
|
9
|
+
* `https://wallet.storage/spec#quota-exceeded`), when the server sent one.
|
|
10
|
+
*/
|
|
11
|
+
type?: string;
|
|
16
12
|
title?: string;
|
|
17
13
|
details?: string[];
|
|
18
14
|
requestUrl?: string;
|
|
@@ -23,6 +19,7 @@ export interface WasErrorOptions {
|
|
|
23
19
|
*/
|
|
24
20
|
export declare class WasError extends Error {
|
|
25
21
|
status?: number;
|
|
22
|
+
type?: string;
|
|
26
23
|
title?: string;
|
|
27
24
|
details?: string[];
|
|
28
25
|
requestUrl?: string;
|
|
@@ -55,6 +52,31 @@ export declare class AuthRequiredError extends WasError {
|
|
|
55
52
|
export declare class NotImplementedError extends WasError {
|
|
56
53
|
constructor(message: string, options?: WasErrorOptions);
|
|
57
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* A client-supplied id or backend conflicts with existing state (HTTP 409):
|
|
57
|
+
* `id-conflict` (the id already exists), `reserved-id` (the id collides with a
|
|
58
|
+
* reserved path segment), or `unsupported-backend` (the backend id is not in
|
|
59
|
+
* the space's available list). The specific kind is on the `type` URI.
|
|
60
|
+
*/
|
|
61
|
+
export declare class ConflictError extends WasError {
|
|
62
|
+
constructor(message: string, options?: WasErrorOptions);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A single upload exceeded the target backend's `maxUploadBytes` constraint
|
|
66
|
+
* (HTTP 413). Unlike `QuotaExceededError`, this is per-request -- a smaller
|
|
67
|
+
* upload may still succeed.
|
|
68
|
+
*/
|
|
69
|
+
export declare class PayloadTooLargeError extends WasError {
|
|
70
|
+
constructor(message: string, options?: WasErrorOptions);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A write was rejected because the target backend's storage quota is exhausted
|
|
74
|
+
* (HTTP 507). This is a client-actionable storage-full condition, not a server
|
|
75
|
+
* fault.
|
|
76
|
+
*/
|
|
77
|
+
export declare class QuotaExceededError extends WasError {
|
|
78
|
+
constructor(message: string, options?: WasErrorOptions);
|
|
79
|
+
}
|
|
58
80
|
/**
|
|
59
81
|
* The server encountered an internal fault (HTTP 5xx).
|
|
60
82
|
*/
|
|
@@ -63,7 +85,9 @@ export declare class WasServerError extends WasError {
|
|
|
63
85
|
}
|
|
64
86
|
/**
|
|
65
87
|
* Translates a thrown ky/ezcap error into the appropriate `WasError` subclass,
|
|
66
|
-
* carrying through the server's `problem+json` fields.
|
|
88
|
+
* carrying through the server's `problem+json` fields. Dispatches on the
|
|
89
|
+
* problem-kind `type` URI when the server sent one, falling back to the HTTP
|
|
90
|
+
* status otherwise.
|
|
67
91
|
*
|
|
68
92
|
* @param err {unknown} the caught error
|
|
69
93
|
* @returns {WasError}
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;gBAEP,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAU3D;AAED;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAI3D;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAI3D;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAI3D;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAI3D;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAI3D;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;gBACpC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAI3D;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;gBAClC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAI3D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAI3D;AA6ED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CA6C/C"}
|
package/dist/errors.js
CHANGED
|
@@ -7,19 +7,22 @@
|
|
|
7
7
|
* `requestUrl`); `mapError()` translates a thrown ky/ezcap error into the
|
|
8
8
|
* appropriate subclass.
|
|
9
9
|
*/
|
|
10
|
+
import { ProblemTypes } from '@interop/storage-core';
|
|
10
11
|
/**
|
|
11
12
|
* Base class for all errors thrown by the high-level client methods.
|
|
12
13
|
*/
|
|
13
14
|
export class WasError extends Error {
|
|
14
15
|
status;
|
|
16
|
+
type;
|
|
15
17
|
title;
|
|
16
18
|
details;
|
|
17
19
|
requestUrl;
|
|
18
20
|
constructor(message, options = {}) {
|
|
19
|
-
const { status, title, details, requestUrl, cause } = options;
|
|
21
|
+
const { status, type, title, details, requestUrl, cause } = options;
|
|
20
22
|
super(message, cause !== undefined ? { cause } : undefined);
|
|
21
23
|
this.name = 'WasError';
|
|
22
24
|
this.status = status;
|
|
25
|
+
this.type = type;
|
|
23
26
|
this.title = title;
|
|
24
27
|
this.details = details;
|
|
25
28
|
this.requestUrl = requestUrl;
|
|
@@ -64,6 +67,40 @@ export class NotImplementedError extends WasError {
|
|
|
64
67
|
this.name = 'NotImplementedError';
|
|
65
68
|
}
|
|
66
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* A client-supplied id or backend conflicts with existing state (HTTP 409):
|
|
72
|
+
* `id-conflict` (the id already exists), `reserved-id` (the id collides with a
|
|
73
|
+
* reserved path segment), or `unsupported-backend` (the backend id is not in
|
|
74
|
+
* the space's available list). The specific kind is on the `type` URI.
|
|
75
|
+
*/
|
|
76
|
+
export class ConflictError extends WasError {
|
|
77
|
+
constructor(message, options = {}) {
|
|
78
|
+
super(message, options);
|
|
79
|
+
this.name = 'ConflictError';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A single upload exceeded the target backend's `maxUploadBytes` constraint
|
|
84
|
+
* (HTTP 413). Unlike `QuotaExceededError`, this is per-request -- a smaller
|
|
85
|
+
* upload may still succeed.
|
|
86
|
+
*/
|
|
87
|
+
export class PayloadTooLargeError extends WasError {
|
|
88
|
+
constructor(message, options = {}) {
|
|
89
|
+
super(message, options);
|
|
90
|
+
this.name = 'PayloadTooLargeError';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A write was rejected because the target backend's storage quota is exhausted
|
|
95
|
+
* (HTTP 507). This is a client-actionable storage-full condition, not a server
|
|
96
|
+
* fault.
|
|
97
|
+
*/
|
|
98
|
+
export class QuotaExceededError extends WasError {
|
|
99
|
+
constructor(message, options = {}) {
|
|
100
|
+
super(message, options);
|
|
101
|
+
this.name = 'QuotaExceededError';
|
|
102
|
+
}
|
|
103
|
+
}
|
|
67
104
|
/**
|
|
68
105
|
* The server encountered an internal fault (HTTP 5xx).
|
|
69
106
|
*/
|
|
@@ -73,9 +110,58 @@ export class WasServerError extends WasError {
|
|
|
73
110
|
this.name = 'WasServerError';
|
|
74
111
|
}
|
|
75
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Extracts the fragment of a problem-type URI (the part after `#`, e.g.
|
|
115
|
+
* `quota-exceeded` from `https://wallet.storage/spec#quota-exceeded`).
|
|
116
|
+
* @param problemType {string} a `ProblemTypes` URI
|
|
117
|
+
* @returns {string}
|
|
118
|
+
*/
|
|
119
|
+
function problemFragment(problemType) {
|
|
120
|
+
return problemType.split('#')[1] ?? '';
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Maps each problem-kind fragment to the `WasError` subclass that represents
|
|
124
|
+
* it. Keyed off the shared `ProblemTypes` registry from `@interop/storage-core`
|
|
125
|
+
* (via `problemFragment`) so the kinds stay in lockstep with the server instead
|
|
126
|
+
* of being duplicated as literal strings here.
|
|
127
|
+
*/
|
|
128
|
+
const ERROR_CLASS_BY_KIND = {
|
|
129
|
+
[problemFragment(ProblemTypes.NOT_FOUND)]: NotFoundError,
|
|
130
|
+
[problemFragment(ProblemTypes.INVALID_ID)]: ValidationError,
|
|
131
|
+
[problemFragment(ProblemTypes.INVALID_REQUEST_BODY)]: ValidationError,
|
|
132
|
+
[problemFragment(ProblemTypes.MISSING_CONTENT_TYPE)]: ValidationError,
|
|
133
|
+
[problemFragment(ProblemTypes.INVALID_AUTHORIZATION_HEADER)]: ValidationError,
|
|
134
|
+
[problemFragment(ProblemTypes.CONTROLLER_MISMATCH)]: ValidationError,
|
|
135
|
+
[problemFragment(ProblemTypes.INVALID_IMPORT)]: ValidationError,
|
|
136
|
+
[problemFragment(ProblemTypes.MISSING_AUTHORIZATION)]: AuthRequiredError,
|
|
137
|
+
[problemFragment(ProblemTypes.RESERVED_ID)]: ConflictError,
|
|
138
|
+
[problemFragment(ProblemTypes.ID_CONFLICT)]: ConflictError,
|
|
139
|
+
[problemFragment(ProblemTypes.UNSUPPORTED_BACKEND)]: ConflictError,
|
|
140
|
+
[problemFragment(ProblemTypes.PAYLOAD_TOO_LARGE)]: PayloadTooLargeError,
|
|
141
|
+
[problemFragment(ProblemTypes.QUOTA_EXCEEDED)]: QuotaExceededError,
|
|
142
|
+
[problemFragment(ProblemTypes.UNSUPPORTED_OPERATION)]: NotImplementedError,
|
|
143
|
+
[problemFragment(ProblemTypes.STORAGE_ERROR)]: WasServerError,
|
|
144
|
+
[problemFragment(ProblemTypes.INTERNAL_ERROR)]: WasServerError
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Constructs a `WasError` subclass from a problem-kind anchor (the fragment of
|
|
148
|
+
* the `type` URI, e.g. `quota-exceeded`). Returns `null` for an unrecognized or
|
|
149
|
+
* absent kind so the caller can fall back to status-based dispatch.
|
|
150
|
+
*
|
|
151
|
+
* @param kind {string | undefined} the `type` URI fragment
|
|
152
|
+
* @param message {string}
|
|
153
|
+
* @param options {WasErrorOptions}
|
|
154
|
+
* @returns {WasError | null}
|
|
155
|
+
*/
|
|
156
|
+
function errorForKind(kind, message, options) {
|
|
157
|
+
const ErrorClass = kind === undefined ? undefined : ERROR_CLASS_BY_KIND[kind];
|
|
158
|
+
return ErrorClass ? new ErrorClass(message, options) : null;
|
|
159
|
+
}
|
|
76
160
|
/**
|
|
77
161
|
* Translates a thrown ky/ezcap error into the appropriate `WasError` subclass,
|
|
78
|
-
* carrying through the server's `problem+json` fields.
|
|
162
|
+
* carrying through the server's `problem+json` fields. Dispatches on the
|
|
163
|
+
* problem-kind `type` URI when the server sent one, falling back to the HTTP
|
|
164
|
+
* status otherwise.
|
|
79
165
|
*
|
|
80
166
|
* @param err {unknown} the caught error
|
|
81
167
|
* @returns {WasError}
|
|
@@ -87,13 +173,19 @@ export function mapError(err) {
|
|
|
87
173
|
const httpError = (err ?? {});
|
|
88
174
|
const status = httpError.status ?? httpError.response?.status;
|
|
89
175
|
const data = httpError.data;
|
|
176
|
+
const type = data?.type;
|
|
90
177
|
const title = data?.title;
|
|
91
178
|
const details = data?.errors
|
|
92
179
|
?.map(entry => entry.detail)
|
|
93
180
|
.filter((detail) => typeof detail === 'string');
|
|
94
181
|
const requestUrl = httpError.requestUrl;
|
|
95
182
|
const message = title ?? httpError.message ?? 'WAS request failed';
|
|
96
|
-
const options = { status, title, details, requestUrl, cause: err };
|
|
183
|
+
const options = { status, type, title, details, requestUrl, cause: err };
|
|
184
|
+
const kind = typeof type === 'string' ? type.split('#')[1] : undefined;
|
|
185
|
+
const byKind = errorForKind(kind, message, options);
|
|
186
|
+
if (byKind !== null) {
|
|
187
|
+
return byKind;
|
|
188
|
+
}
|
|
97
189
|
switch (status) {
|
|
98
190
|
case 400:
|
|
99
191
|
return new ValidationError(message, options);
|
|
@@ -101,8 +193,14 @@ export function mapError(err) {
|
|
|
101
193
|
return new AuthRequiredError(message, options);
|
|
102
194
|
case 404:
|
|
103
195
|
return new NotFoundError(message, options);
|
|
196
|
+
case 409:
|
|
197
|
+
return new ConflictError(message, options);
|
|
198
|
+
case 413:
|
|
199
|
+
return new PayloadTooLargeError(message, options);
|
|
104
200
|
case 501:
|
|
105
201
|
return new NotImplementedError(message, options);
|
|
202
|
+
case 507:
|
|
203
|
+
return new QuotaExceededError(message, options);
|
|
106
204
|
}
|
|
107
205
|
if (typeof status === 'number' && status >= 500) {
|
|
108
206
|
return new WasServerError(message, options);
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO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AAC,CAAC,SAAS,CAAA;IACtE,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,MAAM,CAAA;IACf,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG;YACN,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC9C,KAAK,GAAG;YACN,OAAO,IAAI,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAChD,KAAK,GAAG;YACN,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC5C,KAAK,GAAG;YACN,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC5C,KAAK,GAAG;YACN,OAAO,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACnD,KAAK,GAAG;YACN,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClD,KAAK,GAAG;YACN,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAChD,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAED,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export { WasClient } from './WasClient.js';
|
|
|
9
9
|
export { Space } from './Space.js';
|
|
10
10
|
export { Collection } from './Collection.js';
|
|
11
11
|
export { Resource } from './Resource.js';
|
|
12
|
-
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, WasServerError, mapError } from './errors.js';
|
|
13
|
-
export type { Json, JsonPrimitive, JsonObject, JsonArray, Action, ActionInput, SpaceDescription, CollectionDescription, CollectionSummary,
|
|
12
|
+
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, ConflictError, PayloadTooLargeError, QuotaExceededError, WasServerError, mapError } from './errors.js';
|
|
13
|
+
export type { Json, JsonPrimitive, JsonObject, JsonArray, Action, ActionInput, SpaceDescription, CollectionDescription, CollectionSummary, CollectionsList, SpaceSummary, SpaceListing, ResourceSummary, CollectionResourcesList, ResourceMetadata, ResourceMetadataCustom, AddResult, ImportStats, PolicyDocument, LinkSet, LinkSetEntry, HandleOptions, BackendReference, BackendDescriptor, StorageLimit, CollectionUsage, BackendUsage, SpaceQuotaReport, GrantOptions, RequestInput, IZcap, IDelegatedZcap, ISigner } from './types.js';
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,IAAI,EACJ,aAAa,EACb,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,IAAI,EACJ,aAAa,EACb,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,SAAS,EACT,WAAW,EACX,cAAc,EACd,OAAO,EACP,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACR,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -9,5 +9,5 @@ export { WasClient } from './WasClient.js';
|
|
|
9
9
|
export { Space } from './Space.js';
|
|
10
10
|
export { Collection } from './Collection.js';
|
|
11
11
|
export { Resource } from './Resource.js';
|
|
12
|
-
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, WasServerError, mapError } from './errors.js';
|
|
12
|
+
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, ConflictError, PayloadTooLargeError, QuotaExceededError, WasServerError, mapError } from './errors.js';
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA"}
|
package/dist/internal/paths.d.ts
CHANGED
|
@@ -39,6 +39,14 @@ export declare function spaceExport(spaceId: string): string;
|
|
|
39
39
|
* `/space/:spaceId/import` -- import a tar archive into a space.
|
|
40
40
|
*/
|
|
41
41
|
export declare function spaceImport(spaceId: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* `/space/:spaceId/backends` -- the backends available within a space.
|
|
44
|
+
*/
|
|
45
|
+
export declare function spaceBackends(spaceId: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* `/space/:spaceId/quotas` -- the space-level storage quota report.
|
|
48
|
+
*/
|
|
49
|
+
export declare function spaceQuotas(spaceId: string): string;
|
|
42
50
|
/**
|
|
43
51
|
* `/space/:spaceId/policy` -- the space-level access-control policy resource.
|
|
44
52
|
*/
|
|
@@ -67,11 +75,26 @@ export declare function collectionPolicy(spaceId: string, collectionId: string):
|
|
|
67
75
|
* (policy discovery).
|
|
68
76
|
*/
|
|
69
77
|
export declare function collectionLinkset(spaceId: string, collectionId: string): string;
|
|
78
|
+
/**
|
|
79
|
+
* `/space/:spaceId/:collectionId/backend` -- the "Collection Backend Selected"
|
|
80
|
+
* descriptor (the backend this collection is stored on).
|
|
81
|
+
*/
|
|
82
|
+
export declare function collectionBackend(spaceId: string, collectionId: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* `/space/:spaceId/:collectionId/quota` -- the per-collection storage quota
|
|
85
|
+
* report (spec "Quotas").
|
|
86
|
+
*/
|
|
87
|
+
export declare function collectionQuota(spaceId: string, collectionId: string): string;
|
|
70
88
|
/**
|
|
71
89
|
* `/space/:spaceId/:collectionId/:resourceId` -- get / put / delete a resource
|
|
72
90
|
* (no trailing slash).
|
|
73
91
|
*/
|
|
74
92
|
export declare function resourcePath(spaceId: string, collectionId: string, resourceId: string): string;
|
|
93
|
+
/**
|
|
94
|
+
* `/space/:spaceId/:collectionId/:resourceId/meta` -- the resource metadata
|
|
95
|
+
* object (server-managed properties plus the user-writable `custom` object).
|
|
96
|
+
*/
|
|
97
|
+
export declare function resourceMeta(spaceId: string, collectionId: string, resourceId: string): string;
|
|
75
98
|
/**
|
|
76
99
|
* `/space/:spaceId/:collectionId/:resourceId/policy` -- the resource-level
|
|
77
100
|
* access-control policy resource.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/internal/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AAMH;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,G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ACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,EACpB,SAAS,EACT,IAAI,EACL,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,MAAM,CAET"}
|
package/dist/internal/paths.js
CHANGED
|
@@ -56,6 +56,18 @@ export function spaceExport(spaceId) {
|
|
|
56
56
|
export function spaceImport(spaceId) {
|
|
57
57
|
return `/space/${encode(spaceId)}/import`;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* `/space/:spaceId/backends` -- the backends available within a space.
|
|
61
|
+
*/
|
|
62
|
+
export function spaceBackends(spaceId) {
|
|
63
|
+
return `/space/${encode(spaceId)}/backends`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* `/space/:spaceId/quotas` -- the space-level storage quota report.
|
|
67
|
+
*/
|
|
68
|
+
export function spaceQuotas(spaceId) {
|
|
69
|
+
return `/space/${encode(spaceId)}/quotas`;
|
|
70
|
+
}
|
|
59
71
|
/**
|
|
60
72
|
* `/space/:spaceId/policy` -- the space-level access-control policy resource.
|
|
61
73
|
*/
|
|
@@ -96,6 +108,20 @@ export function collectionPolicy(spaceId, collectionId) {
|
|
|
96
108
|
export function collectionLinkset(spaceId, collectionId) {
|
|
97
109
|
return `/space/${encode(spaceId)}/${encode(collectionId)}/linkset`;
|
|
98
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* `/space/:spaceId/:collectionId/backend` -- the "Collection Backend Selected"
|
|
113
|
+
* descriptor (the backend this collection is stored on).
|
|
114
|
+
*/
|
|
115
|
+
export function collectionBackend(spaceId, collectionId) {
|
|
116
|
+
return `/space/${encode(spaceId)}/${encode(collectionId)}/backend`;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* `/space/:spaceId/:collectionId/quota` -- the per-collection storage quota
|
|
120
|
+
* report (spec "Quotas").
|
|
121
|
+
*/
|
|
122
|
+
export function collectionQuota(spaceId, collectionId) {
|
|
123
|
+
return `/space/${encode(spaceId)}/${encode(collectionId)}/quota`;
|
|
124
|
+
}
|
|
99
125
|
/**
|
|
100
126
|
* `/space/:spaceId/:collectionId/:resourceId` -- get / put / delete a resource
|
|
101
127
|
* (no trailing slash).
|
|
@@ -103,6 +129,13 @@ export function collectionLinkset(spaceId, collectionId) {
|
|
|
103
129
|
export function resourcePath(spaceId, collectionId, resourceId) {
|
|
104
130
|
return `/space/${encode(spaceId)}/${encode(collectionId)}/${encode(resourceId)}`;
|
|
105
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* `/space/:spaceId/:collectionId/:resourceId/meta` -- the resource metadata
|
|
134
|
+
* object (server-managed properties plus the user-writable `custom` object).
|
|
135
|
+
*/
|
|
136
|
+
export function resourceMeta(spaceId, collectionId, resourceId) {
|
|
137
|
+
return `/space/${encode(spaceId)}/${encode(collectionId)}/${encode(resourceId)}/meta`;
|
|
138
|
+
}
|
|
106
139
|
/**
|
|
107
140
|
* `/space/:spaceId/:collectionId/:resourceId/policy` -- the resource-level
|
|
108
141
|
* access-control policy resource.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/internal/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AAEH,SAAS,MAAM,CAAC,OAAe;IAC7B,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,WAAW,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,GAAG,CAAA;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,eAAe,CAAA;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,SAAS,CAAA;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,SAAS,CAAA;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,UAAU,MAAM,CA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M,CAAC,YAAY,CAAC,QAAQ,CAAA;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAe,EACf,YAAoB,EACpB,UAAkB;IAElB,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE,CAAA;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAe,EACf,YAAoB,EACpB,UAAkB;IAElB,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAA;AACvF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,YAAoB,EACpB,UAAkB;IAElB,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,CAAA;AACzF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,SAAS,EACT,IAAI,EAIL;IACC,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAA;AAC5C,CAAC"}
|
|
@@ -51,6 +51,26 @@ export interface SendInput {
|
|
|
51
51
|
* @returns {Promise<HttpResponse>}
|
|
52
52
|
*/
|
|
53
53
|
export declare function rawRequest(context: ClientContext, input: SendInput): Promise<HttpResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Sends an **unsigned** request (a plain `fetch`, no capability invocation), for
|
|
56
|
+
* reading public (`PublicCanRead`) resources that need no authorization. Applies
|
|
57
|
+
* the same typed-error mapping and null-on-404 read translation as `send()`.
|
|
58
|
+
* Takes an absolute `url` -- public reads address a resource by its link, not by
|
|
59
|
+
* a server-relative path.
|
|
60
|
+
*
|
|
61
|
+
* @param input {object}
|
|
62
|
+
* @param input.url {string} absolute URL to read
|
|
63
|
+
* @param [input.method] {string} HTTP method (defaults to `GET`)
|
|
64
|
+
* @param [input.headers] {Record<string,string>}
|
|
65
|
+
* @param [input.read] {boolean} when true, a 404 resolves to `null`
|
|
66
|
+
* @returns {Promise<HttpResponse | null>}
|
|
67
|
+
*/
|
|
68
|
+
export declare function unsignedRequest(input: {
|
|
69
|
+
url: string;
|
|
70
|
+
method?: string;
|
|
71
|
+
headers?: Record<string, string>;
|
|
72
|
+
read?: boolean;
|
|
73
|
+
}): Promise<HttpResponse | null>;
|
|
54
74
|
/**
|
|
55
75
|
* Signs and sends a request, applying the typed-error mapping. When `read` is
|
|
56
76
|
* set, a 404 resolves to `null` (MongoDB `findOne` semantics); otherwise every
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/internal/request.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IAExB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,IAAI,GAAG,UAAU,CAAA;IACxB,U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