@tdengine/websocket 3.0.0 → 3.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.
- package/lib/example/all_type_query.d.ts +2 -0
- package/lib/example/all_type_query.d.ts.map +1 -0
- package/lib/example/all_type_query.js +89 -0
- package/lib/example/all_type_stmt.d.ts +2 -0
- package/lib/example/all_type_stmt.d.ts.map +1 -0
- package/lib/example/all_type_stmt.js +130 -0
- package/lib/example/basicBatchTmq.d.ts +2 -0
- package/lib/example/basicBatchTmq.d.ts.map +1 -0
- package/lib/example/basicBatchTmq.js +129 -0
- package/lib/example/basicSchemaless.d.ts +2 -0
- package/lib/example/basicSchemaless.d.ts.map +1 -0
- package/lib/example/basicSchemaless.js +47 -0
- package/lib/example/basicSql.d.ts +2 -0
- package/lib/example/basicSql.d.ts.map +1 -0
- package/lib/example/basicSql.js +54 -0
- package/lib/example/basicStmt.d.ts +2 -0
- package/lib/example/basicStmt.d.ts.map +1 -0
- package/lib/example/basicStmt.js +72 -0
- package/lib/example/basicTmq.d.ts +2 -0
- package/lib/example/basicTmq.d.ts.map +1 -0
- package/lib/example/basicTmq.js +73 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +41 -0
- package/lib/src/client/wsClient.d.ts +22 -0
- package/lib/src/client/wsClient.d.ts.map +1 -0
- package/lib/src/client/wsClient.js +256 -0
- package/lib/src/client/wsConnector.d.ts +17 -0
- package/lib/src/client/wsConnector.d.ts.map +1 -0
- package/lib/src/client/wsConnector.js +140 -0
- package/lib/src/client/wsConnectorPool.d.ts +13 -0
- package/lib/src/client/wsConnectorPool.d.ts.map +1 -0
- package/lib/src/client/wsConnectorPool.js +107 -0
- package/lib/src/client/wsEventCallback.d.ts +22 -0
- package/lib/src/client/wsEventCallback.d.ts.map +1 -0
- package/lib/src/client/wsEventCallback.js +97 -0
- package/lib/src/client/wsResponse.d.ts +74 -0
- package/lib/src/client/wsResponse.d.ts.map +1 -0
- package/lib/src/client/wsResponse.js +103 -0
- package/lib/src/common/config.d.ts +22 -0
- package/lib/src/common/config.d.ts.map +1 -0
- package/lib/src/common/config.js +45 -0
- package/lib/src/common/constant.d.ts +35 -0
- package/lib/src/common/constant.d.ts.map +1 -0
- package/lib/src/common/constant.js +78 -0
- package/lib/src/common/log.d.ts +5 -0
- package/lib/src/common/log.d.ts.map +1 -0
- package/lib/src/common/log.js +40 -0
- package/lib/src/common/reqid.d.ts +8 -0
- package/lib/src/common/reqid.d.ts.map +1 -0
- package/lib/src/common/reqid.js +59 -0
- package/lib/src/common/taosResult.d.ts +57 -0
- package/lib/src/common/taosResult.d.ts.map +1 -0
- package/lib/src/common/taosResult.js +449 -0
- package/lib/src/common/ut8Helper.d.ts +2 -0
- package/lib/src/common/ut8Helper.d.ts.map +1 -0
- package/{src/ut8Helper.ts → lib/src/common/ut8Helper.js} +22 -21
- package/lib/src/common/utils.d.ts +7 -0
- package/lib/src/common/utils.d.ts.map +1 -0
- package/lib/src/common/utils.js +66 -0
- package/lib/src/common/wsError.d.ts +29 -0
- package/lib/src/common/wsError.d.ts.map +1 -0
- package/lib/src/common/wsError.js +51 -0
- package/{src/wsOptions.ts → lib/src/common/wsOptions.d.ts} +4 -2
- package/lib/src/common/wsOptions.d.ts.map +1 -0
- package/lib/src/common/wsOptions.js +2 -0
- package/lib/src/index.d.ts +9 -0
- package/lib/src/index.d.ts.map +1 -0
- package/lib/src/index.js +58 -0
- package/lib/src/sql/wsProto.d.ts +26 -0
- package/lib/src/sql/wsProto.d.ts.map +1 -0
- package/lib/src/sql/wsProto.js +19 -0
- package/lib/src/sql/wsRows.d.ts +16 -0
- package/lib/src/sql/wsRows.d.ts.map +1 -0
- package/lib/src/sql/wsRows.js +87 -0
- package/lib/src/sql/wsSql.d.ts +24 -0
- package/lib/src/sql/wsSql.d.ts.map +1 -0
- package/lib/src/sql/wsSql.js +174 -0
- package/lib/src/stmt/wsParams.d.ts +41 -0
- package/lib/src/stmt/wsParams.d.ts.map +1 -0
- package/lib/src/stmt/wsParams.js +428 -0
- package/lib/src/stmt/wsProto.d.ts +27 -0
- package/lib/src/stmt/wsProto.d.ts.map +1 -0
- package/lib/src/stmt/wsProto.js +67 -0
- package/lib/src/stmt/wsStmt.d.ts +30 -0
- package/lib/src/stmt/wsStmt.d.ts.map +1 -0
- package/lib/src/stmt/wsStmt.js +207 -0
- package/lib/src/tmq/config.d.ts +14 -0
- package/lib/src/tmq/config.d.ts.map +1 -0
- package/lib/src/tmq/config.js +42 -0
- package/lib/src/tmq/constant.d.ts +100 -0
- package/lib/src/tmq/constant.d.ts.map +1 -0
- package/lib/src/tmq/constant.js +105 -0
- package/lib/src/tmq/tmqResponse.d.ts +92 -0
- package/lib/src/tmq/tmqResponse.d.ts.map +1 -0
- package/lib/src/tmq/tmqResponse.js +329 -0
- package/lib/src/tmq/wsTmq.d.ts +32 -0
- package/lib/src/tmq/wsTmq.d.ts.map +1 -0
- package/lib/src/tmq/wsTmq.js +319 -0
- package/lib/test/bulkPulling/log.test.d.ts +2 -0
- package/lib/test/bulkPulling/log.test.d.ts.map +1 -0
- package/lib/test/bulkPulling/log.test.js +44 -0
- package/lib/test/bulkPulling/queryTables.test.d.ts +2 -0
- package/lib/test/bulkPulling/queryTables.test.d.ts.map +1 -0
- package/lib/test/bulkPulling/queryTables.test.js +297 -0
- package/lib/test/bulkPulling/schemaless.test.d.ts +2 -0
- package/lib/test/bulkPulling/schemaless.test.d.ts.map +1 -0
- package/lib/test/bulkPulling/schemaless.test.js +95 -0
- package/lib/test/bulkPulling/sql.test.d.ts +2 -0
- package/lib/test/bulkPulling/sql.test.d.ts.map +1 -0
- package/lib/test/bulkPulling/sql.test.js +144 -0
- package/lib/test/bulkPulling/stmt.func.test.d.ts +2 -0
- package/lib/test/bulkPulling/stmt.func.test.d.ts.map +1 -0
- package/lib/test/bulkPulling/stmt.func.test.js +397 -0
- package/lib/test/bulkPulling/stmt.type.test.d.ts +2 -0
- package/lib/test/bulkPulling/stmt.type.test.d.ts.map +1 -0
- package/lib/test/bulkPulling/stmt.type.test.js +269 -0
- package/lib/test/bulkPulling/tmq.test.d.ts +2 -0
- package/lib/test/bulkPulling/tmq.test.d.ts.map +1 -0
- package/lib/test/bulkPulling/tmq.test.js +178 -0
- package/lib/test/bulkPulling/wsConnectPool.test.d.ts +2 -0
- package/lib/test/bulkPulling/wsConnectPool.test.d.ts.map +1 -0
- package/lib/test/bulkPulling/wsConnectPool.test.js +136 -0
- package/lib/test/utils.d.ts +18 -0
- package/lib/test/utils.d.ts.map +1 -0
- package/lib/test/utils.js +318 -0
- package/package.json +27 -14
- package/readme.md +302 -0
- package/README.md +0 -59
- package/dist/browser/index.js +0 -778
- package/dist/main/index.js +0 -711
- package/dist/main/index.js.map +0 -1
- package/dist/module/index.mjs +0 -704
- package/dist/module/index.mjs.map +0 -1
- package/dist/types.d.ts +0 -103
- package/dist/types.d.ts.map +0 -1
- package/example/basicUsageAsync.ts +0 -48
- package/example/basicUsagePrimse.ts +0 -43
- package/example/cloudUsage.ts +0 -55
- package/example/continousConnectAndVersion.ts +0 -16
- package/example/test.mjs +0 -51
- package/index.ts +0 -7
- package/jest.config.js +0 -8
- package/src/constant.ts +0 -74
- package/src/taosResult.ts +0 -269
- package/src/tdengineWebsocket.ts +0 -39
- package/src/wsClient.ts +0 -196
- package/src/wsError.ts +0 -5
- package/src/wsQuery.ts +0 -30
- package/src/wsQueryInterface.ts +0 -212
- package/src/wsQueryResponse.ts +0 -112
- package/tdengine-websocket-3.0.0.tgz +0 -0
- package/test/bulkPulling/connect.test.ts +0 -27
- package/test/bulkPulling/queryTables.test.ts +0 -274
- package/test/bulkPulling/version.test.ts +0 -19
- package/test/utils.ts +0 -235
- package/tsconfig.json +0 -101
package/dist/browser/index.js
DELETED
|
@@ -1,778 +0,0 @@
|
|
|
1
|
-
var $d6Ue0$buffer = require("buffer");
|
|
2
|
-
|
|
3
|
-
function $parcel$export(e, n, v, s) {
|
|
4
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
5
|
-
}
|
|
6
|
-
var $parcel$global =
|
|
7
|
-
typeof globalThis !== 'undefined'
|
|
8
|
-
? globalThis
|
|
9
|
-
: typeof self !== 'undefined'
|
|
10
|
-
? self
|
|
11
|
-
: typeof window !== 'undefined'
|
|
12
|
-
? window
|
|
13
|
-
: typeof global !== 'undefined'
|
|
14
|
-
? global
|
|
15
|
-
: {};
|
|
16
|
-
var $parcel$modules = {};
|
|
17
|
-
var $parcel$inits = {};
|
|
18
|
-
|
|
19
|
-
var parcelRequire = $parcel$global["parcelRequire2729"];
|
|
20
|
-
if (parcelRequire == null) {
|
|
21
|
-
parcelRequire = function(id) {
|
|
22
|
-
if (id in $parcel$modules) {
|
|
23
|
-
return $parcel$modules[id].exports;
|
|
24
|
-
}
|
|
25
|
-
if (id in $parcel$inits) {
|
|
26
|
-
var init = $parcel$inits[id];
|
|
27
|
-
delete $parcel$inits[id];
|
|
28
|
-
var module = {id: id, exports: {}};
|
|
29
|
-
$parcel$modules[id] = module;
|
|
30
|
-
init.call(module.exports, module, module.exports);
|
|
31
|
-
return module.exports;
|
|
32
|
-
}
|
|
33
|
-
var err = new Error("Cannot find module '" + id + "'");
|
|
34
|
-
err.code = 'MODULE_NOT_FOUND';
|
|
35
|
-
throw err;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
parcelRequire.register = function register(id, init) {
|
|
39
|
-
$parcel$inits[id] = init;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
$parcel$global["parcelRequire2729"] = parcelRequire;
|
|
43
|
-
}
|
|
44
|
-
parcelRequire.register("69yKH", function(module, exports) {
|
|
45
|
-
var $47ae8a62cab4bf08$var$naiveFallback = function() {
|
|
46
|
-
if (typeof self === "object" && self) return self;
|
|
47
|
-
if (typeof window === "object" && window) return window;
|
|
48
|
-
throw new Error("Unable to resolve global `this`");
|
|
49
|
-
};
|
|
50
|
-
module.exports = function() {
|
|
51
|
-
if (this) return this;
|
|
52
|
-
// Unexpected strict mode (may happen if e.g. bundled into ESM module)
|
|
53
|
-
// Fallback to standard globalThis if available
|
|
54
|
-
if (typeof globalThis === "object" && globalThis) return globalThis;
|
|
55
|
-
// Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
|
|
56
|
-
// In all ES5+ engines global object inherits from Object.prototype
|
|
57
|
-
// (if you approached one that doesn't please report)
|
|
58
|
-
try {
|
|
59
|
-
Object.defineProperty(Object.prototype, "__global__", {
|
|
60
|
-
get: function() {
|
|
61
|
-
return this;
|
|
62
|
-
},
|
|
63
|
-
configurable: true
|
|
64
|
-
});
|
|
65
|
-
} catch (error) {
|
|
66
|
-
// Unfortunate case of updates to Object.prototype being restricted
|
|
67
|
-
// via preventExtensions, seal or freeze
|
|
68
|
-
return $47ae8a62cab4bf08$var$naiveFallback();
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
// Safari case (window.__global__ works, but __global__ does not)
|
|
72
|
-
if (!__global__) return $47ae8a62cab4bf08$var$naiveFallback();
|
|
73
|
-
return __global__;
|
|
74
|
-
} finally{
|
|
75
|
-
delete Object.prototype.__global__;
|
|
76
|
-
}
|
|
77
|
-
}();
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
parcelRequire.register("k36f6", function(module, exports) {
|
|
82
|
-
module.exports = JSON.parse('{"name":"websocket","description":"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.","keywords":["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],"author":"Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)","contributors":["I\xf1aki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"],"version":"1.0.34","repository":{"type":"git","url":"https://github.com/theturtle32/WebSocket-Node.git"},"homepage":"https://github.com/theturtle32/WebSocket-Node","engines":{"node":">=4.0.0"},"dependencies":{"bufferutil":"^4.0.1","debug":"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2","yaeti":"^0.0.6"},"devDependencies":{"buffer-equal":"^1.0.0","gulp":"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1","jshint":"^2.0.0","tape":"^4.9.1"},"config":{"verbose":false},"scripts":{"test":"tape test/unit/*.js","gulp":"gulp"},"main":"index","directories":{"lib":"./lib"},"browser":"lib/browser.js","license":"Apache-2.0"}');
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
$parcel$export(module.exports, "connect", () => $dd27acfa38609814$export$64605811ab45167f);
|
|
88
|
-
const $1a532b64e63a9aa7$export$7138a112355d88b8 = {
|
|
89
|
-
0: "NULL",
|
|
90
|
-
1: "BOOL",
|
|
91
|
-
2: "TINYINT",
|
|
92
|
-
3: "SMALLINT",
|
|
93
|
-
4: "INT",
|
|
94
|
-
5: "BIGINT",
|
|
95
|
-
6: "FLOAT",
|
|
96
|
-
7: "DOUBLE",
|
|
97
|
-
8: "VARCHAR",
|
|
98
|
-
9: "TIMESTAMP",
|
|
99
|
-
10: "NCHAR",
|
|
100
|
-
11: "TINYINT UNSIGNED",
|
|
101
|
-
12: "SMALLINT UNSIGNED",
|
|
102
|
-
13: "INT UNSIGNED",
|
|
103
|
-
14: "BIGINT UNSIGNED",
|
|
104
|
-
15: "JSON"
|
|
105
|
-
};
|
|
106
|
-
const $1a532b64e63a9aa7$export$9c85ccb1eaab884c = {
|
|
107
|
-
"SOLID": 0,
|
|
108
|
-
"VARCHAR": 1,
|
|
109
|
-
"NCHAR": 2
|
|
110
|
-
};
|
|
111
|
-
const $1a532b64e63a9aa7$export$9f025993407a7e76 = {
|
|
112
|
-
"NULL": 0,
|
|
113
|
-
"BOOL": 1,
|
|
114
|
-
"TINYINT": 2,
|
|
115
|
-
"SMALLINT": 3,
|
|
116
|
-
"INT": 4,
|
|
117
|
-
"BIGINT": 5,
|
|
118
|
-
"FLOAT": 6,
|
|
119
|
-
"DOUBLE": 7,
|
|
120
|
-
"BINARY": 8,
|
|
121
|
-
"VARCHAR": 8,
|
|
122
|
-
"TIMESTAMP": 9,
|
|
123
|
-
"NCHAR": 10,
|
|
124
|
-
"TINYINT UNSIGNED": 11,
|
|
125
|
-
"SMALLINT UNSIGNED": 12,
|
|
126
|
-
"INT UNSIGNED": 13,
|
|
127
|
-
"BIGINT UNSIGNED": 14,
|
|
128
|
-
"JSON": 15
|
|
129
|
-
};
|
|
130
|
-
const $1a532b64e63a9aa7$export$a24993810630aa00 = {
|
|
131
|
-
0: "MILLISECOND",
|
|
132
|
-
1: "MICROSECOND",
|
|
133
|
-
2: "NANOSECOND"
|
|
134
|
-
};
|
|
135
|
-
const $1a532b64e63a9aa7$export$60958af5d03c3d00 = {
|
|
136
|
-
"BOOL": 1,
|
|
137
|
-
"TINYINT": 1,
|
|
138
|
-
"SMALLINT": 2,
|
|
139
|
-
"INT": 4,
|
|
140
|
-
"BIGINT": 8,
|
|
141
|
-
"FLOAT": 4,
|
|
142
|
-
"DOUBLE": 8,
|
|
143
|
-
"TIMESTAMP": 8,
|
|
144
|
-
"TINYINT UNSIGNED": 1,
|
|
145
|
-
"SMALLINT UNSIGNED": 2,
|
|
146
|
-
"INT UNSIGNED": 4,
|
|
147
|
-
"BIGINT UNSIGNED": 8
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
class $acec40551acd7d47$export$e04e72655114a7e extends Error {
|
|
152
|
-
}
|
|
153
|
-
class $acec40551acd7d47$export$bb331b3b46269060 extends $acec40551acd7d47$export$e04e72655114a7e {
|
|
154
|
-
}
|
|
155
|
-
class $acec40551acd7d47$export$d45d01cc7570ed33 extends $acec40551acd7d47$export$e04e72655114a7e {
|
|
156
|
-
}
|
|
157
|
-
class $acec40551acd7d47$export$bef77b941ab4e130 extends $acec40551acd7d47$export$d45d01cc7570ed33 {
|
|
158
|
-
}
|
|
159
|
-
class $acec40551acd7d47$export$a28431cdd91982f0 extends Error {
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
var $dfd1c9f3b61bad2a$require$Buffer = $d6Ue0$buffer.Buffer;
|
|
165
|
-
// Numbers fundamental to the encoding.
|
|
166
|
-
// the "error" Rune or "Unicode replacement character"
|
|
167
|
-
const $dfd1c9f3b61bad2a$var$RuneError = "�";
|
|
168
|
-
// Maximum valid Unicode code point.
|
|
169
|
-
const $dfd1c9f3b61bad2a$var$MaxRune = "U0010FFFF";
|
|
170
|
-
// Code points in the surrogate range are not valid for UTF-8.
|
|
171
|
-
const $dfd1c9f3b61bad2a$var$surrogateMin = 0xD800;
|
|
172
|
-
const $dfd1c9f3b61bad2a$var$surrogateMax = 0xDFFF;
|
|
173
|
-
const $dfd1c9f3b61bad2a$var$tx = 128;
|
|
174
|
-
const $dfd1c9f3b61bad2a$var$t2 = 192;
|
|
175
|
-
const $dfd1c9f3b61bad2a$var$t3 = 224;
|
|
176
|
-
const $dfd1c9f3b61bad2a$var$t4 = 240;
|
|
177
|
-
const $dfd1c9f3b61bad2a$var$maskx = 63;
|
|
178
|
-
const $dfd1c9f3b61bad2a$var$rune1Max = 127;
|
|
179
|
-
const $dfd1c9f3b61bad2a$var$rune2Max = 2047;
|
|
180
|
-
const $dfd1c9f3b61bad2a$var$rune3Max = 65535;
|
|
181
|
-
function $dfd1c9f3b61bad2a$export$ee9b81b89b187997(r) {
|
|
182
|
-
let p = [];
|
|
183
|
-
// console.log("== AppendRun r:");
|
|
184
|
-
// console.log(r)
|
|
185
|
-
if (r <= $dfd1c9f3b61bad2a$var$rune1Max) {
|
|
186
|
-
p.push(r & 0xff);
|
|
187
|
-
return $dfd1c9f3b61bad2a$require$Buffer.from(p).toString();
|
|
188
|
-
}
|
|
189
|
-
if (r <= $dfd1c9f3b61bad2a$var$rune2Max) p.push($dfd1c9f3b61bad2a$var$t2 | r >> 6 & 0xff, $dfd1c9f3b61bad2a$var$tx | r & 0xff & $dfd1c9f3b61bad2a$var$maskx);
|
|
190
|
-
else if (r > $dfd1c9f3b61bad2a$var$MaxRune || $dfd1c9f3b61bad2a$var$surrogateMax <= r && r <= $dfd1c9f3b61bad2a$var$surrogateMax) p.push($dfd1c9f3b61bad2a$var$RuneError);
|
|
191
|
-
else if (r <= $dfd1c9f3b61bad2a$var$rune3Max) p.push($dfd1c9f3b61bad2a$var$t3 | r >> 12 & 0xff, $dfd1c9f3b61bad2a$var$tx | r >> 6 & 0xff & $dfd1c9f3b61bad2a$var$maskx, $dfd1c9f3b61bad2a$var$tx | r & 0xff & $dfd1c9f3b61bad2a$var$maskx);
|
|
192
|
-
else p.push($dfd1c9f3b61bad2a$var$t4 | r >> 18 & 0xff, $dfd1c9f3b61bad2a$var$tx | r >> 12 & 0xff & $dfd1c9f3b61bad2a$var$maskx, $dfd1c9f3b61bad2a$var$tx | r >> 6 & 0xff & $dfd1c9f3b61bad2a$var$maskx, $dfd1c9f3b61bad2a$var$tx | r & 0xff & $dfd1c9f3b61bad2a$var$maskx);
|
|
193
|
-
return $dfd1c9f3b61bad2a$require$Buffer.from(p).toString();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
var $023c1547a6b9d83a$require$Buffer = $d6Ue0$buffer.Buffer;
|
|
199
|
-
class $023c1547a6b9d83a$export$e452488413ae38a1 {
|
|
200
|
-
precision = 0;
|
|
201
|
-
affectRows = 0;
|
|
202
|
-
constructor(queryResponse){
|
|
203
|
-
if (queryResponse.is_update == true) {
|
|
204
|
-
this.meta = null;
|
|
205
|
-
this.data = null;
|
|
206
|
-
} else {
|
|
207
|
-
if (queryResponse.fields_count && queryResponse.fields_names && queryResponse.fields_types && queryResponse.fields_lengths) {
|
|
208
|
-
let _meta = [];
|
|
209
|
-
for(let i = 0; i < queryResponse.fields_count; i++)_meta.push({
|
|
210
|
-
name: queryResponse.fields_names[i],
|
|
211
|
-
type: queryResponse.fields_types[i],
|
|
212
|
-
length: queryResponse.fields_lengths[i]
|
|
213
|
-
});
|
|
214
|
-
this.meta = _meta;
|
|
215
|
-
} else throw new (0, $acec40551acd7d47$export$a28431cdd91982f0)(`fields_count,fields_names,fields_types,fields_lengths of the update query response should be null`);
|
|
216
|
-
this.data = [];
|
|
217
|
-
}
|
|
218
|
-
this.affectRows = queryResponse.affected_rows;
|
|
219
|
-
this.timing = queryResponse.timing;
|
|
220
|
-
this.precision = queryResponse.precision;
|
|
221
|
-
}
|
|
222
|
-
setRows(fetchResponse) {
|
|
223
|
-
this.affectRows += fetchResponse.rows;
|
|
224
|
-
this.timing = this.timing + fetchResponse.timing;
|
|
225
|
-
}
|
|
226
|
-
setData(fetchBlockResponse) {
|
|
227
|
-
if (this.data) this.data.push([]);
|
|
228
|
-
else throw new (0, $acec40551acd7d47$export$a28431cdd91982f0)(`update query response cannot set data`);
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Mapping the WebSocket response type code to TDengine's type name.
|
|
232
|
-
*/ getTDengineMeta() {
|
|
233
|
-
if (this.meta) {
|
|
234
|
-
let _ = new Array();
|
|
235
|
-
this.meta.forEach((m)=>{
|
|
236
|
-
_.push({
|
|
237
|
-
name: m.name,
|
|
238
|
-
type: (0, $1a532b64e63a9aa7$export$7138a112355d88b8)[m.type],
|
|
239
|
-
length: m.length
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
return _;
|
|
243
|
-
} else return null;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function $023c1547a6b9d83a$export$4aed668c47d45036(fetchResponse, blocks, taosResult) {
|
|
247
|
-
if (taosResult.meta && taosResult.data) {
|
|
248
|
-
let metaList = taosResult.meta;
|
|
249
|
-
// console.log(typeof taosResult.timing)
|
|
250
|
-
// console.log(typeof blocks.timing)
|
|
251
|
-
// console.log(blocks.id)
|
|
252
|
-
taosResult.timing = BigInt(taosResult.timing).valueOf() + blocks.timing;
|
|
253
|
-
const INT_32_SIZE = 4;
|
|
254
|
-
// Offset num of bytes from rawBlockBuffer.
|
|
255
|
-
let bufferOffset = 28 + 5 * metaList.length;
|
|
256
|
-
let colLengthBlockSize = INT_32_SIZE * metaList.length;
|
|
257
|
-
// console.log("===colLengthBlockSize:" + colLengthBlockSize)
|
|
258
|
-
let bitMapSize = fetchResponse.rows + 8 - 1 >> 3;
|
|
259
|
-
// whole raw block ArrayBuffer
|
|
260
|
-
let dataBuffer = blocks.data.slice(bufferOffset);
|
|
261
|
-
// record the head of column in block
|
|
262
|
-
let colBlockHead = 0;
|
|
263
|
-
for(let i = 0; i < fetchResponse.rows; i++){
|
|
264
|
-
let row = [];
|
|
265
|
-
// point to the head of the column in the block
|
|
266
|
-
colBlockHead = 0 + colLengthBlockSize;
|
|
267
|
-
// point to the head of columns's data in the block (include bitMap and offsetArray)
|
|
268
|
-
let colDataHead = colBlockHead;
|
|
269
|
-
// traverse row after row.
|
|
270
|
-
for(let j = 0; j < metaList.length; j++){
|
|
271
|
-
let isVarType = $023c1547a6b9d83a$var$_isVarTye(metaList[j]);
|
|
272
|
-
// console.log("== dataBuffer Length:" + dataBuffer.byteLength)
|
|
273
|
-
// console.log("== loop i:" + i + "J=" + j + "col:" + metaList[j].name + "type:" + metaList[j].type)
|
|
274
|
-
// console.log("== loop isVarType:" + isVarType);
|
|
275
|
-
if (isVarType == (0, $1a532b64e63a9aa7$export$9c85ccb1eaab884c).SOLID) {
|
|
276
|
-
colDataHead = colBlockHead + bitMapSize + metaList[j].length * i;
|
|
277
|
-
let byteArrayIndex = i >> 3;
|
|
278
|
-
let bitwiseOffset = 7 - (i & 7);
|
|
279
|
-
let bitMapArr = dataBuffer.slice(colBlockHead, colBlockHead + bitMapSize);
|
|
280
|
-
// console.log("==i:" + i + "byteArrayIndex=" + byteArrayIndex)
|
|
281
|
-
// console.log("== loop colblockhead:" + colBlockHead)
|
|
282
|
-
// console.log("== loop bitmap:" + bitMapSize)
|
|
283
|
-
// console.log("== loop bitMap length=" + bitMapArr.byteLength)
|
|
284
|
-
// console.log("==loop bitMap bitwiseoffset:" + bitwiseOffset + "byteArrayIndex:" + byteArrayIndex)
|
|
285
|
-
let bitFlag = (new DataView(bitMapArr).getUint8(byteArrayIndex) & 1 << bitwiseOffset) >> bitwiseOffset;
|
|
286
|
-
if (bitFlag == 1) row.push("NULL");
|
|
287
|
-
else row.push($023c1547a6b9d83a$var$readSolidData(dataBuffer, colDataHead, metaList[j]));
|
|
288
|
-
// console.log("=====(new DataView(dataBuffer, INT_32_SIZE * j, INT_32_SIZE).getInt32(0))=" + (new DataView(dataBuffer, INT_32_SIZE * j, INT_32_SIZE).getInt32(0, true)));
|
|
289
|
-
colBlockHead = colBlockHead + bitMapSize + new DataView(dataBuffer, INT_32_SIZE * j, INT_32_SIZE).getInt32(0, true);
|
|
290
|
-
} else {
|
|
291
|
-
// if null check
|
|
292
|
-
let varOffset = new DataView(dataBuffer, colBlockHead + INT_32_SIZE * i, INT_32_SIZE).getInt32(0, true);
|
|
293
|
-
// console.log("== var type offset:" + varOffset)
|
|
294
|
-
if (varOffset == -1) {
|
|
295
|
-
row.push("NULL");
|
|
296
|
-
colBlockHead = colBlockHead + INT_32_SIZE * fetchResponse.rows + new DataView(dataBuffer, j * INT_32_SIZE, INT_32_SIZE).getInt32(0, true);
|
|
297
|
-
} else {
|
|
298
|
-
colDataHead = colBlockHead + INT_32_SIZE * fetchResponse.rows + varOffset;
|
|
299
|
-
let dataLength = new DataView(dataBuffer, colDataHead, 2).getInt16(0, true);
|
|
300
|
-
// console.log("== loop var type length:" + dataLength)
|
|
301
|
-
if (isVarType == (0, $1a532b64e63a9aa7$export$9c85ccb1eaab884c).VARCHAR) row.push($023c1547a6b9d83a$var$readVarchar(dataBuffer, colDataHead + 2, dataLength));
|
|
302
|
-
else row.push($023c1547a6b9d83a$var$readNchar(dataBuffer, colDataHead + 2, dataLength));
|
|
303
|
-
colBlockHead = colBlockHead + INT_32_SIZE * fetchResponse.rows + new DataView(dataBuffer, j * INT_32_SIZE, INT_32_SIZE).getInt32(0, true);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
taosResult.data.push(row);
|
|
308
|
-
}
|
|
309
|
-
return taosResult;
|
|
310
|
-
} else throw new (0, $acec40551acd7d47$export$a28431cdd91982f0)("cannot fetch block for an update query.");
|
|
311
|
-
}
|
|
312
|
-
function $023c1547a6b9d83a$var$_isVarTye(meta) {
|
|
313
|
-
switch(meta.type){
|
|
314
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["NCHAR"]:
|
|
315
|
-
return (0, $1a532b64e63a9aa7$export$9c85ccb1eaab884c)["NCHAR"];
|
|
316
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["VARCHAR"]:
|
|
317
|
-
return (0, $1a532b64e63a9aa7$export$9c85ccb1eaab884c)["VARCHAR"];
|
|
318
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["BINARY"]:
|
|
319
|
-
return (0, $1a532b64e63a9aa7$export$9c85ccb1eaab884c)["VARCHAR"];
|
|
320
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["JSON"]:
|
|
321
|
-
return (0, $1a532b64e63a9aa7$export$9c85ccb1eaab884c)["VARCHAR"];
|
|
322
|
-
default:
|
|
323
|
-
return (0, $1a532b64e63a9aa7$export$9c85ccb1eaab884c)["SOLID"];
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
function $023c1547a6b9d83a$var$readSolidData(dataBuffer, colDataHead, meta) {
|
|
327
|
-
switch(meta.type){
|
|
328
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["BOOL"]:
|
|
329
|
-
return Boolean(new DataView(dataBuffer, colDataHead, 1).getInt8(0));
|
|
330
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["TINYINT"]:
|
|
331
|
-
return new DataView(dataBuffer, colDataHead, 1).getInt8(0);
|
|
332
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["SMALLINT"]:
|
|
333
|
-
return new DataView(dataBuffer, colDataHead, 2).getInt16(0, true);
|
|
334
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["INT"]:
|
|
335
|
-
return new DataView(dataBuffer, colDataHead, 4).getInt32(0, true);
|
|
336
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["BIGINT"]:
|
|
337
|
-
return new DataView(dataBuffer, colDataHead, 8).getBigInt64(0, true);
|
|
338
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["TINYINT UNSIGNED"]:
|
|
339
|
-
return new DataView(dataBuffer, colDataHead, 1).getUint8(0);
|
|
340
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["SMALLINT UNSIGNED"]:
|
|
341
|
-
return new DataView(dataBuffer, colDataHead, 2).getUint16(0, true);
|
|
342
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["INT UNSIGNED"]:
|
|
343
|
-
return new DataView(dataBuffer, colDataHead, 4).getUint32(0, true);
|
|
344
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["BIGINT UNSIGNED"]:
|
|
345
|
-
return new DataView(dataBuffer, colDataHead, 8).getBigUint64(0, true);
|
|
346
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["FLOAT"]:
|
|
347
|
-
return parseFloat(new DataView(dataBuffer, colDataHead, 4).getFloat32(0, true).toFixed(5));
|
|
348
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["DOUBLE"]:
|
|
349
|
-
return parseFloat(new DataView(dataBuffer, colDataHead, 8).getFloat64(0, true).toFixed(15));
|
|
350
|
-
case (0, $1a532b64e63a9aa7$export$9f025993407a7e76)["TIMESTAMP"]:
|
|
351
|
-
return new DataView(dataBuffer, colDataHead, 8).getBigInt64(0, true);
|
|
352
|
-
default:
|
|
353
|
-
throw new (0, $acec40551acd7d47$export$bef77b941ab4e130)(`unspported type ${meta.type} for column ${meta.name}`);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
function $023c1547a6b9d83a$var$readVarchar(dataBuffer, colDataHead, length) {
|
|
357
|
-
let data = "";
|
|
358
|
-
data += new TextDecoder().decode(dataBuffer.slice(colDataHead, colDataHead + length));
|
|
359
|
-
return data;
|
|
360
|
-
}
|
|
361
|
-
function $023c1547a6b9d83a$var$readNchar(dataBuffer, colDataHead, length) {
|
|
362
|
-
let decoder = new TextDecoder();
|
|
363
|
-
let data = "";
|
|
364
|
-
let buff = dataBuffer.slice(colDataHead, colDataHead + length);
|
|
365
|
-
for(let i = 0; i < length / 4; i++)// console.log("== readNchar data:" + new DataView(buff, i * 4, 4).getUint32(0, true))
|
|
366
|
-
data += (0, $dfd1c9f3b61bad2a$export$ee9b81b89b187997)(new DataView(buff, i * 4, 4).getUint32(0, true));
|
|
367
|
-
return data;
|
|
368
|
-
}
|
|
369
|
-
function $023c1547a6b9d83a$var$iteratorBuff(arr) {
|
|
370
|
-
let buf = $023c1547a6b9d83a$require$Buffer.from(arr);
|
|
371
|
-
for (const value of buf)console.log(value.toString());
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
async function $0f30d7256dc7141b$export$51396ec711da548b(sql, wsInterface) {
|
|
376
|
-
let taosResult;
|
|
377
|
-
let wsQueryResponse = await wsInterface.query(sql);
|
|
378
|
-
try {
|
|
379
|
-
taosResult = new (0, $023c1547a6b9d83a$export$e452488413ae38a1)(wsQueryResponse);
|
|
380
|
-
if (wsQueryResponse.is_update == true) return taosResult;
|
|
381
|
-
else {
|
|
382
|
-
while(true){
|
|
383
|
-
let wsFetchResponse = await wsInterface.fetch(wsQueryResponse);
|
|
384
|
-
if (wsFetchResponse.completed == true) break;
|
|
385
|
-
else {
|
|
386
|
-
taosResult.setRows(wsFetchResponse);
|
|
387
|
-
let tmp = await wsInterface.fetchBlock(wsFetchResponse, taosResult);
|
|
388
|
-
taosResult = tmp;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return taosResult;
|
|
392
|
-
}
|
|
393
|
-
} finally{
|
|
394
|
-
wsInterface.freeResult(wsQueryResponse);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
var $80857a4644ab9e3c$exports = {};
|
|
401
|
-
var $80857a4644ab9e3c$var$_globalThis;
|
|
402
|
-
|
|
403
|
-
if (typeof globalThis === "object") $80857a4644ab9e3c$var$_globalThis = globalThis;
|
|
404
|
-
else try {
|
|
405
|
-
$80857a4644ab9e3c$var$_globalThis = (parcelRequire("69yKH"));
|
|
406
|
-
} catch (error) {} finally{
|
|
407
|
-
if (!$80857a4644ab9e3c$var$_globalThis && typeof window !== "undefined") $80857a4644ab9e3c$var$_globalThis = window;
|
|
408
|
-
if (!$80857a4644ab9e3c$var$_globalThis) throw new Error("Could not determine global this");
|
|
409
|
-
}
|
|
410
|
-
var $80857a4644ab9e3c$var$NativeWebSocket = $80857a4644ab9e3c$var$_globalThis.WebSocket || $80857a4644ab9e3c$var$_globalThis.MozWebSocket;
|
|
411
|
-
var $7c6df17c382b3218$exports = {};
|
|
412
|
-
|
|
413
|
-
$7c6df17c382b3218$exports = (parcelRequire("k36f6")).version;
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* Expose a W3C WebSocket class with just one or two arguments.
|
|
418
|
-
*/ function $80857a4644ab9e3c$var$W3CWebSocket(uri, protocols) {
|
|
419
|
-
var native_instance;
|
|
420
|
-
if (protocols) native_instance = new $80857a4644ab9e3c$var$NativeWebSocket(uri, protocols);
|
|
421
|
-
else native_instance = new $80857a4644ab9e3c$var$NativeWebSocket(uri);
|
|
422
|
-
/**
|
|
423
|
-
* 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket
|
|
424
|
-
* class). Since it is an Object it will be returned as it is when creating an
|
|
425
|
-
* instance of W3CWebSocket via 'new W3CWebSocket()'.
|
|
426
|
-
*
|
|
427
|
-
* ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2
|
|
428
|
-
*/ return native_instance;
|
|
429
|
-
}
|
|
430
|
-
if ($80857a4644ab9e3c$var$NativeWebSocket) [
|
|
431
|
-
"CONNECTING",
|
|
432
|
-
"OPEN",
|
|
433
|
-
"CLOSING",
|
|
434
|
-
"CLOSED"
|
|
435
|
-
].forEach(function(prop) {
|
|
436
|
-
Object.defineProperty($80857a4644ab9e3c$var$W3CWebSocket, prop, {
|
|
437
|
-
get: function() {
|
|
438
|
-
return $80857a4644ab9e3c$var$NativeWebSocket[prop];
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
});
|
|
442
|
-
/**
|
|
443
|
-
* Module exports.
|
|
444
|
-
*/ $80857a4644ab9e3c$exports = {
|
|
445
|
-
"w3cwebsocket": $80857a4644ab9e3c$var$NativeWebSocket ? $80857a4644ab9e3c$var$W3CWebSocket : null,
|
|
446
|
-
"version": $7c6df17c382b3218$exports
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
var $8ab48638a7253d6f$require$Buffer = $d6Ue0$buffer.Buffer;
|
|
453
|
-
var $8ab48638a7253d6f$var$_msgActionRegister = new Map();
|
|
454
|
-
class $8ab48638a7253d6f$export$60c5222feb151075 {
|
|
455
|
-
_timeout = 5000;
|
|
456
|
-
// create ws
|
|
457
|
-
constructor(url){
|
|
458
|
-
// return w3bsocket3
|
|
459
|
-
if (url) {
|
|
460
|
-
this._wsURL = url;
|
|
461
|
-
let origin = url.origin;
|
|
462
|
-
let pathname = url.pathname;
|
|
463
|
-
let search = url.search;
|
|
464
|
-
this._wsConn = new (0, $80857a4644ab9e3c$exports.w3cwebsocket)(origin.concat(pathname).concat(search));
|
|
465
|
-
// this._wsConn.onopen = this._onopen
|
|
466
|
-
this._wsConn.onerror = function(err) {
|
|
467
|
-
throw err;
|
|
468
|
-
};
|
|
469
|
-
this._wsConn.onclose = this._onclose;
|
|
470
|
-
this._wsConn.onmessage = this._onmessage;
|
|
471
|
-
this._wsConn._binaryType = "arraybuffer";
|
|
472
|
-
} else throw new (0, $acec40551acd7d47$export$bb331b3b46269060)("websocket URL must be defined");
|
|
473
|
-
}
|
|
474
|
-
Ready() {
|
|
475
|
-
return new Promise((resolve, reject)=>{
|
|
476
|
-
this._wsConn.onopen = ()=>{
|
|
477
|
-
// console.log("websocket connection opened")
|
|
478
|
-
resolve(this);
|
|
479
|
-
};
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
_onclose(e) {
|
|
483
|
-
return new Promise((resolve, reject)=>{
|
|
484
|
-
resolve("websocket connection closed");
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
_onmessage(event) {
|
|
488
|
-
let data = event.data;
|
|
489
|
-
console.log("====" + Object.prototype.toString.call(data));
|
|
490
|
-
if (data instanceof $8ab48638a7253d6f$require$Buffer) console.log("unexpected response type :" + typeof data);
|
|
491
|
-
else if (data instanceof ArrayBuffer) {
|
|
492
|
-
let id = new DataView(data, 8, 8).getBigUint64(0, true);
|
|
493
|
-
// console.log("fetch block response id:" + id)
|
|
494
|
-
let action = undefined;
|
|
495
|
-
$8ab48638a7253d6f$var$_msgActionRegister.forEach((v, k)=>{
|
|
496
|
-
if (k.id == id) {
|
|
497
|
-
action = v;
|
|
498
|
-
$8ab48638a7253d6f$var$_msgActionRegister.delete(k);
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
if (action) action.resolve(data);
|
|
502
|
-
else throw new (0, $acec40551acd7d47$export$e04e72655114a7e)(`no callback registered for fetch_block with id=${id}`);
|
|
503
|
-
} else {
|
|
504
|
-
let msg = JSON.parse(data);
|
|
505
|
-
// console.log("onMessage:" + JSON.stringify(msg));
|
|
506
|
-
let action1 = undefined;
|
|
507
|
-
$8ab48638a7253d6f$var$_msgActionRegister.forEach((v, k)=>{
|
|
508
|
-
if (k.action == "version") {
|
|
509
|
-
action1 = v;
|
|
510
|
-
$8ab48638a7253d6f$var$_msgActionRegister.delete(k);
|
|
511
|
-
}
|
|
512
|
-
if (k.req_id == msg.req_id && k.action == msg.action) {
|
|
513
|
-
action1 = v;
|
|
514
|
-
$8ab48638a7253d6f$var$_msgActionRegister.delete(k);
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
if (action1) action1.resolve(msg);
|
|
518
|
-
else throw new (0, $acec40551acd7d47$export$e04e72655114a7e)(`no callback registered for ${msg.action} with req_id=${msg.req_id}`);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
close() {
|
|
522
|
-
if (this._wsConn) {
|
|
523
|
-
$8ab48638a7253d6f$var$_msgActionRegister.clear();
|
|
524
|
-
this._wsConn.close();
|
|
525
|
-
} else throw new (0, $acec40551acd7d47$export$e04e72655114a7e)("WebSocket connection is undefined.");
|
|
526
|
-
}
|
|
527
|
-
readyState() {
|
|
528
|
-
return this._wsConn.readyState;
|
|
529
|
-
}
|
|
530
|
-
sendMsg(message, register = true) {
|
|
531
|
-
let msg = JSON.parse(message);
|
|
532
|
-
return new Promise((resolve, reject)=>{
|
|
533
|
-
if (register) this._registerCallback({
|
|
534
|
-
action: msg.action,
|
|
535
|
-
req_id: msg.args.req_id,
|
|
536
|
-
id: msg.args.id
|
|
537
|
-
}, resolve, reject);
|
|
538
|
-
if (this._wsConn && this._wsConn.readyState > 0) this._wsConn.send(message);
|
|
539
|
-
else reject(new (0, $acec40551acd7d47$export$bb331b3b46269060)(`WebSocket connection is not ready,status :${this._wsConn?.readyState}`));
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
_registerCallback(id, res, rej) {
|
|
543
|
-
// console.log("register messageId:"+ JSON.stringify(id))
|
|
544
|
-
$8ab48638a7253d6f$var$_msgActionRegister.set(id, {
|
|
545
|
-
reject: rej,
|
|
546
|
-
resolve: res,
|
|
547
|
-
timer: setTimeout(()=>rej(new (0, $acec40551acd7d47$export$bb331b3b46269060)(`action:${id.action},req_id:${id.req_id} timeout with ${this._timeout} milliseconds`)), this._timeout)
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
configTimeout(ms) {
|
|
551
|
-
this._timeout = ms;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
class $515f34441c440f86$export$32ebe749c88dc8fc {
|
|
558
|
-
constructor(msg){
|
|
559
|
-
this.version = msg.version;
|
|
560
|
-
this.code = msg.code;
|
|
561
|
-
this.message = msg.message;
|
|
562
|
-
this.action = msg.action;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
class $515f34441c440f86$export$ab76f9e6bb13551a {
|
|
566
|
-
constructor(msg){
|
|
567
|
-
this.code = msg.code;
|
|
568
|
-
this.message = msg.message;
|
|
569
|
-
this.action = msg.action;
|
|
570
|
-
this.req_id = msg.req_id;
|
|
571
|
-
this.timing = msg.timing;
|
|
572
|
-
this.id = msg.id;
|
|
573
|
-
this.is_update = msg.is_update;
|
|
574
|
-
this.affected_rows = msg.affected_rows;
|
|
575
|
-
this.fields_count = msg.fields_count;
|
|
576
|
-
this.fields_names = msg.fields_names;
|
|
577
|
-
this.fields_types = msg.fields_types;
|
|
578
|
-
this.fields_lengths = msg.fields_lengths;
|
|
579
|
-
this.precision = msg.precision;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
class $515f34441c440f86$export$3f2f9b8b1b9adb1c {
|
|
583
|
-
constructor(msg){
|
|
584
|
-
this.code = msg.code;
|
|
585
|
-
this.message = msg.message;
|
|
586
|
-
this.action = msg.action;
|
|
587
|
-
this.req_id = msg.req_id;
|
|
588
|
-
this.timing = msg.timing;
|
|
589
|
-
this.id = msg.id;
|
|
590
|
-
this.completed = msg.completed;
|
|
591
|
-
this.length = msg.length;
|
|
592
|
-
this.rows = msg.rows;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
class $515f34441c440f86$export$322bf5a2be43493 {
|
|
596
|
-
constructor(msg){
|
|
597
|
-
this.timing = new DataView(msg, 0, 8).getBigUint64(0, true);
|
|
598
|
-
this.id = new DataView(msg, 8, 8).getBigUint64(0, true);
|
|
599
|
-
this.data = msg.slice(16);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
class $515f34441c440f86$export$4f402cd23dd77992 {
|
|
603
|
-
}
|
|
604
|
-
class $515f34441c440f86$export$99f0d6683d6024ac {
|
|
605
|
-
constructor(msg){
|
|
606
|
-
this.code = msg.code;
|
|
607
|
-
this.message = msg.message;
|
|
608
|
-
this.action = msg.action;
|
|
609
|
-
this.req_id = msg.req_id;
|
|
610
|
-
this.timing = msg.timing;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
class $d604b483955d32fb$export$84a38ced4e7f1e4e {
|
|
616
|
-
_req_id = 0;
|
|
617
|
-
constructor(url){
|
|
618
|
-
this.checkURL(url);
|
|
619
|
-
this._url = url;
|
|
620
|
-
this._wsQueryClient = new (0, $8ab48638a7253d6f$export$60c5222feb151075)(this._url);
|
|
621
|
-
}
|
|
622
|
-
connect(database) {
|
|
623
|
-
let _db = this._url.pathname.split("/")[3];
|
|
624
|
-
if (database) _db = database;
|
|
625
|
-
this._reqIDIncrement();
|
|
626
|
-
let connMsg = {
|
|
627
|
-
action: "conn",
|
|
628
|
-
args: {
|
|
629
|
-
req_id: this._req_id,
|
|
630
|
-
user: this._url.username,
|
|
631
|
-
password: this._url.password,
|
|
632
|
-
db: _db
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
return new Promise((resolve, reject)=>{
|
|
636
|
-
this._wsQueryClient.Ready().then((ws)=>{
|
|
637
|
-
return ws.sendMsg(JSON.stringify(connMsg));
|
|
638
|
-
}).then((e)=>{
|
|
639
|
-
if (e.code == 0) resolve(e);
|
|
640
|
-
else reject(new (0, $acec40551acd7d47$export$bb331b3b46269060)(`${e.message}, code ${e.code}`));
|
|
641
|
-
});
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
// need to construct Response.
|
|
645
|
-
query(sql) {
|
|
646
|
-
this._reqIDIncrement();
|
|
647
|
-
// construct msg
|
|
648
|
-
let queryMsg = {
|
|
649
|
-
action: "query",
|
|
650
|
-
args: {
|
|
651
|
-
req_id: this._req_id,
|
|
652
|
-
sql: sql
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
return new Promise((resolve, reject)=>{
|
|
656
|
-
this._wsQueryClient.sendMsg(JSON.stringify(queryMsg)).then((e)=>{
|
|
657
|
-
if (e.code == 0) resolve(new (0, $515f34441c440f86$export$ab76f9e6bb13551a)(e));
|
|
658
|
-
else reject(new (0, $acec40551acd7d47$export$d45d01cc7570ed33)(`${e.message},code ${e.code}`));
|
|
659
|
-
});
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
getState() {
|
|
663
|
-
return this._wsQueryClient.readyState();
|
|
664
|
-
}
|
|
665
|
-
fetch(res) {
|
|
666
|
-
this._reqIDIncrement();
|
|
667
|
-
let fetchMsg = {
|
|
668
|
-
action: "fetch",
|
|
669
|
-
args: {
|
|
670
|
-
req_id: this._req_id,
|
|
671
|
-
id: res.id
|
|
672
|
-
}
|
|
673
|
-
};
|
|
674
|
-
return new Promise((resolve, reject)=>{
|
|
675
|
-
this._wsQueryClient.sendMsg(JSON.stringify(fetchMsg)).then((e)=>{
|
|
676
|
-
if (e.code == 0) resolve(new (0, $515f34441c440f86$export$3f2f9b8b1b9adb1c)(e));
|
|
677
|
-
else reject(new (0, $acec40551acd7d47$export$d45d01cc7570ed33)(`${e.message},code ${e.code}`));
|
|
678
|
-
}).catch((e)=>{
|
|
679
|
-
reject(e);
|
|
680
|
-
});
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
fetchBlock(fetchResponse, taosResult) {
|
|
684
|
-
this._reqIDIncrement();
|
|
685
|
-
let fetchBlockMsg = {
|
|
686
|
-
action: "fetch_block",
|
|
687
|
-
args: {
|
|
688
|
-
"req_id": this._req_id,
|
|
689
|
-
"id": fetchResponse.id
|
|
690
|
-
}
|
|
691
|
-
};
|
|
692
|
-
return new Promise((resolve, reject)=>{
|
|
693
|
-
this._wsQueryClient.sendMsg(JSON.stringify(fetchBlockMsg)).then((e)=>{
|
|
694
|
-
resolve((0, $023c1547a6b9d83a$export$4aed668c47d45036)(fetchResponse, new (0, $515f34441c440f86$export$322bf5a2be43493)(e), taosResult));
|
|
695
|
-
// if retrieve JSON then reject with message
|
|
696
|
-
// else is binary , so parse raw block to TaosResult
|
|
697
|
-
}).catch((e)=>reject(e));
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
freeResult(res) {
|
|
701
|
-
this._reqIDIncrement();
|
|
702
|
-
let freeResultMsg = {
|
|
703
|
-
action: "free_result",
|
|
704
|
-
args: {
|
|
705
|
-
req_id: this._req_id,
|
|
706
|
-
id: res.id
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
return new Promise((resolve, reject)=>{
|
|
710
|
-
this._wsQueryClient.sendMsg(JSON.stringify(freeResultMsg), false).then((e)=>{
|
|
711
|
-
resolve(e);
|
|
712
|
-
}).catch((e)=>reject(e));
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
version() {
|
|
716
|
-
this._reqIDIncrement();
|
|
717
|
-
let versionMsg = {
|
|
718
|
-
action: "version",
|
|
719
|
-
args: {
|
|
720
|
-
req_id: this._req_id
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
return new Promise((resolve, reject)=>{
|
|
724
|
-
this._wsQueryClient.Ready().then((ws)=>{
|
|
725
|
-
return ws.sendMsg(JSON.stringify(versionMsg));
|
|
726
|
-
}).then((e)=>{
|
|
727
|
-
if (e.code == 0) resolve(new (0, $515f34441c440f86$export$32ebe749c88dc8fc)(e).version);
|
|
728
|
-
else reject(new (0, $515f34441c440f86$export$32ebe749c88dc8fc)(e).message);
|
|
729
|
-
}).catch((e)=>reject(e));
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
close() {
|
|
733
|
-
this._wsQueryClient.close();
|
|
734
|
-
}
|
|
735
|
-
checkURL(url) {
|
|
736
|
-
// Assert is cloud url
|
|
737
|
-
if (!!url.searchParams.has("token")) {
|
|
738
|
-
if (!(url.username || url.password)) throw new (0, $acec40551acd7d47$export$d45d01cc7570ed33)("invalid url, password or username needed.");
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
_reqIDIncrement() {
|
|
742
|
-
if (this._req_id == Number.MAX_SAFE_INTEGER) this._req_id = 0;
|
|
743
|
-
else this._req_id += 1;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
class $db4a4c604e654257$export$d15bd779f38f3fbe {
|
|
749
|
-
_data = [];
|
|
750
|
-
_meta = [];
|
|
751
|
-
constructor(url){
|
|
752
|
-
this._wsInterface = new (0, $d604b483955d32fb$export$84a38ced4e7f1e4e)(new URL(url));
|
|
753
|
-
}
|
|
754
|
-
connect(database) {
|
|
755
|
-
return this._wsInterface.connect(database);
|
|
756
|
-
}
|
|
757
|
-
state() {
|
|
758
|
-
return this._wsInterface.getState();
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* return client version.
|
|
762
|
-
*/ version() {
|
|
763
|
-
return this._wsInterface.version();
|
|
764
|
-
}
|
|
765
|
-
query(sql) {
|
|
766
|
-
return (0, $0f30d7256dc7141b$export$51396ec711da548b)(sql, this._wsInterface);
|
|
767
|
-
}
|
|
768
|
-
close() {
|
|
769
|
-
this._wsInterface.close();
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
let $dd27acfa38609814$export$64605811ab45167f = (url)=>{
|
|
775
|
-
return new (0, $db4a4c604e654257$export$d15bd779f38f3fbe)(url);
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
|