node-consul-service 1.0.34 → 1.0.36
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/index.cjs.js +8 -3
- package/dist/index.esm.js +8 -3
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -19433,7 +19433,7 @@ async function callService(serviceName, options = {}) {
|
|
|
19433
19433
|
// ✅ Custom Error Class
|
|
19434
19434
|
class DataLinkError extends Error {
|
|
19435
19435
|
constructor(service, path, originalError) {
|
|
19436
|
-
super(`DataLinkError: Failed to fetch from ${service}
|
|
19436
|
+
super(`DataLinkError: Failed to fetch from ${service}:${path}`);
|
|
19437
19437
|
this.name = "DataLinkError";
|
|
19438
19438
|
this.service = service;
|
|
19439
19439
|
this.path = path;
|
|
@@ -19494,8 +19494,14 @@ async function dataLink(data, schema) {
|
|
|
19494
19494
|
}
|
|
19495
19495
|
});
|
|
19496
19496
|
}
|
|
19497
|
-
// ✅
|
|
19497
|
+
// ✅ Validate path
|
|
19498
|
+
console.log(`🚀 ~ schema.map ~ !path.startsWith("/"):`, !path.startsWith("/"));
|
|
19499
|
+
console.log(`🚀 ~ schema.map ~ !path.startsWith("/"):`, path);
|
|
19498
19500
|
if (idsToFetch.length > 0) {
|
|
19501
|
+
if (!path.startsWith("/")) {
|
|
19502
|
+
throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
|
|
19503
|
+
}
|
|
19504
|
+
// ✅ Fetch remaining from service
|
|
19499
19505
|
try {
|
|
19500
19506
|
const response = await callService(service, {
|
|
19501
19507
|
method: "POST",
|
|
@@ -19512,7 +19518,6 @@ async function dataLink(data, schema) {
|
|
|
19512
19518
|
}
|
|
19513
19519
|
}
|
|
19514
19520
|
catch (error) {
|
|
19515
|
-
console.error(`❌ Failed to fetch from ${service}${path}:`, JSON.stringify(error, Object.getOwnPropertyNames(error), 2));
|
|
19516
19521
|
throw new DataLinkError(service, path, error);
|
|
19517
19522
|
}
|
|
19518
19523
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -19431,7 +19431,7 @@ async function callService(serviceName, options = {}) {
|
|
|
19431
19431
|
// ✅ Custom Error Class
|
|
19432
19432
|
class DataLinkError extends Error {
|
|
19433
19433
|
constructor(service, path, originalError) {
|
|
19434
|
-
super(`DataLinkError: Failed to fetch from ${service}
|
|
19434
|
+
super(`DataLinkError: Failed to fetch from ${service}:${path}`);
|
|
19435
19435
|
this.name = "DataLinkError";
|
|
19436
19436
|
this.service = service;
|
|
19437
19437
|
this.path = path;
|
|
@@ -19492,8 +19492,14 @@ async function dataLink(data, schema) {
|
|
|
19492
19492
|
}
|
|
19493
19493
|
});
|
|
19494
19494
|
}
|
|
19495
|
-
// ✅
|
|
19495
|
+
// ✅ Validate path
|
|
19496
|
+
console.log(`🚀 ~ schema.map ~ !path.startsWith("/"):`, !path.startsWith("/"));
|
|
19497
|
+
console.log(`🚀 ~ schema.map ~ !path.startsWith("/"):`, path);
|
|
19496
19498
|
if (idsToFetch.length > 0) {
|
|
19499
|
+
if (!path.startsWith("/")) {
|
|
19500
|
+
throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
|
|
19501
|
+
}
|
|
19502
|
+
// ✅ Fetch remaining from service
|
|
19497
19503
|
try {
|
|
19498
19504
|
const response = await callService(service, {
|
|
19499
19505
|
method: "POST",
|
|
@@ -19510,7 +19516,6 @@ async function dataLink(data, schema) {
|
|
|
19510
19516
|
}
|
|
19511
19517
|
}
|
|
19512
19518
|
catch (error) {
|
|
19513
|
-
console.error(`❌ Failed to fetch from ${service}${path}:`, JSON.stringify(error, Object.getOwnPropertyNames(error), 2));
|
|
19514
19519
|
throw new DataLinkError(service, path, error);
|
|
19515
19520
|
}
|
|
19516
19521
|
}
|