@databricks/sql 1.5.0 → 1.6.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 (104) hide show
  1. package/dist/DBSQLClient.d.ts +15 -8
  2. package/dist/DBSQLClient.js +74 -81
  3. package/dist/DBSQLClient.js.map +1 -1
  4. package/dist/DBSQLOperation/FetchResultsHelper.d.ts +3 -3
  5. package/dist/DBSQLOperation/FetchResultsHelper.js +4 -3
  6. package/dist/DBSQLOperation/FetchResultsHelper.js.map +1 -1
  7. package/dist/DBSQLOperation/index.d.ts +10 -7
  8. package/dist/DBSQLOperation/index.js +110 -41
  9. package/dist/DBSQLOperation/index.js.map +1 -1
  10. package/dist/DBSQLParameter.d.ts +6 -2
  11. package/dist/DBSQLParameter.js +15 -1
  12. package/dist/DBSQLParameter.js.map +1 -1
  13. package/dist/DBSQLSession.d.ts +5 -6
  14. package/dist/DBSQLSession.js +66 -36
  15. package/dist/DBSQLSession.js.map +1 -1
  16. package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.d.ts +3 -3
  17. package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.js +3 -4
  18. package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.js.map +1 -1
  19. package/dist/connection/auth/DatabricksOAuth/OAuthManager.d.ts +6 -3
  20. package/dist/connection/auth/DatabricksOAuth/OAuthManager.js +27 -8
  21. package/dist/connection/auth/DatabricksOAuth/OAuthManager.js.map +1 -1
  22. package/dist/connection/auth/DatabricksOAuth/index.d.ts +4 -6
  23. package/dist/connection/auth/DatabricksOAuth/index.js +1 -1
  24. package/dist/connection/auth/DatabricksOAuth/index.js.map +1 -1
  25. package/dist/connection/auth/PlainHttpAuthentication.d.ts +6 -3
  26. package/dist/connection/auth/PlainHttpAuthentication.js +1 -0
  27. package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -1
  28. package/dist/connection/connections/HttpConnection.d.ts +16 -9
  29. package/dist/connection/connections/HttpConnection.js +60 -51
  30. package/dist/connection/connections/HttpConnection.js.map +1 -1
  31. package/dist/connection/connections/ThriftHttpConnection.d.ts +38 -0
  32. package/dist/connection/connections/ThriftHttpConnection.js +134 -0
  33. package/dist/connection/connections/ThriftHttpConnection.js.map +1 -0
  34. package/dist/connection/contracts/IAuthentication.d.ts +2 -2
  35. package/dist/connection/contracts/IConnectionOptions.d.ts +17 -19
  36. package/dist/connection/contracts/IConnectionProvider.d.ts +6 -3
  37. package/dist/contracts/IClientContext.d.ts +10 -0
  38. package/dist/{connection/contracts/IThriftConnection.js → contracts/IClientContext.js} +1 -1
  39. package/dist/contracts/IClientContext.js.map +1 -0
  40. package/dist/contracts/IDBSQLClient.d.ts +2 -0
  41. package/dist/contracts/IDBSQLSession.d.ts +1 -0
  42. package/dist/contracts/IDriver.d.ts +24 -0
  43. package/dist/contracts/IDriver.js +3 -0
  44. package/dist/contracts/IDriver.js.map +1 -0
  45. package/dist/errors/ParameterError.d.ts +2 -0
  46. package/dist/errors/ParameterError.js +6 -0
  47. package/dist/errors/ParameterError.js.map +1 -0
  48. package/dist/hive/HiveDriver.d.ts +8 -5
  49. package/dist/hive/HiveDriver.js +23 -23
  50. package/dist/hive/HiveDriver.js.map +1 -1
  51. package/dist/result/ArrowResult.d.ts +3 -1
  52. package/dist/result/ArrowResult.js +4 -2
  53. package/dist/result/ArrowResult.js.map +1 -1
  54. package/dist/result/CloudFetchResult.d.ts +2 -1
  55. package/dist/result/CloudFetchResult.js +5 -3
  56. package/dist/result/CloudFetchResult.js.map +1 -1
  57. package/dist/result/JsonResult.d.ts +3 -1
  58. package/dist/result/JsonResult.js +2 -1
  59. package/dist/result/JsonResult.js.map +1 -1
  60. package/dist/utils/index.d.ts +1 -2
  61. package/dist/utils/index.js +1 -3
  62. package/dist/utils/index.js.map +1 -1
  63. package/dist/version.d.ts +1 -1
  64. package/dist/version.js +1 -1
  65. package/package.json +2 -4
  66. package/dist/DBSQLOperation/OperationStatusHelper.d.ts +0 -16
  67. package/dist/DBSQLOperation/OperationStatusHelper.js +0 -138
  68. package/dist/DBSQLOperation/OperationStatusHelper.js.map +0 -1
  69. package/dist/connection/contracts/IThriftConnection.d.ts +0 -4
  70. package/dist/connection/contracts/IThriftConnection.js.map +0 -1
  71. package/dist/node_modules/thrift/LICENSE +0 -306
  72. package/dist/node_modules/thrift/README.md +0 -210
  73. package/dist/node_modules/thrift/lib/nodejs/README.md +0 -142
  74. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/binary.js +0 -168
  75. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/binary_protocol.js +0 -367
  76. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/browser.js +0 -49
  77. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/buffered_transport.js +0 -186
  78. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/compact_protocol.js +0 -915
  79. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/connection.js +0 -396
  80. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/create_client.js +0 -54
  81. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/framed_transport.js +0 -185
  82. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/header_protocol.js +0 -258
  83. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/header_transport.js +0 -341
  84. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js +0 -292
  85. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/index.js +0 -76
  86. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error.js +0 -32
  87. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/int64_util.js +0 -91
  88. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/json_parse.js +0 -299
  89. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/json_protocol.js +0 -799
  90. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/log.js +0 -87
  91. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/multiplexed_processor.js +0 -63
  92. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/multiplexed_protocol.js +0 -73
  93. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/protocol.js +0 -22
  94. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/server.js +0 -123
  95. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/thrift.js +0 -241
  96. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/transport.js +0 -22
  97. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/web_server.js +0 -567
  98. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/ws_connection.js +0 -286
  99. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/ws_transport.js +0 -206
  100. package/dist/node_modules/thrift/lib/nodejs/lib/thrift/xhr_connection.js +0 -280
  101. package/dist/node_modules/thrift/package.json +0 -72
  102. package/dist/utils/areHeadersEqual.d.ts +0 -2
  103. package/dist/utils/areHeadersEqual.js +0 -49
  104. package/dist/utils/areHeadersEqual.js.map +0 -1
@@ -1,12 +1,19 @@
1
- import IThriftConnection from '../contracts/IThriftConnection';
1
+ /// <reference types="node" />
2
+ import http from 'http';
3
+ import { HeadersInit } from 'node-fetch';
2
4
  import IConnectionProvider from '../contracts/IConnectionProvider';
3
5
  import IConnectionOptions from '../contracts/IConnectionOptions';
4
- export default class HttpConnection implements IConnectionProvider, IThriftConnection {
5
- private thrift;
6
- private connection;
7
- connect(options: IConnectionOptions): Promise<IThriftConnection>;
8
- getConnection(): any;
9
- isConnected(): boolean;
10
- private getNodeOptions;
11
- private addCookieHandler;
6
+ export default class HttpConnection implements IConnectionProvider {
7
+ private readonly options;
8
+ private headers;
9
+ private connection?;
10
+ private agent?;
11
+ constructor(options: IConnectionOptions);
12
+ setHeaders(headers: HeadersInit): void;
13
+ getAgent(): Promise<http.Agent>;
14
+ private getAgentDefaultOptions;
15
+ private createHttpAgent;
16
+ private createHttpsAgent;
17
+ private createProxyAgent;
18
+ getThriftConnection(): Promise<any>;
12
19
  }
@@ -15,67 +15,76 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const thrift_1 = __importDefault(require("thrift"));
16
16
  const https_1 = __importDefault(require("https"));
17
17
  const http_1 = __importDefault(require("http"));
18
+ const proxy_agent_1 = require("proxy-agent");
18
19
  const globalConfig_1 = __importDefault(require("../../globalConfig"));
20
+ const ThriftHttpConnection_1 = __importDefault(require("./ThriftHttpConnection"));
19
21
  class HttpConnection {
20
- constructor() {
21
- this.thrift = thrift_1.default;
22
+ constructor(options) {
23
+ this.headers = {};
24
+ this.options = options;
22
25
  }
23
- connect(options) {
24
- var _a, _b, _c, _d, _e, _f;
26
+ setHeaders(headers) {
27
+ var _a;
28
+ this.headers = headers;
29
+ (_a = this.connection) === null || _a === void 0 ? void 0 : _a.setHeaders(Object.assign(Object.assign({}, this.options.headers), this.headers));
30
+ }
31
+ getAgent() {
25
32
  return __awaiter(this, void 0, void 0, function* () {
26
- const agentOptions = {
27
- keepAlive: true,
28
- maxSockets: 5,
29
- keepAliveMsecs: 10000,
30
- timeout: (_b = (_a = options.options) === null || _a === void 0 ? void 0 : _a.socketTimeout) !== null && _b !== void 0 ? _b : globalConfig_1.default.socketTimeout,
31
- };
32
- const agent = ((_c = options.options) === null || _c === void 0 ? void 0 : _c.https)
33
- ? new https_1.default.Agent(Object.assign(Object.assign({}, agentOptions), { minVersion: 'TLSv1.2' }))
34
- : new http_1.default.Agent(agentOptions);
35
- const thriftOptions = Object.assign(Object.assign({ transport: thrift_1.default.TBufferedTransport, protocol: thrift_1.default.TBinaryProtocol }, options.options), { nodeOptions: Object.assign(Object.assign(Object.assign({ agent }, this.getNodeOptions(options.options || {})), (((_d = options.options) === null || _d === void 0 ? void 0 : _d.nodeOptions) || {})), { timeout: (_f = (_e = options.options) === null || _e === void 0 ? void 0 : _e.socketTimeout) !== null && _f !== void 0 ? _f : globalConfig_1.default.socketTimeout }) });
36
- this.connection = this.thrift.createHttpConnection(options.host, options.port, thriftOptions);
37
- this.addCookieHandler();
38
- return this;
33
+ if (!this.agent) {
34
+ if (this.options.proxy !== undefined) {
35
+ this.agent = this.createProxyAgent(this.options.proxy);
36
+ }
37
+ else {
38
+ this.agent = this.options.https ? this.createHttpsAgent() : this.createHttpAgent();
39
+ }
40
+ }
41
+ return this.agent;
39
42
  });
40
43
  }
41
- getConnection() {
42
- return this.connection;
44
+ getAgentDefaultOptions() {
45
+ var _a;
46
+ return {
47
+ keepAlive: true,
48
+ maxSockets: 5,
49
+ keepAliveMsecs: 10000,
50
+ timeout: (_a = this.options.socketTimeout) !== null && _a !== void 0 ? _a : globalConfig_1.default.socketTimeout,
51
+ };
52
+ }
53
+ createHttpAgent() {
54
+ const httpAgentOptions = this.getAgentDefaultOptions();
55
+ return new http_1.default.Agent(httpAgentOptions);
43
56
  }
44
- isConnected() {
45
- if (this.connection) {
46
- return true;
47
- }
48
- return false;
57
+ createHttpsAgent() {
58
+ const httpsAgentOptions = Object.assign(Object.assign({}, this.getAgentDefaultOptions()), { minVersion: 'TLSv1.2', rejectUnauthorized: false, ca: this.options.ca, cert: this.options.cert, key: this.options.key });
59
+ return new https_1.default.Agent(httpsAgentOptions);
49
60
  }
50
- getNodeOptions(options) {
51
- const { ca, cert, key, https: useHttps } = options;
52
- const nodeOptions = {};
53
- if (ca) {
54
- nodeOptions.ca = ca;
55
- }
56
- if (cert) {
57
- nodeOptions.cert = cert;
58
- }
59
- if (key) {
60
- nodeOptions.key = key;
61
- }
62
- if (useHttps) {
63
- nodeOptions.rejectUnauthorized = false;
64
- }
65
- return nodeOptions;
61
+ createProxyAgent(proxyOptions) {
62
+ var _a, _b, _c;
63
+ const proxyAuth = ((_a = proxyOptions.auth) === null || _a === void 0 ? void 0 : _a.username)
64
+ ? `${proxyOptions.auth.username}:${(_c = (_b = proxyOptions.auth) === null || _b === void 0 ? void 0 : _b.password) !== null && _c !== void 0 ? _c : ''}@`
65
+ : '';
66
+ const proxyUrl = `${proxyOptions.protocol}://${proxyAuth}${proxyOptions.host}:${proxyOptions.port}`;
67
+ const proxyProtocol = `${proxyOptions.protocol}:`;
68
+ return new proxy_agent_1.ProxyAgent(Object.assign(Object.assign({}, this.getAgentDefaultOptions()), { getProxyForUrl: () => proxyUrl, httpsAgent: this.createHttpsAgent(), httpAgent: this.createHttpAgent(), protocol: proxyProtocol }));
66
69
  }
67
- addCookieHandler() {
68
- const { responseCallback } = this.connection;
69
- this.connection.responseCallback = (response, ...rest) => {
70
- if (Array.isArray(response.headers['set-cookie'])) {
71
- const cookie = [this.connection.nodeOptions.headers.cookie];
72
- this.connection.nodeOptions.headers.cookie = cookie
73
- .concat(response.headers['set-cookie'])
74
- .filter(Boolean)
75
- .join(';');
70
+ getThriftConnection() {
71
+ var _a, _b;
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ if (!this.connection) {
74
+ const { options } = this;
75
+ const agent = yield this.getAgent();
76
+ this.connection = new ThriftHttpConnection_1.default({
77
+ url: `${options.https ? 'https' : 'http'}://${options.host}:${options.port}${(_a = options.path) !== null && _a !== void 0 ? _a : '/'}`,
78
+ transport: thrift_1.default.TBufferedTransport,
79
+ protocol: thrift_1.default.TBinaryProtocol,
80
+ }, {
81
+ agent,
82
+ timeout: (_b = options.socketTimeout) !== null && _b !== void 0 ? _b : globalConfig_1.default.socketTimeout,
83
+ headers: Object.assign(Object.assign({}, options.headers), this.headers),
84
+ });
76
85
  }
77
- responseCallback.call(this.connection, response, ...rest);
78
- };
86
+ return this.connection;
87
+ });
79
88
  }
80
89
  }
81
90
  exports.default = HttpConnection;
@@ -1 +1 @@
1
- {"version":3,"file":"HttpConnection.js","sourceRoot":"","sources":["../../../lib/connection/connections/HttpConnection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAC5B,kDAA0B;AAC1B,gDAA6C;AAK7C,sEAA8C;AAS9C,MAAqB,cAAc;IAAnC;QACU,WAAM,GAAG,gBAAM,CAAC;IAkF1B,CAAC;IA9EO,OAAO,CAAC,OAA2B;;;YACvC,MAAM,YAAY,GAAsB;gBACtC,SAAS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,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,MAAM,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,GAAG,MAAA,OAAO,CAAC,IAAI,mCAAI,GAAG,EAAE;oBAClG,SAAS,EAAE,gBAAM,CAAC,kBAAkB;oBACpC,QAAQ,EAAE,gBAAM,CAAC,eAAe;iBACjC,EACD;oBACE,KAAK;oBACL,OAAO,EAAE,MAAA,OAAO,CAAC,aAAa,mCAAI,sBAAY,CAAC,aAAa;oBAC5D,OAAO,kCACF,OAAO,CAAC,OAAO,GACf,IAAI,CAAC,OAAO,CAChB;iBACF,CACF,CAAC;aACH;YAED,OAAO,IAAI,CAAC,UAAU,CAAC;;KACxB;CACF;AApGD,iCAoGC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ This file is created using node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js as an example
3
+
4
+ The code relies on thrift internals, so be careful when upgrading `thrift` library
5
+ */
6
+ /// <reference types="node" />
7
+ /// <reference types="node" />
8
+ import { EventEmitter } from 'events';
9
+ import { TBufferedTransport, Thrift, TProtocol, TProtocolConstructor } from 'thrift';
10
+ import { RequestInit, HeadersInit, Response } from 'node-fetch';
11
+ export declare class THTTPException extends Thrift.TApplicationException {
12
+ readonly statusCode: unknown;
13
+ readonly response: Response;
14
+ constructor(response: Response);
15
+ }
16
+ type TTransportType = typeof TBufferedTransport;
17
+ interface ThriftHttpConnectionOptions {
18
+ url: string;
19
+ transport?: TTransportType;
20
+ protocol?: TProtocolConstructor;
21
+ }
22
+ type ThriftClient = {
23
+ _reqs: Record<number, (error: unknown, response?: unknown) => void>;
24
+ } & {
25
+ [key: string]: (input: TProtocol, mtype: Thrift.MessageType, seqId: number) => void;
26
+ };
27
+ export default class ThriftHttpConnection extends EventEmitter {
28
+ private readonly url;
29
+ private config;
30
+ private readonly transport;
31
+ private readonly protocol;
32
+ client?: ThriftClient;
33
+ constructor(options: ThriftHttpConnectionOptions, config?: RequestInit);
34
+ setHeaders(headers: HeadersInit): void;
35
+ write(data: Buffer, seqId: number): void;
36
+ private handleThriftResponse;
37
+ }
38
+ export {};
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ /**
3
+ This file is created using node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js as an example
4
+
5
+ The code relies on thrift internals, so be careful when upgrading `thrift` library
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || function (mod) {
24
+ if (mod && mod.__esModule) return mod;
25
+ var result = {};
26
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
27
+ __setModuleDefault(result, mod);
28
+ return result;
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.THTTPException = void 0;
35
+ const events_1 = require("events");
36
+ const thrift_1 = require("thrift");
37
+ const node_fetch_1 = __importStar(require("node-fetch"));
38
+ // @ts-expect-error TS7016: Could not find a declaration file for module
39
+ const input_buffer_underrun_error_1 = __importDefault(require("thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error"));
40
+ class THTTPException extends thrift_1.Thrift.TApplicationException {
41
+ constructor(response) {
42
+ super(thrift_1.Thrift.TApplicationExceptionType.PROTOCOL_ERROR, `Received a response with a bad HTTP status code: ${response.status}`);
43
+ this.statusCode = response.status;
44
+ this.response = response;
45
+ }
46
+ }
47
+ exports.THTTPException = THTTPException;
48
+ class ThriftHttpConnection extends events_1.EventEmitter {
49
+ constructor(options, config = {}) {
50
+ var _a, _b;
51
+ super();
52
+ this.url = options.url;
53
+ this.config = config;
54
+ this.transport = (_a = options.transport) !== null && _a !== void 0 ? _a : thrift_1.TBufferedTransport;
55
+ this.protocol = (_b = options.protocol) !== null && _b !== void 0 ? _b : thrift_1.TBinaryProtocol;
56
+ }
57
+ setHeaders(headers) {
58
+ this.config = Object.assign(Object.assign({}, this.config), { headers });
59
+ }
60
+ write(data, seqId) {
61
+ const requestConfig = Object.assign(Object.assign({}, this.config), { method: 'POST', headers: Object.assign(Object.assign({}, this.config.headers), { Connection: 'keep-alive', 'Content-Length': `${data.length}`, 'Content-Type': 'application/x-thrift' }), body: data });
62
+ (0, node_fetch_1.default)(this.url, requestConfig)
63
+ .then((response) => {
64
+ if (response.status !== 200) {
65
+ throw new THTTPException(response);
66
+ }
67
+ return response.buffer();
68
+ })
69
+ .then((buffer) => {
70
+ this.transport.receiver((transportWithData) => this.handleThriftResponse(transportWithData), seqId)(buffer);
71
+ })
72
+ .catch((error) => {
73
+ var _a;
74
+ if (error instanceof node_fetch_1.FetchError) {
75
+ if (error.type === 'request-timeout') {
76
+ error = new thrift_1.Thrift.TApplicationException(thrift_1.Thrift.TApplicationExceptionType.PROTOCOL_ERROR, 'Request timed out');
77
+ }
78
+ }
79
+ const defaultErrorHandler = (err) => {
80
+ this.emit('error', err);
81
+ };
82
+ if (this.client) {
83
+ const callback = (_a = this.client._reqs[seqId]) !== null && _a !== void 0 ? _a : defaultErrorHandler;
84
+ delete this.client._reqs[seqId];
85
+ callback(error);
86
+ }
87
+ else {
88
+ defaultErrorHandler(error);
89
+ }
90
+ });
91
+ }
92
+ handleThriftResponse(transportWithData) {
93
+ if (!this.client) {
94
+ throw new thrift_1.Thrift.TApplicationException(thrift_1.Thrift.TApplicationExceptionType.INTERNAL_ERROR, 'Client not available');
95
+ }
96
+ const Protocol = this.protocol;
97
+ const proto = new Protocol(transportWithData);
98
+ try {
99
+ // eslint-disable-next-line no-constant-condition
100
+ while (true) {
101
+ const header = proto.readMessageBegin();
102
+ const dummySeqId = header.rseqid * -1;
103
+ const { client } = this;
104
+ client._reqs[dummySeqId] = (err, success) => {
105
+ transportWithData.commitPosition();
106
+ const clientCallback = client._reqs[header.rseqid];
107
+ delete client._reqs[header.rseqid];
108
+ if (clientCallback) {
109
+ process.nextTick(() => {
110
+ clientCallback(err, success);
111
+ });
112
+ }
113
+ };
114
+ if (client[`recv_${header.fname}`]) {
115
+ client[`recv_${header.fname}`](proto, header.mtype, dummySeqId);
116
+ }
117
+ else {
118
+ delete client._reqs[dummySeqId];
119
+ throw new thrift_1.Thrift.TApplicationException(thrift_1.Thrift.TApplicationExceptionType.WRONG_METHOD_NAME, 'Received a response to an unknown RPC function');
120
+ }
121
+ }
122
+ }
123
+ catch (error) {
124
+ if (error instanceof input_buffer_underrun_error_1.default) {
125
+ transportWithData.rollbackPosition();
126
+ }
127
+ else {
128
+ throw error;
129
+ }
130
+ }
131
+ }
132
+ }
133
+ exports.default = ThriftHttpConnection;
134
+ //# sourceMappingURL=ThriftHttpConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThriftHttpConnection.js","sourceRoot":"","sources":["../../../lib/connection/connections/ThriftHttpConnection.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,mCAAsC;AACtC,mCAAkH;AAClH,yDAAmF;AACnF,wEAAwE;AACxE,2HAAgG;AAEhG,MAAa,cAAe,SAAQ,eAAM,CAAC,qBAAqB;IAK9D,YAAY,QAAkB;QAC5B,KAAK,CACH,eAAM,CAAC,yBAAyB,CAAC,cAAc,EAC/C,oDAAoD,Q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rift';
1
+ import { HeadersInit } from 'node-fetch';
2
2
  export default interface IAuthentication {
3
- authenticate(): Promise<HttpHeaders>;
3
+ authenticate(): Promise<HeadersInit>;
4
4
  }
@@ -1,25 +1,23 @@
1
1
  /// <reference types="node" />
2
- import { HttpHeaders } from 'thrift';
3
- export type Options = {
4
- socketTimeout?: number;
5
- username?: string;
6
- password?: string;
7
- ssl?: boolean;
8
- https?: boolean;
9
- debug?: boolean;
10
- max_attempts?: number;
11
- retry_max_delay?: number;
12
- connect_timeout?: number;
13
- timeout?: number;
14
- headers?: HttpHeaders;
2
+ import { HeadersInit } from 'node-fetch';
3
+ export interface ProxyOptions {
4
+ protocol: 'http' | 'https' | 'socks' | 'socks4' | 'socks4a' | 'socks5' | 'socks5h';
5
+ host: string;
6
+ port: number;
7
+ auth?: {
8
+ username?: string;
9
+ password?: string;
10
+ };
11
+ }
12
+ export default interface IConnectionOptions {
13
+ host: string;
14
+ port: number;
15
15
  path?: string;
16
+ https?: boolean;
17
+ headers?: HeadersInit;
18
+ socketTimeout?: number;
19
+ proxy?: ProxyOptions;
16
20
  ca?: Buffer | string;
17
21
  cert?: Buffer | string;
18
22
  key?: Buffer | string;
19
- [key: string]: any;
20
- };
21
- export default interface IConnectionOptions {
22
- host: string;
23
- port: number;
24
- options?: Options;
25
23
  }
@@ -1,5 +1,8 @@
1
- import IConnectionOptions from './IConnectionOptions';
2
- import IThriftConnection from './IThriftConnection';
1
+ /// <reference types="node" />
2
+ import http from 'http';
3
+ import { HeadersInit } from 'node-fetch';
3
4
  export default interface IConnectionProvider {
4
- connect(options: IConnectionOptions): Promise<IThriftConnection>;
5
+ getThriftConnection(): Promise<any>;
6
+ getAgent(): Promise<http.Agent>;
7
+ setHeaders(headers: HeadersInit): void;
5
8
  }
@@ -0,0 +1,10 @@
1
+ import IDBSQLLogger from './IDBSQLLogger';
2
+ import IDriver from './IDriver';
3
+ import IConnectionProvider from '../connection/contracts/IConnectionProvider';
4
+ import TCLIService from '../../thrift/TCLIService';
5
+ export default interface IClientContext {
6
+ getLogger(): IDBSQLLogger;
7
+ getConnectionProvider(): Promise<IConnectionProvider>;
8
+ getClient(): Promise<TCLIService.Client>;
9
+ getDriver(): Promise<IDriver>;
10
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IThriftConnection.js.map
3
+ //# sourceMappingURL=IClientContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IClientContext.js","sourceRoot":"","sources":["../../lib/contracts/IClientContext.ts"],"names":[],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  import IDBSQLLogger from './IDBSQLLogger';
2
2
  import IDBSQLSession from './IDBSQLSession';
3
3
  import IAuthentication from '../connection/contracts/IAuthentication';
4
+ import { ProxyOptions } from '../connection/contracts/IConnectionOptions';
4
5
  import OAuthPersistence from '../connection/auth/DatabricksOAuth/OAuthPersistence';
5
6
  export interface ClientOptions {
6
7
  logger?: IDBSQLLogger;
@@ -24,6 +25,7 @@ export type ConnectionOptions = {
24
25
  path: string;
25
26
  clientId?: string;
26
27
  socketTimeout?: number;
28
+ proxy?: ProxyOptions;
27
29
  } & AuthOptions;
28
30
  export interface OpenSessionRequest {
29
31
  initialCatalog?: string;
@@ -14,6 +14,7 @@ export type ExecuteStatementOptions = {
14
14
  useCloudFetch?: boolean;
15
15
  stagingAllowedLocalPath?: string | string[];
16
16
  namedParameters?: Record<string, DBSQLParameter | DBSQLParameterValue>;
17
+ ordinalParameters?: Array<DBSQLParameter | DBSQLParameterValue>;
17
18
  };
18
19
  export type TypeInfoRequest = {
19
20
  /**
@@ -0,0 +1,24 @@
1
+ import { TOpenSessionReq, TOpenSessionResp, TCloseSessionReq, TCloseSessionResp, TExecuteStatementReq, TExecuteStatementResp, TGetResultSetMetadataReq, TGetResultSetMetadataResp, TFetchResultsReq, TFetchResultsResp, TGetInfoReq, TGetInfoResp, TGetTypeInfoReq, TGetTypeInfoResp, TGetCatalogsReq, TGetCatalogsResp, TGetSchemasReq, TGetSchemasResp, TGetTablesReq, TGetTablesResp, TGetTableTypesReq, TGetTableTypesResp, TGetColumnsReq, TGetColumnsResp, TGetFunctionsReq, TGetFunctionsResp, TGetPrimaryKeysReq, TGetPrimaryKeysResp, TGetCrossReferenceReq, TGetCrossReferenceResp, TGetOperationStatusReq, TGetOperationStatusResp, TCancelOperationReq, TCancelOperationResp, TCloseOperationReq, TCloseOperationResp, TGetDelegationTokenReq, TGetDelegationTokenResp, TCancelDelegationTokenReq, TCancelDelegationTokenResp, TRenewDelegationTokenReq, TRenewDelegationTokenResp } from '../../thrift/TCLIService_types';
2
+ export default interface IDriver {
3
+ openSession(request: TOpenSessionReq): Promise<TOpenSessionResp>;
4
+ closeSession(request: TCloseSessionReq): Promise<TCloseSessionResp>;
5
+ executeStatement(request: TExecuteStatementReq): Promise<TExecuteStatementResp>;
6
+ getResultSetMetadata(request: TGetResultSetMetadataReq): Promise<TGetResultSetMetadataResp>;
7
+ fetchResults(request: TFetchResultsReq): Promise<TFetchResultsResp>;
8
+ getInfo(request: TGetInfoReq): Promise<TGetInfoResp>;
9
+ getTypeInfo(request: TGetTypeInfoReq): Promise<TGetTypeInfoResp>;
10
+ getCatalogs(request: TGetCatalogsReq): Promise<TGetCatalogsResp>;
11
+ getSchemas(request: TGetSchemasReq): Promise<TGetSchemasResp>;
12
+ getTables(request: TGetTablesReq): Promise<TGetTablesResp>;
13
+ getTableTypes(request: TGetTableTypesReq): Promise<TGetTableTypesResp>;
14
+ getColumns(request: TGetColumnsReq): Promise<TGetColumnsResp>;
15
+ getFunctions(request: TGetFunctionsReq): Promise<TGetFunctionsResp>;
16
+ getPrimaryKeys(request: TGetPrimaryKeysReq): Promise<TGetPrimaryKeysResp>;
17
+ getCrossReference(request: TGetCrossReferenceReq): Promise<TGetCrossReferenceResp>;
18
+ getOperationStatus(request: TGetOperationStatusReq): Promise<TGetOperationStatusResp>;
19
+ cancelOperation(request: TCancelOperationReq): Promise<TCancelOperationResp>;
20
+ closeOperation(request: TCloseOperationReq): Promise<TCloseOperationResp>;
21
+ getDelegationToken(request: TGetDelegationTokenReq): Promise<TGetDelegationTokenResp>;
22
+ cancelDelegationToken(request: TCancelDelegationTokenReq): Promise<TCancelDelegationTokenResp>;
23
+ renewDelegationToken(request: TRenewDelegationTokenReq): Promise<TRenewDelegationTokenResp>;
24
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IDriver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IDriver.js","sourceRoot":"","sources":["../../lib/contracts/IDriver.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export default class ParameterError extends Error {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class ParameterError extends Error {
4
+ }
5
+ exports.default = ParameterError;
6
+ //# sourceMappingURL=ParameterError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParameterError.js","sourceRoot":"","sources":["../../lib/errors/ParameterError.ts"],"names":[],"mappings":";;AAAA,MAAqB,cAAe,SAAQ,KAAK;CAAG;AAApD,iCAAoD"}
@@ -1,9 +1,12 @@
1
- import TCLIService from '../../thrift/TCLIService';
2
1
  import { TOpenSessionReq, TCloseSessionReq, TExecuteStatementReq, TGetResultSetMetadataReq, TFetchResultsReq, TGetInfoReq, TGetTypeInfoReq, TGetCatalogsReq, TGetSchemasReq, TGetTablesReq, TGetTableTypesReq, TGetColumnsReq, TGetFunctionsReq, TGetPrimaryKeysReq, TGetCrossReferenceReq, TGetOperationStatusReq, TCancelOperationReq, TCloseOperationReq, TGetDelegationTokenReq, TCancelDelegationTokenReq, TRenewDelegationTokenReq } from '../../thrift/TCLIService_types';
3
- export type ClientFactory = () => Promise<TCLIService.Client>;
4
- export default class HiveDriver {
5
- private readonly clientFactory;
6
- constructor(clientFactory: ClientFactory);
2
+ import IDriver from '../contracts/IDriver';
3
+ import IClientContext from '../contracts/IClientContext';
4
+ export interface HiveDriverOptions {
5
+ context: IClientContext;
6
+ }
7
+ export default class HiveDriver implements IDriver {
8
+ private readonly context;
9
+ constructor(options: HiveDriverOptions);
7
10
  openSession(request: TOpenSessionReq): Promise<import("../../thrift/TCLIService_types").TOpenSessionResp>;
8
11
  closeSession(request: TCloseSessionReq): Promise<import("../../thrift/TCLIService_types").TCloseSessionResp>;
9
12
  executeStatement(request: TExecuteStatementReq): Promise<import("../../thrift/TCLIService_types").TExecuteStatementResp>;