@oliversalzburg/js-utils 0.6.0 → 0.7.0
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/package.json +5 -5
- package/lib/async/async.d.ts +0 -44
- package/lib/async/async.js +0 -76
- package/lib/async/async.js.map +0 -1
- package/lib/async/async.test.d.ts +0 -1
- package/lib/async/async.test.js +0 -26
- package/lib/async/async.test.js.map +0 -1
- package/lib/core.d.ts +0 -43
- package/lib/core.js +0 -2
- package/lib/core.js.map +0 -1
- package/lib/data/array.d.ts +0 -45
- package/lib/data/array.js +0 -70
- package/lib/data/array.js.map +0 -1
- package/lib/data/nil.d.ts +0 -92
- package/lib/data/nil.js +0 -131
- package/lib/data/nil.js.map +0 -1
- package/lib/data/random.d.ts +0 -111
- package/lib/data/random.js +0 -377
- package/lib/data/random.js.map +0 -1
- package/lib/data/string.d.ts +0 -30
- package/lib/data/string.js +0 -52
- package/lib/data/string.js.map +0 -1
- package/lib/data/tree.d.ts +0 -28
- package/lib/data/tree.js +0 -45
- package/lib/data/tree.js.map +0 -1
- package/lib/device/shake.d.ts +0 -79
- package/lib/device/shake.js +0 -135
- package/lib/device/shake.js.map +0 -1
- package/lib/dom/core.d.ts +0 -21
- package/lib/dom/core.js +0 -41
- package/lib/dom/core.js.map +0 -1
- package/lib/errors/AbstractError.d.ts +0 -29
- package/lib/errors/AbstractError.js +0 -59
- package/lib/errors/AbstractError.js.map +0 -1
- package/lib/errors/InternalError.d.ts +0 -19
- package/lib/errors/InternalError.js +0 -38
- package/lib/errors/InternalError.js.map +0 -1
- package/lib/errors/InvalidArgumentError.d.ts +0 -13
- package/lib/errors/InvalidArgumentError.js +0 -22
- package/lib/errors/InvalidArgumentError.js.map +0 -1
- package/lib/errors/InvalidOperationError.d.ts +0 -13
- package/lib/errors/InvalidOperationError.js +0 -22
- package/lib/errors/InvalidOperationError.js.map +0 -1
- package/lib/errors/NotImplementedError.d.ts +0 -12
- package/lib/errors/NotImplementedError.js +0 -21
- package/lib/errors/NotImplementedError.js.map +0 -1
- package/lib/errors/PermissionViolationError.d.ts +0 -13
- package/lib/errors/PermissionViolationError.js +0 -22
- package/lib/errors/PermissionViolationError.js.map +0 -1
- package/lib/errors/ResourceConflictError.d.ts +0 -12
- package/lib/errors/ResourceConflictError.js +0 -21
- package/lib/errors/ResourceConflictError.js.map +0 -1
- package/lib/errors/UnknownError.d.ts +0 -16
- package/lib/errors/UnknownError.js +0 -25
- package/lib/errors/UnknownError.js.map +0 -1
- package/lib/errors/console.d.ts +0 -7
- package/lib/errors/console.js +0 -13
- package/lib/errors/console.js.map +0 -1
- package/lib/errors/error-serializer.d.ts +0 -45
- package/lib/errors/error-serializer.js +0 -71
- package/lib/errors/error-serializer.js.map +0 -1
- package/lib/errors/error-serializer.test.d.ts +0 -1
- package/lib/errors/error-serializer.test.js +0 -109
- package/lib/errors/error-serializer.test.js.map +0 -1
- package/lib/errors/stream.d.ts +0 -7
- package/lib/errors/stream.js +0 -15
- package/lib/errors/stream.js.map +0 -1
- package/lib/errors/tools.d.ts +0 -10
- package/lib/errors/tools.js +0 -13
- package/lib/errors/tools.js.map +0 -1
- package/lib/events/event.d.ts +0 -9
- package/lib/events/event.js +0 -10
- package/lib/events/event.js.map +0 -1
- package/lib/format/bytes.d.ts +0 -118
- package/lib/format/bytes.js +0 -99
- package/lib/format/bytes.js.map +0 -1
- package/lib/format/bytes.test.d.ts +0 -1
- package/lib/format/bytes.test.js +0 -138
- package/lib/format/bytes.test.js.map +0 -1
- package/lib/format/count.d.ts +0 -14
- package/lib/format/count.js +0 -50
- package/lib/format/count.js.map +0 -1
- package/lib/format/count.test.d.ts +0 -1
- package/lib/format/count.test.js +0 -42
- package/lib/format/count.test.js.map +0 -1
- package/lib/format/milliseconds.d.ts +0 -100
- package/lib/format/milliseconds.js +0 -192
- package/lib/format/milliseconds.js.map +0 -1
- package/lib/format/milliseconds.test.d.ts +0 -1
- package/lib/format/milliseconds.test.js +0 -343
- package/lib/format/milliseconds.test.js.map +0 -1
- package/lib/format/string.d.ts +0 -24
- package/lib/format/string.js +0 -30
- package/lib/format/string.js.map +0 -1
- package/lib/format/string.test.d.ts +0 -1
- package/lib/format/string.test.js +0 -17
- package/lib/format/string.test.js.map +0 -1
- package/lib/graphics/canvas-sandbox-mp.d.ts +0 -258
- package/lib/graphics/canvas-sandbox-mp.js +0 -279
- package/lib/graphics/canvas-sandbox-mp.js.map +0 -1
- package/lib/graphics/canvas-sandbox.d.ts +0 -255
- package/lib/graphics/canvas-sandbox.js +0 -361
- package/lib/graphics/canvas-sandbox.js.map +0 -1
- package/lib/graphics/canvas.d.ts +0 -57
- package/lib/graphics/canvas.js +0 -37
- package/lib/graphics/canvas.js.map +0 -1
- package/lib/graphics/canvas2d-headless.d.ts +0 -85
- package/lib/graphics/canvas2d-headless.js +0 -193
- package/lib/graphics/canvas2d-headless.js.map +0 -1
- package/lib/graphics/canvas2d.d.ts +0 -162
- package/lib/graphics/canvas2d.js +0 -328
- package/lib/graphics/canvas2d.js.map +0 -1
- package/lib/graphics/canvas3d.d.ts +0 -41
- package/lib/graphics/canvas3d.js +0 -67
- package/lib/graphics/canvas3d.js.map +0 -1
- package/lib/graphics/color.d.ts +0 -22
- package/lib/graphics/color.js +0 -42
- package/lib/graphics/color.js.map +0 -1
- package/lib/graphics/core.d.ts +0 -89
- package/lib/graphics/core.js +0 -146
- package/lib/graphics/core.js.map +0 -1
- package/lib/graphics/palette-sampler.d.ts +0 -7
- package/lib/graphics/palette-sampler.js +0 -21
- package/lib/graphics/palette-sampler.js.map +0 -1
- package/lib/graphics/palette.d.ts +0 -120
- package/lib/graphics/palette.js +0 -494
- package/lib/graphics/palette.js.map +0 -1
- package/lib/graphics/palette.test.d.ts +0 -1
- package/lib/graphics/palette.test.js +0 -43
- package/lib/graphics/palette.test.js.map +0 -1
- package/lib/graphics/render-loop.d.ts +0 -80
- package/lib/graphics/render-loop.js +0 -120
- package/lib/graphics/render-loop.js.map +0 -1
- package/lib/graphics/shader.d.ts +0 -56
- package/lib/graphics/shader.js +0 -80
- package/lib/graphics/shader.js.map +0 -1
- package/lib/log/log.d.ts +0 -11
- package/lib/log/log.js +0 -2
- package/lib/log/log.js.map +0 -1
- package/lib/log/report.d.ts +0 -57
- package/lib/log/report.js +0 -88
- package/lib/log/report.js.map +0 -1
- package/lib/math/core.d.ts +0 -85
- package/lib/math/core.js +0 -125
- package/lib/math/core.js.map +0 -1
- package/lib/math/easing.d.ts +0 -204
- package/lib/math/easing.js +0 -332
- package/lib/math/easing.js.map +0 -1
- package/lib/math/euler.d.ts +0 -18
- package/lib/math/euler.js +0 -22
- package/lib/math/euler.js.map +0 -1
- package/lib/math/matrix3.d.ts +0 -217
- package/lib/math/matrix3.js +0 -508
- package/lib/math/matrix3.js.map +0 -1
- package/lib/math/quaternion.d.ts +0 -119
- package/lib/math/quaternion.js +0 -270
- package/lib/math/quaternion.js.map +0 -1
- package/lib/math/transformation.d.ts +0 -26
- package/lib/math/transformation.js +0 -31
- package/lib/math/transformation.js.map +0 -1
- package/lib/math/vector2.d.ts +0 -202
- package/lib/math/vector2.js +0 -310
- package/lib/math/vector2.js.map +0 -1
- package/lib/math/vector3.d.ts +0 -293
- package/lib/math/vector3.js +0 -492
- package/lib/math/vector3.js.map +0 -1
- package/lib/math/vector4.d.ts +0 -182
- package/lib/math/vector4.js +0 -302
- package/lib/math/vector4.js.map +0 -1
- package/lib/measurement/performance.d.ts +0 -13
- package/lib/measurement/performance.js +0 -19
- package/lib/measurement/performance.js.map +0 -1
package/lib/device/shake.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The type of the details of a shake event.
|
|
3
|
-
*/
|
|
4
|
-
export type ShakeEventData = DeviceMotionEvent;
|
|
5
|
-
/**
|
|
6
|
-
* The type of the `"shake"` event.
|
|
7
|
-
*/
|
|
8
|
-
export type ShakeEvent = CustomEvent<ShakeEventData> & {
|
|
9
|
-
type: "shake";
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* The type of a handler for the `"shake"` event.
|
|
13
|
-
*/
|
|
14
|
-
export type ShakeEventListener = (event: ShakeEvent) => void;
|
|
15
|
-
/**
|
|
16
|
-
* The options for constructing a {@linkcode Shake} handler.
|
|
17
|
-
*/
|
|
18
|
-
export interface ShakeOptions {
|
|
19
|
-
/**
|
|
20
|
-
* Minimum acceleration needed to dispatch an event:
|
|
21
|
-
* meters per second squared (m/s²).
|
|
22
|
-
*
|
|
23
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/acceleration
|
|
24
|
-
*/
|
|
25
|
-
threshold: number;
|
|
26
|
-
/**
|
|
27
|
-
* After a shake event is dispatched, subsequent events will not be dispatched
|
|
28
|
-
* until after a duration greater than or equal to this value (milliseconds).
|
|
29
|
-
*/
|
|
30
|
-
timeout: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* A device motion handler that dispatches a `"shake"` event as appropriate.
|
|
34
|
-
*
|
|
35
|
-
* Original author: Jesse Jackson - https://github.com/jsejcksn
|
|
36
|
-
* This part of the code is licensed under CC BY-SA 4.0
|
|
37
|
-
*/
|
|
38
|
-
export declare class Shake extends EventTarget {
|
|
39
|
-
#private;
|
|
40
|
-
/**
|
|
41
|
-
* Construct a new device shake handler.
|
|
42
|
-
* @param options - The options for the handler.
|
|
43
|
-
*/
|
|
44
|
-
constructor(options?: Partial<ShakeOptions>);
|
|
45
|
-
/**
|
|
46
|
-
* Add a new shake event listener.
|
|
47
|
-
* @param type - The type of the event to handle.
|
|
48
|
-
* @param listener - The event handler to call.
|
|
49
|
-
* @param options - The options for this handler.
|
|
50
|
-
*/
|
|
51
|
-
addEventListener(type: "shake", listener: ShakeEventListener | null, options?: boolean | AddEventListenerOptions): void;
|
|
52
|
-
/**
|
|
53
|
-
* Dispatch a shake event.
|
|
54
|
-
* @param event - The event to dispatch.
|
|
55
|
-
* @returns true if the event was cancelled, false otherwise.
|
|
56
|
-
*/
|
|
57
|
-
dispatchEvent(event: ShakeEvent): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Removes a previously added event listener.
|
|
60
|
-
* @param type - The type of the event to remove.
|
|
61
|
-
* @param callback - The event handler to remove.
|
|
62
|
-
* @param options - The options the event handler was added with.
|
|
63
|
-
*/
|
|
64
|
-
removeEventListener(type: "shake", callback: ShakeEventListener | null, options?: EventListenerOptions | boolean): void;
|
|
65
|
-
/**
|
|
66
|
-
* Requests approval to handle device motion events.
|
|
67
|
-
* @returns true if we got approval, false otherwise.
|
|
68
|
-
*/
|
|
69
|
-
approve(): Promise<boolean>;
|
|
70
|
-
/**
|
|
71
|
-
* Start handling device shake.
|
|
72
|
-
* @returns true if we were able to register our handler, false otherwise.
|
|
73
|
-
*/
|
|
74
|
-
start(): Promise<boolean>;
|
|
75
|
-
/**
|
|
76
|
-
* Stop handling device shake.
|
|
77
|
-
*/
|
|
78
|
-
stop(): void;
|
|
79
|
-
}
|
package/lib/device/shake.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { createEvent } from "../events/event.js";
|
|
2
|
-
const getMaxAcceleration = (event) => {
|
|
3
|
-
let max = 0;
|
|
4
|
-
if (event.acceleration) {
|
|
5
|
-
for (const key of ["x", "y", "z"]) {
|
|
6
|
-
const value = Math.abs(event.acceleration[key] ?? 0);
|
|
7
|
-
if (value > max)
|
|
8
|
-
max = value;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return max;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* A device motion handler that dispatches a `"shake"` event as appropriate.
|
|
15
|
-
*
|
|
16
|
-
* Original author: Jesse Jackson - https://github.com/jsejcksn
|
|
17
|
-
* This part of the code is licensed under CC BY-SA 4.0
|
|
18
|
-
*/
|
|
19
|
-
export class Shake extends EventTarget {
|
|
20
|
-
/**
|
|
21
|
-
* Have we been granted permissions to use device motion events?
|
|
22
|
-
*/
|
|
23
|
-
#approved;
|
|
24
|
-
/**
|
|
25
|
-
* How strong does the motion have to be to trigger the event?
|
|
26
|
-
*/
|
|
27
|
-
#threshold;
|
|
28
|
-
/**
|
|
29
|
-
* After the event has been triggered, don't trigger another event for
|
|
30
|
-
* how many milliseconds?
|
|
31
|
-
*/
|
|
32
|
-
#timeout;
|
|
33
|
-
/**
|
|
34
|
-
* The last time we triggered an event.
|
|
35
|
-
*/
|
|
36
|
-
#timeStamp;
|
|
37
|
-
/**
|
|
38
|
-
* Construct a new device shake handler.
|
|
39
|
-
* @param options - The options for the handler.
|
|
40
|
-
*/
|
|
41
|
-
constructor(options) {
|
|
42
|
-
super();
|
|
43
|
-
const { threshold = 15, timeout = 1000 } = options ?? {};
|
|
44
|
-
this.#threshold = threshold;
|
|
45
|
-
this.#timeout = timeout;
|
|
46
|
-
this.#timeStamp = timeout * -1;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Add a new shake event listener.
|
|
50
|
-
* @param type - The type of the event to handle.
|
|
51
|
-
* @param listener - The event handler to call.
|
|
52
|
-
* @param options - The options for this handler.
|
|
53
|
-
*/
|
|
54
|
-
// @ts-expect-error Extending EventTarget is hard
|
|
55
|
-
addEventListener(type, listener, options) {
|
|
56
|
-
super.addEventListener(type, listener, options);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Dispatch a shake event.
|
|
60
|
-
* @param event - The event to dispatch.
|
|
61
|
-
* @returns true if the event was cancelled, false otherwise.
|
|
62
|
-
*/
|
|
63
|
-
dispatchEvent(event) {
|
|
64
|
-
return super.dispatchEvent(event);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Removes a previously added event listener.
|
|
68
|
-
* @param type - The type of the event to remove.
|
|
69
|
-
* @param callback - The event handler to remove.
|
|
70
|
-
* @param options - The options the event handler was added with.
|
|
71
|
-
*/
|
|
72
|
-
// @ts-expect-error Extending EventTarget is hard
|
|
73
|
-
removeEventListener(type, callback, options) {
|
|
74
|
-
super.removeEventListener(type, callback, options);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Requests approval to handle device motion events.
|
|
78
|
-
* @returns true if we got approval, false otherwise.
|
|
79
|
-
*/
|
|
80
|
-
async approve() {
|
|
81
|
-
if (typeof this.#approved === "undefined") {
|
|
82
|
-
if (!("DeviceMotionEvent" in window)) {
|
|
83
|
-
this.#approved = false;
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
if (typeof DeviceMotionEvent.requestPermission === "function") {
|
|
88
|
-
const permissionState = await DeviceMotionEvent.requestPermission();
|
|
89
|
-
this.#approved = permissionState === "granted";
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
this.#approved = true;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
this.#approved = false;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return this.#approved;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Handles a device motion event.
|
|
103
|
-
* @param event - The device motion event.
|
|
104
|
-
*/
|
|
105
|
-
#handleDeviceMotion = (event) => {
|
|
106
|
-
const diff = event.timeStamp - this.#timeStamp;
|
|
107
|
-
if (diff < this.#timeout) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const accel = getMaxAcceleration(event);
|
|
111
|
-
if (accel < this.#threshold) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
this.#timeStamp = event.timeStamp;
|
|
115
|
-
this.dispatchEvent(createEvent("shake", event));
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Start handling device shake.
|
|
119
|
-
* @returns true if we were able to register our handler, false otherwise.
|
|
120
|
-
*/
|
|
121
|
-
async start() {
|
|
122
|
-
const approved = await this.approve();
|
|
123
|
-
if (!approved)
|
|
124
|
-
return false;
|
|
125
|
-
window.addEventListener("devicemotion", this.#handleDeviceMotion);
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Stop handling device shake.
|
|
130
|
-
*/
|
|
131
|
-
stop() {
|
|
132
|
-
window.removeEventListener("devicemotion", this.#handleDeviceMotion);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=shake.js.map
|
package/lib/device/shake.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shake.js","sourceRoot":"","sources":["../../source/device/shake.ts"],"names":[],"mappings":"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"}
|
package/lib/dom/core.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ConstructorOf } from "../core.js";
|
|
2
|
-
/**
|
|
3
|
-
* Retrieves an element from the document and returns it if it is
|
|
4
|
-
* non-null and has the expected type. Otherwise an error is thrown.
|
|
5
|
-
* @param document - The document from which to look up the element.
|
|
6
|
-
* @param id - The ID of the element.
|
|
7
|
-
* @param Type - The type you expect the element to have.
|
|
8
|
-
* @returns The requested element, if it has the expected type.
|
|
9
|
-
* @throws {@linkcode InvalidOperationError} When the document element has an unexpected type.
|
|
10
|
-
* @throws {@linkcode UnexpectedNilError} When the the document element is `null`.
|
|
11
|
-
*/
|
|
12
|
-
export declare const getDocumentElementTypeByIdStrict: <T extends HTMLElement>(document: Document, id: string, Type: ConstructorOf<T>) => T;
|
|
13
|
-
/**
|
|
14
|
-
* Retrieves an element from the document and returns it if it has the
|
|
15
|
-
* expected type.
|
|
16
|
-
* @param document - The document from which to look up the element.
|
|
17
|
-
* @param id - The ID of the element.
|
|
18
|
-
* @param Type - The type you expect the element to have.
|
|
19
|
-
* @returns The requested element, if it has the expected type; `null` otherwise.
|
|
20
|
-
*/
|
|
21
|
-
export declare const getDocumentElementTypeById: <T extends HTMLElement>(document: Document, id: string, Type: ConstructorOf<T>) => T | null;
|
package/lib/dom/core.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { UnexpectedNilError } from "../data/nil.js";
|
|
2
|
-
import { InvalidOperationError } from "../errors/InvalidOperationError.js";
|
|
3
|
-
/**
|
|
4
|
-
* Retrieves an element from the document and returns it if it is
|
|
5
|
-
* non-null and has the expected type. Otherwise an error is thrown.
|
|
6
|
-
* @param document - The document from which to look up the element.
|
|
7
|
-
* @param id - The ID of the element.
|
|
8
|
-
* @param Type - The type you expect the element to have.
|
|
9
|
-
* @returns The requested element, if it has the expected type.
|
|
10
|
-
* @throws {@linkcode InvalidOperationError} When the document element has an unexpected type.
|
|
11
|
-
* @throws {@linkcode UnexpectedNilError} When the the document element is `null`.
|
|
12
|
-
*/
|
|
13
|
-
export const getDocumentElementTypeByIdStrict = (document, id, Type) => {
|
|
14
|
-
const element = document.getElementById(id);
|
|
15
|
-
if (element === null) {
|
|
16
|
-
throw new UnexpectedNilError(`The document element '${id}' does not exist.`);
|
|
17
|
-
}
|
|
18
|
-
if (!(element instanceof Type)) {
|
|
19
|
-
throw new InvalidOperationError(`The document element '${id}' has an unexpected type.`);
|
|
20
|
-
}
|
|
21
|
-
return element;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Retrieves an element from the document and returns it if it has the
|
|
25
|
-
* expected type.
|
|
26
|
-
* @param document - The document from which to look up the element.
|
|
27
|
-
* @param id - The ID of the element.
|
|
28
|
-
* @param Type - The type you expect the element to have.
|
|
29
|
-
* @returns The requested element, if it has the expected type; `null` otherwise.
|
|
30
|
-
*/
|
|
31
|
-
export const getDocumentElementTypeById = (document, id, Type) => {
|
|
32
|
-
const element = document.getElementById(id);
|
|
33
|
-
if (element === null) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
if (!(element instanceof Type)) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
return element;
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=core.js.map
|
package/lib/dom/core.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../source/dom/core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,QAAkB,EAClB,EAAU,EACV,IAAsB,EACnB,EAAE;IACL,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAE5C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,kBAAkB,CAAC,yBAAyB,EAAE,mBAAmB,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,CAAC,CAAC,OAAO,YAAY,IAAI,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,qBAAqB,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,CAAC;IAC1F,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,QAAkB,EAClB,EAAU,EACV,IAAsB,EACZ,EAAE;IACZ,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAE5C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,CAAC,OAAO,YAAY,IAAI,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base class for all errors.
|
|
3
|
-
*/
|
|
4
|
-
export declare class AbstractError extends Error {
|
|
5
|
-
/**
|
|
6
|
-
* The HTTP status code to associate with this error.
|
|
7
|
-
*/
|
|
8
|
-
status: number;
|
|
9
|
-
/**
|
|
10
|
-
* An application-unique, readable error code.
|
|
11
|
-
*/
|
|
12
|
-
code: string;
|
|
13
|
-
/**
|
|
14
|
-
* Constructs a new {@linkcode AbstractError}.
|
|
15
|
-
* @param code - The main identification code for the error.
|
|
16
|
-
* @param message - The main error message.
|
|
17
|
-
* @param status - The HTTP status code to return.
|
|
18
|
-
*/
|
|
19
|
-
constructor(code: string, message: string, status: number);
|
|
20
|
-
/**
|
|
21
|
-
* Checks if an object is an instance of {@linkcode AbstractError}, or one of its subclasses.
|
|
22
|
-
* @param error - The object to check.
|
|
23
|
-
* @param allowForeignModule - Only check for similar looking error codes.
|
|
24
|
-
* You're going to want to use this if you're dealing with a setup where
|
|
25
|
-
* multiple versions of js-utils are loaded.
|
|
26
|
-
* @returns `true` if the object is an {@linkcode AbstractError}, `false` otherwise.
|
|
27
|
-
*/
|
|
28
|
-
static isAbstractError(error: unknown, allowForeignModule?: boolean): error is AbstractError;
|
|
29
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base class for all errors.
|
|
3
|
-
*/
|
|
4
|
-
export class AbstractError extends Error {
|
|
5
|
-
/**
|
|
6
|
-
* The HTTP status code to associate with this error.
|
|
7
|
-
*/
|
|
8
|
-
status;
|
|
9
|
-
/**
|
|
10
|
-
* An application-unique, readable error code.
|
|
11
|
-
*/
|
|
12
|
-
code;
|
|
13
|
-
/**
|
|
14
|
-
* Constructs a new {@linkcode AbstractError}.
|
|
15
|
-
* @param code - The main identification code for the error.
|
|
16
|
-
* @param message - The main error message.
|
|
17
|
-
* @param status - The HTTP status code to return.
|
|
18
|
-
*/
|
|
19
|
-
constructor(code, message, status) {
|
|
20
|
-
super(message);
|
|
21
|
-
this.code = code;
|
|
22
|
-
this.name = "AbstractError";
|
|
23
|
-
this.status = status;
|
|
24
|
-
if (typeof Error.captureStackTrace !== "undefined") {
|
|
25
|
-
// Capture a new stacktrace, otherwise it will include our base-class constructor instead of the code
|
|
26
|
-
// location we're actually interested in.
|
|
27
|
-
Error.captureStackTrace(this, AbstractError);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Checks if an object is an instance of {@linkcode AbstractError}, or one of its subclasses.
|
|
32
|
-
* @param error - The object to check.
|
|
33
|
-
* @param allowForeignModule - Only check for similar looking error codes.
|
|
34
|
-
* You're going to want to use this if you're dealing with a setup where
|
|
35
|
-
* multiple versions of js-utils are loaded.
|
|
36
|
-
* @returns `true` if the object is an {@linkcode AbstractError}, `false` otherwise.
|
|
37
|
-
*/
|
|
38
|
-
static isAbstractError(error, allowForeignModule = true) {
|
|
39
|
-
if (error instanceof AbstractError) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
// When multiple versions of js-utils are loaded at runtime, the
|
|
43
|
-
// prototypes of errors don't align. In that case, we just analyze the
|
|
44
|
-
// error code.
|
|
45
|
-
if (allowForeignModule) {
|
|
46
|
-
const errorRecord = error;
|
|
47
|
-
if (Object(error) === error &&
|
|
48
|
-
"code" in errorRecord &&
|
|
49
|
-
typeof errorRecord.code === "string") {
|
|
50
|
-
const codedError = error;
|
|
51
|
-
if (codedError.code.match(/^ERR_OS_/)) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=AbstractError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractError.js","sourceRoot":"","sources":["../../source/errors/AbstractError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC;;OAEG;IACH,MAAM,CAAS;IAEf;;OAEG;IACH,IAAI,CAAS;IAEb;;;;;OAKG;IACH,YAAY,IAAY,EAAE,OAAe,EAAE,MAAc;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,WAAW,EAAE,CAAC;YACnD,qGAAqG;YACrG,yCAAyC;YACzC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,CAAC,KAAc,EAAE,kBAAkB,GAAG,IAAI;QAC9D,IAAI,KAAK,YAAY,aAAa,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,gEAAgE;QAChE,sEAAsE;QACtE,cAAc;QACd,IAAI,kBAAkB,EAAE,CAAC;YACvB,MAAM,WAAW,GAAG,KAAgC,CAAC;YACrD,IACE,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK;gBACvB,MAAM,IAAI,WAAW;gBACrB,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ,EACpC,CAAC;gBACD,MAAM,UAAU,GAAG,KAAyB,CAAC;gBAC7C,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;oBACtC,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when an {@linkcode !Error}-like object was caught and converted into an
|
|
4
|
-
* implementation of {@linkcode AbstractError} for further processing.
|
|
5
|
-
*/
|
|
6
|
-
export declare class InternalError extends AbstractError {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new {@linkcode InternalError}.
|
|
9
|
-
* @param message - The main error message.
|
|
10
|
-
* @param status - The HTTP status code to return.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message: string, status?: number);
|
|
13
|
-
/**
|
|
14
|
-
* Converts an error into an {@linkcode InternalError}.
|
|
15
|
-
* @param error - The error to convert.
|
|
16
|
-
* @returns An {@linkcode InternalError} that represents the given error.
|
|
17
|
-
*/
|
|
18
|
-
static fromError(error: Error): InternalError;
|
|
19
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when an {@linkcode !Error}-like object was caught and converted into an
|
|
4
|
-
* implementation of {@linkcode AbstractError} for further processing.
|
|
5
|
-
*/
|
|
6
|
-
export class InternalError extends AbstractError {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new {@linkcode InternalError}.
|
|
9
|
-
* @param message - The main error message.
|
|
10
|
-
* @param status - The HTTP status code to return.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message, status = 500) {
|
|
13
|
-
super("ERR_OS_INTERNAL", message, status);
|
|
14
|
-
this.name = "InternalError";
|
|
15
|
-
if (typeof Error.captureStackTrace !== "undefined") {
|
|
16
|
-
// Capture a new stacktrace, otherwise it will include our base-class
|
|
17
|
-
// constructor instead of the code location we're actually interested in.
|
|
18
|
-
Error.captureStackTrace(this, InternalError);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Converts an error into an {@linkcode InternalError}.
|
|
23
|
-
* @param error - The error to convert.
|
|
24
|
-
* @returns An {@linkcode InternalError} that represents the given error.
|
|
25
|
-
*/
|
|
26
|
-
static fromError(error) {
|
|
27
|
-
// Create a _real_ `InternalError` instance, which we will return later.
|
|
28
|
-
const internalError = new InternalError(error.message);
|
|
29
|
-
// Assign the error to it, to inherit all the fields in the error.
|
|
30
|
-
// Then assign another `InternalError` to replace key fields, like:
|
|
31
|
-
// name, code, status, ...
|
|
32
|
-
Object.assign(internalError, error, new InternalError(error.message));
|
|
33
|
-
// Inherit the original error stack again.
|
|
34
|
-
internalError.stack = error.stack;
|
|
35
|
-
return internalError;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=InternalError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InternalError.js","sourceRoot":"","sources":["../../source/errors/InternalError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9C;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,iBAAiB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAE1C,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAE5B,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,WAAW,EAAE,CAAC;YACnD,qEAAqE;YACrE,yEAAyE;YACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,KAAY;QAC3B,wEAAwE;QACxE,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvD,kEAAkE;QAClE,mEAAmE;QACnE,0BAA0B;QAC1B,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACtE,0CAA0C;QAC1C,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when the user supplied an argument that is not valid in the current
|
|
4
|
-
* context.
|
|
5
|
-
*/
|
|
6
|
-
export declare class InvalidArgumentError extends AbstractError {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new {@linkcode InvalidArgumentError}.
|
|
9
|
-
* @param message - The main error message.
|
|
10
|
-
* @param status - The HTTP status code to return.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message: string, status?: number);
|
|
13
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when the user supplied an argument that is not valid in the current
|
|
4
|
-
* context.
|
|
5
|
-
*/
|
|
6
|
-
export class InvalidArgumentError extends AbstractError {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new {@linkcode InvalidArgumentError}.
|
|
9
|
-
* @param message - The main error message.
|
|
10
|
-
* @param status - The HTTP status code to return.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message, status = 400) {
|
|
13
|
-
super("ERR_OS_INVALID_ARGUMENT", message, status);
|
|
14
|
-
this.name = "InvalidArgumentError";
|
|
15
|
-
if (typeof Error.captureStackTrace !== "undefined") {
|
|
16
|
-
// Capture a new stacktrace, otherwise it will include our base-class
|
|
17
|
-
// constructor instead of the code location we're actually interested in.
|
|
18
|
-
Error.captureStackTrace(this, InvalidArgumentError);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=InvalidArgumentError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InvalidArgumentError.js","sourceRoot":"","sources":["../../source/errors/InvalidArgumentError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IACrD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,yBAAyB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAElD,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QAEnC,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,WAAW,EAAE,CAAC;YACnD,qEAAqE;YACrE,yEAAyE;YACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when an operation was attempted that can not be completed in the current
|
|
4
|
-
* context.
|
|
5
|
-
*/
|
|
6
|
-
export declare class InvalidOperationError extends AbstractError {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new {@linkcode InvalidOperationError}.
|
|
9
|
-
* @param message - The main error message.
|
|
10
|
-
* @param status - The HTTP status code to return.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message: string, status?: number);
|
|
13
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when an operation was attempted that can not be completed in the current
|
|
4
|
-
* context.
|
|
5
|
-
*/
|
|
6
|
-
export class InvalidOperationError extends AbstractError {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new {@linkcode InvalidOperationError}.
|
|
9
|
-
* @param message - The main error message.
|
|
10
|
-
* @param status - The HTTP status code to return.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message, status = 400) {
|
|
13
|
-
super("ERR_OS_INVALID_OPERATION", message, status);
|
|
14
|
-
this.name = "InvalidOperationError";
|
|
15
|
-
if (typeof Error.captureStackTrace !== "undefined") {
|
|
16
|
-
// Capture a new stacktrace, otherwise it will include our base-class
|
|
17
|
-
// constructor instead of the code location we're actually interested in.
|
|
18
|
-
Error.captureStackTrace(this, InvalidOperationError);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=InvalidOperationError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InvalidOperationError.js","sourceRoot":"","sources":["../../source/errors/InvalidOperationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IACtD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,0BAA0B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEnD,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QAEpC,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,WAAW,EAAE,CAAC;YACnD,qEAAqE;YACrE,yEAAyE;YACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when a called method actually hasn't been implemented yet (whoops).
|
|
4
|
-
*/
|
|
5
|
-
export declare class NotImplementedError extends AbstractError {
|
|
6
|
-
/**
|
|
7
|
-
* Constructs a new {@linkcode NotImplementedError}.
|
|
8
|
-
* @param message - The main error message.
|
|
9
|
-
* @param status - The HTTP status code to return.
|
|
10
|
-
*/
|
|
11
|
-
constructor(message?: string, status?: number);
|
|
12
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when a called method actually hasn't been implemented yet (whoops).
|
|
4
|
-
*/
|
|
5
|
-
export class NotImplementedError extends AbstractError {
|
|
6
|
-
/**
|
|
7
|
-
* Constructs a new {@linkcode NotImplementedError}.
|
|
8
|
-
* @param message - The main error message.
|
|
9
|
-
* @param status - The HTTP status code to return.
|
|
10
|
-
*/
|
|
11
|
-
constructor(message = "Not implemented.", status = 501) {
|
|
12
|
-
super("ERR_OS_NOT_IMPLEMENTED", message, status);
|
|
13
|
-
this.name = "NotImplementedError";
|
|
14
|
-
if (typeof Error.captureStackTrace !== "undefined") {
|
|
15
|
-
// Capture a new stacktrace, otherwise it will include our base-class
|
|
16
|
-
// constructor instead of the code location we're actually interested in.
|
|
17
|
-
Error.captureStackTrace(this, NotImplementedError);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=NotImplementedError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotImplementedError.js","sourceRoot":"","sources":["../../source/errors/NotImplementedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IACpD;;;;OAIG;IACH,YAAY,OAAO,GAAG,kBAAkB,EAAE,MAAM,GAAG,GAAG;QACpD,KAAK,CAAC,wBAAwB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEjD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAElC,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,WAAW,EAAE,CAAC;YACnD,qEAAqE;YACrE,yEAAyE;YACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* An error used when access to a resource was requested, but the required
|
|
4
|
-
* permissions were not available.
|
|
5
|
-
*/
|
|
6
|
-
export declare class PermissionViolationError extends AbstractError {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new {@linkcode PermissionViolationError}.
|
|
9
|
-
* @param message - The main error message.
|
|
10
|
-
* @param status - The HTTP status code to return.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message: string, status?: number);
|
|
13
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* An error used when access to a resource was requested, but the required
|
|
4
|
-
* permissions were not available.
|
|
5
|
-
*/
|
|
6
|
-
export class PermissionViolationError extends AbstractError {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new {@linkcode PermissionViolationError}.
|
|
9
|
-
* @param message - The main error message.
|
|
10
|
-
* @param status - The HTTP status code to return.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message, status = 403) {
|
|
13
|
-
super("ERR_OS_PERMISSION_VIOLATION", message, status);
|
|
14
|
-
this.name = "PermissionViolationError";
|
|
15
|
-
if (typeof Error.captureStackTrace !== "undefined") {
|
|
16
|
-
// Capture a new stacktrace, otherwise it will include our base-class
|
|
17
|
-
// constructor instead of the code location we're actually interested in.
|
|
18
|
-
Error.captureStackTrace(this, PermissionViolationError);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=PermissionViolationError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionViolationError.js","sourceRoot":"","sources":["../../source/errors/PermissionViolationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IACzD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,6BAA6B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEtD,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QAEvC,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,WAAW,EAAE,CAAC;YACnD,qEAAqE;YACrE,yEAAyE;YACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when a resource conflict was detected.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ResourceConflictError extends AbstractError {
|
|
6
|
-
/**
|
|
7
|
-
* Constructs a new {@linkcode ResourceConflictError}.
|
|
8
|
-
* @param message - The main error message.
|
|
9
|
-
* @param status - The HTTP status code to return.
|
|
10
|
-
*/
|
|
11
|
-
constructor(message: string, status?: number);
|
|
12
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AbstractError } from "./AbstractError.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used when a resource conflict was detected.
|
|
4
|
-
*/
|
|
5
|
-
export class ResourceConflictError extends AbstractError {
|
|
6
|
-
/**
|
|
7
|
-
* Constructs a new {@linkcode ResourceConflictError}.
|
|
8
|
-
* @param message - The main error message.
|
|
9
|
-
* @param status - The HTTP status code to return.
|
|
10
|
-
*/
|
|
11
|
-
constructor(message, status = 409) {
|
|
12
|
-
super("ERR_OS_RESOURCE_CONFLICT", message, status);
|
|
13
|
-
this.name = "ResourceConflictError";
|
|
14
|
-
if (typeof Error.captureStackTrace !== "undefined") {
|
|
15
|
-
// Capture a new stacktrace, otherwise it will include our base-class
|
|
16
|
-
// constructor instead of the code location we're actually interested in.
|
|
17
|
-
Error.captureStackTrace(this, ResourceConflictError);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=ResourceConflictError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceConflictError.js","sourceRoot":"","sources":["../../source/errors/ResourceConflictError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IACtD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,0BAA0B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEnD,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QAEpC,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,WAAW,EAAE,CAAC;YACnD,qEAAqE;YACrE,yEAAyE;YACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF"}
|