node-consul-service 1.0.34 → 1.0.35

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 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}${path}`);
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,12 @@ async function dataLink(data, schema) {
19494
19494
  }
19495
19495
  });
19496
19496
  }
19497
- // ✅ Fetch remaining from service
19497
+ // ✅ Validate path
19498
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
19499
19503
  try {
19500
19504
  const response = await callService(service, {
19501
19505
  method: "POST",
@@ -19512,7 +19516,6 @@ async function dataLink(data, schema) {
19512
19516
  }
19513
19517
  }
19514
19518
  catch (error) {
19515
- console.error(`❌ Failed to fetch from ${service}${path}:`, JSON.stringify(error, Object.getOwnPropertyNames(error), 2));
19516
19519
  throw new DataLinkError(service, path, error);
19517
19520
  }
19518
19521
  }
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}${path}`);
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,12 @@ async function dataLink(data, schema) {
19492
19492
  }
19493
19493
  });
19494
19494
  }
19495
- // ✅ Fetch remaining from service
19495
+ // ✅ Validate path
19496
19496
  if (idsToFetch.length > 0) {
19497
+ if (!path.startsWith("/")) {
19498
+ throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
19499
+ }
19500
+ // ✅ Fetch remaining from service
19497
19501
  try {
19498
19502
  const response = await callService(service, {
19499
19503
  method: "POST",
@@ -19510,7 +19514,6 @@ async function dataLink(data, schema) {
19510
19514
  }
19511
19515
  }
19512
19516
  catch (error) {
19513
- console.error(`❌ Failed to fetch from ${service}${path}:`, JSON.stringify(error, Object.getOwnPropertyNames(error), 2));
19514
19517
  throw new DataLinkError(service, path, error);
19515
19518
  }
19516
19519
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-consul-service",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",