@imgly/plugin-ai-generation-web 0.1.0-rc.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.
- package/README.md +798 -0
- package/dist/__tests__/middleware-disposer.test.d.ts +1 -0
- package/dist/__tests__/middleware-rateLimiting.test.d.ts +1 -0
- package/dist/__tests__/middleware.test.d.ts +1 -0
- package/dist/__tests__/utils.test.d.ts +1 -0
- package/dist/common/renderImageUrlProperty.d.ts +14 -0
- package/dist/generation/generate.d.ts +16 -0
- package/dist/generation/getAssetResultForGenerated.d.ts +4 -0
- package/dist/generation/getAssetResultForPlaceholder.d.ts +4 -0
- package/dist/generation/getDryRunOutput.d.ts +3 -0
- package/dist/generation/handleGenerationError.d.ts +9 -0
- package/dist/generation/initProvider.d.ts +20 -0
- package/dist/generation/middleware/alwaysOnTopMiddleware.d.ts +14 -0
- package/dist/generation/middleware/editModeMiddleware.d.ts +30 -0
- package/dist/generation/middleware/highlightBlocksMiddleware.d.ts +24 -0
- package/dist/generation/middleware/lockMiddleware.d.ts +19 -0
- package/dist/generation/middleware/loggingMiddleware.d.ts +4 -0
- package/dist/generation/middleware/middleware.d.ts +35 -0
- package/dist/generation/middleware/pendingMiddleware.d.ts +14 -0
- package/dist/generation/middleware/rateLimitMiddleware.d.ts +40 -0
- package/dist/generation/openapi/dereferenceDocument.d.ts +14 -0
- package/dist/generation/openapi/getProperties.d.ts +5 -0
- package/dist/generation/openapi/isOpenAPISchema.d.ts +9 -0
- package/dist/generation/openapi/renderProperty.d.ts +6 -0
- package/dist/generation/openapi/types.d.ts +41 -0
- package/dist/generation/previewUri.d.ts +2 -0
- package/dist/generation/provider.d.ts +373 -0
- package/dist/generation/quickAction/consumeGeneratedResult.d.ts +23 -0
- package/dist/generation/quickAction/getQuickActionMenu.d.ts +10 -0
- package/dist/generation/quickAction/registerQuickActionMenuComponent.d.ts +12 -0
- package/dist/generation/quickAction/types.d.ts +25 -0
- package/dist/generation/quickAction/utils.d.ts +13 -0
- package/dist/generation/registerPanelInputCustom.d.ts +6 -0
- package/dist/generation/registerPanelInputSchema.d.ts +9 -0
- package/dist/generation/renderGenerationComponents.d.ts +15 -0
- package/dist/generation/types.d.ts +56 -0
- package/dist/icons.d.ts +3 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.mjs +81 -0
- package/dist/index.mjs.map +7 -0
- package/dist/registerDockComponent.d.ts +10 -0
- package/dist/utils.d.ts +66 -0
- package/package.json +67 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
2
|
+
/**
|
|
3
|
+
* Registers a dock component for AI generation that opens
|
|
4
|
+
* the AI generation panel and closes any other AI panels.
|
|
5
|
+
*/
|
|
6
|
+
declare function registerDockComponent(options: {
|
|
7
|
+
cesdk: CreativeEditorSDK;
|
|
8
|
+
panelId: string;
|
|
9
|
+
}): void;
|
|
10
|
+
export default registerDockComponent;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';
|
|
2
|
+
import { GenerationResult, Output } from './generation/provider';
|
|
3
|
+
export declare const AI_PANEL_ID_PREFIX = "ly.img.ai";
|
|
4
|
+
/**
|
|
5
|
+
* Adding asset to the scene.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: Will use a temporary asset source so that
|
|
8
|
+
* our asset source middleware trigger. This is necessary since there is
|
|
9
|
+
* a lot of extra logic in the video middlewares regarding trim, position etc.
|
|
10
|
+
*
|
|
11
|
+
* These will only trigger via an asset source, not by calling
|
|
12
|
+
* `defaultApplyAsset` directly.
|
|
13
|
+
*/
|
|
14
|
+
export declare function addAssetToScene(cesdk: CreativeEditorSDK, assetResult: AssetResult): Promise<number | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a consistent panel ID for a provider ID
|
|
17
|
+
*/
|
|
18
|
+
export declare function getPanelId(providerId: string): string;
|
|
19
|
+
export default getPanelId;
|
|
20
|
+
/**
|
|
21
|
+
* Extracts a readable error message from an unknown error
|
|
22
|
+
*
|
|
23
|
+
* @param error The error caught in a try/catch block
|
|
24
|
+
* @param fallbackMessage Optional fallback message if error is not an Error object
|
|
25
|
+
* @returns A string representation of the error
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractErrorMessage(error: unknown, fallbackMessage?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Generates a random UUID v4
|
|
30
|
+
*/
|
|
31
|
+
export declare function uuid4(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the duration of a video from a URL
|
|
34
|
+
* @param url - The URL of the video
|
|
35
|
+
* @returns A promise that resolves to the duration of the video in seconds
|
|
36
|
+
*/
|
|
37
|
+
export declare function getDurationForVideo(url: string): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets a thumbnail image from a video URL
|
|
40
|
+
* @param url - The URL of the video
|
|
41
|
+
* @param seekTime - Time in seconds to capture the thumbnail (default: 0)
|
|
42
|
+
* @param format - Image format for the thumbnail (default: 'image/jpeg')
|
|
43
|
+
* @param quality - Image quality between 0 and 1 (default: 0.8)
|
|
44
|
+
* @returns A promise that resolves to the thumbnail data URL
|
|
45
|
+
*/
|
|
46
|
+
export declare function getThumbnailForVideo(url: string, seekTime?: number, format?: string, quality?: number): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Converts an ID string to a human-readable label
|
|
49
|
+
* @param id - The ID string to convert
|
|
50
|
+
* @returns A human-readable label derived from the ID
|
|
51
|
+
*
|
|
52
|
+
* Examples:
|
|
53
|
+
* - snake_case_id → Snake Case Id
|
|
54
|
+
* - kebab-case-id → Kebab Case Id
|
|
55
|
+
* - camelCaseId → Camel Case Id
|
|
56
|
+
* - PascalCaseId → Pascal Case Id
|
|
57
|
+
*/
|
|
58
|
+
export declare function getLabelFromId(id: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Type guard to check if a value is an AsyncGenerator rather than a Promise
|
|
61
|
+
*
|
|
62
|
+
* @param value - Value of type Promise<O> | AsyncGenerator<O, C>
|
|
63
|
+
* @returns Boolean indicating if the value is an AsyncGenerator
|
|
64
|
+
*/
|
|
65
|
+
export declare function isAsyncGenerator<O extends Output, C>(value: GenerationResult<O, C>): value is AsyncGenerator<O, C>;
|
|
66
|
+
export declare function isAbortError(error: unknown): error is Error;
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@imgly/plugin-ai-generation-web",
|
|
3
|
+
"version": "0.1.0-rc.0",
|
|
4
|
+
"description": "AI generation plugin for the CE.SDK editor",
|
|
5
|
+
"keywords": ["CE.SDK", "plugin", "AI", "ai generation"],
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/imgly/plugins.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "IMG.LY GmbH",
|
|
13
|
+
"email": "support@img.ly",
|
|
14
|
+
"url": "https://img.ly"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"email": "support@img.ly"
|
|
18
|
+
},
|
|
19
|
+
"source": "./src/index.ts",
|
|
20
|
+
"module": "./dist/index.mjs",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./dist/index.mjs",
|
|
25
|
+
"types": "./dist/index.d.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://img.ly/products/creative-sdk",
|
|
29
|
+
"files": ["LICENSE.md", "README.md", "CHANGELOG.md", "dist/", "bin/"],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"start": "pnpm run watch",
|
|
32
|
+
"clean": "pnpm exec rimraf dist",
|
|
33
|
+
"purge": "pnpm exec rimraf node_modules",
|
|
34
|
+
"build": "pnpm run clean && pnpm _syncPnpm && pnpm exec node scripts/build.mjs",
|
|
35
|
+
"publish:latest": "pnpm run build && npm publish --tag latest --access public",
|
|
36
|
+
"publish:next": "pnpm run build && npm publish --tag next --access public",
|
|
37
|
+
"test": "jest",
|
|
38
|
+
"test:watch": "jest --watch",
|
|
39
|
+
"test:coverage": "jest --coverage",
|
|
40
|
+
"dev": "pnpm --filter \"${npm_package_name}^...\" --parallel run dev:wait && node scripts/watch.mjs",
|
|
41
|
+
"dev:wait": "pnpm exec wait-on ./dist/index.mjs ./dist/index.d.ts --window 250 --timeout 30000",
|
|
42
|
+
"check:all": "concurrently -n lint,type,pretty \"pnpm run check:lint\" \"pnpm run check:types\" \"pnpm run check:pretty\"",
|
|
43
|
+
"check:lint": "eslint --max-warnings 0 './src/**/*.{ts,tsx}'",
|
|
44
|
+
"check:pretty": "prettier --list-different './src/**/*.{ts,tsx}'",
|
|
45
|
+
"check:types": "tsc --noEmit",
|
|
46
|
+
"types:create": "tsc --emitDeclarationOnly",
|
|
47
|
+
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@cesdk/cesdk-js": "^1.48.0",
|
|
51
|
+
"@imgly/plugin-utils": "workspace:*",
|
|
52
|
+
"esbuild": "^0.19.12",
|
|
53
|
+
"jest": "^29.7.0",
|
|
54
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
55
|
+
"ts-jest": "^29.1.2",
|
|
56
|
+
"ts-node": "^10.9.2",
|
|
57
|
+
"openapi-types": "^12.1.3"
|
|
58
|
+
},
|
|
59
|
+
"dependenciesMeta": {
|
|
60
|
+
"@imgly/plugin-utils": {
|
|
61
|
+
"injected": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@cesdk/cesdk-js": "^1.48.0"
|
|
66
|
+
}
|
|
67
|
+
}
|