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