jcc-express-mvc 1.5.9 → 1.6.1
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/lib/Application/Application.d.ts.map +1 -1
- package/lib/Application/Application.js +1 -0
- package/lib/Auth/index.js +2 -2
- package/lib/Error/public/js/app-error-prism-line.js +377 -0
- package/lib/Error/public/js/app-error-prism.js +7 -0
- package/lib/Error/public/pageNotFound.html +28 -0
- package/lib/Interface/index.d.ts +1 -1
- package/lib/Interface/index.d.ts.map +1 -1
- package/lib/Providers/RouteServiceProvider.js +1 -1
- package/lib/Response/index.d.ts.map +1 -1
- package/lib/Response/index.js +13 -2
- package/lib/Routes/Route.d.ts +1 -0
- package/lib/Routes/Route.d.ts.map +1 -1
- package/lib/Routes/Route.js +5 -0
- package/lib/Routes/RouteBuilder.d.ts +2 -0
- package/lib/Routes/RouteBuilder.d.ts.map +1 -1
- package/lib/Routes/RouteBuilder.js +7 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Application/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAQnE,qBAAa,WAAY,SAAQ,kBAAkB;IACjD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAyB;IACnC,QAAQ,EAAE,MAAM,CAAY;IAC5B,YAAY,EAAE,WAAW,EAAE,CAAM;IACxC,OAAO,CAAC,OAAO,CAAW;;IAU1B,iBAAiB,CAAC,QAAQ,EAAE,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,GAAG,IAAI;IAc5E,IAAI,IAAI,IAAI;IAUZ,OAAO,CAAC,YAAY;IAIb,OAAO;IAKR,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Application/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAQnE,qBAAa,WAAY,SAAQ,kBAAkB;IACjD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAyB;IACnC,QAAQ,EAAE,MAAM,CAAY;IAC5B,YAAY,EAAE,WAAW,EAAE,CAAM;IACxC,OAAO,CAAC,OAAO,CAAW;;IAU1B,iBAAiB,CAAC,QAAQ,EAAE,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,GAAG,IAAI;IAc5E,IAAI,IAAI,IAAI;IAUZ,OAAO,CAAC,YAAY;IAIb,OAAO;IAKR,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB1B,MAAM,CAAC,aAAa;CAGrB"}
|
|
@@ -59,6 +59,7 @@ class Application extends ExpressApplication_1.ExpressApplication {
|
|
|
59
59
|
//
|
|
60
60
|
RouteBuilder_1.RouteBuilder.setServiceContainer(this);
|
|
61
61
|
await routeServiceProvider.loadRoutes(this.configRoutes);
|
|
62
|
+
console.log(RouteBuilder_1.RouteBuilder.routeList);
|
|
62
63
|
const server = new Server_1.Server(this);
|
|
63
64
|
server.server(Number(Config_1.config.get("PORT", "5500")));
|
|
64
65
|
}
|
package/lib/Auth/index.js
CHANGED
|
@@ -66,7 +66,7 @@ class Authentication {
|
|
|
66
66
|
// Method to handle authentication attempt
|
|
67
67
|
static attempt(req, res, next, redirectTo = "/home") {
|
|
68
68
|
try {
|
|
69
|
-
let redirectBack = req.
|
|
69
|
+
let redirectBack = req.previsiousUrls[1];
|
|
70
70
|
// Retrieve the previous URL
|
|
71
71
|
const appRedirect = req.session["appRedirect"];
|
|
72
72
|
const redirectPath = appRedirect ? appRedirect : redirectTo || "";
|
|
@@ -85,7 +85,7 @@ class Authentication {
|
|
|
85
85
|
if (err) {
|
|
86
86
|
next(err);
|
|
87
87
|
}
|
|
88
|
-
return res.redirect(
|
|
88
|
+
return res.redirect(303, "/login");
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
const d = () => {
|
|
2
|
+
if (
|
|
3
|
+
typeof Prism === "undefined" ||
|
|
4
|
+
typeof document === "undefined" ||
|
|
5
|
+
!document.querySelector
|
|
6
|
+
) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
var LINE_NUMBERS_CLASS = "line-numbers";
|
|
11
|
+
var LINKABLE_LINE_NUMBERS_CLASS = "linkable-line-numbers";
|
|
12
|
+
var NEW_LINE_EXP = /\n(?!$)/g;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} selector
|
|
16
|
+
* @param {ParentNode} [container]
|
|
17
|
+
* @returns {HTMLElement[]}
|
|
18
|
+
*/
|
|
19
|
+
function $$(selector, container) {
|
|
20
|
+
return Array.prototype.slice.call(
|
|
21
|
+
(container || document).querySelectorAll(selector)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns whether the given element has the given class.
|
|
27
|
+
*
|
|
28
|
+
* @param {Element} element
|
|
29
|
+
* @param {string} className
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
function hasClass(element, className) {
|
|
33
|
+
return element.classList.contains(className);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Calls the given function.
|
|
38
|
+
*
|
|
39
|
+
* @param {() => any} func
|
|
40
|
+
* @returns {void}
|
|
41
|
+
*/
|
|
42
|
+
function callFunction(func) {
|
|
43
|
+
func();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Some browsers round the line-height, others don't.
|
|
47
|
+
// We need to test for it to position the elements properly.
|
|
48
|
+
var isLineHeightRounded = (function () {
|
|
49
|
+
var res;
|
|
50
|
+
return function () {
|
|
51
|
+
if (typeof res === "undefined") {
|
|
52
|
+
var d = document.createElement("div");
|
|
53
|
+
d.style.fontSize = "13px";
|
|
54
|
+
d.style.lineHeight = "1.5";
|
|
55
|
+
d.style.padding = "0";
|
|
56
|
+
d.style.border = "0";
|
|
57
|
+
d.innerHTML = " <br /> ";
|
|
58
|
+
document.body.appendChild(d);
|
|
59
|
+
// Browsers that round the line-height should have offsetHeight === 38
|
|
60
|
+
// The others should have 39.
|
|
61
|
+
res = d.offsetHeight === 38;
|
|
62
|
+
document.body.removeChild(d);
|
|
63
|
+
}
|
|
64
|
+
return res;
|
|
65
|
+
};
|
|
66
|
+
})();
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns the top offset of the content box of the given parent and the content box of one of its children.
|
|
70
|
+
*
|
|
71
|
+
* @param {HTMLElement} parent
|
|
72
|
+
* @param {HTMLElement} child
|
|
73
|
+
*/
|
|
74
|
+
function getContentBoxTopOffset(parent, child) {
|
|
75
|
+
var parentStyle = getComputedStyle(parent);
|
|
76
|
+
var childStyle = getComputedStyle(child);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Returns the numeric value of the given pixel value.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} px
|
|
82
|
+
*/
|
|
83
|
+
function pxToNumber(px) {
|
|
84
|
+
return +px.substr(0, px.length - 2);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
child.offsetTop +
|
|
89
|
+
pxToNumber(childStyle.borderTopWidth) +
|
|
90
|
+
pxToNumber(childStyle.paddingTop) -
|
|
91
|
+
pxToNumber(parentStyle.paddingTop)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns whether the Line Highlight plugin is active for the given element.
|
|
97
|
+
*
|
|
98
|
+
* If this function returns `false`, do not call `highlightLines` for the given element.
|
|
99
|
+
*
|
|
100
|
+
* @param {HTMLElement | null | undefined} pre
|
|
101
|
+
* @returns {boolean}
|
|
102
|
+
*/
|
|
103
|
+
function isActiveFor(pre) {
|
|
104
|
+
if (!pre || !/pre/i.test(pre.nodeName)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (pre.hasAttribute("data-line")) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (pre.id && Prism.util.isActive(pre, LINKABLE_LINE_NUMBERS_CLASS)) {
|
|
113
|
+
// Technically, the line numbers plugin is also necessary but this plugin doesn't control the classes of
|
|
114
|
+
// the line numbers plugin, so we can't assume that they are present.
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var scrollIntoView = true;
|
|
122
|
+
|
|
123
|
+
Prism.plugins.lineHighlight = {
|
|
124
|
+
/**
|
|
125
|
+
* Highlights the lines of the given pre.
|
|
126
|
+
*
|
|
127
|
+
* This function is split into a DOM measuring and mutate phase to improve performance.
|
|
128
|
+
* The returned function mutates the DOM when called.
|
|
129
|
+
*
|
|
130
|
+
* @param {HTMLElement} pre
|
|
131
|
+
* @param {string | null} [lines]
|
|
132
|
+
* @param {string} [classes='']
|
|
133
|
+
* @returns {() => void}
|
|
134
|
+
*/
|
|
135
|
+
highlightLines: function highlightLines(pre, lines, classes) {
|
|
136
|
+
lines =
|
|
137
|
+
typeof lines === "string" ? lines : pre.getAttribute("data-line") || "";
|
|
138
|
+
|
|
139
|
+
var ranges = lines.replace(/\s+/g, "").split(",").filter(Boolean);
|
|
140
|
+
var offset = +pre.getAttribute("data-line-offset") || 0;
|
|
141
|
+
|
|
142
|
+
var parseMethod = isLineHeightRounded() ? parseInt : parseFloat;
|
|
143
|
+
var lineHeight = parseMethod(getComputedStyle(pre).lineHeight);
|
|
144
|
+
var hasLineNumbers = Prism.util.isActive(pre, LINE_NUMBERS_CLASS);
|
|
145
|
+
var codeElement = pre.querySelector("code");
|
|
146
|
+
var parentElement = hasLineNumbers ? pre : codeElement || pre;
|
|
147
|
+
var mutateActions = /** @type {(() => void)[]} */ ([]);
|
|
148
|
+
var lineBreakMatch = codeElement.textContent.match(NEW_LINE_EXP);
|
|
149
|
+
var numberOfLines = lineBreakMatch ? lineBreakMatch.length + 1 : 1;
|
|
150
|
+
/**
|
|
151
|
+
* The top offset between the content box of the <code> element and the content box of the parent element of
|
|
152
|
+
* the line highlight element (either `<pre>` or `<code>`).
|
|
153
|
+
*
|
|
154
|
+
* This offset might not be zero for some themes where the <code> element has a top margin. Some plugins
|
|
155
|
+
* (or users) might also add element above the <code> element. Because the line highlight is aligned relative
|
|
156
|
+
* to the <pre> element, we have to take this into account.
|
|
157
|
+
*
|
|
158
|
+
* This offset will be 0 if the parent element of the line highlight element is the `<code>` element.
|
|
159
|
+
*/
|
|
160
|
+
var codePreOffset =
|
|
161
|
+
!codeElement || parentElement == codeElement
|
|
162
|
+
? 0
|
|
163
|
+
: getContentBoxTopOffset(pre, codeElement);
|
|
164
|
+
|
|
165
|
+
ranges.forEach(function (currentRange) {
|
|
166
|
+
var range = currentRange.split("-");
|
|
167
|
+
|
|
168
|
+
var start = +range[0];
|
|
169
|
+
var end = +range[1] || start;
|
|
170
|
+
end = Math.min(numberOfLines + offset, end);
|
|
171
|
+
|
|
172
|
+
if (end < start) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @type {HTMLElement} */
|
|
177
|
+
var line =
|
|
178
|
+
pre.querySelector(
|
|
179
|
+
'.line-highlight[data-range="' + currentRange + '"]'
|
|
180
|
+
) || document.createElement("div");
|
|
181
|
+
|
|
182
|
+
mutateActions.push(function () {
|
|
183
|
+
line.setAttribute("aria-hidden", "true");
|
|
184
|
+
line.setAttribute("data-range", currentRange);
|
|
185
|
+
line.className = (classes || "") + " line-highlight";
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers
|
|
189
|
+
if (hasLineNumbers && Prism.plugins.lineNumbers) {
|
|
190
|
+
var startNode = Prism.plugins.lineNumbers.getLine(pre, start);
|
|
191
|
+
var endNode = Prism.plugins.lineNumbers.getLine(pre, end);
|
|
192
|
+
|
|
193
|
+
if (startNode) {
|
|
194
|
+
var top = startNode.offsetTop + codePreOffset + "px";
|
|
195
|
+
mutateActions.push(function () {
|
|
196
|
+
line.style.top = top;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (endNode) {
|
|
201
|
+
var height =
|
|
202
|
+
endNode.offsetTop -
|
|
203
|
+
startNode.offsetTop +
|
|
204
|
+
endNode.offsetHeight +
|
|
205
|
+
"px";
|
|
206
|
+
mutateActions.push(function () {
|
|
207
|
+
line.style.height = height;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
mutateActions.push(function () {
|
|
212
|
+
line.setAttribute("data-start", String(start));
|
|
213
|
+
|
|
214
|
+
if (end > start) {
|
|
215
|
+
line.setAttribute("data-end", String(end));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
line.style.top =
|
|
219
|
+
(start - offset - 1) * lineHeight + codePreOffset + "px";
|
|
220
|
+
|
|
221
|
+
line.textContent = new Array(end - start + 2).join(" \n");
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
mutateActions.push(function () {
|
|
226
|
+
line.style.width = pre.scrollWidth + "px";
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
mutateActions.push(function () {
|
|
230
|
+
// allow this to play nicely with the line-numbers plugin
|
|
231
|
+
// need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning
|
|
232
|
+
parentElement.appendChild(line);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
var id = pre.id;
|
|
237
|
+
if (
|
|
238
|
+
hasLineNumbers &&
|
|
239
|
+
Prism.util.isActive(pre, LINKABLE_LINE_NUMBERS_CLASS) &&
|
|
240
|
+
id
|
|
241
|
+
) {
|
|
242
|
+
// This implements linkable line numbers. Linkable line numbers use Line Highlight to create a link to a
|
|
243
|
+
// specific line. For this to work, the pre element has to:
|
|
244
|
+
// 1) have line numbers,
|
|
245
|
+
// 2) have the `linkable-line-numbers` class or an ascendant that has that class, and
|
|
246
|
+
// 3) have an id.
|
|
247
|
+
|
|
248
|
+
if (!hasClass(pre, LINKABLE_LINE_NUMBERS_CLASS)) {
|
|
249
|
+
// add class to pre
|
|
250
|
+
mutateActions.push(function () {
|
|
251
|
+
pre.classList.add(LINKABLE_LINE_NUMBERS_CLASS);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
var start = parseInt(pre.getAttribute("data-start") || "1");
|
|
256
|
+
|
|
257
|
+
// iterate all line number spans
|
|
258
|
+
$$(".line-numbers-rows > span", pre).forEach(function (lineSpan, i) {
|
|
259
|
+
var lineNumber = i + start;
|
|
260
|
+
lineSpan.onclick = function () {
|
|
261
|
+
var hash = id + "." + lineNumber;
|
|
262
|
+
|
|
263
|
+
// this will prevent scrolling since the span is obviously in view
|
|
264
|
+
scrollIntoView = false;
|
|
265
|
+
location.hash = hash;
|
|
266
|
+
setTimeout(function () {
|
|
267
|
+
scrollIntoView = true;
|
|
268
|
+
}, 1);
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return function () {
|
|
274
|
+
mutateActions.forEach(callFunction);
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
function applyHash() {
|
|
280
|
+
var hash = location.hash.slice(1);
|
|
281
|
+
|
|
282
|
+
// Remove pre-existing temporary lines
|
|
283
|
+
$$(".temporary.line-highlight").forEach(function (line) {
|
|
284
|
+
line.parentNode.removeChild(line);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
var range = (hash.match(/\.([\d,-]+)$/) || [, ""])[1];
|
|
288
|
+
|
|
289
|
+
if (!range || document.getElementById(hash)) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
var id = hash.slice(0, hash.lastIndexOf("."));
|
|
294
|
+
var pre = document.getElementById(id);
|
|
295
|
+
|
|
296
|
+
if (!pre) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (!pre.hasAttribute("data-line")) {
|
|
301
|
+
pre.setAttribute("data-line", "");
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
var mutateDom = Prism.plugins.lineHighlight.highlightLines(
|
|
305
|
+
pre,
|
|
306
|
+
range,
|
|
307
|
+
"temporary "
|
|
308
|
+
);
|
|
309
|
+
mutateDom();
|
|
310
|
+
|
|
311
|
+
if (scrollIntoView) {
|
|
312
|
+
document.querySelector(".temporary.line-highlight").scrollIntoView();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
var fakeTimer = 0; // Hack to limit the number of times applyHash() runs
|
|
317
|
+
|
|
318
|
+
Prism.hooks.add("before-sanity-check", function (env) {
|
|
319
|
+
var pre = env.element.parentElement;
|
|
320
|
+
if (!isActiveFor(pre)) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/*
|
|
325
|
+
* Cleanup for other plugins (e.g. autoloader).
|
|
326
|
+
*
|
|
327
|
+
* Sometimes <code> blocks are highlighted multiple times. It is necessary
|
|
328
|
+
* to cleanup any left-over tags, because the whitespace inside of the <div>
|
|
329
|
+
* tags change the content of the <code> tag.
|
|
330
|
+
*/
|
|
331
|
+
var num = 0;
|
|
332
|
+
$$(".line-highlight", pre).forEach(function (line) {
|
|
333
|
+
num += line.textContent.length;
|
|
334
|
+
line.parentNode.removeChild(line);
|
|
335
|
+
});
|
|
336
|
+
// Remove extra whitespace
|
|
337
|
+
if (num && /^(?: \n)+$/.test(env.code.slice(-num))) {
|
|
338
|
+
env.code = env.code.slice(0, -num);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
Prism.hooks.add("complete", function completeHook(env) {
|
|
343
|
+
var pre = env.element.parentElement;
|
|
344
|
+
if (!isActiveFor(pre)) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
clearTimeout(fakeTimer);
|
|
349
|
+
|
|
350
|
+
var hasLineNumbers = Prism.plugins.lineNumbers;
|
|
351
|
+
var isLineNumbersLoaded = env.plugins && env.plugins.lineNumbers;
|
|
352
|
+
|
|
353
|
+
if (
|
|
354
|
+
hasClass(pre, LINE_NUMBERS_CLASS) &&
|
|
355
|
+
hasLineNumbers &&
|
|
356
|
+
!isLineNumbersLoaded
|
|
357
|
+
) {
|
|
358
|
+
Prism.hooks.add("line-numbers", completeHook);
|
|
359
|
+
} else {
|
|
360
|
+
var mutateDom = Prism.plugins.lineHighlight.highlightLines(pre);
|
|
361
|
+
mutateDom();
|
|
362
|
+
fakeTimer = setTimeout(applyHash, 1);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
window.addEventListener("hashchange", applyHash);
|
|
367
|
+
window.addEventListener("resize", function () {
|
|
368
|
+
var actions = $$("pre")
|
|
369
|
+
.filter(isActiveFor)
|
|
370
|
+
.map(function (pre) {
|
|
371
|
+
return Prism.plugins.lineHighlight.highlightLines(pre);
|
|
372
|
+
});
|
|
373
|
+
actions.forEach(callFunction);
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
d();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* PrismJS 1.29.0
|
|
2
|
+
https://prismjs.com/download.html#themes=prism-okaidia&languages=clike+javascript */
|
|
3
|
+
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(e){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof i?new i(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(n,t){var r,i;switch(t=t||{},a.util.type(n)){case"Object":if(i=a.util.objId(n),t[i])return t[i];for(var l in r={},t[i]=r,n)n.hasOwnProperty(l)&&(r[l]=e(n[l],t));return r;case"Array":return i=a.util.objId(n),t[i]?t[i]:(r=[],t[i]=r,n.forEach((function(n,a){r[a]=e(n,t)})),r);default:return n}},getLanguage:function(e){for(;e;){var t=n.exec(e.className);if(t)return t[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,t){e.className=e.className.replace(RegExp(n,"gi"),""),e.classList.add("language-"+t)},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var n=document.getElementsByTagName("script");for(var t in n)if(n[t].src==e)return n[t]}return null}},isActive:function(e,n,t){for(var r="no-"+n;e;){var a=e.classList;if(a.contains(n))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!t}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,n){var t=a.util.clone(a.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(e,n,t,r){var i=(r=r||a.languages)[e],l={};for(var o in i)if(i.hasOwnProperty(o)){if(o==n)for(var s in t)t.hasOwnProperty(s)&&(l[s]=t[s]);t.hasOwnProperty(o)||(l[o]=i[o])}var u=r[e];return r[e]=l,a.languages.DFS(a.languages,(function(n,t){t===u&&n!=e&&(this[n]=l)})),l},DFS:function e(n,t,r,i){i=i||{};var l=a.util.objId;for(var o in n)if(n.hasOwnProperty(o)){t.call(n,o,n[o],r||o);var s=n[o],u=a.util.type(s);"Object"!==u||i[l(s)]?"Array"!==u||i[l(s)]||(i[l(s)]=!0,e(s,t,o,i)):(i[l(s)]=!0,e(s,t,null,i))}}},plugins:{},highlightAll:function(e,n){a.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var r={callback:t,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),a.hooks.run("before-all-elements-highlight",r);for(var i,l=0;i=r.elements[l++];)a.highlightElement(i,!0===n,r.callback)},highlightElement:function(n,t,r){var i=a.util.getLanguage(n),l=a.languages[i];a.util.setLanguage(n,i);var o=n.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&a.util.setLanguage(o,i);var s={element:n,language:i,grammar:l,code:n.textContent};function u(e){s.highlightedCode=e,a.hooks.run("before-insert",s),s.element.innerHTML=s.highlightedCode,a.hooks.run("after-highlight",s),a.hooks.run("complete",s),r&&r.call(s.element)}if(a.hooks.run("before-sanity-check",s),(o=s.element.parentElement)&&"pre"===o.nodeName.toLowerCase()&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","0"),!s.code)return a.hooks.run("complete",s),void(r&&r.call(s.element));if(a.hooks.run("before-highlight",s),s.grammar)if(t&&e.Worker){var c=new Worker(a.filename);c.onmessage=function(e){u(e.data)},c.postMessage(JSON.stringify({language:s.language,code:s.code,immediateClose:!0}))}else u(a.highlight(s.code,s.grammar,s.language));else u(a.util.encode(s.code))},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};if(a.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=a.tokenize(r.code,r.grammar),a.hooks.run("after-tokenize",r),i.stringify(a.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var a=new s;return u(a,a.head,e),o(e,a,n,a.head,0),function(e){for(var n=[],t=e.head.next;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=a.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=a.hooks.all[e];if(t&&t.length)for(var r,i=0;r=t[i++];)r(n)}},Token:i};function i(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||"").length}function l(e,n,t,r){e.lastIndex=n;var a=e.exec(t);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function o(e,n,t,r,s,g){for(var f in t)if(t.hasOwnProperty(f)&&t[f]){var h=t[f];h=Array.isArray(h)?h:[h];for(var d=0;d<h.length;++d){if(g&&g.cause==f+","+d)return;var v=h[d],p=v.inside,m=!!v.lookbehind,y=!!v.greedy,k=v.alias;if(y&&!v.pattern.global){var x=v.pattern.toString().match(/[imsuy]*$/)[0];v.pattern=RegExp(v.pattern.source,x+"g")}for(var b=v.pattern||v,w=r.next,A=s;w!==n.tail&&!(g&&A>=g.reach);A+=w.value.length,w=w.next){var E=w.value;if(n.length>e.length)return;if(!(E instanceof i)){var P,L=1;if(y){if(!(P=l(b,A,e,m))||P.index>=e.length)break;var S=P.index,O=P.index+P[0].length,j=A;for(j+=w.value.length;S>=j;)j+=(w=w.next).value.length;if(A=j-=w.value.length,w.value instanceof i)continue;for(var C=w;C!==n.tail&&(j<O||"string"==typeof C.value);C=C.next)L++,j+=C.value.length;L--,E=e.slice(A,j),P.index-=A}else if(!(P=l(b,0,E,m)))continue;S=P.index;var N=P[0],_=E.slice(0,S),M=E.slice(S+N.length),W=A+E.length;g&&W>g.reach&&(g.reach=W);var z=w.prev;if(_&&(z=u(n,z,_),A+=_.length),c(n,z,L),w=u(n,z,new i(f,p?a.tokenize(N,p):N,k,N)),M&&u(n,w,M),L>1){var I={cause:f+","+d,reach:W};o(e,n,t,w.prev,A,I),g&&I.reach>g.reach&&(g.reach=I.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function u(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function c(e,n,t){for(var r=n.next,a=0;a<t&&r!==e.tail;a++)r=r.next;n.next=r,r.prev=n,e.length-=a}if(e.Prism=a,i.stringify=function e(n,t){if("string"==typeof n)return n;if(Array.isArray(n)){var r="";return n.forEach((function(n){r+=e(n,t)})),r}var i={type:n.type,content:e(n.content,t),tag:"span",classes:["token",n.type],attributes:{},language:t},l=n.alias;l&&(Array.isArray(l)?Array.prototype.push.apply(i.classes,l):i.classes.push(l)),a.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=" "+s+'="'+(i.attributes[s]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+o+">"+i.content+"</"+i.tag+">"},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener("message",(function(n){var t=JSON.parse(n.data),r=t.language,i=t.code,l=t.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),l&&e.close()}),!1),a):a;var g=a.util.currentScript();function f(){a.manual||a.highlightAll()}if(g&&(a.filename=g.src,g.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var h=document.readyState;"loading"===h||"interactive"===h&&g&&g.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return a}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
|
|
4
|
+
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};
|
|
5
|
+
Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)/(?:(?:\\[(?:[^\\]\\\\\r\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|/\\*(?:[^*]|\\*(?!/))*\\*/)*(?:$|[\r\n,.;:})\\]]|//))"),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),Prism.languages.js=Prism.languages.javascript;
|
|
6
|
+
|
|
7
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Not Found</title>
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
body {
|
|
14
|
+
background: #eee;
|
|
15
|
+
height: 100vh;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
h1 {
|
|
21
|
+
color: rgba(0, 0, 0, 0.893);
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
<h1>404 Page Not Found</h1>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
package/lib/Interface/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1E,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC;CACzE;AAED,MAAM,WAAW,UAAW,SAAQ,OAAO;IACzC,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1E,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC;CACzE;AAED,MAAM,WAAW,UAAW,SAAQ,OAAO;IACzC,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,cAAc,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,KAAK,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IACrC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC;IACxD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MA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;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,cAAc,EAAE,CAAC;IAE9B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -10,7 +10,7 @@ class RouteServiceProvider extends ServiceProvider_1.ServiceProvider {
|
|
|
10
10
|
}
|
|
11
11
|
async loadRoutes(routeConfig) {
|
|
12
12
|
for (const route of routeConfig) {
|
|
13
|
-
Route_1.Route.
|
|
13
|
+
Route_1.Route.basePath(route.prefix).group((Route) => {
|
|
14
14
|
(0, util_1.loadRoute)(route.name);
|
|
15
15
|
});
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Response/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Response/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG9D;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,QAAQ,CAAc;gBAClB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW;IAYtD;;;OAGG;IACH,SAAS,CAAC,WAAW;IAerB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,IAAI;CAIb"}
|
package/lib/Response/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpResponse = void 0;
|
|
4
|
+
const reqUrls = [];
|
|
4
5
|
/**
|
|
5
6
|
* Initializes a Response object.
|
|
6
7
|
* This class manages the response behavior, including tracking visited URLs and handling redirection.
|
|
@@ -23,7 +24,15 @@ class HttpResponse {
|
|
|
23
24
|
* Excludes "/favicon.ico" and "/js/app.js" from tracking.
|
|
24
25
|
*/
|
|
25
26
|
visitedUrls() {
|
|
26
|
-
this.request.
|
|
27
|
+
if (this.request.originalUrl !== "/favicon.ico" &&
|
|
28
|
+
this.request.originalUrl !== "/js/app.js" &&
|
|
29
|
+
!this.request.originalUrl.includes("com.chrome.devtools")) {
|
|
30
|
+
if (reqUrls.length > 1) {
|
|
31
|
+
reqUrls.pop();
|
|
32
|
+
}
|
|
33
|
+
reqUrls.unshift(this.request.originalUrl);
|
|
34
|
+
}
|
|
35
|
+
this.request.previsiousUrls = reqUrls;
|
|
27
36
|
return;
|
|
28
37
|
}
|
|
29
38
|
/**
|
|
@@ -31,7 +40,9 @@ class HttpResponse {
|
|
|
31
40
|
* If there are no previous URLs, redirects to the current URL.
|
|
32
41
|
*/
|
|
33
42
|
redirectBack() {
|
|
34
|
-
return
|
|
43
|
+
return reqUrls.length > 0 && reqUrls[1]
|
|
44
|
+
? this.response.redirect(303, reqUrls[1])
|
|
45
|
+
: this.response.redirect(303, reqUrls[0]);
|
|
35
46
|
}
|
|
36
47
|
with(message, type) {
|
|
37
48
|
this.request.flash(type, message);
|
package/lib/Routes/Route.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare class Route<T extends Record<string, RequestHandler>> {
|
|
|
64
64
|
static delete(url: string, callback: RouteHandler): void;
|
|
65
65
|
static view(url: string, view: string, data?: object): void;
|
|
66
66
|
static resource(url: string, controller: Constructor<any>, option?: ResourceOption): void;
|
|
67
|
+
static basePath(path: string): typeof Route;
|
|
67
68
|
private static bindResourceMethods;
|
|
68
69
|
}
|
|
69
70
|
//# sourceMappingURL=Route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Routes/Route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAkB,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEhF,qBAAa,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;IACzD,OAAO,CAAC,MAAM,CAAC,YAAY,CAAqC;IAEhE;;;;OAIG;WACW,UAAU,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,KAAK;IAOvD;;;;OAIG;WACW,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,KAAK;IAK/C;;;;OAIG;WACW,UAAU,CACtB,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAAE,GACzC,OAAO,KAAK;IAKf;;;;OAIG;WACW,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,IAAI,GAAG,OAAO,KAAK;
|
|
1
|
+
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Routes/Route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAkB,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEhF,qBAAa,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;IACzD,OAAO,CAAC,MAAM,CAAC,YAAY,CAAqC;IAEhE;;;;OAIG;WACW,UAAU,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,KAAK;IAOvD;;;;OAIG;WACW,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,KAAK;IAK/C;;;;OAIG;WACW,UAAU,CACtB,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAAE,GACzC,OAAO,KAAK;IAKf;;;;OAIG;WACW,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,IAAI,GAAG,OAAO,KAAK;IAM3E;;;;;OAKG;WACW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI;IAS5D;;;;;OAKG;WACW,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI;IAI7D;;;;;OAKG;WACW,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI;IAI9D;;;;;OAKG;WACW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI;IAI5D;;;;;OAKG;WACW,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI;WAIjD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;WAM7C,QAAQ,CACpB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,WAAW,CAAC,GAAG,CAAC,EAC5B,MAAM,GAAE,cAAyC;WAWrC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAMnC,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAOnC"}
|
package/lib/Routes/Route.js
CHANGED
|
@@ -38,6 +38,7 @@ class Route {
|
|
|
38
38
|
*/
|
|
39
39
|
static group(callback) {
|
|
40
40
|
callback(Route);
|
|
41
|
+
this.prefix("");
|
|
41
42
|
return this;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
@@ -98,6 +99,10 @@ class Route {
|
|
|
98
99
|
this.controller(controller);
|
|
99
100
|
this.bindResourceMethods(acceptMethods || methods);
|
|
100
101
|
}
|
|
102
|
+
static basePath(path) {
|
|
103
|
+
this.routeBuilder.setBaseRoute(path);
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
101
106
|
// Helper method to reduce redundancy
|
|
102
107
|
static bindResourceMethods(methods) {
|
|
103
108
|
for (const key in methods) {
|
|
@@ -5,6 +5,7 @@ import { Application } from "../Application/Application";
|
|
|
5
5
|
export declare class RouteBuilder {
|
|
6
6
|
private static middleware;
|
|
7
7
|
private static prefix;
|
|
8
|
+
private static baseRoute;
|
|
8
9
|
protected static serviceContainer: Application;
|
|
9
10
|
protected static controller: BaseController;
|
|
10
11
|
private static routes;
|
|
@@ -15,6 +16,7 @@ export declare class RouteBuilder {
|
|
|
15
16
|
*/
|
|
16
17
|
protected static resolvePath(path: string): string;
|
|
17
18
|
static controllerMethods(url: string): MethodsInterface;
|
|
19
|
+
static setBaseRoute(url: string): void;
|
|
18
20
|
static validateResourceOption(option: ResourceOption, methods: ObjectType): boolean | ObjectType;
|
|
19
21
|
static setPrefix(prefix: string): void;
|
|
20
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteBuilder.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Routes/RouteBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAIL,cAAc,EAEd,gBAAgB,EAChB,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACb,MAAM,SAAS,CAAC;AAMjB,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,qBAAa,YAAY;IAEvB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAwB;IACjD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAS;
|
|
1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;WACW,UAAU,CACtB,UAAU,EAAE,cAAc,EAC1B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,YAAY;WAgBV,mBAAmB,CAAC,SAAS,EAAE,WAAW;IAIxD;;;;;;;;OAQG;IACH,SAAS,CAAC,MAAM,CAAC,QAAQ,CACvB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,cAAc,GAAG,cAAc,EAAE,GAC5C,GAAG;IASN,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAC/B,QAAQ,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,GACpC,cAAc;IAejB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;WAoBf,aAAa,CAAC,GAAG,EAAE,kBAAkB;IAoBnD,WAAkB,SAAS,IAAI,UAAU,CAExC;CACF"}
|
|
@@ -13,8 +13,8 @@ class RouteBuilder {
|
|
|
13
13
|
static resolvePath(path) {
|
|
14
14
|
const prefix = RouteBuilder.prefix;
|
|
15
15
|
return prefix
|
|
16
|
-
? `${prefix}${this.replaceRouteParameters(path)}`
|
|
17
|
-
: `${this.replaceRouteParameters(path)}`;
|
|
16
|
+
? `${this.baseRoute}${this.prefix}${this.replaceRouteParameters(path)}`
|
|
17
|
+
: `${this.baseRoute}${this.replaceRouteParameters(path)}`;
|
|
18
18
|
}
|
|
19
19
|
static controllerMethods(url) {
|
|
20
20
|
const uri = url.startsWith("/") ? url : `/${url}`;
|
|
@@ -28,6 +28,9 @@ class RouteBuilder {
|
|
|
28
28
|
destroy: { uri: `${uri}/{id}`, method: "delete" },
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
+
static setBaseRoute(url) {
|
|
32
|
+
this.baseRoute = url;
|
|
33
|
+
}
|
|
31
34
|
static validateResourceOption(option, methods) {
|
|
32
35
|
if (!option.only && !option.except) {
|
|
33
36
|
return false;
|
|
@@ -103,6 +106,7 @@ class RouteBuilder {
|
|
|
103
106
|
handler = [RouteBuilder.controller, callback];
|
|
104
107
|
}
|
|
105
108
|
this.addRoute(this.resolvePath(url), httpMethod, handler, middleware);
|
|
109
|
+
// this.prefix = "";
|
|
106
110
|
}
|
|
107
111
|
catch (error) {
|
|
108
112
|
throw new AppError_1.AppError(error.message, error_1.ROUTE_BUILDER_ERROR);
|
|
@@ -158,6 +162,7 @@ class RouteBuilder {
|
|
|
158
162
|
}
|
|
159
163
|
static registerRoute(app) {
|
|
160
164
|
this.prefix = "";
|
|
165
|
+
this.baseRoute = "";
|
|
161
166
|
this.routes.forEach((route) => {
|
|
162
167
|
const middleware = route.middlewares;
|
|
163
168
|
app[route.method](route.url, ...middleware, (0, util_1.asyncHandler)((req, res, next) => {
|