node-consul-service 1.0.52 → 1.0.54
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 +4 -9
- package/dist/index.esm.js +4 -9
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -19033,7 +19033,7 @@ const {
|
|
|
19033
19033
|
|
|
19034
19034
|
async function callService(serviceName, options = {}) {
|
|
19035
19035
|
var _a, _b;
|
|
19036
|
-
const { method = 'GET', path = '/
|
|
19036
|
+
const { method = 'GET', path = '/', data, headers, params, } = options;
|
|
19037
19037
|
try {
|
|
19038
19038
|
const instance = await getRandomServiceInstance(serviceName);
|
|
19039
19039
|
const url = `http://${instance.ServiceAddress}:${instance.ServicePort}${path}`;
|
|
@@ -19044,11 +19044,7 @@ async function callService(serviceName, options = {}) {
|
|
|
19044
19044
|
headers,
|
|
19045
19045
|
params,
|
|
19046
19046
|
});
|
|
19047
|
-
return
|
|
19048
|
-
success: true,
|
|
19049
|
-
data: response.data,
|
|
19050
|
-
status: response.status,
|
|
19051
|
-
};
|
|
19047
|
+
return response.data;
|
|
19052
19048
|
}
|
|
19053
19049
|
catch (error) {
|
|
19054
19050
|
return {
|
|
@@ -19099,7 +19095,6 @@ async function dataLink(data, schema) {
|
|
|
19099
19095
|
const sourceData = isArray ? data : [data];
|
|
19100
19096
|
const result = sourceData.map((item) => ({ ...item }));
|
|
19101
19097
|
await Promise.all(schema.map(async ({ filed, service, path, headers, cacheGetter }) => {
|
|
19102
|
-
var _a;
|
|
19103
19098
|
if (!path || !path.trim().startsWith("/")) {
|
|
19104
19099
|
throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
|
|
19105
19100
|
}
|
|
@@ -19151,8 +19146,8 @@ async function dataLink(data, schema) {
|
|
|
19151
19146
|
headers,
|
|
19152
19147
|
data: { ids: idsToFetch },
|
|
19153
19148
|
});
|
|
19154
|
-
if ((response === null || response === void 0 ? void 0 : response.success) && Array.isArray(
|
|
19155
|
-
for (const item of response.data
|
|
19149
|
+
if ((response === null || response === void 0 ? void 0 : response.success) && Array.isArray(response.data)) {
|
|
19150
|
+
for (const item of response.data) {
|
|
19156
19151
|
if (item === null || item === void 0 ? void 0 : item._id) {
|
|
19157
19152
|
cacheMap.set(normalizeId(item._id), item);
|
|
19158
19153
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -19031,7 +19031,7 @@ const {
|
|
|
19031
19031
|
|
|
19032
19032
|
async function callService(serviceName, options = {}) {
|
|
19033
19033
|
var _a, _b;
|
|
19034
|
-
const { method = 'GET', path = '/
|
|
19034
|
+
const { method = 'GET', path = '/', data, headers, params, } = options;
|
|
19035
19035
|
try {
|
|
19036
19036
|
const instance = await getRandomServiceInstance(serviceName);
|
|
19037
19037
|
const url = `http://${instance.ServiceAddress}:${instance.ServicePort}${path}`;
|
|
@@ -19042,11 +19042,7 @@ async function callService(serviceName, options = {}) {
|
|
|
19042
19042
|
headers,
|
|
19043
19043
|
params,
|
|
19044
19044
|
});
|
|
19045
|
-
return
|
|
19046
|
-
success: true,
|
|
19047
|
-
data: response.data,
|
|
19048
|
-
status: response.status,
|
|
19049
|
-
};
|
|
19045
|
+
return response.data;
|
|
19050
19046
|
}
|
|
19051
19047
|
catch (error) {
|
|
19052
19048
|
return {
|
|
@@ -19097,7 +19093,6 @@ async function dataLink(data, schema) {
|
|
|
19097
19093
|
const sourceData = isArray ? data : [data];
|
|
19098
19094
|
const result = sourceData.map((item) => ({ ...item }));
|
|
19099
19095
|
await Promise.all(schema.map(async ({ filed, service, path, headers, cacheGetter }) => {
|
|
19100
|
-
var _a;
|
|
19101
19096
|
if (!path || !path.trim().startsWith("/")) {
|
|
19102
19097
|
throw new DataLinkError(service, path, new Error(`Invalid path: "${path}". Path must start with "/"`));
|
|
19103
19098
|
}
|
|
@@ -19149,8 +19144,8 @@ async function dataLink(data, schema) {
|
|
|
19149
19144
|
headers,
|
|
19150
19145
|
data: { ids: idsToFetch },
|
|
19151
19146
|
});
|
|
19152
|
-
if ((response === null || response === void 0 ? void 0 : response.success) && Array.isArray(
|
|
19153
|
-
for (const item of response.data
|
|
19147
|
+
if ((response === null || response === void 0 ? void 0 : response.success) && Array.isArray(response.data)) {
|
|
19148
|
+
for (const item of response.data) {
|
|
19154
19149
|
if (item === null || item === void 0 ? void 0 : item._id) {
|
|
19155
19150
|
cacheMap.set(normalizeId(item._id), item);
|
|
19156
19151
|
}
|