dolphindb 3.1.39 → 3.1.42
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 +10 -14
- package/browser.js +12 -30
- package/browser.js.map +1 -1
- package/common.d.ts +132 -110
- package/common.js +111 -111
- package/common.js.map +1 -1
- package/index.d.ts +11 -15
- package/index.js +13 -29
- package/index.js.map +1 -1
- package/package.json +7 -7
- package/test.js.map +1 -1
- package/unused.js +1 -0
- package/unused.js.map +1 -1
package/browser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Dayjs } from 'dayjs';
|
|
2
2
|
import { Lock } from 'xshell/utils.browser.js';
|
|
3
3
|
import { type WebSocketConnectionError } from 'xshell/net.browser.js';
|
|
4
|
-
import { DdbChartType, DdbForm, DdbFunctionType, DdbType, DdbVoidType, type ConvertOptions, type DdbDecimal32Value, type DdbDecimal32VectorValue, type DdbDecimal64Value, type DdbDecimal64VectorValue, type DdbDurationValue, type DdbDurationVectorValue, type DdbFunctionDefValue, type DdbRpcType, type DdbScalarValue, type DdbSymbolExtendedValue, type DdbTableData, type DdbTensorValue, type IotVectorItemValue, type TensorData, type DdbExtObjValue, type ConvertableDdbTimeValue, type DdbLanguage } from './common.ts';
|
|
4
|
+
import { DdbChartType, DdbForm, DdbFunctionType, DdbType, DdbVoidType, SqlStandard, type ConvertOptions, type DdbDecimal32Value, type DdbDecimal32VectorValue, type DdbDecimal64Value, type DdbDecimal64VectorValue, type DdbDurationValue, type DdbDurationVectorValue, type DdbFunctionDefValue, type DdbRpcType, type DdbScalarValue, type DdbSymbolExtendedValue, type DdbTableData, type DdbTensorValue, type IotVectorItemValue, type TensorData, type DdbExtObjValue, type ConvertableDdbTimeValue, type DdbLanguage } from './common.ts';
|
|
5
5
|
export * from './common.ts';
|
|
6
6
|
export interface DdbDecimal128VectorValue {
|
|
7
7
|
scale: number;
|
|
@@ -47,7 +47,9 @@ export interface DdbChartValue {
|
|
|
47
47
|
z_axis?: string;
|
|
48
48
|
};
|
|
49
49
|
extras?: {
|
|
50
|
-
multi_y_axes
|
|
50
|
+
multi_y_axes?: boolean;
|
|
51
|
+
/** 自适应 y 轴,而不是从 0 刻度开始 */
|
|
52
|
+
auto_scale_y_axes?: boolean;
|
|
51
53
|
};
|
|
52
54
|
data: DdbMatrixObj;
|
|
53
55
|
}
|
|
@@ -138,7 +140,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
|
|
|
138
140
|
strides: number[];
|
|
139
141
|
}, limit?: number): TensorData;
|
|
140
142
|
toString(options?: InspectOptions): string;
|
|
141
|
-
inspect_type():
|
|
143
|
+
inspect_type(): any;
|
|
142
144
|
/** 自动转换 Convertable 为 DdbObj */
|
|
143
145
|
static to_ddbobj(value: Convertable): DdbObj;
|
|
144
146
|
/** 转换 js 数组为 DdbObj[] */
|
|
@@ -185,7 +187,7 @@ export interface InspectOptions {
|
|
|
185
187
|
export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
|
|
186
188
|
/** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
|
|
187
189
|
export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
|
|
188
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] |
|
|
190
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | string[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | DdbExtObjValue | DdbTensorValue | Uint8Array<ArrayBufferLike> | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | IotVectorItemValue | DdbArrayVectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue;
|
|
189
191
|
/** 转换一个向量到 js 原生数组 */
|
|
190
192
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
|
|
191
193
|
/** 构造 void 类型,默认为 `DdbVoidType.undefined` */
|
|
@@ -362,19 +364,13 @@ export declare class DdbDatabaseError extends Error {
|
|
|
362
364
|
options: DdbRpcOptions;
|
|
363
365
|
constructor(message: string, url: string, type: DdbRpcType, options: DdbRpcOptions, id: number);
|
|
364
366
|
}
|
|
365
|
-
/** SQL Standrd 标准类型 */
|
|
366
|
-
export declare enum SqlStandard {
|
|
367
|
-
DolphinDB = 0,
|
|
368
|
-
Oracle = 1,
|
|
369
|
-
MySQL = 2
|
|
370
|
-
}
|
|
371
367
|
export interface DdbOptions {
|
|
372
368
|
autologin?: boolean;
|
|
373
369
|
ticket?: string;
|
|
374
370
|
username?: string;
|
|
375
371
|
password?: string;
|
|
376
372
|
python?: boolean;
|
|
377
|
-
|
|
373
|
+
q?: boolean;
|
|
378
374
|
sql?: SqlStandard;
|
|
379
375
|
streaming?: StreamingParams;
|
|
380
376
|
verbose?: boolean;
|
|
@@ -414,8 +410,8 @@ export declare class DDB {
|
|
|
414
410
|
password: string;
|
|
415
411
|
/** python session flag (2048) */
|
|
416
412
|
python: boolean;
|
|
417
|
-
/**
|
|
418
|
-
|
|
413
|
+
/** q session flag (4096) */
|
|
414
|
+
q: boolean;
|
|
419
415
|
/** 是否为 dolphindb 语言 */
|
|
420
416
|
dolphindb: boolean;
|
|
421
417
|
language: DdbLanguage;
|
|
@@ -458,7 +454,7 @@ export declare class DDB {
|
|
|
458
454
|
- username?: DolphinDB 登录用户名,默认 `'admin'` DolphinDB username, default `'admin'`
|
|
459
455
|
- password?: DolphinDB 登录密码,默认 `'123456'` DolphinDB password, default `'123456'`
|
|
460
456
|
- python?: 设置 python session flag,默认 `false` set python session flag, default `false`
|
|
461
|
-
-
|
|
457
|
+
- q?: 设置 q session flag,默认 `false` set q session flag, default `false`
|
|
462
458
|
- streaming?: 设置该选项后,该 WebSocket 连接只用于流数据 When this option is set, the WebSocket connection is only used for streaming data
|
|
463
459
|
- verbose?: 是否打印每个 rpc 的信息用于调试
|
|
464
460
|
- sql?: 设置当前会话执行的 sql 标准, 请使用 SqlStandard 枚举进行传参,默认 `DolphinDB`
|
package/browser.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { empty } from 'xshell/prototype.browser.js';
|
|
1
|
+
import { empty, to_lower_camel_case } from 'xshell/prototype.browser.js';
|
|
2
2
|
import { blue, cyan, green, gray, magenta } from 'xshell/chalk.browser.js';
|
|
3
|
-
import { concat, assert, Lock, genid, seq, zip_object, decode, check } from 'xshell/utils.browser.js';
|
|
3
|
+
import { concat, assert, Lock, genid, seq, zip_object, decode, check, map_keys } from 'xshell/utils.browser.js';
|
|
4
4
|
import { connect_websocket } from 'xshell/net.browser.js';
|
|
5
5
|
import { t } from "./i18n/index.js";
|
|
6
|
-
import { ddb_tensor_bytes, DdbChartType, DdbDurationUnit, DdbForm, generate_array_type, DdbFunctionType, DdbType, DdbVoidType, dictables, function_definition_patterns, get_big_int_128, get_time_ddbobj, get_duration_unit, get_type_name, int1282str, ipaddr2str, is_decimal_null_value, is_decimal_type, time_formatters, number_nulls, nulls, set_big_int_128, uuid2str, get_times_ddbobj, funcdefs, get_number_formatter, urgent } from "./common.js";
|
|
6
|
+
import { ddb_tensor_bytes, DdbChartType, DdbDurationUnit, DdbForm, generate_array_type, DdbFunctionType, DdbType, DdbVoidType, dictables, function_definition_patterns, get_big_int_128, get_time_ddbobj, get_duration_unit, get_type_name, int1282str, ipaddr2str, is_decimal_null_value, is_decimal_type, time_formatters, number_nulls, nulls, set_big_int_128, SqlStandard, uuid2str, get_times_ddbobj, funcdefs, get_number_formatter, urgent } from "./common.js";
|
|
7
7
|
export * from "./common.js";
|
|
8
8
|
/** 可以表示所有 DolphinDB 数据库中的数据类型 Can represent data types in all DolphinDB databases */
|
|
9
9
|
export class DdbObj {
|
|
@@ -172,15 +172,7 @@ export class DdbObj {
|
|
|
172
172
|
},
|
|
173
173
|
...bin_start ? { bin_start, bin_end, } : {},
|
|
174
174
|
...bin_count ? { bin_count } : {},
|
|
175
|
-
...extras ? (()
|
|
176
|
-
const { multiYAxes: multi_y_axes = false, ...extras_others } = extras.to_dict({ strip: true });
|
|
177
|
-
return {
|
|
178
|
-
extras: {
|
|
179
|
-
multi_y_axes,
|
|
180
|
-
...extras_others,
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
})() : {},
|
|
175
|
+
...extras ? { extras: map_keys(extras.data()) } : {},
|
|
184
176
|
data,
|
|
185
177
|
...others,
|
|
186
178
|
};
|
|
@@ -956,10 +948,7 @@ export class DdbObj {
|
|
|
956
948
|
...bin_start ? { binStart: bin_start, binEnd: bin_end } : {},
|
|
957
949
|
...bin_count ? { binCount: bin_count } : {},
|
|
958
950
|
title: new DdbVectorString([chart, x_axis, y_axis, z_axis]),
|
|
959
|
-
...extras ? (()
|
|
960
|
-
const { multi_y_axes, ...extras_other } = extras;
|
|
961
|
-
return { extras: new DdbDict({ multiYAxes: multi_y_axes, ...extras_other }) };
|
|
962
|
-
})() : {},
|
|
951
|
+
...extras ? { extras: new DdbDict(map_keys(extras, to_lower_camel_case)) } : {},
|
|
963
952
|
data,
|
|
964
953
|
});
|
|
965
954
|
return [keys.pack(), values.pack()];
|
|
@@ -2402,13 +2391,6 @@ export class DdbDatabaseError extends Error {
|
|
|
2402
2391
|
this.id = id;
|
|
2403
2392
|
}
|
|
2404
2393
|
}
|
|
2405
|
-
/** SQL Standrd 标准类型 */
|
|
2406
|
-
export var SqlStandard;
|
|
2407
|
-
(function (SqlStandard) {
|
|
2408
|
-
SqlStandard[SqlStandard["DolphinDB"] = 0] = "DolphinDB";
|
|
2409
|
-
SqlStandard[SqlStandard["Oracle"] = 1] = "Oracle";
|
|
2410
|
-
SqlStandard[SqlStandard["MySQL"] = 2] = "MySQL";
|
|
2411
|
-
})(SqlStandard || (SqlStandard = {}));
|
|
2412
2394
|
export class DDB {
|
|
2413
2395
|
/** 当前的 session id (http 或 tcp) */
|
|
2414
2396
|
sid = '0';
|
|
@@ -2434,8 +2416,8 @@ export class DDB {
|
|
|
2434
2416
|
password = '123456';
|
|
2435
2417
|
/** python session flag (2048) */
|
|
2436
2418
|
python = false;
|
|
2437
|
-
/**
|
|
2438
|
-
|
|
2419
|
+
/** q session flag (4096) */
|
|
2420
|
+
q = false;
|
|
2439
2421
|
/** 是否为 dolphindb 语言 */
|
|
2440
2422
|
dolphindb = true;
|
|
2441
2423
|
language = 'dolphindb';
|
|
@@ -2481,7 +2463,7 @@ export class DDB {
|
|
|
2481
2463
|
- username?: DolphinDB 登录用户名,默认 `'admin'` DolphinDB username, default `'admin'`
|
|
2482
2464
|
- password?: DolphinDB 登录密码,默认 `'123456'` DolphinDB password, default `'123456'`
|
|
2483
2465
|
- python?: 设置 python session flag,默认 `false` set python session flag, default `false`
|
|
2484
|
-
-
|
|
2466
|
+
- q?: 设置 q session flag,默认 `false` set q session flag, default `false`
|
|
2485
2467
|
- streaming?: 设置该选项后,该 WebSocket 连接只用于流数据 When this option is set, the WebSocket connection is only used for streaming data
|
|
2486
2468
|
- verbose?: 是否打印每个 rpc 的信息用于调试
|
|
2487
2469
|
- sql?: 设置当前会话执行的 sql 标准, 请使用 SqlStandard 枚举进行传参,默认 `DolphinDB`
|
|
@@ -2512,9 +2494,9 @@ export class DDB {
|
|
|
2512
2494
|
this.dolphindb = false;
|
|
2513
2495
|
this.language = 'python';
|
|
2514
2496
|
}
|
|
2515
|
-
if (options.
|
|
2497
|
+
if (options.q !== undefined && (this.q = Boolean(options.q))) {
|
|
2516
2498
|
this.dolphindb = false;
|
|
2517
|
-
this.language = '
|
|
2499
|
+
this.language = 'q';
|
|
2518
2500
|
}
|
|
2519
2501
|
if (options.sql !== undefined)
|
|
2520
2502
|
this.sql = options.sql;
|
|
@@ -2617,8 +2599,8 @@ export class DDB {
|
|
|
2617
2599
|
// python session
|
|
2618
2600
|
if (this.python)
|
|
2619
2601
|
flag += 2048;
|
|
2620
|
-
//
|
|
2621
|
-
if (this.
|
|
2602
|
+
// q session
|
|
2603
|
+
if (this.q)
|
|
2622
2604
|
flag += 4096;
|
|
2623
2605
|
// sql standrd
|
|
2624
2606
|
flag += 2 ** 19 * this.sql;
|