@tdengine/websocket 3.1.2 → 3.1.4
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/basicSchemaless.js +1 -3
- package/lib/example/logs/.007e668bb78549e9a304b8466671945ab2a1553e-audit.json +3 -3
- package/lib/example/logs/app-2025-01-24.log +5580 -0
- package/lib/src/client/wsConnectorPool.d.ts.map +1 -1
- package/lib/src/client/wsConnectorPool.js +2 -1
- package/lib/src/common/log.d.ts.map +1 -1
- package/lib/src/common/log.js +7 -14
- package/lib/src/common/taosResult.js +12 -12
- package/lib/src/common/ut8Helper.js +1 -2
- package/lib/src/common/utils.d.ts +0 -1
- package/lib/src/common/utils.d.ts.map +1 -1
- package/lib/src/common/utils.js +4 -9
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +17 -7
- package/lib/src/stmt/wsProto.js +2 -2
- package/lib/test/bulkPulling/log.test.js +17 -7
- package/lib/test/bulkPulling/queryTables.test.js +3 -0
- package/lib/test/bulkPulling/schemaless.test.js +7 -1
- package/lib/test/bulkPulling/sql.test.js +9 -1
- package/lib/test/bulkPulling/stmt.func.test.js +34 -28
- package/lib/test/bulkPulling/stmt.type.test.js +4 -0
- package/lib/test/bulkPulling/tmq.test.js +6 -0
- package/lib/test/bulkPulling/wsConnectPool.test.js +17 -5
- package/lib/test/utils.d.ts +1 -0
- package/lib/test/utils.d.ts.map +1 -1
- package/lib/test/utils.js +17 -13
- package/package.json +5 -4
- package/readme.md +82 -270
- package/lib/example/logs/app-2024-10-12.log.gz +0 -0
- package/lib/example/logs/app-2024-11-06.log +0 -542
- package/lib/example/test.d.ts +0 -2
- package/lib/example/test.d.ts.map +0 -1
- package/lib/example/test.js +0 -88
package/lib/example/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../example/test.ts"],"names":[],"mappings":""}
|
package/lib/example/test.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const config_1 = require("../src/common/config");
|
|
4
|
-
const wsSql_1 = require("../src/sql/wsSql");
|
|
5
|
-
const utils_1 = require("../test/utils");
|
|
6
|
-
// const DSN = 'ws://root:taosdata@127.0.0.1:6041'
|
|
7
|
-
let dsn = 'ws://root:taosdata@192.168.1.98:6041';
|
|
8
|
-
let conf = new config_1.WSConfig(dsn);
|
|
9
|
-
const resultMap = new Map();
|
|
10
|
-
resultMap.set("POINT (4.0 8.0)", (0, utils_1.hexToBytes)("010100000000000000000010400000000000002040"));
|
|
11
|
-
resultMap.set("POINT (3.0 5.0)", (0, utils_1.hexToBytes)("010100000000000000000008400000000000001440"));
|
|
12
|
-
resultMap.set("LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)", (0, utils_1.hexToBytes)("010200000003000000000000000000f03f000000000000f03f0000000000000040000000000000004000000000000014400000000000001440"));
|
|
13
|
-
resultMap.set("POLYGON ((3.000000 6.000000, 5.000000 6.000000, 5.000000 8.000000, 3.000000 8.000000, 3.000000 6.000000))", (0, utils_1.hexToBytes)("010300000001000000050000000000000000000840000000000000184000000000000014400000000000001840000000000000144000000000000020400000000000000840000000000000204000000000000008400000000000001840"));
|
|
14
|
-
resultMap.set("POINT (7.0 9.0)", (0, utils_1.hexToBytes)("01010000000000000000001c400000000000002240"));
|
|
15
|
-
resultMap.set("0x7661726332", (0, utils_1.hexToBytes)("307837363631373236333332"));
|
|
16
|
-
resultMap.set("0x7661726333", (0, utils_1.hexToBytes)("307837363631373236333333"));
|
|
17
|
-
resultMap.set("0x7661726334", (0, utils_1.hexToBytes)("307837363631373236333334"));
|
|
18
|
-
resultMap.set("0x7661726335", (0, utils_1.hexToBytes)("307837363631373236333335"));
|
|
19
|
-
const table = 'ws_q_n';
|
|
20
|
-
const stable = 'ws_q_s';
|
|
21
|
-
const tableCN = 'ws_q_n_cn';
|
|
22
|
-
const stableCN = 'ws_q_s_cn';
|
|
23
|
-
const db = 'ws_q_db';
|
|
24
|
-
const jsonTable = 'ws_q_j';
|
|
25
|
-
const jsonTableCN = 'ws_q_j_cn';
|
|
26
|
-
const createDB = `create database if not exists ${db} keep 3650`;
|
|
27
|
-
const dropDB = `drop database if exists ${db}`;
|
|
28
|
-
const useDB = `use ${db}`;
|
|
29
|
-
const stableTags = [true, -1, -2, -3, BigInt(-4), 1, 2, 3, BigInt(4), parseFloat(3.1415.toFixed(5)), parseFloat(3.14159265.toFixed(15)), 'varchar_tag_1', 'nchar_tag_1'];
|
|
30
|
-
const stableCNTags = [false, -1 * 2, -2 * 2, -3 * 2, BigInt(-4 * 2), 1 * 2, 2 * 2, 3 * 2, BigInt(4 * 2), parseFloat((3.1415 * 2).toFixed(5)), parseFloat((3.14159265 * 2).toFixed(15)), 'varchar_标签_壹', 'nchar_标签_贰'];
|
|
31
|
-
const tableValues = [
|
|
32
|
-
[BigInt(1656677710000), 0, -1, -2, BigInt(-3), 0, 1, 2, BigInt(3), parseFloat(3.1415.toFixed(5)), parseFloat(3.14159265.toFixed(15)), 'varchar_col_1', 'nchar_col_1', true, 'NULL', 'POINT (4.0 8.0)', '0x7661726332'],
|
|
33
|
-
[BigInt(1656677720000), -1, -2, -3, BigInt(-4), 1, 2, 3, BigInt(4), parseFloat((3.1415 * 2).toFixed(5)), parseFloat((3.14159265 * 2).toFixed(15)), 'varchar_col_2', 'nchar_col_2', false, 'NULL', 'POINT (3.0 5.0)', '0x7661726333'],
|
|
34
|
-
[BigInt(1656677730000), -2, -3, -4, BigInt(-5), 2, 3, 4, BigInt(5), parseFloat((3.1415 * 3).toFixed(5)), parseFloat((3.14159265 * 3).toFixed(15)), 'varchar_col_3', 'nchar_col_3', true, 'NULL', 'LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)', '0x7661726334'],
|
|
35
|
-
[BigInt(1656677740000), -3, -4, -5, BigInt(-6), 3, 4, 5, BigInt(6), parseFloat((3.1415 * 4).toFixed(5)), parseFloat((3.14159265 * 4).toFixed(15)), 'varchar_col_4', 'nchar_col_4', false, 'NULL', 'POLYGON ((3.000000 6.000000, 5.000000 6.000000, 5.000000 8.000000, 3.000000 8.000000, 3.000000 6.000000))', '0x7661726335'],
|
|
36
|
-
[BigInt(1656677750000), -4, -5, -6, BigInt(-7), 4, 5, 6, BigInt(7), parseFloat((3.1415 * 5).toFixed(5)), parseFloat((3.14159265 * 5).toFixed(15)), 'varchar_col_5', 'nchar_col_5', true, 'NULL', 'POINT (7.0 9.0)', '0x7661726335'],
|
|
37
|
-
];
|
|
38
|
-
const tableCNValues = [
|
|
39
|
-
[BigInt(1656677760000), 0, -1, -2, BigInt(-3), 0, 1, 2, BigInt(3), parseFloat(3.1415.toFixed(5)), parseFloat(3.14159265.toFixed(15)), 'varchar_列_壹', 'nchar_列_甲', true, 'NULL', 'POINT (4.0 8.0)', '0x7661726332'],
|
|
40
|
-
[BigInt(1656677770000), -1, -2, -3, BigInt(-4), 1, 2, 3, BigInt(4), parseFloat((3.1415 * 2).toFixed(5)), parseFloat((3.14159265 * 2).toFixed(15)), 'varchar_列_贰', 'nchar_列_乙', false, 'NULL', 'POINT (3.0 5.0)', '0x7661726333'],
|
|
41
|
-
[BigInt(1656677780000), -2, -3, -4, BigInt(-5), 2, 3, 4, BigInt(5), parseFloat((3.1415 * 3).toFixed(5)), parseFloat((3.14159265 * 3).toFixed(15)), 'varchar_列_叁', 'nchar_列_丙', true, 'NULL', 'LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)', '0x7661726334'],
|
|
42
|
-
[BigInt(1656677790000), -3, -4, -5, BigInt(-6), 3, 4, 5, BigInt(6), parseFloat((3.1415 * 4).toFixed(5)), parseFloat((3.14159265 * 4).toFixed(15)), 'varchar_列_肆', 'nchar_列_丁', false, 'NULL', 'POLYGON ((3.000000 6.000000, 5.000000 6.000000, 5.000000 8.000000, 3.000000 8.000000, 3.000000 6.000000))', '0x7661726335'],
|
|
43
|
-
[BigInt(1656677800000), -4, -5, -6, BigInt(-7), 4, 5, 6, BigInt(7), parseFloat((3.1415 * 5).toFixed(5)), parseFloat((3.14159265 * 5).toFixed(15)), 'varchar_列_伍', 'nchar_列_戊', true, 'NULL', 'POINT (7.0 9.0)', '0x7661726335'],
|
|
44
|
-
];
|
|
45
|
-
const jsonTags = ["{\"key1\":\"taos\",\"key2\":null,\"key3\":\"TDengine\",\"key4\":0,\"key5\":false}"];
|
|
46
|
-
const jsonTagsCN = ["{\"key1\":\"taosdata\",\"key2\":null,\"key3\":\"TDengine涛思数据\",\"key4\":1,\"key5\":true}"];
|
|
47
|
-
// const selectStable = `select * from ${stable}`
|
|
48
|
-
const selectStableCN = `select * from ${stableCN}`;
|
|
49
|
-
// const selectTable = `select * from ${table}`
|
|
50
|
-
// const selectTableCN = `select * from ${tableCN}`
|
|
51
|
-
// const selectJsonTable = `select * from ${jsonTable}`
|
|
52
|
-
// const selectJsonTableCN = `select * from ${jsonTableCN}`
|
|
53
|
-
(async () => {
|
|
54
|
-
let ws = await wsSql_1.WsSql.open(conf);
|
|
55
|
-
await ws.exec(useDB);
|
|
56
|
-
let insertCN = (0, utils_1.insertStable)(tableCNValues, stableCNTags, stableCN);
|
|
57
|
-
let insertRes = await ws.exec(insertCN);
|
|
58
|
-
console.log("insertRes------", insertRes);
|
|
59
|
-
// let queryRes = await ws.exec(selectStableCN)
|
|
60
|
-
// let expectMeta = tableMeta.concat(tagMeta)
|
|
61
|
-
// let expectData = expectStableData(tableCNValues, stableCNTags)
|
|
62
|
-
// let actualMeta = queryRes.getMeta()
|
|
63
|
-
// let actualData = queryRes.getData()
|
|
64
|
-
await ws.close();
|
|
65
|
-
// if (actualData && actualMeta) {
|
|
66
|
-
// actualMeta.forEach((meta, index) => {
|
|
67
|
-
// expect(meta.name).toBe(expectMeta[index].name)
|
|
68
|
-
// expect(meta.type).toBe(expectMeta[index].type)
|
|
69
|
-
// expect(meta.length).toBe(expectMeta[index].length)
|
|
70
|
-
// })
|
|
71
|
-
// for (let i = 0; i < actualData.length; i++) {
|
|
72
|
-
// actualData[i].forEach((d, index) => {
|
|
73
|
-
// if (expectMeta[index].name == 'geo' || expectMeta[index].name == 'vbinary') {
|
|
74
|
-
// let buffer:ArrayBuffer = resultMap.get(expectData[i][index])
|
|
75
|
-
// if (buffer) {
|
|
76
|
-
// let dbData :ArrayBuffer = d
|
|
77
|
-
// console.log(i, index, dbData, expectData[i][index], buffer, compareUint8Arrays(new Uint8Array(dbData), new Uint8Array(buffer)))
|
|
78
|
-
// expect(compareUint8Arrays(new Uint8Array(dbData), new Uint8Array(buffer))).toBe(true)
|
|
79
|
-
// }
|
|
80
|
-
// } else {
|
|
81
|
-
// expect(d).toBe(expectData[i][index])
|
|
82
|
-
// }
|
|
83
|
-
// })
|
|
84
|
-
// }
|
|
85
|
-
// } else {
|
|
86
|
-
// throw new Error("retrieve empty result")
|
|
87
|
-
// }
|
|
88
|
-
})();
|