@dgac/nmb2b-client
Version:
EUROCONTROL Network Manager B2B SOAP client
67 lines (62 loc) • 1.83 kB
text/typescript
import { ISecurity, Client } from 'soap';
interface PfxSecurity {
pfx: Buffer;
passphrase: string;
}
interface PemSecurity {
cert: Buffer;
key: Buffer;
passphrase?: string;
}
interface ApiGwSecurity {
apiKeyId: string;
apiSecretKey: string;
}
type Security = PfxSecurity | PemSecurity | ApiGwSecurity;
declare function isValidSecurity(obj: unknown): obj is Security;
declare function prepareSecurity(config: Config): ISecurity;
/**
* Create a security objet from environment variables
*
* Will cache data for future use.
*
* @returns Security configuration
*/
declare function fromEnv(): Security;
/**
* Convenience function to clear the cached security objet
*/
declare function clearCache(): void;
type B2BFlavour = 'OPS' | 'PREOPS';
interface Config {
endpoint?: string;
xsdEndpoint?: string;
ignoreWSDLCache?: boolean;
security: Security;
flavour: B2BFlavour;
XSD_PATH: string;
soapClient?: null | Client;
}
declare function isConfigValid(args: unknown): args is Config;
declare function getEndpoint(config?: {
endpoint?: string;
flavour?: B2BFlavour;
}): string;
declare function getFileEndpoint(config?: {
endpoint?: string;
flavour?: B2BFlavour;
}): string;
declare function getFileUrl(path: string, config?: {
flavour?: B2BFlavour;
endpoint?: string;
}): string;
declare function obfuscate(config: Config): {
security: {};
endpoint?: string;
xsdEndpoint?: string;
ignoreWSDLCache?: boolean;
flavour: B2BFlavour;
XSD_PATH: string;
soapClient?: null | Client;
};
export { type B2BFlavour as B, type Config as C, type Security as S, isConfigValid as a, getFileEndpoint as b, clearCache as c, getFileUrl as d, fromEnv as f, getEndpoint as g, isValidSecurity as i, obfuscate as o, prepareSecurity as p };