tedious-fabric 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/CLAUDE.md +91 -0
  2. package/LICENSE +21 -0
  3. package/README.md +67 -0
  4. package/appveyor.yml +67 -0
  5. package/eslint.config.mjs +314 -0
  6. package/lib/all-headers.d.ts +2 -0
  7. package/lib/all-headers.js +24 -0
  8. package/lib/all-headers.js.map +1 -0
  9. package/lib/always-encrypted/aead-aes-256-cbc-hmac-algorithm.js +82 -0
  10. package/lib/always-encrypted/aead-aes-256-cbc-hmac-algorithm.js.map +1 -0
  11. package/lib/always-encrypted/aead-aes-256-cbc-hmac-encryption-key.js +55 -0
  12. package/lib/always-encrypted/aead-aes-256-cbc-hmac-encryption-key.js.map +1 -0
  13. package/lib/always-encrypted/cek-entry.d.ts +11 -0
  14. package/lib/always-encrypted/cek-entry.js +42 -0
  15. package/lib/always-encrypted/cek-entry.js.map +1 -0
  16. package/lib/always-encrypted/get-parameter-encryption-metadata.js +90 -0
  17. package/lib/always-encrypted/get-parameter-encryption-metadata.js.map +1 -0
  18. package/lib/always-encrypted/key-crypto.js +94 -0
  19. package/lib/always-encrypted/key-crypto.js.map +1 -0
  20. package/lib/always-encrypted/keystore-provider-azure-key-vault.d.ts +21 -0
  21. package/lib/always-encrypted/keystore-provider-azure-key-vault.js +247 -0
  22. package/lib/always-encrypted/keystore-provider-azure-key-vault.js.map +1 -0
  23. package/lib/always-encrypted/symmetric-key-cache.js +36 -0
  24. package/lib/always-encrypted/symmetric-key-cache.js.map +1 -0
  25. package/lib/always-encrypted/symmetric-key.js +25 -0
  26. package/lib/always-encrypted/symmetric-key.js.map +1 -0
  27. package/lib/always-encrypted/types.d.ts +73 -0
  28. package/lib/always-encrypted/types.js +61 -0
  29. package/lib/always-encrypted/types.js.map +1 -0
  30. package/lib/always-encrypted/utils.js +23 -0
  31. package/lib/always-encrypted/utils.js.map +1 -0
  32. package/lib/bulk-load-payload.d.ts +8 -0
  33. package/lib/bulk-load-payload.js +23 -0
  34. package/lib/bulk-load-payload.js.map +1 -0
  35. package/lib/bulk-load.d.ts +275 -0
  36. package/lib/bulk-load.js +515 -0
  37. package/lib/bulk-load.js.map +1 -0
  38. package/lib/collation.d.ts +28 -0
  39. package/lib/collation.js +348 -0
  40. package/lib/collation.js.map +1 -0
  41. package/lib/connection.d.ts +1309 -0
  42. package/lib/connection.js +2732 -0
  43. package/lib/connection.js.map +1 -0
  44. package/lib/connector.d.ts +18 -0
  45. package/lib/connector.js +142 -0
  46. package/lib/connector.js.map +1 -0
  47. package/lib/data-type.d.ts +554 -0
  48. package/lib/data-type.js +428 -0
  49. package/lib/data-type.js.map +1 -0
  50. package/lib/data-types/bigint.d.ts +3 -0
  51. package/lib/data-types/bigint.js +53 -0
  52. package/lib/data-types/bigint.js.map +1 -0
  53. package/lib/data-types/binary.d.ts +5 -0
  54. package/lib/data-types/binary.js +67 -0
  55. package/lib/data-types/binary.js.map +1 -0
  56. package/lib/data-types/bit.d.ts +3 -0
  57. package/lib/data-types/bit.js +46 -0
  58. package/lib/data-types/bit.js.map +1 -0
  59. package/lib/data-types/bitn.d.ts +3 -0
  60. package/lib/data-types/bitn.js +29 -0
  61. package/lib/data-types/bitn.js.map +1 -0
  62. package/lib/data-types/char.d.ts +5 -0
  63. package/lib/data-types/char.js +86 -0
  64. package/lib/data-types/char.js.map +1 -0
  65. package/lib/data-types/date.d.ts +3 -0
  66. package/lib/data-types/date.js +72 -0
  67. package/lib/data-types/date.js.map +1 -0
  68. package/lib/data-types/datetime.d.ts +3 -0
  69. package/lib/data-types/datetime.js +93 -0
  70. package/lib/data-types/datetime.js.map +1 -0
  71. package/lib/data-types/datetime2.d.ts +5 -0
  72. package/lib/data-types/datetime2.js +118 -0
  73. package/lib/data-types/datetime2.js.map +1 -0
  74. package/lib/data-types/datetimen.d.ts +3 -0
  75. package/lib/data-types/datetimen.js +29 -0
  76. package/lib/data-types/datetimen.js.map +1 -0
  77. package/lib/data-types/datetimeoffset.d.ts +5 -0
  78. package/lib/data-types/datetimeoffset.js +111 -0
  79. package/lib/data-types/datetimeoffset.js.map +1 -0
  80. package/lib/data-types/decimal.d.ts +6 -0
  81. package/lib/data-types/decimal.js +107 -0
  82. package/lib/data-types/decimal.js.map +1 -0
  83. package/lib/data-types/decimaln.d.ts +3 -0
  84. package/lib/data-types/decimaln.js +29 -0
  85. package/lib/data-types/decimaln.js.map +1 -0
  86. package/lib/data-types/float.d.ts +3 -0
  87. package/lib/data-types/float.js +47 -0
  88. package/lib/data-types/float.js.map +1 -0
  89. package/lib/data-types/floatn.d.ts +3 -0
  90. package/lib/data-types/floatn.js +29 -0
  91. package/lib/data-types/floatn.js.map +1 -0
  92. package/lib/data-types/image.d.ts +3 -0
  93. package/lib/data-types/image.js +56 -0
  94. package/lib/data-types/image.js.map +1 -0
  95. package/lib/data-types/int.d.ts +3 -0
  96. package/lib/data-types/int.js +53 -0
  97. package/lib/data-types/int.js.map +1 -0
  98. package/lib/data-types/intn.d.ts +3 -0
  99. package/lib/data-types/intn.js +29 -0
  100. package/lib/data-types/intn.js.map +1 -0
  101. package/lib/data-types/money.d.ts +3 -0
  102. package/lib/data-types/money.js +59 -0
  103. package/lib/data-types/money.js.map +1 -0
  104. package/lib/data-types/moneyn.d.ts +3 -0
  105. package/lib/data-types/moneyn.js +29 -0
  106. package/lib/data-types/moneyn.js.map +1 -0
  107. package/lib/data-types/nchar.d.ts +5 -0
  108. package/lib/data-types/nchar.js +100 -0
  109. package/lib/data-types/nchar.js.map +1 -0
  110. package/lib/data-types/ntext.d.ts +3 -0
  111. package/lib/data-types/ntext.js +60 -0
  112. package/lib/data-types/ntext.js.map +1 -0
  113. package/lib/data-types/null.d.ts +3 -0
  114. package/lib/data-types/null.js +29 -0
  115. package/lib/data-types/null.js.map +1 -0
  116. package/lib/data-types/numeric.d.ts +6 -0
  117. package/lib/data-types/numeric.js +106 -0
  118. package/lib/data-types/numeric.js.map +1 -0
  119. package/lib/data-types/numericn.d.ts +3 -0
  120. package/lib/data-types/numericn.js +29 -0
  121. package/lib/data-types/numericn.js.map +1 -0
  122. package/lib/data-types/nvarchar.d.ts +5 -0
  123. package/lib/data-types/nvarchar.js +133 -0
  124. package/lib/data-types/nvarchar.js.map +1 -0
  125. package/lib/data-types/real.d.ts +3 -0
  126. package/lib/data-types/real.js +48 -0
  127. package/lib/data-types/real.js.map +1 -0
  128. package/lib/data-types/smalldatetime.d.ts +3 -0
  129. package/lib/data-types/smalldatetime.js +83 -0
  130. package/lib/data-types/smalldatetime.js.map +1 -0
  131. package/lib/data-types/smallint.d.ts +3 -0
  132. package/lib/data-types/smallint.js +53 -0
  133. package/lib/data-types/smallint.js.map +1 -0
  134. package/lib/data-types/smallmoney.d.ts +3 -0
  135. package/lib/data-types/smallmoney.js +51 -0
  136. package/lib/data-types/smallmoney.js.map +1 -0
  137. package/lib/data-types/sql-variant.d.ts +3 -0
  138. package/lib/data-types/sql-variant.js +29 -0
  139. package/lib/data-types/sql-variant.js.map +1 -0
  140. package/lib/data-types/text.d.ts +3 -0
  141. package/lib/data-types/text.js +69 -0
  142. package/lib/data-types/text.js.map +1 -0
  143. package/lib/data-types/time.d.ts +3 -0
  144. package/lib/data-types/time.js +96 -0
  145. package/lib/data-types/time.js.map +1 -0
  146. package/lib/data-types/tinyint.d.ts +3 -0
  147. package/lib/data-types/tinyint.js +53 -0
  148. package/lib/data-types/tinyint.js.map +1 -0
  149. package/lib/data-types/tvp.d.ts +3 -0
  150. package/lib/data-types/tvp.js +117 -0
  151. package/lib/data-types/tvp.js.map +1 -0
  152. package/lib/data-types/udt.d.ts +3 -0
  153. package/lib/data-types/udt.js +29 -0
  154. package/lib/data-types/udt.js.map +1 -0
  155. package/lib/data-types/uniqueidentifier.d.ts +3 -0
  156. package/lib/data-types/uniqueidentifier.js +50 -0
  157. package/lib/data-types/uniqueidentifier.js.map +1 -0
  158. package/lib/data-types/varbinary.d.ts +5 -0
  159. package/lib/data-types/varbinary.js +119 -0
  160. package/lib/data-types/varbinary.js.map +1 -0
  161. package/lib/data-types/varchar.d.ts +5 -0
  162. package/lib/data-types/varchar.js +112 -0
  163. package/lib/data-types/varchar.js.map +1 -0
  164. package/lib/data-types/xml.d.ts +3 -0
  165. package/lib/data-types/xml.js +29 -0
  166. package/lib/data-types/xml.js.map +1 -0
  167. package/lib/debug.d.ts +25 -0
  168. package/lib/debug.js +66 -0
  169. package/lib/debug.js.map +1 -0
  170. package/lib/errors.d.ts +17 -0
  171. package/lib/errors.js +23 -0
  172. package/lib/errors.js.map +1 -0
  173. package/lib/guid-parser.d.ts +3 -0
  174. package/lib/guid-parser.js +30 -0
  175. package/lib/guid-parser.js.map +1 -0
  176. package/lib/incoming-message-stream.d.ts +19 -0
  177. package/lib/incoming-message-stream.js +97 -0
  178. package/lib/incoming-message-stream.js.map +1 -0
  179. package/lib/instance-lookup.d.ts +13 -0
  180. package/lib/instance-lookup.js +91 -0
  181. package/lib/instance-lookup.js.map +1 -0
  182. package/lib/library.d.ts +1 -0
  183. package/lib/library.js +8 -0
  184. package/lib/library.js.map +1 -0
  185. package/lib/login7-payload.d.ts +51 -0
  186. package/lib/login7-payload.js +408 -0
  187. package/lib/login7-payload.js.map +1 -0
  188. package/lib/message-io.d.ts +28 -0
  189. package/lib/message-io.js +152 -0
  190. package/lib/message-io.js.map +1 -0
  191. package/lib/message.d.ts +11 -0
  192. package/lib/message.js +21 -0
  193. package/lib/message.js.map +1 -0
  194. package/lib/metadata-parser.d.ts +48 -0
  195. package/lib/metadata-parser.js +380 -0
  196. package/lib/metadata-parser.js.map +1 -0
  197. package/lib/ntlm-payload.d.ts +23 -0
  198. package/lib/ntlm-payload.js +135 -0
  199. package/lib/ntlm-payload.js.map +1 -0
  200. package/lib/ntlm.d.ts +4 -0
  201. package/lib/ntlm.js +72 -0
  202. package/lib/ntlm.js.map +1 -0
  203. package/lib/outgoing-message-stream.d.ts +15 -0
  204. package/lib/outgoing-message-stream.js +81 -0
  205. package/lib/outgoing-message-stream.js.map +1 -0
  206. package/lib/packet.d.ts +33 -0
  207. package/lib/packet.js +191 -0
  208. package/lib/packet.js.map +1 -0
  209. package/lib/prelogin-payload.d.ts +67 -0
  210. package/lib/prelogin-payload.js +228 -0
  211. package/lib/prelogin-payload.js.map +1 -0
  212. package/lib/request.d.ts +370 -0
  213. package/lib/request.js +387 -0
  214. package/lib/request.js.map +1 -0
  215. package/lib/rpcrequest-payload.d.ts +16 -0
  216. package/lib/rpcrequest-payload.js +109 -0
  217. package/lib/rpcrequest-payload.js.map +1 -0
  218. package/lib/sender.d.ts +5 -0
  219. package/lib/sender.js +78 -0
  220. package/lib/sender.js.map +1 -0
  221. package/lib/special-stored-procedure.d.ts +18 -0
  222. package/lib/special-stored-procedure.js +26 -0
  223. package/lib/special-stored-procedure.js.map +1 -0
  224. package/lib/sqlbatch-payload.d.ts +13 -0
  225. package/lib/sqlbatch-payload.js +34 -0
  226. package/lib/sqlbatch-payload.js.map +1 -0
  227. package/lib/tds-versions.d.ts +6 -0
  228. package/lib/tds-versions.js +19 -0
  229. package/lib/tds-versions.js.map +1 -0
  230. package/lib/tedious.d.ts +13 -0
  231. package/lib/tedious.js +73 -0
  232. package/lib/tedious.js.map +1 -0
  233. package/lib/token/colmetadata-token-parser.d.ts +12 -0
  234. package/lib/token/colmetadata-token-parser.js +124 -0
  235. package/lib/token/colmetadata-token-parser.js.map +1 -0
  236. package/lib/token/done-token-parser.d.ts +6 -0
  237. package/lib/token/done-token-parser.js +76 -0
  238. package/lib/token/done-token-parser.js.map +1 -0
  239. package/lib/token/env-change-token-parser.d.ts +5 -0
  240. package/lib/token/env-change-token-parser.js +190 -0
  241. package/lib/token/env-change-token-parser.js.map +1 -0
  242. package/lib/token/feature-ext-ack-parser.d.ts +5 -0
  243. package/lib/token/feature-ext-ack-parser.js +52 -0
  244. package/lib/token/feature-ext-ack-parser.js.map +1 -0
  245. package/lib/token/fedauth-info-parser.d.ts +5 -0
  246. package/lib/token/fedauth-info-parser.js +62 -0
  247. package/lib/token/fedauth-info-parser.js.map +1 -0
  248. package/lib/token/handler.d.ts +136 -0
  249. package/lib/token/handler.js +445 -0
  250. package/lib/token/handler.js.map +1 -0
  251. package/lib/token/helpers.d.ts +28 -0
  252. package/lib/token/helpers.js +205 -0
  253. package/lib/token/helpers.js.map +1 -0
  254. package/lib/token/infoerror-token-parser.d.ts +5 -0
  255. package/lib/token/infoerror-token-parser.js +80 -0
  256. package/lib/token/infoerror-token-parser.js.map +1 -0
  257. package/lib/token/loginack-token-parser.d.ts +5 -0
  258. package/lib/token/loginack-token-parser.js +75 -0
  259. package/lib/token/loginack-token-parser.js.map +1 -0
  260. package/lib/token/nbcrow-token-parser.d.ts +4 -0
  261. package/lib/token/nbcrow-token-parser.js +103 -0
  262. package/lib/token/nbcrow-token-parser.js.map +1 -0
  263. package/lib/token/order-token-parser.d.ts +5 -0
  264. package/lib/token/order-token-parser.js +34 -0
  265. package/lib/token/order-token-parser.js.map +1 -0
  266. package/lib/token/returnstatus-token-parser.d.ts +5 -0
  267. package/lib/token/returnstatus-token-parser.js +21 -0
  268. package/lib/token/returnstatus-token-parser.js.map +1 -0
  269. package/lib/token/returnvalue-token-parser.d.ts +4 -0
  270. package/lib/token/returnvalue-token-parser.js +93 -0
  271. package/lib/token/returnvalue-token-parser.js.map +1 -0
  272. package/lib/token/row-token-parser.d.ts +4 -0
  273. package/lib/token/row-token-parser.js +76 -0
  274. package/lib/token/row-token-parser.js.map +1 -0
  275. package/lib/token/sspi-token-parser.d.ts +5 -0
  276. package/lib/token/sspi-token-parser.js +42 -0
  277. package/lib/token/sspi-token-parser.js.map +1 -0
  278. package/lib/token/stream-parser.d.ts +34 -0
  279. package/lib/token/stream-parser.js +341 -0
  280. package/lib/token/stream-parser.js.map +1 -0
  281. package/lib/token/token-stream-parser.d.ts +15 -0
  282. package/lib/token/token-stream-parser.js +36 -0
  283. package/lib/token/token-stream-parser.js.map +1 -0
  284. package/lib/token/token.d.ts +312 -0
  285. package/lib/token/token.js +328 -0
  286. package/lib/token/token.js.map +1 -0
  287. package/lib/tracking-buffer/writable-tracking-buffer.d.ts +47 -0
  288. package/lib/tracking-buffer/writable-tracking-buffer.js +249 -0
  289. package/lib/tracking-buffer/writable-tracking-buffer.js.map +1 -0
  290. package/lib/transaction.d.ts +39 -0
  291. package/lib/transaction.js +137 -0
  292. package/lib/transaction.js.map +1 -0
  293. package/lib/transient-error-lookup.d.ts +3 -0
  294. package/lib/transient-error-lookup.js +19 -0
  295. package/lib/transient-error-lookup.js.map +1 -0
  296. package/lib/value-parser.d.ts +7 -0
  297. package/lib/value-parser.js +813 -0
  298. package/lib/value-parser.js.map +1 -0
  299. package/package.json +145 -0
  300. package/pull_request_template.md +9 -0
  301. package/tsconfig.build-types.json +15 -0
  302. package/tsconfig.json +30 -0
  303. package/types/js-md4.d.ts +7 -0
  304. package/types/native-duplexpair.d.ts +12 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":["SQLServerEncryptionType","exports","DescribeParameterEncryptionResultSet1","DescribeParameterEncryptionResultSet2","SQLServerStatementColumnEncryptionSetting"],"sources":["../../src/always-encrypted/types.ts"],"sourcesContent":["// This code is based on the `mssql-jdbc` library published under the conditions of MIT license.\n// Copyright (c) 2019 Microsoft Corporation\n\nimport { CEKEntry } from './cek-entry';\nimport { type BaseMetadata } from '../metadata-parser';\n\nexport interface EncryptionKeyInfo {\n encryptedKey: Buffer;\n dbId: number;\n keyId: number;\n keyVersion: number;\n mdVersion: Buffer;\n keyPath: string;\n keyStoreName: string;\n algorithmName: string;\n}\n\nexport enum SQLServerEncryptionType {\n Deterministic = 1,\n Randomized = 2,\n PlainText = 0,\n}\n\nexport interface EncryptionAlgorithm {\n encryptData: (plainText: Buffer) => Buffer;\n decryptData: (cipherText: Buffer) => Buffer;\n}\n\nexport interface CryptoMetadata {\n cekEntry?: CEKEntry;\n cipherAlgorithmId: number;\n cipherAlgorithmName?: string;\n normalizationRuleVersion: Buffer;\n encryptionKeyInfo?: EncryptionKeyInfo;\n ordinal: number;\n encryptionType: SQLServerEncryptionType;\n cipherAlgorithm?: EncryptionAlgorithm;\n baseTypeInfo?: BaseMetadata;\n}\n\nexport interface HashMap<T> {\n [hash: string]: T;\n}\n\n\n// Fields in the first resultset of \"sp_describe_parameter_encryption\"\n// We expect the server to return the fields in the resultset in the same order as mentioned below.\n// If the server changes the below order, then transparent parameter encryption will break.\nexport enum DescribeParameterEncryptionResultSet1 {\n KeyOrdinal,\n DbId,\n KeyId,\n KeyVersion,\n KeyMdVersion,\n EncryptedKey,\n ProviderName,\n KeyPath,\n KeyEncryptionAlgorithm\n}\n\n\n// Fields in the second resultset of \"sp_describe_parameter_encryption\"\n// We expect the server to return the fields in the resultset in the same order as mentioned below.\n// If the server changes the below order, then transparent parameter encryption will break.\nexport enum DescribeParameterEncryptionResultSet2 {\n ParameterOrdinal,\n ParameterName,\n ColumnEncryptionAlgorithm,\n ColumnEncrytionType,\n ColumnEncryptionKeyOrdinal,\n NormalizationRuleVersion\n}\n\nexport enum SQLServerStatementColumnEncryptionSetting {\n /**\n * if \"Column Encryption Setting=Enabled\" in the connection string, use Enabled. Otherwise, maps to Disabled.\n */\n UseConnectionSetting,\n /**\n * Enables TCE for the command. Overrides the connection level setting for this command.\n */\n Enabled,\n /**\n * Parameters will not be encrypted, only the ResultSet will be decrypted. This is an optimization for queries that\n * do not pass any encrypted input parameters. Overrides the connection level setting for this command.\n */\n ResultSetOnly,\n /**\n * Disables TCE for the command.Overrides the connection level setting for this command.\n */\n Disabled,\n}\n"],"mappings":";;;;;;AAAA;AACA;AAAA,IAgBYA,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,0BAAvBA,uBAAuB;EAAvBA,uBAAuB,CAAvBA,uBAAuB;EAAvBA,uBAAuB,CAAvBA,uBAAuB;EAAvBA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AA4BnC;AACA;AACA;AAAA,IACYE,qCAAqC,GAAAD,OAAA,CAAAC,qCAAA,0BAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAAA,OAArCA,qCAAqC;AAAA,OAajD;AACA;AACA;AAAA,IACYC,qCAAqC,GAAAF,OAAA,CAAAE,qCAAA,0BAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAArCA,qCAAqC,CAArCA,qCAAqC;EAAA,OAArCA,qCAAqC;AAAA;AAAA,IASrCC,yCAAyC,GAAAH,OAAA,CAAAG,yCAAA,0BAAzCA,yCAAyC;EACnD;AACF;AACA;EAHYA,yCAAyC,CAAzCA,yCAAyC;EAKnD;AACF;AACA;EAPYA,yCAAyC,CAAzCA,yCAAyC;EASnD;AACF;AACA;AACA;EAZYA,yCAAyC,CAAzCA,yCAAyC;EAcnD;AACF;AACA;EAhBYA,yCAAyC,CAAzCA,yCAAyC;EAAA,OAAzCA,yCAAyC;AAAA","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.shouldHonorAE = void 0;
7
+ var _types = require("./types");
8
+ // This code is based on the `mssql-jdbc` library published under the conditions of MIT license.
9
+ // Copyright (c) 2019 Microsoft Corporation
10
+
11
+ const shouldHonorAE = (stmtColumnEncryptionSetting, columnEncryptionSetting) => {
12
+ switch (stmtColumnEncryptionSetting) {
13
+ case _types.SQLServerStatementColumnEncryptionSetting.Disabled:
14
+ case _types.SQLServerStatementColumnEncryptionSetting.ResultSetOnly:
15
+ return false;
16
+ case _types.SQLServerStatementColumnEncryptionSetting.Enabled:
17
+ return true;
18
+ default:
19
+ return columnEncryptionSetting;
20
+ }
21
+ };
22
+ exports.shouldHonorAE = shouldHonorAE;
23
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfdHlwZXMiLCJyZXF1aXJlIiwic2hvdWxkSG9ub3JBRSIsInN0bXRDb2x1bW5FbmNyeXB0aW9uU2V0dGluZyIsImNvbHVtbkVuY3J5cHRpb25TZXR0aW5nIiwiU1FMU2VydmVyU3RhdGVtZW50Q29sdW1uRW5jcnlwdGlvblNldHRpbmciLCJEaXNhYmxlZCIsIlJlc3VsdFNldE9ubHkiLCJFbmFibGVkIiwiZXhwb3J0cyJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hbHdheXMtZW5jcnlwdGVkL3V0aWxzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIFRoaXMgY29kZSBpcyBiYXNlZCBvbiB0aGUgYG1zc3FsLWpkYmNgIGxpYnJhcnkgcHVibGlzaGVkIHVuZGVyIHRoZSBjb25kaXRpb25zIG9mIE1JVCBsaWNlbnNlLlxuLy8gQ29weXJpZ2h0IChjKSAyMDE5IE1pY3Jvc29mdCBDb3Jwb3JhdGlvblxuXG5pbXBvcnQgeyBTUUxTZXJ2ZXJTdGF0ZW1lbnRDb2x1bW5FbmNyeXB0aW9uU2V0dGluZyB9IGZyb20gJy4vdHlwZXMnO1xuXG5leHBvcnQgY29uc3Qgc2hvdWxkSG9ub3JBRSA9IChzdG10Q29sdW1uRW5jcnlwdGlvblNldHRpbmc6IFNRTFNlcnZlclN0YXRlbWVudENvbHVtbkVuY3J5cHRpb25TZXR0aW5nLCBjb2x1bW5FbmNyeXB0aW9uU2V0dGluZzogYm9vbGVhbik6IGJvb2xlYW4gPT4ge1xuICBzd2l0Y2ggKHN0bXRDb2x1bW5FbmNyeXB0aW9uU2V0dGluZykge1xuICAgIGNhc2UgU1FMU2VydmVyU3RhdGVtZW50Q29sdW1uRW5jcnlwdGlvblNldHRpbmcuRGlzYWJsZWQ6XG4gICAgY2FzZSBTUUxTZXJ2ZXJTdGF0ZW1lbnRDb2x1bW5FbmNyeXB0aW9uU2V0dGluZy5SZXN1bHRTZXRPbmx5OlxuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIGNhc2UgU1FMU2VydmVyU3RhdGVtZW50Q29sdW1uRW5jcnlwdGlvblNldHRpbmcuRW5hYmxlZDpcbiAgICAgIHJldHVybiB0cnVlO1xuICAgIGRlZmF1bHQ6XG4gICAgICByZXR1cm4gY29sdW1uRW5jcnlwdGlvblNldHRpbmc7XG4gIH1cbn07XG4iXSwibWFwcGluZ3MiOiI7Ozs7OztBQUdBLElBQUFBLE1BQUEsR0FBQUMsT0FBQTtBQUhBO0FBQ0E7O0FBSU8sTUFBTUMsYUFBYSxHQUFHQSxDQUFDQywyQkFBc0UsRUFBRUMsdUJBQWdDLEtBQWM7RUFDbEosUUFBUUQsMkJBQTJCO0lBQ2pDLEtBQUtFLGdEQUF5QyxDQUFDQyxRQUFRO0lBQ3ZELEtBQUtELGdEQUF5QyxDQUFDRSxhQUFhO01BQzFELE9BQU8sS0FBSztJQUNkLEtBQUtGLGdEQUF5QyxDQUFDRyxPQUFPO01BQ3BELE9BQU8sSUFBSTtJQUNiO01BQ0UsT0FBT0osdUJBQXVCO0VBQ2xDO0FBQ0YsQ0FBQztBQUFDSyxPQUFBLENBQUFQLGFBQUEsR0FBQUEsYUFBQSIsImlnbm9yZUxpc3QiOltdfQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["_types","require","shouldHonorAE","stmtColumnEncryptionSetting","columnEncryptionSetting","SQLServerStatementColumnEncryptionSetting","Disabled","ResultSetOnly","Enabled","exports"],"sources":["../../src/always-encrypted/utils.ts"],"sourcesContent":["// This code is based on the `mssql-jdbc` library published under the conditions of MIT license.\n// Copyright (c) 2019 Microsoft Corporation\n\nimport { SQLServerStatementColumnEncryptionSetting } from './types';\n\nexport const shouldHonorAE = (stmtColumnEncryptionSetting: SQLServerStatementColumnEncryptionSetting, columnEncryptionSetting: boolean): boolean => {\n switch (stmtColumnEncryptionSetting) {\n case SQLServerStatementColumnEncryptionSetting.Disabled:\n case SQLServerStatementColumnEncryptionSetting.ResultSetOnly:\n return false;\n case SQLServerStatementColumnEncryptionSetting.Enabled:\n return true;\n default:\n return columnEncryptionSetting;\n }\n};\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;;AAIO,MAAMC,aAAa,GAAGA,CAACC,2BAAsE,EAAEC,uBAAgC,KAAc;EAClJ,QAAQD,2BAA2B;IACjC,KAAKE,gDAAyC,CAACC,QAAQ;IACvD,KAAKD,gDAAyC,CAACE,aAAa;MAC1D,OAAO,KAAK;IACd,KAAKF,gDAAyC,CAACG,OAAO;MACpD,OAAO,IAAI;IACb;MACE,OAAOJ,uBAAuB;EAClC;AACF,CAAC;AAACK,OAAA,CAAAP,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import BulkLoad from './bulk-load';
2
+ export declare class BulkLoadPayload implements AsyncIterable<Buffer> {
3
+ bulkLoad: BulkLoad;
4
+ iterator: AsyncIterableIterator<Buffer>;
5
+ constructor(bulkLoad: BulkLoad);
6
+ [Symbol.asyncIterator](): AsyncIterableIterator<Buffer<ArrayBufferLike>>;
7
+ toString(indent?: string): string;
8
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BulkLoadPayload = void 0;
7
+ class BulkLoadPayload {
8
+ constructor(bulkLoad) {
9
+ this.bulkLoad = bulkLoad;
10
+
11
+ // We need to grab the iterator here so that `error` event handlers are set up
12
+ // as early as possible (and are not potentially lost).
13
+ this.iterator = this.bulkLoad.rowToPacketTransform[Symbol.asyncIterator]();
14
+ }
15
+ [Symbol.asyncIterator]() {
16
+ return this.iterator;
17
+ }
18
+ toString(indent = '') {
19
+ return indent + 'BulkLoad';
20
+ }
21
+ }
22
+ exports.BulkLoadPayload = BulkLoadPayload;
23
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJCdWxrTG9hZFBheWxvYWQiLCJjb25zdHJ1Y3RvciIsImJ1bGtMb2FkIiwiaXRlcmF0b3IiLCJyb3dUb1BhY2tldFRyYW5zZm9ybSIsIlN5bWJvbCIsImFzeW5jSXRlcmF0b3IiLCJ0b1N0cmluZyIsImluZGVudCIsImV4cG9ydHMiXSwic291cmNlcyI6WyIuLi9zcmMvYnVsay1sb2FkLXBheWxvYWQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IEJ1bGtMb2FkIGZyb20gJy4vYnVsay1sb2FkJztcblxuZXhwb3J0IGNsYXNzIEJ1bGtMb2FkUGF5bG9hZCBpbXBsZW1lbnRzIEFzeW5jSXRlcmFibGU8QnVmZmVyPiB7XG4gIGRlY2xhcmUgYnVsa0xvYWQ6IEJ1bGtMb2FkO1xuICBkZWNsYXJlIGl0ZXJhdG9yOiBBc3luY0l0ZXJhYmxlSXRlcmF0b3I8QnVmZmVyPjtcblxuICBjb25zdHJ1Y3RvcihidWxrTG9hZDogQnVsa0xvYWQpIHtcbiAgICB0aGlzLmJ1bGtMb2FkID0gYnVsa0xvYWQ7XG5cbiAgICAvLyBXZSBuZWVkIHRvIGdyYWIgdGhlIGl0ZXJhdG9yIGhlcmUgc28gdGhhdCBgZXJyb3JgIGV2ZW50IGhhbmRsZXJzIGFyZSBzZXQgdXBcbiAgICAvLyBhcyBlYXJseSBhcyBwb3NzaWJsZSAoYW5kIGFyZSBub3QgcG90ZW50aWFsbHkgbG9zdCkuXG4gICAgdGhpcy5pdGVyYXRvciA9IHRoaXMuYnVsa0xvYWQucm93VG9QYWNrZXRUcmFuc2Zvcm1bU3ltYm9sLmFzeW5jSXRlcmF0b3JdKCk7XG4gIH1cblxuICBbU3ltYm9sLmFzeW5jSXRlcmF0b3JdKCkge1xuICAgIHJldHVybiB0aGlzLml0ZXJhdG9yO1xuICB9XG5cbiAgdG9TdHJpbmcoaW5kZW50ID0gJycpIHtcbiAgICByZXR1cm4gaW5kZW50ICsgKCdCdWxrTG9hZCcpO1xuICB9XG59XG4iXSwibWFwcGluZ3MiOiI7Ozs7OztBQUVPLE1BQU1BLGVBQWUsQ0FBa0M7RUFJNURDLFdBQVdBLENBQUNDLFFBQWtCLEVBQUU7SUFDOUIsSUFBSSxDQUFDQSxRQUFRLEdBQUdBLFFBQVE7O0lBRXhCO0lBQ0E7SUFDQSxJQUFJLENBQUNDLFFBQVEsR0FBRyxJQUFJLENBQUNELFFBQVEsQ0FBQ0Usb0JBQW9CLENBQUNDLE1BQU0sQ0FBQ0MsYUFBYSxDQUFDLENBQUMsQ0FBQztFQUM1RTtFQUVBLENBQUNELE1BQU0sQ0FBQ0MsYUFBYSxJQUFJO0lBQ3ZCLE9BQU8sSUFBSSxDQUFDSCxRQUFRO0VBQ3RCO0VBRUFJLFFBQVFBLENBQUNDLE1BQU0sR0FBRyxFQUFFLEVBQUU7SUFDcEIsT0FBT0EsTUFBTSxHQUFJLFVBQVc7RUFDOUI7QUFDRjtBQUFDQyxPQUFBLENBQUFULGVBQUEsR0FBQUEsZUFBQSIsImlnbm9yZUxpc3QiOltdfQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-load-payload.js","names":["BulkLoadPayload","constructor","bulkLoad","iterator","rowToPacketTransform","Symbol","asyncIterator","toString","indent","exports"],"sources":["../src/bulk-load-payload.ts"],"sourcesContent":["import BulkLoad from './bulk-load';\n\nexport class BulkLoadPayload implements AsyncIterable<Buffer> {\n declare bulkLoad: BulkLoad;\n declare iterator: AsyncIterableIterator<Buffer>;\n\n constructor(bulkLoad: BulkLoad) {\n this.bulkLoad = bulkLoad;\n\n // We need to grab the iterator here so that `error` event handlers are set up\n // as early as possible (and are not potentially lost).\n this.iterator = this.bulkLoad.rowToPacketTransform[Symbol.asyncIterator]();\n }\n\n [Symbol.asyncIterator]() {\n return this.iterator;\n }\n\n toString(indent = '') {\n return indent + ('BulkLoad');\n }\n}\n"],"mappings":";;;;;;AAEO,MAAMA,eAAe,CAAkC;EAI5DC,WAAWA,CAACC,QAAkB,EAAE;IAC9B,IAAI,CAACA,QAAQ,GAAGA,QAAQ;;IAExB;IACA;IACA,IAAI,CAACC,QAAQ,GAAG,IAAI,CAACD,QAAQ,CAACE,oBAAoB,CAACC,MAAM,CAACC,aAAa,CAAC,CAAC,CAAC;EAC5E;EAEA,CAACD,MAAM,CAACC,aAAa,IAAI;IACvB,OAAO,IAAI,CAACH,QAAQ;EACtB;EAEAI,QAAQA,CAACC,MAAM,GAAG,EAAE,EAAE;IACpB,OAAOA,MAAM,GAAI,UAAW;EAC9B;AACF;AAACC,OAAA,CAAAT,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,275 @@
1
+ import { EventEmitter } from 'events';
2
+ import Connection, { type InternalConnectionOptions } from './connection';
3
+ import { Transform } from 'stream';
4
+ import { type DataType, type Parameter } from './data-type';
5
+ import { Collation } from './collation';
6
+ /**
7
+ * @private
8
+ */
9
+ interface InternalOptions {
10
+ checkConstraints: boolean;
11
+ fireTriggers: boolean;
12
+ keepNulls: boolean;
13
+ lockTable: boolean;
14
+ order: {
15
+ [columnName: string]: 'ASC' | 'DESC';
16
+ };
17
+ }
18
+ export interface Options {
19
+ /**
20
+ * Honors constraints during bulk load, using T-SQL
21
+ * [CHECK_CONSTRAINTS](https://technet.microsoft.com/en-us/library/ms186247(v=sql.105).aspx).
22
+ * (default: `false`)
23
+ */
24
+ checkConstraints?: InternalOptions['checkConstraints'] | undefined;
25
+ /**
26
+ * Honors insert triggers during bulk load, using the T-SQL [FIRE_TRIGGERS](https://technet.microsoft.com/en-us/library/ms187640(v=sql.105).aspx). (default: `false`)
27
+ */
28
+ fireTriggers?: InternalOptions['fireTriggers'] | undefined;
29
+ /**
30
+ * Honors null value passed, ignores the default values set on table, using T-SQL [KEEP_NULLS](https://msdn.microsoft.com/en-us/library/ms187887(v=sql.120).aspx). (default: `false`)
31
+ */
32
+ keepNulls?: InternalOptions['keepNulls'] | undefined;
33
+ /**
34
+ * Places a bulk update(BU) lock on table while performing bulk load, using T-SQL [TABLOCK](https://technet.microsoft.com/en-us/library/ms180876(v=sql.105).aspx). (default: `false`)
35
+ */
36
+ lockTable?: InternalOptions['lockTable'] | undefined;
37
+ /**
38
+ * Specifies the ordering of the data to possibly increase bulk insert performance, using T-SQL [ORDER](https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms177468(v=sql.105)). (default: `{}`)
39
+ */
40
+ order?: InternalOptions['order'] | undefined;
41
+ }
42
+ export type Callback =
43
+ /**
44
+ * A function which will be called after the [[BulkLoad]] finishes executing.
45
+ *
46
+ * @param rowCount the number of rows inserted
47
+ */
48
+ (err: Error | undefined | null, rowCount?: number) => void;
49
+ interface Column extends Parameter {
50
+ objName: string;
51
+ collation: Collation | undefined;
52
+ }
53
+ interface ColumnOptions {
54
+ output?: boolean;
55
+ /**
56
+ * For VarChar, NVarChar, VarBinary. Use length as `Infinity` for VarChar(max), NVarChar(max) and VarBinary(max).
57
+ */
58
+ length?: number;
59
+ /**
60
+ * For Numeric, Decimal.
61
+ */
62
+ precision?: number;
63
+ /**
64
+ * For Numeric, Decimal, Time, DateTime2, DateTimeOffset.
65
+ */
66
+ scale?: number;
67
+ /**
68
+ * If the name of the column is different from the name of the property found on `rowObj` arguments passed to [[addRow]], then you can use this option to specify the property name.
69
+ */
70
+ objName?: string;
71
+ /**
72
+ * Indicates whether the column accepts NULL values.
73
+ */
74
+ nullable?: boolean;
75
+ }
76
+ declare class RowTransform extends Transform {
77
+ /**
78
+ * @private
79
+ */
80
+ columnMetadataWritten: boolean;
81
+ /**
82
+ * @private
83
+ */
84
+ bulkLoad: BulkLoad;
85
+ /**
86
+ * @private
87
+ */
88
+ mainOptions: BulkLoad['options'];
89
+ /**
90
+ * @private
91
+ */
92
+ columns: BulkLoad['columns'];
93
+ /**
94
+ * @private
95
+ */
96
+ constructor(bulkLoad: BulkLoad);
97
+ /**
98
+ * @private
99
+ */
100
+ _transform(row: Array<unknown> | {
101
+ [colName: string]: unknown;
102
+ }, _encoding: string, callback: (error?: Error) => void): void;
103
+ /**
104
+ * @private
105
+ */
106
+ _flush(callback: () => void): void;
107
+ }
108
+ /**
109
+ * A BulkLoad instance is used to perform a bulk insert.
110
+ *
111
+ * Use [[Connection.newBulkLoad]] to create a new instance, and [[Connection.execBulkLoad]] to execute it.
112
+ *
113
+ * Example of BulkLoad Usages:
114
+ *
115
+ * ```js
116
+ * // optional BulkLoad options
117
+ * const options = { keepNulls: true };
118
+ *
119
+ * // instantiate - provide the table where you'll be inserting to, options and a callback
120
+ * const bulkLoad = connection.newBulkLoad('MyTable', options, (error, rowCount) => {
121
+ * console.log('inserted %d rows', rowCount);
122
+ * });
123
+ *
124
+ * // setup your columns - always indicate whether the column is nullable
125
+ * bulkLoad.addColumn('myInt', TYPES.Int, { nullable: false });
126
+ * bulkLoad.addColumn('myString', TYPES.NVarChar, { length: 50, nullable: true });
127
+ *
128
+ * // execute
129
+ * connection.execBulkLoad(bulkLoad, [
130
+ * { myInt: 7, myString: 'hello' },
131
+ * { myInt: 23, myString: 'world' }
132
+ * ]);
133
+ * ```
134
+ */
135
+ declare class BulkLoad extends EventEmitter {
136
+ /**
137
+ * @private
138
+ */
139
+ error: Error | undefined;
140
+ /**
141
+ * @private
142
+ */
143
+ canceled: boolean;
144
+ /**
145
+ * @private
146
+ */
147
+ executionStarted: boolean;
148
+ /**
149
+ * @private
150
+ */
151
+ streamingMode: boolean;
152
+ /**
153
+ * @private
154
+ */
155
+ table: string;
156
+ /**
157
+ * @private
158
+ */
159
+ timeout: number | undefined;
160
+ /**
161
+ * @private
162
+ */
163
+ options: InternalConnectionOptions;
164
+ /**
165
+ * @private
166
+ */
167
+ callback: Callback;
168
+ /**
169
+ * @private
170
+ */
171
+ columns: Array<Column>;
172
+ /**
173
+ * @private
174
+ */
175
+ columnsByName: {
176
+ [name: string]: Column;
177
+ };
178
+ /**
179
+ * @private
180
+ */
181
+ firstRowWritten: boolean;
182
+ /**
183
+ * @private
184
+ */
185
+ rowToPacketTransform: RowTransform;
186
+ /**
187
+ * @private
188
+ */
189
+ bulkOptions: InternalOptions;
190
+ /**
191
+ * @private
192
+ */
193
+ connection: Connection | undefined;
194
+ /**
195
+ * @private
196
+ */
197
+ rows: Array<any> | undefined;
198
+ /**
199
+ * @private
200
+ */
201
+ rst: Array<any> | undefined;
202
+ /**
203
+ * @private
204
+ */
205
+ rowCount: number | undefined;
206
+ collation: Collation | undefined;
207
+ /**
208
+ * @private
209
+ */
210
+ constructor(table: string, collation: Collation | undefined, connectionOptions: InternalConnectionOptions, { checkConstraints, fireTriggers, keepNulls, lockTable, order, }: Options, callback: Callback);
211
+ /**
212
+ * Adds a column to the bulk load.
213
+ *
214
+ * The column definitions should match the table you are trying to insert into.
215
+ * Attempting to call addColumn after the first row has been added will throw an exception.
216
+ *
217
+ * ```js
218
+ * bulkLoad.addColumn('MyIntColumn', TYPES.Int, { nullable: false });
219
+ * ```
220
+ *
221
+ * @param name The name of the column.
222
+ * @param type One of the supported `data types`.
223
+ * @param __namedParameters Additional column type information. At a minimum, `nullable` must be set to true or false.
224
+ * @param length For VarChar, NVarChar, VarBinary. Use length as `Infinity` for VarChar(max), NVarChar(max) and VarBinary(max).
225
+ * @param nullable Indicates whether the column accepts NULL values.
226
+ * @param objName If the name of the column is different from the name of the property found on `rowObj` arguments passed to [[addRow]] or [[Connection.execBulkLoad]], then you can use this option to specify the property name.
227
+ * @param precision For Numeric, Decimal.
228
+ * @param scale For Numeric, Decimal, Time, DateTime2, DateTimeOffset.
229
+ */
230
+ addColumn(name: string, type: DataType, { output, length, precision, scale, objName, nullable }: ColumnOptions): void;
231
+ /**
232
+ * @private
233
+ */
234
+ getOptionsSql(): string;
235
+ /**
236
+ * @private
237
+ */
238
+ getBulkInsertSql(): string;
239
+ /**
240
+ * This is simply a helper utility function which returns a `CREATE TABLE SQL` statement based on the columns added to the bulkLoad object.
241
+ * This may be particularly handy when you want to insert into a temporary table (a table which starts with `#`).
242
+ *
243
+ * ```js
244
+ * var sql = bulkLoad.getTableCreationSql();
245
+ * ```
246
+ *
247
+ * A side note on bulk inserting into temporary tables: if you want to access a local temporary table after executing the bulk load,
248
+ * you'll need to use the same connection and execute your requests using [[Connection.execSqlBatch]] instead of [[Connection.execSql]]
249
+ */
250
+ getTableCreationSql(): string;
251
+ /**
252
+ * @private
253
+ */
254
+ getColMetaData(): Buffer<ArrayBufferLike>;
255
+ /**
256
+ * Sets a timeout for this bulk load.
257
+ *
258
+ * ```js
259
+ * bulkLoad.setTimeout(timeout);
260
+ * ```
261
+ *
262
+ * @param timeout The number of milliseconds before the bulk load is considered failed, or 0 for no timeout.
263
+ * When no timeout is set for the bulk load, the [[ConnectionOptions.requestTimeout]] of the Connection is used.
264
+ */
265
+ setTimeout(timeout?: number): void;
266
+ /**
267
+ * @private
268
+ */
269
+ createDoneToken(): Buffer<ArrayBufferLike>;
270
+ /**
271
+ * @private
272
+ */
273
+ cancel(): void;
274
+ }
275
+ export default BulkLoad;