n8n-nodes-labelzoom 1.1.0 → 1.2.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 +34 -3
- package/dist/nodes/LabelZoom/resources/printer/print.js +4 -0
- package/dist/nodes/LabelZoom/resources/printer/print.js.map +1 -1
- package/dist/nodes/LabelZoom/resources/printer/printTemplate.js +8 -1
- package/dist/nodes/LabelZoom/resources/printer/printTemplate.js.map +1 -1
- package/dist/nodes/LabelZoom/resources/printer/shared.d.ts +4 -1
- package/dist/nodes/LabelZoom/resources/printer/shared.js +35 -2
- package/dist/nodes/LabelZoom/resources/printer/shared.js.map +1 -1
- package/dist/package.json +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,7 +13,11 @@ into two steps in a workflow.
|
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
The node is [verified by n8n](https://n8n.io/integrations/labelzoom/), so it installs straight
|
|
17
|
+
from the canvas: open the nodes panel, search for **LabelZoom**, and pick it from **More from the
|
|
18
|
+
community**.
|
|
19
|
+
|
|
20
|
+
To install it by package name instead, go to **Settings → Community nodes → Install** and enter:
|
|
17
21
|
|
|
18
22
|
```
|
|
19
23
|
n8n-nodes-labelzoom
|
|
@@ -65,7 +69,7 @@ inline raw bytes (EPL's `GW`, IPL's `STX`/`ETX` framing, TSPL's `BITMAP`, DPL's
|
|
|
65
69
|
SBPL's `ESC`-prefixed commands), and decoding them to a string would corrupt any label carrying
|
|
66
70
|
graphics.
|
|
67
71
|
|
|
68
|
-
Options cover the full parameter set — DPI, rotation, scaling,
|
|
72
|
+
Options cover the full parameter set — DPI, rotation, scaling, color mode, darkness, label
|
|
69
73
|
size in inches, position, PDF conversion mode and page number, ZPL image compression and
|
|
70
74
|
commands to ignore, and a **Variable Data** field that fills placeholders on the label (one
|
|
71
75
|
output label per array entry). Anything not yet surfaced in the UI can go through **Custom
|
|
@@ -92,10 +96,31 @@ transform option from Convert works here too, even when no format change is need
|
|
|
92
96
|
once the print agent reports back. Turn on **Wait for Completion** when the workflow needs to
|
|
93
97
|
know the label came out of the printer.
|
|
94
98
|
|
|
99
|
+
**Copies.** Print and Print Template both take **Copies**: how many times the job is sent to the
|
|
100
|
+
printer, from 1 to 9999, for any document in any printer language. **A print quantity already in
|
|
101
|
+
the label or template multiplies** — a label carrying `^PQ3` sent with Copies set to 5 prints 15.
|
|
102
|
+
A document holding several labels prints collated (A, B, A, B), all as a single job, and the job in
|
|
103
|
+
the output reports the `copies` it was accepted with (`null` when Copies was left at 1). Leave
|
|
104
|
+
Copies at the default of 1 and nothing is sent: the document prints once, as sent, exactly as
|
|
105
|
+
before. Map it from the incoming item to print a per-order quantity:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
{{ $json.quantity }}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
A number that arrives as text, such as `"25"` from a CSV or spreadsheet, is accepted. Anything
|
|
112
|
+
that isn't a whole number from 1 to 9999 fails the item before a request is made. Copies above 1
|
|
113
|
+
needs an up-to-date LabelZoom Print Agent: if the agent serving the printer is out of date, the
|
|
114
|
+
job is rejected with a 422 asking you to update it, rather than printed a different number of
|
|
115
|
+
times. For a large run of a complex label, the printer language's own quantity command inside the
|
|
116
|
+
label (`^PQ` in ZPL, for example) prints faster than sending the whole job again and again.
|
|
117
|
+
|
|
95
118
|
**Idempotency.** Print carries an `Idempotency-Key`; repeating a key returns the original job
|
|
96
119
|
instead of printing again. It defaults to `{{ $execution.id }}-{{ $itemIndex }}`, which makes a
|
|
97
120
|
retried *step* safe. Set it from an order number to make a whole workflow re-run safe too — a
|
|
98
|
-
duplicate shipping label is a real cost.
|
|
121
|
+
duplicate shipping label is a real cost. A key identifies the whole request, Copies included:
|
|
122
|
+
repeating it with a different document, merge data or Copies is rejected with a 422 instead of
|
|
123
|
+
replaying the original job, so give a deliberate reprint a key of its own.
|
|
99
124
|
|
|
100
125
|
## Examples
|
|
101
126
|
|
|
@@ -112,6 +137,11 @@ Variable Data mapped from the rows) → Google Drive. Each row becomes one page.
|
|
|
112
137
|
Printer → Print Template with the merge fields mapped from the incoming item. The template
|
|
113
138
|
picker shows each template's merge fields, so you can see what data it wants.
|
|
114
139
|
|
|
140
|
+
**One label per unit.** An order-line trigger (or a spreadsheet of SKUs) → LabelZoom (Printer →
|
|
141
|
+
Print Template, merge fields mapped from the line, **Copies** set to `{{ $json.quantity }}`). A
|
|
142
|
+
line for 12 units sends its label to the printer 12 times as one job. Design the template to
|
|
143
|
+
print a single label: a quantity built into the template multiplies with Copies.
|
|
144
|
+
|
|
115
145
|
## Development
|
|
116
146
|
|
|
117
147
|
```sh
|
|
@@ -149,6 +179,7 @@ claim to be LabelZoom Studio, whose prefix the server special-cases — is asser
|
|
|
149
179
|
|
|
150
180
|
## Resources
|
|
151
181
|
|
|
182
|
+
- [LabelZoom on n8n.io](https://n8n.io/integrations/labelzoom/) — the verified integration listing
|
|
152
183
|
- [n8n integration guide](https://docs.labelzoom.com/integrations/n8n/) — this node, end to end
|
|
153
184
|
- [LabelZoom API docs](https://docs.labelzoom.com)
|
|
154
185
|
- [Conversion parameters](https://docs.labelzoom.com/reference/conversion-parameters/)
|
|
@@ -37,6 +37,7 @@ exports.printDescription = [
|
|
|
37
37
|
displayOptions: { show: showFor },
|
|
38
38
|
},
|
|
39
39
|
...(0, descriptions_1.documentInputFields)(showFor),
|
|
40
|
+
(0, shared_1.copiesField)(showFor),
|
|
40
41
|
(0, shared_1.idempotencyKeyField)(showFor),
|
|
41
42
|
{
|
|
42
43
|
displayName: 'Wait for Completion',
|
|
@@ -73,6 +74,7 @@ async function waitForJob(jobId, timeoutSeconds, itemIndex) {
|
|
|
73
74
|
}
|
|
74
75
|
async function print(itemIndex) {
|
|
75
76
|
const printerId = utils_1.resourceId.call(this, 'printerId', itemIndex);
|
|
77
|
+
const copies = shared_1.readCopies.call(this, itemIndex);
|
|
76
78
|
const sourceFormat = this.getNodeParameter('sourceFormat', itemIndex, '');
|
|
77
79
|
const idempotencyKey = this.getNodeParameter('idempotencyKey', itemIndex, '');
|
|
78
80
|
const waitForCompletion = this.getNodeParameter('waitForCompletion', itemIndex, false);
|
|
@@ -82,6 +84,8 @@ async function print(itemIndex) {
|
|
|
82
84
|
const query = {};
|
|
83
85
|
if (sourceFormat !== '')
|
|
84
86
|
query.sourceFormat = sourceFormat;
|
|
87
|
+
if (copies !== 1)
|
|
88
|
+
query.copies = String(copies);
|
|
85
89
|
const headers = {};
|
|
86
90
|
if (idempotencyKey !== '')
|
|
87
91
|
headers['Idempotency-Key'] = idempotencyKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print.js","sourceRoot":"","sources":["../../../../../nodes/LabelZoom/resources/printer/print.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"print.js","sourceRoot":"","sources":["../../../../../nodes/LabelZoom/resources/printer/print.ts"],"names":[],"mappings":";;;AA4GA,sBAuEC;AA5KD,+CAAyD;AAEzD,4DAAwF;AACxF,kDAAuG;AAEvG,kDAAiE;AACjE,sDAA6F;AAC7F,8CAA8D;AAC9D,qCAMkB;AAElB,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;AAEhE,SAAS,kBAAkB,CAAC,SAAiB,EAAE,YAAoB;IAClE,IAAI,SAAS,KAAK,QAAQ;QAAE,OAAO,YAAY,CAAC;IAChD,IAAI,YAAY,KAAK,EAAE;QAAE,OAAO,0BAA0B,CAAC;IAC3D,OAAO,IAAA,yBAAe,EAAC,IAAA,yBAAe,EAAC,YAAY,CAAC,CAAC,CAAC;AACvD,CAAC;AAEY,QAAA,gBAAgB,GAAsB;IAClD,IAAA,uBAAc,EAAC,OAAO,CAAC;IACvB;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QAC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CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EACpE,EAAE,SAAS,EAAE,CACb,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAgB;QACzB,GAAG,GAAG;QACN,SAAS;QACT,SAAS,EAAE,IAAA,uBAAW,EAAC,QAAQ,CAAC;KAChC,CAAC;IAEF,IAAI,iBAAiB,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxD,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,SAAS,EAAE,GAAG,CAAW,CAAC;QAC/E,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QAC5E,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -27,11 +27,13 @@ exports.printTemplateDescription = [
|
|
|
27
27
|
description: 'Whether to reject the job when a required merge field is missing, instead of printing a label with a blank in it',
|
|
28
28
|
displayOptions: { show: showFor },
|
|
29
29
|
},
|
|
30
|
+
(0, shared_1.copiesField)(showFor),
|
|
30
31
|
(0, shared_1.idempotencyKeyField)(showFor),
|
|
31
32
|
];
|
|
32
33
|
async function printTemplate(itemIndex) {
|
|
33
34
|
const printerId = utils_1.resourceId.call(this, 'printerId', itemIndex);
|
|
34
35
|
const templateId = utils_1.resourceId.call(this, 'templateId', itemIndex);
|
|
36
|
+
const copies = shared_1.readCopies.call(this, itemIndex);
|
|
35
37
|
const validate = this.getNodeParameter('validate', itemIndex, true);
|
|
36
38
|
const idempotencyKey = this.getNodeParameter('idempotencyKey', itemIndex, '');
|
|
37
39
|
const rawMergeData = this.getNodeParameter('mergeData', itemIndex, '{}');
|
|
@@ -53,10 +55,15 @@ async function printTemplate(itemIndex) {
|
|
|
53
55
|
description: 'Send one item per label — this operation runs once per input item and each run produces one print job.',
|
|
54
56
|
});
|
|
55
57
|
}
|
|
58
|
+
const query = {};
|
|
59
|
+
if (validate)
|
|
60
|
+
query.validate = 'true';
|
|
61
|
+
if (copies !== 1)
|
|
62
|
+
query.copies = String(copies);
|
|
56
63
|
const headers = {};
|
|
57
64
|
if (idempotencyKey !== '')
|
|
58
65
|
headers['Idempotency-Key'] = idempotencyKey;
|
|
59
|
-
const job = await transport_1.labelZoomJsonRequest.call(this, 'POST', `/api/v3/printers/${encodeURIComponent(printerId)}/templates/${encodeURIComponent(templateId)}/print`, mergeData,
|
|
66
|
+
const job = await transport_1.labelZoomJsonRequest.call(this, 'POST', `/api/v3/printers/${encodeURIComponent(printerId)}/templates/${encodeURIComponent(templateId)}/print`, mergeData, Object.keys(query).length > 0 ? query : undefined, headers);
|
|
60
67
|
return {
|
|
61
68
|
json: { ...job, printerId, templateId },
|
|
62
69
|
pairedItem: { item: itemIndex },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printTemplate.js","sourceRoot":"","sources":["../../../../../nodes/LabelZoom/resources/printer/printTemplate.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"printTemplate.js","sourceRoot":"","sources":["../../../../../nodes/LabelZoom/resources/printer/printTemplate.ts"],"names":[],"mappings":";;;AAyCA,sCAgEC;AAxGD,+CAAkD;AAElD,sDAA8D;AAC9D,8CAAgD;AAChD,qCAMkB;AAElB,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;AAE3D,QAAA,wBAAwB,GAAsB;IAC1D,IAAA,uBAAc,EAAC,OAAO,CAAC;IACvB,I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@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { INodeProperties } from 'n8n-workflow';
|
|
1
|
+
import type { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
type ShowFor = {
|
|
3
3
|
resource: string[];
|
|
4
4
|
operation: string[];
|
|
@@ -6,5 +6,8 @@ type ShowFor = {
|
|
|
6
6
|
export declare function printerLocator(showFor: ShowFor): INodeProperties;
|
|
7
7
|
export declare function templateLocator(showFor: ShowFor): INodeProperties;
|
|
8
8
|
export declare function idempotencyKeyField(showFor: ShowFor): INodeProperties;
|
|
9
|
+
export declare const MAX_COPIES = 9999;
|
|
10
|
+
export declare function copiesField(showFor: ShowFor): INodeProperties;
|
|
11
|
+
export declare function readCopies(this: IExecuteFunctions, itemIndex: number): number;
|
|
9
12
|
export declare const TERMINAL_JOB_STATUSES: readonly ["completed", "failed"];
|
|
10
13
|
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TERMINAL_JOB_STATUSES = void 0;
|
|
3
|
+
exports.TERMINAL_JOB_STATUSES = exports.MAX_COPIES = void 0;
|
|
4
4
|
exports.printerLocator = printerLocator;
|
|
5
5
|
exports.templateLocator = templateLocator;
|
|
6
6
|
exports.idempotencyKeyField = idempotencyKeyField;
|
|
7
|
+
exports.copiesField = copiesField;
|
|
8
|
+
exports.readCopies = readCopies;
|
|
9
|
+
const validation_1 = require("../../shared/validation");
|
|
7
10
|
function printerLocator(showFor) {
|
|
8
11
|
return {
|
|
9
12
|
displayName: 'Printer',
|
|
@@ -60,9 +63,39 @@ function idempotencyKeyField(showFor) {
|
|
|
60
63
|
name: 'idempotencyKey',
|
|
61
64
|
type: 'string',
|
|
62
65
|
default: '={{ $execution.id }}-{{ $itemIndex }}',
|
|
63
|
-
description: 'Repeating a key returns the original job instead of printing again. Set it from a stable business value (an order number) to make a whole workflow re-run safe.',
|
|
66
|
+
description: 'Repeating a key with the same request returns the original job instead of printing again; reusing it for a different document, merge data or Copies is rejected. Set it from a stable business value (an order number) to make a whole workflow re-run safe.',
|
|
64
67
|
displayOptions: { show: showFor },
|
|
65
68
|
};
|
|
66
69
|
}
|
|
70
|
+
exports.MAX_COPIES = 9999;
|
|
71
|
+
function copiesField(showFor) {
|
|
72
|
+
return {
|
|
73
|
+
displayName: 'Copies',
|
|
74
|
+
name: 'copies',
|
|
75
|
+
type: 'number',
|
|
76
|
+
typeOptions: { minValue: 1, maxValue: exports.MAX_COPIES, numberPrecision: 0 },
|
|
77
|
+
default: 1,
|
|
78
|
+
description: "How many times to send the job to the printer, from 1 to 9999. A quantity already set in the document or template multiplies: a label carrying ^PQ3 with Copies set to 5 prints 15. Leave it at 1 to print it once, as sent.",
|
|
79
|
+
displayOptions: { show: showFor },
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function readCopies(itemIndex) {
|
|
83
|
+
const raw = this.getNodeParameter('copies', itemIndex, 1);
|
|
84
|
+
let copies = Number.NaN;
|
|
85
|
+
if (typeof raw === 'number') {
|
|
86
|
+
copies = raw;
|
|
87
|
+
}
|
|
88
|
+
else if (typeof raw === 'string' && /^\d+$/.test(raw.trim())) {
|
|
89
|
+
copies = Number(raw.trim());
|
|
90
|
+
}
|
|
91
|
+
if (!Number.isInteger(copies) || copies < 1 || copies > exports.MAX_COPIES) {
|
|
92
|
+
const received = typeof raw === 'number' ? String(raw) : JSON.stringify(raw);
|
|
93
|
+
throw new validation_1.LabelZoomValidationError(this.getNode(), 'copies', `Copies must be a whole number from 1 to ${exports.MAX_COPIES}, got ${received}`, {
|
|
94
|
+
itemIndex,
|
|
95
|
+
description: "Set Copies to how many times the job should be sent to the printer, or leave it at 1 to print it once, as sent.",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return copies;
|
|
99
|
+
}
|
|
67
100
|
exports.TERMINAL_JOB_STATUSES = ['completed', 'failed'];
|
|
68
101
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../nodes/LabelZoom/resources/printer/shared.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../nodes/LabelZoom/resources/printer/shared.ts"],"names":[],"mappings":";;;AAYA,wCAwBC;AAED,0CAwBC;AAWD,kDAUC;AAcD,kCAWC;AAWD,gCAyBC;AA9ID,wDAAmE;AAUnE,SAAgB,cAAc,CAAC,OAAgB;IAC9C,OAAO;QACN,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QACpC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,gDAAgD;QAC7D,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACjC,KAAK,EAAE;YACN;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE;aAClE;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,cAAc;aAC3B;SACD;KACD,CAAC;AACH,CAAC;AAED,SAAgB,eAAe,CAAC,OAAgB;IAC/C,OAAO;QACN,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QACpC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,kDAAkD;QAC/D,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACjC,KAAK,EAAE;YACN;gBACC,W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,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAChE,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,kBAAU,EAAE,CAAC;QACpE,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC7E,MAAM,IAAI,qCAAwB,CACjC,IAAI,CAAC,OAAO,EAAE,EACd,QAAQ,EACR,2CAA2C,kBAAU,SAAS,QAAQ,EAAE,EACxE;YACC,SAAS;YACT,WAAW,EACV,iHAAiH;SAClH,CACD,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAGY,QAAA,qBAAqB,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAU,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-labelzoom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "n8n community node for LabelZoom \u2014 convert barcode labels between ZPL, EPL, TSPL, DPL, PDF and images, and print them to cloud-connected thermal printers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.labelzoom.com",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
]
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@n8n/node-cli": "^0.
|
|
60
|
+
"@n8n/node-cli": "^0.50.2",
|
|
61
61
|
"@types/node": "^22.15.0",
|
|
62
62
|
"eslint": "9.39.4",
|
|
63
|
-
"prettier": "3.9.
|
|
63
|
+
"prettier": "3.9.9",
|
|
64
64
|
"typescript": "6.0.3",
|
|
65
65
|
"vitest": "^5.0.0"
|
|
66
66
|
},
|