@arke-institute/sdk 2.3.14 → 2.6.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/dist/{crypto-Fh8b6rTi.d.ts → crypto-96bEBoO_.d.ts} +89 -1
- package/dist/{crypto-k-x66Nei.d.cts → crypto-wBQ1LBgz.d.cts} +89 -1
- package/dist/generated/index.d.cts +668 -90
- package/dist/generated/index.d.ts +668 -90
- package/dist/index.cjs +184 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +184 -1
- package/dist/index.js.map +1 -1
- package/dist/operations/index.d.cts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/openapi/spec.json +1021 -180
- package/openapi/version.json +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,49 @@
|
|
|
1
1
|
import { Client } from 'openapi-fetch';
|
|
2
|
-
import { paths } from './generated/index.js';
|
|
2
|
+
import { paths, components } from './generated/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Retry logic for transient network and server errors
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for retry behavior
|
|
9
|
+
*/
|
|
10
|
+
interface RetryConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Maximum number of retry attempts
|
|
13
|
+
* @default 3
|
|
14
|
+
*/
|
|
15
|
+
maxRetries?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Initial delay in milliseconds before first retry
|
|
18
|
+
* @default 100
|
|
19
|
+
*/
|
|
20
|
+
initialDelay?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum delay in milliseconds (caps exponential backoff)
|
|
23
|
+
* @default 5000
|
|
24
|
+
*/
|
|
25
|
+
maxDelay?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to retry on 5xx server errors
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
retryOn5xx?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to retry on network errors (connection refused, DNS, timeouts)
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
retryOnNetworkError?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional callback invoked before each retry attempt
|
|
38
|
+
* Useful for logging or monitoring
|
|
39
|
+
*/
|
|
40
|
+
onRetry?: (attempt: number, error: Error, delayMs: number) => void;
|
|
41
|
+
}
|
|
3
42
|
|
|
4
43
|
/**
|
|
5
44
|
* SDK configuration types
|
|
6
45
|
*/
|
|
46
|
+
|
|
7
47
|
interface ArkeClientConfig {
|
|
8
48
|
/**
|
|
9
49
|
* Base URL for the Arke API
|
|
@@ -34,6 +74,29 @@ interface ArkeClientConfig {
|
|
|
34
74
|
* Custom headers to include in all requests
|
|
35
75
|
*/
|
|
36
76
|
headers?: Record<string, string>;
|
|
77
|
+
/**
|
|
78
|
+
* Retry configuration for transient errors
|
|
79
|
+
*
|
|
80
|
+
* Set to `false` to disable retries entirely.
|
|
81
|
+
* If not specified, uses default retry behavior (3 retries with exponential backoff).
|
|
82
|
+
*
|
|
83
|
+
* CAS conflicts (409) are never retried - they are returned immediately.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const arke = new ArkeClient({
|
|
88
|
+
* authToken: 'ak_...',
|
|
89
|
+
* retry: {
|
|
90
|
+
* maxRetries: 5,
|
|
91
|
+
* initialDelay: 200,
|
|
92
|
+
* onRetry: (attempt, error, delay) => {
|
|
93
|
+
* console.log(`Retry ${attempt} after ${delay}ms`);
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
retry?: RetryConfig | false;
|
|
37
100
|
}
|
|
38
101
|
declare const DEFAULT_CONFIG: Required<Pick<ArkeClientConfig, 'baseUrl' | 'network'>>;
|
|
39
102
|
|
|
@@ -167,6 +230,31 @@ declare class ArkeClient {
|
|
|
167
230
|
data: ReadableStream<Uint8Array> | null | undefined;
|
|
168
231
|
error: unknown;
|
|
169
232
|
}>;
|
|
233
|
+
/**
|
|
234
|
+
* Upload file content
|
|
235
|
+
*
|
|
236
|
+
* This is a convenience method that handles the binary body serialization
|
|
237
|
+
* that openapi-fetch doesn't handle automatically for non-JSON bodies.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* // Upload from a Blob
|
|
242
|
+
* const blob = new Blob(['Hello, world!'], { type: 'text/plain' });
|
|
243
|
+
* const { data, error } = await arke.uploadFileContent('01ABC...', blob, 'text/plain');
|
|
244
|
+
*
|
|
245
|
+
* // Upload from an ArrayBuffer
|
|
246
|
+
* const buffer = new TextEncoder().encode('Hello, world!').buffer;
|
|
247
|
+
* const { data, error } = await arke.uploadFileContent('01ABC...', buffer, 'text/plain');
|
|
248
|
+
*
|
|
249
|
+
* // Upload from a Uint8Array
|
|
250
|
+
* const bytes = new TextEncoder().encode('Hello, world!');
|
|
251
|
+
* const { data, error } = await arke.uploadFileContent('01ABC...', bytes, 'text/plain');
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
uploadFileContent(fileId: string, content: Blob | ArrayBuffer | Uint8Array, contentType: string): Promise<{
|
|
255
|
+
data: components['schemas']['UploadContentResponse'] | undefined;
|
|
256
|
+
error: unknown;
|
|
257
|
+
}>;
|
|
170
258
|
}
|
|
171
259
|
/**
|
|
172
260
|
* Create a new ArkeClient instance
|
|
@@ -1,9 +1,49 @@
|
|
|
1
1
|
import { Client } from 'openapi-fetch';
|
|
2
|
-
import { paths } from './generated/index.cjs';
|
|
2
|
+
import { paths, components } from './generated/index.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Retry logic for transient network and server errors
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for retry behavior
|
|
9
|
+
*/
|
|
10
|
+
interface RetryConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Maximum number of retry attempts
|
|
13
|
+
* @default 3
|
|
14
|
+
*/
|
|
15
|
+
maxRetries?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Initial delay in milliseconds before first retry
|
|
18
|
+
* @default 100
|
|
19
|
+
*/
|
|
20
|
+
initialDelay?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum delay in milliseconds (caps exponential backoff)
|
|
23
|
+
* @default 5000
|
|
24
|
+
*/
|
|
25
|
+
maxDelay?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to retry on 5xx server errors
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
retryOn5xx?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to retry on network errors (connection refused, DNS, timeouts)
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
retryOnNetworkError?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional callback invoked before each retry attempt
|
|
38
|
+
* Useful for logging or monitoring
|
|
39
|
+
*/
|
|
40
|
+
onRetry?: (attempt: number, error: Error, delayMs: number) => void;
|
|
41
|
+
}
|
|
3
42
|
|
|
4
43
|
/**
|
|
5
44
|
* SDK configuration types
|
|
6
45
|
*/
|
|
46
|
+
|
|
7
47
|
interface ArkeClientConfig {
|
|
8
48
|
/**
|
|
9
49
|
* Base URL for the Arke API
|
|
@@ -34,6 +74,29 @@ interface ArkeClientConfig {
|
|
|
34
74
|
* Custom headers to include in all requests
|
|
35
75
|
*/
|
|
36
76
|
headers?: Record<string, string>;
|
|
77
|
+
/**
|
|
78
|
+
* Retry configuration for transient errors
|
|
79
|
+
*
|
|
80
|
+
* Set to `false` to disable retries entirely.
|
|
81
|
+
* If not specified, uses default retry behavior (3 retries with exponential backoff).
|
|
82
|
+
*
|
|
83
|
+
* CAS conflicts (409) are never retried - they are returned immediately.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const arke = new ArkeClient({
|
|
88
|
+
* authToken: 'ak_...',
|
|
89
|
+
* retry: {
|
|
90
|
+
* maxRetries: 5,
|
|
91
|
+
* initialDelay: 200,
|
|
92
|
+
* onRetry: (attempt, error, delay) => {
|
|
93
|
+
* console.log(`Retry ${attempt} after ${delay}ms`);
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
retry?: RetryConfig | false;
|
|
37
100
|
}
|
|
38
101
|
declare const DEFAULT_CONFIG: Required<Pick<ArkeClientConfig, 'baseUrl' | 'network'>>;
|
|
39
102
|
|
|
@@ -167,6 +230,31 @@ declare class ArkeClient {
|
|
|
167
230
|
data: ReadableStream<Uint8Array> | null | undefined;
|
|
168
231
|
error: unknown;
|
|
169
232
|
}>;
|
|
233
|
+
/**
|
|
234
|
+
* Upload file content
|
|
235
|
+
*
|
|
236
|
+
* This is a convenience method that handles the binary body serialization
|
|
237
|
+
* that openapi-fetch doesn't handle automatically for non-JSON bodies.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* // Upload from a Blob
|
|
242
|
+
* const blob = new Blob(['Hello, world!'], { type: 'text/plain' });
|
|
243
|
+
* const { data, error } = await arke.uploadFileContent('01ABC...', blob, 'text/plain');
|
|
244
|
+
*
|
|
245
|
+
* // Upload from an ArrayBuffer
|
|
246
|
+
* const buffer = new TextEncoder().encode('Hello, world!').buffer;
|
|
247
|
+
* const { data, error } = await arke.uploadFileContent('01ABC...', buffer, 'text/plain');
|
|
248
|
+
*
|
|
249
|
+
* // Upload from a Uint8Array
|
|
250
|
+
* const bytes = new TextEncoder().encode('Hello, world!');
|
|
251
|
+
* const { data, error } = await arke.uploadFileContent('01ABC...', bytes, 'text/plain');
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
uploadFileContent(fileId: string, content: Blob | ArrayBuffer | Uint8Array, contentType: string): Promise<{
|
|
255
|
+
data: components['schemas']['UploadContentResponse'] | undefined;
|
|
256
|
+
error: unknown;
|
|
257
|
+
}>;
|
|
170
258
|
}
|
|
171
259
|
/**
|
|
172
260
|
* Create a new ArkeClient instance
|