dolphindb 2.0.1103 → 3.0.0
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 +2 -2
- package/browser.js +10 -12
- package/browser.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +10 -11
- package/index.js.map +1 -1
- package/language.d.ts +1 -1
- package/language.js +2 -0
- package/language.js.map +1 -1
- package/package.json +8 -8
- package/shared/constants.d.ts +5 -0
- package/shared/constants.js +9 -0
- package/shared/constants.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { InspectOptions as UtilInspectOptions } from 'util';
|
|
|
3
3
|
import { inspect, Lock, type WebSocket, type WebSocketConnectionError } from 'xshell';
|
|
4
4
|
import { type DdbDecimal128Value, type DdbDecimal128VectorValue } from './data-types/decimal-128.js';
|
|
5
5
|
import { BigInt128Array } from './shared/bigint-128-array.js';
|
|
6
|
-
import { DdbChartType, DdbDurationUnit, DdbForm, DdbFunctionType, DdbType } from './shared/constants.js';
|
|
6
|
+
import { DdbChartType, DdbDurationUnit, DdbForm, DdbFunctionType, DdbType, DdbVoidType } from './shared/constants.js';
|
|
7
7
|
export * from './shared/constants.js';
|
|
8
8
|
export type { DdbDecimal128Value, DdbDecimal128VectorValue } from './data-types/decimal-128.js';
|
|
9
9
|
export interface DdbFunctionDefValue {
|
|
@@ -188,7 +188,7 @@ export declare function format(type: DdbType, value: DdbValue, le: boolean, opti
|
|
|
188
188
|
/** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
|
|
189
189
|
export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
|
|
190
190
|
export declare class DdbVoid extends DdbObj<undefined> {
|
|
191
|
-
constructor();
|
|
191
|
+
constructor(value?: DdbVoidType);
|
|
192
192
|
}
|
|
193
193
|
export declare class DdbBool extends DdbObj<boolean> {
|
|
194
194
|
constructor(value: boolean | null);
|
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { t } from './i18n/index.js';
|
|
|
9
9
|
import { DdbDecimal128Serializor } from './data-types/decimal-128.js';
|
|
10
10
|
import { BigInt128Array } from './shared/bigint-128-array.js';
|
|
11
11
|
import { is_decimal_type, is_decimal_null_value, get_duration_unit } from './shared/utils.js';
|
|
12
|
-
import { nulls, DdbChartType, DdbDurationUnit, DdbForm, DdbFunctionType, DdbType } from './shared/constants.js';
|
|
12
|
+
import { nulls, DdbChartType, DdbDurationUnit, DdbForm, DdbFunctionType, DdbType, DdbVoidType } from './shared/constants.js';
|
|
13
13
|
export * from './shared/constants.js';
|
|
14
14
|
// Simulate other TypedArray behavior in nodejs
|
|
15
15
|
BigInt128Array.prototype[inspect.custom] = function () {
|
|
@@ -268,13 +268,12 @@ export class DdbObj {
|
|
|
268
268
|
}
|
|
269
269
|
static parse_scalar(buf, le, type) {
|
|
270
270
|
switch (type) {
|
|
271
|
-
case DdbType.void:
|
|
272
|
-
return [1, null];
|
|
273
271
|
case DdbType.bool: {
|
|
274
272
|
const dv = new DataView(buf.buffer, buf.byteOffset);
|
|
275
273
|
const value = dv.getInt8(0);
|
|
276
274
|
return [1, value === nulls.int8 ? null : Boolean(value)];
|
|
277
275
|
}
|
|
276
|
+
case DdbType.void:
|
|
278
277
|
case DdbType.char: {
|
|
279
278
|
const dv = new DataView(buf.buffer, buf.byteOffset);
|
|
280
279
|
const value = dv.getInt8(0);
|
|
@@ -723,10 +722,7 @@ export class DdbObj {
|
|
|
723
722
|
case DdbForm.scalar:
|
|
724
723
|
switch (type) {
|
|
725
724
|
case DdbType.void:
|
|
726
|
-
|
|
727
|
-
// Void::serialize()
|
|
728
|
-
// isNothing() ? 0 : 1;
|
|
729
|
-
return [Uint8Array.of(0)];
|
|
725
|
+
return [Uint8Array.of(Number(value))];
|
|
730
726
|
case DdbType.bool:
|
|
731
727
|
return [
|
|
732
728
|
Int8Array.of(value === null ?
|
|
@@ -905,7 +901,6 @@ export class DdbObj {
|
|
|
905
901
|
case DdbType.void:
|
|
906
902
|
return [];
|
|
907
903
|
case DdbType.bool:
|
|
908
|
-
return [value];
|
|
909
904
|
case DdbType.char:
|
|
910
905
|
return [value];
|
|
911
906
|
case DdbType.short:
|
|
@@ -1281,7 +1276,7 @@ let _grouping = true;
|
|
|
1281
1276
|
/** 缓存,为了优化性能,通常 options.decimals 都是不变的 */
|
|
1282
1277
|
let _formatter = new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 });
|
|
1283
1278
|
/** 用来处理时差 To deal with jet lag */
|
|
1284
|
-
let _datetime_formatter = new Intl.DateTimeFormat('zh-CN', { dateStyle: 'short', timeStyle: 'medium', timeZone: 'UTC' });
|
|
1279
|
+
let _datetime_formatter = new Intl.DateTimeFormat('zh-CN', { dateStyle: 'short', timeStyle: 'medium', timeZone: 'UTC', hour12: false });
|
|
1285
1280
|
/** 根据 DdbType 格式化单个元素 (value) 为字符串,空值返回 'null' 字符串 Formats a single element (value) as a string according to DdbType, null returns a 'null' string */
|
|
1286
1281
|
export function format(type, value, le, options = {}) {
|
|
1287
1282
|
const formatter = (() => {
|
|
@@ -1316,6 +1311,10 @@ export function format(type, value, le, options = {}) {
|
|
|
1316
1311
|
return options.colors ? str.magenta : str;
|
|
1317
1312
|
}
|
|
1318
1313
|
switch (type) {
|
|
1314
|
+
case DdbType.void: {
|
|
1315
|
+
const str = value === DdbVoidType.default ? 'default' : 'null';
|
|
1316
|
+
return options.colors ? str.grey : str;
|
|
1317
|
+
}
|
|
1319
1318
|
case DdbType.bool:
|
|
1320
1319
|
return inspect((value === null || value === nulls.int8) ?
|
|
1321
1320
|
null
|
|
@@ -1552,11 +1551,11 @@ export function formati(obj, index, options = {}) {
|
|
|
1552
1551
|
}
|
|
1553
1552
|
}
|
|
1554
1553
|
export class DdbVoid extends DdbObj {
|
|
1555
|
-
constructor() {
|
|
1554
|
+
constructor(value = DdbVoidType.undefined) {
|
|
1556
1555
|
super({
|
|
1557
1556
|
form: DdbForm.scalar,
|
|
1558
1557
|
type: DdbType.void,
|
|
1559
|
-
value
|
|
1558
|
+
value,
|
|
1560
1559
|
});
|
|
1561
1560
|
}
|
|
1562
1561
|
}
|