n8n-nodes-amazon-selling-partner-dnangelx 0.0.3 → 0.0.5

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.
Files changed (104) hide show
  1. package/dist/credentials/AmazonSpApi.credentials.d.ts +9 -0
  2. package/dist/credentials/AmazonSpApi.credentials.js +212 -0
  3. package/dist/credentials/AmazonSpApi.credentials.js.map +1 -0
  4. package/dist/nodes/AmazonSellingPartner/AmazonSellingPartner.node.d.ts +1 -1
  5. package/dist/nodes/AmazonSellingPartner/AmazonSellingPartner.node.js +142 -33
  6. package/dist/nodes/AmazonSellingPartner/AmazonSellingPartner.node.js.map +1 -1
  7. package/dist/nodes/AmazonSellingPartner/AmazonSellingPartner.node.json +1 -1
  8. package/dist/nodes/AmazonSellingPartner/amazonSpApi.svg +25 -0
  9. package/dist/nodes/AmazonSellingPartner/core/AuditLogger.d.ts +67 -0
  10. package/dist/nodes/AmazonSellingPartner/core/AuditLogger.js +296 -0
  11. package/dist/nodes/AmazonSellingPartner/core/AuditLogger.js.map +1 -0
  12. package/dist/nodes/AmazonSellingPartner/core/ErrorHandler.d.ts +6 -0
  13. package/dist/nodes/AmazonSellingPartner/core/ErrorHandler.js +82 -0
  14. package/dist/nodes/AmazonSellingPartner/core/ErrorHandler.js.map +1 -0
  15. package/dist/nodes/AmazonSellingPartner/core/MetricsCollector.d.ts +48 -0
  16. package/dist/nodes/AmazonSellingPartner/core/MetricsCollector.js +181 -0
  17. package/dist/nodes/AmazonSellingPartner/core/MetricsCollector.js.map +1 -0
  18. package/dist/nodes/AmazonSellingPartner/core/RateLimiter.d.ts +43 -0
  19. package/dist/nodes/AmazonSellingPartner/core/RateLimiter.js +260 -0
  20. package/dist/nodes/AmazonSellingPartner/core/RateLimiter.js.map +1 -0
  21. package/dist/nodes/AmazonSellingPartner/core/SecurityValidator.d.ts +35 -0
  22. package/dist/nodes/AmazonSellingPartner/core/SecurityValidator.js +383 -0
  23. package/dist/nodes/AmazonSellingPartner/core/SecurityValidator.js.map +1 -0
  24. package/dist/nodes/AmazonSellingPartner/core/rateLimitConfig.d.ts +14 -0
  25. package/dist/nodes/AmazonSellingPartner/core/rateLimitConfig.js +93 -0
  26. package/dist/nodes/AmazonSellingPartner/core/rateLimitConfig.js.map +1 -0
  27. package/dist/nodes/AmazonSellingPartner/descriptions/Analytics.description.d.ts +3 -0
  28. package/dist/nodes/AmazonSellingPartner/descriptions/Analytics.description.js +27 -0
  29. package/dist/nodes/AmazonSellingPartner/descriptions/Analytics.description.js.map +1 -0
  30. package/dist/nodes/AmazonSellingPartner/descriptions/DataKiosk.description.d.ts +3 -0
  31. package/dist/nodes/AmazonSellingPartner/descriptions/DataKiosk.description.js +196 -0
  32. package/dist/nodes/AmazonSellingPartner/descriptions/DataKiosk.description.js.map +1 -0
  33. package/dist/nodes/AmazonSellingPartner/descriptions/Finance.description.d.ts +3 -0
  34. package/dist/nodes/AmazonSellingPartner/descriptions/Finance.description.js +341 -0
  35. package/dist/nodes/AmazonSellingPartner/descriptions/Finance.description.js.map +1 -0
  36. package/dist/nodes/AmazonSellingPartner/descriptions/Invoices.description.d.ts +3 -0
  37. package/dist/nodes/AmazonSellingPartner/descriptions/Invoices.description.js +312 -0
  38. package/dist/nodes/AmazonSellingPartner/descriptions/Invoices.description.js.map +1 -0
  39. package/dist/nodes/AmazonSellingPartner/descriptions/Listings.description.d.ts +3 -0
  40. package/dist/nodes/AmazonSellingPartner/descriptions/Listings.description.js +292 -0
  41. package/dist/nodes/AmazonSellingPartner/descriptions/Listings.description.js.map +1 -0
  42. package/dist/nodes/AmazonSellingPartner/descriptions/Orders.description.d.ts +3 -0
  43. package/dist/nodes/AmazonSellingPartner/descriptions/Orders.description.js +202 -0
  44. package/dist/nodes/AmazonSellingPartner/descriptions/Orders.description.js.map +1 -0
  45. package/dist/nodes/AmazonSellingPartner/descriptions/Reports.description.d.ts +3 -0
  46. package/dist/nodes/AmazonSellingPartner/descriptions/Reports.description.js +289 -0
  47. package/dist/nodes/AmazonSellingPartner/descriptions/Reports.description.js.map +1 -0
  48. package/dist/nodes/AmazonSellingPartner/descriptions/Shipments.description.d.ts +3 -0
  49. package/dist/nodes/AmazonSellingPartner/descriptions/Shipments.description.js +181 -0
  50. package/dist/nodes/AmazonSellingPartner/descriptions/Shipments.description.js.map +1 -0
  51. package/dist/nodes/AmazonSellingPartner/helpers/LwaClient.d.ts +10 -0
  52. package/dist/nodes/AmazonSellingPartner/helpers/LwaClient.js +79 -0
  53. package/dist/nodes/AmazonSellingPartner/helpers/LwaClient.js.map +1 -0
  54. package/dist/nodes/AmazonSellingPartner/helpers/RdtClient.d.ts +11 -0
  55. package/dist/nodes/AmazonSellingPartner/helpers/RdtClient.js +66 -0
  56. package/dist/nodes/AmazonSellingPartner/helpers/RdtClient.js.map +1 -0
  57. package/dist/nodes/AmazonSellingPartner/helpers/ReportDownloader.d.ts +16 -0
  58. package/dist/nodes/AmazonSellingPartner/helpers/ReportDownloader.js +65 -0
  59. package/dist/nodes/AmazonSellingPartner/helpers/ReportDownloader.js.map +1 -0
  60. package/dist/nodes/AmazonSellingPartner/helpers/SigV4Signer.d.ts +4 -0
  61. package/dist/nodes/AmazonSellingPartner/helpers/SigV4Signer.js +76 -0
  62. package/dist/nodes/AmazonSellingPartner/helpers/SigV4Signer.js.map +1 -0
  63. package/dist/nodes/AmazonSellingPartner/helpers/SpApiRequest.d.ts +23 -0
  64. package/dist/nodes/AmazonSellingPartner/helpers/SpApiRequest.js +208 -0
  65. package/dist/nodes/AmazonSellingPartner/helpers/SpApiRequest.js.map +1 -0
  66. package/dist/nodes/AmazonSellingPartner/helpers/downloadPresigned.d.ts +4 -0
  67. package/dist/nodes/AmazonSellingPartner/helpers/downloadPresigned.js +16 -0
  68. package/dist/nodes/AmazonSellingPartner/helpers/downloadPresigned.js.map +1 -0
  69. package/dist/nodes/AmazonSellingPartner/helpers/graphql.d.ts +1 -0
  70. package/dist/nodes/AmazonSellingPartner/helpers/graphql.js +13 -0
  71. package/dist/nodes/AmazonSellingPartner/helpers/graphql.js.map +1 -0
  72. package/dist/nodes/AmazonSellingPartner/operations/Analytics.operations.d.ts +2 -0
  73. package/dist/nodes/AmazonSellingPartner/operations/Analytics.operations.js +66 -0
  74. package/dist/nodes/AmazonSellingPartner/operations/Analytics.operations.js.map +1 -0
  75. package/dist/nodes/AmazonSellingPartner/operations/DataKiosk.operations.d.ts +2 -0
  76. package/dist/nodes/AmazonSellingPartner/operations/DataKiosk.operations.js +249 -0
  77. package/dist/nodes/AmazonSellingPartner/operations/DataKiosk.operations.js.map +1 -0
  78. package/dist/nodes/AmazonSellingPartner/operations/Finance.operations.d.ts +2 -0
  79. package/dist/nodes/AmazonSellingPartner/operations/Finance.operations.js +444 -0
  80. package/dist/nodes/AmazonSellingPartner/operations/Finance.operations.js.map +1 -0
  81. package/dist/nodes/AmazonSellingPartner/operations/Invoices.operations.d.ts +4 -0
  82. package/dist/nodes/AmazonSellingPartner/operations/Invoices.operations.js +224 -0
  83. package/dist/nodes/AmazonSellingPartner/operations/Invoices.operations.js.map +1 -0
  84. package/dist/nodes/AmazonSellingPartner/operations/Listings.operations.d.ts +2 -0
  85. package/dist/nodes/AmazonSellingPartner/operations/Listings.operations.js +426 -0
  86. package/dist/nodes/AmazonSellingPartner/operations/Listings.operations.js.map +1 -0
  87. package/dist/nodes/AmazonSellingPartner/operations/Orders.operations.d.ts +2 -0
  88. package/dist/nodes/AmazonSellingPartner/operations/Orders.operations.js +169 -0
  89. package/dist/nodes/AmazonSellingPartner/operations/Orders.operations.js.map +1 -0
  90. package/dist/nodes/AmazonSellingPartner/operations/Reports.operations.d.ts +2 -0
  91. package/dist/nodes/AmazonSellingPartner/operations/Reports.operations.js +434 -0
  92. package/dist/nodes/AmazonSellingPartner/operations/Reports.operations.js.map +1 -0
  93. package/dist/nodes/AmazonSellingPartner/operations/Shipments.operations.d.ts +2 -0
  94. package/dist/nodes/AmazonSellingPartner/operations/Shipments.operations.js +78 -0
  95. package/dist/nodes/AmazonSellingPartner/operations/Shipments.operations.js.map +1 -0
  96. package/dist/nodes/AmazonSellingPartner/operations/analytics/constants.d.ts +126 -0
  97. package/dist/nodes/AmazonSellingPartner/operations/analytics/constants.js +213 -0
  98. package/dist/nodes/AmazonSellingPartner/operations/analytics/constants.js.map +1 -0
  99. package/dist/package.json +10 -2
  100. package/dist/tsconfig.tsbuildinfo +1 -1
  101. package/package.json +10 -2
  102. package/dist/credentials/AmazonSellingPartnerApi.credentials.d.ts +0 -16
  103. package/dist/credentials/AmazonSellingPartnerApi.credentials.js +0 -145
  104. package/dist/credentials/AmazonSellingPartnerApi.credentials.js.map +0 -1
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shipmentsFields = exports.shipmentsOperations = void 0;
4
+ exports.shipmentsOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['shipments'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Confirm Shipment',
18
+ value: 'confirmShipment',
19
+ description: 'Send carrier & tracking info to Amazon',
20
+ action: 'Confirm shipment',
21
+ },
22
+ {
23
+ name: 'Update Shipment Status',
24
+ value: 'updateShipmentStatus',
25
+ description: 'Update the status of a shipment',
26
+ action: 'Update shipment status',
27
+ },
28
+ ],
29
+ default: 'confirmShipment',
30
+ },
31
+ ];
32
+ exports.shipmentsFields = [
33
+ {
34
+ displayName: 'Order ID',
35
+ name: 'orderId',
36
+ type: 'string',
37
+ required: true,
38
+ displayOptions: {
39
+ show: {
40
+ resource: ['shipments'],
41
+ operation: ['confirmShipment', 'updateShipmentStatus'],
42
+ },
43
+ },
44
+ default: '',
45
+ description: 'The Amazon-defined order identifier (3-7-7 format)',
46
+ },
47
+ {
48
+ displayName: 'Marketplace ID',
49
+ name: 'marketplaceId',
50
+ type: 'options',
51
+ required: true,
52
+ displayOptions: {
53
+ show: {
54
+ resource: ['shipments'],
55
+ operation: ['confirmShipment', 'updateShipmentStatus'],
56
+ },
57
+ },
58
+ options: [
59
+ { name: 'Amazon.com (US)', value: 'ATVPDKIKX0DER' },
60
+ { name: 'Amazon.ca (Canada)', value: 'A2EUQ1WTGCTBG2' },
61
+ { name: 'Amazon.com.mx (Mexico)', value: 'A1AM78C64UM0Y8' },
62
+ { name: 'Amazon.com.br (Brazil)', value: 'A2Q3Y263D00KWC' },
63
+ { name: 'Amazon.co.uk (UK)', value: 'A1F83G8C2ARO7P' },
64
+ { name: 'Amazon.de (Germany)', value: 'A1PA6795UKMFR9' },
65
+ { name: 'Amazon.fr (France)', value: 'A13V1IB3VIYZZH' },
66
+ { name: 'Amazon.it (Italy)', value: 'APJ6JRA9NG5V4' },
67
+ { name: 'Amazon.es (Spain)', value: 'A1RKKUPIHCS9HS' },
68
+ { name: 'Amazon.nl (Netherlands)', value: 'A1805IZSGTT6HS' },
69
+ { name: 'Amazon.se (Sweden)', value: 'A2NODRKZP88ZB9' },
70
+ { name: 'Amazon.pl (Poland)', value: 'A1C3SOZRARQ6R3' },
71
+ { name: 'Amazon.co.jp (Japan)', value: 'A1VC38T7YXB528' },
72
+ { name: 'Amazon.com.au (Australia)', value: 'A39IBJ37TRP1C6' },
73
+ { name: 'Amazon.sg (Singapore)', value: 'A19VAU5U5O7RUS' },
74
+ { name: 'Amazon.ae (UAE)', value: 'A2VIGQ35RCS4UG' },
75
+ { name: 'Amazon.sa (Saudi Arabia)', value: 'A17E79C6D8DWNP' },
76
+ { name: 'Amazon.in (India)', value: 'A21TJRUUN4KGV' },
77
+ ],
78
+ default: 'ATVPDKIKX0DER',
79
+ description: 'The marketplace to for the shipment operation',
80
+ },
81
+ {
82
+ displayName: 'Carrier Code',
83
+ name: 'carrierCode',
84
+ type: 'string',
85
+ required: true,
86
+ displayOptions: {
87
+ show: {
88
+ resource: ['shipments'],
89
+ operation: ['confirmShipment'],
90
+ },
91
+ },
92
+ default: 'UPS',
93
+ description: 'The carrier code for the shipment (e.g., UPS, FedEx, USPS)',
94
+ },
95
+ {
96
+ displayName: 'Tracking Number',
97
+ name: 'trackingNumber',
98
+ type: 'string',
99
+ required: true,
100
+ displayOptions: {
101
+ show: {
102
+ resource: ['shipments'],
103
+ operation: ['confirmShipment'],
104
+ },
105
+ },
106
+ default: '',
107
+ description: 'The tracking number for the shipment',
108
+ },
109
+ {
110
+ displayName: 'Ship Date',
111
+ name: 'shipDate',
112
+ type: 'dateTime',
113
+ displayOptions: {
114
+ show: {
115
+ resource: ['shipments'],
116
+ operation: ['confirmShipment'],
117
+ },
118
+ },
119
+ default: '',
120
+ description: 'The date and time of the shipment (ISO 8601 format). Defaults to now.',
121
+ },
122
+ {
123
+ displayName: 'Items',
124
+ name: 'itemsUi',
125
+ type: 'fixedCollection',
126
+ placeholder: 'Add Item',
127
+ displayOptions: {
128
+ show: {
129
+ resource: ['shipments'],
130
+ operation: ['confirmShipment'],
131
+ },
132
+ },
133
+ default: {
134
+ orderItems: [{ orderItemId: '', quantity: 1 }],
135
+ },
136
+ options: [
137
+ {
138
+ displayName: 'Order Items',
139
+ name: 'orderItems',
140
+ values: [
141
+ {
142
+ displayName: 'Order Item ID',
143
+ name: 'orderItemId',
144
+ type: 'string',
145
+ required: true,
146
+ default: '',
147
+ },
148
+ {
149
+ displayName: 'Quantity',
150
+ name: 'quantity',
151
+ type: 'number',
152
+ required: true,
153
+ default: 1,
154
+ typeOptions: { minValue: 1 },
155
+ },
156
+ ],
157
+ },
158
+ ],
159
+ },
160
+ {
161
+ displayName: 'Status',
162
+ name: 'status',
163
+ type: 'options',
164
+ required: true,
165
+ displayOptions: {
166
+ show: {
167
+ resource: ['shipments'],
168
+ operation: ['updateShipmentStatus'],
169
+ },
170
+ },
171
+ options: [
172
+ { name: 'Ready For Pickup', value: 'ReadyForPickup' },
173
+ { name: 'Picked Up', value: 'PickedUp' },
174
+ { name: 'At Destination', value: 'AtDestination' },
175
+ { name: 'Delivered', value: 'Delivered' },
176
+ ],
177
+ default: 'ReadyForPickup',
178
+ description: 'The status of the shipment',
179
+ },
180
+ ];
181
+ //# sourceMappingURL=Shipments.description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shipments.description.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/descriptions/Shipments.description.ts"],"names":[],"mappings":";;;AAEa,QAAA,mBAAmB,GAAsB;IACrD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,WAAW,CAAC;aACvB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,kBAAkB;gBACxB,KAAK,EAAE,iBAAiB;gBACxB,WAAW,EAAE,wCAAwC;gBACrD,MAAM,EAAE,kBAAkB;aAC1B;YACD;gBACC,IAAI,EAAE,wBAAwB;gBAC9B,KAAK,EAAE,sBAAsB;gBAC7B,WAAW,EAAE,iCAAiC;gBAC9C,MAAM,EAAE,wBAAwB;aAChC;SACD;QACD,OAAO,EAAE,iBAAiB;KAC1B;CACD,CAAC;AAEW,QAAA,eAAe,GAAsB;IAIjD;QACC,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,WAAW,CAAC;gBACvB,SAAS,EAAE,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;aACtD;SACD;QACD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,oDAAoD;KACjE;IACD;QACC,WAAW,EAAE,gBAAgB;QAC7B,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE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EAAE,CAAC;SAC9C;QACD,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,MAAM,EAAE;oBACP;wBACC,WAAW,EAAE,eAAe;wBAC5B,IAAI,EAAE,aAAa;wBACnB,IAAI,EAAE,QAAQ;wBACd,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,EAAE;qBACX;oBACD;wBACC,WAAW,EAAE,UAAU;wBACvB,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,QAAQ;wBACd,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,CAAC;wBACV,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;qBAC5B;iBACD;aACD;SACD;KACD;IAID;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,WAAW,CAAC;gBACvB,SAAS,EAAE,CAAC,sBAAsB,CAAC;aACnC;SACD;QACD,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,gBAAgB,EAAE;YACrD,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE;YACxC,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE;YAClD,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;SACzC;QACD,OAAO,EAAE,gBAAgB;QACzB,WAAW,EAAE,4BAA4B;KACzC;CACD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ICredentialDataDecryptedObject } from 'n8n-workflow';
2
+ export declare class LwaClient {
3
+ private static tokenCache;
4
+ private static readonly TOKEN_ENDPOINT;
5
+ private static readonly BUFFER_TIME_SECONDS;
6
+ static getAccessToken(credentials: ICredentialDataDecryptedObject): Promise<string>;
7
+ private static fetchAccessToken;
8
+ private static getCacheKey;
9
+ static clearCache(credentials?: ICredentialDataDecryptedObject): void;
10
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LwaClient = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const n8n_workflow_1 = require("n8n-workflow");
9
+ class LwaClient {
10
+ static async getAccessToken(credentials) {
11
+ const cacheKey = this.getCacheKey(credentials);
12
+ const cached = this.tokenCache.get(cacheKey);
13
+ if (cached && cached.expiresAt > Date.now()) {
14
+ return cached.accessToken;
15
+ }
16
+ const newToken = await this.fetchAccessToken(credentials);
17
+ this.tokenCache.set(cacheKey, {
18
+ accessToken: newToken.access_token,
19
+ expiresAt: Date.now() + (newToken.expires_in - this.BUFFER_TIME_SECONDS) * 1000,
20
+ });
21
+ return newToken.access_token;
22
+ }
23
+ static async fetchAccessToken(credentials) {
24
+ try {
25
+ const formData = new URLSearchParams({
26
+ grant_type: 'refresh_token',
27
+ refresh_token: credentials.lwaRefreshToken,
28
+ client_id: credentials.lwaClientId,
29
+ client_secret: credentials.lwaClientSecret,
30
+ });
31
+ const response = await axios_1.default.post(this.TOKEN_ENDPOINT, formData.toString(), {
32
+ headers: {
33
+ 'Content-Type': 'application/x-www-form-urlencoded',
34
+ 'User-Agent': 'n8n-amazon-sp-api/1.0.0',
35
+ },
36
+ timeout: 30000,
37
+ });
38
+ return response.data;
39
+ }
40
+ catch (error) {
41
+ if (axios_1.default.isAxiosError(error) && error.response) {
42
+ const { status, data } = error.response;
43
+ if (!process.env.JEST_SILENT_LOGS) {
44
+ console.error('LWA Token Request Failed:', {
45
+ status,
46
+ data,
47
+ requestUrl: this.TOKEN_ENDPOINT,
48
+ clientId: credentials.lwaClientId,
49
+ });
50
+ }
51
+ throw new n8n_workflow_1.NodeOperationError({}, `LWA authentication failed (${status}): ${data.error_description || data.error || JSON.stringify(data)}`, {
52
+ description: 'Check your LWA credentials and ensure they are valid and not expired. See server logs for details.',
53
+ });
54
+ }
55
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
56
+ if (!process.env.JEST_SILENT_LOGS) {
57
+ console.error('LWA Token Request Error (non-HTTP):', errorMessage);
58
+ }
59
+ throw new n8n_workflow_1.NodeOperationError({}, `LWA request failed: ${errorMessage}`);
60
+ }
61
+ }
62
+ static getCacheKey(credentials) {
63
+ return `lwa_${credentials.lwaClientId}`;
64
+ }
65
+ static clearCache(credentials) {
66
+ if (credentials) {
67
+ const cacheKey = this.getCacheKey(credentials);
68
+ this.tokenCache.delete(cacheKey);
69
+ }
70
+ else {
71
+ this.tokenCache.clear();
72
+ }
73
+ }
74
+ }
75
+ exports.LwaClient = LwaClient;
76
+ LwaClient.tokenCache = new Map();
77
+ LwaClient.TOKEN_ENDPOINT = 'https://api.amazon.com/auth/o2/token';
78
+ LwaClient.BUFFER_TIME_SECONDS = 300;
79
+ //# sourceMappingURL=LwaClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LwaClient.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/helpers/LwaClient.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAC7C,+CAAkF;AAclF,MAAa,SAAS;IAKrB,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,WAA2C;QACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAG7C,IAAI,MAAM,IAAI,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAC7C,OAAO,MAAM,CAAC,WAAW,CAAC;QAC3B,CAAC;QAGD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,WAAW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' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
4
+ path: string;
5
+ dataElements?: string[];
6
+ }
7
+ export declare class RdtClient {
8
+ private static readonly RDT_ENDPOINT;
9
+ static getRestrictedAccessToken(credentials: ICredentialDataDecryptedObject, restrictedResources: RestrictedResource[]): Promise<string>;
10
+ private static getBaseUrl;
11
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RdtClient = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const n8n_workflow_1 = require("n8n-workflow");
9
+ const LwaClient_1 = require("./LwaClient");
10
+ class RdtClient {
11
+ static async getRestrictedAccessToken(credentials, restrictedResources) {
12
+ var _a, _b;
13
+ try {
14
+ const lwaToken = await LwaClient_1.LwaClient.getAccessToken(credentials);
15
+ const baseUrl = this.getBaseUrl(credentials);
16
+ const rdtUrl = new URL(this.RDT_ENDPOINT, baseUrl);
17
+ const requestBody = {
18
+ restrictedResources,
19
+ };
20
+ const response = await axios_1.default.post(rdtUrl.toString(), requestBody, {
21
+ headers: {
22
+ 'Content-Type': 'application/json',
23
+ 'User-Agent': 'n8n-amazon-sp-api/1.0.0',
24
+ 'x-amz-access-token': lwaToken,
25
+ },
26
+ timeout: 30000,
27
+ });
28
+ return response.data.restrictedDataToken;
29
+ }
30
+ catch (error) {
31
+ const isAxiosErr = ((_b = (_a = axios_1.default).isAxiosError) === null || _b === void 0 ? void 0 : _b.call(_a, error)) || (error === null || error === void 0 ? void 0 : error.isAxiosError);
32
+ if (isAxiosErr && error.response) {
33
+ const { status, data } = error.response;
34
+ throw new n8n_workflow_1.NodeOperationError({}, `RDT authentication failed (${status}): ${data.error_description || data.error || 'Unknown error'}`, {
35
+ description: 'Check your LWA credentials and restricted resource configuration',
36
+ });
37
+ }
38
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
39
+ throw new n8n_workflow_1.NodeOperationError({}, `RDT request failed: ${errorMessage}`);
40
+ }
41
+ }
42
+ static getBaseUrl(credentials) {
43
+ const advancedOptions = credentials.advancedOptions;
44
+ const customEndpoint = credentials.spApiEndpoint || (advancedOptions === null || advancedOptions === void 0 ? void 0 : advancedOptions.spApiEndpoint);
45
+ if (customEndpoint) {
46
+ return customEndpoint;
47
+ }
48
+ const region = credentials.awsRegion;
49
+ const environment = credentials.environment;
50
+ const endpoints = {
51
+ 'us-east-1': environment === 'sandbox'
52
+ ? 'https://sandbox.sellingpartnerapi-na.amazon.com'
53
+ : 'https://sellingpartnerapi-na.amazon.com',
54
+ 'eu-west-1': environment === 'sandbox'
55
+ ? 'https://sandbox.sellingpartnerapi-eu.amazon.com'
56
+ : 'https://sellingpartnerapi-eu.amazon.com',
57
+ 'us-west-2': environment === 'sandbox'
58
+ ? 'https://sandbox.sellingpartnerapi-fe.amazon.com'
59
+ : 'https://sellingpartnerapi-fe.amazon.com',
60
+ };
61
+ return endpoints[region] || endpoints['us-east-1'];
62
+ }
63
+ }
64
+ exports.RdtClient = RdtClient;
65
+ RdtClient.RDT_ENDPOINT = '/tokens/2021-03-01/restrictedDataToken';
66
+ //# sourceMappingURL=RdtClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RdtClient.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/helpers/RdtClient.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAC7C,+CAAkF;AAClF,2CAAwC;AAaxC,MAAa,SAAS;IAGrB,MAAM,CAAC,KAAK,CAAC,wBAAwB,CACpC,WAA2C,EAC3C,mBAAyC;;QAEzC,IAAI,CAAC;YAEJ,MAAM,QAAQ,GAAG,MAAM,qBAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YAG7D,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAC7C,MAAM,MAAM,GAAG,IA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GAAG,WAAW,CAAC,aAAa,KAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,aAAa,CAAA,CAAC;QAEnF,IAAI,cAAc,EAAE,CAAC;YACpB,OAAO,cAAwB,CAAC;QACjC,CAAC;QAED,MAAM,MAAM,GAAG,WAAW,CAAC,SAAmB,CAAC;QAC/C,MAAM,WAAW,GAAG,WAAW,CAAC,WAAqB,CAAC;QAEtD,MAAM,SAAS,GAA2B;YACzC,WAAW,EAAE,WAAW,KAAK,SAAS;gBACrC,CAAC,CAAC,iDAAiD;gBACnD,CAAC,CAAC,yCAAyC;YAC5C,WAAW,EAAE,WAAW,KAAK,SAAS;gBACrC,CAAC,CAAC,iDAAiD;gBACnD,CAAC,CAAC,yCAAyC;YAC5C,WAAW,EAAE,WAAW,KAAK,SAAS;gBACrC,CAAC,CAAC,iDAAiD;gBACnD,CAAC,CAAC,yCAAyC;SAC5C,CAAC;QAEF,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;;AA5EF,8BA6EC;AA5EwB,sBAAY,GAAG,wCAAwC,CAAC"}
@@ -0,0 +1,16 @@
1
+ interface EncryptionDetails {
2
+ standard: string;
3
+ initializationVector: string;
4
+ key: string;
5
+ }
6
+ interface ReportDocument {
7
+ reportDocumentId: string;
8
+ url: string;
9
+ encryptionDetails?: EncryptionDetails;
10
+ compressionAlgorithm?: string;
11
+ }
12
+ export declare class ReportDownloader {
13
+ static downloadReportDocument(document: ReportDocument, nodeId?: string): Promise<Buffer>;
14
+ private static decryptDocument;
15
+ }
16
+ export {};
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ReportDownloader = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const crypto_1 = require("crypto");
9
+ const zlib_1 = require("zlib");
10
+ const n8n_workflow_1 = require("n8n-workflow");
11
+ class ReportDownloader {
12
+ static async downloadReportDocument(document, nodeId) {
13
+ try {
14
+ const response = await (0, axios_1.default)({
15
+ method: 'GET',
16
+ url: document.url,
17
+ responseType: 'arraybuffer',
18
+ timeout: 300000,
19
+ });
20
+ let data = Buffer.from(response.data);
21
+ if (document.encryptionDetails) {
22
+ data = this.decryptDocument(data, document.encryptionDetails);
23
+ }
24
+ if (document.compressionAlgorithm === 'GZIP') {
25
+ try {
26
+ data = (0, zlib_1.gunzipSync)(data);
27
+ }
28
+ catch (err) {
29
+ throw new n8n_workflow_1.NodeOperationError({ id: nodeId || 'unknown', name: 'ReportDownloader', type: 'helper' }, `Failed to decompress GZIP report: ${(err === null || err === void 0 ? void 0 : err.message) || 'Unknown error'}`);
30
+ }
31
+ }
32
+ return data;
33
+ }
34
+ catch (error) {
35
+ if (axios_1.default.isAxiosError(error)) {
36
+ throw new n8n_workflow_1.NodeOperationError({ id: nodeId || 'unknown', name: 'ReportDownloader', type: 'helper' }, `Failed to download report document: ${error.message}`, {
37
+ description: 'Check if the document URL is still valid and accessible'
38
+ });
39
+ }
40
+ throw new n8n_workflow_1.NodeOperationError({ id: nodeId || 'unknown', name: 'ReportDownloader', type: 'helper' }, `Unexpected error downloading report: ${error instanceof Error ? error.message : 'Unknown error'}`);
41
+ }
42
+ }
43
+ static decryptDocument(encryptedData, encryptionDetails) {
44
+ try {
45
+ if (encryptionDetails.standard !== 'AES') {
46
+ throw new Error(`Unsupported encryption standard: ${encryptionDetails.standard}`);
47
+ }
48
+ const key = Buffer.from(encryptionDetails.key, 'base64');
49
+ const iv = Buffer.from(encryptionDetails.initializationVector, 'base64');
50
+ const decipher = (0, crypto_1.createDecipheriv)('aes-256-cbc', key, iv);
51
+ const decrypted = Buffer.concat([
52
+ decipher.update(encryptedData),
53
+ decipher.final()
54
+ ]);
55
+ return decrypted;
56
+ }
57
+ catch (error) {
58
+ throw new n8n_workflow_1.NodeOperationError({ id: 'unknown', name: 'ReportDownloader', type: 'helper' }, `Failed to decrypt report document: ${error instanceof Error ? error.message : 'Unknown error'}`, {
59
+ description: 'The encryption key or initialization vector may be invalid'
60
+ });
61
+ }
62
+ }
63
+ }
64
+ exports.ReportDownloader = ReportDownloader;
65
+ //# sourceMappingURL=ReportDownloader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReportDownloader.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/helpers/ReportDownloader.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,mCAA0C;AAC1C,+BAAkC;AAClC,+CAAkD;AAelD,MAAa,gBAAgB;IAI5B,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAClC,QAAwB,EACxB,MAAe;QAEf,IAAI,CAAC;YAEJ,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC;gBAC5B,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,QAAQ,CAAC,GAAG;gBACjB,YAAY,EAAE,aAAa;gBAC3B,OAAO,EAAE,MAAM;aACf,CAAC,CAAC;YAEH,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAGtC,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC;gBAChC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;YAC/D,CAAC;YAGD,IAAI,QAAQ,CAAC,oBAAoB,KAAK,MAAM,EAAE,CAAC;gBAC9C,IAAI,CAAC;oBACJ,IAAI,GAAG,IAAA,iBAAU,EAAC,IAAI,CAAC,CAAC;gBACzB,CAAC;gBAAC,OAAO,GAAQ,EAAE,CAAC;oBACnB,MAAM,IAAI,iCAAkB,CAC3B,EAAE,EAAE,EAAE,MAAM,IAAI,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAS,EAC5E,qCAAqC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SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;gBAC/B,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC;gBAC9B,QAAQ,CAAC,KAAK,EAAE;aAChB,CAAC,CAAC;YAEH,OAAO,SAAS,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,iCAAkB,CAC3B,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAS,EAClE,sCAAsC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,EAChG;gBACC,WAAW,EAAE,4DAA4D;aACzE,CACD,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAxFD,4CAwFC"}
@@ -0,0 +1,4 @@
1
+ import { ICredentialDataDecryptedObject } from 'n8n-workflow';
2
+ export declare class SigV4Signer {
3
+ static signRequest(method: string, url: string, headers: Record<string, string>, body: string | undefined, credentials: ICredentialDataDecryptedObject): Promise<Record<string, string>>;
4
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SigV4Signer = void 0;
37
+ const aws4 = __importStar(require("aws4"));
38
+ const url_1 = require("url");
39
+ const n8n_workflow_1 = require("n8n-workflow");
40
+ class SigV4Signer {
41
+ static async signRequest(method, url, headers, body, credentials) {
42
+ try {
43
+ const urlParts = new url_1.URL(url);
44
+ const advancedOptions = credentials.advancedOptions;
45
+ const awsAccessKeyId = credentials.awsAccessKeyId || (advancedOptions === null || advancedOptions === void 0 ? void 0 : advancedOptions.awsAccessKeyId);
46
+ const awsSecretAccessKey = credentials.awsSecretAccessKey || (advancedOptions === null || advancedOptions === void 0 ? void 0 : advancedOptions.awsSecretAccessKey);
47
+ const awsRegion = credentials.awsRegion;
48
+ if (!awsAccessKeyId || !awsSecretAccessKey) {
49
+ throw new Error('AWS credentials are required for SigV4 signing');
50
+ }
51
+ const requestOptions = {
52
+ method,
53
+ host: urlParts.hostname,
54
+ path: urlParts.pathname + urlParts.search,
55
+ headers: { ...headers },
56
+ body,
57
+ service: 'execute-api',
58
+ region: awsRegion,
59
+ };
60
+ const awsCredentials = {
61
+ accessKeyId: awsAccessKeyId,
62
+ secretAccessKey: awsSecretAccessKey,
63
+ };
64
+ const signedRequest = aws4.sign(requestOptions, awsCredentials);
65
+ return signedRequest.headers;
66
+ }
67
+ catch (error) {
68
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
69
+ throw new n8n_workflow_1.NodeOperationError({}, `Failed to sign request: ${errorMessage}`, {
70
+ description: 'Check your AWS credentials and region configuration',
71
+ });
72
+ }
73
+ }
74
+ }
75
+ exports.SigV4Signer = SigV4Signer;
76
+ //# sourceMappingURL=SigV4Signer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SigV4Signer.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/helpers/SigV4Signer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6BAA0B;AAC1B,+CAAkF;AAElF,MAAa,WAAW;IACvB,MAAM,CAAC,KAAK,CAAC,WAAW,CACvB,MAAc,EACd,GAAW,EACX,OAA+B,EAC/B,IAAwB,EACxB,WAA2C;QAE3C,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;YAG9B,MAAM,eAAe,GAAG,WAAW,CAAC,eAAsB,CAAC;YAC3D,MAAM,cAAc,GAAG,WAAW,CAAC,cAAc,KAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,cAAc,CAAA,CAAC;YACrF,MAAM,kBAAkB,GAAG,WAAW,CAAC,kBAAkB,KAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,kBAAkB,CAAA,CAAC;YACjG,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;YAExC,IAAI,CAAC,cAAc,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC5C,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;YACnE,CAAC;YAED,MAAM,cAAc,GAAG;gBACtB,MAAM;gBACN,IAAI,EAAE,QAAQ,CAAC,QAAQ;gBACvB,IAAI,EAAE,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM;gBACzC,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE;gBACvB,IAAI;gBACJ,OAAO,EAAE,aAAa;gBACtB,MAAM,EAAE,SAAmB;aAC3B,CAAC;YAEF,MAAM,cAAc,GAAG;gBACtB,WAAW,EAAE,cAAwB;gBACrC,eAAe,EAAE,kBAA4B;aAC7C,CAAC;YAGF,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;YAEhE,OAAO,aAAa,CAAC,OAAiC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YACvF,MAAM,IAAI,iCAAkB,CAC3B,EAAS,EACT,2BAA2B,YAAY,EAAE,EACzC;gBACC,WAAW,EAAE,qDAAqD;aAClE,CACD,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAnDD,kCAmDC"}
@@ -0,0 +1,23 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ import { RestrictedResource } from './RdtClient';
3
+ interface SpApiRequestOptions {
4
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
5
+ endpoint: string;
6
+ query?: Record<string, any>;
7
+ body?: any;
8
+ headers?: Record<string, string>;
9
+ responseType?: 'json' | 'stream' | 'text';
10
+ restrictedResources?: RestrictedResource[];
11
+ }
12
+ interface SpApiResponse<T = any> {
13
+ data: T;
14
+ headers: Record<string, string>;
15
+ status: number;
16
+ }
17
+ export declare class SpApiRequest {
18
+ private static rateLimiter;
19
+ static makeRequest<T = any>(executeFunctions: IExecuteFunctions, options: SpApiRequestOptions): Promise<SpApiResponse<T>>;
20
+ private static validateCredentials;
21
+ private static getBaseUrl;
22
+ }
23
+ export {};