@volter/live 0.5.211 → 0.5.213

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.
Files changed (73) hide show
  1. package/BUNDLED_NOTICES +13 -13
  2. package/README.md +10 -11
  3. package/dist/asset-library.d.ts +98 -0
  4. package/dist/asset-library.js +7 -0
  5. package/dist/asset-library.js.map +7 -0
  6. package/dist/chunk-7WKVJGHZ.js +15 -0
  7. package/dist/chunk-7WKVJGHZ.js.map +7 -0
  8. package/dist/chunk-B2HUWFTT.js +25 -0
  9. package/dist/chunk-B2HUWFTT.js.map +7 -0
  10. package/dist/chunk-IZJOOON2.js +805 -0
  11. package/dist/chunk-IZJOOON2.js.map +7 -0
  12. package/dist/chunk-JDOIPALX.js +158 -0
  13. package/dist/chunk-JDOIPALX.js.map +7 -0
  14. package/dist/chunk-JFAHP5CC.js +218 -0
  15. package/dist/chunk-JFAHP5CC.js.map +7 -0
  16. package/dist/chunk-PC56TDHV.js +189 -0
  17. package/dist/chunk-PC56TDHV.js.map +7 -0
  18. package/dist/chunk-WIAH4XZE.js +82 -0
  19. package/dist/chunk-WIAH4XZE.js.map +7 -0
  20. package/dist/client.d.ts +376 -0
  21. package/dist/client.js +10 -0
  22. package/dist/client.js.map +7 -0
  23. package/dist/discovery.d.ts +32 -0
  24. package/dist/discovery.js +19 -0
  25. package/dist/discovery.js.map +7 -0
  26. package/dist/editor-document.d.ts +12 -47
  27. package/dist/editor.d.ts +45 -183
  28. package/dist/http-transport.d.ts +6 -0
  29. package/dist/index.d.ts +3 -6
  30. package/dist/index.js +83 -1762
  31. package/dist/index.js.map +4 -4
  32. package/dist/installed-package.d.ts +6 -0
  33. package/dist/installed-package.js +7 -0
  34. package/dist/installed-package.js.map +7 -0
  35. package/dist/lazy-proxy.d.ts +11 -11
  36. package/dist/member-hints.d.ts +6 -9
  37. package/dist/product-create.d.ts +29 -0
  38. package/dist/product-create.js +13 -0
  39. package/dist/product-create.js.map +7 -0
  40. package/dist/product-locator.d.ts +100 -0
  41. package/dist/product-locator.js +25 -0
  42. package/dist/product-locator.js.map +7 -0
  43. package/dist/registry-format.d.ts +72 -0
  44. package/dist/registry-format.js +31 -0
  45. package/dist/registry-format.js.map +7 -0
  46. package/dist/session.d.ts +11 -15
  47. package/dist/singleton.d.ts +1 -13
  48. package/dist/volter-manifest.d.ts +55 -0
  49. package/dist/volter-manifest.js +9 -0
  50. package/dist/volter-manifest.js.map +7 -0
  51. package/dist/workbench-locator.d.ts +84 -0
  52. package/dist/workbench-locator.js +416 -0
  53. package/dist/workbench-locator.js.map +7 -0
  54. package/package.json +39 -3
  55. package/src/asset-library.ts +104 -0
  56. package/src/client.ts +1093 -0
  57. package/src/discovery.ts +105 -0
  58. package/src/editor-document.ts +12 -49
  59. package/src/editor.ts +56 -215
  60. package/src/http-transport.ts +19 -0
  61. package/src/index.ts +5 -8
  62. package/src/installed-package.ts +15 -0
  63. package/src/lazy-proxy.ts +11 -11
  64. package/src/member-hints.ts +8 -12
  65. package/src/product-create.ts +38 -0
  66. package/src/product-locator.ts +327 -0
  67. package/src/registry-format.ts +248 -0
  68. package/src/session.ts +36 -144
  69. package/src/singleton.ts +1 -16
  70. package/src/volter-manifest.ts +97 -0
  71. package/src/workbench-locator.ts +625 -0
  72. package/dist/tools.d.ts +0 -23
  73. package/src/tools.ts +0 -45
@@ -0,0 +1,104 @@
1
+ /**
2
+ * THE ASSET LIBRARY, as the session's `/__editor/asset-library/*` routes answer it (editor-core's
3
+ * `server/asset-library-routes.ts`, which takes these shapes from here): search a source, list an asset's files, and
4
+ * download one into the project. `editor.assetLibrary` reaches it through `EditorClient`, so a request carries the
5
+ * session's connection token as every other one does.
6
+ */
7
+ import type { EditorClient } from './client.js';
8
+
9
+ /** An asset as a search answers it. */
10
+ export interface OnlineAsset {
11
+ id: string;
12
+ source: 'polyhaven' | 'ambientcg' | 'local';
13
+ name: string;
14
+ type: 'model' | 'animation' | 'source' | 'hdri' | 'texture' | 'material';
15
+ thumbnailUrl: string;
16
+ categories: string[];
17
+ tags: string[];
18
+ downloadCount?: number;
19
+ license?: string;
20
+ author?: string;
21
+ sourceUrl?: string;
22
+ cloudHosted?: boolean;
23
+ variantId?: string;
24
+ variantCount?: number;
25
+ sizeBytes?: number;
26
+ animationCount?: number;
27
+ deliveryKinds?: ('local-ssd' | 'cloud' | 'remote')[];
28
+ addedAt?: string;
29
+ capabilities?: {
30
+ previewable: boolean;
31
+ importable: boolean;
32
+ runtimeReady: boolean;
33
+ animated: boolean;
34
+ deliveryAvailable: boolean;
35
+ health: 'healthy' | 'source-only' | 'unsupported';
36
+ };
37
+ }
38
+
39
+ /** One file of an asset that can be downloaded (`files`); `download` takes it with the asset. */
40
+ export interface AssetFileOption {
41
+ label: string;
42
+ format: string;
43
+ url: string;
44
+ sizeBytes?: number;
45
+ /** Additional files that must be downloaded alongside the main URL (GLTF includes). */
46
+ includes?: { relativePath: string; url: string; size: number }[];
47
+ }
48
+
49
+ /** `GET /search`'s query. `type` is the kind the source names (`model`, `hdri`, …; `all` in the local catalog). */
50
+ export interface AssetSearchQuery {
51
+ source: OnlineAsset['source'];
52
+ type: string;
53
+ q?: string;
54
+ category?: string;
55
+ offset?: number;
56
+ limit?: number;
57
+ }
58
+
59
+ /** `POST /download`'s body: the asset and the file `files` offered for it. `license` is the search result's, which the
60
+ * route records for a remote source; the local catalog's own license is recorded whatever is passed. */
61
+ export interface AssetDownloadRequest {
62
+ source: OnlineAsset['source'];
63
+ id: string;
64
+ name: string;
65
+ url: string;
66
+ format: string;
67
+ includes?: AssetFileOption['includes'];
68
+ license?: string;
69
+ }
70
+
71
+ /** What a download answers: the file's path under the project's `public/`, the provenance operation that wrote it, and
72
+ * `ledgerError` when the asset and its license could not be recorded in `.volter/assets.json`. */
73
+ export interface AssetDownloadResult {
74
+ ok: true;
75
+ path: string;
76
+ provenanceOperationId?: string;
77
+ ledgerError?: string;
78
+ alreadyExists?: boolean;
79
+ }
80
+
81
+ /** `editor.assetLibrary`: the routes, one call each. */
82
+ export class LiveAssetLibrary {
83
+ readonly #client: EditorClient;
84
+
85
+ constructor(client: EditorClient) {
86
+ this.#client = client;
87
+ }
88
+
89
+ /** Search one source: `{ assets, total }`, each asset with its tags, license, author and source address. */
90
+ async search(query: AssetSearchQuery): Promise<{ assets: OnlineAsset[]; total: number }> {
91
+ return this.#client.assetLibraryRequest('GET', 'search', query);
92
+ }
93
+
94
+ /** The files an asset can be downloaded as. */
95
+ async files(asset: { source: OnlineAsset['source']; id: string }): Promise<{ files: AssetFileOption[] }> {
96
+ return this.#client.assetLibraryRequest('GET', 'files', asset);
97
+ }
98
+
99
+ /** Download one file of an asset into the project's `public/asset-library/`, recording the asset and its license in
100
+ * the project's `.volter/assets.json`. */
101
+ async download(request: AssetDownloadRequest): Promise<AssetDownloadResult> {
102
+ return this.#client.assetLibraryRequest('POST', 'download', request);
103
+ }
104
+ }