@dgac/nmb2b-client
Version:
EUROCONTROL Network Manager B2B SOAP client
26 lines (24 loc) • 860 B
JavaScript
import { B2B_VERSION } from "../../constants.mjs";
import path from "node:path";
import { createHash } from "node:crypto";
//#region src/utils/xsd/paths.ts
function getEndpointHash(endpoint) {
return createHash("sha256").update(endpoint).digest("hex").slice(0, 8);
}
function getXSDCacheDirectory(config) {
if (config.xsdEndpoint) {
const hash = getEndpointHash(config.xsdEndpoint);
return path.join(config.XSD_PATH, `${B2B_VERSION}-${hash}`);
}
return path.join(config.XSD_PATH, `${B2B_VERSION}-network-manager`);
}
function getServiceWSDLFilePath({ service, flavour, XSD_PATH, xsdEndpoint }) {
const directory = getXSDCacheDirectory({
XSD_PATH,
xsdEndpoint
});
return path.join(directory, `${service}_${flavour}_${B2B_VERSION}.wsdl`);
}
//#endregion
export { getServiceWSDLFilePath, getXSDCacheDirectory };
//# sourceMappingURL=paths.mjs.map