@cesdk/engine 1.58.0-nightly.20250808 → 1.58.0-nightly.20250810
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/assets/core/{cesdk-v1.58.0-nightly.20250808-LYJPJTXI.wasm → cesdk-v1.58.0-nightly.20250810-TQ5J2YPM.wasm} +0 -0
- package/assets/core/{worker-host-v1.58.0-nightly.20250808.js → worker-host-v1.58.0-nightly.20250810.js} +1 -1
- package/index.d.ts +73 -1
- package/index.js +1 -1
- package/package.json +1 -1
- /package/assets/core/{cesdk-v1.58.0-nightly.20250808-44YCFRT6.data → cesdk-v1.58.0-nightly.20250810-44YCFRT6.data} +0 -0
package/index.d.ts
CHANGED
|
@@ -271,11 +271,83 @@ export declare class AssetAPI {
|
|
|
271
271
|
addLocalSource(id: string, supportedMimeTypes?: string[], applyAsset?: (asset: CompleteAssetResult) => Promise<DesignBlockId | undefined>, applyAssetToBlock?: (asset: CompleteAssetResult, block: DesignBlockId) => Promise<void>): void;
|
|
272
272
|
/**
|
|
273
273
|
* Creates a new local asset source from a JSON string containing asset definitions.
|
|
274
|
+
*
|
|
275
|
+
* The JSON structure should contain a `version` field, an `id` field specifying the asset source identifier,
|
|
276
|
+
* and an `assets` array with asset definitions. Each asset should have an `id`, localized `label` object,
|
|
277
|
+
* and a `meta` object containing asset-specific properties like `uri`, `thumbUri`, `blockType`, etc.
|
|
278
|
+
*
|
|
279
|
+
* @category Asset Source Management
|
|
274
280
|
* @param contentJSON - The JSON string containing the asset definitions.
|
|
275
281
|
* @param basePath - An optional base path with which \{\{base_url\}\} strings in the assets should be replaced. If no value is provided, settings.basePath is used.
|
|
276
|
-
* @returns The ID of the newly created asset source
|
|
282
|
+
* @returns The ID of the newly created asset source (as specified in the JSON's `id` field).
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```javascript
|
|
286
|
+
* const json = JSON.stringify({
|
|
287
|
+
* "version": "2.0.0",
|
|
288
|
+
* "id": "my.custom.assets",
|
|
289
|
+
* "assets": [
|
|
290
|
+
* {
|
|
291
|
+
* "id": "sample_asset",
|
|
292
|
+
* "label": { "en": "Sample Asset" },
|
|
293
|
+
* "meta": {
|
|
294
|
+
* "uri": "https://example.com/asset.jpg",
|
|
295
|
+
* "thumbUri": "https://example.com/thumb.jpg",
|
|
296
|
+
* "blockType": "//ly.img.ubq/image"
|
|
297
|
+
* }
|
|
298
|
+
* }
|
|
299
|
+
* ]
|
|
300
|
+
* });
|
|
301
|
+
* const sourceId = await engine.asset.addLocalAssetSourceFromJSONString(json);
|
|
302
|
+
* console.log('Created asset source:', sourceId); // "my.custom.assets"
|
|
303
|
+
* ```
|
|
277
304
|
*/
|
|
278
305
|
addLocalAssetSourceFromJSONString(contentJSON: string, basePath?: string): Promise<string>;
|
|
306
|
+
/**
|
|
307
|
+
* Creates a new local asset source from a JSON URI.
|
|
308
|
+
*
|
|
309
|
+
* Loads and parses a JSON file from the specified URI to create an asset source. The JSON structure
|
|
310
|
+
* should contain a `version` field, an `id` field specifying the asset source identifier, and an
|
|
311
|
+
* `assets` array with asset definitions. The created asset source will have the ID specified in the
|
|
312
|
+
* JSON's `id` field, and all assets defined in the JSON will be added to the source.
|
|
313
|
+
*
|
|
314
|
+
* Note: The parent directory of the content.json URI will be used as the base path for resolving
|
|
315
|
+
* relative URLs in the asset definitions (e.g., `{{base_url}}` placeholders).
|
|
316
|
+
*
|
|
317
|
+
* @category Asset Source Management
|
|
318
|
+
* @param contentURI - The URI for the JSON file to load and parse.
|
|
319
|
+
* @returns The ID of the newly created asset source (as specified in the JSON's `id` field).
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```javascript
|
|
323
|
+
* // Load audio assets from IMG.LY's CDN
|
|
324
|
+
* const sourceId = await engine.asset.addLocalAssetSourceFromJSONURI(
|
|
325
|
+
* 'https://cdn.img.ly/assets/demo/v2/ly.img.audio/content.json'
|
|
326
|
+
* );
|
|
327
|
+
* console.log('Loaded asset source:', sourceId); // "ly.img.audio"
|
|
328
|
+
*
|
|
329
|
+
* // The parent directory (https://cdn.img.ly/assets/demo/v2/ly.img.audio/)
|
|
330
|
+
* // will be used as base path for resolving relative asset URLs
|
|
331
|
+
*
|
|
332
|
+
* // The JSON at this URL contains audio assets with structure like:
|
|
333
|
+
* // {
|
|
334
|
+
* // "version": "2.0.0",
|
|
335
|
+
* // "id": "ly.img.audio",
|
|
336
|
+
* // "assets": [
|
|
337
|
+
* // {
|
|
338
|
+
* // "id": "dance_harder",
|
|
339
|
+
* // "label": { "en": "Dance Harder" },
|
|
340
|
+
* // "meta": {
|
|
341
|
+
* // "uri": "https://cdn.img.ly/.../dance_harder.m4a",
|
|
342
|
+
* // "blockType": "//ly.img.ubq/audio",
|
|
343
|
+
* // "mimeType": "audio/x-m4a"
|
|
344
|
+
* // }
|
|
345
|
+
* // }
|
|
346
|
+
* // ]
|
|
347
|
+
* // }
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
addLocalAssetSourceFromJSONURI(contentURI: string): Promise<string>;
|
|
279
351
|
/**
|
|
280
352
|
* Remove a registered asset source.
|
|
281
353
|
*
|