@camunda8/sdk 8.9.0-alpha.14 → 8.9.0-alpha.16
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/CHANGELOG.md +14 -0
- package/MAINTAINER.md +8 -9
- package/README.md +27 -2
- package/dist/admin/lib/AdminApiClient.js +2 -3
- package/dist/admin/lib/AdminApiClient.js.map +1 -1
- package/dist/c8/lib/CamundaRestClient.d.ts +22 -4
- package/dist/c8/lib/CamundaRestClient.js +125 -33
- package/dist/c8/lib/CamundaRestClient.js.map +1 -1
- package/dist/c8/lib/TrackedGot.d.ts +3 -3
- package/dist/c8/lib/TrackedGot.js +3 -3
- package/dist/c8/lib/TrackedGot.js.map +1 -1
- package/dist/lib/Configuration.d.ts +1 -1
- package/dist/lib/Configuration.js.map +1 -1
- package/dist/lib/GotErrors.d.ts +5 -5
- package/dist/lib/GotErrors.js +3 -37
- package/dist/lib/GotErrors.js.map +1 -1
- package/dist/lib/GotHooks.d.ts +5 -26
- package/dist/lib/GotHooks.js +8 -46
- package/dist/lib/GotHooks.js.map +1 -1
- package/dist/lib/HttpClient.d.ts +194 -0
- package/dist/lib/HttpClient.js +749 -0
- package/dist/lib/HttpClient.js.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +9 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/modeler/lib/ModelerAPIClient.js +2 -3
- package/dist/modeler/lib/ModelerAPIClient.js.map +1 -1
- package/dist/oauth/lib/CookieAuthProvider.d.ts +2 -2
- package/dist/oauth/lib/CookieAuthProvider.js +2 -6
- package/dist/oauth/lib/CookieAuthProvider.js.map +1 -1
- package/dist/oauth/lib/OAuthProvider.js +2 -3
- package/dist/oauth/lib/OAuthProvider.js.map +1 -1
- package/dist/operate/lib/OperateApiClient.js +2 -6
- package/dist/operate/lib/OperateApiClient.js.map +1 -1
- package/dist/optimize/lib/OptimizeApiClient.d.ts +2 -2
- package/dist/optimize/lib/OptimizeApiClient.js +2 -6
- package/dist/optimize/lib/OptimizeApiClient.js.map +1 -1
- package/dist/optimize/lib/ReportResults.d.ts +2 -2
- package/dist/tasklist/lib/TasklistApiClient.js +2 -6
- package/dist/tasklist/lib/TasklistApiClient.js.map +1 -1
- package/dist/test-support/socketTap.d.ts +23 -0
- package/dist/test-support/socketTap.js +183 -0
- package/dist/test-support/socketTap.js.map +1 -0
- package/dist/zeebe/lib/ZBStreamWorker.d.ts +39 -1
- package/dist/zeebe/lib/ZBStreamWorker.js +213 -36
- package/dist/zeebe/lib/ZBStreamWorker.js.map +1 -1
- package/dist/zeebe/lib/cancelProcesses.js +8 -0
- package/dist/zeebe/lib/cancelProcesses.js.map +1 -1
- package/dist/zeebe/zb/ZeebeGrpcClient.d.ts +12 -3
- package/dist/zeebe/zb/ZeebeGrpcClient.js +10 -2
- package/dist/zeebe/zb/ZeebeGrpcClient.js.map +1 -1
- package/package.json +13 -7
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Dispatcher, FormData } from 'undici';
|
|
2
|
+
export type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options' | 'trace';
|
|
3
|
+
export type Headers = Record<string, string | string[] | undefined>;
|
|
4
|
+
export type SearchParams = string | URLSearchParams | Record<string, string | number | boolean | null | undefined>;
|
|
5
|
+
export type RequestBody = string | Buffer | Uint8Array | URLSearchParams | FormData;
|
|
6
|
+
export interface HttpsOptions {
|
|
7
|
+
certificateAuthority?: string | Buffer | (string | Buffer)[];
|
|
8
|
+
key?: string | Buffer;
|
|
9
|
+
/** Client certificate (PEM). */
|
|
10
|
+
certificate?: string | Buffer;
|
|
11
|
+
/** Alias of `certificate`. */
|
|
12
|
+
cert?: string | Buffer;
|
|
13
|
+
passphrase?: string;
|
|
14
|
+
rejectUnauthorized?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The error shape a retry decision is based on. Deliberately structural (not
|
|
18
|
+
* the {@link RequestError} class) so that `calculateDelay` functions written
|
|
19
|
+
* against got 11's `RetryObject` type keep type-checking.
|
|
20
|
+
*/
|
|
21
|
+
export interface RetryError extends Error {
|
|
22
|
+
code: string;
|
|
23
|
+
options: {
|
|
24
|
+
method: string;
|
|
25
|
+
};
|
|
26
|
+
response?: {
|
|
27
|
+
statusCode: number;
|
|
28
|
+
headers: Record<string, string | string[] | undefined>;
|
|
29
|
+
body?: unknown;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface RetryObject {
|
|
33
|
+
attemptCount: number;
|
|
34
|
+
retryOptions: RequiredRetryOptions;
|
|
35
|
+
error: RetryError;
|
|
36
|
+
computedValue: number;
|
|
37
|
+
/** Parsed `Retry-After` delay in milliseconds, when the response supplied one. */
|
|
38
|
+
retryAfter?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface RequiredRetryOptions {
|
|
41
|
+
limit: number;
|
|
42
|
+
methods: Method[];
|
|
43
|
+
statusCodes: number[];
|
|
44
|
+
errorCodes: string[];
|
|
45
|
+
maxRetryAfter?: number;
|
|
46
|
+
calculateDelay(retryObject: RetryObject): number | Promise<number>;
|
|
47
|
+
}
|
|
48
|
+
export type RetryOptions = Partial<RequiredRetryOptions> | number;
|
|
49
|
+
/**
|
|
50
|
+
* A response a `beforeRequest` hook may return to short-circuit the network
|
|
51
|
+
* call (got 11 contract), e.g. to serve a cached or stubbed response.
|
|
52
|
+
*/
|
|
53
|
+
export interface ResponseLike {
|
|
54
|
+
statusCode: number;
|
|
55
|
+
statusMessage?: string;
|
|
56
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
57
|
+
body?: string | Buffer;
|
|
58
|
+
}
|
|
59
|
+
export type BeforeRequestHook = (options: NormalizedOptions) => void | ResponseLike | Promise<void | ResponseLike>;
|
|
60
|
+
export type BeforeRetryHook = (options: NormalizedOptions, error?: RequestError, retryCount?: number) => void | Promise<void>;
|
|
61
|
+
export type BeforeErrorHook = (error: RequestError) => RequestError | Promise<RequestError>;
|
|
62
|
+
export type AfterResponseHook = (response: Response) => Response | Promise<Response>;
|
|
63
|
+
export interface Hooks {
|
|
64
|
+
beforeRequest?: BeforeRequestHook[];
|
|
65
|
+
beforeRetry?: BeforeRetryHook[];
|
|
66
|
+
beforeError?: BeforeErrorHook[];
|
|
67
|
+
afterResponse?: AfterResponseHook[];
|
|
68
|
+
}
|
|
69
|
+
/** Runs once per call (not per retry), before any hooks. */
|
|
70
|
+
export type HandlerFunction = (options: NormalizedOptions) => void;
|
|
71
|
+
export interface Options {
|
|
72
|
+
method?: Method;
|
|
73
|
+
prefixUrl?: string;
|
|
74
|
+
headers?: Headers;
|
|
75
|
+
json?: unknown;
|
|
76
|
+
body?: RequestBody;
|
|
77
|
+
/** application/x-www-form-urlencoded body */
|
|
78
|
+
form?: Record<string, string | number | boolean | undefined>;
|
|
79
|
+
searchParams?: SearchParams;
|
|
80
|
+
parseJson?: (text: string) => unknown;
|
|
81
|
+
retry?: RetryOptions;
|
|
82
|
+
timeout?: number | {
|
|
83
|
+
request?: number;
|
|
84
|
+
};
|
|
85
|
+
throwHttpErrors?: boolean;
|
|
86
|
+
username?: string;
|
|
87
|
+
password?: string;
|
|
88
|
+
context?: Record<string, unknown>;
|
|
89
|
+
https?: HttpsOptions;
|
|
90
|
+
hooks?: Hooks;
|
|
91
|
+
handlers?: HandlerFunction[];
|
|
92
|
+
}
|
|
93
|
+
export interface NormalizedOptions {
|
|
94
|
+
method: string;
|
|
95
|
+
url: URL;
|
|
96
|
+
prefixUrl: string;
|
|
97
|
+
headers: Record<string, string>;
|
|
98
|
+
body?: RequestBody;
|
|
99
|
+
json?: unknown;
|
|
100
|
+
parseJson: (text: string) => unknown;
|
|
101
|
+
retry: RequiredRetryOptions;
|
|
102
|
+
timeout: {
|
|
103
|
+
request?: number;
|
|
104
|
+
};
|
|
105
|
+
throwHttpErrors: boolean;
|
|
106
|
+
context: Record<string, any>;
|
|
107
|
+
https: HttpsOptions;
|
|
108
|
+
hooks: Required<Hooks>;
|
|
109
|
+
}
|
|
110
|
+
export interface Response<T = string> {
|
|
111
|
+
statusCode: number;
|
|
112
|
+
statusMessage: string;
|
|
113
|
+
headers: Record<string, string | string[]>;
|
|
114
|
+
body: T;
|
|
115
|
+
rawBody: Buffer;
|
|
116
|
+
url: string;
|
|
117
|
+
ok: boolean;
|
|
118
|
+
retryCount: number;
|
|
119
|
+
request: {
|
|
120
|
+
options: NormalizedOptions;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export interface ResponsePromise<T = Response<string>> extends Promise<T> {
|
|
124
|
+
json<J = unknown>(): Promise<J>;
|
|
125
|
+
text(): Promise<string>;
|
|
126
|
+
buffer(): Promise<Buffer>;
|
|
127
|
+
cancel(reason?: string): void;
|
|
128
|
+
readonly isCanceled: boolean;
|
|
129
|
+
}
|
|
130
|
+
type VerbFn = (url: string | URL, options?: Options) => ResponsePromise;
|
|
131
|
+
export interface HttpClient {
|
|
132
|
+
(url: string | URL, options?: Options): ResponsePromise;
|
|
133
|
+
get: VerbFn;
|
|
134
|
+
post: VerbFn;
|
|
135
|
+
put: VerbFn;
|
|
136
|
+
patch: VerbFn;
|
|
137
|
+
delete: VerbFn;
|
|
138
|
+
head: VerbFn;
|
|
139
|
+
extend(options: Options): HttpClient;
|
|
140
|
+
readonly defaults: Options;
|
|
141
|
+
}
|
|
142
|
+
export declare class RequestError extends Error {
|
|
143
|
+
code: string;
|
|
144
|
+
options: NormalizedOptions;
|
|
145
|
+
request?: {
|
|
146
|
+
options: NormalizedOptions;
|
|
147
|
+
};
|
|
148
|
+
response?: Response<string>;
|
|
149
|
+
/** Always undefined; kept for got 11 shape compatibility. */
|
|
150
|
+
timings?: object;
|
|
151
|
+
cause?: unknown;
|
|
152
|
+
constructor(message: string, { code, options, response, cause, }: {
|
|
153
|
+
code?: string;
|
|
154
|
+
options: NormalizedOptions;
|
|
155
|
+
response?: Response<string>;
|
|
156
|
+
cause?: unknown;
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export declare class HTTPError extends RequestError {
|
|
160
|
+
response: Response<string>;
|
|
161
|
+
constructor(response: Response<string>, options?: NormalizedOptions);
|
|
162
|
+
}
|
|
163
|
+
export declare class TimeoutError extends RequestError {
|
|
164
|
+
event: string;
|
|
165
|
+
constructor(ms: number, options: NormalizedOptions);
|
|
166
|
+
}
|
|
167
|
+
export declare class CancelError extends RequestError {
|
|
168
|
+
constructor(reason: string | undefined, options: NormalizedOptions);
|
|
169
|
+
get isCanceled(): boolean;
|
|
170
|
+
}
|
|
171
|
+
export declare class ParseError extends RequestError {
|
|
172
|
+
constructor(cause: Error, response: Response<string>);
|
|
173
|
+
}
|
|
174
|
+
/** Network error codes that are retried (got 11 defaults plus undici/Node 24 codes). */
|
|
175
|
+
export declare const DEFAULT_RETRY_ERROR_CODES: string[];
|
|
176
|
+
/**
|
|
177
|
+
* Parse a `Retry-After` header (delta-seconds or an HTTP-date) into milliseconds.
|
|
178
|
+
* Returns `undefined` when the error carries no response, the status is not one
|
|
179
|
+
* that uses `Retry-After`, or the header is absent.
|
|
180
|
+
*/
|
|
181
|
+
export declare const parseRetryAfter: (error: RetryError) => number | undefined;
|
|
182
|
+
/** got 11-compatible default backoff: 2^(n-1) * 1000ms + up to 100ms jitter, honouring Retry-After. */
|
|
183
|
+
export declare const defaultCalculateDelay: ({ attemptCount, retryOptions, error, retryAfter, }: RetryObject) => number;
|
|
184
|
+
/** Merge two option objects with got.extend()-like semantics. */
|
|
185
|
+
export declare function mergeOptions(base: Options, override?: Options): Options;
|
|
186
|
+
/**
|
|
187
|
+
* Returns the dispatcher for a request: the TLS-configured Agent (or the global
|
|
188
|
+
* package-owned default Agent) composed with redirect following, as got 11 followed redirects.
|
|
189
|
+
*/
|
|
190
|
+
export declare function getDispatcher(https: HttpsOptions): Dispatcher;
|
|
191
|
+
export declare function createHttpClient(defaults?: Options): HttpClient;
|
|
192
|
+
/** Default client, analogous to `import got from 'got'`. */
|
|
193
|
+
export declare const http: HttpClient;
|
|
194
|
+
export { FormData };
|