Repository URL to install this package:
|
Version:
2.0.1 ▾
|
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const uuid_1 = __importDefault(require("uuid"));
// this we can output to a file
// and then get all the logs for a specific deploy
exports.idList = [];
exports.correlationIdNamespace = process.env.SKCID || '@skava/graphql';
/**
* @todo add this req param if we want to use it explicitly,
* since we should set it on the req
*/
exports.toCorrelationId = (index) => {
// return at an index, or the last one
if (index !== undefined) {
return exports.idList[index] || exports.idList[exports.idList.length - 1];
}
const idForRequest = exports.correlationIdNamespace + uuid_1.default();
console.info('[gql] toCorrelationId: ', idForRequest);
exports.idList.push(idForRequest);
return idForRequest;
};
//# sourceMappingURL=correlationId.js.map