dolphindb 3.0.25 → 3.0.27
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 +15 -21
- package/browser.js.map +1 -1
- package/i18n/dict.json +2 -2
- package/index.d.ts +1 -1
- package/index.js +15 -21
- 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
|
@@ -741,7 +741,7 @@ export declare class DDB {
|
|
|
741
741
|
call<TResult extends DdbObj>(func: string, args?: (DdbObj | string | boolean)[], { urgent, node, nodes, func_type, add_node_alias, listener, parse_object, skip_connection_check, on_more_messages }?: DdbCallOptions): Promise<TResult>;
|
|
742
742
|
/** 调用 dolphindb 函数,传入 js 原生数组作为参数,返回 js 原生对象或值(调用 DdbObj.data() 后的结果)
|
|
743
743
|
- func: 函数名
|
|
744
|
-
- args?: `[ ]` 调用参数,可以是 js
|
|
744
|
+
- args?: `[ ]` 调用参数,可以是 js 原生数组,参数在中间且想用 server 函数的默认参数值时可以传 null 占位
|
|
745
745
|
- options?: 调用选项
|
|
746
746
|
- urgent?: 紧急 flag。使用 urgent worker 执行,防止被其它作业阻塞
|
|
747
747
|
- node?: 设置结点 alias 时发送到集群中对应的结点执行 (使用 DolphinDB 中的 rpc 方法)
|
package/index.js
CHANGED
|
@@ -2922,7 +2922,7 @@ export class DDB {
|
|
|
2922
2922
|
}
|
|
2923
2923
|
/** 调用 dolphindb 函数,传入 js 原生数组作为参数,返回 js 原生对象或值(调用 DdbObj.data() 后的结果)
|
|
2924
2924
|
- func: 函数名
|
|
2925
|
-
- args?: `[ ]` 调用参数,可以是 js
|
|
2925
|
+
- args?: `[ ]` 调用参数,可以是 js 原生数组,参数在中间且想用 server 函数的默认参数值时可以传 null 占位
|
|
2926
2926
|
- options?: 调用选项
|
|
2927
2927
|
- urgent?: 紧急 flag。使用 urgent worker 执行,防止被其它作业阻塞
|
|
2928
2928
|
- node?: 设置结点 alias 时发送到集群中对应的结点执行 (使用 DolphinDB 中的 rpc 方法)
|
|
@@ -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 {
|