n8n-nodes-amazon-selling-partner-dnangelx 0.0.2 → 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 +12 -4
  100. package/dist/tsconfig.tsbuildinfo +1 -1
  101. package/package.json +11 -3
  102. package/dist/credentials/AmazonSellingPartnerOAuth2Api.credentials.d.ts +0 -17
  103. package/dist/credentials/AmazonSellingPartnerOAuth2Api.credentials.js +0 -177
  104. package/dist/credentials/AmazonSellingPartnerOAuth2Api.credentials.js.map +0 -1
@@ -0,0 +1,208 @@
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.SpApiRequest = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const url_1 = require("url");
9
+ const n8n_workflow_1 = require("n8n-workflow");
10
+ const LwaClient_1 = require("./LwaClient");
11
+ const RdtClient_1 = require("./RdtClient");
12
+ const RateLimiter_1 = require("../core/RateLimiter");
13
+ const ErrorHandler_1 = require("../core/ErrorHandler");
14
+ const MetricsCollector_1 = require("../core/MetricsCollector");
15
+ const AuditLogger_1 = require("../core/AuditLogger");
16
+ const SecurityValidator_1 = require("../core/SecurityValidator");
17
+ const rateLimitConfig_1 = require("../core/rateLimitConfig");
18
+ class SpApiRequest {
19
+ static async makeRequest(executeFunctions, options) {
20
+ const startTime = Date.now();
21
+ const nodeId = executeFunctions.getNode().id;
22
+ try {
23
+ const credentials = await executeFunctions.getCredentials('amazonSpApi');
24
+ const credentialValidation = this.validateCredentials(credentials);
25
+ if (!credentialValidation.isValid) {
26
+ AuditLogger_1.auditLogger.logCredentialUsage(nodeId, 'amazonSpApi', false, {
27
+ errors: credentialValidation.errors,
28
+ });
29
+ throw new n8n_workflow_1.NodeOperationError(executeFunctions.getNode(), `Invalid credentials: ${credentialValidation.errors.join(', ')}`);
30
+ }
31
+ try {
32
+ const environmentValidation = SecurityValidator_1.securityValidator.validateEnvironmentIsolation(credentials, nodeId);
33
+ if (!environmentValidation.isValid) {
34
+ throw new n8n_workflow_1.NodeOperationError(executeFunctions.getNode(), `Environment isolation violation: ${environmentValidation.errors.join(', ')}`);
35
+ }
36
+ }
37
+ catch (error) {
38
+ console.warn('Security validator not available, skipping environment validation');
39
+ }
40
+ if (options.query) {
41
+ try {
42
+ const paramValidation = SecurityValidator_1.securityValidator.validateApiParameters(options.query, nodeId);
43
+ if (!paramValidation.isValid) {
44
+ throw new n8n_workflow_1.NodeOperationError(executeFunctions.getNode(), `Invalid parameters: ${paramValidation.errors.join(', ')}`);
45
+ }
46
+ options.query = paramValidation.sanitizedData;
47
+ }
48
+ catch (error) {
49
+ console.warn('Security validator not available, skipping parameter validation');
50
+ }
51
+ }
52
+ const baseUrl = this.getBaseUrl(credentials);
53
+ const url = new url_1.URL(options.endpoint, baseUrl);
54
+ if (options.query) {
55
+ Object.entries(options.query).forEach(([key, value]) => {
56
+ if (value !== undefined && value !== null && value !== '') {
57
+ if (Array.isArray(value)) {
58
+ value.forEach(v => url.searchParams.append(key, v));
59
+ }
60
+ else {
61
+ url.searchParams.set(key, String(value));
62
+ }
63
+ }
64
+ });
65
+ }
66
+ const rateLimitGroup = (0, rateLimitConfig_1.getEndpointGroup)(options.method, options.endpoint);
67
+ await this.rateLimiter.waitForToken(rateLimitGroup);
68
+ let accessToken;
69
+ let authType;
70
+ if (options.restrictedResources && options.restrictedResources.length > 0) {
71
+ accessToken = await RdtClient_1.RdtClient.getRestrictedAccessToken(credentials, options.restrictedResources);
72
+ authType = 'RDT';
73
+ }
74
+ else {
75
+ accessToken = await LwaClient_1.LwaClient.getAccessToken(credentials);
76
+ authType = 'LWA';
77
+ }
78
+ AuditLogger_1.auditLogger.logAuthentication(nodeId, authType, true, { endpoint: options.endpoint });
79
+ const acceptHeader = (options.responseType === 'stream' || options.responseType === 'text')
80
+ ? '*/*'
81
+ : 'application/json';
82
+ const headers = {
83
+ 'Accept': acceptHeader,
84
+ 'Content-Type': 'application/json',
85
+ 'User-Agent': 'n8n-amazon-sp-api/1.0.0',
86
+ 'x-amz-access-token': accessToken,
87
+ ...options.headers,
88
+ };
89
+ const finalHeaders = headers;
90
+ console.log('SP-API Request:', {
91
+ method: options.method,
92
+ url: url.toString(),
93
+ endpoint: options.endpoint,
94
+ baseUrl,
95
+ hasAccessToken: !!accessToken,
96
+ region: credentials.awsRegion,
97
+ marketplace: credentials.primaryMarketplace,
98
+ });
99
+ const axiosConfig = {
100
+ method: options.method,
101
+ url: url.toString(),
102
+ headers: finalHeaders,
103
+ data: options.body,
104
+ timeout: 60000,
105
+ validateStatus: (status) => status < 500,
106
+ };
107
+ if (options.responseType === 'stream') {
108
+ axiosConfig.responseType = 'stream';
109
+ }
110
+ else if (options.responseType === 'text') {
111
+ axiosConfig.responseType = 'text';
112
+ }
113
+ const response = await (0, axios_1.default)(axiosConfig);
114
+ const duration = Date.now() - startTime;
115
+ this.rateLimiter.updateFromHeaders(rateLimitGroup, response.headers);
116
+ if (response.status >= 400) {
117
+ console.error('SP-API Request Failed:', {
118
+ status: response.status,
119
+ statusText: response.statusText,
120
+ url: url.toString(),
121
+ endpoint: options.endpoint,
122
+ method: options.method,
123
+ baseUrl,
124
+ responseData: response.data,
125
+ requestHeaders: headers,
126
+ responseHeaders: response.headers,
127
+ });
128
+ AuditLogger_1.auditLogger.logApiAccess(nodeId, options.endpoint, false, {
129
+ status: response.status,
130
+ duration,
131
+ method: options.method,
132
+ });
133
+ MetricsCollector_1.metricsCollector.recordApiRequest(options.endpoint, duration, false, `HTTP_${response.status}`);
134
+ throw await ErrorHandler_1.ErrorHandler.handleApiError(response);
135
+ }
136
+ AuditLogger_1.auditLogger.logApiAccess(nodeId, options.endpoint, true, {
137
+ status: response.status,
138
+ duration,
139
+ method: options.method,
140
+ });
141
+ MetricsCollector_1.metricsCollector.recordApiRequest(options.endpoint, duration, true);
142
+ return {
143
+ data: response.data,
144
+ headers: response.headers,
145
+ status: response.status,
146
+ };
147
+ }
148
+ catch (error) {
149
+ const duration = Date.now() - startTime;
150
+ AuditLogger_1.auditLogger.logError(nodeId, error instanceof Error ? error : new Error('Unknown error'), {
151
+ endpoint: options.endpoint,
152
+ method: options.method,
153
+ duration,
154
+ });
155
+ if (error instanceof n8n_workflow_1.NodeOperationError) {
156
+ MetricsCollector_1.metricsCollector.recordApiRequest(options.endpoint, duration, false, 'NODE_OPERATION_ERROR');
157
+ throw error;
158
+ }
159
+ if (axios_1.default.isAxiosError(error)) {
160
+ MetricsCollector_1.metricsCollector.recordApiRequest(options.endpoint, duration, false, 'NETWORK_ERROR');
161
+ throw await ErrorHandler_1.ErrorHandler.handleNetworkError(error);
162
+ }
163
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
164
+ MetricsCollector_1.metricsCollector.recordApiRequest(options.endpoint, duration, false, 'UNEXPECTED_ERROR');
165
+ throw new n8n_workflow_1.NodeOperationError(executeFunctions.getNode(), `Unexpected error: ${errorMessage}`);
166
+ }
167
+ }
168
+ static validateCredentials(credentials) {
169
+ const errors = [];
170
+ if (!credentials.lwaClientId) {
171
+ errors.push('LWA Client ID is required');
172
+ }
173
+ if (!credentials.lwaClientSecret) {
174
+ errors.push('LWA Client Secret is required');
175
+ }
176
+ if (!credentials.lwaRefreshToken) {
177
+ errors.push('LWA Refresh Token is required');
178
+ }
179
+ return {
180
+ isValid: errors.length === 0,
181
+ errors,
182
+ };
183
+ }
184
+ static getBaseUrl(credentials) {
185
+ const advancedOptions = credentials.advancedOptions;
186
+ const customEndpoint = credentials.spApiEndpoint || (advancedOptions === null || advancedOptions === void 0 ? void 0 : advancedOptions.spApiEndpoint);
187
+ if (customEndpoint) {
188
+ return customEndpoint;
189
+ }
190
+ const region = credentials.awsRegion;
191
+ const environment = credentials.environment;
192
+ const endpoints = {
193
+ 'us-east-1': environment === 'sandbox'
194
+ ? 'https://sandbox.sellingpartnerapi-na.amazon.com'
195
+ : 'https://sellingpartnerapi-na.amazon.com',
196
+ 'eu-west-1': environment === 'sandbox'
197
+ ? 'https://sandbox.sellingpartnerapi-eu.amazon.com'
198
+ : 'https://sellingpartnerapi-eu.amazon.com',
199
+ 'us-west-2': environment === 'sandbox'
200
+ ? 'https://sandbox.sellingpartnerapi-fe.amazon.com'
201
+ : 'https://sellingpartnerapi-fe.amazon.com',
202
+ };
203
+ return endpoints[region] || endpoints['us-east-1'];
204
+ }
205
+ }
206
+ exports.SpApiRequest = SpApiRequest;
207
+ SpApiRequest.rateLimiter = new RateLimiter_1.RateLimiter();
208
+ //# sourceMappingURL=SpApiRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpApiRequest.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/helpers/SpApiRequest.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAC7C,6BAA0B;AAC1B,+CAIsB;AACtB,2CAAwC;AACxC,2CAA4D;AAC5D,qDAAkD;AAClD,uDAAoD;AACpD,+DAA4D;AAC5D,qDAAkD;AAClD,iEAA8D;AAC9D,6DAA2D;AAkB3D,MAAa,YAAY;IAGxB,MAAM,CAAC,KAAK,CAAC,WAAW,CACvB,gBAAmC,EACnC,OAA4B;QAE5B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QAE7C,IAAI,CAAC;YACJ,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YAGzE,MAAM,oBAAoB,GAAG,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;YACnE,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;gBACnC,yBAAW,CAAC,kBAAkB,CAAC,MA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zC,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;;AA/PF,oCAgQC;AA/Pe,wBAAW,GAAG,IAAI,yBAAW,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function downloadPresigned(url: string): Promise<{
2
+ buffer: Buffer;
3
+ contentType?: string;
4
+ }>;
@@ -0,0 +1,16 @@
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.downloadPresigned = downloadPresigned;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ async function downloadPresigned(url) {
9
+ const res = await axios_1.default.get(url, { responseType: 'arraybuffer', validateStatus: s => s < 500 });
10
+ if (res.status >= 400) {
11
+ throw new Error(`Failed to download document: HTTP ${res.status}`);
12
+ }
13
+ const contentType = res.headers['content-type'];
14
+ return { buffer: Buffer.from(res.data), contentType };
15
+ }
16
+ //# sourceMappingURL=downloadPresigned.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"downloadPresigned.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/helpers/downloadPresigned.ts"],"names":[],"mappings":";;;;;AAEA,8CAOC;AATD,kDAA0B;AAEnB,KAAK,UAAU,iBAAiB,CAAC,GAAW;IAClD,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IAChG,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAuB,CAAC;IACtE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;AACvD,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function minifyGraphql(query: string): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.minifyGraphql = minifyGraphql;
4
+ function minifyGraphql(query) {
5
+ if (!query)
6
+ return '';
7
+ let q = query;
8
+ q = q.replace(/\/\*[\s\S]*?\*\//g, '');
9
+ q = q.replace(/(^|\s)#[^\n]*/g, '$1');
10
+ q = q.replace(/\s+/g, ' ').trim();
11
+ return q;
12
+ }
13
+ //# sourceMappingURL=graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/helpers/graphql.ts"],"names":[],"mappings":";;AAAA,sCAUC;AAVD,SAAgB,aAAa,CAAC,KAAa;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,IAAI,CAAC,GAAG,KAAK,CAAC;IAEd,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IAEvC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAEtC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAClC,OAAO,CAAC,CAAC;AACV,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function executeAnalyticsOperation(this: IExecuteFunctions, operation: string, index: number): Promise<INodeExecutionData[]>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeAnalyticsOperation = executeAnalyticsOperation;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const SpApiRequest_1 = require("../helpers/SpApiRequest");
6
+ const AuditLogger_1 = require("../core/AuditLogger");
7
+ async function executeAnalyticsOperation(operation, index) {
8
+ switch (operation) {
9
+ case 'validateAccess':
10
+ return await validateAnalyticsAccess.call(this, index);
11
+ default:
12
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown analytics operation: ${operation}`);
13
+ }
14
+ }
15
+ async function validateAnalyticsAccess(_index) {
16
+ const nodeId = this.getNode().id;
17
+ try {
18
+ let dataKioskAccess = false;
19
+ let reportsAccess = false;
20
+ const errors = [];
21
+ try {
22
+ await SpApiRequest_1.SpApiRequest.makeRequest(this, {
23
+ method: 'GET',
24
+ endpoint: '/dataKiosk/2023-11-15/queries',
25
+ query: { pageSize: 1 },
26
+ });
27
+ dataKioskAccess = true;
28
+ }
29
+ catch (error) {
30
+ errors.push(`Data Kiosk: ${error instanceof Error ? error.message : 'Unknown error'}`);
31
+ }
32
+ try {
33
+ await SpApiRequest_1.SpApiRequest.makeRequest(this, {
34
+ method: 'GET',
35
+ endpoint: '/reports/2021-06-30/reports',
36
+ query: { reportTypes: 'GET_SALES_AND_TRAFFIC_REPORT' },
37
+ });
38
+ reportsAccess = true;
39
+ }
40
+ catch (error) {
41
+ errors.push(`Reports API: ${error instanceof Error ? error.message : 'Unknown error'}`);
42
+ }
43
+ const result = {
44
+ success: dataKioskAccess || reportsAccess,
45
+ dataKioskAccess,
46
+ reportsAccess,
47
+ recommendedMode: dataKioskAccess ? 'dataKiosk' : reportsAccess ? 'reports' : 'none',
48
+ errors: errors.length > 0 ? errors : undefined,
49
+ timestamp: new Date().toISOString(),
50
+ };
51
+ AuditLogger_1.auditLogger.logEvent({
52
+ nodeId,
53
+ action: 'analytics_access_validation',
54
+ resource: 'analytics',
55
+ details: result,
56
+ severity: result.success ? 'low' : 'high',
57
+ source: 'system',
58
+ outcome: result.success ? 'success' : 'failure',
59
+ });
60
+ return [{ json: result }];
61
+ }
62
+ catch (error) {
63
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to validate analytics access: ${error instanceof Error ? error.message : 'Unknown error'}`);
64
+ }
65
+ }
66
+ //# sourceMappingURL=Analytics.operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Analytics.operations.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/operations/Analytics.operations.ts"],"names":[],"mappings":";;AASA,8DAWC;AApBD,+CAIsB;AACtB,0DAAuD;AACvD,qDAAkD;AAG3C,KAAK,UAAU,yBAAyB,CAE9C,SAAiB,EACjB,KAAa;IAEb,QAAQ,SAAS,EAAE,CAAC;QACnB,KAAK,gBAAgB;YACpB,OAAO,MAAM,uBAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACxD;YACC,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,gCAAgC,SAAS,EAAE,CAAC,CAAC;IAC5F,CAAC;AACF,CAAC;AAGD,KAAK,UAAU,uBAAuB,CAErC,MAAc;IAEd,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;IAE9B,IAAI,CAAC;QACD,IAAI,eAAe,GAAG,KAAK,CAAC;QAC5B,IAAI,aAAa,GAAG,KAAK,CAAC;QAC1B,MAAM,MAAM,GAAa,EAAE,CAAC;QAG5B,IAAI,CAAC;YACD,MAAM,2BAAY,CAAC,WAAW,CAAC,IAAI,EAAE;gBACjC,MAA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,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM;YACzC,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;SAC/C,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,wCAAwC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAClG,CAAC;IACH,CAAC;AACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function executeDataKioskOperation(this: IExecuteFunctions, operation: string, itemIndex: number): Promise<INodeExecutionData[]>;
@@ -0,0 +1,249 @@
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.executeDataKioskOperation = executeDataKioskOperation;
37
+ const n8n_workflow_1 = require("n8n-workflow");
38
+ const SpApiRequest_1 = require("../helpers/SpApiRequest");
39
+ const downloadPresigned_1 = require("../helpers/downloadPresigned");
40
+ const graphql_1 = require("../helpers/graphql");
41
+ const DATA_KIOSK_BASE = '/dataKiosk/2023-11-15';
42
+ async function executeDataKioskOperation(operation, itemIndex) {
43
+ switch (operation) {
44
+ case 'createQuery':
45
+ return await createQuery.call(this, itemIndex);
46
+ case 'getQueries':
47
+ return await getQueries.call(this, itemIndex);
48
+ case 'getQuery':
49
+ return await getQuery.call(this, itemIndex);
50
+ case 'cancelQuery':
51
+ return await cancelQuery.call(this, itemIndex);
52
+ case 'getDocument':
53
+ return await getDocument.call(this, itemIndex);
54
+ case 'runQueryAndDownload':
55
+ return await runQueryAndDownload.call(this, itemIndex);
56
+ default:
57
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown dataKiosk operation: ${operation}`);
58
+ }
59
+ }
60
+ async function createQuery(index) {
61
+ let query = this.getNodeParameter('query', index);
62
+ const minify = this.getNodeParameter('minifyGraphql', index, true);
63
+ const paginationToken = this.getNodeParameter('paginationToken', index, '');
64
+ if (minify) {
65
+ query = (0, graphql_1.minifyGraphql)(query);
66
+ }
67
+ if (query.length > 8000) {
68
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'GraphQL query exceeds 8000 characters after minification');
69
+ }
70
+ const body = { query };
71
+ if (paginationToken)
72
+ body.paginationToken = paginationToken;
73
+ const res = await SpApiRequest_1.SpApiRequest.makeRequest(this, {
74
+ method: 'POST',
75
+ endpoint: `${DATA_KIOSK_BASE}/queries`,
76
+ body,
77
+ });
78
+ return [{ json: { queryId: res.data.queryId } }];
79
+ }
80
+ async function getQueries(index) {
81
+ const processingStatuses = this.getNodeParameter('processingStatuses', index, []);
82
+ const pageSize = this.getNodeParameter('pageSize', index, 10);
83
+ const createdSince = this.getNodeParameter('createdSince', index, '');
84
+ const createdUntil = this.getNodeParameter('createdUntil', index, '');
85
+ const paginationToken = this.getNodeParameter('paginationToken', index, '');
86
+ const query = {};
87
+ if (processingStatuses === null || processingStatuses === void 0 ? void 0 : processingStatuses.length)
88
+ query.processingStatuses = processingStatuses;
89
+ if (pageSize)
90
+ query.pageSize = pageSize;
91
+ if (createdSince)
92
+ query.createdSince = createdSince;
93
+ if (createdUntil)
94
+ query.createdUntil = createdUntil;
95
+ if (paginationToken)
96
+ query.paginationToken = paginationToken;
97
+ const res = await SpApiRequest_1.SpApiRequest.makeRequest(this, {
98
+ method: 'GET',
99
+ endpoint: `${DATA_KIOSK_BASE}/queries`,
100
+ query,
101
+ });
102
+ return [{ json: res.data }];
103
+ }
104
+ async function getQuery(index) {
105
+ const queryId = this.getNodeParameter('queryId', index);
106
+ const res = await SpApiRequest_1.SpApiRequest.makeRequest(this, {
107
+ method: 'GET',
108
+ endpoint: `${DATA_KIOSK_BASE}/queries/${encodeURIComponent(queryId)}`,
109
+ });
110
+ return [{ json: res.data }];
111
+ }
112
+ async function cancelQuery(index) {
113
+ const queryId = this.getNodeParameter('queryId', index);
114
+ await SpApiRequest_1.SpApiRequest.makeRequest(this, {
115
+ method: 'DELETE',
116
+ endpoint: `${DATA_KIOSK_BASE}/queries/${encodeURIComponent(queryId)}`,
117
+ });
118
+ return [{ json: { success: true, queryId } }];
119
+ }
120
+ async function getDocument(index) {
121
+ const documentId = this.getNodeParameter('documentId', index);
122
+ const output = this.getNodeParameter('output', index, 'binary');
123
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', index, 'dataKioskFile');
124
+ const meta = await SpApiRequest_1.SpApiRequest.makeRequest(this, {
125
+ method: 'GET',
126
+ endpoint: `${DATA_KIOSK_BASE}/documents/${encodeURIComponent(documentId)}`,
127
+ });
128
+ const { buffer, contentType } = await (0, downloadPresigned_1.downloadPresigned)(meta.data.documentUrl);
129
+ if (output === 'text') {
130
+ return [{ json: { documentId, contentType, content: buffer.toString('utf-8') } }];
131
+ }
132
+ return [{
133
+ json: { documentId, contentType },
134
+ binary: {
135
+ [binaryPropertyName]: {
136
+ data: buffer.toString('base64'),
137
+ fileName: `${documentId}.dat`,
138
+ mimeType: contentType || 'application/octet-stream',
139
+ },
140
+ },
141
+ }];
142
+ }
143
+ async function runQueryAndDownload(index) {
144
+ var _a;
145
+ const metricsCollectorModule = await Promise.resolve().then(() => __importStar(require('../core/MetricsCollector')));
146
+ const metricsCollector = metricsCollectorModule.metricsCollector;
147
+ let query = this.getNodeParameter('query', index);
148
+ const minify = this.getNodeParameter('minifyGraphql', index, true);
149
+ const output = this.getNodeParameter('output', index, 'binary');
150
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', index, 'dataKioskFile');
151
+ const pollIntervalMs = this.getNodeParameter('pollIntervalMs', index, 2000);
152
+ const timeoutMs = this.getNodeParameter('timeoutMs', index, 300000);
153
+ const multiPageHandling = this.getNodeParameter('multiPageHandling', index, 'keepPagesSeparate');
154
+ if (minify)
155
+ query = (0, graphql_1.minifyGraphql)(query);
156
+ if (query.length > 8000) {
157
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'GraphQL query exceeds 8000 characters after minification');
158
+ }
159
+ const startedAt = Date.now();
160
+ const items = [];
161
+ let paginationToken = undefined;
162
+ let pageIndex = 0;
163
+ const requestMetrics = (success, errorCode) => {
164
+ metricsCollector.recordApiRequest('dataKiosk', Date.now() - startedAt, success, errorCode);
165
+ };
166
+ do {
167
+ const createRes = await SpApiRequest_1.SpApiRequest.makeRequest(this, {
168
+ method: 'POST',
169
+ endpoint: `${DATA_KIOSK_BASE}/queries`,
170
+ body: paginationToken ? { query, paginationToken } : { query },
171
+ });
172
+ const queryId = createRes.data.queryId;
173
+ let status;
174
+ do {
175
+ if (Date.now() - startedAt > timeoutMs) {
176
+ requestMetrics(false, 'TIMEOUT');
177
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Timeout while waiting for Data Kiosk query to complete');
178
+ }
179
+ await new Promise((r) => setTimeout(r, pollIntervalMs));
180
+ const statusRes = await SpApiRequest_1.SpApiRequest.makeRequest(this, {
181
+ method: 'GET',
182
+ endpoint: `${DATA_KIOSK_BASE}/queries/${encodeURIComponent(queryId)}`,
183
+ });
184
+ status = statusRes.data;
185
+ } while (status && (status.processingStatus === 'IN_QUEUE' || status.processingStatus === 'IN_PROGRESS'));
186
+ if (!status) {
187
+ requestMetrics(false, 'NO_STATUS');
188
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Unable to fetch query status');
189
+ }
190
+ if (status.processingStatus === 'FATAL') {
191
+ if (status.errorDocumentId) {
192
+ const docMeta = await SpApiRequest_1.SpApiRequest.makeRequest(this, {
193
+ method: 'GET',
194
+ endpoint: `${DATA_KIOSK_BASE}/documents/${encodeURIComponent(status.errorDocumentId)}`,
195
+ });
196
+ const { buffer, contentType } = await (0, downloadPresigned_1.downloadPresigned)(docMeta.data.documentUrl);
197
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Data Kiosk query failed. errorDocumentId=${status.errorDocumentId}, contentType=${contentType}, content=${buffer.toString('utf-8').slice(0, 500)}`);
198
+ }
199
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Data Kiosk query failed with FATAL status');
200
+ }
201
+ if (status.processingStatus === 'CANCELLED') {
202
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Data Kiosk query was cancelled');
203
+ }
204
+ if (status.dataDocumentId) {
205
+ const meta = await SpApiRequest_1.SpApiRequest.makeRequest(this, {
206
+ method: 'GET',
207
+ endpoint: `${DATA_KIOSK_BASE}/documents/${encodeURIComponent(status.dataDocumentId)}`,
208
+ });
209
+ const { buffer, contentType } = await (0, downloadPresigned_1.downloadPresigned)(meta.data.documentUrl);
210
+ if (output === 'text') {
211
+ items.push({ json: {
212
+ queryId: status.queryId,
213
+ pageIndex,
214
+ contentType,
215
+ content: buffer.toString('utf-8'),
216
+ processingStatus: status.processingStatus,
217
+ processingStartTime: status.processingStartTime,
218
+ processingEndTime: status.processingEndTime,
219
+ } });
220
+ }
221
+ else {
222
+ items.push({
223
+ json: {
224
+ queryId: status.queryId,
225
+ pageIndex,
226
+ contentType,
227
+ processingStatus: status.processingStatus,
228
+ processingStartTime: status.processingStartTime,
229
+ processingEndTime: status.processingEndTime,
230
+ },
231
+ binary: {
232
+ [binaryPropertyName]: {
233
+ data: buffer.toString('base64'),
234
+ fileName: `${status.queryId}_${pageIndex}.dat`,
235
+ mimeType: contentType || 'application/octet-stream',
236
+ },
237
+ },
238
+ });
239
+ }
240
+ }
241
+ paginationToken = (_a = status.pagination) === null || _a === void 0 ? void 0 : _a.nextToken;
242
+ pageIndex += 1;
243
+ if (multiPageHandling === 'stopAfterFirst')
244
+ break;
245
+ requestMetrics(true);
246
+ } while (paginationToken);
247
+ return items;
248
+ }
249
+ //# sourceMappingURL=DataKiosk.operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataKiosk.operations.js","sourceRoot":"","sources":["../../../../nodes/AmazonSellingPartner/operations/DataKiosk.operations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,8DAqBC;AAlDD,+CAKsB;AAEtB,0DAAuD;AACvD,oEAAiE;AACjE,gDAAmD;AAEnD,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAkBzC,KAAK,UAAU,yBAAyB,CAE9C,SAAiB,EACjB,SAAiB;IAEjB,QAAQ,SAAS,EAAE,CAAC;QACnB,KAAK,aAAa;YACjB,OAAO,MAAM,WAAW,CAAC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E,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;wBACjC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;wBACzC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;wBAC/C,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;qBAC3C,EAAC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACP,KAAK,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE;wBACL,OAAO,EAAE,MAAM,CAAC,OAAO;wBACvB,SAAS;wBACT,WAAW;wBACX,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;wBACzC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;wBAC/C,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;qBAC3C;oBACD,MAAM,EAAE;wBACP,CAAC,kBAAkB,CAAC,EAAE;4BACrB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;4BAC/B,QAAQ,EAAE,GAAG,MAAM,CAAC,OAAO,IAAI,SAAS,MAAM;4BAC9C,QAAQ,EAAE,WAAW,IAAI,0BAA0B;yBACnD;qBACD;iBACD,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAGD,eAAe,GAAG,MAAA,MAAM,CAAC,UAAU,0CAAE,SAAS,CAAC;QAC/C,SAAS,IAAI,CAAC,CAAC;QACf,IAAI,iBAAiB,KAAK,gBAAgB;YAAE,MAAM;QAClD,cAAc,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,QAAQ,eAAe,EAAE;IAE1B,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function executeFinanceOperation(this: IExecuteFunctions, operation: string, itemIndex: number): Promise<INodeExecutionData[]>;