dolphindb 3.1.24 → 3.1.25

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/browser.d.ts CHANGED
@@ -184,7 +184,7 @@ export interface InspectOptions {
184
184
  export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
185
185
  /** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
186
186
  export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
187
- export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | string[] | DdbExtObjValue | DdbTensorValue | Uint8Array<ArrayBufferLike> | DdbDecimal128VectorValue | BigInt128Array | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | IotVectorItemValue | DdbArrayVectorValue | DdbDurationVectorValue | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | DdbMatrixValue | DdbChartValue;
187
+ export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | string[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | DdbExtObjValue | DdbTensorValue | Uint8Array<ArrayBufferLike> | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | IotVectorItemValue | DdbArrayVectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue;
188
188
  /** 转换一个向量到 js 原生数组 */
189
189
  export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
190
190
  /** 构造 void 类型,默认为 `DdbVoidType.undefined` */
@@ -425,7 +425,6 @@ export declare class DDB {
425
425
  print_object_buffer: boolean;
426
426
  print_message: boolean;
427
427
  parse_object: boolean;
428
- heartbeat_aborter?: AbortController;
429
428
  /** 在 websocket 收到的第一个 error 时,
430
429
  在 connect_websocket 的 on_error 回调中构造 DdbConnectionError 并保存到 DDB 对象上,
431
430
  这个 error 的错误信息最准确 */
package/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { empty } from 'xshell/prototype.browser.js';
2
2
  import { blue, cyan, green, grey, magenta } from 'xshell/chalk.browser.js';
3
- import { concat, assert, Lock, genid, seq, zip_object, decode, delay, check } from 'xshell/utils.browser.js';
3
+ import { concat, assert, Lock, genid, seq, zip_object, decode, check } from 'xshell/utils.browser.js';
4
4
  import { connect_websocket } from 'xshell/net.browser.js';
5
5
  import { t } from "./i18n/index.js";
6
6
  import { ddb_tensor_bytes, DdbChartType, DdbDurationUnit, DdbForm, generate_array_type, DdbFunctionType, DdbType, DdbVoidType, dictables, function_definition_patterns, get_big_int_128, get_time_ddbobj, get_duration_unit, get_type_name, int1282str, ipaddr2str, is_decimal_null_value, is_decimal_type, time_formatters, number_nulls, nulls, set_big_int_128, uuid2str, get_times_ddbobj, funcdefs, get_number_formatter } from "./common.js";
@@ -2447,7 +2447,6 @@ export class DDB {
2447
2447
  print_object_buffer = false;
2448
2448
  print_message = true;
2449
2449
  parse_object = true;
2450
- heartbeat_aborter;
2451
2450
  /** 在 websocket 收到的第一个 error 时,
2452
2451
  在 connect_websocket 的 on_error 回调中构造 DdbConnectionError 并保存到 DDB 对象上,
2453
2452
  这个 error 的错误信息最准确 */
@@ -2562,11 +2561,7 @@ export class DDB {
2562
2561
  },
2563
2562
  on_error: error => {
2564
2563
  this.error ??= new DdbConnectionError(this.url, error);
2565
- this.heartbeat_aborter?.abort();
2566
2564
  this.on_error();
2567
- },
2568
- on_close: () => {
2569
- this.heartbeat_aborter?.abort();
2570
2565
  }
2571
2566
  });
2572
2567
  }
@@ -2580,30 +2575,6 @@ export class DDB {
2580
2575
  await this.rpc('connect', { skip_connection_check: true });
2581
2576
  if (this.streaming)
2582
2577
  await this.subscribe();
2583
- else
2584
- // 定时执行一次空脚本作为心跳检查,避免因为 nat 超时导致 tcp 连接断开
2585
- (async () => {
2586
- this.heartbeat_aborter = new AbortController();
2587
- while (true) {
2588
- // 连接主动关闭时从循环退出防止影响 node.js 退出
2589
- try {
2590
- await delay(1000 * 60 * 4.5, { signal: this.heartbeat_aborter.signal });
2591
- }
2592
- catch {
2593
- break;
2594
- }
2595
- if (this.connected)
2596
- try {
2597
- await this.eval('');
2598
- }
2599
- catch (error) {
2600
- console.log(t('{{time}} 心跳检测失败,连接已断开', { time: new Date().to_formal_str() }), error);
2601
- break;
2602
- }
2603
- else
2604
- break;
2605
- }
2606
- })();
2607
2578
  resolve();
2608
2579
  }
2609
2580
  catch (error) {
@@ -2649,7 +2620,6 @@ export class DDB {
2649
2620
  return options.join('_');
2650
2621
  }
2651
2622
  disconnect() {
2652
- this.heartbeat_aborter?.abort();
2653
2623
  const { resource } = this.lwebsocket;
2654
2624
  if (resource) {
2655
2625
  const { readyState } = resource;