node-consul-service 1.0.28 → 1.0.30
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 +16 -9
- package/dist/index.esm.js +16 -9
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -19421,7 +19421,7 @@ async function callService(serviceName, options = {}) {
|
|
|
19421
19421
|
};
|
|
19422
19422
|
}
|
|
19423
19423
|
catch (error) {
|
|
19424
|
-
|
|
19424
|
+
throw {
|
|
19425
19425
|
success: false,
|
|
19426
19426
|
message: error.message,
|
|
19427
19427
|
status: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
@@ -19439,20 +19439,25 @@ function normalizeId(id) {
|
|
|
19439
19439
|
async function dataLink(data, schema) {
|
|
19440
19440
|
const isArray = Array.isArray(data);
|
|
19441
19441
|
const sourceData = isArray ? data : [data];
|
|
19442
|
-
|
|
19442
|
+
// ✅ ننسخ كل عنصر بدون التأثير على الأصل
|
|
19443
|
+
const result = sourceData.map((item) => ({ ...item }));
|
|
19443
19444
|
await Promise.all(schema.map(async ({ filed, service, path, headers, cacheGetter }) => {
|
|
19444
19445
|
var _a;
|
|
19445
|
-
const uniqueIds = Array.from(new Set(sourceData.flatMap(item => {
|
|
19446
|
+
const uniqueIds = Array.from(new Set(sourceData.flatMap((item) => {
|
|
19446
19447
|
const value = item[filed];
|
|
19447
19448
|
if (typeof value === "string" ||
|
|
19448
|
-
(value &&
|
|
19449
|
+
(value &&
|
|
19450
|
+
typeof value === "object" &&
|
|
19451
|
+
typeof value.toString === "function")) {
|
|
19449
19452
|
return [normalizeId(value)];
|
|
19450
19453
|
}
|
|
19451
19454
|
if (Array.isArray(value)) {
|
|
19452
19455
|
return value
|
|
19453
|
-
.filter(v => typeof v === "string" ||
|
|
19454
|
-
(v &&
|
|
19455
|
-
|
|
19456
|
+
.filter((v) => typeof v === "string" ||
|
|
19457
|
+
(v &&
|
|
19458
|
+
typeof v === "object" &&
|
|
19459
|
+
typeof v.toString === "function"))
|
|
19460
|
+
.map((v) => normalizeId(v));
|
|
19456
19461
|
}
|
|
19457
19462
|
return [];
|
|
19458
19463
|
})));
|
|
@@ -19496,14 +19501,16 @@ async function dataLink(data, schema) {
|
|
|
19496
19501
|
for (const item of result) {
|
|
19497
19502
|
const value = item[filed];
|
|
19498
19503
|
if (typeof value === "string" ||
|
|
19499
|
-
(value &&
|
|
19504
|
+
(value &&
|
|
19505
|
+
typeof value === "object" &&
|
|
19506
|
+
typeof value.toString === "function")) {
|
|
19500
19507
|
const key = normalizeId(value);
|
|
19501
19508
|
if (cacheMap.has(key)) {
|
|
19502
19509
|
item[filed] = cacheMap.get(key);
|
|
19503
19510
|
}
|
|
19504
19511
|
}
|
|
19505
19512
|
else if (Array.isArray(value)) {
|
|
19506
|
-
item[filed] = value.map(id => {
|
|
19513
|
+
item[filed] = value.map((id) => {
|
|
19507
19514
|
var _a;
|
|
19508
19515
|
const key = normalizeId(id);
|
|
19509
19516
|
return (_a = cacheMap.get(key)) !== null && _a !== void 0 ? _a : id;
|
package/dist/index.esm.js
CHANGED
|
@@ -19419,7 +19419,7 @@ async function callService(serviceName, options = {}) {
|
|
|
19419
19419
|
};
|
|
19420
19420
|
}
|
|
19421
19421
|
catch (error) {
|
|
19422
|
-
|
|
19422
|
+
throw {
|
|
19423
19423
|
success: false,
|
|
19424
19424
|
message: error.message,
|
|
19425
19425
|
status: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
@@ -19437,20 +19437,25 @@ function normalizeId(id) {
|
|
|
19437
19437
|
async function dataLink(data, schema) {
|
|
19438
19438
|
const isArray = Array.isArray(data);
|
|
19439
19439
|
const sourceData = isArray ? data : [data];
|
|
19440
|
-
|
|
19440
|
+
// ✅ ننسخ كل عنصر بدون التأثير على الأصل
|
|
19441
|
+
const result = sourceData.map((item) => ({ ...item }));
|
|
19441
19442
|
await Promise.all(schema.map(async ({ filed, service, path, headers, cacheGetter }) => {
|
|
19442
19443
|
var _a;
|
|
19443
|
-
const uniqueIds = Array.from(new Set(sourceData.flatMap(item => {
|
|
19444
|
+
const uniqueIds = Array.from(new Set(sourceData.flatMap((item) => {
|
|
19444
19445
|
const value = item[filed];
|
|
19445
19446
|
if (typeof value === "string" ||
|
|
19446
|
-
(value &&
|
|
19447
|
+
(value &&
|
|
19448
|
+
typeof value === "object" &&
|
|
19449
|
+
typeof value.toString === "function")) {
|
|
19447
19450
|
return [normalizeId(value)];
|
|
19448
19451
|
}
|
|
19449
19452
|
if (Array.isArray(value)) {
|
|
19450
19453
|
return value
|
|
19451
|
-
.filter(v => typeof v === "string" ||
|
|
19452
|
-
(v &&
|
|
19453
|
-
|
|
19454
|
+
.filter((v) => typeof v === "string" ||
|
|
19455
|
+
(v &&
|
|
19456
|
+
typeof v === "object" &&
|
|
19457
|
+
typeof v.toString === "function"))
|
|
19458
|
+
.map((v) => normalizeId(v));
|
|
19454
19459
|
}
|
|
19455
19460
|
return [];
|
|
19456
19461
|
})));
|
|
@@ -19494,14 +19499,16 @@ async function dataLink(data, schema) {
|
|
|
19494
19499
|
for (const item of result) {
|
|
19495
19500
|
const value = item[filed];
|
|
19496
19501
|
if (typeof value === "string" ||
|
|
19497
|
-
(value &&
|
|
19502
|
+
(value &&
|
|
19503
|
+
typeof value === "object" &&
|
|
19504
|
+
typeof value.toString === "function")) {
|
|
19498
19505
|
const key = normalizeId(value);
|
|
19499
19506
|
if (cacheMap.has(key)) {
|
|
19500
19507
|
item[filed] = cacheMap.get(key);
|
|
19501
19508
|
}
|
|
19502
19509
|
}
|
|
19503
19510
|
else if (Array.isArray(value)) {
|
|
19504
|
-
item[filed] = value.map(id => {
|
|
19511
|
+
item[filed] = value.map((id) => {
|
|
19505
19512
|
var _a;
|
|
19506
19513
|
const key = normalizeId(id);
|
|
19507
19514
|
return (_a = cacheMap.get(key)) !== null && _a !== void 0 ? _a : id;
|