lightspeed-retail-sdk 3.4.1 ā 3.4.3
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/dist/src/bin/cli.js
CHANGED
|
@@ -330,6 +330,10 @@ program
|
|
|
330
330
|
err.message
|
|
331
331
|
);
|
|
332
332
|
}
|
|
333
|
+
// Remove storage config file
|
|
334
|
+
const storageConfig = new StorageConfig();
|
|
335
|
+
await storageConfig.removeConfig();
|
|
336
|
+
console.log("šļø Storage configuration cleared");
|
|
333
337
|
return;
|
|
334
338
|
}
|
|
335
339
|
case "postgres": {
|
|
@@ -365,6 +369,10 @@ program
|
|
|
365
369
|
err.message
|
|
366
370
|
);
|
|
367
371
|
}
|
|
372
|
+
// Remove storage config file
|
|
373
|
+
const storageConfig = new StorageConfig();
|
|
374
|
+
await storageConfig.removeConfig();
|
|
375
|
+
console.log("šļø Storage configuration cleared");
|
|
368
376
|
return;
|
|
369
377
|
}
|
|
370
378
|
case "mongodb": {
|
|
@@ -402,6 +410,10 @@ program
|
|
|
402
410
|
err.message
|
|
403
411
|
);
|
|
404
412
|
}
|
|
413
|
+
// Remove storage config file
|
|
414
|
+
const storageConfig = new StorageConfig();
|
|
415
|
+
await storageConfig.removeConfig();
|
|
416
|
+
console.log("šļø Storage configuration cleared");
|
|
405
417
|
return;
|
|
406
418
|
}
|
|
407
419
|
default:
|
|
@@ -439,6 +451,11 @@ program
|
|
|
439
451
|
await fileStorage.setTokens({});
|
|
440
452
|
console.log(`\nā
Token file cleared: ${tokenFile}`);
|
|
441
453
|
}
|
|
454
|
+
|
|
455
|
+
// Remove storage config file
|
|
456
|
+
const storageConfig = new StorageConfig();
|
|
457
|
+
await storageConfig.removeConfig();
|
|
458
|
+
console.log("šļø Storage configuration cleared");
|
|
442
459
|
});
|
|
443
460
|
|
|
444
461
|
program
|
|
@@ -1104,6 +1121,16 @@ async function getStorageConfig(storage) {
|
|
|
1104
1121
|
|
|
1105
1122
|
async function selectStorageBackend(saveConfig = true) {
|
|
1106
1123
|
const storageConfig = new StorageConfig();
|
|
1124
|
+
|
|
1125
|
+
// Try auto-discovery first if not saving config (read-only operations)
|
|
1126
|
+
if (!saveConfig) {
|
|
1127
|
+
const { autoDiscoverStorage } = await import("../storage/StorageConfig.mjs");
|
|
1128
|
+
const autoStorage = await autoDiscoverStorage();
|
|
1129
|
+
if (autoStorage) {
|
|
1130
|
+
return autoStorage;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1107
1134
|
const storage = await selectStorageBackendInternal();
|
|
1108
1135
|
|
|
1109
1136
|
// Save configuration for auto-discovery if requested
|
|
@@ -291,7 +291,15 @@ class LightspeedSDKCore {
|
|
|
291
291
|
console.log("ā
Token refresh successful");
|
|
292
292
|
return this.token;
|
|
293
293
|
} catch (error) {
|
|
294
|
+
var _error_response, _error_response1;
|
|
294
295
|
console.error("ā Token refresh failed:", error.message);
|
|
296
|
+
// Log detailed error response from Lightspeed for debugging
|
|
297
|
+
if ((_error_response = error.response) === null || _error_response === void 0 ? void 0 : _error_response.data) {
|
|
298
|
+
console.error("š Error details from Lightspeed:", JSON.stringify(error.response.data, null, 2));
|
|
299
|
+
}
|
|
300
|
+
if ((_error_response1 = error.response) === null || _error_response1 === void 0 ? void 0 : _error_response1.status) {
|
|
301
|
+
console.error("š HTTP Status:", error.response.status);
|
|
302
|
+
}
|
|
295
303
|
// Check if the token was refreshed by another process
|
|
296
304
|
const updatedTokens = await this.tokenStorage.getTokens();
|
|
297
305
|
if (updatedTokens.access_token && updatedTokens.expires_at) {
|
|
@@ -336,6 +336,17 @@ export class LightspeedSDKCore {
|
|
|
336
336
|
} catch (error) {
|
|
337
337
|
console.error("ā Token refresh failed:", error.message);
|
|
338
338
|
|
|
339
|
+
// Log detailed error response from Lightspeed for debugging
|
|
340
|
+
if (error.response?.data) {
|
|
341
|
+
console.error(
|
|
342
|
+
"š Error details from Lightspeed:",
|
|
343
|
+
JSON.stringify(error.response.data, null, 2)
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
if (error.response?.status) {
|
|
347
|
+
console.error("š HTTP Status:", error.response.status);
|
|
348
|
+
}
|
|
349
|
+
|
|
339
350
|
// Check if the token was refreshed by another process
|
|
340
351
|
const updatedTokens = await this.tokenStorage.getTokens();
|
|
341
352
|
if (updatedTokens.access_token && updatedTokens.expires_at) {
|