@aignostics/sdk 3.5.1 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aignostics-sdk-3.6.1.tgz +0 -0
- package/dist/index.cjs +53 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/aignostics-sdk-3.5.1.tgz +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
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-B0sQ1mLM.cjs';
|
|
2
2
|
export { f as ApplicationVersion, g as ArtifactOutput, h as ArtifactState, i as ArtifactTerminationReason, an as Configuration, am as ConfigurationParameters, C as CustomMetadataUpdateRequest, j as CustomMetadataUpdateResponse, G as GrantCreateRequest, k as GrantReadResponse, l as GrantRelation, H as HTTPValidationError, m as InputArtifact, n as InputArtifactCreationRequest, o as InputArtifactResultReadResponse, p as ItemCreationRequest, q as ItemOutput, M as MeReadResponse, O as OrganizationReadResponse, r as OutputArtifact, s as OutputArtifactResultReadResponse, t as OutputArtifactScope, u as OutputArtifactVisibility, al as PublicApi, Y as PublicApiApplicationVersionDetailsV1ApplicationsApplicationIdVersionsVersionGetRequest, Q as PublicApiAxiosParamCreator, Z as PublicApiCancelRunV1RunsRunIdCancelPostRequest, _ as PublicApiCreateGrantV1AccessGrantsPostRequest, $ as PublicApiCreateRunV1RunsPostRequest, a0 as PublicApiCreateShareTokenV1AccessShareTokensPostRequest, a1 as PublicApiDeleteRunItemsV1RunsRunIdArtifactsDeleteRequest, W as PublicApiFactory, T as PublicApiFp, a2 as PublicApiGetArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGetRequest, a3 as PublicApiGetGrantV1AccessGrantsGrantIdGetRequest, a4 as PublicApiGetItemByRunV1RunsRunIdItemsExternalIdGetRequest, a5 as PublicApiGetRunV1RunsRunIdGetRequest, a6 as PublicApiGetShareTokenV1AccessShareTokensShareTokenIdGetRequest, a8 as PublicApiGetVersionDocumentContentRequest, a9 as PublicApiGetVersionDocumentFileRequest, a7 as PublicApiGetVersionDocumentRequest, X as PublicApiInterface, aa as PublicApiListApplicationsV1ApplicationsGetRequest, ab as PublicApiListGrantsV1AccessGrantsGetRequest, ac as PublicApiListRunItemsV1RunsRunIdItemsGetRequest, ad as PublicApiListRunsV1RunsGetRequest, ae as PublicApiListShareTokensV1AccessShareTokensGetRequest, af as PublicApiListVersionDocumentsRequest, ag as PublicApiPutItemCustomMetadataByRunV1RunsRunIdItemsExternalIdCustomMetadataPutRequest, ah as PublicApiPutRunCustomMetadataV1RunsRunIdCustomMetadataPutRequest, ai as PublicApiReadApplicationByIdV1ApplicationsApplicationIdGetRequest, aj as PublicApiRevokeGrantV1AccessGrantsGrantIdDeleteRequest, ak as PublicApiRevokeShareTokenV1AccessShareTokensShareTokenIdDeleteRequest, v as ResourceType, w as RunItemStatistics, x as RunOutput, y as RunState, z as RunTerminationReason, S as SchedulingRequest, B as SchedulingResponse, D as ShareTokenCreateRequest, E as ShareTokenCreateResponse, F as ShareTokenReadResponse, J as SubjectType, U as UserReadResponse, K as ValidationError, L as ValidationErrorLocInner, N as VersionDocumentResponse, P as VersionDocumentVisibility } from './api-B0sQ1mLM.cjs';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
3
4
|
import 'axios';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -85,6 +86,7 @@ interface PlatformSDK {
|
|
|
85
86
|
}): Promise<ApplicationRunItem[]>;
|
|
86
87
|
getApplicationVersionDetails(applicationId: string, version: string): Promise<VersionReadResponse>;
|
|
87
88
|
downloadArtifact(runId: string, artifactId: string): Promise<ArrayBuffer>;
|
|
89
|
+
downloadArtifactStream(runId: string, artifactId: string): Promise<Readable>;
|
|
88
90
|
}
|
|
89
91
|
/**
|
|
90
92
|
* Main SDK class for interacting with the Aignostics Platform
|
|
@@ -453,6 +455,40 @@ declare class PlatformSDKHttp implements PlatformSDK {
|
|
|
453
455
|
* ```
|
|
454
456
|
*/
|
|
455
457
|
downloadArtifact(runId: string, artifactId: string): Promise<ArrayBuffer>;
|
|
458
|
+
/**
|
|
459
|
+
* Download an artifact file from a completed application run as a stream
|
|
460
|
+
*
|
|
461
|
+
* Prefer this method over `downloadArtifact` when downloading large (e.g. multi-gigabyte)
|
|
462
|
+
* artifacts: instead of buffering the entire file into memory before returning it, this
|
|
463
|
+
* method streams the artifact's bytes as they arrive, keeping memory usage low regardless
|
|
464
|
+
* of the artifact's size.
|
|
465
|
+
*
|
|
466
|
+
* The download is performed with automatic retries for transient failures.
|
|
467
|
+
* Non-retryable HTTP status codes (403, 404, 410, 422) will abort immediately.
|
|
468
|
+
*
|
|
469
|
+
* @param runId - The unique identifier of the application run
|
|
470
|
+
* @param artifactId - The unique identifier of the artifact to download
|
|
471
|
+
* @returns A promise that resolves to a Node.js `Readable` stream yielding the artifact's binary content
|
|
472
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
473
|
+
* @throws {APIError} If the API request fails (e.g., 403, 404, 410, 422, or other HTTP errors)
|
|
474
|
+
* @throws {UnexpectedError} If a non-HTTP error occurs
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```typescript
|
|
478
|
+
* import { pipeline } from 'node:stream/promises';
|
|
479
|
+
* import { createWriteStream } from 'node:fs';
|
|
480
|
+
*
|
|
481
|
+
* const stream = await sdk.downloadArtifactStream('run-123', 'artifact-456');
|
|
482
|
+
* await pipeline(stream, createWriteStream('output.bin'));
|
|
483
|
+
* ```
|
|
484
|
+
*
|
|
485
|
+
* @remarks
|
|
486
|
+
* Retries only cover failures at the initial-request stage (a non-2xx status surfaced from
|
|
487
|
+
* the response headers before the body begins streaming). Once the response body has started
|
|
488
|
+
* streaming, a mid-stream connection drop CANNOT be retried by this method — the consumer must
|
|
489
|
+
* listen for the stream's `error` event and re-download if needed.
|
|
490
|
+
*/
|
|
491
|
+
downloadArtifactStream(runId: string, artifactId: string): Promise<Readable>;
|
|
456
492
|
}
|
|
457
493
|
|
|
458
494
|
type ErrorCode = 'AUTHENTICATION_ERROR' | 'API_ERROR' | 'CONFIGURATION_ERROR' | 'UNEXPECTED_ERROR';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
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-B0sQ1mLM.js';
|
|
2
2
|
export { f as ApplicationVersion, g as ArtifactOutput, h as ArtifactState, i as ArtifactTerminationReason, an as Configuration, am as ConfigurationParameters, C as CustomMetadataUpdateRequest, j as CustomMetadataUpdateResponse, G as GrantCreateRequest, k as GrantReadResponse, l as GrantRelation, H as HTTPValidationError, m as InputArtifact, n as InputArtifactCreationRequest, o as InputArtifactResultReadResponse, p as ItemCreationRequest, q as ItemOutput, M as MeReadResponse, O as OrganizationReadResponse, r as OutputArtifact, s as OutputArtifactResultReadResponse, t as OutputArtifactScope, u as OutputArtifactVisibility, al as PublicApi, Y as PublicApiApplicationVersionDetailsV1ApplicationsApplicationIdVersionsVersionGetRequest, Q as PublicApiAxiosParamCreator, Z as PublicApiCancelRunV1RunsRunIdCancelPostRequest, _ as PublicApiCreateGrantV1AccessGrantsPostRequest, $ as PublicApiCreateRunV1RunsPostRequest, a0 as PublicApiCreateShareTokenV1AccessShareTokensPostRequest, a1 as PublicApiDeleteRunItemsV1RunsRunIdArtifactsDeleteRequest, W as PublicApiFactory, T as PublicApiFp, a2 as PublicApiGetArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGetRequest, a3 as PublicApiGetGrantV1AccessGrantsGrantIdGetRequest, a4 as PublicApiGetItemByRunV1RunsRunIdItemsExternalIdGetRequest, a5 as PublicApiGetRunV1RunsRunIdGetRequest, a6 as PublicApiGetShareTokenV1AccessShareTokensShareTokenIdGetRequest, a8 as PublicApiGetVersionDocumentContentRequest, a9 as PublicApiGetVersionDocumentFileRequest, a7 as PublicApiGetVersionDocumentRequest, X as PublicApiInterface, aa as PublicApiListApplicationsV1ApplicationsGetRequest, ab as PublicApiListGrantsV1AccessGrantsGetRequest, ac as PublicApiListRunItemsV1RunsRunIdItemsGetRequest, ad as PublicApiListRunsV1RunsGetRequest, ae as PublicApiListShareTokensV1AccessShareTokensGetRequest, af as PublicApiListVersionDocumentsRequest, ag as PublicApiPutItemCustomMetadataByRunV1RunsRunIdItemsExternalIdCustomMetadataPutRequest, ah as PublicApiPutRunCustomMetadataV1RunsRunIdCustomMetadataPutRequest, ai as PublicApiReadApplicationByIdV1ApplicationsApplicationIdGetRequest, aj as PublicApiRevokeGrantV1AccessGrantsGrantIdDeleteRequest, ak as PublicApiRevokeShareTokenV1AccessShareTokensShareTokenIdDeleteRequest, v as ResourceType, w as RunItemStatistics, x as RunOutput, y as RunState, z as RunTerminationReason, S as SchedulingRequest, B as SchedulingResponse, D as ShareTokenCreateRequest, E as ShareTokenCreateResponse, F as ShareTokenReadResponse, J as SubjectType, U as UserReadResponse, K as ValidationError, L as ValidationErrorLocInner, N as VersionDocumentResponse, P as VersionDocumentVisibility } from './api-B0sQ1mLM.js';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
3
4
|
import 'axios';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -85,6 +86,7 @@ interface PlatformSDK {
|
|
|
85
86
|
}): Promise<ApplicationRunItem[]>;
|
|
86
87
|
getApplicationVersionDetails(applicationId: string, version: string): Promise<VersionReadResponse>;
|
|
87
88
|
downloadArtifact(runId: string, artifactId: string): Promise<ArrayBuffer>;
|
|
89
|
+
downloadArtifactStream(runId: string, artifactId: string): Promise<Readable>;
|
|
88
90
|
}
|
|
89
91
|
/**
|
|
90
92
|
* Main SDK class for interacting with the Aignostics Platform
|
|
@@ -453,6 +455,40 @@ declare class PlatformSDKHttp implements PlatformSDK {
|
|
|
453
455
|
* ```
|
|
454
456
|
*/
|
|
455
457
|
downloadArtifact(runId: string, artifactId: string): Promise<ArrayBuffer>;
|
|
458
|
+
/**
|
|
459
|
+
* Download an artifact file from a completed application run as a stream
|
|
460
|
+
*
|
|
461
|
+
* Prefer this method over `downloadArtifact` when downloading large (e.g. multi-gigabyte)
|
|
462
|
+
* artifacts: instead of buffering the entire file into memory before returning it, this
|
|
463
|
+
* method streams the artifact's bytes as they arrive, keeping memory usage low regardless
|
|
464
|
+
* of the artifact's size.
|
|
465
|
+
*
|
|
466
|
+
* The download is performed with automatic retries for transient failures.
|
|
467
|
+
* Non-retryable HTTP status codes (403, 404, 410, 422) will abort immediately.
|
|
468
|
+
*
|
|
469
|
+
* @param runId - The unique identifier of the application run
|
|
470
|
+
* @param artifactId - The unique identifier of the artifact to download
|
|
471
|
+
* @returns A promise that resolves to a Node.js `Readable` stream yielding the artifact's binary content
|
|
472
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
473
|
+
* @throws {APIError} If the API request fails (e.g., 403, 404, 410, 422, or other HTTP errors)
|
|
474
|
+
* @throws {UnexpectedError} If a non-HTTP error occurs
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```typescript
|
|
478
|
+
* import { pipeline } from 'node:stream/promises';
|
|
479
|
+
* import { createWriteStream } from 'node:fs';
|
|
480
|
+
*
|
|
481
|
+
* const stream = await sdk.downloadArtifactStream('run-123', 'artifact-456');
|
|
482
|
+
* await pipeline(stream, createWriteStream('output.bin'));
|
|
483
|
+
* ```
|
|
484
|
+
*
|
|
485
|
+
* @remarks
|
|
486
|
+
* Retries only cover failures at the initial-request stage (a non-2xx status surfaced from
|
|
487
|
+
* the response headers before the body begins streaming). Once the response body has started
|
|
488
|
+
* streaming, a mid-stream connection drop CANNOT be retried by this method — the consumer must
|
|
489
|
+
* listen for the stream's `error` event and re-download if needed.
|
|
490
|
+
*/
|
|
491
|
+
downloadArtifactStream(runId: string, artifactId: string): Promise<Readable>;
|
|
456
492
|
}
|
|
457
493
|
|
|
458
494
|
type ErrorCode = 'AUTHENTICATION_ERROR' | 'API_ERROR' | 'CONFIGURATION_ERROR' | 'UNEXPECTED_ERROR';
|
package/dist/index.js
CHANGED
|
@@ -3073,6 +3073,59 @@ var PlatformSDKHttp = class {
|
|
|
3073
3073
|
handleRequestError(error);
|
|
3074
3074
|
}
|
|
3075
3075
|
}
|
|
3076
|
+
/**
|
|
3077
|
+
* Download an artifact file from a completed application run as a stream
|
|
3078
|
+
*
|
|
3079
|
+
* Prefer this method over `downloadArtifact` when downloading large (e.g. multi-gigabyte)
|
|
3080
|
+
* artifacts: instead of buffering the entire file into memory before returning it, this
|
|
3081
|
+
* method streams the artifact's bytes as they arrive, keeping memory usage low regardless
|
|
3082
|
+
* of the artifact's size.
|
|
3083
|
+
*
|
|
3084
|
+
* The download is performed with automatic retries for transient failures.
|
|
3085
|
+
* Non-retryable HTTP status codes (403, 404, 410, 422) will abort immediately.
|
|
3086
|
+
*
|
|
3087
|
+
* @param runId - The unique identifier of the application run
|
|
3088
|
+
* @param artifactId - The unique identifier of the artifact to download
|
|
3089
|
+
* @returns A promise that resolves to a Node.js `Readable` stream yielding the artifact's binary content
|
|
3090
|
+
* @throws {AuthenticationError} If no valid authentication token is available
|
|
3091
|
+
* @throws {APIError} If the API request fails (e.g., 403, 404, 410, 422, or other HTTP errors)
|
|
3092
|
+
* @throws {UnexpectedError} If a non-HTTP error occurs
|
|
3093
|
+
*
|
|
3094
|
+
* @example
|
|
3095
|
+
* ```typescript
|
|
3096
|
+
* import { pipeline } from 'node:stream/promises';
|
|
3097
|
+
* import { createWriteStream } from 'node:fs';
|
|
3098
|
+
*
|
|
3099
|
+
* const stream = await sdk.downloadArtifactStream('run-123', 'artifact-456');
|
|
3100
|
+
* await pipeline(stream, createWriteStream('output.bin'));
|
|
3101
|
+
* ```
|
|
3102
|
+
*
|
|
3103
|
+
* @remarks
|
|
3104
|
+
* Retries only cover failures at the initial-request stage (a non-2xx status surfaced from
|
|
3105
|
+
* the response headers before the body begins streaming). Once the response body has started
|
|
3106
|
+
* streaming, a mid-stream connection drop CANNOT be retried by this method — the consumer must
|
|
3107
|
+
* listen for the stream's `error` event and re-download if needed.
|
|
3108
|
+
*/
|
|
3109
|
+
async downloadArtifactStream(runId, artifactId) {
|
|
3110
|
+
const client = await this.#getClient();
|
|
3111
|
+
try {
|
|
3112
|
+
const response = await downloadWithRetry(
|
|
3113
|
+
() => client.getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet(
|
|
3114
|
+
{
|
|
3115
|
+
runId,
|
|
3116
|
+
artifactId
|
|
3117
|
+
},
|
|
3118
|
+
{
|
|
3119
|
+
responseType: "stream"
|
|
3120
|
+
}
|
|
3121
|
+
),
|
|
3122
|
+
[403, 404, 410, 422]
|
|
3123
|
+
);
|
|
3124
|
+
return response.data;
|
|
3125
|
+
} catch (error) {
|
|
3126
|
+
handleRequestError(error);
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3076
3129
|
};
|
|
3077
3130
|
|
|
3078
3131
|
// src/index.ts
|