dolphindb 3.0.40 → 3.0.41
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 +4 -4
- package/README.zh.md +4 -4
- package/browser.d.ts +8 -6
- package/browser.js +11 -14
- package/browser.js.map +1 -1
- package/docs.d.ts +1 -1
- package/i18n/index.d.ts +1 -1
- package/index.d.ts +6 -7
- package/index.js +11 -14
- package/index.js.map +1 -1
- package/package.json +5 -5
package/docs.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare class DocsAnalyser {
|
|
|
32
32
|
@returns */
|
|
33
33
|
search_completion_items(query: string): {
|
|
34
34
|
keywords: string[];
|
|
35
|
-
constants: ("
|
|
35
|
+
constants: ("true" | "false" | "DFLT" | "NULL" | "pi" | "e" | "SCALAR" | "VECTOR" | "PAIR" | "MATRIX" | "SET" | "DICT" | "TABLE" | "VOID" | "BOOL" | "CHAR" | "SHORT" | "INT" | "INDEX" | "LONG" | "DATE" | "MONTH" | "TIME" | "MINUTE" | "SECOND" | "DATETIME" | "TIMESTAMP" | "NANOTIME" | "NANOTIMESTAMP" | "FLOAT" | "DOUBLE" | "SYMBOL" | "STRING" | "UUID" | "FUNCTIONDEF" | "HANDLE" | "CODE" | "DATASOURCE" | "RESOURCE" | "ANY" | "DICTIONARY" | "DATEHOUR" | "IPADDR" | "INT128" | "BLOB" | "COMPLEX" | "POINT" | "DURATION" | "OBJECT" | "DECIMAL32" | "DECIMAL64" | "DECIMAL128" | "SEQ" | "RANGE" | "HASH" | "VALUE" | "LIST" | "COMPO" | "VAR" | "SHARED" | "DEF" | "GLOBAL" | "TABLE_READ" | "TABLE_WRITE" | "TABLE_INSERT" | "TABLE_UPDATE" | "TABLE_DELETE" | "DBOBJ_CREATE" | "DBOBJ_DELETE" | "DB_DELETE" | "DB_INSERT" | "DB_MANAGE" | "DB_OWNER" | "DB_READ" | "DB_UPDATE" | "DB_WRITE" | "SCRIPT_EXEC" | "TASK_GROUP_MEM_LIMIT" | "TEST_EXEC" | "VIEW_EXEC" | "VIEW_OWNER" | "QUERY_RESULT_MEM_LIMIT" | "HINT_HASH" | "HINT_SNAPSHOT" | "HINT_KEEPORDER" | "HINT_SEQ" | "HINT_EXPLAIN" | "HINT_VECTORIZED" | "HEAD" | "CURRENT" | "TAIL" | "LINE" | "PIE" | "COLUMN" | "BAR" | "AREA" | "SCATTER" | "HISTOGRAM" | "KLINE" | "DEBUG" | "INFO" | "WARNING" | "ERROR" | "FIRST" | "LAST" | "ALL" | "NONE" | "HASH_PTN" | "True" | "False" | "None")[];
|
|
36
36
|
functions: string[];
|
|
37
37
|
};
|
|
38
38
|
}
|
package/i18n/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { I18N } from 'xshell/i18n/index.js';
|
|
2
2
|
export declare let i18n: I18N;
|
|
3
3
|
declare const t: (text: string, options?: {
|
|
4
|
-
[key: string]: any;
|
|
5
4
|
language?: import("xshell/i18n/index.js").Language;
|
|
6
5
|
context?: string;
|
|
7
6
|
count?: number;
|
|
7
|
+
[key: string]: any;
|
|
8
8
|
}) => string, language: import("xshell/i18n/index.js").Language;
|
|
9
9
|
export { t, language };
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
import type { InspectOptions as UtilInspectOptions } from 'util';
|
|
3
2
|
import { inspect, Lock, type WebSocket, type WebSocketConnectionError } from 'xshell';
|
|
4
3
|
export declare const nulls: {
|
|
@@ -378,7 +377,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
|
|
|
378
377
|
}
|
|
379
378
|
/** 根据 DdbType 获取其名称,array vector type 自动在后面加上 [] */
|
|
380
379
|
export declare function get_type_name(type: DdbType): string;
|
|
381
|
-
export declare function is_decimal_type(type: DdbType):
|
|
380
|
+
export declare function is_decimal_type(type: DdbType): type is DdbType.decimal32 | DdbType.decimal64 | DdbType.decimal128;
|
|
382
381
|
export declare function is_decimal_null_value(type: DdbType, value: number | bigint): boolean;
|
|
383
382
|
export declare function get_duration_unit(code: number): string;
|
|
384
383
|
export interface InspectOptions extends UtilInspectOptions {
|
|
@@ -388,6 +387,8 @@ export interface InspectOptions extends UtilInspectOptions {
|
|
|
388
387
|
decimals?: number;
|
|
389
388
|
/** `true` 决定格式化后的数据是否有千分位 */
|
|
390
389
|
grouping?: boolean;
|
|
390
|
+
/** timestamp 类型转换为字符串表示时显示到秒还是毫秒 */
|
|
391
|
+
timestamp?: 's' | 'ms';
|
|
391
392
|
}
|
|
392
393
|
/** 根据 DdbType 格式化单个元素 (value) 为字符串,空值返回 'null' 字符串 */
|
|
393
394
|
export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
|
|
@@ -399,7 +400,7 @@ export interface ConvertOptions {
|
|
|
399
400
|
/** timestamp 类型转换为字符串表示时显示到秒还是毫秒 */
|
|
400
401
|
timestamp?: 's' | 'ms';
|
|
401
402
|
}
|
|
402
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob }?: ConvertOptions): string | number | bigint | boolean | Uint8Array | Int32Array | BigInt64Array | string[] | Int8Array | Int16Array | Float32Array | Float64Array | Uint8Array[] | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | BigInt128Array | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbMatrixValue | DdbObj<DdbValue>[] | DdbDurationVectorValue | DdbTensorValue | DdbChartValue;
|
|
403
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, timestamp }?: ConvertOptions): string | number | bigint | boolean | Uint8Array | Int32Array | BigInt64Array | string[] | Int8Array | Int16Array | Float32Array | Float64Array | Uint8Array[] | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | BigInt128Array | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbMatrixValue | DdbObj<DdbValue>[] | DdbDurationVectorValue | DdbTensorValue | DdbChartValue;
|
|
403
404
|
/** 转换一个向量到 js 原生数组 */
|
|
404
405
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[];
|
|
405
406
|
export declare class DdbVoid extends DdbObj<undefined> {
|
|
@@ -563,10 +564,8 @@ export interface StreamingMessage<TRows = any> extends StreamingParams {
|
|
|
563
564
|
window: {
|
|
564
565
|
/** 建立连接开始 offset = 0, 随着 window 的移动逐渐增加 The establishment of the connection starts offset = 0, and gradually increases as the window moves */
|
|
565
566
|
offset: number;
|
|
566
|
-
/**
|
|
567
|
-
|
|
568
|
-
/** 每次接收到的 data 组成的数组 An array of data received each time */
|
|
569
|
-
segments: DdbTableData<TRows>[];
|
|
567
|
+
/** 历史数据 Historical data */
|
|
568
|
+
data: TRows[];
|
|
570
569
|
/** 每次接收到的 obj 组成的数组 An array of obj received each time */
|
|
571
570
|
objs: DdbObj<DdbVectorObj[]>[];
|
|
572
571
|
};
|
package/index.js
CHANGED
|
@@ -1660,8 +1660,8 @@ let _formatter = new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 });
|
|
|
1660
1660
|
let _datetime_formatter = new Intl.DateTimeFormat('zh-CN', { dateStyle: 'short', timeStyle: 'medium', timeZone: 'UTC', hour12: false });
|
|
1661
1661
|
/** 根据 DdbType 格式化单个元素 (value) 为字符串,空值返回 'null' 字符串 */
|
|
1662
1662
|
export function format(type, value, le, options = {}) {
|
|
1663
|
+
const { grouping = true, timestamp = 'ms' } = options;
|
|
1663
1664
|
const formatter = (() => {
|
|
1664
|
-
const { grouping = true } = options;
|
|
1665
1665
|
const decimals = options.decimals ?? _decimals;
|
|
1666
1666
|
if (decimals !== _decimals || grouping !== _grouping) {
|
|
1667
1667
|
_decimals = decimals;
|
|
@@ -1681,7 +1681,7 @@ export function format(type, value, le, options = {}) {
|
|
|
1681
1681
|
let str;
|
|
1682
1682
|
// formatter 可能会在 value 不属于 new Date() 有效值时,调用 抛出错误,这里统一处理
|
|
1683
1683
|
try {
|
|
1684
|
-
str = formatter(value);
|
|
1684
|
+
str = formatter(value, (type === DdbType.timestamp && timestamp === 's') ? 'YYYY.MM.DD HH:mm:ss' : undefined);
|
|
1685
1685
|
}
|
|
1686
1686
|
catch (error) {
|
|
1687
1687
|
if (error instanceof RangeError)
|
|
@@ -1931,7 +1931,7 @@ export function formati(obj, index, options = {}) {
|
|
|
1931
1931
|
}
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
|
-
export function convert(type, value, le, { blob = 'string' } = {}) {
|
|
1934
|
+
export function convert(type, value, le, { blob = 'string', timestamp = 'ms' } = {}) {
|
|
1935
1935
|
switch (type) {
|
|
1936
1936
|
case DdbType.void:
|
|
1937
1937
|
return value === DdbVoidType.null ? null : undefined;
|
|
@@ -1986,7 +1986,7 @@ export function convert(type, value, le, { blob = 'string' } = {}) {
|
|
|
1986
1986
|
case DdbType.decimal32:
|
|
1987
1987
|
case DdbType.decimal64:
|
|
1988
1988
|
case DdbType.decimal128:
|
|
1989
|
-
return format(type, value, le, { colors: false });
|
|
1989
|
+
return format(type, value, le, { colors: false, timestamp });
|
|
1990
1990
|
default:
|
|
1991
1991
|
throw new Error(String(DdbType[type] || type) + t(' 暂时不支持转换为 js 对象'));
|
|
1992
1992
|
}
|
|
@@ -3261,8 +3261,7 @@ export class DDB {
|
|
|
3261
3261
|
let first = true;
|
|
3262
3262
|
let win = {
|
|
3263
3263
|
offset: 0,
|
|
3264
|
-
|
|
3265
|
-
segments: [],
|
|
3264
|
+
data: [],
|
|
3266
3265
|
objs: []
|
|
3267
3266
|
};
|
|
3268
3267
|
let schema;
|
|
@@ -3316,19 +3315,17 @@ export class DDB {
|
|
|
3316
3315
|
data: seq(rows, i => zip_object(columns, seq(columns.length, j => _data[j][i])))
|
|
3317
3316
|
};
|
|
3318
3317
|
}
|
|
3319
|
-
|
|
3320
|
-
win.segments.push(data);
|
|
3318
|
+
data.data.forEach(row => { win.data.push(row); });
|
|
3321
3319
|
win.objs.push(obj);
|
|
3322
|
-
if (win.
|
|
3320
|
+
if (win.data.length >= winsize * 2 && win.objs.length >= 2) {
|
|
3323
3321
|
let winsize_ = 0;
|
|
3324
|
-
let i = win.
|
|
3322
|
+
let i = win.objs.length - 1;
|
|
3325
3323
|
// 往前移动至首个累计 winsize_ 超过 winsize 的位置
|
|
3326
3324
|
for (; winsize_ < winsize; i--)
|
|
3327
|
-
winsize_ += win.
|
|
3328
|
-
win.
|
|
3325
|
+
winsize_ += win.objs[i].value[0].rows;
|
|
3326
|
+
win.offset += win.data.length - winsize_;
|
|
3327
|
+
win.data = win.data.slice(-winsize_);
|
|
3329
3328
|
win.objs = win.objs.slice(i);
|
|
3330
|
-
win.offset += win.rows - winsize_;
|
|
3331
|
-
win.rows = winsize_;
|
|
3332
3329
|
}
|
|
3333
3330
|
}
|
|
3334
3331
|
this.streaming.handler({
|