dolphindb 2.0.510 → 2.0.511
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 +19 -1
- package/browser.js +40 -3
- package/browser.js.map +1 -1
- package/index.d.ts +19 -1
- package/index.js +41 -3
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -63,10 +63,28 @@ export declare enum DdbFunctionType {
|
|
|
63
63
|
JitFunc = 7,
|
|
64
64
|
JitPartialFunc = 8
|
|
65
65
|
}
|
|
66
|
+
export declare enum DdbDurationUnit {
|
|
67
|
+
ns = 0,
|
|
68
|
+
us = 1,
|
|
69
|
+
ms = 2,
|
|
70
|
+
s = 3,
|
|
71
|
+
m = 4,
|
|
72
|
+
H = 5,
|
|
73
|
+
d = 6,
|
|
74
|
+
w = 7,
|
|
75
|
+
M = 8,
|
|
76
|
+
y = 9,
|
|
77
|
+
B = 10
|
|
78
|
+
}
|
|
66
79
|
export interface DdbFunctionDefValue {
|
|
67
80
|
type: DdbFunctionType;
|
|
68
81
|
name: string;
|
|
69
82
|
}
|
|
83
|
+
export interface DdbDurationValue {
|
|
84
|
+
unit: DdbDurationUnit;
|
|
85
|
+
/** int32 */
|
|
86
|
+
data: number;
|
|
87
|
+
}
|
|
70
88
|
export interface DdbSymbolExtendedValue {
|
|
71
89
|
base_id: number;
|
|
72
90
|
base: string[];
|
|
@@ -88,7 +106,7 @@ export declare type DdbScalarValue = null | boolean | number | bigint | string |
|
|
|
88
106
|
number,
|
|
89
107
|
number
|
|
90
108
|
] | // complex, point
|
|
91
|
-
DdbFunctionDefValue;
|
|
109
|
+
DdbFunctionDefValue | DdbDurationValue;
|
|
92
110
|
export declare type DdbVectorValue = Uint8Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | string[] | // string[]
|
|
93
111
|
Uint8Array[] | // blob
|
|
94
112
|
DdbObj[] | // any
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DDB = exports.str2nanotimestamp = exports.nanotimestamp2str = exports.str2timestamp = exports.timestamp2str = exports.datetime2str = exports.date2str = exports.DdbTable = exports.DdbSetString = exports.DdbSetDouble = exports.DdbSetInt = exports.DdbVectorSymbol = exports.DdbVectorAny = exports.DdbVectorString = exports.DdbVectorDouble = exports.DdbVectorInt = exports.DdbFunction = exports.DdbPair = exports.DdbNanoTimeStamp = exports.DdbTimeStamp = exports.DdbDateTime = exports.DdbDouble = exports.DdbLong = exports.DdbString = exports.DdbInt = exports.DdbChar = exports.DdbBool = exports.DdbVoid = exports.DdbObj = exports.timezone_offset = exports.nulls = exports.DdbFunctionType = exports.ddb_sizes = exports.DdbType = exports.DdbForm = void 0;
|
|
3
|
+
exports.DDB = exports.str2nanotimestamp = exports.nanotimestamp2str = exports.str2timestamp = exports.timestamp2str = exports.datetime2str = exports.date2str = exports.DdbTable = exports.DdbSetString = exports.DdbSetDouble = exports.DdbSetInt = exports.DdbVectorSymbol = exports.DdbVectorAny = exports.DdbVectorString = exports.DdbVectorDouble = exports.DdbVectorInt = exports.DdbFunction = exports.DdbPair = exports.DdbNanoTimeStamp = exports.DdbTimeStamp = exports.DdbDateTime = exports.DdbDouble = exports.DdbLong = exports.DdbString = exports.DdbInt = exports.DdbChar = exports.DdbBool = exports.DdbVoid = exports.DdbObj = exports.timezone_offset = exports.nulls = exports.DdbDurationUnit = exports.DdbFunctionType = exports.ddb_sizes = exports.DdbType = exports.DdbForm = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ws_1 = require("ws");
|
|
6
6
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
@@ -109,6 +109,20 @@ var DdbFunctionType;
|
|
|
109
109
|
DdbFunctionType[DdbFunctionType["JitFunc"] = 7] = "JitFunc";
|
|
110
110
|
DdbFunctionType[DdbFunctionType["JitPartialFunc"] = 8] = "JitPartialFunc";
|
|
111
111
|
})(DdbFunctionType = exports.DdbFunctionType || (exports.DdbFunctionType = {}));
|
|
112
|
+
var DdbDurationUnit;
|
|
113
|
+
(function (DdbDurationUnit) {
|
|
114
|
+
DdbDurationUnit[DdbDurationUnit["ns"] = 0] = "ns";
|
|
115
|
+
DdbDurationUnit[DdbDurationUnit["us"] = 1] = "us";
|
|
116
|
+
DdbDurationUnit[DdbDurationUnit["ms"] = 2] = "ms";
|
|
117
|
+
DdbDurationUnit[DdbDurationUnit["s"] = 3] = "s";
|
|
118
|
+
DdbDurationUnit[DdbDurationUnit["m"] = 4] = "m";
|
|
119
|
+
DdbDurationUnit[DdbDurationUnit["H"] = 5] = "H";
|
|
120
|
+
DdbDurationUnit[DdbDurationUnit["d"] = 6] = "d";
|
|
121
|
+
DdbDurationUnit[DdbDurationUnit["w"] = 7] = "w";
|
|
122
|
+
DdbDurationUnit[DdbDurationUnit["M"] = 8] = "M";
|
|
123
|
+
DdbDurationUnit[DdbDurationUnit["y"] = 9] = "y";
|
|
124
|
+
DdbDurationUnit[DdbDurationUnit["B"] = 10] = "B";
|
|
125
|
+
})(DdbDurationUnit = exports.DdbDurationUnit || (exports.DdbDurationUnit = {}));
|
|
112
126
|
exports.nulls = {
|
|
113
127
|
int8: -0x80,
|
|
114
128
|
int16: -32768,
|
|
@@ -406,6 +420,16 @@ class DdbObj {
|
|
|
406
420
|
]
|
|
407
421
|
];
|
|
408
422
|
}
|
|
423
|
+
case DdbType.duration: {
|
|
424
|
+
const dv = new DataView(buf.buffer, buf.byteOffset);
|
|
425
|
+
return [
|
|
426
|
+
8,
|
|
427
|
+
{
|
|
428
|
+
unit: dv.getUint32(4, le),
|
|
429
|
+
data: dv.getInt32(0, le)
|
|
430
|
+
}
|
|
431
|
+
];
|
|
432
|
+
}
|
|
409
433
|
default:
|
|
410
434
|
return [0, buf];
|
|
411
435
|
}
|
|
@@ -639,6 +663,13 @@ class DdbObj {
|
|
|
639
663
|
values
|
|
640
664
|
];
|
|
641
665
|
}
|
|
666
|
+
// case DdbType.duration: -> 实际会返回一个 any vector
|
|
667
|
+
// [2y, 1M, 3d, 7H, 11m, 12s, 15ms, 16us, 17ns]
|
|
668
|
+
// <Buffer 19 01 type = any, form = vector
|
|
669
|
+
// 09 00 00 00 01 00 00 00 rows = 9, cols = 1
|
|
670
|
+
// 24 00 type = DdbType.duration, form = scalar
|
|
671
|
+
// 02 00 00 00 09 00 00 00
|
|
672
|
+
// 24 00 01 00 00 00 08 00 00 00 24 00 03 00 00 00 06 00 00 00 24 00 07 00 00 00 05 00 00 00 ... 50 more bytes>
|
|
642
673
|
default:
|
|
643
674
|
return [0, buf];
|
|
644
675
|
}
|
|
@@ -740,8 +771,10 @@ class DdbObj {
|
|
|
740
771
|
case DdbType.complex:
|
|
741
772
|
case DdbType.point:
|
|
742
773
|
return [Float64Array.from(this.value)];
|
|
743
|
-
case DdbType.duration:
|
|
744
|
-
|
|
774
|
+
case DdbType.duration: {
|
|
775
|
+
const { unit, data } = this.value;
|
|
776
|
+
return [Int32Array.of(data, unit)];
|
|
777
|
+
}
|
|
745
778
|
case DdbType.handle:
|
|
746
779
|
throw new Error('DolphinDB Server 不支持 handle 的反序列化');
|
|
747
780
|
default:
|
|
@@ -924,6 +957,11 @@ class DdbObj {
|
|
|
924
957
|
switch (this.type) {
|
|
925
958
|
case DdbType.functiondef:
|
|
926
959
|
return (0, utils_js_1.inspect)(this.value.name, options);
|
|
960
|
+
case DdbType.duration: {
|
|
961
|
+
const { data, unit } = this.value;
|
|
962
|
+
const str = `${data}${DdbDurationUnit[unit]}`;
|
|
963
|
+
return options.colors ? str.green : str;
|
|
964
|
+
}
|
|
927
965
|
}
|
|
928
966
|
break;
|
|
929
967
|
}
|