dolphindb 3.0.113 → 3.0.115

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
@@ -549,8 +549,13 @@ export declare function int1282str(buffer: Uint8Array, le?: boolean): string;
549
549
  export interface StreamingParams {
550
550
  table: string;
551
551
  action?: string;
552
+ /** offset 是订阅任务开始后的第一条消息所在的位置。消息是流数据表中的行。
553
+ 如果未指定,或设为-1,订阅将会从流数据表的当前行开始。
554
+ 如果 offset = -2,系统会获取持久化到磁盘上的 offset,并从该位置开始订阅。注意:须同时设置 persistOffset = true,offset = -2 才会生效;否则 offset 会变为 -1。
555
+ offset 与流数据表创建时的第一行对应。如果某些行因为内存限制被删除,在决定订阅开始的位置时,这些行仍然考虑在内。 */
556
+ offset?: number;
552
557
  filters?: {
553
- /** https://docs.dolphindb.cn/zh/help/FunctionsandCommands/FunctionReferences/s/subscribeTable.html#:~:text=%E8%BF%9E%E6%8E%A5%E6%96%B0%E7%9A%84%20leader%E3%80%82-,filter%20%E5%8F%82%E6%95%B0%E9%9C%80%E8%A6%81%E9%85%8D%E5%90%88,-setStreamTableFilterColumn%20%E5%87%BD%E6%95%B0%E4%B8%80%E8%B5%B7 */
558
+ /** https://test.dolphindb.cn/zh/funcs/s/subscribeTable.html#:~:text=filter%20%E5%8F%82%E6%95%B0%E9%9C%80%E8%A6%81%E9%85%8D%E5%90%88%20setStreamTableFilterColumn%20%E5%87%BD%E6%95%B0%E4%B8%80%E8%B5%B7%E4%BD%BF%E7%94%A8 */
554
559
  column?: DdbObj;
555
560
  /** 过滤条件的 DolphinDB 表达式 https://dolphindb1.atlassian.net/wiki/spaces/dev/pages/760840447/WebSocketConsole */
556
561
  expression?: string;
@@ -590,6 +595,8 @@ export interface DdbEvalOptions {
590
595
  listener?: DdbMessageListener;
591
596
  parse_object?: boolean;
592
597
  }
598
+ export interface DdbExecuteOptions extends DdbEvalOptions, ConvertOptions {
599
+ }
593
600
  type DdbRpcType = 'script' | 'function' | 'variable' | 'connect';
594
601
  export interface DdbRpcOptions extends DdbEvalOptions {
595
602
  script?: string;
@@ -637,6 +644,8 @@ export interface DdbCallOptions extends DdbEvalOptions {
637
644
  skip_connection_check?: boolean;
638
645
  on_more_messages?: DdbRpcOptions['on_more_messages'];
639
646
  }
647
+ export interface DdbInvokeOptions extends DdbCallOptions, ConvertOptions {
648
+ }
640
649
  export declare class DDB {
641
650
  /** 当前的 session id (http 或 tcp) */
642
651
  sid: string;
@@ -813,13 +822,13 @@ export declare class DDB {
813
822
  - func_type?: 设置 node 参数且参数数组为空时必传,需指定函数类型,其它情况下不传
814
823
  - add_node_alias?: 设置 nodes 参数时选传,其它情况不传
815
824
  - listener?: 处理本次 rpc 期间的消息 (DdbMessage) */
816
- invoke<TResult = any>(func: string, args?: any[], options?: DdbCallOptions): Promise<TResult>;
825
+ invoke<TResult = any>(func: string, args?: any[], options?: DdbInvokeOptions): Promise<TResult>;
817
826
  /** 执行 dolphindb 脚本,返回 js 原生对象或值(调用 DdbObj.data() 后的结果)
818
827
  - script?: 执行的脚本
819
828
  - options?: 执行选项
820
829
  - urgent?: 紧急 flag,确保提交的脚本使用 urgent worker 处理,防止被其它作业阻塞
821
830
  - listener?: 处理本次 rpc 期间的消息 (DdbMessage) */
822
- execute<TResult = any>(script: string, options?: DdbEvalOptions): Promise<TResult>;
831
+ execute<TResult = any>(script: string, options?: DdbExecuteOptions): Promise<TResult>;
823
832
  /** upload variable through websocket (variable command) */
824
833
  upload(
825
834
  /** 上传的变量名 Uploaded variables' name */
package/browser.js CHANGED
@@ -3221,7 +3221,7 @@ export class DDB {
3221
3221
  const result = simple
3222
3222
  ? await this.call(func, args, options)
3223
3223
  : await this.call('invoke', [func, JSON.stringify(args)], options);
3224
- return result.data();
3224
+ return result.data(options);
3225
3225
  }
3226
3226
  /** 执行 dolphindb 脚本,返回 js 原生对象或值(调用 DdbObj.data() 后的结果)
3227
3227
  - script?: 执行的脚本
@@ -3230,7 +3230,7 @@ export class DDB {
3230
3230
  - listener?: 处理本次 rpc 期间的消息 (DdbMessage) */
3231
3231
  async execute(script, options) {
3232
3232
  return (await this.eval(script, options))
3233
- .data();
3233
+ .data(options);
3234
3234
  }
3235
3235
  /** upload variable through websocket (variable command) */
3236
3236
  async upload(
@@ -3330,10 +3330,10 @@ export class DDB {
3330
3330
  new DdbInt(0),
3331
3331
  this.streaming.table,
3332
3332
  (this.streaming.action ||= `api_js_${new Date().getTime()}`),
3333
- ...this.streaming?.filters?.column ? [
3334
- new DdbVoid(), // offset
3335
- this.streaming.filters.column // filter
3336
- ] : []
3333
+ (this.streaming.offset === undefined || this.streaming.offset === null)
3334
+ ? new DdbVoid()
3335
+ : new DdbInt(this.streaming.offset), // offset
3336
+ this.streaming.filters?.column || new DdbVoid(), // filter
3337
3337
  ], {
3338
3338
  skip_connection_check: true,
3339
3339
  // 先准备好收到 websocket message 的 callback