dolphindb 3.0.25 → 3.0.26
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 +1 -1
- package/browser.js +14 -20
- package/browser.js.map +1 -1
- package/i18n/dict.json +2 -2
- package/index.d.ts +1 -1
- package/index.js +14 -20
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/test.js +32 -19
- package/test.js.map +1 -1
package/i18n/dict.json
CHANGED
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"session id 从 {{sid}} 变为 {{sid_}}": {
|
|
39
39
|
"en": "session id changed from {{sid}} to {{sid_}}"
|
|
40
40
|
},
|
|
41
|
-
"
|
|
42
|
-
"en": "subscribed to streaming table"
|
|
41
|
+
"订阅流表成功:": {
|
|
42
|
+
"en": "subscribed to streaming table:"
|
|
43
43
|
},
|
|
44
44
|
"vector {{type}} 暂不支持序列化": {
|
|
45
45
|
"en": "vector {{type}} serialization is not currently supported"
|
package/index.d.ts
CHANGED
|
@@ -347,7 +347,7 @@ export interface ConvertOptions {
|
|
|
347
347
|
/** `'string'` blob 类型数据的格式 */
|
|
348
348
|
blob?: 'string' | 'binary';
|
|
349
349
|
}
|
|
350
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob }?: ConvertOptions): string | number | bigint | boolean | Uint8Array |
|
|
350
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob }?: ConvertOptions): string | number | bigint | boolean | string[] | Uint8Array | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | BigInt128Array | Uint8Array[] | DdbObj<DdbValue>[] | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | number[];
|
|
351
351
|
/** 转换一个向量到 js 原生数组 */
|
|
352
352
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[];
|
|
353
353
|
export declare class DdbVoid extends DdbObj<undefined> {
|
package/index.js
CHANGED
|
@@ -3038,14 +3038,18 @@ export class DDB {
|
|
|
3038
3038
|
}
|
|
3039
3039
|
/** 内部的流订阅方法 Internal stream subscription method */
|
|
3040
3040
|
async subscribe() {
|
|
3041
|
+
// 流表推送过来的第一条数据是 schema,需要特殊处理
|
|
3042
|
+
let first = true;
|
|
3041
3043
|
let win = {
|
|
3042
3044
|
offset: 0,
|
|
3043
3045
|
rows: 0,
|
|
3044
3046
|
segments: [],
|
|
3045
3047
|
};
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3048
|
+
let schema;
|
|
3049
|
+
console.log(t('订阅流表成功:'),
|
|
3050
|
+
// 普通流表结果为 columns (string[])
|
|
3051
|
+
// 高可用流表为 [columns (string[]), node sites (string[])]
|
|
3052
|
+
(await this.call('publishTable', [
|
|
3049
3053
|
'localhost',
|
|
3050
3054
|
new DdbInt(0),
|
|
3051
3055
|
this.streaming.table,
|
|
@@ -3071,24 +3075,17 @@ export class DDB {
|
|
|
3071
3075
|
throw new Error(value.slice(value.indexOf(':') + 1).trim());
|
|
3072
3076
|
}
|
|
3073
3077
|
if (first) {
|
|
3074
|
-
data = obj.data();
|
|
3078
|
+
schema = data = obj.data();
|
|
3075
3079
|
data.name ||= this.streaming.table;
|
|
3076
3080
|
first = false;
|
|
3077
3081
|
}
|
|
3078
3082
|
else {
|
|
3079
|
-
const
|
|
3080
|
-
const
|
|
3081
|
-
const
|
|
3082
|
-
// 遍历每一列
|
|
3083
|
-
obj.value.forEach(({ type, value }) => {
|
|
3084
|
-
types.push(type);
|
|
3085
|
-
js_cols.push(converts(type, value, rows, obj.le));
|
|
3086
|
-
});
|
|
3083
|
+
const _data = obj.data();
|
|
3084
|
+
const rows = _data[0].length;
|
|
3085
|
+
const { columns } = schema;
|
|
3087
3086
|
data = {
|
|
3088
|
-
|
|
3089
|
-
columns,
|
|
3090
|
-
types,
|
|
3091
|
-
data: seq(rows, i => zip_object(columns, seq(columns.length, j => js_cols[j][i])))
|
|
3087
|
+
...schema,
|
|
3088
|
+
data: seq(rows, i => zip_object(columns, seq(columns.length, j => _data[j][i])))
|
|
3092
3089
|
};
|
|
3093
3090
|
win.rows += rows;
|
|
3094
3091
|
win.segments.push(data);
|
|
@@ -3118,10 +3115,7 @@ export class DDB {
|
|
|
3118
3115
|
this.streaming.handler({ ...this.streaming, error });
|
|
3119
3116
|
}
|
|
3120
3117
|
}
|
|
3121
|
-
});
|
|
3122
|
-
console.log(t('订阅流表成功') + ', columns:',
|
|
3123
|
-
// string[3](['time', 'stock', 'price'])
|
|
3124
|
-
columns);
|
|
3118
|
+
})).data());
|
|
3125
3119
|
}
|
|
3126
3120
|
}
|
|
3127
3121
|
export class BigInt128Array {
|