dolphindb 3.1.3 → 3.1.6
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 +17 -3
- package/browser.js +44 -22
- package/browser.js.map +1 -1
- package/common.d.ts +15 -2
- package/common.js +49 -23
- package/common.js.map +1 -1
- package/i18n/dict.json +3 -0
- package/index.d.ts +17 -2
- package/index.js +44 -22
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/test.js.map +1 -1
package/browser.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Dayjs } from 'dayjs';
|
|
2
|
-
import 'xshell/prototype.browser.js';
|
|
3
2
|
import { Lock } from 'xshell/utils.browser.js';
|
|
4
3
|
import { type WebSocketConnectionError } from 'xshell/net.browser.js';
|
|
5
|
-
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 } from './common.ts';
|
|
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 } from './common.ts';
|
|
6
5
|
export * from './common.ts';
|
|
7
6
|
export interface DdbDecimal128VectorValue {
|
|
8
7
|
scale: number;
|
|
@@ -185,7 +184,7 @@ export interface InspectOptions {
|
|
|
185
184
|
export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
|
|
186
185
|
/** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
|
|
187
186
|
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 | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue |
|
|
187
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | string[] | number[] | 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
188
|
/** 转换一个向量到 js 原生数组 */
|
|
190
189
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
|
|
191
190
|
/** 构造 void 类型,默认为 `DdbVoidType.undefined` */
|
|
@@ -252,6 +251,21 @@ export declare class DdbVectorSymbol extends DdbObj<DdbSymbolExtendedValue> {
|
|
|
252
251
|
export declare class DdbVectorChar extends DdbObj<Int8Array> {
|
|
253
252
|
constructor(chars?: Uint8Array | Int8Array | ArrayBuffer, name?: string);
|
|
254
253
|
}
|
|
254
|
+
export declare class DdbVectorBool extends DdbObj<Int8Array> {
|
|
255
|
+
constructor(bools?: (boolean | null)[], name?: string);
|
|
256
|
+
}
|
|
257
|
+
export declare class DdbVectorDatetime extends DdbObj<Int32Array> {
|
|
258
|
+
constructor(datetimes?: ConvertableDdbTimeValue[], name?: string);
|
|
259
|
+
}
|
|
260
|
+
export declare class DdbVectorTimeStamp extends DdbObj<BigInt64Array> {
|
|
261
|
+
constructor(timestamps?: ConvertableDdbTimeValue[], name?: string);
|
|
262
|
+
}
|
|
263
|
+
export declare class DdbVectorNanoTimeStamp extends DdbObj<BigInt64Array> {
|
|
264
|
+
constructor(nanotimestamps?: ConvertableDdbTimeValue[], name?: string);
|
|
265
|
+
}
|
|
266
|
+
export declare class DdbVectorDate extends DdbObj<BigInt64Array> {
|
|
267
|
+
constructor(dates?: ConvertableDdbTimeValue[], name?: string);
|
|
268
|
+
}
|
|
255
269
|
export declare class DdbSetInt extends DdbObj<Int32Array> {
|
|
256
270
|
constructor(ints: (number | null)[] | Set<number> | Int32Array);
|
|
257
271
|
}
|
package/browser.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import 'xshell/prototype.browser.js';
|
|
1
|
+
import { empty } from 'xshell/prototype.browser.js';
|
|
2
2
|
import { blue, cyan, green, grey, magenta } from 'xshell/chalk.browser.js';
|
|
3
3
|
import { concat, assert, Lock, genid, seq, zip_object, decode, delay, check } 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 { date2str, datehour2str, datetime2str, ddb_tensor_bytes, DdbChartType, DdbDurationUnit, DdbForm, DdbFunctionType, DdbType, DdbVoidType, dictables, function_definition_pattern, generate_array_type, get_big_int_128,
|
|
6
|
+
import { date2str, datehour2str, datetime2str, ddb_tensor_bytes, DdbChartType, DdbDurationUnit, DdbForm, DdbFunctionType, DdbType, DdbVoidType, dictables, function_definition_pattern, generate_array_type, get_big_int_128, get_time_ddbobj, get_duration_unit, get_type_name, int1282str, ipaddr2str, is_decimal_null_value, is_decimal_type, minute2str, month2str, nanotime2str, nanotimestamp2str, nulls, second2str, set_big_int_128, time2str, timestamp2str, uuid2str, get_times_ddbobj } 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 {
|
|
@@ -2097,38 +2097,22 @@ export class DdbDouble extends DdbObj {
|
|
|
2097
2097
|
}
|
|
2098
2098
|
export class DdbDateTime extends DdbObj {
|
|
2099
2099
|
constructor(value) {
|
|
2100
|
-
super(
|
|
2101
|
-
form: DdbForm.scalar,
|
|
2102
|
-
type: DdbType.datetime,
|
|
2103
|
-
value: get_ddb_time_value('DdbDateTime', value)
|
|
2104
|
-
});
|
|
2100
|
+
super(get_time_ddbobj(DdbType.datetime, value));
|
|
2105
2101
|
}
|
|
2106
2102
|
}
|
|
2107
2103
|
export class DdbTimeStamp extends DdbObj {
|
|
2108
2104
|
constructor(value) {
|
|
2109
|
-
super(
|
|
2110
|
-
form: DdbForm.scalar,
|
|
2111
|
-
type: DdbType.timestamp,
|
|
2112
|
-
value: get_ddb_time_value('DdbTimeStamp', value)
|
|
2113
|
-
});
|
|
2105
|
+
super(get_time_ddbobj(DdbType.timestamp, value));
|
|
2114
2106
|
}
|
|
2115
2107
|
}
|
|
2116
2108
|
export class DdbNanoTimeStamp extends DdbObj {
|
|
2117
2109
|
constructor(value) {
|
|
2118
|
-
super(
|
|
2119
|
-
form: DdbForm.scalar,
|
|
2120
|
-
type: DdbType.nanotimestamp,
|
|
2121
|
-
value: get_ddb_time_value('DdbNanoTimeStamp', value)
|
|
2122
|
-
});
|
|
2110
|
+
super(get_time_ddbobj(DdbType.nanotimestamp, value));
|
|
2123
2111
|
}
|
|
2124
2112
|
}
|
|
2125
2113
|
export class DdbDate extends DdbObj {
|
|
2126
2114
|
constructor(value) {
|
|
2127
|
-
super(
|
|
2128
|
-
form: DdbForm.scalar,
|
|
2129
|
-
type: DdbType.date,
|
|
2130
|
-
value: get_ddb_time_value('DdbDate', value)
|
|
2131
|
-
});
|
|
2115
|
+
super(get_time_ddbobj(DdbType.date, value));
|
|
2132
2116
|
}
|
|
2133
2117
|
}
|
|
2134
2118
|
export class DdbBlob extends DdbObj {
|
|
@@ -2291,6 +2275,44 @@ export class DdbVectorChar extends DdbObj {
|
|
|
2291
2275
|
});
|
|
2292
2276
|
}
|
|
2293
2277
|
}
|
|
2278
|
+
export class DdbVectorBool extends DdbObj {
|
|
2279
|
+
constructor(bools, name) {
|
|
2280
|
+
const length = bools?.length || 0;
|
|
2281
|
+
let value = new Int8Array(length);
|
|
2282
|
+
for (let i = 0; i < length; ++i) {
|
|
2283
|
+
const x = bools[i];
|
|
2284
|
+
value[i] = empty(x) ? nulls.int8 : x ? 1 : 0;
|
|
2285
|
+
}
|
|
2286
|
+
super({
|
|
2287
|
+
form: DdbForm.vector,
|
|
2288
|
+
type: DdbType.bool,
|
|
2289
|
+
rows: length,
|
|
2290
|
+
cols: 1,
|
|
2291
|
+
value,
|
|
2292
|
+
name
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
export class DdbVectorDatetime extends DdbObj {
|
|
2297
|
+
constructor(datetimes, name) {
|
|
2298
|
+
super(get_times_ddbobj(DdbType.datetime, datetimes, name));
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
export class DdbVectorTimeStamp extends DdbObj {
|
|
2302
|
+
constructor(timestamps, name) {
|
|
2303
|
+
super(get_times_ddbobj(DdbType.timestamp, timestamps, name));
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
export class DdbVectorNanoTimeStamp extends DdbObj {
|
|
2307
|
+
constructor(nanotimestamps, name) {
|
|
2308
|
+
super(get_times_ddbobj(DdbType.nanotimestamp, nanotimestamps, name));
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
export class DdbVectorDate extends DdbObj {
|
|
2312
|
+
constructor(dates, name) {
|
|
2313
|
+
super(get_times_ddbobj(DdbType.date, dates, name));
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2294
2316
|
export class DdbSetInt extends DdbObj {
|
|
2295
2317
|
constructor(ints) {
|
|
2296
2318
|
super({
|