dolphindb 2.0.516 → 2.0.517
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 +1 -1
- package/browser.js +12 -5
- package/browser.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +12 -5
- package/index.js.map +1 -1
- package/package.json +6 -5
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
|
@@ -288,7 +288,7 @@ export declare function nanotimestamp2str(nanotimestamp: bigint, format?: string
|
|
|
288
288
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
289
289
|
*/
|
|
290
290
|
export declare function str2nanotimestamp(str: string, format?: string): bigint;
|
|
291
|
-
export declare function ipaddr2str(buffer: Uint8Array, le?: boolean): string;
|
|
291
|
+
export declare function ipaddr2str(buffer: Uint8Array, le?: boolean, ipv6?: boolean): string;
|
|
292
292
|
export declare function uuid2str(buffer: Uint8Array, le?: boolean): string;
|
|
293
293
|
export declare function int1282str(buffer: Uint8Array, le?: boolean): string;
|
|
294
294
|
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");
|
|
@@ -1088,7 +1090,12 @@ function format(type, value, le) {
|
|
|
1088
1090
|
return String((value === null || value === exports.nulls.int8) ?
|
|
1089
1091
|
null
|
|
1090
1092
|
:
|
|
1091
|
-
|
|
1093
|
+
// ascii printable
|
|
1094
|
+
// http://facweb.cs.depaul.edu/sjost/it212/documents/ascii-pr.htm
|
|
1095
|
+
(32 <= value && value <= 126) ?
|
|
1096
|
+
String.fromCharCode(value).quote()
|
|
1097
|
+
:
|
|
1098
|
+
value);
|
|
1092
1099
|
case DdbType.short:
|
|
1093
1100
|
return String((value === null || value === exports.nulls.int16) ?
|
|
1094
1101
|
null
|
|
@@ -1677,14 +1684,14 @@ function str2nanotimestamp(str, format = 'YYYY.MM.DD HH:mm:ss.SSSSSSSSS') {
|
|
|
1677
1684
|
BigInt(str.slice(i_nanosecond_start, i_nanosecond_start + 9)));
|
|
1678
1685
|
}
|
|
1679
1686
|
exports.str2nanotimestamp = str2nanotimestamp;
|
|
1680
|
-
function ipaddr2str(buffer, le = true) {
|
|
1687
|
+
function ipaddr2str(buffer, le = true, ipv6) {
|
|
1681
1688
|
let buf = buffer;
|
|
1682
1689
|
if (le)
|
|
1683
1690
|
buf = buffer.slice().reverse();
|
|
1684
1691
|
const i_non_zero = buf.findIndex(x => x);
|
|
1685
|
-
if (
|
|
1686
|
-
|
|
1687
|
-
|
|
1692
|
+
if (ipv6 ||
|
|
1693
|
+
i_non_zero !== -1 && i_non_zero < 12) // ipv6
|
|
1694
|
+
return buf2ipaddr([...buf]).toString();
|
|
1688
1695
|
else // ipv4
|
|
1689
1696
|
return buf.subarray(12).join('.');
|
|
1690
1697
|
}
|