lakutata 2.0.32 → 2.0.34
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/helper.cjs +32 -28
- package/helper.d.ts +37 -2
- package/helper.mjs +2 -0
- package/package.json +1 -1
- package/src/decorators/ctrl/http/DELETE.cjs +1 -1
- package/src/decorators/ctrl/http/DELETE.mjs +1 -1
- package/src/decorators/ctrl/http/GET.cjs +1 -1
- package/src/decorators/ctrl/http/GET.mjs +1 -1
- package/src/decorators/ctrl/http/HEAD.cjs +1 -1
- package/src/decorators/ctrl/http/HEAD.mjs +1 -1
- package/src/decorators/ctrl/http/OPTIONS.cjs +1 -1
- package/src/decorators/ctrl/http/OPTIONS.mjs +1 -1
- package/src/decorators/ctrl/http/PATCH.cjs +1 -1
- package/src/decorators/ctrl/http/PATCH.mjs +1 -1
- package/src/decorators/ctrl/http/POST.cjs +1 -1
- package/src/decorators/ctrl/http/POST.mjs +1 -1
- package/src/decorators/ctrl/http/PUT.cjs +1 -1
- package/src/decorators/ctrl/http/PUT.mjs +1 -1
- package/src/lib/helpers/URLBuilder.cjs +441 -0
- package/src/lib/helpers/URLBuilder.mjs +435 -0
- package/vendor/Package.15.cjs +154 -159
- package/vendor/Package.15.mjs +1 -1
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
4
|
+
value: "Module"
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const e = require("../../../vendor/Package.5.cjs");
|
|
8
|
+
|
|
9
|
+
"use strict";
|
|
10
|
+
|
|
11
|
+
var t = function e(t, s) {
|
|
12
|
+
s = s.split(":")[0];
|
|
13
|
+
t = +t;
|
|
14
|
+
if (!t) return false;
|
|
15
|
+
switch (s) {
|
|
16
|
+
case "http":
|
|
17
|
+
case "ws":
|
|
18
|
+
return t !== 80;
|
|
19
|
+
|
|
20
|
+
case "https":
|
|
21
|
+
case "wss":
|
|
22
|
+
return t !== 443;
|
|
23
|
+
|
|
24
|
+
case "ftp":
|
|
25
|
+
return t !== 21;
|
|
26
|
+
|
|
27
|
+
case "gopher":
|
|
28
|
+
return t !== 70;
|
|
29
|
+
|
|
30
|
+
case "file":
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return t !== 0;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const s = e.getDefaultExportFromCjs(t);
|
|
37
|
+
|
|
38
|
+
var o = {};
|
|
39
|
+
|
|
40
|
+
"use strict";
|
|
41
|
+
|
|
42
|
+
var r = Object.prototype.hasOwnProperty, n;
|
|
43
|
+
|
|
44
|
+
function i(e) {
|
|
45
|
+
try {
|
|
46
|
+
return decodeURIComponent(e.replace(/\+/g, " "));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function a(e) {
|
|
53
|
+
try {
|
|
54
|
+
return encodeURIComponent(e);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function h(e) {
|
|
61
|
+
var t = /([^=?#&]+)=?([^&]*)/g, s = {}, o;
|
|
62
|
+
while (o = t.exec(e)) {
|
|
63
|
+
var r = i(o[1]), n = i(o[2]);
|
|
64
|
+
if (r === null || n === null || r in s) continue;
|
|
65
|
+
s[r] = n;
|
|
66
|
+
}
|
|
67
|
+
return s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function l(e, t) {
|
|
71
|
+
t = t || "";
|
|
72
|
+
var s = [], o, i;
|
|
73
|
+
if ("string" !== typeof t) t = "?";
|
|
74
|
+
for (i in e) {
|
|
75
|
+
if (r.call(e, i)) {
|
|
76
|
+
o = e[i];
|
|
77
|
+
if (!o && (o === null || o === n || isNaN(o))) {
|
|
78
|
+
o = "";
|
|
79
|
+
}
|
|
80
|
+
i = a(i);
|
|
81
|
+
o = a(o);
|
|
82
|
+
if (i === null || o === null) continue;
|
|
83
|
+
s.push(i + "=" + o);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return s.length ? t + s.join("&") : "";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var c = o.stringify = l;
|
|
90
|
+
|
|
91
|
+
var u = o.parse = h;
|
|
92
|
+
|
|
93
|
+
"use strict";
|
|
94
|
+
|
|
95
|
+
var f = t, p = o, d = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, m = /[\n\r\t]/g, g = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, w = /:\d+$/, y = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, b = /^[a-zA-Z]:/;
|
|
96
|
+
|
|
97
|
+
function v(e) {
|
|
98
|
+
return (e ? e : "").toString().replace(d, "");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
var j = [ [ "#", "hash" ], [ "?", "query" ], function e(t, s) {
|
|
102
|
+
return R(s.protocol) ? t.replace(/\\/g, "/") : t;
|
|
103
|
+
}, [ "/", "pathname" ], [ "@", "auth", 1 ], [ NaN, "host", undefined, 1, 1 ], [ /:(\d*)$/, "port", undefined, 1 ], [ NaN, "hostname", undefined, 1, 1 ] ];
|
|
104
|
+
|
|
105
|
+
var O = {
|
|
106
|
+
hash: 1,
|
|
107
|
+
query: 1
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
function C(t) {
|
|
111
|
+
var s;
|
|
112
|
+
if (typeof window !== "undefined") s = window; else if (typeof e.commonjsGlobal !== "undefined") s = e.commonjsGlobal; else if (typeof self !== "undefined") s = self; else s = {};
|
|
113
|
+
var o = s.location || {};
|
|
114
|
+
t = t || o;
|
|
115
|
+
var r = {}, n = typeof t, i;
|
|
116
|
+
if ("blob:" === t.protocol) {
|
|
117
|
+
r = new q(unescape(t.pathname), {});
|
|
118
|
+
} else if ("string" === n) {
|
|
119
|
+
r = new q(t, {});
|
|
120
|
+
for (i in O) delete r[i];
|
|
121
|
+
} else if ("object" === n) {
|
|
122
|
+
for (i in t) {
|
|
123
|
+
if (i in O) continue;
|
|
124
|
+
r[i] = t[i];
|
|
125
|
+
}
|
|
126
|
+
if (r.slashes === undefined) {
|
|
127
|
+
r.slashes = g.test(t.href);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return r;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function R(e) {
|
|
134
|
+
return e === "file:" || e === "ftp:" || e === "http:" || e === "https:" || e === "ws:" || e === "wss:";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function U(e, t) {
|
|
138
|
+
e = v(e);
|
|
139
|
+
e = e.replace(m, "");
|
|
140
|
+
t = t || {};
|
|
141
|
+
var s = y.exec(e);
|
|
142
|
+
var o = s[1] ? s[1].toLowerCase() : "";
|
|
143
|
+
var r = !!s[2];
|
|
144
|
+
var n = !!s[3];
|
|
145
|
+
var i = 0;
|
|
146
|
+
var a;
|
|
147
|
+
if (r) {
|
|
148
|
+
if (n) {
|
|
149
|
+
a = s[2] + s[3] + s[4];
|
|
150
|
+
i = s[2].length + s[3].length;
|
|
151
|
+
} else {
|
|
152
|
+
a = s[2] + s[4];
|
|
153
|
+
i = s[2].length;
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
if (n) {
|
|
157
|
+
a = s[3] + s[4];
|
|
158
|
+
i = s[3].length;
|
|
159
|
+
} else {
|
|
160
|
+
a = s[4];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (o === "file:") {
|
|
164
|
+
if (i >= 2) {
|
|
165
|
+
a = a.slice(2);
|
|
166
|
+
}
|
|
167
|
+
} else if (R(o)) {
|
|
168
|
+
a = s[4];
|
|
169
|
+
} else if (o) {
|
|
170
|
+
if (r) {
|
|
171
|
+
a = a.slice(2);
|
|
172
|
+
}
|
|
173
|
+
} else if (i >= 2 && R(t.protocol)) {
|
|
174
|
+
a = s[4];
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
protocol: o,
|
|
178
|
+
slashes: r || R(o),
|
|
179
|
+
slashesCount: i,
|
|
180
|
+
rest: a
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function I(e, t) {
|
|
185
|
+
if (e === "") return t;
|
|
186
|
+
var s = (t || "/").split("/").slice(0, -1).concat(e.split("/")), o = s.length, r = s[o - 1], n = false, i = 0;
|
|
187
|
+
while (o--) {
|
|
188
|
+
if (s[o] === ".") {
|
|
189
|
+
s.splice(o, 1);
|
|
190
|
+
} else if (s[o] === "..") {
|
|
191
|
+
s.splice(o, 1);
|
|
192
|
+
i++;
|
|
193
|
+
} else if (i) {
|
|
194
|
+
if (o === 0) n = true;
|
|
195
|
+
s.splice(o, 1);
|
|
196
|
+
i--;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (n) s.unshift("");
|
|
200
|
+
if (r === "." || r === "..") s.push("");
|
|
201
|
+
return s.join("/");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function q(e, t, s) {
|
|
205
|
+
e = v(e);
|
|
206
|
+
e = e.replace(m, "");
|
|
207
|
+
if (!(this instanceof q)) {
|
|
208
|
+
return new q(e, t, s);
|
|
209
|
+
}
|
|
210
|
+
var o, r, n, i, a, h, l = j.slice(), c = typeof t, u = this, d = 0;
|
|
211
|
+
if ("object" !== c && "string" !== c) {
|
|
212
|
+
s = t;
|
|
213
|
+
t = null;
|
|
214
|
+
}
|
|
215
|
+
if (s && "function" !== typeof s) s = p.parse;
|
|
216
|
+
t = C(t);
|
|
217
|
+
r = U(e || "", t);
|
|
218
|
+
o = !r.protocol && !r.slashes;
|
|
219
|
+
u.slashes = r.slashes || o && t.slashes;
|
|
220
|
+
u.protocol = r.protocol || t.protocol || "";
|
|
221
|
+
e = r.rest;
|
|
222
|
+
if (r.protocol === "file:" && (r.slashesCount !== 2 || b.test(e)) || !r.slashes && (r.protocol || r.slashesCount < 2 || !R(u.protocol))) {
|
|
223
|
+
l[3] = [ /(.*)/, "pathname" ];
|
|
224
|
+
}
|
|
225
|
+
for (;d < l.length; d++) {
|
|
226
|
+
i = l[d];
|
|
227
|
+
if (typeof i === "function") {
|
|
228
|
+
e = i(e, u);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
n = i[0];
|
|
232
|
+
h = i[1];
|
|
233
|
+
if (n !== n) {
|
|
234
|
+
u[h] = e;
|
|
235
|
+
} else if ("string" === typeof n) {
|
|
236
|
+
a = n === "@" ? e.lastIndexOf(n) : e.indexOf(n);
|
|
237
|
+
if (~a) {
|
|
238
|
+
if ("number" === typeof i[2]) {
|
|
239
|
+
u[h] = e.slice(0, a);
|
|
240
|
+
e = e.slice(a + i[2]);
|
|
241
|
+
} else {
|
|
242
|
+
u[h] = e.slice(a);
|
|
243
|
+
e = e.slice(0, a);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
} else if (a = n.exec(e)) {
|
|
247
|
+
u[h] = a[1];
|
|
248
|
+
e = e.slice(0, a.index);
|
|
249
|
+
}
|
|
250
|
+
u[h] = u[h] || (o && i[3] ? t[h] || "" : "");
|
|
251
|
+
if (i[4]) u[h] = u[h].toLowerCase();
|
|
252
|
+
}
|
|
253
|
+
if (s) u.query = s(u.query);
|
|
254
|
+
if (o && t.slashes && u.pathname.charAt(0) !== "/" && (u.pathname !== "" || t.pathname !== "")) {
|
|
255
|
+
u.pathname = I(u.pathname, t.pathname);
|
|
256
|
+
}
|
|
257
|
+
if (u.pathname.charAt(0) !== "/" && R(u.protocol)) {
|
|
258
|
+
u.pathname = "/" + u.pathname;
|
|
259
|
+
}
|
|
260
|
+
if (!f(u.port, u.protocol)) {
|
|
261
|
+
u.host = u.hostname;
|
|
262
|
+
u.port = "";
|
|
263
|
+
}
|
|
264
|
+
u.username = u.password = "";
|
|
265
|
+
if (u.auth) {
|
|
266
|
+
a = u.auth.indexOf(":");
|
|
267
|
+
if (~a) {
|
|
268
|
+
u.username = u.auth.slice(0, a);
|
|
269
|
+
u.username = encodeURIComponent(decodeURIComponent(u.username));
|
|
270
|
+
u.password = u.auth.slice(a + 1);
|
|
271
|
+
u.password = encodeURIComponent(decodeURIComponent(u.password));
|
|
272
|
+
} else {
|
|
273
|
+
u.username = encodeURIComponent(decodeURIComponent(u.auth));
|
|
274
|
+
}
|
|
275
|
+
u.auth = u.password ? u.username + ":" + u.password : u.username;
|
|
276
|
+
}
|
|
277
|
+
u.origin = u.protocol !== "file:" && R(u.protocol) && u.host ? u.protocol + "//" + u.host : "null";
|
|
278
|
+
u.href = u.toString();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function x(e, t, s) {
|
|
282
|
+
var o = this;
|
|
283
|
+
switch (e) {
|
|
284
|
+
case "query":
|
|
285
|
+
if ("string" === typeof t && t.length) {
|
|
286
|
+
t = (s || p.parse)(t);
|
|
287
|
+
}
|
|
288
|
+
o[e] = t;
|
|
289
|
+
break;
|
|
290
|
+
|
|
291
|
+
case "port":
|
|
292
|
+
o[e] = t;
|
|
293
|
+
if (!f(t, o.protocol)) {
|
|
294
|
+
o.host = o.hostname;
|
|
295
|
+
o[e] = "";
|
|
296
|
+
} else if (t) {
|
|
297
|
+
o.host = o.hostname + ":" + t;
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
|
|
301
|
+
case "hostname":
|
|
302
|
+
o[e] = t;
|
|
303
|
+
if (o.port) t += ":" + o.port;
|
|
304
|
+
o.host = t;
|
|
305
|
+
break;
|
|
306
|
+
|
|
307
|
+
case "host":
|
|
308
|
+
o[e] = t;
|
|
309
|
+
if (w.test(t)) {
|
|
310
|
+
t = t.split(":");
|
|
311
|
+
o.port = t.pop();
|
|
312
|
+
o.hostname = t.join(":");
|
|
313
|
+
} else {
|
|
314
|
+
o.hostname = t;
|
|
315
|
+
o.port = "";
|
|
316
|
+
}
|
|
317
|
+
break;
|
|
318
|
+
|
|
319
|
+
case "protocol":
|
|
320
|
+
o.protocol = t.toLowerCase();
|
|
321
|
+
o.slashes = !s;
|
|
322
|
+
break;
|
|
323
|
+
|
|
324
|
+
case "pathname":
|
|
325
|
+
case "hash":
|
|
326
|
+
if (t) {
|
|
327
|
+
var r = e === "pathname" ? "/" : "#";
|
|
328
|
+
o[e] = t.charAt(0) !== r ? r + t : t;
|
|
329
|
+
} else {
|
|
330
|
+
o[e] = t;
|
|
331
|
+
}
|
|
332
|
+
break;
|
|
333
|
+
|
|
334
|
+
case "username":
|
|
335
|
+
case "password":
|
|
336
|
+
o[e] = encodeURIComponent(t);
|
|
337
|
+
break;
|
|
338
|
+
|
|
339
|
+
case "auth":
|
|
340
|
+
var n = t.indexOf(":");
|
|
341
|
+
if (~n) {
|
|
342
|
+
o.username = t.slice(0, n);
|
|
343
|
+
o.username = encodeURIComponent(decodeURIComponent(o.username));
|
|
344
|
+
o.password = t.slice(n + 1);
|
|
345
|
+
o.password = encodeURIComponent(decodeURIComponent(o.password));
|
|
346
|
+
} else {
|
|
347
|
+
o.username = encodeURIComponent(decodeURIComponent(t));
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
for (var i = 0; i < j.length; i++) {
|
|
351
|
+
var a = j[i];
|
|
352
|
+
if (a[4]) o[a[1]] = o[a[1]].toLowerCase();
|
|
353
|
+
}
|
|
354
|
+
o.auth = o.password ? o.username + ":" + o.password : o.username;
|
|
355
|
+
o.origin = o.protocol !== "file:" && R(o.protocol) && o.host ? o.protocol + "//" + o.host : "null";
|
|
356
|
+
o.href = o.toString();
|
|
357
|
+
return o;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function S(e) {
|
|
361
|
+
if (!e || "function" !== typeof e) e = p.stringify;
|
|
362
|
+
var t, s = this, o = s.host, r = s.protocol;
|
|
363
|
+
if (r && r.charAt(r.length - 1) !== ":") r += ":";
|
|
364
|
+
var n = r + (s.protocol && s.slashes || R(s.protocol) ? "//" : "");
|
|
365
|
+
if (s.username) {
|
|
366
|
+
n += s.username;
|
|
367
|
+
if (s.password) n += ":" + s.password;
|
|
368
|
+
n += "@";
|
|
369
|
+
} else if (s.password) {
|
|
370
|
+
n += ":" + s.password;
|
|
371
|
+
n += "@";
|
|
372
|
+
} else if (s.protocol !== "file:" && R(s.protocol) && !o && s.pathname !== "/") {
|
|
373
|
+
n += "@";
|
|
374
|
+
}
|
|
375
|
+
if (o[o.length - 1] === ":" || w.test(s.hostname) && !s.port) {
|
|
376
|
+
o += ":";
|
|
377
|
+
}
|
|
378
|
+
n += o + s.pathname;
|
|
379
|
+
t = "object" === typeof s.query ? e(s.query) : s.query;
|
|
380
|
+
if (t) n += "?" !== t.charAt(0) ? "?" + t : t;
|
|
381
|
+
if (s.hash) n += s.hash;
|
|
382
|
+
return n;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
q.prototype = {
|
|
386
|
+
set: x,
|
|
387
|
+
toString: S
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
q.extractProtocol = U;
|
|
391
|
+
|
|
392
|
+
q.location = C;
|
|
393
|
+
|
|
394
|
+
q.trimLeft = v;
|
|
395
|
+
|
|
396
|
+
q.qs = p;
|
|
397
|
+
|
|
398
|
+
var L = q;
|
|
399
|
+
|
|
400
|
+
const k = e.getDefaultExportFromCjs(L);
|
|
401
|
+
|
|
402
|
+
class URLBuilder {
|
|
403
|
+
static parse(e) {
|
|
404
|
+
return new URLBuilder(JSON.parse(JSON.stringify(k(e, true))));
|
|
405
|
+
}
|
|
406
|
+
#e;
|
|
407
|
+
constructor(e = {}) {
|
|
408
|
+
this.#e = k("");
|
|
409
|
+
this.auth = e.auth;
|
|
410
|
+
this.hash = e.hash;
|
|
411
|
+
this.host = e.host;
|
|
412
|
+
this.hostname = e.hostname;
|
|
413
|
+
this.href = e.href;
|
|
414
|
+
this.origin = e.origin;
|
|
415
|
+
this.password = e.password;
|
|
416
|
+
this.pathname = e.pathname;
|
|
417
|
+
this.port = e.port;
|
|
418
|
+
this.protocol = e.protocol;
|
|
419
|
+
this.query = e.query;
|
|
420
|
+
this.slashes = e.slashes;
|
|
421
|
+
this.username = e.username;
|
|
422
|
+
}
|
|
423
|
+
toString() {
|
|
424
|
+
if (this.auth) this.#e.set("auth", this.auth);
|
|
425
|
+
if (this.hash) this.#e.set("hash", this.hash);
|
|
426
|
+
if (this.host) this.#e.set("host", this.host);
|
|
427
|
+
if (this.hostname) this.#e.set("hostname", this.hostname);
|
|
428
|
+
if (this.href) this.#e.set("href", this.href);
|
|
429
|
+
if (this.origin !== undefined) this.#e.set("origin", this.origin.toString());
|
|
430
|
+
if (this.password) this.#e.set("password", this.password);
|
|
431
|
+
if (this.pathname) this.#e.set("pathname", this.pathname);
|
|
432
|
+
if (this.port !== undefined) this.#e.set("port", this.port);
|
|
433
|
+
if (this.protocol) this.#e.set("protocol", this.protocol);
|
|
434
|
+
if (this.query) this.#e.set("query", this.query);
|
|
435
|
+
if (this.slashes !== undefined) this.#e.set("slashes", this.slashes);
|
|
436
|
+
if (this.username) this.#e.set("username", this.username);
|
|
437
|
+
return this.#e.toString();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
exports.URLBuilder = URLBuilder;
|