n8n-nodes-amazon-selling-partner-marketplace 0.0.14
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.md +19 -0
- package/README.md +125 -0
- package/dist/credentials/AmazonSpApi.credentials.d.ts +10 -0
- package/dist/credentials/AmazonSpApi.credentials.js +267 -0
- package/dist/credentials/AmazonSpApi.credentials.js.map +1 -0
- package/dist/icons/amazon-sp.dark.svg +13 -0
- package/dist/icons/amazon-sp.svg +13 -0
- package/dist/nodes/AmazonSellingPartner/AmazonSellingPartner.node.d.ts +5 -0
- package/dist/nodes/AmazonSellingPartner/AmazonSellingPartner.node.js +93 -0
- package/dist/nodes/AmazonSellingPartner/AmazonSellingPartner.node.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/AmazonSellingPartner.node.json +18 -0
- package/dist/nodes/AmazonSellingPartner/amazonSpApi.svg +25 -0
- package/dist/nodes/AmazonSellingPartner/core/AuditLogger.d.ts +67 -0
- package/dist/nodes/AmazonSellingPartner/core/AuditLogger.js +296 -0
- package/dist/nodes/AmazonSellingPartner/core/AuditLogger.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/core/ErrorHandler.d.ts +6 -0
- package/dist/nodes/AmazonSellingPartner/core/ErrorHandler.js +82 -0
- package/dist/nodes/AmazonSellingPartner/core/ErrorHandler.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/core/MetricsCollector.d.ts +48 -0
- package/dist/nodes/AmazonSellingPartner/core/MetricsCollector.js +181 -0
- package/dist/nodes/AmazonSellingPartner/core/MetricsCollector.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/core/RateLimiter.d.ts +43 -0
- package/dist/nodes/AmazonSellingPartner/core/RateLimiter.js +260 -0
- package/dist/nodes/AmazonSellingPartner/core/RateLimiter.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/core/SecurityValidator.d.ts +35 -0
- package/dist/nodes/AmazonSellingPartner/core/SecurityValidator.js +383 -0
- package/dist/nodes/AmazonSellingPartner/core/SecurityValidator.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/core/rateLimitConfig.d.ts +14 -0
- package/dist/nodes/AmazonSellingPartner/core/rateLimitConfig.js +93 -0
- package/dist/nodes/AmazonSellingPartner/core/rateLimitConfig.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/descriptions/Custom.description.d.ts +3 -0
- package/dist/nodes/AmazonSellingPartner/descriptions/Custom.description.js +147 -0
- package/dist/nodes/AmazonSellingPartner/descriptions/Custom.description.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/generated/Generated.description.d.ts +4977 -0
- package/dist/nodes/AmazonSellingPartner/generated/Generated.description.js +40893 -0
- package/dist/nodes/AmazonSellingPartner/generated/Generated.description.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/helpers/LwaClient.d.ts +10 -0
- package/dist/nodes/AmazonSellingPartner/helpers/LwaClient.js +79 -0
- package/dist/nodes/AmazonSellingPartner/helpers/LwaClient.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/helpers/RdtClient.d.ts +11 -0
- package/dist/nodes/AmazonSellingPartner/helpers/RdtClient.js +66 -0
- package/dist/nodes/AmazonSellingPartner/helpers/RdtClient.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/helpers/ReportDownloader.d.ts +16 -0
- package/dist/nodes/AmazonSellingPartner/helpers/ReportDownloader.js +65 -0
- package/dist/nodes/AmazonSellingPartner/helpers/ReportDownloader.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/helpers/SigV4Signer.d.ts +4 -0
- package/dist/nodes/AmazonSellingPartner/helpers/SigV4Signer.js +76 -0
- package/dist/nodes/AmazonSellingPartner/helpers/SigV4Signer.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/helpers/SpApiRequest.d.ts +23 -0
- package/dist/nodes/AmazonSellingPartner/helpers/SpApiRequest.js +220 -0
- package/dist/nodes/AmazonSellingPartner/helpers/SpApiRequest.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/helpers/downloadPresigned.d.ts +4 -0
- package/dist/nodes/AmazonSellingPartner/helpers/downloadPresigned.js +16 -0
- package/dist/nodes/AmazonSellingPartner/helpers/downloadPresigned.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/helpers/graphql.d.ts +1 -0
- package/dist/nodes/AmazonSellingPartner/helpers/graphql.js +13 -0
- package/dist/nodes/AmazonSellingPartner/helpers/graphql.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/operations/Custom.operations.d.ts +2 -0
- package/dist/nodes/AmazonSellingPartner/operations/Custom.operations.js +232 -0
- package/dist/nodes/AmazonSellingPartner/operations/Custom.operations.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/operations/Generated.operations.d.ts +2 -0
- package/dist/nodes/AmazonSellingPartner/operations/Generated.operations.js +186 -0
- package/dist/nodes/AmazonSellingPartner/operations/Generated.operations.js.map +1 -0
- package/dist/nodes/AmazonSellingPartner/operations/analytics/constants.d.ts +126 -0
- package/dist/nodes/AmazonSellingPartner/operations/analytics/constants.js +213 -0
- package/dist/nodes/AmazonSellingPartner/operations/analytics/constants.js.map +1 -0
- package/dist/package.json +63 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.securityValidator = exports.SecurityValidator = void 0;
|
|
4
|
+
const AuditLogger_1 = require("./AuditLogger");
|
|
5
|
+
class SecurityValidator {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.suspiciousPatterns = [
|
|
8
|
+
/(\b(SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC|UNION|SCRIPT)\b)/i,
|
|
9
|
+
/<script[^>]*>.*?<\/script>/gi,
|
|
10
|
+
/javascript:/gi,
|
|
11
|
+
/on\w+\s*=/gi,
|
|
12
|
+
/[;&|`$(){}[\]]/,
|
|
13
|
+
/\.\.\//,
|
|
14
|
+
/\.\.\\/,
|
|
15
|
+
/\x00/,
|
|
16
|
+
];
|
|
17
|
+
this.marketplaceIdPattern = /^[A-Z0-9]{10,15}$/;
|
|
18
|
+
this.datePattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/;
|
|
19
|
+
}
|
|
20
|
+
validateInput(data, rules, nodeId) {
|
|
21
|
+
const result = {
|
|
22
|
+
isValid: true,
|
|
23
|
+
errors: [],
|
|
24
|
+
sanitizedData: {},
|
|
25
|
+
};
|
|
26
|
+
try {
|
|
27
|
+
for (const rule of rules) {
|
|
28
|
+
const value = this.getNestedValue(data, rule.field);
|
|
29
|
+
const fieldResult = this.validateField(value, rule, nodeId);
|
|
30
|
+
if (!fieldResult.isValid) {
|
|
31
|
+
result.isValid = false;
|
|
32
|
+
result.errors.push(...fieldResult.errors);
|
|
33
|
+
}
|
|
34
|
+
else if (fieldResult.sanitizedValue !== undefined) {
|
|
35
|
+
this.setNestedValue(result.sanitizedData, rule.field, fieldResult.sanitizedValue);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
AuditLogger_1.auditLogger.logEvent({
|
|
39
|
+
nodeId,
|
|
40
|
+
action: 'input_validation',
|
|
41
|
+
resource: 'data',
|
|
42
|
+
details: {
|
|
43
|
+
fieldsValidated: rules.map(r => r.field),
|
|
44
|
+
isValid: result.isValid,
|
|
45
|
+
errorCount: result.errors.length,
|
|
46
|
+
},
|
|
47
|
+
severity: result.isValid ? 'low' : 'medium',
|
|
48
|
+
source: 'system',
|
|
49
|
+
outcome: result.isValid ? 'success' : 'failure',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
result.isValid = false;
|
|
54
|
+
result.errors.push(`Validation error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
55
|
+
AuditLogger_1.auditLogger.logError(nodeId, error instanceof Error ? error : new Error('Validation failed'), {
|
|
56
|
+
context: 'input_validation',
|
|
57
|
+
rules: rules.map(r => r.field),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
validateMarketplaceIds(marketplaceIds, nodeId) {
|
|
63
|
+
const rules = [
|
|
64
|
+
{
|
|
65
|
+
field: 'marketplaceIds',
|
|
66
|
+
required: true,
|
|
67
|
+
type: 'array',
|
|
68
|
+
customValidator: (value) => {
|
|
69
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
70
|
+
return 'At least one marketplace ID is required';
|
|
71
|
+
}
|
|
72
|
+
for (const id of value) {
|
|
73
|
+
if (!this.marketplaceIdPattern.test(id)) {
|
|
74
|
+
return `Invalid marketplace ID format: ${id}`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
return this.validateInput({ marketplaceIds }, rules, nodeId);
|
|
82
|
+
}
|
|
83
|
+
validateDateRange(createdAfter, createdBefore, nodeId) {
|
|
84
|
+
const rules = [
|
|
85
|
+
{
|
|
86
|
+
field: 'createdAfter',
|
|
87
|
+
required: true,
|
|
88
|
+
pattern: this.datePattern,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
field: 'createdBefore',
|
|
92
|
+
required: true,
|
|
93
|
+
pattern: this.datePattern,
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
const result = this.validateInput({ createdAfter, createdBefore }, rules, nodeId);
|
|
97
|
+
if (result.isValid) {
|
|
98
|
+
const afterDate = new Date(createdAfter);
|
|
99
|
+
const beforeDate = new Date(createdBefore);
|
|
100
|
+
const daysDiff = Math.ceil((beforeDate.getTime() - afterDate.getTime()) / (1000 * 60 * 60 * 24));
|
|
101
|
+
if (afterDate >= beforeDate) {
|
|
102
|
+
result.isValid = false;
|
|
103
|
+
result.errors.push('Created After date must be before Created Before date');
|
|
104
|
+
}
|
|
105
|
+
if (daysDiff > 30) {
|
|
106
|
+
result.isValid = false;
|
|
107
|
+
result.errors.push('Date range cannot exceed 30 days');
|
|
108
|
+
}
|
|
109
|
+
const twoYearsAgo = new Date();
|
|
110
|
+
twoYearsAgo.setFullYear(twoYearsAgo.getFullYear() - 2);
|
|
111
|
+
if (afterDate < twoYearsAgo) {
|
|
112
|
+
AuditLogger_1.auditLogger.logSuspiciousActivity(nodeId, 'old_date_range_request', {
|
|
113
|
+
createdAfter,
|
|
114
|
+
createdBefore,
|
|
115
|
+
daysDiff,
|
|
116
|
+
yearsAgo: (Date.now() - afterDate.getTime()) / (1000 * 60 * 60 * 24 * 365),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
sanitizeString(input) {
|
|
123
|
+
if (typeof input !== 'string') {
|
|
124
|
+
return String(input);
|
|
125
|
+
}
|
|
126
|
+
let sanitized = input.replace(/\x00/g, '');
|
|
127
|
+
sanitized = sanitized
|
|
128
|
+
.replace(/&/g, '&')
|
|
129
|
+
.replace(/</g, '<')
|
|
130
|
+
.replace(/>/g, '>')
|
|
131
|
+
.replace(/"/g, '"')
|
|
132
|
+
.replace(/'/g, ''');
|
|
133
|
+
sanitized = sanitized.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '');
|
|
134
|
+
return sanitized.trim();
|
|
135
|
+
}
|
|
136
|
+
detectSuspiciousPatterns(input, nodeId) {
|
|
137
|
+
if (typeof input !== 'string') {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
for (const pattern of this.suspiciousPatterns) {
|
|
141
|
+
if (pattern.test(input)) {
|
|
142
|
+
AuditLogger_1.auditLogger.logSuspiciousActivity(nodeId, 'malicious_input_detected', {
|
|
143
|
+
input: input.substring(0, 100),
|
|
144
|
+
pattern: pattern.toString(),
|
|
145
|
+
attackVector: 'input_injection',
|
|
146
|
+
});
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
validateCredentials(credentials, nodeId, useAwsSigning = false) {
|
|
153
|
+
const rules = [
|
|
154
|
+
{
|
|
155
|
+
field: 'lwaClientId',
|
|
156
|
+
required: true,
|
|
157
|
+
type: 'string',
|
|
158
|
+
minLength: 10,
|
|
159
|
+
maxLength: 100,
|
|
160
|
+
sanitize: true,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
field: 'lwaClientSecret',
|
|
164
|
+
required: true,
|
|
165
|
+
type: 'string',
|
|
166
|
+
minLength: 10,
|
|
167
|
+
maxLength: 200,
|
|
168
|
+
sanitize: true,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
field: 'lwaRefreshToken',
|
|
172
|
+
required: true,
|
|
173
|
+
type: 'string',
|
|
174
|
+
minLength: 10,
|
|
175
|
+
maxLength: 500,
|
|
176
|
+
sanitize: true,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
field: 'awsRegion',
|
|
180
|
+
required: true,
|
|
181
|
+
type: 'string',
|
|
182
|
+
allowedValues: ['us-east-1', 'us-west-2', 'eu-west-1', 'eu-central-1', 'ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2'],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
field: 'environment',
|
|
186
|
+
required: true,
|
|
187
|
+
type: 'string',
|
|
188
|
+
allowedValues: ['sandbox', 'production'],
|
|
189
|
+
},
|
|
190
|
+
];
|
|
191
|
+
if (useAwsSigning) {
|
|
192
|
+
const advancedOptions = credentials.advancedOptions || {};
|
|
193
|
+
const awsAccessKeyId = credentials.awsAccessKeyId || advancedOptions.awsAccessKeyId;
|
|
194
|
+
const awsSecretAccessKey = credentials.awsSecretAccessKey || advancedOptions.awsSecretAccessKey;
|
|
195
|
+
if (!awsAccessKeyId) {
|
|
196
|
+
return {
|
|
197
|
+
isValid: false,
|
|
198
|
+
errors: ['AWS Access Key ID is required when AWS signing is enabled'],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (!awsSecretAccessKey) {
|
|
202
|
+
return {
|
|
203
|
+
isValid: false,
|
|
204
|
+
errors: ['AWS Secret Access Key is required when AWS signing is enabled'],
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (typeof awsAccessKeyId === 'string') {
|
|
208
|
+
if (awsAccessKeyId.length < 16 || awsAccessKeyId.length > 30) {
|
|
209
|
+
return {
|
|
210
|
+
isValid: false,
|
|
211
|
+
errors: ['AWS Access Key ID must be between 16 and 30 characters'],
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
if (!/^[A-Z0-9]+$/.test(awsAccessKeyId)) {
|
|
215
|
+
return {
|
|
216
|
+
isValid: false,
|
|
217
|
+
errors: ['AWS Access Key ID contains invalid characters'],
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (typeof awsSecretAccessKey === 'string') {
|
|
222
|
+
if (awsSecretAccessKey.length < 20 || awsSecretAccessKey.length > 100) {
|
|
223
|
+
return {
|
|
224
|
+
isValid: false,
|
|
225
|
+
errors: ['AWS Secret Access Key must be between 20 and 100 characters'],
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return this.validateInput(credentials, rules, nodeId);
|
|
231
|
+
}
|
|
232
|
+
validateApiParameters(params, nodeId) {
|
|
233
|
+
const result = {
|
|
234
|
+
isValid: true,
|
|
235
|
+
errors: [],
|
|
236
|
+
sanitizedData: {},
|
|
237
|
+
};
|
|
238
|
+
for (const [key, value] of Object.entries(params)) {
|
|
239
|
+
if (typeof value === 'string' && this.detectSuspiciousPatterns(value, nodeId)) {
|
|
240
|
+
result.isValid = false;
|
|
241
|
+
result.errors.push(`Suspicious pattern detected in parameter: ${key}`);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (typeof value === 'string') {
|
|
245
|
+
result.sanitizedData[key] = this.sanitizeString(value);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
result.sanitizedData[key] = value;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return result;
|
|
252
|
+
}
|
|
253
|
+
checkRateLimitCompliance(endpoint, nodeId) {
|
|
254
|
+
AuditLogger_1.auditLogger.logEvent({
|
|
255
|
+
nodeId,
|
|
256
|
+
action: 'rate_limit_check',
|
|
257
|
+
resource: endpoint,
|
|
258
|
+
details: { endpoint },
|
|
259
|
+
severity: 'low',
|
|
260
|
+
source: 'system',
|
|
261
|
+
outcome: 'success',
|
|
262
|
+
});
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
validateEnvironmentIsolation(credentials, nodeId) {
|
|
266
|
+
const result = {
|
|
267
|
+
isValid: true,
|
|
268
|
+
errors: [],
|
|
269
|
+
};
|
|
270
|
+
if (credentials.environment === 'production') {
|
|
271
|
+
const credentialString = JSON.stringify(credentials).toLowerCase();
|
|
272
|
+
if (credentialString.includes('sandbox') || credentialString.includes('test')) {
|
|
273
|
+
result.isValid = false;
|
|
274
|
+
result.errors.push('Production environment contains test/sandbox references');
|
|
275
|
+
AuditLogger_1.auditLogger.logSecurityEvent({
|
|
276
|
+
nodeId,
|
|
277
|
+
action: 'environment_isolation_violation',
|
|
278
|
+
resource: 'credentials',
|
|
279
|
+
details: {
|
|
280
|
+
environment: credentials.environment,
|
|
281
|
+
violation: 'mixed_environment_credentials',
|
|
282
|
+
},
|
|
283
|
+
severity: 'high',
|
|
284
|
+
source: 'system',
|
|
285
|
+
outcome: 'failure',
|
|
286
|
+
threatLevel: 'medium',
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return result;
|
|
291
|
+
}
|
|
292
|
+
validateField(value, rule, nodeId) {
|
|
293
|
+
const result = {
|
|
294
|
+
isValid: true,
|
|
295
|
+
errors: [],
|
|
296
|
+
sanitizedValue: value
|
|
297
|
+
};
|
|
298
|
+
if (rule.required && (value === undefined || value === null || value === '')) {
|
|
299
|
+
result.isValid = false;
|
|
300
|
+
result.errors.push(`${rule.field} is required`);
|
|
301
|
+
return result;
|
|
302
|
+
}
|
|
303
|
+
if (!rule.required && (value === undefined || value === null || value === '')) {
|
|
304
|
+
return result;
|
|
305
|
+
}
|
|
306
|
+
if (rule.type) {
|
|
307
|
+
const typeValid = this.validateType(value, rule.type);
|
|
308
|
+
if (!typeValid) {
|
|
309
|
+
result.isValid = false;
|
|
310
|
+
result.errors.push(`${rule.field} must be of type ${rule.type}`);
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (typeof value === 'string') {
|
|
315
|
+
if (this.detectSuspiciousPatterns(value, nodeId)) {
|
|
316
|
+
result.isValid = false;
|
|
317
|
+
result.errors.push(`${rule.field} contains suspicious patterns`);
|
|
318
|
+
return result;
|
|
319
|
+
}
|
|
320
|
+
if (rule.minLength && value.length < rule.minLength) {
|
|
321
|
+
result.isValid = false;
|
|
322
|
+
result.errors.push(`${rule.field} must be at least ${rule.minLength} characters long`);
|
|
323
|
+
}
|
|
324
|
+
if (rule.maxLength && value.length > rule.maxLength) {
|
|
325
|
+
result.isValid = false;
|
|
326
|
+
result.errors.push(`${rule.field} must not exceed ${rule.maxLength} characters`);
|
|
327
|
+
}
|
|
328
|
+
if (rule.pattern && !rule.pattern.test(value)) {
|
|
329
|
+
result.isValid = false;
|
|
330
|
+
result.errors.push(`${rule.field} does not match required pattern`);
|
|
331
|
+
}
|
|
332
|
+
if (rule.sanitize) {
|
|
333
|
+
result.sanitizedValue = this.sanitizeString(value);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (rule.allowedValues && !rule.allowedValues.includes(value)) {
|
|
337
|
+
result.isValid = false;
|
|
338
|
+
result.errors.push(`${rule.field} must be one of: ${rule.allowedValues.join(', ')}`);
|
|
339
|
+
}
|
|
340
|
+
if (rule.customValidator) {
|
|
341
|
+
const customResult = rule.customValidator(value);
|
|
342
|
+
if (customResult !== true) {
|
|
343
|
+
result.isValid = false;
|
|
344
|
+
result.errors.push(typeof customResult === 'string' ? customResult : `${rule.field} failed custom validation`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
validateType(value, type) {
|
|
350
|
+
switch (type) {
|
|
351
|
+
case 'string':
|
|
352
|
+
return typeof value === 'string';
|
|
353
|
+
case 'number':
|
|
354
|
+
return typeof value === 'number' && !isNaN(value);
|
|
355
|
+
case 'boolean':
|
|
356
|
+
return typeof value === 'boolean';
|
|
357
|
+
case 'array':
|
|
358
|
+
return Array.isArray(value);
|
|
359
|
+
case 'object':
|
|
360
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
361
|
+
case 'date':
|
|
362
|
+
return typeof value === 'string' && !isNaN(Date.parse(value));
|
|
363
|
+
default:
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
getNestedValue(obj, path) {
|
|
368
|
+
return path.split('.').reduce((current, key) => current && current[key], obj);
|
|
369
|
+
}
|
|
370
|
+
setNestedValue(obj, path, value) {
|
|
371
|
+
const keys = path.split('.');
|
|
372
|
+
const lastKey = keys.pop();
|
|
373
|
+
const target = keys.reduce((current, key) => {
|
|
374
|
+
if (!current[key])
|
|
375
|
+
current[key] = {};
|
|
376
|
+
return current[key];
|
|
377
|
+
}, obj);
|
|
378
|
+
target[lastKey] = value;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
exports.SecurityValidator = SecurityValidator;
|
|
382
|
+
exports.securityValidator = new SecurityValidator();
|
|
383
|
+
//# sourceMappingURL=SecurityValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecurityValidator.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/core/SecurityValidator.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAoB5C,MAAa,iBAAiB;IAA9B;QACkB,uBAAkB,GAAG;YAErC,0EAA0E;YAE1E,8BAA8B;YAC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AC,GAAG,EAAG,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;YAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;YACrC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;IACzB,CAAC;CACD;AAxeD,8CAweC;AAGY,QAAA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface RateLimitConfig {
|
|
2
|
+
rate: number;
|
|
3
|
+
burst: number;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const RATE_LIMIT_GROUPS: Record<string, RateLimitConfig>;
|
|
7
|
+
export declare const ENDPOINT_TO_GROUP: Array<{
|
|
8
|
+
method: '*' | 'GET' | 'POST' | 'DELETE';
|
|
9
|
+
pattern: RegExp;
|
|
10
|
+
group: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function getEndpointGroup(method: string, endpoint: string): string;
|
|
13
|
+
export declare function getRateLimitConfig(group: string): RateLimitConfig;
|
|
14
|
+
export declare function validateRateLimitConfig(config: RateLimitConfig): boolean;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENDPOINT_TO_GROUP = exports.RATE_LIMIT_GROUPS = void 0;
|
|
4
|
+
exports.getEndpointGroup = getEndpointGroup;
|
|
5
|
+
exports.getRateLimitConfig = getRateLimitConfig;
|
|
6
|
+
exports.validateRateLimitConfig = validateRateLimitConfig;
|
|
7
|
+
exports.RATE_LIMIT_GROUPS = {
|
|
8
|
+
'orders-detail': {
|
|
9
|
+
rate: 0.5,
|
|
10
|
+
burst: 30,
|
|
11
|
+
description: 'Order detail operations: getOrder, getOrderItems, getOrderAddress, getOrderBuyerInfo, etc.'
|
|
12
|
+
},
|
|
13
|
+
'orders-list': {
|
|
14
|
+
rate: 0.0167,
|
|
15
|
+
burst: 20,
|
|
16
|
+
description: 'Order list operations: getOrders'
|
|
17
|
+
},
|
|
18
|
+
'orders-update': {
|
|
19
|
+
rate: 2.0,
|
|
20
|
+
burst: 10,
|
|
21
|
+
description: 'Order update operations: confirmShipment, updateShipmentStatus'
|
|
22
|
+
},
|
|
23
|
+
'reports': {
|
|
24
|
+
rate: 0.0167,
|
|
25
|
+
burst: 15,
|
|
26
|
+
description: 'Reports API operations: createReport, getReport, getReportDocument'
|
|
27
|
+
},
|
|
28
|
+
'dataKiosk-queries-create': { rate: 0.0167, burst: 15, description: 'POST /dataKiosk/2023-11-15/queries' },
|
|
29
|
+
'dataKiosk-queries-list': { rate: 0.0222, burst: 10, description: 'GET /dataKiosk/2023-11-15/queries' },
|
|
30
|
+
'dataKiosk-queries-get': { rate: 2.0, burst: 15, description: 'GET /dataKiosk/2023-11-15/queries/{id}' },
|
|
31
|
+
'dataKiosk-queries-cancel': { rate: 0.0222, burst: 10, description: 'DELETE /dataKiosk/2023-11-15/queries/{id}' },
|
|
32
|
+
'dataKiosk-documents': { rate: 0.0167, burst: 15, description: 'GET /dataKiosk/2023-11-15/documents/{id}' },
|
|
33
|
+
'default': {
|
|
34
|
+
rate: 0.5,
|
|
35
|
+
burst: 10,
|
|
36
|
+
description: 'Default rate limit for unclassified endpoints'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.ENDPOINT_TO_GROUP = [
|
|
40
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+\/orderItems/, group: 'orders-detail' },
|
|
41
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+\/orderAddress/, group: 'orders-detail' },
|
|
42
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+\/buyerInfo/, group: 'orders-detail' },
|
|
43
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+\/orderItemsBuyerInfo/, group: 'orders-detail' },
|
|
44
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+\/regulatedInfo/, group: 'orders-detail' },
|
|
45
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+$/, group: 'orders-detail' },
|
|
46
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/?(\?.*)?$/, group: 'orders-list' },
|
|
47
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+\/shipment/, group: 'orders-update' },
|
|
48
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+\/shipmentConfirmation$/, group: 'orders-update' },
|
|
49
|
+
{ method: '*', pattern: /^\/orders\/v0\/orders\/[^\/]+\/shipmentStatus$/, group: 'orders-update' },
|
|
50
|
+
{ method: '*', pattern: /^\/reports\/2021-06-30\/reports\/?(\?.*)?$/, group: 'reports' },
|
|
51
|
+
{ method: '*', pattern: /^\/reports\/2021-06-30\/reports\/[^\/]+$/, group: 'reports' },
|
|
52
|
+
{ method: '*', pattern: /^\/reports\/2021-06-30\/documents\/[^\/]+$/, group: 'reports' },
|
|
53
|
+
{ method: 'POST', pattern: /^\/dataKiosk\/2023-11-15\/queries$/, group: 'dataKiosk-queries-create' },
|
|
54
|
+
{ method: 'GET', pattern: /^\/dataKiosk\/2023-11-15\/queries(\?.*)?$/, group: 'dataKiosk-queries-list' },
|
|
55
|
+
{ method: 'GET', pattern: /^\/dataKiosk\/2023-11-15\/queries\/[^\/]+$/, group: 'dataKiosk-queries-get' },
|
|
56
|
+
{ method: 'DELETE', pattern: /^\/dataKiosk\/2023-11-15\/queries\/[^\/]+$/, group: 'dataKiosk-queries-cancel' },
|
|
57
|
+
{ method: 'GET', pattern: /^\/dataKiosk\/2023-11-15\/documents\/[^\/]+$/, group: 'dataKiosk-documents' },
|
|
58
|
+
];
|
|
59
|
+
function getEndpointGroup(method, endpoint) {
|
|
60
|
+
for (const { method: m, pattern, group } of exports.ENDPOINT_TO_GROUP) {
|
|
61
|
+
if ((m === '*' || m === method) && pattern.test(endpoint)) {
|
|
62
|
+
return group;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return 'default';
|
|
66
|
+
}
|
|
67
|
+
function getRateLimitConfig(group) {
|
|
68
|
+
const baseConfig = exports.RATE_LIMIT_GROUPS[group] || exports.RATE_LIMIT_GROUPS['default'];
|
|
69
|
+
const envOverride = process.env.RATE_LIMIT_OVERRIDE_JSON;
|
|
70
|
+
if (envOverride) {
|
|
71
|
+
try {
|
|
72
|
+
const overrides = JSON.parse(envOverride);
|
|
73
|
+
if (overrides[group]) {
|
|
74
|
+
return {
|
|
75
|
+
...baseConfig,
|
|
76
|
+
...overrides[group]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.warn('Failed to parse RATE_LIMIT_OVERRIDE_JSON:', error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return baseConfig;
|
|
85
|
+
}
|
|
86
|
+
function validateRateLimitConfig(config) {
|
|
87
|
+
return (typeof config.rate === 'number' &&
|
|
88
|
+
config.rate > 0 &&
|
|
89
|
+
typeof config.burst === 'number' &&
|
|
90
|
+
config.burst > 0 &&
|
|
91
|
+
config.burst >= 1);
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=rateLimitConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateLimitConfig.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/core/rateLimitConfig.ts"],"names":[],"mappings":";;;AAmFA,4CAOC;AAKD,gDAoBC;AAKD,0DAQC;AAzHY,QAAA,iBAAiB,GAAoC;IAEjE,eAAe,EAAE;QAChB,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,EAAE;QACT,WAAW,EA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AAG,CAAC;QAChB,MAAM,CAAC,KAAK,IAAI,CAAC,CACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customFields = exports.customOperations = void 0;
|
|
4
|
+
exports.customOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['custom'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Custom Request',
|
|
18
|
+
value: 'customRequest',
|
|
19
|
+
description: 'Send a custom SP-API request',
|
|
20
|
+
action: 'Send a custom request',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Request via JSON Definition',
|
|
24
|
+
value: 'jsonDefinition',
|
|
25
|
+
description: 'Provide a full JSON definition for the request',
|
|
26
|
+
action: 'Send a request via JSON definition',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
default: 'customRequest',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
exports.customFields = [
|
|
33
|
+
{
|
|
34
|
+
displayName: 'HTTP Method',
|
|
35
|
+
name: 'method',
|
|
36
|
+
type: 'options',
|
|
37
|
+
displayOptions: {
|
|
38
|
+
show: {
|
|
39
|
+
resource: ['custom'],
|
|
40
|
+
operation: ['customRequest'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
options: [
|
|
44
|
+
{ name: 'GET', value: 'GET' },
|
|
45
|
+
{ name: 'POST', value: 'POST' },
|
|
46
|
+
{ name: 'PUT', value: 'PUT' },
|
|
47
|
+
{ name: 'PATCH', value: 'PATCH' },
|
|
48
|
+
{ name: 'DELETE', value: 'DELETE' },
|
|
49
|
+
],
|
|
50
|
+
default: 'GET',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Endpoint',
|
|
54
|
+
name: 'endpoint',
|
|
55
|
+
type: 'string',
|
|
56
|
+
displayOptions: {
|
|
57
|
+
show: {
|
|
58
|
+
resource: ['custom'],
|
|
59
|
+
operation: ['customRequest'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
default: '/catalog/2022-04-01/items',
|
|
63
|
+
description: 'SP-API path starting with /. Full URLs are also supported.',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Query (JSON)',
|
|
67
|
+
name: 'queryJson',
|
|
68
|
+
type: 'json',
|
|
69
|
+
displayOptions: {
|
|
70
|
+
show: {
|
|
71
|
+
resource: ['custom'],
|
|
72
|
+
operation: ['customRequest'],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
default: '{}',
|
|
76
|
+
description: 'Query string parameters as JSON object',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Body (JSON)',
|
|
80
|
+
name: 'bodyJson',
|
|
81
|
+
type: 'json',
|
|
82
|
+
displayOptions: {
|
|
83
|
+
show: {
|
|
84
|
+
resource: ['custom'],
|
|
85
|
+
operation: ['customRequest'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
default: '{}',
|
|
89
|
+
description: 'JSON body (for GET/HEAD it is merged into query)',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Headers (JSON)',
|
|
93
|
+
name: 'headersJson',
|
|
94
|
+
type: 'json',
|
|
95
|
+
displayOptions: {
|
|
96
|
+
show: {
|
|
97
|
+
resource: ['custom'],
|
|
98
|
+
operation: ['customRequest'],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
default: '{}',
|
|
102
|
+
description: 'Additional headers as JSON object',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
displayName: 'Response Type',
|
|
106
|
+
name: 'responseType',
|
|
107
|
+
type: 'options',
|
|
108
|
+
displayOptions: {
|
|
109
|
+
show: {
|
|
110
|
+
resource: ['custom'],
|
|
111
|
+
operation: ['customRequest'],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
options: [
|
|
115
|
+
{ name: 'JSON', value: 'json' },
|
|
116
|
+
{ name: 'Text', value: 'text' },
|
|
117
|
+
],
|
|
118
|
+
default: 'json',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
displayName: 'Include Response Metadata',
|
|
122
|
+
name: 'includeMetadata',
|
|
123
|
+
type: 'boolean',
|
|
124
|
+
displayOptions: {
|
|
125
|
+
show: {
|
|
126
|
+
resource: ['custom'],
|
|
127
|
+
operation: ['customRequest'],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
default: false,
|
|
131
|
+
description: 'Include status code and headers in the output',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Request Definition (JSON)',
|
|
135
|
+
name: 'requestJson',
|
|
136
|
+
type: 'json',
|
|
137
|
+
displayOptions: {
|
|
138
|
+
show: {
|
|
139
|
+
resource: ['custom'],
|
|
140
|
+
operation: ['jsonDefinition'],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
default: '{}',
|
|
144
|
+
description: 'Fields: method, endpoint, query, body, headers, responseType, includeMetadata. You can also pass an array.',
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
//# sourceMappingURL=Custom.description.js.map
|