@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
|
@@ -5,12 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.makeApiRequest = makeApiRequest;
|
|
8
|
+
exports.toPosty5NodeApiError = toPosty5NodeApiError;
|
|
9
|
+
exports.toPosty5ApiError = toPosty5ApiError;
|
|
10
|
+
exports.makeBinaryApiRequest = makeBinaryApiRequest;
|
|
11
|
+
exports.parseContentDispositionFileName = parseContentDispositionFileName;
|
|
8
12
|
exports.makePaginatedRequest = makePaginatedRequest;
|
|
9
13
|
exports.uploadFile = uploadFile;
|
|
14
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
10
15
|
const constants_1 = require("./constants");
|
|
11
16
|
/**
|
|
12
17
|
* Make an API request to Posty5 API using n8n's HTTP request helper
|
|
13
|
-
* @param context - N8n execution context
|
|
18
|
+
* @param context - N8n execution context, or a `loadOptions` context (both carry `helpers.httpRequest`)
|
|
14
19
|
* @param apiKey - Posty5 API key
|
|
15
20
|
* @param options - Request options
|
|
16
21
|
* @returns API response
|
|
@@ -23,14 +28,19 @@ async function makeApiRequest(apiKey, options) {
|
|
|
23
28
|
headers: {
|
|
24
29
|
'X-API-Key': apiKey,
|
|
25
30
|
'Content-Type': 'application/json',
|
|
31
|
+
[constants_1.Posty5ClientConst.HEADER]: constants_1.Posty5ClientConst.VALUE,
|
|
32
|
+
...(typeof options.version === 'number'
|
|
33
|
+
? { [constants_1.VERSIONED_WRITES.IF_MATCH_HEADER]: `"${options.version}"` }
|
|
34
|
+
: {}),
|
|
35
|
+
...(options.headers || {}),
|
|
26
36
|
},
|
|
27
37
|
json: true,
|
|
28
38
|
};
|
|
29
39
|
if (options.body) {
|
|
30
40
|
requestOptions.body = options.body;
|
|
31
41
|
}
|
|
32
|
-
// Add createdFrom to
|
|
33
|
-
if (options.method === 'POST') {
|
|
42
|
+
// Add createdFrom to POST request bodies, unless the caller opts out
|
|
43
|
+
if (options.method === 'POST' && options.stampCreatedFrom !== false) {
|
|
34
44
|
requestOptions.body = { ...requestOptions.body, createdFrom: 'n8n' };
|
|
35
45
|
}
|
|
36
46
|
if (options.qs) {
|
|
@@ -40,19 +50,172 @@ async function makeApiRequest(apiKey, options) {
|
|
|
40
50
|
const response = await this.helpers.httpRequest(requestOptions);
|
|
41
51
|
// Handle standard Posty5 API response format
|
|
42
52
|
if (response && typeof response === 'object') {
|
|
53
|
+
if (options.returnEnvelope)
|
|
54
|
+
return response;
|
|
43
55
|
// API returns { success, result, message } format
|
|
44
56
|
if ('result' in response) {
|
|
45
|
-
return response.result;
|
|
57
|
+
return withEnvelopeVersion(response.result, response.version, options.version);
|
|
46
58
|
}
|
|
47
59
|
return response;
|
|
48
60
|
}
|
|
49
61
|
return response;
|
|
50
62
|
}
|
|
51
63
|
catch (error) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
throw toPosty5NodeApiError(this, error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* On a versioned write, the envelope's `version` becomes the result's `__v`
|
|
69
|
+
* (a DELETE answers without one, so its result is returned as is).
|
|
70
|
+
*/
|
|
71
|
+
function withEnvelopeVersion(result, envelopeVersion, sentVersion) {
|
|
72
|
+
if (typeof sentVersion !== 'number' || typeof envelopeVersion !== 'number')
|
|
73
|
+
return result;
|
|
74
|
+
if (!result || typeof result !== 'object' || Array.isArray(result))
|
|
75
|
+
return result;
|
|
76
|
+
return { ...result, __v: envelopeVersion };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The `NodeApiError` `makeApiRequest` throws. Its message stays
|
|
80
|
+
* `Posty5 API Error: <message>` (except a version conflict, which says how to
|
|
81
|
+
* fix it); `httpCode`, `apiMessage`, the API's `code` and, on a
|
|
82
|
+
* `VERSION_CONFLICT`, `currentVersion` ride along. A context without
|
|
83
|
+
* `getNode` (never in n8n) gets the plain error.
|
|
84
|
+
*/
|
|
85
|
+
function toPosty5NodeApiError(context, error) {
|
|
86
|
+
const plain = toPosty5ApiError(error);
|
|
87
|
+
if (typeof context?.getNode !== 'function')
|
|
88
|
+
return plain;
|
|
89
|
+
const message = plain.code === constants_1.VERSIONED_WRITES.CONFLICT_CODE
|
|
90
|
+
? constants_1.VERSIONED_WRITES.CONFLICT_MESSAGE(plain.currentVersion)
|
|
91
|
+
: plain.message;
|
|
92
|
+
const apiError = new n8n_workflow_1.NodeApiError(context.getNode(), { message, httpCode: plain.httpCode ?? null, code: plain.code ?? null }, { message, ...(plain.httpCode ? { httpCode: plain.httpCode } : {}), description: plain.apiMessage });
|
|
93
|
+
if (plain.httpCode)
|
|
94
|
+
apiError.httpCode = plain.httpCode;
|
|
95
|
+
if (plain.apiMessage)
|
|
96
|
+
apiError.apiMessage = plain.apiMessage;
|
|
97
|
+
if (plain.code)
|
|
98
|
+
apiError.code = plain.code;
|
|
99
|
+
if (plain.currentVersion !== undefined)
|
|
100
|
+
apiError.currentVersion = plain.currentVersion;
|
|
101
|
+
return apiError;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The error `makeApiRequest` throws for a failed request. The API's message is
|
|
105
|
+
* read from the answer: `response.data` is where n8n's `httpRequest` (axios)
|
|
106
|
+
* puts the parsed body, `response.body` is the older request-library shape.
|
|
107
|
+
* The HTTP status is kept as `httpCode` so a caller can map one status (the
|
|
108
|
+
* analytics plan-gate 403) to a `NodeApiError` without parsing the message.
|
|
109
|
+
*/
|
|
110
|
+
function toPosty5ApiError(error) {
|
|
111
|
+
const apiMessage = error?.response?.data?.message || error?.response?.body?.message || undefined;
|
|
112
|
+
const errorMessage = apiMessage || error?.message || 'Unknown error';
|
|
113
|
+
const apiError = new Error(`Posty5 API Error: ${errorMessage}`);
|
|
114
|
+
const status = error?.response?.status ?? error?.response?.statusCode ?? error?.statusCode ?? error?.httpCode;
|
|
115
|
+
if (status !== undefined && status !== null)
|
|
116
|
+
apiError.httpCode = String(status);
|
|
117
|
+
if (apiMessage)
|
|
118
|
+
apiError.apiMessage = apiMessage;
|
|
119
|
+
const body = error?.response?.data ?? error?.response?.body;
|
|
120
|
+
if (body && typeof body === 'object') {
|
|
121
|
+
if (typeof body.code === 'string')
|
|
122
|
+
apiError.code = body.code;
|
|
123
|
+
const currentVersion = body.result?.currentVersion ?? body.currentVersion;
|
|
124
|
+
if (typeof currentVersion === 'number')
|
|
125
|
+
apiError.currentVersion = currentVersion;
|
|
126
|
+
}
|
|
127
|
+
return apiError;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A GET whose answer is a file (`/api/qr-code/:id/render`): same base URL and
|
|
131
|
+
* headers as `makeApiRequest`, but the body is kept as bytes. The file name
|
|
132
|
+
* comes from `Content-Disposition`, the type from `Content-Type`. A failed
|
|
133
|
+
* request's JSON error body (also bytes) is decoded first, so the error keeps
|
|
134
|
+
* the API's message — the plan gate's 403 text unchanged (C4).
|
|
135
|
+
*/
|
|
136
|
+
async function makeBinaryApiRequest(apiKey, endpoint, qs) {
|
|
137
|
+
const requestOptions = {
|
|
138
|
+
method: 'GET',
|
|
139
|
+
url: `${constants_1.POSTY5_API_BASE_URL}${endpoint}`,
|
|
140
|
+
headers: {
|
|
141
|
+
'X-API-Key': apiKey,
|
|
142
|
+
[constants_1.Posty5ClientConst.HEADER]: constants_1.Posty5ClientConst.VALUE,
|
|
143
|
+
},
|
|
144
|
+
encoding: 'arraybuffer',
|
|
145
|
+
json: false,
|
|
146
|
+
returnFullResponse: true,
|
|
147
|
+
};
|
|
148
|
+
if (qs)
|
|
149
|
+
requestOptions.qs = qs;
|
|
150
|
+
try {
|
|
151
|
+
const response = await this.helpers.httpRequest(requestOptions);
|
|
152
|
+
const headers = (response?.headers || {});
|
|
153
|
+
return {
|
|
154
|
+
data: toBuffer(response?.body),
|
|
155
|
+
mimeType: String(headers['content-type'] ?? '').split(';')[0].trim().toLowerCase(),
|
|
156
|
+
fileName: parseContentDispositionFileName(headers['content-disposition']),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
throw toPosty5NodeApiError(this, withDecodedErrorBody(error));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The file name of a `Content-Disposition` header: the RFC 5987
|
|
165
|
+
* `filename*=UTF-8''…` form when present, else `filename="…"`. Empty when
|
|
166
|
+
* there is none. Path separators are dropped, so the name is a bare file name.
|
|
167
|
+
*/
|
|
168
|
+
function parseContentDispositionFileName(header) {
|
|
169
|
+
const value = Array.isArray(header) ? String(header[0] ?? '') : String(header ?? '');
|
|
170
|
+
if (!value)
|
|
171
|
+
return '';
|
|
172
|
+
let name = '';
|
|
173
|
+
const extended = /filename\*\s*=\s*([^']*)'[^']*'([^;]+)/i.exec(value);
|
|
174
|
+
if (extended) {
|
|
175
|
+
try {
|
|
176
|
+
name = decodeURIComponent(extended[2].trim().replace(/^"|"$/g, ''));
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
name = '';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!name) {
|
|
183
|
+
const plain = /filename\s*=\s*("([^"]*)"|[^;]+)/i.exec(value);
|
|
184
|
+
if (plain)
|
|
185
|
+
name = (plain[2] ?? plain[1]).trim();
|
|
186
|
+
}
|
|
187
|
+
return name.replace(/[\\/]/g, '_').trim();
|
|
188
|
+
}
|
|
189
|
+
/** A response body as a Buffer (n8n hands back a Buffer, an ArrayBuffer or, from mocks, a string). */
|
|
190
|
+
function toBuffer(body) {
|
|
191
|
+
if (Buffer.isBuffer(body))
|
|
192
|
+
return body;
|
|
193
|
+
if (body instanceof ArrayBuffer)
|
|
194
|
+
return Buffer.from(body);
|
|
195
|
+
if (ArrayBuffer.isView(body))
|
|
196
|
+
return Buffer.from(body.buffer, body.byteOffset, body.byteLength);
|
|
197
|
+
if (typeof body === 'string')
|
|
198
|
+
return Buffer.from(body);
|
|
199
|
+
return Buffer.alloc(0);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The error of a bytes request with its body parsed as JSON where it is JSON,
|
|
203
|
+
* so `toPosty5ApiError` reads the API's `message` and `code` as for any request.
|
|
204
|
+
*/
|
|
205
|
+
function withDecodedErrorBody(error) {
|
|
206
|
+
for (const key of ['data', 'body']) {
|
|
207
|
+
const body = error?.response?.[key];
|
|
208
|
+
if (body === undefined || body === null || (typeof body === 'object' && !ArrayBuffer.isView(body) && !(body instanceof ArrayBuffer))) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
error.response[key] = JSON.parse(toBuffer(body).toString('utf8'));
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
// Not JSON: the error keeps its own message.
|
|
216
|
+
}
|
|
55
217
|
}
|
|
218
|
+
return error;
|
|
56
219
|
}
|
|
57
220
|
/**
|
|
58
221
|
* Make a paginated list request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.helpers.js","sourceRoot":"","sources":["../../utils/api.helpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
|
|
1
|
+
{"version":3,"file":"api.helpers.js","sourceRoot":"","sources":["../../utils/api.helpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA2CH,wCA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C;AACF,CAAC"}
|
|
@@ -3,20 +3,259 @@
|
|
|
3
3
|
* Central location for all API-related constants
|
|
4
4
|
*/
|
|
5
5
|
export declare const POSTY5_API_BASE_URL = "https://api.posty5.com";
|
|
6
|
+
/**
|
|
7
|
+
* `X-Posty5-Client`, sent on every request this package makes to the API (the
|
|
8
|
+
* mcp-server headers contract: `posty5-n8n/<version>`; the API logs it and never
|
|
9
|
+
* trusts it). The version is package.json's, compiled in by tsc through
|
|
10
|
+
* `resolveJsonModule`, so a release bump cannot leave a stale copy here.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Posty5ClientConst: {
|
|
13
|
+
readonly HEADER: "X-Posty5-Client";
|
|
14
|
+
readonly VALUE: `posty5-n8n/${string}`;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The credential's Test button (`GET /api/api-key/current`). A wrong or revoked
|
|
18
|
+
* key answers 401; a 200 has to name the key at `KEY_ID_PATH`, so a 200 from
|
|
19
|
+
* anything else is not a pass.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CredentialTestConst: {
|
|
22
|
+
readonly INVALID_KEY_STATUS: 401;
|
|
23
|
+
readonly INVALID_KEY_MESSAGE: "Invalid or revoked API key";
|
|
24
|
+
readonly KEY_ID_PATH: "result.apiKey._id";
|
|
25
|
+
readonly NO_KEY_ID_MESSAGE: "The Posty5 API did not identify this API key";
|
|
26
|
+
};
|
|
6
27
|
export declare const API_ENDPOINTS: {
|
|
28
|
+
readonly API_KEY_CURRENT: "/api/api-key/current";
|
|
7
29
|
readonly SHORT_LINK: "/api/short-link";
|
|
30
|
+
readonly LINK_CAMPAIGN: "/api/link-campaign";
|
|
8
31
|
readonly QR_CODE: "/api/qr-code";
|
|
32
|
+
readonly QR_CODE_TEMPLATE: "/api/qr-code-template";
|
|
9
33
|
readonly HTML_HOSTING: "/api/html-hosting";
|
|
10
34
|
readonly FORM_SUBMISSION: "/api/html-hosting-form-submission";
|
|
11
35
|
readonly SOCIAL_PUBLISHER_WORKSPACE: "/api/social-publisher-workspace";
|
|
12
36
|
readonly SOCIAL_PUBLISHER_POST: "/api/social-publisher-post";
|
|
37
|
+
readonly STORE_SUPPLIERS: "/api/store-suppliers";
|
|
38
|
+
readonly STORE_ORDERS: "/api/store-orders";
|
|
39
|
+
readonly WEBHOOK_ENDPOINTS: "/api/webhook-endpoints";
|
|
13
40
|
};
|
|
14
41
|
export declare const DEFAULT_PAGINATION: {
|
|
15
42
|
readonly page: 1;
|
|
16
43
|
readonly pageSize: 50;
|
|
17
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Page sizes the `/api/store-suppliers` list routes accept. They mirror the api's
|
|
47
|
+
* Joi schemas (`suppliers/schema.ts`): a larger `pageSize` is refused with a 400,
|
|
48
|
+
* not clamped, so the node's Limit fields are capped at the same values.
|
|
49
|
+
*/
|
|
50
|
+
export declare const STORE_SUPPLIER_PAGE_SIZES: {
|
|
51
|
+
/** Catalogue browse (`GET /:storeId/:id/products`) — the api's `CATALOGUE_MAX_PAGE_SIZE`. */
|
|
52
|
+
readonly CATALOGUE_MAX: 48;
|
|
53
|
+
/** Supplier order queue (`GET /:storeId/orders`). */
|
|
54
|
+
readonly SUPPLIER_ORDERS_MAX: 100;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The Template dropdown on the Short Link and QR Code nodes. It reads the
|
|
58
|
+
* caller's own templates (`GET /api/qr-code-template/user-lookup`, accepts the
|
|
59
|
+
* API key) and the public ones (`/public-lookup`, no auth). Both lists are
|
|
60
|
+
* cursor-paged; one page of `PAGE_SIZE` each fills the dropdown, and a template
|
|
61
|
+
* beyond it can still be entered by ID as an expression.
|
|
62
|
+
*/
|
|
63
|
+
export declare const QR_TEMPLATE_LOOKUP: {
|
|
64
|
+
readonly USER_PATH: "/user-lookup";
|
|
65
|
+
readonly PUBLIC_PATH: "/public-lookup";
|
|
66
|
+
readonly PAGE_SIZE: 100;
|
|
67
|
+
/** Shown under each option so the user can tell the two lists apart. */
|
|
68
|
+
readonly USER_LABEL: "My template";
|
|
69
|
+
readonly PUBLIC_LABEL: "Public template";
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* QR Code *Render*, *Check Scannability* and *List Templates* (QR design and
|
|
73
|
+
* export, K6): `GET /api/qr-code/:id/render`, `POST /api/qr-code/scannability-check`,
|
|
74
|
+
* the two template lookups, and the print presets of
|
|
75
|
+
* `GET /api/qr-code-template/design-catalogue`. Values mirror the API's schemas.
|
|
76
|
+
* SVG, PDF, a preset, a DPI or a PNG over 2048 px need a paid plan; the API's
|
|
77
|
+
* 403 text is shown unchanged.
|
|
78
|
+
*/
|
|
79
|
+
export declare const QR_RENDER: {
|
|
80
|
+
readonly RENDER_PATH_SEGMENT: "render";
|
|
81
|
+
readonly SCANNABILITY_PATH: "/scannability-check";
|
|
82
|
+
readonly CATALOGUE_PATH: "/design-catalogue";
|
|
83
|
+
readonly FORMATS: readonly ["png", "svg", "pdf"];
|
|
84
|
+
readonly DEFAULT_FORMAT: "png";
|
|
85
|
+
/** The API's MIME type per format, used when the answer carries none. */
|
|
86
|
+
readonly MIME_TYPES: Record<string, string>;
|
|
87
|
+
readonly DPI_VALUES: readonly [150, 300, 600];
|
|
88
|
+
readonly DEFAULT_DPI: 300;
|
|
89
|
+
/** `presetId` value that takes a width in mm (`customMm`). */
|
|
90
|
+
readonly CUSTOM_PRESET_ID: "custom";
|
|
91
|
+
readonly CUSTOM_MM_MIN: 20;
|
|
92
|
+
readonly CUSTOM_MM_MAX: 500;
|
|
93
|
+
readonly DEFAULT_CUSTOM_MM: 50;
|
|
94
|
+
readonly SIZE_PX_MIN: 64;
|
|
95
|
+
readonly SIZE_PX_MAX: 6000;
|
|
96
|
+
readonly DEFAULT_SIZE_PX: 1024;
|
|
97
|
+
readonly DEFAULT_BINARY_PROPERTY: "data";
|
|
98
|
+
/** Any value: the API answers an attachment named `<name>-<preset|size>.<ext>`. */
|
|
99
|
+
readonly DOWNLOAD_FLAG: "1";
|
|
100
|
+
/** File name when the answer has no `Content-Disposition`: `qr-code-<id>.<ext>`. */
|
|
101
|
+
readonly FALLBACK_FILE_NAME_PREFIX: "qr-code-";
|
|
102
|
+
/** The "no preset" option of the Print Preset dropdown. */
|
|
103
|
+
readonly NO_PRESET_LABEL: "None (Size in Pixels)";
|
|
104
|
+
readonly LIST_TEMPLATES_DEFAULT_LIMIT: 50;
|
|
105
|
+
readonly LIST_TEMPLATES_MAX_LIMIT: 100;
|
|
106
|
+
};
|
|
107
|
+
/** Errors the QR render operations raise before any request. */
|
|
108
|
+
export declare const QR_RENDER_MESSAGES: {
|
|
109
|
+
readonly unknownFormat: (format: string) => string;
|
|
110
|
+
readonly idRequired: (what: string) => string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* The QR types the API validates (`/api/qr-code/:type`). The node's QR Type
|
|
114
|
+
* values are these, and `qrCodeTarget.type` is always one of them.
|
|
115
|
+
*/
|
|
116
|
+
export declare const QR_CODE_TYPES: readonly ["url", "freeText", "email", "wifi", "call", "sms", "geolocation", "vcard", "event", "whatsapp", "review", "social", "appStore", "file"];
|
|
117
|
+
/** WiFi authentication values: the node's default, and the one that means "open network" (no password is sent). */
|
|
118
|
+
export declare const QR_WIFI_AUTH: {
|
|
119
|
+
readonly DEFAULT: "WPA";
|
|
120
|
+
readonly OPEN_NETWORK: "nopass";
|
|
121
|
+
};
|
|
122
|
+
/** The Short Link fields that set a device's destination by hand (S13). */
|
|
123
|
+
export declare const SHORT_LINK_DEEP_LINK_FIELDS: readonly ["androidUrl", "iosUrl"];
|
|
124
|
+
/** Errors the Short Link and QR Code nodes raise before calling the API. */
|
|
125
|
+
export declare const LINK_TOOL_MESSAGES: {
|
|
126
|
+
readonly TEMPLATE_REQUIRED: "Template is required: pick one in the Template field. The Posty5 API refuses a create or update made with an API key without it.";
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* *Get Analytics* on the Short Link and QR Code nodes:
|
|
130
|
+
* `GET <SHORT_LINK|QR_CODE>/:id/analytics` (contract C2). The breakdown names,
|
|
131
|
+
* intervals, the `all` value and the limit bounds mirror the API's query schema.
|
|
132
|
+
*/
|
|
133
|
+
export declare const LINK_ANALYTICS: {
|
|
134
|
+
/** Path segment after `/:id`. */
|
|
135
|
+
readonly PATH_SEGMENT: "analytics";
|
|
136
|
+
/** `breakdown` value asking for every breakdown the owner's plan allows. */
|
|
137
|
+
readonly ALL_BREAKDOWNS: "all";
|
|
138
|
+
/** Separator of an explicit `breakdown` list. */
|
|
139
|
+
readonly BREAKDOWN_SEPARATOR: ",";
|
|
140
|
+
/** Days of each preset range, today included. */
|
|
141
|
+
readonly RANGE_DAYS: {
|
|
142
|
+
readonly last7Days: 7;
|
|
143
|
+
readonly last30Days: 30;
|
|
144
|
+
readonly last90Days: 90;
|
|
145
|
+
};
|
|
146
|
+
/** The Range a new node starts with: the API's own default span. */
|
|
147
|
+
readonly DEFAULT_RANGE: "last30Days";
|
|
148
|
+
readonly DEFAULT_INTERVAL: "day";
|
|
149
|
+
/** The Output a new node starts with: the API answer, unchanged. */
|
|
150
|
+
readonly DEFAULT_OUTPUT: "response";
|
|
151
|
+
/** Rows per breakdown: the API's default and maximum. */
|
|
152
|
+
readonly LIMIT_DEFAULT: 10;
|
|
153
|
+
readonly LIMIT_MIN: 1;
|
|
154
|
+
readonly LIMIT_MAX: 50;
|
|
155
|
+
/** The status the API answers for a breakdown or a range the owner's plan does not include. */
|
|
156
|
+
readonly PLAN_GATE_HTTP_CODE: "403";
|
|
157
|
+
/** The zone used when neither the Time Zone option nor the workflow names one. */
|
|
158
|
+
readonly FALLBACK_TIME_ZONE: "UTC";
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* *Get Statistics* on the Short Link and QR Code nodes: account-wide counts
|
|
162
|
+
* over the caller's records, `GET <SHORT_LINK|QR_CODE>/statistics`. The periods
|
|
163
|
+
* are the API's own `period` values; days are UTC days on the server.
|
|
164
|
+
*/
|
|
165
|
+
export declare const LINK_STATISTICS: {
|
|
166
|
+
readonly PATH_SEGMENT: "statistics";
|
|
167
|
+
/** The API's default period. */
|
|
168
|
+
readonly DEFAULT_PERIOD: "30d";
|
|
169
|
+
readonly CUSTOM_PERIOD: "custom";
|
|
170
|
+
};
|
|
171
|
+
/** Errors *Get Analytics* and *Get Statistics* raise before calling the API. */
|
|
172
|
+
export declare const LINK_ANALYTICS_MESSAGES: {
|
|
173
|
+
readonly ID_REQUIRED: "The ID is required to read analytics.";
|
|
174
|
+
readonly CUSTOM_RANGE_REQUIRED: "A Custom range needs both From and To dates.";
|
|
175
|
+
readonly INVALID_DATE: "is not a date. Use a date such as 2026-10-01.";
|
|
176
|
+
readonly UNKNOWN_TIME_ZONE: "is not a known time zone. Use an IANA name such as Africa/Cairo in the Time Zone option or in the workflow settings.";
|
|
177
|
+
};
|
|
178
|
+
/** `YYYY-MM-DD` at the start of a date string (the day an n8n `dateTime` value names). */
|
|
179
|
+
export declare const DAY_KEY_PATTERN: RegExp;
|
|
180
|
+
/** Milliseconds in one calendar day (day keys are shifted on UTC midnights, so no DST applies). */
|
|
181
|
+
export declare const MS_PER_DAY: number;
|
|
182
|
+
/**
|
|
183
|
+
* *Create Many* on the Short Link and QR Code nodes: `POST <SHORT_LINK|QR_CODE>/bulk`
|
|
184
|
+
* (link-qr-bulk-and-webhooks contract). Rows are sent in chunks of at most
|
|
185
|
+
* `MAX_BATCH_SIZE`; each chunk carries `Idempotency-Key:
|
|
186
|
+
* n8n-<executionId>-<nodeName>-<chunk>`, so retrying the same execution is
|
|
187
|
+
* charged once while a new run is not deduped.
|
|
188
|
+
*/
|
|
189
|
+
export declare const LINK_BULK: {
|
|
190
|
+
readonly PATH_SEGMENT: "bulk";
|
|
191
|
+
readonly MAX_BATCH_SIZE: 100;
|
|
192
|
+
readonly DEFAULT_BATCH_SIZE: 100;
|
|
193
|
+
readonly IDEMPOTENCY_HEADER: "Idempotency-Key";
|
|
194
|
+
readonly IDEMPOTENCY_PREFIX: "n8n";
|
|
195
|
+
readonly ROW_STATUS_CREATED: "created";
|
|
196
|
+
readonly ROW_STATUS_FAILED: "failed";
|
|
197
|
+
};
|
|
198
|
+
/** Errors *Create Many* raises. */
|
|
199
|
+
export declare const LINK_BULK_MESSAGES: {
|
|
200
|
+
readonly TEMPLATE_REQUIRED: "Template is required: pick one in the Template field or set Defaults > Template ID. The Posty5 API refuses a create made with an API key without it.";
|
|
201
|
+
readonly ROW_FAILED: "Posty5 refused a row of Create Many";
|
|
202
|
+
readonly MISSING_ROW_RESULT: "The Posty5 API returned no result for this row";
|
|
203
|
+
};
|
|
18
204
|
export declare const API_TIMEOUTS: {
|
|
19
205
|
readonly DEFAULT: 30000;
|
|
20
206
|
readonly UPLOAD: 120000;
|
|
21
207
|
};
|
|
208
|
+
/**
|
|
209
|
+
* Short link controls (short-link-controls): sub-paths under `/api/short-link`,
|
|
210
|
+
* the enums the API's Joi schemas accept, and the node's own messages.
|
|
211
|
+
*/
|
|
212
|
+
export declare const SHORT_LINK_CONTROLS: {
|
|
213
|
+
readonly TAGS_PATH: "/tags";
|
|
214
|
+
readonly HEALTH_CHECK_PATH: "/health-check";
|
|
215
|
+
/** `?tags=a,b` and the Tags field are split on this. */
|
|
216
|
+
readonly TAGS_SEPARATOR: ",";
|
|
217
|
+
/** `GET /api/link-campaign` page size for the Campaign dropdown. */
|
|
218
|
+
readonly CAMPAIGN_LOOKUP_PAGE_SIZE: 100;
|
|
219
|
+
/** Answer of Check Health (the API answers 202 with no body). */
|
|
220
|
+
readonly HEALTH_CHECK_QUEUED: {
|
|
221
|
+
readonly queued: true;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
/** Retargeting pixel providers (`pixelsJoi`). */
|
|
225
|
+
export declare const LINK_PIXEL_PROVIDERS: readonly ["meta", "googleAds", "tiktok", "linkedin", "x", "pinterest"];
|
|
226
|
+
/** Campaign colours (`LINK_CAMPAIGN_COLORS`). */
|
|
227
|
+
export declare const LINK_CAMPAIGN_COLORS: readonly ["slate", "red", "orange", "amber", "green", "teal", "blue", "indigo", "purple", "pink"];
|
|
228
|
+
/** Routing rule condition values (documented in the Routing Rules field). */
|
|
229
|
+
export declare const LINK_ROUTING_DEVICES: readonly ["tablet", "mobile", "desktop", "other"];
|
|
230
|
+
export declare const LINK_ROUTING_OS: readonly ["android", "ios", "windows", "macos", "linux"];
|
|
231
|
+
/** The UTM keys a link or a campaign carries. */
|
|
232
|
+
export declare const LINK_UTM_KEYS: readonly ["source", "medium", "campaign", "term", "content"];
|
|
233
|
+
/** The access keys of a link (`password` and `removePassword` handled apart). */
|
|
234
|
+
export declare const LINK_ACCESS_KEYS: readonly ["activeFrom", "expiresAt", "maxVisits", "fallbackUrl"];
|
|
235
|
+
export declare const SHORT_LINK_CONTROLS_MESSAGES: {
|
|
236
|
+
readonly INVALID_JSON: (field: string) => string;
|
|
237
|
+
readonly CAMPAIGN_NAME_REQUIRED: "Campaign Name is required";
|
|
238
|
+
readonly ID_REQUIRED: (field: string) => string;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Optimistic concurrency (optimistic-concurrency feature, D-5/D-6/D-18). v2 of
|
|
242
|
+
* the nodes with update/delete operations sends the Version field as
|
|
243
|
+
* `If-Match`; v1 keeps last-write-wins by reading the item's `__v` first.
|
|
244
|
+
*/
|
|
245
|
+
export declare const VERSIONED_WRITES: {
|
|
246
|
+
readonly IF_MATCH_HEADER: "If-Match";
|
|
247
|
+
readonly CONFLICT_CODE: "VERSION_CONFLICT";
|
|
248
|
+
/** The node version that carries the Version field. */
|
|
249
|
+
readonly FIRST_VERSIONED_NODE_VERSION: 2;
|
|
250
|
+
readonly VERSION_PARAMETER: "expectedVersion";
|
|
251
|
+
readonly OPTIONS_PARAMETER: "versionOptions";
|
|
252
|
+
/** The v1-only legacy notice (display only, no value). */
|
|
253
|
+
readonly V1_NOTICE_PARAMETER: "legacyVersionNotice";
|
|
254
|
+
readonly ON_UNKNOWN_FAIL: "fail";
|
|
255
|
+
readonly ON_UNKNOWN_USE_LATEST: "useLatest";
|
|
256
|
+
readonly DEFAULT_VERSION_EXPRESSION: "={{ $json.__v }}";
|
|
257
|
+
readonly CONFLICT_MESSAGE: (currentVersion?: number) => string;
|
|
258
|
+
readonly UNKNOWN_VERSION_MESSAGE: "Version is required: map the __v of a Get step, or set Version Options > On Unknown Version to Use Latest (Overwrite).";
|
|
259
|
+
readonly V1_DEPRECATION_NOTE: "Version 1 of this node is legacy: its update and delete operations read the item first and overwrite it (last write wins). Add the node again to get version 2, which fails on a conflict instead.";
|
|
260
|
+
};
|
|
22
261
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;CAahB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;IACrC,6FAA6F;;IAE7F,qDAAqD;;CAE5C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;IAI9B,wEAAwE;;;CAG/D,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;;;;;;IAMrB,yEAAyE;yBAKpE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;IAG3B,8DAA8D;;;;;;;;;IAS9D,mFAAmF;;IAEnF,oFAAoF;;IAEpF,2DAA2D;;;;CAIlD,CAAC;AAEX,gEAAgE;AAChE,eAAO,MA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