n8n-nodes-n8ndesigner-salla-n8nai 0.3.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/assets/salla-logo.svg +7 -0
- package/dist/credentials/SallaActionsApi.credentials.d.ts +19 -0
- package/dist/credentials/SallaActionsApi.credentials.js +80 -0
- package/dist/data/salla_actions_map.json +9304 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +317 -0
- package/dist/nodes/Actions/SallaActions.node.d.ts +14 -0
- package/dist/nodes/Actions/SallaActions.node.js +7992 -0
- package/dist/nodes/Actions/assets/salla-logo.svg +7 -0
- package/dist/nodes/Customers/DeleteCustomer.node.d.ts +8 -0
- package/dist/nodes/Customers/DeleteCustomer.node.js +304 -0
- package/dist/nodes/Customers/assets/salla-logo.svg +7 -0
- package/dist/nodes/Orders/UpdateOrderStatus.node.d.ts +8 -0
- package/dist/nodes/Orders/UpdateOrderStatus.node.js +359 -0
- package/dist/nodes/Orders/assets/salla-logo.svg +7 -0
- package/dist/nodes/Triggers/CustomerCreatedTrigger.node.d.ts +8 -0
- package/dist/nodes/Triggers/CustomerCreatedTrigger.node.js +150 -0
- package/dist/nodes/Triggers/OrderStatusUpdatedTrigger.node.d.ts +8 -0
- package/dist/nodes/Triggers/OrderStatusUpdatedTrigger.node.js +150 -0
- package/dist/nodes/Triggers/SallaTrigger.node.d.ts +3 -0
- package/dist/nodes/Triggers/SallaTrigger.node.js +30 -0
- package/dist/nodes/Triggers/SallaTriggers.node.d.ts +8 -0
- package/dist/nodes/Triggers/SallaTriggers.node.js +267 -0
- package/dist/nodes/Triggers/assets/salla-logo.svg +7 -0
- package/dist/shared/constants.d.ts +5 -0
- package/dist/shared/constants.js +36 -0
- package/dist/shared/eventStore.d.ts +4 -0
- package/dist/shared/eventStore.js +57 -0
- package/dist/shared/httpClient.d.ts +33 -0
- package/dist/shared/httpClient.js +439 -0
- package/dist/shared/sallaActionsMap.js +28 -0
- package/package.json +60 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// shared/httpClient.ts
|
|
21
|
+
var httpClient_exports = {};
|
|
22
|
+
__export(httpClient_exports, {
|
|
23
|
+
createSallaActionsClient: () => createSallaActionsClient
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(httpClient_exports);
|
|
26
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
27
|
+
var import_fs = require("fs");
|
|
28
|
+
|
|
29
|
+
// shared/constants.ts
|
|
30
|
+
var SALLA_CREDENTIAL_NAME = "sallaActionsApi";
|
|
31
|
+
var DEFAULT_BASE_URL = "https://app.n8ndesigner.com";
|
|
32
|
+
|
|
33
|
+
// shared/httpClient.ts
|
|
34
|
+
var DEFAULT_TIMEOUT = 12e3;
|
|
35
|
+
var RETRY_DELAYS = [1e3, 3e3];
|
|
36
|
+
var RETRY_ERROR_CODES = /* @__PURE__ */ new Set(["ETIMEDOUT", "ECONNRESET"]);
|
|
37
|
+
var ERROR_DEBUG_PATH = "/tmp/salla_http_raw_response.json";
|
|
38
|
+
function safeStringify(value) {
|
|
39
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
40
|
+
return JSON.stringify(
|
|
41
|
+
value,
|
|
42
|
+
(key, val) => {
|
|
43
|
+
if (typeof val === "object" && val !== null) {
|
|
44
|
+
if (seen.has(val)) {
|
|
45
|
+
return "[Circular]";
|
|
46
|
+
}
|
|
47
|
+
seen.add(val);
|
|
48
|
+
}
|
|
49
|
+
if (typeof val === "function") {
|
|
50
|
+
return `[Function ${val.name || "anonymous"}]`;
|
|
51
|
+
}
|
|
52
|
+
if (val instanceof Error) {
|
|
53
|
+
return { name: val.name, message: val.message, stack: val.stack };
|
|
54
|
+
}
|
|
55
|
+
return val;
|
|
56
|
+
},
|
|
57
|
+
2
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function extractJsonFromText(text) {
|
|
61
|
+
if (typeof text !== "string" || !text.includes("{")) {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
const first = text.indexOf("{");
|
|
65
|
+
const last = text.lastIndexOf("}");
|
|
66
|
+
if (last <= first) {
|
|
67
|
+
return void 0;
|
|
68
|
+
}
|
|
69
|
+
const candidate = text.slice(first, last + 1);
|
|
70
|
+
try {
|
|
71
|
+
return JSON.parse(candidate);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function writeDebugFile(filePath, payload) {
|
|
77
|
+
try {
|
|
78
|
+
import_fs.writeFileSync(filePath, safeStringify(payload), { encoding: "utf8" });
|
|
79
|
+
} catch (error) {
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function summarizeErrorResponse(label, requestOptions, statusCode, rawBody, normalized, rawResponse) {
|
|
83
|
+
const headers = rawResponse?.headers ?? rawResponse?.response?.headers ?? rawResponse?.rawResponse?.headers ?? void 0;
|
|
84
|
+
const bodyKeys = requestOptions?.body && typeof requestOptions.body === "object" ? Object.keys(requestOptions.body) : void 0;
|
|
85
|
+
let errorSummary = void 0;
|
|
86
|
+
if (label === "http_exception" && rawResponse) {
|
|
87
|
+
const source = rawResponse;
|
|
88
|
+
if (typeof source === "object") {
|
|
89
|
+
errorSummary = {
|
|
90
|
+
name: source.name ?? void 0,
|
|
91
|
+
message: source.message ?? void 0,
|
|
92
|
+
code: source.code ?? source.cause?.code ?? void 0,
|
|
93
|
+
statusCode: source.statusCode ?? source.response?.statusCode ?? source.status ?? void 0
|
|
94
|
+
};
|
|
95
|
+
const responseBody = source.response?.body ?? source.response?.data ?? source.response?.rawBody ?? source.response?.raw;
|
|
96
|
+
if (responseBody !== void 0) {
|
|
97
|
+
errorSummary.responseBody = responseBody;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const snapshot = {
|
|
102
|
+
label,
|
|
103
|
+
request: {
|
|
104
|
+
method: requestOptions?.method,
|
|
105
|
+
url: requestOptions?.url,
|
|
106
|
+
path: requestOptions?.path,
|
|
107
|
+
qs: requestOptions?.qs ?? void 0,
|
|
108
|
+
hasBody: !!requestOptions?.body,
|
|
109
|
+
bodyKeys
|
|
110
|
+
},
|
|
111
|
+
response: {
|
|
112
|
+
statusCode,
|
|
113
|
+
headers,
|
|
114
|
+
body: rawBody ?? null
|
|
115
|
+
},
|
|
116
|
+
normalized
|
|
117
|
+
};
|
|
118
|
+
if (errorSummary) {
|
|
119
|
+
snapshot.error = errorSummary;
|
|
120
|
+
}
|
|
121
|
+
writeDebugFile(ERROR_DEBUG_PATH, snapshot);
|
|
122
|
+
}
|
|
123
|
+
function trimTrailingSlash(input) {
|
|
124
|
+
const value = input && input.trim() !== "" ? input : DEFAULT_BASE_URL;
|
|
125
|
+
return value.replace(/\/+$/, "");
|
|
126
|
+
}
|
|
127
|
+
function ensureLeadingSlash(path) {
|
|
128
|
+
if (!path.startsWith("/")) {
|
|
129
|
+
return "/" + path;
|
|
130
|
+
}
|
|
131
|
+
return path;
|
|
132
|
+
}
|
|
133
|
+
function buildActionsUrl(baseUrl, path) {
|
|
134
|
+
const normalizedBase = trimTrailingSlash(baseUrl);
|
|
135
|
+
return normalizedBase + "/api/actions" + ensureLeadingSlash(path);
|
|
136
|
+
}
|
|
137
|
+
function buildProxyUrl(baseUrl) {
|
|
138
|
+
const normalizedBase = trimTrailingSlash(baseUrl);
|
|
139
|
+
return normalizedBase + "/api/merchant/salla";
|
|
140
|
+
}
|
|
141
|
+
function normalizeResponse(rawBody, statusCode) {
|
|
142
|
+
const parsedBody = (() => {
|
|
143
|
+
if (typeof rawBody === "string") {
|
|
144
|
+
try {
|
|
145
|
+
return JSON.parse(rawBody);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
return rawBody;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return rawBody;
|
|
151
|
+
})();
|
|
152
|
+
const raw = parsedBody ?? rawBody ?? null;
|
|
153
|
+
if (parsedBody === void 0 || parsedBody === null || parsedBody === "") {
|
|
154
|
+
return {
|
|
155
|
+
ok: statusCode >= 200 && statusCode < 300,
|
|
156
|
+
status: statusCode,
|
|
157
|
+
data: null,
|
|
158
|
+
error: statusCode >= 400 ? "Request failed with status " + statusCode : null,
|
|
159
|
+
raw
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (typeof parsedBody !== "object") {
|
|
163
|
+
return {
|
|
164
|
+
ok: statusCode >= 200 && statusCode < 300,
|
|
165
|
+
status: statusCode,
|
|
166
|
+
data: parsedBody,
|
|
167
|
+
error: statusCode >= 400 ? String(parsedBody) : null,
|
|
168
|
+
raw
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const body = parsedBody;
|
|
172
|
+
const successFlag = typeof body.success === "boolean" ? body.success : void 0;
|
|
173
|
+
const okFlag = typeof body.ok === "boolean" ? body.ok : void 0;
|
|
174
|
+
const status = typeof body.status === "number" ? body.status : statusCode;
|
|
175
|
+
const ok = okFlag ?? successFlag ?? (status >= 200 && status < 300);
|
|
176
|
+
let data = null;
|
|
177
|
+
if (!ok && (Object.prototype.hasOwnProperty.call(body, "backendStatus") || Object.prototype.hasOwnProperty.call(body, "backendError"))) {
|
|
178
|
+
data = body;
|
|
179
|
+
} else if (Object.prototype.hasOwnProperty.call(body, "data")) {
|
|
180
|
+
data = body.data ?? null;
|
|
181
|
+
} else {
|
|
182
|
+
data = body;
|
|
183
|
+
}
|
|
184
|
+
const errors = body.errors;
|
|
185
|
+
if (errors) {
|
|
186
|
+
if (data && typeof data === "object") {
|
|
187
|
+
data = {
|
|
188
|
+
...data,
|
|
189
|
+
errors
|
|
190
|
+
};
|
|
191
|
+
} else {
|
|
192
|
+
data = { errors };
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
let error = null;
|
|
196
|
+
if (typeof body.error === "string") {
|
|
197
|
+
error = body.error;
|
|
198
|
+
} else if (!ok) {
|
|
199
|
+
if (typeof body.backendError === "string") {
|
|
200
|
+
error = body.backendError;
|
|
201
|
+
} else if (typeof body.message === "string" && body.message.trim() !== "") {
|
|
202
|
+
error = body.message;
|
|
203
|
+
} else if (body.error && typeof body.error === "object") {
|
|
204
|
+
error = JSON.stringify(body.error);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (!ok && !error) {
|
|
208
|
+
error = "Request failed with status " + status;
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
ok,
|
|
212
|
+
status,
|
|
213
|
+
data: data ?? null,
|
|
214
|
+
error,
|
|
215
|
+
raw: body && typeof body === "object" && body.raw !== void 0 ? body.raw : raw
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function shouldRetryStatus(status) {
|
|
219
|
+
return status === 429 || status >= 500;
|
|
220
|
+
}
|
|
221
|
+
function shouldRetryError(error) {
|
|
222
|
+
if (!error || typeof error !== "object") {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
const err = error;
|
|
226
|
+
const status = err.statusCode ?? err.response?.statusCode;
|
|
227
|
+
if (typeof status === "number" && shouldRetryStatus(status)) {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
const code = err.code ?? err.cause?.code;
|
|
231
|
+
return code ? RETRY_ERROR_CODES.has(code) : false;
|
|
232
|
+
}
|
|
233
|
+
function extractBodyFromResponse(response) {
|
|
234
|
+
if (!response || typeof response !== "object") {
|
|
235
|
+
return void 0;
|
|
236
|
+
}
|
|
237
|
+
if (response.body !== void 0) {
|
|
238
|
+
return response.body;
|
|
239
|
+
}
|
|
240
|
+
if (response.data !== void 0) {
|
|
241
|
+
return response.data;
|
|
242
|
+
}
|
|
243
|
+
if (response.rawBody !== void 0) {
|
|
244
|
+
return response.rawBody;
|
|
245
|
+
}
|
|
246
|
+
if (response.response && typeof response.response === "object") {
|
|
247
|
+
if (response.response.body !== void 0) {
|
|
248
|
+
return response.response.body;
|
|
249
|
+
}
|
|
250
|
+
if (response.response.data !== void 0) {
|
|
251
|
+
return response.response.data;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (response.rawResponse && typeof response.rawResponse === "object") {
|
|
255
|
+
if (response.rawResponse.body !== void 0) {
|
|
256
|
+
return response.rawResponse.body;
|
|
257
|
+
}
|
|
258
|
+
if (response.rawResponse.data !== void 0) {
|
|
259
|
+
return response.rawResponse.data;
|
|
260
|
+
}
|
|
261
|
+
if (response.rawResponse.rawBody !== void 0) {
|
|
262
|
+
return response.rawResponse.rawBody;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return void 0;
|
|
266
|
+
}
|
|
267
|
+
async function executeWithRetry(caller, requestOptions) {
|
|
268
|
+
let lastError;
|
|
269
|
+
for (let attempt = 0; attempt <= RETRY_DELAYS.length; attempt++) {
|
|
270
|
+
try {
|
|
271
|
+
const response = await caller(requestOptions);
|
|
272
|
+
const body = extractBodyFromResponse(response);
|
|
273
|
+
const statusCode = response.statusCode ?? response.status ?? response.rawResponse?.statusCode ?? response.rawResponse?.status ?? 0;
|
|
274
|
+
const normalized = normalizeResponse(body, statusCode);
|
|
275
|
+
const envelopeDetected = body && typeof body === "object" && Object.prototype.hasOwnProperty.call(body, "backendStatus") && Object.prototype.hasOwnProperty.call(body, "backendError");
|
|
276
|
+
if (envelopeDetected) {
|
|
277
|
+
normalized.data = body;
|
|
278
|
+
normalized.raw = body.raw ?? body;
|
|
279
|
+
normalized.backendStatus = typeof body.backendStatus === "number" ? body.backendStatus : statusCode;
|
|
280
|
+
normalized.backendError = typeof body.backendError === "string" ? body.backendError : normalized.error ?? null;
|
|
281
|
+
} else {
|
|
282
|
+
if (!normalized.data && body !== void 0) {
|
|
283
|
+
normalized.data = body ?? null;
|
|
284
|
+
}
|
|
285
|
+
if (!normalized.raw && body !== void 0) {
|
|
286
|
+
normalized.raw = body ?? null;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
normalized.rawResponse = response;
|
|
290
|
+
normalized.body = body ?? null;
|
|
291
|
+
if (!normalized.ok && statusCode >= 400) {
|
|
292
|
+
summarizeErrorResponse("http_error", requestOptions, statusCode, body ?? null, normalized, response);
|
|
293
|
+
}
|
|
294
|
+
if (shouldRetryStatus(normalized.status) && attempt < RETRY_DELAYS.length) {
|
|
295
|
+
await (0, import_n8n_workflow.sleep)(RETRY_DELAYS[attempt]);
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
return normalized;
|
|
299
|
+
} catch (error) {
|
|
300
|
+
lastError = error;
|
|
301
|
+
if (attempt < RETRY_DELAYS.length && shouldRetryError(error)) {
|
|
302
|
+
await (0, import_n8n_workflow.sleep)(RETRY_DELAYS[attempt]);
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (lastError && typeof lastError === "object") {
|
|
309
|
+
const err = lastError;
|
|
310
|
+
const httpCode = typeof err.httpCode === "string" ? parseInt(err.httpCode, 10) : err.httpCode;
|
|
311
|
+
const responseStatusCode = err.statusCode ?? err.response?.statusCode ?? err.cause?.statusCode ?? err.cause?.response?.statusCode ?? httpCode;
|
|
312
|
+
let status = typeof responseStatusCode === "number" && responseStatusCode > 0 ? responseStatusCode : void 0;
|
|
313
|
+
if (status === void 0) {
|
|
314
|
+
const axiosStatus = err.response?.status ?? err.cause?.response?.status ?? err.cause?.status;
|
|
315
|
+
if (typeof axiosStatus === "number" && axiosStatus > 0) {
|
|
316
|
+
status = axiosStatus;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
if (status === void 0) {
|
|
320
|
+
const errorCode = err.code ?? err.cause?.code;
|
|
321
|
+
if (errorCode === "ECONNREFUSED" || errorCode === "ENOTFOUND") {
|
|
322
|
+
status = 503;
|
|
323
|
+
} else {
|
|
324
|
+
status = 500;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const responseCandidate = err.response ?? err.errorResponse ?? err.cause?.response ?? err.cause?.errorResponse ?? err.cause;
|
|
328
|
+
const bodyFromResponse = extractBodyFromResponse(responseCandidate);
|
|
329
|
+
let body = bodyFromResponse ?? err.context?.data ?? err.errorResponse ?? err.cause?.data ?? err.error;
|
|
330
|
+
if ((body === void 0 || body === null || typeof body === "string") && typeof err.description === "string") {
|
|
331
|
+
const parsed = extractJsonFromText(err.description);
|
|
332
|
+
if (parsed !== void 0) {
|
|
333
|
+
body = parsed;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if ((body === void 0 || body === null || typeof body === "string") && typeof err.message === "string") {
|
|
337
|
+
const parsed = extractJsonFromText(err.message);
|
|
338
|
+
if (parsed !== void 0) {
|
|
339
|
+
body = parsed;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const fallback = normalizeResponse(body, status);
|
|
343
|
+
const envelopeDetected = body && typeof body === "object" && Object.prototype.hasOwnProperty.call(body, "backendStatus") && Object.prototype.hasOwnProperty.call(body, "backendError");
|
|
344
|
+
if (envelopeDetected) {
|
|
345
|
+
fallback.data = body;
|
|
346
|
+
fallback.raw = body.raw ?? body;
|
|
347
|
+
fallback.backendStatus = typeof body.backendStatus === "number" ? body.backendStatus : status;
|
|
348
|
+
fallback.backendError = typeof body.backendError === "string" ? body.backendError : fallback.error ?? null;
|
|
349
|
+
} else {
|
|
350
|
+
if (!fallback.data && body !== void 0) {
|
|
351
|
+
fallback.data = body ?? null;
|
|
352
|
+
}
|
|
353
|
+
if (!fallback.raw && body !== void 0) {
|
|
354
|
+
fallback.raw = body ?? null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
fallback.rawResponse = responseCandidate ?? err;
|
|
358
|
+
fallback.body = body ?? null;
|
|
359
|
+
if (fallback.error && err.message && !fallback.error.includes(err.message)) {
|
|
360
|
+
fallback.error = fallback.error + ". " + err.message;
|
|
361
|
+
} else if (!fallback.error) {
|
|
362
|
+
fallback.error = err.message ?? "Request failed";
|
|
363
|
+
}
|
|
364
|
+
if (fallback.status >= 400) {
|
|
365
|
+
summarizeErrorResponse("http_exception", requestOptions, status ?? fallback.status ?? 0, body ?? null, fallback, responseCandidate ?? err);
|
|
366
|
+
}
|
|
367
|
+
return fallback;
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
ok: false,
|
|
371
|
+
status: 0,
|
|
372
|
+
data: null,
|
|
373
|
+
error: lastError instanceof Error ? lastError.message : "Request failed",
|
|
374
|
+
raw: null
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function buildCaller(context, credentialType) {
|
|
378
|
+
return async (options) => {
|
|
379
|
+
const response = await context.helpers.requestWithAuthentication.call(
|
|
380
|
+
context,
|
|
381
|
+
credentialType,
|
|
382
|
+
options
|
|
383
|
+
);
|
|
384
|
+
return {
|
|
385
|
+
statusCode: response.statusCode,
|
|
386
|
+
body: response.body,
|
|
387
|
+
rawBody: response.rawBody ?? response.body ?? response.data ?? null,
|
|
388
|
+
data: response.data ?? null,
|
|
389
|
+
headers: response.headers,
|
|
390
|
+
rawResponse: response
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function createSallaActionsClient(context, credentials, credentialType = SALLA_CREDENTIAL_NAME) {
|
|
395
|
+
const caller = buildCaller(context, credentialType);
|
|
396
|
+
async function request(options) {
|
|
397
|
+
const requestOptions = {
|
|
398
|
+
method: options.method,
|
|
399
|
+
url: buildActionsUrl(credentials.baseUrl, options.path),
|
|
400
|
+
qs: options.qs,
|
|
401
|
+
body: options.body,
|
|
402
|
+
headers: options.headers,
|
|
403
|
+
json: true,
|
|
404
|
+
timeout: DEFAULT_TIMEOUT
|
|
405
|
+
};
|
|
406
|
+
const advanced = requestOptions;
|
|
407
|
+
advanced["returnFullResponse"] = true;
|
|
408
|
+
advanced["resolveWithFullResponse"] = true;
|
|
409
|
+
advanced["ignoreHttpStatusErrors"] = true;
|
|
410
|
+
return executeWithRetry(caller, requestOptions);
|
|
411
|
+
}
|
|
412
|
+
async function proxy(options) {
|
|
413
|
+
const requestOptions = {
|
|
414
|
+
method: "POST",
|
|
415
|
+
url: buildProxyUrl(credentials.baseUrl),
|
|
416
|
+
body: {
|
|
417
|
+
salla_merchant_id: credentials.salla_merchant_id,
|
|
418
|
+
method: options.method,
|
|
419
|
+
path: options.path,
|
|
420
|
+
payload: options.payload ?? null
|
|
421
|
+
},
|
|
422
|
+
json: true,
|
|
423
|
+
timeout: DEFAULT_TIMEOUT
|
|
424
|
+
};
|
|
425
|
+
const advanced = requestOptions;
|
|
426
|
+
advanced["returnFullResponse"] = true;
|
|
427
|
+
advanced["resolveWithFullResponse"] = true;
|
|
428
|
+
advanced["ignoreHttpStatusErrors"] = true;
|
|
429
|
+
return executeWithRetry(caller, requestOptions);
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
request,
|
|
433
|
+
proxy
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
437
|
+
0 && (module.exports = {
|
|
438
|
+
createSallaActionsClient
|
|
439
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// shared/sallaActionsMap.ts
|
|
23
|
+
var sallaActionsMap_exports = {};
|
|
24
|
+
__export(sallaActionsMap_exports, {
|
|
25
|
+
sallaActionsMap: () => sallaActionsMap
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(sallaActionsMap_exports);
|
|
28
|
+
var sallaActionsMap = require("../data/salla_actions_map.json");
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-n8ndesigner-salla-n8nai",
|
|
3
|
+
"version": "0.3.158",
|
|
4
|
+
"description": "Receive and handle Salla webhook events routed through N8N Designer with support for multi-endpoint workflows and event-based routing",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/**",
|
|
11
|
+
"assets/**",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"n8n-community-node",
|
|
17
|
+
"n8n",
|
|
18
|
+
"salla",
|
|
19
|
+
"ecommerce",
|
|
20
|
+
"n8ndesigner",
|
|
21
|
+
"salla-nodes",
|
|
22
|
+
"n8nai",
|
|
23
|
+
"n8n-salla",
|
|
24
|
+
"n8n-designer"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://n8ndesigner.com/",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/alhabir/n8n-nodes-n8ndesigner-salla-n8nai.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/alhabir/n8n-nodes-n8ndesigner-salla-n8nai/issues"
|
|
33
|
+
},
|
|
34
|
+
"author": "N8NDesigner",
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "echo \"Skipping build; dist already compiled\"",
|
|
37
|
+
"pack:check": "npm pack --dry-run && tar -tf $(ls -1t n8n-nodes-salla-n8nai-*.tgz | head -n1)",
|
|
38
|
+
"publish:public": "npm publish --access public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"n8n-workflow": "^1.116.0"
|
|
42
|
+
},
|
|
43
|
+
"n8n": {
|
|
44
|
+
"nodes": [
|
|
45
|
+
"dist/nodes/Actions/SallaActions.node.js",
|
|
46
|
+
"dist/nodes/Orders/UpdateOrderStatus.node.js",
|
|
47
|
+
"dist/nodes/Customers/DeleteCustomer.node.js",
|
|
48
|
+
"dist/nodes/Triggers/OrderStatusUpdatedTrigger.node.js",
|
|
49
|
+
"dist/nodes/Triggers/CustomerCreatedTrigger.node.js",
|
|
50
|
+
"dist/nodes/Triggers/SallaTriggers.node.js",
|
|
51
|
+
"dist/nodes/Triggers/SallaTrigger.node.js"
|
|
52
|
+
],
|
|
53
|
+
"credentials": [
|
|
54
|
+
"dist/credentials/SallaActionsApi.credentials.js"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18.0.0"
|
|
59
|
+
}
|
|
60
|
+
}
|