node-consul-service 1.0.37 → 1.0.39
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 +5 -7
- package/dist/index.esm.js +5 -7
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -19458,6 +19458,10 @@ async function dataLink(data, schema) {
|
|
|
19458
19458
|
const result = sourceData.map((item) => ({ ...item }));
|
|
19459
19459
|
await Promise.all(schema.map(async ({ filed, service, path, headers, cacheGetter }) => {
|
|
19460
19460
|
var _a;
|
|
19461
|
+
// ✅ Safety check + trim path
|
|
19462
|
+
if (!path || !path.trim().startsWith("/")) {
|
|
19463
|
+
throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
|
|
19464
|
+
}
|
|
19461
19465
|
const uniqueIds = Array.from(new Set(sourceData.flatMap((item) => {
|
|
19462
19466
|
const value = item[filed];
|
|
19463
19467
|
if (typeof value === "string" ||
|
|
@@ -19494,14 +19498,8 @@ async function dataLink(data, schema) {
|
|
|
19494
19498
|
}
|
|
19495
19499
|
});
|
|
19496
19500
|
}
|
|
19497
|
-
// ✅
|
|
19498
|
-
console.log(`🚀 ~ schema.map ~ !path.startsWith("/"):`, !path.startsWith("/"));
|
|
19499
|
-
console.log(`🚀 ~ schema.map ~ !path.startsWith("/"):`, path);
|
|
19500
|
-
if (!path.startsWith("/")) {
|
|
19501
|
-
throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
|
|
19502
|
-
}
|
|
19501
|
+
// ✅ Fetch missing items from service
|
|
19503
19502
|
if (idsToFetch.length > 0) {
|
|
19504
|
-
// ✅ Fetch remaining from service
|
|
19505
19503
|
try {
|
|
19506
19504
|
const response = await callService(service, {
|
|
19507
19505
|
method: "POST",
|
package/dist/index.esm.js
CHANGED
|
@@ -19456,6 +19456,10 @@ async function dataLink(data, schema) {
|
|
|
19456
19456
|
const result = sourceData.map((item) => ({ ...item }));
|
|
19457
19457
|
await Promise.all(schema.map(async ({ filed, service, path, headers, cacheGetter }) => {
|
|
19458
19458
|
var _a;
|
|
19459
|
+
// ✅ Safety check + trim path
|
|
19460
|
+
if (!path || !path.trim().startsWith("/")) {
|
|
19461
|
+
throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
|
|
19462
|
+
}
|
|
19459
19463
|
const uniqueIds = Array.from(new Set(sourceData.flatMap((item) => {
|
|
19460
19464
|
const value = item[filed];
|
|
19461
19465
|
if (typeof value === "string" ||
|
|
@@ -19492,14 +19496,8 @@ async function dataLink(data, schema) {
|
|
|
19492
19496
|
}
|
|
19493
19497
|
});
|
|
19494
19498
|
}
|
|
19495
|
-
// ✅
|
|
19496
|
-
console.log(`🚀 ~ schema.map ~ !path.startsWith("/"):`, !path.startsWith("/"));
|
|
19497
|
-
console.log(`🚀 ~ schema.map ~ !path.startsWith("/"):`, path);
|
|
19498
|
-
if (!path.startsWith("/")) {
|
|
19499
|
-
throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
|
|
19500
|
-
}
|
|
19499
|
+
// ✅ Fetch missing items from service
|
|
19501
19500
|
if (idsToFetch.length > 0) {
|
|
19502
|
-
// ✅ Fetch remaining from service
|
|
19503
19501
|
try {
|
|
19504
19502
|
const response = await callService(service, {
|
|
19505
19503
|
method: "POST",
|