@imgly/plugin-ai-video-generation-web 0.1.10 → 0.2.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/dist/plugin.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type EditorPlugin } from '@cesdk/cesdk-js';
2
+ import { Output } from '@imgly/plugin-ai-generation-web';
2
3
  import { PluginConfiguration } from './types';
3
4
  export { PLUGIN_ID } from './constants';
4
- export declare function VideoGeneration(options: PluginConfiguration): Omit<EditorPlugin, 'name' | 'version'>;
5
+ export declare function VideoGeneration<I, O extends Output>(config: PluginConfiguration<I, O>): Omit<EditorPlugin, 'name' | 'version'>;
5
6
  export default VideoGeneration;
@@ -0,0 +1,30 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.createVideo";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.video.createVideo";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ uri: string;
16
+ };
17
+ declare const CreateVideo: GetQuickActionDefinition<InputType>;
18
+ /**
19
+ * Extend VideoQuickActionInputs with this action's input type.
20
+ * This will ensure that the types are correctly recognized
21
+ * in the VideoProvider.
22
+ *
23
+ * COPY this file to other quick action to support type safety
24
+ */
25
+ declare module '../types' {
26
+ interface VideoQuickActionInputs {
27
+ [ID]: InputType;
28
+ }
29
+ }
30
+ export default CreateVideo;
@@ -0,0 +1,6 @@
1
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
2
+ import { QuickActionDefinition } from '@imgly/plugin-ai-generation-web';
3
+ export type GetQuickActionDefinitionContext = {
4
+ cesdk: CreativeEditorSDK;
5
+ };
6
+ export type GetQuickActionDefinition<Q extends Record<string, any>> = (context: GetQuickActionDefinitionContext) => QuickActionDefinition<Q>;
package/dist/types.d.ts CHANGED
@@ -1,35 +1,66 @@
1
- import type CreativeEditorSDK from '@cesdk/cesdk-js';
2
- import { type Provider, type GenerationMiddleware } from '@imgly/plugin-ai-generation-web';
3
- type AiVideoProvider = (context: {
4
- cesdk: CreativeEditorSDK;
5
- }) => Promise<Provider<'video', any, any>>;
1
+ import { CommonPluginConfiguration, GetProvider, Output, Provider, VideoOutput } from '@imgly/plugin-ai-generation-web';
6
2
  /**
7
3
  * Configuration to set provider and models for video generation.
8
4
  */
9
- export interface PluginConfiguration {
5
+ export interface PluginConfiguration<I, O extends Output> extends CommonPluginConfiguration<'video', I, O> {
6
+ providers?: {
7
+ /**
8
+ * Provider of a model for video generation just from a (prompt) text.
9
+ */
10
+ text2video?: GetProvider<'video'>[] | GetProvider<'video'>;
11
+ /**
12
+ * Provider of a model for video generation from a given image.
13
+ */
14
+ image2video?: GetProvider<'video'>[] | GetProvider<'video'>;
15
+ };
10
16
  /**
11
17
  * Provider of a model for video generation just from a (prompt) text.
18
+ * @deprecated Use `providers.text2video` instead.
12
19
  */
13
- text2video?: AiVideoProvider;
20
+ text2video?: GetProvider<'video'>[] | GetProvider<'video'>;
14
21
  /**
15
22
  * Provider of a model for video generation from a given image.
23
+ * @deprecated Use `providers.image2video` instead.
16
24
  */
17
- image2video?: AiVideoProvider;
18
- /**
19
- * Render console logs for debugging purposes.
20
- */
21
- debug?: boolean;
22
- /**
23
- * Dry run mode. If set to true, the plugin will not make any API calls.
24
- */
25
- dryRun?: boolean;
26
- /**
27
- * Is called when the generation process is started. Can be used to
28
- * extend the generation process with additional steps.
29
- *
30
- * @param generate A function that starts the actual generation process.
31
- * @param context The context of the generation process.
32
- */
33
- middleware?: GenerationMiddleware;
25
+ image2video?: GetProvider<'video'>[] | GetProvider<'video'>;
26
+ }
27
+ /**
28
+ * Input types for video-specific quick actions
29
+ * This interface is extended by individual quick action files using module augmentation
30
+ */
31
+ export interface VideoQuickActionInputs {
32
+ }
33
+ /**
34
+ * Type-safe support mapping for image quick actions
35
+ * Allows `true` or `{}` when the quick action input type extends the provider input type
36
+ */
37
+ export type VideoQuickActionSupport<I, K extends keyof VideoQuickActionInputs> = VideoQuickActionInputs[K] extends I ? true | {
38
+ mapInput: (input: VideoQuickActionInputs[K]) => I;
39
+ } | {
40
+ [key: string]: any;
41
+ } : {
42
+ mapInput: (input: VideoQuickActionInputs[K]) => I;
43
+ };
44
+ /**
45
+ * Type-safe mapping for video quick action support
46
+ */
47
+ export type VideoQuickActionSupportMap<I> = {
48
+ [K in keyof VideoQuickActionInputs]?: VideoQuickActionSupport<I, K>;
49
+ } & {
50
+ [key: string]: true | {
51
+ mapInput: (input: any) => I;
52
+ } | {
53
+ [key: string]: any;
54
+ };
55
+ };
56
+ /**
57
+ * Video provider extension with type-safe quick action support
58
+ * Only parameterized by K (the quick action key), O is fixed to VideoOutput
59
+ */
60
+ export interface VideoProvider<I> extends Provider<'video', I, VideoOutput> {
61
+ input: Omit<Provider<'video', I, VideoOutput>['input'], 'quickActions'> & {
62
+ quickActions?: {
63
+ supported?: VideoQuickActionSupportMap<I>;
64
+ };
65
+ };
34
66
  }
35
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imgly/plugin-ai-video-generation-web",
3
- "version": "0.1.10",
3
+ "version": "0.2.0",
4
4
  "description": "AI video generation plugin for the CE.SDK editor",
5
5
  "keywords": ["CE.SDK", "plugin", "AI", "video-generation"],
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "build": "pnpm run clean && pnpm _syncPnpm && pnpm exec node scripts/build.mjs",
39
39
  "test": "echo No tests",
40
40
  "dev": "pnpm --filter \"${npm_package_name}^...\" --parallel run dev:wait && pnpm exec concurrently 'node scripts/watch.mjs' 'pnpm _syncPnpm --watch' --names 'build,sync deps'",
41
- "dev:wait": "pnpm exec wait-on ./dist/index.mjs ./dist/index.d.ts ./dist/fal-ai/index.mjs ./dist/fal-ai/index.d.ts --window 250 --timeout 30000",
41
+ "dev:wait": "pnpm exec wait-on ./dist/index.mjs ./dist/index.d.ts ./dist/fal-ai/index.mjs ./dist/fal-ai/index.d.ts --window 250 --timeout 60000",
42
42
  "dev:types": "tsc --emitDeclarationOnly --watch --preserveWatchOutput",
43
43
  "publish:latest": "pnpm run build && npm publish --tag latest --access public",
44
44
  "publish:next": "pnpm run build && npm publish --tag next --access public",