n8n-nodes-piapi 0.1.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.
Files changed (94) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +41 -0
  3. package/dist/credentials/PiAPI.credentials.d.ts +8 -0
  4. package/dist/credentials/PiAPI.credentials.js +46 -0
  5. package/dist/credentials/PiAPI.credentials.js.map +1 -0
  6. package/dist/nodes/PiAPI/DreamMachine/DreamMachineExtendVideo.node.d.ts +5 -0
  7. package/dist/nodes/PiAPI/DreamMachine/DreamMachineExtendVideo.node.js +237 -0
  8. package/dist/nodes/PiAPI/DreamMachine/DreamMachineExtendVideo.node.js.map +1 -0
  9. package/dist/nodes/PiAPI/DreamMachine/DreamMachineImageToVideo.node.d.ts +5 -0
  10. package/dist/nodes/PiAPI/DreamMachine/DreamMachineImageToVideo.node.js +270 -0
  11. package/dist/nodes/PiAPI/DreamMachine/DreamMachineImageToVideo.node.js.map +1 -0
  12. package/dist/nodes/PiAPI/DreamMachine/DreamMachineTextToVideo.node.d.ts +5 -0
  13. package/dist/nodes/PiAPI/DreamMachine/DreamMachineTextToVideo.node.js +186 -0
  14. package/dist/nodes/PiAPI/DreamMachine/DreamMachineTextToVideo.node.js.map +1 -0
  15. package/dist/nodes/PiAPI/Flux/FluxImageToImage.node.d.ts +5 -0
  16. package/dist/nodes/PiAPI/Flux/FluxImageToImage.node.js +359 -0
  17. package/dist/nodes/PiAPI/Flux/FluxImageToImage.node.js.map +1 -0
  18. package/dist/nodes/PiAPI/Flux/FluxTextToImage.node.d.ts +5 -0
  19. package/dist/nodes/PiAPI/Flux/FluxTextToImage.node.js +398 -0
  20. package/dist/nodes/PiAPI/Flux/FluxTextToImage.node.js.map +1 -0
  21. package/dist/nodes/PiAPI/Hailuo/HailuoImageToVideo.node.d.ts +5 -0
  22. package/dist/nodes/PiAPI/Hailuo/HailuoImageToVideo.node.js +190 -0
  23. package/dist/nodes/PiAPI/Hailuo/HailuoImageToVideo.node.js.map +1 -0
  24. package/dist/nodes/PiAPI/Hailuo/HailuoSubjectVideo.node.d.ts +5 -0
  25. package/dist/nodes/PiAPI/Hailuo/HailuoSubjectVideo.node.js +140 -0
  26. package/dist/nodes/PiAPI/Hailuo/HailuoSubjectVideo.node.js.map +1 -0
  27. package/dist/nodes/PiAPI/Hailuo/HailuoTextToVideo.node.d.ts +5 -0
  28. package/dist/nodes/PiAPI/Hailuo/HailuoTextToVideo.node.js +150 -0
  29. package/dist/nodes/PiAPI/Hailuo/HailuoTextToVideo.node.js.map +1 -0
  30. package/dist/nodes/PiAPI/Hailuo/index.d.ts +4 -0
  31. package/dist/nodes/PiAPI/Hailuo/index.js +10 -0
  32. package/dist/nodes/PiAPI/Hailuo/index.js.map +1 -0
  33. package/dist/nodes/PiAPI/Hunyuan/HunyuanImageToVideo.node.d.ts +5 -0
  34. package/dist/nodes/PiAPI/Hunyuan/HunyuanImageToVideo.node.js +227 -0
  35. package/dist/nodes/PiAPI/Hunyuan/HunyuanImageToVideo.node.js.map +1 -0
  36. package/dist/nodes/PiAPI/Hunyuan/HunyuanTextToVideo.node.d.ts +5 -0
  37. package/dist/nodes/PiAPI/Hunyuan/HunyuanTextToVideo.node.js +142 -0
  38. package/dist/nodes/PiAPI/Hunyuan/HunyuanTextToVideo.node.js.map +1 -0
  39. package/dist/nodes/PiAPI/Hunyuan/index.d.ts +3 -0
  40. package/dist/nodes/PiAPI/Hunyuan/index.js +8 -0
  41. package/dist/nodes/PiAPI/Hunyuan/index.js.map +1 -0
  42. package/dist/nodes/PiAPI/Kling/KlingEffects.node.d.ts +5 -0
  43. package/dist/nodes/PiAPI/Kling/KlingEffects.node.js +175 -0
  44. package/dist/nodes/PiAPI/Kling/KlingEffects.node.js.map +1 -0
  45. package/dist/nodes/PiAPI/Kling/KlingImageToVideo.node.d.ts +5 -0
  46. package/dist/nodes/PiAPI/Kling/KlingImageToVideo.node.js +411 -0
  47. package/dist/nodes/PiAPI/Kling/KlingImageToVideo.node.js.map +1 -0
  48. package/dist/nodes/PiAPI/Kling/KlingLipSync.node.d.ts +13 -0
  49. package/dist/nodes/PiAPI/Kling/KlingLipSync.node.js +276 -0
  50. package/dist/nodes/PiAPI/Kling/KlingLipSync.node.js.map +1 -0
  51. package/dist/nodes/PiAPI/Kling/KlingTextToVideo.node.d.ts +5 -0
  52. package/dist/nodes/PiAPI/Kling/KlingTextToVideo.node.js +206 -0
  53. package/dist/nodes/PiAPI/Kling/KlingTextToVideo.node.js.map +1 -0
  54. package/dist/nodes/PiAPI/Kling/KlingTryOn.node.d.ts +5 -0
  55. package/dist/nodes/PiAPI/Kling/KlingTryOn.node.js +426 -0
  56. package/dist/nodes/PiAPI/Kling/KlingTryOn.node.js.map +1 -0
  57. package/dist/nodes/PiAPI/Kling/KlingVideoExtend.node.d.ts +5 -0
  58. package/dist/nodes/PiAPI/Kling/KlingVideoExtend.node.js +93 -0
  59. package/dist/nodes/PiAPI/Kling/KlingVideoExtend.node.js.map +1 -0
  60. package/dist/nodes/PiAPI/Skyreels/SkytreelsImageToVideo.node.d.ts +5 -0
  61. package/dist/nodes/PiAPI/Skyreels/SkytreelsImageToVideo.node.js +242 -0
  62. package/dist/nodes/PiAPI/Skyreels/SkytreelsImageToVideo.node.js.map +1 -0
  63. package/dist/nodes/PiAPI/Skyreels/index.d.ts +2 -0
  64. package/dist/nodes/PiAPI/Skyreels/index.js +6 -0
  65. package/dist/nodes/PiAPI/Skyreels/index.js.map +1 -0
  66. package/dist/nodes/PiAPI/TaskStatus/PiAPITaskStatus.node.d.ts +5 -0
  67. package/dist/nodes/PiAPI/TaskStatus/PiAPITaskStatus.node.js +125 -0
  68. package/dist/nodes/PiAPI/TaskStatus/PiAPITaskStatus.node.js.map +1 -0
  69. package/dist/nodes/PiAPI/Trellis/TrellisModelGeneration.node.d.ts +5 -0
  70. package/dist/nodes/PiAPI/Trellis/TrellisModelGeneration.node.js +262 -0
  71. package/dist/nodes/PiAPI/Trellis/TrellisModelGeneration.node.js.map +1 -0
  72. package/dist/nodes/PiAPI/Trellis/index.d.ts +2 -0
  73. package/dist/nodes/PiAPI/Trellis/index.js +6 -0
  74. package/dist/nodes/PiAPI/Trellis/index.js.map +1 -0
  75. package/dist/nodes/PiAPI/WanX/WanXImageToVideo.node.d.ts +5 -0
  76. package/dist/nodes/PiAPI/WanX/WanXImageToVideo.node.js +227 -0
  77. package/dist/nodes/PiAPI/WanX/WanXImageToVideo.node.js.map +1 -0
  78. package/dist/nodes/PiAPI/WanX/WanXTextToVideo.node.d.ts +5 -0
  79. package/dist/nodes/PiAPI/WanX/WanXTextToVideo.node.js +129 -0
  80. package/dist/nodes/PiAPI/WanX/WanXTextToVideo.node.js.map +1 -0
  81. package/dist/nodes/PiAPI/piapi.svg +5 -0
  82. package/dist/nodes/PiAPI/shared/Constants.d.ts +30 -0
  83. package/dist/nodes/PiAPI/shared/Constants.js +262 -0
  84. package/dist/nodes/PiAPI/shared/Constants.js.map +1 -0
  85. package/dist/nodes/PiAPI/shared/GenericFunctions.d.ts +3 -0
  86. package/dist/nodes/PiAPI/shared/GenericFunctions.js +43 -0
  87. package/dist/nodes/PiAPI/shared/GenericFunctions.js.map +1 -0
  88. package/dist/nodes/PiAPI/shared/Interfaces.d.ts +102 -0
  89. package/dist/nodes/PiAPI/shared/Interfaces.js +3 -0
  90. package/dist/nodes/PiAPI/shared/Interfaces.js.map +1 -0
  91. package/dist/package.json +95 -0
  92. package/dist/tsconfig.tsbuildinfo +1 -0
  93. package/index.js +6 -0
  94. package/package.json +95 -0
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HunyuanTextToVideo = void 0;
4
+ const GenericFunctions_1 = require("../shared/GenericFunctions");
5
+ class HunyuanTextToVideo {
6
+ constructor() {
7
+ this.description = {
8
+ displayName: 'PiAPI Hunyuan Text to Video',
9
+ name: 'hunyuanTextToVideo',
10
+ icon: 'file:../piapi.svg',
11
+ group: ['transform'],
12
+ version: 1,
13
+ description: 'Generate videos from text prompts using PiAPI Hunyuan',
14
+ defaults: {
15
+ name: 'Hunyuan Text to Video',
16
+ },
17
+ inputs: ["main"],
18
+ outputs: ["main"],
19
+ credentials: [
20
+ {
21
+ name: 'piAPIApi',
22
+ required: true,
23
+ },
24
+ ],
25
+ properties: [
26
+ {
27
+ displayName: 'Task Type',
28
+ name: 'taskType',
29
+ type: 'options',
30
+ options: [
31
+ {
32
+ name: 'Standard Text-to-Video',
33
+ value: 'txt2video',
34
+ description: 'Higher quality with more processing steps (20 steps, 85 FPS, 480x848/640x640)',
35
+ },
36
+ {
37
+ name: 'Fast Text-to-Video',
38
+ value: 'fast-txt2video',
39
+ description: 'Faster generation with fewer steps (6 steps, 85 FPS, 480x848/640x640)',
40
+ },
41
+ ],
42
+ default: 'txt2video',
43
+ description: 'Type of video generation task',
44
+ },
45
+ {
46
+ displayName: 'Prompt',
47
+ name: 'prompt',
48
+ type: 'string',
49
+ typeOptions: {
50
+ rows: 4,
51
+ },
52
+ default: '',
53
+ required: true,
54
+ description: 'Text prompt for video generation',
55
+ },
56
+ {
57
+ displayName: 'Aspect Ratio',
58
+ name: 'aspectRatio',
59
+ type: 'options',
60
+ options: [
61
+ {
62
+ name: '16:9',
63
+ value: '16:9',
64
+ description: 'Landscape (480x848)',
65
+ },
66
+ {
67
+ name: '9:16',
68
+ value: '9:16',
69
+ description: 'Portrait (848x480)',
70
+ },
71
+ {
72
+ name: '1:1',
73
+ value: '1:1',
74
+ description: 'Square (640x640)',
75
+ },
76
+ ],
77
+ default: '16:9',
78
+ description: 'Aspect ratio of the generated video',
79
+ },
80
+ {
81
+ displayName: 'Wait for Completion',
82
+ name: 'waitForCompletion',
83
+ type: 'boolean',
84
+ default: false,
85
+ description: 'Whether to wait for the task to complete before returning',
86
+ },
87
+ ],
88
+ };
89
+ }
90
+ async execute() {
91
+ const items = this.getInputData();
92
+ const returnData = [];
93
+ for (let i = 0; i < items.length; i++) {
94
+ const taskType = this.getNodeParameter('taskType', i);
95
+ const prompt = this.getNodeParameter('prompt', i);
96
+ const aspectRatio = this.getNodeParameter('aspectRatio', i);
97
+ const waitForCompletion = this.getNodeParameter('waitForCompletion', i, true);
98
+ const body = {
99
+ model: 'Qubico/hunyuan',
100
+ task_type: taskType,
101
+ input: {
102
+ prompt,
103
+ aspect_ratio: aspectRatio,
104
+ },
105
+ config: {
106
+ webhook_config: {
107
+ endpoint: '',
108
+ secret: '',
109
+ },
110
+ },
111
+ };
112
+ try {
113
+ const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', body);
114
+ if (response.code !== 200) {
115
+ throw new Error(`API Error: ${response.message}`);
116
+ }
117
+ const taskId = response.data.task_id;
118
+ let taskData = response.data;
119
+ if (waitForCompletion) {
120
+ taskData = await GenericFunctions_1.waitForTaskCompletion.call(this, taskId);
121
+ }
122
+ returnData.push({
123
+ json: taskData,
124
+ });
125
+ }
126
+ catch (error) {
127
+ if (this.continueOnFail()) {
128
+ returnData.push({
129
+ json: {
130
+ error: error.message,
131
+ },
132
+ });
133
+ continue;
134
+ }
135
+ throw error;
136
+ }
137
+ }
138
+ return [returnData];
139
+ }
140
+ }
141
+ exports.HunyuanTextToVideo = HunyuanTextToVideo;
142
+ //# sourceMappingURL=HunyuanTextToVideo.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HunyuanTextToVideo.node.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/Hunyuan/HunyuanTextToVideo.node.ts"],"names":[],"mappings":";;;AAQA,iEAAiF;AAEjF,MAAa,kBAAkB;IAA/B;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,6BAA6B;YAC1C,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE;gBACN,IAAI,EAAE,uBAAuB;aAChC;YACD,M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AAC,OAAO,CAAC;gBAErC,IAAI,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC;gBAG7B,IAAI,iBAAiB,EAAE,CAAC;oBACpB,QAAQ,GAAG,MAAM,wCAAqB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBAC9D,CAAC;gBAED,UAAU,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,QAAQ;iBACjB,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBACxB,UAAU,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE;4BACF,KAAK,EAAE,KAAK,CAAC,OAAO;yBACvB;qBACJ,CAAC,CAAC;oBACH,SAAS;gBACb,CAAC;gBACD,MAAM,KAAK,CAAC;YAChB,CAAC;QACL,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;CACJ;AAjJD,gDAiJC"}
@@ -0,0 +1,3 @@
1
+ import { HunyuanTextToVideo } from './HunyuanTextToVideo.node';
2
+ import { HunyuanImageToVideo } from './HunyuanImageToVideo.node';
3
+ export { HunyuanTextToVideo, HunyuanImageToVideo };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HunyuanImageToVideo = exports.HunyuanTextToVideo = void 0;
4
+ const HunyuanTextToVideo_node_1 = require("./HunyuanTextToVideo.node");
5
+ Object.defineProperty(exports, "HunyuanTextToVideo", { enumerable: true, get: function () { return HunyuanTextToVideo_node_1.HunyuanTextToVideo; } });
6
+ const HunyuanImageToVideo_node_1 = require("./HunyuanImageToVideo.node");
7
+ Object.defineProperty(exports, "HunyuanImageToVideo", { enumerable: true, get: function () { return HunyuanImageToVideo_node_1.HunyuanImageToVideo; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/Hunyuan/index.ts"],"names":[],"mappings":";;;AAAA,uEAA+D;AAGtD,mGAHA,4CAAkB,OAGA;AAF3B,yEAAiE;AAEpC,oGAFpB,8CAAmB,OAEoB"}
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class KlingEffects implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KlingEffects = void 0;
4
+ const GenericFunctions_1 = require("../shared/GenericFunctions");
5
+ class KlingEffects {
6
+ constructor() {
7
+ this.description = {
8
+ displayName: 'PiAPI Kling Effects',
9
+ name: 'klingEffects',
10
+ icon: 'file:../piapi.svg',
11
+ group: ['transform'],
12
+ version: 1,
13
+ description: 'Generate videos with special effects using PiAPI Kling',
14
+ defaults: {
15
+ name: 'Kling Effects',
16
+ },
17
+ inputs: ["main"],
18
+ outputs: ["main"],
19
+ credentials: [
20
+ {
21
+ name: 'piAPIApi',
22
+ required: true,
23
+ },
24
+ ],
25
+ properties: [
26
+ {
27
+ displayName: 'Image Source',
28
+ name: 'imageSource',
29
+ type: 'options',
30
+ options: [
31
+ {
32
+ name: 'URL',
33
+ value: 'url',
34
+ description: 'Load image from URL',
35
+ },
36
+ {
37
+ name: 'Binary Data',
38
+ value: 'binaryData',
39
+ description: 'Use image from binary field',
40
+ },
41
+ ],
42
+ default: 'url',
43
+ description: 'Where to get the image from',
44
+ },
45
+ {
46
+ displayName: 'Image URL',
47
+ name: 'imageUrl',
48
+ type: 'string',
49
+ default: '',
50
+ required: true,
51
+ displayOptions: {
52
+ show: {
53
+ imageSource: ['url'],
54
+ },
55
+ },
56
+ description: 'URL of the image to apply effects to',
57
+ },
58
+ {
59
+ displayName: 'Binary Property',
60
+ name: 'binaryPropertyName',
61
+ type: 'string',
62
+ default: 'data',
63
+ required: true,
64
+ displayOptions: {
65
+ show: {
66
+ imageSource: ['binaryData'],
67
+ },
68
+ },
69
+ description: 'Name of the binary property containing the image',
70
+ },
71
+ {
72
+ displayName: 'Effect',
73
+ name: 'effect',
74
+ type: 'options',
75
+ options: [
76
+ {
77
+ name: 'Squish',
78
+ value: 'squish',
79
+ description: 'Apply a squish effect to generate video',
80
+ },
81
+ {
82
+ name: 'Expansion',
83
+ value: 'expansion',
84
+ description: 'Apply an expansion effect to generate video',
85
+ },
86
+ ],
87
+ default: 'squish',
88
+ description: 'Type of effect to apply',
89
+ },
90
+ {
91
+ displayName: 'Wait for Completion',
92
+ name: 'waitForCompletion',
93
+ type: 'boolean',
94
+ default: false,
95
+ description: 'Whether to wait for the task to complete before returning',
96
+ },
97
+ ],
98
+ };
99
+ }
100
+ async execute() {
101
+ var _a;
102
+ const items = this.getInputData();
103
+ const returnData = [];
104
+ for (let i = 0; i < items.length; i++) {
105
+ try {
106
+ const imageSource = this.getNodeParameter('imageSource', i);
107
+ const effect = this.getNodeParameter('effect', i);
108
+ const waitForCompletion = this.getNodeParameter('waitForCompletion', i, false);
109
+ let imageUrl = '';
110
+ if (imageSource === 'url') {
111
+ imageUrl = this.getNodeParameter('imageUrl', i);
112
+ try {
113
+ new URL(imageUrl);
114
+ }
115
+ catch (error) {
116
+ throw new Error(`Invalid image URL: ${error.message}`);
117
+ }
118
+ }
119
+ else if (imageSource === 'binaryData') {
120
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
121
+ const binaryItem = (_a = items[i].binary) === null || _a === void 0 ? void 0 : _a[binaryPropertyName];
122
+ if (!binaryItem) {
123
+ throw new Error(`No binary data found in property ${binaryPropertyName}`);
124
+ }
125
+ const binaryData = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
126
+ if (!binaryData) {
127
+ throw new Error(`No binary data found in property ${binaryPropertyName}`);
128
+ }
129
+ const binaryMimeType = binaryItem.mimeType || 'image/png';
130
+ imageUrl = `data:${binaryMimeType};base64,${binaryData.toString('base64')}`;
131
+ }
132
+ const body = {
133
+ model: 'kling',
134
+ task_type: 'effects',
135
+ input: {
136
+ image_url: imageUrl,
137
+ effect,
138
+ },
139
+ config: {
140
+ webhook_config: {
141
+ endpoint: '',
142
+ secret: '',
143
+ },
144
+ },
145
+ };
146
+ const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', body);
147
+ if (response.code !== 200) {
148
+ throw new Error(`API Error: ${response.message}`);
149
+ }
150
+ const taskId = response.data.task_id;
151
+ let taskData = response.data;
152
+ if (waitForCompletion) {
153
+ taskData = await GenericFunctions_1.waitForTaskCompletion.call(this, taskId);
154
+ }
155
+ returnData.push({
156
+ json: taskData,
157
+ });
158
+ }
159
+ catch (error) {
160
+ if (this.continueOnFail()) {
161
+ returnData.push({
162
+ json: {
163
+ error: error.message,
164
+ },
165
+ });
166
+ continue;
167
+ }
168
+ throw error;
169
+ }
170
+ }
171
+ return [returnData];
172
+ }
173
+ }
174
+ exports.KlingEffects = KlingEffects;
175
+ //# sourceMappingURL=KlingEffects.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KlingEffects.node.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/Kling/KlingEffects.node.ts"],"names":[],"mappings":";;;AAQA,iEAAiF;AAEjF,MAAa,YAAY;IAAzB;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE;gBACN,IAAI,EAAE,eAAe;aACxB;YACD,MAAM,EAAE,QAAyB;YACjC,OAAO,EAAE,QAAyB;YAClC,WAAW,EAAE;gBACT;oBACI,IAAI,EAAE,UAAU;oBAChB,QAAQ,EAAE,IAAI;iBACjB;aACJ;YACD,UAAU,EAAE;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AI,EAAE,MAAM,CAAC,CAAC;gBAC9D,CAAC;gBAED,UAAU,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,QAAQ;iBACjB,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBACxB,UAAU,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE;4BACF,KAAK,EAAE,KAAK,CAAC,OAAO;yBACvB;qBACJ,CAAC,CAAC;oBACH,SAAS;gBACb,CAAC;gBACD,MAAM,KAAK,CAAC;YAChB,CAAC;QACL,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;CACJ;AArLD,oCAqLC"}
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class KlingImageToVideo implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }