dolphindb 2.0.1026 → 2.0.1028
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 +6 -0
- package/browser.js +5 -3
- package/browser.js.map +1 -1
- package/index.d.ts +6 -0
- package/index.js +4 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -321,6 +321,12 @@ export declare function int1282str(buffer: Uint8Array, le?: boolean): string;
|
|
|
321
321
|
export interface StreamingParams {
|
|
322
322
|
table: string;
|
|
323
323
|
action?: string;
|
|
324
|
+
filters?: {
|
|
325
|
+
/** https://docs.dolphindb.cn/zh/help/FunctionsandCommands/FunctionReferences/s/subscribeTable.html#:~:text=%E8%BF%9E%E6%8E%A5%E6%96%B0%E7%9A%84%20leader%E3%80%82-,filter%20%E5%8F%82%E6%95%B0%E9%9C%80%E8%A6%81%E9%85%8D%E5%90%88,-setStreamTableFilterColumn%20%E5%87%BD%E6%95%B0%E4%B8%80%E8%B5%B7 */
|
|
326
|
+
column?: DdbObj;
|
|
327
|
+
/** 过滤条件的 DolphinDB 表达式 https://dolphindb1.atlassian.net/wiki/spaces/dev/pages/760840447/WebSocketConsole */
|
|
328
|
+
expression?: string;
|
|
329
|
+
};
|
|
324
330
|
handler(message: StreamingMessage): any;
|
|
325
331
|
}
|
|
326
332
|
export interface StreamingMessage extends StreamingParams {
|
package/index.js
CHANGED
|
@@ -2290,8 +2290,11 @@ export class DDB {
|
|
|
2290
2290
|
reject(this.error /* 一定有,不需要再 || new DdbConnectionError(this) */);
|
|
2291
2291
|
};
|
|
2292
2292
|
try {
|
|
2293
|
+
let url = new URL(this.url);
|
|
2294
|
+
if (this.streaming?.filters?.expression)
|
|
2295
|
+
url.searchParams.set('filter', this.streaming.filters.expression.trim());
|
|
2293
2296
|
// 连接建立之前应该不会有别的调用占用 this.lwebsocket
|
|
2294
|
-
this.lwebsocket.resource = await connect_websocket(
|
|
2297
|
+
this.lwebsocket.resource = await connect_websocket(url, {
|
|
2295
2298
|
protocols: this.streaming ? ['streaming'] : this.python ? ['python'] : undefined,
|
|
2296
2299
|
on_message: (buffer, websocket) => {
|
|
2297
2300
|
this.on_message(new Uint8Array(buffer), websocket);
|