dolphindb 3.1.14 → 3.1.16

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
  }
@@ -1764,6 +1766,8 @@ export function formati(obj, index, options = {}) {
1764
1766
  // av
1765
1767
  const type_ = obj.type - 64;
1766
1768
  let offset = 0;
1769
+ // array vector 中禁用 grouping
1770
+ options = { ...options, grouping: false };
1767
1771
  const nullstr = inspect(null, options);
1768
1772
  for (const { lengths, data, rows } of obj.value) {
1769
1773
  let acc_len = 0;
@@ -2072,7 +2076,7 @@ export class DdbDate extends DdbObj {
2072
2076
  }
2073
2077
  export class DdbBlob extends DdbObj {
2074
2078
  constructor(value) {
2075
- assert(value, t('new DdbBlob 不能传空的 value'));
2079
+ check(value, t('new DdbBlob 不能传空的 value'));
2076
2080
  super({
2077
2081
  form: DdbForm.scalar,
2078
2082
  type: DdbType.blob,
@@ -2702,7 +2706,7 @@ export class DDB {
2702
2706
  console.log(func, args.map(arg => arg.data()), rpc_id);
2703
2707
  else
2704
2708
  console.log(`${func}()`, rpc_id);
2705
- assert(!func.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2709
+ check(!func.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2706
2710
  return 'function\n' +
2707
2711
  `${func}\n` +
2708
2712
  `${args.length}\n` +
@@ -2710,7 +2714,7 @@ export class DDB {
2710
2714
  case 'script':
2711
2715
  if (this.verbose)
2712
2716
  console.log(script, rpc_id);
2713
- assert(!script.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2717
+ check(!script.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2714
2718
  return 'script\n' +
2715
2719
  script;
2716
2720
  case 'variable':
@@ -2946,7 +2950,7 @@ export class DDB {
2946
2950
  vars,
2947
2951
  /** 上传的变量值 Uploaded variables' value */
2948
2952
  args, { listener, parse_object, } = {}) {
2949
- assert(args.length && args.length === vars.length, t('variable 指令参数不能为空且参数名不能为空,且数量应该匹配'));
2953
+ check(args.length && args.length === vars.length, t('variable 指令参数不能为空且参数名不能为空,且数量应该匹配'));
2950
2954
  return this.rpc('variable', { vars, args, listener, parse_object });
2951
2955
  }
2952
2956
  /** 取消当前 session id 对应的所有 console jobs Cancel all console jobs corresponding to the current session id */