n8n-nodes-piapi 0.1.2 → 0.1.4
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/README.md +8 -1
 - package/dist/nodes/PiAPI/DiffRhythm/DiffRhythmAudioGeneration.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/DiffRhythm/DiffRhythmAudioGeneration.node.js +259 -0
 - package/dist/nodes/PiAPI/DiffRhythm/DiffRhythmAudioGeneration.node.js.map +1 -0
 - package/dist/nodes/PiAPI/{Skyreels/SkytreelsImageToVideo.node.d.ts → Faceswap/FaceswapImageToImage.node.d.ts} +1 -1
 - package/dist/nodes/PiAPI/Faceswap/FaceswapImageToImage.node.js +278 -0
 - package/dist/nodes/PiAPI/Faceswap/FaceswapImageToImage.node.js.map +1 -0
 - package/dist/nodes/PiAPI/Faceswap/FaceswapVideoToVideo.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/Faceswap/FaceswapVideoToVideo.node.js +297 -0
 - package/dist/nodes/PiAPI/Faceswap/FaceswapVideoToVideo.node.js.map +1 -0
 - package/dist/nodes/PiAPI/FileUpload/FileUpload.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/FileUpload/FileUpload.node.js +215 -0
 - package/dist/nodes/PiAPI/FileUpload/FileUpload.node.js.map +1 -0
 - package/dist/nodes/PiAPI/Flux/FluxTextToImage.node.js +20 -8
 - package/dist/nodes/PiAPI/Flux/FluxTextToImage.node.js.map +1 -1
 - package/dist/nodes/PiAPI/ImageUpscale/ImageUpscale.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/ImageUpscale/ImageUpscale.node.js +209 -0
 - package/dist/nodes/PiAPI/ImageUpscale/ImageUpscale.node.js.map +1 -0
 - package/dist/nodes/PiAPI/MMAudio/MMAudioVideoToAudio.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/MMAudio/MMAudioVideoToAudio.node.js +241 -0
 - package/dist/nodes/PiAPI/MMAudio/MMAudioVideoToAudio.node.js.map +1 -0
 - package/dist/nodes/PiAPI/Midjourney/PiAPIMidjourney.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/Midjourney/PiAPIMidjourney.node.js +426 -0
 - package/dist/nodes/PiAPI/Midjourney/PiAPIMidjourney.node.js.map +1 -0
 - package/dist/nodes/PiAPI/Qubico/QubicoSegment.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/Qubico/QubicoSegment.node.js +243 -0
 - package/dist/nodes/PiAPI/Qubico/QubicoSegment.node.js.map +1 -0
 - package/dist/nodes/PiAPI/RemoveBackground/RemoveBackground.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/RemoveBackground/RemoveBackground.node.js +188 -0
 - package/dist/nodes/PiAPI/RemoveBackground/RemoveBackground.node.js.map +1 -0
 - package/dist/nodes/PiAPI/Skyreels/PiAPISkyreels.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/Skyreels/PiAPISkyreels.node.js +335 -0
 - package/dist/nodes/PiAPI/Skyreels/PiAPISkyreels.node.js.map +1 -0
 - package/dist/nodes/PiAPI/Skyreels/SkyreelsImageToVideo.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/Skyreels/{SkytreelsImageToVideo.node.js → SkyreelsImageToVideo.node.js} +4 -4
 - package/dist/nodes/PiAPI/Skyreels/SkyreelsImageToVideo.node.js.map +1 -0
 - package/dist/nodes/PiAPI/Skyreels/index.d.ts +2 -2
 - package/dist/nodes/PiAPI/Skyreels/index.js +3 -3
 - package/dist/nodes/PiAPI/Skyreels/index.js.map +1 -1
 - package/dist/nodes/PiAPI/TTS/TextToSpeech.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/TTS/TextToSpeech.node.js +214 -0
 - package/dist/nodes/PiAPI/TTS/TextToSpeech.node.js.map +1 -0
 - package/dist/nodes/PiAPI/VideoUpscale/VideoUpscale.node.d.ts +5 -0
 - package/dist/nodes/PiAPI/VideoUpscale/VideoUpscale.node.js +194 -0
 - package/dist/nodes/PiAPI/VideoUpscale/VideoUpscale.node.js.map +1 -0
 - package/dist/nodes/PiAPI/shared/Interfaces.d.ts +179 -5
 - package/dist/package.json +14 -3
 - package/dist/tsconfig.tsbuildinfo +1 -1
 - package/package.json +14 -3
 - package/dist/nodes/PiAPI/Skyreels/SkytreelsImageToVideo.node.js.map +0 -1
 
| 
         @@ -0,0 +1,243 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            "use strict";
         
     | 
| 
      
 2 
     | 
    
         
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 3 
     | 
    
         
            +
            exports.QubicoSegment = void 0;
         
     | 
| 
      
 4 
     | 
    
         
            +
            const GenericFunctions_1 = require("../shared/GenericFunctions");
         
     | 
| 
      
 5 
     | 
    
         
            +
            class QubicoSegment {
         
     | 
| 
      
 6 
     | 
    
         
            +
                constructor() {
         
     | 
| 
      
 7 
     | 
    
         
            +
                    this.description = {
         
     | 
| 
      
 8 
     | 
    
         
            +
                        displayName: 'PiAPI Qubico Image Segmentation',
         
     | 
| 
      
 9 
     | 
    
         
            +
                        name: 'qubicoSegment',
         
     | 
| 
      
 10 
     | 
    
         
            +
                        icon: 'file:../piapi.svg',
         
     | 
| 
      
 11 
     | 
    
         
            +
                        group: ['transform'],
         
     | 
| 
      
 12 
     | 
    
         
            +
                        version: 1,
         
     | 
| 
      
 13 
     | 
    
         
            +
                        description: 'Segment images using semantic prompts via PiAPI Qubico',
         
     | 
| 
      
 14 
     | 
    
         
            +
                        defaults: {
         
     | 
| 
      
 15 
     | 
    
         
            +
                            name: 'Qubico Segment',
         
     | 
| 
      
 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 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 35 
     | 
    
         
            +
                                    {
         
     | 
| 
      
 36 
     | 
    
         
            +
                                        name: 'Binary Field',
         
     | 
| 
      
 37 
     | 
    
         
            +
                                        value: 'binaryField',
         
     | 
| 
      
 38 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 39 
     | 
    
         
            +
                                ],
         
     | 
| 
      
 40 
     | 
    
         
            +
                                default: 'url',
         
     | 
| 
      
 41 
     | 
    
         
            +
                                description: 'How to input the image to segment',
         
     | 
| 
      
 42 
     | 
    
         
            +
                            },
         
     | 
| 
      
 43 
     | 
    
         
            +
                            {
         
     | 
| 
      
 44 
     | 
    
         
            +
                                displayName: 'Image URL',
         
     | 
| 
      
 45 
     | 
    
         
            +
                                name: 'imageUrl',
         
     | 
| 
      
 46 
     | 
    
         
            +
                                type: 'string',
         
     | 
| 
      
 47 
     | 
    
         
            +
                                default: '',
         
     | 
| 
      
 48 
     | 
    
         
            +
                                required: true,
         
     | 
| 
      
 49 
     | 
    
         
            +
                                displayOptions: {
         
     | 
| 
      
 50 
     | 
    
         
            +
                                    show: {
         
     | 
| 
      
 51 
     | 
    
         
            +
                                        imageInputMethod: ['url'],
         
     | 
| 
      
 52 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 53 
     | 
    
         
            +
                                },
         
     | 
| 
      
 54 
     | 
    
         
            +
                                description: 'URL of the image to segment',
         
     | 
| 
      
 55 
     | 
    
         
            +
                            },
         
     | 
| 
      
 56 
     | 
    
         
            +
                            {
         
     | 
| 
      
 57 
     | 
    
         
            +
                                displayName: 'Binary Field',
         
     | 
| 
      
 58 
     | 
    
         
            +
                                name: 'binaryField',
         
     | 
| 
      
 59 
     | 
    
         
            +
                                type: 'string',
         
     | 
| 
      
 60 
     | 
    
         
            +
                                default: 'data',
         
     | 
| 
      
 61 
     | 
    
         
            +
                                required: true,
         
     | 
| 
      
 62 
     | 
    
         
            +
                                displayOptions: {
         
     | 
| 
      
 63 
     | 
    
         
            +
                                    show: {
         
     | 
| 
      
 64 
     | 
    
         
            +
                                        imageInputMethod: ['binaryField'],
         
     | 
| 
      
 65 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 66 
     | 
    
         
            +
                                },
         
     | 
| 
      
 67 
     | 
    
         
            +
                                description: 'The binary field containing the image to segment',
         
     | 
| 
      
 68 
     | 
    
         
            +
                            },
         
     | 
| 
      
 69 
     | 
    
         
            +
                            {
         
     | 
| 
      
 70 
     | 
    
         
            +
                                displayName: 'Prompt',
         
     | 
| 
      
 71 
     | 
    
         
            +
                                name: 'prompt',
         
     | 
| 
      
 72 
     | 
    
         
            +
                                type: 'string',
         
     | 
| 
      
 73 
     | 
    
         
            +
                                typeOptions: {
         
     | 
| 
      
 74 
     | 
    
         
            +
                                    rows: 4,
         
     | 
| 
      
 75 
     | 
    
         
            +
                                },
         
     | 
| 
      
 76 
     | 
    
         
            +
                                default: '',
         
     | 
| 
      
 77 
     | 
    
         
            +
                                placeholder: 'clothes,shoes',
         
     | 
| 
      
 78 
     | 
    
         
            +
                                required: true,
         
     | 
| 
      
 79 
     | 
    
         
            +
                                description: 'The semantic prompt of the things that you want to segment, separate by comma',
         
     | 
| 
      
 80 
     | 
    
         
            +
                            },
         
     | 
| 
      
 81 
     | 
    
         
            +
                            {
         
     | 
| 
      
 82 
     | 
    
         
            +
                                displayName: 'Negative Prompt',
         
     | 
| 
      
 83 
     | 
    
         
            +
                                name: 'negativePrompt',
         
     | 
| 
      
 84 
     | 
    
         
            +
                                type: 'string',
         
     | 
| 
      
 85 
     | 
    
         
            +
                                typeOptions: {
         
     | 
| 
      
 86 
     | 
    
         
            +
                                    rows: 4,
         
     | 
| 
      
 87 
     | 
    
         
            +
                                },
         
     | 
| 
      
 88 
     | 
    
         
            +
                                default: '',
         
     | 
| 
      
 89 
     | 
    
         
            +
                                placeholder: 'pants',
         
     | 
| 
      
 90 
     | 
    
         
            +
                                description: 'The semantic prompt of the things that you do not want to segment, separate by comma',
         
     | 
| 
      
 91 
     | 
    
         
            +
                            },
         
     | 
| 
      
 92 
     | 
    
         
            +
                            {
         
     | 
| 
      
 93 
     | 
    
         
            +
                                displayName: 'Segment Factor',
         
     | 
| 
      
 94 
     | 
    
         
            +
                                name: 'segmentFactor',
         
     | 
| 
      
 95 
     | 
    
         
            +
                                type: 'number',
         
     | 
| 
      
 96 
     | 
    
         
            +
                                default: 0,
         
     | 
| 
      
 97 
     | 
    
         
            +
                                description: 'Pixels that expand or shrink on the edge, positive integer for expansion, negative for shrinking',
         
     | 
| 
      
 98 
     | 
    
         
            +
                            },
         
     | 
| 
      
 99 
     | 
    
         
            +
                            {
         
     | 
| 
      
 100 
     | 
    
         
            +
                                displayName: 'Wait For Completion',
         
     | 
| 
      
 101 
     | 
    
         
            +
                                name: 'waitForCompletion',
         
     | 
| 
      
 102 
     | 
    
         
            +
                                type: 'boolean',
         
     | 
| 
      
 103 
     | 
    
         
            +
                                default: false,
         
     | 
| 
      
 104 
     | 
    
         
            +
                                description: 'Whether to wait for the segmentation to complete',
         
     | 
| 
      
 105 
     | 
    
         
            +
                            },
         
     | 
| 
      
 106 
     | 
    
         
            +
                            {
         
     | 
| 
      
 107 
     | 
    
         
            +
                                displayName: 'Return Binary Data',
         
     | 
| 
      
 108 
     | 
    
         
            +
                                name: 'returnBinaryData',
         
     | 
| 
      
 109 
     | 
    
         
            +
                                type: 'boolean',
         
     | 
| 
      
 110 
     | 
    
         
            +
                                default: false,
         
     | 
| 
      
 111 
     | 
    
         
            +
                                description: 'Whether to return the segmented image as binary data',
         
     | 
| 
      
 112 
     | 
    
         
            +
                                displayOptions: {
         
     | 
| 
      
 113 
     | 
    
         
            +
                                    show: {
         
     | 
| 
      
 114 
     | 
    
         
            +
                                        waitForCompletion: [true],
         
     | 
| 
      
 115 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 116 
     | 
    
         
            +
                                },
         
     | 
| 
      
 117 
     | 
    
         
            +
                            },
         
     | 
| 
      
 118 
     | 
    
         
            +
                            {
         
     | 
| 
      
 119 
     | 
    
         
            +
                                displayName: 'Binary Property',
         
     | 
| 
      
 120 
     | 
    
         
            +
                                name: 'binaryPropertyName',
         
     | 
| 
      
 121 
     | 
    
         
            +
                                type: 'string',
         
     | 
| 
      
 122 
     | 
    
         
            +
                                default: 'data',
         
     | 
| 
      
 123 
     | 
    
         
            +
                                required: true,
         
     | 
| 
      
 124 
     | 
    
         
            +
                                displayOptions: {
         
     | 
| 
      
 125 
     | 
    
         
            +
                                    show: {
         
     | 
| 
      
 126 
     | 
    
         
            +
                                        returnBinaryData: [true],
         
     | 
| 
      
 127 
     | 
    
         
            +
                                        waitForCompletion: [true],
         
     | 
| 
      
 128 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 129 
     | 
    
         
            +
                                },
         
     | 
| 
      
 130 
     | 
    
         
            +
                                description: 'Name of the binary property to which to write the data of the segmented image',
         
     | 
| 
      
 131 
     | 
    
         
            +
                            },
         
     | 
| 
      
 132 
     | 
    
         
            +
                        ],
         
     | 
| 
      
 133 
     | 
    
         
            +
                    };
         
     | 
| 
      
 134 
     | 
    
         
            +
                }
         
     | 
| 
      
 135 
     | 
    
         
            +
                async execute() {
         
     | 
| 
      
 136 
     | 
    
         
            +
                    const items = this.getInputData();
         
     | 
| 
      
 137 
     | 
    
         
            +
                    const returnData = [];
         
     | 
| 
      
 138 
     | 
    
         
            +
                    for (let i = 0; i < items.length; i++) {
         
     | 
| 
      
 139 
     | 
    
         
            +
                        try {
         
     | 
| 
      
 140 
     | 
    
         
            +
                            const imageInputMethod = this.getNodeParameter('imageInputMethod', i);
         
     | 
| 
      
 141 
     | 
    
         
            +
                            const prompt = this.getNodeParameter('prompt', i);
         
     | 
| 
      
 142 
     | 
    
         
            +
                            const negativePrompt = this.getNodeParameter('negativePrompt', i, '');
         
     | 
| 
      
 143 
     | 
    
         
            +
                            const segmentFactor = this.getNodeParameter('segmentFactor', i, 0);
         
     | 
| 
      
 144 
     | 
    
         
            +
                            const waitForCompletion = this.getNodeParameter('waitForCompletion', i, false);
         
     | 
| 
      
 145 
     | 
    
         
            +
                            let imageUrl;
         
     | 
| 
      
 146 
     | 
    
         
            +
                            if (imageInputMethod === 'url') {
         
     | 
| 
      
 147 
     | 
    
         
            +
                                imageUrl = this.getNodeParameter('imageUrl', i);
         
     | 
| 
      
 148 
     | 
    
         
            +
                            }
         
     | 
| 
      
 149 
     | 
    
         
            +
                            else {
         
     | 
| 
      
 150 
     | 
    
         
            +
                                const binaryField = this.getNodeParameter('binaryField', i);
         
     | 
| 
      
 151 
     | 
    
         
            +
                                if (items[i].binary === undefined) {
         
     | 
| 
      
 152 
     | 
    
         
            +
                                    throw new Error('No binary data exists on item!');
         
     | 
| 
      
 153 
     | 
    
         
            +
                                }
         
     | 
| 
      
 154 
     | 
    
         
            +
                                const binaryData = items[i].binary[binaryField];
         
     | 
| 
      
 155 
     | 
    
         
            +
                                if (binaryData === undefined) {
         
     | 
| 
      
 156 
     | 
    
         
            +
                                    throw new Error(`No binary data found for field "${binaryField}"!`);
         
     | 
| 
      
 157 
     | 
    
         
            +
                                }
         
     | 
| 
      
 158 
     | 
    
         
            +
                                if (binaryData.url) {
         
     | 
| 
      
 159 
     | 
    
         
            +
                                    imageUrl = String(binaryData.url);
         
     | 
| 
      
 160 
     | 
    
         
            +
                                }
         
     | 
| 
      
 161 
     | 
    
         
            +
                                else {
         
     | 
| 
      
 162 
     | 
    
         
            +
                                    const mimeType = binaryData.mimeType;
         
     | 
| 
      
 163 
     | 
    
         
            +
                                    const base64 = Buffer.from(binaryData.data, 'base64').toString('base64');
         
     | 
| 
      
 164 
     | 
    
         
            +
                                    imageUrl = `data:${mimeType};base64,${base64}`;
         
     | 
| 
      
 165 
     | 
    
         
            +
                                }
         
     | 
| 
      
 166 
     | 
    
         
            +
                            }
         
     | 
| 
      
 167 
     | 
    
         
            +
                            const params = {
         
     | 
| 
      
 168 
     | 
    
         
            +
                                model: 'Qubico/image-toolkit',
         
     | 
| 
      
 169 
     | 
    
         
            +
                                task_type: 'segment',
         
     | 
| 
      
 170 
     | 
    
         
            +
                                input: {
         
     | 
| 
      
 171 
     | 
    
         
            +
                                    image: imageUrl,
         
     | 
| 
      
 172 
     | 
    
         
            +
                                    prompt,
         
     | 
| 
      
 173 
     | 
    
         
            +
                                    negative_prompt: negativePrompt,
         
     | 
| 
      
 174 
     | 
    
         
            +
                                    segment_factor: segmentFactor,
         
     | 
| 
      
 175 
     | 
    
         
            +
                                },
         
     | 
| 
      
 176 
     | 
    
         
            +
                            };
         
     | 
| 
      
 177 
     | 
    
         
            +
                            const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', params);
         
     | 
| 
      
 178 
     | 
    
         
            +
                            const taskId = response.data.task_id;
         
     | 
| 
      
 179 
     | 
    
         
            +
                            if (waitForCompletion) {
         
     | 
| 
      
 180 
     | 
    
         
            +
                                const completedTask = await GenericFunctions_1.waitForTaskCompletion.call(this, taskId);
         
     | 
| 
      
 181 
     | 
    
         
            +
                                const returnBinaryData = this.getNodeParameter('returnBinaryData', i, false);
         
     | 
| 
      
 182 
     | 
    
         
            +
                                if (returnBinaryData) {
         
     | 
| 
      
 183 
     | 
    
         
            +
                                    const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
         
     | 
| 
      
 184 
     | 
    
         
            +
                                    const segmentedImageUrl = completedTask.output && typeof completedTask.output === 'object'
         
     | 
| 
      
 185 
     | 
    
         
            +
                                        ? completedTask.output.image_url
         
     | 
| 
      
 186 
     | 
    
         
            +
                                        : undefined;
         
     | 
| 
      
 187 
     | 
    
         
            +
                                    if (segmentedImageUrl) {
         
     | 
| 
      
 188 
     | 
    
         
            +
                                        const imageData = await this.helpers.request({
         
     | 
| 
      
 189 
     | 
    
         
            +
                                            method: 'GET',
         
     | 
| 
      
 190 
     | 
    
         
            +
                                            url: segmentedImageUrl,
         
     | 
| 
      
 191 
     | 
    
         
            +
                                            encoding: null,
         
     | 
| 
      
 192 
     | 
    
         
            +
                                            resolveWithFullResponse: true,
         
     | 
| 
      
 193 
     | 
    
         
            +
                                        });
         
     | 
| 
      
 194 
     | 
    
         
            +
                                        const newItem = {
         
     | 
| 
      
 195 
     | 
    
         
            +
                                            json: completedTask,
         
     | 
| 
      
 196 
     | 
    
         
            +
                                            binary: {},
         
     | 
| 
      
 197 
     | 
    
         
            +
                                        };
         
     | 
| 
      
 198 
     | 
    
         
            +
                                        if (newItem.binary) {
         
     | 
| 
      
 199 
     | 
    
         
            +
                                            newItem.binary[binaryPropertyName] = await this.helpers.prepareBinaryData(Buffer.from(imageData.body), segmentedImageUrl.split('/').pop() || 'segmented-image.png', imageData.headers['content-type']);
         
     | 
| 
      
 200 
     | 
    
         
            +
                                        }
         
     | 
| 
      
 201 
     | 
    
         
            +
                                        returnData.push(newItem);
         
     | 
| 
      
 202 
     | 
    
         
            +
                                    }
         
     | 
| 
      
 203 
     | 
    
         
            +
                                    else {
         
     | 
| 
      
 204 
     | 
    
         
            +
                                        returnData.push({
         
     | 
| 
      
 205 
     | 
    
         
            +
                                            json: {
         
     | 
| 
      
 206 
     | 
    
         
            +
                                                ...completedTask,
         
     | 
| 
      
 207 
     | 
    
         
            +
                                                error: 'No segmented image URL found in the response',
         
     | 
| 
      
 208 
     | 
    
         
            +
                                            },
         
     | 
| 
      
 209 
     | 
    
         
            +
                                        });
         
     | 
| 
      
 210 
     | 
    
         
            +
                                    }
         
     | 
| 
      
 211 
     | 
    
         
            +
                                }
         
     | 
| 
      
 212 
     | 
    
         
            +
                                else {
         
     | 
| 
      
 213 
     | 
    
         
            +
                                    returnData.push({
         
     | 
| 
      
 214 
     | 
    
         
            +
                                        json: completedTask,
         
     | 
| 
      
 215 
     | 
    
         
            +
                                    });
         
     | 
| 
      
 216 
     | 
    
         
            +
                                }
         
     | 
| 
      
 217 
     | 
    
         
            +
                            }
         
     | 
| 
      
 218 
     | 
    
         
            +
                            else {
         
     | 
| 
      
 219 
     | 
    
         
            +
                                returnData.push({
         
     | 
| 
      
 220 
     | 
    
         
            +
                                    json: {
         
     | 
| 
      
 221 
     | 
    
         
            +
                                        taskId,
         
     | 
| 
      
 222 
     | 
    
         
            +
                                        ...response.data,
         
     | 
| 
      
 223 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 224 
     | 
    
         
            +
                                });
         
     | 
| 
      
 225 
     | 
    
         
            +
                            }
         
     | 
| 
      
 226 
     | 
    
         
            +
                        }
         
     | 
| 
      
 227 
     | 
    
         
            +
                        catch (error) {
         
     | 
| 
      
 228 
     | 
    
         
            +
                            if (this.continueOnFail()) {
         
     | 
| 
      
 229 
     | 
    
         
            +
                                returnData.push({
         
     | 
| 
      
 230 
     | 
    
         
            +
                                    json: {
         
     | 
| 
      
 231 
     | 
    
         
            +
                                        error: error.message,
         
     | 
| 
      
 232 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 233 
     | 
    
         
            +
                                });
         
     | 
| 
      
 234 
     | 
    
         
            +
                                continue;
         
     | 
| 
      
 235 
     | 
    
         
            +
                            }
         
     | 
| 
      
 236 
     | 
    
         
            +
                            throw error;
         
     | 
| 
      
 237 
     | 
    
         
            +
                        }
         
     | 
| 
      
 238 
     | 
    
         
            +
                    }
         
     | 
| 
      
 239 
     | 
    
         
            +
                    return [returnData];
         
     | 
| 
      
 240 
     | 
    
         
            +
                }
         
     | 
| 
      
 241 
     | 
    
         
            +
            }
         
     | 
| 
      
 242 
     | 
    
         
            +
            exports.QubicoSegment = QubicoSegment;
         
     | 
| 
      
 243 
     | 
    
         
            +
            //# sourceMappingURL=QubicoSegment.node.js.map
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"QubicoSegment.node.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/Qubico/QubicoSegment.node.ts"],"names":[],"mappings":";;;AASA,iEAAiF;AAGjF,MAAa,aAAa;IAA1B;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,iCAAiC;YAC9C,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE;gBACN,IAAI,EAAE,gBAAgB;aACzB;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;gBACR;oBACI,WAAW,EAAE,oBAAoB;oBACjC,IAAI,EAAE,kBAAkB;oBACxB,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACL;4BACI,IAAI,EAAE,KAAK;4BACX,KAAK,EAAE,KAAK;yBACf;wBACD;4BACI,IAAI,EAAE,cAAc;4BACpB,KAAK,EAAE,aAAa;yBACvB;qBACJ;oBACD,OAAO,EAAE,KAAK;oBACd,WAAW,EAAE,mCAAmC;iBACnD;gBACD;oBACI,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,QAAQ,EAAE,IAAI;oBACd,cAAc,EAAE;wB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C;4BAED,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;wBAC7B,CAAC;6BAAM,CAAC;4BAEJ,UAAU,CAAC,IAAI,CAAC;gCACZ,IAAI,EAAE;oCACF,GAAG,aAAa;oCAChB,KAAK,EAAE,8CAA8C;iCACxD;6BACJ,CAAC,CAAC;wBACP,CAAC;oBACL,CAAC;yBAAM,CAAC;wBAEJ,UAAU,CAAC,IAAI,CAAC;4BACZ,IAAI,EAAE,aAAa;yBACtB,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;qBAAM,CAAC;oBAEJ,UAAU,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE;4BACF,MAAM;4BACN,GAAG,QAAQ,CAAC,IAAI;yBACnB;qBACJ,CAAC,CAAC;gBACP,CAAC;YACL,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;AAtQD,sCAsQC"}
         
     | 
| 
         @@ -0,0 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
         
     | 
| 
      
 2 
     | 
    
         
            +
            export declare class RemoveBackground implements INodeType {
         
     | 
| 
      
 3 
     | 
    
         
            +
                description: INodeTypeDescription;
         
     | 
| 
      
 4 
     | 
    
         
            +
                execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
         
     | 
| 
      
 5 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,188 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            "use strict";
         
     | 
| 
      
 2 
     | 
    
         
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 3 
     | 
    
         
            +
            exports.RemoveBackground = void 0;
         
     | 
| 
      
 4 
     | 
    
         
            +
            const n8n_workflow_1 = require("n8n-workflow");
         
     | 
| 
      
 5 
     | 
    
         
            +
            const GenericFunctions_1 = require("../shared/GenericFunctions");
         
     | 
| 
      
 6 
     | 
    
         
            +
            class RemoveBackground {
         
     | 
| 
      
 7 
     | 
    
         
            +
                constructor() {
         
     | 
| 
      
 8 
     | 
    
         
            +
                    this.description = {
         
     | 
| 
      
 9 
     | 
    
         
            +
                        displayName: 'PiAPI Remove Background',
         
     | 
| 
      
 10 
     | 
    
         
            +
                        name: 'removeBackground',
         
     | 
| 
      
 11 
     | 
    
         
            +
                        icon: 'file:../piapi.svg',
         
     | 
| 
      
 12 
     | 
    
         
            +
                        group: ['transform'],
         
     | 
| 
      
 13 
     | 
    
         
            +
                        version: 1,
         
     | 
| 
      
 14 
     | 
    
         
            +
                        description: 'Remove the background from images using PiAPI',
         
     | 
| 
      
 15 
     | 
    
         
            +
                        defaults: {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            name: 'Remove Background',
         
     | 
| 
      
 17 
     | 
    
         
            +
                        },
         
     | 
| 
      
 18 
     | 
    
         
            +
                        inputs: ["main"],
         
     | 
| 
      
 19 
     | 
    
         
            +
                        outputs: ["main"],
         
     | 
| 
      
 20 
     | 
    
         
            +
                        credentials: [
         
     | 
| 
      
 21 
     | 
    
         
            +
                            {
         
     | 
| 
      
 22 
     | 
    
         
            +
                                name: 'piAPIApi',
         
     | 
| 
      
 23 
     | 
    
         
            +
                                required: true,
         
     | 
| 
      
 24 
     | 
    
         
            +
                            },
         
     | 
| 
      
 25 
     | 
    
         
            +
                        ],
         
     | 
| 
      
 26 
     | 
    
         
            +
                        properties: [
         
     | 
| 
      
 27 
     | 
    
         
            +
                            {
         
     | 
| 
      
 28 
     | 
    
         
            +
                                displayName: 'Image Input Method',
         
     | 
| 
      
 29 
     | 
    
         
            +
                                name: 'imageInputMethod',
         
     | 
| 
      
 30 
     | 
    
         
            +
                                type: 'options',
         
     | 
| 
      
 31 
     | 
    
         
            +
                                options: [
         
     | 
| 
      
 32 
     | 
    
         
            +
                                    {
         
     | 
| 
      
 33 
     | 
    
         
            +
                                        name: 'URL',
         
     | 
| 
      
 34 
     | 
    
         
            +
                                        value: 'url',
         
     | 
| 
      
 35 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 36 
     | 
    
         
            +
                                    {
         
     | 
| 
      
 37 
     | 
    
         
            +
                                        name: 'Binary Data',
         
     | 
| 
      
 38 
     | 
    
         
            +
                                        value: 'binaryData',
         
     | 
| 
      
 39 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 40 
     | 
    
         
            +
                                ],
         
     | 
| 
      
 41 
     | 
    
         
            +
                                default: 'url',
         
     | 
| 
      
 42 
     | 
    
         
            +
                                description: 'Method to input the image data',
         
     | 
| 
      
 43 
     | 
    
         
            +
                            },
         
     | 
| 
      
 44 
     | 
    
         
            +
                            {
         
     | 
| 
      
 45 
     | 
    
         
            +
                                displayName: 'Image Binary Property',
         
     | 
| 
      
 46 
     | 
    
         
            +
                                name: 'imageBinaryPropertyName',
         
     | 
| 
      
 47 
     | 
    
         
            +
                                type: 'string',
         
     | 
| 
      
 48 
     | 
    
         
            +
                                default: 'data',
         
     | 
| 
      
 49 
     | 
    
         
            +
                                required: true,
         
     | 
| 
      
 50 
     | 
    
         
            +
                                displayOptions: {
         
     | 
| 
      
 51 
     | 
    
         
            +
                                    show: {
         
     | 
| 
      
 52 
     | 
    
         
            +
                                        imageInputMethod: ['binaryData'],
         
     | 
| 
      
 53 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 54 
     | 
    
         
            +
                                },
         
     | 
| 
      
 55 
     | 
    
         
            +
                                description: 'Name of the binary property containing the image data',
         
     | 
| 
      
 56 
     | 
    
         
            +
                            },
         
     | 
| 
      
 57 
     | 
    
         
            +
                            {
         
     | 
| 
      
 58 
     | 
    
         
            +
                                displayName: 'Image URL',
         
     | 
| 
      
 59 
     | 
    
         
            +
                                name: 'imageUrl',
         
     | 
| 
      
 60 
     | 
    
         
            +
                                type: 'string',
         
     | 
| 
      
 61 
     | 
    
         
            +
                                default: '',
         
     | 
| 
      
 62 
     | 
    
         
            +
                                required: true,
         
     | 
| 
      
 63 
     | 
    
         
            +
                                displayOptions: {
         
     | 
| 
      
 64 
     | 
    
         
            +
                                    show: {
         
     | 
| 
      
 65 
     | 
    
         
            +
                                        imageInputMethod: ['url'],
         
     | 
| 
      
 66 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 67 
     | 
    
         
            +
                                },
         
     | 
| 
      
 68 
     | 
    
         
            +
                                description: 'URL of the image to process',
         
     | 
| 
      
 69 
     | 
    
         
            +
                            },
         
     | 
| 
      
 70 
     | 
    
         
            +
                            {
         
     | 
| 
      
 71 
     | 
    
         
            +
                                displayName: 'Image Requirements',
         
     | 
| 
      
 72 
     | 
    
         
            +
                                name: 'imageRequirements',
         
     | 
| 
      
 73 
     | 
    
         
            +
                                type: 'notice',
         
     | 
| 
      
 74 
     | 
    
         
            +
                                default: 'The image should be in a common format (JPEG, PNG) and must not exceed 10MB in size.',
         
     | 
| 
      
 75 
     | 
    
         
            +
                            },
         
     | 
| 
      
 76 
     | 
    
         
            +
                            {
         
     | 
| 
      
 77 
     | 
    
         
            +
                                displayName: 'Wait For Completion',
         
     | 
| 
      
 78 
     | 
    
         
            +
                                name: 'waitForCompletion',
         
     | 
| 
      
 79 
     | 
    
         
            +
                                type: 'boolean',
         
     | 
| 
      
 80 
     | 
    
         
            +
                                default: false,
         
     | 
| 
      
 81 
     | 
    
         
            +
                                description: 'Whether to wait for the background removal process to complete before continuing',
         
     | 
| 
      
 82 
     | 
    
         
            +
                            },
         
     | 
| 
      
 83 
     | 
    
         
            +
                            {
         
     | 
| 
      
 84 
     | 
    
         
            +
                                displayName: 'Max Retries',
         
     | 
| 
      
 85 
     | 
    
         
            +
                                name: 'maxRetries',
         
     | 
| 
      
 86 
     | 
    
         
            +
                                type: 'number',
         
     | 
| 
      
 87 
     | 
    
         
            +
                                default: 20,
         
     | 
| 
      
 88 
     | 
    
         
            +
                                description: 'Maximum number of retries to check task status',
         
     | 
| 
      
 89 
     | 
    
         
            +
                                displayOptions: {
         
     | 
| 
      
 90 
     | 
    
         
            +
                                    show: {
         
     | 
| 
      
 91 
     | 
    
         
            +
                                        waitForCompletion: [true],
         
     | 
| 
      
 92 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 93 
     | 
    
         
            +
                                },
         
     | 
| 
      
 94 
     | 
    
         
            +
                            },
         
     | 
| 
      
 95 
     | 
    
         
            +
                            {
         
     | 
| 
      
 96 
     | 
    
         
            +
                                displayName: 'Retry Interval',
         
     | 
| 
      
 97 
     | 
    
         
            +
                                name: 'retryInterval',
         
     | 
| 
      
 98 
     | 
    
         
            +
                                type: 'number',
         
     | 
| 
      
 99 
     | 
    
         
            +
                                default: 3000,
         
     | 
| 
      
 100 
     | 
    
         
            +
                                description: 'Interval between retries in milliseconds',
         
     | 
| 
      
 101 
     | 
    
         
            +
                                displayOptions: {
         
     | 
| 
      
 102 
     | 
    
         
            +
                                    show: {
         
     | 
| 
      
 103 
     | 
    
         
            +
                                        waitForCompletion: [true],
         
     | 
| 
      
 104 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 105 
     | 
    
         
            +
                                },
         
     | 
| 
      
 106 
     | 
    
         
            +
                            },
         
     | 
| 
      
 107 
     | 
    
         
            +
                        ],
         
     | 
| 
      
 108 
     | 
    
         
            +
                    };
         
     | 
| 
      
 109 
     | 
    
         
            +
                }
         
     | 
| 
      
 110 
     | 
    
         
            +
                async execute() {
         
     | 
| 
      
 111 
     | 
    
         
            +
                    var _a, _b;
         
     | 
| 
      
 112 
     | 
    
         
            +
                    const items = this.getInputData();
         
     | 
| 
      
 113 
     | 
    
         
            +
                    const returnData = [];
         
     | 
| 
      
 114 
     | 
    
         
            +
                    for (let i = 0; i < items.length; i++) {
         
     | 
| 
      
 115 
     | 
    
         
            +
                        try {
         
     | 
| 
      
 116 
     | 
    
         
            +
                            const imageInputMethod = this.getNodeParameter('imageInputMethod', i);
         
     | 
| 
      
 117 
     | 
    
         
            +
                            const waitForCompletion = this.getNodeParameter('waitForCompletion', i, false);
         
     | 
| 
      
 118 
     | 
    
         
            +
                            let imageData;
         
     | 
| 
      
 119 
     | 
    
         
            +
                            if (imageInputMethod === 'url') {
         
     | 
| 
      
 120 
     | 
    
         
            +
                                imageData = this.getNodeParameter('imageUrl', i);
         
     | 
| 
      
 121 
     | 
    
         
            +
                            }
         
     | 
| 
      
 122 
     | 
    
         
            +
                            else {
         
     | 
| 
      
 123 
     | 
    
         
            +
                                const imageBinaryPropertyName = this.getNodeParameter('imageBinaryPropertyName', i);
         
     | 
| 
      
 124 
     | 
    
         
            +
                                const imageBinaryData = this.helpers.assertBinaryData(i, imageBinaryPropertyName);
         
     | 
| 
      
 125 
     | 
    
         
            +
                                if (imageBinaryData.mimeType && !imageBinaryData.mimeType.includes('image')) {
         
     | 
| 
      
 126 
     | 
    
         
            +
                                    throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The provided binary data is not an image', { itemIndex: i });
         
     | 
| 
      
 127 
     | 
    
         
            +
                                }
         
     | 
| 
      
 128 
     | 
    
         
            +
                                const base64String = Buffer.from(await this.helpers.getBinaryDataBuffer(i, imageBinaryPropertyName)).toString('base64');
         
     | 
| 
      
 129 
     | 
    
         
            +
                                imageData = `data:${imageBinaryData.mimeType};base64,${base64String}`;
         
     | 
| 
      
 130 
     | 
    
         
            +
                            }
         
     | 
| 
      
 131 
     | 
    
         
            +
                            const requestBody = {
         
     | 
| 
      
 132 
     | 
    
         
            +
                                model: 'Qubico/image-toolkit',
         
     | 
| 
      
 133 
     | 
    
         
            +
                                task_type: 'background-remove',
         
     | 
| 
      
 134 
     | 
    
         
            +
                                input: {
         
     | 
| 
      
 135 
     | 
    
         
            +
                                    image: imageData,
         
     | 
| 
      
 136 
     | 
    
         
            +
                                },
         
     | 
| 
      
 137 
     | 
    
         
            +
                            };
         
     | 
| 
      
 138 
     | 
    
         
            +
                            const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', requestBody);
         
     | 
| 
      
 139 
     | 
    
         
            +
                            const taskId = (_a = response.data) === null || _a === void 0 ? void 0 : _a.task_id;
         
     | 
| 
      
 140 
     | 
    
         
            +
                            if (!taskId) {
         
     | 
| 
      
 141 
     | 
    
         
            +
                                throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Failed to get a valid task ID from the API');
         
     | 
| 
      
 142 
     | 
    
         
            +
                            }
         
     | 
| 
      
 143 
     | 
    
         
            +
                            let executionData;
         
     | 
| 
      
 144 
     | 
    
         
            +
                            if (waitForCompletion) {
         
     | 
| 
      
 145 
     | 
    
         
            +
                                const maxRetries = this.getNodeParameter('maxRetries', i, 20);
         
     | 
| 
      
 146 
     | 
    
         
            +
                                const retryInterval = this.getNodeParameter('retryInterval', i, 3000);
         
     | 
| 
      
 147 
     | 
    
         
            +
                                executionData = await GenericFunctions_1.waitForTaskCompletion.call(this, taskId, maxRetries, retryInterval);
         
     | 
| 
      
 148 
     | 
    
         
            +
                            }
         
     | 
| 
      
 149 
     | 
    
         
            +
                            else {
         
     | 
| 
      
 150 
     | 
    
         
            +
                                executionData = {
         
     | 
| 
      
 151 
     | 
    
         
            +
                                    task_id: taskId,
         
     | 
| 
      
 152 
     | 
    
         
            +
                                    status: ((_b = response.data) === null || _b === void 0 ? void 0 : _b.status) || 'pending',
         
     | 
| 
      
 153 
     | 
    
         
            +
                                };
         
     | 
| 
      
 154 
     | 
    
         
            +
                            }
         
     | 
| 
      
 155 
     | 
    
         
            +
                            returnData.push({
         
     | 
| 
      
 156 
     | 
    
         
            +
                                json: executionData,
         
     | 
| 
      
 157 
     | 
    
         
            +
                            });
         
     | 
| 
      
 158 
     | 
    
         
            +
                        }
         
     | 
| 
      
 159 
     | 
    
         
            +
                        catch (error) {
         
     | 
| 
      
 160 
     | 
    
         
            +
                            if (error.message && error.message.includes('failed to get valid image')) {
         
     | 
| 
      
 161 
     | 
    
         
            +
                                const errorMessage = 'The API could not process the provided image. Please ensure the image is accessible, in a common format (JPEG, PNG), and not too large (under 10MB).';
         
     | 
| 
      
 162 
     | 
    
         
            +
                                if (this.continueOnFail()) {
         
     | 
| 
      
 163 
     | 
    
         
            +
                                    returnData.push({
         
     | 
| 
      
 164 
     | 
    
         
            +
                                        json: {
         
     | 
| 
      
 165 
     | 
    
         
            +
                                            error: errorMessage,
         
     | 
| 
      
 166 
     | 
    
         
            +
                                            details: error.message,
         
     | 
| 
      
 167 
     | 
    
         
            +
                                        },
         
     | 
| 
      
 168 
     | 
    
         
            +
                                    });
         
     | 
| 
      
 169 
     | 
    
         
            +
                                    continue;
         
     | 
| 
      
 170 
     | 
    
         
            +
                                }
         
     | 
| 
      
 171 
     | 
    
         
            +
                                throw new n8n_workflow_1.NodeOperationError(this.getNode(), errorMessage);
         
     | 
| 
      
 172 
     | 
    
         
            +
                            }
         
     | 
| 
      
 173 
     | 
    
         
            +
                            if (this.continueOnFail()) {
         
     | 
| 
      
 174 
     | 
    
         
            +
                                returnData.push({
         
     | 
| 
      
 175 
     | 
    
         
            +
                                    json: {
         
     | 
| 
      
 176 
     | 
    
         
            +
                                        error: error.message,
         
     | 
| 
      
 177 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 178 
     | 
    
         
            +
                                });
         
     | 
| 
      
 179 
     | 
    
         
            +
                                continue;
         
     | 
| 
      
 180 
     | 
    
         
            +
                            }
         
     | 
| 
      
 181 
     | 
    
         
            +
                            throw error;
         
     | 
| 
      
 182 
     | 
    
         
            +
                        }
         
     | 
| 
      
 183 
     | 
    
         
            +
                    }
         
     | 
| 
      
 184 
     | 
    
         
            +
                    return [returnData];
         
     | 
| 
      
 185 
     | 
    
         
            +
                }
         
     | 
| 
      
 186 
     | 
    
         
            +
            }
         
     | 
| 
      
 187 
     | 
    
         
            +
            exports.RemoveBackground = RemoveBackground;
         
     | 
| 
      
 188 
     | 
    
         
            +
            //# sourceMappingURL=RemoveBackground.node.js.map
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"RemoveBackground.node.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/RemoveBackground/RemoveBackground.node.ts"],"names":[],"mappings":";;;AAAA,+CAQsB;AAEtB,iEAAiF;AAGjF,MAAa,gBAAgB;IAA7B;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE;gBACN,IAAI,EAAE,mBAAmB;aAC5B;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;gBAER;oBACI,WAAW,EAAE,oBAAoB;oBACjC,IAAI,EAAE,kBAAkB;oBACxB,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACL;4BACI,IAAI,EAAE,KAAK;4BACX,KAAK,EAAE,KAAK;yBACf;wBACD;4BACI,IAAI,EAAE,aAAa;4BACnB,KAAK,EAAE,YAAY;yBACtB;qBACJ;oBACD,OAAO,EAAE,KAAK;oBACd,WAAW,EAAE,gCAAgC;iBAChD;gBACD;oBACI,WAAW,EAAE,uBAAuB;oBACpC,IAAI,EAAE,yBAAyB;oBAC/B,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,MAAM;oBACf,QAAQ,EAAE,IAAI;oBACd,cAAc,EAAE;wBACZ,IAAI,EAAE;4BACF,gBAAgB,EAAE,CAAC,YAAY,CAAC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;gCACF,KAAK,EAAE,YAAY;gCACnB,OAAO,EAAE,KAAK,CAAC,OAAO;6BACzB;yBACJ,CAAC,CAAC;wBACH,SAAS;oBACb,CAAC;oBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;gBAC/D,CAAC;gBAED,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;AA1ND,4CA0NC"}
         
     | 
| 
         @@ -0,0 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
         
     | 
| 
      
 2 
     | 
    
         
            +
            export declare class PiAPISkyreels implements INodeType {
         
     | 
| 
      
 3 
     | 
    
         
            +
                description: INodeTypeDescription;
         
     | 
| 
      
 4 
     | 
    
         
            +
                execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
         
     | 
| 
      
 5 
     | 
    
         
            +
            }
         
     |