@calimero-network/mero-js 7.3.1 → 7.3.2
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/dist/admin-api/admin-client.d.ts +0 -1
- package/dist/admin-api/admin-client.js +0 -1
- package/dist/admin-api/admin-factory.d.ts +10 -4
- package/dist/admin-api/admin-factory.js +14 -34
- package/dist/admin-api/admin-types.d.ts +62 -23
- package/dist/admin-api/admin-types.js +0 -1
- package/dist/admin-api/index.d.ts +0 -1
- package/dist/admin-api/index.js +0 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/index.js +0 -1
- package/dist/auth-api/auth-client.d.ts +0 -1
- package/dist/auth-api/auth-client.js +0 -1
- package/dist/auth-api/auth-factory.d.ts +0 -1
- package/dist/auth-api/auth-factory.js +0 -1
- package/dist/auth-api/auth-types.d.ts +0 -1
- package/dist/auth-api/auth-types.js +0 -1
- package/dist/auth-api/index.d.ts +0 -1
- package/dist/auth-api/index.js +0 -1
- package/dist/capabilities.d.ts +0 -1
- package/dist/capabilities.js +0 -1
- package/dist/cloud/cloud-client.d.ts +0 -1
- package/dist/cloud/cloud-client.js +0 -1
- package/dist/cloud/index.d.ts +0 -1
- package/dist/cloud/index.js +0 -1
- package/dist/events/group.d.ts +0 -1
- package/dist/events/group.js +0 -1
- package/dist/events/index.d.ts +0 -1
- package/dist/events/index.js +0 -1
- package/dist/events/sse.d.ts +0 -1
- package/dist/events/sse.js +0 -1
- package/dist/events/ws.d.ts +0 -1
- package/dist/events/ws.js +0 -1
- package/dist/http-client/api-response.d.ts +0 -1
- package/dist/http-client/api-response.js +0 -1
- package/dist/http-client/http-factory.d.ts +0 -1
- package/dist/http-client/http-factory.js +0 -1
- package/dist/http-client/http-types.d.ts +0 -1
- package/dist/http-client/http-types.js +0 -1
- package/dist/http-client/index.d.ts +0 -1
- package/dist/http-client/index.js +0 -1
- package/dist/http-client/retry.d.ts +0 -1
- package/dist/http-client/retry.js +0 -1
- package/dist/http-client/signal-utils.d.ts +0 -1
- package/dist/http-client/signal-utils.js +0 -1
- package/dist/http-client/web-client.d.ts +0 -1
- package/dist/http-client/web-client.js +26 -2
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +26 -48
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.mjs +26 -48
- package/dist/index.mjs.map +3 -3
- package/dist/mero-js.d.ts +8 -1
- package/dist/mero-js.js +8 -3
- package/dist/nodeDiscovery.d.ts +0 -1
- package/dist/nodeDiscovery.js +0 -1
- package/dist/rpc/index.d.ts +0 -1
- package/dist/rpc/index.js +0 -1
- package/dist/token-store/index.d.ts +0 -1
- package/dist/token-store/index.js +0 -1
- package/dist/types/api-response.d.ts +0 -1
- package/dist/types/api-response.js +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/package.json +2 -4
- package/dist/admin-api/admin-client.d.ts.map +0 -1
- package/dist/admin-api/admin-client.js.map +0 -1
- package/dist/admin-api/admin-factory.d.ts.map +0 -1
- package/dist/admin-api/admin-factory.js.map +0 -1
- package/dist/admin-api/admin-types.d.ts.map +0 -1
- package/dist/admin-api/admin-types.js.map +0 -1
- package/dist/admin-api/index.d.ts.map +0 -1
- package/dist/admin-api/index.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth-api/auth-client.d.ts.map +0 -1
- package/dist/auth-api/auth-client.js.map +0 -1
- package/dist/auth-api/auth-factory.d.ts.map +0 -1
- package/dist/auth-api/auth-factory.js.map +0 -1
- package/dist/auth-api/auth-types.d.ts.map +0 -1
- package/dist/auth-api/auth-types.js.map +0 -1
- package/dist/auth-api/index.d.ts.map +0 -1
- package/dist/auth-api/index.js.map +0 -1
- package/dist/capabilities.d.ts.map +0 -1
- package/dist/capabilities.js.map +0 -1
- package/dist/cloud/cloud-client.d.ts.map +0 -1
- package/dist/cloud/cloud-client.js.map +0 -1
- package/dist/cloud/index.d.ts.map +0 -1
- package/dist/cloud/index.js.map +0 -1
- package/dist/events/group.d.ts.map +0 -1
- package/dist/events/group.js.map +0 -1
- package/dist/events/index.d.ts.map +0 -1
- package/dist/events/index.js.map +0 -1
- package/dist/events/sse.d.ts.map +0 -1
- package/dist/events/sse.js.map +0 -1
- package/dist/events/ws.d.ts.map +0 -1
- package/dist/events/ws.js.map +0 -1
- package/dist/http-client/api-response.d.ts.map +0 -1
- package/dist/http-client/api-response.js.map +0 -1
- package/dist/http-client/http-factory.d.ts.map +0 -1
- package/dist/http-client/http-factory.js.map +0 -1
- package/dist/http-client/http-types.d.ts.map +0 -1
- package/dist/http-client/http-types.js.map +0 -1
- package/dist/http-client/index.d.ts.map +0 -1
- package/dist/http-client/index.js.map +0 -1
- package/dist/http-client/retry.d.ts.map +0 -1
- package/dist/http-client/retry.js.map +0 -1
- package/dist/http-client/signal-utils.d.ts.map +0 -1
- package/dist/http-client/signal-utils.js.map +0 -1
- package/dist/http-client/web-client.d.ts.map +0 -1
- package/dist/http-client/web-client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mero-js.d.ts.map +0 -1
- package/dist/mero-js.js.map +0 -1
- package/dist/nodeDiscovery.d.ts.map +0 -1
- package/dist/nodeDiscovery.js.map +0 -1
- package/dist/rpc/index.d.ts.map +0 -1
- package/dist/rpc/index.js.map +0 -1
- package/dist/token-store/index.d.ts.map +0 -1
- package/dist/token-store/index.js.map +0 -1
- package/dist/types/api-response.d.ts.map +0 -1
- package/dist/types/api-response.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
|
@@ -186,4 +186,3 @@ export declare class AdminApiClient {
|
|
|
186
186
|
/** Abort a namespace migration (POST /admin-api/groups/:namespace_id/migration/abort). */
|
|
187
187
|
abortMigration(namespaceId: string, request?: Record<string, unknown>): Promise<unknown>;
|
|
188
188
|
}
|
|
189
|
-
//# sourceMappingURL=admin-client.d.ts.map
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { AdminApiClient } from './admin-client.js';
|
|
2
2
|
import { AdminApiClientConfig } from './admin-types.js';
|
|
3
3
|
import { HttpClient } from '../http-client/index.js';
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
|
|
4
|
+
/** Admin client over a browser HTTP transport (global `fetch`). */
|
|
5
|
+
export declare function createBrowserAdminApiClient(config: AdminApiClientConfig): AdminApiClient;
|
|
6
|
+
/** Admin client over a Node HTTP transport (Node 18+ `fetch`). */
|
|
7
|
+
export declare function createNodeAdminApiClient(config: AdminApiClientConfig): AdminApiClient;
|
|
8
|
+
/** Admin client over whichever transport suits the current runtime. */
|
|
9
|
+
export declare function createAdminApiClient(config: AdminApiClientConfig): AdminApiClient;
|
|
10
|
+
/**
|
|
11
|
+
* Admin client over a caller-supplied HTTP client — use this to share one
|
|
12
|
+
* transport (and its token handling) with the other API clients.
|
|
13
|
+
*/
|
|
7
14
|
export declare function createAdminApiClientFromHttpClient(httpClient: HttpClient, _config: AdminApiClientConfig): AdminApiClient;
|
|
8
|
-
//# sourceMappingURL=admin-factory.d.ts.map
|
|
@@ -1,42 +1,22 @@
|
|
|
1
1
|
import { AdminApiClient } from './admin-client.js';
|
|
2
|
-
|
|
3
|
-
class MockHttpClient {
|
|
4
|
-
async get() {
|
|
5
|
-
throw new Error('HTTP client not implemented - use createAdminApiClientFromHttpClient with a real HTTP client');
|
|
6
|
-
}
|
|
7
|
-
async post() {
|
|
8
|
-
throw new Error('HTTP client not implemented - use createAdminApiClientFromHttpClient with a real HTTP client');
|
|
9
|
-
}
|
|
10
|
-
async put() {
|
|
11
|
-
throw new Error('HTTP client not implemented - use createAdminApiClientFromHttpClient with a real HTTP client');
|
|
12
|
-
}
|
|
13
|
-
async delete() {
|
|
14
|
-
throw new Error('HTTP client not implemented - use createAdminApiClientFromHttpClient with a real HTTP client');
|
|
15
|
-
}
|
|
16
|
-
async patch() {
|
|
17
|
-
throw new Error('HTTP client not implemented - use createAdminApiClientFromHttpClient with a real HTTP client');
|
|
18
|
-
}
|
|
19
|
-
async head() {
|
|
20
|
-
throw new Error('HTTP client not implemented - use createAdminApiClientFromHttpClient with a real HTTP client');
|
|
21
|
-
}
|
|
22
|
-
async request() {
|
|
23
|
-
throw new Error('HTTP client not implemented - use createAdminApiClientFromHttpClient with a real HTTP client');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
2
|
+
import { createBrowserHttpClient, createNodeHttpClient, createUniversalHttpClient, } from '../http-client/index.js';
|
|
26
3
|
// Factory functions for creating Admin API clients
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return new AdminApiClient(
|
|
4
|
+
/** Admin client over a browser HTTP transport (global `fetch`). */
|
|
5
|
+
export function createBrowserAdminApiClient(config) {
|
|
6
|
+
return new AdminApiClient(createBrowserHttpClient(config));
|
|
30
7
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return new AdminApiClient(
|
|
8
|
+
/** Admin client over a Node HTTP transport (Node 18+ `fetch`). */
|
|
9
|
+
export function createNodeAdminApiClient(config) {
|
|
10
|
+
return new AdminApiClient(createNodeHttpClient(config));
|
|
34
11
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return new AdminApiClient(
|
|
12
|
+
/** Admin client over whichever transport suits the current runtime. */
|
|
13
|
+
export function createAdminApiClient(config) {
|
|
14
|
+
return new AdminApiClient(createUniversalHttpClient(config));
|
|
38
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Admin client over a caller-supplied HTTP client — use this to share one
|
|
18
|
+
* transport (and its token handling) with the other API clients.
|
|
19
|
+
*/
|
|
39
20
|
export function createAdminApiClientFromHttpClient(httpClient, _config) {
|
|
40
21
|
return new AdminApiClient(httpClient);
|
|
41
22
|
}
|
|
42
|
-
//# sourceMappingURL=admin-factory.js.map
|
|
@@ -26,18 +26,24 @@ export interface InstallApplicationResponseData {
|
|
|
26
26
|
export interface UninstallApplicationResponseData {
|
|
27
27
|
applicationId: string;
|
|
28
28
|
}
|
|
29
|
+
export interface ApplicationBlob {
|
|
30
|
+
bytecode: string;
|
|
31
|
+
compiled: string;
|
|
32
|
+
}
|
|
29
33
|
export interface Application {
|
|
30
34
|
id: string;
|
|
31
|
-
blob:
|
|
32
|
-
bytecode: string;
|
|
33
|
-
compiled: string;
|
|
34
|
-
};
|
|
35
|
+
blob: ApplicationBlob;
|
|
35
36
|
size: number;
|
|
36
37
|
source: string;
|
|
37
38
|
metadata: number[];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/** Absent for a raw-wasm install (no signed bundle) and for bootstrap stubs. */
|
|
40
|
+
signer_id?: string;
|
|
41
|
+
/** Absent on a bootstrap stub row, written before the app's blob arrives. */
|
|
42
|
+
package?: string;
|
|
43
|
+
/** Absent when the stored version is empty or not valid semver. */
|
|
44
|
+
version?: string;
|
|
45
|
+
/** Named services of a multi-service bundle; absent for single-service apps. */
|
|
46
|
+
services?: Record<string, ApplicationBlob>;
|
|
41
47
|
}
|
|
42
48
|
export interface ListApplicationsResponseData {
|
|
43
49
|
apps: Application[];
|
|
@@ -122,7 +128,8 @@ export interface Context {
|
|
|
122
128
|
* namespaceStateHash). Renamed from `rootHash`, which never populated.
|
|
123
129
|
*/
|
|
124
130
|
contextStateHash: string;
|
|
125
|
-
|
|
131
|
+
/** Absent while the context has no deltas yet (core omits an empty list). */
|
|
132
|
+
dagHeads?: number[][];
|
|
126
133
|
/** Bundle semver of the installed application (skew #2). Absent on older nodes. */
|
|
127
134
|
applicationVersion?: string;
|
|
128
135
|
}
|
|
@@ -214,13 +221,12 @@ export interface CreateContextIdentityAliasRequest {
|
|
|
214
221
|
alias: string;
|
|
215
222
|
identity: string;
|
|
216
223
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
+
/**
|
|
225
|
+
* Core's `ListAliasesResponse` is `{ data: BTreeMap<Alias<T>, T> }`, so once the
|
|
226
|
+
* `data` envelope is stripped the payload is a flat `{ alias: id }` map — not a
|
|
227
|
+
* list of entries. Applies to context, application and context-identity aliases.
|
|
228
|
+
*/
|
|
229
|
+
export type ListAliasesResponseData = Record<string, string>;
|
|
224
230
|
export type CreateAliasResponseData = Record<string, never>;
|
|
225
231
|
export type DeleteAliasResponseData = Record<string, never>;
|
|
226
232
|
export interface LookupAliasResponseData {
|
|
@@ -232,16 +238,44 @@ export interface LookupContextIdentityAliasResponseData {
|
|
|
232
238
|
value?: string;
|
|
233
239
|
}
|
|
234
240
|
export type DeleteContextIdentityAliasResponseData = Record<string, never>;
|
|
241
|
+
/**
|
|
242
|
+
* The signed half of an invitation. Wire keys are snake_case: this type mirrors
|
|
243
|
+
* a core primitive (`calimero_context_config::types`), which carries no
|
|
244
|
+
* camelCase rename — unlike the admin DTOs that wrap it.
|
|
245
|
+
*/
|
|
235
246
|
export interface GroupInvitationFromAdmin {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
247
|
+
readonly inviter_identity: number[];
|
|
248
|
+
readonly group_id: number[];
|
|
249
|
+
readonly expiration_timestamp: number;
|
|
250
|
+
/** Per-invitation nonce; core keeps the legacy `secret_salt` wire name. */
|
|
251
|
+
readonly secret_salt: number[];
|
|
252
|
+
readonly invited_role: number;
|
|
241
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* An invitation blob the node signed. **Opaque: pass it through unchanged.**
|
|
256
|
+
*
|
|
257
|
+
* `inviter_signature` covers `invitation`, and the trailing bootstrap fields
|
|
258
|
+
* (`application_id`, `app_key`) are needed by the joiner even though they sit
|
|
259
|
+
* outside the signature — so a value that has been rebuilt field-by-field is
|
|
260
|
+
* not the value the node signed. Rebuilding is what a schema derived from these
|
|
261
|
+
* declarations does: an object schema drops the keys it wasn't told about, and
|
|
262
|
+
* core may add more (both trailing fields were added this way). Carry the value
|
|
263
|
+
* verbatim from the call that produced it to {@link JoinGroupRequest}, and treat
|
|
264
|
+
* the fields below as read-only detail for display.
|
|
265
|
+
*
|
|
266
|
+
* The `never`-typed brand makes that structural: an object literal or a schema
|
|
267
|
+
* result cannot satisfy this type, while a value the SDK returned — or one
|
|
268
|
+
* recovered with `JSON.parse` after transport — still does.
|
|
269
|
+
*/
|
|
242
270
|
export interface SignedGroupOpenInvitation {
|
|
243
|
-
invitation: GroupInvitationFromAdmin;
|
|
244
|
-
|
|
271
|
+
readonly invitation: GroupInvitationFromAdmin;
|
|
272
|
+
readonly inviter_signature: string;
|
|
273
|
+
/** Unsigned bootstrap field; absent on invitations from older nodes. */
|
|
274
|
+
readonly application_id?: number[];
|
|
275
|
+
/** Unsigned bootstrap field; absent on invitations from older nodes. */
|
|
276
|
+
readonly app_key?: number[];
|
|
277
|
+
/** @internal Brand — never present at runtime, never write it. */
|
|
278
|
+
readonly __nodeSigned: never;
|
|
245
279
|
}
|
|
246
280
|
export interface RecursiveInvitationEntry {
|
|
247
281
|
groupId: string;
|
|
@@ -258,6 +292,12 @@ export interface Namespace {
|
|
|
258
292
|
memberCount: number;
|
|
259
293
|
contextCount: number;
|
|
260
294
|
subgroupCount: number;
|
|
295
|
+
/**
|
|
296
|
+
* Bundle version of this namespace's `appKey` blob — the per-namespace truth,
|
|
297
|
+
* where the application row only says "latest fetched". Absent when core
|
|
298
|
+
* cannot resolve it (raw-wasm app, legacy key, blob not retained locally).
|
|
299
|
+
*/
|
|
300
|
+
appVersion?: string;
|
|
261
301
|
}
|
|
262
302
|
export type ListNamespacesResponseData = Namespace[];
|
|
263
303
|
export interface NamespaceIdentity {
|
|
@@ -665,4 +705,3 @@ export interface AdminApiClientConfig {
|
|
|
665
705
|
getAuthToken?: () => Promise<string | undefined>;
|
|
666
706
|
timeoutMs?: number;
|
|
667
707
|
}
|
|
668
|
-
//# sourceMappingURL=admin-types.d.ts.map
|
package/dist/admin-api/index.js
CHANGED
package/dist/auth/index.d.ts
CHANGED
|
@@ -23,4 +23,3 @@ export declare function parseAuthCallback(url: string): AuthCallbackResult | nul
|
|
|
23
23
|
* Build the auth login URL for redirecting users to the node's auth page.
|
|
24
24
|
*/
|
|
25
25
|
export declare function buildAuthLoginUrl(nodeUrl: string, opts: AuthLoginOptions): string;
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.js
CHANGED
|
@@ -5,4 +5,3 @@ export declare function createBrowserAuthApiClient(_config: AuthApiClientConfig)
|
|
|
5
5
|
export declare function createNodeAuthApiClient(_config: AuthApiClientConfig): AuthApiClient;
|
|
6
6
|
export declare function createAuthApiClient(_config: AuthApiClientConfig): AuthApiClient;
|
|
7
7
|
export declare function createAuthApiClientFromHttpClient(httpClient: HttpClient, _config: AuthApiClientConfig): AuthApiClient;
|
|
8
|
-
//# sourceMappingURL=auth-factory.d.ts.map
|
package/dist/auth-api/index.d.ts
CHANGED
package/dist/auth-api/index.js
CHANGED
package/dist/capabilities.d.ts
CHANGED
|
@@ -28,4 +28,3 @@ export declare function hasCap(mask: number, cap: number): boolean;
|
|
|
28
28
|
export declare function withCap(mask: number, cap: number): number;
|
|
29
29
|
/** Returns `mask` with every bit of `cap` cleared (u32-normalized). */
|
|
30
30
|
export declare function withoutCap(mask: number, cap: number): number;
|
|
31
|
-
//# sourceMappingURL=capabilities.d.ts.map
|
package/dist/capabilities.js
CHANGED
package/dist/cloud/index.d.ts
CHANGED
package/dist/cloud/index.js
CHANGED
package/dist/events/group.d.ts
CHANGED
package/dist/events/group.js
CHANGED
package/dist/events/index.d.ts
CHANGED
package/dist/events/index.js
CHANGED
package/dist/events/sse.d.ts
CHANGED
package/dist/events/sse.js
CHANGED
package/dist/events/ws.d.ts
CHANGED
package/dist/events/ws.js
CHANGED
|
@@ -5,4 +5,3 @@ export { createHttpClient, createBrowserHttpClient, createNodeHttpClient, create
|
|
|
5
5
|
export { withRetry, createRetryableMethod } from './retry.js';
|
|
6
6
|
export type { RetryOptions } from './retry.js';
|
|
7
7
|
export { combineSignals, createTimeoutSignal } from './signal-utils.js';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -9,4 +9,3 @@ export { createHttpClient, createBrowserHttpClient, createNodeHttpClient, create
|
|
|
9
9
|
export { withRetry, createRetryableMethod } from './retry.js';
|
|
10
10
|
// Signal utilities
|
|
11
11
|
export { combineSignals, createTimeoutSignal } from './signal-utils.js';
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -3,4 +3,3 @@ export interface RetryOptions {
|
|
|
3
3
|
}
|
|
4
4
|
export declare function withRetry<T>(fn: (attempt: number) => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
5
5
|
export declare function createRetryableMethod<T extends unknown[], R>(method: (...args: T) => Promise<R>, retryOptions?: RetryOptions): (...args: T) => Promise<R>;
|
|
6
|
-
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -8,10 +8,35 @@ import { combineSignals, createTimeoutSignal } from './signal-utils.js';
|
|
|
8
8
|
* a fresh login.
|
|
9
9
|
*/
|
|
10
10
|
const TERMINAL_AUTH_ERRORS = new Set(['token_reuse', 'token_revoked']);
|
|
11
|
+
/**
|
|
12
|
+
* Pull the node's explanation out of an error body. Core answers every handled
|
|
13
|
+
* failure with `{"error": "<message>"}` (`ApiError::into_response`); the nested
|
|
14
|
+
* `{"error": {"message": ...}}` form is what proxies in front of a node emit.
|
|
15
|
+
* Returns undefined for a non-JSON, empty, or envelope-less body.
|
|
16
|
+
*/
|
|
17
|
+
function extractErrorMessage(bodyText) {
|
|
18
|
+
if (!bodyText)
|
|
19
|
+
return undefined;
|
|
20
|
+
try {
|
|
21
|
+
const error = JSON.parse(bodyText)?.error;
|
|
22
|
+
if (typeof error === 'string' && error.trim() !== '')
|
|
23
|
+
return error;
|
|
24
|
+
const nested = error?.message;
|
|
25
|
+
if (typeof nested === 'string' && nested.trim() !== '')
|
|
26
|
+
return nested;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Not JSON — the status line is all we can honestly report.
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
11
33
|
// Custom error class for HTTP errors
|
|
12
34
|
export class HTTPError extends Error {
|
|
13
35
|
constructor(status, statusText, url, headers, bodyText) {
|
|
14
|
-
|
|
36
|
+
const explanation = extractErrorMessage(bodyText);
|
|
37
|
+
super(explanation
|
|
38
|
+
? `HTTP ${status} ${statusText}: ${explanation}`
|
|
39
|
+
: `HTTP ${status} ${statusText}`);
|
|
15
40
|
this.status = status;
|
|
16
41
|
this.statusText = statusText;
|
|
17
42
|
this.url = url;
|
|
@@ -424,4 +449,3 @@ export class WebHttpClient {
|
|
|
424
449
|
}
|
|
425
450
|
}
|
|
426
451
|
}
|
|
427
|
-
//# sourceMappingURL=web-client.js.map
|