dolphindb 3.0.105 → 3.0.107
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 +4 -4
- package/browser.js +20 -19
- package/browser.js.map +1 -1
- package/i18n/dict.json +3 -0
- package/index.d.ts +1 -1
- package/index.js +17 -16
- package/index.js.map +1 -1
- package/package.json +5 -5
package/i18n/dict.json
CHANGED
|
@@ -91,5 +91,8 @@
|
|
|
91
91
|
},
|
|
92
92
|
"pack 时字符串中间不能含有 \\0, 否则上传给 DolphinDB 会导致连接断开": {
|
|
93
93
|
"en": "The string cannot contain \\0 in the middle when packing, otherwise uploading to DolphinDB will cause the connection to be disconnected"
|
|
94
|
+
},
|
|
95
|
+
"发送至 DolphinDB 执行的脚本中间不能含有 \\0": {
|
|
96
|
+
"en": "The script sent to DolphinDB for execution cannot contain \\0 in the middle"
|
|
94
97
|
}
|
|
95
98
|
}
|
package/index.d.ts
CHANGED
|
@@ -494,7 +494,7 @@ export declare function second2str(second: number | null, format?: string): stri
|
|
|
494
494
|
export declare function datetime2ms(datetime: number | null): number | null;
|
|
495
495
|
export declare function datetime2str(datetime: number | null, format?: string): string;
|
|
496
496
|
/** _datetime_formatter.format 会在 date 为 Invalid Date 时抛出错误 */
|
|
497
|
-
export declare function timestamp2ms(timestamp: bigint | null): number | null;
|
|
497
|
+
export declare function timestamp2ms(timestamp: bigint | number | null): number | null;
|
|
498
498
|
/** format timestamp (bigint) to string
|
|
499
499
|
- timestamp: bigint value
|
|
500
500
|
- format?:
|
package/index.js
CHANGED
|
@@ -2409,13 +2409,13 @@ export class DdbTable extends DdbObj {
|
|
|
2409
2409
|
}
|
|
2410
2410
|
}
|
|
2411
2411
|
export function date2ms(date) {
|
|
2412
|
-
// 将 server 的本地时间 (以 ms 为单位,1970.01.01 00:00:00 作为零点)
|
|
2413
|
-
// 本地的时区与实际的时间值相关,
|
|
2412
|
+
// 将 server 的本地时间 (以 ms 为单位,1970.01.01 00:00:00 作为零点) 作为 UTC-0 格式化为字符串,然后根据本地的时区解析这个字符串转换为 UTC-8
|
|
2413
|
+
// 本地的时区与实际的时间值相关,getTimezoneOffset() 可能会受到夏令时 (DST) 的影响,不能使用
|
|
2414
2414
|
// 得到的 utc 毫秒数交给 js date 或者 dayjs 去格式化
|
|
2415
2415
|
if (date === null || date === nulls.int32)
|
|
2416
2416
|
return null;
|
|
2417
2417
|
const ms = 1000 * 3600 * 24 * date;
|
|
2418
|
-
return
|
|
2418
|
+
return timestamp2ms(ms);
|
|
2419
2419
|
}
|
|
2420
2420
|
export function date2str(date, format = 'YYYY.MM.DD') {
|
|
2421
2421
|
return (date === null || date === nulls.int32) ?
|
|
@@ -2442,7 +2442,7 @@ export function time2ms(time) {
|
|
|
2442
2442
|
return (time === null || time === nulls.int32) ?
|
|
2443
2443
|
null
|
|
2444
2444
|
:
|
|
2445
|
-
|
|
2445
|
+
timestamp2ms(time);
|
|
2446
2446
|
}
|
|
2447
2447
|
export function time2str(time, format = 'HH:mm:ss.SSS') {
|
|
2448
2448
|
return (time === null || time === nulls.int32) ?
|
|
@@ -2454,7 +2454,7 @@ export function minute2ms(minute) {
|
|
|
2454
2454
|
if (minute === null || minute === nulls.int32)
|
|
2455
2455
|
return null;
|
|
2456
2456
|
const ms = 60 * 1000 * minute;
|
|
2457
|
-
return
|
|
2457
|
+
return timestamp2ms(ms);
|
|
2458
2458
|
}
|
|
2459
2459
|
export function minute2str(minute, format = 'HH:mm[m]') {
|
|
2460
2460
|
return (minute === null || minute === nulls.int32) ?
|
|
@@ -2466,7 +2466,7 @@ export function second2ms(second) {
|
|
|
2466
2466
|
if (second === null || second === nulls.int32)
|
|
2467
2467
|
return null;
|
|
2468
2468
|
const ms = 1000 * second;
|
|
2469
|
-
return
|
|
2469
|
+
return timestamp2ms(ms);
|
|
2470
2470
|
}
|
|
2471
2471
|
export function second2str(second, format = 'HH:mm:ss') {
|
|
2472
2472
|
return (second === null || second === nulls.int32) ?
|
|
@@ -2508,13 +2508,13 @@ export function datehour2ms(datehour) {
|
|
|
2508
2508
|
if (datehour === null || datehour === nulls.int32)
|
|
2509
2509
|
return null;
|
|
2510
2510
|
const ms = 1000 * 3600 * datehour;
|
|
2511
|
-
return
|
|
2511
|
+
return timestamp2ms(ms);
|
|
2512
2512
|
}
|
|
2513
2513
|
export function datehour2str(datehour, format = 'YYYY.MM.DDTHH') {
|
|
2514
2514
|
if (datehour === null || datehour === nulls.int32)
|
|
2515
2515
|
return 'null';
|
|
2516
2516
|
const ms = 1000 * 3600 * datehour;
|
|
2517
|
-
return dayjs(
|
|
2517
|
+
return dayjs(timestamp2ms(ms)).format(format);
|
|
2518
2518
|
}
|
|
2519
2519
|
/** parse timestamp string to bigint value
|
|
2520
2520
|
- str: timestamp string, 如果为空字符串或 'null' 会返回对应的空值 (nulls.int64)
|
|
@@ -2545,7 +2545,7 @@ export function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
|
2545
2545
|
const i_nanosecond_start = format.indexOf('SSSSSSSSS', i_second_end);
|
|
2546
2546
|
assert(i_nanosecond_start !== -1, t('格式串必须包含纳秒的格式 (SSSSSSSSS)'));
|
|
2547
2547
|
const ms = Number(nanotime) / 1000000;
|
|
2548
|
-
return (dayjs(
|
|
2548
|
+
return (dayjs(timestamp2ms(ms)).format(format.slice(0, i_second_end)) +
|
|
2549
2549
|
format.slice(i_second_end, i_nanosecond_start) +
|
|
2550
2550
|
String(nanotime % 1000000000n).padStart(9, '0'));
|
|
2551
2551
|
}
|
|
@@ -2974,12 +2974,12 @@ export class DDB {
|
|
|
2974
2974
|
if (this.error)
|
|
2975
2975
|
throw this.error;
|
|
2976
2976
|
const args = DdbObj.to_ddbobjs(_args);
|
|
2977
|
-
const rpc_id = `
|
|
2977
|
+
const rpc_id = `(id = ${id})`;
|
|
2978
2978
|
const command = this.enc.encode((() => {
|
|
2979
2979
|
switch (type) {
|
|
2980
2980
|
case 'function':
|
|
2981
2981
|
if (this.verbose)
|
|
2982
|
-
console.log(func
|
|
2982
|
+
console.log(func, args.map(arg => arg.data()), rpc_id);
|
|
2983
2983
|
assert(!func.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
|
|
2984
2984
|
return 'function\n' +
|
|
2985
2985
|
`${func}\n` +
|
|
@@ -2987,14 +2987,15 @@ export class DDB {
|
|
|
2987
2987
|
`${Number(DDB.le_client)}\n`;
|
|
2988
2988
|
case 'script':
|
|
2989
2989
|
if (this.verbose)
|
|
2990
|
-
console.log(script
|
|
2990
|
+
console.log(script, rpc_id);
|
|
2991
2991
|
assert(!script.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
|
|
2992
2992
|
return 'script\n' +
|
|
2993
2993
|
script;
|
|
2994
2994
|
case 'variable':
|
|
2995
2995
|
if (this.verbose)
|
|
2996
|
-
|
|
2997
|
-
console.log(
|
|
2996
|
+
vars.forEach((v, i) => {
|
|
2997
|
+
console.log(v, '=', args[i].data());
|
|
2998
|
+
});
|
|
2998
2999
|
return 'variable\n' +
|
|
2999
3000
|
`${vars.join(',')}\n` +
|
|
3000
3001
|
`${vars.length}\n` +
|
|
@@ -3007,7 +3008,7 @@ export class DDB {
|
|
|
3007
3008
|
`login(${this.username.quote()}, ${this.password.quote()})`
|
|
3008
3009
|
:
|
|
3009
3010
|
'') +
|
|
3010
|
-
rpc_id);
|
|
3011
|
+
` ${rpc_id}`);
|
|
3011
3012
|
return 'connect\n' +
|
|
3012
3013
|
// 详见 InterProcessIO.cpp#APISocketConsole::parseScript 中的
|
|
3013
3014
|
// Util::startWith "connect"
|
|
@@ -3065,7 +3066,7 @@ export class DDB {
|
|
|
3065
3066
|
]));
|
|
3066
3067
|
});
|
|
3067
3068
|
if (this.verbose)
|
|
3068
|
-
console.log(
|
|
3069
|
+
console.log(result.data(), rpc_id);
|
|
3069
3070
|
return result;
|
|
3070
3071
|
});
|
|
3071
3072
|
}
|