dolphindb 2.0.513 → 2.0.514

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
@@ -12,6 +12,10 @@ export declare enum DdbForm {
12
12
  chart = 7,
13
13
  chunk = 8
14
14
  }
15
+ /** DolphinDB DataType
16
+ 对应的 array vector 类型为 64 + 基本类型
17
+ 对应的 extended 类型为 128 + 基本类型
18
+ */
15
19
  export declare enum DdbType {
16
20
  void = 0,
17
21
  bool = 1,
@@ -93,7 +97,7 @@ export interface DdbArrayVectorBlock {
93
97
  unit: 1 | 2 | 4;
94
98
  rows: number;
95
99
  lengths: Uint8Array | Uint16Array | Uint32Array;
96
- data: DdbVectorValue;
100
+ data: Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
97
101
  }
98
102
  export interface DdbMatrixValue {
99
103
  rows: DdbObj<DdbVectorValue>;
@@ -387,7 +391,7 @@ export declare class DDB {
387
391
  - options:
388
392
  - urgent?: 决定 `行为标识` 那一行字符串的取值(只适用于 script 和 function)
389
393
  - vars?: type === 'variable' 时必传,variable 指令中待上传的变量名
390
- - handler?: Process messages during this rpc (DdbMessage)
394
+ - listener?: 处理本次 rpc 期间的消息 (DdbMessage)
391
395
  - parse_object?: 在该次 rpc 期间设置 parse_object, 结束后恢复原有,为 false 时返回的 DdbObj 仅含有 buffer 和 le,
392
396
  不做解析,以便后续转发、序列化
393
397
  */
@@ -469,4 +473,3 @@ export interface DdbErrorMessage {
469
473
  data: Error;
470
474
  }
471
475
  export declare type DdbMessage = DdbPrintMessage | DdbObjectMessage | DdbErrorMessage;
472
- export default DDB;
package/index.js CHANGED
@@ -20,6 +20,10 @@ var DdbForm;
20
20
  DdbForm[DdbForm["chart"] = 7] = "chart";
21
21
  DdbForm[DdbForm["chunk"] = 8] = "chunk";
22
22
  })(DdbForm = exports.DdbForm || (exports.DdbForm = {}));
23
+ /** DolphinDB DataType
24
+ 对应的 array vector 类型为 64 + 基本类型
25
+ 对应的 extended 类型为 128 + 基本类型
26
+ */
23
27
  var DdbType;
24
28
  (function (DdbType) {
25
29
  DdbType[DdbType["void"] = 0] = "void";
@@ -471,7 +475,7 @@ class DdbObj {
471
475
  unit,
472
476
  rows,
473
477
  lengths,
474
- data
478
+ data: data
475
479
  });
476
480
  i_block_start = i_data_start + len_items;
477
481
  i_row += rows;
@@ -929,6 +933,34 @@ class DdbObj {
929
933
  :
930
934
  str_items.bracket('square');
931
935
  }
936
+ if (64 <= this.type && this.type < 128) { // array vector
937
+ // 因为 array vector 目前只支持:Logical, Integral(不包括 INT128, COMPRESS 类型), Floating, Temporal
938
+ // 都对应 TypedArray 中的一格,所以直接根据 index 去取即可
939
+ // av = array(INT[], 0, 5)
940
+ // append!(av, [1..1])
941
+ // append!(av, [1..70000])
942
+ // append!(av, [1..1])
943
+ // append!(av, [1..500])
944
+ // ...
945
+ // av
946
+ const _type = this.type - 64;
947
+ const limit = 10;
948
+ let items = new Array(Math.min(limit, this.rows));
949
+ let i_items = 0;
950
+ for (const { lengths, data } of this.value) {
951
+ let acc_len = 0;
952
+ for (const length of lengths) {
953
+ let _items = new Array(Math.min(limit, length));
954
+ for (let i = 0; i < _items.length; i++)
955
+ _items[i] = format(_type, data[acc_len + i], this.le, options);
956
+ items[i_items++] = format_array(_items, length > limit);
957
+ acc_len += length;
958
+ }
959
+ if (i_items >= limit)
960
+ break;
961
+ }
962
+ return format_array(items, this.rows > limit);
963
+ }
932
964
  switch (this.type) {
933
965
  case DdbType.symbol_extended: {
934
966
  const limit = 50;
@@ -1844,7 +1876,7 @@ class DDB {
1844
1876
  - options:
1845
1877
  - urgent?: 决定 `行为标识` 那一行字符串的取值(只适用于 script 和 function)
1846
1878
  - vars?: type === 'variable' 时必传,variable 指令中待上传的变量名
1847
- - handler?: Process messages during this rpc (DdbMessage)
1879
+ - listener?: 处理本次 rpc 期间的消息 (DdbMessage)
1848
1880
  - parse_object?: 在该次 rpc 期间设置 parse_object, 结束后恢复原有,为 false 时返回的 DdbObj 仅含有 buffer 和 le,
1849
1881
  不做解析,以便后续转发、序列化
1850
1882
  */
@@ -2070,5 +2102,4 @@ class DDB {
2070
2102
  exports.DDB = DDB;
2071
2103
  /** little endian (client) */
2072
2104
  DDB.le_client = Boolean(new Uint8Array(Uint32Array.of(1).buffer)[0]);
2073
- exports.default = DDB;
2074
2105
  //# sourceMappingURL=index.js.map