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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LabelZoom
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# n8n-nodes-labelzoom
|
|
2
|
+
|
|
3
|
+
An [n8n](https://n8n.io) community node for [LabelZoom](https://www.labelzoom.com) — convert
|
|
4
|
+
barcode labels between ZPL, EPL, TSPL, DPL, PDF, images and XML/JSON, and print them to
|
|
5
|
+
cloud-connected thermal printers.
|
|
6
|
+
|
|
7
|
+
The labels in a business rarely arrive in the format the printer wants. A WMS emits ZPL, a
|
|
8
|
+
carrier hands you a PDF, an old Eltron on the packing bench speaks EPL. This node turns that
|
|
9
|
+
into two steps in a workflow.
|
|
10
|
+
|
|
11
|
+
[Installation](#installation) · [Credentials](#credentials) · [Operations](#operations) ·
|
|
12
|
+
[Examples](#examples) · [Development](#development)
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
In n8n, go to **Settings → Community nodes → Install** and enter:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
n8n-nodes-labelzoom
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Self-hosted installs can also use npm directly:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install n8n-nodes-labelzoom
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Credentials
|
|
29
|
+
|
|
30
|
+
Create a **LabelZoom API** credential with the API key from the **API Access** section of your
|
|
31
|
+
[dashboard](https://www.labelzoom.com/dashboard).
|
|
32
|
+
|
|
33
|
+
**Converting works without a credential.** Leave it unset and the node runs on the free tier —
|
|
34
|
+
unlimited conversions, watermarked output, first label only, 1 MB request cap. Add a key when
|
|
35
|
+
you're ready to ship.
|
|
36
|
+
|
|
37
|
+
**Printing requires a key with the `print` scope**, because a print job goes to *your* printer.
|
|
38
|
+
`print` implies `convert`, so one key covers both.
|
|
39
|
+
|
|
40
|
+
| Field | Notes |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| API Key | Optional for Label operations, required for Printer operations |
|
|
43
|
+
| Max Retries | 429s and 5xx are retried with exponential backoff. `0` fails fast. Client errors are never retried. |
|
|
44
|
+
| Base URL | Only change this if you were given a dedicated endpoint |
|
|
45
|
+
|
|
46
|
+
## Operations
|
|
47
|
+
|
|
48
|
+
### Label
|
|
49
|
+
|
|
50
|
+
| Operation | What it does |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| **Convert** | Convert a document between any supported source and target format |
|
|
53
|
+
| **Convert Template** | Fill a Print Template with data and render it, without printing |
|
|
54
|
+
|
|
55
|
+
Sources: `zpl` `epl` `tspl` `dpl` `xml` `json` `pdf` `png` `bmp` `gif` `jpeg` `jpg` `url`
|
|
56
|
+
Targets: `zpl` `epl` `tspl` `dpl` `xml` `json` `pdf` `png` `bmp` `gif` `jpeg`
|
|
57
|
+
|
|
58
|
+
`url` is a source only — post a link and LabelZoom fetches the document itself. `jpg` is an
|
|
59
|
+
input spelling that normalizes to `jpeg`.
|
|
60
|
+
|
|
61
|
+
The output is always a **binary field**, because five of the eleven targets are binary. A
|
|
62
|
+
decoded `text` field is added for `zpl`, `xml` and `json` as a convenience. It is deliberately
|
|
63
|
+
*not* added for `epl`, `tspl` or `dpl`: those come back as `text/plain` but can inline raw
|
|
64
|
+
bytes (EPL's `GW`, TSPL's `BITMAP`, DPL's leading `STX`), and decoding them to a string would
|
|
65
|
+
corrupt any label carrying graphics.
|
|
66
|
+
|
|
67
|
+
Options cover the full parameter set — DPI, rotation, scaling, colour mode, darkness, label
|
|
68
|
+
size in inches, position, PDF conversion mode and page number, ZPL image compression and
|
|
69
|
+
commands to ignore, and a **Variable Data** field that fills placeholders on the label (one
|
|
70
|
+
output label per array entry). Anything not yet surfaced in the UI can go through **Custom
|
|
71
|
+
Parameters (JSON)**.
|
|
72
|
+
|
|
73
|
+
### Printer
|
|
74
|
+
|
|
75
|
+
> **Cloud Print is in private beta.** Endpoints and payloads may change.
|
|
76
|
+
> [Apply for access](https://www.labelzoom.com/beta).
|
|
77
|
+
|
|
78
|
+
| Operation | What it does |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| **Print** | Send a document to a printer, converting it in transit |
|
|
81
|
+
| **Print Template** | Fill a Print Template with data and print it |
|
|
82
|
+
| **Get Job** | Look up a print job to see whether it actually printed |
|
|
83
|
+
| **Get Many** | List the printers on your account |
|
|
84
|
+
| **Get Status** | One printer's live status and its bound agents |
|
|
85
|
+
|
|
86
|
+
Printing sends the document as-is; if it doesn't match the printer's native format, LabelZoom
|
|
87
|
+
converts it on the way — a carrier PDF sent to a Zebra becomes ZPL automatically. Every
|
|
88
|
+
transform option from Convert works here too, even when no format change is needed.
|
|
89
|
+
|
|
90
|
+
**`dispatched` and `queued` mean *accepted*, not *printed*.** A job only reaches `completed`
|
|
91
|
+
once the print agent reports back. Turn on **Wait for Completion** when the workflow needs to
|
|
92
|
+
know the label came out of the printer.
|
|
93
|
+
|
|
94
|
+
**Idempotency.** Print carries an `Idempotency-Key`; repeating a key returns the original job
|
|
95
|
+
instead of printing again. It defaults to `{{ $execution.id }}-{{ $itemIndex }}`, which makes a
|
|
96
|
+
retried *step* safe. Set it from an order number to make a whole workflow re-run safe too — a
|
|
97
|
+
duplicate shipping label is a real cost.
|
|
98
|
+
|
|
99
|
+
## Examples
|
|
100
|
+
|
|
101
|
+
**Carrier PDF → Zebra.** HTTP Request (download the label PDF) → LabelZoom (Printer → Print,
|
|
102
|
+
source format `pdf`, pick your ZPL printer). One step; the conversion is implicit.
|
|
103
|
+
|
|
104
|
+
**Preview a ZPL label.** LabelZoom (Label → Convert, `zpl` → `png`) → Send Email. Useful for a
|
|
105
|
+
"does this template look right" approval step before a production run.
|
|
106
|
+
|
|
107
|
+
**Batch from a spreadsheet.** Google Sheets → LabelZoom (Label → Convert, `zpl` → `pdf`, with
|
|
108
|
+
Variable Data mapped from the rows) → Google Drive. Each row becomes one page.
|
|
109
|
+
|
|
110
|
+
**Fill a designed template.** Design in LabelZoom Studio, publish it to Print Templates, then
|
|
111
|
+
Printer → Print Template with the merge fields mapped from the incoming item. The template
|
|
112
|
+
picker shows each template's merge fields, so you can see what data it wants.
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
npm install
|
|
118
|
+
npm run dev # a local n8n with this node linked
|
|
119
|
+
npm run build
|
|
120
|
+
npm run lint # the n8n community-node linter (the verification gate)
|
|
121
|
+
npm run typecheck
|
|
122
|
+
npm test
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### The conformance suite
|
|
126
|
+
|
|
127
|
+
n8n verification forbids runtime dependencies, so this node cannot call
|
|
128
|
+
[`@labelzoom/sdk`](https://www.npmjs.com/package/@labelzoom/sdk) — it re-implements the
|
|
129
|
+
LabelZoom wire contract by hand. To stop the two drifting apart, it runs the **same
|
|
130
|
+
language-neutral conformance fixtures** the eight official SDKs run: 83 cases pinned from
|
|
131
|
+
`labelzoom-sdk` covering request shape, error mapping, retry policy and local validation.
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
npm run sync-conformance # refresh test/conformance/ from the pinned SDK tag
|
|
135
|
+
node scripts/sync-conformance.mjs --check # verify it hasn't drifted (CI)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The suite asserts its own coverage — `executed == spec.cases - declared skips` — so a
|
|
139
|
+
partially-implemented runner can't quietly report green. Each skip carries a written reason in
|
|
140
|
+
[`test/conformance-skips.json`](test/conformance-skips.json).
|
|
141
|
+
|
|
142
|
+
There is one deliberate deviation, documented in the runner: the fixtures pin a `User-Agent`
|
|
143
|
+
matching `^labelzoom-[a-z0-9]+-sdk/`, the SDK family's naming. This is an n8n node, not an SDK,
|
|
144
|
+
and calling itself one on the wire would misreport what's talking to the API. It sends
|
|
145
|
+
`labelzoom-n8n-node` instead, and the substance of that rule — identify yourself, and never
|
|
146
|
+
claim to be LabelZoom Studio, whose prefix the server special-cases — is asserted directly in
|
|
147
|
+
`test/node.test.ts`.
|
|
148
|
+
|
|
149
|
+
## Resources
|
|
150
|
+
|
|
151
|
+
- [LabelZoom API docs](https://docs.labelzoom.com)
|
|
152
|
+
- [Conversion parameters](https://docs.labelzoom.com/reference/conversion-parameters/)
|
|
153
|
+
- [Cloud Print API](https://docs.labelzoom.com/reference/cloud-print-api/)
|
|
154
|
+
- [n8n community nodes](https://docs.n8n.io/integrations/community-nodes/)
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class LabelZoomApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: Icon;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LabelZoomApi = void 0;
|
|
4
|
+
class LabelZoomApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'labelZoomApi';
|
|
7
|
+
this.displayName = 'LabelZoom API';
|
|
8
|
+
this.icon = { light: 'file:../icons/labelzoom.svg', dark: 'file:../icons/labelzoom.dark.svg' };
|
|
9
|
+
this.documentationUrl = 'https://docs.labelzoom.com/getting-started/authentication/';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
name: 'apiKey',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: { password: true },
|
|
16
|
+
default: '',
|
|
17
|
+
description: 'Your LabelZoom API key, from the API Access section of your dashboard. Conversion also works without a key on the free tier, but output is watermarked and printing requires a key with the "print" scope.',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Max Retries',
|
|
21
|
+
name: 'maxRetries',
|
|
22
|
+
type: 'number',
|
|
23
|
+
typeOptions: { minValue: 0, maxValue: 5 },
|
|
24
|
+
default: 2,
|
|
25
|
+
description: 'How many times to retry a rate limit (429) or a server error (5xx), with exponential backoff. Set to 0 to fail fast. Client errors are never retried.',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Base URL',
|
|
29
|
+
name: 'baseUrl',
|
|
30
|
+
type: 'string',
|
|
31
|
+
default: 'https://api.labelzoom.com',
|
|
32
|
+
description: 'Only change this if you were given a dedicated endpoint',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
this.authenticate = {
|
|
36
|
+
type: 'generic',
|
|
37
|
+
properties: {
|
|
38
|
+
headers: {
|
|
39
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
this.test = {
|
|
44
|
+
request: {
|
|
45
|
+
baseURL: '={{$credentials.baseUrl || "https://api.labelzoom.com"}}',
|
|
46
|
+
url: '/api/v3/templates',
|
|
47
|
+
method: 'GET',
|
|
48
|
+
headers: { Accept: '*/*' },
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.LabelZoomApi = LabelZoomApi;
|
|
54
|
+
//# sourceMappingURL=LabelZoomApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelZoomApi.credentials.js","sourceRoot":"","sources":["../../credentials/LabelZoomApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QAEtB,gBAAW,GAAG,eAAe,CAAC;QAE9B,SAAI,GAAS,EAAE,KAAK,EAAE,6BAA6B,EAAE,IAAI,EAAE,kCAAkC,EAAE,CAAC;QAEhG,qBAAgB,GAAG,4DAA4D,CAAC;QAEhF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,4MAA4M;aAC7M;YACD;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE;gBACzC,OAAO,EAAE,CAAC;gBACV,WAAW,EACV,uJAAuJ;aACxJ;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,yDAAyD;aACtE;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAeF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBAIR,OAAO,EAAE,0DAA0D;gBACnE,GAAG,EAAE,mBAAmB;gBACxB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;aAC1B;SACD,CAAC;IACH,CAAC;CAAA;AAtED,oCAsEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 168.07 168.07"><defs><style>.cls-1{fill:#f93549;}.cls-2{fill:#fff;}</style></defs><rect class="cls-1" width="168.07" height="168.07"/><path class="cls-2" d="M421.33,235H366a17.87,17.87,0,0,0-17.87,17.87h0A17.87,17.87,0,0,0,366,270.77h25.23s22.48-28.78,25.21-31.95a10.64,10.64,0,0,1,5-3.6C421.55,235.07,421.33,235,421.33,235Z" transform="translate(-323.36 -215.42)"/><polygon class="cls-2" points="96.92 146.88 89.98 146.88 109.03 111.29 115.96 111.29 96.92 146.88"/><polygon class="cls-2" points="132.66 146.88 125.72 146.88 144.77 111.29 151.71 111.29 132.66 146.88"/><polygon class="cls-2" points="122.44 146.88 118.79 146.88 137.84 111.29 141.48 111.29 122.44 146.88"/><polygon class="cls-2" points="101.85 146.88 99.57 146.88 118.61 111.29 120.9 111.29 101.85 146.88"/><polygon class="cls-2" points="115.47 146.88 105.52 146.88 124.56 111.29 134.51 111.29 115.47 146.88"/><path class="cls-2" d="M453.84,266.54a20.21,20.21,0,0,0-17.66-30.05H436c-.57,0-1.13,0-1.69.09l-.25,0a20.13,20.13,0,0,0-13.22,6.77c-.4.45-.78.93-1.15,1.43L353.06,328a21.18,21.18,0,0,0,16.53,34.44h37.12l19-35.56h-20l46.16-57.35A16.75,16.75,0,0,0,453.84,266.54Z" transform="translate(-323.36 -215.42)"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 126.99 127.39"><defs><style>.cls-1{fill:#f93549;}</style></defs><path class="cls-1" d="M417.33,235H362a17.87,17.87,0,0,0-17.87,17.87h0A17.87,17.87,0,0,0,362,270.77h25.22s22.48-28.78,25.21-31.95a10.73,10.73,0,0,1,5-3.6C417.55,235.07,417.33,235,417.33,235Z" transform="translate(-344.08 -235.03)"/><polygon class="cls-1" points="72.2 127.26 65.27 127.26 84.31 91.68 91.25 91.68 72.2 127.26"/><polygon class="cls-1" points="107.95 127.26 101.01 127.26 120.05 91.68 126.99 91.68 107.95 127.26"/><polygon class="cls-1" points="97.72 127.26 94.08 127.26 113.12 91.68 116.77 91.68 97.72 127.26"/><polygon class="cls-1" points="77.14 127.26 74.85 127.26 93.9 91.68 96.18 91.68 77.14 127.26"/><polygon class="cls-1" points="90.75 127.26 80.81 127.26 99.85 91.68 109.79 91.68 90.75 127.26"/><path class="cls-1" d="M449.84,266.54a20.22,20.22,0,0,0-17.67-30.05H432c-.57,0-1.13,0-1.69.09l-.25,0a20.13,20.13,0,0,0-13.21,6.77,16,16,0,0,0-1.15,1.43L349.05,328a21.19,21.19,0,0,0,16.54,34.44h37.12l19-35.56h-20l46.16-57.35A16.25,16.25,0,0,0,449.84,266.54Z" transform="translate(-344.08 -235.03)"/></svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
import { getPrinters } from './listSearch/getPrinters';
|
|
3
|
+
import { getTemplates } from './listSearch/getTemplates';
|
|
4
|
+
export declare class LabelZoom implements INodeType {
|
|
5
|
+
description: INodeTypeDescription;
|
|
6
|
+
methods: {
|
|
7
|
+
listSearch: {
|
|
8
|
+
getPrinters: typeof getPrinters;
|
|
9
|
+
getTemplates: typeof getTemplates;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LabelZoom = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const getPrinters_1 = require("./listSearch/getPrinters");
|
|
6
|
+
const getTemplates_1 = require("./listSearch/getTemplates");
|
|
7
|
+
const label_1 = require("./resources/label");
|
|
8
|
+
const printer_1 = require("./resources/printer");
|
|
9
|
+
async function runOperation(resource, operation, itemIndex) {
|
|
10
|
+
if (resource === 'label') {
|
|
11
|
+
if (operation === 'convert')
|
|
12
|
+
return [await label_1.convert.call(this, itemIndex)];
|
|
13
|
+
if (operation === 'convertTemplate')
|
|
14
|
+
return [await label_1.convertTemplate.call(this, itemIndex)];
|
|
15
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown label operation: ${operation}`, {
|
|
16
|
+
itemIndex,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (resource === 'printer') {
|
|
20
|
+
if (operation === 'print')
|
|
21
|
+
return [await printer_1.print.call(this, itemIndex)];
|
|
22
|
+
if (operation === 'printTemplate')
|
|
23
|
+
return [await printer_1.printTemplate.call(this, itemIndex)];
|
|
24
|
+
if (operation === 'getJob')
|
|
25
|
+
return [await printer_1.getJob.call(this, itemIndex)];
|
|
26
|
+
if (operation === 'getStatus')
|
|
27
|
+
return [await printer_1.getStatus.call(this, itemIndex)];
|
|
28
|
+
if (operation === 'getMany')
|
|
29
|
+
return await printer_1.getMany.call(this, itemIndex);
|
|
30
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown printer operation: ${operation}`, {
|
|
31
|
+
itemIndex,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`, { itemIndex });
|
|
35
|
+
}
|
|
36
|
+
class LabelZoom {
|
|
37
|
+
constructor() {
|
|
38
|
+
this.description = {
|
|
39
|
+
displayName: 'LabelZoom',
|
|
40
|
+
name: 'labelZoom',
|
|
41
|
+
icon: { light: 'file:../../icons/labelzoom.svg', dark: 'file:../../icons/labelzoom.dark.svg' },
|
|
42
|
+
group: ['transform'],
|
|
43
|
+
version: 1,
|
|
44
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
45
|
+
description: 'Convert barcode labels between formats and print them to thermal printers',
|
|
46
|
+
defaults: { name: 'LabelZoom' },
|
|
47
|
+
usableAsTool: true,
|
|
48
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
49
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
50
|
+
credentials: [
|
|
51
|
+
{
|
|
52
|
+
name: 'labelZoomApi',
|
|
53
|
+
required: false,
|
|
54
|
+
displayOptions: { show: { resource: ['label'], operation: ['convert'] } },
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'labelZoomApi',
|
|
58
|
+
required: true,
|
|
59
|
+
displayOptions: { show: { resource: ['label'], operation: ['convertTemplate'] } },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'labelZoomApi',
|
|
63
|
+
required: true,
|
|
64
|
+
displayOptions: { show: { resource: ['printer'] } },
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
properties: [
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Resource',
|
|
70
|
+
name: 'resource',
|
|
71
|
+
type: 'options',
|
|
72
|
+
noDataExpression: true,
|
|
73
|
+
options: [
|
|
74
|
+
{ name: 'Label', value: 'label', description: 'Convert a label between formats' },
|
|
75
|
+
{
|
|
76
|
+
name: 'Printer',
|
|
77
|
+
value: 'printer',
|
|
78
|
+
description: 'Send labels to a cloud-connected printer (beta)',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
default: 'label',
|
|
82
|
+
},
|
|
83
|
+
...label_1.labelDescription,
|
|
84
|
+
...printer_1.printerDescription,
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
this.methods = {
|
|
88
|
+
listSearch: {
|
|
89
|
+
getPrinters: getPrinters_1.getPrinters,
|
|
90
|
+
getTemplates: getTemplates_1.getTemplates,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async execute() {
|
|
95
|
+
const items = this.getInputData();
|
|
96
|
+
const returnData = [];
|
|
97
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
98
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
99
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
100
|
+
if (!this.continueOnFail()) {
|
|
101
|
+
returnData.push(...(await runOperation.call(this, resource, operation, itemIndex)));
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
returnData.push(...(await runOperation.call(this, resource, operation, itemIndex)));
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
returnData.push({
|
|
109
|
+
json: { error: error.message },
|
|
110
|
+
pairedItem: { item: itemIndex },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return [returnData];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.LabelZoom = LabelZoom;
|
|
118
|
+
//# sourceMappingURL=LabelZoom.node.js.map
|
|
@@ -0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AC;gBACJ,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;YACrF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,UAAU,CAAC,IAAI,CAAC;oBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;oBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;iBAC/B,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA3FD,8BA2FC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-base.labelZoom",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Utility", "Development"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{ "url": "https://docs.labelzoom.com/getting-started/authentication/" }
|
|
9
|
+
],
|
|
10
|
+
"primaryDocumentation": [{ "url": "https://docs.labelzoom.com/guides/n8n/" }]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPrinters = getPrinters;
|
|
4
|
+
const transport_1 = require("../shared/transport");
|
|
5
|
+
async function getPrinters(filter) {
|
|
6
|
+
const response = await transport_1.labelZoomJsonRequest.call(this, 'GET', '/api/v3/printers');
|
|
7
|
+
const printers = Array.isArray(response.printers) ? response.printers : [];
|
|
8
|
+
const results = printers
|
|
9
|
+
.map((printer) => {
|
|
10
|
+
const config = (printer.config ?? {});
|
|
11
|
+
const nativeFormat = typeof config.nativeFormat === 'string' ? config.nativeFormat.toUpperCase() : 'unknown';
|
|
12
|
+
const status = typeof printer.status === 'string' ? printer.status : 'unknown';
|
|
13
|
+
return {
|
|
14
|
+
name: `${String(printer.name ?? printer.id)} — ${nativeFormat} (${status})`,
|
|
15
|
+
value: String(printer.id),
|
|
16
|
+
};
|
|
17
|
+
})
|
|
18
|
+
.filter((option) => filter === undefined || filter === ''
|
|
19
|
+
? true
|
|
20
|
+
: option.name.toLowerCase().includes(filter.toLowerCase()))
|
|
21
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
22
|
+
return { results };
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=getPrinters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPrinters.js","sourceRoot":"","sources":["../../../../nodes/LabelZoom/listSearch/getPrinters.ts"],"names":[],"mappings":";;AAYA,kCA4BC;AAtCD,mDAA2D;AAUpD,KAAK,UAAU,WAAW,CAEhC,MAAe;IAEf,MAAM,QAAQ,GAAG,MAAM,gCAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;IAClF,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAE,QAAQ,CAAC,QAAyB,CAAC,CAAC,CAAC,EAAE,CAAC;IAE7F,MAAM,OAAO,GAAG,QAAQ;SACtB,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAChB,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAe,CAAC;QACpD,MAAM,YAAY,GACjB,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,MAAM,MAAM,GAAG,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/E,OAAO;YAGN,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC,MAAM,YAAY,KAAK,MAAM,GAAG;YAC3E,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;SACzB,CAAC;IACH,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAClB,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE;QACpC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAC3D;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAE/C,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTemplates = getTemplates;
|
|
4
|
+
const transport_1 = require("../shared/transport");
|
|
5
|
+
async function getTemplates(filter) {
|
|
6
|
+
const response = await transport_1.labelZoomJsonRequest.call(this, 'GET', '/api/v3/templates');
|
|
7
|
+
const templates = Array.isArray(response.templates) ? response.templates : [];
|
|
8
|
+
const results = templates
|
|
9
|
+
.map((template) => {
|
|
10
|
+
const mergeFields = Array.isArray(template.merge_fields)
|
|
11
|
+
? template.merge_fields
|
|
12
|
+
: [];
|
|
13
|
+
const fields = mergeFields.length > 0 ? ` — ${mergeFields.join(', ')}` : '';
|
|
14
|
+
return {
|
|
15
|
+
name: `${String(template.name ?? template.id)}${fields}`,
|
|
16
|
+
value: String(template.id),
|
|
17
|
+
};
|
|
18
|
+
})
|
|
19
|
+
.filter((option) => filter === undefined || filter === ''
|
|
20
|
+
? true
|
|
21
|
+
: option.name.toLowerCase().includes(filter.toLowerCase()))
|
|
22
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
23
|
+
return { results };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=getTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTemplates.js","sourceRoot":"","sources":["../../../../nodes/LabelZoom/listSearch/getTemplates.ts"],"names":[],"mappings":";;AAUA,oCA4BC;AApCD,mDAA2D;AAQpD,KAAK,UAAU,YAAY,CAEjC,MAAe;IAEf,MAAM,QAAQ,GAAG,MAAM,gCAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC;IACnF,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAE,QAAQ,CAAC,SAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhG,MAAM,OAAO,GAAG,SAAS;SACvB,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QACjB,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;YACvD,CAAC,CAAE,QAAQ,CAAC,YAAyB;YACrC,CAAC,CAAC,EAAE,CAAC;QAGN,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,OAAO;YACN,IAAI,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE;YACxD,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;SAC1B,CAAC;IACH,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAClB,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE;QACpC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAC3D;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAE/C,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertDescription = void 0;
|
|
4
|
+
exports.convert = convert;
|
|
5
|
+
const descriptions_1 = require("../../shared/descriptions");
|
|
6
|
+
const formats_1 = require("../../shared/formats");
|
|
7
|
+
const options_1 = require("../../shared/options");
|
|
8
|
+
const transport_1 = require("../../shared/transport");
|
|
9
|
+
const utils_1 = require("../../shared/utils");
|
|
10
|
+
const showFor = { resource: ['label'], operation: ['convert'] };
|
|
11
|
+
exports.convertDescription = [
|
|
12
|
+
{
|
|
13
|
+
displayName: 'Source Format',
|
|
14
|
+
name: 'sourceFormat',
|
|
15
|
+
type: 'options',
|
|
16
|
+
noDataExpression: true,
|
|
17
|
+
options: (0, formats_1.formatOptions)(formats_1.SOURCE_FORMATS),
|
|
18
|
+
default: 'zpl',
|
|
19
|
+
description: 'The format of the document you are sending. Choose URL to have LabelZoom fetch a document from a link instead of uploading it.',
|
|
20
|
+
displayOptions: { show: showFor },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Target Format',
|
|
24
|
+
name: 'targetFormat',
|
|
25
|
+
type: 'options',
|
|
26
|
+
noDataExpression: true,
|
|
27
|
+
options: (0, formats_1.formatOptions)(formats_1.TARGET_FORMATS),
|
|
28
|
+
default: 'pdf',
|
|
29
|
+
description: 'The format to convert to',
|
|
30
|
+
displayOptions: { show: showFor },
|
|
31
|
+
},
|
|
32
|
+
...(0, descriptions_1.documentInputFields)(showFor),
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Output Binary Field',
|
|
35
|
+
name: 'outputBinaryPropertyName',
|
|
36
|
+
type: 'string',
|
|
37
|
+
default: 'data',
|
|
38
|
+
required: true,
|
|
39
|
+
hint: 'The name of the output field to put the converted label in',
|
|
40
|
+
displayOptions: { show: showFor },
|
|
41
|
+
},
|
|
42
|
+
(0, descriptions_1.conversionOptionsField)(showFor),
|
|
43
|
+
];
|
|
44
|
+
async function convert(itemIndex) {
|
|
45
|
+
const sourceFormat = this.getNodeParameter('sourceFormat', itemIndex);
|
|
46
|
+
const targetFormat = this.getNodeParameter('targetFormat', itemIndex);
|
|
47
|
+
const outputBinaryPropertyName = this.getNodeParameter('outputBinaryPropertyName', itemIndex);
|
|
48
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
49
|
+
const document = await utils_1.readDocument.call(this, itemIndex);
|
|
50
|
+
const inputType = this.getNodeParameter('inputType', itemIndex);
|
|
51
|
+
const contentType = inputType === 'base64' ? 'text/plain' : (0, formats_1.sourceMediaType)(sourceFormat);
|
|
52
|
+
const response = await transport_1.labelZoomRequest.call(this, {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
path: `/api/v2/convert/${(0, formats_1.sourceWireToken)(sourceFormat)}/to/${targetFormat}`,
|
|
55
|
+
params: (0, options_1.serializeConversionParams)(this.getNode(), options),
|
|
56
|
+
body: document,
|
|
57
|
+
contentType,
|
|
58
|
+
});
|
|
59
|
+
const mimeType = (0, transport_1.contentTypeOf)(response)?.split(';')[0].trim() ?? (0, formats_1.targetMediaType)(targetFormat);
|
|
60
|
+
const fileName = `label.${(0, formats_1.targetExtension)(targetFormat)}`;
|
|
61
|
+
const json = {
|
|
62
|
+
sourceFormat,
|
|
63
|
+
targetFormat,
|
|
64
|
+
contentType: (0, transport_1.contentTypeOf)(response),
|
|
65
|
+
byteLength: response.body.length,
|
|
66
|
+
requestId: (0, transport_1.requestIdOf)(response),
|
|
67
|
+
};
|
|
68
|
+
if ((0, formats_1.isTextualTarget)(targetFormat)) {
|
|
69
|
+
json.text = (0, transport_1.decodeText)(response);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
json,
|
|
73
|
+
binary: {
|
|
74
|
+
[outputBinaryPropertyName]: await this.helpers.prepareBinaryData(response.body, fileName, mimeType),
|
|
75
|
+
},
|
|
76
|
+
pairedItem: { item: itemIndex },
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../../../nodes/LabelZoom/resources/label/convert.ts"],"names":[],"mappings":";;;AA4DA,0BA4DC;AAjHD,4DAAwF;AACxF,kDAS8B;AAE9B,kDAAiE;AACjE,sDAAkG;AAClG,8CAAkD;AAElD,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;AAEnD,QAAA,kBAAkB,GAAsB;IACpD;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,IAAA,uBAAa,EAAC,wBAAc,CAAC;QACtC,OAAO,EAAE,KAAK;QACd,WAAW,EACV,gIAAgI;QACjI,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;KACjC;IACD;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,IAAA,uBAAa,EAAC,wBAAc,CAAC;QACtC,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,0BAA0B;QACvC,cAAc,EAAE,EAAE,IAAI,EAAE,O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E,OAAO,CAAC;QAC1D,IAAI,EAAE,QAAQ;QACd,WAAW;KACX,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAA,yBAAa,EAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAA,yBAAe,EAAC,YAAY,CAAC,CAAC;IAChG,MAAM,QAAQ,GAAG,SAAS,IAAA,yBAAe,EAAC,YAAY,CAAC,EAAE,CAAC;IAE1D,MAAM,IAAI,GAAgB;QACzB,YAAY;QACZ,YAAY;QACZ,WAAW,EAAE,IAAA,yBAAa,EAAC,QAAQ,CAAC;QACpC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;QAChC,SAAS,EAAE,IAAA,uBAAW,EAAC,QAAQ,CAAC;KAChC,CAAC;IAMF,IAAI,IAAA,yBAAe,EAAC,YAAY,CAAC,EAAE,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAA,sBAAU,EAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED,OAAO;QACN,IAAI;QACJ,MAAM,EAAE;YACP,CAAC,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAC/D,QAAQ,CAAC,IAAI,EACb,QAAQ,EACR,QAAQ,CACR;SACD;QACD,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC/B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const convertTemplateDescription: INodeProperties[];
|
|
3
|
+
export declare function convertTemplate(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
|