dolphindb 3.1.14 → 3.1.15

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
@@ -174,7 +174,7 @@ export interface InspectOptions extends UtilInspectOptions {
174
174
  export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
175
175
  /** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
176
176
  export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
177
- export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | string[] | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | DdbExtObjValue | DdbTensorValue | Uint8Array<ArrayBufferLike> | IotVectorItemValue | DdbDurationVectorValue | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | DdbArrayVectorValue | DdbDecimal128VectorValue | DdbMatrixValue | DdbChartValue;
177
+ export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | Uint8Array<ArrayBufferLike> | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | string[] | IotVectorItemValue | DdbSymbolExtendedValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDurationVectorValue | DdbTensorValue | DdbExtObjValue | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | DdbArrayVectorValue | DdbDecimal128VectorValue | DdbMatrixValue | DdbChartValue;
178
178
  /** 转换一个向量到 js 原生数组 */
179
179
  export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
180
180
  /** 构造 void 类型,默认为 `DdbVoidType.undefined` */
package/index.js CHANGED
@@ -1715,7 +1715,7 @@ export function format(type, value, le, options = {}) {
1715
1715
  }
1716
1716
  /** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
1717
1717
  export function formati(obj, index, options = {}) {
1718
- assert(index < obj.rows, 'index < obj.rows');
1718
+ check(index < obj.rows, 'index 应该 < obj.rows');
1719
1719
  if (obj.type < 64 || obj.type >= 128) // 普通数组
1720
1720
  switch (obj.type) {
1721
1721
  case DdbType.symbol_extended: {
@@ -1749,6 +1749,8 @@ export function formati(obj, index, options = {}) {
1749
1749
  const str = (x < 0 ? '-' : '') + (scale ? `${s.slice(0, -scale) || '0'}.${s.slice(-scale)}` : s);
1750
1750
  return options.colors ? str.green : str;
1751
1751
  }
1752
+ case DdbType.any:
1753
+ return inspect(obj.value[index], options);
1752
1754
  default:
1753
1755
  return format(obj.type, obj.value[index], obj.le, options);
1754
1756
  }
@@ -2072,7 +2074,7 @@ export class DdbDate extends DdbObj {
2072
2074
  }
2073
2075
  export class DdbBlob extends DdbObj {
2074
2076
  constructor(value) {
2075
- assert(value, t('new DdbBlob 不能传空的 value'));
2077
+ check(value, t('new DdbBlob 不能传空的 value'));
2076
2078
  super({
2077
2079
  form: DdbForm.scalar,
2078
2080
  type: DdbType.blob,
@@ -2702,7 +2704,7 @@ export class DDB {
2702
2704
  console.log(func, args.map(arg => arg.data()), rpc_id);
2703
2705
  else
2704
2706
  console.log(`${func}()`, rpc_id);
2705
- assert(!func.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2707
+ check(!func.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2706
2708
  return 'function\n' +
2707
2709
  `${func}\n` +
2708
2710
  `${args.length}\n` +
@@ -2710,7 +2712,7 @@ export class DDB {
2710
2712
  case 'script':
2711
2713
  if (this.verbose)
2712
2714
  console.log(script, rpc_id);
2713
- assert(!script.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2715
+ check(!script.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2714
2716
  return 'script\n' +
2715
2717
  script;
2716
2718
  case 'variable':
@@ -2946,7 +2948,7 @@ export class DDB {
2946
2948
  vars,
2947
2949
  /** 上传的变量值 Uploaded variables' value */
2948
2950
  args, { listener, parse_object, } = {}) {
2949
- assert(args.length && args.length === vars.length, t('variable 指令参数不能为空且参数名不能为空,且数量应该匹配'));
2951
+ check(args.length && args.length === vars.length, t('variable 指令参数不能为空且参数名不能为空,且数量应该匹配'));
2950
2952
  return this.rpc('variable', { vars, args, listener, parse_object });
2951
2953
  }
2952
2954
  /** 取消当前 session id 对应的所有 console jobs Cancel all console jobs corresponding to the current session id */