@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
@@ -1,45 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetDelegationTokenCommand = require('../../../../dist/hive/Commands/GetDelegationTokenCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- owner: 'user1',
9
- renewer: 'user2'
10
- };
11
-
12
- const TCLIService_types = {
13
- TGetDelegationTokenReq: function (options) {
14
- this.options = options;
15
-
16
- expect(options).to.be.deep.eq(requestMock);
17
- }
18
- };
19
-
20
- const responseMock = {
21
- status: { statusCode: 0 },
22
- delegationToken: 'token'
23
- };
24
- const thriftClientMock = {
25
- GetDelegationToken(request, callback) {
26
- return callback(null, responseMock);
27
- }
28
- };
29
-
30
- describe('GetDelegationTokenCommand', () => {
31
- it('should return response', (cb) => {
32
- const command = new GetDelegationTokenCommand(
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,50 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetFunctionsCommand = require('../../../../dist/hive/Commands/GetFunctionsCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- };
9
-
10
- const TCLIService_types = {
11
- TGetFunctionsReq: function (options) {
12
- this.options = options;
13
-
14
- expect(options).to.be.deep.eq(requestMock);
15
- }
16
- };
17
-
18
- const GET_FUNCTIONS = 7;
19
-
20
- const responseMock = {
21
- status: { statusCode: 0 },
22
- operationHandle: {
23
- hasResultSet: true,
24
- operationId: { guid: '', secret: '' },
25
- operationType: GET_FUNCTIONS,
26
- modifiedRowCount: 0
27
- }
28
- };
29
- const thriftClientMock = {
30
- GetFunctions(request, callback) {
31
- return callback(null, responseMock);
32
- }
33
- };
34
-
35
- describe('GetFunctionsCommand', () => {
36
- it('should return response', (cb) => {
37
- const command = new GetFunctionsCommand(
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,51 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetInfoCommand = require('../../../../dist/hive/Commands/GetInfoCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- infoType: 0
9
- };
10
-
11
- const TCLIService_types = {
12
- TGetInfoReq: 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
- infoValue: {
22
- stringValue: '',
23
- smallIntValue: 0,
24
- integerBitmask: 1,
25
- integerFlag: 0,
26
- binaryValue: Buffer.from([]),
27
- lenValue: Buffer.from([])
28
- }
29
- };
30
- const thriftClientMock = {
31
- GetInfo(request, callback) {
32
- return callback(null, responseMock);
33
- }
34
- };
35
-
36
- describe('GetInfoCommand', () => {
37
- it('should return response', (cb) => {
38
- const command = new GetInfoCommand(
39
- thriftClientMock,
40
- TCLIService_types
41
- );
42
-
43
- command.execute(requestMock)
44
- .then(response => {
45
- expect(response).to.be.deep.eq(responseMock);
46
- cb();
47
- }).catch(error => {
48
- cb(error);
49
- });
50
- });
51
- });
@@ -1,63 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetOperationStatusCommand = require('../../../../dist/hive/Commands/GetOperationStatusCommand').default;
3
-
4
- const requestMock = {
5
- operationHandle: {
6
- hasResultSet: true,
7
- operationId: { guid: '', secret: '' },
8
- operationType: 0,
9
- modifiedRowCount: 0
10
- },
11
- getProgressUpdate: true
12
- };
13
-
14
- const TCLIService_types = {
15
- TGetOperationStatusReq: function (options) {
16
- this.options = options;
17
-
18
- expect(options).to.be.deep.eq(requestMock);
19
- }
20
- };
21
-
22
- const responseMock = {
23
- status: { statusCode: 0 },
24
- operationState: 2,
25
- sqlState: '',
26
- errorCode: 0,
27
- errorMessage: '',
28
- taskStatus: '',
29
- operationStarted: Buffer.from([]),
30
- operationCompleted: Buffer.from([]),
31
- hasResultSet: true,
32
- progressUpdateResponse: {
33
- headerNames: [''],
34
- rows: [['']],
35
- progressedPercentage: 50,
36
- status: 0,
37
- footerSummary: '',
38
- startTime: Buffer.from([])
39
- },
40
- numModifiedRows: Buffer.from([]),
41
- };
42
- const thriftClientMock = {
43
- GetOperationStatus(request, callback) {
44
- return callback(null, responseMock);
45
- }
46
- };
47
-
48
- describe('GetOperationStatusCommand', () => {
49
- it('should return response', (cb) => {
50
- const command = new GetOperationStatusCommand(
51
- thriftClientMock,
52
- TCLIService_types
53
- );
54
-
55
- command.execute(requestMock)
56
- .then(response => {
57
- expect(response).to.be.deep.eq(responseMock);
58
- cb();
59
- }).catch(error => {
60
- cb(error);
61
- });
62
- });
63
- });
@@ -1,50 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetPrimaryKeysCommand = require('../../../../dist/hive/Commands/GetPrimaryKeysCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- };
9
-
10
- const TCLIService_types = {
11
- TGetPrimaryKeysReq: function (options) {
12
- this.options = options;
13
-
14
- expect(options).to.be.deep.eq(requestMock);
15
- }
16
- };
17
-
18
- const GET_PRIMARY_KEYS = 7;
19
-
20
- const responseMock = {
21
- status: { statusCode: 0 },
22
- operationHandle: {
23
- hasResultSet: true,
24
- operationId: { guid: '', secret: '' },
25
- operationType: GET_PRIMARY_KEYS,
26
- modifiedRowCount: 0
27
- }
28
- };
29
- const thriftClientMock = {
30
- GetPrimaryKeys(request, callback) {
31
- return callback(null, responseMock);
32
- }
33
- };
34
-
35
- describe('GetPrimaryKeysCommand', () => {
36
- it('should return response', (cb) => {
37
- const command = new GetPrimaryKeysCommand(
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,42 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetQueryIdCommand = require('../../../../dist/hive/Commands/GetQueryIdCommand').default;
3
-
4
- const requestMock = {
5
- operationHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- }
8
- };
9
-
10
- const TCLIService_types = {
11
- TGetQueryIdReq: function (options) {
12
- this.options = options;
13
-
14
- expect(options).to.be.deep.eq(requestMock);
15
- }
16
- };
17
-
18
- const responseMock = {
19
- queryId: 'id'
20
- };
21
- const thriftClientMock = {
22
- GetQueryId(request, callback) {
23
- return callback(null, responseMock);
24
- }
25
- };
26
-
27
- describe('GetQueryIdCommand', () => {
28
- it('should return response', (cb) => {
29
- const command = new GetQueryIdCommand(
30
- thriftClientMock,
31
- TCLIService_types
32
- );
33
-
34
- command.execute(requestMock)
35
- .then(response => {
36
- expect(response).to.be.deep.eq(responseMock);
37
- cb();
38
- }).catch(error => {
39
- cb(error);
40
- });
41
- });
42
- });
@@ -1,54 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetResultSetMetadataCommand = require('../../../../dist/hive/Commands/GetResultSetMetadataCommand').default;
3
-
4
- const requestMock = {
5
- operationHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- }
8
- };
9
-
10
- const TCLIService_types = {
11
- TGetResultSetMetadataReq: function (options) {
12
- this.options = options;
13
-
14
- expect(options).to.be.deep.eq(requestMock);
15
- }
16
- };
17
-
18
- const responseMock = {
19
- status: { statusCode: 0 },
20
- schema: {
21
- columns: [{
22
- columnName: 'column1',
23
- typeDesc: {
24
- types: [{
25
- type: 0
26
- }]
27
- },
28
- position: 0,
29
- comment: ''
30
- }]
31
- }
32
- };
33
- const thriftClientMock = {
34
- GetResultSetMetadata(request, callback) {
35
- return callback(null, responseMock);
36
- }
37
- };
38
-
39
- describe('GetResultSetMetadataCommand', () => {
40
- it('should return response', (cb) => {
41
- const command = new GetResultSetMetadataCommand(
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,52 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetSchemasCommand = require('../../../../dist/hive/Commands/GetSchemasCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- catalogName: 'catalog',
9
- schemaName: 'schema'
10
- };
11
-
12
- const TCLIService_types = {
13
- TGetSchemasReq: function (options) {
14
- this.options = options;
15
-
16
- expect(options).to.be.deep.eq(requestMock);
17
- }
18
- };
19
-
20
- const GET_SCHEMAS = 3;
21
-
22
- const responseMock = {
23
- status: { statusCode: 0 },
24
- operationHandle: {
25
- hasResultSet: true,
26
- operationId: { guid: '', secret: '' },
27
- operationType: GET_SCHEMAS,
28
- modifiedRowCount: 0
29
- }
30
- };
31
- const thriftClientMock = {
32
- GetSchemas(request, callback) {
33
- return callback(null, responseMock);
34
- }
35
- };
36
-
37
- describe('GetSchemasCommand', () => {
38
- it('should return response', (cb) => {
39
- const command = new GetSchemasCommand(
40
- thriftClientMock,
41
- TCLIService_types
42
- );
43
-
44
- command.execute(requestMock)
45
- .then(response => {
46
- expect(response).to.be.deep.eq(responseMock);
47
- cb();
48
- }).catch(error => {
49
- cb(error);
50
- });
51
- });
52
- });
@@ -1,50 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetTableTypesCommand = require('../../../../dist/hive/Commands/GetTableTypesCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- };
9
-
10
- const TCLIService_types = {
11
- TGetTableTypesReq: function (options) {
12
- this.options = options;
13
-
14
- expect(options).to.be.deep.eq(requestMock);
15
- }
16
- };
17
-
18
- const GET_TABLE_TYPES = 5;
19
-
20
- const responseMock = {
21
- status: { statusCode: 0 },
22
- operationHandle: {
23
- hasResultSet: true,
24
- operationId: { guid: '', secret: '' },
25
- operationType: GET_TABLE_TYPES,
26
- modifiedRowCount: 0
27
- }
28
- };
29
- const thriftClientMock = {
30
- GetTableTypes(request, callback) {
31
- return callback(null, responseMock);
32
- }
33
- };
34
-
35
- describe('GetTableTypesCommand', () => {
36
- it('should return response', (cb) => {
37
- const command = new GetTableTypesCommand(
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,54 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetTablesCommand = require('../../../../dist/hive/Commands/GetTablesCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- catalogName: 'catalog',
9
- schemaName: 'schema',
10
- tableName: 'table',
11
- tableTypes: ['TABLE', 'VIEW', 'SYSTEM TABLE', 'GLOBAL TEMPORARY', 'LOCAL TEMPORARY', 'ALIAS', 'SYNONYM']
12
- };
13
-
14
- const TCLIService_types = {
15
- TGetTablesReq: function (options) {
16
- this.options = options;
17
-
18
- expect(options).to.be.deep.eq(requestMock);
19
- }
20
- };
21
-
22
- const GET_TABLES = 4;
23
-
24
- const responseMock = {
25
- status: { statusCode: 0 },
26
- operationHandle: {
27
- hasResultSet: true,
28
- operationId: { guid: '', secret: '' },
29
- operationType: GET_TABLES,
30
- modifiedRowCount: 0
31
- }
32
- };
33
- const thriftClientMock = {
34
- GetTables(request, callback) {
35
- return callback(null, responseMock);
36
- }
37
- };
38
-
39
- describe('GetTablesCommand', () => {
40
- it('should return response', (cb) => {
41
- const command = new GetTablesCommand(
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,50 +0,0 @@
1
- const { expect } = require('chai');
2
- const GetTypeInfoCommand = require('../../../../dist/hive/Commands/GetTypeInfoCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- }
8
- };
9
-
10
- const TCLIService_types = {
11
- TGetTypeInfoReq: function (options) {
12
- this.options = options;
13
-
14
- expect(options).to.be.deep.eq(requestMock);
15
- }
16
- };
17
-
18
- const GET_TYPE_INFO = 1;
19
-
20
- const responseMock = {
21
- status: { statusCode: 0 },
22
- operationHandle: {
23
- hasResultSet: true,
24
- operationId: { guid: '', secret: '' },
25
- operationType: GET_TYPE_INFO,
26
- modifiedRowCount: 0
27
- }
28
- };
29
- const thriftClientMock = {
30
- GetTypeInfo(request, callback) {
31
- return callback(null, responseMock);
32
- }
33
- };
34
-
35
- describe('GetTypeInfoCommand', () => {
36
- it('should return response', (cb) => {
37
- const command = new GetTypeInfoCommand(
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,43 +0,0 @@
1
- const { expect } = require('chai');
2
- const OpenSessionCommand = require('../../../../dist/hive/Commands/OpenSessionCommand').default;
3
-
4
- const CLIENT_PROTOCOL = 8;
5
-
6
- const TCLIService_types = {
7
- TOpenSessionReq: function (options) {
8
- this.options = options;
9
-
10
- expect(options.client_protocol).to.be.eq(CLIENT_PROTOCOL);
11
- }
12
- };
13
- const responseMock = {
14
- status: { statusCode: 0 },
15
- serverProtocolVersion: CLIENT_PROTOCOL,
16
- sessionHandle: {
17
- sessionId: { guid: '', secret: '' }
18
- },
19
- configuration: {}
20
- };
21
- const thriftClientMock = {
22
- OpenSession(request, callback) {
23
- return callback(null, responseMock);
24
- }
25
- };
26
-
27
- describe('OpenSessionCommand', () => {
28
- it('should return response', (cb) => {
29
- const command = new OpenSessionCommand(
30
- thriftClientMock,
31
- TCLIService_types
32
- );
33
-
34
- command.execute({
35
- client_protocol: CLIENT_PROTOCOL
36
- }).then(response => {
37
- expect(response).to.be.deep.eq(responseMock);
38
- cb();
39
- }).catch(error => {
40
- cb(error);
41
- });
42
- });
43
- });
@@ -1,43 +0,0 @@
1
- const { expect } = require('chai');
2
- const RenewDelegationTokenCommand = require('../../../../dist/hive/Commands/RenewDelegationTokenCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- delegationToken: 'token'
9
- };
10
-
11
- const TCLIService_types = {
12
- TRenewDelegationTokenReq: 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
- RenewDelegationToken(request, callback) {
24
- return callback(null, responseMock);
25
- }
26
- };
27
-
28
- describe('RenewDelegationTokenCommand', () => {
29
- it('should return response', (cb) => {
30
- const command = new RenewDelegationTokenCommand(
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 SetClientInfoCommand = require('../../../../dist/hive/Commands/SetClientInfoCommand').default;
3
-
4
- const requestMock = {
5
- sessionHandle: {
6
- sessionId: { guid: '', secret: '' }
7
- },
8
- configuration: {
9
- param: 'value'
10
- }
11
- };
12
-
13
- const TCLIService_types = {
14
- TSetClientInfoReq: 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
- SetClientInfo(request, callback) {
26
- return callback(null, responseMock);
27
- }
28
- };
29
-
30
- describe('SetClientInfoCommand', () => {
31
- it('should return response', (cb) => {
32
- const command = new SetClientInfoCommand(
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
- });