soonjs 0.0.13 → 0.0.15

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.d.ts CHANGED
@@ -99,7 +99,20 @@ export declare function createSoonApp(options?: SoonAppOptions): Promise<SoonApp
99
99
  /**
100
100
  * 错误
101
101
  */
102
- export declare function CodeError(message?: string, code?: number): Error;
102
+ /**
103
+ * 业务错误
104
+ */
105
+ export declare class BizError extends Error {
106
+ code: number;
107
+ constructor(message?: string, code?: number);
108
+ }
109
+ /**
110
+ * http错误
111
+ */
112
+ export declare class SoonError extends Error {
113
+ status: number;
114
+ constructor(message?: string, status?: number);
115
+ }
103
116
  /**
104
117
  * 使用 SSE,在 API action 中返回该 SSE
105
118
  */
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var mP = Object.defineProperty;
2
2
  var yP = (e, t, r) => t in e ? mP(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var Gt = (e, t, r) => yP(e, typeof t != "symbol" ? t + "" : t, r);
3
+ var Ut = (e, t, r) => yP(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import pl, { PassThrough as gP } from "stream";
5
5
  import hl, { format as DP, inspect as Gf } from "util";
6
6
  import { randomInt as cE, createHash as EP } from "crypto";
@@ -1061,7 +1061,7 @@ var R_ = PE, M_ = Us, jm = L_, j_ = R_(), $m = CE, Um = Ga, $_ = M_("%Math.floor
1061
1061
  var V_ = AE.exports, _E = Us, xE = V_, H_ = xE(_E("String.prototype.indexOf")), q_ = function(t, r) {
1062
1062
  var n = _E(t, !!r);
1063
1063
  return typeof n == "function" && H_(t, ".prototype.") > -1 ? xE(n) : n;
1064
- }, K_ = hl.inspect, ph = typeof Map == "function" && Map.prototype, Fc = Object.getOwnPropertyDescriptor && ph ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, $u = ph && Fc && typeof Fc.get == "function" ? Fc.get : null, Vm = ph && Map.prototype.forEach, hh = typeof Set == "function" && Set.prototype, wc = Object.getOwnPropertyDescriptor && hh ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, Uu = hh && wc && typeof wc.get == "function" ? wc.get : null, Hm = hh && Set.prototype.forEach, W_ = typeof WeakMap == "function" && WeakMap.prototype, Ca = W_ ? WeakMap.prototype.has : null, G_ = typeof WeakSet == "function" && WeakSet.prototype, Pa = G_ ? WeakSet.prototype.has : null, Y_ = typeof WeakRef == "function" && WeakRef.prototype, qm = Y_ ? WeakRef.prototype.deref : null, X_ = Boolean.prototype.valueOf, J_ = Object.prototype.toString, z_ = Function.prototype.toString, Q_ = String.prototype.match, dh = String.prototype.slice, Wn = String.prototype.replace, Z_ = String.prototype.toUpperCase, Km = String.prototype.toLowerCase, FE = RegExp.prototype.test, Wm = Array.prototype.concat, Zr = Array.prototype.join, ex = Array.prototype.slice, Gm = Math.floor, zf = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, Ic = Object.getOwnPropertySymbols, Qf = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, Is = typeof Symbol == "function" && typeof Symbol.iterator == "object", Kt = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === Is || !0) ? Symbol.toStringTag : null, wE = Object.prototype.propertyIsEnumerable, Ym = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(e) {
1064
+ }, K_ = hl.inspect, ph = typeof Map == "function" && Map.prototype, Fc = Object.getOwnPropertyDescriptor && ph ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, $u = ph && Fc && typeof Fc.get == "function" ? Fc.get : null, Vm = ph && Map.prototype.forEach, hh = typeof Set == "function" && Set.prototype, wc = Object.getOwnPropertyDescriptor && hh ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, Uu = hh && wc && typeof wc.get == "function" ? wc.get : null, Hm = hh && Set.prototype.forEach, W_ = typeof WeakMap == "function" && WeakMap.prototype, Ca = W_ ? WeakMap.prototype.has : null, G_ = typeof WeakSet == "function" && WeakSet.prototype, Pa = G_ ? WeakSet.prototype.has : null, Y_ = typeof WeakRef == "function" && WeakRef.prototype, qm = Y_ ? WeakRef.prototype.deref : null, X_ = Boolean.prototype.valueOf, J_ = Object.prototype.toString, z_ = Function.prototype.toString, Q_ = String.prototype.match, dh = String.prototype.slice, Wn = String.prototype.replace, Z_ = String.prototype.toUpperCase, Km = String.prototype.toLowerCase, FE = RegExp.prototype.test, Wm = Array.prototype.concat, Zr = Array.prototype.join, ex = Array.prototype.slice, Gm = Math.floor, zf = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, Ic = Object.getOwnPropertySymbols, Qf = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, Is = typeof Symbol == "function" && typeof Symbol.iterator == "object", Wt = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === Is || !0) ? Symbol.toStringTag : null, wE = Object.prototype.propertyIsEnumerable, Ym = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(e) {
1065
1065
  return e.__proto__;
1066
1066
  } : null);
1067
1067
  function Xm(e, t) {
@@ -1186,7 +1186,7 @@ var Zf = K_, Jm = Zf.custom, zm = OE(Jm) ? Jm : null, tx = function e(t, r, n, i
1186
1186
  if (typeof globalThis < "u" && t === globalThis || typeof nn < "u" && t === nn)
1187
1187
  return "{ [object globalThis] }";
1188
1188
  if (!nx(t) && !Qm(t)) {
1189
- var w = Ao(t, p), x = Ym ? Ym(t) === Object.prototype : t instanceof Object || t.constructor === Object, I = t instanceof Object ? "" : "null prototype", B = !x && Kt && Object(t) === t && Kt in t ? dh.call(ni(t), 8, -1) : I ? "Object" : "", S = x || typeof t.constructor != "function" ? "" : t.constructor.name ? t.constructor.name + " " : "", _ = S + (B || I ? "[" + Zr.call(Wm.call([], B || [], I || []), ": ") + "] " : "");
1189
+ var w = Ao(t, p), x = Ym ? Ym(t) === Object.prototype : t instanceof Object || t.constructor === Object, I = t instanceof Object ? "" : "null prototype", B = !x && Wt && Object(t) === t && Wt in t ? dh.call(ni(t), 8, -1) : I ? "Object" : "", S = x || typeof t.constructor != "function" ? "" : t.constructor.name ? t.constructor.name + " " : "", _ = S + (B || I ? "[" + Zr.call(Wm.call([], B || [], I || []), ": ") + "] " : "");
1190
1190
  return w.length === 0 ? _ + "{}" : f ? _ + "{" + tp(w, f) + "}" : _ + "{ " + Zr.call(w, ", ") + " }";
1191
1191
  }
1192
1192
  return String(t);
@@ -1199,25 +1199,25 @@ function rx(e) {
1199
1199
  return Wn.call(String(e), /"/g, "&quot;");
1200
1200
  }
1201
1201
  function ep(e) {
1202
- return ni(e) === "[object Array]" && (!Kt || !(typeof e == "object" && Kt in e));
1202
+ return ni(e) === "[object Array]" && (!Wt || !(typeof e == "object" && Wt in e));
1203
1203
  }
1204
1204
  function nx(e) {
1205
- return ni(e) === "[object Date]" && (!Kt || !(typeof e == "object" && Kt in e));
1205
+ return ni(e) === "[object Date]" && (!Wt || !(typeof e == "object" && Wt in e));
1206
1206
  }
1207
1207
  function Qm(e) {
1208
- return ni(e) === "[object RegExp]" && (!Kt || !(typeof e == "object" && Kt in e));
1208
+ return ni(e) === "[object RegExp]" && (!Wt || !(typeof e == "object" && Wt in e));
1209
1209
  }
1210
1210
  function ix(e) {
1211
- return ni(e) === "[object Error]" && (!Kt || !(typeof e == "object" && Kt in e));
1211
+ return ni(e) === "[object Error]" && (!Wt || !(typeof e == "object" && Wt in e));
1212
1212
  }
1213
1213
  function sx(e) {
1214
- return ni(e) === "[object String]" && (!Kt || !(typeof e == "object" && Kt in e));
1214
+ return ni(e) === "[object String]" && (!Wt || !(typeof e == "object" && Wt in e));
1215
1215
  }
1216
1216
  function ax(e) {
1217
- return ni(e) === "[object Number]" && (!Kt || !(typeof e == "object" && Kt in e));
1217
+ return ni(e) === "[object Number]" && (!Wt || !(typeof e == "object" && Wt in e));
1218
1218
  }
1219
1219
  function ox(e) {
1220
- return ni(e) === "[object Boolean]" && (!Kt || !(typeof e == "object" && Kt in e));
1220
+ return ni(e) === "[object Boolean]" && (!Wt || !(typeof e == "object" && Wt in e));
1221
1221
  }
1222
1222
  function OE(e) {
1223
1223
  if (Is)
@@ -1951,7 +1951,7 @@ function gh({ workerId: e, isFixedLength: t = !1, prefix: r = "" } = {}) {
1951
1951
  return m > l && g(), d + (m++).toString(36);
1952
1952
  };
1953
1953
  }
1954
- var Ht = {}, St = {}, Ns = {};
1954
+ var qt = {}, St = {}, Ns = {};
1955
1955
  Object.defineProperty(Ns, "__esModule", { value: !0 });
1956
1956
  Ns.splitWhen = Ns.flatten = void 0;
1957
1957
  function dF(e) {
@@ -3915,8 +3915,8 @@ const K2 = Al;
3915
3915
  St.stream = K2;
3916
3916
  const W2 = Bs;
3917
3917
  St.string = W2;
3918
- Object.defineProperty(Ht, "__esModule", { value: !0 });
3919
- Ht.convertPatternGroupToTask = Ht.convertPatternGroupsToTasks = Ht.groupPatternsByBaseDirectory = Ht.getNegativePatternsAsPositive = Ht.getPositivePatterns = Ht.convertPatternsToTasks = Ht.generate = void 0;
3918
+ Object.defineProperty(qt, "__esModule", { value: !0 });
3919
+ qt.convertPatternGroupToTask = qt.convertPatternGroupsToTasks = qt.groupPatternsByBaseDirectory = qt.getNegativePatternsAsPositive = qt.getPositivePatterns = qt.convertPatternsToTasks = qt.generate = void 0;
3920
3920
  const jr = St;
3921
3921
  function G2(e, t) {
3922
3922
  const r = Ay(e, t), n = Ay(t.ignore, t), i = db(r), s = mb(r, n), a = i.filter((c) => jr.pattern.isStaticPattern(c, t)), o = i.filter((c) => jr.pattern.isDynamicPattern(c, t)), u = sp(
@@ -3932,7 +3932,7 @@ function G2(e, t) {
3932
3932
  );
3933
3933
  return u.concat(l);
3934
3934
  }
3935
- Ht.generate = G2;
3935
+ qt.generate = G2;
3936
3936
  function Ay(e, t) {
3937
3937
  let r = e;
3938
3938
  return t.braceExpansion && (r = jr.pattern.expandPatternsWithBraceExpansion(r)), t.baseNameMatch && (r = r.map((n) => n.includes("/") ? n : `**/${n}`)), r.map((n) => jr.pattern.removeDuplicateSlashes(n));
@@ -3941,15 +3941,15 @@ function sp(e, t, r) {
3941
3941
  const n = [], i = jr.pattern.getPatternsOutsideCurrentDirectory(e), s = jr.pattern.getPatternsInsideCurrentDirectory(e), a = ap(i), o = ap(s);
3942
3942
  return n.push(...op(a, t, r)), "." in o ? n.push(_h(".", s, t, r)) : n.push(...op(o, t, r)), n;
3943
3943
  }
3944
- Ht.convertPatternsToTasks = sp;
3944
+ qt.convertPatternsToTasks = sp;
3945
3945
  function db(e) {
3946
3946
  return jr.pattern.getPositivePatterns(e);
3947
3947
  }
3948
- Ht.getPositivePatterns = db;
3948
+ qt.getPositivePatterns = db;
3949
3949
  function mb(e, t) {
3950
3950
  return jr.pattern.getNegativePatterns(e).concat(t).map(jr.pattern.convertToPositivePattern);
3951
3951
  }
3952
- Ht.getNegativePatternsAsPositive = mb;
3952
+ qt.getNegativePatternsAsPositive = mb;
3953
3953
  function ap(e) {
3954
3954
  const t = {};
3955
3955
  return e.reduce((r, n) => {
@@ -3957,11 +3957,11 @@ function ap(e) {
3957
3957
  return i in r ? r[i].push(n) : r[i] = [n], r;
3958
3958
  }, t);
3959
3959
  }
3960
- Ht.groupPatternsByBaseDirectory = ap;
3960
+ qt.groupPatternsByBaseDirectory = ap;
3961
3961
  function op(e, t, r) {
3962
3962
  return Object.keys(e).map((n) => _h(n, e[n], t, r));
3963
3963
  }
3964
- Ht.convertPatternGroupsToTasks = op;
3964
+ qt.convertPatternGroupsToTasks = op;
3965
3965
  function _h(e, t, r, n) {
3966
3966
  return {
3967
3967
  dynamic: n,
@@ -3971,7 +3971,7 @@ function _h(e, t, r, n) {
3971
3971
  patterns: [].concat(t, r.map(jr.pattern.convertToNegativePattern))
3972
3972
  };
3973
3973
  }
3974
- Ht.convertPatternGroupToTask = _h;
3974
+ qt.convertPatternGroupToTask = _h;
3975
3975
  var xh = {}, Fh = {}, Er = {}, wh = {}, Cl = {}, tn = {}, Gn = {}, fr = {}, Pl = {};
3976
3976
  Object.defineProperty(Pl, "__esModule", { value: !0 });
3977
3977
  Pl.read = void 0;
@@ -5093,7 +5093,7 @@ var wb = {};
5093
5093
  }
5094
5094
  e.default = i;
5095
5095
  })(wb);
5096
- const Ib = Ht, zO = xh, QO = qh, ZO = Kh, dp = wb, dr = St;
5096
+ const Ib = qt, zO = xh, QO = qh, ZO = Kh, dp = wb, dr = St;
5097
5097
  async function mp(e, t) {
5098
5098
  Nr(e);
5099
5099
  const r = yp(e, zO.default, t), n = await Promise.all(r);
@@ -5520,7 +5520,7 @@ Expected it to be ${n}.`;
5520
5520
  var uN = class extends Error {
5521
5521
  constructor(r) {
5522
5522
  super(oN(r));
5523
- Gt(this, "name", "InvalidDocError");
5523
+ Ut(this, "name", "InvalidDocError");
5524
5524
  this.doc = r;
5525
5525
  }
5526
5526
  }, ks = uN, Oy = {};
@@ -14634,17 +14634,17 @@ Hs(ES, {
14634
14634
  var ud = class extends Error {
14635
14635
  constructor() {
14636
14636
  super(...arguments);
14637
- Gt(this, "name", "ConfigError");
14637
+ Ut(this, "name", "ConfigError");
14638
14638
  }
14639
14639
  }, xp = class extends Error {
14640
14640
  constructor() {
14641
14641
  super(...arguments);
14642
- Gt(this, "name", "UndefinedParserError");
14642
+ Ut(this, "name", "UndefinedParserError");
14643
14643
  }
14644
14644
  }, wk = class extends Error {
14645
14645
  constructor() {
14646
14646
  super(...arguments);
14647
- Gt(this, "name", "ArgExpansionBailout");
14647
+ Ut(this, "name", "ArgExpansionBailout");
14648
14648
  }
14649
14649
  }, r0 = Fn(Gb()), Ik = (e) => e instanceof URL, bS = (e) => typeof e == "string" && e.startsWith("file://"), SS = (e) => Ik(e) || bS(e), Ks = (e) => SS(e) ? it(e) : e;
14650
14650
  function Ok(e, t) {
@@ -14923,7 +14923,7 @@ function gL(e, t) {
14923
14923
  }, this.instanceOf = t.instanceOf || null, this.predicate = t.predicate || null, this.represent = t.represent || null, this.representName = t.representName || null, this.defaultStyle = t.defaultStyle || null, this.multi = t.multi || !1, this.styleAliases = yL(t.styleAliases || null), mL.indexOf(this.kind) === -1)
14924
14924
  throw new bn('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
14925
14925
  }
14926
- var qt = gL;
14926
+ var Kt = gL;
14927
14927
  function i0(e, t) {
14928
14928
  var r = [];
14929
14929
  return e[t].forEach(function(n) {
@@ -14958,7 +14958,7 @@ function wp(e) {
14958
14958
  }
14959
14959
  wp.prototype.extend = function(t) {
14960
14960
  var r = [], n = [];
14961
- if (t instanceof qt)
14961
+ if (t instanceof Kt)
14962
14962
  n.push(t);
14963
14963
  else if (Array.isArray(t))
14964
14964
  n = n.concat(t);
@@ -14967,30 +14967,30 @@ wp.prototype.extend = function(t) {
14967
14967
  else
14968
14968
  throw new bn("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
14969
14969
  r.forEach(function(s) {
14970
- if (!(s instanceof qt))
14970
+ if (!(s instanceof Kt))
14971
14971
  throw new bn("Specified list of YAML types (or a single Type object) contains a non-Type object.");
14972
14972
  if (s.loadKind && s.loadKind !== "scalar")
14973
14973
  throw new bn("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
14974
14974
  if (s.multi)
14975
14975
  throw new bn("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
14976
14976
  }), n.forEach(function(s) {
14977
- if (!(s instanceof qt))
14977
+ if (!(s instanceof Kt))
14978
14978
  throw new bn("Specified list of YAML types (or a single Type object) contains a non-Type object.");
14979
14979
  });
14980
14980
  var i = Object.create(wp.prototype);
14981
14981
  return i.implicit = (this.implicit || []).concat(r), i.explicit = (this.explicit || []).concat(n), i.compiledImplicit = i0(i, "implicit"), i.compiledExplicit = i0(i, "explicit"), i.compiledTypeMap = DL(i.compiledImplicit, i.compiledExplicit), i;
14982
14982
  };
14983
- var EL = wp, bL = new qt("tag:yaml.org,2002:str", {
14983
+ var EL = wp, bL = new Kt("tag:yaml.org,2002:str", {
14984
14984
  kind: "scalar",
14985
14985
  construct: function(e) {
14986
14986
  return e !== null ? e : "";
14987
14987
  }
14988
- }), SL = new qt("tag:yaml.org,2002:seq", {
14988
+ }), SL = new Kt("tag:yaml.org,2002:seq", {
14989
14989
  kind: "sequence",
14990
14990
  construct: function(e) {
14991
14991
  return e !== null ? e : [];
14992
14992
  }
14993
- }), vL = new qt("tag:yaml.org,2002:map", {
14993
+ }), vL = new Kt("tag:yaml.org,2002:map", {
14994
14994
  kind: "mapping",
14995
14995
  construct: function(e) {
14996
14996
  return e !== null ? e : {};
@@ -15013,7 +15013,7 @@ function CL() {
15013
15013
  function PL(e) {
15014
15014
  return e === null;
15015
15015
  }
15016
- var _L = new qt("tag:yaml.org,2002:null", {
15016
+ var _L = new Kt("tag:yaml.org,2002:null", {
15017
15017
  kind: "scalar",
15018
15018
  resolve: AL,
15019
15019
  construct: CL,
@@ -15048,7 +15048,7 @@ function FL(e) {
15048
15048
  function wL(e) {
15049
15049
  return Object.prototype.toString.call(e) === "[object Boolean]";
15050
15050
  }
15051
- var IL = new qt("tag:yaml.org,2002:bool", {
15051
+ var IL = new Kt("tag:yaml.org,2002:bool", {
15052
15052
  kind: "scalar",
15053
15053
  resolve: xL,
15054
15054
  construct: FL,
@@ -15128,7 +15128,7 @@ function LL(e) {
15128
15128
  function RL(e) {
15129
15129
  return Object.prototype.toString.call(e) === "[object Number]" && e % 1 === 0 && !zt.isNegativeZero(e);
15130
15130
  }
15131
- var ML = new qt("tag:yaml.org,2002:int", {
15131
+ var ML = new Kt("tag:yaml.org,2002:int", {
15132
15132
  kind: "scalar",
15133
15133
  resolve: kL,
15134
15134
  construct: LL,
@@ -15205,7 +15205,7 @@ function HL(e, t) {
15205
15205
  function qL(e) {
15206
15206
  return Object.prototype.toString.call(e) === "[object Number]" && (e % 1 !== 0 || zt.isNegativeZero(e));
15207
15207
  }
15208
- var KL = new qt("tag:yaml.org,2002:float", {
15208
+ var KL = new Kt("tag:yaml.org,2002:float", {
15209
15209
  kind: "scalar",
15210
15210
  resolve: $L,
15211
15211
  construct: UL,
@@ -15242,7 +15242,7 @@ function XL(e) {
15242
15242
  function JL(e) {
15243
15243
  return e.toISOString();
15244
15244
  }
15245
- var zL = new qt("tag:yaml.org,2002:timestamp", {
15245
+ var zL = new Kt("tag:yaml.org,2002:timestamp", {
15246
15246
  kind: "scalar",
15247
15247
  resolve: YL,
15248
15248
  construct: XL,
@@ -15252,7 +15252,7 @@ var zL = new qt("tag:yaml.org,2002:timestamp", {
15252
15252
  function QL(e) {
15253
15253
  return e === "<<" || e === null;
15254
15254
  }
15255
- var ZL = new qt("tag:yaml.org,2002:merge", {
15255
+ var ZL = new Kt("tag:yaml.org,2002:merge", {
15256
15256
  kind: "scalar",
15257
15257
  resolve: QL
15258
15258
  }), cd = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
@@ -15282,7 +15282,7 @@ function rR(e) {
15282
15282
  function nR(e) {
15283
15283
  return Object.prototype.toString.call(e) === "[object Uint8Array]";
15284
15284
  }
15285
- var iR = new qt("tag:yaml.org,2002:binary", {
15285
+ var iR = new Kt("tag:yaml.org,2002:binary", {
15286
15286
  kind: "scalar",
15287
15287
  resolve: eR,
15288
15288
  construct: tR,
@@ -15307,7 +15307,7 @@ function oR(e) {
15307
15307
  function uR(e) {
15308
15308
  return e !== null ? e : [];
15309
15309
  }
15310
- var lR = new qt("tag:yaml.org,2002:omap", {
15310
+ var lR = new Kt("tag:yaml.org,2002:omap", {
15311
15311
  kind: "sequence",
15312
15312
  resolve: oR,
15313
15313
  construct: uR
@@ -15328,7 +15328,7 @@ function pR(e) {
15328
15328
  n = a[t], i = Object.keys(n), s[t] = [i[0], n[i[0]]];
15329
15329
  return s;
15330
15330
  }
15331
- var hR = new qt("tag:yaml.org,2002:pairs", {
15331
+ var hR = new Kt("tag:yaml.org,2002:pairs", {
15332
15332
  kind: "sequence",
15333
15333
  resolve: fR,
15334
15334
  construct: pR
@@ -15344,7 +15344,7 @@ function mR(e) {
15344
15344
  function yR(e) {
15345
15345
  return e !== null ? e : {};
15346
15346
  }
15347
- var gR = new qt("tag:yaml.org,2002:set", {
15347
+ var gR = new Kt("tag:yaml.org,2002:set", {
15348
15348
  kind: "mapping",
15349
15349
  resolve: mR,
15350
15350
  construct: yR
@@ -16655,12 +16655,12 @@ var dM = hM, mM = {}.hasOwnProperty, yM = /^([A-Z][a-z\d]*)+$/, gM = /* @__PURE_
16655
16655
  "boolean",
16656
16656
  "bigint",
16657
16657
  "symbol"
16658
- ]), Ut = {};
16658
+ ]), Vt = {};
16659
16659
  function sf(e, t = "and") {
16660
16660
  return e.length < 3 ? e.join(` ${t} `) : `${e.slice(0, -1).join(", ")}, ${t} ${e[e.length - 1]}`;
16661
16661
  }
16662
16662
  var qS = /* @__PURE__ */ new Map(), DM = "__node_internal_", m0;
16663
- Ut.ERR_INVALID_ARG_TYPE = _r(
16663
+ Vt.ERR_INVALID_ARG_TYPE = _r(
16664
16664
  "ERR_INVALID_ARG_TYPE",
16665
16665
  /**
16666
16666
  * @param {string} name
@@ -16697,7 +16697,7 @@ Ut.ERR_INVALID_ARG_TYPE = _r(
16697
16697
  },
16698
16698
  TypeError
16699
16699
  );
16700
- Ut.ERR_INVALID_MODULE_SPECIFIER = _r(
16700
+ Vt.ERR_INVALID_MODULE_SPECIFIER = _r(
16701
16701
  "ERR_INVALID_MODULE_SPECIFIER",
16702
16702
  /**
16703
16703
  * @param {string} request
@@ -16707,7 +16707,7 @@ Ut.ERR_INVALID_MODULE_SPECIFIER = _r(
16707
16707
  (e, t, r = void 0) => `Invalid module "${e}" ${t}${r ? ` imported from ${r}` : ""}`,
16708
16708
  TypeError
16709
16709
  );
16710
- Ut.ERR_INVALID_PACKAGE_CONFIG = _r(
16710
+ Vt.ERR_INVALID_PACKAGE_CONFIG = _r(
16711
16711
  "ERR_INVALID_PACKAGE_CONFIG",
16712
16712
  /**
16713
16713
  * @param {string} path
@@ -16717,7 +16717,7 @@ Ut.ERR_INVALID_PACKAGE_CONFIG = _r(
16717
16717
  (e, t, r) => `Invalid package config ${e}${t ? ` while importing ${t}` : ""}${r ? `. ${r}` : ""}`,
16718
16718
  Error
16719
16719
  );
16720
- Ut.ERR_INVALID_PACKAGE_TARGET = _r(
16720
+ Vt.ERR_INVALID_PACKAGE_TARGET = _r(
16721
16721
  "ERR_INVALID_PACKAGE_TARGET",
16722
16722
  /**
16723
16723
  * @param {string} packagePath
@@ -16734,7 +16734,7 @@ Ut.ERR_INVALID_PACKAGE_TARGET = _r(
16734
16734
  },
16735
16735
  Error
16736
16736
  );
16737
- Ut.ERR_MODULE_NOT_FOUND = _r(
16737
+ Vt.ERR_MODULE_NOT_FOUND = _r(
16738
16738
  "ERR_MODULE_NOT_FOUND",
16739
16739
  /**
16740
16740
  * @param {string} path
@@ -16744,12 +16744,12 @@ Ut.ERR_MODULE_NOT_FOUND = _r(
16744
16744
  (e, t, r = !1) => `Cannot find ${r ? "module" : "package"} '${e}' imported from ${t}`,
16745
16745
  Error
16746
16746
  );
16747
- Ut.ERR_NETWORK_IMPORT_DISALLOWED = _r(
16747
+ Vt.ERR_NETWORK_IMPORT_DISALLOWED = _r(
16748
16748
  "ERR_NETWORK_IMPORT_DISALLOWED",
16749
16749
  "import of '%s' by %s is not supported: %s",
16750
16750
  Error
16751
16751
  );
16752
- Ut.ERR_PACKAGE_IMPORT_NOT_DEFINED = _r(
16752
+ Vt.ERR_PACKAGE_IMPORT_NOT_DEFINED = _r(
16753
16753
  "ERR_PACKAGE_IMPORT_NOT_DEFINED",
16754
16754
  /**
16755
16755
  * @param {string} specifier
@@ -16759,7 +16759,7 @@ Ut.ERR_PACKAGE_IMPORT_NOT_DEFINED = _r(
16759
16759
  (e, t, r) => `Package import specifier "${e}" is not defined${t ? ` in package ${t}package.json` : ""} imported from ${r}`,
16760
16760
  TypeError
16761
16761
  );
16762
- Ut.ERR_PACKAGE_PATH_NOT_EXPORTED = _r(
16762
+ Vt.ERR_PACKAGE_PATH_NOT_EXPORTED = _r(
16763
16763
  "ERR_PACKAGE_PATH_NOT_EXPORTED",
16764
16764
  /**
16765
16765
  * @param {string} packagePath
@@ -16769,17 +16769,17 @@ Ut.ERR_PACKAGE_PATH_NOT_EXPORTED = _r(
16769
16769
  (e, t, r = void 0) => t === "." ? `No "exports" main defined in ${e}package.json${r ? ` imported from ${r}` : ""}` : `Package subpath '${t}' is not defined by "exports" in ${e}package.json${r ? ` imported from ${r}` : ""}`,
16770
16770
  Error
16771
16771
  );
16772
- Ut.ERR_UNSUPPORTED_DIR_IMPORT = _r(
16772
+ Vt.ERR_UNSUPPORTED_DIR_IMPORT = _r(
16773
16773
  "ERR_UNSUPPORTED_DIR_IMPORT",
16774
16774
  "Directory import '%s' is not supported resolving ES modules imported from %s",
16775
16775
  Error
16776
16776
  );
16777
- Ut.ERR_UNSUPPORTED_RESOLVE_REQUEST = _r(
16777
+ Vt.ERR_UNSUPPORTED_RESOLVE_REQUEST = _r(
16778
16778
  "ERR_UNSUPPORTED_RESOLVE_REQUEST",
16779
16779
  'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
16780
16780
  TypeError
16781
16781
  );
16782
- Ut.ERR_UNKNOWN_FILE_EXTENSION = _r(
16782
+ Vt.ERR_UNKNOWN_FILE_EXTENSION = _r(
16783
16783
  "ERR_UNKNOWN_FILE_EXTENSION",
16784
16784
  /**
16785
16785
  * @param {string} extension
@@ -16788,7 +16788,7 @@ Ut.ERR_UNKNOWN_FILE_EXTENSION = _r(
16788
16788
  (e, t) => `Unknown file extension "${e}" for ${t}`,
16789
16789
  TypeError
16790
16790
  );
16791
- Ut.ERR_INVALID_ARG_VALUE = _r(
16791
+ Vt.ERR_INVALID_ARG_VALUE = _r(
16792
16792
  "ERR_INVALID_ARG_VALUE",
16793
16793
  /**
16794
16794
  * @param {string} name
@@ -16885,7 +16885,7 @@ function TM(e) {
16885
16885
  let t = Gf(e, { colors: !1 });
16886
16886
  return t.length > 28 && (t = `${t.slice(0, 25)}...`), `type ${typeof e} (${t})`;
16887
16887
  }
16888
- var ta = {}.hasOwnProperty, { ERR_INVALID_PACKAGE_CONFIG: AM } = Ut, y0 = /* @__PURE__ */ new Map();
16888
+ var ta = {}.hasOwnProperty, { ERR_INVALID_PACKAGE_CONFIG: AM } = Vt, y0 = /* @__PURE__ */ new Map();
16889
16889
  function KS(e, { base: t, specifier: r }) {
16890
16890
  const n = y0.get(e);
16891
16891
  if (n)
@@ -16951,7 +16951,7 @@ function dd(e) {
16951
16951
  function g0(e) {
16952
16952
  return dd(e).type;
16953
16953
  }
16954
- var { ERR_UNKNOWN_FILE_EXTENSION: CM } = Ut, PM = {}.hasOwnProperty, _M = {
16954
+ var { ERR_UNKNOWN_FILE_EXTENSION: CM } = Vt, PM = {}.hasOwnProperty, _M = {
16955
16955
  // @ts-expect-error: hush.
16956
16956
  __proto__: null,
16957
16957
  ".cjs": "commonjs",
@@ -17014,7 +17014,7 @@ function WS(e, t) {
17014
17014
  const r = e.protocol;
17015
17015
  return PM.call(D0, r) && D0[r](e, t, !0) || null;
17016
17016
  }
17017
- var { ERR_INVALID_ARG_VALUE: OM } = Ut, GS = Object.freeze(["node", "import"]), NM = new Set(GS);
17017
+ var { ERR_INVALID_ARG_VALUE: OM } = Vt, GS = Object.freeze(["node", "import"]), NM = new Set(GS);
17018
17018
  function BM() {
17019
17019
  return GS;
17020
17020
  }
@@ -17043,7 +17043,7 @@ var Lo = RegExp.prototype[Symbol.replace], {
17043
17043
  ERR_PACKAGE_PATH_NOT_EXPORTED: jM,
17044
17044
  ERR_UNSUPPORTED_DIR_IMPORT: $M,
17045
17045
  ERR_UNSUPPORTED_RESOLVE_REQUEST: b0
17046
- } = Ut, XS = {}.hasOwnProperty, S0 = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i, v0 = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i, UM = /^\.|%|\\/, Ro = /\*/g, VM = /%2f|%5c/i, T0 = /* @__PURE__ */ new Set(), HM = /[/\\]{2}/;
17046
+ } = Vt, XS = {}.hasOwnProperty, S0 = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i, v0 = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i, UM = /^\.|%|\\/, Ro = /\*/g, VM = /%2f|%5c/i, T0 = /* @__PURE__ */ new Set(), HM = /[/\\]{2}/;
17047
17047
  function A0(e, t, r, n, i, s, a) {
17048
17048
  if (en.noDeprecation)
17049
17049
  return;
@@ -17625,7 +17625,7 @@ function n6(e) {
17625
17625
  }
17626
17626
  function i6(e) {
17627
17627
  if (e !== void 0 && typeof e != "string" && !n6(e))
17628
- throw new Ut.ERR_INVALID_ARG_TYPE(
17628
+ throw new Vt.ERR_INVALID_ARG_TYPE(
17629
17629
  "parentURL",
17630
17630
  ["string", "URL"],
17631
17631
  e
@@ -18011,7 +18011,7 @@ Expected it to be ${n}.`;
18011
18011
  var K6 = class extends Error {
18012
18012
  constructor(t) {
18013
18013
  super(q6(t));
18014
- Gt(this, "name", "InvalidDocError");
18014
+ Ut(this, "name", "InvalidDocError");
18015
18015
  this.doc = t;
18016
18016
  }
18017
18017
  }, js = K6, x0 = {};
@@ -47667,23 +47667,23 @@ function fte(e, t) {
47667
47667
  }
47668
47668
  return n;
47669
47669
  }
47670
- var Wt = {};
47671
- Object.defineProperty(Wt, "__esModule", {
47670
+ var Gt = {};
47671
+ Object.defineProperty(Gt, "__esModule", {
47672
47672
  value: !0
47673
47673
  });
47674
- Wt.ExportAllDeclaration = Cte;
47675
- Wt.ExportDefaultDeclaration = _te;
47676
- Wt.ExportDefaultSpecifier = Ste;
47677
- Wt.ExportNamedDeclaration = Pte;
47678
- Wt.ExportNamespaceSpecifier = Tte;
47679
- Wt.ExportSpecifier = vte;
47680
- Wt.ImportAttribute = Fte;
47681
- Wt.ImportDeclaration = xte;
47682
- Wt.ImportDefaultSpecifier = bte;
47683
- Wt.ImportExpression = Ite;
47684
- Wt.ImportNamespaceSpecifier = wte;
47685
- Wt.ImportSpecifier = Ete;
47686
- Wt._printAttributes = Ate;
47674
+ Gt.ExportAllDeclaration = Cte;
47675
+ Gt.ExportDefaultDeclaration = _te;
47676
+ Gt.ExportDefaultSpecifier = Ste;
47677
+ Gt.ExportNamedDeclaration = Pte;
47678
+ Gt.ExportNamespaceSpecifier = Tte;
47679
+ Gt.ExportSpecifier = vte;
47680
+ Gt.ImportAttribute = Fte;
47681
+ Gt.ImportDeclaration = xte;
47682
+ Gt.ImportDefaultSpecifier = bte;
47683
+ Gt.ImportExpression = Ite;
47684
+ Gt.ImportNamespaceSpecifier = wte;
47685
+ Gt.ImportSpecifier = Ete;
47686
+ Gt._printAttributes = Ate;
47687
47687
  var pte = Xe(), hte = ts();
47688
47688
  const {
47689
47689
  isClassDeclaration: dte,
@@ -48102,7 +48102,7 @@ var VT = {};
48102
48102
  return i.StringLiteral;
48103
48103
  }
48104
48104
  }), e.StringTypeAnnotation = Be, e.SymbolTypeAnnotation = he, e.ThisTypeAnnotation = _e, e.TupleTypeAnnotation = Ie, e.TypeAlias = xe, e.TypeAnnotation = ot, e.TypeCastExpression = fe, e.TypeParameter = Ve, e.TypeParameterDeclaration = e.TypeParameterInstantiation = de, e.TypeofTypeAnnotation = Se, e.UnionTypeAnnotation = qe, e.Variance = $e, e.VoidTypeAnnotation = Ke, e._interfaceish = ie, e._variance = J;
48105
- var t = Xe(), r = Wt, n = ts(), i = pt;
48105
+ var t = Xe(), r = Gt, n = ts(), i = pt;
48106
48106
  const {
48107
48107
  isDeclareExportDeclaration: s,
48108
48108
  isStatement: a
@@ -48437,25 +48437,25 @@ function Tre(e) {
48437
48437
  function Are(e) {
48438
48438
  this.token("%%"), this.print(e.name), this.token("%%"), e.expectedNode === "Statement" && this.semicolon();
48439
48439
  }
48440
- var Vt = {};
48441
- Object.defineProperty(Vt, "__esModule", {
48440
+ var Ht = {};
48441
+ Object.defineProperty(Ht, "__esModule", {
48442
48442
  value: !0
48443
48443
  });
48444
- Vt.JSXAttribute = Cre;
48445
- Vt.JSXClosingElement = Lre;
48446
- Vt.JSXClosingFragment = $re;
48447
- Vt.JSXElement = Nre;
48448
- Vt.JSXEmptyExpression = Rre;
48449
- Vt.JSXExpressionContainer = wre;
48450
- Vt.JSXFragment = Mre;
48451
- Vt.JSXIdentifier = Pre;
48452
- Vt.JSXMemberExpression = xre;
48453
- Vt.JSXNamespacedName = _re;
48454
- Vt.JSXOpeningElement = kre;
48455
- Vt.JSXOpeningFragment = jre;
48456
- Vt.JSXSpreadAttribute = Fre;
48457
- Vt.JSXSpreadChild = Ire;
48458
- Vt.JSXText = Ore;
48444
+ Ht.JSXAttribute = Cre;
48445
+ Ht.JSXClosingElement = Lre;
48446
+ Ht.JSXClosingFragment = $re;
48447
+ Ht.JSXElement = Nre;
48448
+ Ht.JSXEmptyExpression = Rre;
48449
+ Ht.JSXExpressionContainer = wre;
48450
+ Ht.JSXFragment = Mre;
48451
+ Ht.JSXIdentifier = Pre;
48452
+ Ht.JSXMemberExpression = xre;
48453
+ Ht.JSXNamespacedName = _re;
48454
+ Ht.JSXOpeningElement = kre;
48455
+ Ht.JSXOpeningFragment = jre;
48456
+ Ht.JSXSpreadAttribute = Fre;
48457
+ Ht.JSXSpreadChild = Ire;
48458
+ Ht.JSXText = Ore;
48459
48459
  function Cre(e) {
48460
48460
  this.print(e.name, e), e.value && (this.tokenChar(61), this.print(e.value, e));
48461
48461
  }
@@ -48942,7 +48942,7 @@ function eie(e) {
48942
48942
  }
48943
48943
  });
48944
48944
  });
48945
- var a = Wt;
48945
+ var a = Gt;
48946
48946
  Object.keys(a).forEach(function(p) {
48947
48947
  p === "default" || p === "__esModule" || p in e && e[p] === a[p] || Object.defineProperty(e, p, {
48948
48948
  enumerable: !0,
@@ -48978,7 +48978,7 @@ function eie(e) {
48978
48978
  }
48979
48979
  });
48980
48980
  });
48981
- var c = Vt;
48981
+ var c = Ht;
48982
48982
  Object.keys(c).forEach(function(p) {
48983
48983
  p === "default" || p === "__esModule" || p in e && e[p] === c[p] || Object.defineProperty(e, p, {
48984
48984
  enumerable: !0,
@@ -54244,7 +54244,7 @@ export default {
54244
54244
  });
54245
54245
  } catch {
54246
54246
  }
54247
- PP(Oe.join(o, p.callId + ".ts"), p.serverCode, (d) => {
54247
+ PP(Oe.join(o, p.callId + ".ts"), h, (d) => {
54248
54248
  d && console.error(d);
54249
54249
  });
54250
54250
  });
@@ -54291,10 +54291,10 @@ async function Loe(e) {
54291
54291
  }
54292
54292
  class Roe {
54293
54293
  constructor(t = {}, r) {
54294
- Gt(this, "options");
54295
- Gt(this, "apis", []);
54296
- Gt(this, "middlewares", []);
54297
- Gt(this, "defaultMiddlewares", [
54294
+ Ut(this, "options");
54295
+ Ut(this, "apis", []);
54296
+ Ut(this, "middlewares", []);
54297
+ Ut(this, "defaultMiddlewares", [
54298
54298
  async (t, r) => {
54299
54299
  try {
54300
54300
  await r();
@@ -54303,11 +54303,11 @@ class Roe {
54303
54303
  }
54304
54304
  }
54305
54305
  ]);
54306
- Gt(this, "api404");
54307
- Gt(this, "fnMiddleware");
54308
- Gt(this, "getId");
54309
- Gt(this, "config");
54310
- Gt(this, "apiList");
54306
+ Ut(this, "api404");
54307
+ Ut(this, "fnMiddleware");
54308
+ Ut(this, "getId");
54309
+ Ut(this, "config");
54310
+ Ut(this, "apiList");
54311
54311
  this.options = { ...t, baseUrl: t.baseUrl ?? "/" }, this.options.baseUrl = this.options.baseUrl.split("/").map((i) => encodeURIComponent(i)).join("/"), this.middlewares.push(...this.defaultMiddlewares), this.middlewares.push(...t.middlewares || []);
54312
54312
  const n = ((t == null ? void 0 : t.apis) ?? []).sort((i, s) => {
54313
54313
  const a = s.path.substr(-1, 1), o = a === "*" ? 0 : a === "/" ? 0.1 : 0.2, u = i.path.substr(-1, 1), l = u === "*" ? 0 : u === "/" ? 0.1 : 0.2;
@@ -54426,9 +54426,9 @@ function Due(e) {
54426
54426
  a.push((u) => o(u));
54427
54427
  });
54428
54428
  }
54429
- return await new Promise((a) => {
54429
+ return Et.servicePending.set(r, !0), await new Promise((a) => {
54430
54430
  Et.app ? a(1) : Et.appCb.push(() => a(1));
54431
- }), Et.servicePending.set(r, !0), n = await r(Et.app), Et.services.set(r, n), (s = Et.serviceCb.get(r)) == null || s.forEach((a) => a(n)), Et.serviceCb.delete(r), Et.servicePending.delete(r), n;
54431
+ }), n = await r(Et.app), Et.services.set(r, n), (s = Et.serviceCb.get(r)) == null || s.forEach((a) => a(n)), Et.serviceCb.delete(r), Et.servicePending.delete(r), n;
54432
54432
  }
54433
54433
  return t._soon_symbol = joe, t.serviceName = (e == null ? void 0 : e.serviceName) ?? "", t.autoInject = (e == null ? void 0 : e.autoInject) ?? !1, t.enableClient = (e == null ? void 0 : e.enableClient) ?? !1, t;
54434
54434
  }
@@ -54451,11 +54451,21 @@ async function Sue(e) {
54451
54451
  });
54452
54452
  });
54453
54453
  }
54454
- function vue(e, t) {
54455
- const r = new Error(e);
54456
- return r.code = t, r;
54454
+ class vue extends Error {
54455
+ constructor(r, n) {
54456
+ super(r);
54457
+ Ut(this, "code");
54458
+ this.code = n;
54459
+ }
54460
+ }
54461
+ class Tue extends Error {
54462
+ constructor(r, n) {
54463
+ super(r);
54464
+ Ut(this, "status");
54465
+ this.status = n;
54466
+ }
54457
54467
  }
54458
- function Tue({
54468
+ function Aue({
54459
54469
  pingTime: e = 0,
54460
54470
  action: t
54461
54471
  }) {
@@ -54500,7 +54510,7 @@ data:
54500
54510
  function $oe(e) {
54501
54511
  return e instanceof SE;
54502
54512
  }
54503
- function Aue(e) {
54513
+ function Cue(e) {
54504
54514
  if ($oe(e)) {
54505
54515
  const t = new gP();
54506
54516
  return e.subscribe({
@@ -54515,19 +54525,20 @@ function Aue(e) {
54515
54525
  throw new Error("Not a valid SSE body");
54516
54526
  }
54517
54527
  export {
54518
- vue as CodeError,
54528
+ vue as BizError,
54519
54529
  SE as Observable,
54520
54530
  Roe as SoonApp,
54531
+ Tue as SoonError,
54521
54532
  Sue as createSoonApp,
54522
54533
  gue as defineApi,
54523
54534
  bue as defineConfig,
54524
54535
  Eue as defineMiddleware,
54525
54536
  Due as defineService,
54526
54537
  $oe as isSSEBody,
54527
- Aue as resolveSSEBody,
54538
+ Cue as resolveSSEBody,
54528
54539
  Moe as soonApiSymbol,
54529
54540
  joe as soonServiceSymbol,
54530
- Tue as useSSE,
54541
+ Aue as useSSE,
54531
54542
  yue as vitePluginSoonClient,
54532
54543
  aue as vitePluginSoonServer
54533
54544
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soonjs",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",