dolphindb 2.0.518 → 2.0.521
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 +77 -19
- package/browser.js +207 -66
- package/browser.js.map +1 -1
- package/index.d.ts +72 -14
- package/index.js +204 -63
- package/index.js.map +1 -1
- package/package.json +6 -6
package/browser.d.ts
CHANGED
|
@@ -8,13 +8,14 @@ export declare enum DdbForm {
|
|
|
8
8
|
dict = 5,
|
|
9
9
|
table = 6,
|
|
10
10
|
chart = 7,
|
|
11
|
+
/** Node internal communication may be used, calling function execution script generally does not return this type */
|
|
11
12
|
chunk = 8,
|
|
12
13
|
/** sysobj */
|
|
13
14
|
object = 9
|
|
14
15
|
}
|
|
15
16
|
/** DolphinDB DataType
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
The corresponding array vector type is 64 + base type
|
|
18
|
+
The corresponding extended type is 128 + base type
|
|
18
19
|
*/
|
|
19
20
|
export declare enum DdbType {
|
|
20
21
|
void = 0,
|
|
@@ -104,6 +105,33 @@ export interface DdbMatrixValue {
|
|
|
104
105
|
cols: DdbObj<DdbVectorValue>;
|
|
105
106
|
data: DdbVectorValue;
|
|
106
107
|
}
|
|
108
|
+
export declare type DdbDictValue = [DdbObj<DdbVectorValue>, DdbObj<DdbVectorValue>];
|
|
109
|
+
export declare enum DdbChartType {
|
|
110
|
+
area = 0,
|
|
111
|
+
bar = 1,
|
|
112
|
+
column = 2,
|
|
113
|
+
histogram = 3,
|
|
114
|
+
line = 4,
|
|
115
|
+
pie = 5,
|
|
116
|
+
scatter = 6,
|
|
117
|
+
trend = 7,
|
|
118
|
+
kline = 8,
|
|
119
|
+
stack = 9
|
|
120
|
+
}
|
|
121
|
+
export interface DdbChartValue {
|
|
122
|
+
/** 原属性 chartType */
|
|
123
|
+
type: DdbChartType;
|
|
124
|
+
stacking: boolean;
|
|
125
|
+
titles: {
|
|
126
|
+
chart: string;
|
|
127
|
+
x_axis: string;
|
|
128
|
+
y_axis: string;
|
|
129
|
+
};
|
|
130
|
+
extras: {
|
|
131
|
+
multi_y_axis: boolean;
|
|
132
|
+
};
|
|
133
|
+
data: DdbObj<DdbMatrixValue>;
|
|
134
|
+
}
|
|
107
135
|
export declare type DdbScalarValue = null | boolean | number | bigint | string | Uint8Array | // uuid, ipaddr, int128, blob
|
|
108
136
|
[
|
|
109
137
|
number,
|
|
@@ -114,7 +142,7 @@ export declare type DdbVectorValue = Uint8Array | Int8Array | Int16Array | Int32
|
|
|
114
142
|
Uint8Array[] | // blob
|
|
115
143
|
DdbObj[] | // any
|
|
116
144
|
DdbSymbolExtendedValue | DdbArrayVectorBlock[];
|
|
117
|
-
export declare type DdbValue = DdbScalarValue | DdbVectorValue | DdbMatrixValue;
|
|
145
|
+
export declare type DdbValue = DdbScalarValue | DdbVectorValue | DdbMatrixValue | DdbDictValue | DdbChartValue;
|
|
118
146
|
export declare const nulls: {
|
|
119
147
|
readonly int8: -128;
|
|
120
148
|
readonly int16: -32768;
|
|
@@ -179,16 +207,32 @@ export declare class DdbObj<T extends DdbValue = DdbValue> {
|
|
|
179
207
|
];
|
|
180
208
|
pack(): Uint8Array;
|
|
181
209
|
static pack_vector_body(value: DdbVectorValue, type: DdbType, length: number): ArrayBufferView[];
|
|
182
|
-
toString():
|
|
210
|
+
toString(): any;
|
|
211
|
+
/** 自动转换 js string, boolean 为 DdbObj */
|
|
212
|
+
static to_ddbobj(value: DdbObj | string | boolean): DdbObj;
|
|
213
|
+
/** 转换 js 数组为 DdbObj[] */
|
|
214
|
+
static to_ddbobjs(values: any[]): DdbObj<DdbValue>[];
|
|
183
215
|
to_cols(): {
|
|
184
216
|
title: string;
|
|
185
217
|
dataIndex: string;
|
|
186
218
|
render?: any;
|
|
187
219
|
}[];
|
|
188
220
|
to_rows<T extends Record<string, any> = Record<string, any>>(): T[];
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
221
|
+
/** Automatically convert dict<string, any> to js object (Record<string, any>)
|
|
222
|
+
- options?:
|
|
223
|
+
- strip?: `false` Whether to directly extract and strip the value in DdbObj as the value of js object (discard the rest of the information in DdbObj, only keep the value)
|
|
224
|
+
- deep?: `false` whether to convert recursively
|
|
225
|
+
*/
|
|
226
|
+
to_dict<T extends Record<string, DdbObj> = Record<string, DdbObj>>(): T;
|
|
227
|
+
to_dict<T extends Record<string, any> = Record<string, any>>(options: {
|
|
228
|
+
strip: true;
|
|
229
|
+
}): T;
|
|
230
|
+
to_dict<T extends Record<string, any> = Record<string, any>>(options?: {
|
|
231
|
+
strip?: boolean;
|
|
232
|
+
deep?: boolean;
|
|
233
|
+
}): T;
|
|
234
|
+
}
|
|
235
|
+
export declare function format(type: DdbType, value: DdbValue, le: boolean): any;
|
|
192
236
|
export declare class DdbVoid extends DdbObj<undefined> {
|
|
193
237
|
constructor();
|
|
194
238
|
}
|
|
@@ -235,7 +279,7 @@ export declare class DdbVectorString extends DdbObj<string[]> {
|
|
|
235
279
|
constructor(strings: string[], name?: string);
|
|
236
280
|
}
|
|
237
281
|
export declare class DdbVectorAny extends DdbObj {
|
|
238
|
-
constructor(objs: DdbObj
|
|
282
|
+
constructor(objs: (DdbObj | string | boolean)[], name?: string);
|
|
239
283
|
}
|
|
240
284
|
export declare class DdbVectorSymbol extends DdbObj<DdbSymbolExtendedValue> {
|
|
241
285
|
constructor(strings: string[], name?: string);
|
|
@@ -249,23 +293,39 @@ export declare class DdbSetDouble extends DdbObj<Float64Array> {
|
|
|
249
293
|
export declare class DdbSetString extends DdbObj<string[]> {
|
|
250
294
|
constructor(strings: string[] | Set<string>);
|
|
251
295
|
}
|
|
296
|
+
/** Constructs a DdbDict object, which supports two usages:
|
|
297
|
+
- The incoming type is the keys of DdbObj<DdbVectorValue>, and the two parameters of values directly form the DdbDict of dict<keys.type, values.type>
|
|
298
|
+
- Pass in js object (type is Record<string, boolean | string | DdbObj>), automatically converted to DdbDict of dict<string, any>
|
|
299
|
+
*/
|
|
300
|
+
export declare class DdbDict extends DdbObj<DdbDictValue> {
|
|
301
|
+
constructor(obj: Record<string, boolean | string | DdbObj>);
|
|
302
|
+
constructor(keys: DdbObj<DdbVectorValue>, values: DdbObj<DdbVectorValue>);
|
|
303
|
+
}
|
|
252
304
|
export declare class DdbTable extends DdbObj<DdbObj[]> {
|
|
253
305
|
constructor(columns: DdbObj[], name?: string);
|
|
254
306
|
}
|
|
255
|
-
export declare function
|
|
307
|
+
export declare function date2ms(date: number | null): number;
|
|
308
|
+
export declare function date2str(date: number | null, format?: string): string;
|
|
309
|
+
export declare function month2ms(month: number | null): number | null;
|
|
256
310
|
export declare function month2str(month: number | null): string;
|
|
257
|
-
export declare function
|
|
311
|
+
export declare function time2ms(time: number | null): number | null;
|
|
312
|
+
export declare function time2str(time: number | null, format?: string): string;
|
|
313
|
+
export declare function minute2ms(minute: number | null): number | null;
|
|
258
314
|
export declare function minute2str(minute: number | null, format?: string): string;
|
|
315
|
+
export declare function second2ms(second: number | null): number | null;
|
|
259
316
|
export declare function second2str(second: number | null, format?: string): string;
|
|
260
|
-
export declare function
|
|
317
|
+
export declare function datetime2ms(datetime: number | null): number | null;
|
|
318
|
+
export declare function datetime2str(datetime: number | null, format?: string): string;
|
|
319
|
+
export declare function timestamp2ms(timestamp: bigint | null): number | null;
|
|
261
320
|
/** format timestamp (bigint) to string
|
|
262
321
|
- timestamp: bigint value
|
|
263
322
|
- format?:
|
|
264
323
|
format string, default to `YYYY.MM.DD HH:mm:ss.SSS`
|
|
265
324
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
266
325
|
*/
|
|
267
|
-
export declare function timestamp2str(timestamp: bigint, format?: string): string;
|
|
268
|
-
export declare function
|
|
326
|
+
export declare function timestamp2str(timestamp: bigint | null, format?: string): string;
|
|
327
|
+
export declare function datehour2ms(datehour: number | null): number | null;
|
|
328
|
+
export declare function datehour2str(datehour: number | null, format?: string): string;
|
|
269
329
|
/** parse timestamp string to bigint value
|
|
270
330
|
- str: timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
|
|
271
331
|
- format?:
|
|
@@ -273,7 +333,9 @@ export declare function datehour2str(datehour: number, format?: string): string;
|
|
|
273
333
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
274
334
|
*/
|
|
275
335
|
export declare function str2timestamp(str: string, format?: string): bigint;
|
|
276
|
-
export declare function
|
|
336
|
+
export declare function nanotime2ns(nanotime: bigint | null): bigint | null;
|
|
337
|
+
export declare function nanotime2str(nanotime: bigint | null, format?: string): string;
|
|
338
|
+
export declare function nanotimestamp2ns(nanotimestamp: bigint | null): bigint | null;
|
|
277
339
|
/** format nanotimestamp value (bigint) to string
|
|
278
340
|
- nanotimestamp: bigint value
|
|
279
341
|
- format?:
|
|
@@ -281,7 +343,7 @@ export declare function nanotime2str(nanotime: bigint, format?: string): string;
|
|
|
281
343
|
Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
|
|
282
344
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
283
345
|
*/
|
|
284
|
-
export declare function nanotimestamp2str(nanotimestamp: bigint, format?: string): string;
|
|
346
|
+
export declare function nanotimestamp2str(nanotimestamp: bigint | null, format?: string): string;
|
|
285
347
|
/** parse nano timestamp string to bigint value
|
|
286
348
|
- str: nano timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
|
|
287
349
|
- format?:
|
|
@@ -457,10 +519,6 @@ export declare class DDB {
|
|
|
457
519
|
}): Promise<DdbObj<DdbValue>>;
|
|
458
520
|
/** 解析服务端响应报文,返回去掉 header 的 data buf */
|
|
459
521
|
parse_message(buf: Uint8Array, parse_object?: boolean): DdbMessage;
|
|
460
|
-
/** 自动转换 js string, boolean 为 DdbObj */
|
|
461
|
-
to_ddbobj(value: DdbObj | string | boolean): DdbObj;
|
|
462
|
-
/** 转换 js 数组为 DdbObj[] */
|
|
463
|
-
to_ddbobjs(values: any[]): DdbObj<DdbValue>[];
|
|
464
522
|
}
|
|
465
523
|
export interface DdbMessageListener {
|
|
466
524
|
(message: DdbMessage, _this: DDB): any;
|