dolphindb 3.0.224 → 3.0.227

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/common.d.ts ADDED
@@ -0,0 +1,300 @@
1
+ import { type Dayjs } from 'dayjs';
2
+ import 'xshell/prototype.common.js';
3
+ export declare const nulls: {
4
+ readonly int8: -128;
5
+ readonly int16: -32768;
6
+ readonly int32: -2147483648;
7
+ readonly int64: -9223372036854775808n;
8
+ readonly int128: -170141183460469231731687303715884105728n;
9
+ readonly float32: -3.4028234663852886e+38;
10
+ /** -Number.MAX_VALUE */
11
+ readonly double: number;
12
+ readonly bytes16: Uint8Array<ArrayBuffer>;
13
+ };
14
+ export declare enum DdbForm {
15
+ scalar = 0,
16
+ vector = 1,
17
+ pair = 2,
18
+ matrix = 3,
19
+ set = 4,
20
+ dict = 5,
21
+ table = 6,
22
+ chart = 7,
23
+ /** 节点内部通信可能会使用,调用函数执行脚本一般不会返回这种类型 */
24
+ chunk = 8,
25
+ /** sysobj */
26
+ object = 9,
27
+ tensor = 10
28
+ }
29
+ /** DolphinDB DataType
30
+ 对应的 array vector 类型为 64 + 基本类型
31
+ 对应的 extended 类型为 128 + 基本类型 */
32
+ export declare enum DdbType {
33
+ void = 0,
34
+ bool = 1,
35
+ char = 2,
36
+ short = 3,
37
+ int = 4,
38
+ long = 5,
39
+ date = 6,
40
+ month = 7,
41
+ time = 8,
42
+ minute = 9,
43
+ second = 10,
44
+ datetime = 11,
45
+ timestamp = 12,
46
+ nanotime = 13,
47
+ nanotimestamp = 14,
48
+ float = 15,
49
+ double = 16,
50
+ symbol = 17,
51
+ string = 18,
52
+ uuid = 19,
53
+ functiondef = 20,
54
+ handle = 21,
55
+ code = 22,
56
+ datasource = 23,
57
+ resource = 24,
58
+ any = 25,
59
+ compressed = 26,
60
+ dict = 27,
61
+ datehour = 28,
62
+ ipaddr = 30,
63
+ int128 = 31,
64
+ blob = 32,
65
+ complex = 34,
66
+ point = 35,
67
+ duration = 36,
68
+ decimal32 = 37,
69
+ decimal64 = 38,
70
+ decimal128 = 39,
71
+ object = 40,
72
+ iotany = 41,
73
+ symbol_extended = 145
74
+ }
75
+ export declare enum DdbFunctionType {
76
+ SystemFunc = 0,
77
+ SystemProc = 1,
78
+ OperatorFunc = 2,
79
+ UserDefinedFunc = 3,
80
+ PartialFunc = 4,
81
+ DynamicFunc = 5,
82
+ PiecewiseFunc = 6,
83
+ JitFunc = 7,
84
+ JitPartialFunc = 8
85
+ }
86
+ export declare enum DdbDurationUnit {
87
+ ns = 0,
88
+ us = 1,
89
+ ms = 2,
90
+ s = 3,
91
+ m = 4,
92
+ H = 5,
93
+ d = 6,
94
+ w = 7,
95
+ M = 8,
96
+ y = 9,
97
+ B = 10
98
+ }
99
+ export declare enum DdbChartType {
100
+ area = 0,
101
+ bar = 1,
102
+ column = 2,
103
+ histogram = 3,
104
+ line = 4,
105
+ pie = 5,
106
+ scatter = 6,
107
+ trend = 7,
108
+ kline = 8
109
+ }
110
+ export declare enum DdbVoidType {
111
+ undefined = 0,
112
+ null = 1,
113
+ default = 2
114
+ }
115
+ export interface DdbFunctionDefValue {
116
+ type: DdbFunctionType;
117
+ name: string;
118
+ }
119
+ export interface DdbDurationValue {
120
+ unit: DdbDurationUnit;
121
+ /** int32 */
122
+ data: number;
123
+ }
124
+ export interface DdbDecimal32Value {
125
+ /** int32, data 需要除以 10^scale 得到原值 */
126
+ scale: number;
127
+ /** int32, 空值为 null ddb null is js null */
128
+ data: number | null;
129
+ }
130
+ export interface DdbDecimal64Value {
131
+ /** int32, data 需要除以 10^scale 得到原值 */
132
+ scale: number;
133
+ /** int64, 空值为 null empty value is null */
134
+ data: bigint | null;
135
+ }
136
+ export interface DdbDecimal128Value {
137
+ /** int32, data 需要除以 10^scale 得到原值 */
138
+ scale: number;
139
+ /** int128, 空值为 null empty value is null */
140
+ data: bigint | null;
141
+ }
142
+ export interface DdbDecimal32VectorValue {
143
+ scale: number;
144
+ data: Int32Array;
145
+ }
146
+ export interface DdbDecimal64VectorValue {
147
+ scale: number;
148
+ data: BigInt64Array;
149
+ }
150
+ export type DdbDurationVectorValue = DdbDurationValue[];
151
+ export interface DdbSymbolExtendedValue {
152
+ base_id: number;
153
+ base: string[];
154
+ data: Uint32Array;
155
+ }
156
+ export declare const dictables: Set<DdbType>;
157
+ /** 工具,取得某个 DdbType 的字节数 */
158
+ export declare const ddb_tensor_bytes: Record<DdbType.bool | DdbType.char | DdbType.short | DdbType.int | DdbType.long | DdbType.float | DdbType.double, number>;
159
+ export type TensorElem = TensorData | boolean | number | bigint | null | string;
160
+ export interface TensorData extends Array<TensorElem> {
161
+ }
162
+ export interface DdbTensorMetadata {
163
+ /** Tensor 的元素的数据类型 */
164
+ data_type: DdbType;
165
+ /** Tensor 类型 */
166
+ tensor_type: number;
167
+ /** 设备类型 */
168
+ device_type: number;
169
+ /** Tensor Flags */
170
+ tensor_flags: number;
171
+ /** 维度 */
172
+ dimensions: number;
173
+ /** shape, shape[i] 表示第 i 个维度的 size */
174
+ shape: number[];
175
+ /** strides, strides[i] 表示在第 i 个维度,一个元素与下一个元素的距离 */
176
+ strides: number[];
177
+ /** 保留值 */
178
+ preserve_value: bigint;
179
+ /** 元素个数 */
180
+ elem_count: number;
181
+ }
182
+ export interface DdbTensorValue extends DdbTensorMetadata {
183
+ /** 数据 */
184
+ data: Uint8Array;
185
+ }
186
+ /** DdbObj.data() 返回的表格对象 */
187
+ export interface DdbTableData<TRow = any> {
188
+ /** 表名 */
189
+ name: string;
190
+ /** 每一列的名称 */
191
+ columns: string[];
192
+ /** 每一列的原始 ddb 数据类型 */
193
+ types: DdbType[];
194
+ /** 表格数据,每一行的对象组成的数组 */
195
+ data: TRow[];
196
+ }
197
+ /** DdbObj.data() 返回的 Tensor 对象 */
198
+ export interface DdbTensorData extends DdbTensorMetadata {
199
+ /** 数据 */
200
+ data: TensorData;
201
+ }
202
+ /** DdbObj.data() 返回的矩阵对象 */
203
+ export interface DdbMatrixData {
204
+ /** 原始数据类型 */
205
+ type: DdbType;
206
+ /** 行数 */
207
+ nrows: number;
208
+ /** 列数 */
209
+ ncolumns: number;
210
+ /** 行名称 */
211
+ rows?: any[];
212
+ /** 列名称 */
213
+ columns?: any[];
214
+ /** 数据, data[0][1] 为第 0 行第 1 列数据 */
215
+ data: any[][];
216
+ }
217
+ export type DdbScalarValue = null | boolean | number | bigint | string | Uint8Array | // uuid, ipaddr, int128, blob
218
+ [
219
+ number,
220
+ number
221
+ ] | // complex, point
222
+ DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal128Value;
223
+ export type IotVectorItemValue = [number | string | bigint | boolean][];
224
+ /** 根据 DdbType 获取其名称,array vector type 自动在后面加上 [] */
225
+ export declare function get_type_name(type: DdbType): string;
226
+ export declare function is_decimal_type(type: DdbType): type is DdbType.decimal32 | DdbType.decimal64 | DdbType.decimal128;
227
+ export declare function is_decimal_null_value(type: DdbType, value: number | bigint): boolean;
228
+ export declare function get_duration_unit(code: number): string;
229
+ export declare function get_ddb_time_value(classname: 'DdbDateTime' | 'DdbTimeStamp' | 'DdbNanoTimeStamp' | 'DdbDate', value: null | number | string | Date | Dayjs): number | bigint | null;
230
+ export declare function get_big_uint_128(dataview: DataView, byte_offset: number, le?: boolean): bigint;
231
+ export declare function get_big_int_128(dataview: DataView, byte_offset: number, le?: boolean): bigint;
232
+ export declare function set_big_uint_128(dataView: DataView, byte_offset: number, value: bigint, le?: boolean): void;
233
+ export declare function set_big_int_128(dataview: DataView, byte_offset: number, value: bigint, le?: boolean): void;
234
+ export declare function generate_array_type(baseType: string, dimensions: number[]): string;
235
+ export declare function date2ms(date: number | null): number;
236
+ export declare function date2str(date: number | null, format?: string): string;
237
+ export declare function month2ms(month: number | null): number | null;
238
+ export declare function month2str(month: number | null): string;
239
+ export declare function time2ms(time: number | null): number | null;
240
+ export declare function time2str(time: number | null, format?: string): string;
241
+ export declare function minute2ms(minute: number | null): number | null;
242
+ export declare function minute2str(minute: number | null, format?: string): string;
243
+ export declare function second2ms(second: number | null): number | null;
244
+ export declare function second2str(second: number | null, format?: string): string;
245
+ export declare function datetime2ms(datetime: number | null): number | null;
246
+ export declare function datetime2str(datetime: number | null, format?: string): string;
247
+ /** _datetime_formatter.format 会在 date 为 Invalid Date 时抛出错误 */
248
+ export declare function timestamp2ms(timestamp: bigint | number | null): number | null;
249
+ /** format timestamp (bigint) to string
250
+ - timestamp: bigint value
251
+ - format?:
252
+ 格式串,默认是 `YYYY.MM.DD HH:mm:ss.SSS` format string, default to `YYYY.MM.DD HH:mm:ss.SSS`
253
+ https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens */
254
+ export declare function timestamp2str(timestamp: bigint | null, format?: string): string;
255
+ export declare function datehour2ms(datehour: number | null): number | null;
256
+ export declare function datehour2str(datehour: number | null, format?: string): string;
257
+ /** parse timestamp string to bigint value
258
+ - str: timestamp string, 如果为空字符串或 'null' 会返回对应的空值 (nulls.int64)
259
+ timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
260
+ - format?:
261
+ 对应传入字符串的格式串,默认是 `YYYY.MM.DD HH:mm:ss.SSS`
262
+ The format string corresponding to the incoming string, the default is `YYYY.MM.DD HH:mm:ss.SSS`
263
+ https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens */
264
+ export declare function str2timestamp(str: string, format?: string): bigint;
265
+ export declare function nanotime2ns(nanotime: bigint | null): bigint | null;
266
+ export declare function nanotime2str(nanotime: bigint | null, format?: string): string;
267
+ export declare function nanotimestamp2ns(nanotimestamp: bigint | null): bigint | null;
268
+ /** format nanotimestamp value (bigint) to string
269
+ - nanotimestamp: bigint value
270
+ - format?:
271
+ 格式串,默认是 `YYYY.MM.DD HH:mm:ss.SSSSSSSSS` format string, default is `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
272
+ 秒的格式为 ss (必须包含); 纳秒的格式为 SSSSSSSSS (必须包含) Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
273
+ https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
274
+ */
275
+ export declare function nanotimestamp2str(nanotimestamp: bigint | null, format?: string): string;
276
+ /** parse nano timestamp string to bigint value
277
+ - str: nano timestamp string, 如果为空字符串或 'null' 会返回对应的空值 (nulls.int64)
278
+ nano timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
279
+ - format?:
280
+ 对应传入字符串的格式串,默认是 `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
281
+ 秒的格式为 ss (必须包含); 纳秒的格式为 SSSSSSSSS (必须包含)
282
+ https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
283
+ The format string corresponding to the incoming string, the default is `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
284
+ Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included) */
285
+ export declare function str2nanotimestamp(str: string, format?: string): bigint;
286
+ export declare function ipaddr2str(buffer: Uint8Array, le?: boolean, ipv6?: boolean): string;
287
+ export declare function uuid2str(buffer: Uint8Array, le?: boolean): string;
288
+ export declare function int1282str(buffer: Uint8Array, le?: boolean): string;
289
+ export interface ConvertOptions {
290
+ /** `'string'` blob 转换格式 */
291
+ blob?: 'string' | 'binary';
292
+ /** `'string'` char 转换格式: string 转为 string[],number 转为 number[] */
293
+ char?: 'string' | 'number';
294
+ /** `'strings'` char vector 转换格式: strings 转为 string[], binary 转为 Uint8Array */
295
+ chars?: 'strings' | 'binary';
296
+ /** `'ms'` timestamp 类型转换为字符串表示时显示到秒还是毫秒 */
297
+ timestamp?: 's' | 'ms';
298
+ }
299
+ export declare const winsize: 10000;
300
+ export type DdbRpcType = 'script' | 'function' | 'variable' | 'connect';