dolphindb 2.0.800 → 2.0.900

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
@@ -126,12 +126,15 @@ export interface DdbArrayVectorBlock {
126
126
  lengths: Uint8Array | Uint16Array | Uint32Array;
127
127
  data: Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
128
128
  }
129
+ export type DdbArrayVectorValue = DdbArrayVectorBlock[] & /* decimal32, decimal64 会有这个属性 */ {
130
+ scale?: number;
131
+ };
129
132
  export interface DdbMatrixValue {
130
133
  rows: DdbVectorObj;
131
134
  cols: DdbVectorObj;
132
135
  data: DdbVectorValue;
133
136
  }
134
- export declare type DdbDictValue = [DdbVectorObj, DdbVectorObj];
137
+ export type DdbDictValue = [DdbVectorObj, DdbVectorObj];
135
138
  export declare enum DdbChartType {
136
139
  area = 0,
137
140
  bar = 1,
@@ -166,24 +169,24 @@ export interface DdbChartValue {
166
169
  };
167
170
  data: DdbMatrixObj;
168
171
  }
169
- export declare type DdbScalarValue = null | boolean | number | bigint | string | Uint8Array | // uuid, ipaddr, int128, blob
172
+ export type DdbScalarValue = null | boolean | number | bigint | string | Uint8Array | // uuid, ipaddr, int128, blob
170
173
  [
171
174
  number,
172
175
  number
173
176
  ] | // complex, point
174
177
  DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value;
175
- export declare type DdbVectorValue = Uint8Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | string[] | // string[]
178
+ export type DdbVectorValue = Uint8Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | string[] | // string[]
176
179
  Uint8Array[] | // blob
177
180
  DdbObj[] | // any
178
- DdbSymbolExtendedValue | DdbArrayVectorBlock[] | DdbDecimal32VectorValue | DdbDecimal64VectorValue;
179
- export declare type DdbValue = DdbScalarValue | DdbVectorValue | DdbMatrixValue | DdbDictValue | DdbChartValue;
180
- export declare type DdbVectorObj = DdbObj<DdbVectorValue>;
181
- export declare type DdbVectorAnyObj = DdbObj<DdbObj[]>;
182
- export declare type DdbVectorStringObj = DdbObj<string[]>;
183
- export declare type DdbTableObj = DdbObj<DdbVectorObj[]>;
184
- export declare type DdbDictObj = DdbObj<[DdbVectorObj, DdbVectorObj]>;
185
- export declare type DdbMatrixObj = DdbObj<DdbMatrixValue>;
186
- export declare type DdbChartObj = DdbObj<DdbChartValue>;
181
+ DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue;
182
+ export type DdbValue = DdbScalarValue | DdbVectorValue | DdbMatrixValue | DdbDictValue | DdbChartValue;
183
+ export type DdbVectorObj = DdbObj<DdbVectorValue>;
184
+ export type DdbVectorAnyObj = DdbObj<DdbObj[]>;
185
+ export type DdbVectorStringObj = DdbObj<string[]>;
186
+ export type DdbTableObj = DdbObj<DdbVectorObj[]>;
187
+ export type DdbDictObj = DdbObj<[DdbVectorObj, DdbVectorObj]>;
188
+ export type DdbMatrixObj = DdbObj<DdbMatrixValue>;
189
+ export type DdbChartObj = DdbObj<DdbChartValue>;
187
190
  export declare const nulls: {
188
191
  readonly int8: -128;
189
192
  readonly int16: -32768;
@@ -194,14 +197,6 @@ export declare const nulls: {
194
197
  readonly double: number;
195
198
  readonly bytes16: Uint8Array;
196
199
  };
197
- export declare const timezone_offset: number;
198
- export declare enum StreamingStatusCode {
199
- ok = 0,
200
- connection_existed = 1,
201
- not_leader = 2,
202
- other = 3,
203
- error = 4
204
- }
205
200
  /** Can represent data types in all DolphinDB databases */
206
201
  export declare class DdbObj<TValue extends DdbValue = DdbValue> {
207
202
  static dec: TextDecoder;
@@ -255,7 +250,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
255
250
  ];
256
251
  pack(): Uint8Array;
257
252
  static pack_vector_body(value: DdbVectorValue, type: DdbType, length: number): ArrayBufferView[];
258
- [inspect.custom](depth: number, options: InspectOptions, _inspect: any): string;
253
+ [inspect.custom](depth: number, _options: InspectOptions, _inspect: any): string;
259
254
  inspect_type(): string;
260
255
  /** 自动转换 js string, boolean 为 DdbObj */
261
256
  static to_ddbobj(value: DdbObj | string | boolean): DdbObj;
@@ -425,10 +420,10 @@ export interface StreamingData extends StreamingParams {
425
420
  It is a string consisting of the alias of the node where the subscription table is located, the stream data table name, and the subscription task name (if actionName is specified), separated by `/`
426
421
  */
427
422
  topic: string;
428
- /** The schema of the flow table, the type is table, there is no data in the column vector (rows === 0), only the column name and type */
429
- schema: DdbTableObj;
430
423
  /** Stream data, the type is any vector, each element of which corresponds to a column (without name) of the subscribed table, and the content in the column (DdbObj<DdbVectorValue>) is the new data value */
431
424
  data: DdbObj<DdbVectorObj[]>;
425
+ /** Number of new streaming data rows */
426
+ rows: number;
432
427
  window: {
433
428
  /** The establishment of the connection starts offset = 0, and gradually increases as the window moves */
434
429
  offset: number;
@@ -437,8 +432,14 @@ export interface StreamingData extends StreamingParams {
437
432
  /** An array of data received each time */
438
433
  segments: DdbObj<DdbVectorObj[]>[];
439
434
  };
435
+ /** After successfully subscribed, if the subsequently pushed message is parsed incorrectly, the error will be set and the handler will be called. */
436
+ error?: Error;
437
+ }
438
+ export declare const winsize: 100000;
439
+ export declare class ConnectionError extends Error {
440
+ ddb: DDB;
441
+ constructor(ddb: DDB);
440
442
  }
441
- export declare const winsize: 40;
442
443
  export declare class DDB {
443
444
  /** 当前的 session id (http 或 tcp) */
444
445
  sid: string;
@@ -505,23 +506,10 @@ export declare class DDB {
505
506
  streaming?: StreamingParams;
506
507
  });
507
508
  private on_message;
508
- /** Establish the actual WebSocket connection to the DolphinDB corresponding to the URL
509
- - options?:
510
- - url?: DolphinDB WebSocket URL. By default, the WebSocket URL passed in when the instance is initialized is used
511
- - autologin?: Whether to log in automatically after establishing a connection, default `true`
512
- - username?: DolphinDB username, default `'admin'`
513
- - password?: DolphinDB password, default `'123456'`
514
- - python?: set python session flag, default `false`
515
- - streaming?: When this option is set, the WebSocket connection is only used for streaming data
516
- */
517
- connect({ url, autologin, username, password, python, streaming }?: {
518
- url?: string;
519
- autologin?: boolean;
520
- username?: string;
521
- password?: string;
522
- python?: boolean;
523
- streaming?: StreamingParams;
524
- }): Promise<void>;
509
+ /** Establish a actual websocket connection to the DolphindB corresponding to the URL
510
+ It is a power, and after calling, it will ensure that it has been connected to the database (ensure that websocket.ReadyState is open), otherwise an error will be reported
511
+ this.autologin automatically log in when it is true */
512
+ connect(): Promise<void>;
525
513
  get_rpc_options({ urgent, secondary, async: _async, pickle, clear, api, compress, cancellable, priority, parallelism, root_id, limit, }?: {
526
514
  urgent?: boolean;
527
515
  /** API 提交的任务, secondary 必须为 false */
@@ -547,6 +535,7 @@ export declare class DDB {
547
535
  }): string;
548
536
  disconnect(): void;
549
537
  /** rpc through websocket (function/script/variable command)
538
+ When the DDB is not connected, the call will be automatically connected. When the connection is disconnected, the call will throw the Connectionerror
550
539
  - type: API 类型: 'script' | 'function' | 'variable'
551
540
  - options:
552
541
  - urgent?: 决定 `行为标识` 那一行字符串的取值(只适用于 script 和 function)
@@ -615,7 +604,7 @@ export declare class DDB {
615
604
  /** 解析服务端响应报文,返回去掉 header 的 data buf */
616
605
  parse_message(buf: Uint8Array, parse_object?: boolean): DdbMessage;
617
606
  /** Internal stream subscription method */
618
- subscribe(): Promise<DdbTableObj>;
607
+ subscribe(): Promise<StreamingData>;
619
608
  }
620
609
  export interface DdbMessageListener {
621
610
  (message: DdbMessage, _this: DDB): any;
@@ -632,4 +621,4 @@ export interface DdbErrorMessage {
632
621
  type: 'error';
633
622
  data: Error;
634
623
  }
635
- export declare type DdbMessage = DdbPrintMessage | DdbObjectMessage | DdbErrorMessage;
624
+ export type DdbMessage = DdbPrintMessage | DdbObjectMessage | DdbErrorMessage;