@sswroom/sswr 1.6.3 → 1.6.5

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/certutil.d.ts CHANGED
@@ -48,7 +48,7 @@ export enum RuleCond
48
48
  RepeatIfTypeIs,
49
49
  LastOIDAndTypeIs,
50
50
  AllNotMatch
51
- };
51
+ }
52
52
 
53
53
  declare class PDULenInfo
54
54
  {
@@ -88,7 +88,7 @@ export class ASN1Util
88
88
  static pduDSizeEnd(reader: data.ByteReader, startOfst: number, endOfst: number): number | null;
89
89
  static pduGetItem(reader: data.ByteReader, startOfst: number, endOfst: number, path: string): PDUInfo;
90
90
  static pduGetItemType(reader: data.ByteReader, startOfst: number, endOfst: number, path: string): ASN1ItemType;
91
- static pduCountItem(reader: data.ByteReader, startOfst: number, endOfst: number, path?: string): number;
91
+ static pduCountItem(reader: data.ByteReader, startOfst: number, endOfst: number, path?: string | null): number;
92
92
  static pduIsValid(reader: data.ByteReader, startOfst: number, endOfst: number): boolean;
93
93
  // static void PDUAnalyse(NotNullPtr<IO::FileAnalyse::FrameDetail> frame, Data::ByteArrayR buff, UOSInt pduOfst, UOSInt pduEndOfst, Net::ASN1Names *names);
94
94
 
@@ -160,19 +160,19 @@ export class ASN1Names
160
160
  setPFX(): ASN1Names; //PKCS-12
161
161
  }
162
162
 
163
- class General
163
+ declare class General
164
164
  {
165
165
  static pbeParam(names: ASN1Names): void;
166
166
  static extendedValidationCertificates(names: ASN1Names): void;
167
167
  static attributeOutlookExpress(names: ASN1Names): void;
168
168
  }
169
169
 
170
- class InformationFramework
170
+ declare class InformationFramework
171
171
  {
172
172
  static attributeCont(names: ASN1Names): void;
173
173
  }
174
174
 
175
- class PKCS1
175
+ declare class PKCS1
176
176
  {
177
177
  static rsaPublicKey(names: ASN1Names): void;
178
178
  static rsaPublicKeyCont(names: ASN1Names): void;
@@ -183,7 +183,7 @@ class PKCS1
183
183
  static digestInfoCont(names: ASN1Names): void;
184
184
  }
185
185
 
186
- class PKCS7
186
+ declare class PKCS7
187
187
  {
188
188
  static addContentInfo(names: ASN1Names, name: string): void;
189
189
  static contentInfo(names: ASN1Names): void;
@@ -214,7 +214,7 @@ class PKCS7
214
214
  static authenticatedData(names: ASN1Names): void;
215
215
  }
216
216
 
217
- class PKCS8
217
+ declare class PKCS8
218
218
  {
219
219
  static privateKeyInfo(names: ASN1Names): void;
220
220
  static privateKeyInfoCont(names: ASN1Names): void;
@@ -222,7 +222,7 @@ class PKCS8
222
222
  static encryptedPrivateKeyInfoCont(names: ASN1Names): void;
223
223
  }
224
224
 
225
- class PKCS9
225
+ declare class PKCS9
226
226
  {
227
227
  static attributeContentType(names: ASN1Names): void;
228
228
  static attributeMessageDigest(names: ASN1Names): void;
@@ -234,7 +234,7 @@ class PKCS9
234
234
  static smimeCapabilityCont(names: ASN1Names): void;
235
235
  }
236
236
 
237
- class PKCS10
237
+ declare class PKCS10
238
238
  {
239
239
  static addCertificationRequestInfo(names: ASN1Names, name: string): void;
240
240
  static certificationRequestInfoCont(names: ASN1Names): void;
@@ -243,7 +243,7 @@ class PKCS10
243
243
  static certificationRequestCont(names: ASN1Names): void;
244
244
  }
245
245
 
246
- class PKCS12
246
+ declare class PKCS12
247
247
  {
248
248
  static pfx(names: ASN1Names): void;
249
249
  static pfxCont(names: ASN1Names): void;
@@ -272,7 +272,7 @@ class PKCS12
272
272
  static pkcs12Attributes(names: ASN1Names): void;
273
273
  }
274
274
 
275
- class PKIX1Explicit88
275
+ declare class PKIX1Explicit88
276
276
  {
277
277
  static addAttributeTypeAndValue(names: ASN1Names, name: string): void;
278
278
  static attributeTypeAndValueCont(names: ASN1Names): void;
package/certutil.js CHANGED
@@ -489,7 +489,7 @@ export class ASN1Util
489
489
  case 0x1E:
490
490
  sb = ["\t".repeat(level)];
491
491
  if (name) sb.push(name+" ")
492
- if (len & 1)
492
+ if (len.pduLen & 1)
493
493
  {
494
494
  sb.push("BMPString (");
495
495
  sb.push(text.u8Arr2Hex(new Uint8Array(reader.getArrayBuffer(len.nextOfst, len.pduLen)), ' ', null));
@@ -1032,6 +1032,10 @@ export class ASN1Util
1032
1032
  return sb.join(".");
1033
1033
  }
1034
1034
 
1035
+ /**
1036
+ * @param {string} oidText
1037
+ * @returns {number[] | null}
1038
+ */
1035
1039
  static oidText2PDU(oidText)
1036
1040
  {
1037
1041
  let sarr = oidText.split(".");
@@ -1226,6 +1230,10 @@ class RuleContainer
1226
1230
  constructor()
1227
1231
  {
1228
1232
  this.rules = [];
1233
+ /**
1234
+ * @type {RuleContainer | null}
1235
+ */
1236
+ this.parent = null;
1229
1237
  }
1230
1238
  }
1231
1239
 
@@ -2103,11 +2111,6 @@ class PKIX1Explicit88
2103
2111
  names.typeIs(ASN1ItemType.SEQUENCE).container(name, PKIX1Explicit88.rdnSequenceCont);
2104
2112
  }
2105
2113
 
2106
- static name(names)
2107
- {
2108
- names.typeIs(ASN1ItemType.SEQUENCE).container("Name", PKIX1Explicit88.rdnSequenceCont);
2109
- }
2110
-
2111
2114
  static rdnSequenceCont(names)
2112
2115
  {
2113
2116
  names.repeatIfTypeIs(ASN1ItemType.SET).container("rdnSequence", PKIX1Explicit88.relativeDistinguishedNameCont);
@@ -2562,6 +2565,8 @@ export class ASN1PDUBuilder
2562
2565
  appendOIDString(oidStr)
2563
2566
  {
2564
2567
  let buff = ASN1Util.oidText2PDU(oidStr);
2568
+ if (buff == null)
2569
+ throw new Error("\""+oidStr+"\" is not valid oid string");
2565
2570
  this.appendOID(new Uint8Array(buff).buffer);
2566
2571
  }
2567
2572
 
package/data.d.ts CHANGED
@@ -1,3 +1,22 @@
1
+ export enum Weekday
2
+ {
3
+ Sunday,
4
+ Monday,
5
+ Tuesday,
6
+ Wednesday,
7
+ Thursday,
8
+ Friday,
9
+ Saturday
10
+ }
11
+
12
+ interface StringMap<Type> {
13
+ [key: string]: Type;
14
+ }
15
+
16
+ interface NumberMap<Type> {
17
+ [key: number]: Type;
18
+ }
19
+
1
20
  export function isArray(o: any): boolean;
2
21
  export function isObject(o: any): boolean;
3
22
  export function toObjectString(o: any, lev: number): string;
@@ -5,7 +24,7 @@ export function arrayBuffer2Base64(buff: ArrayBuffer): string;
5
24
  export function arrayBufferEquals(buff1: ArrayBuffer, buff2: ArrayBuffer): boolean;
6
25
  export function compare(a: any, b: any): number;
7
26
  export function sort(arr: object[], compareFunc?: (val1: object, val2: object) => number, firstIndex?: number, lastIndex?: number): void;
8
- export function mergeOptions(options: object | null, defOptions: object): object;
27
+ export function mergeOptions<OptionType>(options: object | null, defOptions: OptionType): OptionType;
9
28
  export function readUInt16(arr: Uint8Array, index: number): number;
10
29
  export function readMUInt16(arr: Uint8Array, index: number): number;
11
30
  export function readUInt24(arr: Uint8Array, index: number): number;
@@ -53,11 +72,14 @@ export class DateTimeUtil
53
72
  static secs2TimeValue(secs: bigint, tzQhr?: number): TimeValue;
54
73
  static totalDays2DateValue(totalDays: number, d: DateValue): void;
55
74
  static instant2TimeValue(secs: bigint, nanosec: number, tzQhr?: number): TimeValue;
75
+ static ticks2Weekday(ticks: number, tzQhr: number): Weekday;
56
76
  static toString(tval: TimeValue, pattern: string): string;
57
77
  static string2TimeValue(dateStr: string, tzQhr?: number): TimeValue;
78
+ static timeValueFromYMDHMS(ymdhms: number | bigint): TimeValue | null;
58
79
  static isYearLeap(year: number): boolean;
59
80
  static parseYearStr(year: string): number;
60
81
  static parseMonthStr(month: string): number;
82
+ static dayInMonth(year: number, month: number): number;
61
83
  static getLocalTzQhr(): number;
62
84
  }
63
85
 
@@ -98,6 +120,7 @@ export class LocalDate
98
120
  toString(pattern: string | null): string;
99
121
  compareTo(obj: Date): number;
100
122
  isNull(): boolean;
123
+ getWeekday(): Weekday;
101
124
  static today(): LocalDate;
102
125
  static fromStr(s: string): LocalDate | null;
103
126
  }
@@ -131,9 +154,13 @@ export class TimeInstant
131
154
  toEpochSec(): bigint;
132
155
  toEpochMS(): bigint;
133
156
  toEpochNS(): bigint;
157
+ static fromDotNetTicks(ticks: bigint | number): TimeInstant;
134
158
  }
135
159
 
136
160
  export class Timestamp {
161
+ inst: TimeInstant;
162
+ tzQhr: number;
163
+
137
164
  constructor(inst: TimeInstant, tzQhr?: number);
138
165
  static fromTicks(ticks: number | number, tzQhr?: number): Timestamp;
139
166
  static fromStr(str: string, defTzQhr?: number): Timestamp | null;
@@ -167,6 +194,7 @@ export class Timestamp {
167
194
  diffMS(ts: Timestamp): number;
168
195
  diffSecDbl(ts: Timestamp): number;
169
196
  diff(ts: Timestamp): number;
197
+ toDate(): LocalDate;
170
198
  toTicks(): number;
171
199
  toDotNetTicks(): number;
172
200
  toUnixTimestamp(): number;
package/data.js CHANGED
@@ -1,5 +1,15 @@
1
1
  import * as text from "./text.js";
2
2
 
3
+ export const Weekday = {
4
+ Sunday: 0,
5
+ Monday: 1,
6
+ Tuesday: 2,
7
+ Wednesday: 3,
8
+ Thursday: 4,
9
+ Friday: 5,
10
+ Saturday: 6
11
+ }
12
+
3
13
  export function isArray(o)
4
14
  {
5
15
  return o != null && o.constructor === Array;
@@ -539,7 +549,7 @@ export class DateTimeUtil
539
549
 
540
550
  static timeValue2Ticks(t)
541
551
  {
542
- return DateTimeUtil.timeValue2Secs(t) * 1000n + Math.floor(t.nanosec / 1000000);
552
+ return DateTimeUtil.timeValue2Secs(t) * 1000n + BigInt(Math.floor(t.nanosec / 1000000));
543
553
  }
544
554
 
545
555
  static ticks2TimeValue(ticks, tzQhr)
@@ -803,7 +813,7 @@ export class DateTimeUtil
803
813
  secs -= totalDays * 86400n;
804
814
  while (secs < 0)
805
815
  {
806
- totalDays -= 1;
816
+ totalDays -= 1n;
807
817
  secs += 86400n;
808
818
  }
809
819
  minutes = Number(secs % 86400n);
@@ -824,6 +834,19 @@ export class DateTimeUtil
824
834
  return t;
825
835
  }
826
836
 
837
+ static ticks2Weekday(ticks, tzQhr)
838
+ {
839
+ let days = ((ticks + tzQhr * 900000) / 86400000 + 4);
840
+ if (days >= 0)
841
+ {
842
+ return (days % 7);
843
+ }
844
+ else
845
+ {
846
+ return ((days % 7) + 7);
847
+ }
848
+ }
849
+
827
850
  static toString(tval, pattern)
828
851
  {
829
852
  let output = new Array();
@@ -1065,12 +1088,12 @@ export class DateTimeUtil
1065
1088
  }
1066
1089
  else if (pattern[3] != 'M')
1067
1090
  {
1068
- output.push(data.DateTimeUtil.monString[tval.month - 1]);
1091
+ output.push(DateTimeUtil.monString[tval.month - 1]);
1069
1092
  i += 3;
1070
1093
  }
1071
1094
  else
1072
1095
  {
1073
- output.push(data.DateTimeUtil.monthString[tval.month - 1]);
1096
+ output.push(DateTimeUtil.monthString[tval.month - 1]);
1074
1097
  i += 4;
1075
1098
  while (i < pattern.length && pattern.charAt(i) == 'M')
1076
1099
  i++;
@@ -1255,7 +1278,7 @@ export class DateTimeUtil
1255
1278
  tval.tzQhr = min / 15;
1256
1279
  }
1257
1280
  }
1258
- else if (tzlen == 2)
1281
+ else if (tz.length == 2)
1259
1282
  {
1260
1283
  if (c == '-')
1261
1284
  {
@@ -1476,6 +1499,40 @@ export class DateTimeUtil
1476
1499
  return tval;
1477
1500
  }
1478
1501
 
1502
+ static timeValueFromYMDHMS(prmymdhms)
1503
+ {
1504
+ let ymdhms = BigInt(prmymdhms);
1505
+ if (ymdhms < 0n)
1506
+ return null;
1507
+ let tval = new TimeValue();
1508
+ tval.second = Number(ymdhms % 100n);
1509
+ ymdhms = ymdhms / 100n;
1510
+ if (tval.second >= 60)
1511
+ return null;
1512
+ tval.minute = Number(ymdhms % 100n);
1513
+ ymdhms = ymdhms / 100n;
1514
+ if (tval.minute >= 60)
1515
+ return null;
1516
+ tval.hour = Number(ymdhms % 100n);
1517
+ ymdhms = ymdhms / 100n;
1518
+ if (tval.hour >= 24)
1519
+ return null;
1520
+ tval.day = Number(ymdhms % 100n);
1521
+ ymdhms = ymdhms / 100n;
1522
+ if (tval.day == 0 || tval.day > 31)
1523
+ return null;
1524
+ tval.month = Number(ymdhms % 100n);
1525
+ ymdhms = ymdhms / 100n;
1526
+ if (tval.month == 0 || tval.month > 12)
1527
+ return null;
1528
+ if (ymdhms <= 0n || ymdhms > 65535n)
1529
+ return null;
1530
+ tval.year = Number(ymdhms);
1531
+ if (tval.day > DateTimeUtil.dayInMonth(tval.year, tval.month))
1532
+ return null;
1533
+ return tval;
1534
+ }
1535
+
1479
1536
  static isYearLeap(year)
1480
1537
  {
1481
1538
  return ((year & 3) == 0) && ((year % 100) != 0 || (year % 400) == 0);
@@ -1545,6 +1602,52 @@ export class DateTimeUtil
1545
1602
  return 0;
1546
1603
  }
1547
1604
 
1605
+ static dayInMonth(year, month)
1606
+ {
1607
+ while (month < 1)
1608
+ {
1609
+ month = (month + 12);
1610
+ year--;
1611
+ }
1612
+ while (month > 12)
1613
+ {
1614
+ month = (month - 12);
1615
+ year++;
1616
+ }
1617
+ switch (month)
1618
+ {
1619
+ case 12:
1620
+ return 31;
1621
+ case 11:
1622
+ return 30;
1623
+ case 10:
1624
+ return 31;
1625
+ case 9:
1626
+ return 30;
1627
+ case 8:
1628
+ return 31;
1629
+ case 7:
1630
+ return 31;
1631
+ case 6:
1632
+ return 30;
1633
+ case 5:
1634
+ return 31;
1635
+ case 4:
1636
+ return 30;
1637
+ case 3:
1638
+ return 31;
1639
+ case 2:
1640
+ if (((year % 4) == 0 && (year % 100) != 0) || (year % 400) == 0)
1641
+ return 29;
1642
+ else
1643
+ return 28;
1644
+ case 1:
1645
+ return 31;
1646
+ default:
1647
+ return 0;
1648
+ }
1649
+ }
1650
+
1548
1651
  static getLocalTzQhr()
1549
1652
  {
1550
1653
  return new Date().getTimezoneOffset() / -15;
@@ -1602,27 +1705,27 @@ export class Duration
1602
1705
 
1603
1706
  getNS()
1604
1707
  {
1605
- return this.ns;
1708
+ return this.nanosec;
1606
1709
  }
1607
1710
 
1608
1711
  getTotalMS()
1609
1712
  {
1610
- return Number(this.seconds) * 1000 + this.ns / 1000000n;
1713
+ return Number(this.seconds) * 1000 + this.nanosec / 1000000;
1611
1714
  }
1612
1715
 
1613
1716
  getTotalSec()
1614
1717
  {
1615
- return Number(this.seconds) + (this.ns * 0.000000001);
1718
+ return Number(this.seconds) + (this.nanosec * 0.000000001);
1616
1719
  }
1617
1720
 
1618
1721
  notZero()
1619
1722
  {
1620
- return this.seconds != 0 || this.ns != 0;
1723
+ return this.seconds != 0n || this.nanosec != 0;
1621
1724
  }
1622
1725
 
1623
1726
  isZero()
1624
1727
  {
1625
- return this.seconds == 0 && this.ns == 0;
1728
+ return this.seconds == 0n && this.nanosec == 0;
1626
1729
  }
1627
1730
 
1628
1731
  toString()
@@ -1705,7 +1808,7 @@ export class LocalDate
1705
1808
  this.dateVal = year;
1706
1809
  }
1707
1810
  }
1708
- else if (t == "DateValue" || t == "TimeValue")
1811
+ else if (year instanceof DateValue)
1709
1812
  {
1710
1813
  this.dateVal = DateTimeUtil.dateValue2TotalDays(year);
1711
1814
  }
@@ -1798,6 +1901,11 @@ export class LocalDate
1798
1901
  return this.dateVal == LocalDate.DATE_NULL;
1799
1902
  }
1800
1903
 
1904
+ getWeekday()
1905
+ {
1906
+ return DateTimeUtil.ticks2Weekday(this.dateVal * 86400000, 0);
1907
+ }
1908
+
1801
1909
  static today()
1802
1910
  {
1803
1911
  let d = new Date();
@@ -1846,7 +1954,7 @@ export class TimeInstant
1846
1954
  let days = Math.floor(variTime);
1847
1955
  let ds = (variTime - days);
1848
1956
  let s = Math.floor(ds * 86400);
1849
- return new TimeInstant((days - 25569n) * 86400000n + Math.floor(ds * 86400000n), ((ds * 86400n - s) * 1000000000n));
1957
+ return new TimeInstant(BigInt(days - 25569) * 86400000n + BigInt(Math.floor(ds * 86400000)), ((ds * 86400 - s) * 1000000000));
1850
1958
  }
1851
1959
 
1852
1960
  static fromTicks(ticks)
@@ -1884,7 +1992,7 @@ export class TimeInstant
1884
1992
 
1885
1993
  addMS(val)
1886
1994
  {
1887
- let newSec = this.sec + Math.floor(val / 1000);
1995
+ let newSec = this.sec + BigInt(Math.floor(val / 1000));
1888
1996
  val = (val % 1000) * 1000000 + this.nanosec;
1889
1997
  while (val > 1000000000)
1890
1998
  {
@@ -1896,7 +2004,7 @@ export class TimeInstant
1896
2004
 
1897
2005
  addNS(val)
1898
2006
  {
1899
- let newSec = this.sec + Math.floor(val / 1000000000);
2007
+ let newSec = this.sec + BigInt(Math.floor(val / 1000000000));
1900
2008
  val = val % 1000000000 + this.nanosec;
1901
2009
  while (val > 1000000000)
1902
2010
  {
@@ -1913,14 +2021,14 @@ export class TimeInstant
1913
2021
 
1914
2022
  clearTime()
1915
2023
  {
1916
- return new TimeInstant(this.sec - this.sec % 86400, 0);
2024
+ return new TimeInstant(this.sec - this.sec % 86400n, 0);
1917
2025
  }
1918
2026
 
1919
2027
  roundToS()
1920
2028
  {
1921
2029
  if (this.nanosec >= 500000000)
1922
2030
  {
1923
- return new TimeInstant(this.sec + 1, 0);
2031
+ return new TimeInstant(this.sec + 1n, 0);
1924
2032
  }
1925
2033
  else
1926
2034
  {
@@ -1930,7 +2038,7 @@ export class TimeInstant
1930
2038
 
1931
2039
  getMSPassedDate()
1932
2040
  {
1933
- return Number(this.sec % 86400) * 1000 + Math.floor(this.nanosec / 1000000);
2041
+ return Number(this.sec % 86400n) * 1000 + Math.floor(this.nanosec / 1000000);
1934
2042
  }
1935
2043
 
1936
2044
  diffMS(ts)
@@ -1981,12 +2089,27 @@ export class TimeInstant
1981
2089
 
1982
2090
  toEpochMS()
1983
2091
  {
1984
- return this.sec * 1000 + BigInt(Math.floor(this.nanosec / 1000000));
2092
+ return this.sec * 1000n + BigInt(Math.floor(this.nanosec / 1000000));
1985
2093
  }
1986
2094
 
1987
2095
  toEpochNS()
1988
2096
  {
1989
- return this.sec * 1000000000 + BigInt(this.nanosec);
2097
+ return this.sec * 1000000000n + BigInt(this.nanosec);
2098
+ }
2099
+
2100
+ static fromDotNetTicks(ticks)
2101
+ {
2102
+ ticks = BigInt(ticks) - 621355968000000000n;
2103
+ let ns = Number(ticks % 10000000n);
2104
+ if (ns < 0)
2105
+ {
2106
+ return new TimeInstant(ticks / 10000000n - 1n, (ns + 10000000) * 100);
2107
+ }
2108
+ else
2109
+ {
2110
+ return new TimeInstant(ticks / 10000000n, ns * 100);
2111
+ }
2112
+
1990
2113
  }
1991
2114
  }
1992
2115
 
@@ -2057,11 +2180,11 @@ export class Timestamp
2057
2180
  {
2058
2181
  if (epochUS < 0)
2059
2182
  {
2060
- return new Timestamp(new TimeInstant(epochUS / 1000000n - 1, Number(epochUS % 1000000 + 1000000) * 1000), tzQhr);
2183
+ return new Timestamp(new TimeInstant(epochUS / 1000000n - 1n, Number(epochUS % 1000000n + 1000000n) * 1000), tzQhr);
2061
2184
  }
2062
2185
  else
2063
2186
  {
2064
- return new Timestamp(new TimeInstant(epochUS / 1000000n, Number(epochUS % 1000000) * 1000), tzQhr);
2187
+ return new Timestamp(new TimeInstant(epochUS / 1000000n, Number(epochUS % 1000000n) * 1000), tzQhr);
2065
2188
  }
2066
2189
  }
2067
2190
 
@@ -2069,11 +2192,11 @@ export class Timestamp
2069
2192
  {
2070
2193
  if (epochNS < 0)
2071
2194
  {
2072
- return new Timestamp(new TimeInstant(epochNS / 1000000000n - 1, Number(epochNS % 1000000000 + 1000000000)), tzQhr);
2195
+ return new Timestamp(new TimeInstant(epochNS / 1000000000n - 1n, Number(epochNS % 1000000000n + 1000000000n)), tzQhr);
2073
2196
  }
2074
2197
  else
2075
2198
  {
2076
- return new Timestamp(new TimeInstant(epochNS / 1000000000n, Number(epochNS % 1000000000)), tzQhr);
2199
+ return new Timestamp(new TimeInstant(epochNS / 1000000000n, Number(epochNS % 1000000000n)), tzQhr);
2077
2200
  }
2078
2201
  }
2079
2202
 
@@ -2220,6 +2343,11 @@ export class Timestamp
2220
2343
  return this.inst.diff(ts.inst);
2221
2344
  }
2222
2345
 
2346
+ toDate()
2347
+ {
2348
+ return new LocalDate(Math.floor(Number((this.inst.sec + BigInt(this.tzQhr * 900)) / 86400n)));
2349
+ }
2350
+
2223
2351
  toTicks()
2224
2352
  {
2225
2353
  return this.inst.toTicks();
@@ -2299,7 +2427,7 @@ export class Timestamp
2299
2427
  {
2300
2428
  if (this.inst.nanosec == 0)
2301
2429
  {
2302
- if (((this.inst.sec + BigInt(this.tzQhr * 900)) % 86400n) == 0)
2430
+ if (((this.inst.sec + BigInt(this.tzQhr * 900)) % 86400n) == 0n)
2303
2431
  {
2304
2432
  return this.toString("yyyy-MM-dd");
2305
2433
  }
package/geometry.d.ts CHANGED
@@ -35,10 +35,11 @@ export enum VectorType
35
35
  PieArea
36
36
  }
37
37
 
38
- export class Vector2D {
38
+ export abstract class Vector2D {
39
39
  srid: number;
40
40
  type: VectorType;
41
41
  constructor(srid: number);
42
+ abstract calBoundaryPoint(coord: math.Coord2D): BoundaryPointResult;
42
43
  insideOrTouch(coord: math.Coord2D): boolean;
43
44
  getBounds(): math.RectArea;
44
45
  }
@@ -47,6 +48,7 @@ export class Point extends Vector2D
47
48
  {
48
49
  coordinates: number[];
49
50
  constructor(srid: number, coordinates: number[] | math.Coord2D | math.Vector3);
51
+ calBoundaryPoint(coord: math.Coord2D): BoundaryPointResult;
50
52
  insideOrTouch(coord: math.Coord2D): boolean;
51
53
  getBounds(): math.RectArea;
52
54
  }
@@ -84,12 +86,18 @@ export class MultiGeometry<VecType> extends Vector2D
84
86
 
85
87
  export class Polygon extends MultiGeometry<LinearRing>
86
88
  {
87
- constructor(srid: number, coordinates: number[][][]);
89
+ constructor(srid: number, coordinates?: number[][][]);
90
+ insideOrTouch(coord: math.Coord2D): boolean;
88
91
  }
89
92
 
90
93
  export class MultiPolygon extends MultiGeometry<Polygon>
91
94
  {
92
- constructor(srid: number, coordinates: number[][][][]);
95
+ constructor(srid: number, coordinates?: number[][][][]);
96
+ }
97
+
98
+ export class Polyline extends MultiGeometry<LineString>
99
+ {
100
+ constructor(srid: number, coordinates?: number[][][]);
93
101
  }
94
102
 
95
103
  export class GeometryCollection extends MultiGeometry<Vector2D>