dolphindb 2.0.502 → 2.0.503
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 +38 -11
- package/browser.js +54 -11
- package/browser.js.map +1 -1
- package/index.d.ts +35 -10
- package/index.js +51 -10
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/test/index.d.ts +0 -1
- package/test/index.js +0 -20
- package/test/index.js.map +0 -1
- package/test/print.d.ts +0 -2
- package/test/print.js +0 -20
- package/test/print.js.map +0 -1
- package/test/types.d.ts +0 -2
- package/test/types.js +0 -24
- package/test/types.js.map +0 -1
- package/test.d.ts +0 -1
- package/test.js +0 -38
- package/test.js.map +0 -1
package/index.d.ts
CHANGED
|
@@ -252,6 +252,12 @@ export declare class DDB {
|
|
|
252
252
|
le: boolean;
|
|
253
253
|
/** little endian (client) */
|
|
254
254
|
static le_client: boolean;
|
|
255
|
+
/** 是否在建立连接后自动登录,默认 true */
|
|
256
|
+
autologin: boolean;
|
|
257
|
+
/** DolphinDB 登录用户名 */
|
|
258
|
+
username: string;
|
|
259
|
+
/** DolphinDB 登录密码 */
|
|
260
|
+
password: string;
|
|
255
261
|
/** python session flag (2048) */
|
|
256
262
|
python: boolean;
|
|
257
263
|
message_hook: (message: Uint8Array) => any;
|
|
@@ -265,22 +271,41 @@ export declare class DDB {
|
|
|
265
271
|
/**
|
|
266
272
|
Initialize an instance of DolphinDB Client using the WebSocket URL
|
|
267
273
|
(without establishing an actual network connection)
|
|
274
|
+
- url: DolphinDB WebSocket URL. e.g.:`ws://127.0.0.1:8848`
|
|
275
|
+
- options?:
|
|
276
|
+
- autologin?: Whether to log in automatically after establishing a connection, default `true`
|
|
277
|
+
- username?: DolphinDB username, default `'admin'`
|
|
278
|
+
- password?: DolphinDB password, default `'123456'`
|
|
279
|
+
- python?: set python session flag, default `false`
|
|
280
|
+
|
|
268
281
|
@example
|
|
269
282
|
let ddb = new DDB('ws://127.0.0.1:8848')
|
|
270
|
-
let
|
|
283
|
+
let ddbsecure = new DDB('wss://dolphindb.com', {
|
|
284
|
+
autologin: true,
|
|
285
|
+
username: 'admin',
|
|
286
|
+
password: '123456',
|
|
287
|
+
python: false
|
|
288
|
+
})
|
|
271
289
|
*/
|
|
272
|
-
constructor(url: string
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
290
|
+
constructor(url: string, options?: {
|
|
291
|
+
autologin?: boolean;
|
|
292
|
+
username?: string;
|
|
293
|
+
password?: string;
|
|
294
|
+
python?: boolean;
|
|
295
|
+
});
|
|
296
|
+
/** Establish the actual WebSocket connection to the DolphinDB corresponding to the URL
|
|
297
|
+
- options?:
|
|
298
|
+
- url?: DolphinDB WebSocket URL. By default, the WebSocket URL passed in when the instance is initialized is used
|
|
299
|
+
- autologin?: Whether to log in automatically after establishing a connection, default `true`
|
|
300
|
+
- username?: DolphinDB username, default `'admin'`
|
|
301
|
+
- password?: DolphinDB password, default `'123456'`
|
|
302
|
+
- python?: set python session flag, default `false`
|
|
303
|
+
*/
|
|
304
|
+
connect(options?: {
|
|
276
305
|
url?: string;
|
|
277
|
-
|
|
278
|
-
login?: boolean;
|
|
279
|
-
/** DolphinDB username */
|
|
306
|
+
autologin?: boolean;
|
|
280
307
|
username?: string;
|
|
281
|
-
/** DolphinDB password */
|
|
282
308
|
password?: string;
|
|
283
|
-
/** set python session flag */
|
|
284
309
|
python?: boolean;
|
|
285
310
|
}): Promise<void>;
|
|
286
311
|
get_rpc_options({ urgent, secondary, async: _async, pickle, clear, api, compress, cancellable, priority, parallelism, root_id, limit, }?: {
|
package/index.js
CHANGED
|
@@ -1280,11 +1280,23 @@ class DDB {
|
|
|
1280
1280
|
/**
|
|
1281
1281
|
Initialize an instance of DolphinDB Client using the WebSocket URL
|
|
1282
1282
|
(without establishing an actual network connection)
|
|
1283
|
+
- url: DolphinDB WebSocket URL. e.g.:`ws://127.0.0.1:8848`
|
|
1284
|
+
- options?:
|
|
1285
|
+
- autologin?: Whether to log in automatically after establishing a connection, default `true`
|
|
1286
|
+
- username?: DolphinDB username, default `'admin'`
|
|
1287
|
+
- password?: DolphinDB password, default `'123456'`
|
|
1288
|
+
- python?: set python session flag, default `false`
|
|
1289
|
+
|
|
1283
1290
|
@example
|
|
1284
1291
|
let ddb = new DDB('ws://127.0.0.1:8848')
|
|
1285
|
-
let
|
|
1292
|
+
let ddbsecure = new DDB('wss://dolphindb.com', {
|
|
1293
|
+
autologin: true,
|
|
1294
|
+
username: 'admin',
|
|
1295
|
+
password: '123456',
|
|
1296
|
+
python: false
|
|
1297
|
+
})
|
|
1286
1298
|
*/
|
|
1287
|
-
constructor(url) {
|
|
1299
|
+
constructor(url, options = {}) {
|
|
1288
1300
|
/** 当前的 session id (http 或 tcp) */
|
|
1289
1301
|
this.sid = '0';
|
|
1290
1302
|
/** utf-8 text decoder */
|
|
@@ -1294,11 +1306,25 @@ class DDB {
|
|
|
1294
1306
|
this.websocket = null;
|
|
1295
1307
|
/** little endian (server) */
|
|
1296
1308
|
this.le = true;
|
|
1309
|
+
/** 是否在建立连接后自动登录,默认 true */
|
|
1310
|
+
this.autologin = true;
|
|
1311
|
+
/** DolphinDB 登录用户名 */
|
|
1312
|
+
this.username = 'admin';
|
|
1313
|
+
/** DolphinDB 登录密码 */
|
|
1314
|
+
this.password = '123456';
|
|
1297
1315
|
/** python session flag (2048) */
|
|
1298
1316
|
this.python = false;
|
|
1299
1317
|
this.message_hook = null;
|
|
1300
1318
|
this.presult = Promise.resolve(null);
|
|
1301
1319
|
this.url = url;
|
|
1320
|
+
if (options.autologin !== undefined)
|
|
1321
|
+
this.autologin = options.autologin;
|
|
1322
|
+
if (options.username !== undefined)
|
|
1323
|
+
this.username = options.username;
|
|
1324
|
+
if (options.password !== undefined)
|
|
1325
|
+
this.password = options.password;
|
|
1326
|
+
if (options.python !== undefined)
|
|
1327
|
+
this.python = options.python;
|
|
1302
1328
|
}
|
|
1303
1329
|
/** print message handler */
|
|
1304
1330
|
printer(message) {
|
|
@@ -1310,12 +1336,27 @@ class DDB {
|
|
|
1310
1336
|
get connected() {
|
|
1311
1337
|
return this.websocket?.readyState === ws_1.WebSocket.OPEN;
|
|
1312
1338
|
}
|
|
1313
|
-
/** Establish the actual WebSocket connection to the DolphinDB corresponding to the URL
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1339
|
+
/** Establish the actual WebSocket connection to the DolphinDB corresponding to the URL
|
|
1340
|
+
- options?:
|
|
1341
|
+
- url?: DolphinDB WebSocket URL. By default, the WebSocket URL passed in when the instance is initialized is used
|
|
1342
|
+
- autologin?: Whether to log in automatically after establishing a connection, default `true`
|
|
1343
|
+
- username?: DolphinDB username, default `'admin'`
|
|
1344
|
+
- password?: DolphinDB password, default `'123456'`
|
|
1345
|
+
- python?: set python session flag, default `false`
|
|
1346
|
+
*/
|
|
1347
|
+
async connect(options = {}) {
|
|
1348
|
+
if (options.url !== undefined)
|
|
1349
|
+
this.url = options.url;
|
|
1350
|
+
if (options.autologin !== undefined)
|
|
1351
|
+
this.autologin = options.autologin;
|
|
1352
|
+
if (options.username !== undefined)
|
|
1353
|
+
this.username = options.username;
|
|
1354
|
+
if (options.password !== undefined)
|
|
1355
|
+
this.password = options.password;
|
|
1356
|
+
if (options.python !== undefined)
|
|
1357
|
+
this.python = options.python;
|
|
1317
1358
|
this.disconnect();
|
|
1318
|
-
let websocket = new ws_1.WebSocket(url, python ? ['python'] : [], {
|
|
1359
|
+
let websocket = new ws_1.WebSocket(this.url, this.python ? ['python'] : [], {
|
|
1319
1360
|
maxPayload: 2 ** 33 // 8 GB
|
|
1320
1361
|
});
|
|
1321
1362
|
// https://stackoverflow.com/questions/11821096/what-is-the-difference-between-an-arraybuffer-and-a-blob/39951543
|
|
@@ -1369,11 +1410,11 @@ class DDB {
|
|
|
1369
1410
|
' add_node_alias\n' +
|
|
1370
1411
|
' )\n' +
|
|
1371
1412
|
'}\n', { urgent: true });
|
|
1372
|
-
if (
|
|
1413
|
+
if (this.autologin)
|
|
1373
1414
|
if (this.python)
|
|
1374
|
-
await this.eval(`login(${username.quote('double')}, ${password.quote('double')})`, { urgent: true });
|
|
1415
|
+
await this.eval(`login(${this.username.quote('double')}, ${this.password.quote('double')})`, { urgent: true });
|
|
1375
1416
|
else
|
|
1376
|
-
await this.call('login', [username, password], { urgent: true });
|
|
1417
|
+
await this.call('login', [this.username, this.password], { urgent: true });
|
|
1377
1418
|
}
|
|
1378
1419
|
get_rpc_options({ urgent = false, secondary = false, async: _async = false, pickle = false, clear = false, api = false, compress = false, cancellable = true, priority = urgent ? 8 : 4, parallelism = 8, root_id = '', limit, } = {}) {
|
|
1379
1420
|
let flag = 0;
|