UNPKG

@dgac/nmb2b-client

Version:

EUROCONTROL Network Manager B2B SOAP client

1 lines 1.57 kB
{"version":3,"file":"paths.mjs","names":[],"sources":["../../../src/utils/xsd/paths.ts"],"sourcesContent":["import path from 'node:path';\nimport { createHash } from 'node:crypto';\nimport type { Config } from '../../config.js';\nimport { B2B_VERSION, type B2BFlavour } from '../../constants.js';\n\nfunction getEndpointHash(endpoint: string): string {\n return createHash('sha256').update(endpoint).digest('hex').slice(0, 8);\n}\n\nexport function getXSDCacheDirectory(\n config: Pick<Config, 'XSD_PATH' | 'xsdEndpoint'>,\n): string {\n if (config.xsdEndpoint) {\n const hash = getEndpointHash(config.xsdEndpoint);\n return path.join(config.XSD_PATH, `${B2B_VERSION}-${hash}`);\n }\n\n return path.join(config.XSD_PATH, `${B2B_VERSION}-network-manager`);\n}\n\nexport function getServiceWSDLFilePath({\n service,\n flavour,\n XSD_PATH,\n xsdEndpoint,\n}: {\n service: string;\n flavour: B2BFlavour;\n XSD_PATH: string;\n xsdEndpoint?: string;\n}): string {\n const directory = getXSDCacheDirectory({ XSD_PATH, xsdEndpoint });\n return path.join(directory, `${service}_${flavour}_${B2B_VERSION}.wsdl`);\n}\n"],"mappings":";;;;;AAKA,SAAS,gBAAgB,UAA0B;AACjD,QAAO,WAAW,SAAS,CAAC,OAAO,SAAS,CAAC,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE;;AAGxE,SAAgB,qBACd,QACQ;AACR,KAAI,OAAO,aAAa;EACtB,MAAM,OAAO,gBAAgB,OAAO,YAAY;AAChD,SAAO,KAAK,KAAK,OAAO,UAAU,GAAG,YAAY,GAAG,OAAO;;AAG7D,QAAO,KAAK,KAAK,OAAO,UAAU,GAAG,YAAY,kBAAkB;;AAGrE,SAAgB,uBAAuB,EACrC,SACA,SACA,UACA,eAMS;CACT,MAAM,YAAY,qBAAqB;EAAE;EAAU;EAAa,CAAC;AACjE,QAAO,KAAK,KAAK,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,OAAO"}