dolphindb 3.0.209 → 3.0.211
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/README.md +5 -0
- package/README.zh.md +4 -0
- package/browser.d.ts +6 -4
- package/browser.js +17 -14
- package/browser.js.map +1 -1
- package/docs.js.map +1 -1
- package/index.d.ts +6 -4
- package/index.js +17 -14
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/test.js.map +1 -1
package/README.md
CHANGED
|
@@ -607,6 +607,11 @@ export interface StreamingMessage <TRows = any> extends StreamingParams {
|
|
|
607
607
|
}
|
|
608
608
|
```
|
|
609
609
|
|
|
610
|
+
To close streaming data subscription, use the following two methods to disconnect:
|
|
611
|
+
- Automatically disconnect by closing the browser page
|
|
612
|
+
- Manually disconnect by calling `sddb.disconnect()`
|
|
613
|
+
|
|
614
|
+
|
|
610
615
|
## Development Method
|
|
611
616
|
|
|
612
617
|
```shell
|
package/README.zh.md
CHANGED
package/browser.d.ts
CHANGED
|
@@ -281,6 +281,7 @@ export interface DdbMatrixData {
|
|
|
281
281
|
}
|
|
282
282
|
export type IotVectorItemValue = [number | string | bigint | boolean][];
|
|
283
283
|
export type DdbIotAnyVector = DdbObj<IotVectorItemValue>;
|
|
284
|
+
export type Convertable = DdbObj | string | boolean | null | undefined;
|
|
284
285
|
/** 可以表示所有 DolphinDB 数据库中的数据类型 Can represent data types in all DolphinDB databases */
|
|
285
286
|
export declare class DdbObj<TValue extends DdbValue = DdbValue> {
|
|
286
287
|
static dec: TextDecoder;
|
|
@@ -357,10 +358,10 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
|
|
|
357
358
|
}, limit?: number): TensorData;
|
|
358
359
|
toString(options?: InspectOptions): string;
|
|
359
360
|
inspect_type(): string;
|
|
360
|
-
/** 自动转换
|
|
361
|
-
static to_ddbobj(value:
|
|
361
|
+
/** 自动转换 Convertable 为 DdbObj */
|
|
362
|
+
static to_ddbobj(value: Convertable): DdbObj;
|
|
362
363
|
/** 转换 js 数组为 DdbObj[] */
|
|
363
|
-
static to_ddbobjs(values:
|
|
364
|
+
static to_ddbobjs(values: Convertable[]): DdbObj<DdbValue>[];
|
|
364
365
|
/** @deprecated 用 data() */
|
|
365
366
|
to_cols(): {
|
|
366
367
|
title: string;
|
|
@@ -418,9 +419,10 @@ export interface ConvertOptions {
|
|
|
418
419
|
/** `'ms'` timestamp 类型转换为字符串表示时显示到秒还是毫秒 */
|
|
419
420
|
timestamp?: 's' | 'ms';
|
|
420
421
|
}
|
|
421
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean |
|
|
422
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | BigInt128Array | DdbSymbolExtendedValue | string[] | DdbArrayVectorValue | DdbMatrixValue | Uint8Array<ArrayBufferLike> | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | IotVectorItemValue | DdbDurationVectorValue | number[] | DdbTensorValue | DdbChartValue;
|
|
422
423
|
/** 转换一个向量到 js 原生数组 */
|
|
423
424
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
|
|
425
|
+
/** 构造 void 类型,默认为 `DdbVoidType.undefined` */
|
|
424
426
|
export declare class DdbVoid extends DdbObj<undefined> {
|
|
425
427
|
constructor(value?: DdbVoidType);
|
|
426
428
|
}
|
package/browser.js
CHANGED
|
@@ -1549,10 +1549,14 @@ export class DdbObj {
|
|
|
1549
1549
|
return `${DdbForm[this.form]} ${tname}`;
|
|
1550
1550
|
}
|
|
1551
1551
|
}
|
|
1552
|
-
/** 自动转换
|
|
1552
|
+
/** 自动转换 Convertable 为 DdbObj */
|
|
1553
1553
|
static to_ddbobj(value) {
|
|
1554
1554
|
if (value && value instanceof DdbObj)
|
|
1555
1555
|
return value;
|
|
1556
|
+
if (value === undefined)
|
|
1557
|
+
return new DdbVoid();
|
|
1558
|
+
if (value === null)
|
|
1559
|
+
return new DdbVoid(DdbVoidType.null);
|
|
1556
1560
|
const type = typeof value;
|
|
1557
1561
|
switch (type) {
|
|
1558
1562
|
case 'string':
|
|
@@ -2148,6 +2152,7 @@ export function converts(type, value, rows, le, options) {
|
|
|
2148
2152
|
}).flat();
|
|
2149
2153
|
}
|
|
2150
2154
|
}
|
|
2155
|
+
/** 构造 void 类型,默认为 `DdbVoidType.undefined` */
|
|
2151
2156
|
export class DdbVoid extends DdbObj {
|
|
2152
2157
|
constructor(value = DdbVoidType.undefined) {
|
|
2153
2158
|
super({
|
|
@@ -3295,20 +3300,23 @@ export class DDB {
|
|
|
3295
3300
|
async invoke(func, args, options) {
|
|
3296
3301
|
// 检查 args 是否全部为简单参数,是则直接调用 call,避免 invoke 间接调用
|
|
3297
3302
|
// 逻辑类似 DdbObj.to_ddbobjs, 需要同步修改
|
|
3298
|
-
let
|
|
3303
|
+
let convertable = true;
|
|
3299
3304
|
let has_ddbobj = false;
|
|
3300
3305
|
if (args)
|
|
3301
3306
|
for (const arg of args)
|
|
3302
3307
|
if (arg && arg instanceof DdbObj)
|
|
3303
3308
|
has_ddbobj = true;
|
|
3309
|
+
else if (arg === undefined || arg === null) {
|
|
3310
|
+
// simple
|
|
3311
|
+
}
|
|
3304
3312
|
else {
|
|
3305
3313
|
const type = typeof arg;
|
|
3306
|
-
if (type === 'string' || type === 'boolean') { }
|
|
3314
|
+
if (type === 'string' || type === 'boolean') { } // simple
|
|
3307
3315
|
else
|
|
3308
|
-
|
|
3316
|
+
convertable = false;
|
|
3309
3317
|
}
|
|
3310
3318
|
let result;
|
|
3311
|
-
if (
|
|
3319
|
+
if (convertable)
|
|
3312
3320
|
result = await this.call(func, args, options);
|
|
3313
3321
|
else {
|
|
3314
3322
|
if (has_ddbobj)
|
|
@@ -3396,15 +3404,10 @@ export class DDB {
|
|
|
3396
3404
|
/** index of line feed 0 */
|
|
3397
3405
|
const ilf0 = buf.indexOf(0x0a); // '\n'
|
|
3398
3406
|
const parts = this.dec.decode(buf.subarray(0, ilf0)).split(' ');
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
this.sid = sid;
|
|
3404
|
-
}
|
|
3405
|
-
/** 返回对象的数量 */
|
|
3406
|
-
const nobj = Number(parts[1]);
|
|
3407
|
-
/** 大小端: 协议中大端为 0, 小端为 1 */
|
|
3407
|
+
this.sid = parts[0];
|
|
3408
|
+
// 返回对象的数量
|
|
3409
|
+
// const nobj = Number(parts[1])
|
|
3410
|
+
// 大小端: 协议中大端为 0, 小端为 1
|
|
3408
3411
|
this.le = Number(parts[2]) !== 0;
|
|
3409
3412
|
const ils1 = ilf0 + 1;
|
|
3410
3413
|
const ilf1 = buf.indexOf(0x0a, ils1); // '\n'
|