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/browser.d.ts
CHANGED
|
@@ -750,7 +750,7 @@ export declare class DDB {
|
|
|
750
750
|
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>;
|
|
751
751
|
/** 调用 dolphindb 函数,传入 js 原生数组作为参数,返回 js 原生对象或值(调用 DdbObj.data() 后的结果)
|
|
752
752
|
- func: 函数名
|
|
753
|
-
- args?: `[ ]` 调用参数,可以是 js
|
|
753
|
+
- args?: `[ ]` 调用参数,可以是 js 原生数组,参数在中间且想用 server 函数的默认参数值时可以传 null 占位
|
|
754
754
|
- options?: 调用选项
|
|
755
755
|
- urgent?: 紧急 flag。使用 urgent worker 执行,防止被其它作业阻塞
|
|
756
756
|
- node?: 设置结点 alias 时发送到集群中对应的结点执行 (使用 DolphinDB 中的 rpc 方法)
|
package/browser.js
CHANGED
|
@@ -2944,7 +2944,7 @@ export class DDB {
|
|
|
2944
2944
|
}
|
|
2945
2945
|
/** 调用 dolphindb 函数,传入 js 原生数组作为参数,返回 js 原生对象或值(调用 DdbObj.data() 后的结果)
|
|
2946
2946
|
- func: 函数名
|
|
2947
|
-
- args?: `[ ]` 调用参数,可以是 js
|
|
2947
|
+
- args?: `[ ]` 调用参数,可以是 js 原生数组,参数在中间且想用 server 函数的默认参数值时可以传 null 占位
|
|
2948
2948
|
- options?: 调用选项
|
|
2949
2949
|
- urgent?: 紧急 flag。使用 urgent worker 执行,防止被其它作业阻塞
|
|
2950
2950
|
- node?: 设置结点 alias 时发送到集群中对应的结点执行 (使用 DolphinDB 中的 rpc 方法)
|
|
@@ -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
|