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