dolphindb 3.1.51 → 3.1.53

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
@@ -339,6 +339,7 @@ export interface DdbEvalOptions {
339
339
  listener?: DdbMessageListener;
340
340
  parse_object?: boolean;
341
341
  iife?: boolean;
342
+ ai?: boolean;
342
343
  }
343
344
  export interface DdbExecuteOptions extends DdbEvalOptions, ConvertOptions {
344
345
  }
@@ -540,8 +541,9 @@ export declare class DDB {
540
541
  Set parse_object during this rpc, and restore the original after the end.
541
542
  When it is false, the returned DdbObj only contains buffer and le without parsing,
542
543
  so as to facilitate subsequent forwarding and serialization
543
- - iife?: 使用 `def () { ... } ()` 包裹脚本,return 最后一行,避免变量泄漏 */
544
- eval<T extends DdbObj>(script: string, { urgent, listener, parse_object, iife, }?: DdbEvalOptions): Promise<T>;
544
+ - iife?: 使用 `def () { ... } ()` 包裹脚本,return 最后一行,避免变量泄漏
545
+ - ai?: ai 生成的且未经审核的脚本,底层用 aiscript 发给 server */
546
+ eval<T extends DdbObj>(script: string, { iife, ...options }?: DdbEvalOptions): Promise<T>;
545
547
  /** call function through websocket (function command)
546
548
  - func: 函数名 function name
547
549
  - args?: `[ ]` 调用参数 (传入的原生 string 和 boolean 会被自动转换为 DdbObj<string> 和 DdbObj<boolean>)
@@ -581,7 +583,8 @@ export declare class DDB {
581
583
  - script?: 执行的脚本
582
584
  - options?: 执行选项
583
585
  - urgent?: 紧急 flag,确保提交的脚本使用 urgent worker 处理,防止被其它作业阻塞
584
- - listener?: 处理本次 rpc 期间的消息 (DdbMessage) */
586
+ - listener?: 处理本次 rpc 期间的消息 (DdbMessage)
587
+ - ai?: ai 生成的且未经审核的脚本,底层用 aiscript 发给 server */
585
588
  execute<TResult = any>(script: string, options?: DdbExecuteOptions): Promise<TResult>;
586
589
  /** upload variable through websocket (variable command) */
587
590
  upload(
@@ -653,8 +656,8 @@ export declare class BigInt128Array {
653
656
  value: bigint;
654
657
  done: boolean;
655
658
  } | {
656
- value?: undefined;
657
659
  done: boolean;
660
+ value?: undefined;
658
661
  };
659
662
  };
660
663
  toString(): string;
package/browser.js CHANGED
@@ -2652,7 +2652,7 @@ export class DDB {
2652
2652
  let error = new DdbDatabaseError('', this.url, type, options, id);
2653
2653
  if (!options.skip_connection_check)
2654
2654
  await this.connect();
2655
- const { script, func, args: _args = [], vars = [], urgent: u, listener, on_more_messages, } = options;
2655
+ const { script, func, args: _args = [], vars = [], urgent: u, listener, on_more_messages, ai } = options;
2656
2656
  if (func === 'pnode_run')
2657
2657
  try {
2658
2658
  await (this.ppnode_run ??= this.eval(funcdefs.pnode_run[this.language], urgent));
@@ -2693,7 +2693,7 @@ export class DDB {
2693
2693
  if (this.verbose)
2694
2694
  console.log(script, rpc_id);
2695
2695
  assert(!script.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2696
- return 'script\n' +
2696
+ return (ai ? 'ai' : '') + 'script\n' +
2697
2697
  script;
2698
2698
  case 'variable':
2699
2699
  if (this.verbose)
@@ -2785,8 +2785,9 @@ export class DDB {
2785
2785
  Set parse_object during this rpc, and restore the original after the end.
2786
2786
  When it is false, the returned DdbObj only contains buffer and le without parsing,
2787
2787
  so as to facilitate subsequent forwarding and serialization
2788
- - iife?: 使用 `def () { ... } ()` 包裹脚本,return 最后一行,避免变量泄漏 */
2789
- async eval(script, { urgent, listener, parse_object, iife, } = {}) {
2788
+ - iife?: 使用 `def () { ... } ()` 包裹脚本,return 最后一行,避免变量泄漏
2789
+ - ai?: ai 生成的且未经审核的脚本,底层用 aiscript 发给 server */
2790
+ async eval(script, { iife, ...options } = {}) {
2790
2791
  if (iife) {
2791
2792
  const lines = script.split_lines();
2792
2793
  if (lines.length < 2)
@@ -2797,7 +2798,7 @@ export class DDB {
2797
2798
  ` return ${lines.last}\n` +
2798
2799
  '} ()\n';
2799
2800
  }
2800
- return this.rpc('script', { script, urgent, listener, parse_object });
2801
+ return this.rpc('script', { script, ...options });
2801
2802
  }
2802
2803
  /** call function through websocket (function command)
2803
2804
  - func: 函数名 function name
@@ -2917,7 +2918,8 @@ export class DDB {
2917
2918
  - script?: 执行的脚本
2918
2919
  - options?: 执行选项
2919
2920
  - urgent?: 紧急 flag,确保提交的脚本使用 urgent worker 处理,防止被其它作业阻塞
2920
- - listener?: 处理本次 rpc 期间的消息 (DdbMessage) */
2921
+ - listener?: 处理本次 rpc 期间的消息 (DdbMessage)
2922
+ - ai?: ai 生成的且未经审核的脚本,底层用 aiscript 发给 server */
2921
2923
  async execute(script, options) {
2922
2924
  return (await this.eval(script, options))
2923
2925
  .data(options);