@posty5/n8n-nodes-posty5 4.2.0 → 5.0.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 +351 -15
- 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 +6 -0
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.d.ts.map +1 -1
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.js +850 -189
- 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 +62 -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 +189 -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 +36 -3
- package/dist/utils/api.helpers.d.ts.map +1 -1
- package/dist/utils/api.helpers.js +77 -7
- package/dist/utils/api.helpers.js.map +1 -1
- package/dist/utils/constants.d.ts +198 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +215 -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-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,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Option lists and limits of the QR content types (vCard, event, WhatsApp,
|
|
4
|
+
* review, social). They mirror the API's `QrContentConfig`
|
|
5
|
+
* (`link-tools-service/.../qr-code/qr-text.config.ts`) and the npm SDK's
|
|
6
|
+
* `QrCodeVCardPhoneKind` / `QrCodeReviewPlatform` / `QrCodeSocialPlatform`.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.QR_EVENT_TIMEZONES = exports.QR_CONTENT_LABELS = exports.QR_FILE_MESSAGES = exports.QR_CONTENT_CONFIG = void 0;
|
|
10
|
+
exports.toNodeOptions = toNodeOptions;
|
|
11
|
+
exports.QR_CONTENT_CONFIG = {
|
|
12
|
+
vcard: {
|
|
13
|
+
phoneKinds: ['mobile', 'work', 'home'],
|
|
14
|
+
defaultPhoneKind: 'mobile',
|
|
15
|
+
phonesMax: 3,
|
|
16
|
+
emailsMax: 2,
|
|
17
|
+
/** Separator of the Emails field (comma-separated → array). */
|
|
18
|
+
emailSeparator: ',',
|
|
19
|
+
},
|
|
20
|
+
event: {
|
|
21
|
+
defaultTimezone: 'UTC',
|
|
22
|
+
},
|
|
23
|
+
review: {
|
|
24
|
+
platforms: ['google', 'tripadvisor', 'trustpilot', 'yelp', 'facebook', 'other'],
|
|
25
|
+
/** The platform that takes a Place ID instead of a URL. */
|
|
26
|
+
placeIdPlatform: 'google',
|
|
27
|
+
},
|
|
28
|
+
social: {
|
|
29
|
+
platforms: [
|
|
30
|
+
'instagram',
|
|
31
|
+
'facebook',
|
|
32
|
+
'tiktok',
|
|
33
|
+
'x',
|
|
34
|
+
'youtube',
|
|
35
|
+
'linkedin',
|
|
36
|
+
'snapchat',
|
|
37
|
+
'telegram',
|
|
38
|
+
'threads',
|
|
39
|
+
'pinterest',
|
|
40
|
+
'other',
|
|
41
|
+
],
|
|
42
|
+
/** Profiles a static code may carry; more makes the code dynamic-only. */
|
|
43
|
+
maxProfilesStatic: 1,
|
|
44
|
+
/** Profiles a dynamic code may carry (API `maxProfilesDynamic`). */
|
|
45
|
+
maxProfilesDynamic: 12,
|
|
46
|
+
defaultPlatform: 'instagram',
|
|
47
|
+
},
|
|
48
|
+
/** Types with no static form: the node hides Mode and always sends `mode: dynamic`. */
|
|
49
|
+
dynamicOnlyTypes: ['appStore', 'file'],
|
|
50
|
+
/** Types *Create Many* cannot send (the bulk route refuses a `file` row: it needs an upload first). */
|
|
51
|
+
bulkExcludedTypes: ['file'],
|
|
52
|
+
file: {
|
|
53
|
+
/** Default binary property the file is read from. */
|
|
54
|
+
defaultBinaryProperty: 'data',
|
|
55
|
+
/** The API's default upload cap (`QR_FILE_MAX_UPLOAD_MB`, 10 MB); checked before any request. */
|
|
56
|
+
maxUploadBytes: 10 * 1024 * 1024,
|
|
57
|
+
fileNameMax: 120,
|
|
58
|
+
/** MIME types a `file` code accepts (API `QrFileConfig.mimeTypes`). */
|
|
59
|
+
mimeTypes: ['application/pdf', 'image/jpeg', 'image/png', 'image/webp'],
|
|
60
|
+
/** File name sent when neither the field nor the binary has one. */
|
|
61
|
+
fallbackFileName: 'file',
|
|
62
|
+
uploadUrlPath: '/file/upload-url',
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
/** Errors the QR Code node raises before calling the API for a `file` code. */
|
|
66
|
+
exports.QR_FILE_MESSAGES = {
|
|
67
|
+
binaryMissing: (property) => `No binary data in property "${property}" of the input item. Set Binary Property to the property holding the file.`,
|
|
68
|
+
tooLarge: (maxMb) => `The file is larger than ${maxMb} MB, the Posty5 limit for a file QR code.`,
|
|
69
|
+
empty: 'The file is empty.',
|
|
70
|
+
mimeNotAllowed: (mimeType) => `A file QR code takes a PDF, JPEG, PNG or WebP file, not "${mimeType || 'unknown'}".`,
|
|
71
|
+
notInBulk: 'File QR codes cannot be created with Create Many: use Create (the file is uploaded first).',
|
|
72
|
+
};
|
|
73
|
+
/** Display names of the option values above. */
|
|
74
|
+
exports.QR_CONTENT_LABELS = {
|
|
75
|
+
mobile: 'Mobile',
|
|
76
|
+
work: 'Work',
|
|
77
|
+
home: 'Home',
|
|
78
|
+
google: 'Google',
|
|
79
|
+
tripadvisor: 'Tripadvisor',
|
|
80
|
+
trustpilot: 'Trustpilot',
|
|
81
|
+
yelp: 'Yelp',
|
|
82
|
+
facebook: 'Facebook',
|
|
83
|
+
instagram: 'Instagram',
|
|
84
|
+
tiktok: 'TikTok',
|
|
85
|
+
x: 'X (Twitter)',
|
|
86
|
+
youtube: 'YouTube',
|
|
87
|
+
linkedin: 'LinkedIn',
|
|
88
|
+
snapchat: 'Snapchat',
|
|
89
|
+
telegram: 'Telegram',
|
|
90
|
+
threads: 'Threads',
|
|
91
|
+
pinterest: 'Pinterest',
|
|
92
|
+
other: 'Other',
|
|
93
|
+
};
|
|
94
|
+
/** A static IANA time-zone list for the Event Timezone field (any other zone can be typed via an expression). */
|
|
95
|
+
exports.QR_EVENT_TIMEZONES = [
|
|
96
|
+
'UTC',
|
|
97
|
+
'Africa/Cairo',
|
|
98
|
+
'Africa/Casablanca',
|
|
99
|
+
'Africa/Johannesburg',
|
|
100
|
+
'Africa/Lagos',
|
|
101
|
+
'Africa/Nairobi',
|
|
102
|
+
'America/Anchorage',
|
|
103
|
+
'America/Bogota',
|
|
104
|
+
'America/Chicago',
|
|
105
|
+
'America/Denver',
|
|
106
|
+
'America/Los_Angeles',
|
|
107
|
+
'America/Mexico_City',
|
|
108
|
+
'America/New_York',
|
|
109
|
+
'America/Sao_Paulo',
|
|
110
|
+
'America/Toronto',
|
|
111
|
+
'Asia/Baghdad',
|
|
112
|
+
'Asia/Bangkok',
|
|
113
|
+
'Asia/Dubai',
|
|
114
|
+
'Asia/Hong_Kong',
|
|
115
|
+
'Asia/Jakarta',
|
|
116
|
+
'Asia/Karachi',
|
|
117
|
+
'Asia/Kolkata',
|
|
118
|
+
'Asia/Riyadh',
|
|
119
|
+
'Asia/Seoul',
|
|
120
|
+
'Asia/Shanghai',
|
|
121
|
+
'Asia/Singapore',
|
|
122
|
+
'Asia/Tokyo',
|
|
123
|
+
'Australia/Melbourne',
|
|
124
|
+
'Australia/Sydney',
|
|
125
|
+
'Europe/Amsterdam',
|
|
126
|
+
'Europe/Berlin',
|
|
127
|
+
'Europe/Istanbul',
|
|
128
|
+
'Europe/London',
|
|
129
|
+
'Europe/Madrid',
|
|
130
|
+
'Europe/Moscow',
|
|
131
|
+
'Europe/Paris',
|
|
132
|
+
'Europe/Rome',
|
|
133
|
+
'Pacific/Auckland',
|
|
134
|
+
];
|
|
135
|
+
/** n8n option rows for a list of values. */
|
|
136
|
+
function toNodeOptions(values) {
|
|
137
|
+
return values.map((value) => ({ name: exports.QR_CONTENT_LABELS[value] ?? value, value }));
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=qr-content.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-content.config.js","sourceRoot":"","sources":["../../utils/qr-content.config.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAqIH,sCAEC;AArIY,QAAA,iBAAiB,GAAG;IAChC,KAAK,EAAE;QACN,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;QACtC,gBAAgB,EAAE,QAAQ;QAC1B,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC;QACZ,+DAA+D;QAC/D,cAAc,EAAE,GAAG;KACnB;IACD,KAAK,EAAE;QACN,eAAe,EAAE,KAAK;KACtB;IACD,MAAM,EAAE;QACP,SAAS,EAAE,CAAC,QAAQ,E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|
2
|
+
* Upload of a `file` QR code's content from an n8n binary property, mirroring
|
|
3
|
+
* `@posty5/qr-code`'s `createFile` / `updateFile`:
|
|
4
|
+
* 1. `POST /api/qr-code/file/upload-url` `{ fileName, mimeType, sizeBytes }`
|
|
5
|
+
* → `{ uploadFileURL, bucketFilePath, expiresInSeconds }`;
|
|
6
|
+
* 2. `PUT` the bytes to `uploadFileURL` with the binary's MIME type and no
|
|
7
|
+
* Posty5 API key (the URL is a signed storage URL, not the Posty5 API);
|
|
8
|
+
* 3. the caller sends `qrCodeTarget.file.bucketFilePath` on create / update.
|
|
9
|
+
*/
|
|
10
|
+
import { type IExecuteFunctions } from 'n8n-workflow';
|
|
11
|
+
/** What the upload produced: the path to send, and the file name the upload-url call used. */
|
|
12
|
+
export interface IQrFileUploadResult {
|
|
13
|
+
bucketFilePath: string;
|
|
14
|
+
fileName: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reads the binary at `binaryProperty` of item `itemIndex`, checks its type and
|
|
18
|
+
* size against the API's limits (before any request), then runs steps 1-2.
|
|
19
|
+
* `fileName` overrides the binary's own file name.
|
|
20
|
+
*/
|
|
21
|
+
export declare function uploadQrFile(ctx: IExecuteFunctions, apiKey: string, itemIndex: number, binaryProperty: string, fileName?: string): Promise<IQrFileUploadResult>;
|
|
22
|
+
//# sourceMappingURL=qr-file.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-file.helpers.d.ts","sourceRoot":"","sources":["../../utils/qr-file.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAO1E,8FAA8F;AAC9F,MAAM,WAAW,mBAAmB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CACjC,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,QAAQ,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAiD9B"}
|
|
@@ -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;IAC5G,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,0BAAM,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC5E,IAAI,CAAE,MAAM,CAAC,SAA+B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjE,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,oCAAgB,CAAC,cAAc,CAAC,QAA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,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,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"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `qrCodeTarget` for the QR Code node.
|
|
4
|
+
*
|
|
5
|
+
* The API reads a QR code's content from `qrCodeTarget: { type, [type]: {...} }`
|
|
6
|
+
* and nowhere else. The node builds no `options.text`: the server encodes the
|
|
7
|
+
* target itself, so the stored text is always the one its safety checks saw.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.requiredQrMode = requiredQrMode;
|
|
11
|
+
exports.buildQrCodeTarget = buildQrCodeTarget;
|
|
12
|
+
exports.readQrMode = readQrMode;
|
|
13
|
+
exports.buildQrAccess = buildQrAccess;
|
|
14
|
+
const constants_1 = require("./constants");
|
|
15
|
+
const link_tool_helpers_1 = require("./link-tool.helpers");
|
|
16
|
+
const qr_content_config_1 = require("./qr-content.config");
|
|
17
|
+
/** A coordinate as the API takes it: a number, or the text an expression produced. */
|
|
18
|
+
function toCoordinate(value) {
|
|
19
|
+
return typeof value === 'number' ? value : (0, link_tool_helpers_1.toText)(value).trim();
|
|
20
|
+
}
|
|
21
|
+
/** Sets `target[key]` to the trimmed text of `value`, or leaves it unset when empty. */
|
|
22
|
+
function setText(target, key, value) {
|
|
23
|
+
const text = (0, link_tool_helpers_1.toText)(value).trim();
|
|
24
|
+
if (text)
|
|
25
|
+
target[key] = text;
|
|
26
|
+
}
|
|
27
|
+
/** A boolean parameter, also accepting the text `"true"` an expression may produce. */
|
|
28
|
+
function readBoolean(value) {
|
|
29
|
+
return value === true || (0, link_tool_helpers_1.toText)(value).trim().toLowerCase() === 'true';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* An event date-time as the API takes it: an ISO string kept as typed (a
|
|
33
|
+
* wall-clock value is read in the event's timezone), a `Date` as ISO, or
|
|
34
|
+
* `undefined` when empty.
|
|
35
|
+
*/
|
|
36
|
+
function readEventDateTime(value) {
|
|
37
|
+
if (value instanceof Date)
|
|
38
|
+
return value.toISOString();
|
|
39
|
+
const text = (0, link_tool_helpers_1.toText)(value).trim();
|
|
40
|
+
return text || undefined;
|
|
41
|
+
}
|
|
42
|
+
/** The vCard target: empty fields are not sent; emails split on commas, at most the API's cap. */
|
|
43
|
+
function buildVCardTarget(read) {
|
|
44
|
+
const config = qr_content_config_1.QR_CONTENT_CONFIG.vcard;
|
|
45
|
+
const vcard = {};
|
|
46
|
+
setText(vcard, 'firstName', read('vcardFirstName', ''));
|
|
47
|
+
setText(vcard, 'lastName', read('vcardLastName', ''));
|
|
48
|
+
setText(vcard, 'organization', read('vcardOrganization', ''));
|
|
49
|
+
setText(vcard, 'jobTitle', read('vcardJobTitle', ''));
|
|
50
|
+
const phonesParameter = (read('vcardPhones', {}) ?? {});
|
|
51
|
+
const phones = (phonesParameter.phone ?? [])
|
|
52
|
+
.map((row) => ({
|
|
53
|
+
kind: ((0, link_tool_helpers_1.toText)(row.kind).trim() || config.defaultPhoneKind),
|
|
54
|
+
number: (0, link_tool_helpers_1.toText)(row.number).trim(),
|
|
55
|
+
}))
|
|
56
|
+
.filter((phone) => phone.number);
|
|
57
|
+
// Over the cap is sent as is: the API's 400 names the limit.
|
|
58
|
+
if (phones.length)
|
|
59
|
+
vcard.phones = phones;
|
|
60
|
+
const emailsValue = read('vcardEmails', '');
|
|
61
|
+
const emails = (Array.isArray(emailsValue) ? emailsValue : (0, link_tool_helpers_1.toText)(emailsValue).split(config.emailSeparator))
|
|
62
|
+
.map((email) => (0, link_tool_helpers_1.toText)(email).trim())
|
|
63
|
+
.filter(Boolean);
|
|
64
|
+
if (emails.length)
|
|
65
|
+
vcard.emails = emails;
|
|
66
|
+
setText(vcard, 'website', read('vcardWebsite', ''));
|
|
67
|
+
const addressParameter = (read('vcardAddress', {}) ?? {});
|
|
68
|
+
const address = {};
|
|
69
|
+
for (const key of ['street', 'city', 'region', 'postalCode', 'country']) {
|
|
70
|
+
setText(address, key, addressParameter[key]);
|
|
71
|
+
}
|
|
72
|
+
if (Object.keys(address).length)
|
|
73
|
+
vcard.address = address;
|
|
74
|
+
setText(vcard, 'note', read('vcardNote', ''));
|
|
75
|
+
return vcard;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The social target from the Profiles fixedCollection (up to 12 rows). Rows
|
|
79
|
+
* with neither a handle nor a URL are dropped; over the cap is sent as is (the
|
|
80
|
+
* API's 400 names the limit). `title` only when set.
|
|
81
|
+
*/
|
|
82
|
+
function buildSocialTarget(read) {
|
|
83
|
+
const parameter = (read('socialProfiles', {}) ?? {});
|
|
84
|
+
const profiles = [];
|
|
85
|
+
for (const row of parameter.profile ?? []) {
|
|
86
|
+
const profile = {
|
|
87
|
+
platform: ((0, link_tool_helpers_1.toText)(row.platform).trim() || qr_content_config_1.QR_CONTENT_CONFIG.social.defaultPlatform),
|
|
88
|
+
};
|
|
89
|
+
setText(profile, 'handle', row.handle);
|
|
90
|
+
setText(profile, 'url', row.url);
|
|
91
|
+
if (profile.handle || profile.url)
|
|
92
|
+
profiles.push(profile);
|
|
93
|
+
}
|
|
94
|
+
const social = { profiles };
|
|
95
|
+
setText(social, 'title', read('socialTitle', ''));
|
|
96
|
+
return social;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* `dynamic` when the target has no static form — an `appStore` or `file` code,
|
|
100
|
+
* or `social` with more than one profile — so the node sends `mode: dynamic`
|
|
101
|
+
* whatever Mode says (the API answers 400 to a static one); else `undefined`.
|
|
102
|
+
*/
|
|
103
|
+
function requiredQrMode(target) {
|
|
104
|
+
if (qr_content_config_1.QR_CONTENT_CONFIG.dynamicOnlyTypes.includes(target.type))
|
|
105
|
+
return 'dynamic';
|
|
106
|
+
if (target.type === 'social' && (target.social?.profiles.length ?? 0) > qr_content_config_1.QR_CONTENT_CONFIG.social.maxProfilesStatic) {
|
|
107
|
+
return 'dynamic';
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The `qrCodeTarget` for one QR type, read from that type's node fields.
|
|
113
|
+
* Optional values left empty (email subject/body, SMS message, WiFi password)
|
|
114
|
+
* are not sent; an open network never sends a password.
|
|
115
|
+
*/
|
|
116
|
+
function buildQrCodeTarget(qrType, read) {
|
|
117
|
+
switch (qrType) {
|
|
118
|
+
case 'url':
|
|
119
|
+
return { type: 'url', url: { url: (0, link_tool_helpers_1.toText)(read('url', '')).trim() } };
|
|
120
|
+
case 'freeText':
|
|
121
|
+
return { type: 'freeText', freeText: { text: (0, link_tool_helpers_1.toText)(read('text', '')) } };
|
|
122
|
+
case 'email': {
|
|
123
|
+
const email = { email: (0, link_tool_helpers_1.toText)(read('email', '')).trim() };
|
|
124
|
+
const subject = (0, link_tool_helpers_1.toText)(read('emailSubject', ''));
|
|
125
|
+
const body = (0, link_tool_helpers_1.toText)(read('emailBody', ''));
|
|
126
|
+
if (subject)
|
|
127
|
+
email.subject = subject;
|
|
128
|
+
if (body)
|
|
129
|
+
email.body = body;
|
|
130
|
+
return { type: 'email', email };
|
|
131
|
+
}
|
|
132
|
+
case 'wifi': {
|
|
133
|
+
const authenticationType = (0, link_tool_helpers_1.toText)(read('wifiAuthType', constants_1.QR_WIFI_AUTH.DEFAULT)) || constants_1.QR_WIFI_AUTH.DEFAULT;
|
|
134
|
+
const wifi = { name: (0, link_tool_helpers_1.toText)(read('wifiName', '')), authenticationType };
|
|
135
|
+
const password = authenticationType === constants_1.QR_WIFI_AUTH.OPEN_NETWORK ? '' : (0, link_tool_helpers_1.toText)(read('wifiPassword', ''));
|
|
136
|
+
if (password)
|
|
137
|
+
wifi.password = password;
|
|
138
|
+
return { type: 'wifi', wifi };
|
|
139
|
+
}
|
|
140
|
+
case 'call':
|
|
141
|
+
return { type: 'call', call: { phoneNumber: (0, link_tool_helpers_1.toText)(read('phoneNumber', '')).trim() } };
|
|
142
|
+
case 'sms': {
|
|
143
|
+
const sms = { phoneNumber: (0, link_tool_helpers_1.toText)(read('smsPhoneNumber', '')).trim() };
|
|
144
|
+
const message = (0, link_tool_helpers_1.toText)(read('smsMessage', ''));
|
|
145
|
+
if (message)
|
|
146
|
+
sms.message = message;
|
|
147
|
+
return { type: 'sms', sms };
|
|
148
|
+
}
|
|
149
|
+
case 'geolocation':
|
|
150
|
+
return {
|
|
151
|
+
type: 'geolocation',
|
|
152
|
+
geolocation: {
|
|
153
|
+
latitude: toCoordinate(read('latitude', 0)),
|
|
154
|
+
longitude: toCoordinate(read('longitude', 0)),
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
case 'vcard':
|
|
158
|
+
return { type: 'vcard', vcard: buildVCardTarget(read) };
|
|
159
|
+
case 'event': {
|
|
160
|
+
const event = {
|
|
161
|
+
title: (0, link_tool_helpers_1.toText)(read('eventTitle', '')).trim(),
|
|
162
|
+
startsAt: readEventDateTime(read('eventStartsAt', '')) ?? '',
|
|
163
|
+
};
|
|
164
|
+
setText(event, 'location', read('eventLocation', ''));
|
|
165
|
+
setText(event, 'description', read('eventDescription', ''));
|
|
166
|
+
const endsAt = readEventDateTime(read('eventEndsAt', ''));
|
|
167
|
+
if (endsAt)
|
|
168
|
+
event.endsAt = endsAt;
|
|
169
|
+
if (readBoolean(read('eventAllDay', false)))
|
|
170
|
+
event.allDay = true;
|
|
171
|
+
setText(event, 'timezone', read('eventTimezone', qr_content_config_1.QR_CONTENT_CONFIG.event.defaultTimezone));
|
|
172
|
+
setText(event, 'url', read('eventUrl', ''));
|
|
173
|
+
return { type: 'event', event };
|
|
174
|
+
}
|
|
175
|
+
case 'whatsapp': {
|
|
176
|
+
const whatsapp = {
|
|
177
|
+
phoneNumber: (0, link_tool_helpers_1.toText)(read('whatsappPhoneNumber', '')).trim(),
|
|
178
|
+
};
|
|
179
|
+
const message = (0, link_tool_helpers_1.toText)(read('whatsappMessage', ''));
|
|
180
|
+
if (message)
|
|
181
|
+
whatsapp.message = message;
|
|
182
|
+
return { type: 'whatsapp', whatsapp };
|
|
183
|
+
}
|
|
184
|
+
case 'review': {
|
|
185
|
+
const platform = (0, link_tool_helpers_1.toText)(read('reviewPlatform', 'google')).trim();
|
|
186
|
+
const review = { platform };
|
|
187
|
+
// Place ID is a Google-only field; another platform never sends it.
|
|
188
|
+
if (platform === qr_content_config_1.QR_CONTENT_CONFIG.review.placeIdPlatform) {
|
|
189
|
+
setText(review, 'placeId', read('reviewPlaceId', ''));
|
|
190
|
+
}
|
|
191
|
+
setText(review, 'url', read('reviewUrl', ''));
|
|
192
|
+
return { type: 'review', review };
|
|
193
|
+
}
|
|
194
|
+
case 'social':
|
|
195
|
+
return { type: 'social', social: buildSocialTarget(read) };
|
|
196
|
+
case 'appStore': {
|
|
197
|
+
const appStore = { fallbackUrl: (0, link_tool_helpers_1.toText)(read('appStoreFallbackUrl', '')).trim() };
|
|
198
|
+
setText(appStore, 'androidUrl', read('appStoreAndroidUrl', ''));
|
|
199
|
+
setText(appStore, 'iosUrl', read('appStoreIosUrl', ''));
|
|
200
|
+
return { type: 'appStore', appStore };
|
|
201
|
+
}
|
|
202
|
+
case 'file': {
|
|
203
|
+
// `bucketFilePath` is added by the node after the upload (see `uploadQrFile`);
|
|
204
|
+
// without it an update keeps the stored file.
|
|
205
|
+
const file = {};
|
|
206
|
+
setText(file, 'fileName', read('fileName', ''));
|
|
207
|
+
return { type: 'file', file };
|
|
208
|
+
}
|
|
209
|
+
default:
|
|
210
|
+
throw new Error(`Unsupported QR type "${qrType}". Use one of: ${constants_1.QR_CODE_TYPES.join(', ')}.`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A Mode parameter value as the API takes it: `static`, `dynamic`, or
|
|
215
|
+
* `undefined` for anything else (an empty "Keep Current", or an expression that
|
|
216
|
+
* resolved to an empty string), so the caller sends no `mode` at all.
|
|
217
|
+
*/
|
|
218
|
+
function readQrMode(value) {
|
|
219
|
+
const mode = (0, link_tool_helpers_1.toText)(value).trim().toLowerCase();
|
|
220
|
+
return mode === 'static' || mode === 'dynamic' ? mode : undefined;
|
|
221
|
+
}
|
|
222
|
+
/** A date-time parameter as ISO, or `undefined` when empty (an expression that resolved to ''). */
|
|
223
|
+
function readDateTime(value) {
|
|
224
|
+
if (value instanceof Date)
|
|
225
|
+
return value.toISOString();
|
|
226
|
+
const text = (0, link_tool_helpers_1.toText)(value).trim();
|
|
227
|
+
if (!text)
|
|
228
|
+
return undefined;
|
|
229
|
+
const parsed = new Date(text);
|
|
230
|
+
// Leave anything unparseable as typed: the API's 400 names the field.
|
|
231
|
+
return Number.isNaN(parsed.getTime()) ? text : parsed.toISOString();
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The `access` body value from the Scan Rules collection:
|
|
235
|
+
* - `undefined`: nothing set, send no `access` (Update keeps the stored rules);
|
|
236
|
+
* - `null`: Clear Scan Rules is on, send `access: null`;
|
|
237
|
+
* - otherwise the rules object, which replaces the stored rules as a whole.
|
|
238
|
+
* Empty values (including expressions that resolve to '') are skipped.
|
|
239
|
+
*/
|
|
240
|
+
function buildQrAccess(rules) {
|
|
241
|
+
if (!rules)
|
|
242
|
+
return undefined;
|
|
243
|
+
if (rules.clearScanRules === true || (0, link_tool_helpers_1.toText)(rules.clearScanRules).trim().toLowerCase() === 'true')
|
|
244
|
+
return null;
|
|
245
|
+
const access = {};
|
|
246
|
+
const activeFrom = readDateTime(rules.activeFrom);
|
|
247
|
+
if (activeFrom)
|
|
248
|
+
access.activeFrom = activeFrom;
|
|
249
|
+
const expiresAt = readDateTime(rules.expiresAt);
|
|
250
|
+
if (expiresAt)
|
|
251
|
+
access.expiresAt = expiresAt;
|
|
252
|
+
const maxVisitsText = (0, link_tool_helpers_1.toText)(rules.maxVisits).trim();
|
|
253
|
+
if (maxVisitsText)
|
|
254
|
+
access.maxVisits = Number(maxVisitsText);
|
|
255
|
+
const fallbackUrl = (0, link_tool_helpers_1.toText)(rules.fallbackUrl).trim();
|
|
256
|
+
if (fallbackUrl)
|
|
257
|
+
access.fallbackUrl = fallbackUrl;
|
|
258
|
+
return Object.keys(access).length ? access : undefined;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=qr-target.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-target.helpers.js","sourceRoot":"","sources":["../../utils/qr-target.helpers.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA0HH,wCAMC;AAOD,8CAyGC;AAOD,gCAGC;AAmBD,sCAeC;AA1RD,2CAA0D;AAC1D,2DAA6C;AAC7C,2DAAwD;AA2BxD,sFAAsF;AACtF,SAAS,YAAY,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,0BAAM,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC;AAED,wFAAwF;AACxF,SAAS,OAAO,CAAmB,MAAS,EAAE,GAAqB,EAAE,KAAc;IAClF,MAAM,IAAI,GAAG,IAAA,0BAAM,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,IAAI;QAAG,MAAkC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAC3D,CAAC;AAED,uFAAuF;AACvF,SAAS,WAAW,CAAC,KAAc;IAClC,OAAO,KAAK,KAAK,IAAI,IAAI,IAAA,0BAAM,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;AACxE,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,KAAc;IACxC,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IACtD,MAAM,IAAI,GAAG,IAAA,0BAAM,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAClC,OAAO,IAAI,IAAI,SAAS,CAAC;AAC1B,CAAC;AAED,kGAAkG;AAClG,SAAS,gBAAgB,CAAC,IAAuB;IAChD,MAAM,MAAM,GAAG,qCAAiB,CAAC,KAAK,CAAC;IACvC,MAAM,KAAK,GA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Y,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAClD,IAAI,UAAU;QAAE,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/C,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAChD,IAAI,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5C,MAAM,aAAa,GAAG,IAAA,0BAAM,EAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,IAAI,aAAa;QAAE,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,IAAA,0BAAM,EAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,IAAI,WAAW;QAAE,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;IAElD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Template field of the Short Link and QR Code nodes: the dropdown's
|
|
3
|
+
* options, and which template a run sends.
|
|
4
|
+
*
|
|
5
|
+
* The Posty5 API requires `templateId` on every create and update made with an
|
|
6
|
+
* API key (which is every n8n call), so the node never sends a write without one.
|
|
7
|
+
*/
|
|
8
|
+
import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
9
|
+
import type { ILinkToolAdditionalFields, ILinkToolStoredFields } from '../types/common';
|
|
10
|
+
import type { IQRCodeTemplateLookupItem } from '../types/qr-code.types';
|
|
11
|
+
/**
|
|
12
|
+
* `loadOptions` for the Template field: the caller's own templates first, then
|
|
13
|
+
* the public ones. A template in both lists appears once, as the caller's.
|
|
14
|
+
* A bad credential rejects the call, so n8n shows the error in the dropdown.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getQrTemplates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
17
|
+
/** The dropdown options for two lookup pages: the caller's templates, then the public ones not already listed. */
|
|
18
|
+
export declare function mergeQrTemplateOptions(userTemplates: IQRCodeTemplateLookupItem[], publicTemplates: IQRCodeTemplateLookupItem[]): INodePropertyOptions[];
|
|
19
|
+
/**
|
|
20
|
+
* The template a write sends: the Template field; else the deprecated
|
|
21
|
+
* Additional Fields value that workflows saved before 4.6.0 carry; else, on
|
|
22
|
+
* Update, the record's stored template. Throws when there is none, before any
|
|
23
|
+
* request is made.
|
|
24
|
+
*/
|
|
25
|
+
export declare function requireTemplateId(selected: unknown, fields: ILinkToolAdditionalFields, stored?: ILinkToolStoredFields): string;
|
|
26
|
+
//# sourceMappingURL=qr-templates.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-templates.helpers.d.ts","sourceRoot":"","sources":["../../utils/qr-templates.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAIhF,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,yBAAyB,EAA6B,MAAM,wBAAwB,CAAC;AAEnG;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAmBjG;AAED,kHAAkH;AAClH,wBAAgB,sBAAsB,CACrC,aAAa,EAAE,yBAAyB,EAAE,EAC1C,eAAe,EAAE,yBAAyB,EAAE,GAC1C,oBAAoB,EAAE,CAiBxB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,yBAAyB,EACjC,MAAM,CAAC,EAAE,qBAAqB,GAC5B,MAAM,CAIR"}
|