@posty5/n8n-nodes-posty5 4.2.0 → 5.1.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 +364 -16
- package/dist/credentials/Posty5Api.credentials.d.ts +4 -0
- package/dist/credentials/Posty5Api.credentials.d.ts.map +1 -1
- package/dist/credentials/Posty5Api.credentials.js +30 -4
- package/dist/credentials/Posty5Api.credentials.js.map +1 -1
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.d.ts.map +1 -1
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.js +6 -2
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.js.map +1 -1
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.d.ts.map +1 -1
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.js +14 -3
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.js.map +1 -1
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.d.ts +8 -0
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.d.ts.map +1 -1
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.js +885 -190
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.js.map +1 -1
- package/dist/nodes/Posty5QrCode/helpers.d.ts +12 -0
- package/dist/nodes/Posty5QrCode/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5QrCode/helpers.js +56 -0
- package/dist/nodes/Posty5QrCode/helpers.js.map +1 -0
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.d.ts +8 -0
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.d.ts.map +1 -1
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.js +389 -78
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.js.map +1 -1
- package/dist/nodes/Posty5ShortLink/helpers.d.ts +12 -0
- package/dist/nodes/Posty5ShortLink/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5ShortLink/helpers.js +46 -0
- package/dist/nodes/Posty5ShortLink/helpers.js.map +1 -0
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.d.ts.map +1 -1
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.js +143 -52
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.js.map +1 -1
- package/dist/nodes/Posty5Store/Posty5Store.node.d.ts +17 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.js +230 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.js +55 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.js +91 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.js +48 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.js +118 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.js +167 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.js +50 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.js.map +1 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.d.ts +13 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.js +171 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.js.map +1 -0
- package/dist/nodes/Posty5Trigger/config.d.ts +51 -0
- package/dist/nodes/Posty5Trigger/config.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/config.js +76 -0
- package/dist/nodes/Posty5Trigger/config.js.map +1 -0
- package/dist/nodes/Posty5Trigger/descriptions.d.ts +4 -0
- package/dist/nodes/Posty5Trigger/descriptions.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/descriptions.js +99 -0
- package/dist/nodes/Posty5Trigger/descriptions.js.map +1 -0
- package/dist/nodes/Posty5Trigger/helpers.d.ts +34 -0
- package/dist/nodes/Posty5Trigger/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/helpers.js +139 -0
- package/dist/nodes/Posty5Trigger/helpers.js.map +1 -0
- package/dist/package.json +78 -0
- package/dist/types/common.d.ts +70 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/link-analytics.types.d.ts +147 -0
- package/dist/types/link-analytics.types.d.ts.map +1 -0
- package/dist/types/link-analytics.types.js +10 -0
- package/dist/types/link-analytics.types.js.map +1 -0
- package/dist/types/link-bulk.types.d.ts +68 -0
- package/dist/types/link-bulk.types.d.ts.map +1 -0
- package/dist/types/link-bulk.types.js +8 -0
- package/dist/types/link-bulk.types.js.map +1 -0
- package/dist/types/qr-code.types.d.ts +252 -56
- package/dist/types/qr-code.types.d.ts.map +1 -1
- package/dist/types/short-link-controls.types.d.ts +82 -0
- package/dist/types/short-link-controls.types.d.ts.map +1 -0
- package/dist/types/short-link-controls.types.js +7 -0
- package/dist/types/short-link-controls.types.js.map +1 -0
- package/dist/types/short-link.types.d.ts +63 -15
- package/dist/types/short-link.types.d.ts.map +1 -1
- package/dist/types/store.types.d.ts +71 -0
- package/dist/types/store.types.d.ts.map +1 -0
- package/dist/types/store.types.js +7 -0
- package/dist/types/store.types.js.map +1 -0
- package/dist/types/webhook.types.d.ts +66 -0
- package/dist/types/webhook.types.d.ts.map +1 -0
- package/dist/types/webhook.types.js +7 -0
- package/dist/types/webhook.types.js.map +1 -0
- package/dist/utils/analytics.helpers.d.ts +68 -0
- package/dist/utils/analytics.helpers.d.ts.map +1 -0
- package/dist/utils/analytics.helpers.js +202 -0
- package/dist/utils/analytics.helpers.js.map +1 -0
- package/dist/utils/analytics.properties.d.ts +10 -0
- package/dist/utils/analytics.properties.d.ts.map +1 -0
- package/dist/utils/analytics.properties.js +172 -0
- package/dist/utils/analytics.properties.js.map +1 -0
- package/dist/utils/api.helpers.d.ts +50 -3
- package/dist/utils/api.helpers.d.ts.map +1 -1
- package/dist/utils/api.helpers.js +170 -7
- package/dist/utils/api.helpers.js.map +1 -1
- package/dist/utils/constants.d.ts +239 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +260 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/date.helpers.d.ts +25 -0
- package/dist/utils/date.helpers.d.ts.map +1 -0
- package/dist/utils/date.helpers.js +65 -0
- package/dist/utils/date.helpers.js.map +1 -0
- package/dist/utils/link-bulk.helpers.d.ts +26 -0
- package/dist/utils/link-bulk.helpers.d.ts.map +1 -0
- package/dist/utils/link-bulk.helpers.js +135 -0
- package/dist/utils/link-bulk.helpers.js.map +1 -0
- package/dist/utils/link-bulk.properties.d.ts +9 -0
- package/dist/utils/link-bulk.properties.d.ts.map +1 -0
- package/dist/utils/link-bulk.properties.js +113 -0
- package/dist/utils/link-bulk.properties.js.map +1 -0
- package/dist/utils/link-tool.helpers.d.ts +43 -0
- package/dist/utils/link-tool.helpers.d.ts.map +1 -0
- package/dist/utils/link-tool.helpers.js +121 -0
- package/dist/utils/link-tool.helpers.js.map +1 -0
- package/dist/utils/post-comments.d.ts +43 -0
- package/dist/utils/post-comments.d.ts.map +1 -0
- package/dist/utils/post-comments.js +53 -0
- package/dist/utils/post-comments.js.map +1 -0
- package/dist/utils/qr-content.config.d.ts +66 -0
- package/dist/utils/qr-content.config.d.ts.map +1 -0
- package/dist/utils/qr-content.config.js +139 -0
- package/dist/utils/qr-content.config.js.map +1 -0
- package/dist/utils/qr-file.helpers.d.ts +22 -0
- package/dist/utils/qr-file.helpers.d.ts.map +1 -0
- package/dist/utils/qr-file.helpers.js +63 -0
- package/dist/utils/qr-file.helpers.js.map +1 -0
- package/dist/utils/qr-render.helpers.d.ts +48 -0
- package/dist/utils/qr-render.helpers.d.ts.map +1 -0
- package/dist/utils/qr-render.helpers.js +172 -0
- package/dist/utils/qr-render.helpers.js.map +1 -0
- package/dist/utils/qr-render.properties.d.ts +8 -0
- package/dist/utils/qr-render.properties.d.ts.map +1 -0
- package/dist/utils/qr-render.properties.js +143 -0
- package/dist/utils/qr-render.properties.js.map +1 -0
- package/dist/utils/qr-target.helpers.d.ts +35 -0
- package/dist/utils/qr-target.helpers.d.ts.map +1 -0
- package/dist/utils/qr-target.helpers.js +260 -0
- package/dist/utils/qr-target.helpers.js.map +1 -0
- package/dist/utils/qr-templates.helpers.d.ts +26 -0
- package/dist/utils/qr-templates.helpers.d.ts.map +1 -0
- package/dist/utils/qr-templates.helpers.js +70 -0
- package/dist/utils/qr-templates.helpers.js.map +1 -0
- package/dist/utils/short-link-controls.helpers.d.ts +31 -0
- package/dist/utils/short-link-controls.helpers.d.ts.map +1 -0
- package/dist/utils/short-link-controls.helpers.js +185 -0
- package/dist/utils/short-link-controls.helpers.js.map +1 -0
- package/dist/utils/short-link-controls.properties.d.ts +17 -0
- package/dist/utils/short-link-controls.properties.d.ts.map +1 -0
- package/dist/utils/short-link-controls.properties.js +315 -0
- package/dist/utils/short-link-controls.properties.js.map +1 -0
- package/dist/utils/store.helpers.d.ts +43 -0
- package/dist/utils/store.helpers.d.ts.map +1 -0
- package/dist/utils/store.helpers.js +87 -0
- package/dist/utils/store.helpers.js.map +1 -0
- package/dist/utils/versioned-write.helpers.d.ts +31 -0
- package/dist/utils/versioned-write.helpers.d.ts.map +1 -0
- package/dist/utils/versioned-write.helpers.js +120 -0
- package/dist/utils/versioned-write.helpers.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Upload of a `file` QR code's content from an n8n binary property, mirroring
|
|
4
|
+
* `@posty5/qr-code`'s `createFile` / `updateFile`:
|
|
5
|
+
* 1. `POST /api/qr-code/file/upload-url` `{ fileName, mimeType, sizeBytes }`
|
|
6
|
+
* → `{ uploadFileURL, bucketFilePath, expiresInSeconds }`;
|
|
7
|
+
* 2. `PUT` the bytes to `uploadFileURL` with the binary's MIME type and no
|
|
8
|
+
* Posty5 API key (the URL is a signed storage URL, not the Posty5 API);
|
|
9
|
+
* 3. the caller sends `qrCodeTarget.file.bucketFilePath` on create / update.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.uploadQrFile = uploadQrFile;
|
|
13
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
14
|
+
const api_helpers_1 = require("./api.helpers");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const link_tool_helpers_1 = require("./link-tool.helpers");
|
|
17
|
+
const qr_content_config_1 = require("./qr-content.config");
|
|
18
|
+
/**
|
|
19
|
+
* Reads the binary at `binaryProperty` of item `itemIndex`, checks its type and
|
|
20
|
+
* size against the API's limits (before any request), then runs steps 1-2.
|
|
21
|
+
* `fileName` overrides the binary's own file name.
|
|
22
|
+
*/
|
|
23
|
+
async function uploadQrFile(ctx, apiKey, itemIndex, binaryProperty, fileName) {
|
|
24
|
+
const config = qr_content_config_1.QR_CONTENT_CONFIG.file;
|
|
25
|
+
const binary = ctx.getInputData()[itemIndex]?.binary?.[binaryProperty];
|
|
26
|
+
if (!binary) {
|
|
27
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), qr_content_config_1.QR_FILE_MESSAGES.binaryMissing(binaryProperty), { itemIndex });
|
|
28
|
+
}
|
|
29
|
+
const mimeType = (0, link_tool_helpers_1.toText)(binary.mimeType).split(';')[0].trim().toLowerCase();
|
|
30
|
+
if (!config.mimeTypes.includes(mimeType)) {
|
|
31
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), qr_content_config_1.QR_FILE_MESSAGES.mimeNotAllowed(mimeType), { itemIndex });
|
|
32
|
+
}
|
|
33
|
+
const buffer = await ctx.helpers.getBinaryDataBuffer(itemIndex, binaryProperty);
|
|
34
|
+
const sizeBytes = buffer.length;
|
|
35
|
+
if (!sizeBytes)
|
|
36
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), qr_content_config_1.QR_FILE_MESSAGES.empty, { itemIndex });
|
|
37
|
+
if (sizeBytes > config.maxUploadBytes) {
|
|
38
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), qr_content_config_1.QR_FILE_MESSAGES.tooLarge(config.maxUploadBytes / (1024 * 1024)), { itemIndex });
|
|
39
|
+
}
|
|
40
|
+
const name = ((0, link_tool_helpers_1.toText)(fileName).trim() || (0, link_tool_helpers_1.toText)(binary.fileName).trim() || config.fallbackFileName).slice(0, config.fileNameMax);
|
|
41
|
+
const request = { fileName: name, mimeType, sizeBytes };
|
|
42
|
+
const ticket = (await api_helpers_1.makeApiRequest.call(ctx, apiKey, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
endpoint: `${constants_1.API_ENDPOINTS.QR_CODE}${config.uploadUrlPath}`,
|
|
45
|
+
body: request,
|
|
46
|
+
// The upload-url schema takes exactly fileName, mimeType and sizeBytes.
|
|
47
|
+
stampCreatedFrom: false,
|
|
48
|
+
}));
|
|
49
|
+
try {
|
|
50
|
+
await ctx.helpers.httpRequest({
|
|
51
|
+
method: 'PUT',
|
|
52
|
+
url: ticket.uploadFileURL,
|
|
53
|
+
body: buffer,
|
|
54
|
+
headers: { 'Content-Type': mimeType },
|
|
55
|
+
json: false,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw (0, api_helpers_1.toPosty5ApiError)(error);
|
|
60
|
+
}
|
|
61
|
+
return { bucketFilePath: ticket.bucketFilePath, fileName: name };
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=qr-file.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-file.helpers.js","sourceRoot":"","sources":["../../utils/qr-file.helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAoBH,oCAuDC;AAzED,+CAA0E;AAC1E,+CAAiE;AACjE,2CAA4C;AAC5C,2DAA6C;AAC7C,2DAA0E;AAS1E;;;;GAIG;AACI,KAAK,UAAU,YAAY,CACjC,GAAsB,EACtB,MAAc,EACd,SAAiB,EACjB,cAAsB,EACtB,QAAiB;IAEjB,MAAM,MAAM,GAAG,qCAAiB,CAAC,IAAI,CAAC;IACtC,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,cAAc,CAAC,CAAC;IACvE,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,oCAAgB,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IA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AAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAClF,MAAM,MAAM,GAAG,CAAC,MAAM,4BAAc,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE;QACtD,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,GAAG,yBAAa,CAAC,OAAO,GAAG,MAAM,CAAC,aAAa,EAAE;QAC3D,IAAI,EAAE,OAAO;QACb,wEAAwE;QACxE,gBAAgB,EAAE,KAAK;KACvB,CAAC,CAA4B,CAAC;IAE/B,IAAI,CAAC;QACJ,MAAM,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC;YAC7B,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,MAAM,CAAC,aAAa;YACzB,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE;YACrC,IAAI,EAAE,KAAK;SACX,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAA,8BAAgB,EAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QR Code *Render*, *Check Scannability* and *List Templates* (QR design and
|
|
3
|
+
* export, K6/K7), mirroring `@posty5/qr-code`'s `render`, `checkScannability`
|
|
4
|
+
* and the template lookups:
|
|
5
|
+
* - Render: `GET /api/qr-code/:id/render?format&presetId&customMm&dpi&sizePx&download`
|
|
6
|
+
* → the file, emitted as an n8n binary property;
|
|
7
|
+
* - Check Scannability: `POST /api/qr-code/scannability-check` → the K5 report;
|
|
8
|
+
* - List Templates: `GET /api/qr-code-template/user-lookup|public-lookup` → `{ _id, name }` rows.
|
|
9
|
+
*/
|
|
10
|
+
import { type IExecuteFunctions, type ILoadOptionsFunctions, type INodeExecutionData, type INodePropertyOptions } from 'n8n-workflow';
|
|
11
|
+
import type { IQRCodeRenderQuery, IQRCodeScannabilityReport, IQRCodeScannabilityRequest, IQRCodeTemplateLookupItem, IQRPrintPreset } from '../types/qr-code.types';
|
|
12
|
+
/** Reads one node parameter of the current item (`getNodeParameter` bound to an index). */
|
|
13
|
+
type ParameterReader = (name: string, fallback?: unknown) => unknown;
|
|
14
|
+
/**
|
|
15
|
+
* `loadOptions` for the Print Preset field: "None" (size in pixels), then the
|
|
16
|
+
* design catalogue's presets. The catalogue route is public, but the request
|
|
17
|
+
* still carries the API key like every other call.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getQrPrintPresets(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
20
|
+
/** `table-tent-8cm` (80 mm) → "Table Tent 8cm (80 mm)"; `custom` → "Custom (20–500 mm)". */
|
|
21
|
+
export declare function toPresetOption(preset: IQRPrintPreset): INodePropertyOptions;
|
|
22
|
+
/**
|
|
23
|
+
* The render query. A preset sends `presetId` (+ `customMm` for custom, + `dpi`
|
|
24
|
+
* for PNG); no preset sends `sizePx` for PNG and SVG. PDF with no preset sends
|
|
25
|
+
* neither (the API uses `flyer-5cm`). Throws on an unknown format, before any request.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildQrRenderQuery(read: ParameterReader): IQRCodeRenderQuery;
|
|
28
|
+
/**
|
|
29
|
+
* *Render* for one item: the file as binary property `renderBinaryProperty`
|
|
30
|
+
* (default `data`), the request's facts as json. The input item's other binary
|
|
31
|
+
* properties are carried over, so a chain keeps its earlier files.
|
|
32
|
+
*/
|
|
33
|
+
export declare function executeQrRender(ctx: IExecuteFunctions, apiKey: string, itemIndex: number): Promise<INodeExecutionData>;
|
|
34
|
+
/**
|
|
35
|
+
* The scannability-check body for one saved source: a QR code (as rendered,
|
|
36
|
+
* its template wins) or a template (yours or public, with optional sample
|
|
37
|
+
* text). A preset adds the module-size-in-mm check. Throws when the ID is empty.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildQrScannabilityRequest(read: ParameterReader): IQRCodeScannabilityRequest;
|
|
40
|
+
/** *Check Scannability* for one item: the K5 report. */
|
|
41
|
+
export declare function executeQrScannabilityCheck(ctx: IExecuteFunctions, apiKey: string, itemIndex: number): Promise<IQRCodeScannabilityReport>;
|
|
42
|
+
/**
|
|
43
|
+
* *List Templates* for one item: one page of the caller's templates (`mine`)
|
|
44
|
+
* or Posty5's public ones, as `{ _id, name }` rows, filtered by Search.
|
|
45
|
+
*/
|
|
46
|
+
export declare function executeListQrTemplates(ctx: IExecuteFunctions, apiKey: string, itemIndex: number): Promise<IQRCodeTemplateLookupItem[]>;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=qr-render.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-render.helpers.d.ts","sourceRoot":"","sources":["../../utils/qr-render.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAEX,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EAGzB,cAAc,EACd,MAAM,wBAAwB,CAAC;AAEhC,2FAA2F;AAC3F,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;AAErE;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAWpG;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,oBAAoB,CAY3E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,kBAAkB,CAkB5E;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACpC,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,CAoC7B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,eAAe,GAAG,0BAA0B,CAuB5F;AAED,wDAAwD;AACxD,wBAAsB,0BAA0B,CAC/C,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,yBAAyB,CAAC,CASpC;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC3C,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAiBtC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QR Code *Render*, *Check Scannability* and *List Templates* (QR design and
|
|
4
|
+
* export, K6/K7), mirroring `@posty5/qr-code`'s `render`, `checkScannability`
|
|
5
|
+
* and the template lookups:
|
|
6
|
+
* - Render: `GET /api/qr-code/:id/render?format&presetId&customMm&dpi&sizePx&download`
|
|
7
|
+
* → the file, emitted as an n8n binary property;
|
|
8
|
+
* - Check Scannability: `POST /api/qr-code/scannability-check` → the K5 report;
|
|
9
|
+
* - List Templates: `GET /api/qr-code-template/user-lookup|public-lookup` → `{ _id, name }` rows.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getQrPrintPresets = getQrPrintPresets;
|
|
13
|
+
exports.toPresetOption = toPresetOption;
|
|
14
|
+
exports.buildQrRenderQuery = buildQrRenderQuery;
|
|
15
|
+
exports.executeQrRender = executeQrRender;
|
|
16
|
+
exports.buildQrScannabilityRequest = buildQrScannabilityRequest;
|
|
17
|
+
exports.executeQrScannabilityCheck = executeQrScannabilityCheck;
|
|
18
|
+
exports.executeListQrTemplates = executeListQrTemplates;
|
|
19
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
20
|
+
const api_helpers_1 = require("./api.helpers");
|
|
21
|
+
const constants_1 = require("./constants");
|
|
22
|
+
const link_tool_helpers_1 = require("./link-tool.helpers");
|
|
23
|
+
/**
|
|
24
|
+
* `loadOptions` for the Print Preset field: "None" (size in pixels), then the
|
|
25
|
+
* design catalogue's presets. The catalogue route is public, but the request
|
|
26
|
+
* still carries the API key like every other call.
|
|
27
|
+
*/
|
|
28
|
+
async function getQrPrintPresets() {
|
|
29
|
+
const credentials = await this.getCredentials('posty5Api');
|
|
30
|
+
const catalogue = (await api_helpers_1.makeApiRequest.call(this, credentials.apiKey, {
|
|
31
|
+
method: 'GET',
|
|
32
|
+
endpoint: `${constants_1.API_ENDPOINTS.QR_CODE_TEMPLATE}${constants_1.QR_RENDER.CATALOGUE_PATH}`,
|
|
33
|
+
}));
|
|
34
|
+
return [
|
|
35
|
+
{ name: constants_1.QR_RENDER.NO_PRESET_LABEL, value: '' },
|
|
36
|
+
...(catalogue?.printPresets || []).filter((preset) => (0, link_tool_helpers_1.firstText)(preset?.id)).map(toPresetOption),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
/** `table-tent-8cm` (80 mm) → "Table Tent 8cm (80 mm)"; `custom` → "Custom (20–500 mm)". */
|
|
40
|
+
function toPresetOption(preset) {
|
|
41
|
+
const label = preset.id
|
|
42
|
+
.split('-')
|
|
43
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
44
|
+
.join(' ');
|
|
45
|
+
const size = typeof preset.mm === 'number'
|
|
46
|
+
? `${preset.mm} mm`
|
|
47
|
+
: typeof preset.minMm === 'number' && typeof preset.maxMm === 'number'
|
|
48
|
+
? `${preset.minMm}–${preset.maxMm} mm`
|
|
49
|
+
: '';
|
|
50
|
+
return { name: size ? `${label} (${size})` : label, value: preset.id };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The render query. A preset sends `presetId` (+ `customMm` for custom, + `dpi`
|
|
54
|
+
* for PNG); no preset sends `sizePx` for PNG and SVG. PDF with no preset sends
|
|
55
|
+
* neither (the API uses `flyer-5cm`). Throws on an unknown format, before any request.
|
|
56
|
+
*/
|
|
57
|
+
function buildQrRenderQuery(read) {
|
|
58
|
+
const format = (0, link_tool_helpers_1.toText)(read('renderFormat', constants_1.QR_RENDER.DEFAULT_FORMAT)).trim().toLowerCase();
|
|
59
|
+
if (!constants_1.QR_RENDER.FORMATS.includes(format)) {
|
|
60
|
+
throw new Error(constants_1.QR_RENDER_MESSAGES.unknownFormat(format));
|
|
61
|
+
}
|
|
62
|
+
const query = { format, download: constants_1.QR_RENDER.DOWNLOAD_FLAG };
|
|
63
|
+
const presetId = (0, link_tool_helpers_1.toText)(read('presetId', '')).trim();
|
|
64
|
+
if (presetId) {
|
|
65
|
+
query.presetId = presetId;
|
|
66
|
+
if (presetId === constants_1.QR_RENDER.CUSTOM_PRESET_ID) {
|
|
67
|
+
query.customMm = Number(read('customMm', constants_1.QR_RENDER.DEFAULT_CUSTOM_MM));
|
|
68
|
+
}
|
|
69
|
+
if (format === 'png')
|
|
70
|
+
query.dpi = Number(read('dpi', constants_1.QR_RENDER.DEFAULT_DPI));
|
|
71
|
+
}
|
|
72
|
+
else if (format !== 'pdf') {
|
|
73
|
+
query.sizePx = Number(read('sizePx', constants_1.QR_RENDER.DEFAULT_SIZE_PX));
|
|
74
|
+
}
|
|
75
|
+
return query;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* *Render* for one item: the file as binary property `renderBinaryProperty`
|
|
79
|
+
* (default `data`), the request's facts as json. The input item's other binary
|
|
80
|
+
* properties are carried over, so a chain keeps its earlier files.
|
|
81
|
+
*/
|
|
82
|
+
async function executeQrRender(ctx, apiKey, itemIndex) {
|
|
83
|
+
const read = (name, fallback) => ctx.getNodeParameter(name, itemIndex, fallback);
|
|
84
|
+
const qrCodeId = (0, link_tool_helpers_1.toText)(read('qrCodeId', '')).trim();
|
|
85
|
+
if (!qrCodeId) {
|
|
86
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), constants_1.QR_RENDER_MESSAGES.idRequired('QR Code ID'), { itemIndex });
|
|
87
|
+
}
|
|
88
|
+
const query = buildQrRenderQuery(read);
|
|
89
|
+
const binaryProperty = (0, link_tool_helpers_1.toText)(read('renderBinaryProperty', constants_1.QR_RENDER.DEFAULT_BINARY_PROPERTY)).trim() ||
|
|
90
|
+
constants_1.QR_RENDER.DEFAULT_BINARY_PROPERTY;
|
|
91
|
+
const file = await api_helpers_1.makeBinaryApiRequest.call(ctx, apiKey, `${constants_1.API_ENDPOINTS.QR_CODE}/${encodeURIComponent(qrCodeId)}/${constants_1.QR_RENDER.RENDER_PATH_SEGMENT}`, query);
|
|
92
|
+
const mimeType = file.mimeType || constants_1.QR_RENDER.MIME_TYPES[query.format];
|
|
93
|
+
const fileName = file.fileName || `${constants_1.QR_RENDER.FALLBACK_FILE_NAME_PREFIX}${qrCodeId}.${query.format}`;
|
|
94
|
+
const binaryData = await ctx.helpers.prepareBinaryData(file.data, fileName, mimeType);
|
|
95
|
+
const json = {
|
|
96
|
+
qrCodeId,
|
|
97
|
+
format: query.format,
|
|
98
|
+
presetId: query.presetId ?? null,
|
|
99
|
+
fileName,
|
|
100
|
+
mimeType,
|
|
101
|
+
fileSize: file.data.length,
|
|
102
|
+
binaryProperty,
|
|
103
|
+
};
|
|
104
|
+
const inputBinary = ctx.getInputData()[itemIndex]?.binary || {};
|
|
105
|
+
return {
|
|
106
|
+
json: json,
|
|
107
|
+
binary: { ...inputBinary, [binaryProperty]: binaryData },
|
|
108
|
+
pairedItem: { item: itemIndex },
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The scannability-check body for one saved source: a QR code (as rendered,
|
|
113
|
+
* its template wins) or a template (yours or public, with optional sample
|
|
114
|
+
* text). A preset adds the module-size-in-mm check. Throws when the ID is empty.
|
|
115
|
+
*/
|
|
116
|
+
function buildQrScannabilityRequest(read) {
|
|
117
|
+
const source = (0, link_tool_helpers_1.toText)(read('scannabilitySource', 'qrCode'));
|
|
118
|
+
const body = {};
|
|
119
|
+
if (source === 'template') {
|
|
120
|
+
const templateId = (0, link_tool_helpers_1.firstText)(read('scannabilityTemplateId', ''));
|
|
121
|
+
if (!templateId)
|
|
122
|
+
throw new Error(constants_1.QR_RENDER_MESSAGES.idRequired('Template'));
|
|
123
|
+
body.templateId = templateId;
|
|
124
|
+
const text = (0, link_tool_helpers_1.firstText)(read('sampleText', ''));
|
|
125
|
+
if (text)
|
|
126
|
+
body.text = text;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const qrCodeId = (0, link_tool_helpers_1.firstText)(read('qrCodeId', ''));
|
|
130
|
+
if (!qrCodeId)
|
|
131
|
+
throw new Error(constants_1.QR_RENDER_MESSAGES.idRequired('QR Code ID'));
|
|
132
|
+
body.qrCodeId = qrCodeId;
|
|
133
|
+
}
|
|
134
|
+
const presetId = (0, link_tool_helpers_1.firstText)(read('presetId', ''));
|
|
135
|
+
if (presetId) {
|
|
136
|
+
body.presetId = presetId;
|
|
137
|
+
if (presetId === constants_1.QR_RENDER.CUSTOM_PRESET_ID) {
|
|
138
|
+
body.customMm = Number(read('customMm', constants_1.QR_RENDER.DEFAULT_CUSTOM_MM));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return body;
|
|
142
|
+
}
|
|
143
|
+
/** *Check Scannability* for one item: the K5 report. */
|
|
144
|
+
async function executeQrScannabilityCheck(ctx, apiKey, itemIndex) {
|
|
145
|
+
const body = buildQrScannabilityRequest((name, fallback) => ctx.getNodeParameter(name, itemIndex, fallback));
|
|
146
|
+
return (await api_helpers_1.makeApiRequest.call(ctx, apiKey, {
|
|
147
|
+
method: 'POST',
|
|
148
|
+
endpoint: `${constants_1.API_ENDPOINTS.QR_CODE}${constants_1.QR_RENDER.SCANNABILITY_PATH}`,
|
|
149
|
+
body,
|
|
150
|
+
// The check's schema refuses unknown keys.
|
|
151
|
+
stampCreatedFrom: false,
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* *List Templates* for one item: one page of the caller's templates (`mine`)
|
|
156
|
+
* or Posty5's public ones, as `{ _id, name }` rows, filtered by Search.
|
|
157
|
+
*/
|
|
158
|
+
async function executeListQrTemplates(ctx, apiKey, itemIndex) {
|
|
159
|
+
const scope = (0, link_tool_helpers_1.toText)(ctx.getNodeParameter('templateScope', itemIndex, 'mine'));
|
|
160
|
+
const term = (0, link_tool_helpers_1.firstText)(ctx.getNodeParameter('templateSearch', itemIndex, ''));
|
|
161
|
+
const limit = Number(ctx.getNodeParameter('templateLimit', itemIndex, constants_1.QR_RENDER.LIST_TEMPLATES_DEFAULT_LIMIT));
|
|
162
|
+
const path = scope === 'public' ? constants_1.QR_TEMPLATE_LOOKUP.PUBLIC_PATH : constants_1.QR_TEMPLATE_LOOKUP.USER_PATH;
|
|
163
|
+
const page = (await api_helpers_1.makeApiRequest.call(ctx, apiKey, {
|
|
164
|
+
method: 'GET',
|
|
165
|
+
endpoint: `${constants_1.API_ENDPOINTS.QR_CODE_TEMPLATE}${path}`,
|
|
166
|
+
qs: { page: 1, pageSize: limit, ...(term ? { term } : {}) },
|
|
167
|
+
}));
|
|
168
|
+
return (page?.items || [])
|
|
169
|
+
.filter((template) => (0, link_tool_helpers_1.firstText)(template?._id))
|
|
170
|
+
.map((template) => ({ _id: template._id, name: (0, link_tool_helpers_1.firstText)(template.name) }));
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=qr-render.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-render.helpers.js","sourceRoot":"","sources":["../../utils/qr-render.helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AA+BH,8CAWC;AAGD,wCAYC;AAOD,gDAkBC;AAOD,0CAwCC;AAOD,gEAuB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E,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,IAAA,6BAAS,EAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The QR Code node's *Render*, *Check Scannability* and *List Templates*
|
|
3
|
+
* parameters (the QR Code ID field is the node's own, shown for Render too).
|
|
4
|
+
* Read by `qr-render.helpers.ts`.
|
|
5
|
+
*/
|
|
6
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
7
|
+
export declare const QR_RENDER_PROPERTIES: INodeProperties[];
|
|
8
|
+
//# sourceMappingURL=qr-render.properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-render.properties.d.ts","sourceRoot":"","sources":["../../utils/qr-render.properties.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAOpD,eAAO,MAAM,oBAAoB,EAAE,eAAe,EAsIjD,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The QR Code node's *Render*, *Check Scannability* and *List Templates*
|
|
4
|
+
* parameters (the QR Code ID field is the node's own, shown for Render too).
|
|
5
|
+
* Read by `qr-render.helpers.ts`.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.QR_RENDER_PROPERTIES = void 0;
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
const SHOW_ON_RENDER = { show: { operation: ['render'] } };
|
|
11
|
+
const SHOW_ON_CHECK = { show: { operation: ['checkScannability'] } };
|
|
12
|
+
const SHOW_ON_LIST_TEMPLATES = { show: { operation: ['listTemplates'] } };
|
|
13
|
+
exports.QR_RENDER_PROPERTIES = [
|
|
14
|
+
// Check Scannability: which saved design to check
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Source',
|
|
17
|
+
name: 'scannabilitySource',
|
|
18
|
+
type: 'options',
|
|
19
|
+
noDataExpression: true,
|
|
20
|
+
displayOptions: SHOW_ON_CHECK,
|
|
21
|
+
options: [
|
|
22
|
+
{ name: 'QR Code', value: 'qrCode', description: 'A saved QR code, as it renders (its template wins)' },
|
|
23
|
+
{ name: 'Template', value: 'template', description: 'One of your templates, or a public one' },
|
|
24
|
+
],
|
|
25
|
+
default: 'qrCode',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
displayName: 'QR Code ID',
|
|
29
|
+
name: 'qrCodeId',
|
|
30
|
+
type: 'string',
|
|
31
|
+
required: true,
|
|
32
|
+
displayOptions: { show: { operation: ['checkScannability'], scannabilitySource: ['qrCode'] } },
|
|
33
|
+
default: '',
|
|
34
|
+
description: 'The ID of the QR code',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
displayName: 'Template Name or ID',
|
|
38
|
+
name: 'scannabilityTemplateId',
|
|
39
|
+
type: 'options',
|
|
40
|
+
required: true,
|
|
41
|
+
typeOptions: { loadOptionsMethod: 'getQrTemplates' },
|
|
42
|
+
displayOptions: { show: { operation: ['checkScannability'], scannabilitySource: ['template'] } },
|
|
43
|
+
default: '',
|
|
44
|
+
description: 'The template to check. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
displayName: 'Sample Text',
|
|
48
|
+
name: 'sampleText',
|
|
49
|
+
type: 'string',
|
|
50
|
+
displayOptions: { show: { operation: ['checkScannability'], scannabilitySource: ['template'] } },
|
|
51
|
+
default: '',
|
|
52
|
+
description: 'The content to check the template with. Empty uses a representative Posty5 QR URL.',
|
|
53
|
+
},
|
|
54
|
+
// Render: the file
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Format',
|
|
57
|
+
name: 'renderFormat',
|
|
58
|
+
type: 'options',
|
|
59
|
+
displayOptions: SHOW_ON_RENDER,
|
|
60
|
+
options: [
|
|
61
|
+
{ name: 'PNG', value: 'png', description: 'Raster image (every plan, up to 2048 px)' },
|
|
62
|
+
{ name: 'SVG', value: 'svg', description: 'Vector image (paid plans)' },
|
|
63
|
+
{ name: 'PDF', value: 'pdf', description: 'Print-ready PDF at the preset size (paid plans)' },
|
|
64
|
+
],
|
|
65
|
+
default: constants_1.QR_RENDER.DEFAULT_FORMAT,
|
|
66
|
+
},
|
|
67
|
+
// Render and Check Scannability: the print size
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Print Preset Name or ID',
|
|
70
|
+
name: 'presetId',
|
|
71
|
+
type: 'options',
|
|
72
|
+
typeOptions: { loadOptionsMethod: 'getQrPrintPresets' },
|
|
73
|
+
displayOptions: { show: { operation: ['render', 'checkScannability'] } },
|
|
74
|
+
default: '',
|
|
75
|
+
description: 'Print size. On Render a preset, a DPI, SVG, PDF or a PNG over 2048 px need a paid plan; PDF with no preset prints at Flyer 5cm. On Check Scannability a preset adds the module size in mm. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
displayName: 'Custom Width (Mm)',
|
|
79
|
+
name: 'customMm',
|
|
80
|
+
type: 'number',
|
|
81
|
+
displayOptions: { show: { operation: ['render', 'checkScannability'], presetId: [constants_1.QR_RENDER.CUSTOM_PRESET_ID] } },
|
|
82
|
+
typeOptions: { minValue: constants_1.QR_RENDER.CUSTOM_MM_MIN, maxValue: constants_1.QR_RENDER.CUSTOM_MM_MAX },
|
|
83
|
+
default: constants_1.QR_RENDER.DEFAULT_CUSTOM_MM,
|
|
84
|
+
description: 'Printed width of the QR code for the Custom preset',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
displayName: 'DPI',
|
|
88
|
+
name: 'dpi',
|
|
89
|
+
type: 'options',
|
|
90
|
+
displayOptions: { show: { operation: ['render'], renderFormat: ['png'] }, hide: { presetId: [''] } },
|
|
91
|
+
options: constants_1.QR_RENDER.DPI_VALUES.map((dpi) => ({ name: String(dpi), value: dpi })),
|
|
92
|
+
default: constants_1.QR_RENDER.DEFAULT_DPI,
|
|
93
|
+
description: 'PNG resolution at the print preset',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
displayName: 'Size (Px)',
|
|
97
|
+
name: 'sizePx',
|
|
98
|
+
type: 'number',
|
|
99
|
+
displayOptions: { show: { operation: ['render'], renderFormat: ['png', 'svg'], presetId: [''] } },
|
|
100
|
+
typeOptions: { minValue: constants_1.QR_RENDER.SIZE_PX_MIN, maxValue: constants_1.QR_RENDER.SIZE_PX_MAX },
|
|
101
|
+
default: constants_1.QR_RENDER.DEFAULT_SIZE_PX,
|
|
102
|
+
description: 'Width in pixels when no print preset is chosen. Over 2048 needs a paid plan.',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
displayName: 'Put Output File in Field',
|
|
106
|
+
name: 'renderBinaryProperty',
|
|
107
|
+
type: 'string',
|
|
108
|
+
required: true,
|
|
109
|
+
displayOptions: SHOW_ON_RENDER,
|
|
110
|
+
default: constants_1.QR_RENDER.DEFAULT_BINARY_PROPERTY,
|
|
111
|
+
hint: 'The name of the output binary field to put the file in',
|
|
112
|
+
},
|
|
113
|
+
// List Templates
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Scope',
|
|
116
|
+
name: 'templateScope',
|
|
117
|
+
type: 'options',
|
|
118
|
+
displayOptions: SHOW_ON_LIST_TEMPLATES,
|
|
119
|
+
options: [
|
|
120
|
+
{ name: 'My Templates', value: 'mine', description: 'Templates you created' },
|
|
121
|
+
{ name: 'Public Templates', value: 'public', description: "Posty5's public templates (any is a valid Template ID)" },
|
|
122
|
+
],
|
|
123
|
+
default: 'mine',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
displayName: 'Search',
|
|
127
|
+
name: 'templateSearch',
|
|
128
|
+
type: 'string',
|
|
129
|
+
displayOptions: SHOW_ON_LIST_TEMPLATES,
|
|
130
|
+
default: '',
|
|
131
|
+
description: 'Only templates whose name contains this text',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Limit',
|
|
135
|
+
name: 'templateLimit',
|
|
136
|
+
type: 'number',
|
|
137
|
+
displayOptions: SHOW_ON_LIST_TEMPLATES,
|
|
138
|
+
typeOptions: { minValue: 1, maxValue: constants_1.QR_RENDER.LIST_TEMPLATES_MAX_LIMIT },
|
|
139
|
+
default: constants_1.QR_RENDER.LIST_TEMPLATES_DEFAULT_LIMIT,
|
|
140
|
+
description: 'Max number of results to return',
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
//# sourceMappingURL=qr-render.properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-render.properties.js","sourceRoot":"","sources":["../../utils/qr-render.properties.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,2CAAwC;AAExC,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;AAC3D,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAC;AACrE,MAAM,sBAAsB,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;AAE7D,QAAA,oBAAoB,GAAsB;IACtD,kDAAkD;IAClD;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,aAAa;QAC7B,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,oDAAoD,EAAE;YACvG,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,E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E,8CAA8C;KAC3D;IACD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE,sBAAsB;QACtC,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,qBAAS,CAAC,wBAAwB,EAAE;QAC1E,OAAO,EAAE,qBAAS,CAAC,4BAA4B;QAC/C,WAAW,EAAE,iCAAiC;KAC9C;CACD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `qrCodeTarget` for the QR Code node.
|
|
3
|
+
*
|
|
4
|
+
* The API reads a QR code's content from `qrCodeTarget: { type, [type]: {...} }`
|
|
5
|
+
* and nowhere else. The node builds no `options.text`: the server encodes the
|
|
6
|
+
* target itself, so the stored text is always the one its safety checks saw.
|
|
7
|
+
*/
|
|
8
|
+
import type { IQRCodeAccess, IQRCodeScanRulesParameter, IQRCodeTarget, QrCodeMode, QrParameterReader } from '../types/qr-code.types';
|
|
9
|
+
/**
|
|
10
|
+
* `dynamic` when the target has no static form — an `appStore` or `file` code,
|
|
11
|
+
* or `social` with more than one profile — so the node sends `mode: dynamic`
|
|
12
|
+
* whatever Mode says (the API answers 400 to a static one); else `undefined`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function requiredQrMode(target: IQRCodeTarget): QrCodeMode | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The `qrCodeTarget` for one QR type, read from that type's node fields.
|
|
17
|
+
* Optional values left empty (email subject/body, SMS message, WiFi password)
|
|
18
|
+
* are not sent; an open network never sends a password.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildQrCodeTarget(qrType: string, read: QrParameterReader): IQRCodeTarget;
|
|
21
|
+
/**
|
|
22
|
+
* A Mode parameter value as the API takes it: `static`, `dynamic`, or
|
|
23
|
+
* `undefined` for anything else (an empty "Keep Current", or an expression that
|
|
24
|
+
* resolved to an empty string), so the caller sends no `mode` at all.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readQrMode(value: unknown): QrCodeMode | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The `access` body value from the Scan Rules collection:
|
|
29
|
+
* - `undefined`: nothing set, send no `access` (Update keeps the stored rules);
|
|
30
|
+
* - `null`: Clear Scan Rules is on, send `access: null`;
|
|
31
|
+
* - otherwise the rules object, which replaces the stored rules as a whole.
|
|
32
|
+
* Empty values (including expressions that resolve to '') are skipped.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildQrAccess(rules: IQRCodeScanRulesParameter | undefined): IQRCodeAccess | null | undefined;
|
|
35
|
+
//# sourceMappingURL=qr-target.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-target.helpers.d.ts","sourceRoot":"","sources":["../../utils/qr-target.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAiBX,aAAa,EACb,yBAAyB,EAEzB,aAAa,EAEb,UAAU,EACV,iBAAiB,EACjB,MAAM,wBAAwB,CAAC;AAwFhC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,UAAU,GAAG,SAAS,CAM5E;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,aAAa,CAyGxF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAGjE;AAYD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,yBAAyB,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,GAAG,SAAS,CAe5G"}
|