@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
@@ -8,8 +8,8 @@ const constant_1 = require("../../src/tmq/constant");
8
8
  const wsTmq_1 = require("../../src/tmq/wsTmq");
9
9
  const utils_1 = require("../utils");
10
10
  const log_1 = require("../../src/common/log");
11
- let dsn = 'ws://root:taosdata@localhost:6041';
12
- let tags = ['California.SanFrancisco', 3];
11
+ let dsn = "ws://root:taosdata@localhost:6041";
12
+ let tags = ["California.SanFrancisco", 3];
13
13
  let multi = [
14
14
  [1709183268567, 1709183268568, 1709183268569],
15
15
  [10.2, 10.3, 10.4],
@@ -21,19 +21,19 @@ let configMap = new Map([
21
21
  [constant_1.TMQConstants.CONNECT_USER, "root"],
22
22
  [constant_1.TMQConstants.CONNECT_PASS, "taosdata"],
23
23
  [constant_1.TMQConstants.AUTO_OFFSET_RESET, "earliest"],
24
- [constant_1.TMQConstants.CLIENT_ID, 'test_tmq_client'],
25
- [constant_1.TMQConstants.WS_URL, 'ws://localhost:6041'],
26
- [constant_1.TMQConstants.ENABLE_AUTO_COMMIT, 'true'],
27
- [constant_1.TMQConstants.AUTO_COMMIT_INTERVAL_MS, '1000']
24
+ [constant_1.TMQConstants.CLIENT_ID, "test_tmq_client"],
25
+ [constant_1.TMQConstants.WS_URL, "ws://localhost:6041"],
26
+ [constant_1.TMQConstants.ENABLE_AUTO_COMMIT, "true"],
27
+ [constant_1.TMQConstants.AUTO_COMMIT_INTERVAL_MS, "1000"],
28
28
  ]);
29
- const stable = 'meters';
30
- const db = 'power_connect';
31
- const topics = ['pwer_meters_topic'];
29
+ const stable = "meters";
30
+ const db = "power_connect";
31
+ const topics = ["pwer_meters_topic"];
32
32
  let createTopic = `create topic if not exists ${topics[0]} as select * from ${db}.${stable}`;
33
33
  let stmtIds = [];
34
34
  (0, log_1.setLevel)("debug");
35
35
  async function connect() {
36
- let dsn = 'ws://root:taosdata@localhost:6041';
36
+ let dsn = "ws://root:taosdata@localhost:6041";
37
37
  let wsSql = null;
38
38
  let conf = new config_1.WSConfig(dsn);
39
39
  conf.setDb(db);
@@ -43,10 +43,10 @@ async function connect() {
43
43
  await wsSql.close();
44
44
  }
45
45
  async function stmtConnect() {
46
- let dsn = 'ws://root:taosdata@localhost:6041';
46
+ let dsn = "ws://root:taosdata@localhost:6041";
47
47
  let wsConf = new config_1.WSConfig(dsn, "100.100.100.100");
48
48
  wsConf.setDb(db);
49
- // let connector = WsStmtConnect.NewConnector(wsConf)
49
+ // let connector = WsStmtConnect.NewConnector(wsConf)
50
50
  // let stmt = await connector.Init()
51
51
  let connector = await wsSql_1.WsSql.open(wsConf);
52
52
  let stmt = (await connector.stmtInit());
@@ -56,7 +56,7 @@ async function stmtConnect() {
56
56
  }
57
57
  expect(stmt).toBeTruthy();
58
58
  await stmt.prepare(`INSERT INTO ? USING ${stable} (location, groupId) TAGS (?, ?) VALUES (?, ?, ?, ?)`);
59
- await stmt.setTableName('d1001');
59
+ await stmt.setTableName("d1001");
60
60
  await stmt.setJsonTags(tags);
61
61
  let lastTs = 0;
62
62
  const allp = [];
@@ -117,16 +117,16 @@ beforeAll(async () => {
117
117
  await ws.exec(createTopic, reqid_1.ReqId.getReqID());
118
118
  await ws.close();
119
119
  });
120
- describe('TDWebSocket.WsSql()', () => {
120
+ describe("TDWebSocket.WsSql()", () => {
121
121
  jest.setTimeout(60 * 1000);
122
- test('ReqId', async () => {
122
+ test("ReqId", async () => {
123
123
  const allp = [];
124
124
  for (let i = 0; i < 10; i++) {
125
125
  allp.push(console.log(reqid_1.ReqId.getReqID()));
126
126
  }
127
127
  await Promise.all(allp);
128
128
  });
129
- test('normal connect', async () => {
129
+ test("normal connect", async () => {
130
130
  const allp = [];
131
131
  for (let i = 0; i < 20; i++) {
132
132
  allp.push(connect());
@@ -139,8 +139,8 @@ describe('TDWebSocket.WsSql()', () => {
139
139
  });
140
140
  afterAll(async () => {
141
141
  let conf = new config_1.WSConfig(dsn);
142
- conf.setUser('root');
143
- conf.setPwd('taosdata');
142
+ conf.setUser("root");
143
+ conf.setPwd("taosdata");
144
144
  let wsSql = await wsSql_1.WsSql.open(conf);
145
145
  await wsSql.exec(`drop topic if exists ${topics[0]};`);
146
146
  await wsSql.exec(`drop database if exists ${db};`);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":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,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKnD;AACD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvD;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EACvB,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GACjB,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAMnB;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAQnD;AAoBD,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,GACjB,OAAO,CAYT;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C"}
package/lib/test/utils.js CHANGED
@@ -21,23 +21,23 @@ const log_1 = __importDefault(require("../src/common/log"));
21
21
  function getInsertBind(valuesLen, tagsLen, db, stable) {
22
22
  let sql = `insert into ? using ${db}.${stable} tags ( ?`;
23
23
  for (let i = 1; i < tagsLen; i++) {
24
- sql += ', ?';
24
+ sql += ", ?";
25
25
  }
26
- sql += ') values( ?';
26
+ sql += ") values( ?";
27
27
  for (let i = 1; i < valuesLen; i++) {
28
- sql += ', ?';
28
+ sql += ", ?";
29
29
  }
30
- sql += ')';
30
+ sql += ")";
31
31
  log_1.default.debug(`Insert bind sql: ${sql}`);
32
32
  return sql;
33
33
  }
34
- function insertStable(values, tags, stable, table = 'empty') {
35
- let childTable = table == 'empty' ? stable + '_s_01' : table;
34
+ function insertStable(values, tags, stable, table = "empty") {
35
+ let childTable = table == "empty" ? stable + "_s_01" : table;
36
36
  let sql = `insert into ${childTable} using ${stable} tags (`;
37
37
  tags.forEach((tag) => {
38
- if ((typeof tag) == 'string') {
39
- if (tag == 'NULL') {
40
- sql += tag + ',';
38
+ if (typeof tag == "string") {
39
+ if (tag == "NULL") {
40
+ sql += tag + ",";
41
41
  }
42
42
  else {
43
43
  sql += `\'${tag}\',`;
@@ -45,36 +45,36 @@ function insertStable(values, tags, stable, table = 'empty') {
45
45
  }
46
46
  else {
47
47
  sql += tag;
48
- sql += ',';
48
+ sql += ",";
49
49
  }
50
50
  });
51
51
  sql = sql.slice(0, sql.length - 1);
52
- sql += ')';
53
- sql += 'values';
54
- values.forEach(value => {
55
- sql += '(';
56
- value.forEach(v => {
57
- if ((typeof v) == 'string') {
52
+ sql += ")";
53
+ sql += "values";
54
+ values.forEach((value) => {
55
+ sql += "(";
56
+ value.forEach((v) => {
57
+ if (typeof v == "string") {
58
58
  sql += `\'${v}\',`;
59
59
  }
60
60
  else {
61
61
  sql += v;
62
- sql += ',';
62
+ sql += ",";
63
63
  }
64
64
  });
65
65
  sql = sql.slice(0, sql.length - 1);
66
- sql += ')';
66
+ sql += ")";
67
67
  });
68
68
  return sql;
69
69
  }
70
70
  function insertNTable(values, table) {
71
71
  let sql = `insert into ${table} values `;
72
- values.forEach(value => {
73
- sql += '(';
74
- value.forEach(v => {
75
- if ((typeof v) == 'string') {
76
- if (v == 'NULL') {
77
- sql += v + ',';
72
+ values.forEach((value) => {
73
+ sql += "(";
74
+ value.forEach((v) => {
75
+ if (typeof v == "string") {
76
+ if (v == "NULL") {
77
+ sql += v + ",";
78
78
  }
79
79
  else {
80
80
  sql += `\'${v}\',`;
@@ -82,193 +82,193 @@ function insertNTable(values, table) {
82
82
  }
83
83
  else {
84
84
  sql += v;
85
- sql += ',';
85
+ sql += ",";
86
86
  }
87
87
  });
88
88
  sql = sql.slice(0, sql.length - 1);
89
- sql += ')';
89
+ sql += ")";
90
90
  });
91
91
  return sql;
92
92
  }
93
93
  exports.tableMeta = [
94
94
  {
95
- name: 'ts',
96
- type: 'TIMESTAMP',
97
- length: 8
95
+ name: "ts",
96
+ type: "TIMESTAMP",
97
+ length: 8,
98
98
  },
99
99
  {
100
- name: 'i1',
101
- type: 'TINYINT',
102
- length: 1
100
+ name: "i1",
101
+ type: "TINYINT",
102
+ length: 1,
103
103
  },
104
104
  {
105
- name: 'i2',
106
- type: 'SMALLINT',
107
- length: 2
105
+ name: "i2",
106
+ type: "SMALLINT",
107
+ length: 2,
108
108
  },
109
109
  {
110
- name: 'i4',
111
- type: 'INT',
112
- length: 4
110
+ name: "i4",
111
+ type: "INT",
112
+ length: 4,
113
113
  },
114
114
  {
115
- name: 'i8',
116
- type: 'BIGINT',
117
- length: 8
115
+ name: "i8",
116
+ type: "BIGINT",
117
+ length: 8,
118
118
  },
119
119
  {
120
- name: 'u1',
121
- type: 'TINYINT UNSIGNED',
122
- length: 1
120
+ name: "u1",
121
+ type: "TINYINT UNSIGNED",
122
+ length: 1,
123
123
  },
124
124
  {
125
- name: 'u2',
126
- type: 'SMALLINT UNSIGNED',
127
- length: 2
125
+ name: "u2",
126
+ type: "SMALLINT UNSIGNED",
127
+ length: 2,
128
128
  },
129
129
  {
130
- name: 'u4',
131
- type: 'INT UNSIGNED',
132
- length: 4
130
+ name: "u4",
131
+ type: "INT UNSIGNED",
132
+ length: 4,
133
133
  },
134
134
  {
135
- name: 'u8',
136
- type: 'BIGINT UNSIGNED',
137
- length: 8
135
+ name: "u8",
136
+ type: "BIGINT UNSIGNED",
137
+ length: 8,
138
138
  },
139
139
  {
140
- name: 'f4',
141
- type: 'FLOAT',
142
- length: 4
140
+ name: "f4",
141
+ type: "FLOAT",
142
+ length: 4,
143
143
  },
144
144
  {
145
- name: 'd8',
146
- type: 'DOUBLE',
147
- length: 8
145
+ name: "d8",
146
+ type: "DOUBLE",
147
+ length: 8,
148
148
  },
149
149
  {
150
- name: 'bnr',
151
- type: 'VARCHAR',
152
- length: 200
150
+ name: "bnr",
151
+ type: "VARCHAR",
152
+ length: 200,
153
153
  },
154
154
  {
155
- name: 'nchr',
156
- type: 'NCHAR',
157
- length: 200
155
+ name: "nchr",
156
+ type: "NCHAR",
157
+ length: 200,
158
158
  },
159
159
  {
160
- name: 'b',
161
- type: 'BOOL',
162
- length: 1
160
+ name: "b",
161
+ type: "BOOL",
162
+ length: 1,
163
163
  },
164
164
  {
165
- name: 'nilcol',
166
- type: 'INT',
167
- length: 4
165
+ name: "nilcol",
166
+ type: "INT",
167
+ length: 4,
168
168
  },
169
169
  {
170
- name: 'geo',
171
- type: 'GEOMETRY',
172
- length: 512
170
+ name: "geo",
171
+ type: "GEOMETRY",
172
+ length: 512,
173
173
  },
174
174
  {
175
- name: 'vbinary',
176
- type: 'VARBINARY',
177
- length: 32
175
+ name: "vbinary",
176
+ type: "VARBINARY",
177
+ length: 32,
178
178
  },
179
179
  ];
180
180
  exports.jsonMeta = [
181
181
  {
182
- name: 'json_tag',
183
- type: 'JSON',
184
- length: 4095
182
+ name: "json_tag",
183
+ type: "JSON",
184
+ length: 4095,
185
185
  },
186
186
  ];
187
187
  exports.tagMeta = [
188
188
  {
189
- name: 'tb',
190
- type: 'BOOL',
191
- length: 1
189
+ name: "tb",
190
+ type: "BOOL",
191
+ length: 1,
192
192
  },
193
193
  {
194
- name: 'ti1',
195
- type: 'TINYINT',
196
- length: 1
194
+ name: "ti1",
195
+ type: "TINYINT",
196
+ length: 1,
197
197
  },
198
198
  {
199
- name: 'ti2',
200
- type: 'SMALLINT',
201
- length: 2
199
+ name: "ti2",
200
+ type: "SMALLINT",
201
+ length: 2,
202
202
  },
203
203
  {
204
- name: 'ti4',
205
- type: 'INT',
206
- length: 4
204
+ name: "ti4",
205
+ type: "INT",
206
+ length: 4,
207
207
  },
208
208
  {
209
- name: 'ti8',
210
- type: 'BIGINT',
211
- length: 8
209
+ name: "ti8",
210
+ type: "BIGINT",
211
+ length: 8,
212
212
  },
213
213
  {
214
- name: 'tu1',
215
- type: 'TINYINT UNSIGNED',
216
- length: 1
214
+ name: "tu1",
215
+ type: "TINYINT UNSIGNED",
216
+ length: 1,
217
217
  },
218
218
  {
219
- name: 'tu2',
220
- type: 'SMALLINT UNSIGNED',
221
- length: 2
219
+ name: "tu2",
220
+ type: "SMALLINT UNSIGNED",
221
+ length: 2,
222
222
  },
223
223
  {
224
- name: 'tu4',
225
- type: 'INT UNSIGNED',
226
- length: 4
224
+ name: "tu4",
225
+ type: "INT UNSIGNED",
226
+ length: 4,
227
227
  },
228
228
  {
229
- name: 'tu8',
230
- type: 'BIGINT UNSIGNED',
231
- length: 8
229
+ name: "tu8",
230
+ type: "BIGINT UNSIGNED",
231
+ length: 8,
232
232
  },
233
233
  {
234
- name: 'tf4',
235
- type: 'FLOAT',
236
- length: 4
234
+ name: "tf4",
235
+ type: "FLOAT",
236
+ length: 4,
237
237
  },
238
238
  {
239
- name: 'td8',
240
- type: 'DOUBLE',
241
- length: 8
239
+ name: "td8",
240
+ type: "DOUBLE",
241
+ length: 8,
242
242
  },
243
243
  {
244
- name: 'tbnr',
245
- type: 'VARCHAR',
246
- length: 200
244
+ name: "tbnr",
245
+ type: "VARCHAR",
246
+ length: 200,
247
247
  },
248
248
  {
249
- name: 'tnchr',
250
- type: 'NCHAR',
251
- length: 200
249
+ name: "tnchr",
250
+ type: "NCHAR",
251
+ length: 200,
252
252
  },
253
253
  ];
254
254
  function createBaseSTable(stable) {
255
- return `create table if not exists ${stable}( ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int, g1 geometry(512), c4 varbinary(100))` +
256
- 'tags( tb bool,ti1 tinyint,ti2 smallint,ti4 int,ti8 bigint,tu1 tinyint unsigned,tu2 smallint unsigned,tu4 int unsigned,tu8 bigint unsigned,tf4 float,td8 double,tbnr binary(200),tnchr nchar(200));';
255
+ return (`create table if not exists ${stable}( ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int, g1 geometry(512), c4 varbinary(100))` +
256
+ "tags( tb bool,ti1 tinyint,ti2 smallint,ti4 int,ti8 bigint,tu1 tinyint unsigned,tu2 smallint unsigned,tu4 int unsigned,tu8 bigint unsigned,tf4 float,td8 double,tbnr binary(200),tnchr nchar(200));");
257
257
  }
258
258
  function createBaseSTableJSON(stable) {
259
- return `create table if not exists ${stable}(ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int)` +
260
- 'tags(json_tag json);';
259
+ return (`create table if not exists ${stable}(ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int)` +
260
+ "tags(json_tag json);");
261
261
  }
262
262
  function createBaseTable(table) {
263
263
  return `create table if not exists ${table}(ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int)`;
264
264
  }
265
265
  function createSTable(stable) {
266
- return `create table if not exists ${stable}( ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int, geo geometry(512), vbinary varbinary(32))` +
267
- 'tags( tb bool,ti1 tinyint,ti2 smallint,ti4 int,ti8 bigint,tu1 tinyint unsigned,tu2 smallint unsigned,tu4 int unsigned,tu8 bigint unsigned,tf4 float,td8 double,tbnr binary(200),tnchr nchar(200));';
266
+ return (`create table if not exists ${stable}( ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int, geo geometry(512), vbinary varbinary(32))` +
267
+ "tags( tb bool,ti1 tinyint,ti2 smallint,ti4 int,ti8 bigint,tu1 tinyint unsigned,tu2 smallint unsigned,tu4 int unsigned,tu8 bigint unsigned,tf4 float,td8 double,tbnr binary(200),tnchr nchar(200));");
268
268
  }
269
269
  function createSTableJSON(stable) {
270
- return `create table if not exists ${stable}(ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int, geo geometry(512), vbinary varbinary(32))` +
271
- 'tags(json_tag json);';
270
+ return (`create table if not exists ${stable}(ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int, geo geometry(512), vbinary varbinary(32))` +
271
+ "tags(json_tag json);");
272
272
  }
273
273
  function createTable(table) {
274
274
  return `create table if not exists ${table}(ts timestamp,i1 tinyint,i2 smallint,i4 int,i8 bigint,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,f4 float,d8 double,bnr binary(200),nchr nchar(200),b bool,nilcol int, geo geometry(512), vbinary varbinary(32))`;
@@ -289,7 +289,7 @@ function hexToBytes(hex) {
289
289
  }
290
290
  return a.buffer;
291
291
  }
292
- // export function createStmtData(varbinary:string = "ab",
292
+ // export function createStmtData(varbinary:string = "ab",
293
293
  // geoHex:string = "0101000020E6100000000000000000F03F0000000000000040"):Array<Array<any>> {
294
294
  // let multi:any[][] = [
295
295
  // [1709183268567, 1709183268568, 1709183268569],
@@ -319,5 +319,5 @@ function compareUint8Arrays(arr1, arr2) {
319
319
  return true;
320
320
  }
321
321
  function Sleep(ms) {
322
- return new Promise(resolve => setTimeout(resolve, ms));
322
+ return new Promise((resolve) => setTimeout(resolve, ms));
323
323
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tdengine/websocket",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "The websocket Node.js connector for TDengine. TDengine versions 3.3.2.0 and above are recommended to use this connector.",
5
5
  "source": "index.ts",
6
6
  "main": "lib/index.js",
package/readme.md CHANGED
@@ -14,6 +14,7 @@
14
14
  [![StackOverflow](https://img.shields.io/badge/Ask_StackOverflow--white?logo=stackoverflow&style=social&logoColor=orange)](https://stackoverflow.com/questions/tagged/tdengine)
15
15
 
16
16
  English | [简体中文](README-CN.md)
17
+
17
18
  <!-- omit in toc -->
18
19
  ## Table of Contents
19
20
  <!-- omit in toc -->
@@ -1,41 +0,0 @@
1
- export declare class ColumnInfo {
2
- data: ArrayBuffer;
3
- length: number;
4
- type: number;
5
- typeLen: number;
6
- constructor([length, data]: [number, ArrayBuffer], type: number, typeLen: number);
7
- }
8
- export declare class StmtBindParams {
9
- private readonly precisionLength;
10
- private readonly _params;
11
- private _dataTotalLen;
12
- private _rows;
13
- constructor(precision?: number);
14
- getDataRows(): number;
15
- getDataTotalLen(): number;
16
- getParams(): ColumnInfo[];
17
- setBoolean(params: any[]): void;
18
- setTinyInt(params: any[]): void;
19
- setUTinyInt(params: any[]): void;
20
- setSmallInt(params: any[]): void;
21
- setUSmallInt(params: any[]): void;
22
- setInt(params: any[]): void;
23
- setUInt(params: any[]): void;
24
- setBigint(params: any[]): void;
25
- setUBigint(params: any[]): void;
26
- setFloat(params: any[]): void;
27
- setDouble(params: any[]): void;
28
- setVarchar(params: any[]): void;
29
- setBinary(params: any[]): void;
30
- setNchar(params: any[]): void;
31
- setJson(params: any[]): void;
32
- setVarBinary(params: any[]): void;
33
- setGeometry(params: any[]): void;
34
- setTimestamp(params: any[]): void;
35
- private encodeDigitColumns;
36
- private encodeVarLengthColumn;
37
- private getBinaryColumnArrayBuffer;
38
- private encodeNcharColumn;
39
- private countBigintDigits;
40
- }
41
- //# sourceMappingURL=wsParams.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wsParams.d.ts","sourceRoot":"","sources":["../../../src/stmt/wsParams.ts"],"names":[],"mappings":"AAKA,qBAAa,UAAU;IACnB,IAAI,EAAC,WAAW,CAAC;IACjB,MAAM,EAAC,MAAM,CAAC;IACd,IAAI,EAAC,MAAM,CAAC;IACZ,OAAO,EAAC,MAAM,CAAC;gBACH,CAAC,MAAM,EAAC,IAAI,CAAC,EAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,IAAI,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM;CAM/E;AAED,qBAAa,cAAc;IACvB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA+B;IAC/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,KAAK,CAAK;gBACN,SAAS,CAAC,EAAC,MAAM;IAQtB,WAAW,IAAI,MAAM;IAIrB,eAAe,IAAI,MAAM;IAIzB,SAAS,IAAI,UAAU,EAAE;IAIhC,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE;IASxB,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE;IAQxB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE;IAQzB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE;IASzB,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE;IAQ1B,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE;IAQpB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE;IAQrB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE;IAQvB,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE;IAQxB,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAQtB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE;IAQvB,UAAU,CAAC,MAAM,EAAE,GAAG,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