@appaloft/sdk 0.12.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/dist/generated-operations.d.ts +3057 -0
- package/dist/generated-operations.js +3253 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +3520 -0
- package/package.json +36 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export declare const apiVersion = "v1";
|
|
2
|
+
export { generatedSdkOperations } from "./generated-operations";
|
|
3
|
+
export type DomainErrorDetailValue = string | number | boolean | null | readonly string[];
|
|
4
|
+
export interface DomainErrorResponse {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly category: "user" | "infra" | "provider" | "retryable" | "timeout";
|
|
7
|
+
readonly message: string;
|
|
8
|
+
readonly retryable: boolean;
|
|
9
|
+
readonly details?: Readonly<Record<string, DomainErrorDetailValue>>;
|
|
10
|
+
}
|
|
11
|
+
export type SdkOperationKind = "command" | "query";
|
|
12
|
+
export type SdkAuthPolicy = "bootstrap-public" | "product-session" | "webhook-signature";
|
|
13
|
+
export interface SdkOperationRoute {
|
|
14
|
+
readonly method: string;
|
|
15
|
+
readonly path: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SdkOperationDescriptor {
|
|
18
|
+
readonly operationKey: string;
|
|
19
|
+
readonly operationGroup: string;
|
|
20
|
+
readonly operationMethod: string;
|
|
21
|
+
readonly operationId: string;
|
|
22
|
+
readonly kind: SdkOperationKind;
|
|
23
|
+
readonly domain: string;
|
|
24
|
+
readonly messageName: string;
|
|
25
|
+
readonly route: SdkOperationRoute;
|
|
26
|
+
readonly docsHref?: string;
|
|
27
|
+
readonly authPolicy: SdkAuthPolicy;
|
|
28
|
+
readonly errorFamily: string;
|
|
29
|
+
readonly streaming: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type AppaloftSdkAuth = {
|
|
32
|
+
readonly kind: "none";
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: "product-session";
|
|
35
|
+
readonly cookie: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: "deploy-token";
|
|
38
|
+
readonly token: string;
|
|
39
|
+
};
|
|
40
|
+
export type AppaloftSdkFetch = (request: Request) => Promise<Response>;
|
|
41
|
+
export interface AppaloftSdkClientOptions {
|
|
42
|
+
readonly baseUrl: string;
|
|
43
|
+
readonly auth?: AppaloftSdkAuth | (() => AppaloftSdkAuth | undefined);
|
|
44
|
+
readonly fetch?: AppaloftSdkFetch;
|
|
45
|
+
readonly headers?: HeadersInit | (() => HeadersInit);
|
|
46
|
+
}
|
|
47
|
+
export interface AppaloftSdkOperationRequest {
|
|
48
|
+
readonly operation: SdkOperationDescriptor;
|
|
49
|
+
readonly pathParams?: Readonly<Record<string, string>>;
|
|
50
|
+
readonly query?: Readonly<Record<string, string | number | boolean | null | undefined>>;
|
|
51
|
+
readonly body?: unknown;
|
|
52
|
+
readonly signal?: AbortSignal;
|
|
53
|
+
}
|
|
54
|
+
export interface AppaloftSdkStreamRequest<TEnvelope = unknown> extends AppaloftSdkOperationRequest {
|
|
55
|
+
readonly parseEnvelope?: (value: unknown) => TEnvelope;
|
|
56
|
+
}
|
|
57
|
+
export type AppaloftSdkOperationResult<T> = {
|
|
58
|
+
readonly ok: true;
|
|
59
|
+
readonly status: number;
|
|
60
|
+
readonly data: T;
|
|
61
|
+
} | {
|
|
62
|
+
readonly ok: false;
|
|
63
|
+
readonly status: number;
|
|
64
|
+
readonly error: DomainErrorResponse;
|
|
65
|
+
};
|
|
66
|
+
export interface AppaloftSdkClient {
|
|
67
|
+
readonly apiVersion: typeof apiVersion;
|
|
68
|
+
readonly request: <T = unknown>(input: AppaloftSdkOperationRequest) => Promise<AppaloftSdkOperationResult<T>>;
|
|
69
|
+
readonly stream: <TEnvelope = unknown>(input: AppaloftSdkStreamRequest<TEnvelope>) => AsyncIterable<TEnvelope>;
|
|
70
|
+
}
|
|
71
|
+
export declare class AppaloftSdkStreamError extends Error {
|
|
72
|
+
readonly status: number;
|
|
73
|
+
readonly error: DomainErrorResponse;
|
|
74
|
+
constructor(message: string, status: number, error: DomainErrorResponse);
|
|
75
|
+
}
|
|
76
|
+
export declare function createAppaloftSdkClient(options: AppaloftSdkClientOptions): AppaloftSdkClient;
|
|
77
|
+
export declare function isAppaloftSdkErrorCode<TCode extends string>(error: DomainErrorResponse, code: TCode): error is DomainErrorResponse & {
|
|
78
|
+
readonly code: TCode;
|
|
79
|
+
};
|