tedious 20.3.0 → 20.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"connection.js","names":["_crypto","_interopRequireDefault","require","_os","tls","_interopRequireWildcard","net","_dns","_constants","_stream","_identity","_coreAuth","_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","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","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","withAbortRace","signal","func","throwIfAborted","promise","signalAborted","reject","Promise","withResolvers","catch","onAbort","reason","addEventListener","once","removeEventListener","Connection","EventEmitter","constructor","config","TypeError","server","fedAuthRequired","authentication","undefined","type","options","domain","userName","password","toUpperCase","isTokenCredential","credential","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","attentionSent","_cancelAfterRequestSent","messageIo","sendMessage","TYPE","ATTENTION","createCancelTimer","_onSocketClose","socketClose","_onSocketEnd","socketEnd","_onSocketError","error","FINAL","dispatchEvent","process","nextTick","emit","wrapSocketError","connect","connectListener","ConnectionError","name","onConnect","err","removeListener","onError","closeController","AbortController","transitionTo","CONNECTING","initialiseConnection","then","cleanupConnection","on","event","listener","args","close","abort","timeoutController","connectTimer","setTimeout","hostPostfix","routingData","routingMessage","message","log","AbortSignal","any","instanceLookup","timeout","cause","socket","connectOnPort","controller","onClose","onEnd","code","setKeepAlive","MessageIO","cleartext","sendPreLogin","SENT_PRELOGIN","preloginResponse","readPreloginResponse","performTlsNegotiation","sendLogin7Packet","SENT_LOGIN7_WITH_FEDAUTH","performSentLogin7WithFedAuth","SENT_LOGIN7_WITH_NTLM","performSentLogin7WithNTLMLogin","SENT_LOGIN7_WITH_STANDARD_LOGIN","performSentLogin7WithStandardLogin","isTransientError","TRANSIENT_FAILURE_RETRY","performTransientFailureRetry","REROUTING","performReRouting","LOGGED_IN_SENDING_INITIAL_SQL","performLoggedInSendingInitialSql","destroy","LOGGED_IN","clearTimeout","clearRequestTimer","clearCancelTimer","closeConnection","request","callback","RequestError","Debug","createTokenStreamParser","handler","TokenStreamParser","wrapWithTls","secureContext","createSecureContext","isIP","encryptOptions","host","ALPNProtocols","servername","resolve","encryptsocket","setMaxSendFragment","Math","min","MAX_TLS_SEND_FRAGMENT_SIZE","customConnector","connectOpts","connectInParallel","connectInSequence","dns","lookup","end","cancelTimer","createRequestTimer","requestTimer","cancel","newState","exit","enter","apply","getEventHandler","eventName","events","SENT_TLSSSLNEGOTIATION","major","minor","build","exec","version","PreloginPayload","Number","subbuild","PRELOGIN","toString","Login7Payload","versions","clientProgVer","clientPid","pid","connectionId","clientTimeZone","Date","getTimezoneOffset","clientLcid","fedAuth","echo","workflow","fedAuthToken","sspi","createNTLMRequest","hostname","os","instance","libraryName","initDbFatal","LOGIN7","toBuffer","sendFedAuthTokenMessage","accessTokenLen","byteLength","offset","writeUInt32LE","write","FEDAUTH_TOKEN","sendInitialSql","SqlBatchPayload","getInitialSql","currentTransactionDescriptor","Message","SQL_BATCH","outgoingMessageStream","Readable","pipe","push","getIsolationLevelText","join","execSqlBatch","makeRequest","sqlTextOrProcedure","resolveRequestParameter","parameter","resolveParameter","databaseCollation","execSql","validateParameters","parameters","TYPES","NVarChar","output","length","precision","scale","makeParamsParameter","resolvedParameters","RPC_REQUEST","RpcRequestPayload","Procedures","Sp_ExecuteSql","newBulkLoad","table","callbackOrOptions","BulkLoad","execBulkLoad","bulkLoad","rows","executionStarted","BulkLoadPayload","onCancel","Request","getBulkInsertSql","canceled","BULK_LOAD","prepare","Int","preparing","handle","Sp_Prepare","unprepare","Sp_Unprepare","execute","executeParameters","len","Sp_Execute","callProcedure","beginTransaction","transaction","Transaction","isolationLevelToTSQL","TRANSACTION_MANAGER","beginPayload","commitTransaction","commitPayload","rollbackTransaction","rollbackPayload","saveTransaction","savePayload","cb","useSavepoint","crypto","randomBytes","txDone","done","txErr","packetType","connection","rowCount","rst","payloadStream","unpipe","ignore","paused","resume","resetConnection","resetConnectionOnNextRequest","SENT_CLIENT_REQUEST","prependOnceListener","reset","READ_UNCOMMITTED","REPEATABLE_READ","SERIALIZABLE","SNAPSHOT","preloginPayload","encryptionString","race","startTls","readMessage","iterator","Symbol","asyncIterator","next","concat","return","closeSignal","retryTimer","Login7TokenHandler","tokenStreamParser","endOfMessage","loginAckReceived","loginError","ntlmpacket","NTLMResponsePayload","NTLMAUTH_PKT","fedAuthInfoToken","stsurl","spn","tokenScope","URL","credentials","UsernamePasswordCredential","msiArgs","ManagedIdentityCredential","managedIdentityClientId","DefaultAzureCredential","ClientSecretCredential","tokenResponse","getToken","AggregateError","InitialSqlTokenHandler","errors","isTransient","_default","exports","module","prototype","socketError","RequestTokenHandler","onParserError","onPause","onResume","SENT_ATTENTION","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 ClientSecretCredential,\n DefaultAzureCredential,\n ManagedIdentityCredential,\n UsernamePasswordCredential\n} from '@azure/identity';\nimport { type AccessToken, type TokenCredential, isTokenCredential } from '@azure/core-auth';\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, type ResolvedParameter, TYPES, resolveParameter } from './data-type';\nimport { BulkLoadPayload, type Row as BulkLoadRow } 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 want to connect to an Azure app service using a specific client account,\n * you need to provide the `clientId` associated with your created identity.\n *\n * This is optional for retrieving a 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 * you need to provide the `clientId` associated with your created identity.\n *\n * This is optional for retrieving 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 * you need to provide the `clientId` associated with your 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 needs to provide a `token` which they retrieved elsewhere\n * to form the connection.\n */\n token: string;\n };\n}\n\ninterface AzureActiveDirectoryPasswordAuthentication {\n type: 'azure-active-directory-password';\n options: {\n /**\n * A user needs to provide a `userName` associated with their account.\n */\n userName: string;\n\n /**\n * A user needs to provide a `password` associated with 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\n/** Structure that defines the options that are necessary to authenticate the Tedious.JS instance with an `@azure/identity` token credential. */\ninterface TokenCredentialAuthentication {\n /** Unique designator for the type of authentication to be used. */\n type: 'token-credential';\n /** Set of configurations that are required or allowed with this authentication type. */\n options: {\n /** Credential object used to authenticate to the resource. */\n credential: TokenCredential;\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 | TokenCredentialAuthentication | 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 message?(this: Connection, message: Message): void;\n };\n}\n\ntype Authentication = DefaultAuthentication |\n NtlmAuthentication |\n TokenCredentialAuthentication |\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 * * `token-credential`: [[CredentialChainAuthentication.options]]\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 | undefined;\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_COMMITTED`).\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.createSecureContext`](https://nodejs.org/docs/latest/api/tls.html#tlscreatesecurecontextoptions).\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 precision.\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_COMMITTED`).\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 | undefined;\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` (deprecated, support will be removed in a future version)\n * * `7_2`\n * * `7_3_A`\n * * `7_3_B`\n * * `7_4`\n *\n * (default: `7_4`)\n */\n tdsVersion?: string | undefined;\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?: number;\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: `false`)\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\ninterface RoutingData {\n server: string;\n port: number;\n instance: string;\n}\n\n/**\n * Runs the given function, providing it with a promise that will reject\n * with the given signal's abort reason once the signal is aborted.\n *\n * The function can race this promise against any asynchronous work it\n * performs (potentially multiple times) to make itself abortable.\n *\n * The rejection is always considered handled, and the signal's abort\n * listener is removed once the function settles.\n */\nasync function withAbortRace<T>(signal: AbortSignal, func: (signalAborted: Promise<never>) => Promise<T>): Promise<T> {\n signal.throwIfAborted();\n\n const { promise: signalAborted, reject } = Promise.withResolvers<never>();\n\n // Prevent unhandled rejections if the signal is aborted while\n // `func` is not currently racing against `signalAborted`.\n signalAborted.catch(() => {});\n\n const onAbort = () => { reject(signal.reason); };\n signal.addEventListener('abort', onAbort, { once: true });\n\n try {\n return await func(signalAborted);\n } finally {\n signal.removeEventListener('abort', onAbort);\n }\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 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 cancelTimer: undefined | NodeJS.Timeout;\n /**\n * @private\n */\n declare requestTimer: undefined | NodeJS.Timeout;\n\n /**\n * Controller used to abort the connection establishment process\n * when the connection is closed before it was fully established.\n *\n * @private\n */\n declare closeController: undefined | AbortController;\n\n /**\n * Whether an attention message was sent to the server to cancel the\n * currently active request.\n *\n * @private\n */\n declare attentionSent: boolean;\n\n /**\n * @private\n */\n declare _cancelAfterRequestSent: () => void;\n\n /**\n * @private\n */\n declare databaseCollation: Collation | undefined;\n\n /**\n * @private\n */\n declare _onSocketClose: (hadError: boolean) => void;\n\n /**\n * @private\n */\n declare _onSocketError: (err: Error) => void;\n\n /**\n * @private\n */\n declare _onSocketEnd: () => void;\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 !== 'token-credential' && 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\", \"token-credential\", \"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 === 'token-credential') {\n if (!isTokenCredential(options.credential)) {\n throw new TypeError('The \"config.authentication.options.credential\" property must be an instance of the token credential class.');\n }\n\n authentication = {\n type: 'token-credential',\n options: {\n credential: options.credential\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.attentionSent = false;\n\n this._cancelAfterRequestSent = () => {\n this.messageIo.sendMessage(TYPE.ATTENTION);\n this.attentionSent = true;\n this.createCancelTimer();\n };\n\n this._onSocketClose = () => {\n this.socketClose();\n };\n\n this._onSocketEnd = () => {\n this.socketEnd();\n };\n\n this._onSocketError = (error) => {\n // Nothing left to route once the connection is closed: `Final` has no\n // `socketError` handler, and the error would only surface as noise\n // after `close()`. (Mirrors `socketEnd()`.)\n if (this.state === this.STATE.FINAL) {\n return;\n }\n\n this.dispatchEvent('socketError', error);\n process.nextTick(() => {\n this.emit('error', this.wrapSocketError(error));\n });\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.closeController = new AbortController();\n\n this.transitionTo(this.STATE.CONNECTING);\n this.initialiseConnection().then(() => {\n process.nextTick(() => {\n this.emit('connect');\n });\n }, (err) => {\n this.transitionTo(this.STATE.FINAL);\n\n process.nextTick(() => {\n this.emit('connect', err);\n });\n\n this.cleanupConnection();\n });\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 falsy. 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: 'databaseMirroringPartner', partnerInstanceName: 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.closeController?.abort(new ConnectionError('Connection closed before the connection was established.', 'ECLOSE'));\n\n this.transitionTo(this.STATE.FINAL);\n this.cleanupConnection();\n }\n\n /**\n * @private\n */\n async initialiseConnection() {\n const timeoutController = new AbortController();\n\n const connectTimer = setTimeout(() => {\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\n timeoutController.abort(new ConnectionError(message, 'ETIMEOUT'));\n }, this.config.options.connectTimeout);\n\n try {\n let signal = AbortSignal.any([timeoutController.signal, this.closeController!.signal]);\n\n let port = this.config.options.port;\n\n if (!port) {\n try {\n port = await instanceLookup({\n server: this.config.server,\n instanceName: this.config.options.instanceName!,\n timeout: this.config.options.connectTimeout,\n signal: signal\n });\n } catch (err: any) {\n signal.throwIfAborted();\n\n throw new ConnectionError(err.message, 'EINSTLOOKUP', { cause: err });\n }\n }\n\n let socket;\n try {\n socket = await this.connectOnPort(port, this.config.options.multiSubnetFailover, signal, this.config.options.connector);\n } catch (err: any) {\n signal.throwIfAborted();\n\n throw this.wrapSocketError(err);\n }\n\n try {\n const controller = new AbortController();\n const onError = (err: Error) => {\n controller.abort(this.wrapSocketError(err));\n };\n const onClose = () => {\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n };\n const onEnd = () => {\n this.debug.log('socket ended');\n\n const error: ErrorWithCode = new Error('socket hang up');\n error.code = 'ECONNRESET';\n controller.abort(this.wrapSocketError(error));\n };\n\n socket.once('error', onError);\n socket.once('close', onClose);\n socket.once('end', onEnd);\n\n try {\n signal = AbortSignal.any([signal, controller.signal]);\n\n // The connection may have been closed while we were waiting for the\n // socket to connect. Adding an abort listener to an already aborted\n // signal will not call the listener, so we need to check here.\n signal.throwIfAborted();\n\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.debug.log('connected to ' + this.config.server + ':' + this.config.options.port);\n\n this.sendPreLogin();\n\n this.transitionTo(this.STATE.SENT_PRELOGIN);\n const preloginResponse = await this.readPreloginResponse(signal);\n await this.performTlsNegotiation(preloginResponse, signal);\n\n this.sendLogin7Packet();\n\n try {\n const { authentication } = this.config;\n switch (authentication.type) {\n case 'token-credential':\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 this.routingData = await this.performSentLogin7WithFedAuth(signal);\n break;\n case 'ntlm':\n this.transitionTo(this.STATE.SENT_LOGIN7_WITH_NTLM);\n this.routingData = await this.performSentLogin7WithNTLMLogin(signal);\n break;\n default:\n this.transitionTo(this.STATE.SENT_LOGIN7_WITH_STANDARD_LOGIN);\n this.routingData = await this.performSentLogin7WithStandardLogin(signal);\n break;\n }\n } catch (err: any) {\n if (isTransientError(err)) {\n this.debug.log('Initiating retry on transient error');\n this.transitionTo(this.STATE.TRANSIENT_FAILURE_RETRY);\n return await this.performTransientFailureRetry();\n }\n\n throw err;\n }\n\n // If routing data is present, we need to re-route the connection\n if (this.routingData) {\n this.transitionTo(this.STATE.REROUTING);\n return await this.performReRouting();\n }\n\n this.transitionTo(this.STATE.LOGGED_IN_SENDING_INITIAL_SQL);\n await this.performLoggedInSendingInitialSql(signal);\n } finally {\n socket.removeListener('error', onError);\n socket.removeListener('close', onClose);\n socket.removeListener('end', onEnd);\n }\n } catch (err) {\n socket.destroy();\n\n throw err;\n }\n\n socket.on('error', this._onSocketError);\n socket.on('close', this._onSocketClose);\n socket.on('end', this._onSocketEnd);\n\n this.transitionTo(this.STATE.LOGGED_IN);\n } finally {\n clearTimeout(connectTimer);\n }\n }\n\n /**\n * @private\n */\n cleanupConnection() {\n if (!this.closed) {\n this.clearRequestTimer();\n this.clearCancelTimer();\n this.closeConnection();\n\n process.nextTick(() => {\n this.emit('end');\n });\n\n // Mark the connection as closed and detach the active request\n // before invoking its callback, so that a callback that synchronously\n // calls `close` does not re-enter this cleanup logic.\n const request = this.request;\n this.request = undefined;\n this.attentionSent = false;\n this.closed = true;\n\n if (request) {\n request.callback(new RequestError('Connection closed before request completed.', 'ECLOSE'));\n }\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 async wrapWithTls(socket: net.Socket, signal: AbortSignal): Promise<tls.TLSSocket> {\n signal.throwIfAborted();\n\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 { promise, resolve, reject } = Promise.withResolvers<tls.TLSSocket>();\n const encryptsocket = tls.connect(encryptOptions);\n\n try {\n const onAbort = () => { reject(signal.reason); };\n signal.addEventListener('abort', onAbort, { once: true });\n\n try {\n const onError = reject;\n const onConnect = () => {\n // Without this, Node's TLS layer is free to coalesce multiple back-to-back\n // TDS packet writes into a single, larger TLS record. The non-strict `startTls`\n // path (message-io.ts) caps max send fragment to the TDS packet size for the\n // same reason; `wrapWithTls` (TDS 8.0 / encrypt: \"strict\") must match it.\n //\n // Without this fix, a LOGIN7 spanning multiple TDS packets (e.g. any FedAuth\n // login carrying an Entra ID access token, which routinely exceeds one 4KB\n // packet) reliably fails with ECONNRESET against Azure SQL once TLS is\n // negotiated but before LOGINACK — see\n // https://github.com/tediousjs/tedious/issues/1182. Single-packet logins\n // (e.g. plain SQL auth with short credentials) are unaffected either way,\n // which is why this bug reads as \"FedAuth-specific\" until you look closer.\n //\n // `setMaxSendFragment` silently no-ops for values outside 512-16384, so a\n // `packetSize` above that (e.g. 32767, commonly used for bulk load) has to be\n // clamped or it would leave the cap unset and reintroduce the bug it fixes.\n encryptsocket.setMaxSendFragment(Math.min(this.config.options.packetSize, MessageIO.MAX_TLS_SEND_FRAGMENT_SIZE));\n resolve(encryptsocket);\n };\n\n encryptsocket.once('error', onError);\n encryptsocket.once('secureConnect', onConnect);\n\n try {\n return await promise;\n } finally {\n encryptsocket.removeListener('error', onError);\n encryptsocket.removeListener('secureConnect', onConnect);\n }\n } finally {\n signal.removeEventListener('abort', onAbort);\n }\n } catch (err: any) {\n encryptsocket.destroy();\n\n throw err;\n }\n }\n\n async 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 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 return socket;\n }\n\n /**\n * @private\n */\n closeConnection() {\n if (this.socket) {\n this.socket.destroy();\n }\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 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 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 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 wrapSocketError(error: Error): ConnectionError {\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\n return new ConnectionError(message, 'ESOCKET', { cause: error });\n } else {\n const message = `Connection lost - ${error.message}`;\n return new ConnectionError(message, 'ESOCKET', { cause: error });\n }\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\n this.dispatchEvent('socketError', error);\n process.nextTick(() => {\n this.emit('error', this.wrapSocketError(error));\n });\n }\n }\n\n /**\n * @private\n */\n socketClose() {\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n this.transitionTo(this.STATE.FINAL);\n this.cleanupConnection();\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 'token-credential':\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 ?\n `${this.routingData.server}${this.routingData.instance ? '\\\\' + this.routingData.instance : ''}` :\n 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 }\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 * Execute the SQL batch represented by [[Request]].\n * There is no param support, and unlike [[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, [[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 * @private\n */\n resolveRequestParameter(parameter: Parameter): ResolvedParameter {\n return resolveParameter(parameter, this.databaseCollation, 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, this.config.options);\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: ResolvedParameter[] = [];\n\n parameters.push(this.resolveRequestParameter({\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(this.resolveRequestParameter({\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.resolvedParameters);\n }\n\n this.makeRequest(request, TYPE.RPC_REQUEST, new RpcRequestPayload(Procedures.Sp_ExecuteSql, parameters, this.currentTransactionDescriptor(), this.config.options));\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('day_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 * ### The row source\n *\n * The connection owns `rows` from this call on, the way a `for await`\n * loop owns what it iterates. The first row is requested right away,\n * the rest once the server has accepted the bulk load, and the source\n * is closed through its iterator's `return()` whenever the bulk load\n * does not run to completion: a row failed, the bulk load was canceled,\n * the server rejected the `INSERT BULK` statement, or the connection\n * was lost. For a Node.js stream that destroys the stream. A read that\n * is still pending in the source cannot be interrupted; the source is\n * closed once it has settled.\n *\n * An async generator that acquires what it reads from once it is\n * started therefore releases it on every path, through its `finally`:\n *\n * ```js\n * async function* employees() {\n * const file = await fs.promises.open('employees.csv');\n * try {\n * for await (const line of file.readLines()) {\n * const [first_name, last_name, day_of_birth] = line.split(',');\n * yield { first_name, last_name, day_of_birth: new Date(day_of_birth) };\n * }\n * } finally {\n * await file.close();\n * }\n * }\n *\n * connection.execBulkLoad(bulkLoad, employees());\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<BulkLoadRow> | Iterable<BulkLoadRow>): void\n\n execBulkLoad(bulkLoad: BulkLoad, rows?: AsyncIterable<BulkLoadRow> | Iterable<BulkLoadRow>) {\n bulkLoad.executionStarted = true;\n\n // Owns the row source from here on: the first row is requested now,\n // the rest are read once the server has accepted the `INSERT BULK`\n // statement, and the source is closed if that never happens.\n const payload = new BulkLoadPayload(bulkLoad, rows ?? []);\n\n const onCancel = () => {\n request.cancel();\n };\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 payload.close();\n bulkLoad.error = error;\n bulkLoad.callback(error);\n return;\n }\n\n if (bulkLoad.canceled || this.state !== this.STATE.LOGGED_IN) {\n // `makeRequest` completes a canceled bulk load, or one on a\n // connection that is no longer logged in, without reading its\n // payload.\n payload.close();\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: ResolvedParameter[] = [];\n\n parameters.push(this.resolveRequestParameter({\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(this.resolveRequestParameter({\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(this.resolveRequestParameter({\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));\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: ResolvedParameter[] = [];\n\n parameters.push(this.resolveRequestParameter({\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));\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: ResolvedParameter[] = [];\n\n executeParameters.push(this.resolveRequestParameter({\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(this.resolveRequestParameter({\n ...parameter,\n value: parameters ? parameters[parameter.name] : null\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));\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, this.config.options);\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.resolvedParameters, this.currentTransactionDescriptor(), this.config.options));\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 // Clear any error left over from a previous execution of this request,\n // even if the request is rejected before being sent.\n request.error = undefined;\n\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 this.attentionSent = false;\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();\n\n // The request error might already be set, e.g. if the payload\n // stream errored before the cancellation.\n request.error ??= new RequestError('Canceled.', 'ECANCEL');\n\n // set the ignore bit and end the message.\n message.ignore = true;\n message.end();\n\n // The server responds to the ignored message like to any other\n // request message. If that response never arrives (e.g. because\n // the server has become unresponsive), the cancel timer ensures\n // the canceled request still completes.\n this.createCancelTimer();\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 // Prepend the listener so it always runs before the\n // `SentClientRequest` state's `cancel` handler, regardless of the\n // order in which the two were registered. The latter relies on\n // `attentionSent` already being set, which only this listener does.\n request.prependOnceListener('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 /**\n * @private\n */\n async performTlsNegotiation(preloginPayload: PreloginPayload, signal: AbortSignal) {\n await withAbortRace(signal, async (signalAborted) => {\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 throw new ConnectionError(\"Server requires encryption, set 'encrypt' config option to true.\", 'EENCRYPT');\n }\n\n this.transitionTo(this.STATE.SENT_TLSSSLNEGOTIATION);\n await Promise.race([\n this.messageIo.startTls(this.secureContextOptions, this.config.options.serverName ? this.config.options.serverName : this.routingData?.server ?? this.config.server, this.config.options.trustServerCertificate).catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n }\n });\n }\n\n async readPreloginResponse(signal: AbortSignal): Promise<PreloginPayload> {\n let messageBuffer = Buffer.alloc(0);\n\n await withAbortRace(signal, async (signalAborted) => {\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const iterator = message[Symbol.asyncIterator]();\n try {\n while (true) {\n const { done, value } = await Promise.race([\n iterator.next(),\n signalAborted\n ]);\n\n if (done) {\n break;\n }\n\n messageBuffer = Buffer.concat([messageBuffer, value]);\n }\n } finally {\n if (iterator.return) {\n await iterator.return();\n }\n }\n });\n\n const preloginPayload = new PreloginPayload(messageBuffer);\n this.debug.payload(function() {\n return preloginPayload.toString(' ');\n });\n return preloginPayload;\n }\n\n /**\n * @private\n */\n async performReRouting() {\n this.socket!.removeListener('error', this._onSocketError);\n this.socket!.removeListener('close', this._onSocketClose);\n this.socket!.removeListener('end', this._onSocketEnd);\n this.socket!.destroy();\n\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n\n this.emit('rerouting');\n this.debug.log('Rerouting to ' + this.routingData!.server + ':' + this.routingData!.port);\n\n // Attempt connecting to the rerouting target\n this.transitionTo(this.STATE.CONNECTING);\n await this.initialiseConnection();\n }\n\n /**\n * @private\n */\n async performTransientFailureRetry() {\n this.curTransientRetryCount++;\n\n this.socket!.removeListener('error', this._onSocketError);\n this.socket!.removeListener('close', this._onSocketClose);\n this.socket!.removeListener('end', this._onSocketEnd);\n this.socket!.destroy();\n\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n\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 const closeSignal = this.closeController!.signal;\n closeSignal.throwIfAborted();\n\n const { promise, resolve, reject } = Promise.withResolvers<void>();\n\n const onAbort = () => { reject(closeSignal.reason); };\n closeSignal.addEventListener('abort', onAbort, { once: true });\n\n const retryTimer = setTimeout(resolve, this.config.options.connectionRetryInterval);\n try {\n await promise;\n } finally {\n clearTimeout(retryTimer);\n closeSignal.removeEventListener('abort', onAbort);\n }\n\n this.emit('retry');\n this.transitionTo(this.STATE.CONNECTING);\n await this.initialiseConnection();\n }\n\n /**\n * @private\n */\n async performSentLogin7WithStandardLogin(signal: AbortSignal): Promise<RoutingData | undefined> {\n return await withAbortRace(signal, async (signalAborted) => {\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n // If the abort wins this race, the pending `once()` is left\n // unobserved, and a parse error landing afterwards would reject it\n // with nobody listening. Observe it so that cannot become an\n // unhandled rejection (same idiom as `withAbortRace`).\n const endOfMessage = once(tokenStreamParser, 'end');\n endOfMessage.catch(() => {});\n await Promise.race([\n endOfMessage,\n signalAborted\n ]);\n\n if (handler.loginAckReceived) {\n return handler.routingData;\n } else if (handler.loginError) {\n throw handler.loginError;\n } else {\n throw new ConnectionError('Login failed.', 'ELOGIN');\n }\n });\n }\n\n /**\n * @private\n */\n async performSentLogin7WithNTLMLogin(signal: AbortSignal): Promise<RoutingData | undefined> {\n return await withAbortRace(signal, async (signalAborted) => {\n while (true) {\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n // If the abort wins this race, the pending `once()` is left\n // unobserved, and a parse error landing afterwards would reject it\n // with nobody listening. Observe it so that cannot become an\n // unhandled rejection (same idiom as `withAbortRace`).\n const endOfMessage = once(tokenStreamParser, 'end');\n endOfMessage.catch(() => {});\n await Promise.race([\n endOfMessage,\n signalAborted\n ]);\n\n if (handler.loginAckReceived) {\n return handler.routingData;\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 (handler.loginError) {\n throw handler.loginError;\n } else {\n throw new ConnectionError('Login failed.', 'ELOGIN');\n }\n }\n });\n }\n\n /**\n * @private\n */\n async performSentLogin7WithFedAuth(signal: AbortSignal): Promise<RoutingData | undefined> {\n return await withAbortRace(signal, async (signalAborted) => {\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n // If the abort wins this race, the pending `once()` is left\n // unobserved, and a parse error landing afterwards would reject it\n // with nobody listening. Observe it so that cannot become an\n // unhandled rejection (same idiom as `withAbortRace`).\n const endOfMessage = once(tokenStreamParser, 'end');\n endOfMessage.catch(() => {});\n await Promise.race([\n endOfMessage,\n signalAborted\n ]);\n\n if (handler.loginAckReceived) {\n return handler.routingData;\n }\n\n const fedAuthInfoToken = handler.fedAuthInfoToken;\n\n if (fedAuthInfoToken && fedAuthInfoToken.stsurl && fedAuthInfoToken.spn) {\n /** Federated authentication configuration. */\n const authentication = this.config.authentication as TokenCredentialAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication;\n /** Permission scope to pass to Entra ID when requesting an authentication token. */\n const tokenScope = new URL('/.default', fedAuthInfoToken.spn).toString();\n\n /** Instance of the token credential to use to authenticate to the resource. */\n let credentials: TokenCredential;\n\n switch (authentication.type) {\n case 'token-credential':\n credentials = authentication.options.credential;\n break;\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 /** Access token retrieved from Entra ID for the configured permission scope(s). */\n let tokenResponse: AccessToken | null;\n\n try {\n tokenResponse = await Promise.race([\n credentials.getToken(tokenScope),\n signalAborted\n ]);\n } catch (err) {\n signal.throwIfAborted();\n\n throw new AggregateError(\n [new ConnectionError('Security token could not be authenticated or authorized.', 'EFEDAUTH'), err]);\n }\n\n // Type guard the token value so that it is never null.\n if (tokenResponse === null) {\n throw new AggregateError(\n [new ConnectionError('Security token could not be authenticated or authorized.', 'EFEDAUTH')]);\n }\n\n this.sendFedAuthTokenMessage(tokenResponse.token);\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 return await this.performSentLogin7WithStandardLogin(signal);\n } else if (handler.loginError) {\n throw handler.loginError;\n } else {\n throw new ConnectionError('Login failed.', 'ELOGIN');\n }\n });\n }\n\n /**\n * @private\n */\n async performLoggedInSendingInitialSql(signal: AbortSignal) {\n await withAbortRace(signal, async (signalAborted) => {\n this.sendInitialSql();\n\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const tokenStreamParser = this.createTokenStreamParser(message, new InitialSqlTokenHandler(this));\n // If the abort wins this race, the pending `once()` is left\n // unobserved, and a parse error landing afterwards would reject it\n // with nobody listening. Observe it so that cannot become an\n // unhandled rejection (same idiom as `withAbortRace`).\n const endOfMessage = once(tokenStreamParser, 'end');\n endOfMessage.catch(() => {});\n await Promise.race([\n endOfMessage,\n signalAborted\n ]);\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 events: {}\n },\n SENT_PRELOGIN: {\n name: 'SentPrelogin',\n events: {}\n },\n REROUTING: {\n name: 'ReRouting',\n events: {}\n },\n TRANSIENT_FAILURE_RETRY: {\n name: 'TRANSIENT_FAILURE_RETRY',\n events: {}\n },\n SENT_TLSSSLNEGOTIATION: {\n name: 'SentTLSSSLNegotiation',\n events: {}\n },\n SENT_LOGIN7_WITH_STANDARD_LOGIN: {\n name: 'SentLogin7WithStandardLogin',\n events: {}\n },\n SENT_LOGIN7_WITH_NTLM: {\n name: 'SentLogin7WithNTLMLogin',\n events: {}\n },\n SENT_LOGIN7_WITH_FEDAUTH: {\n name: 'SentLogin7WithFedauth',\n events: {}\n },\n LOGGED_IN_SENDING_INITIAL_SQL: {\n name: 'LoggedInSendingInitialSql',\n events: {}\n },\n LOGGED_IN: {\n name: 'LoggedIn',\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n this.cleanupConnection();\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 this._onSocketError(err);\n return;\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 // A token parse failure leaves the connection at an undefined\n // position in the TDS stream, so it cannot be recovered at the\n // request level — treat it like a socket error. Without a listener\n // here, a parse failure would surface as an unhandled `'error'`\n // event on the parser's internal stream and crash the process.\n const onParserError = (err: Error) => {\n // The request is about to fail through the socket error path, so\n // detach its listeners first: a late `cancel()` must not write an\n // attention packet to the destroyed socket. (On the canceled-drain\n // path below these were never attached, and removal is a no-op.)\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._onSocketError(err);\n };\n tokenStreamParser.on('error', onParserError);\n\n // If the request was canceled after the request message was\n // fully sent off, an attention message was sent to the server.\n //\n // We already started consuming the current message (the response\n // to the canceled request, with all the token handlers being\n // no-ops), and need to ensure the next message (containing the\n // attention acknowledgement) is handled by the `SENT_ATTENTION`\n // state.\n if (this.request?.canceled && this.attentionSent) {\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 // If the request was canceled before the request message was\n // fully sent, the message was terminated with the `IGNORE` bit\n // set and no attention message was sent. The server's response\n // to the ignored message is handled like a regular response.\n if (!this.attentionSent) {\n return;\n }\n\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 tokenStreamParser.removeListener('error', onParserError);\n\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 // If the request was canceled before its request message was\n // fully sent, this response belongs to the ignored message and\n // a cancel timer is running - the response's arrival is what\n // completes the cancellation.\n this.clearCancelTimer();\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 this.cleanupConnection();\n\n sqlRequest.callback(err);\n }\n }\n },\n SENT_ATTENTION: {\n name: 'SentAttention',\n enter: function() {\n (async () => {\n // TDS is a request-response protocol at the message level: every\n // client message - including the attention message - receives\n // exactly one response message. By the time we enter this state,\n // the response to the canceled request itself was already consumed\n // in the `SentClientRequest` state, so the single message read here\n // is the attention message's own response, containing the attention\n // acknowledgement. Reading more than one message would consume the\n // response belonging to the next request and desynchronize the\n // message stream - so don't turn this into a loop.\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n this._onSocketError(err);\n return;\n }\n\n const handler = new AttentionTokenHandler(this, this.request!);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n\n try {\n await once(tokenStreamParser, 'end');\n } catch (err: any) {\n // A token parse failure in the attention response rejects the\n // `once()`. Treat it like a socket error - the request fails with\n // the parse error and the connection is closed - instead of the\n // process dying on an unhandled rejection.\n this._onSocketError(err);\n return;\n }\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.attentionSent = false;\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 })().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 this.cleanupConnection();\n\n sqlRequest.callback(err);\n }\n }\n },\n FINAL: {\n name: 'Final',\n events: {}\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,GAAA,GAAAD,uBAAA,CAAAH,OAAA;AACA,IAAAK,IAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AAGA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,SAAA,GAAAR,OAAA;AAMA,IAAAS,SAAA,GAAAT,OAAA;AAEA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AACA,IAAAa,eAAA,GAAAb,OAAA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O,UAAU,GAAG,IAAI,CAACpO,OAAQ;UAChC,IAAI,CAACA,OAAO,GAAGrL,SAAS;UACxB,IAAI,CAAC2H,YAAY,CAAC,IAAI,CAAC/B,KAAK,CAACoF,SAAS,CAAC;UAEvC,IAAIyO,UAAU,CAAC/S,KAAK,IAAI+S,UAAU,CAAC/S,KAAK,YAAY6E,oBAAY,IAAIkO,UAAU,CAAC/S,KAAK,CAAC8C,IAAI,KAAK,UAAU,EAAE;YACxGiQ,UAAU,CAACnO,QAAQ,CAACmO,UAAU,CAAC/S,KAAK,CAAC;UACvC,CAAC,MAAM;YACL+S,UAAU,CAACnO,QAAQ,CAAC,IAAIC,oBAAY,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;UAC/D;QACF;MACF,CAAC,EAAE,CAAC,CAACrM,KAAK,CAAEoI,GAAG,IAAK;QAClBT,OAAO,CAACC,QAAQ,CAAC,MAAM;UACrB,MAAMQ,GAAG;QACX,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ,CAAC;IACDqG,MAAM,EAAE;MACNsL,WAAW,EAAE,SAAAA,CAAS3R,GAAG,EAAE;QACzB,MAAMmS,UAAU,GAAG,IAAI,CAACpO,OAAQ;QAChC,IAAI,CAACA,OAAO,GAAGrL,SAAS;QAExB,IAAI,CAAC2H,YAAY,CAAC,IAAI,CAAC/B,KAAK,CAACe,KAAK,CAAC;QACnC,IAAI,CAACoB,iBAAiB,CAAC,CAAC;QAExB0R,UAAU,CAACnO,QAAQ,CAAChE,GAAG,CAAC;MAC1B;IACF;EACF,CAAC;EACDX,KAAK,EAAE;IACLS,IAAI,EAAE,OAAO;IACbuG,MAAM,EAAE,CAAC;EACX;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"connection.js","names":["_crypto","_interopRequireDefault","require","_os","tls","_interopRequireWildcard","net","_dns","_constants","_stream","_identity","_coreAuth","_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","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","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","withAbortRace","signal","func","throwIfAborted","promise","signalAborted","reject","Promise","withResolvers","catch","onAbort","reason","addEventListener","once","removeEventListener","Connection","EventEmitter","constructor","config","TypeError","server","fedAuthRequired","authentication","undefined","type","options","domain","userName","password","toUpperCase","isTokenCredential","credential","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","attentionSent","_cancelAfterRequestSent","messageIo","sendMessage","TYPE","ATTENTION","createCancelTimer","_onSocketClose","socketClose","_onSocketEnd","socketEnd","_onSocketError","error","FINAL","dispatchEvent","process","nextTick","emit","wrapSocketError","connect","connectListener","ConnectionError","name","onConnect","err","removeListener","onError","closeController","AbortController","transitionTo","CONNECTING","initialiseConnection","then","cleanupConnection","on","event","listener","args","close","abort","timeoutController","connectTimer","setTimeout","hostPostfix","routingData","routingMessage","message","log","AbortSignal","any","instanceLookup","timeout","cause","socket","connectOnPort","controller","onClose","onEnd","code","setKeepAlive","MessageIO","cleartext","sendPreLogin","SENT_PRELOGIN","preloginResponse","readPreloginResponse","performTlsNegotiation","sendLogin7Packet","SENT_LOGIN7_WITH_FEDAUTH","performSentLogin7WithFedAuth","SENT_LOGIN7_WITH_NTLM","performSentLogin7WithNTLMLogin","SENT_LOGIN7_WITH_STANDARD_LOGIN","performSentLogin7WithStandardLogin","isTransientError","TRANSIENT_FAILURE_RETRY","performTransientFailureRetry","REROUTING","performReRouting","LOGGED_IN_SENDING_INITIAL_SQL","performLoggedInSendingInitialSql","destroy","LOGGED_IN","clearTimeout","clearRequestTimer","clearCancelTimer","closeConnection","request","callback","RequestError","Debug","createTokenStreamParser","handler","TokenStreamParser","wrapWithTls","secureContext","createSecureContext","isIP","encryptOptions","host","ALPNProtocols","servername","resolve","encryptsocket","setMaxSendFragment","Math","min","MAX_TLS_SEND_FRAGMENT_SIZE","customConnector","connectOpts","connectInParallel","connectInSequence","dns","lookup","end","cancelTimer","createRequestTimer","requestTimer","cancel","newState","exit","enter","apply","getEventHandler","eventName","events","SENT_TLSSSLNEGOTIATION","major","minor","build","exec","version","PreloginPayload","Number","subbuild","PRELOGIN","toString","Login7Payload","versions","clientProgVer","clientPid","pid","connectionId","clientTimeZone","Date","getTimezoneOffset","clientLcid","fedAuth","echo","workflow","fedAuthToken","sspi","createNTLMRequest","hostname","os","instance","libraryName","initDbFatal","LOGIN7","toBuffer","sendFedAuthTokenMessage","accessTokenLen","byteLength","offset","writeUInt32LE","write","FEDAUTH_TOKEN","sendInitialSql","SqlBatchPayload","getInitialSql","currentTransactionDescriptor","Message","SQL_BATCH","outgoingMessageStream","Readable","pipe","push","getIsolationLevelText","join","execSqlBatch","makeRequest","sqlTextOrProcedure","resolveRequestParameter","parameter","resolveParameter","databaseCollation","execSql","validateParameters","parameters","TYPES","NVarChar","output","length","precision","scale","makeParamsParameter","resolvedParameters","RPC_REQUEST","RpcRequestPayload","Procedures","Sp_ExecuteSql","newBulkLoad","table","callbackOrOptions","BulkLoad","execBulkLoad","bulkLoad","rows","executionStarted","BulkLoadPayload","onCancel","Request","getBulkInsertSql","canceled","BULK_LOAD","prepare","Int","preparing","Sp_Prepare","unprepare","handle","Sp_Unprepare","execute","executeParameters","len","Sp_Execute","callProcedure","beginTransaction","transaction","Transaction","isolationLevelToTSQL","TRANSACTION_MANAGER","beginPayload","commitTransaction","commitPayload","rollbackTransaction","rollbackPayload","saveTransaction","savePayload","cb","useSavepoint","crypto","randomBytes","txDone","done","txErr","packetType","connection","rowCount","rst","payloadStream","unpipe","ignore","paused","resume","resetConnection","resetConnectionOnNextRequest","SENT_CLIENT_REQUEST","prependOnceListener","reset","READ_UNCOMMITTED","REPEATABLE_READ","SERIALIZABLE","SNAPSHOT","preloginPayload","encryptionString","race","startTls","readMessage","iterator","Symbol","asyncIterator","next","concat","return","closeSignal","retryTimer","Login7TokenHandler","tokenStreamParser","endOfMessage","loginAckReceived","loginError","ntlmpacket","NTLMResponsePayload","NTLMAUTH_PKT","fedAuthInfoToken","stsurl","spn","tokenScope","URL","credentials","UsernamePasswordCredential","msiArgs","ManagedIdentityCredential","managedIdentityClientId","DefaultAzureCredential","ClientSecretCredential","tokenResponse","getToken","AggregateError","InitialSqlTokenHandler","errors","isTransient","_default","exports","module","prototype","socketError","RequestTokenHandler","onParserError","onPause","onResume","SENT_ATTENTION","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 ClientSecretCredential,\n DefaultAzureCredential,\n ManagedIdentityCredential,\n UsernamePasswordCredential\n} from '@azure/identity';\nimport { type AccessToken, type TokenCredential, isTokenCredential } from '@azure/core-auth';\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, type ResolvedParameter, TYPES, resolveParameter } from './data-type';\nimport { BulkLoadPayload, type Row as BulkLoadRow } 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 want to connect to an Azure app service using a specific client account,\n * you need to provide the `clientId` associated with your created identity.\n *\n * This is optional for retrieving a 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 * you need to provide the `clientId` associated with your created identity.\n *\n * This is optional for retrieving 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 * you need to provide the `clientId` associated with your 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 needs to provide a `token` which they retrieved elsewhere\n * to form the connection.\n */\n token: string;\n };\n}\n\ninterface AzureActiveDirectoryPasswordAuthentication {\n type: 'azure-active-directory-password';\n options: {\n /**\n * A user needs to provide a `userName` associated with their account.\n */\n userName: string;\n\n /**\n * A user needs to provide a `password` associated with 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\n/** Structure that defines the options that are necessary to authenticate the Tedious.JS instance with an `@azure/identity` token credential. */\ninterface TokenCredentialAuthentication {\n /** Unique designator for the type of authentication to be used. */\n type: 'token-credential';\n /** Set of configurations that are required or allowed with this authentication type. */\n options: {\n /** Credential object used to authenticate to the resource. */\n credential: TokenCredential;\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 | TokenCredentialAuthentication | 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 message?(this: Connection, message: Message): void;\n };\n}\n\ntype Authentication = DefaultAuthentication |\n NtlmAuthentication |\n TokenCredentialAuthentication |\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 * * `token-credential`: [[CredentialChainAuthentication.options]]\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 | undefined;\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_COMMITTED`).\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.createSecureContext`](https://nodejs.org/docs/latest/api/tls.html#tlscreatesecurecontextoptions).\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 precision.\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_COMMITTED`).\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 | undefined;\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` (deprecated, support will be removed in a future version)\n * * `7_2`\n * * `7_3_A`\n * * `7_3_B`\n * * `7_4`\n *\n * (default: `7_4`)\n */\n tdsVersion?: string | undefined;\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?: number;\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: `false`)\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\ninterface RoutingData {\n server: string;\n port: number;\n instance: string;\n}\n\n/**\n * Runs the given function, providing it with a promise that will reject\n * with the given signal's abort reason once the signal is aborted.\n *\n * The function can race this promise against any asynchronous work it\n * performs (potentially multiple times) to make itself abortable.\n *\n * The rejection is always considered handled, and the signal's abort\n * listener is removed once the function settles.\n */\nasync function withAbortRace<T>(signal: AbortSignal, func: (signalAborted: Promise<never>) => Promise<T>): Promise<T> {\n signal.throwIfAborted();\n\n const { promise: signalAborted, reject } = Promise.withResolvers<never>();\n\n // Prevent unhandled rejections if the signal is aborted while\n // `func` is not currently racing against `signalAborted`.\n signalAborted.catch(() => {});\n\n const onAbort = () => { reject(signal.reason); };\n signal.addEventListener('abort', onAbort, { once: true });\n\n try {\n return await func(signalAborted);\n } finally {\n signal.removeEventListener('abort', onAbort);\n }\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 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 cancelTimer: undefined | NodeJS.Timeout;\n /**\n * @private\n */\n declare requestTimer: undefined | NodeJS.Timeout;\n\n /**\n * Controller used to abort the connection establishment process\n * when the connection is closed before it was fully established.\n *\n * @private\n */\n declare closeController: undefined | AbortController;\n\n /**\n * Whether an attention message was sent to the server to cancel the\n * currently active request.\n *\n * @private\n */\n declare attentionSent: boolean;\n\n /**\n * @private\n */\n declare _cancelAfterRequestSent: () => void;\n\n /**\n * @private\n */\n declare databaseCollation: Collation | undefined;\n\n /**\n * @private\n */\n declare _onSocketClose: (hadError: boolean) => void;\n\n /**\n * @private\n */\n declare _onSocketError: (err: Error) => void;\n\n /**\n * @private\n */\n declare _onSocketEnd: () => void;\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 !== 'token-credential' && 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\", \"token-credential\", \"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 === 'token-credential') {\n if (!isTokenCredential(options.credential)) {\n throw new TypeError('The \"config.authentication.options.credential\" property must be an instance of the token credential class.');\n }\n\n authentication = {\n type: 'token-credential',\n options: {\n credential: options.credential\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.attentionSent = false;\n\n this._cancelAfterRequestSent = () => {\n this.messageIo.sendMessage(TYPE.ATTENTION);\n this.attentionSent = true;\n this.createCancelTimer();\n };\n\n this._onSocketClose = () => {\n this.socketClose();\n };\n\n this._onSocketEnd = () => {\n this.socketEnd();\n };\n\n this._onSocketError = (error) => {\n // Nothing left to route once the connection is closed: `Final` has no\n // `socketError` handler, and the error would only surface as noise\n // after `close()`. (Mirrors `socketEnd()`.)\n if (this.state === this.STATE.FINAL) {\n return;\n }\n\n this.dispatchEvent('socketError', error);\n process.nextTick(() => {\n this.emit('error', this.wrapSocketError(error));\n });\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.closeController = new AbortController();\n\n this.transitionTo(this.STATE.CONNECTING);\n this.initialiseConnection().then(() => {\n process.nextTick(() => {\n this.emit('connect');\n });\n }, (err) => {\n this.transitionTo(this.STATE.FINAL);\n\n process.nextTick(() => {\n this.emit('connect', err);\n });\n\n this.cleanupConnection();\n });\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 falsy. 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: 'databaseMirroringPartner', partnerInstanceName: 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.closeController?.abort(new ConnectionError('Connection closed before the connection was established.', 'ECLOSE'));\n\n this.transitionTo(this.STATE.FINAL);\n this.cleanupConnection();\n }\n\n /**\n * @private\n */\n async initialiseConnection() {\n const timeoutController = new AbortController();\n\n const connectTimer = setTimeout(() => {\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\n timeoutController.abort(new ConnectionError(message, 'ETIMEOUT'));\n }, this.config.options.connectTimeout);\n\n try {\n let signal = AbortSignal.any([timeoutController.signal, this.closeController!.signal]);\n\n let port = this.config.options.port;\n\n if (!port) {\n try {\n port = await instanceLookup({\n server: this.config.server,\n instanceName: this.config.options.instanceName!,\n timeout: this.config.options.connectTimeout,\n signal: signal\n });\n } catch (err: any) {\n signal.throwIfAborted();\n\n throw new ConnectionError(err.message, 'EINSTLOOKUP', { cause: err });\n }\n }\n\n let socket;\n try {\n socket = await this.connectOnPort(port, this.config.options.multiSubnetFailover, signal, this.config.options.connector);\n } catch (err: any) {\n signal.throwIfAborted();\n\n throw this.wrapSocketError(err);\n }\n\n try {\n const controller = new AbortController();\n const onError = (err: Error) => {\n controller.abort(this.wrapSocketError(err));\n };\n const onClose = () => {\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n };\n const onEnd = () => {\n this.debug.log('socket ended');\n\n const error: ErrorWithCode = new Error('socket hang up');\n error.code = 'ECONNRESET';\n controller.abort(this.wrapSocketError(error));\n };\n\n socket.once('error', onError);\n socket.once('close', onClose);\n socket.once('end', onEnd);\n\n try {\n signal = AbortSignal.any([signal, controller.signal]);\n\n // The connection may have been closed while we were waiting for the\n // socket to connect. Adding an abort listener to an already aborted\n // signal will not call the listener, so we need to check here.\n signal.throwIfAborted();\n\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.debug.log('connected to ' + this.config.server + ':' + this.config.options.port);\n\n this.sendPreLogin();\n\n this.transitionTo(this.STATE.SENT_PRELOGIN);\n const preloginResponse = await this.readPreloginResponse(signal);\n await this.performTlsNegotiation(preloginResponse, signal);\n\n this.sendLogin7Packet();\n\n try {\n const { authentication } = this.config;\n switch (authentication.type) {\n case 'token-credential':\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 this.routingData = await this.performSentLogin7WithFedAuth(signal);\n break;\n case 'ntlm':\n this.transitionTo(this.STATE.SENT_LOGIN7_WITH_NTLM);\n this.routingData = await this.performSentLogin7WithNTLMLogin(signal);\n break;\n default:\n this.transitionTo(this.STATE.SENT_LOGIN7_WITH_STANDARD_LOGIN);\n this.routingData = await this.performSentLogin7WithStandardLogin(signal);\n break;\n }\n } catch (err: any) {\n if (isTransientError(err)) {\n this.debug.log('Initiating retry on transient error');\n this.transitionTo(this.STATE.TRANSIENT_FAILURE_RETRY);\n return await this.performTransientFailureRetry();\n }\n\n throw err;\n }\n\n // If routing data is present, we need to re-route the connection\n if (this.routingData) {\n this.transitionTo(this.STATE.REROUTING);\n return await this.performReRouting();\n }\n\n this.transitionTo(this.STATE.LOGGED_IN_SENDING_INITIAL_SQL);\n await this.performLoggedInSendingInitialSql(signal);\n } finally {\n socket.removeListener('error', onError);\n socket.removeListener('close', onClose);\n socket.removeListener('end', onEnd);\n }\n } catch (err) {\n socket.destroy();\n\n throw err;\n }\n\n socket.on('error', this._onSocketError);\n socket.on('close', this._onSocketClose);\n socket.on('end', this._onSocketEnd);\n\n this.transitionTo(this.STATE.LOGGED_IN);\n } finally {\n clearTimeout(connectTimer);\n }\n }\n\n /**\n * @private\n */\n cleanupConnection() {\n if (!this.closed) {\n this.clearRequestTimer();\n this.clearCancelTimer();\n this.closeConnection();\n\n process.nextTick(() => {\n this.emit('end');\n });\n\n // Mark the connection as closed and detach the active request\n // before invoking its callback, so that a callback that synchronously\n // calls `close` does not re-enter this cleanup logic.\n const request = this.request;\n this.request = undefined;\n this.attentionSent = false;\n this.closed = true;\n\n if (request) {\n request.callback(new RequestError('Connection closed before request completed.', 'ECLOSE'));\n }\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 async wrapWithTls(socket: net.Socket, signal: AbortSignal): Promise<tls.TLSSocket> {\n signal.throwIfAborted();\n\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 { promise, resolve, reject } = Promise.withResolvers<tls.TLSSocket>();\n const encryptsocket = tls.connect(encryptOptions);\n\n try {\n const onAbort = () => { reject(signal.reason); };\n signal.addEventListener('abort', onAbort, { once: true });\n\n try {\n const onError = reject;\n const onConnect = () => {\n // Without this, Node's TLS layer is free to coalesce multiple back-to-back\n // TDS packet writes into a single, larger TLS record. The non-strict `startTls`\n // path (message-io.ts) caps max send fragment to the TDS packet size for the\n // same reason; `wrapWithTls` (TDS 8.0 / encrypt: \"strict\") must match it.\n //\n // Without this fix, a LOGIN7 spanning multiple TDS packets (e.g. any FedAuth\n // login carrying an Entra ID access token, which routinely exceeds one 4KB\n // packet) reliably fails with ECONNRESET against Azure SQL once TLS is\n // negotiated but before LOGINACK — see\n // https://github.com/tediousjs/tedious/issues/1182. Single-packet logins\n // (e.g. plain SQL auth with short credentials) are unaffected either way,\n // which is why this bug reads as \"FedAuth-specific\" until you look closer.\n //\n // `setMaxSendFragment` silently no-ops for values outside 512-16384, so a\n // `packetSize` above that (e.g. 32767, commonly used for bulk load) has to be\n // clamped or it would leave the cap unset and reintroduce the bug it fixes.\n encryptsocket.setMaxSendFragment(Math.min(this.config.options.packetSize, MessageIO.MAX_TLS_SEND_FRAGMENT_SIZE));\n resolve(encryptsocket);\n };\n\n encryptsocket.once('error', onError);\n encryptsocket.once('secureConnect', onConnect);\n\n try {\n return await promise;\n } finally {\n encryptsocket.removeListener('error', onError);\n encryptsocket.removeListener('secureConnect', onConnect);\n }\n } finally {\n signal.removeEventListener('abort', onAbort);\n }\n } catch (err: any) {\n encryptsocket.destroy();\n\n throw err;\n }\n }\n\n async 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 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 return socket;\n }\n\n /**\n * @private\n */\n closeConnection() {\n if (this.socket) {\n this.socket.destroy();\n }\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 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 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 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 wrapSocketError(error: Error): ConnectionError {\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\n return new ConnectionError(message, 'ESOCKET', { cause: error });\n } else {\n const message = `Connection lost - ${error.message}`;\n return new ConnectionError(message, 'ESOCKET', { cause: error });\n }\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\n this.dispatchEvent('socketError', error);\n process.nextTick(() => {\n this.emit('error', this.wrapSocketError(error));\n });\n }\n }\n\n /**\n * @private\n */\n socketClose() {\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n this.transitionTo(this.STATE.FINAL);\n this.cleanupConnection();\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 'token-credential':\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 ?\n `${this.routingData.server}${this.routingData.instance ? '\\\\' + this.routingData.instance : ''}` :\n 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 }\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 * Execute the SQL batch represented by [[Request]].\n * There is no param support, and unlike [[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, [[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 * @private\n */\n resolveRequestParameter(parameter: Parameter): ResolvedParameter {\n return resolveParameter(parameter, this.databaseCollation, 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, this.config.options);\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: ResolvedParameter[] = [];\n\n parameters.push(this.resolveRequestParameter({\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(this.resolveRequestParameter({\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.resolvedParameters);\n }\n\n this.makeRequest(request, TYPE.RPC_REQUEST, new RpcRequestPayload(Procedures.Sp_ExecuteSql, parameters, this.currentTransactionDescriptor(), this.config.options));\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('day_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 * ### The row source\n *\n * The connection owns `rows` from this call on, the way a `for await`\n * loop owns what it iterates. The first row is requested right away,\n * the rest once the server has accepted the bulk load, and the source\n * is closed through its iterator's `return()` whenever the bulk load\n * does not run to completion: a row failed, the bulk load was canceled,\n * the server rejected the `INSERT BULK` statement, or the connection\n * was lost. For a Node.js stream that destroys the stream. A read that\n * is still pending in the source cannot be interrupted; the source is\n * closed once it has settled.\n *\n * An async generator that acquires what it reads from once it is\n * started therefore releases it on every path, through its `finally`:\n *\n * ```js\n * async function* employees() {\n * const file = await fs.promises.open('employees.csv');\n * try {\n * for await (const line of file.readLines()) {\n * const [first_name, last_name, day_of_birth] = line.split(',');\n * yield { first_name, last_name, day_of_birth: new Date(day_of_birth) };\n * }\n * } finally {\n * await file.close();\n * }\n * }\n *\n * connection.execBulkLoad(bulkLoad, employees());\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<BulkLoadRow> | Iterable<BulkLoadRow>): void\n\n execBulkLoad(bulkLoad: BulkLoad, rows?: AsyncIterable<BulkLoadRow> | Iterable<BulkLoadRow>) {\n bulkLoad.executionStarted = true;\n\n // Owns the row source from here on: the first row is requested now,\n // the rest are read once the server has accepted the `INSERT BULK`\n // statement, and the source is closed if that never happens.\n const payload = new BulkLoadPayload(bulkLoad, rows ?? []);\n\n const onCancel = () => {\n request.cancel();\n };\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 payload.close();\n bulkLoad.error = error;\n bulkLoad.callback(error);\n return;\n }\n\n if (bulkLoad.canceled || this.state !== this.STATE.LOGGED_IN) {\n // `makeRequest` completes a canceled bulk load, or one on a\n // connection that is no longer logged in, without reading its\n // payload.\n payload.close();\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: ResolvedParameter[] = [];\n\n parameters.push(this.resolveRequestParameter({\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(this.resolveRequestParameter({\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(this.resolveRequestParameter({\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 // The prepared statement's handle is stored by the `RequestTokenHandler`.\n this.makeRequest(request, TYPE.RPC_REQUEST, new RpcRequestPayload(Procedures.Sp_Prepare, parameters, this.currentTransactionDescriptor(), this.config.options));\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: ResolvedParameter[] = [];\n\n parameters.push(this.resolveRequestParameter({\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));\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: ResolvedParameter[] = [];\n\n executeParameters.push(this.resolveRequestParameter({\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(this.resolveRequestParameter({\n ...parameter,\n value: parameters ? parameters[parameter.name] : null\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));\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, this.config.options);\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.resolvedParameters, this.currentTransactionDescriptor(), this.config.options));\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 // Clear any error left over from a previous execution of this request,\n // even if the request is rejected before being sent.\n request.error = undefined;\n\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 this.attentionSent = false;\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();\n\n // The request error might already be set, e.g. if the payload\n // stream errored before the cancellation.\n request.error ??= new RequestError('Canceled.', 'ECANCEL');\n\n // set the ignore bit and end the message.\n message.ignore = true;\n message.end();\n\n // The server responds to the ignored message like to any other\n // request message. If that response never arrives (e.g. because\n // the server has become unresponsive), the cancel timer ensures\n // the canceled request still completes.\n this.createCancelTimer();\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 // Prepend the listener so it always runs before the\n // `SentClientRequest` state's `cancel` handler, regardless of the\n // order in which the two were registered. The latter relies on\n // `attentionSent` already being set, which only this listener does.\n request.prependOnceListener('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 /**\n * @private\n */\n async performTlsNegotiation(preloginPayload: PreloginPayload, signal: AbortSignal) {\n await withAbortRace(signal, async (signalAborted) => {\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 throw new ConnectionError(\"Server requires encryption, set 'encrypt' config option to true.\", 'EENCRYPT');\n }\n\n this.transitionTo(this.STATE.SENT_TLSSSLNEGOTIATION);\n await Promise.race([\n this.messageIo.startTls(this.secureContextOptions, this.config.options.serverName ? this.config.options.serverName : this.routingData?.server ?? this.config.server, this.config.options.trustServerCertificate).catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n }\n });\n }\n\n async readPreloginResponse(signal: AbortSignal): Promise<PreloginPayload> {\n let messageBuffer = Buffer.alloc(0);\n\n await withAbortRace(signal, async (signalAborted) => {\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const iterator = message[Symbol.asyncIterator]();\n try {\n while (true) {\n const { done, value } = await Promise.race([\n iterator.next(),\n signalAborted\n ]);\n\n if (done) {\n break;\n }\n\n messageBuffer = Buffer.concat([messageBuffer, value]);\n }\n } finally {\n if (iterator.return) {\n await iterator.return();\n }\n }\n });\n\n const preloginPayload = new PreloginPayload(messageBuffer);\n this.debug.payload(function() {\n return preloginPayload.toString(' ');\n });\n return preloginPayload;\n }\n\n /**\n * @private\n */\n async performReRouting() {\n this.socket!.removeListener('error', this._onSocketError);\n this.socket!.removeListener('close', this._onSocketClose);\n this.socket!.removeListener('end', this._onSocketEnd);\n this.socket!.destroy();\n\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n\n this.emit('rerouting');\n this.debug.log('Rerouting to ' + this.routingData!.server + ':' + this.routingData!.port);\n\n // Attempt connecting to the rerouting target\n this.transitionTo(this.STATE.CONNECTING);\n await this.initialiseConnection();\n }\n\n /**\n * @private\n */\n async performTransientFailureRetry() {\n this.curTransientRetryCount++;\n\n this.socket!.removeListener('error', this._onSocketError);\n this.socket!.removeListener('close', this._onSocketClose);\n this.socket!.removeListener('end', this._onSocketEnd);\n this.socket!.destroy();\n\n this.debug.log('connection to ' + this.config.server + ':' + this.config.options.port + ' closed');\n\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 const closeSignal = this.closeController!.signal;\n closeSignal.throwIfAborted();\n\n const { promise, resolve, reject } = Promise.withResolvers<void>();\n\n const onAbort = () => { reject(closeSignal.reason); };\n closeSignal.addEventListener('abort', onAbort, { once: true });\n\n const retryTimer = setTimeout(resolve, this.config.options.connectionRetryInterval);\n try {\n await promise;\n } finally {\n clearTimeout(retryTimer);\n closeSignal.removeEventListener('abort', onAbort);\n }\n\n this.emit('retry');\n this.transitionTo(this.STATE.CONNECTING);\n await this.initialiseConnection();\n }\n\n /**\n * @private\n */\n async performSentLogin7WithStandardLogin(signal: AbortSignal): Promise<RoutingData | undefined> {\n return await withAbortRace(signal, async (signalAborted) => {\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n // If the abort wins this race, the pending `once()` is left\n // unobserved, and a parse error landing afterwards would reject it\n // with nobody listening. Observe it so that cannot become an\n // unhandled rejection (same idiom as `withAbortRace`).\n const endOfMessage = once(tokenStreamParser, 'end');\n endOfMessage.catch(() => {});\n await Promise.race([\n endOfMessage,\n signalAborted\n ]);\n\n if (handler.loginAckReceived) {\n return handler.routingData;\n } else if (handler.loginError) {\n throw handler.loginError;\n } else {\n throw new ConnectionError('Login failed.', 'ELOGIN');\n }\n });\n }\n\n /**\n * @private\n */\n async performSentLogin7WithNTLMLogin(signal: AbortSignal): Promise<RoutingData | undefined> {\n return await withAbortRace(signal, async (signalAborted) => {\n while (true) {\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n // If the abort wins this race, the pending `once()` is left\n // unobserved, and a parse error landing afterwards would reject it\n // with nobody listening. Observe it so that cannot become an\n // unhandled rejection (same idiom as `withAbortRace`).\n const endOfMessage = once(tokenStreamParser, 'end');\n endOfMessage.catch(() => {});\n await Promise.race([\n endOfMessage,\n signalAborted\n ]);\n\n if (handler.loginAckReceived) {\n return handler.routingData;\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 (handler.loginError) {\n throw handler.loginError;\n } else {\n throw new ConnectionError('Login failed.', 'ELOGIN');\n }\n }\n });\n }\n\n /**\n * @private\n */\n async performSentLogin7WithFedAuth(signal: AbortSignal): Promise<RoutingData | undefined> {\n return await withAbortRace(signal, async (signalAborted) => {\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const handler = new Login7TokenHandler(this);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n // If the abort wins this race, the pending `once()` is left\n // unobserved, and a parse error landing afterwards would reject it\n // with nobody listening. Observe it so that cannot become an\n // unhandled rejection (same idiom as `withAbortRace`).\n const endOfMessage = once(tokenStreamParser, 'end');\n endOfMessage.catch(() => {});\n await Promise.race([\n endOfMessage,\n signalAborted\n ]);\n\n if (handler.loginAckReceived) {\n return handler.routingData;\n }\n\n const fedAuthInfoToken = handler.fedAuthInfoToken;\n\n if (fedAuthInfoToken && fedAuthInfoToken.stsurl && fedAuthInfoToken.spn) {\n /** Federated authentication configuration. */\n const authentication = this.config.authentication as TokenCredentialAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication;\n /** Permission scope to pass to Entra ID when requesting an authentication token. */\n const tokenScope = new URL('/.default', fedAuthInfoToken.spn).toString();\n\n /** Instance of the token credential to use to authenticate to the resource. */\n let credentials: TokenCredential;\n\n switch (authentication.type) {\n case 'token-credential':\n credentials = authentication.options.credential;\n break;\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 /** Access token retrieved from Entra ID for the configured permission scope(s). */\n let tokenResponse: AccessToken | null;\n\n try {\n tokenResponse = await Promise.race([\n credentials.getToken(tokenScope),\n signalAborted\n ]);\n } catch (err) {\n signal.throwIfAborted();\n\n throw new AggregateError(\n [new ConnectionError('Security token could not be authenticated or authorized.', 'EFEDAUTH'), err]);\n }\n\n // Type guard the token value so that it is never null.\n if (tokenResponse === null) {\n throw new AggregateError(\n [new ConnectionError('Security token could not be authenticated or authorized.', 'EFEDAUTH')]);\n }\n\n this.sendFedAuthTokenMessage(tokenResponse.token);\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 return await this.performSentLogin7WithStandardLogin(signal);\n } else if (handler.loginError) {\n throw handler.loginError;\n } else {\n throw new ConnectionError('Login failed.', 'ELOGIN');\n }\n });\n }\n\n /**\n * @private\n */\n async performLoggedInSendingInitialSql(signal: AbortSignal) {\n await withAbortRace(signal, async (signalAborted) => {\n this.sendInitialSql();\n\n const message = await Promise.race([\n this.messageIo.readMessage().catch((err) => {\n throw this.wrapSocketError(err);\n }),\n signalAborted\n ]);\n\n const tokenStreamParser = this.createTokenStreamParser(message, new InitialSqlTokenHandler(this));\n // If the abort wins this race, the pending `once()` is left\n // unobserved, and a parse error landing afterwards would reject it\n // with nobody listening. Observe it so that cannot become an\n // unhandled rejection (same idiom as `withAbortRace`).\n const endOfMessage = once(tokenStreamParser, 'end');\n endOfMessage.catch(() => {});\n await Promise.race([\n endOfMessage,\n signalAborted\n ]);\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 events: {}\n },\n SENT_PRELOGIN: {\n name: 'SentPrelogin',\n events: {}\n },\n REROUTING: {\n name: 'ReRouting',\n events: {}\n },\n TRANSIENT_FAILURE_RETRY: {\n name: 'TRANSIENT_FAILURE_RETRY',\n events: {}\n },\n SENT_TLSSSLNEGOTIATION: {\n name: 'SentTLSSSLNegotiation',\n events: {}\n },\n SENT_LOGIN7_WITH_STANDARD_LOGIN: {\n name: 'SentLogin7WithStandardLogin',\n events: {}\n },\n SENT_LOGIN7_WITH_NTLM: {\n name: 'SentLogin7WithNTLMLogin',\n events: {}\n },\n SENT_LOGIN7_WITH_FEDAUTH: {\n name: 'SentLogin7WithFedauth',\n events: {}\n },\n LOGGED_IN_SENDING_INITIAL_SQL: {\n name: 'LoggedInSendingInitialSql',\n events: {}\n },\n LOGGED_IN: {\n name: 'LoggedIn',\n events: {\n socketError: function() {\n this.transitionTo(this.STATE.FINAL);\n this.cleanupConnection();\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 this._onSocketError(err);\n return;\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 // A token parse failure leaves the connection at an undefined\n // position in the TDS stream, so it cannot be recovered at the\n // request level — treat it like a socket error. Without a listener\n // here, a parse failure would surface as an unhandled `'error'`\n // event on the parser's internal stream and crash the process.\n const onParserError = (err: Error) => {\n // The request is about to fail through the socket error path, so\n // detach its listeners first: a late `cancel()` must not write an\n // attention packet to the destroyed socket. (On the canceled-drain\n // path below these were never attached, and removal is a no-op.)\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._onSocketError(err);\n };\n tokenStreamParser.on('error', onParserError);\n\n // If the request was canceled after the request message was\n // fully sent off, an attention message was sent to the server.\n //\n // We already started consuming the current message (the response\n // to the canceled request, with all the token handlers being\n // no-ops), and need to ensure the next message (containing the\n // attention acknowledgement) is handled by the `SENT_ATTENTION`\n // state.\n if (this.request?.canceled && this.attentionSent) {\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 // If the request was canceled before the request message was\n // fully sent, the message was terminated with the `IGNORE` bit\n // set and no attention message was sent. The server's response\n // to the ignored message is handled like a regular response.\n if (!this.attentionSent) {\n return;\n }\n\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 tokenStreamParser.removeListener('error', onParserError);\n\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 // If the request was canceled before its request message was\n // fully sent, this response belongs to the ignored message and\n // a cancel timer is running - the response's arrival is what\n // completes the cancellation.\n this.clearCancelTimer();\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 this.cleanupConnection();\n\n sqlRequest.callback(err);\n }\n }\n },\n SENT_ATTENTION: {\n name: 'SentAttention',\n enter: function() {\n (async () => {\n // TDS is a request-response protocol at the message level: every\n // client message - including the attention message - receives\n // exactly one response message. By the time we enter this state,\n // the response to the canceled request itself was already consumed\n // in the `SentClientRequest` state, so the single message read here\n // is the attention message's own response, containing the attention\n // acknowledgement. Reading more than one message would consume the\n // response belonging to the next request and desynchronize the\n // message stream - so don't turn this into a loop.\n let message;\n try {\n message = await this.messageIo.readMessage();\n } catch (err: any) {\n this._onSocketError(err);\n return;\n }\n\n const handler = new AttentionTokenHandler(this, this.request!);\n const tokenStreamParser = this.createTokenStreamParser(message, handler);\n\n try {\n await once(tokenStreamParser, 'end');\n } catch (err: any) {\n // A token parse failure in the attention response rejects the\n // `once()`. Treat it like a socket error - the request fails with\n // the parse error and the connection is closed - instead of the\n // process dying on an unhandled rejection.\n this._onSocketError(err);\n return;\n }\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.attentionSent = false;\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 })().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 this.cleanupConnection();\n\n sqlRequest.callback(err);\n }\n }\n },\n FINAL: {\n name: 'Final',\n events: {}\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,GAAA,GAAAD,uBAAA,CAAAH,OAAA;AACA,IAAAK,IAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AAGA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,SAAA,GAAAR,OAAA;AAMA,IAAAS,SAAA,GAAAT,OAAA;AAEA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AACA,IAAAa,eAAA,GAAAb,OAAA;AACA,IAAAc,qBAAA,GAAAd,OAAA;AACA,IAAAe,OAAA,GAAAf,OAAA;AACA,IAAAgB,gBAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,cAAA,GAAAlB,sBAAA,CAAAC,OAAA;AACA,IAAAkB,YAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,QAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAAAoB,kBAAA,GAAArB,sBAAA,CAAAC,OAAA;AACA,IAAAqB,gBAAA,GAAAtB,sBAAA,CAAAC,OAAA;AACA,IAAAsB,UAAA,GAAAvB,sBAAA,CAAAC,OAAA;AACA,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,aAAa,CAAQ,CAAC;;EAEzE;EACA;EACAH,aAAa,CAACI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;EAE7B,MAAMC,OAAO,GAAGA,CAAA,KAAM;IAAEJ,MAAM,CAACL,MAAM,CAACU,MAAM,CAAC;EAAE,CAAC;EAChDV,MAAM,CAACW,gBAAgB,CAAC,OAAO,EAAEF,OAAO,EAAE;IAAEG,IAAI,EAAE;EAAK,CAAC,CAAC;EAEzD,IAAI;IACF,OAAO,MAAMX,IAAI,CAACG,aAAa,CAAC;EAClC,CAAC,SAAS;IACRJ,MAAM,CAACa,mBAAmB,CAAC,OAAO,EAAEJ,OAAO,CAAC;EAC9C;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,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;;EAGE;AACF;AACA;;EAkBE;AACF;AACA;;EAGE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAGE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAGE;AACF;AACA;;EAEE;AACF;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CA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