dolphindb 3.1.34 → 3.1.35

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/example.html ADDED
@@ -0,0 +1,18 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>DolphinDB</title>
5
+ <meta charset='utf-8' />
6
+ </head>
7
+ <body>
8
+ <div>open devtools (press f12) to view output</div>
9
+ <script type="module">
10
+ import { DDB } from 'https://cdn.dolphindb.cn/assets/api.js'
11
+
12
+ let ddb = new DDB('ws://127.0.0.1:8848')
13
+
14
+ console.log(
15
+ await ddb.execute('1 + 1'))
16
+ </script>
17
+ </body>
18
+ </html>
package/index.d.ts CHANGED
@@ -175,7 +175,7 @@ export interface InspectOptions extends UtilInspectOptions {
175
175
  export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
176
176
  /** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
177
177
  export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
178
- export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | string[] | DdbExtObjValue | DdbTensorValue | Uint8Array<ArrayBufferLike> | IotVectorItemValue | DdbDurationVectorValue | DdbDecimal128VectorValue | BigInt128Array | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | DdbArrayVectorValue | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | DdbMatrixValue | DdbChartValue;
178
+ export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | string[] | number[] | Uint8Array<ArrayBufferLike> | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | IotVectorItemValue | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | DdbTensorValue | DdbExtObjValue;
179
179
  /** 转换一个向量到 js 原生数组 */
180
180
  export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
181
181
  /** 构造 void 类型,默认为 `DdbVoidType.undefined` */
package/index.js CHANGED
@@ -947,12 +947,18 @@ export class DdbObj {
947
947
  return [value[0].pack(), value[1].pack()];
948
948
  case DdbForm.chart: {
949
949
  const { type, stacking, bin_start, bin_end, bin_count, titles: { chart, x_axis, y_axis, z_axis }, extras, data } = this.value;
950
+ let titles = [];
951
+ for (const title of [chart, x_axis, y_axis, z_axis])
952
+ if (empty(title))
953
+ break;
954
+ else
955
+ titles.push(title);
950
956
  const { value: [keys, values] } = new DdbDict({
951
957
  chartType: new DdbInt(type),
952
958
  stacking,
953
959
  ...bin_start ? { binStart: bin_start, binEnd: bin_end } : {},
954
960
  ...bin_count ? { binCount: bin_count } : {},
955
- title: new DdbVectorString([chart, x_axis, y_axis, z_axis]),
961
+ title: new DdbVectorString(titles),
956
962
  ...extras ? (() => {
957
963
  const { multi_y_axes, ...extras_other } = extras;
958
964
  return { extras: new DdbDict({ multiYAxes: multi_y_axes, ...extras_other }) };