@marcmeese/n8n-nodes-communityapi-ai-client 0.3.8
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/LICENSE.md +19 -0
- package/README.md +290 -0
- package/dist/config/endpoints.d.ts +84 -0
- package/dist/config/endpoints.js +162 -0
- package/dist/config/endpoints.js.map +1 -0
- package/dist/credentials/CommunityAPIAIServer.credentials.d.ts +9 -0
- package/dist/credentials/CommunityAPIAIServer.credentials.js +36 -0
- package/dist/credentials/CommunityAPIAIServer.credentials.js.map +1 -0
- package/dist/credentials/marcmeeselogo.png +0 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/AdvancedVoice/AdvancedVoice.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/AdvancedVoice/AdvancedVoice.node.js +191 -0
- package/dist/nodes/CommunityAPIAIServer/AdvancedVoice/AdvancedVoice.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/AdvancedVoice/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/AudioDatasetCreator.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/AudioDatasetCreator.node.js +186 -0
- package/dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/AudioDatasetCreator.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/ComfyuiImageModifyFaceswapDetailer.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/ComfyuiImageModifyFaceswapDetailer.node.js +142 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/ComfyuiImageModifyFaceswapDetailer.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/ComfyuiImageUpscaleFluxMagnific.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/ComfyuiImageUpscaleFluxMagnific.node.js +160 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/ComfyuiImageUpscaleFluxMagnific.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/ComfyuiImageUpscaleSdxlClarity.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/ComfyuiImageUpscaleSdxlClarity.node.js +160 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/ComfyuiImageUpscaleSdxlClarity.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSeedvr2/ComfyuiImageUpscaleSeedvr2.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSeedvr2/ComfyuiImageUpscaleSeedvr2.node.js +170 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSeedvr2/ComfyuiImageUpscaleSeedvr2.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSeedvr2/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/ComfyuiImageUpscaleStablesr.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/ComfyuiImageUpscaleStablesr.node.js +170 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/ComfyuiImageUpscaleStablesr.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/DownloadJob/DownloadJob.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/DownloadJob/DownloadJob.node.js +147 -0
- package/dist/nodes/CommunityAPIAIServer/DownloadJob/DownloadJob.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/DownloadJob/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/ElevenLabsSTS.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/ElevenLabsSTS.node.js +266 -0
- package/dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/ElevenLabsSTS.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/ElevenLabsTTS.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/ElevenLabsTTS.node.js +285 -0
- package/dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/ElevenLabsTTS.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/GetJob/GetJob.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/GetJob/GetJob.node.js +51 -0
- package/dist/nodes/CommunityAPIAIServer/GetJob/GetJob.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/GetJob/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/GetUserInfo/GetUserInfo.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/GetUserInfo/GetUserInfo.node.js +41 -0
- package/dist/nodes/CommunityAPIAIServer/GetUserInfo/GetUserInfo.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/GetUserInfo/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/GptVision/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/MultimediaTranscriber.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/MultimediaTranscriber.node.js +157 -0
- package/dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/MultimediaTranscriber.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/Soundstorm/Soundstorm.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/Soundstorm/Soundstorm.node.js +191 -0
- package/dist/nodes/CommunityAPIAIServer/Soundstorm/Soundstorm.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/Soundstorm/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/TopazVideoUpscale.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/TopazVideoUpscale.node.js +163 -0
- package/dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/TopazVideoUpscale.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/UploadFile/UploadFile.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/UploadFile/UploadFile.node.js +115 -0
- package/dist/nodes/CommunityAPIAIServer/UploadFile/UploadFile.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/UploadFile/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/UploadFiles/UploadFiles.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/UploadFiles/UploadFiles.node.js +132 -0
- package/dist/nodes/CommunityAPIAIServer/UploadFiles/UploadFiles.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/UploadFiles/marcmeeselogo.png +0 -0
- package/dist/nodes/CommunityAPIAIServer/WebpageScraper/WebpageScraper.node.d.ts +6 -0
- package/dist/nodes/CommunityAPIAIServer/WebpageScraper/WebpageScraper.node.js +147 -0
- package/dist/nodes/CommunityAPIAIServer/WebpageScraper/WebpageScraper.node.js.map +1 -0
- package/dist/nodes/CommunityAPIAIServer/WebpageScraper/marcmeeselogo.png +0 -0
- package/dist/utils/fileUploads.d.ts +37 -0
- package/dist/utils/fileUploads.js +166 -0
- package/dist/utils/fileUploads.js.map +1 -0
- package/dist/utils/inputProcessing.d.ts +29 -0
- package/dist/utils/inputProcessing.js +147 -0
- package/dist/utils/inputProcessing.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Soundstorm = void 0;
|
|
4
|
+
const endpoints_1 = require("../../../config/endpoints");
|
|
5
|
+
class Soundstorm {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: '(AI) Soundstorm',
|
|
9
|
+
name: 'aiToolsSoundstorm',
|
|
10
|
+
icon: 'file:marcmeeselogo.png',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
description: 'Create soundstorm synthesis using AI models',
|
|
14
|
+
defaults: { name: 'Soundstorm' },
|
|
15
|
+
inputs: ['main'],
|
|
16
|
+
outputs: ['main'],
|
|
17
|
+
credentials: [
|
|
18
|
+
{
|
|
19
|
+
name: 'CommunityAPIAIServer',
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
properties: [
|
|
24
|
+
{
|
|
25
|
+
displayName: 'Scripts',
|
|
26
|
+
name: 'scripts',
|
|
27
|
+
type: 'string',
|
|
28
|
+
typeOptions: {
|
|
29
|
+
multipleValues: true,
|
|
30
|
+
},
|
|
31
|
+
required: true,
|
|
32
|
+
default: [],
|
|
33
|
+
description: "Scripts to be used for voice synthesis",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Instruction',
|
|
37
|
+
name: 'instruction',
|
|
38
|
+
type: 'string',
|
|
39
|
+
required: true,
|
|
40
|
+
default: 'Speak in a happy and energetic tone.',
|
|
41
|
+
description: 'Instruction on how to speak for the voice synthesis',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Language',
|
|
45
|
+
name: 'language',
|
|
46
|
+
type: 'options',
|
|
47
|
+
required: true,
|
|
48
|
+
options: [
|
|
49
|
+
{ name: 'German', value: 'german' },
|
|
50
|
+
{ name: 'English', value: 'english' },
|
|
51
|
+
],
|
|
52
|
+
default: 'german',
|
|
53
|
+
description: 'The language in which the scripts are written.',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Gender',
|
|
57
|
+
name: 'gender',
|
|
58
|
+
type: 'options',
|
|
59
|
+
required: true,
|
|
60
|
+
options: [
|
|
61
|
+
{ name: 'Male', value: 'male' },
|
|
62
|
+
{ name: 'Female', value: 'female' }
|
|
63
|
+
],
|
|
64
|
+
default: 'male',
|
|
65
|
+
description: 'The gender of the voice to be used for synthesis.',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
displayName: 'Target format',
|
|
69
|
+
name: 'target_format',
|
|
70
|
+
type: 'options',
|
|
71
|
+
required: true,
|
|
72
|
+
options: [
|
|
73
|
+
{ name: 'mp3', value: 'mp3' },
|
|
74
|
+
{ name: 'wav', value: 'wav' },
|
|
75
|
+
],
|
|
76
|
+
default: 'mp3',
|
|
77
|
+
description: 'Target audio format for the output files.',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Speed',
|
|
81
|
+
name: 'speed',
|
|
82
|
+
type: 'number',
|
|
83
|
+
required: false,
|
|
84
|
+
default: 1.0,
|
|
85
|
+
description: 'Speed of the voice synthesis (must be > 0)',
|
|
86
|
+
typeOptions: {
|
|
87
|
+
minValue: 0.1,
|
|
88
|
+
maxValue: 8.0,
|
|
89
|
+
numberPrecision: 2,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
displayName: 'Callback URL',
|
|
94
|
+
name: 'callback_url',
|
|
95
|
+
type: 'string',
|
|
96
|
+
required: false,
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'Eine optionale URL, die aufgerufen wird, wenn der Job abgeschlossen ist',
|
|
99
|
+
typeOptions: {
|
|
100
|
+
alwaysOpenEditWindow: true,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Callback Data',
|
|
105
|
+
name: 'callback_payload',
|
|
106
|
+
type: 'fixedCollection',
|
|
107
|
+
placeholder: 'Add Callback Data',
|
|
108
|
+
description: 'Custom data that will be returned with the job completion notification',
|
|
109
|
+
default: {},
|
|
110
|
+
typeOptions: {
|
|
111
|
+
multipleValues: true,
|
|
112
|
+
},
|
|
113
|
+
options: [
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Parameters',
|
|
116
|
+
name: 'parameters',
|
|
117
|
+
values: [
|
|
118
|
+
{
|
|
119
|
+
displayName: 'Key',
|
|
120
|
+
name: 'key',
|
|
121
|
+
type: 'string',
|
|
122
|
+
default: '',
|
|
123
|
+
description: 'Parameter key',
|
|
124
|
+
required: true,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Value',
|
|
128
|
+
name: 'value',
|
|
129
|
+
type: 'string',
|
|
130
|
+
default: '',
|
|
131
|
+
description: 'Parameter value (can be mapped from previous nodes)',
|
|
132
|
+
required: true,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
async execute() {
|
|
142
|
+
const items = this.getInputData();
|
|
143
|
+
const returnData = [];
|
|
144
|
+
for (let i = 0; i < items.length; i++) {
|
|
145
|
+
const scripts = this.getNodeParameter('scripts', i);
|
|
146
|
+
const instruction = this.getNodeParameter('instruction', i);
|
|
147
|
+
const language = this.getNodeParameter('language', i);
|
|
148
|
+
const gender = this.getNodeParameter('gender', i);
|
|
149
|
+
const targetFormat = this.getNodeParameter('target_format', i);
|
|
150
|
+
const speed = this.getNodeParameter('speed', i);
|
|
151
|
+
const callbackUrl = this.getNodeParameter('callback_url', i);
|
|
152
|
+
const callbackPayloadRaw = this.getNodeParameter('callback_payload', i);
|
|
153
|
+
// Job erstellen mit file_id
|
|
154
|
+
const formData = {
|
|
155
|
+
scripts: scripts,
|
|
156
|
+
instruction: instruction,
|
|
157
|
+
language: language,
|
|
158
|
+
gender: gender,
|
|
159
|
+
target_format: targetFormat,
|
|
160
|
+
speed: speed
|
|
161
|
+
};
|
|
162
|
+
if (callbackUrl) {
|
|
163
|
+
formData['callback_url'] = callbackUrl;
|
|
164
|
+
}
|
|
165
|
+
// Callback Payload von fixedCollection in JSON umwandeln
|
|
166
|
+
if (callbackPayloadRaw && callbackPayloadRaw.parameters) {
|
|
167
|
+
const callbackPayload = {};
|
|
168
|
+
// Jedes Key-Value Paar aus der fixedCollection in ein Objekt umwandeln
|
|
169
|
+
for (const param of callbackPayloadRaw.parameters) {
|
|
170
|
+
if (param.key && param.value !== undefined) {
|
|
171
|
+
callbackPayload[param.key] = param.value;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Nur hinzufügen wenn es tatsächlich Daten gibt
|
|
175
|
+
if (Object.keys(callbackPayload).length > 0) {
|
|
176
|
+
formData['callback_payload'] = JSON.stringify(callbackPayload);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const response = await this.helpers.requestWithAuthentication.call(this, 'CommunityAPIAIServer', {
|
|
180
|
+
method: 'POST',
|
|
181
|
+
url: endpoints_1.EndpointBuilder.getSoundstormUrl(),
|
|
182
|
+
formData: formData,
|
|
183
|
+
json: true
|
|
184
|
+
});
|
|
185
|
+
returnData.push({ json: response });
|
|
186
|
+
}
|
|
187
|
+
return this.prepareOutputData(returnData);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.Soundstorm = Soundstorm;
|
|
191
|
+
//# sourceMappingURL=Soundstorm.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Soundstorm.node.js","sourceRoot":"","sources":["../../../../src/nodes/CommunityAPIAIServer/Soundstorm/Soundstorm.node.ts"],"names":[],"mappings":";;;AAOA,yDAA+E;AAE/E,MAAa,UAAU;IAAvB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;YAChC,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,sBAAsB;oBAC5B,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,SAAS;oBACtB,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE;wBACZ,cAAc,EAAE,IAAI;qBACpB;oBACD,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,wCAAwC;iBACrD;gBACD;oBACC,WAAW,EAAE,aAAa;oBAC1B,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,sCAAsC;oBAC/C,WAAW,EAAE,qDAAqD;iBAClE;gBACD;oBACC,WAAW,EAAE,UAAU;oBACv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AAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7C,QAAQ,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;gBAChE,CAAC;YACF,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CACjE,IAAI,EACJ,sBAAsB,EACtB;gBACC,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,2BAAe,CAAC,gBAAgB,EAAE;gBACvC,QAAQ,EAAE,QAAQ;gBAClB,IAAI,EAAE,IAAI;aACV,CACD,CAAC;YAEF,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAuB,EAAE,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACD;AAnMD,gCAmMC"}
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
3
|
+
export declare class TopazVideoUpscale implements INodeType {
|
|
4
|
+
description: INodeTypeDescription;
|
|
5
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TopazVideoUpscale = void 0;
|
|
4
|
+
const endpoints_1 = require("../../../config/endpoints");
|
|
5
|
+
const inputProcessing_1 = require("../../../utils/inputProcessing");
|
|
6
|
+
class TopazVideoUpscale {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.description = {
|
|
9
|
+
displayName: '(AI) Upscale Topaz Video',
|
|
10
|
+
name: 'aiToolsTopazVideoUpscale',
|
|
11
|
+
icon: 'file:marcmeeselogo.png',
|
|
12
|
+
group: ['transform'],
|
|
13
|
+
version: 1,
|
|
14
|
+
description: 'Upscale videos using Topaz AI',
|
|
15
|
+
defaults: { name: 'TopazVideoUpscale' },
|
|
16
|
+
inputs: ['main'],
|
|
17
|
+
outputs: ['main'],
|
|
18
|
+
credentials: [
|
|
19
|
+
{
|
|
20
|
+
name: 'CommunityAPIAIServer',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
properties: [
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Input Video Path',
|
|
27
|
+
name: 'input_video',
|
|
28
|
+
type: 'string',
|
|
29
|
+
required: true,
|
|
30
|
+
default: '',
|
|
31
|
+
description: (0, inputProcessing_1.getInputDescription)('Video', false),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Framerate',
|
|
35
|
+
name: 'fps',
|
|
36
|
+
type: 'number',
|
|
37
|
+
required: false,
|
|
38
|
+
default: -1,
|
|
39
|
+
description: 'Ziel FPS. Verwenden Sie -1, um die ursprüngliche Framerate beizubehalten.',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Scale Factor',
|
|
43
|
+
name: 'factor',
|
|
44
|
+
type: 'number',
|
|
45
|
+
required: false,
|
|
46
|
+
default: -1,
|
|
47
|
+
description: 'Scale Factor. Use -1 to leave the original size.',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Target format',
|
|
51
|
+
name: 'target_format',
|
|
52
|
+
type: 'options',
|
|
53
|
+
required: true,
|
|
54
|
+
options: [
|
|
55
|
+
{ name: 'mp4', value: 'mp4' },
|
|
56
|
+
{ name: 'mov', value: 'mov' },
|
|
57
|
+
{ name: 'mkv', value: 'mkv' },
|
|
58
|
+
{ name: 'webm', value: 'webm' }
|
|
59
|
+
],
|
|
60
|
+
default: 'mp4',
|
|
61
|
+
description: 'Zielformat für das skalierte Video',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Callback URL',
|
|
65
|
+
name: 'callback_url',
|
|
66
|
+
type: 'string',
|
|
67
|
+
required: false,
|
|
68
|
+
default: '',
|
|
69
|
+
description: 'Eine optionale URL, die aufgerufen wird, wenn der Job abgeschlossen ist',
|
|
70
|
+
typeOptions: {
|
|
71
|
+
alwaysOpenEditWindow: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Callback Data',
|
|
76
|
+
name: 'callback_payload',
|
|
77
|
+
type: 'fixedCollection',
|
|
78
|
+
placeholder: 'Add Callback Data',
|
|
79
|
+
description: 'Custom data that will be returned with the job completion notification',
|
|
80
|
+
default: {},
|
|
81
|
+
typeOptions: {
|
|
82
|
+
multipleValues: true,
|
|
83
|
+
},
|
|
84
|
+
options: [
|
|
85
|
+
{
|
|
86
|
+
displayName: 'Parameters',
|
|
87
|
+
name: 'parameters',
|
|
88
|
+
values: [
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Key',
|
|
91
|
+
name: 'key',
|
|
92
|
+
type: 'string',
|
|
93
|
+
default: '',
|
|
94
|
+
description: 'Parameter key',
|
|
95
|
+
required: true,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
displayName: 'Value',
|
|
99
|
+
name: 'value',
|
|
100
|
+
type: 'string',
|
|
101
|
+
default: '',
|
|
102
|
+
description: 'Parameter value (can be mapped from previous nodes)',
|
|
103
|
+
required: true,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async execute() {
|
|
113
|
+
const items = this.getInputData();
|
|
114
|
+
const returnData = [];
|
|
115
|
+
for (let i = 0; i < items.length; i++) {
|
|
116
|
+
const inputVideoPath = this.getNodeParameter('input_video', i);
|
|
117
|
+
const scale_factor = this.getNodeParameter('factor', i);
|
|
118
|
+
const target_format = this.getNodeParameter('target_format', i);
|
|
119
|
+
const framerate = this.getNodeParameter('fps', i);
|
|
120
|
+
const callbackUrl = this.getNodeParameter('callback_url', i);
|
|
121
|
+
const callbackPayloadRaw = this.getNodeParameter('callback_payload', i);
|
|
122
|
+
const validExtensions = [...endpoints_1.SUPPORTED_FORMATS.VIDEO];
|
|
123
|
+
// Eingabe intelligent verarbeiten mit inputProcessing Utils
|
|
124
|
+
const processedInputVideoPath = await (0, inputProcessing_1.processMediaInput)(this, inputVideoPath, validExtensions);
|
|
125
|
+
// Debug-Informationen loggen
|
|
126
|
+
(0, inputProcessing_1.logInputProcessing)(inputVideoPath, processedInputVideoPath);
|
|
127
|
+
// Job erstellen mit file_id
|
|
128
|
+
const formData = {
|
|
129
|
+
input_video: processedInputVideoPath,
|
|
130
|
+
factor: scale_factor,
|
|
131
|
+
target_format: target_format,
|
|
132
|
+
fps: framerate
|
|
133
|
+
};
|
|
134
|
+
if (callbackUrl) {
|
|
135
|
+
formData['callback_url'] = callbackUrl;
|
|
136
|
+
}
|
|
137
|
+
// Callback Payload von fixedCollection in JSON umwandeln
|
|
138
|
+
if (callbackPayloadRaw && callbackPayloadRaw.parameters) {
|
|
139
|
+
const callbackPayload = {};
|
|
140
|
+
// Jedes Key-Value Paar aus der fixedCollection in ein Objekt umwandeln
|
|
141
|
+
for (const param of callbackPayloadRaw.parameters) {
|
|
142
|
+
if (param.key && param.value !== undefined) {
|
|
143
|
+
callbackPayload[param.key] = param.value;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Nur hinzufügen wenn es tatsächlich Daten gibt
|
|
147
|
+
if (Object.keys(callbackPayload).length > 0) {
|
|
148
|
+
formData['callback_payload'] = JSON.stringify(callbackPayload);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const response = await this.helpers.requestWithAuthentication.call(this, 'CommunityAPIAIServer', {
|
|
152
|
+
method: 'POST',
|
|
153
|
+
url: endpoints_1.EndpointBuilder.getTopazVideoUrl(),
|
|
154
|
+
form: formData,
|
|
155
|
+
json: true
|
|
156
|
+
});
|
|
157
|
+
returnData.push({ json: response });
|
|
158
|
+
}
|
|
159
|
+
return this.prepareOutputData(returnData);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.TopazVideoUpscale = TopazVideoUpscale;
|
|
163
|
+
//# sourceMappingURL=TopazVideoUpscale.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopazVideoUpscale.node.js","sourceRoot":"","sources":["../../../../src/nodes/CommunityAPIAIServer/TopazVideoUpscale/TopazVideoUpscale.node.ts"],"names":[],"mappings":";;;AAOA,yDAA+E;AAC/E,oEAIwC;AAExC,MAAa,iBAAiB;IAA9B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,0BAA0B;YAChC,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;YACvC,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,sBAAsB;oBAC5B,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,kBAAkB;oBAC/B,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,IAAA,qCAAmB,EAAC,OAAO,EAAE,KAAK,CAAC;iBAChD;gBACD;oBACC,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,CAAC,CAAC;oBACX,WAAW,EAAE,2EAA2E;iBACxF;gBACD;oBACC,WAAW,EAAE,c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CACD;AAzKD,8CAyKC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
3
|
+
export declare class UploadFile implements INodeType {
|
|
4
|
+
description: INodeTypeDescription;
|
|
5
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.UploadFile = void 0;
|
|
40
|
+
const endpoints_1 = require("../../../config/endpoints");
|
|
41
|
+
const mime_1 = __importDefault(require("mime"));
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
class UploadFile {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.description = {
|
|
47
|
+
displayName: '(AI) Upload File',
|
|
48
|
+
name: 'aiToolsUploadFile',
|
|
49
|
+
icon: 'file:marcmeeselogo.png',
|
|
50
|
+
group: ['transform'],
|
|
51
|
+
version: 1,
|
|
52
|
+
description: 'Erstellt eine Presigned URL für eine lokale Datei und lädt sie hoch',
|
|
53
|
+
defaults: { name: 'UploadFile' },
|
|
54
|
+
inputs: ['main'],
|
|
55
|
+
outputs: ['main'],
|
|
56
|
+
credentials: [
|
|
57
|
+
{
|
|
58
|
+
name: 'CommunityAPIAIServer',
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
properties: [
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Local File Path',
|
|
65
|
+
name: 'local_file_path',
|
|
66
|
+
type: 'string',
|
|
67
|
+
required: true,
|
|
68
|
+
default: '',
|
|
69
|
+
description: 'Pfad zur lokalen Datei, die hochgeladen werden soll',
|
|
70
|
+
placeholder: '/path/to/your/file.pdf',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async execute() {
|
|
76
|
+
const items = this.getInputData();
|
|
77
|
+
const returnData = [];
|
|
78
|
+
for (let i = 0; i < items.length; i++) {
|
|
79
|
+
const localFilePath = this.getNodeParameter('local_file_path', i);
|
|
80
|
+
if (!fs.existsSync(localFilePath)) {
|
|
81
|
+
throw new Error(`Lokale Datei nicht gefunden: ${localFilePath}`);
|
|
82
|
+
}
|
|
83
|
+
const filename = path.basename(localFilePath);
|
|
84
|
+
// Presigned URL anfordern
|
|
85
|
+
const presignedResponse = await this.helpers.requestWithAuthentication.call(this, 'CommunityAPIAIServer', {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
url: `${endpoints_1.API_ENDPOINTS.AI_BASE}${endpoints_1.API_ENDPOINTS.PRESIGN_FILE}`,
|
|
88
|
+
form: { filename: filename },
|
|
89
|
+
json: true,
|
|
90
|
+
});
|
|
91
|
+
if (!(presignedResponse === null || presignedResponse === void 0 ? void 0 : presignedResponse.presigned_url) || !(presignedResponse === null || presignedResponse === void 0 ? void 0 : presignedResponse.file_id)) {
|
|
92
|
+
throw new Error('Fehler beim Anfordern der Presigned URL');
|
|
93
|
+
}
|
|
94
|
+
// Datei hochladen
|
|
95
|
+
const fileBuffer = fs.readFileSync(localFilePath);
|
|
96
|
+
const contentType = mime_1.default.getType(localFilePath) || 'application/octet-stream';
|
|
97
|
+
await this.helpers.request({
|
|
98
|
+
method: 'PUT',
|
|
99
|
+
url: presignedResponse.presigned_url,
|
|
100
|
+
body: fileBuffer,
|
|
101
|
+
headers: {
|
|
102
|
+
'Content-Type': contentType,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
const result = {
|
|
106
|
+
file_id: presignedResponse.file_id,
|
|
107
|
+
filename: presignedResponse.source_filename,
|
|
108
|
+
};
|
|
109
|
+
returnData.push({ json: result });
|
|
110
|
+
}
|
|
111
|
+
return this.prepareOutputData(returnData);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.UploadFile = UploadFile;
|
|
115
|
+
//# sourceMappingURL=UploadFile.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadFile.node.js","sourceRoot":"","sources":["../../../../src/nodes/CommunityAPIAIServer/UploadFile/UploadFile.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,yDAA0D;AAC1D,gDAAwB;AACxB,uCAAyB;AACzB,2CAA6B;AAS7B,MAAa,UAAU;IAAvB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,kBAAkB;YAC/B,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,qEAAqE;YAClF,QAAQ,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;YAChC,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,sBAAsB;oBAC5B,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,iBAAiB;oBAC9B,IAAI,EAAE,iBAAiB;oBACvB,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,qDAAqD;oBAClE,WAAW,EAAE,wBAAwB;iBACrC;aACD;SACD,CAAC;IAsDH,CAAC;IApDA,KAAK,CAAC,OAAO;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,UAAU,GAAyB,EAAE,CAAC;QAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,CAAW,CAAC;YAE5E,IAAI,CAAC,E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,CAAC;YAEF,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACD;AAlFD,gCAkFC"}
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
3
|
+
export declare class UploadFiles implements INodeType {
|
|
4
|
+
description: INodeTypeDescription;
|
|
5
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.UploadFiles = void 0;
|
|
40
|
+
const endpoints_1 = require("../../../config/endpoints");
|
|
41
|
+
const mime_1 = __importDefault(require("mime"));
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
class UploadFiles {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.description = {
|
|
47
|
+
displayName: '(AI) Upload Files Batch',
|
|
48
|
+
name: 'aiToolsUploadFiles',
|
|
49
|
+
icon: 'file:marcmeeselogo.png',
|
|
50
|
+
group: ['transform'],
|
|
51
|
+
version: 1,
|
|
52
|
+
description: 'Erstellt Presigned URLs für mehrere lokale Dateien und lädt sie parallel hoch',
|
|
53
|
+
defaults: { name: 'UploadFiles' },
|
|
54
|
+
inputs: ['main'],
|
|
55
|
+
outputs: ['main'],
|
|
56
|
+
credentials: [
|
|
57
|
+
{
|
|
58
|
+
name: 'CommunityAPIAIServer',
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
properties: [
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Local File Paths',
|
|
65
|
+
name: 'local_file_paths',
|
|
66
|
+
type: 'string',
|
|
67
|
+
typeOptions: {
|
|
68
|
+
multipleValues: true,
|
|
69
|
+
},
|
|
70
|
+
required: true,
|
|
71
|
+
default: [],
|
|
72
|
+
description: 'Pfade zu den lokalen Dateien, die hochgeladen werden sollen',
|
|
73
|
+
placeholder: '/path/to/file1.pdf, /path/to/file2.jpg, ...',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async execute() {
|
|
79
|
+
const items = this.getInputData();
|
|
80
|
+
const returnData = [];
|
|
81
|
+
for (let i = 0; i < items.length; i++) {
|
|
82
|
+
const localFilePaths = this.getNodeParameter('local_file_paths', i);
|
|
83
|
+
if (localFilePaths.length === 0) {
|
|
84
|
+
throw new Error('Mindestens eine Datei muss angegeben werden');
|
|
85
|
+
}
|
|
86
|
+
// Validierung aller Dateien
|
|
87
|
+
for (const filePath of localFilePaths) {
|
|
88
|
+
if (!fs.existsSync(filePath)) {
|
|
89
|
+
throw new Error(`Lokale Datei nicht gefunden: ${filePath}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const filenames = localFilePaths.map(filePath => path.basename(filePath));
|
|
93
|
+
// Batch Presigned URLs anfordern
|
|
94
|
+
const batchResponse = await this.helpers.requestWithAuthentication.call(this, 'CommunityAPIAIServer', {
|
|
95
|
+
method: 'POST',
|
|
96
|
+
url: `${endpoints_1.API_ENDPOINTS.AI_BASE}${endpoints_1.API_ENDPOINTS.PRESIGN_FILE_BATCH}`,
|
|
97
|
+
form: { filenames: filenames },
|
|
98
|
+
json: true,
|
|
99
|
+
});
|
|
100
|
+
if (!(batchResponse === null || batchResponse === void 0 ? void 0 : batchResponse.presigned) || batchResponse.presigned.length !== localFilePaths.length) {
|
|
101
|
+
throw new Error('Fehler beim Anfordern der Batch Presigned URLs');
|
|
102
|
+
}
|
|
103
|
+
// Alle Dateien parallel hochladen
|
|
104
|
+
const uploadPromises = localFilePaths.map(async (filePath, index) => {
|
|
105
|
+
const presignedData = batchResponse.presigned[index];
|
|
106
|
+
const fileBuffer = fs.readFileSync(filePath);
|
|
107
|
+
const contentType = mime_1.default.getType(filePath) || 'application/octet-stream';
|
|
108
|
+
await this.helpers.request({
|
|
109
|
+
method: 'PUT',
|
|
110
|
+
url: presignedData.presigned_url,
|
|
111
|
+
body: fileBuffer,
|
|
112
|
+
headers: {
|
|
113
|
+
'Content-Type': contentType,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
return presignedData;
|
|
117
|
+
});
|
|
118
|
+
await Promise.all(uploadPromises);
|
|
119
|
+
const mappedResults = batchResponse.presigned.map(item => ({
|
|
120
|
+
file_id: item.file_id,
|
|
121
|
+
filename: item.source_filename,
|
|
122
|
+
}));
|
|
123
|
+
const result = {
|
|
124
|
+
presigned: mappedResults,
|
|
125
|
+
};
|
|
126
|
+
returnData.push({ json: result });
|
|
127
|
+
}
|
|
128
|
+
return this.prepareOutputData(returnData);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.UploadFiles = UploadFiles;
|
|
132
|
+
//# sourceMappingURL=UploadFiles.node.js.map
|