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,262 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrellisModelGeneration = void 0;
4
+ const GenericFunctions_1 = require("../shared/GenericFunctions");
5
+ class TrellisModelGeneration {
6
+ constructor() {
7
+ this.description = {
8
+ displayName: 'PiAPI Trellis Image to 3D Model',
9
+ name: 'trellis3DModelGeneration',
10
+ icon: 'file:../piapi.svg',
11
+ group: ['transform'],
12
+ version: 1,
13
+ description: 'Generate 3D models from images using Microsoft Trellis via PiAPI',
14
+ defaults: {
15
+ name: 'Trellis 3D Model Generation',
16
+ },
17
+ inputs: ["main"],
18
+ outputs: ["main"],
19
+ credentials: [
20
+ {
21
+ name: 'piAPIApi',
22
+ required: true,
23
+ },
24
+ ],
25
+ properties: [
26
+ {
27
+ displayName: 'Image Input Method',
28
+ name: 'imageInputMethod',
29
+ type: 'options',
30
+ options: [
31
+ {
32
+ name: 'URL',
33
+ value: 'url',
34
+ description: 'Image accessible via URL',
35
+ },
36
+ {
37
+ name: 'Base64',
38
+ value: 'base64',
39
+ description: 'Base64 encoded image data',
40
+ },
41
+ {
42
+ name: 'Binary Data',
43
+ value: 'binaryData',
44
+ description: 'Binary data from previous node',
45
+ },
46
+ ],
47
+ default: 'url',
48
+ description: 'How to input the image',
49
+ },
50
+ {
51
+ displayName: 'Image URL',
52
+ name: 'imageUrl',
53
+ type: 'string',
54
+ default: '',
55
+ required: true,
56
+ description: 'URL of the image to convert to 3D (max size 1024x1024, image will be downloaded and converted to base64)',
57
+ displayOptions: {
58
+ show: {
59
+ imageInputMethod: ['url'],
60
+ },
61
+ },
62
+ },
63
+ {
64
+ displayName: 'Base64 Image',
65
+ name: 'base64Image',
66
+ type: 'string',
67
+ typeOptions: {
68
+ rows: 4,
69
+ },
70
+ default: '',
71
+ required: true,
72
+ description: 'Base64 encoded image data (max image size is 1024x1024)',
73
+ displayOptions: {
74
+ show: {
75
+ imageInputMethod: ['base64'],
76
+ },
77
+ },
78
+ },
79
+ {
80
+ displayName: 'Binary Property',
81
+ name: 'binaryPropertyName',
82
+ type: 'string',
83
+ default: 'data',
84
+ required: true,
85
+ description: 'Name of the binary property containing the image to convert to 3D',
86
+ displayOptions: {
87
+ show: {
88
+ imageInputMethod: ['binaryData'],
89
+ },
90
+ },
91
+ },
92
+ {
93
+ displayName: 'Seed',
94
+ name: 'seed',
95
+ type: 'number',
96
+ default: 0,
97
+ description: 'Random seed for reproducible results (0 for random)',
98
+ },
99
+ {
100
+ displayName: 'Advanced Options',
101
+ name: 'advancedOptions',
102
+ type: 'collection',
103
+ placeholder: 'Add Option',
104
+ default: {},
105
+ options: [
106
+ {
107
+ displayName: 'Surface Sampling Steps',
108
+ name: 'ssSamplingSteps',
109
+ type: 'number',
110
+ typeOptions: {
111
+ minValue: 10,
112
+ maxValue: 50,
113
+ },
114
+ default: 50,
115
+ description: 'Number of sampling steps for surface creation (10-50, higher means better quality but slower)',
116
+ },
117
+ {
118
+ displayName: 'SLAT Sampling Steps',
119
+ name: 'slatSamplingSteps',
120
+ type: 'number',
121
+ typeOptions: {
122
+ minValue: 10,
123
+ maxValue: 50,
124
+ },
125
+ default: 50,
126
+ description: 'Number of sampling steps for SLAT process (10-50, higher means better quality but slower)',
127
+ },
128
+ {
129
+ displayName: 'Surface Guidance Strength',
130
+ name: 'ssGuidanceStrength',
131
+ type: 'number',
132
+ typeOptions: {
133
+ minValue: 0.1,
134
+ maxValue: 10,
135
+ },
136
+ default: 7.5,
137
+ description: 'Guidance strength for surface creation (0.1-10)',
138
+ },
139
+ {
140
+ displayName: 'SLAT Guidance Strength',
141
+ name: 'slatGuidanceStrength',
142
+ type: 'number',
143
+ typeOptions: {
144
+ minValue: 0.1,
145
+ maxValue: 10,
146
+ },
147
+ default: 3,
148
+ description: 'Guidance strength for SLAT process (0.1-10)',
149
+ },
150
+ ],
151
+ },
152
+ {
153
+ displayName: 'Wait for Completion',
154
+ name: 'waitForCompletion',
155
+ type: 'boolean',
156
+ default: false,
157
+ description: 'Whether to wait for the 3D model generation to complete before returning',
158
+ },
159
+ {
160
+ displayName: 'Note',
161
+ name: 'note',
162
+ type: 'notice',
163
+ default: '3D model generation can take several minutes. Use the Task Status node to check progress and retrieve results later.',
164
+ },
165
+ ],
166
+ };
167
+ }
168
+ async execute() {
169
+ var _a;
170
+ const items = this.getInputData();
171
+ const returnData = [];
172
+ for (let i = 0; i < items.length; i++) {
173
+ try {
174
+ const imageInputMethod = this.getNodeParameter('imageInputMethod', i);
175
+ const seed = this.getNodeParameter('seed', i, 0);
176
+ const waitForCompletion = this.getNodeParameter('waitForCompletion', i, false);
177
+ const advancedOptions = this.getNodeParameter('advancedOptions', i, {});
178
+ let image = '';
179
+ if (imageInputMethod === 'url') {
180
+ const imageUrl = this.getNodeParameter('imageUrl', i);
181
+ try {
182
+ const imageResponse = await this.helpers.request({
183
+ method: 'GET',
184
+ url: imageUrl,
185
+ encoding: null,
186
+ resolveWithFullResponse: true,
187
+ });
188
+ const buffer = Buffer.from(imageResponse.body);
189
+ const contentType = imageResponse.headers['content-type'] || 'image/png';
190
+ image = `data:${contentType};base64,${buffer.toString('base64')}`;
191
+ }
192
+ catch (error) {
193
+ throw new Error(`Failed to download image from URL: ${error.message}. Trellis API requires direct access to images, which some websites block. Try downloading the image first and using the Binary Data input method instead.`);
194
+ }
195
+ }
196
+ else if (imageInputMethod === 'base64') {
197
+ image = this.getNodeParameter('base64Image', i);
198
+ if (!image.startsWith('data:image/')) {
199
+ image = `data:image/jpeg;base64,${image}`;
200
+ }
201
+ }
202
+ else if (imageInputMethod === 'binaryData') {
203
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
204
+ const binaryItem = (_a = items[i].binary) === null || _a === void 0 ? void 0 : _a[binaryPropertyName];
205
+ if (!binaryItem) {
206
+ throw new Error(`No binary data found in property "${binaryPropertyName}"`);
207
+ }
208
+ const binaryData = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
209
+ if (!binaryData) {
210
+ throw new Error(`No binary data found in property "${binaryPropertyName}"`);
211
+ }
212
+ const binaryMimeType = binaryItem.mimeType || 'image/png';
213
+ image = `data:${binaryMimeType};base64,${binaryData.toString('base64')}`;
214
+ }
215
+ const body = {
216
+ model: 'Qubico/trellis',
217
+ task_type: 'image-to-3d',
218
+ input: {
219
+ image,
220
+ seed,
221
+ ss_sampling_steps: advancedOptions.ssSamplingSteps || 50,
222
+ slat_sampling_steps: advancedOptions.slatSamplingSteps || 50,
223
+ ss_guidance_strength: advancedOptions.ssGuidanceStrength || 7.5,
224
+ slat_guidance_strength: advancedOptions.slatGuidanceStrength || 3,
225
+ },
226
+ config: {
227
+ webhook_config: {
228
+ endpoint: '',
229
+ secret: '',
230
+ },
231
+ },
232
+ };
233
+ const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', body);
234
+ if (response.code !== 200) {
235
+ throw new Error(`API Error: ${response.message}`);
236
+ }
237
+ const taskId = response.data.task_id;
238
+ let taskData = response.data;
239
+ if (waitForCompletion) {
240
+ taskData = await GenericFunctions_1.waitForTaskCompletion.call(this, taskId);
241
+ }
242
+ returnData.push({
243
+ json: taskData,
244
+ });
245
+ }
246
+ catch (error) {
247
+ if (this.continueOnFail()) {
248
+ returnData.push({
249
+ json: {
250
+ error: error.message,
251
+ },
252
+ });
253
+ continue;
254
+ }
255
+ throw error;
256
+ }
257
+ }
258
+ return [returnData];
259
+ }
260
+ }
261
+ exports.TrellisModelGeneration = TrellisModelGeneration;
262
+ //# sourceMappingURL=TrellisModelGeneration.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrellisModelGeneration.node.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/Trellis/TrellisModelGeneration.node.ts"],"names":[],"mappings":";;;AAQA,iEAAiF;AAEjF,MAAa,sBAAsB;IAAnC;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,iCAAiC;YAC9C,IAAI,EAAE,0BAA0B;YAChC,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,kEAAkE;YAC/E,QAAQ,EAAE;gBACN,IAAI,EAAE,6BAA6B;aACtC;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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AAC,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;AAjRD,wDAiRC"}
@@ -0,0 +1,2 @@
1
+ import { TrellisModelGeneration } from './TrellisModelGeneration.node';
2
+ export { TrellisModelGeneration, };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrellisModelGeneration = void 0;
4
+ const TrellisModelGeneration_node_1 = require("./TrellisModelGeneration.node");
5
+ Object.defineProperty(exports, "TrellisModelGeneration", { enumerable: true, get: function () { return TrellisModelGeneration_node_1.TrellisModelGeneration; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/Trellis/index.ts"],"names":[],"mappings":";;;AAAA,+EAAuE;AAGnE,uGAHK,oDAAsB,OAGL"}
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class WanXImageToVideo implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WanXImageToVideo = void 0;
4
+ const GenericFunctions_1 = require("../shared/GenericFunctions");
5
+ const Constants_1 = require("../shared/Constants");
6
+ class WanXImageToVideo {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'PiAPI WanX Image to Video',
10
+ name: 'wanXImageToVideo',
11
+ icon: 'file:../piapi.svg',
12
+ group: ['transform'],
13
+ version: 1,
14
+ description: 'Generate videos from images using PiAPI WanX',
15
+ defaults: {
16
+ name: 'WanX Image to Video',
17
+ },
18
+ inputs: ["main"],
19
+ outputs: ["main"],
20
+ credentials: [
21
+ {
22
+ name: 'piAPIApi',
23
+ required: true,
24
+ },
25
+ ],
26
+ properties: [
27
+ {
28
+ displayName: 'Prompt',
29
+ name: 'prompt',
30
+ type: 'string',
31
+ typeOptions: {
32
+ rows: 4,
33
+ },
34
+ default: '',
35
+ required: true,
36
+ description: 'Descriptive prompt for video generation',
37
+ },
38
+ {
39
+ displayName: 'Negative Prompt',
40
+ name: 'negativePrompt',
41
+ type: 'string',
42
+ typeOptions: {
43
+ rows: 2,
44
+ },
45
+ default: '',
46
+ description: 'Things to exclude from the video generation',
47
+ },
48
+ {
49
+ displayName: 'Model',
50
+ name: 'model',
51
+ type: 'options',
52
+ options: Constants_1.WANX_MODELS.filter(model => model.value === 'img2video-14b'),
53
+ default: 'img2video-14b',
54
+ description: 'The WanX model to use for image-to-video generation',
55
+ },
56
+ {
57
+ displayName: 'Image Source',
58
+ name: 'imageSource',
59
+ type: 'options',
60
+ options: [
61
+ {
62
+ name: 'URL',
63
+ value: 'url',
64
+ },
65
+ {
66
+ name: 'Binary Data',
67
+ value: 'binaryData',
68
+ },
69
+ ],
70
+ default: 'url',
71
+ description: 'The source of the input image',
72
+ },
73
+ {
74
+ displayName: 'Image URL',
75
+ name: 'imageUrl',
76
+ type: 'string',
77
+ default: '',
78
+ required: true,
79
+ displayOptions: {
80
+ show: {
81
+ imageSource: ['url'],
82
+ },
83
+ },
84
+ description: 'Direct URL to the image (must be a publicly accessible image file)',
85
+ },
86
+ {
87
+ displayName: 'Binary Property',
88
+ name: 'binaryPropertyName',
89
+ type: 'string',
90
+ default: 'data',
91
+ required: true,
92
+ displayOptions: {
93
+ show: {
94
+ imageSource: ['binaryData'],
95
+ },
96
+ },
97
+ description: 'Name of the binary property containing the image data',
98
+ },
99
+ {
100
+ displayName: 'Aspect Ratio',
101
+ name: 'aspectRatio',
102
+ type: 'options',
103
+ options: [
104
+ {
105
+ name: 'Landscape (16:9)',
106
+ value: '16:9',
107
+ },
108
+ {
109
+ name: 'Portrait (9:16)',
110
+ value: '9:16',
111
+ }
112
+ ],
113
+ default: '16:9',
114
+ description: 'Aspect ratio of the generated video',
115
+ },
116
+ {
117
+ displayName: 'Wait for Completion',
118
+ name: 'waitForCompletion',
119
+ type: 'boolean',
120
+ default: false,
121
+ description: 'Wait for task to complete and return results',
122
+ },
123
+ ],
124
+ };
125
+ }
126
+ async execute() {
127
+ var _a;
128
+ const items = this.getInputData();
129
+ const returnData = [];
130
+ for (let i = 0; i < items.length; i++) {
131
+ const prompt = this.getNodeParameter('prompt', i);
132
+ const negativePrompt = this.getNodeParameter('negativePrompt', i, '');
133
+ const model = this.getNodeParameter('model', i, 'img2video-14b');
134
+ const aspectRatio = this.getNodeParameter('aspectRatio', i);
135
+ const waitForCompletion = this.getNodeParameter('waitForCompletion', i, false);
136
+ const imageSource = this.getNodeParameter('imageSource', i);
137
+ let imageBase64 = '';
138
+ if (imageSource === 'url') {
139
+ const imageUrl = this.getNodeParameter('imageUrl', i);
140
+ try {
141
+ new URL(imageUrl);
142
+ try {
143
+ const imageResponse = await this.helpers.request({
144
+ method: 'GET',
145
+ url: imageUrl,
146
+ encoding: null,
147
+ resolveWithFullResponse: true,
148
+ });
149
+ const buffer = Buffer.from(imageResponse.body);
150
+ const contentType = imageResponse.headers['content-type'] || 'image/png';
151
+ imageBase64 = `data:${contentType};base64,${buffer.toString('base64')}`;
152
+ }
153
+ catch (error) {
154
+ throw new Error(`Failed to download image from URL: ${error.message}`);
155
+ }
156
+ }
157
+ catch (error) {
158
+ throw new Error(`Invalid image URL: ${error.message}`);
159
+ }
160
+ }
161
+ else {
162
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
163
+ const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
164
+ if (binaryData.mimeType && !binaryData.mimeType.includes('image/')) {
165
+ throw new Error('The provided binary data is not an image. Please provide valid image data.');
166
+ }
167
+ if (binaryData.data) {
168
+ imageBase64 = `data:${binaryData.mimeType};base64,${binaryData.data}`;
169
+ }
170
+ else if (binaryData.url) {
171
+ try {
172
+ const imageResponse = await this.helpers.request({
173
+ method: 'GET',
174
+ url: binaryData.url,
175
+ encoding: null,
176
+ resolveWithFullResponse: true,
177
+ });
178
+ const buffer = Buffer.from(imageResponse.body);
179
+ const contentType = imageResponse.headers['content-type'] || 'image/png';
180
+ imageBase64 = `data:${contentType};base64,${buffer.toString('base64')}`;
181
+ }
182
+ catch (error) {
183
+ throw new Error(`Failed to download image from binary URL: ${error.message}`);
184
+ }
185
+ }
186
+ else {
187
+ throw new Error('Could not extract image from binary data. Missing URL or data.');
188
+ }
189
+ }
190
+ const body = {
191
+ model: 'Qubico/wanx',
192
+ task_type: model,
193
+ input: {
194
+ prompt,
195
+ negative_prompt: negativePrompt,
196
+ image: imageBase64,
197
+ aspect_ratio: aspectRatio,
198
+ video_resolution: '480P',
199
+ },
200
+ };
201
+ try {
202
+ const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', body);
203
+ let taskResult = response;
204
+ if (waitForCompletion && ((_a = response.data) === null || _a === void 0 ? void 0 : _a.task_id)) {
205
+ taskResult = await GenericFunctions_1.waitForTaskCompletion.call(this, response.data.task_id);
206
+ }
207
+ returnData.push({
208
+ json: taskResult,
209
+ });
210
+ }
211
+ catch (error) {
212
+ if (this.continueOnFail()) {
213
+ returnData.push({
214
+ json: {
215
+ error: error.message,
216
+ },
217
+ });
218
+ continue;
219
+ }
220
+ throw error;
221
+ }
222
+ }
223
+ return [returnData];
224
+ }
225
+ }
226
+ exports.WanXImageToVideo = WanXImageToVideo;
227
+ //# sourceMappingURL=WanXImageToVideo.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"W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,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE;4BACL,KAAK,EAAE,KAAK,CAAC,OAAO;yBACpB;qBACD,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA1OD,4CA0OC"}
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class WanXTextToVideo implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WanXTextToVideo = void 0;
4
+ const GenericFunctions_1 = require("../shared/GenericFunctions");
5
+ const Constants_1 = require("../shared/Constants");
6
+ class WanXTextToVideo {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'PiAPI WanX Text to Video',
10
+ name: 'wanXTextToVideo',
11
+ icon: 'file:../piapi.svg',
12
+ group: ['transform'],
13
+ version: 1,
14
+ description: 'Generate videos from text using PiAPI WanX',
15
+ defaults: {
16
+ name: 'WanX Text to Video',
17
+ },
18
+ inputs: ["main"],
19
+ outputs: ["main"],
20
+ credentials: [
21
+ {
22
+ name: 'piAPIApi',
23
+ required: true,
24
+ },
25
+ ],
26
+ properties: [
27
+ {
28
+ displayName: 'Prompt',
29
+ name: 'prompt',
30
+ type: 'string',
31
+ typeOptions: {
32
+ rows: 4,
33
+ },
34
+ default: '',
35
+ required: true,
36
+ description: 'Descriptive prompt for video generation',
37
+ },
38
+ {
39
+ displayName: 'Negative Prompt',
40
+ name: 'negativePrompt',
41
+ type: 'string',
42
+ typeOptions: {
43
+ rows: 2,
44
+ },
45
+ default: '',
46
+ description: 'Things to exclude from the video generation',
47
+ },
48
+ {
49
+ displayName: 'Model',
50
+ name: 'model',
51
+ type: 'options',
52
+ options: Constants_1.WANX_MODELS.filter(model => model.value.includes('txt2video')),
53
+ default: 'txt2video-1.3b',
54
+ description: 'The WanX model to use for video generation',
55
+ },
56
+ {
57
+ displayName: 'Aspect Ratio',
58
+ name: 'aspectRatio',
59
+ type: 'options',
60
+ options: [
61
+ {
62
+ name: 'Landscape (16:9)',
63
+ value: '16:9',
64
+ },
65
+ {
66
+ name: 'Portrait (9:16)',
67
+ value: '9:16',
68
+ }
69
+ ],
70
+ default: '16:9',
71
+ description: 'Aspect ratio of the generated video',
72
+ },
73
+ {
74
+ displayName: 'Wait for Completion',
75
+ name: 'waitForCompletion',
76
+ type: 'boolean',
77
+ default: true,
78
+ description: 'Wait for task to complete and return results',
79
+ },
80
+ ],
81
+ };
82
+ }
83
+ async execute() {
84
+ var _a;
85
+ const items = this.getInputData();
86
+ const returnData = [];
87
+ for (let i = 0; i < items.length; i++) {
88
+ const prompt = this.getNodeParameter('prompt', i);
89
+ const negativePrompt = this.getNodeParameter('negativePrompt', i, '');
90
+ const model = this.getNodeParameter('model', i);
91
+ const aspectRatio = this.getNodeParameter('aspectRatio', i);
92
+ const waitForCompletion = this.getNodeParameter('waitForCompletion', i, true);
93
+ const body = {
94
+ model: 'Qubico/wanx',
95
+ task_type: model,
96
+ input: {
97
+ prompt,
98
+ negative_prompt: negativePrompt,
99
+ aspect_ratio: aspectRatio,
100
+ video_resolution: '480P',
101
+ },
102
+ };
103
+ try {
104
+ const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', body);
105
+ let taskResult = response;
106
+ if (waitForCompletion && ((_a = response.data) === null || _a === void 0 ? void 0 : _a.task_id)) {
107
+ taskResult = await GenericFunctions_1.waitForTaskCompletion.call(this, response.data.task_id);
108
+ }
109
+ returnData.push({
110
+ json: taskResult,
111
+ });
112
+ }
113
+ catch (error) {
114
+ if (this.continueOnFail()) {
115
+ returnData.push({
116
+ json: {
117
+ error: error.message,
118
+ },
119
+ });
120
+ continue;
121
+ }
122
+ throw error;
123
+ }
124
+ }
125
+ return [returnData];
126
+ }
127
+ }
128
+ exports.WanXTextToVideo = WanXTextToVideo;
129
+ //# sourceMappingURL=WanXTextToVideo.node.js.map