@aignostics/sdk 3.2.0 → 3.3.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/aignostics-sdk-3.3.0.tgz +0 -0
- package/dist/{api-Ce-0fPc3.d.cts → api-CWohsFN3.d.cts} +184 -33
- package/dist/{api-Ce-0fPc3.d.ts → api-CWohsFN3.d.ts} +184 -33
- package/dist/index.cjs +165 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -9
- package/dist/index.d.ts +119 -9
- package/dist/index.js +159 -9
- package/dist/index.js.map +1 -1
- package/dist/test-utils/http-mocks.d.cts +1 -1
- package/dist/test-utils/http-mocks.d.ts +1 -1
- package/package.json +1 -1
- package/dist/aignostics-sdk-3.2.0.tgz +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { f as ApplicationVersion, g as ArtifactOutput, h as ArtifactState, i as ArtifactTerminationReason,
|
|
1
|
+
import { R as RunReadResponse, I as ItemResultReadResponse, A as ApplicationReadShortResponse, a as ApplicationReadResponse, b as RunCreationRequest, c as RunCreationResponse, d as ItemState, e as ItemTerminationReason, V as VersionReadResponse } from './api-CWohsFN3.cjs';
|
|
2
|
+
export { f as ApplicationVersion, g as ArtifactOutput, h as ArtifactState, i as ArtifactTerminationReason, a0 as Configuration, $ as ConfigurationParameters, C as CustomMetadataUpdateRequest, j as CustomMetadataUpdateResponse, H as HTTPValidationError, k as InputArtifact, l as InputArtifactCreationRequest, m as ItemCreationRequest, n as ItemOutput, M as MeReadResponse, O as OrganizationReadResponse, o as OutputArtifact, p as OutputArtifactResultReadResponse, q as OutputArtifactScope, r as OutputArtifactVisibility, _ as PublicApi, E as PublicApiApplicationVersionDetailsV1ApplicationsApplicationIdVersionsVersionGetRequest, P as PublicApiAxiosParamCreator, F as PublicApiCancelRunV1RunsRunIdCancelPostRequest, G as PublicApiCreateRunV1RunsPostRequest, J as PublicApiDeleteRunItemsV1RunsRunIdArtifactsDeleteRequest, B as PublicApiFactory, z as PublicApiFp, K as PublicApiGetArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGetRequest, L as PublicApiGetItemByRunV1RunsRunIdItemsExternalIdGetRequest, N as PublicApiGetRunV1RunsRunIdGetRequest, D as PublicApiInterface, Q as PublicApiListApplicationsV1ApplicationsGetRequest, T as PublicApiListRunItemsV1RunsRunIdItemsGetRequest, W as PublicApiListRunsV1RunsGetRequest, X as PublicApiPutItemCustomMetadataByRunV1RunsRunIdItemsExternalIdCustomMetadataPutRequest, Y as PublicApiPutRunCustomMetadataV1RunsRunIdCustomMetadataPutRequest, Z as PublicApiReadApplicationByIdV1ApplicationsApplicationIdGetRequest, s as RunItemStatistics, t as RunOutput, u as RunState, v as RunTerminationReason, S as SchedulingRequest, w as SchedulingResponse, U as UserReadResponse, x as ValidationError, y as ValidationErrorLocInner } from './api-CWohsFN3.cjs';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Enriched application run entity that extends the raw API response
|
|
7
|
+
* with computed properties derived from run state and statistics.
|
|
8
|
+
*
|
|
9
|
+
* Returned by `PlatformSDKHttp.listApplicationRuns()` and `PlatformSDKHttp.getRun()`
|
|
10
|
+
* instead of the raw `RunReadResponse`.
|
|
11
|
+
*/
|
|
12
|
+
interface ApplicationRun extends RunReadResponse {
|
|
13
|
+
/** Percentage of items processed (0–100), computed from run statistics. */
|
|
14
|
+
progress: number;
|
|
15
|
+
/** Human-readable status derived from `state` and `termination_reason`. */
|
|
16
|
+
status: RunStatus;
|
|
17
|
+
/** Whether the run's result items are available for download. */
|
|
18
|
+
can_download: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Derived run status that simplifies the raw `state` + `termination_reason` combination. */
|
|
21
|
+
type RunStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'COMPLETED_WITH_ERRORS' | 'CANCELED' | 'FAILED';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Enriched run-item entity that extends the raw API response
|
|
25
|
+
* with computed properties derived from item state and termination reason.
|
|
26
|
+
*
|
|
27
|
+
* Returned by `PlatformSDKHttp.listRunResults()` instead of the raw
|
|
28
|
+
* `ItemResultReadResponse`.
|
|
29
|
+
*/
|
|
30
|
+
interface ApplicationRunItem extends ItemResultReadResponse {
|
|
31
|
+
/** Whether the item's output artifact is available for download. */
|
|
32
|
+
can_download: boolean;
|
|
33
|
+
/** Human-readable status derived from `state` and `termination_reason`. */
|
|
34
|
+
status: string;
|
|
35
|
+
}
|
|
36
|
+
/** Derived item status that simplifies the raw `state` + `termination_reason` combination. */
|
|
37
|
+
type ItemStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'SKIPPED';
|
|
38
|
+
|
|
5
39
|
/**
|
|
6
40
|
* Token provider function that returns a valid access token
|
|
7
41
|
*/
|
|
@@ -37,9 +71,9 @@ interface PlatformSDK {
|
|
|
37
71
|
pageSize?: number;
|
|
38
72
|
customMetadata?: string;
|
|
39
73
|
sort?: string[];
|
|
40
|
-
}): Promise<
|
|
74
|
+
}): Promise<ApplicationRun[]>;
|
|
41
75
|
createApplicationRun(request: RunCreationRequest): Promise<RunCreationResponse>;
|
|
42
|
-
getRun(applicationRunId: string): Promise<
|
|
76
|
+
getRun(applicationRunId: string): Promise<ApplicationRun>;
|
|
43
77
|
cancelApplicationRun(applicationRunId: string): Promise<void>;
|
|
44
78
|
listRunResults(applicationRunId: string, options?: {
|
|
45
79
|
page?: number;
|
|
@@ -48,7 +82,7 @@ interface PlatformSDK {
|
|
|
48
82
|
externalIdIn?: string[];
|
|
49
83
|
state?: ItemState;
|
|
50
84
|
terminationReason?: ItemTerminationReason;
|
|
51
|
-
}): Promise<
|
|
85
|
+
}): Promise<ApplicationRunItem[]>;
|
|
52
86
|
getApplicationVersionDetails(applicationId: string, version: string): Promise<VersionReadResponse>;
|
|
53
87
|
}
|
|
54
88
|
/**
|
|
@@ -215,7 +249,7 @@ declare class PlatformSDKHttp implements PlatformSDK {
|
|
|
215
249
|
sort?: string[];
|
|
216
250
|
page?: number;
|
|
217
251
|
pageSize?: number;
|
|
218
|
-
}): Promise<
|
|
252
|
+
}): Promise<ApplicationRun[]>;
|
|
219
253
|
/**
|
|
220
254
|
* Create and submit a new application run for processing
|
|
221
255
|
*
|
|
@@ -280,7 +314,7 @@ declare class PlatformSDKHttp implements PlatformSDK {
|
|
|
280
314
|
* }
|
|
281
315
|
* ```
|
|
282
316
|
*/
|
|
283
|
-
getRun(applicationRunId: string): Promise<
|
|
317
|
+
getRun(applicationRunId: string): Promise<ApplicationRun>;
|
|
284
318
|
/**
|
|
285
319
|
* Cancel a running or queued application run
|
|
286
320
|
*
|
|
@@ -346,7 +380,7 @@ declare class PlatformSDKHttp implements PlatformSDK {
|
|
|
346
380
|
externalIdIn?: string[];
|
|
347
381
|
state?: ItemState;
|
|
348
382
|
terminationReason?: ItemTerminationReason;
|
|
349
|
-
}): Promise<
|
|
383
|
+
}): Promise<ApplicationRunItem[]>;
|
|
350
384
|
/**
|
|
351
385
|
* Get the current version of the SDK
|
|
352
386
|
*
|
|
@@ -474,4 +508,80 @@ declare class ConfigurationError extends BaseError {
|
|
|
474
508
|
constructor(message: string, options?: BaseErrorOptions);
|
|
475
509
|
}
|
|
476
510
|
|
|
477
|
-
|
|
511
|
+
/**
|
|
512
|
+
* Transform a raw {@link RunReadResponse} from the API into an enriched
|
|
513
|
+
* {@link ApplicationRun} by computing derived properties (progress, status, can_download).
|
|
514
|
+
*
|
|
515
|
+
* This is the single entry-point used by `PlatformSDKHttp` methods to map API
|
|
516
|
+
* responses before returning them to consumers.
|
|
517
|
+
*
|
|
518
|
+
* @param run - Raw run response from the API
|
|
519
|
+
* @returns Enriched run entity with computed properties spread onto the original response
|
|
520
|
+
*/
|
|
521
|
+
declare const processApplicationRun: (run: RunReadResponse) => ApplicationRun;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Compute the overall progress of a run as a percentage (0–100).
|
|
525
|
+
* Progress is based on the ratio of terminal items (succeeded + errored + skipped)
|
|
526
|
+
* to the total item count.
|
|
527
|
+
*
|
|
528
|
+
* @param run - Raw run response from the API
|
|
529
|
+
* @returns Integer percentage rounded to the nearest whole number
|
|
530
|
+
*/
|
|
531
|
+
declare function getRunProgress(run: RunReadResponse): number;
|
|
532
|
+
/**
|
|
533
|
+
* Derive a human-readable {@link RunStatus} from the raw API `state` and `termination_reason`.
|
|
534
|
+
*
|
|
535
|
+
* Mapping rules:
|
|
536
|
+
* - PENDING / PROCESSING → passed through as-is
|
|
537
|
+
* - TERMINATED + CANCELED_BY_USER → CANCELED
|
|
538
|
+
* - TERMINATED + CANCELED_BY_SYSTEM → FAILED
|
|
539
|
+
* - TERMINATED + not all items succeeded → COMPLETED_WITH_ERRORS
|
|
540
|
+
* - TERMINATED + all items succeeded → COMPLETED
|
|
541
|
+
*
|
|
542
|
+
* @param run - Raw run response from the API
|
|
543
|
+
*/
|
|
544
|
+
declare function getRunStatus(run: RunReadResponse): RunStatus;
|
|
545
|
+
/**
|
|
546
|
+
* Determine whether a run's result items are available for download.
|
|
547
|
+
* Items can only be downloaded once the run has reached a completed state.
|
|
548
|
+
*
|
|
549
|
+
* @param run - Raw run response from the API
|
|
550
|
+
* @returns `true` if items are available for download (run is COMPLETED or COMPLETED_WITH_ERRORS)
|
|
551
|
+
*/
|
|
552
|
+
declare const canDownloadRunItems: (run: RunReadResponse) => boolean;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Transform a raw {@link ItemResultReadResponse} from the API into an enriched
|
|
556
|
+
* {@link ApplicationRunItem} by computing derived properties (status, can_download).
|
|
557
|
+
*
|
|
558
|
+
* This is the single entry-point used by `PlatformSDKHttp.listRunResults()` to
|
|
559
|
+
* map API responses before returning them to consumers.
|
|
560
|
+
*
|
|
561
|
+
* @param item - Raw item response from the API
|
|
562
|
+
* @returns Enriched item entity with computed properties spread onto the original response
|
|
563
|
+
*/
|
|
564
|
+
declare const processRunItem: (item: ItemResultReadResponse) => ApplicationRunItem;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Determine whether a single run item's output artifact is available for download.
|
|
568
|
+
* Only items in the COMPLETED state have downloadable artifacts.
|
|
569
|
+
*
|
|
570
|
+
* @param item - Raw item response from the API
|
|
571
|
+
* @returns `true` if the item is in a COMPLETED state
|
|
572
|
+
*/
|
|
573
|
+
declare const canDownloadItem: (item: ItemResultReadResponse) => boolean;
|
|
574
|
+
/**
|
|
575
|
+
* Derive a human-readable {@link ItemStatus} from the raw API `state` and `termination_reason`.
|
|
576
|
+
*
|
|
577
|
+
* Mapping rules:
|
|
578
|
+
* - PENDING / PROCESSING → passed through as-is
|
|
579
|
+
* - TERMINATED + SYSTEM_ERROR or USER_ERROR → FAILED
|
|
580
|
+
* - TERMINATED + SKIPPED → SKIPPED
|
|
581
|
+
* - TERMINATED (otherwise) → COMPLETED
|
|
582
|
+
*
|
|
583
|
+
* @param item - Raw item response from the API
|
|
584
|
+
*/
|
|
585
|
+
declare function getItemStatus(item: ItemResultReadResponse): ItemStatus;
|
|
586
|
+
|
|
587
|
+
export { APIError, ApplicationReadResponse, ApplicationReadShortResponse, type ApplicationRun, type ApplicationRunItem, AuthenticationError, BaseError, ConfigurationError, ItemResultReadResponse, ItemState, type ItemStatus, ItemTerminationReason, type PlatformSDK, type PlatformSDKConfig, PlatformSDKHttp, RunCreationRequest, RunCreationResponse, RunReadResponse, type TokenProvider, VersionReadResponse, canDownloadItem, canDownloadRunItems, PlatformSDKHttp as default, getItemStatus, getRunProgress, getRunStatus, processApplicationRun, processRunItem };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { f as ApplicationVersion, g as ArtifactOutput, h as ArtifactState, i as ArtifactTerminationReason,
|
|
1
|
+
import { R as RunReadResponse, I as ItemResultReadResponse, A as ApplicationReadShortResponse, a as ApplicationReadResponse, b as RunCreationRequest, c as RunCreationResponse, d as ItemState, e as ItemTerminationReason, V as VersionReadResponse } from './api-CWohsFN3.js';
|
|
2
|
+
export { f as ApplicationVersion, g as ArtifactOutput, h as ArtifactState, i as ArtifactTerminationReason, a0 as Configuration, $ as ConfigurationParameters, C as CustomMetadataUpdateRequest, j as CustomMetadataUpdateResponse, H as HTTPValidationError, k as InputArtifact, l as InputArtifactCreationRequest, m as ItemCreationRequest, n as ItemOutput, M as MeReadResponse, O as OrganizationReadResponse, o as OutputArtifact, p as OutputArtifactResultReadResponse, q as OutputArtifactScope, r as OutputArtifactVisibility, _ as PublicApi, E as PublicApiApplicationVersionDetailsV1ApplicationsApplicationIdVersionsVersionGetRequest, P as PublicApiAxiosParamCreator, F as PublicApiCancelRunV1RunsRunIdCancelPostRequest, G as PublicApiCreateRunV1RunsPostRequest, J as PublicApiDeleteRunItemsV1RunsRunIdArtifactsDeleteRequest, B as PublicApiFactory, z as PublicApiFp, K as PublicApiGetArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGetRequest, L as PublicApiGetItemByRunV1RunsRunIdItemsExternalIdGetRequest, N as PublicApiGetRunV1RunsRunIdGetRequest, D as PublicApiInterface, Q as PublicApiListApplicationsV1ApplicationsGetRequest, T as PublicApiListRunItemsV1RunsRunIdItemsGetRequest, W as PublicApiListRunsV1RunsGetRequest, X as PublicApiPutItemCustomMetadataByRunV1RunsRunIdItemsExternalIdCustomMetadataPutRequest, Y as PublicApiPutRunCustomMetadataV1RunsRunIdCustomMetadataPutRequest, Z as PublicApiReadApplicationByIdV1ApplicationsApplicationIdGetRequest, s as RunItemStatistics, t as RunOutput, u as RunState, v as RunTerminationReason, S as SchedulingRequest, w as SchedulingResponse, U as UserReadResponse, x as ValidationError, y as ValidationErrorLocInner } from './api-CWohsFN3.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Enriched application run entity that extends the raw API response
|
|
7
|
+
* with computed properties derived from run state and statistics.
|
|
8
|
+
*
|
|
9
|
+
* Returned by `PlatformSDKHttp.listApplicationRuns()` and `PlatformSDKHttp.getRun()`
|
|
10
|
+
* instead of the raw `RunReadResponse`.
|
|
11
|
+
*/
|
|
12
|
+
interface ApplicationRun extends RunReadResponse {
|
|
13
|
+
/** Percentage of items processed (0–100), computed from run statistics. */
|
|
14
|
+
progress: number;
|
|
15
|
+
/** Human-readable status derived from `state` and `termination_reason`. */
|
|
16
|
+
status: RunStatus;
|
|
17
|
+
/** Whether the run's result items are available for download. */
|
|
18
|
+
can_download: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Derived run status that simplifies the raw `state` + `termination_reason` combination. */
|
|
21
|
+
type RunStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'COMPLETED_WITH_ERRORS' | 'CANCELED' | 'FAILED';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Enriched run-item entity that extends the raw API response
|
|
25
|
+
* with computed properties derived from item state and termination reason.
|
|
26
|
+
*
|
|
27
|
+
* Returned by `PlatformSDKHttp.listRunResults()` instead of the raw
|
|
28
|
+
* `ItemResultReadResponse`.
|
|
29
|
+
*/
|
|
30
|
+
interface ApplicationRunItem extends ItemResultReadResponse {
|
|
31
|
+
/** Whether the item's output artifact is available for download. */
|
|
32
|
+
can_download: boolean;
|
|
33
|
+
/** Human-readable status derived from `state` and `termination_reason`. */
|
|
34
|
+
status: string;
|
|
35
|
+
}
|
|
36
|
+
/** Derived item status that simplifies the raw `state` + `termination_reason` combination. */
|
|
37
|
+
type ItemStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'SKIPPED';
|
|
38
|
+
|
|
5
39
|
/**
|
|
6
40
|
* Token provider function that returns a valid access token
|
|
7
41
|
*/
|
|
@@ -37,9 +71,9 @@ interface PlatformSDK {
|
|
|
37
71
|
pageSize?: number;
|
|
38
72
|
customMetadata?: string;
|
|
39
73
|
sort?: string[];
|
|
40
|
-
}): Promise<
|
|
74
|
+
}): Promise<ApplicationRun[]>;
|
|
41
75
|
createApplicationRun(request: RunCreationRequest): Promise<RunCreationResponse>;
|
|
42
|
-
getRun(applicationRunId: string): Promise<
|
|
76
|
+
getRun(applicationRunId: string): Promise<ApplicationRun>;
|
|
43
77
|
cancelApplicationRun(applicationRunId: string): Promise<void>;
|
|
44
78
|
listRunResults(applicationRunId: string, options?: {
|
|
45
79
|
page?: number;
|
|
@@ -48,7 +82,7 @@ interface PlatformSDK {
|
|
|
48
82
|
externalIdIn?: string[];
|
|
49
83
|
state?: ItemState;
|
|
50
84
|
terminationReason?: ItemTerminationReason;
|
|
51
|
-
}): Promise<
|
|
85
|
+
}): Promise<ApplicationRunItem[]>;
|
|
52
86
|
getApplicationVersionDetails(applicationId: string, version: string): Promise<VersionReadResponse>;
|
|
53
87
|
}
|
|
54
88
|
/**
|
|
@@ -215,7 +249,7 @@ declare class PlatformSDKHttp implements PlatformSDK {
|
|
|
215
249
|
sort?: string[];
|
|
216
250
|
page?: number;
|
|
217
251
|
pageSize?: number;
|
|
218
|
-
}): Promise<
|
|
252
|
+
}): Promise<ApplicationRun[]>;
|
|
219
253
|
/**
|
|
220
254
|
* Create and submit a new application run for processing
|
|
221
255
|
*
|
|
@@ -280,7 +314,7 @@ declare class PlatformSDKHttp implements PlatformSDK {
|
|
|
280
314
|
* }
|
|
281
315
|
* ```
|
|
282
316
|
*/
|
|
283
|
-
getRun(applicationRunId: string): Promise<
|
|
317
|
+
getRun(applicationRunId: string): Promise<ApplicationRun>;
|
|
284
318
|
/**
|
|
285
319
|
* Cancel a running or queued application run
|
|
286
320
|
*
|
|
@@ -346,7 +380,7 @@ declare class PlatformSDKHttp implements PlatformSDK {
|
|
|
346
380
|
externalIdIn?: string[];
|
|
347
381
|
state?: ItemState;
|
|
348
382
|
terminationReason?: ItemTerminationReason;
|
|
349
|
-
}): Promise<
|
|
383
|
+
}): Promise<ApplicationRunItem[]>;
|
|
350
384
|
/**
|
|
351
385
|
* Get the current version of the SDK
|
|
352
386
|
*
|
|
@@ -474,4 +508,80 @@ declare class ConfigurationError extends BaseError {
|
|
|
474
508
|
constructor(message: string, options?: BaseErrorOptions);
|
|
475
509
|
}
|
|
476
510
|
|
|
477
|
-
|
|
511
|
+
/**
|
|
512
|
+
* Transform a raw {@link RunReadResponse} from the API into an enriched
|
|
513
|
+
* {@link ApplicationRun} by computing derived properties (progress, status, can_download).
|
|
514
|
+
*
|
|
515
|
+
* This is the single entry-point used by `PlatformSDKHttp` methods to map API
|
|
516
|
+
* responses before returning them to consumers.
|
|
517
|
+
*
|
|
518
|
+
* @param run - Raw run response from the API
|
|
519
|
+
* @returns Enriched run entity with computed properties spread onto the original response
|
|
520
|
+
*/
|
|
521
|
+
declare const processApplicationRun: (run: RunReadResponse) => ApplicationRun;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Compute the overall progress of a run as a percentage (0–100).
|
|
525
|
+
* Progress is based on the ratio of terminal items (succeeded + errored + skipped)
|
|
526
|
+
* to the total item count.
|
|
527
|
+
*
|
|
528
|
+
* @param run - Raw run response from the API
|
|
529
|
+
* @returns Integer percentage rounded to the nearest whole number
|
|
530
|
+
*/
|
|
531
|
+
declare function getRunProgress(run: RunReadResponse): number;
|
|
532
|
+
/**
|
|
533
|
+
* Derive a human-readable {@link RunStatus} from the raw API `state` and `termination_reason`.
|
|
534
|
+
*
|
|
535
|
+
* Mapping rules:
|
|
536
|
+
* - PENDING / PROCESSING → passed through as-is
|
|
537
|
+
* - TERMINATED + CANCELED_BY_USER → CANCELED
|
|
538
|
+
* - TERMINATED + CANCELED_BY_SYSTEM → FAILED
|
|
539
|
+
* - TERMINATED + not all items succeeded → COMPLETED_WITH_ERRORS
|
|
540
|
+
* - TERMINATED + all items succeeded → COMPLETED
|
|
541
|
+
*
|
|
542
|
+
* @param run - Raw run response from the API
|
|
543
|
+
*/
|
|
544
|
+
declare function getRunStatus(run: RunReadResponse): RunStatus;
|
|
545
|
+
/**
|
|
546
|
+
* Determine whether a run's result items are available for download.
|
|
547
|
+
* Items can only be downloaded once the run has reached a completed state.
|
|
548
|
+
*
|
|
549
|
+
* @param run - Raw run response from the API
|
|
550
|
+
* @returns `true` if items are available for download (run is COMPLETED or COMPLETED_WITH_ERRORS)
|
|
551
|
+
*/
|
|
552
|
+
declare const canDownloadRunItems: (run: RunReadResponse) => boolean;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Transform a raw {@link ItemResultReadResponse} from the API into an enriched
|
|
556
|
+
* {@link ApplicationRunItem} by computing derived properties (status, can_download).
|
|
557
|
+
*
|
|
558
|
+
* This is the single entry-point used by `PlatformSDKHttp.listRunResults()` to
|
|
559
|
+
* map API responses before returning them to consumers.
|
|
560
|
+
*
|
|
561
|
+
* @param item - Raw item response from the API
|
|
562
|
+
* @returns Enriched item entity with computed properties spread onto the original response
|
|
563
|
+
*/
|
|
564
|
+
declare const processRunItem: (item: ItemResultReadResponse) => ApplicationRunItem;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Determine whether a single run item's output artifact is available for download.
|
|
568
|
+
* Only items in the COMPLETED state have downloadable artifacts.
|
|
569
|
+
*
|
|
570
|
+
* @param item - Raw item response from the API
|
|
571
|
+
* @returns `true` if the item is in a COMPLETED state
|
|
572
|
+
*/
|
|
573
|
+
declare const canDownloadItem: (item: ItemResultReadResponse) => boolean;
|
|
574
|
+
/**
|
|
575
|
+
* Derive a human-readable {@link ItemStatus} from the raw API `state` and `termination_reason`.
|
|
576
|
+
*
|
|
577
|
+
* Mapping rules:
|
|
578
|
+
* - PENDING / PROCESSING → passed through as-is
|
|
579
|
+
* - TERMINATED + SYSTEM_ERROR or USER_ERROR → FAILED
|
|
580
|
+
* - TERMINATED + SKIPPED → SKIPPED
|
|
581
|
+
* - TERMINATED (otherwise) → COMPLETED
|
|
582
|
+
*
|
|
583
|
+
* @param item - Raw item response from the API
|
|
584
|
+
*/
|
|
585
|
+
declare function getItemStatus(item: ItemResultReadResponse): ItemStatus;
|
|
586
|
+
|
|
587
|
+
export { APIError, ApplicationReadResponse, ApplicationReadShortResponse, type ApplicationRun, type ApplicationRunItem, AuthenticationError, BaseError, ConfigurationError, ItemResultReadResponse, ItemState, type ItemStatus, ItemTerminationReason, type PlatformSDK, type PlatformSDKConfig, PlatformSDKHttp, RunCreationRequest, RunCreationResponse, RunReadResponse, type TokenProvider, VersionReadResponse, canDownloadItem, canDownloadRunItems, PlatformSDKHttp as default, getItemStatus, getRunProgress, getRunStatus, processApplicationRun, processRunItem };
|
package/dist/index.js
CHANGED
|
@@ -246,6 +246,35 @@ var PublicApiAxiosParamCreator = function(configuration) {
|
|
|
246
246
|
options: localVarRequestOptions
|
|
247
247
|
};
|
|
248
248
|
},
|
|
249
|
+
/**
|
|
250
|
+
* Download the artifact file with the specified artifact_id, belonging to the specified run. The artifact_is is returned by the `GET /v1/runs/{run_id}/items` endpoint as part of the item results, and can also be retrieved via `GET /v1/runs/{run_id}/items/{external_id}`. The endpoint may return a redirect response with a presigned URL to download the artifact file from the storage bucket. The presigned URL is valid for a limited time, so it should be used immediately after receiving the response.
|
|
251
|
+
* @summary Get Artifact Url
|
|
252
|
+
* @param {string} runId Run id, returned by `POST /runs/` endpoint
|
|
253
|
+
* @param {string} artifactId The artifact id to download
|
|
254
|
+
* @param {*} [options] Override http request option.
|
|
255
|
+
* @throws {RequiredError}
|
|
256
|
+
*/
|
|
257
|
+
getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet: async (runId, artifactId, options = {}) => {
|
|
258
|
+
assertParamExists("getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet", "runId", runId);
|
|
259
|
+
assertParamExists("getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet", "artifactId", artifactId);
|
|
260
|
+
const localVarPath = `/v1/runs/{run_id}/artifacts/{artifact_id}/file`.replace(`{${"run_id"}}`, encodeURIComponent(String(runId))).replace(`{${"artifact_id"}}`, encodeURIComponent(String(artifactId)));
|
|
261
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
262
|
+
let baseOptions;
|
|
263
|
+
if (configuration) {
|
|
264
|
+
baseOptions = configuration.baseOptions;
|
|
265
|
+
}
|
|
266
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
267
|
+
const localVarHeaderParameter = {};
|
|
268
|
+
const localVarQueryParameter = {};
|
|
269
|
+
await setOAuthToObject(localVarHeaderParameter, "OAuth2AuthorizationCodeBearer", [], configuration);
|
|
270
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
271
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
272
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
273
|
+
return {
|
|
274
|
+
url: toPathString(localVarUrlObj),
|
|
275
|
+
options: localVarRequestOptions
|
|
276
|
+
};
|
|
277
|
+
},
|
|
249
278
|
/**
|
|
250
279
|
* Retrieve details of a specific item (slide) by its external ID and the run ID.
|
|
251
280
|
* @summary Get Item By Run
|
|
@@ -432,11 +461,12 @@ var PublicApiAxiosParamCreator = function(configuration) {
|
|
|
432
461
|
* @param {string | null} [customMetadata] Use PostgreSQL JSONPath expressions to filter runs by their custom_metadata. #### URL Encoding Required **Important**: JSONPath expressions contain special characters that must be URL-encoded when used in query parameters. Most HTTP clients handle this automatically, but when constructing URLs manually, please ensure proper encoding. #### Examples (Clear Format): - **Field existence**: `$.study` - Runs that have a study field defined - **Exact value match**: `$.study ? (@ == \"high\")` - Runs with specific study value - **Numeric comparison**: `$.confidence_score ? (@ > 0.75)` - Runs with confidence score greater than 0.75 - **Array operations**: `$.tags[*] ? (@ == \"draft\")` - Runs with tags array containing \"draft\" - **Complex conditions**: `$.resources ? (@.gpu_count > 2 && @.memory_gb >= 16)` - Runs with high resource requirements #### Examples (URL-Encoded Format): - **Field existence**: `%24.study` - **Exact value match**: `%24.study%20%3F%20(%40%20%3D%3D%20%22high%22)` - **Numeric comparison**: `%24.confidence_score%20%3F%20(%40%20%3E%200.75)` - **Array operations**: `%24.tags%5B*%5D%20%3F%20(%40%20%3D%3D%20%22draft%22)` - **Complex conditions**: `%24.resources%20%3F%20(%40.gpu_count%20%3E%202%20%26%26%20%40.memory_gb%20%3E%3D%2016)` #### Notes - JSONPath expressions are evaluated using PostgreSQL\'s `@?` operator - The `$.` prefix is automatically added to root-level field references if missing - String values in conditions must be enclosed in double quotes - Use `&&` for AND operations and `||` for OR operations - Regular expressions use `like_regex` with standard regex syntax - **Please remember to URL-encode the entire JSONPath expression when making HTTP requests**
|
|
433
462
|
* @param {number} [page]
|
|
434
463
|
* @param {number} [pageSize]
|
|
464
|
+
* @param {string | null} [forOrganization] Filter runs by organization ID. Available for superadmins (any org) and admins (own org only). When provided, returns all runs for the specified organization instead of only the caller\'s own runs.
|
|
435
465
|
* @param {Array<string> | null} [sort] Sort the results by one or more fields. Use `+` for ascending and `-` for descending order. **Available fields:** - `run_id` - `application_id` - `version_number` - `custom_metadata` - `submitted_at` - `submitted_by` - `terminated_at` - `termination_reason` **Examples:** - `?sort=submitted_at` - Sort by creation time (ascending) - `?sort=-submitted_at` - Sort by creation time (descending) - `?sort=state&sort=-submitted_at` - Sort by state, then by time (descending)
|
|
436
466
|
* @param {*} [options] Override http request option.
|
|
437
467
|
* @throws {RequiredError}
|
|
438
468
|
*/
|
|
439
|
-
listRunsV1RunsGet: async (applicationId, applicationVersion, externalId, customMetadata, page, pageSize, sort, options = {}) => {
|
|
469
|
+
listRunsV1RunsGet: async (applicationId, applicationVersion, externalId, customMetadata, page, pageSize, forOrganization, sort, options = {}) => {
|
|
440
470
|
const localVarPath = `/v1/runs`;
|
|
441
471
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
442
472
|
let baseOptions;
|
|
@@ -465,6 +495,9 @@ var PublicApiAxiosParamCreator = function(configuration) {
|
|
|
465
495
|
if (pageSize !== void 0) {
|
|
466
496
|
localVarQueryParameter["page_size"] = pageSize;
|
|
467
497
|
}
|
|
498
|
+
if (forOrganization !== void 0) {
|
|
499
|
+
localVarQueryParameter["for_organization"] = forOrganization;
|
|
500
|
+
}
|
|
468
501
|
if (sort) {
|
|
469
502
|
localVarQueryParameter["sort"] = sort;
|
|
470
503
|
}
|
|
@@ -625,6 +658,20 @@ var PublicApiFp = function(configuration) {
|
|
|
625
658
|
const localVarOperationServerBasePath = operationServerMap["PublicApi.deleteRunItemsV1RunsRunIdArtifactsDelete"]?.[localVarOperationServerIndex]?.url;
|
|
626
659
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
627
660
|
},
|
|
661
|
+
/**
|
|
662
|
+
* Download the artifact file with the specified artifact_id, belonging to the specified run. The artifact_is is returned by the `GET /v1/runs/{run_id}/items` endpoint as part of the item results, and can also be retrieved via `GET /v1/runs/{run_id}/items/{external_id}`. The endpoint may return a redirect response with a presigned URL to download the artifact file from the storage bucket. The presigned URL is valid for a limited time, so it should be used immediately after receiving the response.
|
|
663
|
+
* @summary Get Artifact Url
|
|
664
|
+
* @param {string} runId Run id, returned by `POST /runs/` endpoint
|
|
665
|
+
* @param {string} artifactId The artifact id to download
|
|
666
|
+
* @param {*} [options] Override http request option.
|
|
667
|
+
* @throws {RequiredError}
|
|
668
|
+
*/
|
|
669
|
+
async getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet(runId, artifactId, options) {
|
|
670
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet(runId, artifactId, options);
|
|
671
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
672
|
+
const localVarOperationServerBasePath = operationServerMap["PublicApi.getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet"]?.[localVarOperationServerIndex]?.url;
|
|
673
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
674
|
+
},
|
|
628
675
|
/**
|
|
629
676
|
* Retrieve details of a specific item (slide) by its external ID and the run ID.
|
|
630
677
|
* @summary Get Item By Run
|
|
@@ -709,12 +756,13 @@ var PublicApiFp = function(configuration) {
|
|
|
709
756
|
* @param {string | null} [customMetadata] Use PostgreSQL JSONPath expressions to filter runs by their custom_metadata. #### URL Encoding Required **Important**: JSONPath expressions contain special characters that must be URL-encoded when used in query parameters. Most HTTP clients handle this automatically, but when constructing URLs manually, please ensure proper encoding. #### Examples (Clear Format): - **Field existence**: `$.study` - Runs that have a study field defined - **Exact value match**: `$.study ? (@ == \"high\")` - Runs with specific study value - **Numeric comparison**: `$.confidence_score ? (@ > 0.75)` - Runs with confidence score greater than 0.75 - **Array operations**: `$.tags[*] ? (@ == \"draft\")` - Runs with tags array containing \"draft\" - **Complex conditions**: `$.resources ? (@.gpu_count > 2 && @.memory_gb >= 16)` - Runs with high resource requirements #### Examples (URL-Encoded Format): - **Field existence**: `%24.study` - **Exact value match**: `%24.study%20%3F%20(%40%20%3D%3D%20%22high%22)` - **Numeric comparison**: `%24.confidence_score%20%3F%20(%40%20%3E%200.75)` - **Array operations**: `%24.tags%5B*%5D%20%3F%20(%40%20%3D%3D%20%22draft%22)` - **Complex conditions**: `%24.resources%20%3F%20(%40.gpu_count%20%3E%202%20%26%26%20%40.memory_gb%20%3E%3D%2016)` #### Notes - JSONPath expressions are evaluated using PostgreSQL\'s `@?` operator - The `$.` prefix is automatically added to root-level field references if missing - String values in conditions must be enclosed in double quotes - Use `&&` for AND operations and `||` for OR operations - Regular expressions use `like_regex` with standard regex syntax - **Please remember to URL-encode the entire JSONPath expression when making HTTP requests**
|
|
710
757
|
* @param {number} [page]
|
|
711
758
|
* @param {number} [pageSize]
|
|
759
|
+
* @param {string | null} [forOrganization] Filter runs by organization ID. Available for superadmins (any org) and admins (own org only). When provided, returns all runs for the specified organization instead of only the caller\'s own runs.
|
|
712
760
|
* @param {Array<string> | null} [sort] Sort the results by one or more fields. Use `+` for ascending and `-` for descending order. **Available fields:** - `run_id` - `application_id` - `version_number` - `custom_metadata` - `submitted_at` - `submitted_by` - `terminated_at` - `termination_reason` **Examples:** - `?sort=submitted_at` - Sort by creation time (ascending) - `?sort=-submitted_at` - Sort by creation time (descending) - `?sort=state&sort=-submitted_at` - Sort by state, then by time (descending)
|
|
713
761
|
* @param {*} [options] Override http request option.
|
|
714
762
|
* @throws {RequiredError}
|
|
715
763
|
*/
|
|
716
|
-
async listRunsV1RunsGet(applicationId, applicationVersion, externalId, customMetadata, page, pageSize, sort, options) {
|
|
717
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.listRunsV1RunsGet(applicationId, applicationVersion, externalId, customMetadata, page, pageSize, sort, options);
|
|
764
|
+
async listRunsV1RunsGet(applicationId, applicationVersion, externalId, customMetadata, page, pageSize, forOrganization, sort, options) {
|
|
765
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.listRunsV1RunsGet(applicationId, applicationVersion, externalId, customMetadata, page, pageSize, forOrganization, sort, options);
|
|
718
766
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
719
767
|
const localVarOperationServerBasePath = operationServerMap["PublicApi.listRunsV1RunsGet"]?.[localVarOperationServerIndex]?.url;
|
|
720
768
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
@@ -806,6 +854,16 @@ var PublicApiFactory = function(configuration, basePath, axios) {
|
|
|
806
854
|
deleteRunItemsV1RunsRunIdArtifactsDelete(requestParameters, options) {
|
|
807
855
|
return localVarFp.deleteRunItemsV1RunsRunIdArtifactsDelete(requestParameters.runId, options).then((request) => request(axios, basePath));
|
|
808
856
|
},
|
|
857
|
+
/**
|
|
858
|
+
* Download the artifact file with the specified artifact_id, belonging to the specified run. The artifact_is is returned by the `GET /v1/runs/{run_id}/items` endpoint as part of the item results, and can also be retrieved via `GET /v1/runs/{run_id}/items/{external_id}`. The endpoint may return a redirect response with a presigned URL to download the artifact file from the storage bucket. The presigned URL is valid for a limited time, so it should be used immediately after receiving the response.
|
|
859
|
+
* @summary Get Artifact Url
|
|
860
|
+
* @param {PublicApiGetArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGetRequest} requestParameters Request parameters.
|
|
861
|
+
* @param {*} [options] Override http request option.
|
|
862
|
+
* @throws {RequiredError}
|
|
863
|
+
*/
|
|
864
|
+
getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet(requestParameters, options) {
|
|
865
|
+
return localVarFp.getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet(requestParameters.runId, requestParameters.artifactId, options).then((request) => request(axios, basePath));
|
|
866
|
+
},
|
|
809
867
|
/**
|
|
810
868
|
* Retrieve details of a specific item (slide) by its external ID and the run ID.
|
|
811
869
|
* @summary Get Item By Run
|
|
@@ -863,7 +921,7 @@ var PublicApiFactory = function(configuration, basePath, axios) {
|
|
|
863
921
|
* @throws {RequiredError}
|
|
864
922
|
*/
|
|
865
923
|
listRunsV1RunsGet(requestParameters = {}, options) {
|
|
866
|
-
return localVarFp.listRunsV1RunsGet(requestParameters.applicationId, requestParameters.applicationVersion, requestParameters.externalId, requestParameters.customMetadata, requestParameters.page, requestParameters.pageSize, requestParameters.sort, options).then((request) => request(axios, basePath));
|
|
924
|
+
return localVarFp.listRunsV1RunsGet(requestParameters.applicationId, requestParameters.applicationVersion, requestParameters.externalId, requestParameters.customMetadata, requestParameters.page, requestParameters.pageSize, requestParameters.forOrganization, requestParameters.sort, options).then((request) => request(axios, basePath));
|
|
867
925
|
},
|
|
868
926
|
/**
|
|
869
927
|
* Update the custom metadata of the item with the specified `external_id`, belonging to the specified run. Optionally, a checksum may be provided along the custom metadata JSON. It can be used to verify if the custom metadata was updated since the last time it was accessed. If the checksum is provided, it must match the existing custom metadata in the system, ensuring that the current custom metadata value to be overwritten is acknowledged by the user. If no checksum is provided, submitted metadata directly overwrites the existing metadata, without any checks. The latest custom metadata and checksum can be retrieved for individual items via `GET /v1/runs/{run_id}/items/{external_id}`, and for all items of a run via `GET /v1/runs/{run_id}/items`.
|
|
@@ -942,6 +1000,17 @@ var PublicApi = class extends BaseAPI {
|
|
|
942
1000
|
deleteRunItemsV1RunsRunIdArtifactsDelete(requestParameters, options) {
|
|
943
1001
|
return PublicApiFp(this.configuration).deleteRunItemsV1RunsRunIdArtifactsDelete(requestParameters.runId, options).then((request) => request(this.axios, this.basePath));
|
|
944
1002
|
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Download the artifact file with the specified artifact_id, belonging to the specified run. The artifact_is is returned by the `GET /v1/runs/{run_id}/items` endpoint as part of the item results, and can also be retrieved via `GET /v1/runs/{run_id}/items/{external_id}`. The endpoint may return a redirect response with a presigned URL to download the artifact file from the storage bucket. The presigned URL is valid for a limited time, so it should be used immediately after receiving the response.
|
|
1005
|
+
* @summary Get Artifact Url
|
|
1006
|
+
* @param {PublicApiGetArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGetRequest} requestParameters Request parameters.
|
|
1007
|
+
* @param {*} [options] Override http request option.
|
|
1008
|
+
* @throws {RequiredError}
|
|
1009
|
+
* @memberof PublicApi
|
|
1010
|
+
*/
|
|
1011
|
+
getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet(requestParameters, options) {
|
|
1012
|
+
return PublicApiFp(this.configuration).getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet(requestParameters.runId, requestParameters.artifactId, options).then((request) => request(this.axios, this.basePath));
|
|
1013
|
+
}
|
|
945
1014
|
/**
|
|
946
1015
|
* Retrieve details of a specific item (slide) by its external ID and the run ID.
|
|
947
1016
|
* @summary Get Item By Run
|
|
@@ -1005,7 +1074,7 @@ var PublicApi = class extends BaseAPI {
|
|
|
1005
1074
|
* @memberof PublicApi
|
|
1006
1075
|
*/
|
|
1007
1076
|
listRunsV1RunsGet(requestParameters = {}, options) {
|
|
1008
|
-
return PublicApiFp(this.configuration).listRunsV1RunsGet(requestParameters.applicationId, requestParameters.applicationVersion, requestParameters.externalId, requestParameters.customMetadata, requestParameters.page, requestParameters.pageSize, requestParameters.sort, options).then((request) => request(this.axios, this.basePath));
|
|
1077
|
+
return PublicApiFp(this.configuration).listRunsV1RunsGet(requestParameters.applicationId, requestParameters.applicationVersion, requestParameters.externalId, requestParameters.customMetadata, requestParameters.page, requestParameters.pageSize, requestParameters.forOrganization, requestParameters.sort, options).then((request) => request(this.axios, this.basePath));
|
|
1009
1078
|
}
|
|
1010
1079
|
/**
|
|
1011
1080
|
* Update the custom metadata of the item with the specified `external_id`, belonging to the specified run. Optionally, a checksum may be provided along the custom metadata JSON. It can be used to verify if the custom metadata was updated since the last time it was accessed. If the checksum is provided, it must match the existing custom metadata in the system, ensuring that the current custom metadata value to be overwritten is acknowledged by the user. If no checksum is provided, submitted metadata directly overwrites the existing metadata, without any checks. The latest custom metadata and checksum can be retrieved for individual items via `GET /v1/runs/{run_id}/items/{external_id}`, and for all items of a run via `GET /v1/runs/{run_id}/items`.
|
|
@@ -1215,6 +1284,87 @@ var UnexpectedError = class extends BaseError {
|
|
|
1215
1284
|
super(message, "UNEXPECTED_ERROR", options);
|
|
1216
1285
|
}
|
|
1217
1286
|
};
|
|
1287
|
+
|
|
1288
|
+
// src/entities/application-run/utils.ts
|
|
1289
|
+
function getRunProgress(run) {
|
|
1290
|
+
const {
|
|
1291
|
+
item_count,
|
|
1292
|
+
item_succeeded_count,
|
|
1293
|
+
item_user_error_count,
|
|
1294
|
+
item_system_error_count,
|
|
1295
|
+
item_skipped_count
|
|
1296
|
+
} = run.statistics;
|
|
1297
|
+
if (item_count === 0) return 0;
|
|
1298
|
+
const processed = item_succeeded_count + item_user_error_count + item_system_error_count + item_skipped_count;
|
|
1299
|
+
return Math.round(processed / item_count * 100);
|
|
1300
|
+
}
|
|
1301
|
+
function getRunStatus(run) {
|
|
1302
|
+
const { state, statistics, termination_reason } = run;
|
|
1303
|
+
switch (state) {
|
|
1304
|
+
case "PENDING":
|
|
1305
|
+
return "PENDING";
|
|
1306
|
+
case "PROCESSING":
|
|
1307
|
+
return "PROCESSING";
|
|
1308
|
+
case "TERMINATED":
|
|
1309
|
+
if (termination_reason === "CANCELED_BY_USER") {
|
|
1310
|
+
return "CANCELED";
|
|
1311
|
+
}
|
|
1312
|
+
if (termination_reason === "CANCELED_BY_SYSTEM") {
|
|
1313
|
+
return "FAILED";
|
|
1314
|
+
}
|
|
1315
|
+
if (statistics.item_count !== statistics.item_succeeded_count) {
|
|
1316
|
+
return "COMPLETED_WITH_ERRORS";
|
|
1317
|
+
}
|
|
1318
|
+
return "COMPLETED";
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
var canDownloadRunItems = (run) => {
|
|
1322
|
+
const status = getRunStatus(run);
|
|
1323
|
+
return !["FAILED", "CANCELED", "PENDING", "PROCESSING"].includes(status);
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1326
|
+
// src/entities/application-run/process-application-run.ts
|
|
1327
|
+
var processApplicationRun = (run) => {
|
|
1328
|
+
return {
|
|
1329
|
+
...run,
|
|
1330
|
+
progress: getRunProgress(run),
|
|
1331
|
+
status: getRunStatus(run),
|
|
1332
|
+
can_download: canDownloadRunItems(run)
|
|
1333
|
+
};
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
// src/entities/run-item/utils.ts
|
|
1337
|
+
var canDownloadItem = (item) => {
|
|
1338
|
+
return getItemStatus(item) === "COMPLETED";
|
|
1339
|
+
};
|
|
1340
|
+
function getItemStatus(item) {
|
|
1341
|
+
const { state, termination_reason } = item;
|
|
1342
|
+
switch (state) {
|
|
1343
|
+
case "PENDING":
|
|
1344
|
+
return "PENDING";
|
|
1345
|
+
case "PROCESSING":
|
|
1346
|
+
return "PROCESSING";
|
|
1347
|
+
case "TERMINATED":
|
|
1348
|
+
if (termination_reason === "SYSTEM_ERROR" || termination_reason === "USER_ERROR") {
|
|
1349
|
+
return "FAILED";
|
|
1350
|
+
}
|
|
1351
|
+
if (termination_reason === "SKIPPED") {
|
|
1352
|
+
return "SKIPPED";
|
|
1353
|
+
}
|
|
1354
|
+
return "COMPLETED";
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
// src/entities/run-item/process-run-item.ts
|
|
1359
|
+
var processRunItem = (item) => {
|
|
1360
|
+
return {
|
|
1361
|
+
...item,
|
|
1362
|
+
status: getItemStatus(item),
|
|
1363
|
+
can_download: canDownloadItem(item)
|
|
1364
|
+
};
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
// src/platform-sdk.ts
|
|
1218
1368
|
var validationErrorSchema = z.object({
|
|
1219
1369
|
detail: z.array(
|
|
1220
1370
|
z.object({
|
|
@@ -1481,7 +1631,7 @@ var PlatformSDKHttp = class {
|
|
|
1481
1631
|
page: options?.page,
|
|
1482
1632
|
pageSize: options?.pageSize
|
|
1483
1633
|
});
|
|
1484
|
-
return response.data;
|
|
1634
|
+
return response.data.map(processApplicationRun);
|
|
1485
1635
|
} catch (error) {
|
|
1486
1636
|
handleRequestError(error);
|
|
1487
1637
|
}
|
|
@@ -1566,7 +1716,7 @@ var PlatformSDKHttp = class {
|
|
|
1566
1716
|
const response = await client.getRunV1RunsRunIdGet({
|
|
1567
1717
|
runId: applicationRunId
|
|
1568
1718
|
});
|
|
1569
|
-
return response.data;
|
|
1719
|
+
return processApplicationRun(response.data);
|
|
1570
1720
|
} catch (error) {
|
|
1571
1721
|
handleRequestError(error);
|
|
1572
1722
|
}
|
|
@@ -1657,7 +1807,7 @@ var PlatformSDKHttp = class {
|
|
|
1657
1807
|
state,
|
|
1658
1808
|
terminationReason
|
|
1659
1809
|
});
|
|
1660
|
-
return response.data;
|
|
1810
|
+
return response.data.map(processRunItem);
|
|
1661
1811
|
} catch (error) {
|
|
1662
1812
|
handleRequestError(error);
|
|
1663
1813
|
}
|
|
@@ -1709,6 +1859,6 @@ var PlatformSDKHttp = class {
|
|
|
1709
1859
|
// src/index.ts
|
|
1710
1860
|
var index_default = PlatformSDKHttp;
|
|
1711
1861
|
|
|
1712
|
-
export { APIError, ArtifactOutput, ArtifactState, ArtifactTerminationReason, AuthenticationError, BaseError, Configuration, ConfigurationError, ItemOutput, ItemState, ItemTerminationReason, OutputArtifactScope, OutputArtifactVisibility, PlatformSDKHttp, PublicApi, PublicApiAxiosParamCreator, PublicApiFactory, PublicApiFp, RunOutput, RunState, RunTerminationReason, index_default as default };
|
|
1862
|
+
export { APIError, ArtifactOutput, ArtifactState, ArtifactTerminationReason, AuthenticationError, BaseError, Configuration, ConfigurationError, ItemOutput, ItemState, ItemTerminationReason, OutputArtifactScope, OutputArtifactVisibility, PlatformSDKHttp, PublicApi, PublicApiAxiosParamCreator, PublicApiFactory, PublicApiFp, RunOutput, RunState, RunTerminationReason, canDownloadItem, canDownloadRunItems, index_default as default, getItemStatus, getRunProgress, getRunStatus, processApplicationRun, processRunItem };
|
|
1713
1863
|
//# sourceMappingURL=index.js.map
|
|
1714
1864
|
//# sourceMappingURL=index.js.map
|