@tdengine/websocket 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/lib/example/all_type_query.js +26 -22
  2. package/lib/example/all_type_stmt.js +22 -20
  3. package/lib/example/basicBatchTmq.js +14 -14
  4. package/lib/example/basicSchemaless.js +11 -11
  5. package/lib/example/basicSql.js +10 -10
  6. package/lib/example/basicStmt.js +3 -3
  7. package/lib/example/basicTmq.js +8 -9
  8. package/lib/index.d.ts +0 -7
  9. package/lib/index.d.ts.map +1 -1
  10. package/lib/index.js +0 -7
  11. package/lib/src/client/wsClient.d.ts +2 -2
  12. package/lib/src/client/wsClient.d.ts.map +1 -1
  13. package/lib/src/client/wsClient.js +60 -37
  14. package/lib/src/client/wsConnector.d.ts.map +1 -1
  15. package/lib/src/client/wsConnector.js +40 -14
  16. package/lib/src/client/wsConnectorPool.d.ts.map +1 -1
  17. package/lib/src/client/wsConnectorPool.js +29 -14
  18. package/lib/src/client/wsEventCallback.d.ts.map +1 -1
  19. package/lib/src/client/wsEventCallback.js +6 -4
  20. package/lib/src/client/wsResponse.d.ts.map +1 -1
  21. package/lib/src/client/wsResponse.js +6 -2
  22. package/lib/src/common/config.d.ts +2 -2
  23. package/lib/src/common/config.d.ts.map +1 -1
  24. package/lib/src/common/config.js +5 -5
  25. package/lib/src/common/constant.d.ts.map +1 -1
  26. package/lib/src/common/constant.js +27 -27
  27. package/lib/src/common/log.d.ts +1 -1
  28. package/lib/src/common/log.d.ts.map +1 -1
  29. package/lib/src/common/log.js +9 -7
  30. package/lib/src/common/reqid.d.ts.map +1 -1
  31. package/lib/src/common/reqid.js +7 -7
  32. package/lib/src/common/taosResult.d.ts.map +1 -1
  33. package/lib/src/common/taosResult.js +46 -27
  34. package/lib/src/common/ut8Helper.d.ts.map +1 -1
  35. package/lib/src/common/ut8Helper.js +8 -8
  36. package/lib/src/common/utils.d.ts.map +1 -1
  37. package/lib/src/common/utils.js +17 -16
  38. package/lib/src/common/wsError.d.ts.map +1 -1
  39. package/lib/src/common/wsError.js +3 -3
  40. package/lib/src/common/wsOptions.d.ts +1 -1
  41. package/lib/src/index.d.ts +3 -3
  42. package/lib/src/index.d.ts.map +1 -1
  43. package/lib/src/sql/wsProto.d.ts.map +1 -1
  44. package/lib/src/sql/wsRows.d.ts +3 -3
  45. package/lib/src/sql/wsRows.d.ts.map +1 -1
  46. package/lib/src/sql/wsRows.js +4 -2
  47. package/lib/src/sql/wsSql.d.ts +5 -5
  48. package/lib/src/sql/wsSql.d.ts.map +1 -1
  49. package/lib/src/sql/wsSql.js +15 -16
  50. package/lib/src/stmt/FieldBindParams.d.ts.map +1 -1
  51. package/lib/src/stmt/wsColumnInfo.d.ts.map +1 -1
  52. package/lib/src/stmt/wsParams1.d.ts.map +1 -1
  53. package/lib/src/stmt/wsParams1.js +50 -24
  54. package/lib/src/stmt/wsParams2.d.ts.map +1 -1
  55. package/lib/src/stmt/wsParams2.js +30 -15
  56. package/lib/src/stmt/wsParamsBase.d.ts.map +1 -1
  57. package/lib/src/stmt/wsParamsBase.js +5 -3
  58. package/lib/src/stmt/wsProto.d.ts.map +1 -1
  59. package/lib/src/stmt/wsProto.js +22 -11
  60. package/lib/src/stmt/wsStmt.d.ts.map +1 -1
  61. package/lib/src/stmt/wsStmt1.d.ts +5 -5
  62. package/lib/src/stmt/wsStmt1.d.ts.map +1 -1
  63. package/lib/src/stmt/wsStmt1.js +14 -14
  64. package/lib/src/stmt/wsStmt2.d.ts +1 -1
  65. package/lib/src/stmt/wsStmt2.d.ts.map +1 -1
  66. package/lib/src/stmt/wsStmt2.js +18 -14
  67. package/lib/src/stmt/wsTableInfo.d.ts.map +1 -1
  68. package/lib/src/tmq/config.d.ts.map +1 -1
  69. package/lib/src/tmq/config.js +2 -2
  70. package/lib/src/tmq/constant.d.ts.map +1 -1
  71. package/lib/src/tmq/constant.js +28 -28
  72. package/lib/src/tmq/tmqResponse.d.ts.map +1 -1
  73. package/lib/src/tmq/tmqResponse.js +30 -16
  74. package/lib/src/tmq/wsTmq.d.ts +2 -2
  75. package/lib/src/tmq/wsTmq.d.ts.map +1 -1
  76. package/lib/src/tmq/wsTmq.js +32 -30
  77. package/lib/test/bulkPulling/cloud.tmq.test.js +11 -11
  78. package/lib/test/bulkPulling/decimal.test.js +50 -26
  79. package/lib/test/bulkPulling/log.test.js +8 -8
  80. package/lib/test/bulkPulling/queryTables.test.js +255 -49
  81. package/lib/test/bulkPulling/schemaless.test.js +34 -34
  82. package/lib/test/bulkPulling/sql.test.js +108 -69
  83. package/lib/test/bulkPulling/stmt1.func.test.js +96 -96
  84. package/lib/test/bulkPulling/stmt1.type.test.js +124 -48
  85. package/lib/test/bulkPulling/stmt2.func.test.js +116 -112
  86. package/lib/test/bulkPulling/stmt2.type.test.js +124 -48
  87. package/lib/test/bulkPulling/tmq.test.js +225 -31
  88. package/lib/test/bulkPulling/utils.test.js +2 -2
  89. package/lib/test/bulkPulling/wsConnectPool.test.js +18 -18
  90. package/lib/test/utils.d.ts.map +1 -1
  91. package/lib/test/utils.js +129 -129
  92. package/package.json +1 -1
  93. package/readme.md +1 -0
  94. package/lib/src/stmt/wsParams.d.ts +0 -41
  95. package/lib/src/stmt/wsParams.d.ts.map +0 -1
  96. package/lib/src/stmt/wsParams.js +0 -428
  97. package/lib/test/bulkPulling/stmt.func.test.d.ts +0 -2
  98. package/lib/test/bulkPulling/stmt.func.test.d.ts.map +0 -1
  99. package/lib/test/bulkPulling/stmt.func.test.js +0 -493
  100. package/lib/test/bulkPulling/stmt.type.test.d.ts +0 -2
  101. package/lib/test/bulkPulling/stmt.type.test.d.ts.map +0 -1
  102. package/lib/test/bulkPulling/stmt.type.test.js +0 -316
@@ -6,18 +6,46 @@ const log_1 = require("../../src/common/log");
6
6
  const wsSql_1 = require("../../src/sql/wsSql");
7
7
  const wsStmt2_1 = require("../../src/stmt/wsStmt2");
8
8
  const utils_1 = require("../utils");
9
- const stable = 'ws_stmt_stb';
10
- const table = 'stmt_001';
11
- const db = 'ws_stmt2';
9
+ const stable = "ws_stmt_stb";
10
+ const table = "stmt_001";
11
+ const db = "ws_stmt2";
12
12
  const createDB = `create database if not exists ${db} keep 3650`;
13
13
  const useDB = `use ${db}`;
14
14
  const dropDB = `drop database if exists ${db}`;
15
- const tableCN = 'stmt_cn';
16
- const stableCN = 'ws_stmt_stb_cn';
17
- const jsonTable = 'stmt_json';
18
- const jsonTableCN = 'stmt_json_cn';
19
- const stableTags = [true, -1, -2, -3, -4, 1, 2, 3, 4, parseFloat(3.1415.toFixed(5)), parseFloat(3.14159265.toFixed(15)), 'varchar_tag_1', 'nchar_tag_1'];
20
- const stableCNTags = [false, -1 * 2, -2 * 2, -3 * 2, -4 * 2, 1 * 2, 2 * 2, 3 * 2, 4 * 2, parseFloat((3.1415 * 2).toFixed(5)), parseFloat((3.14159265 * 2).toFixed(15)), 'varchar_标签_壹', 'nchar_标签_贰'];
15
+ const tableCN = "stmt_cn";
16
+ const stableCN = "ws_stmt_stb_cn";
17
+ const jsonTable = "stmt_json";
18
+ const jsonTableCN = "stmt_json_cn";
19
+ const stableTags = [
20
+ true,
21
+ -1,
22
+ -2,
23
+ -3,
24
+ -4,
25
+ 1,
26
+ 2,
27
+ 3,
28
+ 4,
29
+ parseFloat((3.1415).toFixed(5)),
30
+ parseFloat((3.14159265).toFixed(15)),
31
+ "varchar_tag_1",
32
+ "nchar_tag_1",
33
+ ];
34
+ const stableCNTags = [
35
+ false,
36
+ -1 * 2,
37
+ -2 * 2,
38
+ -3 * 2,
39
+ -4 * 2,
40
+ 1 * 2,
41
+ 2 * 2,
42
+ 3 * 2,
43
+ 4 * 2,
44
+ parseFloat((3.1415 * 2).toFixed(5)),
45
+ parseFloat((3.14159265 * 2).toFixed(15)),
46
+ "varchar_标签_壹",
47
+ "nchar_标签_贰",
48
+ ];
21
49
  const tableValues = [
22
50
  [1656677710000, 1656677720000, 1656677730000, 1656677740000, 1656677750000],
23
51
  [0, -1, -2, -3, -4],
@@ -30,15 +58,39 @@ const tableValues = [
30
58
  [2, 3, 4, 5, 6],
31
59
  // [0, 1, 2, 3, 4],
32
60
  [BigInt(3), BigInt(4), BigInt(5), BigInt(6), BigInt(7)],
33
- [parseFloat(3.1415.toFixed(5)), parseFloat((3.1415 * 2).toFixed(5)), parseFloat((3.1415 * 3).toFixed(5)), parseFloat((3.1415 * 4).toFixed(5)), parseFloat((3.1415 * 5).toFixed(5))],
34
- [parseFloat(3.14159265.toFixed(15)), parseFloat((3.14159265 * 2).toFixed(15)), parseFloat((3.14159265 * 3).toFixed(15)), parseFloat((3.14159265 * 4).toFixed(15)), parseFloat((3.14159265 * 5).toFixed(15))],
35
- ['varchar_col_1', 'varchar_col_2', 'varchar_col_3', 'varchar_col_4', 'varchar_col_5'],
36
- ['nchar_col_1', 'nchar_col_2', '', 'nchar_col_4', 'nchar_col_5'],
61
+ [
62
+ parseFloat((3.1415).toFixed(5)),
63
+ parseFloat((3.1415 * 2).toFixed(5)),
64
+ parseFloat((3.1415 * 3).toFixed(5)),
65
+ parseFloat((3.1415 * 4).toFixed(5)),
66
+ parseFloat((3.1415 * 5).toFixed(5)),
67
+ ],
68
+ [
69
+ parseFloat((3.14159265).toFixed(15)),
70
+ parseFloat((3.14159265 * 2).toFixed(15)),
71
+ parseFloat((3.14159265 * 3).toFixed(15)),
72
+ parseFloat((3.14159265 * 4).toFixed(15)),
73
+ parseFloat((3.14159265 * 5).toFixed(15)),
74
+ ],
75
+ [
76
+ "varchar_col_1",
77
+ "varchar_col_2",
78
+ "varchar_col_3",
79
+ "varchar_col_4",
80
+ "varchar_col_5",
81
+ ],
82
+ ["nchar_col_1", "nchar_col_2", "", "nchar_col_4", "nchar_col_5"],
37
83
  [true, false, true, false, true],
38
- [null, null, null, null, null]
84
+ [null, null, null, null, null],
39
85
  ];
40
86
  const tableCNValues = [
41
- [BigInt(1656677760000), BigInt(1656677770000), BigInt(1656677780000), BigInt(1656677790000), BigInt(1656677100000)],
87
+ [
88
+ BigInt(1656677760000),
89
+ BigInt(1656677770000),
90
+ BigInt(1656677780000),
91
+ BigInt(1656677790000),
92
+ BigInt(1656677100000),
93
+ ],
42
94
  [0, -1, -2, -3, -4],
43
95
  [-1, -2, -3, -4, -5],
44
96
  [-2, -3, -4, -5, -6],
@@ -47,10 +99,28 @@ const tableCNValues = [
47
99
  [1, 2, 3, 4, 5],
48
100
  [2, 3, 4, 5, 6],
49
101
  [BigInt(3), BigInt(4), BigInt(5), BigInt(6), BigInt(7)],
50
- [parseFloat(3.1415.toFixed(5)), parseFloat((3.1415 * 2).toFixed(5)), parseFloat((3.1415 * 3).toFixed(5)), parseFloat((3.1415 * 4).toFixed(5)), parseFloat((3.1415 * 5).toFixed(5))],
51
- [parseFloat(3.14159265.toFixed(15)), parseFloat((3.14159265 * 2).toFixed(15)), parseFloat((3.14159265 * 3).toFixed(15)), parseFloat((3.14159265 * 4).toFixed(15)), parseFloat((3.14159265 * 5).toFixed(15))],
52
- ['varchar_列_壹', 'varchar_列_贰', 'varchar_列_叁', 'varchar_列_肆', 'varchar_列_伍'],
53
- ['nchar_列_甲', 'nchar_列_乙', 'nchar_列_丙', 'nchar_列_丁', 'nchar_列_戊'],
102
+ [
103
+ parseFloat((3.1415).toFixed(5)),
104
+ parseFloat((3.1415 * 2).toFixed(5)),
105
+ parseFloat((3.1415 * 3).toFixed(5)),
106
+ parseFloat((3.1415 * 4).toFixed(5)),
107
+ parseFloat((3.1415 * 5).toFixed(5)),
108
+ ],
109
+ [
110
+ parseFloat((3.14159265).toFixed(15)),
111
+ parseFloat((3.14159265 * 2).toFixed(15)),
112
+ parseFloat((3.14159265 * 3).toFixed(15)),
113
+ parseFloat((3.14159265 * 4).toFixed(15)),
114
+ parseFloat((3.14159265 * 5).toFixed(15)),
115
+ ],
116
+ [
117
+ "varchar_列_壹",
118
+ "varchar_列_贰",
119
+ "varchar_列_叁",
120
+ "varchar_列_肆",
121
+ "varchar_列_伍",
122
+ ],
123
+ ["nchar_列_甲", "nchar_列_乙", "nchar_列_丙", "nchar_列_丁", "nchar_列_戊"],
54
124
  [true, false, true, false, true],
55
125
  [null, null, null, null, null],
56
126
  ];
@@ -58,21 +128,27 @@ let geoDataArray = [];
58
128
  let varbinary = [];
59
129
  const encoder = new TextEncoder();
60
130
  for (let i = 0; i < 5; i++) {
61
- let data = new Uint8Array([0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62
- 0x00, 0x00, 0x00, 0x59, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x40,]);
131
+ let data = new Uint8Array([
132
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59,
133
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x40,
134
+ ]);
63
135
  geoDataArray.push(data.buffer);
64
136
  let vdata = encoder.encode(`varchar_col_${i + 1}`);
65
137
  varbinary.push(vdata.buffer);
66
138
  }
67
- const jsonTags = ["{\"key1\":\"taos\",\"key2\":null,\"key3\":\"TDengine\",\"key4\":0,\"key5\":false}"];
68
- const jsonTagsCN = ["{\"key1\":\"taosdata\",\"key2\":null,\"key3\":\"TDengine涛思数据\",\"key4\":1,\"key5\":true}"];
139
+ const jsonTags = [
140
+ '{"key1":"taos","key2":null,"key3":"TDengine","key4":0,"key5":false}',
141
+ ];
142
+ const jsonTagsCN = [
143
+ '{"key1":"taosdata","key2":null,"key3":"TDengine涛思数据","key4":1,"key5":true}',
144
+ ];
69
145
  const selectStable = `select * from ${stable}`;
70
146
  const selectStableCN = `select * from ${stableCN}`;
71
147
  const selectTable = `select * from ${table}`;
72
148
  const selectTableCN = `select * from ${tableCN}`;
73
149
  const selectJsonTable = `select * from ${jsonTable}`;
74
150
  const selectJsonTableCN = `select * from ${jsonTableCN}`;
75
- let dsn = 'ws://root:taosdata@localhost:6041';
151
+ let dsn = "ws://root:taosdata@localhost:6041";
76
152
  (0, log_1.setLevel)("debug");
77
153
  beforeAll(async () => {
78
154
  let conf = new config_1.WSConfig(dsn);
@@ -84,9 +160,9 @@ beforeAll(async () => {
84
160
  await ws.exec((0, utils_1.createSTableJSON)(jsonTable));
85
161
  await ws.close();
86
162
  });
87
- describe('TDWebSocket.Stmt()', () => {
163
+ describe("TDWebSocket.Stmt()", () => {
88
164
  jest.setTimeout(20 * 1000);
89
- test('normal BindParam', async () => {
165
+ test("normal BindParam", async () => {
90
166
  let wsConf = new config_1.WSConfig(dsn);
91
167
  wsConf.setDb(db);
92
168
  let connector = await wsSql_1.WsSql.open(wsConf);
@@ -138,7 +214,7 @@ describe('TDWebSocket.Stmt()', () => {
138
214
  console.log(result);
139
215
  await connector.close();
140
216
  });
141
- test('normal CN BindParam', async () => {
217
+ test("normal CN BindParam", async () => {
142
218
  let wsConf = new config_1.WSConfig(dsn);
143
219
  wsConf.setDb(db);
144
220
  let connector = await wsSql_1.WsSql.open(wsConf);
@@ -190,7 +266,7 @@ describe('TDWebSocket.Stmt()', () => {
190
266
  console.log(result);
191
267
  await connector.close();
192
268
  });
193
- test('normal json tag BindParam', async () => {
269
+ test("normal json tag BindParam", async () => {
194
270
  let wsConf = new config_1.WSConfig(dsn);
195
271
  wsConf.setDb(db);
196
272
  let connector = await wsSql_1.WsSql.open(wsConf);
@@ -230,7 +306,7 @@ describe('TDWebSocket.Stmt()', () => {
230
306
  console.log(result);
231
307
  await connector.close();
232
308
  });
233
- test('normal json cn tag BindParam', async () => {
309
+ test("normal json cn tag BindParam", async () => {
234
310
  let wsConf = new config_1.WSConfig(dsn);
235
311
  wsConf.setDb(db);
236
312
  let connector = await wsSql_1.WsSql.open(wsConf);
@@ -271,25 +347,25 @@ describe('TDWebSocket.Stmt()', () => {
271
347
  await connector.close();
272
348
  });
273
349
  });
274
- test('test bind exception cases', async () => {
350
+ test("test bind exception cases", async () => {
275
351
  let wsConf = new config_1.WSConfig(dsn);
276
352
  let connector = await wsSql_1.WsSql.open(wsConf);
277
353
  let stmt = await connector.stmtInit();
278
354
  expect(stmt).toBeInstanceOf(wsStmt2_1.WsStmt2);
279
355
  const params = stmt.newStmtParam();
280
356
  const emptyArrayMethods = [
281
- { method: 'setBoolean', name: 'SetBooleanColumn' },
282
- { method: 'setTinyInt', name: 'SetTinyIntColumn' },
283
- { method: 'setUTinyInt', name: 'SetUTinyIntColumn' },
284
- { method: 'setSmallInt', name: 'SetSmallIntColumn' },
285
- { method: 'setUSmallInt', name: 'SetSmallIntColumn' },
286
- { method: 'setInt', name: 'SetIntColumn' },
287
- { method: 'setUInt', name: 'SetUIntColumn' },
288
- { method: 'setBigint', name: 'SetBigIntColumn' },
289
- { method: 'setUBigint', name: 'SetUBigIntColumn' },
290
- { method: 'setFloat', name: 'SetFloatColumn' },
291
- { method: 'setDouble', name: 'SetDoubleColumn' },
292
- { method: 'setTimestamp', name: 'SeTimestampColumn' }
357
+ { method: "setBoolean", name: "SetBooleanColumn" },
358
+ { method: "setTinyInt", name: "SetTinyIntColumn" },
359
+ { method: "setUTinyInt", name: "SetUTinyIntColumn" },
360
+ { method: "setSmallInt", name: "SetSmallIntColumn" },
361
+ { method: "setUSmallInt", name: "SetSmallIntColumn" },
362
+ { method: "setInt", name: "SetIntColumn" },
363
+ { method: "setUInt", name: "SetUIntColumn" },
364
+ { method: "setBigint", name: "SetBigIntColumn" },
365
+ { method: "setUBigint", name: "SetUBigIntColumn" },
366
+ { method: "setFloat", name: "SetFloatColumn" },
367
+ { method: "setDouble", name: "SetDoubleColumn" },
368
+ { method: "setTimestamp", name: "SeTimestampColumn" },
293
369
  ];
294
370
  emptyArrayMethods.forEach(({ method, name }) => {
295
371
  expect(() => {
@@ -303,17 +379,17 @@ test('test bind exception cases', async () => {
303
379
  }).toThrow(`${name} params is invalid!`);
304
380
  });
305
381
  expect(() => {
306
- params.setBoolean(['not boolean']);
382
+ params.setBoolean(["not boolean"]);
307
383
  params.encode();
308
- }).toThrow('SetTinyIntColumn params is invalid!');
384
+ }).toThrow("SetTinyIntColumn params is invalid!");
309
385
  expect(() => {
310
- params.setTinyInt(['not number']);
386
+ params.setTinyInt(["not number"]);
311
387
  params.encode();
312
- }).toThrow('SetTinyIntColumn params is invalid!');
388
+ }).toThrow("SetTinyIntColumn params is invalid!");
313
389
  expect(() => {
314
- params.setBigint(['not bigint']);
390
+ params.setBigint(["not bigint"]);
315
391
  params.encode();
316
- }).toThrow('SetTinyIntColumn params is invalid!');
392
+ }).toThrow("SetTinyIntColumn params is invalid!");
317
393
  await connector.close();
318
394
  });
319
395
  afterAll(async () => {
@@ -8,36 +8,230 @@ const utils_1 = require("../utils");
8
8
  const wsConnectorPool_1 = require("../../src/client/wsConnectorPool");
9
9
  const log_1 = require("../../src/common/log");
10
10
  (0, log_1.setLevel)("debug");
11
- const stable = 'st';
12
- const db = 'ws_tmq_test';
13
- const topics = ['topic_ws_bean'];
11
+ const stable = "st";
12
+ const db = "ws_tmq_test";
13
+ const topics = ["topic_ws_bean"];
14
14
  // const topic2 = 'topic_ws_bean_2'
15
15
  // let createTopic = `create topic if not exists ${topic} as select ts, c1, c2, c3, c4, c5, t1 from ${db}.${stable}`
16
16
  // let createTopic2 = `create topic if not exists ${topic2} as select ts, c1, c4, c5, t1 from ${db}.${stable}`
17
17
  let createTopic = `create topic if not exists ${topics[0]} as select * from ${db}.${stable}`;
18
18
  let dropTopic = `DROP TOPIC IF EXISTS ${topics[0]};`;
19
19
  // let dropTopic2 = `DROP TOPIC IF EXISTS ${topic2};`
20
- let dsn = 'ws://root:taosdata@localhost:6041';
21
- let tmqDsn = 'ws://localhost:6041';
20
+ let dsn = "ws://root:taosdata@localhost:6041";
21
+ let tmqDsn = "ws://localhost:6041";
22
22
  beforeAll(async () => {
23
23
  let conf = new config_1.WSConfig(dsn);
24
24
  const createDB = `create database if not exists ${db} keep 3650`;
25
25
  const dropDB = `drop database if exists ${db}`;
26
26
  const useDB = `use ${db}`;
27
- 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'];
27
+ const stableTags = [
28
+ true,
29
+ -1,
30
+ -2,
31
+ -3,
32
+ BigInt(-4),
33
+ 1,
34
+ 2,
35
+ 3,
36
+ BigInt(4),
37
+ parseFloat((3.1415).toFixed(5)),
38
+ parseFloat((3.14159265).toFixed(15)),
39
+ "varchar_tag_1",
40
+ "nchar_tag_1",
41
+ ];
28
42
  const tableValues = [
29
- [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'],
30
- [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'],
31
- [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'],
32
- [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'],
33
- [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'],
43
+ [
44
+ BigInt(1656677710000),
45
+ 0,
46
+ -1,
47
+ -2,
48
+ BigInt(-3),
49
+ 0,
50
+ 1,
51
+ 2,
52
+ BigInt(3),
53
+ parseFloat((3.1415).toFixed(5)),
54
+ parseFloat((3.14159265).toFixed(15)),
55
+ "varchar_col_1",
56
+ "nchar_col_1",
57
+ true,
58
+ "NULL",
59
+ "POINT (4.0 8.0)",
60
+ "0x7661726332",
61
+ ],
62
+ [
63
+ BigInt(1656677720000),
64
+ -1,
65
+ -2,
66
+ -3,
67
+ BigInt(-4),
68
+ 1,
69
+ 2,
70
+ 3,
71
+ BigInt(4),
72
+ parseFloat((3.1415 * 2).toFixed(5)),
73
+ parseFloat((3.14159265 * 2).toFixed(15)),
74
+ "varchar_col_2",
75
+ "nchar_col_2",
76
+ false,
77
+ "NULL",
78
+ "POINT (3.0 5.0)",
79
+ "0x7661726333",
80
+ ],
81
+ [
82
+ BigInt(1656677730000),
83
+ -2,
84
+ -3,
85
+ -4,
86
+ BigInt(-5),
87
+ 2,
88
+ 3,
89
+ 4,
90
+ BigInt(5),
91
+ parseFloat((3.1415 * 3).toFixed(5)),
92
+ parseFloat((3.14159265 * 3).toFixed(15)),
93
+ "varchar_col_3",
94
+ "nchar_col_3",
95
+ true,
96
+ "NULL",
97
+ "LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)",
98
+ "0x7661726334",
99
+ ],
100
+ [
101
+ BigInt(1656677740000),
102
+ -3,
103
+ -4,
104
+ -5,
105
+ BigInt(-6),
106
+ 3,
107
+ 4,
108
+ 5,
109
+ BigInt(6),
110
+ parseFloat((3.1415 * 4).toFixed(5)),
111
+ parseFloat((3.14159265 * 4).toFixed(15)),
112
+ "varchar_col_4",
113
+ "nchar_col_4",
114
+ false,
115
+ "NULL",
116
+ "POLYGON ((3.000000 6.000000, 5.000000 6.000000, 5.000000 8.000000, 3.000000 8.000000, 3.000000 6.000000))",
117
+ "0x7661726335",
118
+ ],
119
+ [
120
+ BigInt(1656677750000),
121
+ -4,
122
+ -5,
123
+ -6,
124
+ BigInt(-7),
125
+ 4,
126
+ 5,
127
+ 6,
128
+ BigInt(7),
129
+ parseFloat((3.1415 * 5).toFixed(5)),
130
+ parseFloat((3.14159265 * 5).toFixed(15)),
131
+ "varchar_col_5",
132
+ "nchar_col_5",
133
+ true,
134
+ "NULL",
135
+ "POINT (7.0 9.0)",
136
+ "0x7661726335",
137
+ ],
34
138
  ];
35
139
  const tableCNValues = [
36
- [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'],
37
- [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'],
38
- [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'],
39
- [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'],
40
- [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'],
140
+ [
141
+ BigInt(1656677760000),
142
+ 0,
143
+ -1,
144
+ -2,
145
+ BigInt(-3),
146
+ 0,
147
+ 1,
148
+ 2,
149
+ BigInt(3),
150
+ parseFloat((3.1415).toFixed(5)),
151
+ parseFloat((3.14159265).toFixed(15)),
152
+ "varchar_列_壹",
153
+ "nchar_列_甲",
154
+ true,
155
+ "NULL",
156
+ "POINT (4.0 8.0)",
157
+ "0x7661726332",
158
+ ],
159
+ [
160
+ BigInt(1656677770000),
161
+ -1,
162
+ -2,
163
+ -3,
164
+ BigInt(-4),
165
+ 1,
166
+ 2,
167
+ 3,
168
+ BigInt(4),
169
+ parseFloat((3.1415 * 2).toFixed(5)),
170
+ parseFloat((3.14159265 * 2).toFixed(15)),
171
+ "varchar_列_贰",
172
+ "nchar_列_乙",
173
+ false,
174
+ "NULL",
175
+ "POINT (3.0 5.0)",
176
+ "0x7661726333",
177
+ ],
178
+ [
179
+ BigInt(1656677780000),
180
+ -2,
181
+ -3,
182
+ -4,
183
+ BigInt(-5),
184
+ 2,
185
+ 3,
186
+ 4,
187
+ BigInt(5),
188
+ parseFloat((3.1415 * 3).toFixed(5)),
189
+ parseFloat((3.14159265 * 3).toFixed(15)),
190
+ "varchar_列_叁",
191
+ "nchar_列_丙",
192
+ true,
193
+ "NULL",
194
+ "LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)",
195
+ "0x7661726334",
196
+ ],
197
+ [
198
+ BigInt(1656677790000),
199
+ -3,
200
+ -4,
201
+ -5,
202
+ BigInt(-6),
203
+ 3,
204
+ 4,
205
+ 5,
206
+ BigInt(6),
207
+ parseFloat((3.1415 * 4).toFixed(5)),
208
+ parseFloat((3.14159265 * 4).toFixed(15)),
209
+ "varchar_列_肆",
210
+ "nchar_列_丁",
211
+ false,
212
+ "NULL",
213
+ "POLYGON ((3.000000 6.000000, 5.000000 6.000000, 5.000000 8.000000, 3.000000 8.000000, 3.000000 6.000000))",
214
+ "0x7661726335",
215
+ ],
216
+ [
217
+ BigInt(1656677800000),
218
+ -4,
219
+ -5,
220
+ -6,
221
+ BigInt(-7),
222
+ 4,
223
+ 5,
224
+ 6,
225
+ BigInt(7),
226
+ parseFloat((3.1415 * 5).toFixed(5)),
227
+ parseFloat((3.14159265 * 5).toFixed(15)),
228
+ "varchar_列_伍",
229
+ "nchar_列_戊",
230
+ true,
231
+ "NULL",
232
+ "POINT (7.0 9.0)",
233
+ "0x7661726335",
234
+ ],
41
235
  ];
42
236
  let ws = await wsSql_1.WsSql.open(conf);
43
237
  await ws.exec(dropTopic);
@@ -54,27 +248,27 @@ beforeAll(async () => {
54
248
  insertRes = await ws.exec(insert);
55
249
  await ws.close();
56
250
  });
57
- describe('TDWebSocket.Tmq()', () => {
251
+ describe("TDWebSocket.Tmq()", () => {
58
252
  jest.setTimeout(20 * 1000);
59
253
  let configMap = new Map([
60
254
  [constant_1.TMQConstants.GROUP_ID, "gId"],
61
255
  [constant_1.TMQConstants.CONNECT_USER, "root"],
62
256
  [constant_1.TMQConstants.CONNECT_PASS, "taosdata"],
63
257
  [constant_1.TMQConstants.AUTO_OFFSET_RESET, "earliest"],
64
- [constant_1.TMQConstants.CLIENT_ID, 'test_tmq_client'],
258
+ [constant_1.TMQConstants.CLIENT_ID, "test_tmq_client"],
65
259
  [constant_1.TMQConstants.WS_URL, tmqDsn],
66
- [constant_1.TMQConstants.ENABLE_AUTO_COMMIT, 'true'],
67
- [constant_1.TMQConstants.AUTO_COMMIT_INTERVAL_MS, '1000'],
260
+ [constant_1.TMQConstants.ENABLE_AUTO_COMMIT, "true"],
261
+ [constant_1.TMQConstants.AUTO_COMMIT_INTERVAL_MS, "1000"],
68
262
  ["session.timeout.ms", "10000"],
69
263
  ["max.poll.interval.ms", "30000"],
70
- ["msg.with.table.name", "true"]
264
+ ["msg.with.table.name", "true"],
71
265
  ]);
72
266
  console.log(configMap);
73
- test('normal connect', async () => {
267
+ test("normal connect", async () => {
74
268
  let consumer = await wsTmq_1.WsConsumer.newConsumer(configMap);
75
269
  await consumer.close();
76
270
  });
77
- test('connect error', async () => {
271
+ test("connect error", async () => {
78
272
  expect.assertions(1);
79
273
  let consumer = null;
80
274
  let errConfigMap = new Map([
@@ -82,13 +276,13 @@ describe('TDWebSocket.Tmq()', () => {
82
276
  [constant_1.TMQConstants.CONNECT_USER, "root"],
83
277
  [constant_1.TMQConstants.CONNECT_PASS, "test"],
84
278
  [constant_1.TMQConstants.AUTO_OFFSET_RESET, "earliest1"],
85
- [constant_1.TMQConstants.CLIENT_ID, 'test_tmq_client'],
279
+ [constant_1.TMQConstants.CLIENT_ID, "test_tmq_client"],
86
280
  [constant_1.TMQConstants.WS_URL, tmqDsn],
87
- [constant_1.TMQConstants.ENABLE_AUTO_COMMIT, 'true'],
88
- [constant_1.TMQConstants.AUTO_COMMIT_INTERVAL_MS, '1000'],
281
+ [constant_1.TMQConstants.ENABLE_AUTO_COMMIT, "true"],
282
+ [constant_1.TMQConstants.AUTO_COMMIT_INTERVAL_MS, "1000"],
89
283
  ["session.timeout.ms", "10000"],
90
284
  ["max.poll.interval.ms", "30000"],
91
- ["msg.with.table.name", "true"]
285
+ ["msg.with.table.name", "true"],
92
286
  ]);
93
287
  try {
94
288
  consumer = await wsTmq_1.WsConsumer.newConsumer(errConfigMap);
@@ -96,7 +290,7 @@ describe('TDWebSocket.Tmq()', () => {
96
290
  }
97
291
  catch (e) {
98
292
  console.log(e);
99
- expect(e.code).toBe(65535);
293
+ expect(e.code).toBe(280);
100
294
  }
101
295
  finally {
102
296
  if (consumer) {
@@ -104,7 +298,7 @@ describe('TDWebSocket.Tmq()', () => {
104
298
  }
105
299
  }
106
300
  });
107
- test('normal Subscribe', async () => {
301
+ test("normal Subscribe", async () => {
108
302
  let consumer = await wsTmq_1.WsConsumer.newConsumer(configMap);
109
303
  await consumer.subscribe(topics);
110
304
  let assignment = await consumer.assignment();
@@ -160,7 +354,7 @@ describe('TDWebSocket.Tmq()', () => {
160
354
  console.log("------------->", counts);
161
355
  expect(counts).toEqual(10);
162
356
  });
163
- test('Topic not exist', async () => {
357
+ test("Topic not exist", async () => {
164
358
  let consumer = await wsTmq_1.WsConsumer.newConsumer(configMap);
165
359
  try {
166
360
  await consumer.subscribe(["aaa"]);
@@ -170,7 +364,7 @@ describe('TDWebSocket.Tmq()', () => {
170
364
  }
171
365
  await consumer.close();
172
366
  });
173
- test('normal seek', async () => {
367
+ test("normal seek", async () => {
174
368
  let consumer = await wsTmq_1.WsConsumer.newConsumer(configMap);
175
369
  await consumer.subscribe(topics);
176
370
  let assignment = await consumer.assignment();
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../../src/common/utils");
4
- describe('utils test', () => {
5
- test('compare versions test', async () => {
4
+ describe("utils test", () => {
5
+ test("compare versions test", async () => {
6
6
  expect((0, utils_1.compareVersions)("3.3.6.3-alpha", "3.3.6.2")).toBe(1);
7
7
  expect((0, utils_1.compareVersions)("3.3.6.2", "3.3.6.3")).toBe(-1);
8
8
  expect((0, utils_1.compareVersions)("3.3.6.3", "3.3.6.3")).toBe(0);