tedious 18.2.3 → 18.3.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.
package/appveyor.yml CHANGED
@@ -30,64 +30,38 @@ before_test:
30
30
  - sc config sqlbrowser start= auto
31
31
  - net start sqlbrowser
32
32
 
33
- - mkdir C:\Users\appveyor\.tedious
34
- - ps: >-
35
- Set-Content -Value $('{
36
- "config": {
37
- "server": "localhost",
38
- "authentication": {
39
- "type": "default",
40
- "options": {
41
- "userName": "sa",
42
- "password": "Password12!"
43
- }
44
- },
45
- "options": {
46
- "database": "master",
47
- "trustServerCertificate": true
48
- }
49
- },
50
-
51
- "ntlm": {
52
- "server": "localhost",
53
- "authentication": {
54
- "type": "ntlm",
55
- "options": {
56
- "userName": "' + $env:username + '",
57
- "password": "' + [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", '') + '",
58
- "domain": "' + $env:computername + '"
59
- }
60
- },
61
- "options": {
62
- "database": "master",
63
- "trustServerCertificate": true
64
- }
65
- }
66
- }') -Path C:\Users\appveyor\.tedious\test-connection.json
67
-
68
-
69
33
  test_script:
70
34
  - node --version
71
35
  - npm --version
72
36
 
73
- - cmd: |
74
- SET EXITVAL=0
37
+ - pwsh: |-
38
+ $ErrorActionPreference = "Stop"
39
+
40
+ npm run-script test
41
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
75
42
 
76
- npm run-script test || SET EXITVAL=1
43
+ Copy-Item -Force test/config.appveyor.ts test/config.ts
77
44
 
78
- SET TEDIOUS_TDS_VERSION=7_4
79
- npm run-script test-integration || SET EXITVAL=1
45
+ $env:NTLM_USERNAME = $env:USERNAME
46
+ $env:NTLM_PASSWORD = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", '')
47
+ $env:NTLM_DOMAIN = $env:COMPUTERNAME
80
48
 
81
- SET TEDIOUS_TDS_VERSION=7_3_B
82
- npm run-script test-integration || SET EXITVAL=1
49
+ $env:TEDIOUS_TDS_VERSION = '7_4'
50
+ npm run-script test-integration
51
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
83
52
 
84
- SET TEDIOUS_TDS_VERSION=7_3_A
85
- npm run-script test-integration || SET EXITVAL=1
53
+ $env:TEDIOUS_TDS_VERSION = '7_3_B'
54
+ npm run-script test-integration
55
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
86
56
 
87
- SET TEDIOUS_TDS_VERSION=7_2
88
- npm run-script test-integration || SET EXITVAL=1
57
+ $env:TEDIOUS_TDS_VERSION = '7_3_A'
58
+ npm run-script test-integration
59
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
89
60
 
90
- SET TEDIOUS_TDS_VERSION=7_1
91
- npm run-script test-integration || SET EXITVAL=1
61
+ $env:TEDIOUS_TDS_VERSION = '7_2'
62
+ npm run-script test-integration
63
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
92
64
 
93
- EXIT /B %EXITVAL%
65
+ $env:TEDIOUS_TDS_VERSION = '7_1'
66
+ npm run-script test-integration
67
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
@@ -7,6 +7,7 @@
7
7
  import * as tls from 'tls';
8
8
  import * as net from 'net';
9
9
  import { type SecureContextOptions } from 'tls';
10
+ import { type TokenCredential } from '@azure/core-auth';
10
11
  import BulkLoad, { type Options as BulkLoadOptions, type Callback as BulkLoadCallback } from './bulk-load';
11
12
  import Debug from './debug';
12
13
  import { EventEmitter } from 'events';
@@ -169,6 +170,16 @@ interface AzureActiveDirectoryServicePrincipalSecret {
169
170
  tenantId: string;
170
171
  };
171
172
  }
173
+ /** Structure that defines the options that are necessary to authenticate the Tedious.JS instance with an `@azure/identity` token credential. */
174
+ interface TokenCredentialAuthentication {
175
+ /** Unique designator for the type of authentication to be used. */
176
+ type: 'token-credential';
177
+ /** Set of configurations that are required or allowed with this authentication type. */
178
+ options: {
179
+ /** Credential object used to authenticate to the resource. */
180
+ credential: TokenCredential;
181
+ };
182
+ }
172
183
  interface NtlmAuthentication {
173
184
  type: 'ntlm';
174
185
  options: {
@@ -201,7 +212,7 @@ interface DefaultAuthentication {
201
212
  password?: string | undefined;
202
213
  };
203
214
  }
204
- export type ConnectionAuthentication = DefaultAuthentication | NtlmAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication;
215
+ export type ConnectionAuthentication = DefaultAuthentication | NtlmAuthentication | TokenCredentialAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication;
205
216
  interface InternalConnectionConfig {
206
217
  server: string;
207
218
  authentication: ConnectionAuthentication;
@@ -283,7 +294,7 @@ interface State {
283
294
  reconnect?(this: Connection): void;
284
295
  };
285
296
  }
286
- type Authentication = DefaultAuthentication | NtlmAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication;
297
+ type Authentication = DefaultAuthentication | NtlmAuthentication | TokenCredentialAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication;
287
298
  type AuthenticationType = Authentication['type'];
288
299
  export interface ConnectionConfiguration {
289
300
  /**
@@ -339,6 +350,7 @@ interface AuthenticationOptions {
339
350
  *
340
351
  * * `default`: [[DefaultAuthentication.options]]
341
352
  * * `ntlm` :[[NtlmAuthentication]]
353
+ * * `token-credential`: [[CredentialChainAuthentication.options]]
342
354
  * * `azure-active-directory-password` : [[AzureActiveDirectoryPasswordAuthentication.options]]
343
355
  * * `azure-active-directory-access-token` : [[AzureActiveDirectoryAccessTokenAuthentication.options]]
344
356
  * * `azure-active-directory-msi-vm` : [[AzureActiveDirectoryMsiVmAuthentication.options]]