dolphindb 2.0.504 → 2.0.507
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 +69 -39
- package/browser.js +174 -122
- package/browser.js.map +1 -1
- package/index.d.ts +68 -39
- package/index.js +172 -129
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -78,11 +78,10 @@ export interface DdbArrayVectorBlock {
|
|
|
78
78
|
lengths: Uint8Array | Uint16Array | Uint32Array;
|
|
79
79
|
data: DdbVectorValue;
|
|
80
80
|
}
|
|
81
|
-
export declare type DdbValue = null | boolean | number | [number, number] | bigint | string | string[] | Uint8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | Uint8Array[] | DdbObj[] | DdbFunctionDefValue | DdbSymbolExtendedValue | DdbArrayVectorBlock[];
|
|
82
|
-
export declare type DdbVectorValue = string | string[] | Uint8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | Uint8Array[] | DdbObj[] | DdbSymbolExtendedValue | DdbArrayVectorBlock[];
|
|
81
|
+
export declare type DdbValue = null | boolean | number | [number, number] | bigint | string | string[] | Uint8Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | Uint8Array[] | DdbObj[] | DdbFunctionDefValue | DdbSymbolExtendedValue | DdbArrayVectorBlock[];
|
|
82
|
+
export declare type DdbVectorValue = string | string[] | Uint8Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | Uint8Array[] | DdbObj[] | DdbSymbolExtendedValue | DdbArrayVectorBlock[];
|
|
83
83
|
export declare const nulls: {
|
|
84
|
-
readonly
|
|
85
|
-
readonly char: "";
|
|
84
|
+
readonly int8: -128;
|
|
86
85
|
readonly int16: -32768;
|
|
87
86
|
readonly int32: -2147483648;
|
|
88
87
|
readonly int64: -9223372036854775808n;
|
|
@@ -128,10 +127,11 @@ export declare class DdbObj<T extends DdbValue = DdbValue> {
|
|
|
128
127
|
datatype?: DdbType;
|
|
129
128
|
/** 实际数据。不同的 DdbForm, DdbType 使用 DdbValue 中不同的类型来表示实际数据 */
|
|
130
129
|
value: T;
|
|
130
|
+
/** 原始二进制数据,仅在 parse_object 为 false 时通过 parse_message 生成的顶层对象有这个属性 */
|
|
131
|
+
buffer?: Uint8Array;
|
|
131
132
|
constructor(data: Partial<DdbObj> & {
|
|
132
133
|
form: DdbForm;
|
|
133
134
|
type: DdbType;
|
|
134
|
-
length: number;
|
|
135
135
|
});
|
|
136
136
|
static parse(buf: Uint8Array, le: boolean): DdbObj<DdbValue>;
|
|
137
137
|
static parse_scalar(buf: Uint8Array, le: boolean, type: DdbType): [number, DdbValue];
|
|
@@ -157,7 +157,7 @@ export declare class DdbBool extends DdbObj<boolean> {
|
|
|
157
157
|
constructor(value: boolean | null);
|
|
158
158
|
}
|
|
159
159
|
export declare class DdbChar extends DdbObj<string> {
|
|
160
|
-
constructor(value: string | null);
|
|
160
|
+
constructor(value: string | number | null);
|
|
161
161
|
}
|
|
162
162
|
export declare class DdbInt extends DdbObj<number> {
|
|
163
163
|
constructor(value: number | null);
|
|
@@ -251,7 +251,6 @@ export declare class DDB {
|
|
|
251
251
|
/** utf-8 text decoder */
|
|
252
252
|
dec: TextDecoder;
|
|
253
253
|
enc: TextEncoder;
|
|
254
|
-
print_buffer: boolean;
|
|
255
254
|
/** DolphinDB WebSocket URL
|
|
256
255
|
e.g. `ws://127.0.0.1:8848/`, `wss://dolphindb.com`
|
|
257
256
|
*/
|
|
@@ -269,13 +268,13 @@ export declare class DDB {
|
|
|
269
268
|
password: string;
|
|
270
269
|
/** python session flag (2048) */
|
|
271
270
|
python: boolean;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
271
|
+
print_message_buffer: boolean;
|
|
272
|
+
print_object_buffer: boolean;
|
|
273
|
+
print_message: boolean;
|
|
274
|
+
parse_object: boolean;
|
|
275
|
+
/** DdbMessage listeners */
|
|
276
|
+
listeners: DdbMessageListener[];
|
|
277
|
+
promise: Promise<any>;
|
|
279
278
|
get connected(): boolean;
|
|
280
279
|
/**
|
|
281
280
|
Initialize an instance of DolphinDB Client using the WebSocket URL
|
|
@@ -304,6 +303,7 @@ export declare class DDB {
|
|
|
304
303
|
password?: string;
|
|
305
304
|
python?: boolean;
|
|
306
305
|
});
|
|
306
|
+
private on_message;
|
|
307
307
|
/** Establish the actual WebSocket connection to the DolphinDB corresponding to the URL
|
|
308
308
|
- options?:
|
|
309
309
|
- url?: DolphinDB WebSocket URL. By default, the WebSocket URL passed in when the instance is initialized is used
|
|
@@ -348,57 +348,86 @@ export declare class DDB {
|
|
|
348
348
|
- options:
|
|
349
349
|
- urgent?: 决定 `行为标识` 那一行字符串的取值(只适用于 script 和 function)
|
|
350
350
|
- vars?: type === 'variable' 时必传,variable 指令中待上传的变量名
|
|
351
|
+
- handler?: Process messages during this rpc (DdbMessage)
|
|
352
|
+
- parse_object?: 在该次 rpc 期间设置 parse_object, 结束后恢复原有,为 false 时返回的 DdbObj 仅含有 buffer 和 le,
|
|
353
|
+
不做解析,以便后续转发、序列化
|
|
351
354
|
*/
|
|
352
|
-
rpc<T extends DdbObj = DdbObj>(type: 'script' | 'function' | 'variable' | 'connect', { script, func, args, vars, urgent, }: {
|
|
355
|
+
rpc<T extends DdbObj = DdbObj>(type: 'script' | 'function' | 'variable' | 'connect', { script, func, args, vars, urgent, listener, parse_object, }: {
|
|
353
356
|
script?: string;
|
|
354
357
|
func?: string;
|
|
355
358
|
args?: (DdbObj | string | boolean)[];
|
|
356
359
|
vars?: string[];
|
|
357
360
|
urgent?: boolean;
|
|
361
|
+
listener?: DdbMessageListener;
|
|
362
|
+
parse_object?: boolean;
|
|
358
363
|
}): Promise<T>;
|
|
359
|
-
/** eval script through websocket (script command)
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
/** eval script through websocket (script command)
|
|
365
|
+
- script?: Script to execute
|
|
366
|
+
- options?: execution options
|
|
367
|
+
- urgent?: Urgent flag to ensure that submitted scripts are processed by urgent workers to prevent being blocked by other jobs
|
|
368
|
+
- listener?: Process messages during this rpc (DdbMessage)
|
|
369
|
+
- parse_object?: Set parse_object during this rpc, and restore the original after the end.
|
|
370
|
+
When it is false, the returned DdbObj only contains buffer and le without parsing,
|
|
371
|
+
so as to facilitate subsequent forwarding and serialization
|
|
372
|
+
*/
|
|
373
|
+
eval<T extends DdbObj>(script: string, { urgent, listener, parse_object, }?: {
|
|
366
374
|
urgent?: boolean;
|
|
375
|
+
listener?: DdbMessageListener;
|
|
376
|
+
parse_object?: boolean;
|
|
367
377
|
}): Promise<T>;
|
|
368
378
|
/** call function through websocket (function command)
|
|
369
|
-
- func:
|
|
370
|
-
- args?: `[ ]`
|
|
371
|
-
- options?:
|
|
372
|
-
- urgent?:
|
|
373
|
-
- node?:
|
|
374
|
-
- nodes?:
|
|
375
|
-
- func_type?:
|
|
376
|
-
- add_node_alias?:
|
|
379
|
+
- func: function name
|
|
380
|
+
- args?: `[ ]` Call parameters (the incoming native string and boolean will be automatically converted to DdbObj<string> and DdbObj<boolean>)
|
|
381
|
+
- options?: call options
|
|
382
|
+
- urgent?: Emergency flag. Use urgent worker execution to prevent being blocked by other jobs
|
|
383
|
+
- node?: When the node alias is set, it is sent to the corresponding node in the cluster for execution (using the rpc method in DolphinDB)
|
|
384
|
+
- nodes?: When setting multiple node aliases, send them to the corresponding multiple nodes in the cluster for execution (using the pnodeRun method in DolphinDB)
|
|
385
|
+
- func_type?: It must be passed when setting the node parameter, the function type needs to be specified, and it is not passed in other cases
|
|
386
|
+
- add_node_alias?: Select to pass when setting the nodes parameter, otherwise not pass
|
|
387
|
+
- listener?: Process messages during this rpc (DdbMessage)
|
|
388
|
+
- parse_object?: Set parse_object during this rpc, and restore the original after the end.
|
|
389
|
+
When it is false, the returned DdbObj only contains buffer and le without parsing,
|
|
390
|
+
so as to facilitate subsequent forwarding and serialization
|
|
377
391
|
*/
|
|
378
|
-
call<T extends DdbObj>(func: string, args?: (DdbObj | string | boolean)[], { urgent, node, nodes, func_type, add_node_alias }?: {
|
|
392
|
+
call<T extends DdbObj>(func: string, args?: (DdbObj | string | boolean)[], { urgent, node, nodes, func_type, add_node_alias, listener, parse_object, }?: {
|
|
379
393
|
urgent?: boolean;
|
|
380
394
|
node?: string;
|
|
381
395
|
nodes?: string[];
|
|
382
396
|
func_type?: DdbFunctionType;
|
|
383
397
|
add_node_alias?: boolean;
|
|
398
|
+
listener?: DdbMessageListener;
|
|
399
|
+
parse_object?: boolean;
|
|
384
400
|
}): Promise<T>;
|
|
385
401
|
/** upload variable through websocket (variable command) */
|
|
386
402
|
upload(
|
|
387
403
|
/** Uploaded variables' name */
|
|
388
404
|
vars: string[],
|
|
389
405
|
/** Uploaded variables' value */
|
|
390
|
-
args: (DdbObj | string | boolean)[]
|
|
406
|
+
args: (DdbObj | string | boolean)[], { listener, parse_object, }?: {
|
|
407
|
+
listener?: DdbMessageListener;
|
|
408
|
+
parse_object?: boolean;
|
|
409
|
+
}): Promise<DdbObj<DdbValue>>;
|
|
391
410
|
/** 解析服务端响应报文,返回去掉 header 的 data buf */
|
|
392
|
-
parse_message(buf: Uint8Array):
|
|
393
|
-
type: "message";
|
|
394
|
-
data: string;
|
|
395
|
-
} | {
|
|
396
|
-
type: "object";
|
|
397
|
-
data: Uint8Array;
|
|
398
|
-
};
|
|
411
|
+
parse_message(buf: Uint8Array, parse_object?: boolean): DdbMessage;
|
|
399
412
|
/** 自动转换 js string, boolean 为 DdbObj */
|
|
400
413
|
to_ddbobj(value: DdbObj | string | boolean): DdbObj;
|
|
401
414
|
/** 转换 js 数组为 DdbObj[] */
|
|
402
415
|
to_ddbobjs(values: any[]): DdbObj<DdbValue>[];
|
|
403
416
|
}
|
|
417
|
+
export interface DdbMessageListener {
|
|
418
|
+
(message: DdbMessage, _this: DDB): any;
|
|
419
|
+
}
|
|
420
|
+
export interface DdbPrintMessage {
|
|
421
|
+
type: 'print';
|
|
422
|
+
data: string;
|
|
423
|
+
}
|
|
424
|
+
export interface DdbObjectMessage {
|
|
425
|
+
type: 'object';
|
|
426
|
+
data: DdbObj;
|
|
427
|
+
}
|
|
428
|
+
export interface DdbErrorMessage {
|
|
429
|
+
type: 'error';
|
|
430
|
+
data: Error;
|
|
431
|
+
}
|
|
432
|
+
export declare type DdbMessage = DdbPrintMessage | DdbObjectMessage | DdbErrorMessage;
|
|
404
433
|
export default DDB;
|