dolphindb 2.0.901 → 2.0.903

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
@@ -10,7 +10,8 @@ export declare enum DdbForm {
10
10
  dict = 5,
11
11
  table = 6,
12
12
  chart = 7,
13
- /** Node internal communication may be used, calling function execution script generally does not return this type */
13
+ /** 结点内部通信可能会使用,调用函数执行脚本一般不会返回这种类型
14
+ Node internal communication may be used, calling function execution script generally does not return this type */
14
15
  chunk = 8,
15
16
  /** sysobj */
16
17
  object = 9
@@ -96,15 +97,15 @@ export interface DdbDurationValue {
96
97
  data: number;
97
98
  }
98
99
  export interface DdbDecimal32Value {
99
- /** int32, data needs to be divided by 10^scale to get the original value */
100
+ /** int32, data 需要除以 10^scale 得到原值 data needs to be divided by 10^scale to get the original value */
100
101
  scale: number;
101
- /** int32, ddb null is js null */
102
+ /** int32, 空值为 null ddb null is js null */
102
103
  data: number | null;
103
104
  }
104
105
  export interface DdbDecimal64Value {
105
- /** int32, data needs to be divided by 10^scale to get the original value */
106
+ /** int32, data 需要除以 10^scale 得到原值 data needs to be divided by 10^scale to get the original value */
106
107
  scale: number;
107
- /** int32, ddb null is js null */
108
+ /** int64, 空值为 null empty value is null */
108
109
  data: bigint | null;
109
110
  }
110
111
  export interface DdbDecimal32VectorValue {
@@ -147,7 +148,7 @@ export declare enum DdbChartType {
147
148
  kline = 8
148
149
  }
149
150
  export interface DdbChartValue {
150
- /** original: chartType */
151
+ /** 原属性 chartType original: chartType */
151
152
  type: DdbChartType;
152
153
  stacking: boolean;
153
154
  /** 直方图 (Histogram), plotHist 函数返回的 chart 可能具有该属性
@@ -197,7 +198,7 @@ export declare const nulls: {
197
198
  readonly double: number;
198
199
  readonly bytes16: Uint8Array;
199
200
  };
200
- /** Can represent data types in all DolphinDB databases */
201
+ /** 可以表示所有 DolphinDB 数据库中的数据类型 Can represent data types in all DolphinDB databases */
201
202
  export declare class DdbObj<TValue extends DdbValue = DdbValue> {
202
203
  static dec: TextDecoder;
203
204
  static enc: TextEncoder;
@@ -229,7 +230,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
229
230
  rows?: number;
230
231
  /** 第 2 维 */
231
232
  cols?: number;
232
- /** The actual data. Different DdbForm, DdbType use different types in DdbValue to represent actual data */
233
+ /** 实际数据。不同的 DdbForm, DdbType 使用 DdbValue 中不同的类型来表示实际数据 The actual data. Different DdbForm, DdbType use different types in DdbValue to represent actual data */
233
234
  value: TValue;
234
235
  /** 原始二进制数据,仅在 parse_object 为 false 时通过 parse_message 生成的顶层对象有这个属性 */
235
236
  buffer?: Uint8Array;
@@ -257,10 +258,12 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
257
258
  /** 转换 js 数组为 DdbObj[] */
258
259
  static to_ddbobjs(values: any[]): DdbObj<DdbValue>[];
259
260
  to_rows<T extends Record<string, any> = Record<string, any>>(): T[];
260
- /** convert dict<string, any> to js object (Record<string, any>)
261
+ /** 将 dict<string, any> 自动转换为 js object (Record<string, any>) convert dict<string, any> to js object (Record<string, any>)
261
262
  - options?:
262
- - strip?: `false` Whether to directly extract and strip the value in DdbObj as the value of js object (discard the rest of the information in DdbObj, only keep the value)
263
- - deep?: `false` Whether to convert recursively
263
+ - strip?: `false` 是否将 DdbObj 中的 value 直接提取、剥离出来作为 js object 的 value (丢弃 DdbObj 中的其余信息,只保留 value)
264
+ Whether to directly extract and strip the value in DdbObj as the value of js object (discard the rest of the information in DdbObj, only keep the value)
265
+ - deep?: `false` 是否递归转换
266
+ Whether to convert recursively
264
267
  */
265
268
  to_dict<T extends Record<string, DdbObj> = Record<string, DdbObj>>(): T;
266
269
  to_dict<T extends Record<string, any> = Record<string, any>>(options: {
@@ -273,12 +276,12 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
273
276
  }
274
277
  export interface InspectOptions extends UtilInspectOptions {
275
278
  colors?: boolean;
276
- /** decimal places */
279
+ /** `null` decimal places 小数位数 */
277
280
  decimals?: number;
278
281
  }
279
- /** Formats a single element (value) as a string according to DdbType, null returns a 'null' string */
282
+ /** 根据 DdbType 格式化单个元素 (value) 为字符串,空值返回 'null' 字符串 Formats a single element (value) as a string according to DdbType, null returns a 'null' string */
280
283
  export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
281
- /** formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
284
+ /** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
282
285
  export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
283
286
  export declare class DdbVoid extends DdbObj<undefined> {
284
287
  constructor();
@@ -340,10 +343,9 @@ export declare class DdbSetDouble extends DdbObj<Float64Array> {
340
343
  export declare class DdbSetString extends DdbObj<string[]> {
341
344
  constructor(strings: string[] | Set<string>);
342
345
  }
343
- /** Constructs a DdbDict object, which supports two usages:
344
- - The incoming type is the keys of DdbObj<DdbVectorValue>, and the two parameters of values directly form the DdbDict of dict<keys.type, values.type>
345
- - Pass in js object (type is Record<string, boolean | string | DdbObj>), automatically converted to DdbDict of dict<string, any>
346
- */
346
+ /** 构造 DdbDict 对象,支持两种用法: Constructs a DdbDict object, which supports two usages:
347
+ - 传入类型是 DdbVectorObj 的 keys, values 两个参数直接组成 dict<keys.type, values.type> 的 DdbDict The incoming type is the keys of DdbObj<DdbVectorValue>, and the two parameters of values directly form the DdbDict of dict<keys.type, values.type>
348
+ - 传入 js object (类型是 Record<string, boolean | string | DdbObj>), 自动转换为 dict<string, any> 的 DdbDict Pass in js object (type is Record<string, boolean | string | DdbObj>), automatically converted to DdbDict of dict<string, any> */
347
349
  export declare class DdbDict extends DdbObj<DdbDictValue> {
348
350
  constructor(obj: Record<string, boolean | string | DdbObj>);
349
351
  constructor(keys: DdbVectorObj, values: DdbVectorObj);
@@ -367,15 +369,17 @@ export declare function timestamp2ms(timestamp: bigint | null): number | null;
367
369
  /** format timestamp (bigint) to string
368
370
  - timestamp: bigint value
369
371
  - format?:
370
- format string, default to `YYYY.MM.DD HH:mm:ss.SSS`
372
+ 格式串,默认是 `YYYY.MM.DD HH:mm:ss.SSS` format string, default to `YYYY.MM.DD HH:mm:ss.SSS`
371
373
  https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
372
374
  */
373
375
  export declare function timestamp2str(timestamp: bigint | null, format?: string): string;
374
376
  export declare function datehour2ms(datehour: number | null): number | null;
375
377
  export declare function datehour2str(datehour: number | null, format?: string): string;
376
378
  /** parse timestamp string to bigint value
377
- - str: timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
379
+ - str: str: timestamp string, 如果为空字符串或 'null' 会返回对应的空值 (nulls.int64)
380
+ timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
378
381
  - format?:
382
+ 对应传入字符串的格式串,默认是 `YYYY.MM.DD HH:mm:ss.SSS`
379
383
  The format string corresponding to the incoming string, the default is `YYYY.MM.DD HH:mm:ss.SSS`
380
384
  https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
381
385
  */
@@ -386,16 +390,17 @@ export declare function nanotimestamp2ns(nanotimestamp: bigint | null): bigint |
386
390
  /** format nanotimestamp value (bigint) to string
387
391
  - nanotimestamp: bigint value
388
392
  - format?:
389
- format string, default is `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
390
- Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
393
+ 格式串,默认是 `YYYY.MM.DD HH:mm:ss.SSSSSSSSS` format string, default is `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
394
+ 秒的格式为 ss (必须包含); 纳秒的格式为 SSSSSSSSS (必须包含) Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
391
395
  https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
392
396
  */
393
397
  export declare function nanotimestamp2str(nanotimestamp: bigint | null, format?: string): string;
394
398
  /** parse nano timestamp string to bigint value
395
- - str: nano timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
399
+ - str: nano timestamp string, 如果为空字符串或 'null' 会返回对应的空值 (nulls.int64)
400
+ nano timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
396
401
  - format?:
397
- The format string corresponding to the incoming string, the default is `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
398
- Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
402
+ 对应传入字符串的格式串,默认是 `YYYY.MM.DD HH:mm:ss.SSSSSSSSS` The format string corresponding to the incoming string, the default is `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
403
+ 秒的格式为 ss (必须包含); 纳秒的格式为 SSSSSSSSS (必须包含) Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
399
404
  https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
400
405
  */
401
406
  export declare function str2nanotimestamp(str: string, format?: string): bigint;
@@ -409,30 +414,32 @@ export interface StreamingParams {
409
414
  }
410
415
  export interface StreamingData extends StreamingParams {
411
416
  /**
412
- The time the server sent the message (nano seconds since epoch)
417
+ server 发送消息的时间 (nano seconds since epoch) The time the server sent the message (nano seconds since epoch)
413
418
  std::chrono::system_clock::now().time_since_epoch() / std::chrono::nanoseconds(1)
414
419
  */
415
420
  time: bigint;
416
421
  /** message id */
417
422
  id: bigint;
418
423
  colnames: string[];
419
- /** Subscription topic, which is the name of a subscription.
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 `/`
421
- */
424
+ /** 订阅主题,即一个订阅的名称。 Subscription topic, which is the name of a subscription.
425
+ 它是一个字符串,由订阅表所在节点的别名、流数据表名称和订阅任务名称(如果指定了 actionName)组合而成,使用 `/` 分隔
426
+ 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 `/` */
422
427
  topic: string;
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 */
428
+ /** 流数据,类型是 any vector, 其中的每一个元素对应被订阅表的一个列 (没有 name),列 (DdbObj<DdbVectorValue>) 中的内容是新增的数据值
429
+ 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 */
424
430
  data: DdbObj<DdbVectorObj[]>;
425
- /** Number of new streaming data rows */
431
+ /** 新增的流数据行数 Number of new streaming data rows */
426
432
  rows: number;
427
433
  window: {
428
- /** The establishment of the connection starts offset = 0, and gradually increases as the window moves */
434
+ /** 建立连接开始 offset = 0, 随着 window 的移动逐渐增加 The establishment of the connection starts offset = 0, and gradually increases as the window moves */
429
435
  offset: number;
430
- /** sum of segment.row in segments */
436
+ /** segments 中 segment.row 的总和 sum of segment.row in segments */
431
437
  rows: number;
432
- /** An array of data received each time */
438
+ /** 每次接收到的 data 组成的数组 An array of data received each time */
433
439
  segments: DdbObj<DdbVectorObj[]>[];
434
440
  };
435
- /** After successfully subscribed, if the subsequently pushed message is parsed incorrectly, the error will be set and the handler will be called. */
441
+ /** 成功订阅后,后续推送过来的 message 解析错误,则会设置 error 并调用 handler
442
+ After successfully subscribed, if the subsequently pushed message is parsed incorrectly, the error will be set and the handler will be called. */
436
443
  error?: Error;
437
444
  }
438
445
  export declare const winsize: 100000;
@@ -463,7 +470,7 @@ export declare class DDB {
463
470
  password: string;
464
471
  /** python session flag (2048) */
465
472
  python: boolean;
466
- /** Whether it is a streaming data connection, this field is always null for non-streaming data */
473
+ /** 是否为流数据连接,非流数据这个字段恒为 null Whether it is a streaming data connection, this field is always null for non-streaming data */
467
474
  streaming: StreamingData;
468
475
  print_message_buffer: boolean;
469
476
  print_object_buffer: boolean;
@@ -477,20 +484,20 @@ export declare class DDB {
477
484
  presult: Promise<any>;
478
485
  get connected(): boolean;
479
486
  /**
480
- Initialize an instance of DolphinDB Client using the WebSocket URL
481
- (without establishing an actual network connection)
487
+ 使用 WebSocket URL 初始化连接到 DolphinDB 的实例(不建立实际的网络连接)
488
+ Initialize an instance of DolphinDB Client using the WebSocket URL (without establishing an actual network connection)
482
489
  - url: DolphinDB WebSocket URL. e.g.:`ws://127.0.0.1:8848`
483
490
  - options?:
484
- - autologin?: Whether to log in automatically after establishing a connection, default `true`
485
- - username?: DolphinDB username, default `'admin'`
486
- - password?: DolphinDB password, default `'123456'`
487
- - python?: set python session flag, default `false`
488
- - streaming?: When this option is set, the WebSocket connection is only used for streaming data
491
+ - autologin?: 是否在建立连接后自动登录,默认 `true` Whether to log in automatically after establishing a connection, default `true`
492
+ - username?: DolphinDB 登录用户名,默认 `'admin'` DolphinDB username, default `'admin'`
493
+ - password?: DolphinDB 登录密码,默认 `'123456'` DolphinDB password, default `'123456'`
494
+ - python?: 设置 python session flag,默认 `false` set python session flag, default `false`
495
+ - streaming?: 设置该选项后,该 WebSocket 连接只用于流数据 When this option is set, the WebSocket connection is only used for streaming data
489
496
 
490
497
  @example
491
498
  let ddb = new DDB('ws://127.0.0.1:8848')
492
499
 
493
- // Encrypt with HTTPS
500
+ // 使用 HTTPS 加密 Encrypt with HTTPS
494
501
  let ddbsecure = new DDB('wss://dolphindb.com', {
495
502
  autologin: true,
496
503
  username: 'admin',
@@ -506,9 +513,9 @@ export declare class DDB {
506
513
  streaming?: StreamingParams;
507
514
  });
508
515
  private on_message;
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 */
516
+ /** 建立实际的 WebSocket 连接到 URL 对应的 DolphinDB Establish a actual websocket connection to the DolphindB corresponding to the URL
517
+ 是幂等的,调用后会确保已连接到数据库 (确保 websocket.readyState 为 open),否则报错 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
518
+ this.autologin 为 true 时自动登录 this.autologin automatically log in when it is true */
512
519
  connect(): Promise<void>;
513
520
  get_rpc_options({ urgent, secondary, async: _async, pickle, clear, api, compress, cancellable, priority, parallelism, root_id, limit, }?: {
514
521
  urgent?: boolean;
@@ -535,7 +542,7 @@ export declare class DDB {
535
542
  }): string;
536
543
  disconnect(): void;
537
544
  /** 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
545
+ 未连接到 DDB 时调用会自动连接,连接断开时调用会抛出 ConnectionError When the DDB is not connected, the call will be automatically connected. When the connection is disconnected, the call will throw the Connectionerror
539
546
  - type: API 类型: 'script' | 'function' | 'variable'
540
547
  - options:
541
548
  - urgent?: 决定 `行为标识` 那一行字符串的取值(只适用于 script 和 function)
@@ -554,11 +561,15 @@ export declare class DDB {
554
561
  parse_object?: boolean;
555
562
  }): Promise<T>;
556
563
  /** eval script through websocket (script command)
557
- - script?: Script to execute
558
- - options?: execution options
559
- - urgent?: Urgent flag to ensure that submitted scripts are processed by urgent workers to prevent being blocked by other jobs
560
- - listener?: Process messages during this rpc (DdbMessage)
561
- - parse_object?: Set parse_object during this rpc, and restore the original after the end.
564
+ - script?: 执行的脚本 Script to execute
565
+ - options?: 执行选项 execution options
566
+ - urgent?: 紧急 flag,确保提交的脚本使用 urgent worker 处理,防止被其它作业阻塞
567
+ Urgent flag to ensure that submitted scripts are processed by urgent workers to prevent being blocked by other jobs
568
+ - listener?: 处理本次 rpc 期间的消息 (DdbMessage)
569
+ Process messages during this rpc (DdbMessage)
570
+ - parse_object?: 在该次 rpc 期间设置 parse_object, 结束后恢复原有,为 false 时返回的 DdbObj 仅含有 buffer 和 le,
571
+ 不做解析,以便后续转发、序列化
572
+ Set parse_object during this rpc, and restore the original after the end.
562
573
  When it is false, the returned DdbObj only contains buffer and le without parsing,
563
574
  so as to facilitate subsequent forwarding and serialization
564
575
  */
@@ -568,16 +579,24 @@ export declare class DDB {
568
579
  parse_object?: boolean;
569
580
  }): Promise<T>;
570
581
  /** call function through websocket (function command)
571
- - func: function name
572
- - args?: `[ ]` Call parameters (the incoming native string and boolean will be automatically converted to DdbObj<string> and DdbObj<boolean>)
573
- - options?: call options
574
- - urgent?: Emergency flag. Use urgent worker execution to prevent being blocked by other jobs
575
- - node?: When the node alias is set, it is sent to the corresponding node in the cluster for execution (using the rpc method in DolphinDB)
576
- - nodes?: When setting multiple node aliases, send them to the corresponding multiple nodes in the cluster for execution (using the pnodeRun method in DolphinDB)
577
- - func_type?: It must be passed when setting the node parameter, the function type needs to be specified, and it is not passed in other cases
578
- - add_node_alias?: Select to pass when setting the nodes parameter, otherwise not pass
579
- - listener?: Process messages during this rpc (DdbMessage)
580
- - parse_object?: Set parse_object during this rpc, and restore the original after the end.
582
+ - func: 函数名 function name
583
+ - args?: `[ ]` 调用参数 (传入的原生 string 和 boolean 会被自动转换为 DdbObj<string> 和 DdbObj<boolean>) Call parameters (the incoming native string and boolean will be automatically converted to DdbObj<string> and DdbObj<boolean>)
584
+ - options?: 调用选项 call options
585
+ - urgent?: 紧急 flag。使用 urgent worker 执行,防止被其它作业阻塞
586
+ Emergency flag. Use urgent worker execution to prevent being blocked by other jobs
587
+ - node?: 设置结点 alias 时发送到集群中对应的结点执行 (使用 DolphinDB 中的 rpc 方法)
588
+ When the node alias is set, it is sent to the corresponding node in the cluster for execution (using the rpc method in DolphinDB)
589
+ - nodes?: 设置多个结点 alias 时发送到集群中对应的多个结点执行 (使用 DolphinDB 中的 pnodeRun 方法)
590
+ When setting multiple node aliases, send them to the corresponding multiple nodes in the cluster for execution (using the pnodeRun method in DolphinDB)
591
+ - func_type?: 设置 node 参数时必传,需指定函数类型,其它情况下不传
592
+ It must be passed when setting the node parameter, the function type needs to be specified, and it is not passed in other cases
593
+ - add_node_alias?: 设置 nodes 参数时选传,其它情况不传
594
+ Select to pass when setting the nodes parameter, otherwise not pass
595
+ - listener?: 处理本次 rpc 期间的消息 (DdbMessage)
596
+ Process messages during this rpc (DdbMessage)
597
+ - parse_object?: 在该次 rpc 期间设置 parse_object, 结束后恢复原有,为 false 时返回的 DdbObj 仅含有 buffer 和 le,
598
+ 不做解析,以便后续转发、序列化
599
+ Set parse_object during this rpc, and restore the original after the end.
581
600
  When it is false, the returned DdbObj only contains buffer and le without parsing,
582
601
  so as to facilitate subsequent forwarding and serialization
583
602
  */
@@ -592,18 +611,18 @@ export declare class DDB {
592
611
  }): Promise<T>;
593
612
  /** upload variable through websocket (variable command) */
594
613
  upload(
595
- /** Uploaded variables' name */
614
+ /** 上传的变量名 Uploaded variables' name */
596
615
  vars: string[],
597
- /** Uploaded variables' value */
616
+ /** 上传的变量值 Uploaded variables' value */
598
617
  args: (DdbObj | string | boolean)[], { listener, parse_object, }?: {
599
618
  listener?: DdbMessageListener;
600
619
  parse_object?: boolean;
601
620
  }): Promise<DdbObj<DdbValue>>;
602
- /** Cancel all console jobs corresponding to the current session id */
621
+ /** 取消当前 session id 对应的所有 console jobs Cancel all console jobs corresponding to the current session id */
603
622
  cancel(): Promise<void>;
604
623
  /** 解析服务端响应报文,返回去掉 header 的 data buf */
605
624
  parse_message(buf: Uint8Array, parse_object?: boolean): DdbMessage;
606
- /** Internal stream subscription method */
625
+ /** 内部的流订阅方法 Internal stream subscription method */
607
626
  subscribe(): Promise<StreamingData>;
608
627
  }
609
628
  export interface DdbMessageListener {