@nimee/api-clients 1.1.94 → 1.1.96
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/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from "axios";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a configured axios instance that automatically:
|
|
4
|
-
* - Adds correlation ID headers for distributed tracing
|
|
5
|
-
* - Logs errors (not success responses to reduce noise)
|
|
6
|
-
*/
|
|
7
|
-
export declare function createApiClient(baseURL?: string): AxiosInstance;
|
|
8
|
-
export default createApiClient;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createApiClient = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const logger_1 = require("@nimee/logger");
|
|
9
|
-
/**
|
|
10
|
-
* Creates a configured axios instance that automatically:
|
|
11
|
-
* - Adds correlation ID headers for distributed tracing
|
|
12
|
-
* - Logs errors (not success responses to reduce noise)
|
|
13
|
-
*/
|
|
14
|
-
function createApiClient(baseURL) {
|
|
15
|
-
const instance = axios_1.default.create({ baseURL });
|
|
16
|
-
// Add correlation ID to all outgoing requests
|
|
17
|
-
instance.interceptors.request.use((config) => {
|
|
18
|
-
const correlationId = (0, logger_1.getCorrelationId)();
|
|
19
|
-
if (correlationId) {
|
|
20
|
-
config.headers = config.headers || {};
|
|
21
|
-
config.headers["x-correlation-id"] = correlationId;
|
|
22
|
-
}
|
|
23
|
-
return config;
|
|
24
|
-
});
|
|
25
|
-
return instance;
|
|
26
|
-
}
|
|
27
|
-
exports.createApiClient = createApiClient;
|
|
28
|
-
exports.default = createApiClient;
|
|
29
|
-
//# sourceMappingURL=axiosInstance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axiosInstance.js","sourceRoot":"","sources":["../../src/axiosInstance.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAiE;AACjE,0CAAiD;AAEjD;;;;GAIG;AACH,SAAgB,eAAe,CAAC,OAAgB;IAC9C,MAAM,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAE3C,8CAA8C;IAC9C,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAA0B,EAAE,EAAE;QAC/D,MAAM,aAAa,GAAG,IAAA,yBAAgB,GAAE,CAAC;QACzC,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;YACtC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,GAAG,aAAa,CAAC;QACrD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAdD,0CAcC;AAED,kBAAe,eAAe,CAAC"}
|