dolphindb 2.0.515 → 2.0.518
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/README.md +3 -3
- package/README.zh.md +3 -3
- package/browser.d.ts +4 -2
- package/browser.js +20 -8
- package/browser.js.map +1 -1
- package/index.d.ts +4 -2
- package/index.js +20 -8
- package/index.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -128,12 +128,12 @@ class DdbObj <T extends DdbValue = DdbValue> {
|
|
|
128
128
|
/** 2nd dimension */
|
|
129
129
|
cols?: number
|
|
130
130
|
|
|
131
|
-
/** the type of the value in matrix (only matrix has this field) */
|
|
132
|
-
datatype?: DdbType
|
|
133
|
-
|
|
134
131
|
/** the actual data. Different DdbForm, DdbType use different types in DdbValue to represent actual data */
|
|
135
132
|
value: T
|
|
136
133
|
|
|
134
|
+
/** raw binary data, only top-level objects generated by parse_message when parse_object is false have this attribute */
|
|
135
|
+
buffer?: Uint8Array
|
|
136
|
+
|
|
137
137
|
constructor (data: Partial<DdbObj> & { form: DdbForm, type: DdbType, length: number }) {
|
|
138
138
|
Object.assign(this, data)
|
|
139
139
|
}
|
package/README.zh.md
CHANGED
|
@@ -129,12 +129,12 @@ class DdbObj <T extends DdbValue = DdbValue> {
|
|
|
129
129
|
/** 第 2 维 */
|
|
130
130
|
cols?: number
|
|
131
131
|
|
|
132
|
-
/** matrix 中值的类型,仅 matrix 才有 */
|
|
133
|
-
datatype?: DdbType
|
|
134
|
-
|
|
135
132
|
/** 实际数据。不同的 DdbForm, DdbType 使用 DdbValue 中不同的类型来表示实际数据 */
|
|
136
133
|
value: T
|
|
137
134
|
|
|
135
|
+
/** 原始二进制数据,仅在 parse_object 为 false 时通过 parse_message 生成的顶层对象有这个属性 */
|
|
136
|
+
buffer?: Uint8Array
|
|
137
|
+
|
|
138
138
|
constructor (data: Partial<DdbObj> & { form: DdbForm, type: DdbType, length: number }) {
|
|
139
139
|
Object.assign(this, data)
|
|
140
140
|
}
|
package/browser.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ export declare enum DdbForm {
|
|
|
8
8
|
dict = 5,
|
|
9
9
|
table = 6,
|
|
10
10
|
chart = 7,
|
|
11
|
-
chunk = 8
|
|
11
|
+
chunk = 8,
|
|
12
|
+
/** sysobj */
|
|
13
|
+
object = 9
|
|
12
14
|
}
|
|
13
15
|
/** DolphinDB DataType
|
|
14
16
|
对应的 array vector 类型为 64 + 基本类型
|
|
@@ -288,7 +290,7 @@ export declare function nanotimestamp2str(nanotimestamp: bigint, format?: string
|
|
|
288
290
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
289
291
|
*/
|
|
290
292
|
export declare function str2nanotimestamp(str: string, format?: string): bigint;
|
|
291
|
-
export declare function ipaddr2str(buffer: Uint8Array, le?: boolean): string;
|
|
293
|
+
export declare function ipaddr2str(buffer: Uint8Array, le?: boolean, ipv6?: boolean): string;
|
|
292
294
|
export declare function uuid2str(buffer: Uint8Array, le?: boolean): string;
|
|
293
295
|
export declare function int1282str(buffer: Uint8Array, le?: boolean): string;
|
|
294
296
|
export declare class DDB {
|
package/browser.js
CHANGED
|
@@ -5,6 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
6
6
|
const customParseFormat_js_1 = tslib_1.__importDefault(require("dayjs/plugin/customParseFormat.js"));
|
|
7
7
|
dayjs_1.default.extend(customParseFormat_js_1.default);
|
|
8
|
+
const ipaddr_js_1 = tslib_1.__importDefault(require("ipaddr.js"));
|
|
9
|
+
const { fromByteArray: buf2ipaddr } = ipaddr_js_1.default;
|
|
8
10
|
require("xshell/prototype.browser");
|
|
9
11
|
const utils_browser_1 = require("xshell/utils.browser");
|
|
10
12
|
const net_browser_js_1 = require("xshell/net.browser.js");
|
|
@@ -19,6 +21,8 @@ var DdbForm;
|
|
|
19
21
|
DdbForm[DdbForm["table"] = 6] = "table";
|
|
20
22
|
DdbForm[DdbForm["chart"] = 7] = "chart";
|
|
21
23
|
DdbForm[DdbForm["chunk"] = 8] = "chunk";
|
|
24
|
+
/** sysobj */
|
|
25
|
+
DdbForm[DdbForm["object"] = 9] = "object";
|
|
22
26
|
})(DdbForm = exports.DdbForm || (exports.DdbForm = {}));
|
|
23
27
|
/** DolphinDB DataType
|
|
24
28
|
对应的 array vector 类型为 64 + 基本类型
|
|
@@ -913,7 +917,7 @@ class DdbObj {
|
|
|
913
917
|
case DdbForm.dict:
|
|
914
918
|
return `dict<${DdbType[this.value[0].type]}, ${DdbType[this.value[1].type]}>`;
|
|
915
919
|
case DdbForm.matrix:
|
|
916
|
-
return `matrix<${
|
|
920
|
+
return `matrix<${tname}>[${this.rows}r][${this.cols}c]`;
|
|
917
921
|
default:
|
|
918
922
|
return `${DdbForm[this.form]} ${tname}`;
|
|
919
923
|
}
|
|
@@ -1088,7 +1092,12 @@ function format(type, value, le) {
|
|
|
1088
1092
|
return String((value === null || value === exports.nulls.int8) ?
|
|
1089
1093
|
null
|
|
1090
1094
|
:
|
|
1091
|
-
|
|
1095
|
+
// ascii printable
|
|
1096
|
+
// http://facweb.cs.depaul.edu/sjost/it212/documents/ascii-pr.htm
|
|
1097
|
+
(32 <= value && value <= 126) ?
|
|
1098
|
+
String.fromCharCode(value).quote()
|
|
1099
|
+
:
|
|
1100
|
+
value);
|
|
1092
1101
|
case DdbType.short:
|
|
1093
1102
|
return String((value === null || value === exports.nulls.int16) ?
|
|
1094
1103
|
null
|
|
@@ -1179,7 +1188,10 @@ function format(type, value, le) {
|
|
|
1179
1188
|
case DdbType.int128:
|
|
1180
1189
|
return int1282str(value, le);
|
|
1181
1190
|
case DdbType.blob:
|
|
1182
|
-
return
|
|
1191
|
+
return (value.length > 100 ?
|
|
1192
|
+
DdbObj.dec.decode(value.subarray(0, 98)) + '…'
|
|
1193
|
+
:
|
|
1194
|
+
DdbObj.dec.decode(value)).quote('single');
|
|
1183
1195
|
case DdbType.point: {
|
|
1184
1196
|
let [x, y] = value;
|
|
1185
1197
|
if (x === exports.nulls.double)
|
|
@@ -1539,7 +1551,7 @@ function time2str(time, format = 'HH:mm:ss.SSS') {
|
|
|
1539
1551
|
.format(format);
|
|
1540
1552
|
}
|
|
1541
1553
|
exports.time2str = time2str;
|
|
1542
|
-
function minute2str(minute, format = 'HH:mm') {
|
|
1554
|
+
function minute2str(minute, format = 'HH:mm[m]') {
|
|
1543
1555
|
return (minute === null || minute === exports.nulls.int32) ?
|
|
1544
1556
|
'null'
|
|
1545
1557
|
:
|
|
@@ -1674,14 +1686,14 @@ function str2nanotimestamp(str, format = 'YYYY.MM.DD HH:mm:ss.SSSSSSSSS') {
|
|
|
1674
1686
|
BigInt(str.slice(i_nanosecond_start, i_nanosecond_start + 9)));
|
|
1675
1687
|
}
|
|
1676
1688
|
exports.str2nanotimestamp = str2nanotimestamp;
|
|
1677
|
-
function ipaddr2str(buffer, le = true) {
|
|
1689
|
+
function ipaddr2str(buffer, le = true, ipv6) {
|
|
1678
1690
|
let buf = buffer;
|
|
1679
1691
|
if (le)
|
|
1680
1692
|
buf = buffer.slice().reverse();
|
|
1681
1693
|
const i_non_zero = buf.findIndex(x => x);
|
|
1682
|
-
if (
|
|
1683
|
-
|
|
1684
|
-
|
|
1694
|
+
if (ipv6 ||
|
|
1695
|
+
i_non_zero !== -1 && i_non_zero < 12) // ipv6
|
|
1696
|
+
return buf2ipaddr([...buf]).toString();
|
|
1685
1697
|
else // ipv4
|
|
1686
1698
|
return buf.subarray(12).join('.');
|
|
1687
1699
|
}
|