dolphindb 2.0.511 → 2.0.512

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/index.d.ts CHANGED
@@ -51,7 +51,6 @@ export declare enum DdbType {
51
51
  object = 37,
52
52
  symbol_extended = 145
53
53
  }
54
- export declare const ddb_sizes: readonly [0, 1, 1, 2, 4, 8, 4, 4, 4, 4, 4, 4, 8, 8, 8, 4, 8, 0, 0, 16, 0, 0, 0, 0, 0, 0, 1, 0, 0, 16, 16, 0, 0, 0, 0];
55
54
  export declare enum DdbFunctionType {
56
55
  SystemFunc = 0,
57
56
  SystemProc = 1,
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DDB = exports.str2nanotimestamp = exports.nanotimestamp2str = exports.str2timestamp = exports.timestamp2str = exports.datetime2str = exports.date2str = exports.DdbTable = exports.DdbSetString = exports.DdbSetDouble = exports.DdbSetInt = exports.DdbVectorSymbol = exports.DdbVectorAny = exports.DdbVectorString = exports.DdbVectorDouble = exports.DdbVectorInt = exports.DdbFunction = exports.DdbPair = exports.DdbNanoTimeStamp = exports.DdbTimeStamp = exports.DdbDateTime = exports.DdbDouble = exports.DdbLong = exports.DdbString = exports.DdbInt = exports.DdbChar = exports.DdbBool = exports.DdbVoid = exports.DdbObj = exports.timezone_offset = exports.nulls = exports.DdbDurationUnit = exports.DdbFunctionType = exports.ddb_sizes = exports.DdbType = exports.DdbForm = void 0;
3
+ exports.DDB = exports.str2nanotimestamp = exports.nanotimestamp2str = exports.str2timestamp = exports.timestamp2str = exports.datetime2str = exports.date2str = exports.DdbTable = exports.DdbSetString = exports.DdbSetDouble = exports.DdbSetInt = exports.DdbVectorSymbol = exports.DdbVectorAny = exports.DdbVectorString = exports.DdbVectorDouble = exports.DdbVectorInt = exports.DdbFunction = exports.DdbPair = exports.DdbNanoTimeStamp = exports.DdbTimeStamp = exports.DdbDateTime = exports.DdbDouble = exports.DdbLong = exports.DdbString = exports.DdbInt = exports.DdbChar = exports.DdbBool = exports.DdbVoid = exports.DdbObj = exports.timezone_offset = exports.nulls = exports.DdbDurationUnit = exports.DdbFunctionType = exports.DdbType = exports.DdbForm = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ws_1 = require("ws");
6
6
  const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
@@ -60,43 +60,6 @@ var DdbType;
60
60
  DdbType[DdbType["object"] = 37] = "object";
61
61
  DdbType[DdbType["symbol_extended"] = 145] = "symbol_extended";
62
62
  })(DdbType = exports.DdbType || (exports.DdbType = {}));
63
- exports.ddb_sizes = [
64
- 0,
65
- 1,
66
- 1,
67
- 2,
68
- 4,
69
- 8,
70
- 4,
71
- 4,
72
- 4,
73
- 4,
74
- 4,
75
- 4,
76
- 8,
77
- 8,
78
- 8,
79
- 4,
80
- 8,
81
- 0,
82
- 0,
83
- 16,
84
- 0,
85
- 0,
86
- 0,
87
- 0,
88
- 0,
89
- 0,
90
- 1,
91
- 0,
92
- 0,
93
- 16,
94
- 16,
95
- 0,
96
- 0,
97
- 0,
98
- 0, // duration = 36,
99
- ];
100
63
  var DdbFunctionType;
101
64
  (function (DdbFunctionType) {
102
65
  DdbFunctionType[DdbFunctionType["SystemFunc"] = 0] = "SystemFunc";
@@ -373,6 +336,7 @@ class DdbObj {
373
336
  case DdbType.string:
374
337
  case DdbType.symbol:
375
338
  case DdbType.code:
339
+ case DdbType.handle:
376
340
  case DdbType.functiondef: {
377
341
  const i_head = type === DdbType.functiondef ? 1 : 0;
378
342
  let i_zero = buf.indexOf(0, i_head);
@@ -431,7 +395,7 @@ class DdbObj {
431
395
  ];
432
396
  }
433
397
  default:
434
- return [0, buf];
398
+ throw new Error(`${DdbType[type] || type} 暂时不支持解析`);
435
399
  }
436
400
  }
437
401
  /** parse: rows, cols, items
@@ -570,6 +534,7 @@ class DdbObj {
570
534
  ];
571
535
  case DdbType.string:
572
536
  case DdbType.symbol:
537
+ case DdbType.handle:
573
538
  case DdbType.code: {
574
539
  let value = new Array(length);
575
540
  let i_head = 0, i_tail = i_head;
@@ -749,6 +714,7 @@ class DdbObj {
749
714
  case DdbType.string:
750
715
  case DdbType.symbol:
751
716
  case DdbType.code:
717
+ case DdbType.handle:
752
718
  return [
753
719
  DdbObj.enc.encode(value),
754
720
  Uint8Array.of(0),
@@ -775,10 +741,8 @@ class DdbObj {
775
741
  const { unit, data } = this.value;
776
742
  return [Int32Array.of(data, unit)];
777
743
  }
778
- case DdbType.handle:
779
- throw new Error('DolphinDB Server 不支持 handle 的反序列化');
780
744
  default:
781
- throw new Error(`${DdbType[type]} 暂时不支持序列化`);
745
+ throw new Error(`${DdbType[type] || type} 暂时不支持序列化`);
782
746
  }
783
747
  case DdbForm.vector:
784
748
  case DdbForm.pair:
@@ -871,6 +835,7 @@ class DdbObj {
871
835
  return [value];
872
836
  case DdbType.string:
873
837
  case DdbType.symbol:
838
+ case DdbType.handle:
874
839
  case DdbType.code: {
875
840
  let bufs = new Array(length * 2);
876
841
  for (let i = 0; i < length; i++) {