1 | {"version":3,"file":"connection.js","names":["_crypto","_interopRequireDefault","require","_os","tls","_interopRequireWildcard","net","_dns","_constants","_stream","_identity","_bulkLoad","_debug","_events","_instanceLookup","_transientErrorLookup","_packet","_preloginPayload","_login7Payload","_ntlmPayload","_request","_rpcrequestPayload","_sqlbatchPayload","_messageIo","_tokenStreamParser","_transaction","_errors","_connector","_library","_tdsVersions","_message","_ntlm","_dataType","_bulkLoadPayload","_specialStoredProcedure","_package","_url","_handler","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","KEEP_ALIVE_INITIAL_DELAY","DEFAULT_CONNECT_TIMEOUT","DEFAULT_CLIENT_REQUEST_TIMEOUT","DEFAULT_CANCEL_TIMEOUT","DEFAULT_CONNECT_RETRY_INTERVAL","DEFAULT_PACKET_SIZE","DEFAULT_TEXTSIZE","DEFAULT_DATEFIRST","DEFAULT_PORT","DEFAULT_TDS_VERSION","DEFAULT_LANGUAGE","DEFAULT_DATEFORMAT","CLEANUP_TYPE","NORMAL","REDIRECT","RETRY","Connection","EventEmitter","_cancelAfterRequestSent","constructor","config","TypeError","server","fedAuthRequired","authentication","undefined","type","options","domain","userName","password","toUpperCase","clientId","tenantId","token","clientSecret","abortTransactionOnError","appName","camelCaseColumns","cancelTimeout","columnEncryptionKeyCacheTTL","columnEncryptionSetting","columnNameReplacer","connectionRetryInterval","connectTimeout","connector","connectionIsolationLevel","ISOLATION_LEVEL","READ_COMMITTED","cryptoCredentialsDetails","database","datefirst","dateFormat","debug","data","packet","payload","enableAnsiNull","enableAnsiNullDefault","enableAnsiPadding","enableAnsiWarnings","enableArithAbort","enableConcatNullYieldsNull","enableCursorCloseOnCommit","enableImplicitTransactions","enableNumericRoundabort","enableQuotedIdentifier","encrypt","fallbackToDefaultDb","encryptionKeyStoreProviders","instanceName","isolationLevel","language","localAddress","maxRetriesOnTransientErrors","multiSubnetFailover","packetSize","port","readOnlyIntent","requestTimeout","rowCollectionOnDone","rowCollectionOnRequestCompletion","serverName","serverSupportsColumnEncryption","tdsVersion","textsize","trustedServerNameAE","trustServerCertificate","useColumnNames","useUTC","workstationId","lowerCaseGuids","Error","assertValidIsolationLevel","RangeError","secureContextOptions","secureOptions","create","value","constants","SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS","createDebug","inTransaction","transactionDescriptors","Buffer","from","transactionDepth","isSqlBatch","closed","messageBuffer","alloc","curTransientRetryCount","transientErrorLookup","TransientErrorLookup","state","STATE","INITIALIZED","messageIo","sendMessage","TYPE","ATTENTION","createCancelTimer","connect","connectListener","ConnectionError","name","onConnect","err","removeListener","onError","once","transitionTo","CONNECTING","on","event","listener","emit","args","close","FINAL","initialiseConnection","signal","createConnectTimer","connectOnPort","instanceLookup","timeout","then","process","nextTick","clearConnectTimer","aborted","message","cleanupConnection","cleanupType","clearRequestTimer","clearRetryTimer","closeConnection","request","RequestError","callback","loginError","Debug","createTokenStreamParser","handler","TokenStreamParser","socketHandlingForSendPreLogin","socket","error","socketError","socketClose","socketEnd","setKeepAlive","MessageIO","cleartext","log","sendPreLogin","SENT_PRELOGIN","wrapWithTls","throwIfAborted","Promise","resolve","reject","secureContext","createSecureContext","isIP","encryptOptions","host","ALPNProtocols","servername","encryptsocket","onAbort","destroy","reason","removeEventListener","addEventListener","customConnector","connectOpts","routingData","connectInParallel","connectInSequence","dns","lookup","end","catch","controller","AbortController","connectTimer","setTimeout","abort","clearCancelTimer","cancelTimer","createRequestTimer","requestTimer","createRetryTimer","retryTimer","retryTimeout","hostPostfix","routingMessage","dispatchEvent","cancel","clearTimeout","newState","exit","enter","apply","getEventHandler","eventName","events","SENT_TLSSSLNEGOTIATION","code","REROUTING","TRANSIENT_FAILURE_RETRY","major","minor","build","exec","version","PreloginPayload","Number","subbuild","PRELOGIN","toString","sendLogin7Packet","Login7Payload","versions","clientProgVer","clientPid","pid","connectionId","clientTimeZone","Date","getTimezoneOffset","clientLcid","fedAuth","echo","workflow","fedAuthToken","sspi","createNTLMRequest","hostname","os","libraryName","initDbFatal","LOGIN7","toBuffer","sendFedAuthTokenMessage","accessTokenLen","byteLength","offset","writeUInt32LE","write","FEDAUTH_TOKEN","SENT_LOGIN7_WITH_STANDARD_LOGIN","sendInitialSql","SqlBatchPayload","getInitialSql","currentTransactionDescriptor","Message","SQL_BATCH","outgoingMessageStream","Readable","pipe","push","getIsolationLevelText","join","processedInitialSql","execSqlBatch","makeRequest","sqlTextOrProcedure","execSql","validateParameters","databaseCollation","parameters","TYPES","NVarChar","output","length","precision","scale","makeParamsParameter","RPC_REQUEST","RpcRequestPayload","Procedures","Sp_ExecuteSql","newBulkLoad","table","callbackOrOptions","BulkLoad","execBulkLoad","bulkLoad","rows","executionStarted","streamingMode","firstRowWritten","rowStream","rowToPacketTransform","onCancel","BulkLoadPayload","Request","getBulkInsertSql","BULK_LOAD","prepare","Int","preparing","handle","Sp_Prepare","unprepare","Sp_Unprepare","execute","executeParameters","len","parameter","validate","Sp_Execute","callProcedure","beginTransaction","transaction","Transaction","isolationLevelToTSQL","TRANSACTION_MANAGER","beginPayload","commitTransaction","commitPayload","rollbackTransaction","rollbackPayload","saveTransaction","savePayload","cb","useSavepoint","crypto","randomBytes","txDone","done","LOGGED_IN","txErr","packetType","canceled","connection","rowCount","rst","payloadStream","unpipe","ignore","paused","resume","resetConnection","resetConnectionOnNextRequest","SENT_CLIENT_REQUEST","reset","READ_UNCOMMITTED","REPEATABLE_READ","SERIALIZABLE","SNAPSHOT","isTransientError","AggregateError","errors","isTransient","_default","exports","module","readMessage","concat","preloginPayload","encryptionString","startTls","SENT_LOGIN7_WITH_FEDAUTH","SENT_LOGIN7_WITH_NTLM","reconnect","retry","Login7TokenHandler","tokenStreamParser","loginAckReceived","LOGGED_IN_SENDING_INITIAL_SQL","ntlmpacket","NTLMResponsePayload","NTLMAUTH_PKT","fedAuthInfoToken","stsurl","spn","tokenScope","URL","credentials","UsernamePasswordCredential","msiArgs","ManagedIdentityCredential","managedIdentityClientId","DefaultAzureCredential","ClientSecretCredential","tokenResponse","getToken","InitialSqlTokenHandler","RequestTokenHandler","SENT_ATTENTION","onResume","onPause","pause","onEndOfMessage","sqlRequest","nextState","AttentionTokenHandler","attentionReceived"],"sources":["../src/connection.ts"],"sourcesContent":["import crypto from 'crypto';\nimport os from 'os';\nimport * as tls from 'tls';\nimport * as net from 'net';\nimport dns from 'dns';\n\nimport constants from 'constants';\nimport { type SecureContextOptions } from 'tls';\n\nimport { Readable } from 'stream';\n\nimport {\n DefaultAzureCredential,\n ClientSecretCredential,\n ManagedIdentityCredential,\n UsernamePasswordCredential,\n} from '@azure/identity';\n\nimport BulkLoad, { type Options as BulkLoadOptions, type Callback as BulkLoadCallback } from './bulk-load';\nimport Debug from './debug';\nimport { EventEmitter, once } from 'events';\nimport { instanceLookup } from './instance-lookup';\nimport { TransientErrorLookup } from './transient-error-lookup';\nimport { TYPE } from './packet';\nimport PreloginPayload from './prelogin-payload';\nimport Login7Payload from './login7-payload';\nimport NTLMResponsePayload from './ntlm-payload';\nimport Request from './request';\nimport RpcRequestPayload from './rpcrequest-payload';\nimport SqlBatchPayload from './sqlbatch-payload';\nimport MessageIO from './message-io';\nimport { Parser as TokenStreamParser } from './token/token-stream-parser';\nimport { Transaction, ISOLATION_LEVEL, assertValidIsolationLevel } from './transaction';\nimport { ConnectionError, RequestError } from './errors';\nimport { connectInParallel, connectInSequence } from './connector';\nimport { name as libraryName } from './library';\nimport { versions } from './tds-versions';\nimport Message from './message';\nimport { type Metadata } from './metadata-parser';\nimport { createNTLMRequest } from './ntlm';\nimport { ColumnEncryptionAzureKeyVaultProvider } from './always-encrypted/keystore-provider-azure-key-vault';\n\nimport { type Parameter, TYPES } from './data-type';\nimport { BulkLoadPayload } from './bulk-load-payload';\nimport { Collation } from './collation';\nimport Procedures from './special-stored-procedure';\n\nimport { version } from '../package.json';\nimport { URL } from 'url';\nimport { AttentionTokenHandler, InitialSqlTokenHandler, Login7TokenHandler, RequestTokenHandler, TokenHandler } from './token/handler';\n\ntype BeginTransactionCallback =\n /**\n * The callback is called when the request to start the transaction has completed,\n * either successfully or with an error.\n * If an error occurred then `err` will describe the error.\n *\n * As only one request at a time may be executed on a connection, another request should not\n * be initiated until this callback is called.\n *\n * @param err If an error occurred, an [[Error]] object with details of the error.\n * @param transactionDescriptor A Buffer that describe the transaction\n */\n (err: Error | null | undefined, transactionDescriptor?: Buffer) => void\n\ntype SaveTransactionCallback =\n /**\n * The callback is called when the request to set a savepoint within the\n * transaction has completed, either successfully or with an error.\n * If an error occurred then `err` will describe the error.\n *\n * As only one request at a time may be executed on a connection, another request should not\n * be initiated until this callback is called.\n *\n * @param err If an error occurred, an [[Error]] object with details of the error.\n */\n (err: Error | null | undefined) => void;\n\ntype CommitTransactionCallback =\n /**\n * The callback is called when the request to commit the transaction has completed,\n * either successfully or with an error.\n * If an error occurred then `err` will describe the error.\n *\n * As only one request at a time may be executed on a connection, another request should not\n * be initiated until this callback is called.\n *\n * @param err If an error occurred, an [[Error]] object with details of the error.\n */\n (err: Error | null | undefined) => void;\n\ntype RollbackTransactionCallback =\n /**\n * The callback is called when the request to rollback the transaction has\n * completed, either successfully or with an error.\n * If an error occurred then err will describe the error.\n *\n * As only one request at a time may be executed on a connection, another request should not\n * be initiated until this callback is called.\n *\n * @param err If an error occurred, an [[Error]] object with details of the error.\n */\n (err: Error | null | undefined) => void;\n\ntype ResetCallback =\n /**\n * The callback is called when the connection reset has completed,\n * either successfully or with an error.\n *\n * If an error occurred then `err` will describe the error.\n *\n * As only one request at a time may be executed on a connection, another\n * request should not be initiated until this callback is called\n *\n * @param err If an error occurred, an [[Error]] object with details of the error.\n */\n (err: Error | null | undefined) => void;\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype TransactionCallback<T extends (err: Error | null | undefined, ...args: any[]) => void> =\n /**\n * The callback is called when the request to start a transaction (or create a savepoint, in\n * the case of a nested transaction) has completed, either successfully or with an error.\n * If an error occurred, then `err` will describe the error.\n * If no error occurred, the callback should perform its work and eventually call\n * `done` with an error or null (to trigger a transaction rollback or a\n * transaction commit) and an additional completion callback that will be called when the request\n * to rollback or commit the current transaction has completed, either successfully or with an error.\n * Additional arguments given to `done` will be passed through to this callback.\n *\n * As only one request at a time may be executed on a connection, another request should not\n * be initiated until the completion callback is called.\n *\n * @param err If an error occurred, an [[Error]] object with details of the error.\n * @param txDone If no error occurred, a function to be called to commit or rollback the transaction.\n */\n (err: Error | null | undefined, txDone?: TransactionDone<T>) => void;\n\ntype TransactionDoneCallback = (err: Error | null | undefined, ...args: any[]) => void;\ntype CallbackParameters<T extends (err: Error | null | undefined, ...args: any[]) => any> = T extends (err: Error | null | undefined, ...args: infer P) => any ? P : never;\n\ntype TransactionDone<T extends (err: Error | null | undefined, ...args: any[]) => void> =\n /**\n * If no error occurred, a function to be called to commit or rollback the transaction.\n *\n * @param err If an err occurred, a string with details of the error.\n */\n (err: Error | null | undefined, done: T, ...args: CallbackParameters<T>) => void;\n\n/**\n * @private\n */\nconst KEEP_ALIVE_INITIAL_DELAY = 30 * 1000;\n/**\n * @private\n */\nconst DEFAULT_CONNECT_TIMEOUT = 15 * 1000;\n/**\n * @private\n */\nconst DEFAULT_CLIENT_REQUEST_TIMEOUT = 15 * 1000;\n/**\n * @private\n */\nconst DEFAULT_CANCEL_TIMEOUT = 5 * 1000;\n/**\n * @private\n */\nconst DEFAULT_CONNECT_RETRY_INTERVAL = 500;\n/**\n * @private\n */\nconst DEFAULT_PACKET_SIZE = 4 * 1024;\n/**\n * @private\n */\nconst DEFAULT_TEXTSIZE = 2147483647;\n/**\n * @private\n */\nconst DEFAULT_DATEFIRST = 7;\n/**\n * @private\n */\nconst DEFAULT_PORT = 1433;\n/**\n * @private\n */\nconst DEFAULT_TDS_VERSION = '7_4';\n/**\n * @private\n */\nconst DEFAULT_LANGUAGE = 'us_english';\n/**\n * @private\n */\nconst DEFAULT_DATEFORMAT = 'mdy';\n\ninterface AzureActiveDirectoryMsiAppServiceAuthentication {\n type: 'azure-active-directory-msi-app-service';\n options: {\n /**\n * If you user want to connect to an Azure app service using a specific client account\n * they need to provide `clientId` associate to their created identity.\n *\n * This is optional for retrieve token from azure web app service\n */\n clientId?: string;\n };\n}\n\ninterface AzureActiveDirectoryMsiVmAuthentication {\n type: 'azure-active-directory-msi-vm';\n options: {\n /**\n * If you want to connect using a specific client account\n * they need to provide `clientId` associated to their created identity.\n *\n * This is optional for retrieve a token\n */\n clientId?: string;\n };\n}\n\ninterface AzureActiveDirectoryDefaultAuthentication {\n type: 'azure-active-directory-default';\n options: {\n /**\n * If you want to connect using a specific client account\n * they need to provide `clientId` associated to their created identity.\n *\n * This is optional for retrieving a token\n */\n clientId?: string;\n };\n}\n\n\ninterface AzureActiveDirectoryAccessTokenAuthentication {\n type: 'azure-active-directory-access-token';\n options: {\n /**\n * A user need to provide `token` which they retrieved else where\n * to forming the connection.\n */\n token: string;\n };\n}\n\ninterface AzureActiveDirectoryPasswordAuthentication {\n type: 'azure-active-directory-password';\n options: {\n /**\n * A user need to provide `userName` associate to their account.\n */\n userName: string;\n\n /**\n * A user need to provide `password` associate to their account.\n */\n password: string;\n\n /**\n * A client id to use.\n */\n clientId: string;\n\n /**\n * Optional parameter for specific Azure tenant ID\n */\n tenantId: string;\n };\n}\n\ninterface AzureActiveDirectoryServicePrincipalSecret {\n type: 'azure-active-directory-service-principal-secret';\n options: {\n /**\n * Application (`client`) ID from your registered Azure application\n */\n clientId: string;\n /**\n * The created `client secret` for this registered Azure application\n */\n clientSecret: string;\n /**\n * Directory (`tenant`) ID from your registered Azure application\n */\n tenantId: string;\n };\n}\n\ninterface NtlmAuthentication {\n type: 'ntlm';\n options: {\n /**\n * User name from your windows account.\n */\n userName: string;\n /**\n * Password from your windows account.\n */\n password: string;\n /**\n * Once you set domain for ntlm authentication type, driver will connect to SQL Server using domain login.\n *\n * This is necessary for forming a connection using ntlm type\n */\n domain: string;\n };\n}\n\ninterface DefaultAuthentication {\n type: 'default';\n options: {\n /**\n * User name to use for sql server login.\n */\n userName?: string | undefined;\n /**\n * Password to use for sql server login.\n */\n password?: string | undefined;\n };\n}\n\ninterface ErrorWithCode extends Error {\n code?: string;\n}\n\nexport type ConnectionAuthentication = DefaultAuthentication | NtlmAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication;\n\ninterface InternalConnectionConfig {\n server: string;\n authentication: ConnectionAuthentication;\n options: InternalConnectionOptions;\n}\n\nexport interface InternalConnectionOptions {\n abortTransactionOnError: boolean;\n appName: undefined | string;\n camelCaseColumns: boolean;\n cancelTimeout: number;\n columnEncryptionKeyCacheTTL: number;\n columnEncryptionSetting: boolean;\n columnNameReplacer: undefined | ((colName: string, index: number, metadata: Metadata) => string);\n connectionRetryInterval: number;\n connector: undefined | (() => Promise<net.Socket>);\n connectTimeout: number;\n connectionIsolationLevel: typeof ISOLATION_LEVEL[keyof typeof ISOLATION_LEVEL];\n cryptoCredentialsDetails: SecureContextOptions;\n database: undefined | string;\n datefirst: number;\n dateFormat: string;\n debug: {\n data: boolean;\n packet: boolean;\n payload: boolean;\n token: boolean;\n };\n enableAnsiNull: null | boolean;\n enableAnsiNullDefault: null | boolean;\n enableAnsiPadding: null | boolean;\n enableAnsiWarnings: null | boolean;\n enableArithAbort: null | boolean;\n enableConcatNullYieldsNull: null | boolean;\n enableCursorCloseOnCommit: null | boolean;\n enableImplicitTransactions: null | boolean;\n enableNumericRoundabort: null | boolean;\n enableQuotedIdentifier: null | boolean;\n encrypt: string | boolean;\n encryptionKeyStoreProviders: KeyStoreProviderMap | undefined;\n fallbackToDefaultDb: boolean;\n instanceName: undefined | string;\n isolationLevel: typeof ISOLATION_LEVEL[keyof typeof ISOLATION_LEVEL];\n language: string;\n localAddress: undefined | string;\n maxRetriesOnTransientErrors: number;\n multiSubnetFailover: boolean;\n packetSize: number;\n port: undefined | number;\n readOnlyIntent: boolean;\n requestTimeout: number;\n rowCollectionOnDone: boolean;\n rowCollectionOnRequestCompletion: boolean;\n serverName: undefined | string;\n serverSupportsColumnEncryption: boolean;\n tdsVersion: string;\n textsize: number;\n trustedServerNameAE: string | undefined;\n trustServerCertificate: boolean;\n useColumnNames: boolean;\n useUTC: boolean;\n workstationId: undefined | string;\n lowerCaseGuids: boolean;\n}\n\ninterface KeyStoreProviderMap {\n [key: string]: ColumnEncryptionAzureKeyVaultProvider;\n}\n\n/**\n * @private\n */\ninterface State {\n name: string;\n enter?(this: Connection): void;\n exit?(this: Connection, newState: State): void;\n events: {\n socketError?(this: Connection, err: Error): void;\n connectTimeout?(this: Connection): void;\n message?(this: Connection, message: Message): void;\n retry?(this: Connection): void;\n reconnect?(this: Connection): void;\n };\n}\n\ntype Authentication = DefaultAuthentication |\n NtlmAuthentication |\n AzureActiveDirectoryPasswordAuthentication |\n AzureActiveDirectoryMsiAppServiceAuthentication |\n AzureActiveDirectoryMsiVmAuthentication |\n AzureActiveDirectoryAccessTokenAuthentication |\n AzureActiveDirectoryServicePrincipalSecret |\n AzureActiveDirectoryDefaultAuthentication;\n\ntype AuthenticationType = Authentication['type'];\n\nexport interface ConnectionConfiguration {\n /**\n * Hostname to connect to.\n */\n server: string;\n /**\n * Configuration options for forming the connection.\n */\n options?: ConnectionOptions;\n /**\n * Authentication related options for connection.\n */\n authentication?: AuthenticationOptions;\n}\n\ninterface DebugOptions {\n /**\n * A boolean, controlling whether [[debug]] events will be emitted with text describing packet data details\n *\n * (default: `false`)\n */\n data: boolean;\n /**\n * A boolean, controlling whether [[debug]] events will be emitted with text describing packet details\n *\n * (default: `false`)\n */\n packet: boolean;\n /**\n * A boolean, controlling whether [[debug]] events will be emitted with text describing packet payload details\n *\n * (default: `false`)\n */\n payload: boolean;\n /**\n * A boolean, controlling whether [[debug]] events will be emitted with text describing token stream tokens\n *\n * (default: `false`)\n */\n token: boolean;\n}\n\ninterface AuthenticationOptions {\n /**\n * Type of the authentication method, valid types are `default`, `ntlm`,\n * `azure-active-directory-password`, `azure-active-directory-access-token`,\n * `azure-active-directory-msi-vm`, `azure-active-directory-msi-app-service`,\n * `azure-active-directory-default`\n * or `azure-active-directory-service-principal-secret`\n */\n type?: AuthenticationType;\n /**\n * Different options for authentication types:\n *\n * * `default`: [[DefaultAuthentication.options]]\n * * `ntlm` :[[NtlmAuthentication]]\n * * `azure-active-directory-password` : [[AzureActiveDirectoryPasswordAuthentication.options]]\n * * `azure-active-directory-access-token` : [[AzureActiveDirectoryAccessTokenAuthentication.options]]\n * * `azure-active-directory-msi-vm` : [[AzureActiveDirectoryMsiVmAuthentication.options]]\n * * `azure-active-directory-msi-app-service` : [[AzureActiveDirectoryMsiAppServiceAuthentication.options]]\n * * `azure-active-directory-service-principal-secret` : [[AzureActiveDirectoryServicePrincipalSecret.options]]\n * * `azure-active-directory-default` : [[AzureActiveDirectoryDefaultAuthentication.options]]\n */\n options?: any;\n}\n\nexport interface ConnectionOptions {\n /**\n * A boolean determining whether to rollback a transaction automatically if any error is encountered\n * during the given transaction's execution. This sets the value for `SET XACT_ABORT` during the\n * initial SQL phase of a connection [documentation](https://docs.microsoft.com/en-us/sql/t-sql/statements/set-xact-abort-transact-sql).\n */\n abortTransactionOnError?: boolean;\n\n /**\n * Application name used for identifying a specific application in profiling, logging or tracing tools of SQLServer.\n *\n * (default: `Tedious`)\n */\n appName?: string | undefined;\n\n /**\n * A boolean, controlling whether the column names returned will have the first letter converted to lower case\n * (`true`) or not. This value is ignored if you provide a [[columnNameReplacer]].\n *\n * (default: `false`).\n */\n camelCaseColumns?: boolean;\n\n /**\n * The number of milliseconds before the [[Request.cancel]] (abort) of a request is considered failed\n *\n * (default: `5000`).\n */\n cancelTimeout?: number;\n\n /**\n * A function with parameters `(columnName, index, columnMetaData)` and returning a string. If provided,\n * this will be called once per column per result-set. The returned value will be used instead of the SQL-provided\n * column name on row and meta data objects. This allows you to dynamically convert between naming conventions.\n *\n * (default: `null`)\n */\n columnNameReplacer?: (colName: string, index: number, metadata: Metadata) => string;\n\n /**\n * Number of milliseconds before retrying to establish connection, in case of transient failure.\n *\n * (default:`500`)\n */\n connectionRetryInterval?: number;\n\n /**\n * Custom connector factory method.\n *\n * (default: `undefined`)\n */\n connector?: () => Promise<net.Socket>;\n\n /**\n * The number of milliseconds before the attempt to connect is considered failed\n *\n * (default: `15000`).\n */\n connectTimeout?: number;\n\n /**\n * The default isolation level for new connections. All out-of-transaction queries are executed with this setting.\n *\n * The isolation levels are available from `require('tedious').ISOLATION_LEVEL`.\n * * `READ_UNCOMMITTED`\n * * `READ_COMMITTED`\n * * `REPEATABLE_READ`\n * * `SERIALIZABLE`\n * * `SNAPSHOT`\n *\n * (default: `READ_COMMITED`).\n */\n connectionIsolationLevel?: number;\n\n /**\n * When encryption is used, an object may be supplied that will be used\n * for the first argument when calling [`tls.createSecurePair`](http://nodejs.org/docs/latest/api/tls.html#tls_tls_createsecurepair_credentials_isserver_requestcert_rejectunauthorized)\n *\n * (default: `{}`)\n */\n cryptoCredentialsDetails?: SecureContextOptions;\n\n /**\n * Database to connect to (default: dependent on server configuration).\n */\n database?: string | undefined;\n\n /**\n * Sets the first day of the week to a number from 1 through 7.\n */\n datefirst?: number;\n\n /**\n * A string representing position of month, day and year in temporal datatypes.\n *\n * (default: `mdy`)\n */\n dateFormat?: string;\n\n debug?: DebugOptions;\n\n /**\n * A boolean, controls the way null values should be used during comparison operation.\n *\n * (default: `true`)\n */\n enableAnsiNull?: boolean;\n\n /**\n * If true, `SET ANSI_NULL_DFLT_ON ON` will be set in the initial sql. This means new columns will be\n * nullable by default. See the [T-SQL documentation](https://msdn.microsoft.com/en-us/library/ms187375.aspx)\n *\n * (default: `true`).\n */\n enableAnsiNullDefault?: boolean;\n\n /**\n * A boolean, controls if padding should be applied for values shorter than the size of defined column.\n *\n * (default: `true`)\n */\n enableAnsiPadding?: boolean;\n\n /**\n * If true, SQL Server will follow ISO standard behavior during various error conditions. For details,\n * see [documentation](https://docs.microsoft.com/en-us/sql/t-sql/statements/set-ansi-warnings-transact-sql)\n *\n * (default: `true`)\n */\n enableAnsiWarnings?: boolean;\n\n /**\n * Ends a query when an overflow or divide-by-zero error occurs during query execution.\n * See [documentation](https://docs.microsoft.com/en-us/sql/t-sql/statements/set-arithabort-transact-sql?view=sql-server-2017)\n * for more details.\n *\n * (default: `true`)\n */\n enableArithAbort?: boolean;\n\n /**\n * A boolean, determines if concatenation with NULL should result in NULL or empty string value, more details in\n * [documentation](https://docs.microsoft.com/en-us/sql/t-sql/statements/set-concat-null-yields-null-transact-sql)\n *\n * (default: `true`)\n */\n enableConcatNullYieldsNull?: boolean;\n\n /**\n * A boolean, controls whether cursor should be closed, if the transaction opening it gets committed or rolled\n * back.\n *\n * (default: `null`)\n */\n enableCursorCloseOnCommit?: boolean | null;\n\n /**\n * A boolean, sets the connection to either implicit or autocommit transaction mode.\n *\n * (default: `false`)\n */\n enableImplicitTransactions?: boolean;\n\n /**\n * If false, error is not generated during loss of precession.\n *\n * (default: `false`)\n */\n enableNumericRoundabort?: boolean;\n\n /**\n * If true, characters enclosed in single quotes are treated as literals and those enclosed double quotes are treated as identifiers.\n *\n * (default: `true`)\n */\n enableQuotedIdentifier?: boolean;\n\n /**\n * A string value that can be only set to 'strict', which indicates the usage TDS 8.0 protocol. Otherwise,\n * a boolean determining whether or not the connection will be encrypted.\n *\n * (default: `true`)\n */\n encrypt?: string | boolean;\n\n /**\n * By default, if the database requested by [[database]] cannot be accessed,\n * the connection will fail with an error. However, if [[fallbackToDefaultDb]] is\n * set to `true`, then the user's default database will be used instead\n *\n * (default: `false`)\n */\n fallbackToDefaultDb?: boolean;\n\n /**\n * The instance name to connect to.\n * The SQL Server Browser service must be running on the database server,\n * and UDP port 1434 on the database server must be reachable.\n *\n * (no default)\n *\n * Mutually exclusive with [[port]].\n */\n instanceName?: string | undefined;\n\n /**\n * The default isolation level that transactions will be run with.\n *\n * The isolation levels are available from `require('tedious').ISOLATION_LEVEL`.\n * * `READ_UNCOMMITTED`\n * * `READ_COMMITTED`\n * * `REPEATABLE_READ`\n * * `SERIALIZABLE`\n * * `SNAPSHOT`\n *\n * (default: `READ_COMMITED`).\n */\n isolationLevel?: number;\n\n /**\n * Specifies the language environment for the session. The session language determines the datetime formats and system messages.\n *\n * (default: `us_english`).\n */\n language?: string;\n\n /**\n * A string indicating which network interface (ip address) to use when connecting to SQL Server.\n */\n localAddress?: string | undefined;\n\n /**\n * A boolean determining whether to parse unique identifier type with lowercase case characters.\n *\n * (default: `false`).\n */\n lowerCaseGuids?: boolean;\n\n /**\n * The maximum number of connection retries for transient errors.、\n *\n * (default: `3`).\n */\n maxRetriesOnTransientErrors?: number;\n\n /**\n * Sets the MultiSubnetFailover = True parameter, which can help minimize the client recovery latency when failovers occur.\n *\n * (default: `false`).\n */\n multiSubnetFailover?: boolean;\n\n /**\n * The size of TDS packets (subject to negotiation with the server).\n * Should be a power of 2.\n *\n * (default: `4096`).\n */\n packetSize?: number;\n\n /**\n * Port to connect to (default: `1433`).\n *\n * Mutually exclusive with [[instanceName]]\n */\n port?: number;\n\n /**\n * A boolean, determining whether the connection will request read only access from a SQL Server Availability\n * Group. For more information, see [here](http://msdn.microsoft.com/en-us/library/hh710054.aspx \"Microsoft: Configure Read-Only Routing for an Availability Group (SQL Server)\")\n *\n * (default: `false`).\n */\n readOnlyIntent?: boolean;\n\n /**\n * The number of milliseconds before a request is considered failed, or `0` for no timeout.\n *\n * As soon as a response is received, the timeout is cleared. This means that queries that immediately return a response have ability to run longer than this timeout.\n *\n * (default: `15000`).\n */\n requestTimeout?: number;\n\n /**\n * A boolean, that when true will expose received rows in Requests done related events:\n * * [[Request.Event_doneInProc]]\n * * [[Request.Event_doneProc]]\n * * [[Request.Event_done]]\n *\n * (default: `false`)\n *\n * Caution: If many row are received, enabling this option could result in\n * excessive memory usage.\n */\n rowCollectionOnDone?: boolean;\n\n /**\n * A boolean, that when true will expose received rows in Requests' completion callback.See [[Request.constructor]].\n *\n * (default: `false`)\n *\n * Caution: If many row are received, enabling this option could result in\n * excessive memory usage.\n */\n rowCollectionOnRequestCompletion?: boolean;\n\n /**\n * The version of TDS to use. If server doesn't support specified version, negotiated version is used instead.\n *\n * The versions are available from `require('tedious').TDS_VERSION`.\n * * `7_1`\n * * `7_2`\n * * `7_3_A`\n * * `7_3_B`\n * * `7_4`\n *\n * (default: `7_4`)\n */\n tdsVersion?: string;\n\n /**\n * Specifies the size of varchar(max), nvarchar(max), varbinary(max), text, ntext, and image data returned by a SELECT statement.\n *\n * (default: `2147483647`)\n */\n textsize?: string;\n\n /**\n * If \"true\", the SQL Server SSL certificate is automatically trusted when the communication layer is encrypted using SSL.\n *\n * If \"false\", the SQL Server validates the server SSL certificate. If the server certificate validation fails,\n * the driver raises an error and terminates the connection. Make sure the value passed to serverName exactly\n * matches the Common Name (CN) or DNS name in the Subject Alternate Name in the server certificate for an SSL connection to succeed.\n *\n * (default: `true`)\n */\n trustServerCertificate?: boolean;\n\n /**\n *\n */\n serverName?: string;\n /**\n * A boolean determining whether to return rows as arrays or key-value collections.\n *\n * (default: `false`).\n */\n useColumnNames?: boolean;\n\n /**\n * A boolean determining whether to pass time values in UTC or local time.\n *\n * (default: `true`).\n */\n useUTC?: boolean;\n\n /**\n * The workstation ID (WSID) of the client, default os.hostname().\n * Used for identifying a specific client in profiling, logging or\n * tracing client activity in SQLServer.\n *\n * The value is reported by the TSQL function HOST_NAME().\n */\n workstationId?: string | undefined;\n}\n\n/**\n * @private\n */\nconst CLEANUP_TYPE = {\n NORMAL: 0,\n REDIRECT: 1,\n RETRY: 2\n};\n\ninterface RoutingData {\n server: string;\n port: number;\n}\n\n/**\n * A [[Connection]] instance represents a single connection to a database server.\n *\n * ```js\n * var Connection = require('tedious').Connection;\n * var config = {\n * \"authentication\": {\n * ...,\n * \"options\": {...}\n * },\n * \"options\": {...}\n * };\n * var connection = new Connection(config);\n * ```\n *\n * Only one request at a time may be executed on a connection. Once a [[Request]]\n * has been initiated (with [[Connection.callProcedure]], [[Connection.execSql]],\n * or [[Connection.execSqlBatch]]), another should not be initiated until the\n * [[Request]]'s completion callback is called.\n */\nclass Connection extends EventEmitter {\n /**\n * @private\n */\n declare fedAuthRequired: boolean;\n /**\n * @private\n */\n declare config: InternalConnectionConfig;\n /**\n * @private\n */\n declare secureContextOptions: SecureContextOptions;\n /**\n * @private\n */\n declare inTransaction: boolean;\n /**\n * @private\n */\n declare transactionDescriptors: Buffer[];\n /**\n * @private\n */\n declare transactionDepth: number;\n /**\n * @private\n */\n declare isSqlBatch: boolean;\n /**\n * @private\n */\n declare curTransientRetryCount: number;\n /**\n * @private\n */\n declare transientErrorLookup: TransientErrorLookup;\n /**\n * @private\n */\n declare closed: boolean;\n /**\n * @private\n */\n declare loginError: undefined | AggregateError | ConnectionError;\n /**\n * @private\n */\n declare debug: Debug;\n /**\n * @private\n */\n declare ntlmpacket: undefined | any;\n /**\n * @private\n */\n declare ntlmpacketBuffer: undefined | Buffer;\n\n /**\n * @private\n */\n declare STATE: {\n INITIALIZED: State;\n CONNECTING: State;\n SENT_PRELOGIN: State;\n REROUTING: State;\n TRANSIENT_FAILURE_RETRY: State;\n SENT_TLSSSLNEGOTIATION: State;\n SENT_LOGIN7_WITH_STANDARD_LOGIN: State;\n SENT_LOGIN7_WITH_NTLM: State;\n SENT_LOGIN7_WITH_FEDAUTH: State;\n LOGGED_IN_SENDING_INITIAL_SQL: State;\n LOGGED_IN: State;\n SENT_CLIENT_REQUEST: State;\n SENT_ATTENTION: State;\n FINAL: State;\n };\n\n /**\n * @private\n */\n declare routingData: undefined | RoutingData;\n\n /**\n * @private\n */\n declare messageIo: MessageIO;\n /**\n * @private\n */\n declare state: State;\n /**\n * @private\n */\n declare resetConnectionOnNextRequest: undefined | boolean;\n\n /**\n * @private\n */\n declare request: undefined | Request | BulkLoad;\n /**\n * @private\n */\n declare procReturnStatusValue: undefined | any;\n /**\n * @private\n */\n declare socket: undefined | net.Socket;\n /**\n * @private\n */\n declare messageBuffer: Buffer;\n\n /**\n * @private\n */\n declare connectTimer: undefined | NodeJS.Timeout;\n /**\n * @private\n */\n declare cancelTimer: undefined | NodeJS.Timeout;\n /**\n * @private\n */\n declare requestTimer: undefined | NodeJS.Timeout;\n /**\n * @private\n */\n declare retryTimer: undefined | NodeJS.Timeout;\n\n /**\n * @private\n */\n _cancelAfterRequestSent: () => void;\n\n /**\n * @private\n */\n declare databaseCollation: Collation | undefined;\n\n /**\n * Note: be aware of the different options field:\n * 1. config.authentication.options\n * 2. config.options\n *\n * ```js\n * const { Connection } = require('tedious');\n *\n * const config = {\n * \"authentication\": {\n * ...,\n * \"options\": {...}\n * },\n * \"options\": {...}\n * };\n *\n * const connection = new Connection(config);\n * ```\n *\n * @param config\n */\n constructor(config: ConnectionConfiguration) {\n super();\n\n if (typeof config !== 'object' || config === null) {\n throw new TypeError('The \"config\" argument is required and must be of type Object.');\n }\n\n if (typeof config.server !== 'string') {\n throw new TypeError('The \"config.server\" property is required and must be of type string.');\n }\n\n this.fedAuthRequired = false;\n\n let authentication: ConnectionAuthentication;\n if (config.authentication !== undefined) {\n if (typeof config.authentication !== 'object' || config.authentication === null) {\n throw new TypeError('The \"config.authentication\" property must be of type Object.');\n }\n\n const type = config.authentication.type;\n const options = config.authentication.options === undefined ? {} : config.authentication.options;\n\n if (typeof type !== 'string') {\n throw new TypeError('The \"config.authentication.type\" property must be of type string.');\n }\n\n if (type !== 'default' && type !== 'ntlm' && type !== 'azure-active-directory-password' && type !== 'azure-active-directory-access-token' && type !== 'azure-active-directory-msi-vm' && type !== 'azure-active-directory-msi-app-service' && type !== 'azure-active-directory-service-principal-secret' && type !== 'azure-active-directory-default') {\n throw new TypeError('The \"type\" property must one of \"default\", \"ntlm\", \"azure-active-directory-password\", \"azure-active-directory-access-token\", \"azure-active-directory-default\", \"azure-active-directory-msi-vm\" or \"azure-active-directory-msi-app-service\" or \"azure-active-directory-service-principal-secret\".');\n }\n\n if (typeof options !== 'object' || options === null) {\n throw new TypeError('The \"config.authentication.options\" property must be of type object.');\n }\n\n if (type === 'ntlm') {\n if (typeof options.domain !== 'string') {\n throw new TypeError('The \"config.authentication.options.domain\" property must be of type string.');\n }\n\n if (options.userName !== undefined && typeof options.userName !== 'string') {\n throw new TypeError('The \"config.authentication.options.userName\" property must be of type string.');\n }\n\n if (options.password !== undefined && typeof options.password !== 'string') {\n throw new TypeError('The \"config.authentication.options.password\" property must be of type string.');\n }\n\n authentication = {\n type: 'ntlm',\n options: {\n userName: options.userName,\n password: options.password,\n domain: options.domain && options.domain.toUpperCase()\n }\n };\n } else if (type === 'azure-active-directory-password') {\n if (typeof options.clientId !== 'string') {\n throw new TypeError('The \"config.authentication.options.clientId\" property must be of type string.');\n }\n\n if (options.userName !== undefined && typeof options.userName !== 'string') {\n throw new TypeError('The \"config.authentication.options.userName\" property must be of type string.');\n }\n\n if (options.password !== undefined && typeof options.password !== 'string') {\n throw new TypeError('The \"config.authentication.options.password\" property must be of type string.');\n }\n\n if (options.tenantId !== undefined && typeof options.tenantId !== 'string') {\n throw new TypeError('The \"config.authentication.options.tenantId\" property must be of type string.');\n }\n\n authentication = {\n type: 'azure-active-directory-password',\n options: {\n userName: options.userName,\n password: options.password,\n tenantId: options.tenantId,\n clientId: options.clientId\n }\n };\n } else if (type === 'azure-active-directory-access-token') {\n if (typeof options.token !== 'string') {\n throw new TypeError('The \"config.authentication.options.token\" property must be of type string.');\n }\n\n authentication = {\n type: 'azure-active-directory-access-token',\n options: {\n token: options.token\n }\n };\n } else if (type === 'azure-active-directory-msi-vm') {\n if (options.clientId !== undefined && typeof options.clientId !== 'string') {\n throw new TypeError('The \"config.authentication.options.clientId\" property must be of type string.');\n }\n\n authentication = {\n type: 'azure-active-directory-msi-vm',\n options: {\n clientId: options.clientId\n }\n };\n } else if (type === 'azure-active-directory-default') {\n if (options.clientId !== undefined && typeof options.clientId !== 'string') {\n throw new TypeError('The \"config.authentication.options.clientId\" property must be of type string.');\n }\n authentication = {\n type: 'azure-active-directory-default',\n options: {\n clientId: options.clientId\n }\n };\n } else if (type === 'azure-active-directory-msi-app-service') {\n if (options.clientId !== undefined && typeof options.clientId !== 'string') {\n throw new TypeError('The \"config.authentication.options.clientId\" property must be of type string.');\n }\n\n authentication = {\n type: 'azure-active-directory-msi-app-service',\n options: {\n clientId: options.clientId\n }\n };\n } else if (type === 'azure-active-directory-service-principal-secret') {\n if (typeof options.clientId !== 'string') {\n throw new TypeError('The \"config.authentication.options.clientId\" property must be of type string.');\n }\n\n if (typeof options.clientSecret !== 'string') {\n throw new TypeError('The \"config.authentication.options.clientSecret\" property must be of type string.');\n }\n\n if (typeof options.tenantId !== 'string') {\n throw new TypeError('The \"config.authentication.options.tenantId\" property must be of type string.');\n }\n\n authentication = {\n type: 'azure-active-directory-service-principal-secret',\n options: {\n clientId: options.clientId,\n clientSecret: options.clientSecret,\n tenantId: options.tenantId\n }\n };\n } else {\n if (options.userName !== undefined && typeof options.userName !== 'string') {\n throw new TypeError('The \"config.authentication.options.userName\" property must be of type string.');\n }\n\n if (options.password !== undefined && typeof options.password !== 'string') {\n throw new TypeError('The \"config.authentication.options.password\" property must be of type string.');\n }\n\n authentication = {\n type: 'default',\n options: {\n userName: options.userName,\n password: options.password\n }\n };\n }\n } else {\n authentication = {\n type: 'default',\n options: {\n userName: undefined,\n password: undefined\n }\n };\n }\n\n this.config = {\n server: config.server,\n authentication: authentication,\n options: {\n abortTransactionOnError: false,\n appName: undefined,\n camelCaseColumns: false,\n cancelTimeout: DEFAULT_CANCEL_TIMEOUT,\n columnEncryptionKeyCacheTTL: 2 * 60 * 60 * 1000, // Units: milliseconds\n columnEncryptionSetting: false,\n columnNameReplacer: undefined,\n connectionRetryInterval: DEFAULT_CONNECT_RETRY_INTERVAL,\n connectTimeout: DEFAULT_CONNECT_TIMEOUT,\n connector: undefined,\n connectionIsolationLevel: ISOLATION_LEVEL.READ_COMMITTED,\n cryptoCredentialsDetails: {},\n database: undefined,\n datefirst: DEFAULT_DATEFIRST,\n dateFormat: DEFAULT_DATEFORMAT,\n debug: {\n data: false,\n packet: false,\n payload: false,\n token: false\n },\n enableAnsiNull: true,\n enableAnsiNullDefault: true,\n enableAnsiPadding: true,\n enableAnsiWarnings: true,\n enableArithAbort: true,\n enableConcatNullYieldsNull: true,\n enableCursorCloseOnCommit: null,\n enableImplicitTransactions: false,\n enableNumericRoundabort: false,\n enableQuotedIdentifier: true,\n encrypt: true,\n fallbackToDefaultDb: false,\n encryptionKeyStoreProviders: undefined,\n instanceName: undefined,\n isolationLevel: ISOLATION_LEVEL.READ_COMMITTED,\n language: DEFAULT_LANGUAGE,\n localAddress: undefined,\n maxRetriesOnTransientErrors: 3,\n multiSubnetFailover: false,\n packetSize: DEFAULT_PACKET_SIZE,\n port: DEFAULT_PORT,\n readOnlyIntent: false,\n requestTimeout: DEFAULT_CLIENT_REQUEST_TIMEOUT,\n rowCollectionOnDone: false,\n rowCollectionOnRequestCompletion: false,\n serverName: undefined,\n serverSupportsColumnEncryption: false,\n tdsVersion: DEFAULT_TDS_VERSION,\n textsize: DEFAULT_TEXTSIZE,\n trustedServerNameAE: undefined,\n trustServerCertificate: false,\n useColumnNames: false,\n useUTC: true,\n workstationId: undefined,\n lowerCaseGuids: false\n }\n };\n\n if (config.options) {\n if (config.options.port && config.options.instanceName) {\n throw new Error('Port and instanceName are mutually exclusive, but ' + config.options.port + ' and ' + config.options.instanceName + ' provided');\n }\n\n if (config.options.abortTransactionOnError !== undefined) {\n if (typeof config.options.abortTransactionOnError !== 'boolean' && config.options.abortTransactionOnError !== null) {\n throw new TypeError('The \"config.options.abortTransactionOnError\" property must be of type string or null.');\n }\n\n this.config.options.abortTransactionOnError = config.options.abortTransactionOnError;\n }\n\n if (config.options.appName !== undefined) {\n if (typeof config.options.appName !== 'string') {\n throw new TypeError('The \"config.options.appName\" property must be of type string.');\n }\n\n this.config.options.appName = config.options.appName;\n }\n\n if (config.options.camelCaseColumns !== undefined) {\n if (typeof config.options.camelCaseColumns !== 'boolean') {\n throw new TypeError('The \"config.options.camelCaseColumns\" property must be of type boolean.');\n }\n\n this.config.options.camelCaseColumns = config.options.camelCaseColumns;\n }\n\n if (config.options.cancelTimeout !== undefined) {\n if (typeof config.options.cancelTimeout !== 'number') {\n throw new TypeError('The \"config.options.cancelTimeout\" property must be of type number.');\n }\n\n this.config.options.cancelTimeout = config.options.cancelTimeout;\n }\n\n if (config.options.columnNameReplacer) {\n if (typeof config.options.columnNameReplacer !== 'function') {\n throw new TypeError('The \"config.options.cancelTimeout\" property must be of type function.');\n }\n\n this.config.options.columnNameReplacer = config.options.columnNameReplacer;\n }\n\n if (config.options.connectionIsolationLevel !== undefined) {\n assertValidIsolationLevel(config.options.connectionIsolationLevel, 'config.options.connectionIsolationLevel');\n\n this.config.options.connectionIsolationLevel = config.options.connectionIsolationLevel;\n }\n\n if (config.options.connectTimeout !== undefined) {\n if (typeof config.options.connectTimeout !== 'number') {\n throw new TypeError('The \"config.options.connectTimeout\" property must be of type number.');\n }\n\n this.config.options.connectTimeout = config.options.connectTimeout;\n }\n\n if (config.options.connector !== undefined) {\n if (typeof config.options.connector !== 'function') {\n throw new TypeError('The \"config.options.connector\" property must be a function.');\n }\n\n this.config.options.connector = config.options.connector;\n }\n\n if (config.options.cryptoCredentialsDetails !== undefined) {\n if (typeof config.options.cryptoCredentialsDetails !== 'object' || config.options.cryptoCredentialsDetails === null) {\n throw new TypeError('The \"config.options.cryptoCredentialsDetails\" property must be of type Object.');\n }\n\n this.config.options.cryptoCredentialsDetails = config.options.cryptoCredentialsDetails;\n }\n\n if (config.options.database !== undefined) {\n if (typeof config.options.database !== 'string') {\n throw new TypeError('The \"config.options.database\" property must be of type string.');\n }\n\n this.config.options.database = config.options.database;\n }\n\n if (config.options.datefirst !== undefined) {\n if (typeof config.options.datefirst !== 'number' && config.options.datefirst !== null) {\n throw new TypeError('The \"config.options.datefirst\" property must be of type number.');\n }\n\n if (config.options.datefirst !== null && (config.options.datefirst < 1 || config.options.datefirst > 7)) {\n throw new RangeError('The \"config.options.datefirst\" property must be >= 1 and <= 7');\n }\n\n this.config.options.datefirst = config.options.datefirst;\n }\n\n if (config.options.dateFormat !== undefined) {\n if (typeof config.options.dateFormat !== 'string' && config.options.dateFormat !== null) {\n throw new TypeError('The \"config.options.dateFormat\" property must be of type string or null.');\n }\n\n this.config.options.dateFormat = config.options.dateFormat;\n }\n\n if (config.options.debug) {\n if (config.options.debug.data !== undefined) {\n if (typeof config.options.debug.data !== 'boolean') {\n throw new TypeError('The \"config.options.debug.data\" property must be of type boolean.');\n }\n\n this.config.options.debug.data = config.options.debug.data;\n }\n\n if (config.options.debug.packet !== undefined) {\n if (typeof config.options.debug.packet !== 'boolean') {\n throw new TypeError('The \"config.options.debug.packet\" property must be of type boolean.');\n }\n\n this.config.options.debug.packet = config.options.debug.packet;\n }\n\n if (config.options.debug.payload !== undefined) {\n if (typeof config.options.debug.payload !== 'boolean') {\n throw new TypeError('The \"config.options.debug.payload\" property must be of type boolean.');\n }\n\n this.config.options.debug.payload = config.options.debug.payload;\n }\n\n if (config.options.debug.token !== undefined) {\n if (typeof config.options.debug.token !== 'boolean') {\n throw new TypeError('The \"config.options.debug.token\" property must be of type boolean.');\n }\n\n this.config.options.debug.token = config.options.debug.token;\n }\n }\n\n if (config.options.enableAnsiNull !== undefined) {\n if (typeof config.options.enableAnsiNull !== 'boolean' && config.options.enableAnsiNull !== null) {\n throw new TypeError('The \"config.options.enableAnsiNull\" property must be of type boolean or null.');\n }\n\n this.config.options.enableAnsiNull = config.options.enableAnsiNull;\n }\n\n if (config.options.enableAnsiNullDefault !== undefined) {\n if (typeof config.options.enableAnsiNullDefault !== 'boolean' && config.options.enableAnsiNullDefault !== null) {\n throw new TypeError('The \"config.options.enableAnsiNullDefault\" property must be of type boolean or null.');\n }\n\n this.config.options.enableAnsiNullDefault = config.options.enableAnsiNullDefault;\n }\n\n if (config.options.enableAnsiPadding !== undefined) {\n if (typeof config.options.enableAnsiPadding !== 'boolean' && config.options.enableAnsiPadding !== null) {\n throw new TypeError('The \"config.options.enableAnsiPadding\" property must be of type boolean or null.');\n }\n\n this.config.options.enableAnsiPadding = config.options.enableAnsiPadding;\n }\n\n if (config.options.enableAnsiWarnings !== undefined) {\n if (typeof config.options.enableAnsiWarnings !== 'boolean' && config.options.enableAnsiWarnings !== null) {\n throw new TypeError('The \"config.options.enableAnsiWarnings\" property must be of type boolean or null.');\n }\n\n this.config.options.enableAnsiWarnings = config.options.enableAnsiWarnings;\n }\n\n if (config.options.enableArithAbort !== undefined) {\n if (typeof config.options.enableArithAbort !== 'boolean' && config.options.enableArithAbort !== null) {\n throw new TypeError('The \"config.options.enableArithAbort\" property must be of type boolean or null.');\n }\n\n this.config.options.enableArithAbort = config.options.enableArithAbort;\n }\n\n if (config.options.enableConcatNullYieldsNull !== undefined) {\n if (typeof config.options.enableConcatNullYieldsNull !== 'boolean' && config.options.enableConcatNullYieldsNull !== null) {\n throw new TypeError('The \"config.options.enableConcatNullYieldsNull\" property must be of type boolean or null.');\n }\n\n this.config.options.enableConcatNullYieldsNull = config.options.enableConcatNullYieldsNull;\n }\n\n if (config.options.enableCursorCloseOnCommit !== undefined) {\n if (typeof config.options.enableCursorCloseOnCommit !== 'boolean' && config.options.enableCursorCloseOnCommit !== null) {\n throw new TypeError('The \"config.options.enableCursorCloseOnCommit\" property must be of type boolean or null.');\n }\n\n this.config.options.enableCursorCloseOnCommit = config.options.enableCursorCloseOnCommit;\n }\n\n if (config.options.enableImplicitTransactions !== undefined) {\n if (typeof config.options.enableImplicitTransactions !== 'boolean' && config.options.enableImplicitTransactions !== null) {\n throw new TypeError('The \"config.options.enableImplicitTransactions\" property must be of type boolean or null.');\n }\n\n this.config.options.enableImplicitTransactions = config.options.enableImplicitTransactions;\n }\n\n if (config.options.enableNumericRoundabort !== undefined) {\n if (typeof config.options.enableNumericRoundabort !== 'boolean' && config.options.enableNumericRoundabort !== null) {\n throw new TypeError('The \"config.options.enableNumericRoundabort\" property must be of type boolean or null.');\n }\n\n this.config.options.enableNumericRoundabort = config.options.enableNumericRoundabort;\n }\n\n if (config.options.enableQuotedIdentifier !== undefined) {\n if (typeof config.options.enableQuotedIdentifier !== 'boolean' && config.options.enableQuotedIdentifier !== null) {\n throw new TypeError('The \"config.options.enableQuotedIdentifier\" property must be of type boolean or null.');\n }\n\n this.config.options.enableQuotedIdentifier = config.options.enableQuotedIdentifier;\n }\n if (config.options.encrypt !== undefined) {\n if (typeof config.options.encrypt !== 'boolean') {\n if (config.options.encrypt !== 'strict') {\n throw new TypeError('The \"encrypt\" property must be set to \"strict\", or of type boolean.');\n }\n }\n\n this.config.options.encrypt = config.options.encrypt;\n }\n\n if (config.options.fallbackToDefaultDb !== undefined) {\n if (typeof config.options.fallbackToDefaultDb !== 'boolean') {\n throw new TypeError('The \"config.options.fallbackToDefaultDb\" property must be of type boolean.');\n }\n\n this.config.options.fallbackToDefaultDb = config.options.fallbackToDefaultDb;\n }\n\n if (config.options.instanceName !== undefined) {\n if (typeof config.options.instanceName !== 'string') {\n throw new TypeError('The \"config.options.instanceName\" property must be of type string.');\n }\n\n this.config.options.instanceName = config.options.instanceName;\n this.config.options.port = undefined;\n }\n\n if (config.options.isolationLevel !== undefined) {\n assertValidIsolationLevel(config.options.isolationLevel, 'config.options.isolationLevel');\n\n this.config.options.isolationLevel = config.options.isolationLevel;\n }\n\n if (config.options.language !== undefined) {\n if (typeof config.options.language !== 'string' && config.options.language !== null) {\n throw new TypeError('The \"config.options.language\" property must be of type string or null.');\n }\n\n this.config.options.language = config.options.language;\n }\n\n if (config.options.localAddress !== undefined) {\n if (typeof config.options.localAddress !== 'string') {\n throw new TypeError('The \"config.options.localAddress\" property must be of type string.');\n }\n\n this.config.options.localAddress = config.options.localAddress;\n }\n\n if (config.options.multiSubnetFailover !== undefined) {\n if (typeof config.options.multiSubnetFailover !== 'boolean') {\n throw new TypeError('The \"config.options.multiSubnetFailover\" property must be of type boolean.');\n }\n\n this.config.options.multiSubnetFailover = config.options.multiSubnetFailover;\n }\n\n if (config.options.packetSize !== undefined) {\n if (typeof config.options.packetSize !== 'number') {\n throw new TypeError('The \"config.options.packetSize\" property must be of type number.');\n }\n\n this.config.options.packetSize = config.options.packetSize;\n }\n\n if (config.options.port !== undefined) {\n if (typeof config.options.port !== 'number') {\n throw new TypeError('The \"config.options.port\" property must be of type number.');\n }\n\n if (config.options.port <= 0 || config.options.port >= 65536) {\n throw new RangeError('The \"config.options.port\" property must be > 0 and < 65536');\n }\n\n this.config.options.port = config.options.port;\n this.config.options.instanceName = undefined;\n }\n\n if (config.options.readOnlyIntent !== undefined) {\n if (typeof config.options.readOnlyIntent !== 'boolean') {\n throw new TypeError('The \"config.options.readOnlyIntent\" property must be of type boolean.');\n }\n\n this.config.options.readOnlyIntent = config.options.readOnlyIntent;\n }\n\n if (config.options.requestTimeout !== undefined) {\n if (typeof config.options.requestTimeout !== 'number') {\n throw new TypeError('The \"config.options.requestTimeout\" property must be of type number.');\n }\n\n this.config.options.requestTimeout = config.options.requestTimeout;\n }\n\n if (config.options.maxRetriesOnTransientErrors !== undefined) {\n if (typeof config.options.maxRetriesOnTransientErrors !== 'number') {\n throw new TypeError('The \"config.options.maxRetriesOnTransientErrors\" property must be of type number.');\n }\n\n if (config.options.maxRetriesOnTransientErrors < 0) {\n throw new TypeError('The \"config.options.maxRetriesOnTransientErrors\" property must be equal or greater than 0.');\n }\n\n this.config.options.maxRetriesOnTransientErrors = config.options.maxRetriesOnTransientErrors;\n }\n\n if (config.options.connectionRetryInterval !== undefined) {\n if (typeof config.options.connectionRetryInterval !== 'number') {\n throw new TypeError('The \"config.options.connectionRetryInterval\" property must be of type number.');\n }\n\n if (config.options.connectionRetryInterval <= 0) {\n throw new TypeError('The \"config.options.connectionRetryInterval\" property must be greater than 0.');\n }\n\n this.config.options.connectionRetryInterval = config.options.connectionRetryInterval;\n }\n\n if (config.options.rowCollectionOnDone !== undefined) {\n if (typeof config.options.rowCollectionOnDone !== 'boolean') {\n throw new TypeError('The \"config.options.rowCollectionOnDone\" property must be of type boolean.');\n }\n\n this.config.options.rowCollectionOnDone = config.options.rowCollectionOnDone;\n }\n\n if (config.options.rowCollectionOnRequestCompletion !== undefined) {\n if (typeof config.options.rowCollectionOnRequestCompletion !== 'boolean') {\n throw new TypeError('The \"config.options.rowCollectionOnRequestCompletion\" property must be of type boolean.');\n }\n\n this.config.options.rowCollectionOnRequestCompletion = config.options.rowCollectionOnRequestCompletion;\n }\n\n if (config.options.tdsVersion !== undefined) {\n if (typeof config.options.tdsVersion !== 'string') {\n throw new TypeError('The \"config.options.tdsVersion\" property must be of type string.');\n }\n\n this.config.options.tdsVersion = config.options.tdsVersion;\n }\n\n if (config.options.textsize !== undefined) {\n if (typeof config.options.textsize !== 'number' && config.options.textsize !== null) {\n throw new TypeError('The \"config.options.textsize\" property must be of type number or null.');\n }\n\n if (config.options.textsize > 2147483647) {\n throw new TypeError('The \"config.options.textsize\" can\\'t be greater than 2147483647.');\n } else if (config.options.textsize < -1) {\n throw new TypeError('The \"config.options.textsize\" can\\'t be smaller than -1.');\n }\n\n this.config.options.textsize = config.options.textsize | 0;\n }\n\n if (config.options.trustServerCertificate !== undefined) {\n if (typeof config.options.trustServerCertificate !== 'boolean') {\n throw new TypeError('The \"config.options.trustServerCertificate\" property must be of type boolean.');\n }\n\n this.config.options.trustServerCertificate = config.options.trustServerCertificate;\n }\n\n if (config.options.serverName !== undefined) {\n if (typeof config.options.serverName !== 'string') {\n throw new TypeError('The \"config.options.serverName\" property must be of type string.');\n }\n this.config.options.serverName = config.options.serverName;\n }\n\n if (config.options.useColumnNames !== undefined) {\n if (typeof config.options.useColumnNames !== 'boolean') {\n throw new TypeError('The \"config.options.useColumnNames\" property must be of type boolean.');\n }\n\n this.config.options.useColumnNames = config.options.useColumnNames;\n }\n\n if (config.options.useUTC !== undefined) {\n if (typeof config.options.useUTC !== 'boolean') {\n throw new TypeError('The \"config.options.useUTC\" property must be of type boolean.');\n }\n\n this.config.options.useUTC = config.options.useUTC;\n }\n\n if (config.options.workstationId !== undefined) {\n if (typeof config.options.workstationId !== 'string') {\n throw new TypeError('The \"config.options.workstationId\" property must be of type string.');\n }\n\n this.config.options.workstationId = config.options.workstationId;\n }\n\n if (config.options.lowerCaseGuids !== undefined) {\n if (typeof config.options.lowerCaseGuids !== 'boolean') {\n throw new TypeError('The \"config.options.lowerCaseGuids\" property must be of type boolean.');\n }\n\n this.config.options.lowerCaseGuids = config.options.lowerCaseGuids;\n }\n }\n\n this.secureContextOptions = this.config.options.cryptoCredentialsDetails;\n if (this.secureContextOptions.secureOptions === undefined) {\n // If the caller has not specified their own `secureOptions`,\n // we set `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS` here.\n // Older SQL Server instances running on older Windows versions have\n // trouble with the BEAST workaround in OpenSSL.\n // As BEAST is a browser specific exploit, we can just disable this option here.\n this.secureContextOptions = Object.create(this.secureContextOptions, {\n secureOptions: {\n value: constants.SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS\n }\n });\n }\n\n this.debug = this.createDebug();\n this.inTransaction = false;\n this.transactionDescriptors = [Buffer.from([0, 0, 0, 0, 0, 0, 0, 0])];\n\n // 'beginTransaction', 'commitTransaction' and 'rollbackTransaction'\n // events are utilized to maintain inTransaction property state which in\n // turn is used in managing transactions. These events are only fired for\n // TDS version 7.2 and beyond. The properties below are used to emulate\n // equivalent behavior for TDS versions before 7.2.\n this.transactionDepth = 0;\n this.isSqlBatch = false;\n this.closed = false;\n this.messageBuffer = Buffer.alloc(0);\n\n this.curTransientRetryCount = 0;\n this.transientErrorLookup = new TransientErrorLookup();\n\n this.state = this.STATE.INITIALIZED;\n\n this._cancelAfterRequestSent = () => {\n this.messageIo.sendMessage(TYPE.ATTENTION);\n this.createCancelTimer();\n };\n }\n\n connect(connectListener?: (err?: Error) => void) {\n if (this.state !== this.STATE.INITIALIZED) {\n throw new ConnectionError('`.connect` can not be called on a Connection in `' + this.state.name + '` state.');\n }\n\n if (connectListener) {\n const onConnect = (err?: Error) => {\n this.removeListener('error', onError);\n connectListener(err);\n };\n\n const onError = (err: Error) => {\n this.removeListener('connect', onConnect);\n connectListener(err);\n };\n\n this.once('connect', onConnect);\n this.once('error', onError);\n }\n\n this.transitionTo(this.STATE.CONNECTING);\n }\n\n /**\n * The server has reported that the charset has changed.\n */\n on(event: 'charsetChange', listener: (charset: string) => void): this\n\n /**\n * The attempt to connect and validate has completed.\n */\n on(\n event: 'connect',\n /**\n * @param err If successfully connected, will be falsey. If there was a\n * problem (with either connecting or validation), will be an [[Error]] object.\n */\n listener: (err: Error | undefined) => void\n ): this\n\n /**\n * The server has reported that the active database has changed.\n * This may be as a result of a successful login, or a `use` statement.\n */\n on(event: 'databaseChange', listener: (databaseName: string) => void): this\n\n /**\n * A debug message is available. It may be logged or ignored.\n */\n on(event: 'debug', listener: (messageText: string) => void): this\n\n /**\n * Internal error occurs.\n */\n on(event: 'error', listener: (err: Error) => void): this\n\n /**\n * The server has issued an error message.\n */\n on(event: 'errorMessage', listener: (message: import('./token/token').ErrorMessageToken) => void): this\n\n /**\n * The connection has ended.\n *\n * This may be as a result of the client calling [[close]], the server\n * closing the connection, or a network error.\n */\n on(event: 'end', listener: () => void): this\n\n /**\n * The server has issued an information message.\n */\n on(event: 'infoMessage', listener: (message: import('./token/token').InfoMessageToken) => void): this\n\n /**\n * The server has reported that the language has changed.\n */\n on(event: 'languageChange', listener: (languageName: string) => void): this\n\n /**\n * The connection was reset.\n */\n on(event: 'resetConnection', listener: () => void): this\n\n /**\n * A secure connection has been established.\n */\n on(event: 'secure', listener: (cleartext: import('tls').TLSSocket) => void): this\n\n on(event: string | symbol, listener: (...args: any[]) => void) {\n return super.on(event, listener);\n }\n\n /**\n * @private\n */\n emit(event: 'charsetChange', charset: string): boolean\n /**\n * @private\n */\n emit(event: 'connect', error?: Error): boolean\n /**\n * @private\n */\n emit(event: 'databaseChange', databaseName: string): boolean\n /**\n * @private\n */\n emit(event: 'debug', messageText: string): boolean\n /**\n * @private\n */\n emit(event: 'error', error: Error): boolean\n /**\n * @private\n */\n emit(event: 'errorMessage', message: import('./token/token').ErrorMessageToken): boolean\n /**\n * @private\n */\n emit(event: 'end'): boolean\n /**\n * @private\n */\n emit(event: 'infoMessage', message: import('./token/token').InfoMessageToken): boolean\n /**\n * @private\n */\n emit(event: 'languageChange', languageName: string): boolean\n /**\n * @private\n */\n emit(event: 'secure', cleartext: import('tls').TLSSocket): boolean\n /**\n * @private\n */\n emit(event: 'rerouting'): boolean\n /**\n * @private\n */\n emit(event: 'resetConnection'): boolean\n /**\n * @private\n */\n emit(event: 'retry'): boolean\n /**\n * @private\n */\n emit(event: 'rollbackTransaction'): boolean\n\n emit(event: string | symbol, ...args: any[]) {\n return super.emit(event, ...args);\n }\n\n /**\n * Closes the connection to the database.\n *\n * The [[Event_end]] will be emitted once the connection has been closed.\n */\n close() {\n this.transitionTo(this.STATE.FINAL);\n }\n\n /**\n * @private\n */\n initialiseConnection() {\n const signal = this.createConnectTimer();\n\n if (this.config.options.port) {\n return this.connectOnPort(this.config.options.port, this.config.options.multiSubnetFailover, signal, this.config.options.connector);\n } else {\n return instanceLookup({\n server: this.config.server,\n instanceName: this.config.options.instanceName!,\n timeout: this.config.options.connectTimeout,\n signal: signal\n }).then((port) => {\n process.nextTick(() => {\n this.connectOnPort(port, this.config.options.multiSubnetFailover, signal, this.config.options.connector);\n });\n }, (err) => {\n this.clearConnectTimer();\n\n if (signal.aborted) {\n // Ignore the AbortError for now, this is still handled by the connectTimer firing\n return;\n }\n\n process.nextTick(() => {\n this.emit('connect', new ConnectionError(err.message, 'EINSTLOOKUP'));\n });\n });\n }\n }\n\n /**\n * @private\n */\n cleanupConnection(cleanupType: typeof CLEANUP_TYPE[keyof typeof CLEANUP_TYPE]) {\n if (!this.closed) {\n this.clearConnectTimer();\n this.clearRequestTimer();\n this.clearRetryTimer();\n this.closeConnection();\n if (cleanupType === CLEANUP_TYPE.REDIRECT) {\n this.emit('rerouting');\n } else if (cleanupType !== CLEANUP_TYPE.RETRY) {\n process.nextTick(() => {\n this.emit('end');\n });\n }\n\n const request = this.request;\n if (request) {\n const err = new RequestError('Connection closed before request completed.', 'ECLOSE');\n request.callback(err);\n this.request = undefined;\n }\n\n this.closed = true;\n this.loginError = undefined;\n }\n }\n\n /**\n * @private\n */\n createDebug() {\n const debug = new Debug(this.config.options.debug);\n debug.on('debug', (message) => {\n this.emit('debug', message);\n });\n return debug;\n }\n\n /**\n * @private\n */\n createTokenStreamParser(message: Message, handler: TokenHandler) {\n return new TokenStreamParser(message, this.debug, handler, this.config.options);\n }\n\n socketHandlingForSendPreLogin(socket: net.Socket) {\n socket.on('error', (error) => { this.socketError(error); });\n socket.on('close', () => { this.socketClose(); });\n socket.on('end', () => { this.socketEnd(); });\n socket.setKeepAlive(true, KEEP_ALIVE_INITIAL_DELAY);\n\n this.messageIo = new MessageIO(socket, this.config.options.packetSize, this.debug);\n this.messageIo.on('secure', (cleartext) => { this.emit('secure', cleartext); });\n\n this.socket = socket;\n\n this.closed = false;\n this.debug.log('connected to ' + this.config.server + ':' + this.config.options.port);\n\n this.sendPreLogin();\n this.transitionTo(this.STATE.SENT_PRELOGIN);\n }\n\n wrapWithTls(socket: net.Socket, signal: AbortSignal): Promise<tls.TLSSocket> {\n signal.throwIfAborted();\n\n return new Promise((resolve, reject) => {\n const secureContext = tls.createSecureContext(this.secureContextOptions);\n // If connect to an ip address directly,\n // need to set the servername to an empty string\n // if the user has not given a servername explicitly\n const serverName = !net.isIP(this.config.server) ? this.config.server : '';\n const encryptOptions = {\n host: this.config.server,\n socket: socket,\n ALPNProtocols: ['tds/8.0'],\n secureContext: secureContext,\n servername: this.config.options.serverName ? this.config.options.serverName : serverName,\n };\n\n const encryptsocket = tls.connect(encryptOptions);\n\n const onAbort = () => {\n encryptsocket.removeListener('error', onError);\n encryptsocket.removeListener('connect', onConnect);\n\n encryptsocket.destroy();\n\n reject(signal.reason);\n };\n\n const onError = (err: Error) => {\n signal.removeEventListener('abort', onAbort);\n\n encryptsocket.removeListener('error', onError);\n encryptsocket.removeListener('connect', onConnect);\n\n encryptsocket.destroy();\n\n reject(err);\n };\n\n const onConnect = () => {\n signal.removeEventListener('abort', onAbort);\n\n encryptsocket.removeListener('error', onError);\n encryptsocket.removeListener('connect', onConnect);\n\n resolve(encryptsocket);\n };\n\n signal.addEventListener('abort', onAbort, { once: true });\n\n encryptsocket.on('error', onError);\n encryptsocket.on('secureConnect', onConnect);\n });\n }\n\n connectOnPort(port: number, multiSubnetFailover: boolean, signal: AbortSignal, customConnector?: () => Promise<net.Socket>) {\n const connectOpts = {\n host: this.routingData ? this.routingData.server : this.config.server,\n port: this.routingData ? this.routingData.port : port,\n localAddress: this.config.options.localAddress\n };\n\n const connect = customConnector || (multiSubnetFailover ? connectInParallel : connectInSequence);\n\n (async () => {\n let socket = await connect(connectOpts, dns.lookup, signal);\n\n if (this.config.options.encrypt === 'strict') {\n try {\n // Wrap the socket with TLS for TDS 8.0\n socket = await this.wrapWithTls(socket, signal);\n } catch (err) {\n socket.end();\n\n throw err;\n }\n }\n\n this.socketHandlingForSendPreLogin(socket);\n })().catch((err) => {\n this.clearConnectTimer();\n\n if (signal.aborted) {\n return;\n }\n\n process.nextTick(() => { this.socketError(err); });\n });\n }\n\n /**\n * @private\n */\n closeConnection() {\n if (this.socket) {\n this.socket.destroy();\n }\n }\n\n /**\n * @private\n */\n createConnectTimer() {\n const controller = new AbortController();\n this.connectTimer = setTimeout(() => {\n controller.abort();\n this.connectTimeout();\n }, this.config.options.connectTimeout);\n return controller.signal;\n }\n\n /**\n * @private\n */\n createCancelTimer() {\n this.clearCancelTimer();\n const timeout = this.config.options.cancelTimeout;\n if (timeout > 0) {\n this.cancelTimer = setTimeout(() => {\n this.cancelTimeout();\n }, timeout);\n }\n }\n\n /**\n * @private\n */\n createRequestTimer() {\n this.clearRequestTimer(); // release old timer, just to be safe\n const request = this.request as Request;\n const timeout = (request.timeout !== undefined) ? request.timeout : this.config.options.requestTimeout;\n if (timeout) {\n this.requestTimer = setTimeout(() => {\n this.requestTimeout();\n }, timeout);\n }\n }\n\n /**\n * @private\n */\n createRetryTimer() {\n this.clearRetryTimer();\n this.retryTimer = setTimeout(() => {\n this.retryTimeout();\n }, this.config.options.connectionRetryInterval);\n }\n\n /**\n * @private\n */\n connectTimeout() {\n const hostPostfix = this.config.options.port ? `:${this.config.options.port}` : `\\\\${this.config.options.instanceName}`;\n // If we have routing data stored, this connection has been redirected\n const server = this.routingData ? this.routingData.server : this.config.server;\n const port = this.routingData ? `:${this.routingData.port}` : hostPostfix;\n // Grab the target host from the connection configuration, and from a redirect message\n // otherwise, leave the message empty.\n const routingMessage = this.routingData ? ` (redirected from ${this.config.server}${hostPostfix})` : '';\n const message = `Failed to connect to ${server}${port}${routingMessage} in ${this.config.options.connectTimeout}ms`;\n this.debug.log(message);\n this.emit('connect', new ConnectionError(message, 'ETIMEOUT'));\n this.connectTimer = undefined;\n this.dispatchEvent('connectTimeout');\n }\n\n /**\n * @private\n */\n cancelTimeout() {\n const message = `Failed to cancel request in ${this.config.options.cancelTimeout}ms`;\n this.debug.log(message);\n this.dispatchEvent('socketError', new ConnectionError(message, 'ETIMEOUT'));\n }\n\n /**\n * @private\n */\n requestTimeout() {\n this.requestTimer = undefined;\n const request = this.request!;\n request.cancel();\n const timeout = (request.timeout !== undefined) ? request.timeout : this.config.options.requestTimeout;\n const message = 'Timeout: Request failed to complete in ' + timeout + 'ms';\n request.error = new RequestError(message, 'ETIMEOUT');\n }\n\n /**\n * @private\n */\n retryTimeout() {\n this.retryTimer = undefined;\n this.emit('retry');\n this.transitionTo(this.STATE.CONNECTING);\n }\n\n /**\n * @private\n */\n clearConnectTimer() {\n if (this.connectTimer) {\n clearTimeout(this.connectTimer);\n this.connectTimer = undefined;\n }\n }\n\n /**\n * @private\n */\n clearCancelTimer() {\n if (this.cancelTimer) {\n clearTimeout(this.cancelTimer);\n this.cancelTimer = undefined;\n }\n }\n\n /**\n * @private\n */\n clearRequestTimer() {\n if (this.requestTimer) {\n clearTimeout(this.requestTimer);\n this.requestTimer = undefined;\n }\n }\n\n /**\n * @private\n */\n clearRetryTimer() {\n if (this.retryTimer) {\n clearTimeout(this.retryTimer);\n this.retryTimer = undefined;\n }\n }\n\n /**\n * @private\n */\n transitionTo(newState: State) {\n if (this.state === newState) {\n this.debug.log('State is already ' + newState.name);\n return;\n }\n\n if (this.state && this.state.exit) {\n this.state.exit.call(this, newState);\n }\n\n this.debug.log('State change: ' + (this.state ? this.state.name : 'undefined') + ' -> ' + newState.name);\n this.state = newState;\n\n if (this.state.enter) {\n this.state.enter.apply(this);\n }\n }\n\n /**\n * @private\n */\n getEventHandler<T extends keyof State['events']>(eventName: T): NonNullable<State['events'][T]> {\n const handler = this.state.events[eventName];\n\n if (!handler) {\n throw new Error(`No event '${eventName}' in state '${this.state.name}'`);\n }\n\n return handler!;\n }\n\n /**\n * @private\n */\n dispatchEvent<T extends keyof State['events']>(eventName: T, ...args: Parameters<NonNullable<State['events'][T]>>) {\n const handler = this.state.events[eventName] as ((this: Connection, ...args: any[]) => void) | undefined;\n if (handler) {\n handler.apply(this, args);\n } else {\n this.emit('error', new Error(`No event '${eventName}' in state '${this.state.name}'`));\n this.close();\n }\n }\n\n /**\n * @private\n */\n socketError(error: Error) {\n if (this.state === this.STATE.CONNECTING || this.state === this.STATE.SENT_TLSSSLNEGOTIATION) {\n const hostPostfix = this.config.options.port ? `:${this.config.options.port}` : `\\\\${this.config.options.instanceName}`;\n // If we have routing data stored, this connection has been redirected\n const server = this.routingData ? this.routingData.server : this.config.server;\n const port = this.routingData ? `:${this.routingData.port}` : hostPostfix;\n // Grab the target host from the connection configuration, and from a redirect message\n // otherwise, leave the message empty.\n const routingMessage = this.routingData ? ` (redirected from ${this.config.server}${hostPostfix})` : '';\n const message = `Failed to connect to ${server}${port}${routingMessage} - ${error.message}`;\n this.debug.log(message);\n this.emit('connect', new ConnectionError(message, 'ESOCKET'));\n } else {\n const message = `Connection lost - ${error.message}`;\n this.debug.log(message);\n this.emit('error', new ConnectionError(message, 'ESOCKET'));\n }\n this.dispatchEvent('socketError', error);\n }\n\n /**\n * @private\n */\n socketEnd() {\n this.debug.log('socket ended');\n if (this.state !== this.STATE.FINAL) {\n const error: ErrorWithCode = new Error('socket hang up');\n error.code = 'ECONNRESET';\n this.socketError(error);\n }\n }\n\n /**\n * @private\n */\n socketClose() {\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n if (this.state === this.STATE.REROUTING) {\n this.debug.log('Rerouting to ' + this.routingData!.server + ':' + this.routingData!.port);\n\n this.dispatchEvent('reconnect');\n } else if (this.state === this.STATE.TRANSIENT_FAILURE_RETRY) {\n const server = this.routingData ? this.routingData.server : this.config.server;\n const port = this.routingData ? this.routingData.port : this.config.options.port;\n this.debug.log('Retry after transient failure connecting to ' + server + ':' + port);\n\n this.dispatchEvent('retry');\n } else {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n\n /**\n * @private\n */\n sendPreLogin() {\n const [, major, minor, build] = /^(\\d+)\\.(\\d+)\\.(\\d+)/.exec(version) ?? ['0.0.0', '0', '0', '0'];\n const payload = new PreloginPayload({\n // If encrypt setting is set to 'strict', then we should have already done the encryption before calling\n // this function. Therefore, the encrypt will be set to false here.\n // Otherwise, we will set encrypt here based on the encrypt Boolean value from the configuration.\n encrypt: typeof this.config.options.encrypt === 'boolean' && this.config.options.encrypt,\n version: { major: Number(major), minor: Number(minor), build: Number(build), subbuild: 0 }\n });\n\n this.messageIo.sendMessage(TYPE.PRELOGIN, payload.data);\n this.debug.payload(function() {\n return payload.toString(' ');\n });\n }\n\n /**\n * @private\n */\n sendLogin7Packet() {\n const payload = new Login7Payload({\n tdsVersion: versions[this.config.options.tdsVersion],\n packetSize: this.config.options.packetSize,\n clientProgVer: 0,\n clientPid: process.pid,\n connectionId: 0,\n clientTimeZone: new Date().getTimezoneOffset(),\n clientLcid: 0x00000409\n });\n\n const { authentication } = this.config;\n switch (authentication.type) {\n case 'azure-active-directory-password':\n payload.fedAuth = {\n type: 'ADAL',\n echo: this.fedAuthRequired,\n workflow: 'default'\n };\n break;\n\n case 'azure-active-directory-access-token':\n payload.fedAuth = {\n type: 'SECURITYTOKEN',\n echo: this.fedAuthRequired,\n fedAuthToken: authentication.options.token\n };\n break;\n\n case 'azure-active-directory-msi-vm':\n case 'azure-active-directory-default':\n case 'azure-active-directory-msi-app-service':\n case 'azure-active-directory-service-principal-secret':\n payload.fedAuth = {\n type: 'ADAL',\n echo: this.fedAuthRequired,\n workflow: 'integrated'\n };\n break;\n\n case 'ntlm':\n payload.sspi = createNTLMRequest({ domain: authentication.options.domain });\n break;\n\n default:\n payload.userName = authentication.options.userName;\n payload.password = authentication.options.password;\n }\n\n payload.hostname = this.config.options.workstationId || os.hostname();\n payload.serverName = this.routingData ? this.routingData.server : this.config.server;\n payload.appName = this.config.options.appName || 'Tedious';\n payload.libraryName = libraryName;\n payload.language = this.config.options.language;\n payload.database = this.config.options.database;\n payload.clientId = Buffer.from([1, 2, 3, 4, 5, 6]);\n\n payload.readOnlyIntent = this.config.options.readOnlyIntent;\n payload.initDbFatal = !this.config.options.fallbackToDefaultDb;\n\n this.routingData = undefined;\n this.messageIo.sendMessage(TYPE.LOGIN7, payload.toBuffer());\n\n this.debug.payload(function() {\n return payload.toString(' ');\n });\n }\n\n /**\n * @private\n */\n sendFedAuthTokenMessage(token: string) {\n const accessTokenLen = Buffer.byteLength(token, 'ucs2');\n const data = Buffer.alloc(8 + accessTokenLen);\n let offset = 0;\n offset = data.writeUInt32LE(accessTokenLen + 4, offset);\n offset = data.writeUInt32LE(accessTokenLen, offset);\n data.write(token, offset, 'ucs2');\n this.messageIo.sendMessage(TYPE.FEDAUTH_TOKEN, data);\n // sent the fedAuth token message, the rest is similar to standard login 7\n this.transitionTo(this.STATE.SENT_LOGIN7_WITH_STANDARD_LOGIN);\n }\n\n /**\n * @private\n */\n sendInitialSql() {\n const payload = new SqlBatchPayload(this.getInitialSql(), this.currentTransactionDescriptor(), this.config.options);\n\n const message = new Message({ type: TYPE.SQL_BATCH });\n this.messageIo.outgoingMessageStream.write(message);\n Readable.from(payload).pipe(message);\n }\n\n /**\n * @private\n */\n getInitialSql() {\n const options = [];\n\n if (this.config.options.enableAnsiNull === true) {\n options.push('set ansi_nulls on');\n } else if (this.config.options.enableAnsiNull === false) {\n options.push('set ansi_nulls off');\n }\n\n if (this.config.options.enableAnsiNullDefault === true) {\n options.push('set ansi_null_dflt_on on');\n } else if (this.config.options.enableAnsiNullDefault === false) {\n options.push('set ansi_null_dflt_on off');\n }\n\n if (this.config.options.enableAnsiPadding === true) {\n options.push('set ansi_padding on');\n } else if (this.config.options.enableAnsiPadding === false) {\n options.push('set ansi_padding off');\n }\n\n if (this.config.options.enableAnsiWarnings === true) {\n options.push('set ansi_warnings on');\n } else if (this.config.options.enableAnsiWarnings === false) {\n options.push('set ansi_warnings off');\n }\n\n if (this.config.options.enableArithAbort === true) {\n options.push('set arithabort on');\n } else if (this.config.options.enableArithAbort === false) {\n options.push('set arithabort off');\n }\n\n if (this.config.options.enableConcatNullYieldsNull === true) {\n options.push('set concat_null_yields_null on');\n } else if (this.config.options.enableConcatNullYieldsNull === false) {\n options.push('set concat_null_yields_null off');\n }\n\n if (this.config.options.enableCursorCloseOnCommit === true) {\n options.push('set cursor_close_on_commit on');\n } else if (this.config.options.enableCursorCloseOnCommit === false) {\n options.push('set cursor_close_on_commit off');\n }\n\n if (this.config.options.datefirst !== null) {\n options.push(`set datefirst ${this.config.options.datefirst}`);\n }\n\n if (this.config.options.dateFormat !== null) {\n options.push(`set dateformat ${this.config.options.dateFormat}`);\n }\n\n if (this.config.options.enableImplicitTransactions === true) {\n options.push('set implicit_transactions on');\n } else if (this.config.options.enableImplicitTransactions === false) {\n options.push('set implicit_transactions off');\n }\n\n if (this.config.options.language !== null) {\n options.push(`set language ${this.config.options.language}`);\n }\n\n if (this.config.options.enableNumericRoundabort === true) {\n options.push('set numeric_roundabort on');\n } else if (this.config.options.enableNumericRoundabort === false) {\n options.push('set numeric_roundabort off');\n }\n\n if (this.config.options.enableQuotedIdentifier === true) {\n options.push('set quoted_identifier on');\n } else if (this.config.options.enableQuotedIdentifier === false) {\n options.push('set quoted_identifier off');\n }\n\n if (this.config.options.textsize !== null) {\n options.push(`set textsize ${this.config.options.textsize}`);\n }\n\n if (this.config.options.connectionIsolationLevel !== null) {\n options.push(`set transaction isolation level ${this.getIsolationLevelText(this.config.options.connectionIsolationLevel)}`);\n }\n\n if (this.config.options.abortTransactionOnError === true) {\n options.push('set xact_abort on');\n } else if (this.config.options.abortTransactionOnError === false) {\n options.push('set xact_abort off');\n }\n\n return options.join('\\n');\n }\n\n /**\n * @private\n */\n processedInitialSql() {\n this.clearConnectTimer();\n this.emit('connect');\n }\n\n /**\n * Execute the SQL batch represented by [[Request]].\n * There is no param support, and unlike [[Request.execSql]],\n * it is not likely that SQL Server will reuse the execution plan it generates for the SQL.\n *\n * In almost all cases, [[Request.execSql]] will be a better choice.\n *\n * @param request A [[Request]] object representing the request.\n */\n execSqlBatch(request: Request) {\n this.makeRequest(request, TYPE.SQL_BATCH, new SqlBatchPayload(request.sqlTextOrProcedure!, this.currentTransactionDescriptor(), this.config.options));\n }\n\n /**\n * Execute the SQL represented by [[Request]].\n *\n * As `sp_executesql` is used to execute the SQL, if the same SQL is executed multiples times\n * using this function, the SQL Server query optimizer is likely to reuse the execution plan it generates\n * for the first execution. This may also result in SQL server treating the request like a stored procedure\n * which can result in the [[Event_doneInProc]] or [[Event_doneProc]] events being emitted instead of the\n * [[Event_done]] event you might expect. Using [[execSqlBatch]] will prevent this from occurring but may have a negative performance impact.\n *\n * Beware of the way that scoping rules apply, and how they may [affect local temp tables](http://weblogs.sqlteam.com/mladenp/archive/2006/11/03/17197.aspx)\n * If you're running in to scoping issues, then [[execSqlBatch]] may be a better choice.\n * See also [issue #24](https://github.com/pekim/tedious/issues/24)\n *\n * @param request A [[Request]] object representing the request.\n */\n execSql(request: Request) {\n try {\n request.validateParameters(this.databaseCollation);\n } catch (error: any) {\n request.error = error;\n\n process.nextTick(() => {\n this.debug.log(error.message);\n request.callback(error);\n });\n\n return;\n }\n\n const parameters: Parameter[] = [];\n\n parameters.push({\n type: TYPES.NVarChar,\n name: 'statement',\n value: request.sqlTextOrProcedure,\n output: false,\n length: undefined,\n precision: undefined,\n scale: undefined\n });\n\n if (request.parameters.length) {\n parameters.push({\n type: TYPES.NVarChar,\n name: 'params',\n value: request.makeParamsParameter(request.parameters),\n output: false,\n length: undefined,\n precision: undefined,\n scale: undefined\n });\n\n parameters.push(...request.parameters);\n }\n\n this.makeRequest(request, TYPE.RPC_REQUEST, new RpcRequestPayload(Procedures.Sp_ExecuteSql, parameters, this.currentTransactionDescriptor(), this.config.options, this.databaseCollation));\n }\n\n /**\n * Creates a new BulkLoad instance.\n *\n * @param table The name of the table to bulk-insert into.\n * @param options A set of bulk load options.\n */\n newBulkLoad(table: string, callback: BulkLoadCallback): BulkLoad\n newBulkLoad(table: string, options: BulkLoadOptions, callback: BulkLoadCallback): BulkLoad\n newBulkLoad(table: string, callbackOrOptions: BulkLoadOptions | BulkLoadCallback, callback?: BulkLoadCallback) {\n let options: BulkLoadOptions;\n\n if (callback === undefined) {\n callback = callbackOrOptions as BulkLoadCallback;\n options = {};\n } else {\n options = callbackOrOptions as BulkLoadOptions;\n }\n\n if (typeof options !== 'object') {\n throw new TypeError('\"options\" argument must be an object');\n }\n return new BulkLoad(table, this.databaseCollation, this.config.options, options, callback);\n }\n\n /**\n * Execute a [[BulkLoad]].\n *\n * ```js\n * // We want to perform a bulk load into a table with the following format:\n * // CREATE TABLE employees (first_name nvarchar(255), last_name nvarchar(255), day_of_birth date);\n *\n * const bulkLoad = connection.newBulkLoad('employees', (err, rowCount) => {\n * // ...\n * });\n *\n * // First, we need to specify the columns that we want to write to,\n * // and their definitions. These definitions must match the actual table,\n * // otherwise the bulk load will fail.\n * bulkLoad.addColumn('first_name', TYPES.NVarchar, { nullable: false });\n * bulkLoad.addColumn('last_name', TYPES.NVarchar, { nullable: false });\n * bulkLoad.addColumn('date_of_birth', TYPES.Date, { nullable: false });\n *\n * // Execute a bulk load with a predefined list of rows.\n * //\n * // Note that these rows are held in memory until the\n * // bulk load was performed, so if you need to write a large\n * // number of rows (e.g. by reading from a CSV file),\n * // passing an `AsyncIterable` is advisable to keep memory usage low.\n * connection.execBulkLoad(bulkLoad, [\n * { 'first_name': 'Steve', 'last_name': 'Jobs', 'day_of_birth': new Date('02-24-1955') },\n * { 'first_name': 'Bill', 'last_name': 'Gates', 'day_of_birth': new Date('10-28-1955') }\n * ]);\n * ```\n *\n * @param bulkLoad A previously created [[BulkLoad]].\n * @param rows A [[Iterable]] or [[AsyncIterable]] that contains the rows that should be bulk loaded.\n */\n execBulkLoad(bulkLoad: BulkLoad, rows: AsyncIterable<unknown[] | { [columnName: string]: unknown }> | Iterable<unknown[] | { [columnName: string]: unknown }>): void\n\n execBulkLoad(bulkLoad: BulkLoad, rows?: AsyncIterable<unknown[] | { [columnName: string]: unknown }> | Iterable<unknown[] | { [columnName: string]: unknown }>) {\n bulkLoad.executionStarted = true;\n\n if (rows) {\n if (bulkLoad.streamingMode) {\n throw new Error(\"Connection.execBulkLoad can't be called with a BulkLoad that was put in streaming mode.\");\n }\n\n if (bulkLoad.firstRowWritten) {\n throw new Error(\"Connection.execBulkLoad can't be called with a BulkLoad that already has rows written to it.\");\n }\n\n const rowStream = Readable.from(rows);\n\n // Destroy the packet transform if an error happens in the row stream,\n // e.g. if an error is thrown from within a generator or stream.\n rowStream.on('error', (err) => {\n bulkLoad.rowToPacketTransform.destroy(err);\n });\n\n // Destroy the row stream if an error happens in the packet transform,\n // e.g. if the bulk load is cancelled.\n bulkLoad.rowToPacketTransform.on('error', (err) => {\n rowStream.destroy(err);\n });\n\n rowStream.pipe(bulkLoad.rowToPacketTransform);\n } else if (!bulkLoad.streamingMode) {\n // If the bulkload was not put into streaming mode by the user,\n // we end the rowToPacketTransform here for them.\n //\n // If it was put into streaming mode, it's the user's responsibility\n // to end the stream.\n bulkLoad.rowToPacketTransform.end();\n }\n\n const onCancel = () => {\n request.cancel();\n };\n\n const payload = new BulkLoadPayload(bulkLoad);\n\n const request = new Request(bulkLoad.getBulkInsertSql(), (error: (Error & { code?: string }) | null | undefined) => {\n bulkLoad.removeListener('cancel', onCancel);\n\n if (error) {\n if (error.code === 'UNKNOWN') {\n error.message += ' This is likely because the schema of the BulkLoad does not match the schema of the table you are attempting to insert into.';\n }\n bulkLoad.error = error;\n bulkLoad.callback(error);\n return;\n }\n\n this.makeRequest(bulkLoad, TYPE.BULK_LOAD, payload);\n });\n\n bulkLoad.once('cancel', onCancel);\n\n this.execSqlBatch(request);\n }\n\n /**\n * Prepare the SQL represented by the request.\n *\n * The request can then be used in subsequent calls to\n * [[execute]] and [[unprepare]]\n *\n * @param request A [[Request]] object representing the request.\n * Parameters only require a name and type. Parameter values are ignored.\n */\n prepare(request: Request) {\n const parameters: Parameter[] = [];\n\n parameters.push({\n type: TYPES.Int,\n name: 'handle',\n value: undefined,\n output: true,\n length: undefined,\n precision: undefined,\n scale: undefined\n });\n\n parameters.push({\n type: TYPES.NVarChar,\n name: 'params',\n value: request.parameters.length ? request.makeParamsParameter(request.parameters) : null,\n output: false,\n length: undefined,\n precision: undefined,\n scale: undefined\n });\n\n parameters.push({\n type: TYPES.NVarChar,\n name: 'stmt',\n value: request.sqlTextOrProcedure,\n output: false,\n length: undefined,\n precision: undefined,\n scale: undefined\n });\n\n request.preparing = true;\n\n // TODO: We need to clean up this event handler, otherwise this leaks memory\n request.on('returnValue', (name: string, value: any) => {\n if (name === 'handle') {\n request.handle = value;\n } else {\n request.error = new RequestError(`Tedious > Unexpected output parameter ${name} from sp_prepare`);\n }\n });\n\n this.makeRequest(request, TYPE.RPC_REQUEST, new RpcRequestPayload(Procedures.Sp_Prepare, parameters, this.currentTransactionDescriptor(), this.config.options, this.databaseCollation));\n }\n\n /**\n * Release the SQL Server resources associated with a previously prepared request.\n *\n * @param request A [[Request]] object representing the request.\n * Parameters only require a name and type.\n * Parameter values are ignored.\n */\n unprepare(request: Request) {\n const parameters: Parameter[] = [];\n\n parameters.push({\n type: TYPES.Int,\n name: 'handle',\n // TODO: Abort if `request.handle` is not set\n value: request.handle,\n output: false,\n length: undefined,\n precision: undefined,\n scale: undefined\n });\n\n this.makeRequest(request, TYPE.RPC_REQUEST, new RpcRequestPayload(Procedures.Sp_Unprepare, parameters, this.currentTransactionDescriptor(), this.config.options, this.databaseCollation));\n }\n\n /**\n * Execute previously prepared SQL, using the supplied parameters.\n *\n * @param request A previously prepared [[Request]].\n * @param parameters An object whose names correspond to the names of\n * parameters that were added to the [[Request]] before it was prepared.\n * The object's values are passed as the parameters' values when the\n * request is executed.\n */\n execute(request: Request, parameters?: { [key: string]: unknown }) {\n const executeParameters: Parameter[] = [];\n\n executeParameters.push({\n type: TYPES.Int,\n name: '',\n // TODO: Abort if `request.handle` is not set\n value: request.handle,\n output: false,\n length: undefined,\n precision: undefined,\n scale: undefined\n });\n\n try {\n for (let i = 0, len = request.parameters.length; i < len; i++) {\n const parameter = request.parameters[i];\n\n executeParameters.push({\n ...parameter,\n value: parameter.type.validate(parameters ? parameters[parameter.name] : null, this.databaseCollation)\n });\n }\n } catch (error: any) {\n request.error = error;\n\n process.nextTick(() => {\n this.debug.log(error.message);\n request.callback(error);\n });\n\n return;\n }\n\n this.makeRequest(request, TYPE.RPC_REQUEST, new RpcRequestPayload(Procedures.Sp_Execute, executeParameters, this.currentTransactionDescriptor(), this.config.options, this.databaseCollation));\n }\n\n /**\n * Call a stored procedure represented by [[Request]].\n *\n * @param request A [[Request]] object representing the request.\n */\n callProcedure(request: Request) {\n try {\n request.validateParameters(this.databaseCollation);\n } catch (error: any) {\n request.error = error;\n\n process.nextTick(() => {\n this.debug.log(error.message);\n request.callback(error);\n });\n\n return;\n }\n\n this.makeRequest(request, TYPE.RPC_REQUEST, new RpcRequestPayload(request.sqlTextOrProcedure!, request.parameters, this.currentTransactionDescriptor(), this.config.options, this.databaseCollation));\n }\n\n /**\n * Start a transaction.\n *\n * @param callback\n * @param name A string representing a name to associate with the transaction.\n * Optional, and defaults to an empty string. Required when `isolationLevel`\n * is present.\n * @param isolationLevel The isolation level that the transaction is to be run with.\n *\n * The isolation levels are available from `require('tedious').ISOLATION_LEVEL`.\n * * `READ_UNCOMMITTED`\n * * `READ_COMMITTED`\n * * `REPEATABLE_READ`\n * * `SERIALIZABLE`\n * * `SNAPSHOT`\n *\n * Optional, and defaults to the Connection's isolation level.\n */\n beginTransaction(callback: BeginTransactionCallback, name = '', isolationLevel = this.config.options.isolationLevel) {\n assertValidIsolationLevel(isolationLevel, 'isolationLevel');\n\n const transaction = new Transaction(name, isolationLevel);\n\n if (this.config.options.tdsVersion < '7_2') {\n return this.execSqlBatch(new Request('SET TRANSACTION ISOLATION LEVEL ' + (transaction.isolationLevelToTSQL()) + ';BEGIN TRAN ' + transaction.name, (err) => {\n this.transactionDepth++;\n if (this.transactionDepth === 1) {\n this.inTransaction = true;\n }\n callback(err);\n }));\n }\n\n const request = new Request(undefined, (err) => {\n return callback(err, this.currentTransactionDescriptor());\n });\n return this.makeRequest(request, TYPE.TRANSACTION_MANAGER, transaction.beginPayload(this.currentTransactionDescriptor()));\n }\n\n /**\n * Commit a transaction.\n *\n * There should be an active transaction - that is, [[beginTransaction]]\n * should have been previously called.\n *\n * @param callback\n * @param name A string representing a name to associate with the transaction.\n * Optional, and defaults to an empty string. Required when `isolationLevel`is present.\n */\n commitTransaction(callback: CommitTransactionCallback, name = '') {\n const transaction = new Transaction(name);\n if (this.config.options.tdsVersion < '7_2') {\n return this.execSqlBatch(new Request('COMMIT TRAN ' + transaction.name, (err) => {\n this.transactionDepth--;\n if (this.transactionDepth === 0) {\n this.inTransaction = false;\n }\n\n callback(err);\n }));\n }\n const request = new Request(undefined, callback);\n return this.makeRequest(request, TYPE.TRANSACTION_MANAGER, transaction.commitPayload(this.currentTransactionDescriptor()));\n }\n\n /**\n * Rollback a transaction.\n *\n * There should be an active transaction - that is, [[beginTransaction]]\n * should have been previously called.\n *\n * @param callback\n * @param name A string representing a name to associate with the transaction.\n * Optional, and defaults to an empty string.\n * Required when `isolationLevel` is present.\n */\n rollbackTransaction(callback: RollbackTransactionCallback, name = '') {\n const transaction = new Transaction(name);\n if (this.config.options.tdsVersion < '7_2') {\n return this.execSqlBatch(new Request('ROLLBACK TRAN ' + transaction.name, (err) => {\n this.transactionDepth--;\n if (this.transactionDepth === 0) {\n this.inTransaction = false;\n }\n callback(err);\n }));\n }\n const request = new Request(undefined, callback);\n return this.makeRequest(request, TYPE.TRANSACTION_MANAGER, transaction.rollbackPayload(this.currentTransactionDescriptor()));\n }\n\n /**\n * Set a savepoint within a transaction.\n *\n * There should be an active transaction - that is, [[beginTransaction]]\n * should have been previously called.\n *\n * @param callback\n * @param name A string representing a name to associate with the transaction.\\\n * Optional, and defaults to an empty string.\n * Required when `isolationLevel` is present.\n */\n saveTransaction(callback: SaveTransactionCallback, name: string) {\n const transaction = new Transaction(name);\n if (this.config.options.tdsVersion < '7_2') {\n return this.execSqlBatch(new Request('SAVE TRAN ' + transaction.name, (err) => {\n this.transactionDepth++;\n callback(err);\n }));\n }\n const request = new Request(undefined, callback);\n return this.makeRequest(request, TYPE.TRANSACTION_MANAGER, transaction.savePayload(this.currentTransactionDescriptor()));\n }\n\n /**\n * Run the given callback after starting a transaction, and commit or\n * rollback the transaction afterwards.\n *\n * This is a helper that employs [[beginTransaction]], [[commitTransaction]],\n * [[rollbackTransaction]], and [[saveTransaction]] to greatly simplify the\n * use of database transactions and automatically handle transaction nesting.\n *\n * @param cb\n * @param isolationLevel\n * The isolation level that the transaction is to be run with.\n *\n * The isolation levels are available from `require('tedious').ISOLATION_LEVEL`.\n * * `READ_UNCOMMITTED`\n * * `READ_COMMITTED`\n * * `REPEATABLE_READ`\n * * `SERIALIZABLE`\n * * `SNAPSHOT`\n *\n * Optional, and defaults to the Connection's isolation level.\n */\n transaction(cb: (err: Error | null | undefined, txDone?: <T extends TransactionDoneCallback>(err: Error | null | undefined, done: T, ...args: CallbackParameters<T>) => void) => void, isolationLevel?: typeof ISOLATION_LEVEL[keyof typeof ISOLATION_LEVEL]) {\n if (typeof cb !== 'function') {\n throw new TypeError('`cb` must be a function');\n }\n\n const useSavepoint = this.inTransaction;\n const name = '_tedious_' + (crypto.randomBytes(10).toString('hex'));\n const txDone: <T extends TransactionDoneCallback>(err: Error | null | undefined, done: T, ...args: CallbackParameters<T>) => void = (err, done, ...args) => {\n if (err) {\n if (this.inTransaction && this.state === this.STATE.LOGGED_IN) {\n this.rollbackTransaction((txErr) => {\n done(txErr || err, ...args);\n }, name);\n } else {\n done(err, ...args);\n }\n } else if (useSavepoint) {\n if (this.config.options.tdsVersion < '7_2') {\n this.transactionDepth--;\n }\n done(null, ...args);\n } else {\n this.commitTransaction((txErr) => {\n done(txErr, ...args);\n }, name);\n }\n };\n\n if (useSavepoint) {\n return this.saveTransaction((err) => {\n if (err) {\n return cb(err);\n }\n\n if (isolationLevel) {\n return this.execSqlBatch(new Request('SET transaction isolation level ' + this.getIsolationLevelText(isolationLevel), (err) => {\n return cb(err, txDone);\n }));\n } else {\n return cb(null, txDone);\n }\n }, name);\n } else {\n return this.beginTransaction((err) => {\n if (err) {\n return cb(err);\n }\n\n return cb(null, txDone);\n }, name, isolationLevel);\n }\n }\n\n /**\n * @private\n */\n makeRequest(request: Request | BulkLoad, packetType: number, payload: (Iterable<Buffer> | AsyncIterable<Buffer>) & { toString: (indent?: string) => string }) {\n if (this.state !== this.STATE.LOGGED_IN) {\n const message = 'Requests can only be made in the ' + this.STATE.LOGGED_IN.name + ' state, not the ' + this.state.name + ' state';\n this.debug.log(message);\n request.callback(new RequestError(message, 'EINVALIDSTATE'));\n } else if (request.canceled) {\n process.nextTick(() => {\n request.callback(new RequestError('Canceled.', 'ECANCEL'));\n });\n } else {\n if (packetType === TYPE.SQL_BATCH) {\n this.isSqlBatch = true;\n } else {\n this.isSqlBatch = false;\n }\n\n this.request = request;\n request.connection! = this;\n request.rowCount! = 0;\n request.rows! = [];\n request.rst! = [];\n\n const onCancel = () => {\n payloadStream.unpipe(message);\n payloadStream.destroy(new RequestError('Canceled.', 'ECANCEL'));\n\n // set the ignore bit and end the message.\n message.ignore = true;\n message.end();\n\n if (request instanceof Request && request.paused) {\n // resume the request if it was paused so we can read the remaining tokens\n request.resume();\n }\n };\n\n request.once('cancel', onCancel);\n\n this.createRequestTimer();\n\n const message = new Message({ type: packetType, resetConnection: this.resetConnectionOnNextRequest });\n this.messageIo.outgoingMessageStream.write(message);\n this.transitionTo(this.STATE.SENT_CLIENT_REQUEST);\n\n message.once('finish', () => {\n request.removeListener('cancel', onCancel);\n request.once('cancel', this._cancelAfterRequestSent);\n\n this.resetConnectionOnNextRequest = false;\n this.debug.payload(function() {\n return payload!.toString(' ');\n });\n });\n\n const payloadStream = Readable.from(payload);\n payloadStream.once('error', (error) => {\n payloadStream.unpipe(message);\n\n // Only set a request error if no error was set yet.\n request.error ??= error;\n\n message.ignore = true;\n message.end();\n });\n payloadStream.pipe(message);\n }\n }\n\n /**\n * Cancel currently executed request.\n */\n cancel() {\n if (!this.request) {\n return false;\n }\n\n if (this.request.canceled) {\n return false;\n }\n\n this.request.cancel();\n return true;\n }\n\n /**\n * Reset the connection to its initial state.\n * Can be useful for connection pool implementations.\n *\n * @param callback\n */\n reset(callback: ResetCallback) {\n const request = new Request(this.getInitialSql(), (err) => {\n if (this.config.options.tdsVersion < '7_2') {\n this.inTransaction = false;\n }\n callback(err);\n });\n this.resetConnectionOnNextRequest = true;\n this.execSqlBatch(request);\n }\n\n /**\n * @private\n */\n currentTransactionDescriptor() {\n return this.transactionDescriptors[this.transactionDescriptors.length - 1];\n }\n\n /**\n * @private\n */\n getIsolationLevelText(isolationLevel: typeof ISOLATION_LEVEL[keyof typeof ISOLATION_LEVEL]) {\n switch (isolationLevel) {\n case ISOLATION_LEVEL.READ_UNCOMMITTED:\n return 'read uncommitted';\n case ISOLATION_LEVEL.REPEATABLE_READ:\n return 'repeatable read';\n case ISOLATION_LEVEL.SERIALIZABLE:\n return 'serializable';\n case ISOLATION_LEVEL.SNAPSHOT:\n return 'snapshot';\n default:\n return 'read committed';\n }\n }\n}\n\nfunction isTransientError(error: AggregateError | ConnectionError): boolean {\n if (error instanceof AggregateError) {\n error = error.errors[0];\n }\n return (error instanceof ConnectionError) && !!error.isTransient;\n}\n\nexport default Connection;\nmodule.exports = Connection;\n\nConnection.prototype.STATE = {\n INITIALIZED: {\n name: 'Initialized',\n events: {}\n },\n CONNECTING: {\n name: 'Connecting',\n enter: function() {\n this.initialiseConnection();\n },\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n },\n SENT_PRELOGIN: {\n name: 'SentPrelogin',\n enter: function() {\n (async () => {\n let messageBuffer = Buffer.alloc(0);\n\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n return this.socketError(err);\n }\n\n for await (const data of message) {\n messageBuffer = Buffer.concat([messageBuffer, data]);\n }\n\n const preloginPayload = new PreloginPayload(messageBuffer);\n this.debug.payload(function() {\n return preloginPayload.toString(' ');\n });\n\n if (preloginPayload.fedAuthRequired === 1) {\n this.fedAuthRequired = true;\n }\n if ('strict' !== this.config.options.encrypt && (preloginPayload.encryptionString === 'ON' || preloginPayload.encryptionString === 'REQ')) {\n if (!this.config.options.encrypt) {\n this.emit('connect', new ConnectionError(\"Server requires encryption, set 'encrypt' config option to true.\", 'EENCRYPT'));\n return this.close();\n }\n\n try {\n this.transitionTo(this.STATE.SENT_TLSSSLNEGOTIATION);\n await this.messageIo.startTls(this.secureContextOptions, this.config.options.serverName ? this.config.options.serverName : this.routingData?.server ?? this.config.server, this.config.options.trustServerCertificate);\n } catch (err: any) {\n return this.socketError(err);\n }\n }\n\n this.sendLogin7Packet();\n\n const { authentication } = this.config;\n\n switch (authentication.type) {\n case 'azure-active-directory-password':\n case 'azure-active-directory-msi-vm':\n case 'azure-active-directory-msi-app-service':\n case 'azure-active-directory-service-principal-secret':\n case 'azure-active-directory-default':\n this.transitionTo(this.STATE.SENT_LOGIN7_WITH_FEDAUTH);\n break;\n case 'ntlm':\n this.transitionTo(this.STATE.SENT_LOGIN7_WITH_NTLM);\n break;\n default:\n this.transitionTo(this.STATE.SENT_LOGIN7_WITH_STANDARD_LOGIN);\n break;\n }\n })().catch((err) => {\n process.nextTick(() => {\n throw err;\n });\n });\n },\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n },\n REROUTING: {\n name: 'ReRouting',\n enter: function() {\n this.cleanupConnection(CLEANUP_TYPE.REDIRECT);\n },\n events: {\n message: function() {\n },\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n reconnect: function() {\n this.transitionTo(this.STATE.CONNECTING);\n }\n }\n },\n TRANSIENT_FAILURE_RETRY: {\n name: 'TRANSIENT_FAILURE_RETRY',\n enter: function() {\n this.curTransientRetryCount++;\n this.cleanupConnection(CLEANUP_TYPE.RETRY);\n },\n events: {\n message: function() {\n },\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n retry: function() {\n this.createRetryTimer();\n }\n }\n },\n SENT_TLSSSLNEGOTIATION: {\n name: 'SentTLSSSLNegotiation',\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n },\n SENT_LOGIN7_WITH_STANDARD_LOGIN: {\n name: 'SentLogin7WithStandardLogin',\n enter: function() {\n (async () => {\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n return this.socketError(err);\n }\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n\n await once(tokenStreamParser, 'end');\n\n if (handler.loginAckReceived) {\n if (handler.routingData) {\n this.routingData = handler.routingData;\n this.transitionTo(this.STATE.REROUTING);\n } else {\n this.transitionTo(this.STATE.LOGGED_IN_SENDING_INITIAL_SQL);\n }\n } else if (this.loginError) {\n if (isTransientError(this.loginError)) {\n this.debug.log('Initiating retry on transient error');\n this.transitionTo(this.STATE.TRANSIENT_FAILURE_RETRY);\n } else {\n this.emit('connect', this.loginError);\n this.transitionTo(this.STATE.FINAL);\n }\n } else {\n this.emit('connect', new ConnectionError('Login failed.', 'ELOGIN'));\n this.transitionTo(this.STATE.FINAL);\n }\n })().catch((err) => {\n process.nextTick(() => {\n throw err;\n });\n });\n },\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n },\n SENT_LOGIN7_WITH_NTLM: {\n name: 'SentLogin7WithNTLMLogin',\n enter: function() {\n (async () => {\n while (true) {\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n return this.socketError(err);\n }\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n\n await once(tokenStreamParser, 'end');\n\n if (handler.loginAckReceived) {\n if (handler.routingData) {\n this.routingData = handler.routingData;\n return this.transitionTo(this.STATE.REROUTING);\n } else {\n return this.transitionTo(this.STATE.LOGGED_IN_SENDING_INITIAL_SQL);\n }\n } else if (this.ntlmpacket) {\n const authentication = this.config.authentication as NtlmAuthentication;\n\n const payload = new NTLMResponsePayload({\n domain: authentication.options.domain,\n userName: authentication.options.userName,\n password: authentication.options.password,\n ntlmpacket: this.ntlmpacket\n });\n\n this.messageIo.sendMessage(TYPE.NTLMAUTH_PKT, payload.data);\n this.debug.payload(function() {\n return payload.toString(' ');\n });\n\n this.ntlmpacket = undefined;\n } else if (this.loginError) {\n if (isTransientError(this.loginError)) {\n this.debug.log('Initiating retry on transient error');\n return this.transitionTo(this.STATE.TRANSIENT_FAILURE_RETRY);\n } else {\n this.emit('connect', this.loginError);\n return this.transitionTo(this.STATE.FINAL);\n }\n } else {\n this.emit('connect', new ConnectionError('Login failed.', 'ELOGIN'));\n return this.transitionTo(this.STATE.FINAL);\n }\n }\n\n })().catch((err) => {\n process.nextTick(() => {\n throw err;\n });\n });\n },\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n },\n SENT_LOGIN7_WITH_FEDAUTH: {\n name: 'SentLogin7Withfedauth',\n enter: function() {\n (async () => {\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n return this.socketError(err);\n }\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n await once(tokenStreamParser, 'end');\n if (handler.loginAckReceived) {\n if (handler.routingData) {\n this.routingData = handler.routingData;\n this.transitionTo(this.STATE.REROUTING);\n } else {\n this.transitionTo(this.STATE.LOGGED_IN_SENDING_INITIAL_SQL);\n }\n\n return;\n }\n\n const fedAuthInfoToken = handler.fedAuthInfoToken;\n\n if (fedAuthInfoToken && fedAuthInfoToken.stsurl && fedAuthInfoToken.spn) {\n const authentication = this.config.authentication as AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication;\n const tokenScope = new URL('/.default', fedAuthInfoToken.spn).toString();\n\n let credentials;\n\n switch (authentication.type) {\n case 'azure-active-directory-password':\n credentials = new UsernamePasswordCredential(\n authentication.options.tenantId ?? 'common',\n authentication.options.clientId,\n authentication.options.userName,\n authentication.options.password\n );\n break;\n case 'azure-active-directory-msi-vm':\n case 'azure-active-directory-msi-app-service':\n const msiArgs = authentication.options.clientId ? [authentication.options.clientId, {}] : [{}];\n credentials = new ManagedIdentityCredential(...msiArgs);\n break;\n case 'azure-active-directory-default':\n const args = authentication.options.clientId ? { managedIdentityClientId: authentication.options.clientId } : {};\n credentials = new DefaultAzureCredential(args);\n break;\n case 'azure-active-directory-service-principal-secret':\n credentials = new ClientSecretCredential(\n authentication.options.tenantId,\n authentication.options.clientId,\n authentication.options.clientSecret\n );\n break;\n }\n\n let tokenResponse;\n try {\n tokenResponse = await credentials.getToken(tokenScope);\n } catch (err) {\n this.loginError = new AggregateError(\n [new ConnectionError('Security token could not be authenticated or authorized.', 'EFEDAUTH'), err]);\n this.emit('connect', this.loginError);\n this.transitionTo(this.STATE.FINAL);\n return;\n }\n\n\n const token = tokenResponse.token;\n this.sendFedAuthTokenMessage(token);\n\n } else if (this.loginError) {\n if (isTransientError(this.loginError)) {\n this.debug.log('Initiating retry on transient error');\n this.transitionTo(this.STATE.TRANSIENT_FAILURE_RETRY);\n } else {\n this.emit('connect', this.loginError);\n this.transitionTo(this.STATE.FINAL);\n }\n } else {\n this.emit('connect', new ConnectionError('Login failed.', 'ELOGIN'));\n this.transitionTo(this.STATE.FINAL);\n }\n\n })().catch((err) => {\n process.nextTick(() => {\n throw err;\n });\n });\n },\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n },\n LOGGED_IN_SENDING_INITIAL_SQL: {\n name: 'LoggedInSendingInitialSql',\n enter: function() {\n (async () => {\n this.sendInitialSql();\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n return this.socketError(err);\n }\n const tokenStreamParser = this.createTokenStreamParser(message, new InitialSqlTokenHandler(this));\n await once(tokenStreamParser, 'end');\n\n this.transitionTo(this.STATE.LOGGED_IN);\n this.processedInitialSql();\n\n })().catch((err) => {\n process.nextTick(() => {\n throw err;\n });\n });\n },\n events: {\n socketError: function socketError() {\n this.transitionTo(this.STATE.FINAL);\n },\n connectTimeout: function() {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n },\n LOGGED_IN: {\n name: 'LoggedIn',\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n }\n }\n },\n SENT_CLIENT_REQUEST: {\n name: 'SentClientRequest',\n enter: function() {\n (async () => {\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n return this.socketError(err);\n }\n // request timer is stopped on first data package\n this.clearRequestTimer();\n\n const tokenStreamParser = this.createTokenStreamParser(message, new RequestTokenHandler(this, this.request!));\n\n // If the request was canceled and we have a `cancelTimer`\n // defined, we send a attention message after the\n // request message was fully sent off.\n //\n // We already started consuming the current message\n // (but all the token handlers should be no-ops), and\n // need to ensure the next message is handled by the\n // `SENT_ATTENTION` state.\n if (this.request?.canceled && this.cancelTimer) {\n return this.transitionTo(this.STATE.SENT_ATTENTION);\n }\n\n const onResume = () => {\n tokenStreamParser.resume();\n };\n const onPause = () => {\n tokenStreamParser.pause();\n\n this.request?.once('resume', onResume);\n };\n\n this.request?.on('pause', onPause);\n\n if (this.request instanceof Request && this.request.paused) {\n onPause();\n }\n\n const onCancel = () => {\n tokenStreamParser.removeListener('end', onEndOfMessage);\n\n if (this.request instanceof Request && this.request.paused) {\n // resume the request if it was paused so we can read the remaining tokens\n this.request.resume();\n }\n\n this.request?.removeListener('pause', onPause);\n this.request?.removeListener('resume', onResume);\n\n // The `_cancelAfterRequestSent` callback will have sent a\n // attention message, so now we need to also switch to\n // the `SENT_ATTENTION` state to make sure the attention ack\n // message is processed correctly.\n this.transitionTo(this.STATE.SENT_ATTENTION);\n };\n\n const onEndOfMessage = () => {\n this.request?.removeListener('cancel', this._cancelAfterRequestSent);\n this.request?.removeListener('cancel', onCancel);\n this.request?.removeListener('pause', onPause);\n this.request?.removeListener('resume', onResume);\n\n this.transitionTo(this.STATE.LOGGED_IN);\n const sqlRequest = this.request as Request;\n this.request = undefined;\n if (this.config.options.tdsVersion < '7_2' && sqlRequest.error && this.isSqlBatch) {\n this.inTransaction = false;\n }\n sqlRequest.callback(sqlRequest.error, sqlRequest.rowCount, sqlRequest.rows);\n };\n\n tokenStreamParser.once('end', onEndOfMessage);\n this.request?.once('cancel', onCancel);\n })();\n\n },\n exit: function(nextState) {\n this.clearRequestTimer();\n },\n events: {\n socketError: function(err) {\n const sqlRequest = this.request!;\n this.request = undefined;\n this.transitionTo(this.STATE.FINAL);\n\n sqlRequest.callback(err);\n }\n }\n },\n SENT_ATTENTION: {\n name: 'SentAttention',\n enter: function() {\n (async () => {\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n return this.socketError(err);\n }\n\n const handler = new AttentionTokenHandler(this, this.request!);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n\n await once(tokenStreamParser, 'end');\n // 3.2.5.7 Sent Attention State\n // Discard any data contained in the response, until we receive the attention response\n if (handler.attentionReceived) {\n this.clearCancelTimer();\n\n const sqlRequest = this.request!;\n this.request = undefined;\n this.transitionTo(this.STATE.LOGGED_IN);\n\n if (sqlRequest.error && sqlRequest.error instanceof RequestError && sqlRequest.error.code === 'ETIMEOUT') {\n sqlRequest.callback(sqlRequest.error);\n } else {\n sqlRequest.callback(new RequestError('Canceled.', 'ECANCEL'));\n }\n }\n\n })().catch((err) => {\n process.nextTick(() => {\n throw err;\n });\n });\n },\n events: {\n socketError: function(err) {\n const sqlRequest = this.request!;\n this.request = undefined;\n\n this.transitionTo(this.STATE.FINAL);\n\n sqlRequest.callback(err);\n }\n }\n },\n FINAL: {\n name: 'Final',\n enter: function() {\n this.cleanupConnection(CLEANUP_TYPE.NORMAL);\n },\n events: {\n connectTimeout: function() {\n // Do nothing, as the timer should be cleaned up.\n },\n message: function() {\n // Do nothing\n },\n socketError: function() {\n // Do nothing\n }\n }\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,GAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,GAA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Ae,GAAA;AAqEvI;;AA+BA;AACA;AACA;AACA,MAAMC,wBAAwB,GAAG,EAAE,GAAG,IAAI;AAC1C;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG,EAAE,GAAG,IAAI;AACzC;AACA;AACA;AACA,MAAMC,8BAA8B,GAAG,EAAE,GAAG,IAAI;AAChD;AACA;AACA;AACA,MAAMC,sBAAsB,GAAG,CAAC,GAAG,IAAI;AACvC;AACA;AACA;AACA,MAAMC,8BAA8B,GAAG,GAAG;AAC1C;AACA;AACA;AACA,MAAMC,mBAAmB,GAAG,CAAC,GAAG,IAAI;AACpC;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,UAAU;AACnC;AACA;AACA;AACA,MAAMC,iBAAiB,GAAG,CAAC;AAC3B;AACA;AACA;AACA,MAAMC,YAAY,GAAG,IAAI;AACzB;AACA;AACA;AACA,MAAMC,mBAAmB,GAAG,KAAK;AACjC;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,YAAY;AACrC;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,KAAK;;AA6MhC;AACA;AACA;;AA0cA;AACA;AACA;AACA,MAAMC,YAAY,GAAG;EACnBC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,CAAC;EACXC,KAAK,EAAE;AACT,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,SAASC,oBAAY,CAAC;EACpC;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAGE;AACF;AACA;;EAkBE;AACF;AACA;;EAGE;AACF;AACA;;EAEE;AACF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