n8n-nodes-sudomock 0.6.0 → 0.8.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 +6 -6
- package/dist/nodes/SudoMock/SudoMock.node.js +115 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -341,11 +341,11 @@ Deletion confirmation
|
|
|
341
341
|
|
|
342
342
|
Create, prepare, render, and manage reusable mockups from product images without a PSD.
|
|
343
343
|
|
|
344
|
-
1. **2D: Create Mockup** accepts a public `source_url` or `source_base64`, plus an optional name.
|
|
345
|
-
2. **2D: Get Mockup** returns `draft`, `ready`, or `failed` status. Poll this operation until the mockup is `ready
|
|
346
|
-
3. **2D: List Mockups** returns your 2D mockups.
|
|
347
|
-
4. **2D: Set Print Areas**
|
|
348
|
-
5. **2D: Render Mockup** accepts the mockup UUID and one or more ready
|
|
344
|
+
1. **2D: Create Mockup** accepts a public `source_url` or `source_base64`, plus an optional name. By default it waits and returns the ready mockup detail unchanged. Enable **Run Asynchronously** to receive a 202 job with `job_id` and `status_url`, then use **Get Job** when needed.
|
|
345
|
+
2. **2D: Get Mockup** returns `draft`, `ready`, or `failed` status. Poll this operation until the mockup is `ready`. The ready response keeps saved areas in `data.quads` (addressed by `print_area_id`) and full surfaces in `data.surfaces` (addressed by `surface_uuid`).
|
|
346
|
+
3. **2D: List Mockups** returns your 2D mockups with limit, offset, and shopper-customizable filtering.
|
|
347
|
+
4. **2D: Set Print Areas** replaces saved areas with quads made from four `[x, y]` coordinate pairs. It can also send an empty list; the API remains authoritative and accepts that only when the mockup can remain renderable without saved areas.
|
|
348
|
+
5. **2D: Render Mockup** accepts the mockup UUID and one or more ready render targets. Each target sends exactly one identifier: `uuid` for a saved area or `surface_uuid` for a full surface. Each target also includes either an artwork URL or Base64 artwork, with optional background removal (adds 25 credits per artwork), color, public adjustments, and placement. Export options support PNG, JPG, or WebP from 100 to 10000 pixels, plus quality and optional DPI. Each render costs 5 credits and returns `print_files`, where `print_files[0]` is the CDN URL.
|
|
349
349
|
6. **2D: Delete Mockup** deletes the selected 2D mockup.
|
|
350
350
|
|
|
351
351
|
Create must reach `ready` through **2D: Get Mockup** before **2D: Render Mockup**.
|
|
@@ -364,7 +364,7 @@ Turn a mockup (or an existing image URL) into a short product video. Always asyn
|
|
|
364
364
|
- **Image URL** (required in Animate Image URL mode): public HTTPS image (`.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`, `.avif`)
|
|
365
365
|
- **Webhook URL** (optional): one-off HTTPS URL notified when this job finishes
|
|
366
366
|
- **Video Options**:
|
|
367
|
-
- **Duration (Seconds)**: clip length (default 4; must be an allowed duration for the chosen model — the default model `veo-3.1-fast` allows 4
|
|
367
|
+
- **Duration (Seconds)**: clip length (default 4; must be an allowed duration for the chosen model — the default model `veo-3.1-fast` allows 4 or 6; max 15)
|
|
368
368
|
- **Audio**: include a generated audio track (default false; may cost extra credits depending on model)
|
|
369
369
|
- **Motion**: `ambient` (default) or `showcase`
|
|
370
370
|
- **Advanced Model**: optional override pinning a roster model (`veo-3.1-fast`, `kling-v3-pro`, `kling-2.6-pro`, `seedance-2.0`, `wan-2.5`); leave empty to auto-pick by plan tier
|
|
@@ -84,7 +84,7 @@ class SudoMock {
|
|
|
84
84
|
{
|
|
85
85
|
name: '2D: Get Mockup',
|
|
86
86
|
value: 'get2DMockup',
|
|
87
|
-
description: 'Get the status and
|
|
87
|
+
description: 'Get the status and addressable render targets of a 2D mockup',
|
|
88
88
|
action: 'Get a 2D mockup',
|
|
89
89
|
},
|
|
90
90
|
{
|
|
@@ -96,7 +96,7 @@ class SudoMock {
|
|
|
96
96
|
{
|
|
97
97
|
name: '2D: Set Print Areas',
|
|
98
98
|
value: 'set2DPrintAreas',
|
|
99
|
-
description: '
|
|
99
|
+
description: 'Replace or clear the saved print area quads for a 2D mockup',
|
|
100
100
|
action: 'Set 2D print areas',
|
|
101
101
|
},
|
|
102
102
|
{
|
|
@@ -353,6 +353,32 @@ class SudoMock {
|
|
|
353
353
|
default: false,
|
|
354
354
|
description: 'Whether to queue creation and return a job_id (kind: 2d_create) immediately',
|
|
355
355
|
},
|
|
356
|
+
{
|
|
357
|
+
displayName: 'Limit',
|
|
358
|
+
name: 'twoDListLimit',
|
|
359
|
+
type: 'number',
|
|
360
|
+
typeOptions: { minValue: 1, maxValue: 100 },
|
|
361
|
+
displayOptions: { show: { operation: ['list2DMockups'] } },
|
|
362
|
+
default: 20,
|
|
363
|
+
description: 'Number of 2D mockups to return from 1 to 100',
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
displayName: 'Offset',
|
|
367
|
+
name: 'twoDListOffset',
|
|
368
|
+
type: 'number',
|
|
369
|
+
typeOptions: { minValue: 0 },
|
|
370
|
+
displayOptions: { show: { operation: ['list2DMockups'] } },
|
|
371
|
+
default: 0,
|
|
372
|
+
description: 'Number of 2D mockups to skip',
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
displayName: 'Customizable Only',
|
|
376
|
+
name: 'twoDListCustomizableOnly',
|
|
377
|
+
type: 'boolean',
|
|
378
|
+
displayOptions: { show: { operation: ['list2DMockups'] } },
|
|
379
|
+
default: false,
|
|
380
|
+
description: 'Whether to return only mockups ready for shopper customization',
|
|
381
|
+
},
|
|
356
382
|
{
|
|
357
383
|
displayName: 'Mockup UUID',
|
|
358
384
|
name: 'twoDMockupUuid',
|
|
@@ -381,7 +407,7 @@ class SudoMock {
|
|
|
381
407
|
},
|
|
382
408
|
default: {},
|
|
383
409
|
placeholder: 'Add Print Area',
|
|
384
|
-
description:
|
|
410
|
+
description: 'Optional during creation. Set Print Areas may send an empty list; the API decides whether the mockup can remain renderable without saved areas.',
|
|
385
411
|
options: [
|
|
386
412
|
{
|
|
387
413
|
name: 'items',
|
|
@@ -456,7 +482,7 @@ class SudoMock {
|
|
|
456
482
|
],
|
|
457
483
|
},
|
|
458
484
|
{
|
|
459
|
-
displayName: '
|
|
485
|
+
displayName: 'Render Targets',
|
|
460
486
|
name: 'twoDRenderPrintAreas',
|
|
461
487
|
type: 'fixedCollection',
|
|
462
488
|
typeOptions: {
|
|
@@ -469,20 +495,57 @@ class SudoMock {
|
|
|
469
495
|
},
|
|
470
496
|
},
|
|
471
497
|
default: {},
|
|
472
|
-
placeholder: 'Add
|
|
473
|
-
description: 'Artwork and options for each saved print area',
|
|
498
|
+
placeholder: 'Add Render Target',
|
|
499
|
+
description: 'Artwork and options for each target. Select exactly one saved print area UUID or full-surface UUID.',
|
|
474
500
|
options: [
|
|
475
501
|
{
|
|
476
502
|
name: 'items',
|
|
477
|
-
displayName: '
|
|
503
|
+
displayName: 'Render Target',
|
|
478
504
|
values: [
|
|
479
505
|
{
|
|
480
|
-
displayName: '
|
|
506
|
+
displayName: 'Target Type',
|
|
507
|
+
name: 'targetType',
|
|
508
|
+
type: 'options',
|
|
509
|
+
options: [
|
|
510
|
+
{
|
|
511
|
+
name: 'Saved Print Area',
|
|
512
|
+
value: 'savedPrintArea',
|
|
513
|
+
description: 'Target a saved print area returned in data.quads',
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
name: 'Full Surface',
|
|
517
|
+
value: 'fullSurface',
|
|
518
|
+
description: 'Target a full surface returned in data.surfaces',
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
default: 'savedPrintArea',
|
|
522
|
+
description: 'Whether this artwork targets a saved area or a full surface',
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
displayName: 'Saved Print Area UUID',
|
|
481
526
|
name: 'uuid',
|
|
482
527
|
type: 'string',
|
|
483
528
|
required: true,
|
|
529
|
+
displayOptions: {
|
|
530
|
+
show: {
|
|
531
|
+
targetType: ['savedPrintArea'],
|
|
532
|
+
},
|
|
533
|
+
},
|
|
484
534
|
default: '',
|
|
485
|
-
description: '
|
|
535
|
+
description: 'The print_area_id returned in data.quads by 2D: Get Mockup',
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
displayName: 'Full-Surface UUID',
|
|
539
|
+
name: 'surfaceUuid',
|
|
540
|
+
type: 'string',
|
|
541
|
+
required: true,
|
|
542
|
+
displayOptions: {
|
|
543
|
+
show: {
|
|
544
|
+
targetType: ['fullSurface'],
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
default: '',
|
|
548
|
+
description: 'The surface_uuid returned in data.surfaces by 2D: Get Mockup',
|
|
486
549
|
},
|
|
487
550
|
{
|
|
488
551
|
displayName: 'Artwork Type',
|
|
@@ -612,30 +675,6 @@ class SudoMock {
|
|
|
612
675
|
default: 'multiply',
|
|
613
676
|
description: 'Artwork blend mode for the product surface',
|
|
614
677
|
},
|
|
615
|
-
{
|
|
616
|
-
displayName: 'Warp Strength',
|
|
617
|
-
name: 'warp_strength',
|
|
618
|
-
type: 'number',
|
|
619
|
-
typeOptions: { minValue: 0, maxValue: 2 },
|
|
620
|
-
default: 1.5,
|
|
621
|
-
description: 'Surface warp strength from 0 to 2',
|
|
622
|
-
},
|
|
623
|
-
{
|
|
624
|
-
displayName: 'Edge Expand',
|
|
625
|
-
name: 'edge_expand',
|
|
626
|
-
type: 'number',
|
|
627
|
-
typeOptions: { minValue: 0, maxValue: 50 },
|
|
628
|
-
default: 0,
|
|
629
|
-
description: 'Artwork edge expansion from 0 to 50',
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
displayName: 'Texture Strength',
|
|
633
|
-
name: 'texture_strength',
|
|
634
|
-
type: 'number',
|
|
635
|
-
typeOptions: { minValue: 0, maxValue: 100 },
|
|
636
|
-
default: 0,
|
|
637
|
-
description: 'Product texture strength from 0 to 100',
|
|
638
|
-
},
|
|
639
678
|
],
|
|
640
679
|
},
|
|
641
680
|
{
|
|
@@ -685,11 +724,20 @@ class SudoMock {
|
|
|
685
724
|
description: 'How the artwork fits within the print area',
|
|
686
725
|
},
|
|
687
726
|
{
|
|
688
|
-
displayName: '
|
|
689
|
-
name: '
|
|
727
|
+
displayName: 'Width',
|
|
728
|
+
name: 'width',
|
|
690
729
|
type: 'number',
|
|
691
|
-
|
|
692
|
-
|
|
730
|
+
typeOptions: { minValue: 1, maxValue: 30000 },
|
|
731
|
+
default: 1000,
|
|
732
|
+
description: 'Artwork width in print-area pixels. Add Height alongside it; the pair overrides Coverage and Fit. Width and Height are independent, so any aspect ratio is allowed.',
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
displayName: 'Height',
|
|
736
|
+
name: 'height',
|
|
737
|
+
type: 'number',
|
|
738
|
+
typeOptions: { minValue: 1, maxValue: 30000 },
|
|
739
|
+
default: 1000,
|
|
740
|
+
description: 'Artwork height in print-area pixels. Add Width alongside it. Adding only one of the two is rejected rather than silently completed, so the aspect ratio is never guessed for you.',
|
|
693
741
|
},
|
|
694
742
|
{
|
|
695
743
|
displayName: 'Rotation',
|
|
@@ -1332,7 +1380,7 @@ class SudoMock {
|
|
|
1332
1380
|
maxValue: 15,
|
|
1333
1381
|
},
|
|
1334
1382
|
default: 4,
|
|
1335
|
-
description: "Length of the clip in seconds. Must be one of the chosen model's allowed durations (the default model veo-3.1-fast allows 4
|
|
1383
|
+
description: "Length of the clip in seconds. Must be one of the chosen model's allowed durations (the default model veo-3.1-fast allows 4 or 6). Longer clips cost more credits.",
|
|
1336
1384
|
},
|
|
1337
1385
|
{
|
|
1338
1386
|
displayName: 'Audio',
|
|
@@ -2078,9 +2126,17 @@ class SudoMock {
|
|
|
2078
2126
|
// 2D: LIST MOCKUPS
|
|
2079
2127
|
// ========================================
|
|
2080
2128
|
else if (operation === 'list2DMockups') {
|
|
2129
|
+
const limit = this.getNodeParameter('twoDListLimit', i, 20);
|
|
2130
|
+
const offset = this.getNodeParameter('twoDListOffset', i, 0);
|
|
2131
|
+
const customizableOnly = this.getNodeParameter('twoDListCustomizableOnly', i, false);
|
|
2081
2132
|
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'sudoMockApi', {
|
|
2082
2133
|
method: 'GET',
|
|
2083
2134
|
url: 'https://api.sudomock.com/api/v1/sudoai/2d-mockups',
|
|
2135
|
+
qs: {
|
|
2136
|
+
limit,
|
|
2137
|
+
offset,
|
|
2138
|
+
customizable_only: customizableOnly,
|
|
2139
|
+
},
|
|
2084
2140
|
json: true,
|
|
2085
2141
|
});
|
|
2086
2142
|
returnData.push({
|
|
@@ -2094,9 +2150,6 @@ class SudoMock {
|
|
|
2094
2150
|
else if (operation === 'set2DPrintAreas') {
|
|
2095
2151
|
const mockupUuid = this.getNodeParameter('twoDMockupUuid', i);
|
|
2096
2152
|
const printAreas = this.getNodeParameter('twoDSetPrintAreas.items', i, []);
|
|
2097
|
-
if (printAreas.length === 0) {
|
|
2098
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Add at least one print area');
|
|
2099
|
-
}
|
|
2100
2153
|
const body = { print_areas: format2DPrintAreas(printAreas) };
|
|
2101
2154
|
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'sudoMockApi', {
|
|
2102
2155
|
method: 'PUT',
|
|
@@ -2116,7 +2169,14 @@ class SudoMock {
|
|
|
2116
2169
|
const mockupUuid = this.getNodeParameter('twoDMockupUuid', i);
|
|
2117
2170
|
const printAreasData = this.getNodeParameter('twoDRenderPrintAreas.items', i, []);
|
|
2118
2171
|
const printAreas = printAreasData.map((area) => {
|
|
2119
|
-
const
|
|
2172
|
+
const targetType = area.targetType ?? 'savedPrintArea';
|
|
2173
|
+
const targetValue = targetType === 'fullSurface' ? area.surfaceUuid : area.uuid;
|
|
2174
|
+
if (!targetValue) {
|
|
2175
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), targetType === 'fullSurface'
|
|
2176
|
+
? 'Full-Surface UUID is required for a full-surface render target'
|
|
2177
|
+
: 'Saved Print Area UUID is required for a saved print-area render target');
|
|
2178
|
+
}
|
|
2179
|
+
const printArea = targetType === 'fullSurface' ? { surface_uuid: targetValue } : { uuid: targetValue };
|
|
2120
2180
|
if (area.artworkSource === 'base64') {
|
|
2121
2181
|
printArea.base64 = area.base64;
|
|
2122
2182
|
}
|
|
@@ -2130,7 +2190,16 @@ class SudoMock {
|
|
|
2130
2190
|
printArea.color = area.color;
|
|
2131
2191
|
}
|
|
2132
2192
|
if (area.adjustments && Object.keys(area.adjustments).length > 0) {
|
|
2133
|
-
|
|
2193
|
+
const { brightness, contrast, opacity, saturation, vibrance, blur, blend_mode } = area.adjustments;
|
|
2194
|
+
printArea.adjustments = Object.fromEntries(Object.entries({
|
|
2195
|
+
brightness,
|
|
2196
|
+
contrast,
|
|
2197
|
+
opacity,
|
|
2198
|
+
saturation,
|
|
2199
|
+
vibrance,
|
|
2200
|
+
blur,
|
|
2201
|
+
blend_mode,
|
|
2202
|
+
}).filter(([, value]) => value !== undefined));
|
|
2134
2203
|
}
|
|
2135
2204
|
if (area.placement && Object.keys(area.placement).length > 0) {
|
|
2136
2205
|
printArea.placement = area.placement;
|
|
@@ -2956,7 +3025,9 @@ class SudoMock {
|
|
|
2956
3025
|
itemIndex: i,
|
|
2957
3026
|
});
|
|
2958
3027
|
}
|
|
2959
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error instanceof Error ? error : new Error('Unknown error'), {
|
|
3028
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error instanceof Error ? error : new Error('Unknown error'), {
|
|
3029
|
+
itemIndex: i,
|
|
3030
|
+
});
|
|
2960
3031
|
}
|
|
2961
3032
|
}
|
|
2962
3033
|
return [returnData];
|