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/browser.d.ts
CHANGED
|
@@ -330,6 +330,12 @@ export declare function int1282str(buffer: Uint8Array, le?: boolean): string;
|
|
|
330
330
|
export interface StreamingParams {
|
|
331
331
|
table: string;
|
|
332
332
|
action?: string;
|
|
333
|
+
filters?: {
|
|
334
|
+
/** 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 */
|
|
335
|
+
column?: DdbObj;
|
|
336
|
+
/** 过滤条件的 DolphinDB 表达式 https://dolphindb1.atlassian.net/wiki/spaces/dev/pages/760840447/WebSocketConsole */
|
|
337
|
+
expression?: string;
|
|
338
|
+
};
|
|
333
339
|
handler(message: StreamingMessage): any;
|
|
334
340
|
}
|
|
335
341
|
export interface StreamingMessage extends StreamingParams {
|
package/browser.js
CHANGED
|
@@ -1522,8 +1522,7 @@ export function formati(obj, index, options = {}) {
|
|
|
1522
1522
|
const { scale } = obj.value;
|
|
1523
1523
|
const s = String(x < 0 ? -x : x).padStart(scale, '0');
|
|
1524
1524
|
const str = (x < 0 ? '-' : '') + (scale ? `${s.slice(0, -scale) || '0'}.${s.slice(-scale)}` : s);
|
|
1525
|
-
|
|
1526
|
-
items[i] = green(str);
|
|
1525
|
+
items[i] = options.colors ? green(str) : str;
|
|
1527
1526
|
}
|
|
1528
1527
|
break;
|
|
1529
1528
|
case DdbType.complex:
|
|
@@ -2292,8 +2291,11 @@ export class DDB {
|
|
|
2292
2291
|
reject(this.error /* 一定有,不需要再 || new DdbConnectionError(this) */);
|
|
2293
2292
|
};
|
|
2294
2293
|
try {
|
|
2294
|
+
let url = new URL(this.url);
|
|
2295
|
+
if (this.streaming?.filters?.expression)
|
|
2296
|
+
url.searchParams.set('filter', this.streaming.filters.expression.trim());
|
|
2295
2297
|
// 连接建立之前应该不会有别的调用占用 this.lwebsocket
|
|
2296
|
-
this.lwebsocket.resource = await connect_websocket(
|
|
2298
|
+
this.lwebsocket.resource = await connect_websocket(url, {
|
|
2297
2299
|
protocols: this.streaming ? ['streaming'] : this.python ? ['python'] : undefined,
|
|
2298
2300
|
on_message: (buffer, websocket) => {
|
|
2299
2301
|
this.on_message(new Uint8Array(buffer), websocket);
|