snowflake-sdk
Version:
Node.js driver for Snowflake
146 lines (145 loc) • 3.79 kB
TypeScript
export = Connection;
/**
* Creates a new Connection instance.
*
* @param {ConnectionContext} context
*
* @returns {Object}
*/
declare function Connection(context: ConnectionContext): Object;
declare class Connection {
/**
* Creates a new Connection instance.
*
* @param {ConnectionContext} context
*
* @returns {Object}
*/
constructor(context: ConnectionContext);
getTokens: () => any;
/**
* Returns true if the connection is active otherwise false
*
* @returns {boolean}
*/
isUp: () => boolean;
/**
* Returns true if the session token and master token are valid
*
* @returns {boolean}
*/
isTokenValid: () => boolean;
getServiceName: () => any;
getClientSessionKeepAlive: () => any;
getClientSessionKeepAliveHeartbeatFrequency: () => any;
getJsTreatIntegerAsBigInt: () => any;
/**
* Returns the connection id.
*
* @returns {String}
*/
getId: () => string;
heartbeat: (callback: any) => void;
heartbeatAsync: () => Promise<any>;
/**
* @return {Promise<boolean>}
*/
isValidAsync: () => Promise<boolean>;
/**
* Set the private link as the OCSP cache server's URL.
*
* @param {String} host
*
* @returns {null}
*/
setupOcspPrivateLink: (host: string) => null;
determineConnectionDomain: () => "CHINA" | "GLOBAL";
/**
* Establishes a connection if we aren't in a fatal state.
* Delegates to connectAsync() internally, routing results through the callback.
*
* @param {Function} [callback]
*
* @returns {Object} the connection object.
*/
connect: (callback?: Function) => Object;
/**
* Establishes a connection if we aren't in a fatal state.
*
* @param {Function} [callback]
*
* @returns {Object} the connection object.
*/
connectAsync: (callback?: Function) => Object;
/**
* Executes a statement.
*
* @param {Object} options
*
* @returns {Object}
*/
execute: (options: Object) => Object;
/**
* Fetches the result of a previously issued statement.
*
* @param {Object} options
*
* @returns {Object}
*/
fetchResult: (options: Object) => Object;
/**
* Immediately terminates the connection without waiting for currently
* executing statements to complete.
*
* @param {Function} callback
*
* @returns {Object} the connection object.
*/
destroy: (callback: Function) => Object;
/**
* Gets the status of the query based on queryId.
*
* @param {String} queryId
*
* @returns {String} the query status.
*/
getQueryStatus: (queryId: string) => string;
/**
* Gets the status of the query based on queryId and throws if there's an error.
*
* @param {String} queryId
*
* @returns {String} the query status.
*/
getQueryStatusThrowIfError: (queryId: string) => string;
/**
* Gets the results from a previously ran query based on queryId
*
* @param {Object} options
*
* @returns {Object}
*/
getResultsFromQueryId: (options: Object) => Object;
/**
* Checks whether the given status is currently running.
*
* @param {String} status
*
* @returns {Boolean}
*/
isStillRunning: (status: string) => boolean;
/**
* Checks whether the given status means that there has been an error.
*
* @param {String} status
*
* @returns {Boolean}
*/
isAnError: (status: string) => boolean;
/**
* Returns a serialized version of this connection.
*
* @returns {String}
*/
serialize: () => string;
}