dolphindb 2.0.900 → 2.0.902

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