@3dverse/api 0.13.1 → 0.14.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.
@@ -1244,6 +1244,8 @@ export type AssetCreatableWithType = {
1244
1244
  /** Constant type */
1245
1245
  type: 'bool' | 'int' | 'uint' | 'float';
1246
1246
  }>;
1247
+ /** The size in byte of the same code built with its debug symbols, unoptimized: the optional `debug` payload, when built */
1248
+ debugPayloadSize?: number;
1247
1249
  /** GLSL extensions required by this shader, detected from the SPIR-V capabilities declared by its compiled modules or set by its author */
1248
1250
  glslExtensions?: Array<{
1249
1251
  /** Behavior of its #extension directive */
@@ -1703,7 +1705,7 @@ export type Conversion = {
1703
1705
  source_file_name: string;
1704
1706
  conversion_pipeline: ConversionPipeline;
1705
1707
  progress: ConversionProgress;
1706
- status: ('pending' | 'converting' | 'error' | 'success') & string;
1708
+ status: ('pending' | 'converting' | 'error' | 'success' | 'cancelled') & string;
1707
1709
  };
1708
1710
  /**
1709
1711
  * An import of files into the environment, run as a data pipeline: the files uploaded or downloaded, unpacked, and
@@ -1722,7 +1724,7 @@ export type Import = {
1722
1724
  progress: ConversionProgress;
1723
1725
  /** The progress of the download of the files given by URL, while they are downloaded */
1724
1726
  download_progress?: ConversionProgress;
1725
- status: ('waiting' | 'downloading' | 'extracting' | 'pending' | 'converting' | 'error' | 'success' | 'rejected') & string;
1727
+ status: ('waiting' | 'downloading' | 'extracting' | 'pending' | 'converting' | 'pending-confirmation' | 'error' | 'success' | 'rejected' | 'cancelled') & string;
1726
1728
  conversions: Array<Conversion>;
1727
1729
  };
1728
1730
  /** A file an import downloads, given by its URL */
@@ -1795,6 +1797,17 @@ export type AssetGenerationOptions = {
1795
1797
  walkable_slope_angle?: number;
1796
1798
  };
1797
1799
  };
1800
+ /**
1801
+ * What an import imports, when not the files it brings, by its `type`, the only one so far being `library`: a library
1802
+ * synchronized from its repository, by a single conversion building it. The import targets the library's folder, and
1803
+ * holds the library while it runs: a single running import synchronizes it, and it cannot move nor be deleted. Kept
1804
+ * once the import ended, while the library is there.
1805
+ */
1806
+ export type ImportSource = {
1807
+ /** Library unique identifier */
1808
+ library_id: string;
1809
+ type: 'library';
1810
+ };
1798
1811
  /** A line a conversion task logged, as logged */
1799
1812
  export type ConversionLogLine = {
1800
1813
  /**
@@ -2906,6 +2919,8 @@ export type AssetDescription = {
2906
2919
  /** Constant type */
2907
2920
  type: 'bool' | 'int' | 'uint' | 'float';
2908
2921
  }>;
2922
+ /** The size in byte of the same code built with its debug symbols, unoptimized: the optional `debug` payload, when built */
2923
+ debugPayloadSize?: number;
2909
2924
  /** GLSL extensions required by this shader, detected from the SPIR-V capabilities declared by its compiled modules or set by its author */
2910
2925
  glslExtensions?: Array<{
2911
2926
  /** Behavior of its #extension directive */
@@ -4075,6 +4090,8 @@ export type EditableAssetDescription = {
4075
4090
  /** Constant type */
4076
4091
  type: 'bool' | 'int' | 'uint' | 'float';
4077
4092
  }>;
4093
+ /** The size in byte of the same code built with its debug symbols, unoptimized: the optional `debug` payload, when built */
4094
+ debugPayloadSize?: number;
4078
4095
  /** GLSL extensions required by this shader, detected from the SPIR-V capabilities declared by its compiled modules or set by its author */
4079
4096
  glslExtensions?: Array<{
4080
4097
  /** Behavior of its #extension directive */
@@ -5679,7 +5696,7 @@ export type ImportCreated = {
5679
5696
  /** Unique identifier of a project */
5680
5697
  project_id: string;
5681
5698
  /** Possible status of an import before it completes. */
5682
- status: 'created' | 'downloading' | 'extracting' | 'pending-approval' | 'queued' | 'running';
5699
+ status: 'created' | 'downloading' | 'extracting' | 'pending-confirmation' | 'queued' | 'running';
5683
5700
  /** User unique identifier */
5684
5701
  user_id: string;
5685
5702
  };
@@ -5695,7 +5712,7 @@ export type ImportStatusChanged = {
5695
5712
  /** Unique identifier of a project */
5696
5713
  project_id: string;
5697
5714
  /** Possible status of an import before it completes. */
5698
- status: 'created' | 'downloading' | 'extracting' | 'pending-approval' | 'queued' | 'running';
5715
+ status: 'created' | 'downloading' | 'extracting' | 'pending-confirmation' | 'queued' | 'running';
5699
5716
  };
5700
5717
  /** How much of an import's remote files is downloaded: the bytes received against their total size. */
5701
5718
  export type ImportDownloadProgress = {
@@ -5751,7 +5768,7 @@ export type ConversionCreated = {
5751
5768
  /** Conversion unique identifier, which this service mints: the id of the job running it. */
5752
5769
  conversion_id: string;
5753
5770
  /** Its conversion type, unknown for an embedded file no converter supports. */
5754
- conversion_type?: 'collision_geometry' | 'cubemap' | 'navmesh' | 'package' | 'point_cloud' | 'scene' | 'sound' | 'texture' | 'volume';
5771
+ conversion_type?: 'collision_geometry' | 'cubemap' | 'library' | 'navmesh' | 'package' | 'point_cloud' | 'scene' | 'sound' | 'texture' | 'volume';
5755
5772
  /** The converter it runs, unknown for an embedded file no converter supports. */
5756
5773
  converter?: string;
5757
5774
  /** Unique identifier of an environment */
@@ -6733,6 +6750,8 @@ export type AssetCreatableWithTypeInput = {
6733
6750
  /** Constant type */
6734
6751
  type: 'bool' | 'int' | 'uint' | 'float';
6735
6752
  }>;
6753
+ /** The size in byte of the same code built with its debug symbols, unoptimized: the optional `debug` payload, when built */
6754
+ debugPayloadSize?: number;
6736
6755
  /** GLSL extensions required by this shader, detected from the SPIR-V capabilities declared by its compiled modules or set by its author */
6737
6756
  glslExtensions?: Array<{
6738
6757
  /** Behavior of its #extension directive */
@@ -7726,6 +7745,8 @@ export type EditableAssetDescriptionInput = {
7726
7745
  /** Constant type */
7727
7746
  type: 'bool' | 'int' | 'uint' | 'float';
7728
7747
  }>;
7748
+ /** The size in byte of the same code built with its debug symbols, unoptimized: the optional `debug` payload, when built */
7749
+ debugPayloadSize?: number;
7729
7750
  /** GLSL extensions required by this shader, detected from the SPIR-V capabilities declared by its compiled modules or set by its author */
7730
7751
  glslExtensions?: Array<{
7731
7752
  /** Behavior of its #extension directive */
@@ -8798,7 +8819,7 @@ export declare function listSourceFileAssets({ source_file_id, }: {
8798
8819
  /**
8799
8820
  * Imports files into a folder: source files, converted into assets, or asset packages, imported as they are. The
8800
8821
  * files are sent in a multipart body, or given by URL, for the import to download them: in a JSON body when none is
8801
- * sent. An import may also generate an asset from others, in a JSON body (below). The accepted extensions, their
8822
+ * sent. An import may also generate an asset from others, or synchronize a library, in a JSON body (below). The accepted extensions, their
8802
8823
  * conversion type and per-converter options are listed by `GET /source-files/supported-formats` and documented at
8803
8824
  * https://docs.3dverse.com/references/supported-file-formats.
8804
8825
  * The folder is given in the query, so that a request the folder's permission refuses is refused before any of its
@@ -8820,6 +8841,14 @@ export declare function listSourceFileAssets({ source_file_id, }: {
8820
8841
  * names along with the asset's type and name, and the options of the data pipeline's baker: the meshes, by
8821
8842
  * `mesh_ids`, with the submeshes of each, and what is baked, e.g. the shape of the collision geometry, or the Recast
8822
8843
  * settings of the navmesh, each left out taking its default. The meshes must exist and be readable by the caller.
8844
+ * ### Synchronizing a library
8845
+ * A library is synchronized from its repository by the `library-synchronization` data pipeline, which the JSON body
8846
+ * names along with the library, as its `source`, the folder being the library's. Its one conversion fetches the
8847
+ * repository at `options.ref` (a branch, tag or commit, the library's branch when left out) and builds it with
8848
+ * `options.conversion_options`, such as `rebuild` and `debug`. Once built, the import waits up to an hour to be
8849
+ * confirmed or cancelled (`updateImport`) before its assets are stored: its status is `pending-confirmation`
8850
+ * meanwhile, and the build's report is its conversion's metadata file `report.json`
8851
+ * (`getConversionMetadata`). A single import synchronizes a library at a time.
8823
8852
  * The import runs asynchronously, as a data pipeline, `getImport` telling its progress. It is rejected
8824
8853
  * (`quota_exceeded`) once its files are unpacked if it would convert more source files than the plan of the
8825
8854
  * environment's organization has left this month, or store more than its storage has left, the organization's
@@ -8908,8 +8937,27 @@ export declare function createImport({ folder_id, body, }: {
8908
8937
  }) & {
8909
8938
  /** The name of the asset generated */
8910
8939
  name: string;
8911
- })>;
8912
- }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<{
8940
+ }) | {
8941
+ data_pipeline: 'library-synchronization';
8942
+ source: ImportSource;
8943
+ /** How the library is built */
8944
+ options?: {
8945
+ /** The branch, tag or commit of the library's repository built, its branch when left out */
8946
+ ref?: string;
8947
+ /** The build's options, such as `rebuild` and `debug` */
8948
+ conversion_options?: {
8949
+ [_additionalproperties_: string]: any;
8950
+ };
8951
+ };
8952
+ }> | {
8953
+ files?: Array<Blob>;
8954
+ conversion_pipeline: ConversionPipeline;
8955
+ remote_files?: Array<RemoteFile>;
8956
+ options?: {
8957
+ [_additionalproperties_: string]: any;
8958
+ };
8959
+ };
8960
+ }, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<{
8913
8961
  import_id: ImportId;
8914
8962
  }>;
8915
8963
  /**
@@ -8949,6 +8997,30 @@ export declare function listImports({ offset, limit, filters, }: {
8949
8997
  export declare function getImport({ import_id, }: {
8950
8998
  import_id: ImportId;
8951
8999
  }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<Import>;
9000
+ /**
9001
+ * Confirms or cancels a library synchronization. Once built, it waits up to an hour to be confirmed before its
9002
+ * assets are stored, its status `pending-confirmation`, past which it is cancelled: `confirmed`, its assets are
9003
+ * stored as built; `cancelled`, nothing is, its build stopped if it still runs. Given again, the same state is
9004
+ * accepted. The caller also needs to be able to synchronize the library: deciding what it stores is as much as
9005
+ * starting it.
9006
+ * It answers once data-pipeline-scheduler took the change, without the import: its status follows asynchronously,
9007
+ * as `getImport` tells it. Cancelling an import other than a library synchronization is not supported yet.
9008
+ * @throws {InvalidParameter}
9009
+ * @throws {MissingAuthorizationHeader}
9010
+ * @throws {InvalidApiKey}
9011
+ * @throws {Unauthorized}
9012
+ * @throws {InvalidAuthorization}
9013
+ * @throws {InsufficientSecurityScope}
9014
+ * @throws {InsufficientPermissions}
9015
+ * @throws {ImportNotFound}
9016
+ * @throws {TooManyRequests}
9017
+ */
9018
+ export declare function updateImport({ import_id, state, }: {
9019
+ import_id: ImportId;
9020
+ state: 'confirmed' | 'cancelled';
9021
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<AxiosResponse<any, {
9022
+ state: "cancelled" | "confirmed";
9023
+ }, {}, any>>;
8952
9024
  /**
8953
9025
  * Gets the lines a conversion logged, the oldest first, while they are kept: those logged from its creation until a
8954
9026
  * minute after it finished, or until now while it runs, unless asked otherwise. When there are more lines than
package/dist/index.js CHANGED
@@ -136,6 +136,7 @@ __export(index_exports, {
136
136
  updateEntity: () => updateEntity,
137
137
  updateFolder: () => updateFolder,
138
138
  updateGroup: () => updateGroup,
139
+ updateImport: () => updateImport,
139
140
  updateSceneSettings: () => updateSceneSettings,
140
141
  updateSourceFile: () => updateSourceFile,
141
142
  updateUser: () => updateUser,
@@ -180,6 +181,21 @@ function multipartBody(fields, files) {
180
181
  }
181
182
  return form;
182
183
  }
184
+ function jsonOrMultipartBodyOf(body) {
185
+ if (body === void 0) {
186
+ return void 0;
187
+ }
188
+ const isFile = (value) => value instanceof Blob || Array.isArray(value) && value.length > 0 && value.every((item) => item instanceof Blob);
189
+ const entries = Object.entries(body);
190
+ const files = entries.filter(([, value]) => isFile(value));
191
+ if (files.length === 0) {
192
+ return body;
193
+ }
194
+ return multipartBody(
195
+ Object.fromEntries(entries.filter(([, value]) => !isFile(value))),
196
+ Object.fromEntries(files)
197
+ );
198
+ }
183
199
  function plainHeaders(headers) {
184
200
  return headers instanceof import_axios.AxiosHeaders ? headers.toJSON() : { ...headers };
185
201
  }
@@ -888,14 +904,15 @@ function listSourceFileAssets({
888
904
  function createImport({
889
905
  folder_id,
890
906
  body
891
- }, headers) {
907
+ }, onUploadProgress, headers) {
892
908
  return axiosInstance({
893
909
  method: "post",
894
910
  url: "/imports",
895
911
  params: {
896
912
  folder_id
897
913
  },
898
- data: body,
914
+ data: jsonOrMultipartBodyOf(body),
915
+ onUploadProgress,
899
916
  headers
900
917
  });
901
918
  }
@@ -924,6 +941,19 @@ function getImport({
924
941
  headers
925
942
  });
926
943
  }
944
+ function updateImport({
945
+ import_id,
946
+ state
947
+ }, headers) {
948
+ return axiosInstance({
949
+ method: "patch",
950
+ url: "/imports/" + encodeURIComponent(import_id),
951
+ data: {
952
+ state
953
+ },
954
+ headers
955
+ });
956
+ }
927
957
  function getConversionLogs({
928
958
  conversion_id,
929
959
  from,
@@ -1816,6 +1846,7 @@ installInterceptors();
1816
1846
  updateEntity,
1817
1847
  updateFolder,
1818
1848
  updateGroup,
1849
+ updateImport,
1819
1850
  updateSceneSettings,
1820
1851
  updateSourceFile,
1821
1852
  updateUser,