@hkdigital/lib-core 0.4.30 → 0.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/jwt/constants.d.ts +1 -1
- package/dist/auth/jwt/errors.d.ts +5 -5
- package/dist/auth/jwt/typedef.d.ts +30 -30
- package/dist/config/generators/imagetools.d.ts +3 -3
- package/dist/config/generators/vite.d.ts +11 -11
- package/dist/config/generators/vite.js +1 -1
- package/dist/design/generators/index.d.ts +9 -9
- package/dist/design/utils/clamp.d.ts +1 -1
- package/dist/design/utils/root-vars.d.ts +1 -1
- package/dist/design/utils/scaling.d.ts +2 -2
- package/dist/generic/data/classes/IterableTree.d.ts +2 -2
- package/dist/generic/data/classes/IterableTree.js +1 -0
- package/dist/generic/data/classes/Selector.d.ts +5 -5
- package/dist/generic/data/classes/Selector.js +53 -60
- package/dist/generic/data/classes/typedef.d.ts +5 -5
- package/dist/generic/errors/generic.d.ts +3 -1
- package/dist/generic/errors/promise.d.ts +2 -2
- package/dist/generic/events/classes/EventEmitter.js +1 -0
- package/dist/generic/promises/classes/HkPromise.js +9 -15
- package/dist/logging/internal/adapters/console.d.ts +5 -5
- package/dist/logging/internal/adapters/pino.d.ts +3 -3
- package/dist/logging/internal/adapters/typedef.d.ts +7 -7
- package/dist/logging/internal/factories/client.d.ts +1 -1
- package/dist/logging/internal/factories/server.d.ts +1 -1
- package/dist/logging/internal/logger/Logger.d.ts +3 -3
- package/dist/logging/internal/transports/pretty-transport.d.ts +3 -3
- package/dist/logging/internal/transports/test-transport.d.ts +5 -5
- package/dist/logging/typedef.d.ts +1 -1
- package/dist/network/cache/IndexedDbCache.d.ts +10 -10
- package/dist/network/cache/MemoryResponseCache.d.ts +3 -3
- package/dist/network/cache/typedef.d.ts +3 -3
- package/dist/network/errors/http.d.ts +2 -2
- package/dist/network/http/caching.d.ts +2 -2
- package/dist/network/http/http-request.d.ts +1 -1
- package/dist/network/http/typedef.d.ts +31 -31
- package/dist/network/loaders/audio/AudioScene.svelte.d.ts +2 -2
- package/dist/network/loaders/base/SceneBase.svelte.d.ts +4 -4
- package/dist/network/loaders/base/SceneBase.svelte.js +1 -1
- package/dist/network/loaders/image/ImageLoader.svelte.d.ts +1 -1
- package/dist/network/loaders/image/ImageVariantsLoader.svelte.d.ts +5 -5
- package/dist/network/loaders/image/utils/index.d.ts +3 -3
- package/dist/services/manager-plugins/ConfigPlugin.d.ts +1 -1
- package/dist/services/service-base/ServiceBase.d.ts +13 -3
- package/dist/services/service-base/ServiceBase.js +27 -9
- package/dist/services/service-base/typedef.d.ts +8 -8
- package/dist/services/service-manager/ServiceManager.d.ts +10 -2
- package/dist/services/service-manager/ServiceManager.js +55 -27
- package/dist/services/service-manager/typedef.d.ts +12 -11
- package/dist/services/service-manager/typedef.js +2 -1
- package/dist/state/machines/finite-state-machine/FiniteStateMachine.svelte.d.ts +1 -1
- package/dist/state/machines/loading-state-machine/LoadingStateMachine.svelte.d.ts +1 -1
- package/dist/state/stores/theme.d.ts +1 -1
- package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +7 -7
- package/dist/ui/components/button-group/typedef.d.ts +1 -1
- package/dist/ui/components/compare-left-right/CompareLeftRight.svelte.d.ts +5 -5
- package/dist/ui/components/drag-drop/DragController.d.ts +1 -1
- package/dist/ui/components/drag-drop/DragDropContext.svelte.d.ts +3 -3
- package/dist/ui/components/drag-drop/Draggable.svelte.d.ts +20 -20
- package/dist/ui/components/drag-drop/DropZone.svelte.d.ts +27 -27
- package/dist/ui/components/drag-drop/DropZoneArea.svelte.d.ts +26 -26
- package/dist/ui/components/drag-drop/DropZoneList.svelte.d.ts +27 -27
- package/dist/ui/components/drag-drop/drag-state.svelte.d.ts +4 -4
- package/dist/ui/components/drag-drop/typedef/drag.d.ts +1 -1
- package/dist/ui/components/game-box/GameBox.svelte.d.ts +19 -19
- package/dist/ui/components/game-box/gamebox.util.d.ts +2 -2
- package/dist/ui/components/grid-layers/GridLayers.svelte.d.ts +7 -7
- package/dist/ui/components/image-box/ImageBox.svelte.d.ts +14 -14
- package/dist/ui/components/presenter/ImageSlide.svelte.d.ts +8 -8
- package/dist/ui/components/presenter/Presenter.state.svelte.d.ts +1 -1
- package/dist/ui/components/presenter/Presenter.svelte.d.ts +5 -5
- package/dist/ui/components/presenter/typedef.d.ts +13 -13
- package/dist/ui/components/rows/panel-grid-row/PanelGridRow.svelte.d.ts +7 -7
- package/dist/ui/components/rows/panel-row-2/PanelRow2.svelte.d.ts +7 -7
- package/dist/ui/components/tab-bar/HkTabBar.svelte.d.ts +10 -10
- package/dist/ui/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +1 -1
- package/dist/ui/components/tab-bar/HkTabBarSelector.svelte.d.ts +10 -10
- package/dist/ui/components/tab-bar/typedef.d.ts +3 -3
- package/dist/ui/components/virtual-viewport/VirtualViewport.svelte.d.ts +17 -17
- package/dist/ui/dev/blocks/TextBlock.svelte.d.ts +6 -6
- package/dist/ui/dev/buttons/CheckButton.svelte.d.ts +11 -11
- package/dist/ui/primitives/area/HkArea.svelte.d.ts +6 -6
- package/dist/ui/primitives/area/HkGridArea.svelte.d.ts +12 -12
- package/dist/ui/primitives/buttons/button/Button.svelte.d.ts +16 -16
- package/dist/ui/primitives/buttons/button-icon-steeze/SteezeIconButton.svelte.d.ts +2 -2
- package/dist/ui/primitives/buttons/button-submit/SubmitButton.svelte +21 -0
- package/dist/ui/primitives/buttons/button-submit/SubmitButton.svelte.d.ts +12 -0
- package/dist/ui/primitives/buttons/index.d.ts +2 -1
- package/dist/ui/primitives/buttons/index.js +2 -1
- package/dist/ui/primitives/icons/HkIcon.svelte.d.ts +4 -4
- package/dist/ui/primitives/icons/HkTabIcon.svelte.d.ts +13 -13
- package/dist/ui/primitives/icons/SteezeIcon.svelte.d.ts +4 -4
- package/dist/ui/primitives/inputs/text-input/TextInput.svelte.d.ts +22 -22
- package/dist/ui/primitives/inputs/text-input/assets/IconInvalid.svelte.d.ts +1 -1
- package/dist/ui/primitives/inputs/text-input/assets/IconValid.svelte.d.ts +1 -1
- package/dist/ui/primitives/panels/panel/Panel.svelte.d.ts +6 -6
- package/dist/util/array/index.d.ts +17 -17
- package/dist/util/array/index.js +5 -5
- package/dist/util/compare/index.d.ts +2 -1
- package/dist/util/compare/index.js +1 -0
- package/dist/util/exceptions/index.d.ts +3 -2
- package/dist/util/exceptions/index.js +13 -9
- package/dist/util/expect/arrays.d.ts +1 -0
- package/dist/util/expect/arrays.js +1 -0
- package/dist/util/expect/primitives.d.ts +18 -0
- package/dist/util/expect/primitives.js +18 -0
- package/dist/util/function/index.d.ts +14 -1
- package/dist/util/geometry/index.d.ts +2 -2
- package/dist/util/geometry/index.js +1 -1
- package/dist/util/iterate/index.d.ts +7 -7
- package/dist/util/object/index.d.ts +13 -13
- package/dist/util/singleton/index.d.ts +3 -3
- package/dist/util/svelte/loading/loading-tracker.svelte.d.ts +1 -1
- package/dist/util/sveltekit/env/all.d.ts +5 -5
- package/dist/util/sveltekit/env/all.js +2 -2
- package/dist/util/sveltekit/env/parsers.d.ts +12 -12
- package/dist/util/sveltekit/env/private.d.ts +5 -5
- package/dist/util/sveltekit/env/public.d.ts +5 -5
- package/dist/util/sveltekit/route-folders/index.d.ts +2 -2
- package/dist/util/sveltekit/route-folders.d.ts +1 -0
- package/dist/util/{sveltekit.js → sveltekit/route-folders.js} +1 -1
- package/dist/util/time/index.d.ts +4 -4
- package/dist/valibot/parsers/url.d.ts +3 -3
- package/dist/valibot/parsers/url.js +6 -2
- package/package.json +1 -1
- package/dist/util/sveltekit.d.ts +0 -1
|
@@ -18,6 +18,7 @@ export function expect_stringArray(value: any): void;
|
|
|
18
18
|
export function expect_objectArray(value: any): void;
|
|
19
19
|
/**
|
|
20
20
|
* Throws an exception if the value is not an Array or the array is empty
|
|
21
|
+
* @param {any} value - Value to check
|
|
21
22
|
*/
|
|
22
23
|
export function expect_notEmptyArray(value: any): void;
|
|
23
24
|
/**
|
|
@@ -35,6 +35,7 @@ export { expect_objectArray as objectArray };
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Throws an exception if the value is not an Array or the array is empty
|
|
38
|
+
* @param {any} value - Value to check
|
|
38
39
|
*/
|
|
39
40
|
export function expect_notEmptyArray(value) {
|
|
40
41
|
v.parse(v.pipe(v.instance(Array), v.nonEmpty()), value);
|
|
@@ -2,24 +2,32 @@
|
|
|
2
2
|
* Throws a validation error if value is not a string
|
|
3
3
|
*
|
|
4
4
|
* @param {any} value
|
|
5
|
+
*
|
|
6
|
+
* @asserts value is string
|
|
5
7
|
*/
|
|
6
8
|
export function expect_string(value: any): void;
|
|
7
9
|
/**
|
|
8
10
|
* Throws a validation error if value is not a boolean
|
|
9
11
|
*
|
|
10
12
|
* @param {any} value
|
|
13
|
+
*
|
|
14
|
+
* @asserts value is boolean
|
|
11
15
|
*/
|
|
12
16
|
export function expect_boolean(value: any): void;
|
|
13
17
|
/**
|
|
14
18
|
* Throws a validation error if value is not a number
|
|
15
19
|
*
|
|
16
20
|
* @param {any} value
|
|
21
|
+
*
|
|
22
|
+
* @asserts value is number
|
|
17
23
|
*/
|
|
18
24
|
export function expect_number(value: any): void;
|
|
19
25
|
/**
|
|
20
26
|
* Throws a validation error if value is not a Symbol
|
|
21
27
|
*
|
|
22
28
|
* @param {any} value
|
|
29
|
+
*
|
|
30
|
+
* @asserts value is Symbol
|
|
23
31
|
*/
|
|
24
32
|
export function expect_symbol(value: any): void;
|
|
25
33
|
/**
|
|
@@ -32,30 +40,40 @@ export function expect_defined(value: any): void;
|
|
|
32
40
|
* Throws a validation error if value is not a function
|
|
33
41
|
*
|
|
34
42
|
* @param {any} value
|
|
43
|
+
*
|
|
44
|
+
* @asserts value is function
|
|
35
45
|
*/
|
|
36
46
|
export function expect_function(value: any): void;
|
|
37
47
|
/**
|
|
38
48
|
* Throws a validation error if value is not a Promise
|
|
39
49
|
*
|
|
40
50
|
* @param {any} value
|
|
51
|
+
*
|
|
52
|
+
* @asserts value is Promise
|
|
41
53
|
*/
|
|
42
54
|
export function expect_promise(value: any): void;
|
|
43
55
|
/**
|
|
44
56
|
* Throws a validation error if value is not a Map
|
|
45
57
|
*
|
|
46
58
|
* @param {any} value
|
|
59
|
+
*
|
|
60
|
+
* @asserts value is Map
|
|
47
61
|
*/
|
|
48
62
|
export function expect_map(value: any): void;
|
|
49
63
|
/**
|
|
50
64
|
* Throws a validation error if value is not a Set
|
|
51
65
|
*
|
|
52
66
|
* @param {any} value
|
|
67
|
+
*
|
|
68
|
+
* @asserts value is Set
|
|
53
69
|
*/
|
|
54
70
|
export function expect_set(value: any): void;
|
|
55
71
|
/**
|
|
56
72
|
* Throws a validation error if value is not an Error instance
|
|
57
73
|
*
|
|
58
74
|
* @param {any} value
|
|
75
|
+
*
|
|
76
|
+
* @asserts value is Error
|
|
59
77
|
*/
|
|
60
78
|
export function expect_error(value: any): void;
|
|
61
79
|
export { expect_string as string, expect_boolean as boolean, expect_number as number, expect_symbol as symbol, expect_defined as defined, expect_function as function, _function as function, expect_function as class, _class as class, expect_promise as promise, expect_map as map, expect_set as set, expect_error as error };
|
|
@@ -4,6 +4,8 @@ import * as v from 'valibot';
|
|
|
4
4
|
* Throws a validation error if value is not a string
|
|
5
5
|
*
|
|
6
6
|
* @param {any} value
|
|
7
|
+
*
|
|
8
|
+
* @asserts value is string
|
|
7
9
|
*/
|
|
8
10
|
export function expect_string(value) {
|
|
9
11
|
v.parse(v.string(), value);
|
|
@@ -15,6 +17,8 @@ export { expect_string as string };
|
|
|
15
17
|
* Throws a validation error if value is not a boolean
|
|
16
18
|
*
|
|
17
19
|
* @param {any} value
|
|
20
|
+
*
|
|
21
|
+
* @asserts value is boolean
|
|
18
22
|
*/
|
|
19
23
|
export function expect_boolean(value) {
|
|
20
24
|
v.parse(v.boolean(), value);
|
|
@@ -26,6 +30,8 @@ export { expect_boolean as boolean };
|
|
|
26
30
|
* Throws a validation error if value is not a number
|
|
27
31
|
*
|
|
28
32
|
* @param {any} value
|
|
33
|
+
*
|
|
34
|
+
* @asserts value is number
|
|
29
35
|
*/
|
|
30
36
|
export function expect_number(value) {
|
|
31
37
|
v.parse(v.number(), value);
|
|
@@ -37,6 +43,8 @@ export { expect_number as number };
|
|
|
37
43
|
* Throws a validation error if value is not a Symbol
|
|
38
44
|
*
|
|
39
45
|
* @param {any} value
|
|
46
|
+
*
|
|
47
|
+
* @asserts value is Symbol
|
|
40
48
|
*/
|
|
41
49
|
export function expect_symbol(value) {
|
|
42
50
|
v.parse(v.symbol(), value);
|
|
@@ -68,6 +76,8 @@ export { expect_defined as defined };
|
|
|
68
76
|
* Throws a validation error if value is not a function
|
|
69
77
|
*
|
|
70
78
|
* @param {any} value
|
|
79
|
+
*
|
|
80
|
+
* @asserts value is function
|
|
71
81
|
*/
|
|
72
82
|
export function expect_function(value) {
|
|
73
83
|
v.parse(v.function(), value);
|
|
@@ -80,6 +90,8 @@ export { expect_function as class };
|
|
|
80
90
|
* Throws a validation error if value is not a Promise
|
|
81
91
|
*
|
|
82
92
|
* @param {any} value
|
|
93
|
+
*
|
|
94
|
+
* @asserts value is Promise
|
|
83
95
|
*/
|
|
84
96
|
export function expect_promise(value) {
|
|
85
97
|
v.parse(v.instance(Promise), value);
|
|
@@ -91,6 +103,8 @@ export { expect_promise as promise };
|
|
|
91
103
|
* Throws a validation error if value is not a Map
|
|
92
104
|
*
|
|
93
105
|
* @param {any} value
|
|
106
|
+
*
|
|
107
|
+
* @asserts value is Map
|
|
94
108
|
*/
|
|
95
109
|
export function expect_map(value) {
|
|
96
110
|
v.parse(v.instance(Map), value);
|
|
@@ -102,6 +116,8 @@ export { expect_map as map };
|
|
|
102
116
|
* Throws a validation error if value is not a Set
|
|
103
117
|
*
|
|
104
118
|
* @param {any} value
|
|
119
|
+
*
|
|
120
|
+
* @asserts value is Set
|
|
105
121
|
*/
|
|
106
122
|
export function expect_set(value) {
|
|
107
123
|
v.parse(v.instance(Set), value);
|
|
@@ -113,6 +129,8 @@ export { expect_set as set };
|
|
|
113
129
|
* Throws a validation error if value is not an Error instance
|
|
114
130
|
*
|
|
115
131
|
* @param {any} value
|
|
132
|
+
*
|
|
133
|
+
* @asserts value is Error
|
|
116
134
|
*/
|
|
117
135
|
export function expect_error(value) {
|
|
118
136
|
v.parse(v.instance(Error), value);
|
|
@@ -18,4 +18,17 @@ export function once(callback: Function): Function;
|
|
|
18
18
|
*/
|
|
19
19
|
export function debounce(fn: Function, intervalMs?: number): Function;
|
|
20
20
|
export function noop(): void;
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Defer the execution of a function
|
|
23
|
+
* - Uses the best 'setImmediate' implementation supported by the current
|
|
24
|
+
* runtime environment
|
|
25
|
+
*
|
|
26
|
+
* @param {function} fn - Function to execute
|
|
27
|
+
*
|
|
28
|
+
* --
|
|
29
|
+
*
|
|
30
|
+
* @note setImmediate is preferred over nextTick
|
|
31
|
+
*
|
|
32
|
+
* @see https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/
|
|
33
|
+
*/
|
|
34
|
+
export const defer: typeof setImmediate | ((fn: any) => void);
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {number} xPct - X-coordinate as percentage
|
|
5
5
|
* @param {number} yPct - Y-coordinate as percentage
|
|
6
|
-
* @param {Array} polygon - Array of [x, y] points
|
|
6
|
+
* @param {Array<number[]>} polygon - Array of [x, y] points
|
|
7
7
|
*
|
|
8
8
|
* @returns {boolean} True if the point lies within the polygon
|
|
9
9
|
*/
|
|
10
|
-
export function isPointInPolygon(xPct: number, yPct: number, polygon:
|
|
10
|
+
export function isPointInPolygon(xPct: number, yPct: number, polygon: Array<number[]>): boolean;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {number} xPct - X-coordinate as percentage
|
|
5
5
|
* @param {number} yPct - Y-coordinate as percentage
|
|
6
|
-
* @param {Array} polygon - Array of [x, y] points
|
|
6
|
+
* @param {Array<number[]>} polygon - Array of [x, y] points
|
|
7
7
|
*
|
|
8
8
|
* @returns {boolean} True if the point lies within the polygon
|
|
9
9
|
*/
|
|
@@ -48,11 +48,11 @@ export function map(iterable: Iterable<any>, transformFn: Function): Generator;
|
|
|
48
48
|
* @return {Iterable<[string[], any]>} iterable that yields [path, value] pairs
|
|
49
49
|
*/
|
|
50
50
|
export function iterateObjectEntries(obj: object, options?: {
|
|
51
|
-
walkArrays?: boolean;
|
|
52
|
-
expandPathKeys?: boolean;
|
|
53
|
-
outputIntermediateNodes?: boolean;
|
|
54
|
-
ignoreEmptyObjectLeaves?: boolean;
|
|
55
|
-
depthFirst?: boolean;
|
|
51
|
+
walkArrays?: boolean | undefined;
|
|
52
|
+
expandPathKeys?: boolean | undefined;
|
|
53
|
+
outputIntermediateNodes?: boolean | undefined;
|
|
54
|
+
ignoreEmptyObjectLeaves?: boolean | undefined;
|
|
55
|
+
depthFirst?: boolean | undefined;
|
|
56
56
|
}): Iterable<[string[], any]>;
|
|
57
57
|
/**
|
|
58
58
|
* Get an Iterator object that can be used to iterate over all paths in
|
|
@@ -92,6 +92,6 @@ export function iterateObjectValues(obj: object, options?: IterableTreeOptions):
|
|
|
92
92
|
export function sortObjects({ it, getValueFn, reversed }: {
|
|
93
93
|
it: Iterable<any>;
|
|
94
94
|
getValueFn: Function;
|
|
95
|
-
reversed?: boolean;
|
|
96
|
-
}): Promise<
|
|
95
|
+
reversed?: boolean | undefined;
|
|
96
|
+
}): Promise<array>;
|
|
97
97
|
export type IterableTreeOptions = import("../../generic/typedef.js").IterableTreeOptions;
|
|
@@ -54,7 +54,7 @@ export function exportPublic(obj: object, keepKeys?: string[]): object;
|
|
|
54
54
|
*
|
|
55
55
|
* @returns {object|array} new object or array with only primitive values
|
|
56
56
|
*/
|
|
57
|
-
export function exportNotNested(objectOrArray: object |
|
|
57
|
+
export function exportNotNested(objectOrArray: object | array): object | array;
|
|
58
58
|
/**
|
|
59
59
|
* Keep only the specified keys in the object
|
|
60
60
|
* - deletes all other key-value pairs in the object
|
|
@@ -166,12 +166,12 @@ export function objectGetWithThrow(obj: object, path: string | any[], parseFn?:
|
|
|
166
166
|
* List of changes between the object before and object after
|
|
167
167
|
*/
|
|
168
168
|
export function objectDiff(objBefore: object, objAfter: object, options: {
|
|
169
|
-
ignoreAdd?: boolean;
|
|
170
|
-
ignoreUpdate?: boolean;
|
|
171
|
-
ignoreDelete?: boolean;
|
|
172
|
-
ignorePrivate?: boolean;
|
|
173
|
-
deleteValue?: boolean;
|
|
174
|
-
}, _recursion: any):
|
|
169
|
+
ignoreAdd?: boolean | undefined;
|
|
170
|
+
ignoreUpdate?: boolean | undefined;
|
|
171
|
+
ignoreDelete?: boolean | undefined;
|
|
172
|
+
ignorePrivate?: boolean | undefined;
|
|
173
|
+
deleteValue?: boolean | undefined;
|
|
174
|
+
} | undefined, _recursion: any): array;
|
|
175
175
|
/**
|
|
176
176
|
* Applies a list of differences to the input object
|
|
177
177
|
* - A list of changes can be generated by e.g. objectDiff
|
|
@@ -188,10 +188,10 @@ export function objectDiff(objBefore: object, objAfter: object, options: {
|
|
|
188
188
|
* Ignore properties that start with an underscore e.g. _id or _updatedAt
|
|
189
189
|
*/
|
|
190
190
|
export function patchObject(obj: object, changes: object[], options?: {
|
|
191
|
-
ignoreAdd?: boolean;
|
|
192
|
-
ignoreUpdate?: boolean;
|
|
193
|
-
ignoreDelete?: boolean;
|
|
194
|
-
ignorePrivate?: boolean;
|
|
191
|
+
ignoreAdd?: boolean | undefined;
|
|
192
|
+
ignoreUpdate?: boolean | undefined;
|
|
193
|
+
ignoreDelete?: boolean | undefined;
|
|
194
|
+
ignorePrivate?: boolean | undefined;
|
|
195
195
|
}): void;
|
|
196
196
|
/**
|
|
197
197
|
* Extend the target object with methods and properties from the source
|
|
@@ -242,7 +242,7 @@ export function getPrototypeNames(obj: object): string[];
|
|
|
242
242
|
* nested object with the values that were found or defaultValues
|
|
243
243
|
*/
|
|
244
244
|
export function getTree(obj: object, tree: object, options?: {
|
|
245
|
-
shallowLeaves?: boolean;
|
|
245
|
+
shallowLeaves?: boolean | undefined;
|
|
246
246
|
}): object;
|
|
247
247
|
/**
|
|
248
248
|
* Deep clone an object or any kind of other variable
|
|
@@ -284,7 +284,7 @@ export function setReadOnlyProperty(obj: object, propertyName: string, value: an
|
|
|
284
284
|
* @returns {object} updated object
|
|
285
285
|
*/
|
|
286
286
|
export function updateObject(obj?: object, updateData?: object | Iterable<any>, options?: {
|
|
287
|
-
replaceArrays?: boolean;
|
|
287
|
+
replaceArrays?: boolean | undefined;
|
|
288
288
|
}): object;
|
|
289
289
|
/**
|
|
290
290
|
* Copy own properties from an object to another object if they do not
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export function getInstance({ needle, class: Class, args }: {
|
|
14
14
|
class: any;
|
|
15
|
-
args?: any[];
|
|
16
|
-
needle?: string;
|
|
15
|
+
args?: any[] | undefined;
|
|
16
|
+
needle?: string | undefined;
|
|
17
17
|
}): any;
|
|
18
18
|
/**
|
|
19
19
|
* Creates a proxy that instantiates the singleton class upon it's first usage
|
|
@@ -28,7 +28,7 @@ export function getInstance({ needle, class: Class, args }: {
|
|
|
28
28
|
*/
|
|
29
29
|
export function lazySingleton<T>({ class: Class, args }: {
|
|
30
30
|
class: new () => T;
|
|
31
|
-
args?: any[];
|
|
31
|
+
args?: any[] | undefined;
|
|
32
32
|
}): T & {
|
|
33
33
|
init: () => null;
|
|
34
34
|
};
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
* // }
|
|
32
32
|
*/
|
|
33
33
|
export function getAllEnv(options?: {
|
|
34
|
-
camelCase?: boolean;
|
|
35
|
-
parseValues?: boolean;
|
|
36
|
-
autoGroup?: boolean;
|
|
37
|
-
}):
|
|
34
|
+
camelCase?: boolean | undefined;
|
|
35
|
+
parseValues?: boolean | undefined;
|
|
36
|
+
autoGroup?: boolean | undefined;
|
|
37
|
+
}): Object;
|
|
38
38
|
/**
|
|
39
39
|
* Get combined environment variables by prefix
|
|
40
40
|
*
|
|
@@ -43,7 +43,7 @@ export function getAllEnv(options?: {
|
|
|
43
43
|
*
|
|
44
44
|
* @returns {Object} Parsed configuration object
|
|
45
45
|
*/
|
|
46
|
-
export function getAllEnvByPrefix(prefix: string, options?:
|
|
46
|
+
export function getAllEnvByPrefix(prefix: string, options?: Object): Object;
|
|
47
47
|
/**
|
|
48
48
|
* Get raw combined environment variables (no parsing)
|
|
49
49
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import { getPublicEnv, getRawPublicEnv } from './public.js';
|
|
16
16
|
import { getPrivateEnv, getRawPrivateEnv } from './private.js';
|
|
17
|
-
import { autoGroupEnvByPrefix
|
|
17
|
+
import { autoGroupEnvByPrefix } from './parsers.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Get all environment variables (public + private) with automatic grouping
|
|
@@ -94,4 +94,4 @@ export function getRawAllEnv() {
|
|
|
94
94
|
|
|
95
95
|
// Private variables take precedence over public ones
|
|
96
96
|
return { ...publicVars, ...privateVars };
|
|
97
|
-
}
|
|
97
|
+
}
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
export function parseEnv(env: {
|
|
33
33
|
[x: string]: string;
|
|
34
34
|
}, options?: {
|
|
35
|
-
camelCase?: boolean;
|
|
36
|
-
parseValues?: boolean;
|
|
37
|
-
prefix?: string;
|
|
38
|
-
removePrefix?: boolean;
|
|
39
|
-
}):
|
|
35
|
+
camelCase?: boolean | undefined;
|
|
36
|
+
parseValues?: boolean | undefined;
|
|
37
|
+
prefix?: string | undefined;
|
|
38
|
+
removePrefix?: boolean | undefined;
|
|
39
|
+
}): Object;
|
|
40
40
|
/**
|
|
41
41
|
* Parse environment variables by prefix
|
|
42
42
|
*
|
|
@@ -48,7 +48,7 @@ export function parseEnv(env: {
|
|
|
48
48
|
*/
|
|
49
49
|
export function parseEnvByPrefix(env: {
|
|
50
50
|
[x: string]: string;
|
|
51
|
-
}, prefix: string, options?:
|
|
51
|
+
}, prefix: string, options?: Object): Object;
|
|
52
52
|
/**
|
|
53
53
|
* Convert SCREAMING_SNAKE_CASE to camelCase
|
|
54
54
|
*
|
|
@@ -98,10 +98,10 @@ export function parseValue(value: string): any;
|
|
|
98
98
|
export function autoGroupEnvByPrefix(env: {
|
|
99
99
|
[x: string]: string;
|
|
100
100
|
}, options?: {
|
|
101
|
-
camelCase?: boolean;
|
|
102
|
-
parseValues?: boolean;
|
|
101
|
+
camelCase?: boolean | undefined;
|
|
102
|
+
parseValues?: boolean | undefined;
|
|
103
103
|
}): {
|
|
104
|
-
[x: string]:
|
|
104
|
+
[x: string]: Object;
|
|
105
105
|
};
|
|
106
106
|
/**
|
|
107
107
|
* Group environment variables by specific prefixes
|
|
@@ -118,8 +118,8 @@ export function autoGroupEnvByPrefix(env: {
|
|
|
118
118
|
*/
|
|
119
119
|
export function groupEnvByPrefixes(env: {
|
|
120
120
|
[x: string]: string;
|
|
121
|
-
}, prefixes: string[], options?:
|
|
122
|
-
[x: string]:
|
|
121
|
+
}, prefixes: string[], options?: Object): {
|
|
122
|
+
[x: string]: Object;
|
|
123
123
|
};
|
|
124
124
|
/**
|
|
125
125
|
* Filter environment variables by pattern
|
|
@@ -132,4 +132,4 @@ export function groupEnvByPrefixes(env: {
|
|
|
132
132
|
*/
|
|
133
133
|
export function filterEnvByPattern(env: {
|
|
134
134
|
[x: string]: string;
|
|
135
|
-
}, pattern: RegExp | string, options?:
|
|
135
|
+
}, pattern: RegExp | string, options?: Object): Object;
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
* // }
|
|
34
34
|
*/
|
|
35
35
|
export function getPrivateEnv(options?: {
|
|
36
|
-
camelCase?: boolean;
|
|
37
|
-
parseValues?: boolean;
|
|
38
|
-
autoGroup?: boolean;
|
|
39
|
-
}):
|
|
36
|
+
camelCase?: boolean | undefined;
|
|
37
|
+
parseValues?: boolean | undefined;
|
|
38
|
+
autoGroup?: boolean | undefined;
|
|
39
|
+
}): Object;
|
|
40
40
|
/**
|
|
41
41
|
* Get private environment variables by prefix
|
|
42
42
|
*
|
|
@@ -45,7 +45,7 @@ export function getPrivateEnv(options?: {
|
|
|
45
45
|
*
|
|
46
46
|
* @returns {Object} Parsed configuration object
|
|
47
47
|
*/
|
|
48
|
-
export function getPrivateEnvByPrefix(prefix: string, options?:
|
|
48
|
+
export function getPrivateEnvByPrefix(prefix: string, options?: Object): Object;
|
|
49
49
|
/**
|
|
50
50
|
* Get raw private environment variables (no parsing)
|
|
51
51
|
*
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
* // }
|
|
30
30
|
*/
|
|
31
31
|
export function getPublicEnv(options?: {
|
|
32
|
-
camelCase?: boolean;
|
|
33
|
-
parseValues?: boolean;
|
|
34
|
-
autoGroup?: boolean;
|
|
35
|
-
}):
|
|
32
|
+
camelCase?: boolean | undefined;
|
|
33
|
+
parseValues?: boolean | undefined;
|
|
34
|
+
autoGroup?: boolean | undefined;
|
|
35
|
+
}): Object;
|
|
36
36
|
/**
|
|
37
37
|
* Get public environment variables by prefix
|
|
38
38
|
*
|
|
@@ -41,7 +41,7 @@ export function getPublicEnv(options?: {
|
|
|
41
41
|
*
|
|
42
42
|
* @returns {Object} Parsed configuration object
|
|
43
43
|
*/
|
|
44
|
-
export function getPublicEnvByPrefix(prefix: string, options?:
|
|
44
|
+
export function getPublicEnvByPrefix(prefix: string, options?: Object): Object;
|
|
45
45
|
/**
|
|
46
46
|
* Get raw public environment variables (no parsing)
|
|
47
47
|
*
|
|
@@ -19,8 +19,8 @@ export function isValidRoutePath(path: string): boolean;
|
|
|
19
19
|
*/
|
|
20
20
|
export function scanRouteFolders({ dirPath, maxDepth, skipFolders }: {
|
|
21
21
|
dirPath: string;
|
|
22
|
-
maxDepth?: number;
|
|
23
|
-
skipFolders?: Set<string
|
|
22
|
+
maxDepth?: number | undefined;
|
|
23
|
+
skipFolders?: Set<string> | undefined;
|
|
24
24
|
}, depth?: number): Promise<Array<{
|
|
25
25
|
displayName: string;
|
|
26
26
|
path: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./route-folders/index.js";
|
|
@@ -73,8 +73,8 @@ export function getWeekNumber(dateOrTimestamp: Date | number): number;
|
|
|
73
73
|
* @returns {string} name of the month in the specified locale
|
|
74
74
|
*/
|
|
75
75
|
export function getMonthName(dateOrTimestamp: Date | number, locale?: string, options?: {
|
|
76
|
-
month?: "numeric" | "2-digit" | "narrow" | "short" | "long";
|
|
77
|
-
timeZone?: string;
|
|
76
|
+
month?: "numeric" | "2-digit" | "narrow" | "short" | "long" | undefined;
|
|
77
|
+
timeZone?: string | undefined;
|
|
78
78
|
}): string;
|
|
79
79
|
/**
|
|
80
80
|
* Get the name of the day of the week
|
|
@@ -91,8 +91,8 @@ export function getMonthName(dateOrTimestamp: Date | number, locale?: string, op
|
|
|
91
91
|
* @returns {string} name of the day in the specified locale
|
|
92
92
|
*/
|
|
93
93
|
export function getDayName(dateOrTimestamp: Date | number, locale?: string, options?: {
|
|
94
|
-
weekday?: "narrow" | "short" | "long";
|
|
95
|
-
timeZone?: string;
|
|
94
|
+
weekday?: "narrow" | "short" | "long" | undefined;
|
|
95
|
+
timeZone?: string | undefined;
|
|
96
96
|
}): string;
|
|
97
97
|
/**
|
|
98
98
|
* Return the timestamp of the start of the day
|
|
@@ -11,18 +11,18 @@ export const HumanUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.T
|
|
|
11
11
|
/**
|
|
12
12
|
* Parser for URL path, without a search and hash part
|
|
13
13
|
*/
|
|
14
|
-
export const UrlPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname">, v.TransformAction<URL, string>]>;
|
|
14
|
+
export const UrlPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL | null>, v.CustomSchema<URL | null, "Invalid URL pathname">, v.TransformAction<URL | null, string>]>;
|
|
15
15
|
/**
|
|
16
16
|
* Parser for URL path, which consists of
|
|
17
17
|
* a path and optionally search and hash parts
|
|
18
18
|
*/
|
|
19
|
-
export const RelativeUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname or search part">, v.TransformAction<URL, string>]>;
|
|
19
|
+
export const RelativeUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL | null>, v.CustomSchema<URL | null, "Invalid URL pathname or search part">, v.TransformAction<URL | null, string>]>;
|
|
20
20
|
/**
|
|
21
21
|
* Parser for absolute or relative URL
|
|
22
22
|
*
|
|
23
23
|
* @note an empty string is not allowed!
|
|
24
24
|
*/
|
|
25
|
-
export const AbsOrRelUrl: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.UrlAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname or search part">, v.TransformAction<URL, string>]>]>], undefined>;
|
|
25
|
+
export const AbsOrRelUrl: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.UrlAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL | null>, v.CustomSchema<URL | null, "Invalid URL pathname or search part">, v.TransformAction<URL | null, string>]>]>], undefined>;
|
|
26
26
|
/**
|
|
27
27
|
* Parser for URL slug (e.g., "my-blog-post", "user-123")
|
|
28
28
|
*
|
|
@@ -53,6 +53,7 @@ export const UrlPath = v.pipe(
|
|
|
53
53
|
return urlOrNull ? true : false;
|
|
54
54
|
}, 'Invalid URL pathname'),
|
|
55
55
|
v.transform((url) => {
|
|
56
|
+
// @ts-ignore
|
|
56
57
|
return url.pathname;
|
|
57
58
|
})
|
|
58
59
|
);
|
|
@@ -79,8 +80,11 @@ export const RelativeUrl = v.pipe(
|
|
|
79
80
|
}, 'Invalid URL pathname or search part'),
|
|
80
81
|
v.transform((url) => {
|
|
81
82
|
return (
|
|
83
|
+
// @ts-ignore
|
|
82
84
|
`${url.pathname}` +
|
|
85
|
+
// @ts-ignore
|
|
83
86
|
`${url.search.length <= 1 ? '' : url.search}` +
|
|
87
|
+
// @ts-ignore
|
|
84
88
|
`${url.hash.length <= 1 ? '' : url.hash}`
|
|
85
89
|
);
|
|
86
90
|
})
|
|
@@ -98,7 +102,7 @@ export const AbsOrRelUrl = v.union([
|
|
|
98
102
|
|
|
99
103
|
/**
|
|
100
104
|
* Parser for URL slug (e.g., "my-blog-post", "user-123")
|
|
101
|
-
*
|
|
105
|
+
*
|
|
102
106
|
* @note Must start and end with Latin characters or numbers
|
|
103
107
|
* @note Hyphens are allowed between character groups
|
|
104
108
|
* @note Automatically converts to lowercase
|
|
@@ -108,4 +112,4 @@ export const Slug = v.pipe(
|
|
|
108
112
|
v.trim(),
|
|
109
113
|
v.toLowerCase(),
|
|
110
114
|
v.regex(new RegExp(URL_SLUG, 'v'), 'Must be a valid URL slug')
|
|
111
|
-
);
|
|
115
|
+
);
|
package/package.json
CHANGED
package/dist/util/sveltekit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./sveltekit/route-folders/index.js";
|