dolphindb 3.0.208 → 3.0.210
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 +5 -3
- package/browser.js +17 -14
- package/browser.js.map +1 -1
- package/index.d.ts +5 -3
- 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 JsSimpleType = 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
|
+
/** 自动转换 JsSimpleType 为 DdbObj */
|
|
362
|
+
static to_ddbobj(value: JsSimpleType): DdbObj;
|
|
362
363
|
/** 转换 js 数组为 DdbObj[] */
|
|
363
|
-
static to_ddbobjs(values:
|
|
364
|
+
static to_ddbobjs(values: JsSimpleType[]): DdbObj<DdbValue>[];
|
|
364
365
|
/** @deprecated 用 data() */
|
|
365
366
|
to_cols(): {
|
|
366
367
|
title: string;
|
|
@@ -421,6 +422,7 @@ export interface ConvertOptions {
|
|
|
421
422
|
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | Uint8Array<ArrayBufferLike> | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | string[] | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | IotVectorItemValue | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | DdbTensorValue;
|
|
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
|
+
/** 自动转换 JsSimpleType 为 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({
|
|
@@ -2581,7 +2586,7 @@ export function datetime2ms(datetime) {
|
|
|
2581
2586
|
if (datetime === null || datetime === nulls.int32)
|
|
2582
2587
|
return null;
|
|
2583
2588
|
const date = new Date(1000 * datetime);
|
|
2584
|
-
return new Date(`${_datetime_formatter.format(date)}.${date.getUTCMilliseconds()}`).valueOf();
|
|
2589
|
+
return new Date(`${_datetime_formatter.format(date)}.${String(date.getUTCMilliseconds()).padStart(3, '0')}`).valueOf();
|
|
2585
2590
|
}
|
|
2586
2591
|
export function datetime2str(datetime, format = 'YYYY.MM.DD HH:mm:ss') {
|
|
2587
2592
|
return (datetime === null || datetime === nulls.int32) ?
|
|
@@ -2594,7 +2599,7 @@ export function timestamp2ms(timestamp) {
|
|
|
2594
2599
|
if (timestamp === null || timestamp === nulls.int64)
|
|
2595
2600
|
return null;
|
|
2596
2601
|
const date = new Date(Number(timestamp));
|
|
2597
|
-
return new Date(`${_datetime_formatter.format(date)}.${date.getUTCMilliseconds()}`).valueOf();
|
|
2602
|
+
return new Date(`${_datetime_formatter.format(date)}.${String(date.getUTCMilliseconds()).padStart(3, '0')}`).valueOf();
|
|
2598
2603
|
}
|
|
2599
2604
|
/** format timestamp (bigint) to string
|
|
2600
2605
|
- timestamp: bigint value
|
|
@@ -2656,7 +2661,7 @@ export function nanotimestamp2ns(nanotimestamp) {
|
|
|
2656
2661
|
if (nanotimestamp === null || nanotimestamp === nulls.int64)
|
|
2657
2662
|
return null;
|
|
2658
2663
|
const date = new Date(Number(nanotimestamp / 1000000n));
|
|
2659
|
-
return BigInt(new Date(`${_datetime_formatter.format(date)}.${date.getUTCMilliseconds()}`).valueOf()) * 1000000n + nanotimestamp % 1000000n;
|
|
2664
|
+
return BigInt(new Date(`${_datetime_formatter.format(date)}.${String(date.getUTCMilliseconds()).padStart(3, '0')}`).valueOf()) * 1000000n + nanotimestamp % 1000000n;
|
|
2660
2665
|
}
|
|
2661
2666
|
/** format nanotimestamp value (bigint) to string
|
|
2662
2667
|
- nanotimestamp: bigint value
|
|
@@ -3301,9 +3306,12 @@ export class DDB {
|
|
|
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
|
simple = false;
|
|
3309
3317
|
}
|
|
@@ -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'
|