@aignostics/sdk 3.7.0 → 3.8.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/index-B3pQQ0Yu.d.cts +3285 -0
- package/dist/index-B3pQQ0Yu.d.cts.map +1 -0
- package/dist/index-B3pQQ0Yu.d.ts +3285 -0
- package/dist/index-B3pQQ0Yu.d.ts.map +1 -0
- package/dist/index.cjs +3561 -3078
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +786 -557
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +786 -557
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3553 -3066
- package/dist/index.js.map +1 -1
- package/dist/rolldown-runtime-emK7D4bc.cjs +35 -0
- package/dist/test-utils/http-mocks.cjs +29995 -21567
- package/dist/test-utils/http-mocks.cjs.map +1 -1
- package/dist/test-utils/http-mocks.d.cts +1935 -48
- package/dist/test-utils/http-mocks.d.cts.map +1 -0
- package/dist/test-utils/http-mocks.d.ts +1935 -48
- package/dist/test-utils/http-mocks.d.ts.map +1 -0
- package/dist/test-utils/http-mocks.js +29989 -21555
- package/dist/test-utils/http-mocks.js.map +1 -1
- package/package.json +3 -3
- package/dist/api-CGkiPRMR.d.cts +0 -3296
- package/dist/api-CGkiPRMR.d.ts +0 -3296
package/dist/index.d.cts
CHANGED
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Readable } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Enriched application run entity that extends the raw API response
|
|
8
|
-
* with computed properties derived from run state and statistics.
|
|
9
|
-
*
|
|
10
|
-
* Returned by `PlatformSDKHttp.listApplicationRuns()` and `PlatformSDKHttp.getRun()`
|
|
11
|
-
* instead of the raw `RunReadResponse`.
|
|
12
|
-
*/
|
|
13
|
-
interface ApplicationRun extends RunReadResponse {
|
|
14
|
-
/** Percentage of items processed (0–100), computed from run statistics. */
|
|
15
|
-
progress: number;
|
|
16
|
-
/** Human-readable status derived from `state` and `termination_reason`. */
|
|
17
|
-
status: RunStatus;
|
|
18
|
-
/** Whether the run's result items are available for download. */
|
|
19
|
-
can_download: boolean;
|
|
20
|
-
}
|
|
21
|
-
/** Derived run status that simplifies the raw `state` + `termination_reason` combination. */
|
|
22
|
-
type RunStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'COMPLETED_WITH_ERRORS' | 'CANCELED' | 'FAILED' | 'UNKNOWN';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Enriched run-item entity that extends the raw API response
|
|
26
|
-
* with computed properties derived from item state and termination reason.
|
|
27
|
-
*
|
|
28
|
-
* Returned by `PlatformSDKHttp.listRunResults()` instead of the raw
|
|
29
|
-
* `ItemResultReadResponse`.
|
|
30
|
-
*/
|
|
31
|
-
interface ApplicationRunItem extends ItemResultReadResponse {
|
|
32
|
-
/** Whether the item's output artifact is available for download. */
|
|
33
|
-
can_download: boolean;
|
|
34
|
-
/** Human-readable status derived from `state` and `termination_reason`. */
|
|
35
|
-
status: string;
|
|
36
|
-
}
|
|
37
|
-
/** Derived item status that simplifies the raw `state` + `termination_reason` combination. */
|
|
38
|
-
type ItemStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'SKIPPED' | 'UNKNOWN';
|
|
39
|
-
|
|
1
|
+
import { $ as PublicApiPutRunCustomMetadataV1RunsRunIdCustomMetadataPutRequest, A as PublicApiCancelRunV1RunsRunIdCancelPostRequest, B as PublicApiGetRunV1RunsRunIdGetRequest, C as OutputArtifact, Ct as Configuration, D as PublicApi, E as OutputArtifactVisibility, F as PublicApiFactory, G as PublicApiInterface, H as PublicApiGetVersionDocumentContentRequest, I as PublicApiFp, J as PublicApiListRunItemsV1RunsRunIdItemsGetRequest, K as PublicApiListApplicationsV1ApplicationsGetRequest, L as PublicApiGetArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGetRequest, M as PublicApiCreateRunV1RunsPostRequest, N as PublicApiCreateShareTokenV1AccessShareTokensPostRequest, O as PublicApiApplicationVersionDetailsV1ApplicationsApplicationIdVersionsVersionGetRequest, P as PublicApiDeleteRunItemsV1RunsRunIdArtifactsDeleteRequest, Q as PublicApiPutItemCustomMetadataByRunV1RunsRunIdItemsExternalIdCustomMetadataPutRequest, R as PublicApiGetGrantV1AccessGrantsGrantIdGetRequest, S as OrganizationReadResponse, St as VersionReadResponse, T as OutputArtifactScope, U as PublicApiGetVersionDocumentFileRequest, V as PublicApiGetShareTokenV1AccessShareTokensShareTokenIdGetRequest, W as PublicApiGetVersionDocumentRequest, X as PublicApiListShareTokensV1AccessShareTokensGetRequest, Y as PublicApiListRunsV1RunsGetRequest, Z as PublicApiListVersionDocumentsRequest, _ as ItemOutput, _t as UserReadResponse, a as ArtifactState, at as RunCreationResponse, b as ItemTerminationReason, bt as VersionDocumentResponse, c as CustomMetadataUpdateResponse, ct as RunReadResponse, d as GrantRelation, dt as SchedulingRequest, et as PublicApiReadApplicationByIdV1ApplicationsApplicationIdGetRequest, f as HTTPValidationError, ft as SchedulingResponse, g as ItemCreationRequest, gt as SubjectType, h as InputArtifactResultReadResponse, ht as ShareTokenReadResponse, i as ArtifactOutput, it as RunCreationRequest, j as PublicApiCreateGrantV1AccessGrantsPostRequest, k as PublicApiAxiosParamCreator, l as GrantCreateRequest, lt as RunState, m as InputArtifactCreationRequest, mt as ShareTokenCreateResponse, n as ApplicationReadShortResponse, nt as PublicApiRevokeShareTokenV1AccessShareTokensShareTokenIdDeleteRequest, o as ArtifactTerminationReason, ot as RunItemStatistics, p as InputArtifact, pt as ShareTokenCreateRequest, q as PublicApiListGrantsV1AccessGrantsGetRequest, r as ApplicationVersion, rt as ResourceType, s as CustomMetadataUpdateRequest, st as RunOutput, t as ApplicationReadResponse, tt as PublicApiRevokeGrantV1AccessGrantsGrantIdDeleteRequest, u as GrantReadResponse, ut as RunTerminationReason, v as ItemResultReadResponse, vt as ValidationError, w as OutputArtifactResultReadResponse, wt as ConfigurationParameters, x as MeReadResponse, xt as VersionDocumentVisibility, y as ItemState, yt as ValidationErrorLocInner, z as PublicApiGetItemByRunV1RunsRunIdItemsExternalIdGetRequest } from "./index-B3pQQ0Yu.cjs";
|
|
2
|
+
import "axios";
|
|
3
|
+
import { Readable } from "node:stream";
|
|
4
|
+
//#region src/platform-sdk.d.ts
|
|
40
5
|
/**
|
|
41
6
|
* Token provider function that returns a valid access token
|
|
42
7
|
*/
|
|
@@ -45,456 +10,733 @@ type TokenProvider = () => Promise<string | null> | string | null;
|
|
|
45
10
|
* Configuration options for the Platform SDK
|
|
46
11
|
*/
|
|
47
12
|
interface PlatformSDKConfig {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Base URL for the API
|
|
15
|
+
*/
|
|
16
|
+
baseURL?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Token provider function for dynamic token retrieval
|
|
19
|
+
* This function will be called when a token is needed
|
|
20
|
+
*/
|
|
21
|
+
tokenProvider: TokenProvider;
|
|
22
|
+
/**
|
|
23
|
+
* Request timeout in milliseconds
|
|
24
|
+
*/
|
|
25
|
+
timeout?: number;
|
|
61
26
|
}
|
|
62
27
|
interface PlatformSDK {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
28
|
+
getVersion(): string;
|
|
29
|
+
getConfig(): PlatformSDKConfig;
|
|
30
|
+
testConnection(): Promise<boolean>;
|
|
31
|
+
listApplications(): Promise<ApplicationReadShortResponse[]>;
|
|
32
|
+
getApplication(applicationId: string): Promise<ApplicationReadResponse>;
|
|
33
|
+
listApplicationRuns(options?: {
|
|
34
|
+
applicationId?: string;
|
|
35
|
+
applicationVersion?: string;
|
|
36
|
+
page?: number;
|
|
37
|
+
pageSize?: number;
|
|
38
|
+
customMetadata?: string;
|
|
39
|
+
sort?: string[];
|
|
40
|
+
}): Promise<RunReadResponse[]>;
|
|
41
|
+
createApplicationRun(request: RunCreationRequest): Promise<RunCreationResponse>;
|
|
42
|
+
getRun(applicationRunId: string): Promise<RunReadResponse>;
|
|
43
|
+
cancelApplicationRun(applicationRunId: string): Promise<void>;
|
|
44
|
+
listRunResults(applicationRunId: string, options?: {
|
|
45
|
+
page?: number;
|
|
46
|
+
pageSize?: number;
|
|
47
|
+
sort?: string[];
|
|
48
|
+
externalIdIn?: string[];
|
|
49
|
+
state?: ItemState;
|
|
50
|
+
terminationReason?: ItemTerminationReason;
|
|
51
|
+
}): Promise<ItemResultReadResponse[]>;
|
|
52
|
+
getRunItem(applicationRunId: string, externalId: string): Promise<ItemResultReadResponse>;
|
|
53
|
+
updateRunMetadata(applicationRunId: string, customMetadata: Record<string, unknown> | null, customMetadataChecksum?: string | null): Promise<CustomMetadataUpdateResponse>;
|
|
54
|
+
updateRunItemMetadata(applicationRunId: string, externalId: string, customMetadata: Record<string, unknown> | null, customMetadataChecksum?: string | null): Promise<CustomMetadataUpdateResponse>;
|
|
55
|
+
deleteRunResults(applicationRunId: string): Promise<void>;
|
|
56
|
+
getApplicationVersionDetails(applicationId: string, version: string): Promise<VersionReadResponse>;
|
|
57
|
+
downloadArtifact(runId: string, artifactId: string): Promise<ArrayBuffer>;
|
|
58
|
+
downloadArtifactStream(runId: string, artifactId: string): Promise<Readable>;
|
|
59
|
+
createGrant(request: GrantCreateRequest): Promise<GrantReadResponse>;
|
|
60
|
+
listGrants(options?: {
|
|
61
|
+
resourceType?: ResourceType;
|
|
62
|
+
resourceId?: string;
|
|
63
|
+
subjectType?: SubjectType;
|
|
64
|
+
subjectId?: string;
|
|
65
|
+
relation?: GrantRelation[];
|
|
66
|
+
revoked?: boolean;
|
|
67
|
+
page?: number;
|
|
68
|
+
pageSize?: number;
|
|
69
|
+
sort?: string[];
|
|
70
|
+
}): Promise<GrantReadResponse[]>;
|
|
71
|
+
getGrant(grantId: string): Promise<GrantReadResponse>;
|
|
72
|
+
revokeGrant(grantId: string): Promise<GrantReadResponse>;
|
|
73
|
+
createShareToken(request: ShareTokenCreateRequest): Promise<ShareTokenCreateResponse>;
|
|
74
|
+
listShareTokens(options?: {
|
|
75
|
+
runId?: string;
|
|
76
|
+
createdBy?: string;
|
|
77
|
+
revoked?: boolean;
|
|
78
|
+
page?: number;
|
|
79
|
+
pageSize?: number;
|
|
80
|
+
sort?: string[];
|
|
81
|
+
}): Promise<ShareTokenReadResponse[]>;
|
|
82
|
+
getShareToken(shareTokenId: string): Promise<ShareTokenReadResponse>;
|
|
83
|
+
revokeShareToken(shareTokenId: string): Promise<ShareTokenReadResponse>;
|
|
90
84
|
}
|
|
91
85
|
/**
|
|
92
86
|
* Main SDK class for interacting with the Aignostics Platform
|
|
93
87
|
*/
|
|
94
88
|
declare class PlatformSDKHttp implements PlatformSDK {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
89
|
+
#private;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a new instance of the Platform SDK
|
|
92
|
+
* @param config Configuration options
|
|
93
|
+
*/
|
|
94
|
+
constructor(config: PlatformSDKConfig);
|
|
95
|
+
/**
|
|
96
|
+
* Test the connection to the Aignostics Platform API
|
|
97
|
+
*
|
|
98
|
+
* This method performs a simple API call to verify that the SDK can successfully
|
|
99
|
+
* connect to the platform using the provided configuration and authentication.
|
|
100
|
+
* It's useful for validating setup and troubleshooting connectivity issues.
|
|
101
|
+
*
|
|
102
|
+
* @returns A promise that resolves to `true` if the connection is successful
|
|
103
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
104
|
+
* @throws {Error} If the connection test fails due to network issues or API errors
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
109
|
+
*
|
|
110
|
+
* try {
|
|
111
|
+
* const isConnected = await sdk.testConnection();
|
|
112
|
+
* console.log('Connection successful:', isConnected);
|
|
113
|
+
* } catch (error) {
|
|
114
|
+
* console.error('Connection failed:', error.message);
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
testConnection(): Promise<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Retrieve a list of all available applications on the platform
|
|
121
|
+
*
|
|
122
|
+
* This method fetches all applications that are accessible with the current
|
|
123
|
+
* authentication credentials. Applications represent different AI models or
|
|
124
|
+
* processing pipelines available on the Aignostics Platform.
|
|
125
|
+
*
|
|
126
|
+
* @returns A promise that resolves to an array of application objects
|
|
127
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
128
|
+
* @throws {Error} If the request fails due to network issues or API errors
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
133
|
+
*
|
|
134
|
+
* try {
|
|
135
|
+
* const applications = await sdk.listApplications();
|
|
136
|
+
* console.log(`Found ${applications.length} applications`);
|
|
137
|
+
* applications.forEach(app => {
|
|
138
|
+
* console.log(`- ${app.name} (ID: ${app.id})`);
|
|
139
|
+
* });
|
|
140
|
+
* } catch (error) {
|
|
141
|
+
* console.error('Failed to list applications:', error.message);
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
listApplications(): Promise<ApplicationReadShortResponse[]>;
|
|
146
|
+
/**
|
|
147
|
+
* Retrieve detailed information about a specific application version
|
|
148
|
+
*
|
|
149
|
+
* This method fetches comprehensive details about a specific version of an
|
|
150
|
+
* application, including its changelog, release date, and any version-specific
|
|
151
|
+
* configurations or features.
|
|
152
|
+
*
|
|
153
|
+
* @param applicationId - The unique identifier of the application
|
|
154
|
+
* @param version - The version string of the application to retrieve
|
|
155
|
+
* @returns A promise that resolves to the application version details
|
|
156
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid application ID or version, or API errors
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
161
|
+
*
|
|
162
|
+
* try {
|
|
163
|
+
* const appVersion = await sdk.getApplicationVersionDetails('app-123', 'v1.2.0');
|
|
164
|
+
* console.log(`Application Version: ${appVersion.version}`);
|
|
165
|
+
* console.log(`Release Date: ${appVersion.release_date}`);
|
|
166
|
+
* console.log(`Changelog: ${appVersion.changelog}`);
|
|
167
|
+
* } catch (error) {
|
|
168
|
+
* console.error('Failed to get application version details:', error.message);
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
getApplicationVersionDetails(applicationId: string, version: string): Promise<VersionReadResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* Retrieve detailed information about a specific application
|
|
175
|
+
*
|
|
176
|
+
* This method fetches comprehensive details about an application, including
|
|
177
|
+
* its name, description, regulatory classes, and all available versions.
|
|
178
|
+
* This provides more detailed information compared to the summary returned
|
|
179
|
+
* by `listApplications()`.
|
|
180
|
+
*
|
|
181
|
+
* @param applicationId - The unique identifier of the application to retrieve
|
|
182
|
+
* @returns A promise that resolves to the complete application details
|
|
183
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid application ID, or API errors
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
188
|
+
*
|
|
189
|
+
* try {
|
|
190
|
+
* const application = await sdk.getApplication('app-123');
|
|
191
|
+
* console.log(`Application: ${application.name}`);
|
|
192
|
+
* console.log(`Description: ${application.description}`);
|
|
193
|
+
* console.log(`Available versions: ${application.versions.length}`);
|
|
194
|
+
*
|
|
195
|
+
* application.versions.forEach(version => {
|
|
196
|
+
* console.log(`- ${version.version} (ID: ${version.application_version_id})`);
|
|
197
|
+
* });
|
|
198
|
+
* } catch (error) {
|
|
199
|
+
* console.error('Failed to get application details:', error.message);
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
getApplication(applicationId: string): Promise<ApplicationReadResponse>;
|
|
204
|
+
/**
|
|
205
|
+
* Retrieve a list of application runs with optional filtering
|
|
206
|
+
*
|
|
207
|
+
* This method fetches application runs (processing jobs) that have been
|
|
208
|
+
* submitted to the platform. You can optionally filter by application ID
|
|
209
|
+
* and/or application version to narrow down the results.
|
|
210
|
+
*
|
|
211
|
+
* @param options - Optional filtering parameters
|
|
212
|
+
* @param options.applicationId - Filter runs by specific application ID
|
|
213
|
+
* @param options.applicationVersion - Filter runs by specific application version
|
|
214
|
+
* @returns A promise that resolves to an array of application run objects
|
|
215
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, or API errors
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
220
|
+
*
|
|
221
|
+
* try {
|
|
222
|
+
* // Get all runs
|
|
223
|
+
* const allRuns = await sdk.listApplicationRuns();
|
|
224
|
+
*
|
|
225
|
+
* // Get runs for a specific application
|
|
226
|
+
* const appRuns = await sdk.listApplicationRuns({
|
|
227
|
+
* applicationId: 'app-123'
|
|
228
|
+
* });
|
|
229
|
+
*
|
|
230
|
+
* // Get runs for a specific application version
|
|
231
|
+
* const versionRuns = await sdk.listApplicationRuns({
|
|
232
|
+
* applicationId: 'app-123',
|
|
233
|
+
* applicationVersion: 'v1.2.0'
|
|
234
|
+
* });
|
|
235
|
+
*
|
|
236
|
+
* console.log(`Found ${allRuns.length} total runs`);
|
|
237
|
+
* } catch (error) {
|
|
238
|
+
* console.error('Failed to list application runs:', error.message);
|
|
239
|
+
* }
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
listApplicationRuns(options?: {
|
|
243
|
+
applicationId?: string;
|
|
244
|
+
applicationVersion?: string;
|
|
245
|
+
customMetadata?: string;
|
|
246
|
+
sort?: string[];
|
|
247
|
+
page?: number;
|
|
248
|
+
pageSize?: number;
|
|
249
|
+
}): Promise<RunReadResponse[]>;
|
|
250
|
+
/**
|
|
251
|
+
* Create and submit a new application run for processing
|
|
252
|
+
*
|
|
253
|
+
* This method creates a new processing job by submitting data items to a
|
|
254
|
+
* specific application version. The run will be queued and processed
|
|
255
|
+
* asynchronously on the Aignostics Platform.
|
|
256
|
+
*
|
|
257
|
+
* @param request - The run creation request containing application version ID and items to process
|
|
258
|
+
* @returns A promise that resolves to the created run response with run ID and status
|
|
259
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid request data, or API errors
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
264
|
+
*
|
|
265
|
+
* try {
|
|
266
|
+
* const runRequest = {
|
|
267
|
+
* application_version_id: 'app-version-123',
|
|
268
|
+
* items: [
|
|
269
|
+
* {
|
|
270
|
+
* id: 'item-1',
|
|
271
|
+
* data: { }
|
|
272
|
+
* },
|
|
273
|
+
* {
|
|
274
|
+
* id: 'item-2',
|
|
275
|
+
* data: { }
|
|
276
|
+
* }
|
|
277
|
+
* ]
|
|
278
|
+
* };
|
|
279
|
+
*
|
|
280
|
+
* const run = await sdk.createApplicationRun(runRequest);
|
|
281
|
+
* console.log(`Created run with ID: ${run.id}`);
|
|
282
|
+
* console.log(`Status: ${run.status}`);
|
|
283
|
+
* } catch (error) {
|
|
284
|
+
* console.error('Failed to create application run:', error.message);
|
|
285
|
+
* }
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
createApplicationRun(request: RunCreationRequest): Promise<RunCreationResponse>;
|
|
289
|
+
/**
|
|
290
|
+
* Retrieve detailed information about a specific application run
|
|
291
|
+
*
|
|
292
|
+
* This method fetches complete details about a processing job, including
|
|
293
|
+
* its current status, progress, metadata, and execution information.
|
|
294
|
+
*
|
|
295
|
+
* @param applicationRunId - The unique identifier of the application run
|
|
296
|
+
* @returns A promise that resolves to the run details object
|
|
297
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid run ID, or API errors
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
302
|
+
*
|
|
303
|
+
* try {
|
|
304
|
+
* const run = await sdk.getRun('run-123');
|
|
305
|
+
* console.log(`Run ID: ${run.id}`);
|
|
306
|
+
* console.log(`Status: ${run.status}`);
|
|
307
|
+
* console.log(`Progress: ${run.progress}%`);
|
|
308
|
+
* console.log(`Created: ${run.created_at}`);
|
|
309
|
+
* } catch (error) {
|
|
310
|
+
* console.error('Failed to get run details:', error.message);
|
|
311
|
+
* }
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
getRun(applicationRunId: string): Promise<RunReadResponse>;
|
|
315
|
+
/**
|
|
316
|
+
* Cancel a running or queued application run
|
|
317
|
+
*
|
|
318
|
+
* This method attempts to cancel an application run that is currently
|
|
319
|
+
* in progress or waiting in the queue. Once cancelled, the run cannot
|
|
320
|
+
* be resumed and will transition to a cancelled state.
|
|
321
|
+
*
|
|
322
|
+
* @param applicationRunId - The unique identifier of the application run to cancel
|
|
323
|
+
* @returns A promise that resolves when the cancellation request is successful
|
|
324
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid run ID, or if the run cannot be cancelled
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
329
|
+
*
|
|
330
|
+
* try {
|
|
331
|
+
* await sdk.cancelApplicationRun('run-123');
|
|
332
|
+
* console.log('Run cancellation requested successfully');
|
|
333
|
+
*
|
|
334
|
+
* // Check the status to confirm cancellation
|
|
335
|
+
* const run = await sdk.getRun('run-123');
|
|
336
|
+
* console.log(`Updated status: ${run.status}`);
|
|
337
|
+
* } catch (error) {
|
|
338
|
+
* console.error('Failed to cancel run:', error.message);
|
|
339
|
+
* }
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
cancelApplicationRun(applicationRunId: string): Promise<void>;
|
|
343
|
+
/**
|
|
344
|
+
* Retrieve the processing results for a completed application run
|
|
345
|
+
*
|
|
346
|
+
* This method fetches all result items produced by a completed application run.
|
|
347
|
+
* Results include the processed data, analysis outcomes, and any generated
|
|
348
|
+
* artifacts from the AI model execution.
|
|
349
|
+
*
|
|
350
|
+
* @param applicationRunId - The unique identifier of the application run
|
|
351
|
+
* @returns A promise that resolves to an array of result items
|
|
352
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid run ID, or API errors
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```typescript
|
|
356
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
357
|
+
*
|
|
358
|
+
* try {
|
|
359
|
+
* const results = await sdk.listRunResults('run-123');
|
|
360
|
+
* console.log(`Found ${results.length} result items`);
|
|
361
|
+
*
|
|
362
|
+
* results.forEach((result, index) => {
|
|
363
|
+
* console.log(`Result ${index + 1}:`);
|
|
364
|
+
* console.log(`- Item ID: ${result.item_id}`);
|
|
365
|
+
* console.log(`- Status: ${result.status}`);
|
|
366
|
+
* console.log(`- Data: ${JSON.stringify(result.data)}`);
|
|
367
|
+
* });
|
|
368
|
+
* } catch (error) {
|
|
369
|
+
* console.error('Failed to list run results:', error.message);
|
|
370
|
+
* }
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
373
|
+
listRunResults(applicationRunId: string, { page, pageSize, sort, externalIdIn, state, terminationReason }?: {
|
|
374
|
+
page?: number;
|
|
375
|
+
pageSize?: number;
|
|
376
|
+
sort?: string[];
|
|
377
|
+
externalIdIn?: string[];
|
|
378
|
+
state?: ItemState;
|
|
379
|
+
terminationReason?: ItemTerminationReason;
|
|
380
|
+
}): Promise<ItemResultReadResponse[]>;
|
|
381
|
+
/**
|
|
382
|
+
* Retrieve a single item from an application run by its external ID
|
|
383
|
+
*
|
|
384
|
+
* This method fetches details for one specific result item within a run,
|
|
385
|
+
* identified by the `external_id` supplied when the run was created.
|
|
386
|
+
*
|
|
387
|
+
* @param applicationRunId - The unique identifier of the application run
|
|
388
|
+
* @param externalId - The external ID of the item, as supplied when creating the run
|
|
389
|
+
* @returns A promise that resolves to the enriched run item
|
|
390
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
391
|
+
* @throws {APIError} If the request fails (e.g., 404 if the item doesn't exist)
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```typescript
|
|
395
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
396
|
+
*
|
|
397
|
+
* try {
|
|
398
|
+
* const item = await sdk.getRunItem('run-123', 'slide-001');
|
|
399
|
+
* console.log(`Item status: ${item.status}`);
|
|
400
|
+
* } catch (error) {
|
|
401
|
+
* console.error('Failed to get run item:', error.message);
|
|
402
|
+
* }
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
getRunItem(applicationRunId: string, externalId: string): Promise<ItemResultReadResponse>;
|
|
406
|
+
/**
|
|
407
|
+
* Set (replace) the custom metadata attached to an application run
|
|
408
|
+
*
|
|
409
|
+
* This method overwrites the run's custom metadata, an arbitrary JSON object
|
|
410
|
+
* that consumers can use to store their own attributes (e.g. tags, notes,
|
|
411
|
+
* external references) alongside a run. Pass `null` to clear existing metadata.
|
|
412
|
+
*
|
|
413
|
+
* @param applicationRunId - The unique identifier of the application run
|
|
414
|
+
* @param customMetadata - The new custom metadata object, or `null` to clear it
|
|
415
|
+
* @param customMetadataChecksum - Optional checksum for optimistic concurrency control
|
|
416
|
+
* @returns A promise that resolves to the updated metadata checksum
|
|
417
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
418
|
+
* @throws {APIError} If the request fails (e.g., 404 if the run doesn't exist, 422 on checksum mismatch)
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```typescript
|
|
422
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
423
|
+
*
|
|
424
|
+
* try {
|
|
425
|
+
* await sdk.updateRunMetadata('run-123', { note: 'Reviewed by QA' });
|
|
426
|
+
* } catch (error) {
|
|
427
|
+
* console.error('Failed to update run metadata:', error.message);
|
|
428
|
+
* }
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
updateRunMetadata(applicationRunId: string, customMetadata: Record<string, unknown> | null, customMetadataChecksum?: string | null): Promise<CustomMetadataUpdateResponse>;
|
|
432
|
+
/**
|
|
433
|
+
* Set (replace) the custom metadata attached to a single run item
|
|
434
|
+
*
|
|
435
|
+
* This method overwrites the custom metadata of one item within a run,
|
|
436
|
+
* identified by its `external_id`. Pass `null` to clear existing metadata.
|
|
437
|
+
*
|
|
438
|
+
* @param applicationRunId - The unique identifier of the application run
|
|
439
|
+
* @param externalId - The external ID of the item, as supplied when creating the run
|
|
440
|
+
* @param customMetadata - The new custom metadata object, or `null` to clear it
|
|
441
|
+
* @param customMetadataChecksum - Optional checksum for optimistic concurrency control
|
|
442
|
+
* @returns A promise that resolves to the updated metadata checksum
|
|
443
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
444
|
+
* @throws {APIError} If the request fails (e.g., 404 if the item doesn't exist, 422 on checksum mismatch)
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```typescript
|
|
448
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
449
|
+
*
|
|
450
|
+
* try {
|
|
451
|
+
* await sdk.updateRunItemMetadata('run-123', 'slide-001', { reviewed: true });
|
|
452
|
+
* } catch (error) {
|
|
453
|
+
* console.error('Failed to update run item metadata:', error.message);
|
|
454
|
+
* }
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
updateRunItemMetadata(applicationRunId: string, externalId: string, customMetadata: Record<string, unknown> | null, customMetadataChecksum?: string | null): Promise<CustomMetadataUpdateResponse>;
|
|
458
|
+
/**
|
|
459
|
+
* Delete the results (output artifacts) of an application run
|
|
460
|
+
*
|
|
461
|
+
* This method permanently deletes the output artifacts produced by a
|
|
462
|
+
* terminated run. The run and its items remain queryable, but their
|
|
463
|
+
* output artifacts are no longer available for download.
|
|
464
|
+
*
|
|
465
|
+
* @param applicationRunId - The unique identifier of the application run
|
|
466
|
+
* @returns A promise that resolves when the deletion request succeeds
|
|
467
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
468
|
+
* @throws {APIError} If the request fails (e.g., 404 if the run doesn't exist)
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```typescript
|
|
472
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
473
|
+
*
|
|
474
|
+
* try {
|
|
475
|
+
* await sdk.deleteRunResults('run-123');
|
|
476
|
+
* console.log('Run results deleted');
|
|
477
|
+
* } catch (error) {
|
|
478
|
+
* console.error('Failed to delete run results:', error.message);
|
|
479
|
+
* }
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
deleteRunResults(applicationRunId: string): Promise<void>;
|
|
483
|
+
/**
|
|
484
|
+
* Get the current version of the SDK
|
|
485
|
+
*
|
|
486
|
+
* This method returns the version string of the Platform SDK, which can be
|
|
487
|
+
* useful for debugging, logging, or ensuring compatibility with API versions.
|
|
488
|
+
*
|
|
489
|
+
* @returns The SDK version string (e.g., "1.2.3")
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```typescript
|
|
493
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
494
|
+
* console.log(`Using SDK version: ${sdk.getVersion()}`);
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
getVersion(): string;
|
|
498
|
+
/**
|
|
499
|
+
* Get the current SDK configuration
|
|
500
|
+
*
|
|
501
|
+
* This method returns a copy of the current configuration used by the SDK,
|
|
502
|
+
* including the base URL, timeout settings, and other options. The returned
|
|
503
|
+
* object is a copy to prevent accidental modification of the internal config.
|
|
504
|
+
*
|
|
505
|
+
* @returns A copy of the current SDK configuration object
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```typescript
|
|
509
|
+
* const sdk = new PlatformSDKHttp({
|
|
510
|
+
* baseURL: 'https://api.aignostics.com',
|
|
511
|
+
* tokenProvider: () => 'your-token',
|
|
512
|
+
* timeout: 30000
|
|
513
|
+
* });
|
|
514
|
+
*
|
|
515
|
+
* const config = sdk.getConfig();
|
|
516
|
+
* console.log(`Base URL: ${config.baseURL}`);
|
|
517
|
+
* console.log(`Timeout: ${config.timeout}ms`);
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
getConfig(): PlatformSDKConfig;
|
|
521
|
+
/**
|
|
522
|
+
* Download an artifact file from a completed application run
|
|
523
|
+
*
|
|
524
|
+
* This method retrieves the binary content of a specific artifact produced
|
|
525
|
+
* during an application run. Artifacts can include generated reports, processed
|
|
526
|
+
* images, or other output files from the AI model execution.
|
|
527
|
+
*
|
|
528
|
+
* The download is performed with automatic retries for transient failures.
|
|
529
|
+
* Non-retryable HTTP status codes (403, 404, 410, 422) will abort immediately.
|
|
530
|
+
*
|
|
531
|
+
* @param runId - The unique identifier of the application run
|
|
532
|
+
* @param artifactId - The unique identifier of the artifact to download
|
|
533
|
+
* @returns A promise that resolves to an ArrayBuffer containing the artifact's binary content
|
|
534
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
535
|
+
* @throws {APIError} If the API request fails (e.g., 403, 404, 410, 422, or other HTTP errors)
|
|
536
|
+
* @throws {UnexpectedError} If a non-HTTP error occurs
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* ```typescript
|
|
540
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
541
|
+
*
|
|
542
|
+
* try {
|
|
543
|
+
* const buffer = await sdk.downloadArtifact('run-123', 'artifact-456');
|
|
544
|
+
* console.log(`Downloaded ${buffer.byteLength} bytes`);
|
|
545
|
+
*
|
|
546
|
+
* // Write to file (Node.js)
|
|
547
|
+
* fs.writeFileSync('output.bin', Buffer.from(buffer));
|
|
548
|
+
* } catch (error) {
|
|
549
|
+
* console.error('Failed to download artifact:', error.message);
|
|
550
|
+
* }
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
553
|
+
downloadArtifact(runId: string, artifactId: string): Promise<ArrayBuffer>;
|
|
554
|
+
/**
|
|
555
|
+
* Download an artifact file from a completed application run as a stream
|
|
556
|
+
*
|
|
557
|
+
* Prefer this method over `downloadArtifact` when downloading large (e.g. multi-gigabyte)
|
|
558
|
+
* artifacts: instead of buffering the entire file into memory before returning it, this
|
|
559
|
+
* method streams the artifact's bytes as they arrive, keeping memory usage low regardless
|
|
560
|
+
* of the artifact's size.
|
|
561
|
+
*
|
|
562
|
+
* The download is performed with automatic retries for transient failures.
|
|
563
|
+
* Non-retryable HTTP status codes (403, 404, 410, 422) will abort immediately.
|
|
564
|
+
*
|
|
565
|
+
* @param runId - The unique identifier of the application run
|
|
566
|
+
* @param artifactId - The unique identifier of the artifact to download
|
|
567
|
+
* @returns A promise that resolves to a Node.js `Readable` stream yielding the artifact's binary content
|
|
568
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
569
|
+
* @throws {APIError} If the API request fails (e.g., 403, 404, 410, 422, or other HTTP errors)
|
|
570
|
+
* @throws {UnexpectedError} If a non-HTTP error occurs
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* ```typescript
|
|
574
|
+
* import { pipeline } from 'node:stream/promises';
|
|
575
|
+
* import { createWriteStream } from 'node:fs';
|
|
576
|
+
*
|
|
577
|
+
* const stream = await sdk.downloadArtifactStream('run-123', 'artifact-456');
|
|
578
|
+
* await pipeline(stream, createWriteStream('output.bin'));
|
|
579
|
+
* ```
|
|
580
|
+
*
|
|
581
|
+
* @remarks
|
|
582
|
+
* Retries only cover failures at the initial-request stage (a non-2xx status surfaced from
|
|
583
|
+
* the response headers before the body begins streaming). Once the response body has started
|
|
584
|
+
* streaming, a mid-stream connection drop CANNOT be retried by this method — the consumer must
|
|
585
|
+
* listen for the stream's `error` event and re-download if needed.
|
|
586
|
+
*/
|
|
587
|
+
downloadArtifactStream(runId: string, artifactId: string): Promise<Readable>;
|
|
588
|
+
/**
|
|
589
|
+
* Create a grant to share access to a resource with a subject (user or organization)
|
|
590
|
+
*
|
|
591
|
+
* @param request - The grant creation request
|
|
592
|
+
* @returns A promise that resolves to the created grant
|
|
593
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid request data, or API errors
|
|
594
|
+
*
|
|
595
|
+
* @example
|
|
596
|
+
* ```typescript
|
|
597
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
598
|
+
*
|
|
599
|
+
* const grant = await sdk.createGrant({
|
|
600
|
+
* resource_type: 'run',
|
|
601
|
+
* resource_id: 'run-123',
|
|
602
|
+
* subject_type: 'user',
|
|
603
|
+
* subject_email: 'colleague@example.com',
|
|
604
|
+
* relation: 'viewer',
|
|
605
|
+
* });
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
createGrant(request: GrantCreateRequest): Promise<GrantReadResponse>;
|
|
609
|
+
/**
|
|
610
|
+
* List grants, optionally filtered by resource, subject, relation, or revocation status
|
|
611
|
+
*
|
|
612
|
+
* @param options - Optional filters and pagination/sort options
|
|
613
|
+
* @returns A promise that resolves to an array of grants
|
|
614
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, or API errors
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```typescript
|
|
618
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
619
|
+
*
|
|
620
|
+
* const grants = await sdk.listGrants({ resourceType: 'run', resourceId: 'run-123' });
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
listGrants({ resourceType, resourceId, subjectType, subjectId, relation, revoked, page, pageSize, sort }?: {
|
|
624
|
+
resourceType?: ResourceType;
|
|
625
|
+
resourceId?: string;
|
|
626
|
+
subjectType?: SubjectType;
|
|
627
|
+
subjectId?: string;
|
|
628
|
+
relation?: GrantRelation[];
|
|
629
|
+
revoked?: boolean;
|
|
630
|
+
page?: number;
|
|
631
|
+
pageSize?: number;
|
|
632
|
+
sort?: string[];
|
|
633
|
+
}): Promise<GrantReadResponse[]>;
|
|
634
|
+
/**
|
|
635
|
+
* Get a grant by its ID
|
|
636
|
+
*
|
|
637
|
+
* @param grantId - The unique identifier of the grant
|
|
638
|
+
* @returns A promise that resolves to the grant details
|
|
639
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid grant ID, or API errors
|
|
640
|
+
*
|
|
641
|
+
* @example
|
|
642
|
+
* ```typescript
|
|
643
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
644
|
+
*
|
|
645
|
+
* const grant = await sdk.getGrant('grant-123');
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
getGrant(grantId: string): Promise<GrantReadResponse>;
|
|
649
|
+
/**
|
|
650
|
+
* Revoke a grant by its ID
|
|
651
|
+
*
|
|
652
|
+
* @param grantId - The unique identifier of the grant to revoke
|
|
653
|
+
* @returns A promise that resolves to the revoked grant details
|
|
654
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid grant ID, or API errors
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```typescript
|
|
658
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
659
|
+
*
|
|
660
|
+
* await sdk.revokeGrant('grant-123');
|
|
661
|
+
* ```
|
|
662
|
+
*/
|
|
663
|
+
revokeGrant(grantId: string): Promise<GrantReadResponse>;
|
|
664
|
+
/**
|
|
665
|
+
* Create a share token. The returned share_token value is shown only once and is never stored.
|
|
666
|
+
* Use `createGrant` with `subject_type: 'share_token'` to grant access to a resource.
|
|
667
|
+
*
|
|
668
|
+
* @param request - The share token creation request
|
|
669
|
+
* @returns A promise that resolves to the created share token, including the one-time token value
|
|
670
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid request data, or API errors
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
* ```typescript
|
|
674
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
675
|
+
*
|
|
676
|
+
* const shareToken = await sdk.createShareToken({ expires_at: '2026-01-01T00:00:00Z' });
|
|
677
|
+
* console.log(shareToken.share_token); // Only shown once
|
|
678
|
+
* ```
|
|
679
|
+
*/
|
|
680
|
+
createShareToken(request: ShareTokenCreateRequest): Promise<ShareTokenCreateResponse>;
|
|
681
|
+
/**
|
|
682
|
+
* List share tokens, optionally filtered by run, creator, or revocation status
|
|
683
|
+
*
|
|
684
|
+
* @param options - Optional filters and pagination/sort options
|
|
685
|
+
* @returns A promise that resolves to an array of share tokens
|
|
686
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, or API errors
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* ```typescript
|
|
690
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
691
|
+
*
|
|
692
|
+
* const shareTokens = await sdk.listShareTokens({ runId: 'run-123' });
|
|
693
|
+
* ```
|
|
694
|
+
*/
|
|
695
|
+
listShareTokens({ runId, createdBy, revoked, page, pageSize, sort }?: {
|
|
696
|
+
runId?: string;
|
|
697
|
+
createdBy?: string;
|
|
698
|
+
revoked?: boolean;
|
|
699
|
+
page?: number;
|
|
700
|
+
pageSize?: number;
|
|
701
|
+
sort?: string[];
|
|
702
|
+
}): Promise<ShareTokenReadResponse[]>;
|
|
703
|
+
/**
|
|
704
|
+
* Get a share token by its ID
|
|
705
|
+
*
|
|
706
|
+
* @param shareTokenId - The unique identifier of the share token
|
|
707
|
+
* @returns A promise that resolves to the share token details (excludes the token value)
|
|
708
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid share token ID, or API errors
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```typescript
|
|
712
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
713
|
+
*
|
|
714
|
+
* const shareToken = await sdk.getShareToken('share-token-123');
|
|
715
|
+
* ```
|
|
716
|
+
*/
|
|
717
|
+
getShareToken(shareTokenId: string): Promise<ShareTokenReadResponse>;
|
|
718
|
+
/**
|
|
719
|
+
* Revoke a share token by its ID. Invalidates the credential regardless of any active grants.
|
|
720
|
+
*
|
|
721
|
+
* @param shareTokenId - The unique identifier of the share token to revoke
|
|
722
|
+
* @returns A promise that resolves to the revoked share token details
|
|
723
|
+
* @throws {Error} If the request fails due to network issues, authentication problems, invalid share token ID, or API errors
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* ```typescript
|
|
727
|
+
* const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
|
|
728
|
+
*
|
|
729
|
+
* await sdk.revokeShareToken('share-token-123');
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
732
|
+
revokeShareToken(shareTokenId: string): Promise<ShareTokenReadResponse>;
|
|
492
733
|
}
|
|
493
|
-
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region src/errors.d.ts
|
|
494
736
|
type ErrorCode = 'AUTHENTICATION_ERROR' | 'API_ERROR' | 'CONFIGURATION_ERROR' | 'UNEXPECTED_ERROR';
|
|
495
737
|
interface BaseErrorOptions {
|
|
496
|
-
|
|
497
|
-
|
|
738
|
+
context?: Record<string, unknown>;
|
|
739
|
+
originalError?: unknown;
|
|
498
740
|
}
|
|
499
741
|
/**
|
|
500
742
|
* Base error class for all SDK-related errors
|
|
@@ -503,26 +745,26 @@ interface BaseErrorOptions {
|
|
|
503
745
|
* providing consistent error handling and additional context information.
|
|
504
746
|
*/
|
|
505
747
|
declare class BaseError extends Error {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
748
|
+
/**
|
|
749
|
+
* Error code for programmatic error handling
|
|
750
|
+
*/
|
|
751
|
+
readonly code: ErrorCode;
|
|
752
|
+
/**
|
|
753
|
+
* Additional context or metadata related to the error
|
|
754
|
+
*/
|
|
755
|
+
readonly context?: Record<string, unknown>;
|
|
756
|
+
/**
|
|
757
|
+
* Original error that caused this error, if applicable
|
|
758
|
+
*/
|
|
759
|
+
readonly originalError?: unknown;
|
|
760
|
+
/**
|
|
761
|
+
* Creates a new BaseError instance
|
|
762
|
+
*
|
|
763
|
+
* @param message - Human-readable error message
|
|
764
|
+
* @param code - Error code for programmatic handling
|
|
765
|
+
* @param context - Additional error context or metadata
|
|
766
|
+
*/
|
|
767
|
+
constructor(message: string, code: ErrorCode, { context, originalError }?: BaseErrorOptions);
|
|
526
768
|
}
|
|
527
769
|
/**
|
|
528
770
|
* Authentication-related error
|
|
@@ -531,15 +773,15 @@ declare class BaseError extends Error {
|
|
|
531
773
|
* credentials are available for API requests.
|
|
532
774
|
*/
|
|
533
775
|
declare class AuthenticationError extends BaseError {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
776
|
+
/**
|
|
777
|
+
* Creates a new AuthenticationError instance
|
|
778
|
+
*
|
|
779
|
+
* @param message - Human-readable error message describing the authentication issue
|
|
780
|
+
* @param options - Additional options about the authentication failure
|
|
781
|
+
* @param options.context - Additional context about the authentication failure
|
|
782
|
+
* @param options.originalError - Original error that caused this authentication error
|
|
783
|
+
*/
|
|
784
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
543
785
|
}
|
|
544
786
|
/**
|
|
545
787
|
* API-related error
|
|
@@ -548,20 +790,20 @@ declare class AuthenticationError extends BaseError {
|
|
|
548
790
|
* or invalid responses from the Aignostics Platform API.
|
|
549
791
|
*/
|
|
550
792
|
declare class APIError extends BaseError {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
793
|
+
/**
|
|
794
|
+
* HTTP status code from the failed API request
|
|
795
|
+
*/
|
|
796
|
+
readonly statusCode?: number;
|
|
797
|
+
/**
|
|
798
|
+
* Creates a new APIError instance
|
|
799
|
+
*
|
|
800
|
+
* @param message - Human-readable error message describing the API issue
|
|
801
|
+
* @param statusCode - HTTP status code from the failed request
|
|
802
|
+
* @param context - Additional context about the API failure
|
|
803
|
+
*/
|
|
804
|
+
constructor(message: string, options?: BaseErrorOptions & {
|
|
805
|
+
statusCode?: number;
|
|
806
|
+
});
|
|
565
807
|
}
|
|
566
808
|
/**
|
|
567
809
|
* Configuration-related error
|
|
@@ -569,27 +811,20 @@ declare class APIError extends BaseError {
|
|
|
569
811
|
* Thrown when SDK configuration is invalid or missing required parameters.
|
|
570
812
|
*/
|
|
571
813
|
declare class ConfigurationError extends BaseError {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
814
|
+
/**
|
|
815
|
+
* Creates a new ConfigurationError instance
|
|
816
|
+
*
|
|
817
|
+
* @param message - Human-readable error message describing the configuration issue
|
|
818
|
+
* @param context - Additional context about the configuration problem
|
|
819
|
+
*/
|
|
820
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
579
821
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
* responses before returning them to consumers.
|
|
587
|
-
*
|
|
588
|
-
* @param run - Raw run response from the API
|
|
589
|
-
* @returns Enriched run entity with computed properties spread onto the original response
|
|
590
|
-
*/
|
|
591
|
-
declare const processApplicationRun: (run: RunReadResponse) => ApplicationRun;
|
|
592
|
-
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region src/entities/application-run/types.d.ts
|
|
824
|
+
/** Derived run status that simplifies the raw `state` + `termination_reason` combination. */
|
|
825
|
+
type RunStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'COMPLETED_WITH_ERRORS' | 'CANCELED' | 'FAILED' | 'UNKNOWN';
|
|
826
|
+
//#endregion
|
|
827
|
+
//#region src/entities/application-run/utils.d.ts
|
|
593
828
|
/**
|
|
594
829
|
* Compute the overall progress of a run as a percentage (0–100).
|
|
595
830
|
* Progress is based on the ratio of terminal items (succeeded + errored + skipped)
|
|
@@ -624,19 +859,12 @@ declare function getRunStatus(run: RunReadResponse): RunStatus;
|
|
|
624
859
|
* @returns `true` if items are available for download (run is COMPLETED or COMPLETED_WITH_ERRORS)
|
|
625
860
|
*/
|
|
626
861
|
declare const canDownloadRunItems: (run: RunReadResponse) => boolean;
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
* map API responses before returning them to consumers.
|
|
634
|
-
*
|
|
635
|
-
* @param item - Raw item response from the API
|
|
636
|
-
* @returns Enriched item entity with computed properties spread onto the original response
|
|
637
|
-
*/
|
|
638
|
-
declare const processRunItem: (item: ItemResultReadResponse) => ApplicationRunItem;
|
|
639
|
-
|
|
862
|
+
//#endregion
|
|
863
|
+
//#region src/entities/run-item/types.d.ts
|
|
864
|
+
/** Derived item status that simplifies the raw `state` + `termination_reason` combination. */
|
|
865
|
+
type ItemStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'SKIPPED' | 'UNKNOWN';
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region src/entities/run-item/utils.d.ts
|
|
640
868
|
/**
|
|
641
869
|
* Determine whether a single run item's output artifact is available for download.
|
|
642
870
|
* Disabled for PENDING, PROCESSING, FAILED, and SKIPPED items; available otherwise
|
|
@@ -662,5 +890,6 @@ declare const ERROR_TERMINATION_REASONS: Set<string>;
|
|
|
662
890
|
* @param item - Raw item response from the API
|
|
663
891
|
*/
|
|
664
892
|
declare function getItemStatus(item: ItemResultReadResponse): ItemStatus;
|
|
665
|
-
|
|
666
|
-
export { APIError, ApplicationReadResponse, ApplicationReadShortResponse,
|
|
893
|
+
//#endregion
|
|
894
|
+
export { APIError, ApplicationReadResponse, ApplicationReadShortResponse, ApplicationVersion, ArtifactOutput, ArtifactState, ArtifactTerminationReason, AuthenticationError, BaseError, Configuration, ConfigurationError, ConfigurationParameters, CustomMetadataUpdateRequest, CustomMetadataUpdateResponse, ERROR_TERMINATION_REASONS, GrantCreateRequest, GrantReadResponse, GrantRelation, HTTPValidationError, InputArtifact, InputArtifactCreationRequest, InputArtifactResultReadResponse, ItemCreationRequest, ItemOutput, ItemResultReadResponse, ItemState, type ItemStatus, ItemTerminationReason, MeReadResponse, OrganizationReadResponse, OutputArtifact, OutputArtifactResultReadResponse, OutputArtifactScope, OutputArtifactVisibility, type PlatformSDK, type PlatformSDKConfig, PlatformSDKHttp, PlatformSDKHttp as default, PublicApi, PublicApiApplicationVersionDetailsV1ApplicationsApplicationIdVersionsVersionGetRequest, PublicApiAxiosParamCreator, PublicApiCancelRunV1RunsRunIdCancelPostRequest, PublicApiCreateGrantV1AccessGrantsPostRequest, PublicApiCreateRunV1RunsPostRequest, PublicApiCreateShareTokenV1AccessShareTokensPostRequest, PublicApiDeleteRunItemsV1RunsRunIdArtifactsDeleteRequest, PublicApiFactory, PublicApiFp, PublicApiGetArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGetRequest, PublicApiGetGrantV1AccessGrantsGrantIdGetRequest, PublicApiGetItemByRunV1RunsRunIdItemsExternalIdGetRequest, PublicApiGetRunV1RunsRunIdGetRequest, PublicApiGetShareTokenV1AccessShareTokensShareTokenIdGetRequest, PublicApiGetVersionDocumentContentRequest, PublicApiGetVersionDocumentFileRequest, PublicApiGetVersionDocumentRequest, PublicApiInterface, PublicApiListApplicationsV1ApplicationsGetRequest, PublicApiListGrantsV1AccessGrantsGetRequest, PublicApiListRunItemsV1RunsRunIdItemsGetRequest, PublicApiListRunsV1RunsGetRequest, PublicApiListShareTokensV1AccessShareTokensGetRequest, PublicApiListVersionDocumentsRequest, PublicApiPutItemCustomMetadataByRunV1RunsRunIdItemsExternalIdCustomMetadataPutRequest, PublicApiPutRunCustomMetadataV1RunsRunIdCustomMetadataPutRequest, PublicApiReadApplicationByIdV1ApplicationsApplicationIdGetRequest, PublicApiRevokeGrantV1AccessGrantsGrantIdDeleteRequest, PublicApiRevokeShareTokenV1AccessShareTokensShareTokenIdDeleteRequest, ResourceType, RunCreationRequest, RunCreationResponse, RunItemStatistics, RunOutput, RunReadResponse, RunState, type RunStatus, RunTerminationReason, SchedulingRequest, SchedulingResponse, ShareTokenCreateRequest, ShareTokenCreateResponse, ShareTokenReadResponse, SubjectType, type TokenProvider, UserReadResponse, ValidationError, ValidationErrorLocInner, VersionDocumentResponse, VersionDocumentVisibility, VersionReadResponse, canDownloadItem, canDownloadRunItems, getItemStatus, getRunProgress, getRunStatus };
|
|
895
|
+
//# sourceMappingURL=index.d.cts.map
|