dolphindb 3.1.1 → 3.1.3
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 +3 -3
- package/browser.js +30 -5
- package/browser.js.map +1 -1
- package/common.d.ts +9 -1
- package/common.js +3 -0
- package/common.js.map +1 -1
- package/i18n/dict.json +3 -0
- package/index.d.ts +3 -3
- package/index.js +30 -5
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/test.js.map +1 -1
package/browser.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Dayjs } from 'dayjs';
|
|
|
2
2
|
import 'xshell/prototype.browser.js';
|
|
3
3
|
import { Lock } from 'xshell/utils.browser.js';
|
|
4
4
|
import { type WebSocketConnectionError } from 'xshell/net.browser.js';
|
|
5
|
-
import { DdbChartType, DdbForm, DdbFunctionType, DdbType, DdbVoidType, type ConvertOptions, type DdbDecimal32Value, type DdbDecimal32VectorValue, type DdbDecimal64Value, type DdbDecimal64VectorValue, type DdbDurationValue, type DdbDurationVectorValue, type DdbFunctionDefValue, type DdbRpcType, type DdbScalarValue, type DdbSymbolExtendedValue, type DdbTableData, type DdbTensorValue, type IotVectorItemValue, type TensorData } from './common.ts';
|
|
5
|
+
import { DdbChartType, DdbForm, DdbFunctionType, DdbType, DdbVoidType, type ConvertOptions, type DdbDecimal32Value, type DdbDecimal32VectorValue, type DdbDecimal64Value, type DdbDecimal64VectorValue, type DdbDurationValue, type DdbDurationVectorValue, type DdbFunctionDefValue, type DdbRpcType, type DdbScalarValue, type DdbSymbolExtendedValue, type DdbTableData, type DdbTensorValue, type IotVectorItemValue, type TensorData, type DdbExtObjValue } from './common.ts';
|
|
6
6
|
export * from './common.ts';
|
|
7
7
|
export interface DdbDecimal128VectorValue {
|
|
8
8
|
scale: number;
|
|
@@ -51,7 +51,7 @@ export interface DdbChartValue {
|
|
|
51
51
|
};
|
|
52
52
|
data: DdbMatrixObj;
|
|
53
53
|
}
|
|
54
|
-
export type DdbValue = DdbScalarValue | DdbVectorValue | DdbMatrixValue | DdbDictValue | DdbChartValue | DdbTensorValue;
|
|
54
|
+
export type DdbValue = DdbScalarValue | DdbVectorValue | DdbMatrixValue | DdbDictValue | DdbChartValue | DdbTensorValue | DdbExtObjValue;
|
|
55
55
|
export type DdbStringObj = DdbObj<string>;
|
|
56
56
|
export type DdbVectorObj<TValue extends DdbVectorValue = DdbVectorValue> = DdbObj<TValue>;
|
|
57
57
|
export type DdbVectorAnyObj = DdbVectorObj<DdbObj[]>;
|
|
@@ -185,7 +185,7 @@ export interface InspectOptions {
|
|
|
185
185
|
export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
|
|
186
186
|
/** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
|
|
187
187
|
export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
|
|
188
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean |
|
|
188
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | string[] | DdbExtObjValue | number[] | DdbTensorValue | Uint8Array<ArrayBufferLike> | DdbDecimal128VectorValue | BigInt128Array | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | IotVectorItemValue | DdbArrayVectorValue | DdbDurationVectorValue | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | DdbMatrixValue | DdbChartValue;
|
|
189
189
|
/** 转换一个向量到 js 原生数组 */
|
|
190
190
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
|
|
191
191
|
/** 构造 void 类型,默认为 `DdbVoidType.undefined` */
|
package/browser.js
CHANGED
|
@@ -283,6 +283,23 @@ export class DdbObj {
|
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
|
+
case DdbForm.extobj: {
|
|
287
|
+
const dv = new DataView(buf_data.buffer, buf_data.byteOffset, buf_data.byteLength);
|
|
288
|
+
const version_and_size = dv.getUint32(4, le);
|
|
289
|
+
const length = version_and_size & 0x00ffffff;
|
|
290
|
+
return new this({
|
|
291
|
+
le,
|
|
292
|
+
form,
|
|
293
|
+
type,
|
|
294
|
+
// 低 24 位为 size
|
|
295
|
+
length: i_data + 8 + length,
|
|
296
|
+
value: {
|
|
297
|
+
type: buf_data.subarray(0, 4),
|
|
298
|
+
version: (version_and_size >>> 24) & 0xff,
|
|
299
|
+
data: buf_data.subarray(8, 8 + length)
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
286
303
|
default:
|
|
287
304
|
return new this({
|
|
288
305
|
le,
|
|
@@ -989,8 +1006,14 @@ export class DdbObj {
|
|
|
989
1006
|
uint8Array.set(data, dataStart);
|
|
990
1007
|
return [uint8Array];
|
|
991
1008
|
}
|
|
1009
|
+
case DdbForm.extobj: {
|
|
1010
|
+
const { data, type: exttype, version } = value;
|
|
1011
|
+
let version_and_size = new Uint8Array(4);
|
|
1012
|
+
version_and_size.dataview.setUint32(0, (version << 24) | data.length, this.le);
|
|
1013
|
+
return [exttype, version_and_size, data];
|
|
1014
|
+
}
|
|
992
1015
|
default:
|
|
993
|
-
throw new Error(t('
|
|
1016
|
+
throw new Error(t('{{form}} 暂不支持序列化', { form: DdbForm[form] || `form ${form}` }));
|
|
994
1017
|
}
|
|
995
1018
|
})();
|
|
996
1019
|
if (!body)
|
|
@@ -1148,7 +1171,7 @@ export class DdbObj {
|
|
|
1148
1171
|
case DdbForm.tensor: {
|
|
1149
1172
|
const { data_type, tensor_type, device_type, tensor_flags, dimensions, shape, strides, preserve_value, elem_count, data, } = this.value;
|
|
1150
1173
|
const dataByte = ddb_tensor_bytes[data_type];
|
|
1151
|
-
|
|
1174
|
+
return {
|
|
1152
1175
|
data_type,
|
|
1153
1176
|
tensor_type,
|
|
1154
1177
|
device_type,
|
|
@@ -1160,10 +1183,12 @@ export class DdbObj {
|
|
|
1160
1183
|
elem_count,
|
|
1161
1184
|
data: DdbObj.parse_tensor({ currentDim: 0, dimensions, rawData: data, le: this.le, dataByte, dataType: data_type, shape, strides })
|
|
1162
1185
|
};
|
|
1163
|
-
return returnData;
|
|
1164
1186
|
}
|
|
1187
|
+
case DdbForm.extobj:
|
|
1188
|
+
// return (this.value as DdbExtObjValue).data as TResult
|
|
1189
|
+
return `ExtObj<${get_type_name(type)}>`;
|
|
1165
1190
|
default:
|
|
1166
|
-
throw new Error(t('{{form}} {{type}} 暂不支持 data()', { form, type: get_type_name(type) }));
|
|
1191
|
+
throw new Error(t('{{form}} {{type}} 暂不支持 data()', { form: DdbForm[form] || form, type: get_type_name(type) }));
|
|
1167
1192
|
}
|
|
1168
1193
|
}
|
|
1169
1194
|
/** 构建 Tensor
|
|
@@ -2957,7 +2982,7 @@ export class DDB {
|
|
|
2957
2982
|
}
|
|
2958
2983
|
let result;
|
|
2959
2984
|
if (function_definition_pattern.test(func))
|
|
2960
|
-
func = await this.define(func);
|
|
2985
|
+
func = await this.define(func, { urgent: options?.urgent });
|
|
2961
2986
|
if (convertable)
|
|
2962
2987
|
result = await this.call(func, args, options);
|
|
2963
2988
|
else {
|