@3dverse/api 0.11.1 → 0.13.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/README.md CHANGED
@@ -40,14 +40,17 @@ async () => {
40
40
  For client-side request, you can authenticate with the User Token.
41
41
 
42
42
  ```
43
- import { setUserToken, uploadSourceFiles } from '@3dverse/api';
43
+ import { createImport, setUserToken } from '@3dverse/api';
44
44
 
45
45
  setUserToken(MY_USER_TOKEN);
46
46
 
47
47
  async () => {
48
- const upload = await uploadSourceFiles({
48
+ const {
49
+ data: { import_id },
50
+ } = await createImport({
49
51
  folder_id: 'my_folder_id',
50
- body: formData
52
+ conversion_pipeline: 'auto-detect',
53
+ files: [myFile],
51
54
  });
52
55
  }
53
56
  ```
@@ -1680,6 +1680,51 @@ export type SupportedSourceFileFormats = {
1680
1680
  file_extensions: Array<string>;
1681
1681
  };
1682
1682
  };
1683
+ /** Import unique identifier, which this service mints: the id of the pipeline running it. */
1684
+ export type ImportId = string;
1685
+ /** The unique identifier of a conversion */
1686
+ export type ConversionId = string;
1687
+ /** The conversion of one file of an import into assets. */
1688
+ export type Conversion = {
1689
+ conversion_id: ConversionId;
1690
+ /** Asset unique identifier, a version 4 uuid in its canonical lowercase form */
1691
+ asset_id?: string;
1692
+ source_file_id: SourceFileId;
1693
+ /** The name of the file converted */
1694
+ source_file_name: string;
1695
+ conversion_pipeline: ConversionPipeline;
1696
+ progress: ConversionProgress;
1697
+ status: ('pending' | 'converting' | 'error' | 'success') & string;
1698
+ };
1699
+ /**
1700
+ * An import of files into the environment, run as a data pipeline: the files uploaded or downloaded, unpacked, and
1701
+ * each one converted into assets, or imported as it is when it is an asset package. It names the folder its assets
1702
+ * were stored into, which they may have left since.
1703
+ */
1704
+ export type Import = {
1705
+ import_id: ImportId;
1706
+ /** The folder the import stores its assets into */
1707
+ folder_id: FolderId;
1708
+ /** When the import was created */
1709
+ created_at: string;
1710
+ /** The user who created the import */
1711
+ created_by: UserInfo;
1712
+ /** The progress of the import, over all its conversions */
1713
+ progress: ConversionProgress;
1714
+ /** The progress of the download of the files given by URL, while they are downloaded */
1715
+ download_progress?: ConversionProgress;
1716
+ status: ('waiting' | 'downloading' | 'extracting' | 'pending' | 'converting' | 'error' | 'success' | 'rejected') & string;
1717
+ conversions: Array<Conversion>;
1718
+ };
1719
+ /** A file an import downloads, given by its URL */
1720
+ export type RemoteFile = {
1721
+ /** The name of the file */
1722
+ name: string;
1723
+ /** The URL of the file, which must be public, unless an Authorization header is given */
1724
+ url: string;
1725
+ /** The value of the Authorization header of the download, when it needs one */
1726
+ authorization?: string;
1727
+ };
1683
1728
  /** A line a conversion task logged, as logged */
1684
1729
  export type ConversionLogLine = {
1685
1730
  /**
@@ -5775,8 +5820,6 @@ export type ConversionCompleted = {
5775
5820
  step_id: string;
5776
5821
  }>;
5777
5822
  };
5778
- /** Import unique identifier, which this service mints: the id of the pipeline running it. */
5779
- export type ImportId = string;
5780
5823
  export type PipelineId = ImportId;
5781
5824
  export type GroupMemberInput = {
5782
5825
  user_id: UserId;
@@ -7881,6 +7924,20 @@ export declare class UploadAborted extends ServiceErrorResponse {
7881
7924
  static readonly ERROR_CODE = 1009;
7882
7925
  constructor(serviceError: Record<string, unknown>);
7883
7926
  }
7927
+ export declare class ImportNotFound extends ServiceErrorResponse {
7928
+ static readonly ERROR_CODE = 1022;
7929
+ readonly import_id: ImportId;
7930
+ constructor(serviceError: Record<string, unknown>);
7931
+ }
7932
+ export declare class ConversionNotFound extends ServiceErrorResponse {
7933
+ static readonly ERROR_CODE = 1023;
7934
+ readonly conversion_id: ConversionId;
7935
+ constructor(serviceError: Record<string, unknown>);
7936
+ }
7937
+ export declare class LogsUnavailable extends ServiceErrorResponse {
7938
+ static readonly ERROR_CODE = 1019;
7939
+ constructor(serviceError: Record<string, unknown>);
7940
+ }
7884
7941
  export declare class UploadTaskNotFound extends ServiceErrorResponse {
7885
7942
  static readonly ERROR_CODE = 1010;
7886
7943
  readonly upload_task_id: UploadTaskId;
@@ -7891,10 +7948,6 @@ export declare class ConversionTaskNotFound extends ServiceErrorResponse {
7891
7948
  readonly conversion_task_id: ConversionTaskId;
7892
7949
  constructor(serviceError: Record<string, unknown>);
7893
7950
  }
7894
- export declare class LogsUnavailable extends ServiceErrorResponse {
7895
- static readonly ERROR_CODE = 1019;
7896
- constructor(serviceError: Record<string, unknown>);
7897
- }
7898
7951
  export declare class InvalidGuestToken extends ServiceErrorResponse {
7899
7952
  static readonly ERROR_CODE = 1016;
7900
7953
  constructor(serviceError: Record<string, unknown>);
@@ -7921,7 +7974,7 @@ export declare class TooManyRequests extends ServiceErrorResponse {
7921
7974
  constructor(serviceError: Record<string, unknown>);
7922
7975
  }
7923
7976
  /** The errors the spec declares. */
7924
- export type DeclaredError = InvalidAuthorization | InsufficientSecurityScope | InsufficientPermissions | InvalidTokenTtl | InvalidParameter | MemberAccessesDiffer | InvalidMaterial | InvalidRequest | UploadedPayloadTooLarge | NoFileUploaded | UploadAborted | UploadTaskNotFound | ConversionTaskNotFound | LogsUnavailable | InvalidGuestToken | Unauthorized | MissingAuthorizationHeader | InvalidApiKey | TooManyRequests;
7977
+ export type DeclaredError = InvalidAuthorization | InsufficientSecurityScope | InsufficientPermissions | InvalidTokenTtl | InvalidParameter | MemberAccessesDiffer | InvalidMaterial | InvalidRequest | UploadedPayloadTooLarge | NoFileUploaded | UploadAborted | ImportNotFound | ConversionNotFound | LogsUnavailable | UploadTaskNotFound | ConversionTaskNotFound | InvalidGuestToken | Unauthorized | MissingAuthorizationHeader | InvalidApiKey | TooManyRequests;
7925
7978
  /**
7926
7979
  * The error declared in the spec that a request failed with, or undefined: read from the error a function of this
7927
7980
  * client rejected with, e.g. `if (errorOf(error) instanceof FolderNotFound)`.
@@ -8343,6 +8396,8 @@ export declare function moveFolders({ folder_id, folder_ids, }: {
8343
8396
  folder_ids: string[];
8344
8397
  }, {}, any>>;
8345
8398
  /**
8399
+ * **Deprecated**: use `createImport` (`POST /imports?folder_id=…`), which takes the same body, its `source_files`
8400
+ * named `remote_files`, and answers the import's `import_id`.
8346
8401
  * Uploads the specified source file(s). The accepted extensions, their conversion type and
8347
8402
  * per-converter options are listed by `GET /source-files/supported-formats` and documented at
8348
8403
  * https://docs.3dverse.com/references/supported-file-formats.
@@ -8398,9 +8453,12 @@ export declare function uploadSourceFiles({ folder_id, files, conversion_pipelin
8398
8453
  options?: {
8399
8454
  [_additionalproperties_: string]: any;
8400
8455
  };
8401
- }, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<{
8456
+ }, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<ResponseWithHeaders<{
8402
8457
  upload_task_id?: UploadTaskId;
8403
- }>;
8458
+ }, {
8459
+ deprecation?: string;
8460
+ link?: string;
8461
+ }>>;
8404
8462
  /**
8405
8463
  * Lists all source files in a folder.
8406
8464
  * @throws {InvalidParameter}
@@ -8443,6 +8501,8 @@ export declare function moveSourceFiles({ folder_id, source_file_ids, }: {
8443
8501
  source_file_ids: string[];
8444
8502
  }, {}, any>>;
8445
8503
  /**
8504
+ * **Deprecated**, with no replacement: an import names the folder it stored its assets into, which they may have
8505
+ * left since. `listImports` lists the environment's imports, or a user's.
8446
8506
  * Lists the upload tasks importing into a folder. The caller needs to be able to list the folder's upload tasks
8447
8507
  * only: a user granted the folder lists them, without the environment's permission `listUploadTasks` needs.
8448
8508
  * @throws {InvalidParameter}
@@ -8460,6 +8520,7 @@ export declare function listFolderUploadTasks({ folder_id, offset, limit, }: {
8460
8520
  limit?: number;
8461
8521
  }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<ResponseWithHeaders<Array<UploadTask>, {
8462
8522
  link?: string;
8523
+ deprecation?: string;
8463
8524
  }>>;
8464
8525
  /**
8465
8526
  * Lists assets.
@@ -8665,6 +8726,140 @@ export declare function listSourceFileAssets({ source_file_id, }: {
8665
8726
  source_file_id: SourceFileId;
8666
8727
  }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<AssetList>;
8667
8728
  /**
8729
+ * Imports files into a folder: source files, converted into assets, or asset packages, imported as they are. The
8730
+ * files are sent in a multipart body, or given by URL, for the import to download them: in a JSON body when none is
8731
+ * sent. The accepted extensions, their
8732
+ * conversion type and per-converter options are listed by `GET /source-files/supported-formats` and documented at
8733
+ * https://docs.3dverse.com/references/supported-file-formats.
8734
+ * The folder is given in the query, so that a request the folder's permission refuses is refused before any of its
8735
+ * files is received. The import stores its assets into it.
8736
+ * ### Importing an asset package
8737
+ * With the `package` conversion pipeline, the files are already converted assets, imported as they are, submitted
8738
+ * as zip archives (asset packages) or as the asset files themselves. The asset files are named
8739
+ * `<part>.<asset_type>[.<sub resource>].<uuid>`, where the part is `desc` (the asset description, in JSON),
8740
+ * `payload`, `graph` or `layout`, for example `desc.mesh.<uuid>`, `payload.mesh.<uuid>` or
8741
+ * `payload.texture.mip0.<uuid>`. The assets they reference must be submitted along with them, unless they already
8742
+ * exist. The submitted assets that already exist are overwritten only if they are listed in an `overwrite.json`
8743
+ * file, a JSON array of asset ids submitted along with them, the others being left as they are; without it, the
8744
+ * import fails if one of them already exists. Overwriting an asset requires the `update-asset` and `delete-asset`
8745
+ * permissions on it, referencing one the `read-asset` permission. A file named as an asset file but which is not a
8746
+ * valid one fails the import, the files named otherwise being ignored. The payloads of shaders, scripts, animation
8747
+ * sequences and animation graphs, compiled code which only a library builds, are ignored.
8748
+ * The import runs asynchronously, as a data pipeline, `getImport` telling its progress. It is rejected
8749
+ * (`quota_exceeded`) once its files are unpacked if it would convert more source files than the plan of the
8750
+ * environment's organization has left this month, or store more than its storage has left, the organization's
8751
+ * conversions and assets counted as activity-monitor measures them.
8752
+ * @throws {InvalidMaterial}
8753
+ * @throws {InvalidRequest}
8754
+ * @throws {InvalidParameter}
8755
+ * @throws {MissingAuthorizationHeader}
8756
+ * @throws {InvalidApiKey}
8757
+ * @throws {Unauthorized}
8758
+ * @throws {InvalidAuthorization}
8759
+ * @throws {InsufficientSecurityScope}
8760
+ * @throws {InsufficientPermissions}
8761
+ * @throws {UploadedPayloadTooLarge}
8762
+ * @throws {NoFileUploaded}
8763
+ * @throws {UploadAborted}
8764
+ * @throws {TooManyRequests}
8765
+ */
8766
+ export declare function createImport({ folder_id, files, conversion_pipeline, remote_files, options, }: {
8767
+ folder_id: FolderId;
8768
+ /** The files to import, each with its file name. Files are accepted under any field name. */
8769
+ files?: Array<Blob>;
8770
+ conversion_pipeline: ConversionPipeline;
8771
+ /**
8772
+ * Files the import downloads, given by URL, along with the files sent: those already on a storage
8773
+ * service, or too large to send through the API.
8774
+ */
8775
+ remote_files?: Array<RemoteFile>;
8776
+ /** Options for the conversion pipeline. For future use. */
8777
+ options?: {
8778
+ [_additionalproperties_: string]: any;
8779
+ };
8780
+ }, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<{
8781
+ import_id: ImportId;
8782
+ }>;
8783
+ /**
8784
+ * Lists the imports of the caller's environment, or those of a user, with `filters`. The caller needs to be able to
8785
+ * list the environment's imports, and those of the user filtered on.
8786
+ * @throws {InvalidParameter}
8787
+ * @throws {MissingAuthorizationHeader}
8788
+ * @throws {InvalidApiKey}
8789
+ * @throws {Unauthorized}
8790
+ * @throws {InvalidAuthorization}
8791
+ * @throws {InsufficientSecurityScope}
8792
+ * @throws {InsufficientPermissions}
8793
+ * @throws {TooManyRequests}
8794
+ */
8795
+ export declare function listImports({ offset, limit, filters, }: {
8796
+ offset?: number;
8797
+ limit?: number;
8798
+ filters?: {
8799
+ /** Only the imports of this user */
8800
+ user_id?: UserId;
8801
+ };
8802
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<ResponseWithHeaders<Array<Import>, {
8803
+ link?: string;
8804
+ }>>;
8805
+ /**
8806
+ * Gets an import, with its progress and each of its conversions.
8807
+ * @throws {InvalidParameter}
8808
+ * @throws {MissingAuthorizationHeader}
8809
+ * @throws {InvalidApiKey}
8810
+ * @throws {Unauthorized}
8811
+ * @throws {InvalidAuthorization}
8812
+ * @throws {InsufficientSecurityScope}
8813
+ * @throws {InsufficientPermissions}
8814
+ * @throws {ImportNotFound}
8815
+ * @throws {TooManyRequests}
8816
+ */
8817
+ export declare function getImport({ import_id, }: {
8818
+ import_id: ImportId;
8819
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<Import>;
8820
+ /**
8821
+ * Gets the lines a conversion logged, the oldest first, while they are kept: those logged from its creation until a
8822
+ * minute after it finished, or until now while it runs, unless asked otherwise. When there are more lines than
8823
+ * answered, the `link` header gives the next ones (`rel="next"`). To follow a conversion still running, ask again
8824
+ * with `from` just after the timestamp of the last line received.
8825
+ * @throws {InvalidParameter}
8826
+ * @throws {MissingAuthorizationHeader}
8827
+ * @throws {InvalidApiKey}
8828
+ * @throws {Unauthorized}
8829
+ * @throws {InvalidAuthorization}
8830
+ * @throws {InsufficientSecurityScope}
8831
+ * @throws {InsufficientPermissions}
8832
+ * @throws {ConversionNotFound}
8833
+ * @throws {TooManyRequests}
8834
+ * @throws {LogsUnavailable}
8835
+ */
8836
+ export declare function getConversionLogs({ conversion_id, from, to, limit, }: {
8837
+ conversion_id: ConversionId;
8838
+ from?: string;
8839
+ to?: string;
8840
+ limit?: number;
8841
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<ResponseWithHeaders<Array<ConversionLogLine>, {
8842
+ link?: string;
8843
+ }>>;
8844
+ /**
8845
+ * Gets a metadata file a conversion produced, along with its assets, such as the properties an IFC file's elements
8846
+ * carry. The files are kept for 24 hours after the conversion, then deleted.
8847
+ * @throws {InvalidParameter}
8848
+ * @throws {MissingAuthorizationHeader}
8849
+ * @throws {InvalidApiKey}
8850
+ * @throws {Unauthorized}
8851
+ * @throws {InvalidAuthorization}
8852
+ * @throws {InsufficientSecurityScope}
8853
+ * @throws {InsufficientPermissions}
8854
+ * @throws {ConversionNotFound}
8855
+ * @throws {TooManyRequests}
8856
+ */
8857
+ export declare function getConversionMetadata<T extends 'arraybuffer' | 'stream' | 'json' | 'text' = 'arraybuffer'>({ conversion_id, filename, }: {
8858
+ conversion_id: ConversionId;
8859
+ filename: string;
8860
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders, responseType?: T): AxiosPromise<T extends 'arraybuffer' ? ArrayBuffer : T extends 'json' ? object : T extends 'text' ? string : T extends 'stream' ? ReadableStream : never>;
8861
+ /**
8862
+ * **Deprecated**: use `listImports` (`GET /imports`), which takes the same filters.
8668
8863
  * Lists the upload tasks of the caller's environment, or those of a user, with `filters`. These upload tasks relate
8669
8864
  * to uploaded source files. The caller needs to be able to list the environment's upload tasks, and those of the
8670
8865
  * user filtered on. Those of a folder are listed with `listFolderUploadTasks`.
@@ -8686,8 +8881,10 @@ export declare function listUploadTasks({ offset, limit, filters, }: {
8686
8881
  };
8687
8882
  }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<ResponseWithHeaders<Array<UploadTask>, {
8688
8883
  link?: string;
8884
+ deprecation?: string;
8689
8885
  }>>;
8690
8886
  /**
8887
+ * **Deprecated**: use `getImport` (`GET /imports/{import_id}`), the import's id being the upload task's.
8691
8888
  * Gets information related to an upload task. This upload task relates to uploaded source files.
8692
8889
  * @throws {InvalidParameter}
8693
8890
  * @throws {MissingAuthorizationHeader}
@@ -8701,9 +8898,15 @@ export declare function listUploadTasks({ offset, limit, filters, }: {
8701
8898
  */
8702
8899
  export declare function getUploadTask({ upload_task_id, }: {
8703
8900
  upload_task_id: UploadTaskId;
8704
- }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<UploadTask>;
8901
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<ResponseWithHeaders<UploadTask, {
8902
+ deprecation?: string;
8903
+ link?: string;
8904
+ }>>;
8705
8905
  /**
8706
- * Gets metadata related to a conversion task. This metadata is produced by the conversion task.
8906
+ * **Deprecated**: use `getConversionMetadata` (`GET /conversions/{conversion_id}/metadata/{filename}`), the
8907
+ * conversion's id being the conversion task's.
8908
+ * Gets metadata related to a conversion task. This metadata is produced by the conversion task, and kept for 24
8909
+ * hours.
8707
8910
  * @throws {InvalidParameter}
8708
8911
  * @throws {MissingAuthorizationHeader}
8709
8912
  * @throws {InvalidApiKey}
@@ -8717,8 +8920,13 @@ export declare function getUploadTask({ upload_task_id, }: {
8717
8920
  export declare function getConversionTaskMetadata<T extends 'arraybuffer' | 'stream' | 'json' | 'text' = 'arraybuffer'>({ conversion_task_id, filename, }: {
8718
8921
  conversion_task_id: ConversionTaskId;
8719
8922
  filename: string;
8720
- }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders, responseType?: T): AxiosPromise<T extends 'arraybuffer' ? ArrayBuffer : T extends 'json' ? object : T extends 'text' ? string : T extends 'stream' ? ReadableStream : never>;
8923
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders, responseType?: T): Promise<ResponseWithHeaders<T extends 'arraybuffer' ? ArrayBuffer : T extends 'json' ? object : T extends 'text' ? string : T extends 'stream' ? ReadableStream : never, {
8924
+ deprecation?: string;
8925
+ link?: string;
8926
+ }>>;
8721
8927
  /**
8928
+ * **Deprecated**: use `getConversionLogs` (`GET /conversions/{conversion_id}/logs`), the conversion's id being the
8929
+ * conversion task's.
8722
8930
  * Gets the lines a conversion task logged, the oldest first, while they are kept: those logged from its creation until
8723
8931
  * a minute after it finished, or until now while it runs, unless asked otherwise. When there are more lines than
8724
8932
  * answered, the `link` header gives the next ones (`rel="next"`). To follow a conversion task still running, ask
@@ -8741,6 +8949,7 @@ export declare function getConversionTaskLogs({ conversion_task_id, from, to, li
8741
8949
  limit?: number;
8742
8950
  }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<ResponseWithHeaders<Array<ConversionLogLine>, {
8743
8951
  link?: string;
8952
+ deprecation?: string;
8744
8953
  }>>;
8745
8954
  /**
8746
8955
  * Lists the assets of the caller's environment, at every depth, grouped by type, and with
package/dist/index.js CHANGED
@@ -30,7 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
32
  ApiError: () => ApiError,
33
+ ConversionNotFound: () => ConversionNotFound,
33
34
  ConversionTaskNotFound: () => ConversionTaskNotFound,
35
+ ImportNotFound: () => ImportNotFound,
34
36
  InsufficientPermissions: () => InsufficientPermissions,
35
37
  InsufficientSecurityScope: () => InsufficientSecurityScope,
36
38
  InvalidApiKey: () => InvalidApiKey,
@@ -56,6 +58,7 @@ __export(index_exports, {
56
58
  createEntity: () => createEntity,
57
59
  createFolder: () => createFolder,
58
60
  createGroup: () => createGroup,
61
+ createImport: () => createImport,
59
62
  createSession: () => createSession,
60
63
  createSubfolder: () => createSubfolder,
61
64
  deleteAsset: () => deleteAsset,
@@ -77,6 +80,8 @@ __export(index_exports, {
77
80
  getAssetPayload: () => getAssetPayload,
78
81
  getAssetThumbnail: () => getAssetThumbnail,
79
82
  getClient: () => getClient,
83
+ getConversionLogs: () => getConversionLogs,
84
+ getConversionMetadata: () => getConversionMetadata,
80
85
  getConversionTaskLogs: () => getConversionTaskLogs,
81
86
  getConversionTaskMetadata: () => getConversionTaskMetadata,
82
87
  getCurrentUser: () => getCurrentUser,
@@ -84,6 +89,7 @@ __export(index_exports, {
84
89
  getEntity: () => getEntity,
85
90
  getFolder: () => getFolder,
86
91
  getGroup: () => getGroup,
92
+ getImport: () => getImport,
87
93
  getSceneAABB: () => getSceneAABB,
88
94
  getSceneSettings: () => getSceneSettings,
89
95
  getSession: () => getSession,
@@ -106,6 +112,7 @@ __export(index_exports, {
106
112
  listFolderSubfolders: () => listFolderSubfolders,
107
113
  listFolderUploadTasks: () => listFolderUploadTasks,
108
114
  listFolders: () => listFolders,
115
+ listImports: () => listImports,
109
116
  listRunningSessions: () => listRunningSessions,
110
117
  listSourceFileAssets: () => listSourceFileAssets,
111
118
  listSourceFiles: () => listSourceFiles,
@@ -173,6 +180,13 @@ function multipartBody(fields, files) {
173
180
  }
174
181
  return form;
175
182
  }
183
+ function jsonOrMultipartBody(fields, files) {
184
+ const hasFile = Object.values(files).some((value) => Array.isArray(value) ? value.length > 0 : value !== void 0);
185
+ if (hasFile) {
186
+ return multipartBody(fields, files);
187
+ }
188
+ return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== void 0));
189
+ }
176
190
  function plainHeaders(headers) {
177
191
  return headers instanceof import_axios.AxiosHeaders ? headers.toJSON() : { ...headers };
178
192
  }
@@ -260,17 +274,17 @@ var UploadAborted = class extends ServiceErrorResponse {
260
274
  Object.assign(this, serviceError);
261
275
  }
262
276
  };
263
- var UploadTaskNotFound = class extends ServiceErrorResponse {
264
- static ERROR_CODE = 1010;
277
+ var ImportNotFound = class extends ServiceErrorResponse {
278
+ static ERROR_CODE = 1022;
265
279
  constructor(serviceError) {
266
- super(1010, 404, "Upload task not found", serviceError);
280
+ super(1022, 404, "Import not found", serviceError);
267
281
  Object.assign(this, serviceError);
268
282
  }
269
283
  };
270
- var ConversionTaskNotFound = class extends ServiceErrorResponse {
271
- static ERROR_CODE = 1015;
284
+ var ConversionNotFound = class extends ServiceErrorResponse {
285
+ static ERROR_CODE = 1023;
272
286
  constructor(serviceError) {
273
- super(1015, 404, "Conversion task not found", serviceError);
287
+ super(1023, 404, "Conversion not found", serviceError);
274
288
  Object.assign(this, serviceError);
275
289
  }
276
290
  };
@@ -281,6 +295,20 @@ var LogsUnavailable = class extends ServiceErrorResponse {
281
295
  Object.assign(this, serviceError);
282
296
  }
283
297
  };
298
+ var UploadTaskNotFound = class extends ServiceErrorResponse {
299
+ static ERROR_CODE = 1010;
300
+ constructor(serviceError) {
301
+ super(1010, 404, "Upload task not found", serviceError);
302
+ Object.assign(this, serviceError);
303
+ }
304
+ };
305
+ var ConversionTaskNotFound = class extends ServiceErrorResponse {
306
+ static ERROR_CODE = 1015;
307
+ constructor(serviceError) {
308
+ super(1015, 404, "Conversion task not found", serviceError);
309
+ Object.assign(this, serviceError);
310
+ }
311
+ };
284
312
  var InvalidGuestToken = class extends ServiceErrorResponse {
285
313
  static ERROR_CODE = 1016;
286
314
  constructor(serviceError) {
@@ -328,9 +356,11 @@ var declaredErrors = {
328
356
  1007: UploadedPayloadTooLarge,
329
357
  1008: NoFileUploaded,
330
358
  1009: UploadAborted,
359
+ 1022: ImportNotFound,
360
+ 1023: ConversionNotFound,
361
+ 1019: LogsUnavailable,
331
362
  1010: UploadTaskNotFound,
332
363
  1015: ConversionTaskNotFound,
333
- 1019: LogsUnavailable,
334
364
  1016: InvalidGuestToken,
335
365
  1005: Unauthorized,
336
366
  1011: MissingAuthorizationHeader,
@@ -862,6 +892,86 @@ function listSourceFileAssets({
862
892
  headers
863
893
  });
864
894
  }
895
+ function createImport({
896
+ folder_id,
897
+ files,
898
+ conversion_pipeline = "auto-detect",
899
+ remote_files,
900
+ options
901
+ }, onUploadProgress, headers) {
902
+ return axiosInstance({
903
+ method: "post",
904
+ url: "/imports",
905
+ params: {
906
+ folder_id
907
+ },
908
+ data: jsonOrMultipartBody(
909
+ {
910
+ conversion_pipeline,
911
+ remote_files,
912
+ options
913
+ },
914
+ {
915
+ files
916
+ }
917
+ ),
918
+ onUploadProgress,
919
+ headers
920
+ });
921
+ }
922
+ function listImports({
923
+ offset = 0,
924
+ limit = 10,
925
+ filters
926
+ }, headers) {
927
+ return axiosInstance({
928
+ method: "get",
929
+ url: "/imports",
930
+ params: {
931
+ offset,
932
+ limit,
933
+ filters
934
+ },
935
+ headers
936
+ });
937
+ }
938
+ function getImport({
939
+ import_id
940
+ }, headers) {
941
+ return axiosInstance({
942
+ method: "get",
943
+ url: "/imports/" + encodeURIComponent(import_id),
944
+ headers
945
+ });
946
+ }
947
+ function getConversionLogs({
948
+ conversion_id,
949
+ from,
950
+ to,
951
+ limit
952
+ }, headers) {
953
+ return axiosInstance({
954
+ method: "get",
955
+ url: "/conversions/" + encodeURIComponent(conversion_id) + "/logs",
956
+ params: {
957
+ from,
958
+ to,
959
+ limit
960
+ },
961
+ headers
962
+ });
963
+ }
964
+ function getConversionMetadata({
965
+ conversion_id,
966
+ filename
967
+ }, headers, responseType) {
968
+ return axiosInstance({
969
+ method: "get",
970
+ url: "/conversions/" + encodeURIComponent(conversion_id) + "/metadata/" + encodeURIComponent(filename),
971
+ headers,
972
+ responseType: responseType || "arraybuffer"
973
+ });
974
+ }
865
975
  function listUploadTasks({
866
976
  offset = 0,
867
977
  limit = 10,
@@ -1620,7 +1730,9 @@ installInterceptors();
1620
1730
  // Annotate the CommonJS export names for ESM import in node:
1621
1731
  0 && (module.exports = {
1622
1732
  ApiError,
1733
+ ConversionNotFound,
1623
1734
  ConversionTaskNotFound,
1735
+ ImportNotFound,
1624
1736
  InsufficientPermissions,
1625
1737
  InsufficientSecurityScope,
1626
1738
  InvalidApiKey,
@@ -1646,6 +1758,7 @@ installInterceptors();
1646
1758
  createEntity,
1647
1759
  createFolder,
1648
1760
  createGroup,
1761
+ createImport,
1649
1762
  createSession,
1650
1763
  createSubfolder,
1651
1764
  deleteAsset,
@@ -1667,6 +1780,8 @@ installInterceptors();
1667
1780
  getAssetPayload,
1668
1781
  getAssetThumbnail,
1669
1782
  getClient,
1783
+ getConversionLogs,
1784
+ getConversionMetadata,
1670
1785
  getConversionTaskLogs,
1671
1786
  getConversionTaskMetadata,
1672
1787
  getCurrentUser,
@@ -1674,6 +1789,7 @@ installInterceptors();
1674
1789
  getEntity,
1675
1790
  getFolder,
1676
1791
  getGroup,
1792
+ getImport,
1677
1793
  getSceneAABB,
1678
1794
  getSceneSettings,
1679
1795
  getSession,
@@ -1696,6 +1812,7 @@ installInterceptors();
1696
1812
  listFolderSubfolders,
1697
1813
  listFolderUploadTasks,
1698
1814
  listFolders,
1815
+ listImports,
1699
1816
  listRunningSessions,
1700
1817
  listSourceFileAssets,
1701
1818
  listSourceFiles,