dolphindb 3.1.14 → 3.1.15
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 +1 -1
- package/browser.js +6 -4
- package/browser.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +7 -5
- package/index.js.map +1 -1
- package/package.json +1 -1
package/browser.d.ts
CHANGED
|
@@ -184,7 +184,7 @@ export interface InspectOptions {
|
|
|
184
184
|
export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
|
|
185
185
|
/** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
|
|
186
186
|
export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
|
|
187
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean |
|
|
187
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | Uint8Array<ArrayBufferLike> | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | string[] | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | IotVectorItemValue | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | DdbTensorValue | DdbExtObjValue;
|
|
188
188
|
/** 转换一个向量到 js 原生数组 */
|
|
189
189
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
|
|
190
190
|
/** 构造 void 类型,默认为 `DdbVoidType.undefined` */
|
package/browser.js
CHANGED
|
@@ -871,7 +871,7 @@ export class DdbObj {
|
|
|
871
871
|
case DdbType.handle:
|
|
872
872
|
case DdbType.datasource:
|
|
873
873
|
case DdbType.resource:
|
|
874
|
-
|
|
874
|
+
check(!value.includes('\0'), t('pack 时字符串中间不能含有 \\0, 否则上传给 DolphinDB 会导致连接断开'));
|
|
875
875
|
return [
|
|
876
876
|
DdbObj.enc.encode(value),
|
|
877
877
|
Uint8Array.of(0),
|
|
@@ -1057,7 +1057,7 @@ export class DdbObj {
|
|
|
1057
1057
|
let bufs = new Array(length * 2);
|
|
1058
1058
|
for (let i = 0; i < length; i++) {
|
|
1059
1059
|
const s = value[i];
|
|
1060
|
-
|
|
1060
|
+
check(!s.includes('\0'), t('pack 时字符串中间不能含有 \\0, 否则上传给 DolphinDB 会导致连接断开'));
|
|
1061
1061
|
bufs[2 * i] = this.enc.encode(s);
|
|
1062
1062
|
bufs[2 * i + 1] = Uint8Array.of(0);
|
|
1063
1063
|
}
|
|
@@ -1740,7 +1740,7 @@ export function format(type, value, le, options = {}) {
|
|
|
1740
1740
|
}
|
|
1741
1741
|
/** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
|
|
1742
1742
|
export function formati(obj, index, options = {}) {
|
|
1743
|
-
|
|
1743
|
+
check(index < obj.rows, 'index < obj.rows');
|
|
1744
1744
|
if (obj.type < 64 || obj.type >= 128) // 普通数组
|
|
1745
1745
|
switch (obj.type) {
|
|
1746
1746
|
case DdbType.symbol_extended: {
|
|
@@ -1774,6 +1774,8 @@ export function formati(obj, index, options = {}) {
|
|
|
1774
1774
|
const str = (x < 0 ? '-' : '') + (scale ? `${s.slice(0, -scale) || '0'}.${s.slice(-scale)}` : s);
|
|
1775
1775
|
return options.colors ? green(str) : str;
|
|
1776
1776
|
}
|
|
1777
|
+
case DdbType.any:
|
|
1778
|
+
return obj.value[index].toString(options);
|
|
1777
1779
|
default:
|
|
1778
1780
|
return format(obj.type, obj.value[index], obj.le, options);
|
|
1779
1781
|
}
|
|
@@ -2098,7 +2100,7 @@ export class DdbDate extends DdbObj {
|
|
|
2098
2100
|
}
|
|
2099
2101
|
export class DdbBlob extends DdbObj {
|
|
2100
2102
|
constructor(value) {
|
|
2101
|
-
|
|
2103
|
+
check(value, t('new DdbBlob 不能传空的 value'));
|
|
2102
2104
|
super({
|
|
2103
2105
|
form: DdbForm.scalar,
|
|
2104
2106
|
type: DdbType.blob,
|