dolphindb 3.0.119 → 3.0.120
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 +5 -3
- package/browser.js +45 -4
- package/browser.js.map +1 -1
- package/i18n/dict.json +3 -0
- package/index.d.ts +5 -3
- package/index.js +45 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/test.js.map +1 -1
package/browser.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare enum DdbType {
|
|
|
70
70
|
decimal64 = 38,
|
|
71
71
|
decimal128 = 39,
|
|
72
72
|
object = 40,
|
|
73
|
-
|
|
73
|
+
iotany = 41,
|
|
74
74
|
symbol_extended = 145
|
|
75
75
|
}
|
|
76
76
|
export declare enum DdbFunctionType {
|
|
@@ -236,7 +236,7 @@ DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value |
|
|
|
236
236
|
export type DdbVectorValue = null | Uint8Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | BigInt128Array | string[] | // string[]
|
|
237
237
|
Uint8Array[] | // blob
|
|
238
238
|
DdbObj[] | // any
|
|
239
|
-
DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue;
|
|
239
|
+
IotVectorItemValue | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue;
|
|
240
240
|
export type DdbValue = DdbScalarValue | DdbVectorValue | DdbMatrixValue | DdbDictValue | DdbChartValue | DdbTensorValue;
|
|
241
241
|
export type DdbStringObj = DdbObj<string>;
|
|
242
242
|
export type DdbVectorObj<TValue extends DdbVectorValue = DdbVectorValue> = DdbObj<TValue>;
|
|
@@ -278,6 +278,8 @@ export interface DdbMatrixData {
|
|
|
278
278
|
/** 数据, data[0][1] 为第 0 行第 1 列数据 */
|
|
279
279
|
data: any[][];
|
|
280
280
|
}
|
|
281
|
+
export type IotVectorItemValue = [number | string | bigint | boolean][];
|
|
282
|
+
export type DdbIotAnyVector = DdbObj<IotVectorItemValue>;
|
|
281
283
|
/** 可以表示所有 DolphinDB 数据库中的数据类型 Can represent data types in all DolphinDB databases */
|
|
282
284
|
export declare class DdbObj<TValue extends DdbValue = DdbValue> {
|
|
283
285
|
static dec: TextDecoder;
|
|
@@ -411,7 +413,7 @@ export interface ConvertOptions {
|
|
|
411
413
|
/** timestamp 类型转换为字符串表示时显示到秒还是毫秒 */
|
|
412
414
|
timestamp?: 's' | 'ms';
|
|
413
415
|
}
|
|
414
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, timestamp }?: ConvertOptions): string | number | bigint | boolean | Uint8Array | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | BigInt128Array | string[] | Uint8Array[] | DdbObj<DdbValue>[] | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | DdbTensorValue;
|
|
416
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, timestamp }?: ConvertOptions): string | number | bigint | boolean | Uint8Array | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | BigInt128Array | string[] | Uint8Array[] | DdbObj<DdbValue>[] | IotVectorItemValue | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | DdbTensorValue;
|
|
415
417
|
/** 转换一个向量到 js 原生数组 */
|
|
416
418
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[];
|
|
417
419
|
export declare class DdbVoid extends DdbObj<undefined> {
|
package/browser.js
CHANGED
|
@@ -79,7 +79,7 @@ export var DdbType;
|
|
|
79
79
|
DdbType[DdbType["decimal64"] = 38] = "decimal64";
|
|
80
80
|
DdbType[DdbType["decimal128"] = 39] = "decimal128";
|
|
81
81
|
DdbType[DdbType["object"] = 40] = "object";
|
|
82
|
-
DdbType[DdbType["
|
|
82
|
+
DdbType[DdbType["iotany"] = 41] = "iotany";
|
|
83
83
|
DdbType[DdbType["symbol_extended"] = 145] = "symbol_extended";
|
|
84
84
|
})(DdbType || (DdbType = {}));
|
|
85
85
|
export var DdbFunctionType;
|
|
@@ -560,6 +560,7 @@ export class DdbObj {
|
|
|
560
560
|
cols: 1,
|
|
561
561
|
rows,
|
|
562
562
|
value,
|
|
563
|
+
...type === DdbType.iotany ? { buffer: buf } : {}
|
|
563
564
|
});
|
|
564
565
|
}
|
|
565
566
|
else { // array vector
|
|
@@ -823,6 +824,43 @@ export class DdbObj {
|
|
|
823
824
|
values
|
|
824
825
|
];
|
|
825
826
|
}
|
|
827
|
+
case DdbType.iotany: {
|
|
828
|
+
// 构造 indexes
|
|
829
|
+
const dv = new DataView(buf.buffer, buf.byteOffset);
|
|
830
|
+
let i_value_start = 0;
|
|
831
|
+
const size = Number(dv.getBigUint64(i_value_start, le));
|
|
832
|
+
i_value_start += 8;
|
|
833
|
+
const indexes = new Array(size * 2);
|
|
834
|
+
for (let i = 0; i < size; i++) {
|
|
835
|
+
const type = dv.getUint32(i_value_start, le);
|
|
836
|
+
i_value_start += 4;
|
|
837
|
+
const idx = dv.getUint32(i_value_start, le);
|
|
838
|
+
i_value_start += 4;
|
|
839
|
+
indexes[i * 2] = type;
|
|
840
|
+
indexes[i * 2 + 1] = idx;
|
|
841
|
+
}
|
|
842
|
+
// 构造 sub vector
|
|
843
|
+
const type_size = dv.getUint32(i_value_start, le);
|
|
844
|
+
i_value_start += 4;
|
|
845
|
+
const sub_vec = new Map();
|
|
846
|
+
for (let i = 0; i < type_size; i++) {
|
|
847
|
+
const flag = dv.getUint16(i_value_start, le);
|
|
848
|
+
i_value_start += 2;
|
|
849
|
+
const form = flag >> 8;
|
|
850
|
+
const sub_type = flag & 0xff;
|
|
851
|
+
assert(form === DdbForm.vector, t('iotany sub vector 不支持非 vector 类型'));
|
|
852
|
+
const sub_size = dv.getUint32(i_value_start, le);
|
|
853
|
+
i_value_start += 8; // 同时跳过 sub_size 和 cols
|
|
854
|
+
const [len, vector] = this.parse_vector_items(buf.subarray(i_value_start), le, sub_type, sub_size);
|
|
855
|
+
i_value_start += len;
|
|
856
|
+
sub_vec.set(sub_type, vector);
|
|
857
|
+
}
|
|
858
|
+
return [
|
|
859
|
+
i_value_start,
|
|
860
|
+
// 根据 indexes 数组构建最终的 value 数组
|
|
861
|
+
seq(size, i => (sub_vec.get(indexes[i * 2]))[indexes[i * 2 + 1]])
|
|
862
|
+
];
|
|
863
|
+
}
|
|
826
864
|
// 25 01 type = decimal32, form = vector
|
|
827
865
|
// 02 00 00 00 01 00 00 00
|
|
828
866
|
// 00 00 00 00 scale = 0
|
|
@@ -1024,6 +1062,8 @@ export class DdbObj {
|
|
|
1024
1062
|
block.data
|
|
1025
1063
|
])).flat()
|
|
1026
1064
|
];
|
|
1065
|
+
if (form === DdbForm.vector && type === DdbType.iotany)
|
|
1066
|
+
return [this.buffer];
|
|
1027
1067
|
return [
|
|
1028
1068
|
Uint32Array.of(this.rows, 1),
|
|
1029
1069
|
...DdbObj.pack_vector_body(value, type, this.rows)
|
|
@@ -2084,6 +2124,8 @@ export function converts(type, value, rows, le, options) {
|
|
|
2084
2124
|
}
|
|
2085
2125
|
case DdbType.any:
|
|
2086
2126
|
return value.map(x => x.data(options));
|
|
2127
|
+
case DdbType.iotany:
|
|
2128
|
+
return value;
|
|
2087
2129
|
default:
|
|
2088
2130
|
throw new Error(String(DdbType[type] || type) + '[]' + t(' 暂时不支持转换为 js 对象'));
|
|
2089
2131
|
}
|
|
@@ -3211,7 +3253,7 @@ export class DDB {
|
|
|
3211
3253
|
let simple = true;
|
|
3212
3254
|
let has_ddbobj = false;
|
|
3213
3255
|
if (args)
|
|
3214
|
-
for (const arg of args)
|
|
3256
|
+
for (const arg of args)
|
|
3215
3257
|
if (arg && arg instanceof DdbObj)
|
|
3216
3258
|
has_ddbobj = true;
|
|
3217
3259
|
else {
|
|
@@ -3222,7 +3264,6 @@ export class DDB {
|
|
|
3222
3264
|
break;
|
|
3223
3265
|
}
|
|
3224
3266
|
}
|
|
3225
|
-
}
|
|
3226
3267
|
if (!simple) {
|
|
3227
3268
|
if (has_ddbobj)
|
|
3228
3269
|
throw new Error(t('调用 ddb.invoke 的参数中不能同时有 DdbObj 与复杂 js 原生对象'));
|
|
@@ -3383,7 +3424,7 @@ export class DDB {
|
|
|
3383
3424
|
data: seq(rows, i => zip_object(columns, seq(columns.length, j => _data[j][i])))
|
|
3384
3425
|
};
|
|
3385
3426
|
}
|
|
3386
|
-
|
|
3427
|
+
win.data.push(...data.data);
|
|
3387
3428
|
win.objs.push(obj);
|
|
3388
3429
|
if (win.data.length >= winsize * 2 && win.objs.length >= 2) {
|
|
3389
3430
|
let winsize_ = 0;
|