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/browser.d.ts
CHANGED
|
@@ -357,7 +357,7 @@ export interface ConvertOptions {
|
|
|
357
357
|
/** `'string'` blob 类型数据的格式 */
|
|
358
358
|
blob?: 'string' | 'binary';
|
|
359
359
|
}
|
|
360
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob }?: ConvertOptions): string | number | bigint | boolean | Uint8Array |
|
|
360
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob }?: ConvertOptions): string | number | bigint | boolean | string[] | Uint8Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | Uint8Array[] | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | BigInt128Array | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbMatrixValue | DdbObj<DdbValue>[] | DdbDurationVectorValue | DdbChartValue;
|
|
361
361
|
/** 转换一个向量到 js 原生数组 */
|
|
362
362
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[];
|
|
363
363
|
export declare class DdbVoid extends DdbObj<undefined> {
|
package/browser.js
CHANGED
|
@@ -3060,14 +3060,18 @@ export class DDB {
|
|
|
3060
3060
|
}
|
|
3061
3061
|
/** 内部的流订阅方法 Internal stream subscription method */
|
|
3062
3062
|
async subscribe() {
|
|
3063
|
+
// 流表推送过来的第一条数据是 schema,需要特殊处理
|
|
3064
|
+
let first = true;
|
|
3063
3065
|
let win = {
|
|
3064
3066
|
offset: 0,
|
|
3065
3067
|
rows: 0,
|
|
3066
3068
|
segments: [],
|
|
3067
3069
|
};
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3070
|
+
let schema;
|
|
3071
|
+
console.log(t('订阅流表成功:'),
|
|
3072
|
+
// 普通流表结果为 columns (string[])
|
|
3073
|
+
// 高可用流表为 [columns (string[]), node sites (string[])]
|
|
3074
|
+
(await this.call('publishTable', [
|
|
3071
3075
|
'localhost',
|
|
3072
3076
|
new DdbInt(0),
|
|
3073
3077
|
this.streaming.table,
|
|
@@ -3093,24 +3097,17 @@ export class DDB {
|
|
|
3093
3097
|
throw new Error(value.slice(value.indexOf(':') + 1).trim());
|
|
3094
3098
|
}
|
|
3095
3099
|
if (first) {
|
|
3096
|
-
data = obj.data();
|
|
3100
|
+
schema = data = obj.data();
|
|
3097
3101
|
data.name ||= this.streaming.table;
|
|
3098
3102
|
first = false;
|
|
3099
3103
|
}
|
|
3100
3104
|
else {
|
|
3101
|
-
const
|
|
3102
|
-
const
|
|
3103
|
-
const
|
|
3104
|
-
// 遍历每一列
|
|
3105
|
-
obj.value.forEach(({ type, value }) => {
|
|
3106
|
-
types.push(type);
|
|
3107
|
-
js_cols.push(converts(type, value, rows, obj.le));
|
|
3108
|
-
});
|
|
3105
|
+
const _data = obj.data();
|
|
3106
|
+
const rows = _data[0].length;
|
|
3107
|
+
const { columns } = schema;
|
|
3109
3108
|
data = {
|
|
3110
|
-
|
|
3111
|
-
columns,
|
|
3112
|
-
types,
|
|
3113
|
-
data: seq(rows, i => zip_object(columns, seq(columns.length, j => js_cols[j][i])))
|
|
3109
|
+
...schema,
|
|
3110
|
+
data: seq(rows, i => zip_object(columns, seq(columns.length, j => _data[j][i])))
|
|
3114
3111
|
};
|
|
3115
3112
|
win.rows += rows;
|
|
3116
3113
|
win.segments.push(data);
|
|
@@ -3140,10 +3137,7 @@ export class DDB {
|
|
|
3140
3137
|
this.streaming.handler({ ...this.streaming, error });
|
|
3141
3138
|
}
|
|
3142
3139
|
}
|
|
3143
|
-
});
|
|
3144
|
-
console.log(t('订阅流表成功') + ', columns:',
|
|
3145
|
-
// string[3](['time', 'stock', 'price'])
|
|
3146
|
-
columns);
|
|
3140
|
+
})).data());
|
|
3147
3141
|
}
|
|
3148
3142
|
}
|
|
3149
3143
|
/** https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
|