@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.
Files changed (92) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +290 -0
  3. package/dist/config/endpoints.d.ts +84 -0
  4. package/dist/config/endpoints.js +162 -0
  5. package/dist/config/endpoints.js.map +1 -0
  6. package/dist/credentials/CommunityAPIAIServer.credentials.d.ts +9 -0
  7. package/dist/credentials/CommunityAPIAIServer.credentials.js +36 -0
  8. package/dist/credentials/CommunityAPIAIServer.credentials.js.map +1 -0
  9. package/dist/credentials/marcmeeselogo.png +0 -0
  10. package/dist/index.d.ts +19 -0
  11. package/dist/index.js +38 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/nodes/CommunityAPIAIServer/AdvancedVoice/AdvancedVoice.node.d.ts +6 -0
  14. package/dist/nodes/CommunityAPIAIServer/AdvancedVoice/AdvancedVoice.node.js +191 -0
  15. package/dist/nodes/CommunityAPIAIServer/AdvancedVoice/AdvancedVoice.node.js.map +1 -0
  16. package/dist/nodes/CommunityAPIAIServer/AdvancedVoice/marcmeeselogo.png +0 -0
  17. package/dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/AudioDatasetCreator.node.d.ts +6 -0
  18. package/dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/AudioDatasetCreator.node.js +186 -0
  19. package/dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/AudioDatasetCreator.node.js.map +1 -0
  20. package/dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/marcmeeselogo.png +0 -0
  21. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/ComfyuiImageModifyFaceswapDetailer.node.d.ts +6 -0
  22. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/ComfyuiImageModifyFaceswapDetailer.node.js +142 -0
  23. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/ComfyuiImageModifyFaceswapDetailer.node.js.map +1 -0
  24. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/marcmeeselogo.png +0 -0
  25. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/ComfyuiImageUpscaleFluxMagnific.node.d.ts +6 -0
  26. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/ComfyuiImageUpscaleFluxMagnific.node.js +160 -0
  27. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/ComfyuiImageUpscaleFluxMagnific.node.js.map +1 -0
  28. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/marcmeeselogo.png +0 -0
  29. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/ComfyuiImageUpscaleSdxlClarity.node.d.ts +6 -0
  30. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/ComfyuiImageUpscaleSdxlClarity.node.js +160 -0
  31. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/ComfyuiImageUpscaleSdxlClarity.node.js.map +1 -0
  32. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/marcmeeselogo.png +0 -0
  33. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSeedvr2/ComfyuiImageUpscaleSeedvr2.node.d.ts +6 -0
  34. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSeedvr2/ComfyuiImageUpscaleSeedvr2.node.js +170 -0
  35. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSeedvr2/ComfyuiImageUpscaleSeedvr2.node.js.map +1 -0
  36. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSeedvr2/marcmeeselogo.png +0 -0
  37. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/ComfyuiImageUpscaleStablesr.node.d.ts +6 -0
  38. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/ComfyuiImageUpscaleStablesr.node.js +170 -0
  39. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/ComfyuiImageUpscaleStablesr.node.js.map +1 -0
  40. package/dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/marcmeeselogo.png +0 -0
  41. package/dist/nodes/CommunityAPIAIServer/DownloadJob/DownloadJob.node.d.ts +6 -0
  42. package/dist/nodes/CommunityAPIAIServer/DownloadJob/DownloadJob.node.js +147 -0
  43. package/dist/nodes/CommunityAPIAIServer/DownloadJob/DownloadJob.node.js.map +1 -0
  44. package/dist/nodes/CommunityAPIAIServer/DownloadJob/marcmeeselogo.png +0 -0
  45. package/dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/ElevenLabsSTS.node.d.ts +6 -0
  46. package/dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/ElevenLabsSTS.node.js +266 -0
  47. package/dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/ElevenLabsSTS.node.js.map +1 -0
  48. package/dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/marcmeeselogo.png +0 -0
  49. package/dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/ElevenLabsTTS.node.d.ts +6 -0
  50. package/dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/ElevenLabsTTS.node.js +285 -0
  51. package/dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/ElevenLabsTTS.node.js.map +1 -0
  52. package/dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/marcmeeselogo.png +0 -0
  53. package/dist/nodes/CommunityAPIAIServer/GetJob/GetJob.node.d.ts +6 -0
  54. package/dist/nodes/CommunityAPIAIServer/GetJob/GetJob.node.js +51 -0
  55. package/dist/nodes/CommunityAPIAIServer/GetJob/GetJob.node.js.map +1 -0
  56. package/dist/nodes/CommunityAPIAIServer/GetJob/marcmeeselogo.png +0 -0
  57. package/dist/nodes/CommunityAPIAIServer/GetUserInfo/GetUserInfo.node.d.ts +6 -0
  58. package/dist/nodes/CommunityAPIAIServer/GetUserInfo/GetUserInfo.node.js +41 -0
  59. package/dist/nodes/CommunityAPIAIServer/GetUserInfo/GetUserInfo.node.js.map +1 -0
  60. package/dist/nodes/CommunityAPIAIServer/GetUserInfo/marcmeeselogo.png +0 -0
  61. package/dist/nodes/CommunityAPIAIServer/GptVision/marcmeeselogo.png +0 -0
  62. package/dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/MultimediaTranscriber.node.d.ts +6 -0
  63. package/dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/MultimediaTranscriber.node.js +157 -0
  64. package/dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/MultimediaTranscriber.node.js.map +1 -0
  65. package/dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/marcmeeselogo.png +0 -0
  66. package/dist/nodes/CommunityAPIAIServer/Soundstorm/Soundstorm.node.d.ts +6 -0
  67. package/dist/nodes/CommunityAPIAIServer/Soundstorm/Soundstorm.node.js +191 -0
  68. package/dist/nodes/CommunityAPIAIServer/Soundstorm/Soundstorm.node.js.map +1 -0
  69. package/dist/nodes/CommunityAPIAIServer/Soundstorm/marcmeeselogo.png +0 -0
  70. package/dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/TopazVideoUpscale.node.d.ts +6 -0
  71. package/dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/TopazVideoUpscale.node.js +163 -0
  72. package/dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/TopazVideoUpscale.node.js.map +1 -0
  73. package/dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/marcmeeselogo.png +0 -0
  74. package/dist/nodes/CommunityAPIAIServer/UploadFile/UploadFile.node.d.ts +6 -0
  75. package/dist/nodes/CommunityAPIAIServer/UploadFile/UploadFile.node.js +115 -0
  76. package/dist/nodes/CommunityAPIAIServer/UploadFile/UploadFile.node.js.map +1 -0
  77. package/dist/nodes/CommunityAPIAIServer/UploadFile/marcmeeselogo.png +0 -0
  78. package/dist/nodes/CommunityAPIAIServer/UploadFiles/UploadFiles.node.d.ts +6 -0
  79. package/dist/nodes/CommunityAPIAIServer/UploadFiles/UploadFiles.node.js +132 -0
  80. package/dist/nodes/CommunityAPIAIServer/UploadFiles/UploadFiles.node.js.map +1 -0
  81. package/dist/nodes/CommunityAPIAIServer/UploadFiles/marcmeeselogo.png +0 -0
  82. package/dist/nodes/CommunityAPIAIServer/WebpageScraper/WebpageScraper.node.d.ts +6 -0
  83. package/dist/nodes/CommunityAPIAIServer/WebpageScraper/WebpageScraper.node.js +147 -0
  84. package/dist/nodes/CommunityAPIAIServer/WebpageScraper/WebpageScraper.node.js.map +1 -0
  85. package/dist/nodes/CommunityAPIAIServer/WebpageScraper/marcmeeselogo.png +0 -0
  86. package/dist/utils/fileUploads.d.ts +37 -0
  87. package/dist/utils/fileUploads.js +166 -0
  88. package/dist/utils/fileUploads.js.map +1 -0
  89. package/dist/utils/inputProcessing.d.ts +29 -0
  90. package/dist/utils/inputProcessing.js +147 -0
  91. package/dist/utils/inputProcessing.js.map +1 -0
  92. package/package.json +69 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploadFiles.node.js","sourceRoot":"","sources":["../../../../src/nodes/CommunityAPIAIServer/UploadFiles/UploadFiles.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,yDAA0D;AAC1D,gDAAwB;AACxB,uCAAyB;AACzB,2CAA6B;AAa7B,MAAa,WAAW;IAAxB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,+EAA+E;YAC5F,QAAQ,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;YAC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AAE,CAAC,CAAC;gBAC1D,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI,CAAC,eAAe;aAC9B,CAAC,CAAC,CAAC;YAEJ,MAAM,MAAM,GAAgB;gBAC3B,SAAS,EAAE,aAAa;aACxB,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;AAvGD,kCAuGC"}
@@ -0,0 +1,6 @@
1
+ import type { IExecuteFunctions } from 'n8n-workflow';
2
+ import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
3
+ export declare class WebpageScraper implements INodeType {
4
+ description: INodeTypeDescription;
5
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
6
+ }
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebpageScraper = void 0;
4
+ const endpoints_1 = require("../../../config/endpoints");
5
+ class WebpageScraper {
6
+ constructor() {
7
+ this.description = {
8
+ displayName: '(AI) WebpageScraper',
9
+ name: 'aiToolsWebpageScraper',
10
+ icon: 'file:marcmeeselogo.png',
11
+ group: ['transform'],
12
+ version: 1,
13
+ description: 'Scrape content from webpages using AI models',
14
+ defaults: { name: 'Webpage Scraper' },
15
+ inputs: ['main'],
16
+ outputs: ['main'],
17
+ credentials: [
18
+ {
19
+ name: 'CommunityAPIAIServer',
20
+ required: true,
21
+ },
22
+ ],
23
+ properties: [
24
+ {
25
+ displayName: 'URL',
26
+ name: 'url',
27
+ type: 'string',
28
+ required: true,
29
+ default: '',
30
+ description: 'The URL to scrape content from'
31
+ },
32
+ {
33
+ displayName: 'Include Clips',
34
+ name: 'include_clips',
35
+ type: 'boolean',
36
+ default: false,
37
+ description: 'Whether to include video/audio clips in the scraping'
38
+ },
39
+ {
40
+ displayName: 'Use X',
41
+ name: 'use_x',
42
+ type: 'boolean',
43
+ default: false,
44
+ description: 'Whether to use more advanced WhisperX engine',
45
+ displayOptions: {
46
+ show: {
47
+ include_clips: [true],
48
+ },
49
+ },
50
+ },
51
+ {
52
+ displayName: 'Callback URL',
53
+ name: 'callback_url',
54
+ type: 'string',
55
+ required: false,
56
+ default: '',
57
+ description: 'Optional URL that will be called when the job is completed',
58
+ typeOptions: {
59
+ alwaysOpenEditWindow: true,
60
+ },
61
+ },
62
+ {
63
+ displayName: 'Callback Data',
64
+ name: 'callback_payload',
65
+ type: 'fixedCollection',
66
+ placeholder: 'Add Callback Data',
67
+ description: 'Custom data that will be returned with the job completion notification',
68
+ default: {},
69
+ typeOptions: {
70
+ multipleValues: true,
71
+ },
72
+ options: [
73
+ {
74
+ displayName: 'Parameters',
75
+ name: 'parameters',
76
+ values: [
77
+ {
78
+ displayName: 'Key',
79
+ name: 'key',
80
+ type: 'string',
81
+ default: '',
82
+ description: 'Parameter key',
83
+ required: true,
84
+ },
85
+ {
86
+ displayName: 'Value',
87
+ name: 'value',
88
+ type: 'string',
89
+ default: '',
90
+ description: 'Parameter value (can be mapped from previous nodes)',
91
+ required: true,
92
+ },
93
+ ],
94
+ },
95
+ ],
96
+ },
97
+ ],
98
+ };
99
+ }
100
+ async execute() {
101
+ const items = this.getInputData();
102
+ const returnData = [];
103
+ for (let i = 0; i < items.length; i++) {
104
+ const url = this.getNodeParameter('url', i);
105
+ const includeClips = this.getNodeParameter('include_clips', i);
106
+ const useX = this.getNodeParameter('use_x', i, false);
107
+ const callbackUrl = this.getNodeParameter('callback_url', i);
108
+ const callbackPayloadRaw = this.getNodeParameter('callback_payload', i);
109
+ // Form Data erstellen
110
+ const formData = {
111
+ url: url,
112
+ include_clips: includeClips,
113
+ };
114
+ // use_x nur hinzufügen wenn include_clips aktiviert ist
115
+ if (includeClips) {
116
+ formData['use_x'] = useX;
117
+ }
118
+ if (callbackUrl) {
119
+ formData['callback_url'] = callbackUrl;
120
+ }
121
+ // Callback Payload von fixedCollection in JSON umwandeln
122
+ if (callbackPayloadRaw && callbackPayloadRaw.parameters) {
123
+ const callbackPayload = {};
124
+ // Jedes Key-Value Paar aus der fixedCollection in ein Objekt umwandeln
125
+ for (const param of callbackPayloadRaw.parameters) {
126
+ if (param.key && param.value !== undefined) {
127
+ callbackPayload[param.key] = param.value;
128
+ }
129
+ }
130
+ // Nur hinzufügen wenn es tatsächlich Daten gibt
131
+ if (Object.keys(callbackPayload).length > 0) {
132
+ formData['callback_payload'] = JSON.stringify(callbackPayload);
133
+ }
134
+ }
135
+ const response = await this.helpers.requestWithAuthentication.call(this, 'CommunityAPIAIServer', {
136
+ method: 'POST',
137
+ url: endpoints_1.EndpointBuilder.getWebpageScraperUrl(),
138
+ form: formData,
139
+ json: true,
140
+ });
141
+ returnData.push({ json: response });
142
+ }
143
+ return this.prepareOutputData(returnData);
144
+ }
145
+ }
146
+ exports.WebpageScraper = WebpageScraper;
147
+ //# sourceMappingURL=WebpageScraper.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebpageScraper.node.js","sourceRoot":"","sources":["../../../../src/nodes/CommunityAPIAIServer/WebpageScraper/WebpageScraper.node.ts"],"names":[],"mappings":";;;AAOA,yDAA4D;AAE5D,MAAa,cAAc;IAA3B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE,uBAAuB;YAC7B,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;YACrC,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;gBAC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AM,eAAe,GAAgB,EAAE,CAAC;gBAExC,uEAAuE;gBACvE,KAAK,MAAM,KAAK,IAAI,kBAAkB,CAAC,UAAU,EAAE,CAAC;oBACnD,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;wBAC5C,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;oBAC1C,CAAC;gBACF,CAAC;gBAED,gDAAgD;gBAChD,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,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,oBAAoB,EAAE;gBAC3C,IAAI,EAAE,QAAQ;gBACd,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;AAzJD,wCAyJC"}
@@ -0,0 +1,37 @@
1
+ import type { IExecuteFunctions } from 'n8n-workflow';
2
+ /**
3
+ * Interface für Upload Result
4
+ */
5
+ interface FileUploadResult {
6
+ file_id: string;
7
+ source_filename: string;
8
+ }
9
+ /**
10
+ * Lädt eine lokale Datei über Presigned URL zu S3 hoch
11
+ *
12
+ * @param executeFunctions - n8n Execute Functions Context
13
+ * @param localFilePath - Pfad zur lokalen Datei
14
+ * @returns Promise<FileUploadResult> - Enthält file_id und source_filename
15
+ */
16
+ export declare function uploadFileToS3(executeFunctions: IExecuteFunctions, localFilePath: string): Promise<FileUploadResult>;
17
+ /**
18
+ * Lädt mehrere lokale Dateien über Batch Presigned URLs zu S3 hoch
19
+ *
20
+ * @param executeFunctions - n8n Execute Functions Context
21
+ * @param localFilePaths - Array von Pfaden zu lokalen Dateien
22
+ * @returns Promise<FileUploadResult[]> - Array mit file_ids und source_filenames
23
+ */
24
+ export declare function uploadMultipleFilesToS3(executeFunctions: IExecuteFunctions, localFilePaths: string[]): Promise<FileUploadResult[]>;
25
+ /**
26
+ * Lädt mehrere lokale Dateien einzeln zu S3 hoch (Fallback-Methode)
27
+ */
28
+ export declare function uploadFilesToS3(executeFunctions: IExecuteFunctions, localFilePaths: string[]): Promise<FileUploadResult[]>;
29
+ /**
30
+ * Validiert eine Dateiendung gegen erlaubte Formate
31
+ *
32
+ * @param filePath - Pfad zur Datei
33
+ * @param allowedExtensions - Array erlaubter Dateiendungen
34
+ * @throws Error wenn Dateiendung nicht erlaubt ist
35
+ */
36
+ export declare function validateFileExtension(filePath: string, allowedExtensions: string[]): void;
37
+ export {};
@@ -0,0 +1,166 @@
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.uploadFileToS3 = uploadFileToS3;
40
+ exports.uploadMultipleFilesToS3 = uploadMultipleFilesToS3;
41
+ exports.uploadFilesToS3 = uploadFilesToS3;
42
+ exports.validateFileExtension = validateFileExtension;
43
+ const fs = __importStar(require("fs"));
44
+ const path = __importStar(require("path"));
45
+ const endpoints_1 = require("../config/endpoints");
46
+ const mime_1 = __importDefault(require("mime"));
47
+ /**
48
+ * Lädt eine lokale Datei über Presigned URL zu S3 hoch
49
+ *
50
+ * @param executeFunctions - n8n Execute Functions Context
51
+ * @param localFilePath - Pfad zur lokalen Datei
52
+ * @returns Promise<FileUploadResult> - Enthält file_id und source_filename
53
+ */
54
+ async function uploadFileToS3(executeFunctions, localFilePath) {
55
+ // Validierung der Datei
56
+ if (!fs.existsSync(localFilePath)) {
57
+ throw new Error(`Datei nicht gefunden: ${localFilePath}`);
58
+ }
59
+ const filename = path.basename(localFilePath);
60
+ const stats = fs.statSync(localFilePath);
61
+ const fileSize = stats.size;
62
+ // Schritt 1: Presigned URL anfordern
63
+ const presignedResponse = await executeFunctions.helpers.requestWithAuthentication.call(executeFunctions, 'CommunityAPIAIServer', {
64
+ method: 'POST',
65
+ url: `${endpoints_1.API_ENDPOINTS.AI_BASE}${endpoints_1.API_ENDPOINTS.PRESIGN_FILE}`,
66
+ form: {
67
+ filename: filename
68
+ },
69
+ json: true,
70
+ });
71
+ if (!(presignedResponse === null || presignedResponse === void 0 ? void 0 : presignedResponse.presigned_url) || !(presignedResponse === null || presignedResponse === void 0 ? void 0 : presignedResponse.file_id)) {
72
+ throw new Error('Fehler beim Anfordern der Presigned URL');
73
+ }
74
+ // Schritt 2: Datei zu S3 hochladen mit Stream
75
+ const contentType = mime_1.default.getType(localFilePath) || 'application/octet-stream';
76
+ const fileStream = fs.createReadStream(localFilePath);
77
+ await executeFunctions.helpers.request({
78
+ method: 'PUT',
79
+ url: presignedResponse.presigned_url,
80
+ body: fileStream,
81
+ headers: {
82
+ 'Content-Type': contentType,
83
+ 'Content-Length': fileSize.toString(),
84
+ },
85
+ });
86
+ return {
87
+ file_id: presignedResponse.file_id,
88
+ source_filename: presignedResponse.source_filename
89
+ };
90
+ }
91
+ /**
92
+ * Lädt mehrere lokale Dateien über Batch Presigned URLs zu S3 hoch
93
+ *
94
+ * @param executeFunctions - n8n Execute Functions Context
95
+ * @param localFilePaths - Array von Pfaden zu lokalen Dateien
96
+ * @returns Promise<FileUploadResult[]> - Array mit file_ids und source_filenames
97
+ */
98
+ async function uploadMultipleFilesToS3(executeFunctions, localFilePaths) {
99
+ if (localFilePaths.length === 0) {
100
+ return [];
101
+ }
102
+ // Validierung aller Dateien
103
+ for (const filePath of localFilePaths) {
104
+ if (!fs.existsSync(filePath)) {
105
+ throw new Error(`Datei nicht gefunden: ${filePath}`);
106
+ }
107
+ }
108
+ const filenames = localFilePaths.map(filePath => path.basename(filePath));
109
+ const batchResponse = await executeFunctions.helpers.requestWithAuthentication.call(executeFunctions, 'CommunityAPIAIServer', {
110
+ method: 'POST',
111
+ url: `${endpoints_1.API_ENDPOINTS.AI_BASE}${endpoints_1.API_ENDPOINTS.PRESIGN_FILE_BATCH}`,
112
+ form: {
113
+ filenames: filenames
114
+ },
115
+ });
116
+ if (!(batchResponse === null || batchResponse === void 0 ? void 0 : batchResponse.presigned) || batchResponse.presigned.length !== localFilePaths.length) {
117
+ throw new Error('Fehler beim Anfordern der Batch Presigned URLs');
118
+ }
119
+ // Schritt 2: Alle Dateien parallel zu S3 hochladen mit Streams
120
+ const uploadPromises = localFilePaths.map(async (filePath, index) => {
121
+ const presignedData = batchResponse.presigned[index];
122
+ const stats = fs.statSync(filePath);
123
+ const fileSize = stats.size;
124
+ const contentType = mime_1.default.getType(filePath) || 'application/octet-stream';
125
+ const fileStream = fs.createReadStream(filePath);
126
+ await executeFunctions.helpers.request({
127
+ method: 'PUT',
128
+ url: presignedData.presigned_url,
129
+ body: fileStream,
130
+ headers: {
131
+ 'Content-Type': contentType,
132
+ 'Content-Length': fileSize.toString(),
133
+ },
134
+ });
135
+ return {
136
+ file_id: presignedData.file_id,
137
+ source_filename: presignedData.source_filename
138
+ };
139
+ });
140
+ return Promise.all(uploadPromises);
141
+ }
142
+ /**
143
+ * Lädt mehrere lokale Dateien einzeln zu S3 hoch (Fallback-Methode)
144
+ */
145
+ async function uploadFilesToS3(executeFunctions, localFilePaths) {
146
+ const results = [];
147
+ for (const filePath of localFilePaths) {
148
+ const result = await uploadFileToS3(executeFunctions, filePath);
149
+ results.push(result);
150
+ }
151
+ return results;
152
+ }
153
+ /**
154
+ * Validiert eine Dateiendung gegen erlaubte Formate
155
+ *
156
+ * @param filePath - Pfad zur Datei
157
+ * @param allowedExtensions - Array erlaubter Dateiendungen
158
+ * @throws Error wenn Dateiendung nicht erlaubt ist
159
+ */
160
+ function validateFileExtension(filePath, allowedExtensions) {
161
+ const extension = path.extname(filePath).slice(1).toLowerCase();
162
+ if (!extension || !allowedExtensions.includes(extension)) {
163
+ throw new Error(`Ungültige Dateierweiterung ".${extension}". Erlaubt sind nur: ${allowedExtensions.join(', ')}`);
164
+ }
165
+ }
166
+ //# sourceMappingURL=fileUploads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUploads.js","sourceRoot":"","sources":["../../src/utils/fileUploads.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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B,EAAE,QAAQ,CAAC,CAAC;QAChE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,QAAgB,EAAE,iBAA2B;IAClF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAEhE,IAAI,CAAC,SAAS,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,gCAAgC,SAAS,wBAAwB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClH,CAAC;AACF,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { IExecuteFunctions } from 'n8n-workflow';
2
+ /**
3
+ * Erkennt den Typ der Eingabe
4
+ */
5
+ export declare function detectInputType(input: string): 'file_id' | 'url' | 'local_path';
6
+ /**
7
+ * Verarbeitet Media-Eingaben basierend auf dem erkannten Typ
8
+ */
9
+ export declare function processMediaInputs(executeFunctions: IExecuteFunctions, inputs: string[], validExtensions: string[]): Promise<string[]>;
10
+ /**
11
+ * Verarbeitet Media-Eingabe basierend auf dem erkannten Typ
12
+ */
13
+ export declare function processMediaInput(executeFunctions: IExecuteFunctions, input: string, validExtensions: string[]): Promise<string>;
14
+ /**
15
+ * Verarbeitet Bild-Eingabe (ähnlich wie Media, aber mit Bild-spezifischen Extensions)
16
+ */
17
+ export declare function processImageInput(executeFunctions: IExecuteFunctions, input: string, validExtensions: string[]): Promise<string>;
18
+ /**
19
+ * Beschreibung für Eingabefelder generieren
20
+ */
21
+ export declare function getInputDescription(inputType: string, plural: boolean): string;
22
+ /**
23
+ * Debug-Information über Eingabeverarbeitung
24
+ */
25
+ export declare function logInputProcessing(original: string, processed: string): void;
26
+ /**
27
+ * Debug-Information für Array-Eingaben loggen
28
+ */
29
+ export declare function logInputsProcessing(originalArray: string[], processedArray: string[]): void;
@@ -0,0 +1,147 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.detectInputType = detectInputType;
37
+ exports.processMediaInputs = processMediaInputs;
38
+ exports.processMediaInput = processMediaInput;
39
+ exports.processImageInput = processImageInput;
40
+ exports.getInputDescription = getInputDescription;
41
+ exports.logInputProcessing = logInputProcessing;
42
+ exports.logInputsProcessing = logInputsProcessing;
43
+ const fileUploads_1 = require("./fileUploads");
44
+ const fs = __importStar(require("fs"));
45
+ /**
46
+ * Erkennt den Typ der Eingabe
47
+ */
48
+ function detectInputType(input) {
49
+ // Trim whitespace
50
+ input = input.trim();
51
+ // UUID v4 Pattern für file_id (36 Zeichen mit Bindestrichen)
52
+ const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
53
+ // URL Pattern (http/https)
54
+ const urlPattern = /^https?:\/\/.+/i;
55
+ // S3 URL Pattern (falls direkte S3 URLs verwendet werden)
56
+ const s3UrlPattern = /^s3:\/\/.+/i;
57
+ // File ID Pattern mit Bucket-Struktur
58
+ // Format: {bucket_name}/{uuid}/jobs/{uuid}/output/...
59
+ // bucket_name ist variabel (z.B. AI_files, oder andere Namen)
60
+ const fileIdWithPathPattern = /^[^/]+\/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\/jobs\/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\/output\/.+/i;
61
+ if (fileIdWithPathPattern.test(input)) {
62
+ return 'file_id';
63
+ }
64
+ else if (uuidPattern.test(input)) {
65
+ return 'file_id';
66
+ }
67
+ else if (urlPattern.test(input) || s3UrlPattern.test(input)) {
68
+ return 'url';
69
+ }
70
+ else {
71
+ return 'local_path';
72
+ }
73
+ }
74
+ /**
75
+ * Verarbeitet Media-Eingaben basierend auf dem erkannten Typ
76
+ */
77
+ async function processMediaInputs(executeFunctions, inputs, validExtensions) {
78
+ return await Promise.all(inputs.map(input => processMediaInput(executeFunctions, input, validExtensions)));
79
+ }
80
+ /**
81
+ * Verarbeitet Media-Eingabe basierend auf dem erkannten Typ
82
+ */
83
+ async function processMediaInput(executeFunctions, input, validExtensions) {
84
+ const inputType = detectInputType(input);
85
+ switch (inputType) {
86
+ case 'file_id':
87
+ // file_id direkt durchreichen
88
+ return input;
89
+ case 'url':
90
+ // URL direkt durchreichen - Server kann URLs verarbeiten
91
+ return input;
92
+ case 'local_path':
93
+ // Lokalen Pfad validieren und hochladen
94
+ if (!fs.existsSync(input)) {
95
+ throw new Error(`Lokale Datei nicht gefunden: ${input}`);
96
+ }
97
+ // Dateierweiterung validieren
98
+ (0, fileUploads_1.validateFileExtension)(input, validExtensions);
99
+ // Datei zu S3 hochladen
100
+ const uploadResult = await (0, fileUploads_1.uploadFileToS3)(executeFunctions, input);
101
+ return uploadResult.file_id;
102
+ default:
103
+ throw new Error(`Unbekannter Eingabetyp für: ${input}`);
104
+ }
105
+ }
106
+ /**
107
+ * Verarbeitet Bild-Eingabe (ähnlich wie Media, aber mit Bild-spezifischen Extensions)
108
+ */
109
+ async function processImageInput(executeFunctions, input, validExtensions) {
110
+ return await processMediaInput(executeFunctions, input, validExtensions);
111
+ }
112
+ /**
113
+ * Beschreibung für Eingabefelder generieren
114
+ */
115
+ function getInputDescription(inputType, plural) {
116
+ var baseDescription = `${inputType}-Datei, die verarbeitet werden soll`;
117
+ if (plural) {
118
+ baseDescription = `${inputType}-Dateien, die verarbeitet werden sollen`;
119
+ }
120
+ const examples = [
121
+ '• UUID (file_id): 12345678-1234-4321-abcd-123456789abc',
122
+ '• URL: https://example.com/file.mp3',
123
+ '• Lokaler Pfad: /path/to/file.mp4'
124
+ ];
125
+ return `${baseDescription}\n${examples.join('\n')}`;
126
+ }
127
+ /**
128
+ * Debug-Information über Eingabeverarbeitung
129
+ */
130
+ function logInputProcessing(original, processed) {
131
+ const inputType = detectInputType(original);
132
+ console.log(`[Input Processing] Type: ${inputType}`);
133
+ console.log(`[Input Processing] Original: ${original}`);
134
+ console.log(`[Input Processing] Processed: ${processed}`);
135
+ }
136
+ /**
137
+ * Debug-Information für Array-Eingaben loggen
138
+ */
139
+ function logInputsProcessing(originalArray, processedArray) {
140
+ console.log(`[Inputs Processing] Processing ${originalArray.length} items:`);
141
+ for (let i = 0; i < originalArray.length; i++) {
142
+ const original = originalArray[i];
143
+ const processed = processedArray[i];
144
+ logInputProcessing(original, processed);
145
+ }
146
+ }
147
+ //# sourceMappingURL=inputProcessing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputProcessing.js","sourceRoot":"","sources":["../../src/utils/inputProcessing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,0CA2BC;AAKD,gDAMC;AAKD,8CAgCC;AAKD,8CAMC;AAKD,kDAWC;AAKD,gDAKC;AAKD,kDAQC;AApID,+CAAsE;AACtE,uCAAyB;AAGzB;;GAEG;AACH,SAAgB,eAAe,CAAC,KAAa;IAC5C,kBAAkB;IAClB,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAErB,6DAA6D;IAC7D,MAAM,WAAW,GAAG,wEAAwE,CAAC;IAE7F,2BAA2B;IAC3B,MAAM,UAAU,GAAG,iBAAiB,CAAC;IAErC,0DAA0D;IAC1D,MAAM,YAAY,GAAG,aAAa,CAAC;IAEnC,sCAAsC;IACtC,sDAAsD;IACtD,8DAA8D;IAC9D,MAAM,qBAAqB,GAAG,qKAAqK,CAAC;IAEpM,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,SAAS,CAAC;IAClB,CAAC;SAAM,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IAClB,CAAC;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAC;IACd,CAAC;SAAM,CAAC;QACP,OAAO,YAAY,CAAC;IACrB,CAAC;AACF,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,kBAAkB,CACvC,gBAAmC,EACnC,MAAgB,EAChB,eAAyB;IAEzB,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAA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AwD;QACxD,qCAAqC;QACrC,mCAAmC;KACnC,CAAC;IACF,OAAO,GAAG,eAAe,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,QAAgB,EAAE,SAAiB;IACrE,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,4BAA4B,SAAS,EAAE,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,aAAuB,EAAE,cAAwB;IACpF,OAAO,CAAC,GAAG,CAAC,kCAAkC,aAAa,CAAC,MAAM,SAAS,CAAC,CAAC;IAE7E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;QACpC,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzC,CAAC;AACF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@marcmeese/n8n-nodes-communityapi-ai-client",
3
+ "version": "0.3.8",
4
+ "description": "Community API AI Server nodes for n8n",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "n8n-nodes"
8
+ ],
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "files": [
12
+ "dist",
13
+ "LICENSE.md",
14
+ "README.md"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "scripts": {
20
+ "build": "tsc && node copy-icons.js",
21
+ "dev": "tsc --watch",
22
+ "lint": "eslint . --ext .ts",
23
+ "lint:fix": "eslint . --ext .ts --fix"
24
+ },
25
+ "dependencies": {
26
+ "mime": "^3.0.0",
27
+ "n8n-core": "^1.48.0",
28
+ "n8n-workflow": "^1.48.0",
29
+ "request": "^2.88.2",
30
+ "request-promise-native": "^1.0.9"
31
+ },
32
+ "devDependencies": {
33
+ "@types/mime": "^3.0.4",
34
+ "@types/request-promise-native": "^1.0.16",
35
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
36
+ "@typescript-eslint/parser": "^6.0.0",
37
+ "eslint": "^8.0.0",
38
+ "typescript": "^5.5.3"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/ranktotop/community_api.git"
43
+ },
44
+ "n8n": {
45
+ "n8nNodesApiVersion": 1,
46
+ "credentials": [
47
+ "dist/credentials/CommunityAPIAIServer.credentials.js"
48
+ ],
49
+ "nodes": [
50
+ "dist/nodes/CommunityAPIAIServer/GetUserInfo/GetUserInfo.node.js",
51
+ "dist/nodes/CommunityAPIAIServer/GetJob/GetJob.node.js",
52
+ "dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleFluxMagnific/ComfyuiImageUpscaleFluxMagnific.node.js",
53
+ "dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleSdxlClarity/ComfyuiImageUpscaleSdxlClarity.node.js",
54
+ "dist/nodes/CommunityAPIAIServer/ComfyuiImageUpscaleStablesr/ComfyuiImageUpscaleStablesr.node.js",
55
+ "dist/nodes/CommunityAPIAIServer/ComfyuiImageModifyFaceswapDetailer/ComfyuiImageModifyFaceswapDetailer.node.js",
56
+ "dist/nodes/CommunityAPIAIServer/MultimediaTranscriber/MultimediaTranscriber.node.js",
57
+ "dist/nodes/CommunityAPIAIServer/AudioDatasetCreator/AudioDatasetCreator.node.js",
58
+ "dist/nodes/CommunityAPIAIServer/DownloadJob/DownloadJob.node.js",
59
+ "dist/nodes/CommunityAPIAIServer/UploadFile/UploadFile.node.js",
60
+ "dist/nodes/CommunityAPIAIServer/UploadFiles/UploadFiles.node.js",
61
+ "dist/nodes/CommunityAPIAIServer/TopazVideoUpscale/TopazVideoUpscale.node.js",
62
+ "dist/nodes/CommunityAPIAIServer/AdvancedVoice/AdvancedVoice.node.js",
63
+ "dist/nodes/CommunityAPIAIServer/Soundstorm/Soundstorm.node.js",
64
+ "dist/nodes/CommunityAPIAIServer/ElevenLabsTTS/ElevenLabsTTS.node.js",
65
+ "dist/nodes/CommunityAPIAIServer/ElevenLabsSTS/ElevenLabsSTS.node.js",
66
+ "dist/nodes/CommunityAPIAIServer/WebpageScraper/WebpageScraper.node.js"
67
+ ]
68
+ }
69
+ }