UNPKG

@azure/core-amqp

Version:

Common library for amqp based azure sdks like @azure/event-hubs.

77 lines 3.16 kB
import type { CancellableAsyncLock } from "./lock.js"; import type { AbortSignalLike } from "@azure/abort-controller"; import type { WebSocketImpl } from "rhea-promise"; /** * Options to configure the channelling of the AMQP connection over Web Sockets. */ export interface WebSocketOptions { /** * The WebSocket constructor used to create an AMQP connection over a WebSocket. * This option should be provided in the below scenarios: * - The TCP port 5671 which is that is used by the AMQP connection to Event Hubs is blocked in your environment. * - Your application needs to be run behind a proxy server. * - Your application needs to run in the browser and you want to provide your own choice of Websocket implementation * instead of the built-in WebSocket in the browser. */ webSocket?: WebSocketImpl; /** * Options to be passed to the WebSocket constructor when the underlying `rhea` library instantiates * the WebSocket. */ webSocketConstructorOptions?: any; } /** * Defines an object with possible properties defined in T. */ export type ParsedOutput<T> = { [P in keyof T]: T[P]; }; /** * Parses the connection string and returns an object of type T. * * Connection strings have the following syntax: * * ConnectionString ::= `Part { ";" Part } [ ";" ] [ WhiteSpace ]` * Part ::= [ PartLiteral [ "=" PartLiteral ] ] * PartLiteral ::= [ WhiteSpace ] Literal [ WhiteSpace ] * Literal ::= ? any sequence of characters except ; or = or WhiteSpace ? * WhiteSpace ::= ? all whitespace characters including `\r` and `\n` ? * * @param connectionString - The connection string to be parsed. * @returns ParsedOutput<T>. */ export declare function parseConnectionString<T>(connectionString: string): ParsedOutput<T>; /** * The cancellable async lock instance. */ export declare const defaultCancellableLock: CancellableAsyncLock; /** * A wrapper for setTimeout that resolves a promise after t milliseconds. * @param delayInMs - The number of milliseconds to be delayed. * @param abortSignal - The abortSignal associated with containing operation. * @param abortErrorMsg - The abort error message associated with containing operation. * @param value - The value to be resolved with after a timeout of t milliseconds. * @returns - Resolved promise */ export declare function delay<T>(delayInMs: number, abortSignal?: AbortSignalLike, abortErrorMsg?: string, value?: T): Promise<T | void>; /** * Checks if an address is localhost. * @param address - The address to check. * @returns true if the address is localhost, false otherwise. */ export declare function isLoopbackAddress(address: string): boolean; /** * @internal */ export declare function isString(s: unknown): s is string; /** * @internal */ export declare function isNumber(n: unknown): n is number; /** * @internal * Safely read a property from the global object by key. * Returns undefined if the property or global object is unavailable. */ export declare function getGlobalProperty<T = any>(key: string): T | undefined; //# sourceMappingURL=utils.d.ts.map