n8n-nodes-labelzoom 0.0.1
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/LICENSE +21 -0
- package/README.md +158 -0
- package/dist/credentials/LabelZoomApi.credentials.d.ts +10 -0
- package/dist/credentials/LabelZoomApi.credentials.js +54 -0
- package/dist/credentials/LabelZoomApi.credentials.js.map +1 -0
- package/dist/icons/labelzoom.dark.svg +1 -0
- package/dist/icons/labelzoom.svg +1 -0
- package/dist/nodes/LabelZoom/LabelZoom.node.d.ts +13 -0
- package/dist/nodes/LabelZoom/LabelZoom.node.js +118 -0
- package/dist/nodes/LabelZoom/LabelZoom.node.js.map +1 -0
- package/dist/nodes/LabelZoom/LabelZoom.node.json +12 -0
- package/dist/nodes/LabelZoom/listSearch/getPrinters.d.ts +2 -0
- package/dist/nodes/LabelZoom/listSearch/getPrinters.js +24 -0
- package/dist/nodes/LabelZoom/listSearch/getPrinters.js.map +1 -0
- package/dist/nodes/LabelZoom/listSearch/getTemplates.d.ts +2 -0
- package/dist/nodes/LabelZoom/listSearch/getTemplates.js +25 -0
- package/dist/nodes/LabelZoom/listSearch/getTemplates.js.map +1 -0
- package/dist/nodes/LabelZoom/resources/label/convert.d.ts +3 -0
- package/dist/nodes/LabelZoom/resources/label/convert.js +79 -0
- package/dist/nodes/LabelZoom/resources/label/convert.js.map +1 -0
- package/dist/nodes/LabelZoom/resources/label/convertTemplate.d.ts +3 -0
- package/dist/nodes/LabelZoom/resources/label/convertTemplate.js +95 -0
- package/dist/nodes/LabelZoom/resources/label/convertTemplate.js.map +1 -0
- package/dist/nodes/LabelZoom/resources/label/index.d.ts +4 -0
- package/dist/nodes/LabelZoom/resources/label/index.js +36 -0
- package/dist/nodes/LabelZoom/resources/label/index.js.map +1 -0
- package/dist/nodes/LabelZoom/resources/printer/index.d.ts +5 -0
- package/dist/nodes/LabelZoom/resources/printer/index.js +60 -0
- package/dist/nodes/LabelZoom/resources/printer/index.js.map +1 -0
- package/dist/nodes/LabelZoom/resources/printer/print.d.ts +3 -0
- package/dist/nodes/LabelZoom/resources/printer/print.js +117 -0
- package/dist/nodes/LabelZoom/resources/printer/print.js.map +1 -0
- package/dist/nodes/LabelZoom/resources/printer/printTemplate.d.ts +3 -0
- package/dist/nodes/LabelZoom/resources/printer/printTemplate.js +65 -0
- package/dist/nodes/LabelZoom/resources/printer/printTemplate.js.map +1 -0
- package/dist/nodes/LabelZoom/resources/printer/reads.d.ts +5 -0
- package/dist/nodes/LabelZoom/resources/printer/reads.js +39 -0
- package/dist/nodes/LabelZoom/resources/printer/reads.js.map +1 -0
- package/dist/nodes/LabelZoom/resources/printer/shared.d.ts +10 -0
- package/dist/nodes/LabelZoom/resources/printer/shared.js +68 -0
- package/dist/nodes/LabelZoom/resources/printer/shared.js.map +1 -0
- package/dist/nodes/LabelZoom/shared/descriptions.d.ts +9 -0
- package/dist/nodes/LabelZoom/shared/descriptions.js +214 -0
- package/dist/nodes/LabelZoom/shared/descriptions.js.map +1 -0
- package/dist/nodes/LabelZoom/shared/formats.d.ts +13 -0
- package/dist/nodes/LabelZoom/shared/formats.js +114 -0
- package/dist/nodes/LabelZoom/shared/formats.js.map +1 -0
- package/dist/nodes/LabelZoom/shared/options.d.ts +22 -0
- package/dist/nodes/LabelZoom/shared/options.js +98 -0
- package/dist/nodes/LabelZoom/shared/options.js.map +1 -0
- package/dist/nodes/LabelZoom/shared/transport.d.ts +33 -0
- package/dist/nodes/LabelZoom/shared/transport.js +216 -0
- package/dist/nodes/LabelZoom/shared/transport.js.map +1 -0
- package/dist/nodes/LabelZoom/shared/utils.d.ts +3 -0
- package/dist/nodes/LabelZoom/shared/utils.js +35 -0
- package/dist/nodes/LabelZoom/shared/utils.js.map +1 -0
- package/dist/nodes/LabelZoom/shared/validation.d.ts +9 -0
- package/dist/nodes/LabelZoom/shared/validation.js +12 -0
- package/dist/nodes/LabelZoom/shared/validation.js.map +1 -0
- package/dist/package.json +70 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CREDENTIAL_NAME = exports.DEFAULT_BASE_URL = void 0;
|
|
4
|
+
exports.getCredentialsIfAny = getCredentialsIfAny;
|
|
5
|
+
exports.normalizeBaseUrl = normalizeBaseUrl;
|
|
6
|
+
exports.requestIdOf = requestIdOf;
|
|
7
|
+
exports.contentTypeOf = contentTypeOf;
|
|
8
|
+
exports.retryAfterSecondsOf = retryAfterSecondsOf;
|
|
9
|
+
exports.decodeText = decodeText;
|
|
10
|
+
exports.toNodeApiError = toNodeApiError;
|
|
11
|
+
exports.labelZoomRequest = labelZoomRequest;
|
|
12
|
+
exports.labelZoomJsonRequest = labelZoomJsonRequest;
|
|
13
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
14
|
+
exports.DEFAULT_BASE_URL = 'https://api.labelzoom.com';
|
|
15
|
+
exports.CREDENTIAL_NAME = 'labelZoomApi';
|
|
16
|
+
const DEFAULT_MAX_RETRIES = 2;
|
|
17
|
+
async function getCredentialsIfAny(ctx) {
|
|
18
|
+
try {
|
|
19
|
+
return (await ctx.getCredentials(exports.CREDENTIAL_NAME));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function normalizeBaseUrl(baseUrl) {
|
|
26
|
+
const trimmed = (baseUrl ?? '').trim();
|
|
27
|
+
if (trimmed === '')
|
|
28
|
+
return exports.DEFAULT_BASE_URL;
|
|
29
|
+
return trimmed.replace(/\/+$/, '');
|
|
30
|
+
}
|
|
31
|
+
function buildUrl(baseUrl, request) {
|
|
32
|
+
const parts = [];
|
|
33
|
+
for (const [key, value] of Object.entries(request.query ?? {})) {
|
|
34
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
35
|
+
}
|
|
36
|
+
if (request.params !== undefined) {
|
|
37
|
+
parts.push(`params=${encodeURIComponent(request.params)}`);
|
|
38
|
+
}
|
|
39
|
+
const query = parts.length > 0 ? `?${parts.join('&')}` : '';
|
|
40
|
+
return `${baseUrl}${request.path}${query}`;
|
|
41
|
+
}
|
|
42
|
+
function isRetryableStatus(status) {
|
|
43
|
+
return status === 429 || status >= 500;
|
|
44
|
+
}
|
|
45
|
+
function retryDelayMs(attempt, retryAfterHeader) {
|
|
46
|
+
const base = 2 ** attempt * 1000;
|
|
47
|
+
const jittered = Math.random() * base;
|
|
48
|
+
const retryAfterSeconds = Number(retryAfterHeader);
|
|
49
|
+
if (Number.isFinite(retryAfterSeconds) && retryAfterSeconds * 1000 > jittered) {
|
|
50
|
+
return retryAfterSeconds * 1000;
|
|
51
|
+
}
|
|
52
|
+
return jittered;
|
|
53
|
+
}
|
|
54
|
+
function headerValue(headers, name) {
|
|
55
|
+
const lower = name.toLowerCase();
|
|
56
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
57
|
+
if (key.toLowerCase() === lower) {
|
|
58
|
+
return Array.isArray(value) ? String(value[0]) : String(value);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
function requestIdOf(response) {
|
|
64
|
+
return headerValue(response.headers, 'x-lz-request-id');
|
|
65
|
+
}
|
|
66
|
+
function contentTypeOf(response) {
|
|
67
|
+
return headerValue(response.headers, 'content-type');
|
|
68
|
+
}
|
|
69
|
+
function retryAfterSecondsOf(response) {
|
|
70
|
+
const seconds = Number(headerValue(response.headers, 'retry-after'));
|
|
71
|
+
return Number.isFinite(seconds) ? seconds : undefined;
|
|
72
|
+
}
|
|
73
|
+
function decodeText(response) {
|
|
74
|
+
const charset = /charset=([^;\s]+)/i.exec(contentTypeOf(response) ?? '')?.[1];
|
|
75
|
+
if (charset === undefined || /^utf-?8$/i.test(charset))
|
|
76
|
+
return response.body.toString('utf8');
|
|
77
|
+
try {
|
|
78
|
+
return new TextDecoder(charset.replace(/^"|"$/g, '')).decode(response.body);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return response.body.toString('utf8');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function extractMessage(response) {
|
|
85
|
+
const text = decodeText(response).trim();
|
|
86
|
+
if (text !== '') {
|
|
87
|
+
try {
|
|
88
|
+
const parsed = JSON.parse(text);
|
|
89
|
+
if (typeof parsed?.message === 'string' && parsed.message !== '')
|
|
90
|
+
return parsed.message;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
}
|
|
94
|
+
return text.length > 512 ? `${text.slice(0, 512)}…` : text;
|
|
95
|
+
}
|
|
96
|
+
return `LabelZoom request failed with status ${response.statusCode}`;
|
|
97
|
+
}
|
|
98
|
+
function parsedBody(response) {
|
|
99
|
+
try {
|
|
100
|
+
return JSON.parse(decodeText(response));
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function toNodeApiError(node, response) {
|
|
107
|
+
const message = extractMessage(response);
|
|
108
|
+
const body = parsedBody(response);
|
|
109
|
+
const requestId = requestIdOf(response);
|
|
110
|
+
const hints = [];
|
|
111
|
+
if (response.statusCode === 403 && /paid feature/i.test(message)) {
|
|
112
|
+
hints.push('This conversion path requires a paid LabelZoom plan.');
|
|
113
|
+
}
|
|
114
|
+
if (response.statusCode === 403 && /scope/i.test(message)) {
|
|
115
|
+
hints.push('Create a new API key with the required scope in your LabelZoom dashboard.');
|
|
116
|
+
}
|
|
117
|
+
if (response.statusCode === 413) {
|
|
118
|
+
hints.push('Bodies over 1 MB require a Pro plan or above.');
|
|
119
|
+
}
|
|
120
|
+
if (response.statusCode === 401) {
|
|
121
|
+
hints.push('Check the API key on the LabelZoom credential.');
|
|
122
|
+
}
|
|
123
|
+
if (Array.isArray(body?.problems)) {
|
|
124
|
+
hints.push(`Missing merge fields: ${JSON.stringify(body.problems)}`);
|
|
125
|
+
}
|
|
126
|
+
const retryAfterSeconds = retryAfterSecondsOf(response);
|
|
127
|
+
if (response.statusCode === 429 && retryAfterSeconds !== undefined) {
|
|
128
|
+
hints.push(`Rate limited — retry after ${retryAfterSeconds} seconds.`);
|
|
129
|
+
}
|
|
130
|
+
if (requestId !== undefined) {
|
|
131
|
+
hints.push(`LabelZoom request ID: ${requestId} (quote this to support).`);
|
|
132
|
+
}
|
|
133
|
+
return new n8n_workflow_1.NodeApiError(node, { ...(body ?? {}), message, status: response.statusCode }, {
|
|
134
|
+
message,
|
|
135
|
+
httpCode: String(response.statusCode),
|
|
136
|
+
description: hints.length > 0 ? hints.join(' ') : undefined,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async function labelZoomRequest(request) {
|
|
140
|
+
const credentials = await getCredentialsIfAny(this);
|
|
141
|
+
const baseUrl = normalizeBaseUrl(credentials?.baseUrl);
|
|
142
|
+
const url = buildUrl(baseUrl, request);
|
|
143
|
+
const hasApiKey = typeof credentials?.apiKey === 'string' && credentials.apiKey.trim() !== '';
|
|
144
|
+
const headers = {
|
|
145
|
+
Accept: '*/*',
|
|
146
|
+
'User-Agent': 'labelzoom-n8n-node (n8n)',
|
|
147
|
+
...(request.contentType !== undefined ? { 'Content-Type': request.contentType } : {}),
|
|
148
|
+
...(request.headers ?? {}),
|
|
149
|
+
};
|
|
150
|
+
const options = {
|
|
151
|
+
method: request.method,
|
|
152
|
+
url,
|
|
153
|
+
headers,
|
|
154
|
+
body: request.body,
|
|
155
|
+
encoding: 'arraybuffer',
|
|
156
|
+
returnFullResponse: true,
|
|
157
|
+
ignoreHttpStatusErrors: true,
|
|
158
|
+
json: false,
|
|
159
|
+
};
|
|
160
|
+
const maxRetries = typeof credentials?.maxRetries === 'number' && credentials.maxRetries >= 0
|
|
161
|
+
? credentials.maxRetries
|
|
162
|
+
: DEFAULT_MAX_RETRIES;
|
|
163
|
+
let lastResponse;
|
|
164
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
165
|
+
let raw;
|
|
166
|
+
try {
|
|
167
|
+
raw = (hasApiKey
|
|
168
|
+
? await this.helpers.httpRequestWithAuthentication.call(this, exports.CREDENTIAL_NAME, options)
|
|
169
|
+
: await this.helpers.httpRequest(options));
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
if (attempt < maxRetries) {
|
|
173
|
+
await (0, n8n_workflow_1.sleep)(retryDelayMs(attempt, undefined));
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, {
|
|
177
|
+
message: 'Could not reach the LabelZoom API',
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
lastResponse = {
|
|
181
|
+
statusCode: raw.statusCode,
|
|
182
|
+
headers: raw.headers ?? {},
|
|
183
|
+
body: Buffer.isBuffer(raw.body)
|
|
184
|
+
? raw.body
|
|
185
|
+
: Buffer.from(raw.body),
|
|
186
|
+
};
|
|
187
|
+
if (lastResponse.statusCode < 400)
|
|
188
|
+
return lastResponse;
|
|
189
|
+
if (!isRetryableStatus(lastResponse.statusCode) || attempt === maxRetries) {
|
|
190
|
+
throw toNodeApiError(this.getNode(), lastResponse);
|
|
191
|
+
}
|
|
192
|
+
await (0, n8n_workflow_1.sleep)(retryDelayMs(attempt, headerValue(lastResponse.headers, 'retry-after')));
|
|
193
|
+
}
|
|
194
|
+
throw toNodeApiError(this.getNode(), lastResponse);
|
|
195
|
+
}
|
|
196
|
+
async function labelZoomJsonRequest(method, path, body, query, headers) {
|
|
197
|
+
const response = await labelZoomRequest.call(this, {
|
|
198
|
+
method,
|
|
199
|
+
path,
|
|
200
|
+
query,
|
|
201
|
+
headers,
|
|
202
|
+
...(body === undefined
|
|
203
|
+
? {}
|
|
204
|
+
: { body: JSON.stringify(body), contentType: 'application/json' }),
|
|
205
|
+
});
|
|
206
|
+
const text = response.body.toString('utf8');
|
|
207
|
+
if (text.trim() === '')
|
|
208
|
+
return {};
|
|
209
|
+
try {
|
|
210
|
+
return JSON.parse(text);
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Expected JSON from ${path} but got: ${text.slice(0, 200)}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../nodes/LabelZoom/shared/transport.ts"],"names":[],"mappings":";;;AAuDA,kDAYC;AAGD,4CAIC;AAgDD,kCAEC;AAED,sCAEC;AAED,kDAGC;AAWD,gCASC;AAkCD,wCA6CC;AAOD,4CAmFC;AAGD,oDA2BC;AAvVD,+CAAuE;AAS1D,QAAA,gBAAgB,GAAG,2BAA2B,CAAC;AAC/C,QAAA,eAAe,GAAG,cAAc,CAAC;AAG9C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAiCvB,KAAK,UAAU,mBAAmB,CACxC,GAAmB;IAEnB,IAAI,CAAC;QACJ,OAAO,CAAC,MAAM,GAAG,CAAC,cAAc,CAAC,uBAAe,CAAC,CAIhD,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAGD,SAAgB,gBAAgB,CAAC,OAAgB;IAChD,MAAM,OAAO,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvC,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,wBAAgB,CAAC;IAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,QAAQ,CAAC,OAAe,EAAE,OAAyB;IAC3D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CA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,YAAY,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,IAAA,oBAAK,EAAC,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;IAGD,MAAM,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,YAAa,CAAC,CAAC;AACrD,CAAC;AAGM,KAAK,UAAU,oBAAoB,CAEzC,MAA2B,EAC3B,IAAY,EACZ,IAAkC,EAClC,KAA8B,EAC9B,OAAgC;IAEhC,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE;QAClD,MAAM;QACN,IAAI;QACJ,KAAK;QACL,OAAO;QACP,GAAG,CAAC,IAAI,KAAK,SAAS;YACrB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;KACnE,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAClC,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAe,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,sBAAsB,IAAI,aAAa,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAC3D,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readDocument = readDocument;
|
|
4
|
+
exports.resourceId = resourceId;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const validation_1 = require("./validation");
|
|
7
|
+
async function readDocument(itemIndex) {
|
|
8
|
+
const inputType = this.getNodeParameter('inputType', itemIndex);
|
|
9
|
+
if (inputType === 'text' || inputType === 'base64') {
|
|
10
|
+
const content = this.getNodeParameter('labelContent', itemIndex);
|
|
11
|
+
if (content === '') {
|
|
12
|
+
throw new validation_1.LabelZoomValidationError(this.getNode(), 'body', 'Label Content is empty', {
|
|
13
|
+
itemIndex,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return Buffer.from(content, 'utf8');
|
|
17
|
+
}
|
|
18
|
+
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex);
|
|
19
|
+
this.helpers.assertBinaryData(itemIndex, binaryPropertyName);
|
|
20
|
+
const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, binaryPropertyName);
|
|
21
|
+
if (buffer.length === 0) {
|
|
22
|
+
throw new validation_1.LabelZoomValidationError(this.getNode(), 'body', `The binary field "${binaryPropertyName}" is empty`, { itemIndex });
|
|
23
|
+
}
|
|
24
|
+
return buffer;
|
|
25
|
+
}
|
|
26
|
+
function resourceId(parameterName, itemIndex) {
|
|
27
|
+
const value = this.getNodeParameter(parameterName, itemIndex, undefined, {
|
|
28
|
+
extractValue: true,
|
|
29
|
+
});
|
|
30
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
31
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No ${parameterName} was provided`, { itemIndex });
|
|
32
|
+
}
|
|
33
|
+
return value.trim();
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../nodes/LabelZoom/shared/utils.ts"],"names":[],"mappings":";;AAaA,oCA+BC;AASD,gCAYC;AAhED,+CAAkD;AAElD,6CAAwD;AAUjD,KAAK,UAAU,YAAY,CAEjC,S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AAE,EAAE,CAAC;QACtD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,aAAa,eAAe,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { INode } from 'n8n-workflow';
|
|
2
|
+
import { NodeOperationError } from 'n8n-workflow';
|
|
3
|
+
export declare class LabelZoomValidationError extends NodeOperationError {
|
|
4
|
+
readonly parameter: string;
|
|
5
|
+
constructor(node: INode, parameter: string, message: string, options?: {
|
|
6
|
+
itemIndex?: number;
|
|
7
|
+
description?: string;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LabelZoomValidationError = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class LabelZoomValidationError extends n8n_workflow_1.NodeOperationError {
|
|
6
|
+
constructor(node, parameter, message, options) {
|
|
7
|
+
super(node, message, options);
|
|
8
|
+
this.parameter = parameter;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.LabelZoomValidationError = LabelZoomValidationError;
|
|
12
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../nodes/LabelZoom/shared/validation.ts"],"names":[],"mappings":";;;AACA,+CAAkD;AAYlD,MAAa,wBAAyB,SAAQ,iCAAkB;IAG/D,YACC,IAAW,EACX,SAAiB,EACjB,OAAe,EACf,OAAsD;QAEtD,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;CACD;AAZD,4DAYC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-labelzoom",
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://www.labelzoom.com",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"n8n-community-node-package",
|
|
9
|
+
"labelzoom",
|
|
10
|
+
"zpl",
|
|
11
|
+
"epl",
|
|
12
|
+
"tspl",
|
|
13
|
+
"dpl",
|
|
14
|
+
"zebra",
|
|
15
|
+
"barcode",
|
|
16
|
+
"label",
|
|
17
|
+
"thermal-printer",
|
|
18
|
+
"pdf-to-zpl"
|
|
19
|
+
],
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "RJF Technology Solutions LLC",
|
|
22
|
+
"email": "support@labelzoom.com"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/labelzoom/labelzoom-n8n-node.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/labelzoom/labelzoom-n8n-node/issues"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20.19"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "n8n-node build",
|
|
36
|
+
"build:watch": "tsc --watch",
|
|
37
|
+
"dev": "n8n-node dev",
|
|
38
|
+
"lint": "n8n-node lint",
|
|
39
|
+
"lint:fix": "n8n-node lint --fix",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
|
|
43
|
+
"sync-conformance": "node scripts/sync-conformance.mjs",
|
|
44
|
+
"prepublishOnly": "n8n-node prerelease"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist"
|
|
48
|
+
],
|
|
49
|
+
"n8n": {
|
|
50
|
+
"n8nNodesApiVersion": 1,
|
|
51
|
+
"strict": true,
|
|
52
|
+
"credentials": [
|
|
53
|
+
"dist/credentials/LabelZoomApi.credentials.js"
|
|
54
|
+
],
|
|
55
|
+
"nodes": [
|
|
56
|
+
"dist/nodes/LabelZoom/LabelZoom.node.js"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@n8n/node-cli": "^0.46.1",
|
|
61
|
+
"@types/node": "^22.15.0",
|
|
62
|
+
"eslint": "9.39.4",
|
|
63
|
+
"prettier": "3.9.6",
|
|
64
|
+
"typescript": "6.0.3",
|
|
65
|
+
"vitest": "^4.1.11"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"n8n-workflow": "*"
|
|
69
|
+
}
|
|
70
|
+
}
|