Skip to content

Commit

Permalink
Merge branch 'master' into michael-AddParamValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSun90 authored Aug 8, 2023
2 parents 1d35a15 + 4f3e210 commit f0ec70b
Show file tree
Hide file tree
Showing 89 changed files with 409 additions and 315 deletions.
2 changes: 1 addition & 1 deletion src/always-encrypted/aead-aes-256-cbc-hmac-algorithm.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This code is based on the `mssql-jdbc` library published under the conditions of MIT license.
// Copyright (c) 2019 Microsoft Corporation

import { EncryptionAlgorithm, SQLServerEncryptionType } from './types';
import { type EncryptionAlgorithm, SQLServerEncryptionType } from './types';
import { createHmac, randomBytes, createCipheriv, createDecipheriv } from 'crypto';
import { AeadAes256CbcHmac256EncryptionKey, keySize } from './aead-aes-256-cbc-hmac-encryption-key';

Expand Down
2 changes: 1 addition & 1 deletion src/always-encrypted/cek-entry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This code is based on the `mssql-jdbc` library published under the conditions of MIT license.
// Copyright (c) 2019 Microsoft Corporation

import { EncryptionKeyInfo } from './types';
import { type EncryptionKeyInfo } from './types';

export class CEKEntry {
columnEncryptionKeyValues: EncryptionKeyInfo[];
Expand Down
4 changes: 2 additions & 2 deletions src/always-encrypted/get-parameter-encryption-metadata.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// This code is based on the `mssql-jdbc` library published under the conditions of MIT license.
// Copyright (c) 2019 Microsoft Corporation

import { SQLServerEncryptionType, CryptoMetadata, DescribeParameterEncryptionResultSet1, DescribeParameterEncryptionResultSet2 } from './types';
import { SQLServerEncryptionType, type CryptoMetadata, DescribeParameterEncryptionResultSet1, DescribeParameterEncryptionResultSet2 } from './types';
import { CEKEntry } from './cek-entry';
import { decryptSymmetricKey } from './key-crypto';
import { typeByName as TYPES, Parameter } from '../data-type';
import { typeByName as TYPES, type Parameter } from '../data-type';
import Request from '../request';
import Connection from '../connection';
import RpcRequestPayload from '../rpcrequest-payload';
Expand Down
4 changes: 2 additions & 2 deletions src/always-encrypted/key-crypto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// This code is based on the `mssql-jdbc` library published under the conditions of MIT license.
// Copyright (c) 2019 Microsoft Corporation

import { CryptoMetadata, EncryptionKeyInfo } from './types';
import { InternalConnectionOptions as ConnectionOptions } from '../connection';
import { type CryptoMetadata, type EncryptionKeyInfo } from './types';
import { type InternalConnectionOptions as ConnectionOptions } from '../connection';
import SymmetricKey from './symmetric-key';
import { getKey } from './symmetric-key-cache';
import { AeadAes256CbcHmac256Algorithm, algorithmName } from './aead-aes-256-cbc-hmac-algorithm';
Expand Down
2 changes: 1 addition & 1 deletion src/always-encrypted/keystore-provider-azure-key-vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) 2019 Microsoft Corporation

import { ClientSecretCredential } from '@azure/identity';
import { CryptographyClient, KeyWrapAlgorithm, KeyClient, KeyVaultKey } from '@azure/keyvault-keys';
import { CryptographyClient, type KeyWrapAlgorithm, KeyClient, type KeyVaultKey } from '@azure/keyvault-keys';
import { createHash } from 'crypto';
import { parse } from 'url';

Expand Down
4 changes: 2 additions & 2 deletions src/always-encrypted/symmetric-key-cache.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This code is based on the `mssql-jdbc` library published under the conditions of MIT license.
// Copyright (c) 2019 Microsoft Corporation

import { EncryptionKeyInfo } from './types';
import { type EncryptionKeyInfo } from './types';
import SymmetricKey from './symmetric-key';
import { InternalConnectionOptions as ConnectionOptions } from '../connection';
import { type InternalConnectionOptions as ConnectionOptions } from '../connection';
import LRU from 'lru-cache';

const cache = new LRU<string, SymmetricKey>(0);
Expand Down
2 changes: 1 addition & 1 deletion src/always-encrypted/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) 2019 Microsoft Corporation

import { CEKEntry } from './cek-entry';
import { BaseMetadata } from '../metadata-parser';
import { type BaseMetadata } from '../metadata-parser';

export interface EncryptionKeyInfo {
encryptedKey: Buffer;
Expand Down
4 changes: 2 additions & 2 deletions src/bulk-load.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { EventEmitter } from 'events';
import WritableTrackingBuffer from './tracking-buffer/writable-tracking-buffer';
import Connection, { InternalConnectionOptions } from './connection';
import { ParameterValidationError } from './errors';
import Connection, { type InternalConnectionOptions } from './connection';

import { Transform } from 'stream';
import { TYPE as TOKEN_TYPE } from './token/token';

import { DataType, Parameter } from './data-type';
import { type DataType, type Parameter } from './data-type';
import { Collation } from './collation';

/**
Expand Down
8 changes: 4 additions & 4 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as net from 'net';
import dns from 'dns';

import constants from 'constants';
import { SecureContextOptions } from 'tls';
import { type SecureContextOptions } from 'tls';

import { Readable } from 'stream';

Expand All @@ -16,7 +16,7 @@ import {
UsernamePasswordCredential,
} from '@azure/identity';

import BulkLoad, { Options as BulkLoadOptions, Callback as BulkLoadCallback } from './bulk-load';
import BulkLoad, { type Options as BulkLoadOptions, type Callback as BulkLoadCallback } from './bulk-load';
import Debug from './debug';
import { EventEmitter, once } from 'events';
import { instanceLookup } from './instance-lookup';
Expand All @@ -36,12 +36,12 @@ import { connectInParallel, connectInSequence } from './connector';
import { name as libraryName } from './library';
import { versions } from './tds-versions';
import Message from './message';
import { Metadata } from './metadata-parser';
import { type Metadata } from './metadata-parser';
import { createNTLMRequest } from './ntlm';
import { ColumnEncryptionAzureKeyVaultProvider } from './always-encrypted/keystore-provider-azure-key-vault';

import { AbortController, AbortSignal } from 'node-abort-controller';
import { Parameter, TYPES } from './data-type';
import { type Parameter, TYPES } from './data-type';
import { BulkLoadPayload } from './bulk-load-payload';
import { Collation } from './collation';
import Procedures from './special-stored-procedure';
Expand Down
2 changes: 1 addition & 1 deletion src/connector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import net from 'net';
import dns, { LookupAddress } from 'dns';
import dns, { type LookupAddress } from 'dns';

import * as punycode from 'punycode';
import { AbortSignal } from 'node-abort-controller';
Expand Down
4 changes: 2 additions & 2 deletions src/data-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ import DateTimeOffset from './data-types/datetimeoffset';
import UDT from './data-types/udt';
import TVP from './data-types/tvp';
import Variant from './data-types/sql-variant';
import { CryptoMetadata } from './always-encrypted/types';
import { type CryptoMetadata } from './always-encrypted/types';

import { InternalConnectionOptions } from './connection';
import { type InternalConnectionOptions } from './connection';
import { Collation } from './collation';

export interface Parameter {
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/bigint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import IntN from './intn';
import WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/binary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const NULL_LENGTH = Buffer.from([0xFF, 0xFF]);

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/bit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import BitN from './bitn';

const DATA_LENGTH = Buffer.from([0x01]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/bitn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const BitN: DataType = {
id: 0x68,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/char.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import iconv from 'iconv-lite';
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const NULL_LENGTH = Buffer.from([0xFF, 0xFF]);

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/date.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import { ChronoUnit, LocalDate } from '@js-joda/core';

// globalDate is to be used for JavaScript's global 'Date' object to avoid name clashing with the 'Date' constant below
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/datetime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import DateTimeN from './datetimen';
import { ChronoUnit, LocalDate } from '@js-joda/core';

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/datetime2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import { ChronoUnit, LocalDate } from '@js-joda/core';
import WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/datetimen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const DateTimeN: DataType = {
id: 0x6F,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/datetimeoffset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import { ChronoUnit, LocalDate } from '@js-joda/core';
import WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/decimal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import DecimalN from './decimaln';
import WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/decimaln.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const DecimalN: DataType = {
id: 0x6A,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/float.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import FloatN from './floatn';

const NULL_LENGTH = Buffer.from([0x00]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/floatn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const FloatN: DataType = {
id: 0x6D,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/image.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const NULL_LENGTH = Buffer.from([0xFF, 0xFF, 0xFF, 0xFF]);

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/int.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import IntN from './intn';

const NULL_LENGTH = Buffer.from([0x00]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/intn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const IntN: DataType = {
id: 0x26,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/money.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import MoneyN from './moneyn';

const SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/moneyn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const MoneyN: DataType = {
id: 0x6E,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/nchar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const NULL_LENGTH = Buffer.from([0xFF, 0xFF]);

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/ntext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const NULL_LENGTH = Buffer.from([0xFF, 0xFF, 0xFF, 0xFF]);

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/null.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const Null: DataType = {
id: 0x1F,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/numeric.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import NumericN from './numericn';
import WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/numericn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const NumericN: DataType = {
id: 0x6C,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/nvarchar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const MAX = (1 << 16) - 1;
const UNKNOWN_PLP_LEN = Buffer.from([0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/real.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import FloatN from './floatn';

const NULL_LENGTH = Buffer.from([0x00]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/smalldatetime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import DateTimeN from './datetimen';

const EPOCH_DATE = new Date(1900, 0, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/smallint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import IntN from './intn';

const DATA_LENGTH = Buffer.from([0x02]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/smallmoney.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import MoneyN from './moneyn';

const DATA_LENGTH = Buffer.from([0x04]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/sql-variant.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const Variant: DataType = {
id: 0x62,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/text.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import iconv from 'iconv-lite';

import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const NULL_LENGTH = Buffer.from([0xFF, 0xFF, 0xFF, 0xFF]);

Expand Down
2 changes: 1 addition & 1 deletion src/data-types/time.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';

const NULL_LENGTH = Buffer.from([0x00]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/tinyint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import IntN from './intn';

const DATA_LENGTH = Buffer.from([0x01]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/tvp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';

const TVP_ROW_TOKEN = Buffer.from([0x01]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/udt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const UDT: DataType = {
id: 0xF0,
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/uniqueidentifier.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';
import { guidToArray } from '../guid-parser';

const NULL_LENGTH = Buffer.from([0x00]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/varbinary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const MAX = (1 << 16) - 1;
const UNKNOWN_PLP_LEN = Buffer.from([0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/varchar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import iconv from 'iconv-lite';

import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const MAX = (1 << 16) - 1;
const UNKNOWN_PLP_LEN = Buffer.from([0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]);
Expand Down
2 changes: 1 addition & 1 deletion src/data-types/xml.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from '../data-type';
import { type DataType } from '../data-type';

const XML: DataType = {
id: 0xF1,
Expand Down
6 changes: 3 additions & 3 deletions src/metadata-parser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Collation } from './collation';
import Parser, { ParserOptions } from './token/stream-parser';
import { TYPE, DataType } from './data-type';
import { CryptoMetadata } from './always-encrypted/types';
import Parser, { type ParserOptions } from './token/stream-parser';
import { TYPE, type DataType } from './data-type';
import { type CryptoMetadata } from './always-encrypted/types';

import { sprintf } from 'sprintf-js';

Expand Down
Loading

0 comments on commit f0ec70b

Please sign in to comment.