n8n-nodes-sudomock 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -2
- package/dist/nodes/SudoMock/SudoMock.node.js +45 -73
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,11 +31,12 @@ n8n community node for the SudoMock API. Integrate mockup rendering into your n8
|
|
|
31
31
|
|
|
32
32
|
- **Render Mockup**: Generate mockups with artwork, personalized text, or both. Text overrides support styled segments, fonts, size, color, stroke color, and overflow, shrink, or clip fitting. Optionally run asynchronously with the **Run Asynchronously** toggle, which returns a `job_id` to track with **Get Job**.
|
|
33
33
|
- **Render Video**: Turn a mockup (or an existing image URL) into a short product video (always asynchronous). Choose a supported duration, optional audio/motion, an optional one-off webhook, and optionally **Wait for Completion** to return the finished clip.
|
|
34
|
+
- **Remove Background**: Isolate the subject of an image onto a transparent background. The cutout remains stored, and the returned signed PNG URL is valid for 7 days. Costs 25 credits, refunded automatically if processing fails. The same cleanup is available inline on both render operations with the per-artwork **Remove Background** toggle.
|
|
34
35
|
|
|
35
36
|
### Fonts and Order Artwork
|
|
36
37
|
|
|
37
38
|
- **Fonts**: List available fonts, fetch one by UUID, upload a custom TTF or OTF from a public URL, and delete your custom fonts
|
|
38
|
-
- **
|
|
39
|
+
- **Artwork: Delete Stored Files**: Delete stored order artwork by URL or mockup UUID
|
|
39
40
|
|
|
40
41
|
### Async Jobs
|
|
41
42
|
|
|
@@ -238,6 +239,7 @@ Generate a mockup by filling smart objects with your designs.
|
|
|
238
239
|
- Fit Mode: `fill`, `contain`, or `cover` (recommended)
|
|
239
240
|
- **Additional Options** (optional):
|
|
240
241
|
- Rotation: -360 to 360 degrees
|
|
242
|
+
- Remove Background: clean the artwork before placing it (adds 25 credits per artwork)
|
|
241
243
|
- Color Overlay: Hex color code
|
|
242
244
|
- Color Blend Mode: Various blend modes
|
|
243
245
|
- Brightness: -150 to 150
|
|
@@ -284,6 +286,38 @@ Export Options:
|
|
|
284
286
|
|
|
285
287
|
---
|
|
286
288
|
|
|
289
|
+
### Remove Background
|
|
290
|
+
|
|
291
|
+
Isolate the subject of an image onto a transparent background. The cutout remains stored, and the returned signed PNG URL is valid for 7 days.
|
|
292
|
+
|
|
293
|
+
**Parameters:**
|
|
294
|
+
|
|
295
|
+
- **Image URL** (required): public URL of the image to process
|
|
296
|
+
|
|
297
|
+
**Example:**
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
Image URL: https://cdn.example.com/product-photo.jpg
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Output:**
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"success": true,
|
|
308
|
+
"data": {
|
|
309
|
+
"url": "https://cdn.sudomock.com/bg-cutouts/abc123.png",
|
|
310
|
+
"width": 2000,
|
|
311
|
+
"height": 2000,
|
|
312
|
+
"credits_charged": 25
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
The returned signed URL is valid for 7 days and can be fed straight into **Render Mockup** or **2D: Render Mockup** as artwork during that window. The cutout remains stored. Processing costs 25 credits per image and is refunded automatically if it fails. To clean artwork as part of a render instead, use the per-artwork **Remove Background** toggle on either render operation.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
287
321
|
### Delete Mockup
|
|
288
322
|
|
|
289
323
|
Delete a specific mockup template.
|
|
@@ -311,7 +345,7 @@ Create, prepare, render, and manage reusable mockups from product images without
|
|
|
311
345
|
2. **2D: Get Mockup** returns `draft`, `ready`, or `failed` status. Poll this operation until the mockup is `ready`; the ready response includes each print area's UUID and points.
|
|
312
346
|
3. **2D: List Mockups** returns your 2D mockups.
|
|
313
347
|
4. **2D: Set Print Areas** accepts one or more print areas. Each print area is a quad with four `[x, y]` coordinate pairs.
|
|
314
|
-
5. **2D: Render Mockup** accepts the mockup UUID and one or more ready print area UUIDs. Each print area includes either an artwork URL or Base64 artwork, with optional color, adjustments, and placement. Export options support PNG or JPG at 1024, 2048, or 4096 pixels, plus quality and DPI. Each render costs 5 credits and returns `print_files`, where `print_files[0]` is the CDN URL.
|
|
348
|
+
5. **2D: Render Mockup** accepts the mockup UUID and one or more ready print area UUIDs. Each print area includes either an artwork URL or Base64 artwork, with optional background removal (adds 25 credits per artwork), color, adjustments, and placement. Export options support PNG or JPG at 1024, 2048, or 4096 pixels, plus quality and DPI. Each render costs 5 credits and returns `print_files`, where `print_files[0]` is the CDN URL.
|
|
315
349
|
6. **2D: Delete Mockup** deletes the selected 2D mockup.
|
|
316
350
|
|
|
317
351
|
Create must reach `ready` through **2D: Get Mockup** before **2D: Render Mockup**.
|
|
@@ -117,12 +117,6 @@ class SudoMock {
|
|
|
117
117
|
description: 'Delete stored order artwork by URL or mockup UUID',
|
|
118
118
|
action: 'Delete stored artwork',
|
|
119
119
|
},
|
|
120
|
-
{
|
|
121
|
-
name: 'Artwork: Store Files',
|
|
122
|
-
value: 'storeArtworks',
|
|
123
|
-
description: 'Store customer artwork and an optional preview for order fulfillment',
|
|
124
|
-
action: 'Store artwork',
|
|
125
|
-
},
|
|
126
120
|
{
|
|
127
121
|
name: 'Delete Mockup',
|
|
128
122
|
value: 'deleteMockup',
|
|
@@ -183,6 +177,12 @@ class SudoMock {
|
|
|
183
177
|
description: 'List your async render, upload, and video jobs',
|
|
184
178
|
action: 'List jobs',
|
|
185
179
|
},
|
|
180
|
+
{
|
|
181
|
+
name: 'Remove Background',
|
|
182
|
+
value: 'removeBackground',
|
|
183
|
+
description: 'Remove the background from an image and get a transparent-PNG cutout through a signed URL valid for 7 days. The cutout remains stored. Costs 25 credits; auto-refunded on failure.',
|
|
184
|
+
action: 'Remove an image background',
|
|
185
|
+
},
|
|
186
186
|
{
|
|
187
187
|
name: 'Render Mockup',
|
|
188
188
|
value: 'render',
|
|
@@ -530,6 +530,13 @@ class SudoMock {
|
|
|
530
530
|
default: '',
|
|
531
531
|
description: 'Base64 artwork data for this print area',
|
|
532
532
|
},
|
|
533
|
+
{
|
|
534
|
+
displayName: 'Remove Background',
|
|
535
|
+
name: 'removeBackground',
|
|
536
|
+
type: 'boolean',
|
|
537
|
+
default: false,
|
|
538
|
+
description: 'Whether to remove the artwork background before placing it. Adds 25 credits per artwork.',
|
|
539
|
+
},
|
|
533
540
|
{
|
|
534
541
|
displayName: 'Color',
|
|
535
542
|
name: 'color',
|
|
@@ -965,6 +972,13 @@ class SudoMock {
|
|
|
965
972
|
default: 0,
|
|
966
973
|
description: 'Custom position left offset in pixels',
|
|
967
974
|
},
|
|
975
|
+
{
|
|
976
|
+
displayName: 'Remove Background',
|
|
977
|
+
name: 'removeBackground',
|
|
978
|
+
type: 'boolean',
|
|
979
|
+
default: false,
|
|
980
|
+
description: 'Whether to remove the artwork background before placing it. Adds 25 credits per artwork.',
|
|
981
|
+
},
|
|
968
982
|
{
|
|
969
983
|
displayName: 'Color Overlay (Hex)',
|
|
970
984
|
name: 'colorHex',
|
|
@@ -1564,58 +1578,21 @@ class SudoMock {
|
|
|
1564
1578
|
],
|
|
1565
1579
|
},
|
|
1566
1580
|
// ============================================
|
|
1567
|
-
//
|
|
1581
|
+
// BACKGROUND REMOVAL PARAMETERS
|
|
1568
1582
|
// ============================================
|
|
1569
1583
|
{
|
|
1570
|
-
displayName: '
|
|
1571
|
-
name: '
|
|
1584
|
+
displayName: 'Image URL',
|
|
1585
|
+
name: 'removeBackgroundImageUrl',
|
|
1572
1586
|
type: 'string',
|
|
1573
1587
|
required: true,
|
|
1574
|
-
displayOptions: { show: { operation: ['
|
|
1588
|
+
displayOptions: { show: { operation: ['removeBackground'] } },
|
|
1575
1589
|
default: '',
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
{
|
|
1579
|
-
displayName: 'Artwork Items',
|
|
1580
|
-
name: 'artworkItems',
|
|
1581
|
-
type: 'fixedCollection',
|
|
1582
|
-
typeOptions: { multipleValues: true },
|
|
1583
|
-
displayOptions: { show: { operation: ['storeArtworks'] } },
|
|
1584
|
-
default: {},
|
|
1585
|
-
placeholder: 'Add Artwork',
|
|
1586
|
-
description: 'Up to 10 artwork files to keep for order fulfillment',
|
|
1587
|
-
options: [
|
|
1588
|
-
{
|
|
1589
|
-
name: 'items',
|
|
1590
|
-
displayName: 'Artwork',
|
|
1591
|
-
values: [
|
|
1592
|
-
{
|
|
1593
|
-
displayName: 'Smart Object UUID',
|
|
1594
|
-
name: 'smartObjectUuid',
|
|
1595
|
-
type: 'string',
|
|
1596
|
-
required: true,
|
|
1597
|
-
default: '',
|
|
1598
|
-
},
|
|
1599
|
-
{
|
|
1600
|
-
displayName: 'Base64 Artwork',
|
|
1601
|
-
name: 'base64',
|
|
1602
|
-
type: 'string',
|
|
1603
|
-
required: true,
|
|
1604
|
-
default: '',
|
|
1605
|
-
description: 'Raw base64 image bytes without a data URL prefix',
|
|
1606
|
-
},
|
|
1607
|
-
],
|
|
1608
|
-
},
|
|
1609
|
-
],
|
|
1610
|
-
},
|
|
1611
|
-
{
|
|
1612
|
-
displayName: 'Preview URL',
|
|
1613
|
-
name: 'artworkPreviewUrl',
|
|
1614
|
-
type: 'string',
|
|
1615
|
-
displayOptions: { show: { operation: ['storeArtworks'] } },
|
|
1616
|
-
default: '',
|
|
1617
|
-
description: 'Optional render URL to keep with the order',
|
|
1590
|
+
placeholder: 'https://cdn.example.com/product-photo.jpg',
|
|
1591
|
+
description: 'Public URL of the image to isolate onto a transparent background',
|
|
1618
1592
|
},
|
|
1593
|
+
// ============================================
|
|
1594
|
+
// ARTWORK PARAMETERS
|
|
1595
|
+
// ============================================
|
|
1619
1596
|
{
|
|
1620
1597
|
displayName: 'Delete By',
|
|
1621
1598
|
name: 'artworkDeleteMode',
|
|
@@ -2146,6 +2123,9 @@ class SudoMock {
|
|
|
2146
2123
|
else {
|
|
2147
2124
|
printArea.artwork_url = area.artworkUrl;
|
|
2148
2125
|
}
|
|
2126
|
+
if (area.removeBackground) {
|
|
2127
|
+
printArea.remove_background = true;
|
|
2128
|
+
}
|
|
2149
2129
|
if (area.color) {
|
|
2150
2130
|
printArea.color = area.color;
|
|
2151
2131
|
}
|
|
@@ -2269,30 +2249,15 @@ class SudoMock {
|
|
|
2269
2249
|
});
|
|
2270
2250
|
}
|
|
2271
2251
|
// ========================================
|
|
2272
|
-
//
|
|
2252
|
+
// BACKGROUND REMOVAL
|
|
2273
2253
|
// ========================================
|
|
2274
|
-
else if (operation === '
|
|
2275
|
-
const items = this.getNodeParameter('artworkItems.items', i, []);
|
|
2276
|
-
const previewUrl = this.getNodeParameter('artworkPreviewUrl', i, '');
|
|
2277
|
-
if (items.length === 0 && !previewUrl) {
|
|
2278
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Add at least one artwork item or a preview URL');
|
|
2279
|
-
}
|
|
2280
|
-
if (items.length > 10) {
|
|
2281
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Artwork Items supports up to 10 files');
|
|
2282
|
-
}
|
|
2283
|
-
const body = {
|
|
2284
|
-
mockup_uuid: this.getNodeParameter('artworkMockupUuid', i),
|
|
2285
|
-
items: items.map((item) => ({
|
|
2286
|
-
smart_object_uuid: item.smartObjectUuid,
|
|
2287
|
-
base64: item.base64,
|
|
2288
|
-
})),
|
|
2289
|
-
};
|
|
2290
|
-
if (previewUrl)
|
|
2291
|
-
body.preview_url = previewUrl;
|
|
2254
|
+
else if (operation === 'removeBackground') {
|
|
2292
2255
|
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'sudoMockApi', {
|
|
2293
2256
|
method: 'POST',
|
|
2294
|
-
url: 'https://api.sudomock.com/api/v1/
|
|
2295
|
-
body
|
|
2257
|
+
url: 'https://api.sudomock.com/api/v1/remove-background',
|
|
2258
|
+
body: {
|
|
2259
|
+
url: this.getNodeParameter('removeBackgroundImageUrl', i),
|
|
2260
|
+
},
|
|
2296
2261
|
json: true,
|
|
2297
2262
|
});
|
|
2298
2263
|
returnData.push({
|
|
@@ -2300,6 +2265,9 @@ class SudoMock {
|
|
|
2300
2265
|
pairedItem: { item: i },
|
|
2301
2266
|
});
|
|
2302
2267
|
}
|
|
2268
|
+
// ========================================
|
|
2269
|
+
// ARTWORKS
|
|
2270
|
+
// ========================================
|
|
2303
2271
|
else if (operation === 'deleteArtworks') {
|
|
2304
2272
|
const mode = this.getNodeParameter('artworkDeleteMode', i);
|
|
2305
2273
|
const body = {};
|
|
@@ -2356,6 +2324,10 @@ class SudoMock {
|
|
|
2356
2324
|
asset.content_type = opts.contentType;
|
|
2357
2325
|
}
|
|
2358
2326
|
}
|
|
2327
|
+
// Background removal surcharge, billed per unique artwork source
|
|
2328
|
+
if (opts.removeBackground) {
|
|
2329
|
+
asset.remove_background = true;
|
|
2330
|
+
}
|
|
2359
2331
|
// Custom size override
|
|
2360
2332
|
const size = {};
|
|
2361
2333
|
if (opts.sizeWidth !== undefined && opts.sizeWidth > 0) {
|