@zmdb/client 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +57 -0
- package/dist/body/index.d.ts +7 -0
- package/dist/body/index.d.ts.map +1 -0
- package/dist/body/index.js +55 -0
- package/dist/body/index.js.map +1 -0
- package/dist/errors/index.d.ts +59 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +117 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/headers/index.d.ts +6 -0
- package/dist/headers/index.d.ts.map +1 -0
- package/dist/headers/index.js +52 -0
- package/dist/headers/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +585 -0
- package/dist/runtime.js.map +1 -0
- package/dist/testing/index.d.ts +13 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +53 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/transport/index.d.ts +4 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +47 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/types.d.ts +116 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/url/index.d.ts +17 -0
- package/dist/url/index.d.ts.map +1 -0
- package/dist/url/index.js +98 -0
- package/dist/url/index.js.map +1 -0
- package/package.json +68 -0
- package/src/body/index.ts +58 -0
- package/src/errors/index.ts +152 -0
- package/src/headers/index.ts +57 -0
- package/src/index.ts +42 -0
- package/src/runtime.ts +741 -0
- package/src/testing/index.ts +67 -0
- package/src/transport/index.ts +56 -0
- package/src/types.ts +128 -0
- package/src/url/index.ts +113 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @zmdb/client
|
|
2
|
+
|
|
3
|
+
`@zmdb/client` is the dependency-free HTTP execution runtime for generated zmdb clients and manually declared operations. It owns transport injection, deterministic URL assembly, bounded response
|
|
4
|
+
decoding, cancellation, authentication patches, and stable protocol errors without importing the web framework, reflection, OpenAPI, or Node built-ins.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
yarn add @zmdb/client@1.0.0-beta.1
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
> **Prerelease** (`1.0.0-beta.1`). Requires **Node.js 26+** and is **ESM-only**. The runtime uses web-platform APIs and works with either an injected transport or Fetch.
|
|
13
|
+
|
|
14
|
+
## Entry points
|
|
15
|
+
|
|
16
|
+
- `@zmdb/client` — generated-operation ABI, runtime, and the body/URL primitives used by generated modules.
|
|
17
|
+
- `@zmdb/client/body` — request-body preparation helpers and response limits.
|
|
18
|
+
- `@zmdb/client/errors` — stable client error classes.
|
|
19
|
+
- `@zmdb/client/headers` — header normalisation and conflict-safe merging.
|
|
20
|
+
- `@zmdb/client/transport` — structural transport types and the Fetch adapter.
|
|
21
|
+
- `@zmdb/client/url` — RFC 3986 component, path, query, and base-URL helpers.
|
|
22
|
+
- `@zmdb/client/testing` — deterministic held-request transport.
|
|
23
|
+
|
|
24
|
+
## Generated clients
|
|
25
|
+
|
|
26
|
+
`zmdb client generate` loads configured `@zmdb/web` contract exports once and writes both OpenAPI JSON and a typed TypeScript client. Commit both outputs and use `zmdb client generate --check` in CI
|
|
27
|
+
to reject stale output. OpenAPI is a sibling output, not the input to generation.
|
|
28
|
+
|
|
29
|
+
The generated module imports only `@zmdb/client`, so the same source can be bundled for a browser or run under Node:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { createApiClient } from './generated/http-client.generated.js';
|
|
33
|
+
|
|
34
|
+
const api = createApiClient({
|
|
35
|
+
baseUrl: 'https://api.example.com',
|
|
36
|
+
authentication: () => ({
|
|
37
|
+
requirement: 0,
|
|
38
|
+
headers: { authorization: 'Bearer token' },
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The repository's packed-consumer fixture installs only the packed `@zmdb/client` package and exercises the same generated client in browser and Node bundles against a real `@zmdb/web` service,
|
|
44
|
+
including alternate success status, response validation, and authentication injection.
|
|
45
|
+
|
|
46
|
+
## Manual operations
|
|
47
|
+
|
|
48
|
+
The package can also execute a hand-authored `GeneratedOperation` directly. That path is intentionally low level: the caller supplies the request plan and response reader, and `@zmdb/client` supplies
|
|
49
|
+
URL assembly, transport injection, authentication patches, limits, cancellation, and stable errors. It does not inspect controllers, infer types, or parse an OpenAPI document.
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
The complete generated and manual journey is at **https://ambasta.github.io/zmdb/docs/generated-client.html**.
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
GNU General Public License v3.0 or later (GPL-3.0-or-later).
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClientBody } from '../types.js';
|
|
2
|
+
export declare const DEFAULT_MAX_RESPONSE_BYTES: number;
|
|
3
|
+
export declare const DEFAULT_MAX_ERROR_BODY_BYTES: number;
|
|
4
|
+
export type ClientBodyKind = 'json' | 'text' | 'bytes' | 'stream' | 'empty';
|
|
5
|
+
export declare function prepareClientBody(kind: ClientBodyKind, value: unknown): ClientBody | undefined;
|
|
6
|
+
export declare function assertPositiveByteLimit(value: number, option: string): number;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/body/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,0BAA0B,QAAkB,CAAC;AAC1D,eAAO,MAAM,4BAA4B,QAAW,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAQ5E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAoC9F;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAK7E"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ClientRequestError } from '../errors/index.js';
|
|
2
|
+
export const DEFAULT_MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
|
|
3
|
+
export const DEFAULT_MAX_ERROR_BODY_BYTES = 8 * 1024;
|
|
4
|
+
const TEXT_BODY_KIND = 'text';
|
|
5
|
+
function isClientBytes(value) {
|
|
6
|
+
return value instanceof Uint8Array && value.buffer instanceof ArrayBuffer;
|
|
7
|
+
}
|
|
8
|
+
export function prepareClientBody(kind, value) {
|
|
9
|
+
if (kind === 'empty') {
|
|
10
|
+
if (value !== undefined)
|
|
11
|
+
throw new ClientRequestError('An empty request body must be undefined');
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (kind === TEXT_BODY_KIND) {
|
|
15
|
+
if (typeof value !== 'string')
|
|
16
|
+
throw new ClientRequestError('A text request body must be a string');
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
if (kind === 'bytes') {
|
|
20
|
+
if (!isClientBytes(value)) {
|
|
21
|
+
throw new ClientRequestError('A bytes request body must be a Uint8Array');
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
if (kind === 'stream') {
|
|
26
|
+
if (!(value instanceof ReadableStream)) {
|
|
27
|
+
throw new ClientRequestError('A stream request body must be a ReadableStream');
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const serialized = JSON.stringify(value, (_key, item) => {
|
|
33
|
+
if (typeof item === 'number' && !Number.isFinite(item)) {
|
|
34
|
+
throw new ClientRequestError('A JSON request body must not contain a non-finite number');
|
|
35
|
+
}
|
|
36
|
+
return item;
|
|
37
|
+
});
|
|
38
|
+
if (serialized === undefined) {
|
|
39
|
+
throw new ClientRequestError('A JSON request body must have a serialisable top-level value');
|
|
40
|
+
}
|
|
41
|
+
return serialized;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error instanceof ClientRequestError)
|
|
45
|
+
throw error;
|
|
46
|
+
throw new ClientRequestError('A JSON request body could not be serialised', { cause: error });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function assertPositiveByteLimit(value, option) {
|
|
50
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
51
|
+
throw new ClientRequestError(`${option} must be a positive safe integer`);
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/body/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,GAAG,IAAI,CAAC;AAIrD,MAAM,cAAc,GAAmB,MAAM,CAAC;AAE9C,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,YAAY,UAAU,IAAI,KAAK,CAAC,MAAM,YAAY,WAAW,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAoB,EAAE,KAAc;IACpE,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,IAAI,kBAAkB,CAAC,yCAAyC,CAAC,CAAC;QACjG,OAAO,SAAS,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AC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAAa,EAAE,MAAc;IACnE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,kBAAkB,CAAC,GAAG,MAAM,kCAAkC,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ClientHeaders, ValidationIssue } from '../types.js';
|
|
2
|
+
export interface ClientErrorInit {
|
|
3
|
+
readonly operationId?: string;
|
|
4
|
+
readonly cause?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare class ClientError extends Error {
|
|
7
|
+
readonly operationId: string | undefined;
|
|
8
|
+
constructor(message: string, init?: ClientErrorInit);
|
|
9
|
+
}
|
|
10
|
+
export declare class ClientRequestError extends ClientError {
|
|
11
|
+
constructor(message: string, init?: ClientErrorInit);
|
|
12
|
+
}
|
|
13
|
+
export declare class AuthenticationError extends ClientError {
|
|
14
|
+
constructor(operationId: string, cause?: unknown);
|
|
15
|
+
}
|
|
16
|
+
export declare class MissingAuthenticationError extends AuthenticationError {
|
|
17
|
+
constructor(operationId: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class TransportError extends ClientError {
|
|
20
|
+
constructor(operationId: string | undefined, cause: unknown);
|
|
21
|
+
}
|
|
22
|
+
export declare class ClientTimeoutError extends ClientError {
|
|
23
|
+
readonly timeoutMs: number;
|
|
24
|
+
constructor(operationId: string, timeoutMs: number);
|
|
25
|
+
}
|
|
26
|
+
export declare class ResponseTooLargeError extends ClientError {
|
|
27
|
+
readonly status: number;
|
|
28
|
+
readonly limit: number;
|
|
29
|
+
constructor(operationId: string, status: number, limit: number);
|
|
30
|
+
}
|
|
31
|
+
export declare class UnexpectedStatusError extends ClientError {
|
|
32
|
+
readonly status: number;
|
|
33
|
+
readonly headers: ClientHeaders;
|
|
34
|
+
readonly bodySnippet: string;
|
|
35
|
+
constructor(operationId: string, status: number, headers: ClientHeaders, bodySnippet: string);
|
|
36
|
+
}
|
|
37
|
+
export declare class UnexpectedContentTypeError extends ClientError {
|
|
38
|
+
readonly status: number;
|
|
39
|
+
readonly expected: readonly string[];
|
|
40
|
+
readonly received: string | undefined;
|
|
41
|
+
constructor(operationId: string, status: number, expected: readonly string[], received: string | undefined);
|
|
42
|
+
}
|
|
43
|
+
export declare class ResponseDecodeError extends ClientError {
|
|
44
|
+
readonly status: number;
|
|
45
|
+
readonly bodySnippet: string;
|
|
46
|
+
constructor(operationId: string, status: number, bodySnippet: string, cause?: unknown);
|
|
47
|
+
}
|
|
48
|
+
export declare class ResponseValidationError extends ClientError {
|
|
49
|
+
readonly status: number;
|
|
50
|
+
readonly issues: readonly ValidationIssue[];
|
|
51
|
+
constructor(operationId: string, status: number, issues: readonly ValidationIssue[]);
|
|
52
|
+
}
|
|
53
|
+
export declare class ClientResponseError<Status extends number, Body, Headers = ClientHeaders> extends ClientError {
|
|
54
|
+
readonly status: Status;
|
|
55
|
+
readonly body: Body;
|
|
56
|
+
readonly headers: Headers;
|
|
57
|
+
constructor(operationId: string, status: Status, body: Body, headers: Headers);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAMD,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC,YAAY,OAAO,EAAE,MAAM,EAAE,IAAI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G,SAAS,CAAC;IAEtC,YAAY,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAUzG;CACF;AAED,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,YAAY,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAMpF;CACF;AAED,qBAAa,uBAAwB,SAAQ,WAAW;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAE5C,YAAY,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,eAAe,EAAE,EASlF;CACF;AAED,qBAAa,mBAAmB,CAAC,MAAM,SAAS,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,aAAa,CAAE,SAAQ,WAAW;IACxG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,YAAY,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAM5E;CACF"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function operation(operationId) {
|
|
2
|
+
return operationId === undefined ? 'Client request' : `Operation ${operationId}`;
|
|
3
|
+
}
|
|
4
|
+
export class ClientError extends Error {
|
|
5
|
+
operationId;
|
|
6
|
+
constructor(message, init = {}) {
|
|
7
|
+
super(message, init.cause === undefined ? undefined : { cause: init.cause });
|
|
8
|
+
this.name = 'ClientError';
|
|
9
|
+
this.operationId = init.operationId;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class ClientRequestError extends ClientError {
|
|
13
|
+
constructor(message, init = {}) {
|
|
14
|
+
super(message, init);
|
|
15
|
+
this.name = 'ClientRequestError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class AuthenticationError extends ClientError {
|
|
19
|
+
constructor(operationId, cause) {
|
|
20
|
+
super(`Authentication failed for operation ${operationId}`, { operationId, cause });
|
|
21
|
+
this.name = 'AuthenticationError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class MissingAuthenticationError extends AuthenticationError {
|
|
25
|
+
constructor(operationId) {
|
|
26
|
+
super(operationId);
|
|
27
|
+
this.name = 'MissingAuthenticationError';
|
|
28
|
+
this.message = `Operation ${operationId} requires an authentication provider`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class TransportError extends ClientError {
|
|
32
|
+
constructor(operationId, cause) {
|
|
33
|
+
super(`${operation(operationId)} failed in the transport`, operationId === undefined ? { cause } : { operationId, cause });
|
|
34
|
+
this.name = 'TransportError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class ClientTimeoutError extends ClientError {
|
|
38
|
+
timeoutMs;
|
|
39
|
+
constructor(operationId, timeoutMs) {
|
|
40
|
+
super(`Operation ${operationId} timed out after ${String(timeoutMs)}ms`, { operationId });
|
|
41
|
+
this.name = 'ClientTimeoutError';
|
|
42
|
+
this.timeoutMs = timeoutMs;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class ResponseTooLargeError extends ClientError {
|
|
46
|
+
status;
|
|
47
|
+
limit;
|
|
48
|
+
constructor(operationId, status, limit) {
|
|
49
|
+
super(`Operation ${operationId} response status ${String(status)} exceeds the ${String(limit)} byte limit`, {
|
|
50
|
+
operationId,
|
|
51
|
+
});
|
|
52
|
+
this.name = 'ResponseTooLargeError';
|
|
53
|
+
this.status = status;
|
|
54
|
+
this.limit = limit;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export class UnexpectedStatusError extends ClientError {
|
|
58
|
+
status;
|
|
59
|
+
headers;
|
|
60
|
+
bodySnippet;
|
|
61
|
+
constructor(operationId, status, headers, bodySnippet) {
|
|
62
|
+
const detail = bodySnippet.length === 0 ? '' : `: ${bodySnippet}`;
|
|
63
|
+
super(`Operation ${operationId} returned undocumented status ${String(status)}${detail}`, { operationId });
|
|
64
|
+
this.name = 'UnexpectedStatusError';
|
|
65
|
+
this.status = status;
|
|
66
|
+
this.headers = Object.freeze({ ...headers });
|
|
67
|
+
this.bodySnippet = bodySnippet;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export class UnexpectedContentTypeError extends ClientError {
|
|
71
|
+
status;
|
|
72
|
+
expected;
|
|
73
|
+
received;
|
|
74
|
+
constructor(operationId, status, expected, received) {
|
|
75
|
+
super(`Operation ${operationId} status ${String(status)} expected content type ${expected.join(' or ')}, ` +
|
|
76
|
+
`received ${received ?? 'none'}`, { operationId });
|
|
77
|
+
this.name = 'UnexpectedContentTypeError';
|
|
78
|
+
this.status = status;
|
|
79
|
+
this.expected = Object.freeze([...expected]);
|
|
80
|
+
this.received = received;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export class ResponseDecodeError extends ClientError {
|
|
84
|
+
status;
|
|
85
|
+
bodySnippet;
|
|
86
|
+
constructor(operationId, status, bodySnippet, cause) {
|
|
87
|
+
const detail = bodySnippet.length === 0 ? '' : `: ${bodySnippet}`;
|
|
88
|
+
super(`Operation ${operationId} could not decode status ${String(status)}${detail}`, { operationId, cause });
|
|
89
|
+
this.name = 'ResponseDecodeError';
|
|
90
|
+
this.status = status;
|
|
91
|
+
this.bodySnippet = bodySnippet;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export class ResponseValidationError extends ClientError {
|
|
95
|
+
status;
|
|
96
|
+
issues;
|
|
97
|
+
constructor(operationId, status, issues) {
|
|
98
|
+
super(`Operation ${operationId} status ${String(status)} failed response validation with ` +
|
|
99
|
+
`${String(issues.length)} issue(s)`, { operationId });
|
|
100
|
+
this.name = 'ResponseValidationError';
|
|
101
|
+
this.status = status;
|
|
102
|
+
this.issues = Object.freeze(issues.map(issue => Object.freeze({ ...issue })));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export class ClientResponseError extends ClientError {
|
|
106
|
+
status;
|
|
107
|
+
body;
|
|
108
|
+
headers;
|
|
109
|
+
constructor(operationId, status, body, headers) {
|
|
110
|
+
super(`Operation ${operationId} returned documented error status ${String(status)}`, { operationId });
|
|
111
|
+
this.name = 'ClientResponseError';
|
|
112
|
+
this.status = status;
|
|
113
|
+
this.body = body;
|
|
114
|
+
this.headers = headers;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAOA,SAAS,SAAS,CAAC,WAA+B;IAChD,OAAO,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,aAAa,WAAW,EAAE,CAAC;AACnF,CAAC;AAED,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,WAAW,CAAqB;IAEzC,YAAY,OAAe,EAAE,IAAI,GAAoB,EAAE;QACrD,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7E,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IACjD,YAAY,OAAe,EAAE,IAAI,GAAoB,EAAE;QACr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MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;CACF;AAED,MAAM,OAAO,mBAA0E,SAAQ,WAAW;IAC/F,MAAM,CAAS;IACf,IAAI,CAAO;IACX,OAAO,CAAU;IAE1B,YAAY,WAAmB,EAAE,MAAc,EAAE,IAAU,EAAE,OAAgB;QAC3E,KAAK,CAAC,aAAa,WAAW,qCAAqC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QACtG,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ClientHeaders } from '../types.js';
|
|
2
|
+
export declare const TRANSPORT_OWNED_HEADERS: ReadonlySet<string>;
|
|
3
|
+
export declare function normalizeClientHeaders(headers?: ClientHeaders): ClientHeaders;
|
|
4
|
+
export declare function mergeClientHeaders(...sources: readonly ClientHeaders[]): ClientHeaders;
|
|
5
|
+
export declare function assertNoTransportOwnedHeaders(headers: ClientHeaders): void;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/headers/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAStD,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,aAAkB,GAAG,aAAa,CAiBjF;AAED,wBAAgB,kBAAkB,CAAC,GAAG,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,aAAa,CAYtF;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAM1E"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ClientRequestError } from '../errors/index.js';
|
|
2
|
+
const HEADER_NAME = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
3
|
+
const INVALID_VALUE = /[\0\r\n]/;
|
|
4
|
+
export const TRANSPORT_OWNED_HEADERS = new Set([
|
|
5
|
+
'connection',
|
|
6
|
+
'content-length',
|
|
7
|
+
'host',
|
|
8
|
+
'proxy-connection',
|
|
9
|
+
'te',
|
|
10
|
+
'trailer',
|
|
11
|
+
'transfer-encoding',
|
|
12
|
+
'upgrade',
|
|
13
|
+
]);
|
|
14
|
+
export function normalizeClientHeaders(headers = {}) {
|
|
15
|
+
const normalized = {};
|
|
16
|
+
for (const [sourceName, value] of Object.entries(headers)) {
|
|
17
|
+
if (!HEADER_NAME.test(sourceName)) {
|
|
18
|
+
throw new ClientRequestError(`Invalid HTTP header name ${JSON.stringify(sourceName)}`);
|
|
19
|
+
}
|
|
20
|
+
if (typeof value !== 'string' || INVALID_VALUE.test(value)) {
|
|
21
|
+
throw new ClientRequestError(`Invalid value for HTTP header ${sourceName.toLowerCase()}`);
|
|
22
|
+
}
|
|
23
|
+
const name = sourceName.toLowerCase();
|
|
24
|
+
const present = normalized[name];
|
|
25
|
+
if (present !== undefined && present !== value) {
|
|
26
|
+
throw new ClientRequestError(`Conflicting values for HTTP header ${name}`);
|
|
27
|
+
}
|
|
28
|
+
normalized[name] = value;
|
|
29
|
+
}
|
|
30
|
+
return Object.freeze(normalized);
|
|
31
|
+
}
|
|
32
|
+
export function mergeClientHeaders(...sources) {
|
|
33
|
+
const merged = {};
|
|
34
|
+
for (const source of sources) {
|
|
35
|
+
for (const [name, value] of Object.entries(normalizeClientHeaders(source))) {
|
|
36
|
+
const present = merged[name];
|
|
37
|
+
if (present !== undefined && present !== value) {
|
|
38
|
+
throw new ClientRequestError(`Conflicting values for HTTP header ${name}`);
|
|
39
|
+
}
|
|
40
|
+
merged[name] = value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return Object.freeze(merged);
|
|
44
|
+
}
|
|
45
|
+
export function assertNoTransportOwnedHeaders(headers) {
|
|
46
|
+
for (const name of Object.keys(headers)) {
|
|
47
|
+
if (TRANSPORT_OWNED_HEADERS.has(name.toLowerCase())) {
|
|
48
|
+
throw new ClientRequestError(`HTTP header ${name.toLowerCase()} is owned by the transport`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/headers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,WAAW,GAAG,gCAAgC,CAAC;AACrD,MAAM,aAAa,GAAG,UAAU,CAAC;AAEjC,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC;IAClE,YAAY;IACZ,gBAAgB;IAChB,MAAM;IACN,kBAAkB;IAClB,IAAI;IACJ,SAAS;IACT,mBAAmB;IACnB,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,UAAU,sBAAsB,CAAC,OAAO,GAAkB,EAAE;IAChE,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,KAAK,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,kBAAkB,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACzF,CAAC;QACD,IAAI,OAAO,KAAK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AAO,CAAC,EAAE,CAAC;QACxC,IAAI,uBAAuB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YACpD,MAAM,IAAI,kBAAkB,CAAC,eAAe,IAAI,CAAC,WAAW,EAAE,4BAA4B,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { DEFAULT_MAX_ERROR_BODY_BYTES, DEFAULT_MAX_RESPONSE_BYTES, prepareClientBody } from './body/index.js';
|
|
2
|
+
export { AuthenticationError, ClientError, ClientRequestError, ClientResponseError, ClientTimeoutError, MissingAuthenticationError, ResponseDecodeError, ResponseTooLargeError, ResponseValidationError, TransportError, UnexpectedContentTypeError, UnexpectedStatusError, } from './errors/index.js';
|
|
3
|
+
export { CLIENT_RUNTIME_ABI, createClientRuntime } from './runtime.js';
|
|
4
|
+
export { createFetchTransport } from './transport/index.js';
|
|
5
|
+
export { stringifyClientScalar, substituteClientPath } from './url/index.js';
|
|
6
|
+
export type { AuthenticationContext, AuthenticationPatch, AuthenticationProvider, CallOptions, ClientBody, ClientBytes, ClientHeaders, ClientOperationResponse, ClientOptions, ClientQueryPair, ClientRequest, ClientResponse, ClientResponseBody, ClientRuntime, ClientSecurityRequirement, ClientSecurityScheme, ClientTransport, ClientVersionPlan, DecodeResult, GeneratedOperation, PreparedClientRequest, ValidationIssue, } from './types.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DEFAULT_MAX_ERROR_BODY_BYTES, DEFAULT_MAX_RESPONSE_BYTES, prepareClientBody } from './body/index.js';
|
|
2
|
+
export { AuthenticationError, ClientError, ClientRequestError, ClientResponseError, ClientTimeoutError, MissingAuthenticationError, ResponseDecodeError, ResponseTooLargeError, ResponseValidationError, TransportError, UnexpectedContentTypeError, UnexpectedStatusError, } from './errors/index.js';
|
|
3
|
+
export { CLIENT_RUNTIME_ABI, createClientRuntime } from './runtime.js';
|
|
4
|
+
export { createFetchTransport } from './transport/index.js';
|
|
5
|
+
export { stringifyClientScalar, substituteClientPath } from './url/index.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAOV,aAAa,EAKb,aAAa,EAMd,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,kBAAkB,IAAI,CAAC;AA6rBpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAEzE"}
|