dolphindb 2.0.1008 → 2.0.1009

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import type { InspectOptions as UtilInspectOptions } from 'util';
3
- import { inspect, WebSocket, Lock, type WebSocketConnectionError } from 'xshell';
3
+ import { inspect, Lock, type WebSocket, type WebSocketConnectionError } from 'xshell';
4
4
  import { type DdbDecimal128Value, type DdbDecimal128VectorValue } from './data-types/decimal-128.js';
5
5
  import { BigInt128Array } from './shared/bigint-128-array.js';
6
6
  import { DdbChartType, DdbDurationUnit, DdbForm, DdbFunctionType, DdbType } from './shared/constants.js';
package/index.js CHANGED
@@ -4,7 +4,7 @@ import DayjsCustomParseFormat from 'dayjs/plugin/customParseFormat.js';
4
4
  dayjs.extend(DayjsCustomParseFormat);
5
5
  import ipaddrjs from 'ipaddr.js';
6
6
  const { fromByteArray: buf2ipaddr } = ipaddrjs;
7
- import { concat, assert, inspect, typed_array_to_buffer, connect_websocket, WebSocket, Lock, genid } from 'xshell';
7
+ import { concat, assert, inspect, typed_array_to_buffer, connect_websocket, Lock, genid, WebSocketOpen, WebSocketClosed, WebSocketClosing } from 'xshell';
8
8
  import { t } from './i18n/index.js';
9
9
  import { DdbDecimal128Serializor } from './data-types/decimal-128.js';
10
10
  import { BigInt128Array } from './shared/bigint-128-array.js';
@@ -2164,10 +2164,10 @@ export class DDB {
2164
2164
  /** 首次定义 pnode_run 的 promise,保证并发调用 rpc 时只定义一次 pnode_run */
2165
2165
  ppnode_run;
2166
2166
  get connected() {
2167
- return !this.error && this.lwebsocket.resource?.readyState === WebSocket.OPEN;
2167
+ return !this.error && this.lwebsocket.resource?.readyState === WebSocketOpen;
2168
2168
  }
2169
2169
  get errored() {
2170
- return Boolean(this.error || (this.lwebsocket.resource && this.lwebsocket.resource.readyState !== WebSocket.OPEN));
2170
+ return Boolean(this.error || (this.lwebsocket.resource && this.lwebsocket.resource.readyState !== WebSocketOpen));
2171
2171
  }
2172
2172
  /**
2173
2173
  使用 WebSocket URL 初始化连接到 DolphinDB 的实例(不建立实际的网络连接)
@@ -2312,7 +2312,7 @@ export class DDB {
2312
2312
  const { resource } = this.lwebsocket;
2313
2313
  if (resource) {
2314
2314
  const { readyState } = resource;
2315
- if (readyState !== WebSocket.CLOSED && readyState !== WebSocket.CLOSING)
2315
+ if (readyState !== WebSocketClosed && readyState !== WebSocketClosing)
2316
2316
  // 这里不获取 lock,直接关闭连接
2317
2317
  resource.close(1000);
2318
2318
  }