@myeiter/mcy-web 0.0.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/License.txt +21 -0
- package/README.md +1 -0
- package/dist/app/app.d.ts +3 -0
- package/dist/app/app.d.ts.map +1 -0
- package/dist/app/app.js +19 -0
- package/dist/app/app.js.map +1 -0
- package/dist/app/drawing.d.ts +35 -0
- package/dist/app/drawing.d.ts.map +1 -0
- package/dist/app/drawing.js +173 -0
- package/dist/app/drawing.js.map +1 -0
- package/dist/app/input.d.ts +164 -0
- package/dist/app/input.d.ts.map +1 -0
- package/dist/app/input.js +266 -0
- package/dist/app/input.js.map +1 -0
- package/dist/backend.d.ts +48 -0
- package/dist/backend.d.ts.map +1 -0
- package/dist/backend.js +198 -0
- package/dist/backend.js.map +1 -0
- package/dist/core/containers.d.ts +3 -0
- package/dist/core/containers.d.ts.map +1 -0
- package/dist/core/containers.js +17 -0
- package/dist/core/containers.js.map +1 -0
- package/dist/core/core.d.ts +7 -0
- package/dist/core/core.d.ts.map +1 -0
- package/dist/core/core.js +23 -0
- package/dist/core/core.js.map +1 -0
- package/dist/core/error.d.ts +6 -0
- package/dist/core/error.d.ts.map +1 -0
- package/dist/core/error.js +26 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/math.d.ts +20 -0
- package/dist/core/math.d.ts.map +1 -0
- package/dist/core/math.js +48 -0
- package/dist/core/math.js.map +1 -0
- package/dist/core/serialization.d.ts +10 -0
- package/dist/core/serialization.d.ts.map +1 -0
- package/dist/core/serialization.js +86 -0
- package/dist/core/serialization.js.map +1 -0
- package/dist/core/string.d.ts +8 -0
- package/dist/core/string.d.ts.map +1 -0
- package/dist/core/string.js +47 -0
- package/dist/core/string.js.map +1 -0
- package/dist/core/time.d.ts +5 -0
- package/dist/core/time.d.ts.map +1 -0
- package/dist/core/time.js +32 -0
- package/dist/core/time.js.map +1 -0
- package/dist/misc.d.ts +2 -0
- package/dist/misc.d.ts.map +1 -0
- package/dist/misc.js +3 -0
- package/dist/misc.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InputWin = exports.InputClass = exports.KeyKeyCodeMap = exports.KeyCode = void 0;
|
|
4
|
+
var KeyCode;
|
|
5
|
+
(function (KeyCode) {
|
|
6
|
+
KeyCode["A"] = "a";
|
|
7
|
+
KeyCode["B"] = "b";
|
|
8
|
+
KeyCode["C"] = "c";
|
|
9
|
+
KeyCode["D"] = "d";
|
|
10
|
+
KeyCode["E"] = "e";
|
|
11
|
+
KeyCode["F"] = "f";
|
|
12
|
+
KeyCode["G"] = "g";
|
|
13
|
+
KeyCode["H"] = "h";
|
|
14
|
+
KeyCode["I"] = "i";
|
|
15
|
+
KeyCode["J"] = "j";
|
|
16
|
+
KeyCode["K"] = "k";
|
|
17
|
+
KeyCode["L"] = "l";
|
|
18
|
+
KeyCode["M"] = "m";
|
|
19
|
+
KeyCode["N"] = "n";
|
|
20
|
+
KeyCode["O"] = "o";
|
|
21
|
+
KeyCode["P"] = "p";
|
|
22
|
+
KeyCode["Q"] = "q";
|
|
23
|
+
KeyCode["R"] = "r";
|
|
24
|
+
KeyCode["S"] = "s";
|
|
25
|
+
KeyCode["T"] = "t";
|
|
26
|
+
KeyCode["U"] = "u";
|
|
27
|
+
KeyCode["V"] = "v";
|
|
28
|
+
KeyCode["W"] = "w";
|
|
29
|
+
KeyCode["X"] = "x";
|
|
30
|
+
KeyCode["Y"] = "y";
|
|
31
|
+
KeyCode["Z"] = "z";
|
|
32
|
+
KeyCode["Digit0"] = "0";
|
|
33
|
+
KeyCode["Digit1"] = "1";
|
|
34
|
+
KeyCode["Digit2"] = "2";
|
|
35
|
+
KeyCode["Digit3"] = "3";
|
|
36
|
+
KeyCode["Digit4"] = "4";
|
|
37
|
+
KeyCode["Digit5"] = "5";
|
|
38
|
+
KeyCode["Digit6"] = "6";
|
|
39
|
+
KeyCode["Digit7"] = "7";
|
|
40
|
+
KeyCode["Digit8"] = "8";
|
|
41
|
+
KeyCode["Digit9"] = "9";
|
|
42
|
+
KeyCode["F1"] = "F1";
|
|
43
|
+
KeyCode["F2"] = "F2";
|
|
44
|
+
KeyCode["F3"] = "F3";
|
|
45
|
+
KeyCode["F4"] = "F4";
|
|
46
|
+
KeyCode["F5"] = "F5";
|
|
47
|
+
KeyCode["F6"] = "F6";
|
|
48
|
+
KeyCode["F7"] = "F7";
|
|
49
|
+
KeyCode["F8"] = "F8";
|
|
50
|
+
KeyCode["F9"] = "F9";
|
|
51
|
+
KeyCode["F10"] = "F10";
|
|
52
|
+
KeyCode["F11"] = "F11";
|
|
53
|
+
KeyCode["F12"] = "F12";
|
|
54
|
+
KeyCode["ArrowUp"] = "ArrowUp";
|
|
55
|
+
KeyCode["ArrowDown"] = "ArrowDown";
|
|
56
|
+
KeyCode["ArrowLeft"] = "ArrowLeft";
|
|
57
|
+
KeyCode["ArrowRight"] = "ArrowRight";
|
|
58
|
+
KeyCode["ShiftLeft"] = "Shift";
|
|
59
|
+
KeyCode["ControlLeft"] = "Control";
|
|
60
|
+
KeyCode["AltLeft"] = "Alt";
|
|
61
|
+
KeyCode["MetaLeft"] = "Meta";
|
|
62
|
+
KeyCode["Space"] = " ";
|
|
63
|
+
KeyCode["Enter"] = "Enter";
|
|
64
|
+
KeyCode["Escape"] = "Escape";
|
|
65
|
+
KeyCode["Tab"] = "Tab";
|
|
66
|
+
KeyCode["Backspace"] = "Backspace";
|
|
67
|
+
KeyCode["MouseLeft"] = "MouseLeft";
|
|
68
|
+
KeyCode["MouseRight"] = "MouseRight";
|
|
69
|
+
KeyCode["MouseMiddle"] = "MouseMiddle";
|
|
70
|
+
KeyCode["Period"] = ".";
|
|
71
|
+
KeyCode["Dash"] = "-";
|
|
72
|
+
KeyCode["Underscore"] = "_";
|
|
73
|
+
KeyCode["Equals"] = "=";
|
|
74
|
+
KeyCode["Plus"] = "+";
|
|
75
|
+
})(KeyCode || (exports.KeyCode = KeyCode = {}));
|
|
76
|
+
exports.KeyKeyCodeMap = {
|
|
77
|
+
"a": 0,
|
|
78
|
+
"b": 1,
|
|
79
|
+
"c": 2,
|
|
80
|
+
"d": 3,
|
|
81
|
+
"e": 4,
|
|
82
|
+
"f": 5,
|
|
83
|
+
"g": 6,
|
|
84
|
+
"h": 7,
|
|
85
|
+
"i": 8,
|
|
86
|
+
"j": 9,
|
|
87
|
+
"k": 10,
|
|
88
|
+
"l": 11,
|
|
89
|
+
"m": 12,
|
|
90
|
+
"n": 13,
|
|
91
|
+
"o": 14,
|
|
92
|
+
"p": 15,
|
|
93
|
+
"q": 16,
|
|
94
|
+
"r": 17,
|
|
95
|
+
"s": 18,
|
|
96
|
+
"t": 19,
|
|
97
|
+
"u": 20,
|
|
98
|
+
"v": 21,
|
|
99
|
+
"w": 22,
|
|
100
|
+
"x": 23,
|
|
101
|
+
"y": 24,
|
|
102
|
+
"z": 25,
|
|
103
|
+
"0": 26,
|
|
104
|
+
"1": 27,
|
|
105
|
+
"2": 28,
|
|
106
|
+
"3": 29,
|
|
107
|
+
"4": 30,
|
|
108
|
+
"5": 31,
|
|
109
|
+
"6": 32,
|
|
110
|
+
"7": 33,
|
|
111
|
+
"8": 34,
|
|
112
|
+
"9": 35,
|
|
113
|
+
"F1": 36,
|
|
114
|
+
"F2": 37,
|
|
115
|
+
"F3": 38,
|
|
116
|
+
"F4": 39,
|
|
117
|
+
"F5": 40,
|
|
118
|
+
"F6": 41,
|
|
119
|
+
"F7": 42,
|
|
120
|
+
"F8": 43,
|
|
121
|
+
"F9": 44,
|
|
122
|
+
"F10": 45,
|
|
123
|
+
"F11": 46,
|
|
124
|
+
"F12": 47,
|
|
125
|
+
"ArrowUp": 48,
|
|
126
|
+
"ArrowDown": 49,
|
|
127
|
+
"ArrowLeft": 50,
|
|
128
|
+
"ArrowRight": 51,
|
|
129
|
+
"Shift": 52,
|
|
130
|
+
"Control": 53,
|
|
131
|
+
"Alt": 54,
|
|
132
|
+
"Meta": 55,
|
|
133
|
+
" ": 56,
|
|
134
|
+
"Enter": 57,
|
|
135
|
+
"Escape": 58,
|
|
136
|
+
"Tab": 59,
|
|
137
|
+
"Backspace": 60,
|
|
138
|
+
"MouseLeft": 61,
|
|
139
|
+
"MouseRight": 62,
|
|
140
|
+
"MouseMiddle": 63,
|
|
141
|
+
".": 64,
|
|
142
|
+
"-": 65,
|
|
143
|
+
"_": 66,
|
|
144
|
+
"=": 67,
|
|
145
|
+
"+": 68,
|
|
146
|
+
};
|
|
147
|
+
class InputClass {
|
|
148
|
+
constructor(target = window) {
|
|
149
|
+
Object.defineProperty(this, "keysDown", {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
configurable: true,
|
|
152
|
+
writable: true,
|
|
153
|
+
value: new Set()
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(this, "keysDownThisFrame", {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
configurable: true,
|
|
158
|
+
writable: true,
|
|
159
|
+
value: []
|
|
160
|
+
});
|
|
161
|
+
Object.defineProperty(this, "keysUpThisFrame", {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
configurable: true,
|
|
164
|
+
writable: true,
|
|
165
|
+
value: new Set()
|
|
166
|
+
});
|
|
167
|
+
Object.defineProperty(this, "mouseDown", {
|
|
168
|
+
enumerable: true,
|
|
169
|
+
configurable: true,
|
|
170
|
+
writable: true,
|
|
171
|
+
value: false
|
|
172
|
+
});
|
|
173
|
+
Object.defineProperty(this, "mouseDownThisFrame", {
|
|
174
|
+
enumerable: true,
|
|
175
|
+
configurable: true,
|
|
176
|
+
writable: true,
|
|
177
|
+
value: false
|
|
178
|
+
});
|
|
179
|
+
Object.defineProperty(this, "mouseUpThisFrame", {
|
|
180
|
+
enumerable: true,
|
|
181
|
+
configurable: true,
|
|
182
|
+
writable: true,
|
|
183
|
+
value: false
|
|
184
|
+
});
|
|
185
|
+
Object.defineProperty(this, "mouseX", {
|
|
186
|
+
enumerable: true,
|
|
187
|
+
configurable: true,
|
|
188
|
+
writable: true,
|
|
189
|
+
value: 0
|
|
190
|
+
});
|
|
191
|
+
Object.defineProperty(this, "mouseY", {
|
|
192
|
+
enumerable: true,
|
|
193
|
+
configurable: true,
|
|
194
|
+
writable: true,
|
|
195
|
+
value: 0
|
|
196
|
+
});
|
|
197
|
+
target.addEventListener("keydown", (e) => {
|
|
198
|
+
const keyboardEvent = e;
|
|
199
|
+
if (keyboardEvent.key === 'Tab') {
|
|
200
|
+
keyboardEvent.preventDefault(); // Stops default tabbing behavior
|
|
201
|
+
}
|
|
202
|
+
if (!keyboardEvent.repeat) {
|
|
203
|
+
const key = keyboardEvent.key;
|
|
204
|
+
this.keysDownThisFrame.push(key);
|
|
205
|
+
this.keysDown.add(key);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
target.addEventListener("keyup", (e) => {
|
|
209
|
+
const key = e.key;
|
|
210
|
+
this.keysDown.delete(key);
|
|
211
|
+
this.keysUpThisFrame.add(key);
|
|
212
|
+
});
|
|
213
|
+
target.addEventListener("mousedown", (e) => {
|
|
214
|
+
const mouseEvent = e;
|
|
215
|
+
if (mouseEvent.button === 0 && !this.mouseDown) {
|
|
216
|
+
this.mouseDown = true;
|
|
217
|
+
this.mouseDownThisFrame = true;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
target.addEventListener("mouseup", (e) => {
|
|
221
|
+
const mouseEvent = e;
|
|
222
|
+
if (mouseEvent.button === 0) {
|
|
223
|
+
this.mouseDown = false;
|
|
224
|
+
this.mouseUpThisFrame = true;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
target.addEventListener('mousemove', (e) => {
|
|
228
|
+
const mouseEvent = e;
|
|
229
|
+
this.mouseX = mouseEvent.clientX;
|
|
230
|
+
this.mouseY = mouseEvent.clientY;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
ClearThisFramePresses() {
|
|
234
|
+
this.keysDownThisFrame = [];
|
|
235
|
+
this.keysUpThisFrame.clear();
|
|
236
|
+
this.mouseDownThisFrame = false;
|
|
237
|
+
this.mouseUpThisFrame = false;
|
|
238
|
+
}
|
|
239
|
+
KeyDown(key) {
|
|
240
|
+
return this.keysDown.has(key);
|
|
241
|
+
}
|
|
242
|
+
KeyDownThisFrame(key) {
|
|
243
|
+
return this.keysDownThisFrame.includes(key);
|
|
244
|
+
}
|
|
245
|
+
KeyUpThisFrame(key) {
|
|
246
|
+
return this.keysUpThisFrame.has(key);
|
|
247
|
+
}
|
|
248
|
+
MouseDown() {
|
|
249
|
+
return this.mouseDown;
|
|
250
|
+
}
|
|
251
|
+
MouseDownThisFrame() {
|
|
252
|
+
return this.mouseDownThisFrame;
|
|
253
|
+
}
|
|
254
|
+
MouseUpThisFrame() {
|
|
255
|
+
return this.mouseUpThisFrame;
|
|
256
|
+
}
|
|
257
|
+
MousePosInCanvas(canvas) {
|
|
258
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
259
|
+
const canvasMouseX = this.mouseX - canvasRect.left;
|
|
260
|
+
const canvasMouseY = this.mouseY - canvasRect.top;
|
|
261
|
+
return { x: canvasMouseX, y: canvasMouseY };
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.InputClass = InputClass;
|
|
265
|
+
exports.InputWin = new InputClass();
|
|
266
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/app/input.ts"],"names":[],"mappings":";;;AAEA,IAAY,OAuEX;AAvED,WAAY,OAAO;IAEf,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;IACP,kBAAO,CAAA;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AC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,gBAAgB,CAAC,GAAY;QAEzB,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAED,cAAc,CAAC,GAAY;QAEvB,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAED,SAAS;QAEL,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,kBAAkB;QAEd,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,gBAAgB;QAEZ,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,gBAAgB,CAAC,MAAyB;QAEtC,MAAM,UAAU,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAElD,MAAM,YAAY,GAAW,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC;QAC3D,MAAM,YAAY,GAAW,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC;QAE1D,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC;IAChD,CAAC;CACJ;AA/GD,gCA+GC;AAEY,QAAA,QAAQ,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
export declare enum HttpStatusCodeType {
|
|
3
|
+
OK = 200,
|
|
4
|
+
CREATED = 201,
|
|
5
|
+
NO_CONTENT = 204,
|
|
6
|
+
BAD_REQUEST = 400,
|
|
7
|
+
UNAUTHORIZED = 401,
|
|
8
|
+
FORBIDDEN = 403,
|
|
9
|
+
NOT_FOUND = 404,
|
|
10
|
+
CONFLICT = 409,
|
|
11
|
+
UNPROCESSABLE_ENTITY = 422,
|
|
12
|
+
INTERNAL_SERVER_ERROR = 500,
|
|
13
|
+
SERVICE_UNAVAILABLE = 503
|
|
14
|
+
}
|
|
15
|
+
export type NetworkResponse<T> = {
|
|
16
|
+
statusCode: HttpStatusCodeType;
|
|
17
|
+
message: string;
|
|
18
|
+
data?: T;
|
|
19
|
+
};
|
|
20
|
+
export declare function IsSuccessCode(statusCode: HttpStatusCodeType): boolean;
|
|
21
|
+
export declare function MakeResponse<T>(res: express.Response, statusCode: number, message: string, data?: T): void;
|
|
22
|
+
export declare function ConnectToDB(uri: string): Promise<void>;
|
|
23
|
+
export declare class ApiError extends Error {
|
|
24
|
+
status: HttpStatusCodeType;
|
|
25
|
+
message: string;
|
|
26
|
+
constructor(status: HttpStatusCodeType, message: string);
|
|
27
|
+
}
|
|
28
|
+
export declare function BasicErrorHandler(err: any, req: express.Request, res: express.Response, next: express.NextFunction): void;
|
|
29
|
+
export type BackEndConfig = {
|
|
30
|
+
basePath: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const backEndConfig: {
|
|
33
|
+
basePath: string;
|
|
34
|
+
};
|
|
35
|
+
export type FetchOptions = {
|
|
36
|
+
bearerToken?: string;
|
|
37
|
+
credentials?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export declare function FetchPostRequest<t_req, t_res>(endpoint: string, request: t_req, options: FetchOptions): Promise<NetworkResponse<t_res>>;
|
|
40
|
+
export declare function FetchPostRequestThrow<t_req, t_res>(endpoint: string, request: t_req, options: FetchOptions): Promise<NetworkResponse<t_res>>;
|
|
41
|
+
export declare function SimpleGetRequest<t_res>(endpoint: string, options: FetchOptions): Promise<NetworkResponse<t_res>>;
|
|
42
|
+
export declare function SimpleGetRequestThrow<t_res>(endpoint: string, options: FetchOptions): Promise<NetworkResponse<t_res>>;
|
|
43
|
+
export declare const ErrorHandlerWrapper: (fn: express.RequestHandler) => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
|
44
|
+
export declare function FetchPutRequestThrow<t_req, t_res>(endpoint: string, request: t_req): Promise<NetworkResponse<t_res>>;
|
|
45
|
+
export declare function SimpleDeleteRequestThrow<t_res>(endpoint: string): Promise<NetworkResponse<t_res>>;
|
|
46
|
+
export declare function DownloadFromUrl(url: string, filename: string): void;
|
|
47
|
+
export declare function OpenFromUrlInNewWindow(url: string): void;
|
|
48
|
+
//# sourceMappingURL=backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,oBAAY,kBAAkB;IAE1B,EAAE,MAAM;IACR,OAAO,MAAM;IACb,UAAU,MAAM;IAChB,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,QAAQ,MAAM;IACd,oBAAoB,MAAM;IAC1B,qBAAqB,MAAM;IAC3B,mBAAmB,MAAM;CAC5B;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IAC7B;IACI,UAAU,EAAE,kBAAkB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,CAAC,CAAC;CACZ,CAAA;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,kBAAkB,WAU3D;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,QAKnG;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW5D;AAED,qBAAa,QAAS,SAAQ,KAAK;IAEpB,MAAM,EAAE,kBAAkB;IAC1B,OAAO,EAAE,MAAM;gBADf,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,MAAM;CAK7B;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,E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AE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAgBvG;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAS5D;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,QAGjD"}
|
package/dist/backend.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ErrorHandlerWrapper = exports.backEndConfig = exports.ApiError = exports.HttpStatusCodeType = void 0;
|
|
7
|
+
exports.IsSuccessCode = IsSuccessCode;
|
|
8
|
+
exports.MakeResponse = MakeResponse;
|
|
9
|
+
exports.ConnectToDB = ConnectToDB;
|
|
10
|
+
exports.BasicErrorHandler = BasicErrorHandler;
|
|
11
|
+
exports.FetchPostRequest = FetchPostRequest;
|
|
12
|
+
exports.FetchPostRequestThrow = FetchPostRequestThrow;
|
|
13
|
+
exports.SimpleGetRequest = SimpleGetRequest;
|
|
14
|
+
exports.SimpleGetRequestThrow = SimpleGetRequestThrow;
|
|
15
|
+
exports.FetchPutRequestThrow = FetchPutRequestThrow;
|
|
16
|
+
exports.SimpleDeleteRequestThrow = SimpleDeleteRequestThrow;
|
|
17
|
+
exports.DownloadFromUrl = DownloadFromUrl;
|
|
18
|
+
exports.OpenFromUrlInNewWindow = OpenFromUrlInNewWindow;
|
|
19
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
20
|
+
var HttpStatusCodeType;
|
|
21
|
+
(function (HttpStatusCodeType) {
|
|
22
|
+
HttpStatusCodeType[HttpStatusCodeType["OK"] = 200] = "OK";
|
|
23
|
+
HttpStatusCodeType[HttpStatusCodeType["CREATED"] = 201] = "CREATED";
|
|
24
|
+
HttpStatusCodeType[HttpStatusCodeType["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
25
|
+
HttpStatusCodeType[HttpStatusCodeType["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
26
|
+
HttpStatusCodeType[HttpStatusCodeType["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
27
|
+
HttpStatusCodeType[HttpStatusCodeType["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
28
|
+
HttpStatusCodeType[HttpStatusCodeType["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
29
|
+
HttpStatusCodeType[HttpStatusCodeType["CONFLICT"] = 409] = "CONFLICT";
|
|
30
|
+
HttpStatusCodeType[HttpStatusCodeType["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
31
|
+
HttpStatusCodeType[HttpStatusCodeType["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
32
|
+
HttpStatusCodeType[HttpStatusCodeType["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
33
|
+
})(HttpStatusCodeType || (exports.HttpStatusCodeType = HttpStatusCodeType = {}));
|
|
34
|
+
function IsSuccessCode(statusCode) {
|
|
35
|
+
switch (statusCode) {
|
|
36
|
+
case HttpStatusCodeType.OK:
|
|
37
|
+
case HttpStatusCodeType.CREATED:
|
|
38
|
+
case HttpStatusCodeType.NO_CONTENT:
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
function MakeResponse(res, statusCode, message, data) {
|
|
44
|
+
res.status(statusCode).json({
|
|
45
|
+
statusCode, message, data
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async function ConnectToDB(uri) {
|
|
49
|
+
try {
|
|
50
|
+
await mongoose_1.default.connect(uri);
|
|
51
|
+
console.log("Connected to database...");
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
console.error("Database connection error:", err);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
class ApiError extends Error {
|
|
58
|
+
constructor(status, message) {
|
|
59
|
+
super(message);
|
|
60
|
+
Object.defineProperty(this, "status", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
writable: true,
|
|
64
|
+
value: status
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(this, "message", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true,
|
|
70
|
+
value: message
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.ApiError = ApiError;
|
|
75
|
+
function BasicErrorHandler(err, req, res, next) {
|
|
76
|
+
if (err instanceof ApiError)
|
|
77
|
+
MakeResponse(res, err.status, err.message, err.stack);
|
|
78
|
+
else if (err instanceof Error)
|
|
79
|
+
MakeResponse(res, HttpStatusCodeType.INTERNAL_SERVER_ERROR, err.message, err.stack);
|
|
80
|
+
else
|
|
81
|
+
MakeResponse(res, HttpStatusCodeType.INTERNAL_SERVER_ERROR, 'unknown error', err.stack);
|
|
82
|
+
}
|
|
83
|
+
exports.backEndConfig = {
|
|
84
|
+
basePath: '',
|
|
85
|
+
};
|
|
86
|
+
async function FetchPostRequest(endpoint, request, options) {
|
|
87
|
+
const fullRoute = exports.backEndConfig.basePath + endpoint;
|
|
88
|
+
const headers = {
|
|
89
|
+
'Content-Type': 'application/json'
|
|
90
|
+
};
|
|
91
|
+
if (options.bearerToken)
|
|
92
|
+
headers['Authorization'] = 'Bearer ' + options.bearerToken;
|
|
93
|
+
const fetchSettings = {
|
|
94
|
+
method: 'POST', headers, body: JSON.stringify(request)
|
|
95
|
+
};
|
|
96
|
+
if (options.credentials)
|
|
97
|
+
fetchSettings.credentials = 'include';
|
|
98
|
+
const response = await fetch(fullRoute, fetchSettings);
|
|
99
|
+
const result = await response.json();
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
async function FetchPostRequestThrow(endpoint, request, options) {
|
|
103
|
+
const fullRoute = exports.backEndConfig.basePath + endpoint;
|
|
104
|
+
const headers = {
|
|
105
|
+
'Content-Type': 'application/json'
|
|
106
|
+
};
|
|
107
|
+
if (options.bearerToken)
|
|
108
|
+
headers['Authorization'] = 'Bearer ' + options.bearerToken;
|
|
109
|
+
const fetchSettings = {
|
|
110
|
+
method: 'POST', headers, body: JSON.stringify(request)
|
|
111
|
+
};
|
|
112
|
+
if (options.credentials)
|
|
113
|
+
fetchSettings.credentials = 'include';
|
|
114
|
+
const response = await fetch(fullRoute, fetchSettings);
|
|
115
|
+
const result = await response.json();
|
|
116
|
+
if (!IsSuccessCode(result.statusCode))
|
|
117
|
+
throw new Error(`${result.statusCode} ${result.message}`);
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
async function SimpleGetRequest(endpoint, options) {
|
|
121
|
+
const fullRoute = exports.backEndConfig.basePath + endpoint;
|
|
122
|
+
const headers = {
|
|
123
|
+
'Content-Type': 'application/json'
|
|
124
|
+
};
|
|
125
|
+
if (options.bearerToken)
|
|
126
|
+
headers['Authorization'] = 'Bearer ' + options.bearerToken;
|
|
127
|
+
const fetchSettings = {
|
|
128
|
+
method: 'GET', headers
|
|
129
|
+
};
|
|
130
|
+
if (options.credentials)
|
|
131
|
+
fetchSettings.credentials = 'include';
|
|
132
|
+
const response = await fetch(fullRoute, fetchSettings);
|
|
133
|
+
const result = await response.json();
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
async function SimpleGetRequestThrow(endpoint, options) {
|
|
137
|
+
const fullRoute = exports.backEndConfig.basePath + endpoint;
|
|
138
|
+
const headers = {
|
|
139
|
+
'Content-Type': 'application/json'
|
|
140
|
+
};
|
|
141
|
+
if (options.bearerToken)
|
|
142
|
+
headers['Authorization'] = 'Bearer ' + options.bearerToken;
|
|
143
|
+
const fetchSettings = {
|
|
144
|
+
method: 'GET', headers
|
|
145
|
+
};
|
|
146
|
+
if (options.credentials)
|
|
147
|
+
fetchSettings.credentials = 'include';
|
|
148
|
+
const response = await fetch(fullRoute, fetchSettings);
|
|
149
|
+
const result = await response.json();
|
|
150
|
+
if (!IsSuccessCode(result.statusCode))
|
|
151
|
+
throw new Error(`${result.statusCode} ${result.message}`);
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
const ErrorHandlerWrapper = (fn) => {
|
|
155
|
+
return (req, res, next) => {
|
|
156
|
+
Promise.resolve(fn(req, res, next)).catch(next);
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
exports.ErrorHandlerWrapper = ErrorHandlerWrapper;
|
|
160
|
+
async function FetchPutRequestThrow(endpoint, request) {
|
|
161
|
+
const fullRoute = exports.backEndConfig.basePath + endpoint;
|
|
162
|
+
const response = await fetch(fullRoute, {
|
|
163
|
+
method: 'PUT',
|
|
164
|
+
credentials: 'include',
|
|
165
|
+
headers: {
|
|
166
|
+
'Content-Type': 'application/json',
|
|
167
|
+
},
|
|
168
|
+
body: JSON.stringify(request),
|
|
169
|
+
});
|
|
170
|
+
const result = await response.json();
|
|
171
|
+
if (!IsSuccessCode(result.statusCode))
|
|
172
|
+
throw new Error(`${result.statusCode} ${result.message}`);
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
async function SimpleDeleteRequestThrow(endpoint) {
|
|
176
|
+
const fullRoute = exports.backEndConfig.basePath + endpoint;
|
|
177
|
+
const response = await fetch(fullRoute, {
|
|
178
|
+
method: 'DELETE',
|
|
179
|
+
credentials: 'include',
|
|
180
|
+
});
|
|
181
|
+
const result = await response.json();
|
|
182
|
+
if (!IsSuccessCode(result.statusCode))
|
|
183
|
+
throw new Error(`${result.statusCode} ${result.message}`);
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
function DownloadFromUrl(url, filename) {
|
|
187
|
+
const a = document.createElement('a');
|
|
188
|
+
a.href = url;
|
|
189
|
+
a.download = filename;
|
|
190
|
+
a.style.display = 'none';
|
|
191
|
+
document.body.appendChild(a);
|
|
192
|
+
a.click();
|
|
193
|
+
document.body.removeChild(a);
|
|
194
|
+
}
|
|
195
|
+
function OpenFromUrlInNewWindow(url) {
|
|
196
|
+
window.open(url, '_blank');
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":";;;;;;AA0BA,sCAUC;AAED,oCAKC;AAED,kCAWC;AAYD,8CAQC;AAiBD,4CAsBC;AAED,sDA0BC;AAED,4CAsBC;AAED,sDA0BC;AAQD,oDAiBC;AAED,4DAgBC;AAED,0CASC;AAED,wDAGC;AA7PD,wDAAgC;AAGhC,IAAY,kBAaX;AAbD,WAAY,kBAAkB;IAE1B,yDAAQ,CAAA;IACR,mEAAa,CAAA;IACb,yEAAgB,CAAA;IAChB,2EAAiB,CAAA;IACjB,6EAAkB,CAAA;IAClB,uEAAe,CAAA;IACf,uEAAe,CAAA;IACf,qEAAc,CAAA;IACd,6FAA0B,CAAA;IAC1B,+FAA2B,CAAA;IAC3B,2FAAyB,CAAA;AAC7B,CAAC,EAbW,kBAAkB,kCAAlB,kBAAkB,QAa7B;AASD,SAAgB,aAAa,CAAC,UAA8B;IAExD,QAAQ,UAAU,EAClB,CAAC;QACG,KAAK,kBAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,kBAAkB,CAAC,OAAO,CAAC;QAChC,KAAK,kBAAkB,CAAC,UAAU;YAC9B,OAAO,IAAI,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAgB,YAAY,CAAI,GAAqB,EAAE,UAAkB,EAAE,OAAe,EAAE,IAAQ;IAEhG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QACxB,UAAU,EAAE,OAAO,EAAE,IAAI;KAC5B,CAAC,CAAC;AACP,CAAC;AAEM,KAAK,UAAU,WA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Q;QAChB,WAAW,EAAE,SAAS;KACzB,CAAC,CAAC;IAEP,MAAM,MAAM,GAA2B,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE7D,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAE9D,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAgB,eAAe,CAAC,GAAW,EAAE,QAAgB;IAEzD,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;IACb,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACtB,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC,CAAC,KAAK,EAAE,CAAC;IACV,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAgB,sBAAsB,CAAC,GAAW;IAE9C,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containers.d.ts","sourceRoot":"","sources":["../../src/core/containers.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAO/C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,QAK7D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShuffleArray = ShuffleArray;
|
|
4
|
+
exports.PopArrayElements = PopArrayElements;
|
|
5
|
+
function ShuffleArray(array) {
|
|
6
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
7
|
+
const j = Math.floor(Math.random() * (i + 1)); // random index 0..i
|
|
8
|
+
[array[i], array[j]] = [array[j], array[i]]; // swap elements
|
|
9
|
+
}
|
|
10
|
+
return array;
|
|
11
|
+
}
|
|
12
|
+
function PopArrayElements(arr, popCount) {
|
|
13
|
+
ShuffleArray(arr);
|
|
14
|
+
for (let i = 1; i <= popCount; i++)
|
|
15
|
+
arr.pop();
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=containers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../src/core/containers.ts"],"names":[],"mappings":";;AAAA,oCAOC;AAED,4CAKC;AAdD,SAAgB,YAAY,CAAI,KAAU;IAEtC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB;QACnE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,gBAAgB;IAClE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAgB,gBAAgB,CAAI,GAAQ,EAAE,QAAgB;IAE1D,YAAY,CAAC,GAAG,CAAC,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC,EAAE;QAC9B,GAAG,CAAC,GAAG,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core/core.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./containers"), exports);
|
|
18
|
+
__exportStar(require("./error"), exports);
|
|
19
|
+
__exportStar(require("./math"), exports);
|
|
20
|
+
__exportStar(require("./serialization"), exports);
|
|
21
|
+
__exportStar(require("./string"), exports);
|
|
22
|
+
__exportStar(require("./time"), exports);
|
|
23
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,0CAAwB;AACxB,yCAAuB;AACvB,kDAAgC;AAChC,2CAAyB;AACzB,yCAAuB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function MyAssert(conditionMet: boolean, message: string): void;
|
|
2
|
+
export declare function ConvertAssertValue<T>(param: any): T;
|
|
3
|
+
export declare class ParseException extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/core/error.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAO9D;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,CAKnD;AAED,qBAAa,cAAe,SAAQ,KAAK;gBAEzB,OAAO,EAAE,MAAM;CAI9B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParseException = void 0;
|
|
4
|
+
exports.MyAssert = MyAssert;
|
|
5
|
+
exports.ConvertAssertValue = ConvertAssertValue;
|
|
6
|
+
function MyAssert(conditionMet, message) {
|
|
7
|
+
if (!conditionMet) {
|
|
8
|
+
alert("Assertion failure");
|
|
9
|
+
debugger;
|
|
10
|
+
throw new Error(message);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function ConvertAssertValue(param) {
|
|
14
|
+
const value = param;
|
|
15
|
+
if (!value)
|
|
16
|
+
throw new Error("Invalid parameter");
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
class ParseException extends Error {
|
|
20
|
+
constructor(message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "ParseException";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ParseException = ParseException;
|
|
26
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/core/error.ts"],"names":[],"mappings":";;;AAAA,4BAOC;AAED,gDAKC;AAdD,SAAgB,QAAQ,CAAC,YAAqB,EAAE,OAAe;IAE3D,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,QAAQ,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;AACL,CAAC;AAED,SAAgB,kBAAkB,CAAI,KAAU;IAE5C,MAAM,KAAK,GAAG,KAAU,CAAC;IACzB,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,MAAa,cAAe,SAAQ,KAAK;IAErC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IACjC,CAAC;CACJ;AAND,wCAMC"}
|