n8n-nodes-sudomock 0.6.0 → 0.7.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 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. Creation is asynchronous and returns the 202 response with `mockup_uuid`, `status_url`, and job details unchanged. Use the job ID with **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 includes each print area's UUID and points.
346
- 3. **2D: List Mockups** returns your 2D mockups.
347
- 4. **2D: Set Print Areas** accepts one or more print areas. Each print area is a quad with four `[x, y]` coordinate pairs.
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.
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, 6, or 8; max 15)
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 print areas of a 2D mockup',
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: 'Define print area quads for a 2D mockup',
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: "Optional during creation; required when replacing a mockup's print areas",
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: 'Print Areas',
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 Print Area',
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: 'Print Area',
503
+ displayName: 'Render Target',
478
504
  values: [
479
505
  {
480
- displayName: 'Print Area UUID',
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
+ },
534
+ default: '',
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
+ },
484
547
  default: '',
485
- description: 'UUID returned by 2D: Get Mockup when status is ready',
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
  {
@@ -1332,7 +1371,7 @@ class SudoMock {
1332
1371
  maxValue: 15,
1333
1372
  },
1334
1373
  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, 6, or 8). Longer clips cost more credits.",
1374
+ 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
1375
  },
1337
1376
  {
1338
1377
  displayName: 'Audio',
@@ -2078,9 +2117,17 @@ class SudoMock {
2078
2117
  // 2D: LIST MOCKUPS
2079
2118
  // ========================================
2080
2119
  else if (operation === 'list2DMockups') {
2120
+ const limit = this.getNodeParameter('twoDListLimit', i, 20);
2121
+ const offset = this.getNodeParameter('twoDListOffset', i, 0);
2122
+ const customizableOnly = this.getNodeParameter('twoDListCustomizableOnly', i, false);
2081
2123
  const response = await this.helpers.httpRequestWithAuthentication.call(this, 'sudoMockApi', {
2082
2124
  method: 'GET',
2083
2125
  url: 'https://api.sudomock.com/api/v1/sudoai/2d-mockups',
2126
+ qs: {
2127
+ limit,
2128
+ offset,
2129
+ customizable_only: customizableOnly,
2130
+ },
2084
2131
  json: true,
2085
2132
  });
2086
2133
  returnData.push({
@@ -2094,9 +2141,6 @@ class SudoMock {
2094
2141
  else if (operation === 'set2DPrintAreas') {
2095
2142
  const mockupUuid = this.getNodeParameter('twoDMockupUuid', i);
2096
2143
  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
2144
  const body = { print_areas: format2DPrintAreas(printAreas) };
2101
2145
  const response = await this.helpers.httpRequestWithAuthentication.call(this, 'sudoMockApi', {
2102
2146
  method: 'PUT',
@@ -2116,7 +2160,14 @@ class SudoMock {
2116
2160
  const mockupUuid = this.getNodeParameter('twoDMockupUuid', i);
2117
2161
  const printAreasData = this.getNodeParameter('twoDRenderPrintAreas.items', i, []);
2118
2162
  const printAreas = printAreasData.map((area) => {
2119
- const printArea = { uuid: area.uuid };
2163
+ const targetType = area.targetType ?? 'savedPrintArea';
2164
+ const targetValue = targetType === 'fullSurface' ? area.surfaceUuid : area.uuid;
2165
+ if (!targetValue) {
2166
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), targetType === 'fullSurface'
2167
+ ? 'Full-Surface UUID is required for a full-surface render target'
2168
+ : 'Saved Print Area UUID is required for a saved print-area render target');
2169
+ }
2170
+ const printArea = targetType === 'fullSurface' ? { surface_uuid: targetValue } : { uuid: targetValue };
2120
2171
  if (area.artworkSource === 'base64') {
2121
2172
  printArea.base64 = area.base64;
2122
2173
  }
@@ -2130,7 +2181,16 @@ class SudoMock {
2130
2181
  printArea.color = area.color;
2131
2182
  }
2132
2183
  if (area.adjustments && Object.keys(area.adjustments).length > 0) {
2133
- printArea.adjustments = area.adjustments;
2184
+ const { brightness, contrast, opacity, saturation, vibrance, blur, blend_mode } = area.adjustments;
2185
+ printArea.adjustments = Object.fromEntries(Object.entries({
2186
+ brightness,
2187
+ contrast,
2188
+ opacity,
2189
+ saturation,
2190
+ vibrance,
2191
+ blur,
2192
+ blend_mode,
2193
+ }).filter(([, value]) => value !== undefined));
2134
2194
  }
2135
2195
  if (area.placement && Object.keys(area.placement).length > 0) {
2136
2196
  printArea.placement = area.placement;
@@ -2956,7 +3016,9 @@ class SudoMock {
2956
3016
  itemIndex: i,
2957
3017
  });
2958
3018
  }
2959
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), error instanceof Error ? error : new Error('Unknown error'), { itemIndex: i });
3019
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error instanceof Error ? error : new Error('Unknown error'), {
3020
+ itemIndex: i,
3021
+ });
2960
3022
  }
2961
3023
  }
2962
3024
  return [returnData];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-sudomock",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "n8n community node for SudoMock mockup rendering API - POD automation",
5
5
  "license": "MIT",
6
6
  "homepage": "https://sudomock.com",