@dgac/nmb2b-client
Version:
EUROCONTROL Network Manager B2B SOAP client
139 lines (138 loc) • 3.82 kB
text/typescript
import { Security } from "./security.mjs";
import { B2BFlavour } from "./constants.mjs";
import { SoapQueryHook } from "./utils/hooks/hooks.mjs";
//#region src/config.d.ts
interface Config {
/**
* The endpoint used to perform B2B queries.
*
* If not specified, uses the public NM B2B endpoints.
*/
endpoint?: string;
/**
* Where to fetch the WSDL/XSD files.
*
* If not specified, uses the public NM B2B endpoints.
*/
xsdEndpoint?: string;
/**
* If true, will redownload the WSDL/XSD files.
*/
ignoreWSDLCache?: boolean;
/**
* The security configuration.
*
*/
security: Security;
/**
* Either 'OPS' or 'PREOPS'
*/
flavour: B2BFlavour;
/**
* Where the WSDL/XSD files should be stored on the disk.
*/
XSD_PATH: string;
/**
* Soap query hooks.
*
* @see {@link SoapQueryHook}
*/
hooks: Array<SoapQueryHook>;
}
/**
* @deprecated Use {@link assertValidConfig} instead.
*/
declare function isConfigValid(args: unknown): args is Config;
/**
* Type guard to validate a {@link Config} object.
* Checks for required fields and validity of nested objects like {@link Security}.
*
* @param args - The config object to validate.
*/
declare function assertValidConfig(args: unknown): asserts args is Config;
/**
* Constructs the full URL for the B2B SOAP Gateway (Specification Endpoint).
*
* The URL is built using the correct context (`B2B_OPS` or `B2B_PREOPS`) and version.
*
* @param config - Configuration object.
* @param config.endpoint - Optional base URL override.
* @param config.flavour - Target environment ('OPS' or 'PREOPS').
* @returns The full SOAP Gateway URL (e.g. `https://www.b2b.nm.eurocontrol.int/B2B_OPS/gateway/spec/27.0.0`).
*/
declare function getSoapEndpoint(config?: {
endpoint?: string;
flavour?: B2BFlavour;
}): string;
/**
* @deprecated Use {@link getSoapEndpoint} instead.
*/
declare function getEndpoint(config?: {
endpoint?: string;
flavour?: B2BFlavour;
}): string;
/**
* @internal
* @deprecated Use {@link getFileUrl} instead.
*/
declare function getFileEndpoint(config?: {
endpoint?: string;
flavour?: B2BFlavour;
}): string;
/**
* Constructs the absolute URL to download a specific file from the B2B Gateway.
* Handles different environments (OPS/PREOPS) and custom endpoints.
*
* @param path - The relative file path (usually returned by a SOAP response).
* @param config - Configuration object.
* @returns The complete, absolute URL to the file.
*/
declare function getFileUrl(path: string, config?: {
flavour?: B2BFlavour;
endpoint?: string;
}): string;
/**
* Creates a safe copy of the configuration object for logging purposes.
* Masks all sensitive security credentials (passwords, keys, secrets) with 'xxxxxxxxxxxxxxxx'.
*
* @param config - The configuration object to obfuscate.
* @returns A new configuration object with sensitive data masked.
*/
declare function obfuscate(config: Config): {
security: {
[k: string]: string;
};
/**
* The endpoint used to perform B2B queries.
*
* If not specified, uses the public NM B2B endpoints.
*/
endpoint?: string;
/**
* Where to fetch the WSDL/XSD files.
*
* If not specified, uses the public NM B2B endpoints.
*/
xsdEndpoint?: string;
/**
* If true, will redownload the WSDL/XSD files.
*/
ignoreWSDLCache?: boolean;
/**
* Either 'OPS' or 'PREOPS'
*/
flavour: B2BFlavour;
/**
* Where the WSDL/XSD files should be stored on the disk.
*/
XSD_PATH: string;
/**
* Soap query hooks.
*
* @see {@link SoapQueryHook}
*/
hooks: Array<SoapQueryHook>;
};
//#endregion
export { Config, assertValidConfig, getEndpoint, getFileEndpoint, getFileUrl, getSoapEndpoint, isConfigValid, obfuscate };
//# sourceMappingURL=config.d.mts.map