@aignostics/sdk 3.3.0 → 3.4.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.cjs CHANGED
@@ -141,6 +141,10 @@ var RunTerminationReason = {
141
141
  CanceledBySystem: "CANCELED_BY_SYSTEM",
142
142
  CanceledByUser: "CANCELED_BY_USER"
143
143
  };
144
+ var VersionDocumentVisibility = {
145
+ Public: "public",
146
+ Internal: "internal"
147
+ };
144
148
  var PublicApiAxiosParamCreator = function(configuration) {
145
149
  return {
146
150
  /**
@@ -365,6 +369,99 @@ var PublicApiAxiosParamCreator = function(configuration) {
365
369
  options: localVarRequestOptions
366
370
  };
367
371
  },
372
+ /**
373
+ * Return metadata for a single public document attached to an application version.
374
+ * @summary Get version document metadata
375
+ * @param {string} applicationId
376
+ * @param {string} version
377
+ * @param {string} name
378
+ * @param {*} [options] Override http request option.
379
+ * @throws {RequiredError}
380
+ */
381
+ getVersionDocument: async (applicationId, version, name, options = {}) => {
382
+ assertParamExists("getVersionDocument", "applicationId", applicationId);
383
+ assertParamExists("getVersionDocument", "version", version);
384
+ assertParamExists("getVersionDocument", "name", name);
385
+ const localVarPath = `/v1/applications/{application_id}/versions/{version}/documents/{name}`.replace(`{${"application_id"}}`, encodeURIComponent(String(applicationId))).replace(`{${"version"}}`, encodeURIComponent(String(version))).replace(`{${"name"}}`, encodeURIComponent(String(name)));
386
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
387
+ let baseOptions;
388
+ if (configuration) {
389
+ baseOptions = configuration.baseOptions;
390
+ }
391
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
392
+ const localVarHeaderParameter = {};
393
+ const localVarQueryParameter = {};
394
+ await setOAuthToObject(localVarHeaderParameter, "OAuth2AuthorizationCodeBearer", [], configuration);
395
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
396
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
397
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
398
+ return {
399
+ url: toPathString(localVarUrlObj),
400
+ options: localVarRequestOptions
401
+ };
402
+ },
403
+ /**
404
+ * 307 redirect to a short-lived GCS signed URL for streaming document content. Unlike ``/file``, no ``Content-Disposition`` override is set — GCS serves the object body with its stored ``Content-Type``. Intended for programmatic clients that follow redirects and consume the content directly. Response carries ``Cache-Control: no-store``.
405
+ * @summary Stream version document content (programmatic)
406
+ * @param {string} applicationId
407
+ * @param {string} version
408
+ * @param {string} name
409
+ * @param {*} [options] Override http request option.
410
+ * @throws {RequiredError}
411
+ */
412
+ getVersionDocumentContent: async (applicationId, version, name, options = {}) => {
413
+ assertParamExists("getVersionDocumentContent", "applicationId", applicationId);
414
+ assertParamExists("getVersionDocumentContent", "version", version);
415
+ assertParamExists("getVersionDocumentContent", "name", name);
416
+ const localVarPath = `/v1/applications/{application_id}/versions/{version}/documents/{name}/content`.replace(`{${"application_id"}}`, encodeURIComponent(String(applicationId))).replace(`{${"version"}}`, encodeURIComponent(String(version))).replace(`{${"name"}}`, encodeURIComponent(String(name)));
417
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
418
+ let baseOptions;
419
+ if (configuration) {
420
+ baseOptions = configuration.baseOptions;
421
+ }
422
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
423
+ const localVarHeaderParameter = {};
424
+ const localVarQueryParameter = {};
425
+ await setOAuthToObject(localVarHeaderParameter, "OAuth2AuthorizationCodeBearer", [], configuration);
426
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
427
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
428
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
429
+ return {
430
+ url: toPathString(localVarUrlObj),
431
+ options: localVarRequestOptions
432
+ };
433
+ },
434
+ /**
435
+ * 307 redirect to a short-lived GCS signed URL for downloading a document. The signed URL includes ``response-content-disposition=attachment; filename=\"<name>\"`` so browsers prompt a save-as dialog rather than rendering inline. Response carries ``Cache-Control: no-store``.
436
+ * @summary Download version document (browser)
437
+ * @param {string} applicationId
438
+ * @param {string} version
439
+ * @param {string} name
440
+ * @param {*} [options] Override http request option.
441
+ * @throws {RequiredError}
442
+ */
443
+ getVersionDocumentFile: async (applicationId, version, name, options = {}) => {
444
+ assertParamExists("getVersionDocumentFile", "applicationId", applicationId);
445
+ assertParamExists("getVersionDocumentFile", "version", version);
446
+ assertParamExists("getVersionDocumentFile", "name", name);
447
+ const localVarPath = `/v1/applications/{application_id}/versions/{version}/documents/{name}/file`.replace(`{${"application_id"}}`, encodeURIComponent(String(applicationId))).replace(`{${"version"}}`, encodeURIComponent(String(version))).replace(`{${"name"}}`, encodeURIComponent(String(name)));
448
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
449
+ let baseOptions;
450
+ if (configuration) {
451
+ baseOptions = configuration.baseOptions;
452
+ }
453
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
454
+ const localVarHeaderParameter = {};
455
+ const localVarQueryParameter = {};
456
+ await setOAuthToObject(localVarHeaderParameter, "OAuth2AuthorizationCodeBearer", [], configuration);
457
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
458
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
459
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
460
+ return {
461
+ url: toPathString(localVarUrlObj),
462
+ options: localVarRequestOptions
463
+ };
464
+ },
368
465
  /**
369
466
  * Returns the list of the applications, available to the caller. The application is available if any of the versions of the application is assigned to the caller\'s organization. The response is paginated and sorted according to the provided parameters.
370
467
  * @summary List available applications
@@ -518,6 +615,35 @@ var PublicApiAxiosParamCreator = function(configuration) {
518
615
  options: localVarRequestOptions
519
616
  };
520
617
  },
618
+ /**
619
+ * List public documents attached to an application version. Returns only documents with ``visibility=public`` and ``status=uploaded``.
620
+ * @summary List version documents
621
+ * @param {string} applicationId
622
+ * @param {string} version
623
+ * @param {*} [options] Override http request option.
624
+ * @throws {RequiredError}
625
+ */
626
+ listVersionDocuments: async (applicationId, version, options = {}) => {
627
+ assertParamExists("listVersionDocuments", "applicationId", applicationId);
628
+ assertParamExists("listVersionDocuments", "version", version);
629
+ const localVarPath = `/v1/applications/{application_id}/versions/{version}/documents`.replace(`{${"application_id"}}`, encodeURIComponent(String(applicationId))).replace(`{${"version"}}`, encodeURIComponent(String(version)));
630
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
631
+ let baseOptions;
632
+ if (configuration) {
633
+ baseOptions = configuration.baseOptions;
634
+ }
635
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
636
+ const localVarHeaderParameter = {};
637
+ const localVarQueryParameter = {};
638
+ await setOAuthToObject(localVarHeaderParameter, "OAuth2AuthorizationCodeBearer", [], configuration);
639
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
640
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
641
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
642
+ return {
643
+ url: toPathString(localVarUrlObj),
644
+ options: localVarRequestOptions
645
+ };
646
+ },
521
647
  /**
522
648
  * 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`.
523
649
  * @summary Put Item Custom Metadata By Run
@@ -720,6 +846,51 @@ var PublicApiFp = function(configuration) {
720
846
  const localVarOperationServerBasePath = operationServerMap["PublicApi.getRunV1RunsRunIdGet"]?.[localVarOperationServerIndex]?.url;
721
847
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
722
848
  },
849
+ /**
850
+ * Return metadata for a single public document attached to an application version.
851
+ * @summary Get version document metadata
852
+ * @param {string} applicationId
853
+ * @param {string} version
854
+ * @param {string} name
855
+ * @param {*} [options] Override http request option.
856
+ * @throws {RequiredError}
857
+ */
858
+ async getVersionDocument(applicationId, version, name, options) {
859
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getVersionDocument(applicationId, version, name, options);
860
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
861
+ const localVarOperationServerBasePath = operationServerMap["PublicApi.getVersionDocument"]?.[localVarOperationServerIndex]?.url;
862
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
863
+ },
864
+ /**
865
+ * 307 redirect to a short-lived GCS signed URL for streaming document content. Unlike ``/file``, no ``Content-Disposition`` override is set — GCS serves the object body with its stored ``Content-Type``. Intended for programmatic clients that follow redirects and consume the content directly. Response carries ``Cache-Control: no-store``.
866
+ * @summary Stream version document content (programmatic)
867
+ * @param {string} applicationId
868
+ * @param {string} version
869
+ * @param {string} name
870
+ * @param {*} [options] Override http request option.
871
+ * @throws {RequiredError}
872
+ */
873
+ async getVersionDocumentContent(applicationId, version, name, options) {
874
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getVersionDocumentContent(applicationId, version, name, options);
875
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
876
+ const localVarOperationServerBasePath = operationServerMap["PublicApi.getVersionDocumentContent"]?.[localVarOperationServerIndex]?.url;
877
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
878
+ },
879
+ /**
880
+ * 307 redirect to a short-lived GCS signed URL for downloading a document. The signed URL includes ``response-content-disposition=attachment; filename=\"<name>\"`` so browsers prompt a save-as dialog rather than rendering inline. Response carries ``Cache-Control: no-store``.
881
+ * @summary Download version document (browser)
882
+ * @param {string} applicationId
883
+ * @param {string} version
884
+ * @param {string} name
885
+ * @param {*} [options] Override http request option.
886
+ * @throws {RequiredError}
887
+ */
888
+ async getVersionDocumentFile(applicationId, version, name, options) {
889
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getVersionDocumentFile(applicationId, version, name, options);
890
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
891
+ const localVarOperationServerBasePath = operationServerMap["PublicApi.getVersionDocumentFile"]?.[localVarOperationServerIndex]?.url;
892
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
893
+ },
723
894
  /**
724
895
  * Returns the list of the applications, available to the caller. The application is available if any of the versions of the application is assigned to the caller\'s organization. The response is paginated and sorted according to the provided parameters.
725
896
  * @summary List available applications
@@ -776,6 +947,20 @@ var PublicApiFp = function(configuration) {
776
947
  const localVarOperationServerBasePath = operationServerMap["PublicApi.listRunsV1RunsGet"]?.[localVarOperationServerIndex]?.url;
777
948
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
778
949
  },
950
+ /**
951
+ * List public documents attached to an application version. Returns only documents with ``visibility=public`` and ``status=uploaded``.
952
+ * @summary List version documents
953
+ * @param {string} applicationId
954
+ * @param {string} version
955
+ * @param {*} [options] Override http request option.
956
+ * @throws {RequiredError}
957
+ */
958
+ async listVersionDocuments(applicationId, version, options) {
959
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listVersionDocuments(applicationId, version, options);
960
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
961
+ const localVarOperationServerBasePath = operationServerMap["PublicApi.listVersionDocuments"]?.[localVarOperationServerIndex]?.url;
962
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
963
+ },
779
964
  /**
780
965
  * 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`.
781
966
  * @summary Put Item Custom Metadata By Run
@@ -902,6 +1087,36 @@ var PublicApiFactory = function(configuration, basePath, axios) {
902
1087
  getRunV1RunsRunIdGet(requestParameters, options) {
903
1088
  return localVarFp.getRunV1RunsRunIdGet(requestParameters.runId, options).then((request) => request(axios, basePath));
904
1089
  },
1090
+ /**
1091
+ * Return metadata for a single public document attached to an application version.
1092
+ * @summary Get version document metadata
1093
+ * @param {PublicApiGetVersionDocumentRequest} requestParameters Request parameters.
1094
+ * @param {*} [options] Override http request option.
1095
+ * @throws {RequiredError}
1096
+ */
1097
+ getVersionDocument(requestParameters, options) {
1098
+ return localVarFp.getVersionDocument(requestParameters.applicationId, requestParameters.version, requestParameters.name, options).then((request) => request(axios, basePath));
1099
+ },
1100
+ /**
1101
+ * 307 redirect to a short-lived GCS signed URL for streaming document content. Unlike ``/file``, no ``Content-Disposition`` override is set — GCS serves the object body with its stored ``Content-Type``. Intended for programmatic clients that follow redirects and consume the content directly. Response carries ``Cache-Control: no-store``.
1102
+ * @summary Stream version document content (programmatic)
1103
+ * @param {PublicApiGetVersionDocumentContentRequest} requestParameters Request parameters.
1104
+ * @param {*} [options] Override http request option.
1105
+ * @throws {RequiredError}
1106
+ */
1107
+ getVersionDocumentContent(requestParameters, options) {
1108
+ return localVarFp.getVersionDocumentContent(requestParameters.applicationId, requestParameters.version, requestParameters.name, options).then((request) => request(axios, basePath));
1109
+ },
1110
+ /**
1111
+ * 307 redirect to a short-lived GCS signed URL for downloading a document. The signed URL includes ``response-content-disposition=attachment; filename=\"<name>\"`` so browsers prompt a save-as dialog rather than rendering inline. Response carries ``Cache-Control: no-store``.
1112
+ * @summary Download version document (browser)
1113
+ * @param {PublicApiGetVersionDocumentFileRequest} requestParameters Request parameters.
1114
+ * @param {*} [options] Override http request option.
1115
+ * @throws {RequiredError}
1116
+ */
1117
+ getVersionDocumentFile(requestParameters, options) {
1118
+ return localVarFp.getVersionDocumentFile(requestParameters.applicationId, requestParameters.version, requestParameters.name, options).then((request) => request(axios, basePath));
1119
+ },
905
1120
  /**
906
1121
  * Returns the list of the applications, available to the caller. The application is available if any of the versions of the application is assigned to the caller\'s organization. The response is paginated and sorted according to the provided parameters.
907
1122
  * @summary List available applications
@@ -932,6 +1147,16 @@ var PublicApiFactory = function(configuration, basePath, axios) {
932
1147
  listRunsV1RunsGet(requestParameters = {}, options) {
933
1148
  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));
934
1149
  },
1150
+ /**
1151
+ * List public documents attached to an application version. Returns only documents with ``visibility=public`` and ``status=uploaded``.
1152
+ * @summary List version documents
1153
+ * @param {PublicApiListVersionDocumentsRequest} requestParameters Request parameters.
1154
+ * @param {*} [options] Override http request option.
1155
+ * @throws {RequiredError}
1156
+ */
1157
+ listVersionDocuments(requestParameters, options) {
1158
+ return localVarFp.listVersionDocuments(requestParameters.applicationId, requestParameters.version, options).then((request) => request(axios, basePath));
1159
+ },
935
1160
  /**
936
1161
  * 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`.
937
1162
  * @summary Put Item Custom Metadata By Run
@@ -1052,6 +1277,39 @@ var PublicApi = class extends BaseAPI {
1052
1277
  getRunV1RunsRunIdGet(requestParameters, options) {
1053
1278
  return PublicApiFp(this.configuration).getRunV1RunsRunIdGet(requestParameters.runId, options).then((request) => request(this.axios, this.basePath));
1054
1279
  }
1280
+ /**
1281
+ * Return metadata for a single public document attached to an application version.
1282
+ * @summary Get version document metadata
1283
+ * @param {PublicApiGetVersionDocumentRequest} requestParameters Request parameters.
1284
+ * @param {*} [options] Override http request option.
1285
+ * @throws {RequiredError}
1286
+ * @memberof PublicApi
1287
+ */
1288
+ getVersionDocument(requestParameters, options) {
1289
+ return PublicApiFp(this.configuration).getVersionDocument(requestParameters.applicationId, requestParameters.version, requestParameters.name, options).then((request) => request(this.axios, this.basePath));
1290
+ }
1291
+ /**
1292
+ * 307 redirect to a short-lived GCS signed URL for streaming document content. Unlike ``/file``, no ``Content-Disposition`` override is set — GCS serves the object body with its stored ``Content-Type``. Intended for programmatic clients that follow redirects and consume the content directly. Response carries ``Cache-Control: no-store``.
1293
+ * @summary Stream version document content (programmatic)
1294
+ * @param {PublicApiGetVersionDocumentContentRequest} requestParameters Request parameters.
1295
+ * @param {*} [options] Override http request option.
1296
+ * @throws {RequiredError}
1297
+ * @memberof PublicApi
1298
+ */
1299
+ getVersionDocumentContent(requestParameters, options) {
1300
+ return PublicApiFp(this.configuration).getVersionDocumentContent(requestParameters.applicationId, requestParameters.version, requestParameters.name, options).then((request) => request(this.axios, this.basePath));
1301
+ }
1302
+ /**
1303
+ * 307 redirect to a short-lived GCS signed URL for downloading a document. The signed URL includes ``response-content-disposition=attachment; filename=\"<name>\"`` so browsers prompt a save-as dialog rather than rendering inline. Response carries ``Cache-Control: no-store``.
1304
+ * @summary Download version document (browser)
1305
+ * @param {PublicApiGetVersionDocumentFileRequest} requestParameters Request parameters.
1306
+ * @param {*} [options] Override http request option.
1307
+ * @throws {RequiredError}
1308
+ * @memberof PublicApi
1309
+ */
1310
+ getVersionDocumentFile(requestParameters, options) {
1311
+ return PublicApiFp(this.configuration).getVersionDocumentFile(requestParameters.applicationId, requestParameters.version, requestParameters.name, options).then((request) => request(this.axios, this.basePath));
1312
+ }
1055
1313
  /**
1056
1314
  * Returns the list of the applications, available to the caller. The application is available if any of the versions of the application is assigned to the caller\'s organization. The response is paginated and sorted according to the provided parameters.
1057
1315
  * @summary List available applications
@@ -1085,6 +1343,17 @@ var PublicApi = class extends BaseAPI {
1085
1343
  listRunsV1RunsGet(requestParameters = {}, options) {
1086
1344
  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));
1087
1345
  }
1346
+ /**
1347
+ * List public documents attached to an application version. Returns only documents with ``visibility=public`` and ``status=uploaded``.
1348
+ * @summary List version documents
1349
+ * @param {PublicApiListVersionDocumentsRequest} requestParameters Request parameters.
1350
+ * @param {*} [options] Override http request option.
1351
+ * @throws {RequiredError}
1352
+ * @memberof PublicApi
1353
+ */
1354
+ listVersionDocuments(requestParameters, options) {
1355
+ return PublicApiFp(this.configuration).listVersionDocuments(requestParameters.applicationId, requestParameters.version, options).then((request) => request(this.axios, this.basePath));
1356
+ }
1088
1357
  /**
1089
1358
  * 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`.
1090
1359
  * @summary Put Item Custom Metadata By Run
@@ -1373,6 +1642,256 @@ var processRunItem = (item) => {
1373
1642
  };
1374
1643
  };
1375
1644
 
1645
+ // ../../node_modules/is-network-error/index.js
1646
+ var objectToString = Object.prototype.toString;
1647
+ var isError = (value) => objectToString.call(value) === "[object Error]";
1648
+ var errorMessages = /* @__PURE__ */ new Set([
1649
+ "network error",
1650
+ // Chrome
1651
+ "NetworkError when attempting to fetch resource.",
1652
+ // Firefox
1653
+ "The Internet connection appears to be offline.",
1654
+ // Safari 16
1655
+ "Network request failed",
1656
+ // `cross-fetch`
1657
+ "fetch failed",
1658
+ // Undici (Node.js)
1659
+ "terminated",
1660
+ // Undici (Node.js)
1661
+ " A network error occurred.",
1662
+ // Bun (WebKit)
1663
+ "Network connection lost"
1664
+ // Cloudflare Workers (fetch)
1665
+ ]);
1666
+ function isNetworkError(error) {
1667
+ const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
1668
+ if (!isValid) {
1669
+ return false;
1670
+ }
1671
+ const { message, stack } = error;
1672
+ if (message === "Load failed") {
1673
+ return stack === void 0 || "__sentry_captured__" in error;
1674
+ }
1675
+ if (message.startsWith("error sending request for url")) {
1676
+ return true;
1677
+ }
1678
+ if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
1679
+ return true;
1680
+ }
1681
+ return errorMessages.has(message);
1682
+ }
1683
+
1684
+ // ../../node_modules/p-retry/index.js
1685
+ function validateRetries(retries) {
1686
+ if (typeof retries === "number") {
1687
+ if (retries < 0) {
1688
+ throw new TypeError("Expected `retries` to be a non-negative number.");
1689
+ }
1690
+ if (Number.isNaN(retries)) {
1691
+ throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.");
1692
+ }
1693
+ } else if (retries !== void 0) {
1694
+ throw new TypeError("Expected `retries` to be a number or Infinity.");
1695
+ }
1696
+ }
1697
+ function validateNumberOption(name, value, { min = 0, allowInfinity = false } = {}) {
1698
+ if (value === void 0) {
1699
+ return;
1700
+ }
1701
+ if (typeof value !== "number" || Number.isNaN(value)) {
1702
+ throw new TypeError(`Expected \`${name}\` to be a number${allowInfinity ? " or Infinity" : ""}.`);
1703
+ }
1704
+ if (!allowInfinity && !Number.isFinite(value)) {
1705
+ throw new TypeError(`Expected \`${name}\` to be a finite number.`);
1706
+ }
1707
+ if (value < min) {
1708
+ throw new TypeError(`Expected \`${name}\` to be \u2265 ${min}.`);
1709
+ }
1710
+ }
1711
+ function validateFunctionOption(name, value) {
1712
+ if (value === void 0) {
1713
+ return;
1714
+ }
1715
+ if (typeof value !== "function") {
1716
+ throw new TypeError(`Expected \`${name}\` to be a function.`);
1717
+ }
1718
+ }
1719
+ var AbortError = class extends Error {
1720
+ constructor(message) {
1721
+ super();
1722
+ if (message instanceof Error) {
1723
+ this.originalError = message;
1724
+ ({ message } = message);
1725
+ } else {
1726
+ this.originalError = new Error(message);
1727
+ this.originalError.stack = this.stack;
1728
+ }
1729
+ this.name = "AbortError";
1730
+ this.message = message;
1731
+ }
1732
+ };
1733
+ function calculateDelay(retriesConsumed, options) {
1734
+ const attempt = Math.max(1, retriesConsumed + 1);
1735
+ const random = options.randomize ? Math.random() + 1 : 1;
1736
+ let timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
1737
+ timeout = Math.min(timeout, options.maxTimeout);
1738
+ return timeout;
1739
+ }
1740
+ function calculateRemainingTime(start, max) {
1741
+ if (!Number.isFinite(max)) {
1742
+ return max;
1743
+ }
1744
+ return max - (performance.now() - start);
1745
+ }
1746
+ async function delayForRetry(delay, options) {
1747
+ if (delay <= 0) {
1748
+ return;
1749
+ }
1750
+ await new Promise((resolve, reject) => {
1751
+ const onAbort = () => {
1752
+ clearTimeout(timeoutToken);
1753
+ options.signal?.removeEventListener("abort", onAbort);
1754
+ reject(options.signal.reason);
1755
+ };
1756
+ const timeoutToken = setTimeout(() => {
1757
+ options.signal?.removeEventListener("abort", onAbort);
1758
+ resolve();
1759
+ }, delay);
1760
+ if (options.unref) {
1761
+ timeoutToken.unref?.();
1762
+ }
1763
+ options.signal?.addEventListener("abort", onAbort, { once: true });
1764
+ });
1765
+ }
1766
+ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTime, options }) {
1767
+ const normalizedError = error instanceof Error ? error : new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
1768
+ if (normalizedError instanceof AbortError) {
1769
+ throw normalizedError.originalError;
1770
+ }
1771
+ const retriesLeft = Number.isFinite(options.retries) ? Math.max(0, options.retries - retriesConsumed) : options.retries;
1772
+ const maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;
1773
+ const delayTime = calculateDelay(retriesConsumed, options);
1774
+ const remainingTimeBeforeCallbacks = calculateRemainingTime(startTime, maxRetryTime);
1775
+ if (remainingTimeBeforeCallbacks <= 0) {
1776
+ const context2 = Object.freeze({
1777
+ error: normalizedError,
1778
+ attemptNumber,
1779
+ retriesLeft,
1780
+ retriesConsumed,
1781
+ retryDelay: 0
1782
+ });
1783
+ await options.onFailedAttempt(context2);
1784
+ throw normalizedError;
1785
+ }
1786
+ const consumeRetryContext = Object.freeze({
1787
+ error: normalizedError,
1788
+ attemptNumber,
1789
+ retriesLeft,
1790
+ retriesConsumed,
1791
+ retryDelay: retriesLeft > 0 ? delayTime : 0
1792
+ });
1793
+ const consumeRetry = await options.shouldConsumeRetry(consumeRetryContext);
1794
+ const effectiveDelay = consumeRetry && retriesLeft > 0 ? delayTime : 0;
1795
+ const context = Object.freeze({
1796
+ error: normalizedError,
1797
+ attemptNumber,
1798
+ retriesLeft,
1799
+ retriesConsumed,
1800
+ retryDelay: effectiveDelay
1801
+ });
1802
+ await options.onFailedAttempt(context);
1803
+ if (calculateRemainingTime(startTime, maxRetryTime) <= 0) {
1804
+ throw normalizedError;
1805
+ }
1806
+ const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
1807
+ if (remainingTime <= 0 || retriesLeft <= 0) {
1808
+ throw normalizedError;
1809
+ }
1810
+ if (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {
1811
+ throw normalizedError;
1812
+ }
1813
+ if (!await options.shouldRetry(context)) {
1814
+ throw normalizedError;
1815
+ }
1816
+ const remainingTimeAfterShouldRetry = calculateRemainingTime(startTime, maxRetryTime);
1817
+ if (remainingTimeAfterShouldRetry <= 0) {
1818
+ throw normalizedError;
1819
+ }
1820
+ if (!consumeRetry) {
1821
+ options.signal?.throwIfAborted();
1822
+ return false;
1823
+ }
1824
+ const finalDelay = Math.min(effectiveDelay, remainingTimeAfterShouldRetry);
1825
+ options.signal?.throwIfAborted();
1826
+ await delayForRetry(finalDelay, options);
1827
+ options.signal?.throwIfAborted();
1828
+ return true;
1829
+ }
1830
+ async function pRetry(input, options = {}) {
1831
+ options = { ...options };
1832
+ validateRetries(options.retries);
1833
+ if (Object.hasOwn(options, "forever")) {
1834
+ throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");
1835
+ }
1836
+ options.retries ??= 10;
1837
+ options.factor ??= 2;
1838
+ options.minTimeout ??= 1e3;
1839
+ options.maxTimeout ??= Number.POSITIVE_INFINITY;
1840
+ options.maxRetryTime ??= Number.POSITIVE_INFINITY;
1841
+ options.randomize ??= false;
1842
+ options.onFailedAttempt ??= () => {
1843
+ };
1844
+ options.shouldRetry ??= () => true;
1845
+ options.shouldConsumeRetry ??= () => true;
1846
+ validateFunctionOption("onFailedAttempt", options.onFailedAttempt);
1847
+ validateFunctionOption("shouldRetry", options.shouldRetry);
1848
+ validateFunctionOption("shouldConsumeRetry", options.shouldConsumeRetry);
1849
+ validateNumberOption("factor", options.factor, { min: 0, allowInfinity: false });
1850
+ validateNumberOption("minTimeout", options.minTimeout, { min: 0, allowInfinity: false });
1851
+ validateNumberOption("maxTimeout", options.maxTimeout, { min: 0, allowInfinity: true });
1852
+ validateNumberOption("maxRetryTime", options.maxRetryTime, { min: 0, allowInfinity: true });
1853
+ if (!(options.factor > 0)) {
1854
+ options.factor = 1;
1855
+ }
1856
+ options.signal?.throwIfAborted();
1857
+ let attemptNumber = 0;
1858
+ let retriesConsumed = 0;
1859
+ const startTime = performance.now();
1860
+ while (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {
1861
+ attemptNumber++;
1862
+ try {
1863
+ options.signal?.throwIfAborted();
1864
+ const result = await input(attemptNumber);
1865
+ options.signal?.throwIfAborted();
1866
+ return result;
1867
+ } catch (error) {
1868
+ if (await onAttemptFailure({
1869
+ error,
1870
+ attemptNumber,
1871
+ retriesConsumed,
1872
+ startTime,
1873
+ options
1874
+ })) {
1875
+ retriesConsumed++;
1876
+ }
1877
+ }
1878
+ }
1879
+ throw new Error("Retry attempts exhausted without throwing an error.");
1880
+ }
1881
+
1882
+ // src/utils/downloadWithRetry.ts
1883
+ var downloadWithRetry = async (callbackFn, abortStatuses = [404]) => {
1884
+ return await pRetry(callbackFn, {
1885
+ retries: 3,
1886
+ shouldRetry: ({ error }) => {
1887
+ if (globalAxios2.isAxiosError(error) && abortStatuses.includes(error.response?.status ?? 0)) {
1888
+ return false;
1889
+ }
1890
+ return true;
1891
+ }
1892
+ });
1893
+ };
1894
+
1376
1895
  // src/platform-sdk.ts
1377
1896
  var validationErrorSchema = z__default.default.object({
1378
1897
  detail: z__default.default.array(
@@ -1405,6 +1924,24 @@ function handleRequestError(error) {
1405
1924
  statusCode: 404
1406
1925
  });
1407
1926
  }
1927
+ case 403: {
1928
+ throw new APIError(`Access forbidden: ${error.message}`, {
1929
+ context: {
1930
+ responseBody: errorResponseSchema.parse(error.response?.data)
1931
+ },
1932
+ originalError: error,
1933
+ statusCode: 403
1934
+ });
1935
+ }
1936
+ case 410: {
1937
+ throw new APIError(`Resource gone: ${error.message}`, {
1938
+ context: {
1939
+ responseBody: errorResponseSchema.parse(error.response?.data)
1940
+ },
1941
+ originalError: error,
1942
+ statusCode: 410
1943
+ });
1944
+ }
1408
1945
  default: {
1409
1946
  throw new APIError(`API request failed: ${error.message}`, {
1410
1947
  context: {
@@ -1863,6 +2400,58 @@ var PlatformSDKHttp = class {
1863
2400
  getConfig() {
1864
2401
  return { ...this.#config };
1865
2402
  }
2403
+ /**
2404
+ * Download an artifact file from a completed application run
2405
+ *
2406
+ * This method retrieves the binary content of a specific artifact produced
2407
+ * during an application run. Artifacts can include generated reports, processed
2408
+ * images, or other output files from the AI model execution.
2409
+ *
2410
+ * The download is performed with automatic retries for transient failures.
2411
+ * Non-retryable HTTP status codes (403, 404, 410, 422) will abort immediately.
2412
+ *
2413
+ * @param runId - The unique identifier of the application run
2414
+ * @param artifactId - The unique identifier of the artifact to download
2415
+ * @returns A promise that resolves to an ArrayBuffer containing the artifact's binary content
2416
+ * @throws {AuthenticationError} If no valid authentication token is available
2417
+ * @throws {APIError} If the API request fails (e.g., 403, 404, 410, 422, or other HTTP errors)
2418
+ * @throws {UnexpectedError} If a non-HTTP error occurs
2419
+ *
2420
+ * @example
2421
+ * ```typescript
2422
+ * const sdk = new PlatformSDKHttp({ tokenProvider: () => 'your-token' });
2423
+ *
2424
+ * try {
2425
+ * const buffer = await sdk.downloadArtifact('run-123', 'artifact-456');
2426
+ * console.log(`Downloaded ${buffer.byteLength} bytes`);
2427
+ *
2428
+ * // Write to file (Node.js)
2429
+ * fs.writeFileSync('output.bin', Buffer.from(buffer));
2430
+ * } catch (error) {
2431
+ * console.error('Failed to download artifact:', error.message);
2432
+ * }
2433
+ * ```
2434
+ */
2435
+ async downloadArtifact(runId, artifactId) {
2436
+ const client = await this.#getClient();
2437
+ try {
2438
+ const response = await downloadWithRetry(
2439
+ () => client.getArtifactUrlV1RunsRunIdArtifactsArtifactIdFileGet(
2440
+ {
2441
+ runId,
2442
+ artifactId
2443
+ },
2444
+ {
2445
+ responseType: "arraybuffer"
2446
+ }
2447
+ ),
2448
+ [403, 404, 410, 422]
2449
+ );
2450
+ return response.data;
2451
+ } catch (error) {
2452
+ handleRequestError(error);
2453
+ }
2454
+ }
1866
2455
  };
1867
2456
 
1868
2457
  // src/index.ts
@@ -1889,6 +2478,7 @@ exports.PublicApiFp = PublicApiFp;
1889
2478
  exports.RunOutput = RunOutput;
1890
2479
  exports.RunState = RunState;
1891
2480
  exports.RunTerminationReason = RunTerminationReason;
2481
+ exports.VersionDocumentVisibility = VersionDocumentVisibility;
1892
2482
  exports.canDownloadItem = canDownloadItem;
1893
2483
  exports.canDownloadRunItems = canDownloadRunItems;
1894
2484
  exports.default = index_default;