@3dverse/api 0.13.0 → 0.13.1
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/_prebuild/wrapper.d.ts +152 -20
- package/dist/index.js +3 -23
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +3 -23
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
|
@@ -86,9 +86,10 @@ export type ServiceError = {
|
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
88
88
|
* The kind of token authenticating a request: OAuthToken, an access token of the authorization server acting for a
|
|
89
|
-
* person in one environment, authenticates the MCP endpoint only
|
|
89
|
+
* person in one environment, authenticates the MCP endpoint only, and UploadToken, issued by its tool
|
|
90
|
+
* `import_files`, one import
|
|
90
91
|
*/
|
|
91
|
-
export type SessionType = 'ApiKey' | 'UserToken' | 'GuestToken' | 'OAuthToken';
|
|
92
|
+
export type SessionType = 'ApiKey' | 'UserToken' | 'GuestToken' | 'OAuthToken' | 'UploadToken';
|
|
92
93
|
/** What a token lets its holder do, each scope allowing what the ones before it allow */
|
|
93
94
|
export type SecurityScope = 'read' | 'write' | 'manage';
|
|
94
95
|
/** Why the caller may not do what it asks, its credentials being valid */
|
|
@@ -1687,6 +1688,14 @@ export type ConversionId = string;
|
|
|
1687
1688
|
/** The conversion of one file of an import into assets. */
|
|
1688
1689
|
export type Conversion = {
|
|
1689
1690
|
conversion_id: ConversionId;
|
|
1691
|
+
/**
|
|
1692
|
+
* The assets the conversion stored, once stored: its main one, standing for the file, and the others, those of a
|
|
1693
|
+
* conversion embedded in another one included, e.g. the textures of an FBX file.
|
|
1694
|
+
*/
|
|
1695
|
+
assets: Array<{
|
|
1696
|
+
asset_id: AssetId;
|
|
1697
|
+
asset_type: AssetType;
|
|
1698
|
+
}>;
|
|
1690
1699
|
/** Asset unique identifier, a version 4 uuid in its canonical lowercase form */
|
|
1691
1700
|
asset_id?: string;
|
|
1692
1701
|
source_file_id: SourceFileId;
|
|
@@ -1725,6 +1734,67 @@ export type RemoteFile = {
|
|
|
1725
1734
|
/** The value of the Authorization header of the download, when it needs one */
|
|
1726
1735
|
authorization?: string;
|
|
1727
1736
|
};
|
|
1737
|
+
export type AssetGenerationOptions = {
|
|
1738
|
+
asset_type: 'collision_geometry';
|
|
1739
|
+
data_pipeline: 'collision-geometry-baker';
|
|
1740
|
+
/** What a collision geometry is baked from: submeshes of meshes, merged into one geometry. The data pipeline scheduler adds the asset's asset_name. */
|
|
1741
|
+
options: {
|
|
1742
|
+
/** The shape baked */
|
|
1743
|
+
collision_geometry_type: 0 | 1;
|
|
1744
|
+
/** The meshes the geometry is baked from */
|
|
1745
|
+
mesh_ids: Array<string>;
|
|
1746
|
+
/** For each mesh of mesh_ids, at the same index, the submeshes baked */
|
|
1747
|
+
submesh_indices_per_mesh: Array<Array<number>>;
|
|
1748
|
+
};
|
|
1749
|
+
} | {
|
|
1750
|
+
asset_type: 'navmesh';
|
|
1751
|
+
data_pipeline: 'navmesh-baker';
|
|
1752
|
+
/** What a navmesh is baked from, submeshes of meshes, and how Recast bakes it: each setting left out takes its default. The data pipeline scheduler adds the asset's asset_name. */
|
|
1753
|
+
options: {
|
|
1754
|
+
/** Traversal cost multiplier of each area, by area id: 1 for an area left out */
|
|
1755
|
+
area_costs?: Array<number>;
|
|
1756
|
+
/** Border around a tile, in voxels */
|
|
1757
|
+
border_size?: number;
|
|
1758
|
+
/** Build a bounding volume tree for each tile */
|
|
1759
|
+
build_bv_tree?: boolean;
|
|
1760
|
+
/** Build the detail mesh of each tile */
|
|
1761
|
+
build_detail_mesh?: boolean;
|
|
1762
|
+
/** Height of a voxel */
|
|
1763
|
+
cell_height?: number;
|
|
1764
|
+
/** Size of a voxel on the xz-plane */
|
|
1765
|
+
cell_size?: number;
|
|
1766
|
+
/** Distance between the samples of the detail mesh */
|
|
1767
|
+
detail_sample_dist?: number;
|
|
1768
|
+
/** Furthest the detail mesh strays from the heightfield */
|
|
1769
|
+
detail_sample_max_error?: number;
|
|
1770
|
+
/** Longest edge along the mesh border, in voxels, 0 for none */
|
|
1771
|
+
max_edge_len?: number;
|
|
1772
|
+
/** Furthest a simplified contour strays from the raw one, in voxels */
|
|
1773
|
+
max_simplification_error?: number;
|
|
1774
|
+
/** Most vertices a polygon has */
|
|
1775
|
+
max_verts_per_poly?: number;
|
|
1776
|
+
/** Area under which a region is merged into a larger one, in voxels */
|
|
1777
|
+
merge_region_area?: number;
|
|
1778
|
+
/** The meshes the navmesh is baked from */
|
|
1779
|
+
mesh_ids: Array<string>;
|
|
1780
|
+
/** Area of the smallest region kept, in voxels */
|
|
1781
|
+
min_region_area?: number;
|
|
1782
|
+
/** How the walkable area is partitioned into regions */
|
|
1783
|
+
partition_type?: 'watershed' | 'monotone' | 'layers';
|
|
1784
|
+
/** For each mesh of mesh_ids, at the same index, the submeshes baked */
|
|
1785
|
+
submesh_indices_per_mesh: Array<Array<number>>;
|
|
1786
|
+
/** Size of a tile, in voxels */
|
|
1787
|
+
tile_size?: number;
|
|
1788
|
+
/** Height of a step an agent climbs, in voxels */
|
|
1789
|
+
walkable_climb?: number;
|
|
1790
|
+
/** Height an agent needs, in voxels */
|
|
1791
|
+
walkable_height?: number;
|
|
1792
|
+
/** Radius of an agent, in voxels */
|
|
1793
|
+
walkable_radius?: number;
|
|
1794
|
+
/** Steepest slope an agent walks, in degrees */
|
|
1795
|
+
walkable_slope_angle?: number;
|
|
1796
|
+
};
|
|
1797
|
+
};
|
|
1728
1798
|
/** A line a conversion task logged, as logged */
|
|
1729
1799
|
export type ConversionLogLine = {
|
|
1730
1800
|
/**
|
|
@@ -8728,7 +8798,7 @@ export declare function listSourceFileAssets({ source_file_id, }: {
|
|
|
8728
8798
|
/**
|
|
8729
8799
|
* Imports files into a folder: source files, converted into assets, or asset packages, imported as they are. The
|
|
8730
8800
|
* 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
|
|
8801
|
+
* sent. An import may also generate an asset from others, in a JSON body (below). The accepted extensions, their
|
|
8732
8802
|
* conversion type and per-converter options are listed by `GET /source-files/supported-formats` and documented at
|
|
8733
8803
|
* https://docs.3dverse.com/references/supported-file-formats.
|
|
8734
8804
|
* The folder is given in the query, so that a request the folder's permission refuses is refused before any of its
|
|
@@ -8745,6 +8815,11 @@ export declare function listSourceFileAssets({ source_file_id, }: {
|
|
|
8745
8815
|
* permissions on it, referencing one the `read-asset` permission. A file named as an asset file but which is not a
|
|
8746
8816
|
* valid one fails the import, the files named otherwise being ignored. The payloads of shaders, scripts, animation
|
|
8747
8817
|
* sequences and animation graphs, compiled code which only a library builds, are ignored.
|
|
8818
|
+
* ### Generating an asset
|
|
8819
|
+
* A collision geometry or a navmesh is generated from meshes by a data pipeline of its type, which the JSON body
|
|
8820
|
+
* names along with the asset's type and name, and the options of the data pipeline's baker: the meshes, by
|
|
8821
|
+
* `mesh_ids`, with the submeshes of each, and what is baked, e.g. the shape of the collision geometry, or the Recast
|
|
8822
|
+
* settings of the navmesh, each left out taking its default. The meshes must exist and be readable by the caller.
|
|
8748
8823
|
* The import runs asynchronously, as a data pipeline, `getImport` telling its progress. It is rejected
|
|
8749
8824
|
* (`quota_exceeded`) once its files are unpacked if it would convert more source files than the plan of the
|
|
8750
8825
|
* environment's organization has left this month, or store more than its storage has left, the organization's
|
|
@@ -8755,29 +8830,86 @@ export declare function listSourceFileAssets({ source_file_id, }: {
|
|
|
8755
8830
|
* @throws {MissingAuthorizationHeader}
|
|
8756
8831
|
* @throws {InvalidApiKey}
|
|
8757
8832
|
* @throws {Unauthorized}
|
|
8758
|
-
* @throws {InvalidAuthorization}
|
|
8759
|
-
* @throws {InsufficientSecurityScope}
|
|
8760
|
-
* @throws {InsufficientPermissions}
|
|
8761
8833
|
* @throws {UploadedPayloadTooLarge}
|
|
8762
8834
|
* @throws {NoFileUploaded}
|
|
8763
8835
|
* @throws {UploadAborted}
|
|
8764
8836
|
* @throws {TooManyRequests}
|
|
8765
8837
|
*/
|
|
8766
|
-
export declare function createImport({ folder_id,
|
|
8838
|
+
export declare function createImport({ folder_id, body, }: {
|
|
8767
8839
|
folder_id: FolderId;
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8840
|
+
body: StrictUnion<{
|
|
8841
|
+
conversion_pipeline: ConversionPipeline;
|
|
8842
|
+
/** The files the import downloads */
|
|
8843
|
+
remote_files: Array<RemoteFile>;
|
|
8844
|
+
/** Options for the conversion pipeline. For future use. */
|
|
8845
|
+
options?: {
|
|
8846
|
+
[_additionalproperties_: string]: any;
|
|
8847
|
+
};
|
|
8848
|
+
} | (({
|
|
8849
|
+
asset_type: 'collision_geometry';
|
|
8850
|
+
data_pipeline: 'collision-geometry-baker';
|
|
8851
|
+
/** What a collision geometry is baked from: submeshes of meshes, merged into one geometry. The data pipeline scheduler adds the asset's asset_name. */
|
|
8852
|
+
options: {
|
|
8853
|
+
/** The shape baked */
|
|
8854
|
+
collision_geometry_type: 0 | 1;
|
|
8855
|
+
/** The meshes the geometry is baked from */
|
|
8856
|
+
mesh_ids: Array<string>;
|
|
8857
|
+
/** For each mesh of mesh_ids, at the same index, the submeshes baked */
|
|
8858
|
+
submesh_indices_per_mesh: Array<Array<number>>;
|
|
8859
|
+
};
|
|
8860
|
+
} | {
|
|
8861
|
+
asset_type: 'navmesh';
|
|
8862
|
+
data_pipeline: 'navmesh-baker';
|
|
8863
|
+
/** What a navmesh is baked from, submeshes of meshes, and how Recast bakes it: each setting left out takes its default. The data pipeline scheduler adds the asset's asset_name. */
|
|
8864
|
+
options: {
|
|
8865
|
+
/** Traversal cost multiplier of each area, by area id: 1 for an area left out */
|
|
8866
|
+
area_costs?: Array<number>;
|
|
8867
|
+
/** Border around a tile, in voxels */
|
|
8868
|
+
border_size?: number;
|
|
8869
|
+
/** Build a bounding volume tree for each tile */
|
|
8870
|
+
build_bv_tree?: boolean;
|
|
8871
|
+
/** Build the detail mesh of each tile */
|
|
8872
|
+
build_detail_mesh?: boolean;
|
|
8873
|
+
/** Height of a voxel */
|
|
8874
|
+
cell_height?: number;
|
|
8875
|
+
/** Size of a voxel on the xz-plane */
|
|
8876
|
+
cell_size?: number;
|
|
8877
|
+
/** Distance between the samples of the detail mesh */
|
|
8878
|
+
detail_sample_dist?: number;
|
|
8879
|
+
/** Furthest the detail mesh strays from the heightfield */
|
|
8880
|
+
detail_sample_max_error?: number;
|
|
8881
|
+
/** Longest edge along the mesh border, in voxels, 0 for none */
|
|
8882
|
+
max_edge_len?: number;
|
|
8883
|
+
/** Furthest a simplified contour strays from the raw one, in voxels */
|
|
8884
|
+
max_simplification_error?: number;
|
|
8885
|
+
/** Most vertices a polygon has */
|
|
8886
|
+
max_verts_per_poly?: number;
|
|
8887
|
+
/** Area under which a region is merged into a larger one, in voxels */
|
|
8888
|
+
merge_region_area?: number;
|
|
8889
|
+
/** The meshes the navmesh is baked from */
|
|
8890
|
+
mesh_ids: Array<string>;
|
|
8891
|
+
/** Area of the smallest region kept, in voxels */
|
|
8892
|
+
min_region_area?: number;
|
|
8893
|
+
/** How the walkable area is partitioned into regions */
|
|
8894
|
+
partition_type?: 'watershed' | 'monotone' | 'layers';
|
|
8895
|
+
/** For each mesh of mesh_ids, at the same index, the submeshes baked */
|
|
8896
|
+
submesh_indices_per_mesh: Array<Array<number>>;
|
|
8897
|
+
/** Size of a tile, in voxels */
|
|
8898
|
+
tile_size?: number;
|
|
8899
|
+
/** Height of a step an agent climbs, in voxels */
|
|
8900
|
+
walkable_climb?: number;
|
|
8901
|
+
/** Height an agent needs, in voxels */
|
|
8902
|
+
walkable_height?: number;
|
|
8903
|
+
/** Radius of an agent, in voxels */
|
|
8904
|
+
walkable_radius?: number;
|
|
8905
|
+
/** Steepest slope an agent walks, in degrees */
|
|
8906
|
+
walkable_slope_angle?: number;
|
|
8907
|
+
};
|
|
8908
|
+
}) & {
|
|
8909
|
+
/** The name of the asset generated */
|
|
8910
|
+
name: string;
|
|
8911
|
+
})>;
|
|
8912
|
+
}, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<{
|
|
8781
8913
|
import_id: ImportId;
|
|
8782
8914
|
}>;
|
|
8783
8915
|
/**
|
package/dist/index.js
CHANGED
|
@@ -180,13 +180,6 @@ function multipartBody(fields, files) {
|
|
|
180
180
|
}
|
|
181
181
|
return form;
|
|
182
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
|
-
}
|
|
190
183
|
function plainHeaders(headers) {
|
|
191
184
|
return headers instanceof import_axios.AxiosHeaders ? headers.toJSON() : { ...headers };
|
|
192
185
|
}
|
|
@@ -894,28 +887,15 @@ function listSourceFileAssets({
|
|
|
894
887
|
}
|
|
895
888
|
function createImport({
|
|
896
889
|
folder_id,
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
remote_files,
|
|
900
|
-
options
|
|
901
|
-
}, onUploadProgress, headers) {
|
|
890
|
+
body
|
|
891
|
+
}, headers) {
|
|
902
892
|
return axiosInstance({
|
|
903
893
|
method: "post",
|
|
904
894
|
url: "/imports",
|
|
905
895
|
params: {
|
|
906
896
|
folder_id
|
|
907
897
|
},
|
|
908
|
-
data:
|
|
909
|
-
{
|
|
910
|
-
conversion_pipeline,
|
|
911
|
-
remote_files,
|
|
912
|
-
options
|
|
913
|
-
},
|
|
914
|
-
{
|
|
915
|
-
files
|
|
916
|
-
}
|
|
917
|
-
),
|
|
918
|
-
onUploadProgress,
|
|
898
|
+
data: body,
|
|
919
899
|
headers
|
|
920
900
|
});
|
|
921
901
|
}
|