@3dverse/api 0.13.2 → 0.15.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 */
@@ -4286,7 +4303,34 @@ export type EditableAssetDescription = {
4286
4303
  };
4287
4304
  export type AssetContainerWithPayload = 'animations' | 'animation_graphs' | 'animation_sequences' | 'collision_geometries' | 'meshes' | 'navmeshes' | 'point_clouds' | 'scripts' | 'shaders' | 'skeletons' | 'sounds' | 'textures' | 'textures_3d';
4288
4305
  export type AssetContainerWithGraph = 'animation_graphs' | 'render_graphs' | 'scripts' | 'shaders';
4289
- export type AssetContainerWithCode = 'animation_sequences' | 'modules' | 'scripts' | 'shaders';
4306
+ export type AssetContainerWithCode = 'animation_graphs' | 'animation_sequences' | 'modules' | 'scripts' | 'shaders';
4307
+ /** The code replacing an asset's, as its caller sends it. Left open, to be extended through `allOf`, as the route adds the user: a body taking it alone closes it with `unevaluatedProperties: false`. */
4308
+ export type AssetCode = {
4309
+ /** The C++ code, built against the asset type's precompiled header, which it needs not include */
4310
+ code: string;
4311
+ /** Whether to build its debug library too, with its symbols, for the engine's developers */
4312
+ debug?: boolean;
4313
+ };
4314
+ export type AssetCodeInput = {
4315
+ /** The C++ code, built against the asset type's precompiled header, which it needs not include */
4316
+ code: string;
4317
+ /** Whether to build its debug library too, with its symbols, for the engine's developers */
4318
+ debug?: boolean;
4319
+ };
4320
+ /** The build of an asset's code, which replaced the asset's. */
4321
+ export type AssetCodeBuild = {
4322
+ /** Whether the asset's description changed, which a script's code tells */
4323
+ description_changed: boolean;
4324
+ /** The compiler's warnings */
4325
+ warnings: Array<{
4326
+ column?: number;
4327
+ /** The header it is in, relative to the toolchain, none for the code itself */
4328
+ file?: string;
4329
+ line?: number;
4330
+ message: string;
4331
+ severity: 'error' | 'warning' | 'note';
4332
+ }>;
4333
+ };
4290
4334
  export type AssetContainerExportable = 'meshes' | 'sounds';
4291
4335
  export type Vector3 = Array<number>;
4292
4336
  /** An entity of a scene: its components, by class. */
@@ -5679,7 +5723,7 @@ export type ImportCreated = {
5679
5723
  /** Unique identifier of a project */
5680
5724
  project_id: string;
5681
5725
  /** Possible status of an import before it completes. */
5682
- status: 'created' | 'downloading' | 'extracting' | 'pending-approval' | 'queued' | 'running';
5726
+ status: 'created' | 'downloading' | 'extracting' | 'pending-confirmation' | 'queued' | 'running';
5683
5727
  /** User unique identifier */
5684
5728
  user_id: string;
5685
5729
  };
@@ -5695,7 +5739,7 @@ export type ImportStatusChanged = {
5695
5739
  /** Unique identifier of a project */
5696
5740
  project_id: string;
5697
5741
  /** Possible status of an import before it completes. */
5698
- status: 'created' | 'downloading' | 'extracting' | 'pending-approval' | 'queued' | 'running';
5742
+ status: 'created' | 'downloading' | 'extracting' | 'pending-confirmation' | 'queued' | 'running';
5699
5743
  };
5700
5744
  /** How much of an import's remote files is downloaded: the bytes received against their total size. */
5701
5745
  export type ImportDownloadProgress = {
@@ -5751,7 +5795,7 @@ export type ConversionCreated = {
5751
5795
  /** Conversion unique identifier, which this service mints: the id of the job running it. */
5752
5796
  conversion_id: string;
5753
5797
  /** 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';
5798
+ conversion_type?: 'collision_geometry' | 'cubemap' | 'library' | 'navmesh' | 'package' | 'point_cloud' | 'scene' | 'sound' | 'texture' | 'volume';
5755
5799
  /** The converter it runs, unknown for an embedded file no converter supports. */
5756
5800
  converter?: string;
5757
5801
  /** Unique identifier of an environment */
@@ -6733,6 +6777,8 @@ export type AssetCreatableWithTypeInput = {
6733
6777
  /** Constant type */
6734
6778
  type: 'bool' | 'int' | 'uint' | 'float';
6735
6779
  }>;
6780
+ /** The size in byte of the same code built with its debug symbols, unoptimized: the optional `debug` payload, when built */
6781
+ debugPayloadSize?: number;
6736
6782
  /** GLSL extensions required by this shader, detected from the SPIR-V capabilities declared by its compiled modules or set by its author */
6737
6783
  glslExtensions?: Array<{
6738
6784
  /** Behavior of its #extension directive */
@@ -7726,6 +7772,8 @@ export type EditableAssetDescriptionInput = {
7726
7772
  /** Constant type */
7727
7773
  type: 'bool' | 'int' | 'uint' | 'float';
7728
7774
  }>;
7775
+ /** The size in byte of the same code built with its debug symbols, unoptimized: the optional `debug` payload, when built */
7776
+ debugPayloadSize?: number;
7729
7777
  /** GLSL extensions required by this shader, detected from the SPIR-V capabilities declared by its compiled modules or set by its author */
7730
7778
  glslExtensions?: Array<{
7731
7779
  /** Behavior of its #extension directive */
@@ -8798,7 +8846,7 @@ export declare function listSourceFileAssets({ source_file_id, }: {
8798
8846
  /**
8799
8847
  * Imports files into a folder: source files, converted into assets, or asset packages, imported as they are. The
8800
8848
  * 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
8849
+ * sent. An import may also generate an asset from others, or synchronize a library, in a JSON body (below). The accepted extensions, their
8802
8850
  * conversion type and per-converter options are listed by `GET /source-files/supported-formats` and documented at
8803
8851
  * https://docs.3dverse.com/references/supported-file-formats.
8804
8852
  * The folder is given in the query, so that a request the folder's permission refuses is refused before any of its
@@ -8820,6 +8868,14 @@ export declare function listSourceFileAssets({ source_file_id, }: {
8820
8868
  * names along with the asset's type and name, and the options of the data pipeline's baker: the meshes, by
8821
8869
  * `mesh_ids`, with the submeshes of each, and what is baked, e.g. the shape of the collision geometry, or the Recast
8822
8870
  * settings of the navmesh, each left out taking its default. The meshes must exist and be readable by the caller.
8871
+ * ### Synchronizing a library
8872
+ * A library is synchronized from its repository by the `library-synchronization` data pipeline, which the JSON body
8873
+ * names along with the library, as its `source`, the folder being the library's. Its one conversion fetches the
8874
+ * repository at `options.ref` (a branch, tag or commit, the library's branch when left out) and builds it with
8875
+ * `options.conversion_options`, such as `rebuild` and `debug`. Once built, the import waits up to an hour to be
8876
+ * confirmed or cancelled (`updateImport`) before its assets are stored: its status is `pending-confirmation`
8877
+ * meanwhile, and the build's report is its conversion's metadata file `report.json`
8878
+ * (`getConversionMetadata`). A single import synchronizes a library at a time.
8823
8879
  * The import runs asynchronously, as a data pipeline, `getImport` telling its progress. It is rejected
8824
8880
  * (`quota_exceeded`) once its files are unpacked if it would convert more source files than the plan of the
8825
8881
  * environment's organization has left this month, or store more than its storage has left, the organization's
@@ -8908,7 +8964,19 @@ export declare function createImport({ folder_id, body, }: {
8908
8964
  }) & {
8909
8965
  /** The name of the asset generated */
8910
8966
  name: string;
8911
- })> | {
8967
+ }) | {
8968
+ data_pipeline: 'library-synchronization';
8969
+ source: ImportSource;
8970
+ /** How the library is built */
8971
+ options?: {
8972
+ /** The branch, tag or commit of the library's repository built, its branch when left out */
8973
+ ref?: string;
8974
+ /** The build's options, such as `rebuild` and `debug` */
8975
+ conversion_options?: {
8976
+ [_additionalproperties_: string]: any;
8977
+ };
8978
+ };
8979
+ }> | {
8912
8980
  files?: Array<Blob>;
8913
8981
  conversion_pipeline: ConversionPipeline;
8914
8982
  remote_files?: Array<RemoteFile>;
@@ -8956,6 +9024,30 @@ export declare function listImports({ offset, limit, filters, }: {
8956
9024
  export declare function getImport({ import_id, }: {
8957
9025
  import_id: ImportId;
8958
9026
  }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<Import>;
9027
+ /**
9028
+ * Confirms or cancels a library synchronization. Once built, it waits up to an hour to be confirmed before its
9029
+ * assets are stored, its status `pending-confirmation`, past which it is cancelled: `confirmed`, its assets are
9030
+ * stored as built; `cancelled`, nothing is, its build stopped if it still runs. Given again, the same state is
9031
+ * accepted. The caller also needs to be able to synchronize the library: deciding what it stores is as much as
9032
+ * starting it.
9033
+ * It answers once data-pipeline-scheduler took the change, without the import: its status follows asynchronously,
9034
+ * as `getImport` tells it. Cancelling an import other than a library synchronization is not supported yet.
9035
+ * @throws {InvalidParameter}
9036
+ * @throws {MissingAuthorizationHeader}
9037
+ * @throws {InvalidApiKey}
9038
+ * @throws {Unauthorized}
9039
+ * @throws {InvalidAuthorization}
9040
+ * @throws {InsufficientSecurityScope}
9041
+ * @throws {InsufficientPermissions}
9042
+ * @throws {ImportNotFound}
9043
+ * @throws {TooManyRequests}
9044
+ */
9045
+ export declare function updateImport({ import_id, state, }: {
9046
+ import_id: ImportId;
9047
+ state: 'confirmed' | 'cancelled';
9048
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): Promise<AxiosResponse<any, {
9049
+ state: "cancelled" | "confirmed";
9050
+ }, {}, any>>;
8959
9051
  /**
8960
9052
  * Gets the lines a conversion logged, the oldest first, while they are kept: those logged from its creation until a
8961
9053
  * minute after it finished, or until now while it runs, unless asked otherwise. When there are more lines than
@@ -9394,6 +9486,28 @@ export declare function getAssetCode({ asset_container_with_code, asset_id, }: {
9394
9486
  asset_container_with_code: AssetContainerWithCode;
9395
9487
  asset_id: AssetId;
9396
9488
  }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<string>;
9489
+ /**
9490
+ * Replaces the C++ code of a script, animation sequence or animation graph, once asset-compiler built it: code which
9491
+ * fails to build replaces nothing, and answers its diagnostics. A script's description is read from its code, and the
9492
+ * answer tells whether it changed; the caller must be able to read the assets it references. The build takes a few
9493
+ * seconds.
9494
+ * @throws {InvalidParameter}
9495
+ * @throws {MissingAuthorizationHeader}
9496
+ * @throws {InvalidApiKey}
9497
+ * @throws {Unauthorized}
9498
+ * @throws {InvalidAuthorization}
9499
+ * @throws {InsufficientSecurityScope}
9500
+ * @throws {InsufficientPermissions}
9501
+ * @throws {TooManyRequests}
9502
+ */
9503
+ export declare function replaceAssetCode({ asset_container_with_code, asset_id, code, debug, }: {
9504
+ asset_container_with_code: AssetContainerWithCode;
9505
+ asset_id: AssetId;
9506
+ /** The C++ code, built against the asset type's precompiled header, which it needs not include */
9507
+ code: string;
9508
+ /** Whether to build its debug library too, with its symbols, for the engine's developers */
9509
+ debug?: boolean;
9510
+ }, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<AssetCodeBuild>;
9397
9511
  /**
9398
9512
  * Gets the asset thumbnail from the specified asset.
9399
9513
  * @throws {InvalidParameter}
package/dist/index.js CHANGED
@@ -125,6 +125,7 @@ __export(index_exports, {
125
125
  packageAsset: () => packageAsset,
126
126
  registerUser: () => registerUser,
127
127
  renameAsset: () => renameAsset,
128
+ replaceAssetCode: () => replaceAssetCode,
128
129
  revokeMemberAccessToFolder: () => revokeMemberAccessToFolder,
129
130
  revokeMemberAccessToGroup: () => revokeMemberAccessToGroup,
130
131
  setApiKey: () => setApiKey,
@@ -136,6 +137,7 @@ __export(index_exports, {
136
137
  updateEntity: () => updateEntity,
137
138
  updateFolder: () => updateFolder,
138
139
  updateGroup: () => updateGroup,
140
+ updateImport: () => updateImport,
139
141
  updateSceneSettings: () => updateSceneSettings,
140
142
  updateSourceFile: () => updateSourceFile,
141
143
  updateUser: () => updateUser,
@@ -940,6 +942,19 @@ function getImport({
940
942
  headers
941
943
  });
942
944
  }
945
+ function updateImport({
946
+ import_id,
947
+ state
948
+ }, headers) {
949
+ return axiosInstance({
950
+ method: "patch",
951
+ url: "/imports/" + encodeURIComponent(import_id),
952
+ data: {
953
+ state
954
+ },
955
+ headers
956
+ });
957
+ }
943
958
  function getConversionLogs({
944
959
  conversion_id,
945
960
  from,
@@ -1206,6 +1221,22 @@ function getAssetCode({
1206
1221
  responseType: "text"
1207
1222
  });
1208
1223
  }
1224
+ function replaceAssetCode({
1225
+ asset_container_with_code,
1226
+ asset_id,
1227
+ code,
1228
+ debug = false
1229
+ }, headers) {
1230
+ return axiosInstance({
1231
+ method: "put",
1232
+ url: "/assets/" + encodeURIComponent(asset_container_with_code) + "/" + encodeURIComponent(asset_id) + "/code",
1233
+ data: {
1234
+ code,
1235
+ debug
1236
+ },
1237
+ headers
1238
+ });
1239
+ }
1209
1240
  function getAssetThumbnail({
1210
1241
  asset_container,
1211
1242
  asset_id,
@@ -1821,6 +1852,7 @@ installInterceptors();
1821
1852
  packageAsset,
1822
1853
  registerUser,
1823
1854
  renameAsset,
1855
+ replaceAssetCode,
1824
1856
  revokeMemberAccessToFolder,
1825
1857
  revokeMemberAccessToGroup,
1826
1858
  setApiKey,
@@ -1832,6 +1864,7 @@ installInterceptors();
1832
1864
  updateEntity,
1833
1865
  updateFolder,
1834
1866
  updateGroup,
1867
+ updateImport,
1835
1868
  updateSceneSettings,
1836
1869
  updateSourceFile,
1837
1870
  updateUser,