dolphindb 3.1.30 → 3.1.32

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/i18n/dict.json CHANGED
@@ -121,5 +121,8 @@
121
121
  },
122
122
  "value 不能转换为 {{typename}}": {
123
123
  "en": "value cannot be converted to {{typename}}"
124
+ },
125
+ "ddb.cancel 无 ticket,尝试通过密码 login 失败": {
126
+ "en": "ddb.cancel has no ticket, attempt to login using password failed"
124
127
  }
125
128
  }
package/index.d.ts CHANGED
@@ -174,7 +174,7 @@ export interface InspectOptions extends UtilInspectOptions {
174
174
  export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
175
175
  /** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
176
176
  export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
177
- export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | string[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | DdbExtObjValue | DdbTensorValue | Uint8Array<ArrayBufferLike> | IotVectorItemValue | DdbDurationVectorValue | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | DdbArrayVectorValue | DdbDecimal128VectorValue | DdbMatrixValue | DdbChartValue;
177
+ 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
178
  /** 转换一个向量到 js 原生数组 */
179
179
  export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
180
180
  /** 构造 void 类型,默认为 `DdbVoidType.undefined` */
package/index.js CHANGED
@@ -2908,13 +2908,21 @@ export class DDB {
2908
2908
  /** 取消当前 session id 对应的所有 console jobs Cancel all console jobs corresponding to the current session id */
2909
2909
  async cancel() {
2910
2910
  let ddb = new DDB(this.url, {
2911
- autologin: this.autologin,
2911
+ // 如果有 ticket,则认为能够自动登录,并启用,否则禁用,尝试一下用户名密码登录
2912
+ autologin: Boolean(this.ticket),
2912
2913
  ticket: this.ticket,
2913
2914
  username: this.username,
2914
2915
  password: this.password,
2915
2916
  proxy: this.proxy,
2916
2917
  verbose: this.verbose
2917
2918
  });
2919
+ if (!this.ticket)
2920
+ try {
2921
+ await this.invoke('login', [this.username, this.password]);
2922
+ }
2923
+ catch (error) {
2924
+ console.log(t('ddb.cancel 无 ticket,尝试通过密码 login 失败'));
2925
+ }
2918
2926
  try {
2919
2927
  // 因为是新建的连接,而且执行完脚本之后马上就关闭了,所以不用考虑变量泄漏的问题
2920
2928
  await ddb.eval(`jobs = exec rootJobId from getConsoleJobs() where sessionId = ${this.sid}\n` +