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/index.d.ts CHANGED
@@ -538,8 +538,13 @@ export declare function int1282str(buffer: Uint8Array, le?: boolean): string;
538
538
  export interface StreamingParams {
539
539
  table: string;
540
540
  action?: string;
541
+ /** offset 是订阅任务开始后的第一条消息所在的位置。消息是流数据表中的行。
542
+ 如果未指定,或设为-1,订阅将会从流数据表的当前行开始。
543
+ 如果 offset = -2,系统会获取持久化到磁盘上的 offset,并从该位置开始订阅。注意:须同时设置 persistOffset = true,offset = -2 才会生效;否则 offset 会变为 -1。
544
+ offset 与流数据表创建时的第一行对应。如果某些行因为内存限制被删除,在决定订阅开始的位置时,这些行仍然考虑在内。 */
545
+ offset?: number;
541
546
  filters?: {
542
- /** 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 */
547
+ /** 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 */
543
548
  column?: DdbObj;
544
549
  /** 过滤条件的 DolphinDB 表达式 https://dolphindb1.atlassian.net/wiki/spaces/dev/pages/760840447/WebSocketConsole */
545
550
  expression?: string;
@@ -579,6 +584,8 @@ export interface DdbEvalOptions {
579
584
  listener?: DdbMessageListener;
580
585
  parse_object?: boolean;
581
586
  }
587
+ export interface DdbExecuteOptions extends DdbEvalOptions, ConvertOptions {
588
+ }
582
589
  type DdbRpcType = 'script' | 'function' | 'variable' | 'connect';
583
590
  export interface DdbRpcOptions extends DdbEvalOptions {
584
591
  script?: string;
@@ -626,6 +633,8 @@ export interface DdbCallOptions extends DdbEvalOptions {
626
633
  skip_connection_check?: boolean;
627
634
  on_more_messages?: DdbRpcOptions['on_more_messages'];
628
635
  }
636
+ export interface DdbInvokeOptions extends DdbCallOptions, ConvertOptions {
637
+ }
629
638
  export declare class DDB {
630
639
  /** 当前的 session id (http 或 tcp) */
631
640
  sid: string;
@@ -803,13 +812,13 @@ export declare class DDB {
803
812
  - func_type?: 设置 node 参数且参数数组为空时必传,需指定函数类型,其它情况下不传
804
813
  - add_node_alias?: 设置 nodes 参数时选传,其它情况不传
805
814
  - listener?: 处理本次 rpc 期间的消息 (DdbMessage) */
806
- invoke<TResult = any>(func: string, args?: any[], options?: DdbCallOptions): Promise<TResult>;
815
+ invoke<TResult = any>(func: string, args?: any[], options?: DdbInvokeOptions): Promise<TResult>;
807
816
  /** 执行 dolphindb 脚本,返回 js 原生对象或值(调用 DdbObj.data() 后的结果)
808
817
  - script?: 执行的脚本
809
818
  - options?: 执行选项
810
819
  - urgent?: 紧急 flag,确保提交的脚本使用 urgent worker 处理,防止被其它作业阻塞
811
820
  - listener?: 处理本次 rpc 期间的消息 (DdbMessage) */
812
- execute<TResult = any>(script: string, options?: DdbEvalOptions): Promise<TResult>;
821
+ execute<TResult = any>(script: string, options?: DdbExecuteOptions): Promise<TResult>;
813
822
  /** upload variable through websocket (variable command) */
814
823
  upload(
815
824
  /** 上传的变量名 Uploaded variables' name */
package/index.js CHANGED
@@ -3199,7 +3199,7 @@ export class DDB {
3199
3199
  const result = simple
3200
3200
  ? await this.call(func, args, options)
3201
3201
  : await this.call('invoke', [func, JSON.stringify(args)], options);
3202
- return result.data();
3202
+ return result.data(options);
3203
3203
  }
3204
3204
  /** 执行 dolphindb 脚本,返回 js 原生对象或值(调用 DdbObj.data() 后的结果)
3205
3205
  - script?: 执行的脚本
@@ -3208,7 +3208,7 @@ export class DDB {
3208
3208
  - listener?: 处理本次 rpc 期间的消息 (DdbMessage) */
3209
3209
  async execute(script, options) {
3210
3210
  return (await this.eval(script, options))
3211
- .data();
3211
+ .data(options);
3212
3212
  }
3213
3213
  /** upload variable through websocket (variable command) */
3214
3214
  async upload(
@@ -3308,10 +3308,10 @@ export class DDB {
3308
3308
  new DdbInt(0),
3309
3309
  this.streaming.table,
3310
3310
  (this.streaming.action ||= `api_js_${new Date().getTime()}`),
3311
- ...this.streaming?.filters?.column ? [
3312
- new DdbVoid(), // offset
3313
- this.streaming.filters.column // filter
3314
- ] : []
3311
+ (this.streaming.offset === undefined || this.streaming.offset === null)
3312
+ ? new DdbVoid()
3313
+ : new DdbInt(this.streaming.offset), // offset
3314
+ this.streaming.filters?.column || new DdbVoid(), // filter
3315
3315
  ], {
3316
3316
  skip_connection_check: true,
3317
3317
  // 先准备好收到 websocket message 的 callback