@databricks/sql 1.1.0 → 1.1.1

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 (79) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/version.d.ts +1 -1
  3. package/dist/version.js +1 -1
  4. package/node_modules/async-limiter/.eslintignore +2 -0
  5. package/node_modules/async-limiter/.nycrc +10 -0
  6. package/node_modules/async-limiter/.travis.yml +9 -0
  7. package/node_modules/async-limiter/LICENSE +8 -0
  8. package/node_modules/async-limiter/index.js +67 -0
  9. package/node_modules/async-limiter/package.json +39 -0
  10. package/node_modules/async-limiter/readme.md +132 -0
  11. package/node_modules/browser-or-node/LICENSE +21 -0
  12. package/node_modules/browser-or-node/README.md +63 -0
  13. package/node_modules/browser-or-node/lib/index.js +31 -0
  14. package/node_modules/browser-or-node/package.json +64 -0
  15. package/node_modules/browser-or-node/src/index.js +26 -0
  16. package/node_modules/isomorphic-ws/LICENSE +21 -0
  17. package/node_modules/isomorphic-ws/README.md +58 -0
  18. package/node_modules/isomorphic-ws/browser.js +17 -0
  19. package/node_modules/isomorphic-ws/index.d.ts +8 -0
  20. package/node_modules/isomorphic-ws/node.js +3 -0
  21. package/node_modules/isomorphic-ws/package.json +38 -0
  22. package/node_modules/node-int64/.npmignore +3 -0
  23. package/node_modules/node-int64/Int64.js +268 -0
  24. package/node_modules/node-int64/LICENSE +19 -0
  25. package/node_modules/node-int64/README.md +78 -0
  26. package/node_modules/node-int64/package.json +31 -0
  27. package/node_modules/node-int64/test.js +120 -0
  28. package/node_modules/q/CHANGES.md +800 -0
  29. package/node_modules/q/LICENSE +18 -0
  30. package/node_modules/q/README.md +874 -0
  31. package/node_modules/q/package.json +80 -0
  32. package/node_modules/q/q.js +2076 -0
  33. package/node_modules/q/queue.js +35 -0
  34. package/node_modules/thrift/LICENSE +306 -0
  35. package/node_modules/thrift/README.md +210 -0
  36. package/node_modules/thrift/lib/nodejs/README.md +142 -0
  37. package/node_modules/thrift/lib/nodejs/lib/thrift/binary.js +168 -0
  38. package/node_modules/thrift/lib/nodejs/lib/thrift/binary_protocol.js +367 -0
  39. package/node_modules/thrift/lib/nodejs/lib/thrift/browser.js +49 -0
  40. package/node_modules/thrift/lib/nodejs/lib/thrift/buffered_transport.js +186 -0
  41. package/node_modules/thrift/lib/nodejs/lib/thrift/compact_protocol.js +915 -0
  42. package/node_modules/thrift/lib/nodejs/lib/thrift/connection.js +396 -0
  43. package/node_modules/thrift/lib/nodejs/lib/thrift/create_client.js +54 -0
  44. package/node_modules/thrift/lib/nodejs/lib/thrift/framed_transport.js +185 -0
  45. package/node_modules/thrift/lib/nodejs/lib/thrift/header_protocol.js +258 -0
  46. package/node_modules/thrift/lib/nodejs/lib/thrift/header_transport.js +341 -0
  47. package/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js +282 -0
  48. package/node_modules/thrift/lib/nodejs/lib/thrift/index.js +76 -0
  49. package/node_modules/thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error.js +32 -0
  50. package/node_modules/thrift/lib/nodejs/lib/thrift/int64_util.js +91 -0
  51. package/node_modules/thrift/lib/nodejs/lib/thrift/json_parse.js +299 -0
  52. package/node_modules/thrift/lib/nodejs/lib/thrift/json_protocol.js +799 -0
  53. package/node_modules/thrift/lib/nodejs/lib/thrift/log.js +87 -0
  54. package/node_modules/thrift/lib/nodejs/lib/thrift/multiplexed_processor.js +63 -0
  55. package/node_modules/thrift/lib/nodejs/lib/thrift/multiplexed_protocol.js +73 -0
  56. package/node_modules/thrift/lib/nodejs/lib/thrift/protocol.js +22 -0
  57. package/node_modules/thrift/lib/nodejs/lib/thrift/server.js +123 -0
  58. package/node_modules/thrift/lib/nodejs/lib/thrift/thrift.js +241 -0
  59. package/node_modules/thrift/lib/nodejs/lib/thrift/transport.js +22 -0
  60. package/node_modules/thrift/lib/nodejs/lib/thrift/web_server.js +567 -0
  61. package/node_modules/thrift/lib/nodejs/lib/thrift/ws_connection.js +286 -0
  62. package/node_modules/thrift/lib/nodejs/lib/thrift/ws_transport.js +206 -0
  63. package/node_modules/thrift/lib/nodejs/lib/thrift/xhr_connection.js +280 -0
  64. package/node_modules/thrift/package.json +76 -0
  65. package/node_modules/ws/LICENSE +21 -0
  66. package/node_modules/ws/README.md +417 -0
  67. package/node_modules/ws/index.js +9 -0
  68. package/node_modules/ws/lib/buffer-util.js +72 -0
  69. package/node_modules/ws/lib/constants.js +10 -0
  70. package/node_modules/ws/lib/event-target.js +170 -0
  71. package/node_modules/ws/lib/extension.js +211 -0
  72. package/node_modules/ws/lib/permessage-deflate.js +516 -0
  73. package/node_modules/ws/lib/receiver.js +513 -0
  74. package/node_modules/ws/lib/sender.js +401 -0
  75. package/node_modules/ws/lib/validation.js +29 -0
  76. package/node_modules/ws/lib/websocket-server.js +369 -0
  77. package/node_modules/ws/lib/websocket.js +828 -0
  78. package/node_modules/ws/package.json +48 -0
  79. package/package.json +5 -2
@@ -0,0 +1,186 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ var binary = require('./binary');
21
+ var InputBufferUnderrunError = require('./input_buffer_underrun_error');
22
+ var THeaderTransport = require('./header_transport');
23
+
24
+ module.exports = TBufferedTransport;
25
+
26
+ function TBufferedTransport(buffer, callback) {
27
+ this.defaultReadBufferSize = 1024;
28
+ this.writeBufferSize = 512; // Soft Limit
29
+ this.inBuf = new Buffer(this.defaultReadBufferSize);
30
+ this.readCursor = 0;
31
+ this.writeCursor = 0; // for input buffer
32
+ this.outBuffers = [];
33
+ this.outCount = 0;
34
+ this.onFlush = callback;
35
+ };
36
+
37
+ TBufferedTransport.prototype = new THeaderTransport();
38
+
39
+ TBufferedTransport.prototype.reset = function() {
40
+ this.inBuf = new Buffer(this.defaultReadBufferSize);
41
+ this.readCursor = 0;
42
+ this.writeCursor = 0;
43
+ this.outBuffers = [];
44
+ this.outCount = 0;
45
+ }
46
+
47
+ TBufferedTransport.receiver = function(callback, seqid) {
48
+ var reader = new TBufferedTransport();
49
+
50
+ return function(data) {
51
+ if (reader.writeCursor + data.length > reader.inBuf.length) {
52
+ var buf = new Buffer(reader.writeCursor + data.length);
53
+ reader.inBuf.copy(buf, 0, 0, reader.writeCursor);
54
+ reader.inBuf = buf;
55
+ }
56
+ data.copy(reader.inBuf, reader.writeCursor, 0);
57
+ reader.writeCursor += data.length;
58
+
59
+ callback(reader, seqid);
60
+ };
61
+ };
62
+
63
+
64
+ TBufferedTransport.prototype.commitPosition = function(){
65
+ var unreadSize = this.writeCursor - this.readCursor;
66
+ var bufSize = (unreadSize * 2 > this.defaultReadBufferSize) ?
67
+ unreadSize * 2 : this.defaultReadBufferSize;
68
+ var buf = new Buffer(bufSize);
69
+ if (unreadSize > 0) {
70
+ this.inBuf.copy(buf, 0, this.readCursor, this.writeCursor);
71
+ }
72
+ this.readCursor = 0;
73
+ this.writeCursor = unreadSize;
74
+ this.inBuf = buf;
75
+ };
76
+
77
+ TBufferedTransport.prototype.rollbackPosition = function(){
78
+ this.readCursor = 0;
79
+ }
80
+
81
+ // TODO: Implement open/close support
82
+ TBufferedTransport.prototype.isOpen = function() {
83
+ return true;
84
+ };
85
+
86
+ TBufferedTransport.prototype.open = function() {
87
+ };
88
+
89
+ TBufferedTransport.prototype.close = function() {
90
+ };
91
+
92
+ // Set the seqid of the message in the client
93
+ // So that callbacks can be found
94
+ TBufferedTransport.prototype.setCurrSeqId = function(seqid) {
95
+ this._seqid = seqid;
96
+ };
97
+
98
+ TBufferedTransport.prototype.ensureAvailable = function(len) {
99
+ if (this.readCursor + len > this.writeCursor) {
100
+ throw new InputBufferUnderrunError();
101
+ }
102
+ };
103
+
104
+ TBufferedTransport.prototype.read = function(len) {
105
+ this.ensureAvailable(len);
106
+ var buf = new Buffer(len);
107
+ this.inBuf.copy(buf, 0, this.readCursor, this.readCursor + len);
108
+ this.readCursor += len;
109
+ return buf;
110
+ };
111
+
112
+ TBufferedTransport.prototype.readByte = function() {
113
+ this.ensureAvailable(1);
114
+ return binary.readByte(this.inBuf[this.readCursor++]);
115
+ };
116
+
117
+ TBufferedTransport.prototype.readI16 = function() {
118
+ this.ensureAvailable(2);
119
+ var i16 = binary.readI16(this.inBuf, this.readCursor);
120
+ this.readCursor += 2;
121
+ return i16;
122
+ };
123
+
124
+ TBufferedTransport.prototype.readI32 = function() {
125
+ this.ensureAvailable(4);
126
+ var i32 = binary.readI32(this.inBuf, this.readCursor);
127
+ this.readCursor += 4;
128
+ return i32;
129
+ };
130
+
131
+ TBufferedTransport.prototype.readDouble = function() {
132
+ this.ensureAvailable(8);
133
+ var d = binary.readDouble(this.inBuf, this.readCursor);
134
+ this.readCursor += 8;
135
+ return d;
136
+ };
137
+
138
+ TBufferedTransport.prototype.readString = function(len) {
139
+ this.ensureAvailable(len);
140
+ var str = this.inBuf.toString('utf8', this.readCursor, this.readCursor + len);
141
+ this.readCursor += len;
142
+ return str;
143
+ };
144
+
145
+ TBufferedTransport.prototype.borrow = function() {
146
+ var obj = {buf: this.inBuf, readIndex: this.readCursor, writeIndex: this.writeCursor};
147
+ return obj;
148
+ };
149
+
150
+ TBufferedTransport.prototype.consume = function(bytesConsumed) {
151
+ this.readCursor += bytesConsumed;
152
+ };
153
+
154
+ TBufferedTransport.prototype.write = function(buf) {
155
+ if (typeof(buf) === "string") {
156
+ buf = new Buffer(buf, 'utf8');
157
+ }
158
+ this.outBuffers.push(buf);
159
+ this.outCount += buf.length;
160
+ };
161
+
162
+ TBufferedTransport.prototype.flush = function() {
163
+ // If the seqid of the callback is available pass it to the onFlush
164
+ // Then remove the current seqid
165
+ var seqid = this._seqid;
166
+ this._seqid = null;
167
+
168
+ if (this.outCount < 1) {
169
+ return;
170
+ }
171
+
172
+ var msg = new Buffer(this.outCount),
173
+ pos = 0;
174
+ this.outBuffers.forEach(function(buf) {
175
+ buf.copy(msg, pos, 0);
176
+ pos += buf.length;
177
+ });
178
+
179
+ if (this.onFlush) {
180
+ // Passing seqid through this call to get it to the connection
181
+ this.onFlush(msg, seqid);
182
+ }
183
+
184
+ this.outBuffers = [];
185
+ this.outCount = 0;
186
+ }