@3dverse/api 0.14.0 → 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.
@@ -4303,7 +4303,34 @@ export type EditableAssetDescription = {
4303
4303
  };
4304
4304
  export type AssetContainerWithPayload = 'animations' | 'animation_graphs' | 'animation_sequences' | 'collision_geometries' | 'meshes' | 'navmeshes' | 'point_clouds' | 'scripts' | 'shaders' | 'skeletons' | 'sounds' | 'textures' | 'textures_3d';
4305
4305
  export type AssetContainerWithGraph = 'animation_graphs' | 'render_graphs' | 'scripts' | 'shaders';
4306
- 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
+ };
4307
4334
  export type AssetContainerExportable = 'meshes' | 'sounds';
4308
4335
  export type Vector3 = Array<number>;
4309
4336
  /** An entity of a scene: its components, by class. */
@@ -9459,6 +9486,28 @@ export declare function getAssetCode({ asset_container_with_code, asset_id, }: {
9459
9486
  asset_container_with_code: AssetContainerWithCode;
9460
9487
  asset_id: AssetId;
9461
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>;
9462
9511
  /**
9463
9512
  * Gets the asset thumbnail from the specified asset.
9464
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,
@@ -1220,6 +1221,22 @@ function getAssetCode({
1220
1221
  responseType: "text"
1221
1222
  });
1222
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
+ }
1223
1240
  function getAssetThumbnail({
1224
1241
  asset_container,
1225
1242
  asset_id,
@@ -1835,6 +1852,7 @@ installInterceptors();
1835
1852
  packageAsset,
1836
1853
  registerUser,
1837
1854
  renameAsset,
1855
+ replaceAssetCode,
1838
1856
  revokeMemberAccessToFolder,
1839
1857
  revokeMemberAccessToGroup,
1840
1858
  setApiKey,