@databricks/sql 0.1.8-beta.1 → 0.1.8-beta.2

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 (248) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/NOTICE +35 -0
  3. package/README.md +42 -19
  4. package/dist/DBSQLClient.d.ts +23 -39
  5. package/dist/DBSQLClient.js +110 -98
  6. package/dist/DBSQLClient.js.map +1 -1
  7. package/dist/DBSQLOperation/CompleteOperationHelper.d.ts +13 -0
  8. package/dist/DBSQLOperation/CompleteOperationHelper.js +61 -0
  9. package/dist/DBSQLOperation/CompleteOperationHelper.js.map +1 -0
  10. package/dist/DBSQLOperation/FetchResultsHelper.d.ts +14 -0
  11. package/dist/DBSQLOperation/FetchResultsHelper.js +79 -0
  12. package/dist/DBSQLOperation/FetchResultsHelper.js.map +1 -0
  13. package/dist/DBSQLOperation/OperationStatusHelper.d.ts +17 -0
  14. package/dist/DBSQLOperation/OperationStatusHelper.js +115 -0
  15. package/dist/DBSQLOperation/OperationStatusHelper.js.map +1 -0
  16. package/dist/DBSQLOperation/SchemaHelper.d.ts +10 -0
  17. package/dist/DBSQLOperation/SchemaHelper.js +39 -0
  18. package/dist/DBSQLOperation/SchemaHelper.js.map +1 -0
  19. package/dist/DBSQLOperation/getResult.d.ts +2 -0
  20. package/dist/DBSQLOperation/getResult.js +19 -0
  21. package/dist/DBSQLOperation/getResult.js.map +1 -0
  22. package/dist/DBSQLOperation/index.d.ts +34 -0
  23. package/dist/DBSQLOperation/index.js +100 -0
  24. package/dist/DBSQLOperation/index.js.map +1 -0
  25. package/dist/{HiveSession.d.ts → DBSQLSession.d.ts} +8 -9
  26. package/dist/DBSQLSession.js +185 -0
  27. package/dist/DBSQLSession.js.map +1 -0
  28. package/dist/connection/auth/NoSaslAuthentication.d.ts +2 -2
  29. package/dist/connection/auth/NoSaslAuthentication.js +9 -9
  30. package/dist/connection/auth/NoSaslAuthentication.js.map +1 -1
  31. package/dist/connection/auth/PlainHttpAuthentication.d.ts +2 -2
  32. package/dist/connection/auth/PlainHttpAuthentication.js +9 -21
  33. package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -1
  34. package/dist/connection/auth/helpers/SaslPackageFactory.js +5 -9
  35. package/dist/connection/auth/helpers/SaslPackageFactory.js.map +1 -1
  36. package/dist/connection/connections/HttpConnection.d.ts +4 -4
  37. package/dist/connection/connections/HttpConnection.js +39 -47
  38. package/dist/connection/connections/HttpConnection.js.map +1 -1
  39. package/dist/connection/contracts/IAuthentication.d.ts +1 -1
  40. package/dist/connection/transports/HttpTransport.d.ts +1 -1
  41. package/dist/connection/transports/HttpTransport.js +16 -31
  42. package/dist/connection/transports/HttpTransport.js.map +1 -1
  43. package/dist/contracts/IDBSQLClient.d.ts +14 -0
  44. package/dist/contracts/{IHiveClient.js → IDBSQLClient.js} +1 -1
  45. package/dist/contracts/IDBSQLClient.js.map +1 -0
  46. package/dist/contracts/{IHiveSession.d.ts → IDBSQLSession.d.ts} +9 -7
  47. package/dist/contracts/{IHiveSession.js → IDBSQLSession.js} +1 -1
  48. package/dist/contracts/IDBSQLSession.js.map +1 -0
  49. package/dist/contracts/IOperation.d.ts +21 -21
  50. package/dist/contracts/IOperation.js +4 -0
  51. package/dist/contracts/IOperation.js.map +1 -1
  52. package/dist/dto/InfoValue.d.ts +5 -3
  53. package/dist/dto/InfoValue.js +11 -14
  54. package/dist/dto/InfoValue.js.map +1 -1
  55. package/dist/dto/Status.js +9 -10
  56. package/dist/dto/Status.js.map +1 -1
  57. package/dist/errors/AuthenticationError.d.ts +1 -1
  58. package/dist/errors/AuthenticationError.js +3 -23
  59. package/dist/errors/AuthenticationError.js.map +1 -1
  60. package/dist/errors/HiveDriverError.js +2 -22
  61. package/dist/errors/HiveDriverError.js.map +1 -1
  62. package/dist/errors/OperationStateError.d.ts +4 -4
  63. package/dist/errors/OperationStateError.js +6 -24
  64. package/dist/errors/OperationStateError.js.map +1 -1
  65. package/dist/errors/StatusError.d.ts +2 -2
  66. package/dist/errors/StatusError.js +3 -4
  67. package/dist/errors/StatusError.js.map +1 -1
  68. package/dist/factory/StatusFactory.d.ts +2 -4
  69. package/dist/factory/StatusFactory.js +16 -21
  70. package/dist/factory/StatusFactory.js.map +1 -1
  71. package/dist/hive/Commands/BaseCommand.d.ts +3 -4
  72. package/dist/hive/Commands/BaseCommand.js +10 -12
  73. package/dist/hive/Commands/BaseCommand.js.map +1 -1
  74. package/dist/hive/Commands/CancelDelegationTokenCommand.d.ts +3 -10
  75. package/dist/hive/Commands/CancelDelegationTokenCommand.js +7 -26
  76. package/dist/hive/Commands/CancelDelegationTokenCommand.js.map +1 -1
  77. package/dist/hive/Commands/CancelOperationCommand.d.ts +3 -9
  78. package/dist/hive/Commands/CancelOperationCommand.js +7 -26
  79. package/dist/hive/Commands/CancelOperationCommand.js.map +1 -1
  80. package/dist/hive/Commands/CloseOperationCommand.d.ts +3 -9
  81. package/dist/hive/Commands/CloseOperationCommand.js +7 -26
  82. package/dist/hive/Commands/CloseOperationCommand.js.map +1 -1
  83. package/dist/hive/Commands/CloseSessionCommand.d.ts +3 -9
  84. package/dist/hive/Commands/CloseSessionCommand.js +7 -26
  85. package/dist/hive/Commands/CloseSessionCommand.js.map +1 -1
  86. package/dist/hive/Commands/ExecuteStatementCommand.d.ts +3 -15
  87. package/dist/hive/Commands/ExecuteStatementCommand.js +7 -26
  88. package/dist/hive/Commands/ExecuteStatementCommand.js.map +1 -1
  89. package/dist/hive/Commands/FetchResultsCommand.d.ts +4 -16
  90. package/dist/hive/Commands/FetchResultsCommand.js +10 -26
  91. package/dist/hive/Commands/FetchResultsCommand.js.map +1 -1
  92. package/dist/hive/Commands/GetCatalogsCommand.d.ts +3 -10
  93. package/dist/hive/Commands/GetCatalogsCommand.js +7 -26
  94. package/dist/hive/Commands/GetCatalogsCommand.js.map +1 -1
  95. package/dist/hive/Commands/GetColumnsCommand.d.ts +3 -14
  96. package/dist/hive/Commands/GetColumnsCommand.js +7 -26
  97. package/dist/hive/Commands/GetColumnsCommand.js.map +1 -1
  98. package/dist/hive/Commands/GetCrossReferenceCommand.d.ts +3 -16
  99. package/dist/hive/Commands/GetCrossReferenceCommand.js +7 -26
  100. package/dist/hive/Commands/GetCrossReferenceCommand.js.map +1 -1
  101. package/dist/hive/Commands/GetDelegationTokenCommand.d.ts +3 -12
  102. package/dist/hive/Commands/GetDelegationTokenCommand.js +7 -26
  103. package/dist/hive/Commands/GetDelegationTokenCommand.js.map +1 -1
  104. package/dist/hive/Commands/GetFunctionsCommand.d.ts +3 -13
  105. package/dist/hive/Commands/GetFunctionsCommand.js +7 -26
  106. package/dist/hive/Commands/GetFunctionsCommand.js.map +1 -1
  107. package/dist/hive/Commands/GetInfoCommand.d.ts +3 -14
  108. package/dist/hive/Commands/GetInfoCommand.js +7 -26
  109. package/dist/hive/Commands/GetInfoCommand.js.map +1 -1
  110. package/dist/hive/Commands/GetOperationStatusCommand.d.ts +3 -21
  111. package/dist/hive/Commands/GetOperationStatusCommand.js +7 -26
  112. package/dist/hive/Commands/GetOperationStatusCommand.js.map +1 -1
  113. package/dist/hive/Commands/GetPrimaryKeysCommand.d.ts +3 -13
  114. package/dist/hive/Commands/GetPrimaryKeysCommand.js +7 -26
  115. package/dist/hive/Commands/GetPrimaryKeysCommand.js.map +1 -1
  116. package/dist/hive/Commands/GetResultSetMetadataCommand.d.ts +3 -10
  117. package/dist/hive/Commands/GetResultSetMetadataCommand.js +7 -26
  118. package/dist/hive/Commands/GetResultSetMetadataCommand.js.map +1 -1
  119. package/dist/hive/Commands/GetSchemasCommand.d.ts +3 -12
  120. package/dist/hive/Commands/GetSchemasCommand.js +7 -26
  121. package/dist/hive/Commands/GetSchemasCommand.js.map +1 -1
  122. package/dist/hive/Commands/GetTableTypesCommand.d.ts +3 -10
  123. package/dist/hive/Commands/GetTableTypesCommand.js +7 -26
  124. package/dist/hive/Commands/GetTableTypesCommand.js.map +1 -1
  125. package/dist/hive/Commands/GetTablesCommand.d.ts +3 -14
  126. package/dist/hive/Commands/GetTablesCommand.js +7 -26
  127. package/dist/hive/Commands/GetTablesCommand.js.map +1 -1
  128. package/dist/hive/Commands/GetTypeInfoCommand.d.ts +3 -10
  129. package/dist/hive/Commands/GetTypeInfoCommand.js +7 -26
  130. package/dist/hive/Commands/GetTypeInfoCommand.js.map +1 -1
  131. package/dist/hive/Commands/OpenSessionCommand.d.ts +9 -28
  132. package/dist/hive/Commands/OpenSessionCommand.js +16 -26
  133. package/dist/hive/Commands/OpenSessionCommand.js.map +1 -1
  134. package/dist/hive/Commands/RenewDelegationTokenCommand.d.ts +3 -10
  135. package/dist/hive/Commands/RenewDelegationTokenCommand.js +7 -26
  136. package/dist/hive/Commands/RenewDelegationTokenCommand.js.map +1 -1
  137. package/dist/hive/HiveDriver.d.ts +24 -49
  138. package/dist/hive/HiveDriver.js +87 -99
  139. package/dist/hive/HiveDriver.js.map +1 -1
  140. package/dist/hive/Types/index.d.ts +7 -218
  141. package/dist/hive/Types/index.js +11 -2
  142. package/dist/hive/Types/index.js.map +1 -1
  143. package/dist/index.d.ts +14 -16
  144. package/dist/index.js +15 -51
  145. package/dist/index.js.map +1 -1
  146. package/dist/result/IOperationResult.d.ts +0 -2
  147. package/dist/result/JsonResult.d.ts +5 -8
  148. package/dist/result/JsonResult.js +81 -99
  149. package/dist/result/JsonResult.js.map +1 -1
  150. package/dist/result/NullResult.d.ts +1 -3
  151. package/dist/result/NullResult.js +4 -8
  152. package/dist/result/NullResult.js.map +1 -1
  153. package/dist/utils/buildUserAgentString.d.ts +1 -0
  154. package/dist/utils/buildUserAgentString.js +25 -0
  155. package/dist/utils/buildUserAgentString.js.map +1 -0
  156. package/dist/utils/definedOrError.d.ts +1 -0
  157. package/dist/utils/definedOrError.js +10 -0
  158. package/dist/utils/definedOrError.js.map +1 -0
  159. package/dist/utils/formatProgress.d.ts +9 -0
  160. package/dist/utils/formatProgress.js +24 -0
  161. package/dist/utils/formatProgress.js.map +1 -0
  162. package/dist/utils/index.d.ts +4 -0
  163. package/dist/utils/index.js +37 -0
  164. package/dist/utils/index.js.map +1 -0
  165. package/package.json +24 -6
  166. package/thrift/TCLIService.d.ts +196 -0
  167. package/thrift/{gen-nodejs/TCLIService.js → TCLIService.js} +1 -397
  168. package/thrift/TCLIService_types.d.ts +947 -0
  169. package/thrift/{gen-nodejs/TCLIService_types.js → TCLIService_types.js} +2830 -516
  170. package/.gitattributes +0 -32
  171. package/CONTRIBUTING.md +0 -55
  172. package/dist/HiveClient.d.ts +0 -35
  173. package/dist/HiveClient.js +0 -156
  174. package/dist/HiveClient.js.map +0 -1
  175. package/dist/HiveOperation.d.ts +0 -65
  176. package/dist/HiveOperation.js +0 -190
  177. package/dist/HiveOperation.js.map +0 -1
  178. package/dist/HiveSession.js +0 -197
  179. package/dist/HiveSession.js.map +0 -1
  180. package/dist/contracts/IHiveClient.d.ts +0 -10
  181. package/dist/contracts/IHiveClient.js.map +0 -1
  182. package/dist/contracts/IHiveSession.js.map +0 -1
  183. package/dist/hive/Commands/GetQueryIdCommand.d.ts +0 -11
  184. package/dist/hive/Commands/GetQueryIdCommand.js +0 -34
  185. package/dist/hive/Commands/GetQueryIdCommand.js.map +0 -1
  186. package/dist/hive/Commands/SetClientInfoCommand.d.ts +0 -12
  187. package/dist/hive/Commands/SetClientInfoCommand.js +0 -34
  188. package/dist/hive/Commands/SetClientInfoCommand.js.map +0 -1
  189. package/dist/utils/GetResult.d.ts +0 -16
  190. package/dist/utils/GetResult.js +0 -38
  191. package/dist/utils/GetResult.js.map +0 -1
  192. package/dist/utils/HiveUtils.d.ts +0 -11
  193. package/dist/utils/HiveUtils.js +0 -39
  194. package/dist/utils/HiveUtils.js.map +0 -1
  195. package/dist/utils/ProgressUpdateTransformer.d.ts +0 -8
  196. package/dist/utils/ProgressUpdateTransformer.js +0 -33
  197. package/dist/utils/ProgressUpdateTransformer.js.map +0 -1
  198. package/dist/utils/WaitUntilReady.d.ts +0 -16
  199. package/dist/utils/WaitUntilReady.js +0 -120
  200. package/dist/utils/WaitUntilReady.js.map +0 -1
  201. package/docs/readme.md +0 -227
  202. package/docs/troubleshooting.md +0 -84
  203. package/examples/data_types.js +0 -173
  204. package/examples/repl +0 -106
  205. package/examples/session.js +0 -55
  206. package/examples/usage.js +0 -18
  207. package/nyc.config.js +0 -8
  208. package/tests/e2e/data_types.test.js +0 -353
  209. package/tests/e2e/utils/config.js +0 -20
  210. package/tests/e2e/utils/logger.js +0 -22
  211. package/tests/unit/HiveClient.test.js +0 -153
  212. package/tests/unit/HiveOperation.test.js +0 -340
  213. package/tests/unit/HiveSession.test.js +0 -146
  214. package/tests/unit/connection/auth/PlainHttpAuthentication.test.js +0 -44
  215. package/tests/unit/connection/connections/HttpConnection.test.js +0 -141
  216. package/tests/unit/dto/InfoValue.test.js +0 -50
  217. package/tests/unit/factory/StatusFactory.test.js +0 -62
  218. package/tests/unit/hive/HiveDriver.test.js +0 -115
  219. package/tests/unit/hive/commands/CancelDelegationTokenCommand.test.js +0 -43
  220. package/tests/unit/hive/commands/CancelOperationCommand.test.js +0 -45
  221. package/tests/unit/hive/commands/CloseOperationCommand.test.js +0 -45
  222. package/tests/unit/hive/commands/CloseSessionCommand.test.js +0 -38
  223. package/tests/unit/hive/commands/ExecuteStatementCommand.test.js +0 -54
  224. package/tests/unit/hive/commands/FetchResultsCommand.test.js +0 -59
  225. package/tests/unit/hive/commands/GetCatalogsCommand.test.js +0 -50
  226. package/tests/unit/hive/commands/GetColumnsCommand.test.js +0 -50
  227. package/tests/unit/hive/commands/GetCrossReferenceCommand.test.js +0 -56
  228. package/tests/unit/hive/commands/GetDelegationTokenCommand.test.js +0 -45
  229. package/tests/unit/hive/commands/GetFunctionsCommand.test.js +0 -50
  230. package/tests/unit/hive/commands/GetInfoCommand.test.js +0 -51
  231. package/tests/unit/hive/commands/GetOperationStatusCommand.test.js +0 -63
  232. package/tests/unit/hive/commands/GetPrimaryKeysCommand.test.js +0 -50
  233. package/tests/unit/hive/commands/GetQueryIdCommand.test.js +0 -42
  234. package/tests/unit/hive/commands/GetResultSetMetadataCommand.test.js +0 -54
  235. package/tests/unit/hive/commands/GetSchemasCommand.test.js +0 -52
  236. package/tests/unit/hive/commands/GetTableTypesCommand.test.js +0 -50
  237. package/tests/unit/hive/commands/GetTablesCommand.test.js +0 -54
  238. package/tests/unit/hive/commands/GetTypeInfoCommand.test.js +0 -50
  239. package/tests/unit/hive/commands/OpenSessionCommand.test.js +0 -43
  240. package/tests/unit/hive/commands/RenewDelegationTokenCommand.test.js +0 -43
  241. package/tests/unit/hive/commands/SetClientInfoCommand.test.js +0 -45
  242. package/tests/unit/result/JsonResult.test.js +0 -295
  243. package/tests/unit/utils/GetResult.test.js +0 -30
  244. package/tests/unit/utils/HiveUtils.test.js +0 -60
  245. package/tests/unit/utils/ProgressUpdateTransformer.test.js +0 -28
  246. package/tests/unit/utils/WaitUntilReady.test.js +0 -105
  247. package/thrift/TCLIService.thrift +0 -1299
  248. package/tsconfig.json +0 -13
@@ -1,50 +0,0 @@
1
- const { expect } = require('chai');
2
- const InfoValue = require('../../../dist/dto/InfoValue').default;
3
- const NodeInt64 = require('node-int64');
4
-
5
- describe('InfoValue', () => {
6
- const infoValue = (value) => Object.assign({
7
- stringValue: null,
8
- smallIntValue: null,
9
- integerBitmask: null,
10
- integerFlag: null,
11
- lenValue: null,
12
- }, value);
13
-
14
- it('should return string', () => {
15
- const value = new InfoValue(infoValue({
16
- stringValue: 'value'
17
- }));
18
-
19
- expect(value.getValue()).to.be.eq('value');
20
- });
21
-
22
- it('should return number', () => {
23
- const smallInt = new InfoValue(infoValue({
24
- smallIntValue: 1
25
- }));
26
-
27
- expect(smallInt.getValue()).to.be.eq(1);
28
-
29
- const bitMask = new InfoValue(infoValue({
30
- integerBitmask: 0xaa55aa55
31
- }));
32
-
33
- expect(bitMask.getValue()).to.be.eq(0xaa55aa55);
34
-
35
- const integerFlag = new InfoValue(infoValue({
36
- integerFlag: 0x01
37
- }));
38
-
39
- expect(integerFlag.getValue()).to.be.eq(01);
40
- });
41
-
42
- it('should return int64', () => {
43
- const value = new InfoValue(infoValue({
44
- lenValue: new NodeInt64(Buffer.from([ 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10]))
45
- }));
46
-
47
- expect(value.getValue()).to.be.instanceOf(NodeInt64);
48
- expect(value.getValue().toNumber()).to.be.eq(4521260802379792);
49
- });
50
- });
@@ -1,62 +0,0 @@
1
- const { expect } = require('chai');
2
- const { TCLIService_types } = require('../../../').thrift;
3
- const StatusFactory = require('../../../dist/factory/StatusFactory').default;
4
-
5
- const statusFactory = new StatusFactory(TCLIService_types);
6
-
7
- describe('StatusFactory', () => {
8
- it('should be success', () => {
9
- const status = statusFactory.create({
10
- statusCode: TCLIService_types.TStatusCode.SUCCESS_STATUS
11
- });
12
-
13
- expect(status.success()).to.be.true;
14
- expect(status.executing()).to.be.false;
15
- });
16
-
17
- it('should be success and have info messages', () => {
18
- const status = statusFactory.create({
19
- statusCode: TCLIService_types.TStatusCode.SUCCESS_WITH_INFO_STATUS,
20
- infoMessages: [ 'message1', 'message2' ]
21
- });
22
-
23
- expect(status.success()).to.be.true;
24
- expect(status.executing()).to.be.false;
25
- expect(status.getInfo()).to.be.deep.eq([ 'message1', 'message2' ]);
26
- });
27
-
28
- it('should be executing', () => {
29
- const status = statusFactory.create({
30
- statusCode: TCLIService_types.TStatusCode.STILL_EXECUTING_STATUS
31
- });
32
-
33
- expect(status.success()).to.be.false;
34
- expect(status.executing()).to.be.true;
35
- });
36
-
37
- it('should have an error', () => {
38
- const error = expect(() => {
39
- statusFactory.create({
40
- statusCode: TCLIService_types.TStatusCode.ERROR_STATUS,
41
- errorMessage: 'error',
42
- errorCode: 1,
43
- infoMessages: ['line1', 'line2']
44
- });
45
- }).to.throw('error');
46
- error.with.property('stack', 'line1\nline2')
47
- error.with.property('code', 1);
48
- error.with.property('name', 'Status Error');
49
- });
50
-
51
- it('should be set as error if handling invalid', () => {
52
- const error = expect(() => {
53
- statusFactory.create({
54
- statusCode: TCLIService_types.TStatusCode.INVALID_HANDLE_STATUS,
55
- errorMessage: 'error',
56
- });
57
- }).to.throw('error');
58
- error.with.property('name', 'Status Error');
59
- error.with.property('message', 'error');
60
- error.with.property('code', -1);;
61
- });
62
- });
@@ -1,115 +0,0 @@
1
- const { expect } = require('chai');
2
- const { TCLIService_types } = require('../../../').thrift;
3
- const HiveDriver = require('../../../dist/hive/HiveDriver').default;
4
-
5
- const toTitleCase = str => str[0].toUpperCase() + str.slice(1);
6
-
7
- const testCommand = (command, request) => {
8
- const client = {};
9
- const driver = new HiveDriver(TCLIService_types, client);
10
- const response = { response: 'value' };
11
- client[toTitleCase(command)] = function (req, cb) {
12
- expect(req).to.be.deep.eq(new TCLIService_types[`T${toTitleCase(command)}Req`](request));
13
- cb(null, response);
14
- };
15
- return driver[command](request).then(resp => {
16
- expect(resp).to.be.deep.eq(response);
17
- });
18
- };
19
-
20
- describe('HiveDriver', () => {
21
- const sessionHandle = { sessionId: { guid: 'guid', secret: 'secret' } };
22
- const operationHandle = {
23
- operationId: { guid: 'guid', secret: 'secret' },
24
- operationType: '',
25
- hasResultSet: false
26
- };
27
-
28
- it('should execute closeSession', () => {
29
- return testCommand('closeSession', { sessionHandle });
30
- });
31
-
32
- it('should execute executeStatement', () => {
33
- return testCommand('executeStatement', { sessionHandle, statement: 'select * from t' });
34
- });
35
-
36
- it('should execute getResultSetMetadata', () => {
37
- return testCommand('getResultSetMetadata', { operationHandle });
38
- });
39
-
40
- it('should execute fetchResults', () => {
41
- return testCommand('fetchResults', { operationHandle, orientation: 1, maxRows: 100 });
42
- });
43
-
44
- it('should execute getInfo', () => {
45
- return testCommand('getInfo', { sessionHandle, infoType: 1 });
46
- });
47
-
48
- it('should execute getTypeInfo', () => {
49
- return testCommand('getTypeInfo', { sessionHandle });
50
- });
51
-
52
- it('should execute getCatalogs', () => {
53
- return testCommand('getCatalogs', { sessionHandle });
54
- });
55
-
56
- it('should execute getSchemas', () => {
57
- return testCommand('getSchemas', { sessionHandle });
58
- });
59
-
60
- it('should execute getTables', () => {
61
- return testCommand('getTables', { sessionHandle });
62
- });
63
-
64
- it('should execute getTableTypes', () => {
65
- return testCommand('getTableTypes', { sessionHandle });
66
- });
67
-
68
- it('should execute getColumns', () => {
69
- return testCommand('getColumns', { sessionHandle });
70
- });
71
-
72
- it('should execute getFunctions', () => {
73
- return testCommand('getFunctions', { sessionHandle, functionName: 'AVG' });
74
- });
75
-
76
- it('should execute getPrimaryKeys', () => {
77
- return testCommand('getPrimaryKeys', { sessionHandle });
78
- });
79
-
80
- it('should execute getCrossReference', () => {
81
- return testCommand('getCrossReference', { sessionHandle });
82
- });
83
-
84
- it('should execute getOperationStatus', () => {
85
- return testCommand('getOperationStatus', { operationHandle });
86
- });
87
-
88
- it('should execute cancelOperation', () => {
89
- return testCommand('cancelOperation', { operationHandle });
90
- });
91
-
92
- it('should execute closeOperation', () => {
93
- return testCommand('closeOperation', { operationHandle });
94
- });
95
-
96
- it('should execute getDelegationToken', () => {
97
- return testCommand('getDelegationToken', { sessionHandle, owner: 'owner', renewer: 'renewer' });
98
- });
99
-
100
- it('should execute cancelDelegationToken', () => {
101
- return testCommand('cancelDelegationToken', { sessionHandle, delegationToken: 'delegationToken' });
102
- });
103
-
104
- it('should execute renewDelegationToken', () => {
105
- return testCommand('renewDelegationToken', { sessionHandle, delegationToken: 'delegationToken' });
106
- });
107
-
108
- it('should execute getQueryId', () => {
109
- return testCommand('getQueryId', { operationHandle });
110
- });
111
-
112
- it('should execute setClientInfo', () => {
113
- return testCommand('setClientInfo', { sessionHandle });
114
- });
115
- });
@@ -1,43 +0,0 @@
1
- const { expect } = require('chai');
2
- const CancelDelegationTokenCommand = require('../../../../dist/hive/Commands/CancelDelegationTokenCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- delegationToken: 'token'
9
- };
10
-
11
- const TCLIService_types = {
12
- TCancelDelegationTokenReq: function (options) {
13
- this.options = options;
14
-
15
- expect(options).to.be.deep.eq(requestMock);
16
- }
17
- };
18
-
19
- const responseMock = {
20
- status: { statusCode: 0 },
21
- };
22
- const thriftClientMock = {
23
- CancelDelegationToken(request, callback) {
24
- return callback(null, responseMock);
25
- }
26
- };
27
-
28
- describe('CancelDelegationTokenCommand', () => {
29
- it('should return response', (cb) => {
30
- const command = new CancelDelegationTokenCommand(
31
- thriftClientMock,
32
- TCLIService_types
33
- );
34
-
35
- command.execute(requestMock)
36
- .then(response => {
37
- expect(response).to.be.deep.eq(responseMock);
38
- cb();
39
- }).catch(error => {
40
- cb(error);
41
- });
42
- });
43
- });
@@ -1,45 +0,0 @@
1
- const { expect } = require('chai');
2
- const CancelOperationCommand = require('../../../../dist/hive/Commands/CancelOperationCommand').default;
3
-
4
- const requestMock = {
5
- operationHandle: {
6
- hasResultSet: true,
7
- operationId: { guid: '', secret: '' },
8
- operationType: 0,
9
- modifiedRowCount: 0
10
- },
11
- };
12
-
13
- const TCLIService_types = {
14
- TCancelOperationReq: function (options) {
15
- this.options = options;
16
-
17
- expect(options).to.be.deep.eq(requestMock);
18
- }
19
- };
20
-
21
- const responseMock = {
22
- status: { statusCode: 0 },
23
- };
24
- const thriftClientMock = {
25
- CancelOperation(request, callback) {
26
- return callback(null, responseMock);
27
- }
28
- };
29
-
30
- describe('CancelOperationCommand', () => {
31
- it('should return response', (cb) => {
32
- const command = new CancelOperationCommand(
33
- thriftClientMock,
34
- TCLIService_types
35
- );
36
-
37
- command.execute(requestMock)
38
- .then(response => {
39
- expect(response).to.be.deep.eq(responseMock);
40
- cb();
41
- }).catch(error => {
42
- cb(error);
43
- });
44
- });
45
- });
@@ -1,45 +0,0 @@
1
- const { expect } = require('chai');
2
- const CloseOperationCommand = require('../../../../dist/hive/Commands/CloseOperationCommand').default;
3
-
4
- const requestMock = {
5
- operationHandle: {
6
- hasResultSet: true,
7
- operationId: { guid: '', secret: '' },
8
- operationType: 0,
9
- modifiedRowCount: 0
10
- },
11
- };
12
-
13
- const TCLIService_types = {
14
- TCloseOperationReq: function (options) {
15
- this.options = options;
16
-
17
- expect(options).to.be.deep.eq(requestMock);
18
- }
19
- };
20
-
21
- const responseMock = {
22
- status: { statusCode: 0 },
23
- };
24
- const thriftClientMock = {
25
- CloseOperation(request, callback) {
26
- return callback(null, responseMock);
27
- }
28
- };
29
-
30
- describe('CloseOperationCommand', () => {
31
- it('should return response', (cb) => {
32
- const command = new CloseOperationCommand(
33
- thriftClientMock,
34
- TCLIService_types
35
- );
36
-
37
- command.execute(requestMock)
38
- .then(response => {
39
- expect(response).to.be.deep.eq(responseMock);
40
- cb();
41
- }).catch(error => {
42
- cb(error);
43
- });
44
- });
45
- });
@@ -1,38 +0,0 @@
1
- const { expect } = require('chai');
2
- const CloseSessionCommand = require('../../../../dist/hive/Commands/CloseSessionCommand').default;
3
-
4
- const TCLIService_types = {
5
- TCloseSessionReq: function (options) {
6
- this.options = options;
7
-
8
- expect(options).has.property('sessionHandle');
9
- }
10
- };
11
- const responseMock = {
12
- status: { statusCode: 0 }
13
- };
14
- const thriftClientMock = {
15
- CloseSession(request, callback) {
16
- return callback(null, responseMock);
17
- }
18
- };
19
-
20
- describe('CloseSessionCommand', () => {
21
- it('should return response', (cb) => {
22
- const command = new CloseSessionCommand(
23
- thriftClientMock,
24
- TCLIService_types
25
- );
26
-
27
- command.execute({
28
- sessionHandle: {
29
- sessionId: { guid: '', secret: '' }
30
- }
31
- }).then(response => {
32
- expect(response).to.be.deep.eq(responseMock);
33
- cb();
34
- }).catch(error => {
35
- cb(error);
36
- });
37
- });
38
- });
@@ -1,54 +0,0 @@
1
- const { expect } = require('chai');
2
- const ExecuteStatementCommand = require('../../../../dist/hive/Commands/ExecuteStatementCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- statement: 'show tables',
9
- confOverlay: {},
10
- runAsync: false,
11
- queryTimeout: 0
12
- };
13
-
14
- const TCLIService_types = {
15
- TExecuteStatementReq: function (options) {
16
- this.options = options;
17
-
18
- expect(options).to.be.deep.eq(requestMock);
19
- }
20
- };
21
-
22
- const EXECUTE_STATEMENT = 0;
23
-
24
- const responseMock = {
25
- status: { statusCode: 0 },
26
- operationHandle: {
27
- hasResultSet: true,
28
- operationId: { guid: '', secret: '' },
29
- operationType: EXECUTE_STATEMENT,
30
- modifiedRowCount: 0
31
- }
32
- };
33
- const thriftClientMock = {
34
- ExecuteStatement(request, callback) {
35
- return callback(null, responseMock);
36
- }
37
- };
38
-
39
- describe('ExecuteStatementCommand', () => {
40
- it('should return response', (cb) => {
41
- const command = new ExecuteStatementCommand(
42
- thriftClientMock,
43
- TCLIService_types
44
- );
45
-
46
- command.execute(requestMock)
47
- .then(response => {
48
- expect(response).to.be.deep.eq(responseMock);
49
- cb();
50
- }).catch(error => {
51
- cb(error);
52
- });
53
- });
54
- });
@@ -1,59 +0,0 @@
1
- const { expect } = require('chai');
2
- const FetchResultsCommand = require('../../../../dist/hive/Commands/FetchResultsCommand').default;
3
-
4
- const requestMock = {
5
- operationHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- orientation: 0,
9
- maxRows: 100,
10
- fetchType: 0
11
- };
12
-
13
- const TCLIService_types = {
14
- TFetchResultsReq: function (options) {
15
- this.options = options;
16
-
17
- expect(options).to.be.deep.eq(requestMock);
18
- }
19
- };
20
-
21
- const responseMock = {
22
- status: { statusCode: 0 },
23
- hasMoreRows: false,
24
- results: {
25
- startRowOffset: 0,
26
- rows: [{
27
- colVals: [true, 'value']
28
- }],
29
- columns: [{
30
- values: [true]
31
- }, {
32
- values: ['value']
33
- }],
34
- binaryColumns: Buffer.from([]),
35
- columnCount: 2
36
- }
37
- };
38
- const thriftClientMock = {
39
- FetchResults(request, callback) {
40
- return callback(null, responseMock);
41
- }
42
- };
43
-
44
- describe('FetchResultsCommand', () => {
45
- it('should return response', (cb) => {
46
- const command = new FetchResultsCommand(
47
- thriftClientMock,
48
- TCLIService_types
49
- );
50
-
51
- command.execute(requestMock)
52
- .then(response => {
53
- expect(response).to.be.deep.eq(responseMock);
54
- cb();
55
- }).catch(error => {
56
- cb(error);
57
- });
58
- });
59
- });
@@ -1,50 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetCatalogsCommand = require('../../../../dist/hive/Commands/GetCatalogsCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- }
8
- };
9
-
10
- const TCLIService_types = {
11
- TGetCatalogsReq: function (options) {
12
- this.options = options;
13
-
14
- expect(options).to.be.deep.eq(requestMock);
15
- }
16
- };
17
-
18
- const GET_CATALOG = 2;
19
-
20
- const responseMock = {
21
- status: { statusCode: 0 },
22
- operationHandle: {
23
- hasResultSet: true,
24
- operationId: { guid: '', secret: '' },
25
- operationType: GET_CATALOG,
26
- modifiedRowCount: 0
27
- }
28
- };
29
- const thriftClientMock = {
30
- GetCatalogs(request, callback) {
31
- return callback(null, responseMock);
32
- }
33
- };
34
-
35
- describe('GetCatalogsCommand', () => {
36
- it('should return response', (cb) => {
37
- const command = new GetCatalogsCommand(
38
- thriftClientMock,
39
- TCLIService_types
40
- );
41
-
42
- command.execute(requestMock)
43
- .then(response => {
44
- expect(response).to.be.deep.eq(responseMock);
45
- cb();
46
- }).catch(error => {
47
- cb(error);
48
- });
49
- });
50
- });
@@ -1,50 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetColumnsCommand = require('../../../../dist/hive/Commands/GetColumnsCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- };
9
-
10
- const TCLIService_types = {
11
- TGetColumnsReq: function (options) {
12
- this.options = options;
13
-
14
- expect(options).to.be.deep.eq(requestMock);
15
- }
16
- };
17
-
18
- const GET_COLUMNS = 6;
19
-
20
- const responseMock = {
21
- status: { statusCode: 0 },
22
- operationHandle: {
23
- hasResultSet: true,
24
- operationId: { guid: '', secret: '' },
25
- operationType: GET_COLUMNS,
26
- modifiedRowCount: 0
27
- }
28
- };
29
- const thriftClientMock = {
30
- GetColumns(request, callback) {
31
- return callback(null, responseMock);
32
- }
33
- };
34
-
35
- describe('GetColumnsCommand', () => {
36
- it('should return response', (cb) => {
37
- const command = new GetColumnsCommand(
38
- thriftClientMock,
39
- TCLIService_types
40
- );
41
-
42
- command.execute(requestMock)
43
- .then(response => {
44
- expect(response).to.be.deep.eq(responseMock);
45
- cb();
46
- }).catch(error => {
47
- cb(error);
48
- });
49
- });
50
- });
@@ -1,56 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetCrossReferenceCommand = require('../../../../dist/hive/Commands/GetCrossReferenceCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- parentCatalogName: 'parentCatalogName',
9
- parentSchemaName: 'parentSchemaName',
10
- parentTableName: 'parentTableName',
11
- foreignCatalogName: 'foreignCatalogName',
12
- foreignSchemaName: 'foreignSchemaName',
13
- foreignTableName: 'foreignTableName',
14
- };
15
-
16
- const TCLIService_types = {
17
- TGetCrossReferenceReq: function (options) {
18
- this.options = options;
19
-
20
- expect(options).to.be.deep.eq(requestMock);
21
- }
22
- };
23
-
24
- const GET_CROSS_REFERENCE = 7;
25
-
26
- const responseMock = {
27
- status: { statusCode: 0 },
28
- operationHandle: {
29
- hasResultSet: true,
30
- operationId: { guid: '', secret: '' },
31
- operationType: GET_CROSS_REFERENCE,
32
- modifiedRowCount: 0
33
- }
34
- };
35
- const thriftClientMock = {
36
- GetCrossReference(request, callback) {
37
- return callback(null, responseMock);
38
- }
39
- };
40
-
41
- describe('GetCrossReferenceCommand', () => {
42
- it('should return response', (cb) => {
43
- const command = new GetCrossReferenceCommand(
44
- thriftClientMock,
45
- TCLIService_types
46
- );
47
-
48
- command.execute(requestMock)
49
- .then(response => {
50
- expect(response).to.be.deep.eq(responseMock);
51
- cb();
52
- }).catch(error => {
53
- cb(error);
54
- });
55
- });
56
- });