@ztimson/utils 0.28.4 → 0.28.6

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/dist/index.mjs CHANGED
@@ -1503,6 +1503,15 @@ class NotAcceptableError extends CustomError {
1503
1503
  return err.constructor.code == this.code;
1504
1504
  }
1505
1505
  }
1506
+ class TooManyRequestsError extends CustomError {
1507
+ static code = 429;
1508
+ constructor(message = "Rate Limit Reached") {
1509
+ super(message);
1510
+ }
1511
+ static instanceof(err) {
1512
+ return err.constructor.code == this.code;
1513
+ }
1514
+ }
1506
1515
  class InternalServerError extends CustomError {
1507
1516
  static code = 500;
1508
1517
  constructor(message = "Internal Server Error") {
@@ -1884,6 +1893,8 @@ class PathEvent {
1884
1893
  module;
1885
1894
  /** Entire path, including the module & name */
1886
1895
  fullPath;
1896
+ /** Parent directory, excludes module & name */
1897
+ dir;
1887
1898
  /** Path including the name, excluding the module */
1888
1899
  path;
1889
1900
  /** Last segment of path */
@@ -1961,6 +1972,7 @@ class PathEvent {
1961
1972
  if (p === "" || p === void 0 || p === "*") {
1962
1973
  this.module = "";
1963
1974
  this.path = "";
1975
+ this.dir = "";
1964
1976
  this.fullPath = "**";
1965
1977
  this.name = "";
1966
1978
  this.methods = new ASet(p === "*" ? ["*"] : method.split(""));
@@ -1971,6 +1983,7 @@ class PathEvent {
1971
1983
  let temp = p.split("/").filter((p2) => !!p2);
1972
1984
  this.module = temp.splice(0, 1)[0] || "";
1973
1985
  this.path = temp.join("/");
1986
+ this.dir = temp.length > 2 ? temp.slice(0, -1).join("/") : "";
1974
1987
  this.fullPath = `${this.module}${this.module && this.path ? "/" : ""}${this.path}`;
1975
1988
  this.name = temp.pop() || "";
1976
1989
  this.hasGlob = this.fullPath.includes("*");
@@ -2730,6 +2743,7 @@ export {
2730
2743
  ServiceUnavailableError,
2731
2744
  Table,
2732
2745
  TemplateError,
2746
+ TooManyRequestsError,
2733
2747
  TypedEmitter,
2734
2748
  UnauthorizedError,
2735
2749
  addUnique,