@databricks/sql 0.1.8-beta.1 → 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 (253) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/NOTICE +35 -0
  3. package/README.md +41 -20
  4. package/dist/DBSQLClient.d.ts +34 -39
  5. package/dist/DBSQLClient.js +137 -98
  6. package/dist/DBSQLClient.js.map +1 -1
  7. package/dist/DBSQLLogger.d.ts +12 -0
  8. package/dist/DBSQLLogger.js +43 -0
  9. package/dist/DBSQLLogger.js.map +1 -0
  10. package/dist/DBSQLOperation/CompleteOperationHelper.d.ts +13 -0
  11. package/dist/DBSQLOperation/CompleteOperationHelper.js +61 -0
  12. package/dist/DBSQLOperation/CompleteOperationHelper.js.map +1 -0
  13. package/dist/DBSQLOperation/FetchResultsHelper.d.ts +14 -0
  14. package/dist/DBSQLOperation/FetchResultsHelper.js +79 -0
  15. package/dist/DBSQLOperation/FetchResultsHelper.js.map +1 -0
  16. package/dist/DBSQLOperation/OperationStatusHelper.d.ts +17 -0
  17. package/dist/DBSQLOperation/OperationStatusHelper.js +115 -0
  18. package/dist/DBSQLOperation/OperationStatusHelper.js.map +1 -0
  19. package/dist/DBSQLOperation/SchemaHelper.d.ts +10 -0
  20. package/dist/DBSQLOperation/SchemaHelper.js +39 -0
  21. package/dist/DBSQLOperation/SchemaHelper.js.map +1 -0
  22. package/dist/DBSQLOperation/getResult.d.ts +2 -0
  23. package/dist/DBSQLOperation/getResult.js +19 -0
  24. package/dist/DBSQLOperation/getResult.js.map +1 -0
  25. package/dist/DBSQLOperation/index.d.ts +55 -0
  26. package/dist/DBSQLOperation/index.js +139 -0
  27. package/dist/DBSQLOperation/index.js.map +1 -0
  28. package/dist/DBSQLSession.d.ts +99 -0
  29. package/dist/DBSQLSession.js +187 -0
  30. package/dist/DBSQLSession.js.map +1 -0
  31. package/dist/connection/auth/NoSaslAuthentication.d.ts +2 -2
  32. package/dist/connection/auth/NoSaslAuthentication.js +9 -9
  33. package/dist/connection/auth/NoSaslAuthentication.js.map +1 -1
  34. package/dist/connection/auth/PlainHttpAuthentication.d.ts +2 -2
  35. package/dist/connection/auth/PlainHttpAuthentication.js +9 -21
  36. package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -1
  37. package/dist/connection/auth/helpers/SaslPackageFactory.js +5 -9
  38. package/dist/connection/auth/helpers/SaslPackageFactory.js.map +1 -1
  39. package/dist/connection/connections/HttpConnection.d.ts +4 -4
  40. package/dist/connection/connections/HttpConnection.js +42 -47
  41. package/dist/connection/connections/HttpConnection.js.map +1 -1
  42. package/dist/connection/contracts/IAuthentication.d.ts +1 -1
  43. package/dist/connection/transports/HttpTransport.d.ts +1 -1
  44. package/dist/connection/transports/HttpTransport.js +16 -31
  45. package/dist/connection/transports/HttpTransport.js.map +1 -1
  46. package/dist/contracts/IDBSQLClient.d.ts +21 -0
  47. package/dist/contracts/{IHiveClient.js → IDBSQLClient.js} +1 -1
  48. package/dist/contracts/IDBSQLClient.js.map +1 -0
  49. package/dist/contracts/IDBSQLLogger.d.ts +13 -0
  50. package/dist/contracts/IDBSQLLogger.js +11 -0
  51. package/dist/contracts/IDBSQLLogger.js.map +1 -0
  52. package/dist/contracts/{IHiveSession.d.ts → IDBSQLSession.d.ts} +59 -45
  53. package/dist/contracts/{IHiveSession.js → IDBSQLSession.js} +1 -1
  54. package/dist/contracts/IDBSQLSession.js.map +1 -0
  55. package/dist/contracts/IOperation.d.ts +26 -23
  56. package/dist/dto/InfoValue.d.ts +5 -3
  57. package/dist/dto/InfoValue.js +11 -14
  58. package/dist/dto/InfoValue.js.map +1 -1
  59. package/dist/dto/Status.js +9 -10
  60. package/dist/dto/Status.js.map +1 -1
  61. package/dist/errors/AuthenticationError.d.ts +1 -1
  62. package/dist/errors/AuthenticationError.js +3 -23
  63. package/dist/errors/AuthenticationError.js.map +1 -1
  64. package/dist/errors/HiveDriverError.js +2 -22
  65. package/dist/errors/HiveDriverError.js.map +1 -1
  66. package/dist/errors/OperationStateError.d.ts +4 -4
  67. package/dist/errors/OperationStateError.js +6 -24
  68. package/dist/errors/OperationStateError.js.map +1 -1
  69. package/dist/errors/StatusError.d.ts +2 -2
  70. package/dist/errors/StatusError.js +3 -4
  71. package/dist/errors/StatusError.js.map +1 -1
  72. package/dist/factory/StatusFactory.d.ts +2 -4
  73. package/dist/factory/StatusFactory.js +16 -21
  74. package/dist/factory/StatusFactory.js.map +1 -1
  75. package/dist/hive/Commands/BaseCommand.d.ts +3 -4
  76. package/dist/hive/Commands/BaseCommand.js +10 -12
  77. package/dist/hive/Commands/BaseCommand.js.map +1 -1
  78. package/dist/hive/Commands/CancelDelegationTokenCommand.d.ts +3 -10
  79. package/dist/hive/Commands/CancelDelegationTokenCommand.js +7 -26
  80. package/dist/hive/Commands/CancelDelegationTokenCommand.js.map +1 -1
  81. package/dist/hive/Commands/CancelOperationCommand.d.ts +3 -9
  82. package/dist/hive/Commands/CancelOperationCommand.js +7 -26
  83. package/dist/hive/Commands/CancelOperationCommand.js.map +1 -1
  84. package/dist/hive/Commands/CloseOperationCommand.d.ts +3 -9
  85. package/dist/hive/Commands/CloseOperationCommand.js +7 -26
  86. package/dist/hive/Commands/CloseOperationCommand.js.map +1 -1
  87. package/dist/hive/Commands/CloseSessionCommand.d.ts +3 -9
  88. package/dist/hive/Commands/CloseSessionCommand.js +7 -26
  89. package/dist/hive/Commands/CloseSessionCommand.js.map +1 -1
  90. package/dist/hive/Commands/ExecuteStatementCommand.d.ts +3 -15
  91. package/dist/hive/Commands/ExecuteStatementCommand.js +7 -26
  92. package/dist/hive/Commands/ExecuteStatementCommand.js.map +1 -1
  93. package/dist/hive/Commands/FetchResultsCommand.d.ts +4 -16
  94. package/dist/hive/Commands/FetchResultsCommand.js +10 -26
  95. package/dist/hive/Commands/FetchResultsCommand.js.map +1 -1
  96. package/dist/hive/Commands/GetCatalogsCommand.d.ts +3 -10
  97. package/dist/hive/Commands/GetCatalogsCommand.js +7 -26
  98. package/dist/hive/Commands/GetCatalogsCommand.js.map +1 -1
  99. package/dist/hive/Commands/GetColumnsCommand.d.ts +3 -14
  100. package/dist/hive/Commands/GetColumnsCommand.js +7 -26
  101. package/dist/hive/Commands/GetColumnsCommand.js.map +1 -1
  102. package/dist/hive/Commands/GetCrossReferenceCommand.d.ts +3 -16
  103. package/dist/hive/Commands/GetCrossReferenceCommand.js +7 -26
  104. package/dist/hive/Commands/GetCrossReferenceCommand.js.map +1 -1
  105. package/dist/hive/Commands/GetDelegationTokenCommand.d.ts +3 -12
  106. package/dist/hive/Commands/GetDelegationTokenCommand.js +7 -26
  107. package/dist/hive/Commands/GetDelegationTokenCommand.js.map +1 -1
  108. package/dist/hive/Commands/GetFunctionsCommand.d.ts +3 -13
  109. package/dist/hive/Commands/GetFunctionsCommand.js +7 -26
  110. package/dist/hive/Commands/GetFunctionsCommand.js.map +1 -1
  111. package/dist/hive/Commands/GetInfoCommand.d.ts +3 -14
  112. package/dist/hive/Commands/GetInfoCommand.js +7 -26
  113. package/dist/hive/Commands/GetInfoCommand.js.map +1 -1
  114. package/dist/hive/Commands/GetOperationStatusCommand.d.ts +3 -21
  115. package/dist/hive/Commands/GetOperationStatusCommand.js +7 -26
  116. package/dist/hive/Commands/GetOperationStatusCommand.js.map +1 -1
  117. package/dist/hive/Commands/GetPrimaryKeysCommand.d.ts +3 -13
  118. package/dist/hive/Commands/GetPrimaryKeysCommand.js +7 -26
  119. package/dist/hive/Commands/GetPrimaryKeysCommand.js.map +1 -1
  120. package/dist/hive/Commands/GetResultSetMetadataCommand.d.ts +3 -10
  121. package/dist/hive/Commands/GetResultSetMetadataCommand.js +7 -26
  122. package/dist/hive/Commands/GetResultSetMetadataCommand.js.map +1 -1
  123. package/dist/hive/Commands/GetSchemasCommand.d.ts +3 -12
  124. package/dist/hive/Commands/GetSchemasCommand.js +7 -26
  125. package/dist/hive/Commands/GetSchemasCommand.js.map +1 -1
  126. package/dist/hive/Commands/GetTableTypesCommand.d.ts +3 -10
  127. package/dist/hive/Commands/GetTableTypesCommand.js +7 -26
  128. package/dist/hive/Commands/GetTableTypesCommand.js.map +1 -1
  129. package/dist/hive/Commands/GetTablesCommand.d.ts +3 -14
  130. package/dist/hive/Commands/GetTablesCommand.js +7 -26
  131. package/dist/hive/Commands/GetTablesCommand.js.map +1 -1
  132. package/dist/hive/Commands/GetTypeInfoCommand.d.ts +3 -10
  133. package/dist/hive/Commands/GetTypeInfoCommand.js +7 -26
  134. package/dist/hive/Commands/GetTypeInfoCommand.js.map +1 -1
  135. package/dist/hive/Commands/OpenSessionCommand.d.ts +9 -28
  136. package/dist/hive/Commands/OpenSessionCommand.js +16 -26
  137. package/dist/hive/Commands/OpenSessionCommand.js.map +1 -1
  138. package/dist/hive/Commands/RenewDelegationTokenCommand.d.ts +3 -10
  139. package/dist/hive/Commands/RenewDelegationTokenCommand.js +7 -26
  140. package/dist/hive/Commands/RenewDelegationTokenCommand.js.map +1 -1
  141. package/dist/hive/HiveDriver.d.ts +24 -49
  142. package/dist/hive/HiveDriver.js +87 -99
  143. package/dist/hive/HiveDriver.js.map +1 -1
  144. package/dist/hive/Types/index.d.ts +7 -218
  145. package/dist/hive/Types/index.js +11 -2
  146. package/dist/hive/Types/index.js.map +1 -1
  147. package/dist/index.d.ts +16 -16
  148. package/dist/index.js +19 -51
  149. package/dist/index.js.map +1 -1
  150. package/dist/result/IOperationResult.d.ts +0 -2
  151. package/dist/result/JsonResult.d.ts +5 -8
  152. package/dist/result/JsonResult.js +81 -99
  153. package/dist/result/JsonResult.js.map +1 -1
  154. package/dist/result/NullResult.d.ts +1 -3
  155. package/dist/result/NullResult.js +4 -8
  156. package/dist/result/NullResult.js.map +1 -1
  157. package/dist/utils/buildUserAgentString.d.ts +1 -0
  158. package/dist/utils/buildUserAgentString.js +25 -0
  159. package/dist/utils/buildUserAgentString.js.map +1 -0
  160. package/dist/utils/definedOrError.d.ts +1 -0
  161. package/dist/utils/definedOrError.js +10 -0
  162. package/dist/utils/definedOrError.js.map +1 -0
  163. package/dist/utils/formatProgress.d.ts +9 -0
  164. package/dist/utils/formatProgress.js +24 -0
  165. package/dist/utils/formatProgress.js.map +1 -0
  166. package/dist/utils/index.d.ts +4 -0
  167. package/dist/utils/index.js +37 -0
  168. package/dist/utils/index.js.map +1 -0
  169. package/package.json +28 -7
  170. package/thrift/TCLIService.d.ts +196 -0
  171. package/thrift/{gen-nodejs/TCLIService.js → TCLIService.js} +1 -397
  172. package/thrift/TCLIService_types.d.ts +947 -0
  173. package/thrift/{gen-nodejs/TCLIService_types.js → TCLIService_types.js} +2830 -516
  174. package/.gitattributes +0 -32
  175. package/CONTRIBUTING.md +0 -55
  176. package/dist/HiveClient.d.ts +0 -35
  177. package/dist/HiveClient.js +0 -156
  178. package/dist/HiveClient.js.map +0 -1
  179. package/dist/HiveOperation.d.ts +0 -65
  180. package/dist/HiveOperation.js +0 -190
  181. package/dist/HiveOperation.js.map +0 -1
  182. package/dist/HiveSession.d.ts +0 -30
  183. package/dist/HiveSession.js +0 -197
  184. package/dist/HiveSession.js.map +0 -1
  185. package/dist/contracts/IHiveClient.d.ts +0 -10
  186. package/dist/contracts/IHiveClient.js.map +0 -1
  187. package/dist/contracts/IHiveSession.js.map +0 -1
  188. package/dist/hive/Commands/GetQueryIdCommand.d.ts +0 -11
  189. package/dist/hive/Commands/GetQueryIdCommand.js +0 -34
  190. package/dist/hive/Commands/GetQueryIdCommand.js.map +0 -1
  191. package/dist/hive/Commands/SetClientInfoCommand.d.ts +0 -12
  192. package/dist/hive/Commands/SetClientInfoCommand.js +0 -34
  193. package/dist/hive/Commands/SetClientInfoCommand.js.map +0 -1
  194. package/dist/utils/GetResult.d.ts +0 -16
  195. package/dist/utils/GetResult.js +0 -38
  196. package/dist/utils/GetResult.js.map +0 -1
  197. package/dist/utils/HiveUtils.d.ts +0 -11
  198. package/dist/utils/HiveUtils.js +0 -39
  199. package/dist/utils/HiveUtils.js.map +0 -1
  200. package/dist/utils/ProgressUpdateTransformer.d.ts +0 -8
  201. package/dist/utils/ProgressUpdateTransformer.js +0 -33
  202. package/dist/utils/ProgressUpdateTransformer.js.map +0 -1
  203. package/dist/utils/WaitUntilReady.d.ts +0 -16
  204. package/dist/utils/WaitUntilReady.js +0 -120
  205. package/dist/utils/WaitUntilReady.js.map +0 -1
  206. package/docs/readme.md +0 -227
  207. package/docs/troubleshooting.md +0 -84
  208. package/examples/data_types.js +0 -173
  209. package/examples/repl +0 -106
  210. package/examples/session.js +0 -55
  211. package/examples/usage.js +0 -18
  212. package/nyc.config.js +0 -8
  213. package/tests/e2e/data_types.test.js +0 -353
  214. package/tests/e2e/utils/config.js +0 -20
  215. package/tests/e2e/utils/logger.js +0 -22
  216. package/tests/unit/HiveClient.test.js +0 -153
  217. package/tests/unit/HiveOperation.test.js +0 -340
  218. package/tests/unit/HiveSession.test.js +0 -146
  219. package/tests/unit/connection/auth/PlainHttpAuthentication.test.js +0 -44
  220. package/tests/unit/connection/connections/HttpConnection.test.js +0 -141
  221. package/tests/unit/dto/InfoValue.test.js +0 -50
  222. package/tests/unit/factory/StatusFactory.test.js +0 -62
  223. package/tests/unit/hive/HiveDriver.test.js +0 -115
  224. package/tests/unit/hive/commands/CancelDelegationTokenCommand.test.js +0 -43
  225. package/tests/unit/hive/commands/CancelOperationCommand.test.js +0 -45
  226. package/tests/unit/hive/commands/CloseOperationCommand.test.js +0 -45
  227. package/tests/unit/hive/commands/CloseSessionCommand.test.js +0 -38
  228. package/tests/unit/hive/commands/ExecuteStatementCommand.test.js +0 -54
  229. package/tests/unit/hive/commands/FetchResultsCommand.test.js +0 -59
  230. package/tests/unit/hive/commands/GetCatalogsCommand.test.js +0 -50
  231. package/tests/unit/hive/commands/GetColumnsCommand.test.js +0 -50
  232. package/tests/unit/hive/commands/GetCrossReferenceCommand.test.js +0 -56
  233. package/tests/unit/hive/commands/GetDelegationTokenCommand.test.js +0 -45
  234. package/tests/unit/hive/commands/GetFunctionsCommand.test.js +0 -50
  235. package/tests/unit/hive/commands/GetInfoCommand.test.js +0 -51
  236. package/tests/unit/hive/commands/GetOperationStatusCommand.test.js +0 -63
  237. package/tests/unit/hive/commands/GetPrimaryKeysCommand.test.js +0 -50
  238. package/tests/unit/hive/commands/GetQueryIdCommand.test.js +0 -42
  239. package/tests/unit/hive/commands/GetResultSetMetadataCommand.test.js +0 -54
  240. package/tests/unit/hive/commands/GetSchemasCommand.test.js +0 -52
  241. package/tests/unit/hive/commands/GetTableTypesCommand.test.js +0 -50
  242. package/tests/unit/hive/commands/GetTablesCommand.test.js +0 -54
  243. package/tests/unit/hive/commands/GetTypeInfoCommand.test.js +0 -50
  244. package/tests/unit/hive/commands/OpenSessionCommand.test.js +0 -43
  245. package/tests/unit/hive/commands/RenewDelegationTokenCommand.test.js +0 -43
  246. package/tests/unit/hive/commands/SetClientInfoCommand.test.js +0 -45
  247. package/tests/unit/result/JsonResult.test.js +0 -295
  248. package/tests/unit/utils/GetResult.test.js +0 -30
  249. package/tests/unit/utils/HiveUtils.test.js +0 -60
  250. package/tests/unit/utils/ProgressUpdateTransformer.test.js +0 -28
  251. package/tests/unit/utils/WaitUntilReady.test.js +0 -105
  252. package/thrift/TCLIService.thrift +0 -1299
  253. package/tsconfig.json +0 -13
@@ -0,0 +1,99 @@
1
+ import { TSessionHandle } from '../thrift/TCLIService_types';
2
+ import HiveDriver from './hive/HiveDriver';
3
+ import IDBSQLSession, { ExecuteStatementOptions, TypeInfoRequest, CatalogsRequest, SchemasRequest, TablesRequest, TableTypesRequest, ColumnsRequest, FunctionsRequest, PrimaryKeysRequest, CrossReferenceRequest } from './contracts/IDBSQLSession';
4
+ import IOperation from './contracts/IOperation';
5
+ import Status from './dto/Status';
6
+ import InfoValue from './dto/InfoValue';
7
+ import IDBSQLLogger from './contracts/IDBSQLLogger';
8
+ export default class DBSQLSession implements IDBSQLSession {
9
+ private driver;
10
+ private sessionHandle;
11
+ private statusFactory;
12
+ private logger;
13
+ constructor(driver: HiveDriver, sessionHandle: TSessionHandle, logger: IDBSQLLogger);
14
+ getId(): string;
15
+ /**
16
+ * Fetches info
17
+ * @public
18
+ * @param infoType - One of the values TCLIService_types.TGetInfoType
19
+ * @returns Value corresponding to info type requested
20
+ * @example
21
+ * const response = await session.getInfo(thrift.TCLIService_types.TGetInfoType.CLI_DBMS_VER);
22
+ */
23
+ getInfo(infoType: number): Promise<InfoValue>;
24
+ /**
25
+ * Executes statement
26
+ * @public
27
+ * @param statement - SQL statement to be executed
28
+ * @param options - maxRows field is used to specify Direct Results
29
+ * @returns DBSQLOperation
30
+ * @example
31
+ * const operation = await session.executeStatement(query, { runAsync: true });
32
+ */
33
+ executeStatement(statement: string, options?: ExecuteStatementOptions): Promise<IOperation>;
34
+ /**
35
+ * Information about supported data types
36
+ * @public
37
+ * @param request
38
+ * @returns DBSQLOperation
39
+ */
40
+ getTypeInfo(request?: TypeInfoRequest): Promise<IOperation>;
41
+ /**
42
+ * Get list of catalogs
43
+ * @public
44
+ * @param request
45
+ * @returns DBSQLOperation
46
+ */
47
+ getCatalogs(request?: CatalogsRequest): Promise<IOperation>;
48
+ /**
49
+ * Get list of schemas
50
+ * @public
51
+ * @param request
52
+ * @returns DBSQLOperation
53
+ */
54
+ getSchemas(request?: SchemasRequest): Promise<IOperation>;
55
+ /**
56
+ * Get list of tables
57
+ * @public
58
+ * @param request
59
+ * @returns DBSQLOperation
60
+ */
61
+ getTables(request?: TablesRequest): Promise<IOperation>;
62
+ /**
63
+ * Get list of supported table types
64
+ * @public
65
+ * @param request
66
+ * @returns DBSQLOperation
67
+ */
68
+ getTableTypes(request?: TableTypesRequest): Promise<IOperation>;
69
+ /**
70
+ * Get full information about columns of the table
71
+ * @public
72
+ * @param request
73
+ * @returns DBSQLOperation
74
+ */
75
+ getColumns(request?: ColumnsRequest): Promise<IOperation>;
76
+ /**
77
+ * Get information about function
78
+ * @public
79
+ * @param request
80
+ * @returns DBSQLOperation
81
+ */
82
+ getFunctions(request: FunctionsRequest): Promise<IOperation>;
83
+ getPrimaryKeys(request: PrimaryKeysRequest): Promise<IOperation>;
84
+ /**
85
+ * Request information about foreign keys between two tables
86
+ * @public
87
+ * @param request
88
+ * @returns DBSQLOperation
89
+ */
90
+ getCrossReference(request: CrossReferenceRequest): Promise<IOperation>;
91
+ /**
92
+ * Closes the session
93
+ * @public
94
+ * @returns Operation status
95
+ */
96
+ close(): Promise<Status>;
97
+ private createOperation;
98
+ private assertStatus;
99
+ }
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const uuid_1 = require("uuid");
7
+ const Types_1 = require("./hive/Types");
8
+ const DBSQLOperation_1 = __importDefault(require("./DBSQLOperation"));
9
+ const StatusFactory_1 = __importDefault(require("./factory/StatusFactory"));
10
+ const InfoValue_1 = __importDefault(require("./dto/InfoValue"));
11
+ const utils_1 = require("./utils");
12
+ const IDBSQLLogger_1 = require("./contracts/IDBSQLLogger");
13
+ const defaultMaxRows = 100000;
14
+ function getDirectResultsOptions(maxRows = defaultMaxRows) {
15
+ if (maxRows === null) {
16
+ return {};
17
+ }
18
+ return {
19
+ getDirectResults: {
20
+ maxRows: new Types_1.Int64(maxRows),
21
+ },
22
+ };
23
+ }
24
+ class DBSQLSession {
25
+ constructor(driver, sessionHandle, logger) {
26
+ this.driver = driver;
27
+ this.sessionHandle = sessionHandle;
28
+ this.statusFactory = new StatusFactory_1.default();
29
+ this.logger = logger;
30
+ this.logger.log(IDBSQLLogger_1.LogLevel.debug, `Session created with id: ${this.getId()}`);
31
+ }
32
+ getId() {
33
+ var _a, _b;
34
+ return (0, uuid_1.stringify)(((_b = (_a = this.sessionHandle) === null || _a === void 0 ? void 0 : _a.sessionId) === null || _b === void 0 ? void 0 : _b.guid) || (0, uuid_1.parse)(uuid_1.NIL));
35
+ }
36
+ /**
37
+ * Fetches info
38
+ * @public
39
+ * @param infoType - One of the values TCLIService_types.TGetInfoType
40
+ * @returns Value corresponding to info type requested
41
+ * @example
42
+ * const response = await session.getInfo(thrift.TCLIService_types.TGetInfoType.CLI_DBMS_VER);
43
+ */
44
+ getInfo(infoType) {
45
+ return this.driver
46
+ .getInfo({
47
+ sessionHandle: this.sessionHandle,
48
+ infoType,
49
+ })
50
+ .then((response) => {
51
+ this.assertStatus(response.status);
52
+ return new InfoValue_1.default(response.infoValue);
53
+ });
54
+ }
55
+ /**
56
+ * Executes statement
57
+ * @public
58
+ * @param statement - SQL statement to be executed
59
+ * @param options - maxRows field is used to specify Direct Results
60
+ * @returns DBSQLOperation
61
+ * @example
62
+ * const operation = await session.executeStatement(query, { runAsync: true });
63
+ */
64
+ executeStatement(statement, options = {}) {
65
+ return this.driver
66
+ .executeStatement(Object.assign({ sessionHandle: this.sessionHandle, statement, queryTimeout: options.queryTimeout, runAsync: options.runAsync || false }, getDirectResultsOptions(options.maxRows)))
67
+ .then((response) => this.createOperation(response));
68
+ }
69
+ /**
70
+ * Information about supported data types
71
+ * @public
72
+ * @param request
73
+ * @returns DBSQLOperation
74
+ */
75
+ getTypeInfo(request = {}) {
76
+ return this.driver
77
+ .getTypeInfo(Object.assign({ sessionHandle: this.sessionHandle, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
78
+ .then((response) => this.createOperation(response));
79
+ }
80
+ /**
81
+ * Get list of catalogs
82
+ * @public
83
+ * @param request
84
+ * @returns DBSQLOperation
85
+ */
86
+ getCatalogs(request = {}) {
87
+ return this.driver
88
+ .getCatalogs(Object.assign({ sessionHandle: this.sessionHandle, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
89
+ .then((response) => this.createOperation(response));
90
+ }
91
+ /**
92
+ * Get list of schemas
93
+ * @public
94
+ * @param request
95
+ * @returns DBSQLOperation
96
+ */
97
+ getSchemas(request = {}) {
98
+ return this.driver
99
+ .getSchemas(Object.assign({ sessionHandle: this.sessionHandle, catalogName: request.catalogName, schemaName: request.schemaName, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
100
+ .then((response) => this.createOperation(response));
101
+ }
102
+ /**
103
+ * Get list of tables
104
+ * @public
105
+ * @param request
106
+ * @returns DBSQLOperation
107
+ */
108
+ getTables(request = {}) {
109
+ return this.driver
110
+ .getTables(Object.assign({ sessionHandle: this.sessionHandle, catalogName: request.catalogName, schemaName: request.schemaName, tableName: request.tableName, tableTypes: request.tableTypes, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
111
+ .then((response) => this.createOperation(response));
112
+ }
113
+ /**
114
+ * Get list of supported table types
115
+ * @public
116
+ * @param request
117
+ * @returns DBSQLOperation
118
+ */
119
+ getTableTypes(request = {}) {
120
+ return this.driver
121
+ .getTableTypes(Object.assign({ sessionHandle: this.sessionHandle, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
122
+ .then((response) => this.createOperation(response));
123
+ }
124
+ /**
125
+ * Get full information about columns of the table
126
+ * @public
127
+ * @param request
128
+ * @returns DBSQLOperation
129
+ */
130
+ getColumns(request = {}) {
131
+ return this.driver
132
+ .getColumns(Object.assign({ sessionHandle: this.sessionHandle, catalogName: request.catalogName, schemaName: request.schemaName, tableName: request.tableName, columnName: request.columnName, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
133
+ .then((response) => this.createOperation(response));
134
+ }
135
+ /**
136
+ * Get information about function
137
+ * @public
138
+ * @param request
139
+ * @returns DBSQLOperation
140
+ */
141
+ getFunctions(request) {
142
+ return this.driver
143
+ .getFunctions(Object.assign({ sessionHandle: this.sessionHandle, catalogName: request.catalogName, schemaName: request.schemaName, functionName: request.functionName, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
144
+ .then((response) => this.createOperation(response));
145
+ }
146
+ getPrimaryKeys(request) {
147
+ return this.driver
148
+ .getPrimaryKeys(Object.assign({ sessionHandle: this.sessionHandle, catalogName: request.catalogName, schemaName: request.schemaName, tableName: request.tableName, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
149
+ .then((response) => this.createOperation(response));
150
+ }
151
+ /**
152
+ * Request information about foreign keys between two tables
153
+ * @public
154
+ * @param request
155
+ * @returns DBSQLOperation
156
+ */
157
+ getCrossReference(request) {
158
+ return this.driver
159
+ .getCrossReference(Object.assign({ sessionHandle: this.sessionHandle, parentCatalogName: request.parentCatalogName, parentSchemaName: request.parentSchemaName, parentTableName: request.parentTableName, foreignCatalogName: request.foreignCatalogName, foreignSchemaName: request.foreignSchemaName, foreignTableName: request.foreignTableName, runAsync: request.runAsync || false }, getDirectResultsOptions(request.maxRows)))
160
+ .then((response) => this.createOperation(response));
161
+ }
162
+ /**
163
+ * Closes the session
164
+ * @public
165
+ * @returns Operation status
166
+ */
167
+ close() {
168
+ return this.driver
169
+ .closeSession({
170
+ sessionHandle: this.sessionHandle,
171
+ })
172
+ .then((response) => {
173
+ this.logger.log(IDBSQLLogger_1.LogLevel.debug, `Session closed with id: ${this.getId()}`);
174
+ return this.statusFactory.create(response.status);
175
+ });
176
+ }
177
+ createOperation(response) {
178
+ this.assertStatus(response.status);
179
+ const handle = (0, utils_1.definedOrError)(response.operationHandle);
180
+ return new DBSQLOperation_1.default(this.driver, handle, this.logger, response.directResults);
181
+ }
182
+ assertStatus(responseStatus) {
183
+ this.statusFactory.create(responseStatus);
184
+ }
185
+ }
186
+ exports.default = DBSQLSession;
187
+ //# sourceMappingURL=DBSQLSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DBSQLSession.js","sourceRoot":"","sources":["../lib/DBSQLSession.ts"],"names":[],"mappings":";;;;;AAAA,+BAA6C;AAG7C,wCAAqC;AAcrC,sEAA8C;AAE9C,4EAAoD;AACpD,gEAAwC;AACxC,mCAAyC;AACzC,2DAAkE;AAElE,MAAM,cAAc,GAAG,MAAM,CAAC;AAQ9B,SAAS,uBAAuB,CAAC,UAAyB,cAAc;IACtE,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,EAAE,C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AAC,kBAAkB,EAC9C,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAC5C,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAC1C,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK,IAChC,uBAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,EAC3C;aACD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,MAAM;aACf,YAAY,CAAC;YACZ,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC;aACD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAQ,CAAC,KAAK,EAAE,2BAA2B,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3E,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,eAAe,CAAC,QAAgC;QACtD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,IAAA,sBAAc,EAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QACxD,OAAO,IAAI,wBAAc,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACtF,CAAC;IAEO,YAAY,CAAC,cAAuB;QAC1C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;CACF;AAxPD,+BAwPC"}
@@ -1,5 +1,5 @@
1
- import IAuthentication from "../contracts/IAuthentication";
2
- import ITransport from "../contracts/ITransport";
1
+ import IAuthentication from '../contracts/IAuthentication';
2
+ import ITransport from '../contracts/ITransport';
3
3
  export default class NoSaslAuthentication implements IAuthentication {
4
4
  authenticate(transport: ITransport): Promise<ITransport>;
5
5
  }
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var thrift = require('thrift');
4
- var NoSaslAuthentication = /** @class */ (function () {
5
- function NoSaslAuthentication() {
6
- }
7
- NoSaslAuthentication.prototype.authenticate = function (transport) {
6
+ const thrift_1 = __importDefault(require("thrift"));
7
+ class NoSaslAuthentication {
8
+ authenticate(transport) {
8
9
  transport.connect();
9
- transport.setOptions('transport', thrift.TBufferedTransport);
10
+ transport.setOptions('transport', thrift_1.default.TBufferedTransport);
10
11
  return Promise.resolve(transport);
11
- };
12
- return NoSaslAuthentication;
13
- }());
12
+ }
13
+ }
14
14
  exports.default = NoSaslAuthentication;
15
15
  //# sourceMappingURL=NoSaslAuthentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NoSaslAuthentication.js","sourceRoot":"","sources":["../../../lib/connection/auth/NoSaslAuthentication.ts"],"names":[],"mappings":";;AAAA,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAIjC;IAAA;IAOA,CAAC;IANG,2CAAY,GAAZ,UAAa,SAAqB;QAC9B,SAAS,CAAC,OAAO,EAAE,CAAC;QACpB,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IACL,2BAAC;AAAD,CAAC,AAPD,IAOC"}
1
+ {"version":3,"file":"NoSaslAuthentication.js","sourceRoot":"","sources":["../../../lib/connection/auth/NoSaslAuthentication.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAI5B,MAAqB,oBAAoB;IACvC,YAAY,CAAC,SAAqB;QAChC,SAAS,CAAC,OAAO,EAAE,CAAC;QACpB,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,gBAAM,CAAC,kBAAkB,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;CACF;AAPD,uCAOC"}
@@ -1,5 +1,5 @@
1
- import IAuthentication from "../contracts/IAuthentication";
2
- import ITransport from "../contracts/ITransport";
1
+ import IAuthentication from '../contracts/IAuthentication';
2
+ import ITransport from '../contracts/ITransport';
3
3
  import { AuthOptions } from '../types/AuthOptions';
4
4
  declare type HttpAuthOptions = AuthOptions & {
5
5
  headers?: object;
@@ -1,30 +1,18 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
- var PlainHttpAuthentication = /** @class */ (function () {
15
- function PlainHttpAuthentication(options) {
3
+ class PlainHttpAuthentication {
4
+ constructor(options) {
16
5
  this.username = (options === null || options === void 0 ? void 0 : options.username) || 'anonymous';
17
6
  this.password = (options === null || options === void 0 ? void 0 : options.password) !== undefined ? options === null || options === void 0 ? void 0 : options.password : 'anonymous';
18
7
  this.headers = (options === null || options === void 0 ? void 0 : options.headers) || {};
19
8
  }
20
- PlainHttpAuthentication.prototype.authenticate = function (transport) {
21
- transport.setOptions('headers', __assign(__assign({}, (this.headers)), { Authorization: this.getToken(this.username, this.password) }));
9
+ authenticate(transport) {
10
+ transport.setOptions('headers', Object.assign(Object.assign({}, this.headers), { Authorization: this.getToken(this.username, this.password) }));
22
11
  return Promise.resolve(transport);
23
- };
24
- PlainHttpAuthentication.prototype.getToken = function (username, password) {
25
- return 'Basic ' + Buffer.from("".concat(username, ":").concat(password)).toString('base64');
26
- };
27
- return PlainHttpAuthentication;
28
- }());
12
+ }
13
+ getToken(username, password) {
14
+ return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;
15
+ }
16
+ }
29
17
  exports.default = PlainHttpAuthentication;
30
18
  //# sourceMappingURL=PlainHttpAuthentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlainHttpAuthentication.js","sourceRoot":"","sources":["../../../lib/connection/auth/PlainHttpAuthentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAQA;IAKI,iCAAY,OAAwB;QAChC,IAAI,CAAC,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,WAAW,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,MAAK,SAAS,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;QAClF,IAAI,CAAC,OAAO,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,EAAE,CAAC;IAC1C,CAAC;IAED,8CAAY,GAAZ,UAAa,SAAqB;QAC9B,SAAS,CAAC,UAAU,CAAC,SAAS,wBACvB,CAAC,IAAI,CAAC,OAAO,CAAC,KACjB,aAAa,EAAE,IAAI,CAAC,QAAQ,CACxB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,QAAQ,CAChB,IACH,CAAC;QAEH,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAEO,0CAAQ,GAAhB,UAAiB,QAAgB,EAAE,QAAgB;QAC/C,OAAO,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,UAAG,QAAQ,cAAI,QAAQ,CAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAChF,CAAC;IACL,8BAAC;AAAD,CAAC,AA1BD,IA0BC"}
1
+ {"version":3,"file":"PlainHttpAuthentication.js","sourceRoot":"","sources":["../../../lib/connection/auth/PlainHttpAuthentication.ts"],"names":[],"mappings":";;AAQA,MAAqB,uBAAuB;IAO1C,YAAY,OAAwB;QAClC,IAAI,CAAC,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,WAAW,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,MAAK,SAAS,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;QAClF,IAAI,CAAC,OAAO,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,EAAE,CAAC;IACxC,CAAC;IAED,YAAY,CAAC,SAAqB;QAChC,SAAS,CAAC,UAAU,CAAC,SAAS,kCACzB,IAAI,CAAC,OAAO,KACf,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,IAC1D,CAAC;QAEH,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,QAAgB;QACjD,OAAO,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC9E,CAAC;CACF;AAzBD,0CAyBC"}
@@ -9,16 +9,12 @@ var StatusCode;
9
9
  StatusCode[StatusCode["ERROR"] = 4] = "ERROR";
10
10
  StatusCode[StatusCode["COMPLETE"] = 5] = "COMPLETE";
11
11
  })(StatusCode = exports.StatusCode || (exports.StatusCode = {}));
12
- ;
13
- var SaslPackageFactory = /** @class */ (function () {
14
- function SaslPackageFactory() {
15
- }
16
- SaslPackageFactory.create = function (status, body) {
17
- var bodyLength = Buffer.alloc(4);
12
+ class SaslPackageFactory {
13
+ static create(status, body) {
14
+ const bodyLength = Buffer.alloc(4);
18
15
  bodyLength.writeUInt32BE(body.length, 0);
19
16
  return Buffer.concat([Buffer.from([status]), bodyLength, body]);
20
- };
21
- return SaslPackageFactory;
22
- }());
17
+ }
18
+ }
23
19
  exports.SaslPackageFactory = SaslPackageFactory;
24
20
  //# sourceMappingURL=SaslPackageFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SaslPackageFactory.js","sourceRoot":"","sources":["../../../../lib/connection/auth/helpers/SaslPackageFactory.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,6CAAO,CAAA;IACP,uCAAI,CAAA;IACJ,yCAAK,CAAA;IACL,6CAAO,CAAA;IACP,mDAAU,CAAA;AACd,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB;AAAA,CAAC;AAEF;IAAA;IAQA,CAAC;IAPU,yBAAM,GAAb,UAAc,MAAkB,EAAE,IAAY;QAC1C,IAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEnC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAEzC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAE,MAAM,CAAC,IAAI,CAAC,CAAE,MAAM,CAAE,CAAC,EAAE,UAAU,EAAE,IAAI,CAAE,CAAC,CAAC;IACxE,CAAC;IACL,yBAAC;AAAD,CAAC,AARD,IAQC;AARY,gDAAkB"}
1
+ {"version":3,"file":"SaslPackageFactory.js","sourceRoot":"","sources":["../../../../lib/connection/auth/helpers/SaslPackageFactory.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,6CAAS,CAAA;IACT,uCAAM,CAAA;IACN,yCAAO,CAAA;IACP,6CAAS,CAAA;IACT,mDAAY,CAAA;AACd,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB;AAED,MAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,MAAkB,EAAE,IAAY;QAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEnC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAEzC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;CACF;AARD,gDAQC"}
@@ -1,7 +1,7 @@
1
- import IThriftConnection from "../contracts/IThriftConnection";
2
- import IConnectionProvider from "../contracts/IConnectionProvider";
3
- import IConnectionOptions from "../contracts/IConnectionOptions";
4
- import IAuthentication from "../contracts/IAuthentication";
1
+ import IThriftConnection from '../contracts/IThriftConnection';
2
+ import IConnectionProvider from '../contracts/IConnectionProvider';
3
+ import IConnectionOptions from '../contracts/IConnectionOptions';
4
+ import IAuthentication from '../contracts/IAuthentication';
5
5
  export default class HttpConnection implements IConnectionProvider, IThriftConnection {
6
6
  private thrift;
7
7
  private connection;
@@ -1,49 +1,45 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
5
  Object.defineProperty(exports, "__esModule", { value: true });
17
- var thrift = require('thrift');
18
- var HttpTransport_1 = __importDefault(require("../transports/HttpTransport"));
19
- var HttpConnection = /** @class */ (function () {
20
- function HttpConnection() {
21
- this.thrift = thrift;
6
+ const thrift_1 = __importDefault(require("thrift"));
7
+ const https_1 = __importDefault(require("https"));
8
+ const http_1 = __importDefault(require("http"));
9
+ const HttpTransport_1 = __importDefault(require("../transports/HttpTransport"));
10
+ class HttpConnection {
11
+ constructor() {
12
+ this.thrift = thrift_1.default;
22
13
  }
23
- HttpConnection.prototype.connect = function (options, authProvider) {
24
- var _this = this;
25
- var _a;
26
- var httpTransport = new HttpTransport_1.default(__assign(__assign({ transport: thrift.TBufferedTransport, protocol: thrift.TBinaryProtocol }, options.options), { nodeOptions: __assign(__assign({}, this.getNodeOptions(options.options || {})), (((_a = options.options) === null || _a === void 0 ? void 0 : _a.nodeOptions) || {})) }));
27
- return authProvider.authenticate(httpTransport).then(function () {
28
- _this.connection = _this.thrift.createHttpConnection(options.host, options.port, httpTransport.getOptions());
29
- _this.addCookieHandler();
30
- return _this;
14
+ connect(options, authProvider) {
15
+ var _a, _b;
16
+ const agentOptions = {
17
+ keepAlive: true,
18
+ maxSockets: 5,
19
+ keepAliveMsecs: 10000,
20
+ };
21
+ const agent = ((_a = options.options) === null || _a === void 0 ? void 0 : _a.https)
22
+ ? new https_1.default.Agent(Object.assign(Object.assign({}, agentOptions), { minVersion: 'TLSv1.2' }))
23
+ : new http_1.default.Agent(agentOptions);
24
+ const httpTransport = new HttpTransport_1.default(Object.assign(Object.assign({ transport: thrift_1.default.TBufferedTransport, protocol: thrift_1.default.TBinaryProtocol }, options.options), { nodeOptions: Object.assign(Object.assign({ agent }, this.getNodeOptions(options.options || {})), (((_b = options.options) === null || _b === void 0 ? void 0 : _b.nodeOptions) || {})) }));
25
+ return authProvider.authenticate(httpTransport).then(() => {
26
+ this.connection = this.thrift.createHttpConnection(options.host, options.port, httpTransport.getOptions());
27
+ this.addCookieHandler();
28
+ return this;
31
29
  });
32
- };
33
- HttpConnection.prototype.getConnection = function () {
30
+ }
31
+ getConnection() {
34
32
  return this.connection;
35
- };
36
- HttpConnection.prototype.isConnected = function () {
33
+ }
34
+ isConnected() {
37
35
  if (this.connection) {
38
36
  return true;
39
37
  }
40
- else {
41
- return false;
42
- }
43
- };
44
- HttpConnection.prototype.getNodeOptions = function (options) {
45
- var ca = options.ca, cert = options.cert, key = options.key, https = options.https;
46
- var nodeOptions = {};
38
+ return false;
39
+ }
40
+ getNodeOptions(options) {
41
+ const { ca, cert, key, https: useHttps } = options;
42
+ const nodeOptions = {};
47
43
  if (ca) {
48
44
  nodeOptions.ca = ca;
49
45
  }
@@ -53,25 +49,24 @@ var HttpConnection = /** @class */ (function () {
53
49
  if (key) {
54
50
  nodeOptions.key = key;
55
51
  }
56
- if (https) {
52
+ if (useHttps) {
57
53
  nodeOptions.rejectUnauthorized = false;
58
54
  }
59
55
  return nodeOptions;
60
- };
61
- HttpConnection.prototype.addCookieHandler = function () {
62
- var _this = this;
63
- var responseCallback = this.connection.responseCallback;
64
- this.connection.responseCallback = function (response) {
56
+ }
57
+ addCookieHandler() {
58
+ const { responseCallback } = this.connection;
59
+ this.connection.responseCallback = (response) => {
65
60
  if (Array.isArray(response.headers['set-cookie'])) {
66
- var cookie = [_this.connection.nodeOptions.headers['cookie']];
67
- _this.connection.nodeOptions.headers['cookie'] = cookie.concat(response.headers['set-cookie'])
61
+ const cookie = [this.connection.nodeOptions.headers.cookie];
62
+ this.connection.nodeOptions.headers.cookie = cookie
63
+ .concat(response.headers['set-cookie'])
68
64
  .filter(Boolean)
69
65
  .join(';');
70
66
  }
71
- responseCallback.call(_this.connection, response);
67
+ responseCallback.call(this.connection, response);
72
68
  };
73
- };
74
- return HttpConnection;
75
- }());
69
+ }
70
+ }
76
71
  exports.default = HttpConnection;
77
72
  //# sourceMappingURL=HttpConnection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HttpConnection.js","sourceRoot":"","sources":["../../../lib/connection/connections/HttpConnection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;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MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QACnD,MAAM,WAAW,GAAgB,EAAE,CAAC;QAEpC,IAAI,EAAE,EAAE;YACN,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC;SACrB;QACD,IAAI,IAAI,EAAE;YACR,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;SACzB;QACD,IAAI,GAAG,EAAE;YACP,WAAW,CAAC,GAAG,GAAG,GAAG,CAAC;SACvB;QAED,IAAI,QAAQ,EAAE;YACZ,WAAW,CAAC,kBAAkB,GAAG,KAAK,CAAC;SACxC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,gBAAgB;QACtB,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QAE7C,IAAI,CAAC,UAAU,CAAC,gBAAgB,GAAG,CAAC,QAAyB,EAAE,EAAE;YAC/D,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE;gBACjD,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAE5D,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM;qBAChD,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;qBACtC,MAAM,CAAC,OAAO,CAAC;qBACf,IAAI,CAAC,GAAG,CAAC,CAAC;aACd;YAED,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC;CACF;AApFD,iCAoFC"}
@@ -1,4 +1,4 @@
1
- import ITransport from "./ITransport";
1
+ import ITransport from './ITransport';
2
2
  export default interface IAuthentication {
3
3
  authenticate(connection: ITransport): Promise<ITransport>;
4
4
  }
@@ -1,4 +1,4 @@
1
- import ITransport from "../contracts/ITransport";
1
+ import ITransport from '../contracts/ITransport';
2
2
  export default class HttpTransport implements ITransport {
3
3
  private httpOptions;
4
4
  constructor(httpOptions?: object);
@@ -1,39 +1,24 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
- var HttpTransport = /** @class */ (function () {
15
- function HttpTransport(httpOptions) {
16
- if (httpOptions === void 0) { httpOptions = {}; }
3
+ class HttpTransport {
4
+ constructor(httpOptions = {}) {
17
5
  this.httpOptions = httpOptions;
18
6
  }
19
- HttpTransport.prototype.getTransport = function () {
7
+ getTransport() {
20
8
  return this.httpOptions;
21
- };
22
- HttpTransport.prototype.setOptions = function (option, value) {
23
- var _a;
24
- this.httpOptions = __assign(__assign({}, this.httpOptions), (_a = {}, _a[option] = value, _a));
25
- };
26
- HttpTransport.prototype.getOptions = function () {
9
+ }
10
+ setOptions(option, value) {
11
+ this.httpOptions = Object.assign(Object.assign({}, this.httpOptions), { [option]: value });
12
+ }
13
+ getOptions() {
27
14
  return this.httpOptions;
28
- };
29
- HttpTransport.prototype.connect = function () { };
30
- ;
31
- HttpTransport.prototype.addListener = function () { };
32
- HttpTransport.prototype.removeListener = function () { };
33
- HttpTransport.prototype.write = function () { };
34
- HttpTransport.prototype.end = function () { };
35
- HttpTransport.prototype.emit = function () { };
36
- return HttpTransport;
37
- }());
15
+ }
16
+ connect() { }
17
+ addListener() { }
18
+ removeListener() { }
19
+ write() { }
20
+ end() { }
21
+ emit() { }
22
+ }
38
23
  exports.default = HttpTransport;
39
24
  //# sourceMappingURL=HttpTransport.js.map