UNPKG

@epilot/entity-client

Version:

JavaScript client library for the epilot Core Entity API

37 lines 1.55 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createClient = exports.getClient = void 0; var lambda_powertools_correlation_ids_1 = __importDefault(require("@dazn/lambda-powertools-correlation-ids")); var openapi_client_axios_1 = __importDefault(require("openapi-client-axios")); var definition_1 = __importDefault(require("./definition")); var client; var getClient = function () { if (!client) { client = (0, exports.createClient)(); } return client; }; exports.getClient = getClient; var createClient = function () { var _a; var api = new openapi_client_axios_1.default({ definition: definition_1.default, quick: true }); var apiClient = api.initSync(); apiClient.defaults.headers.common = __assign(__assign({}, ((_a = apiClient.defaults.headers.common) !== null && _a !== void 0 ? _a : {})), (lambda_powertools_correlation_ids_1.default.get() || {})); return apiClient; }; exports.createClient = createClient; //# sourceMappingURL=client.js.map