@hkdigital/lib-core 0.3.15 → 0.4.3
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/README.md +6 -6
- package/dist/auth/errors.d.ts +1 -0
- package/dist/auth/errors.js +1 -0
- package/dist/{states → browser/navigation}/navigation.svelte.js +1 -1
- package/dist/browser/navigation.d.ts +1 -0
- package/dist/browser/navigation.js +1 -0
- package/dist/config/README.md +1 -1
- package/dist/config/generators/imagetools.d.ts +2 -0
- package/dist/config/generators/imagetools.js +23 -10
- package/dist/config/generators/vite.js +1 -1
- package/dist/config/imagetools.d.ts +5 -5
- package/dist/config/typedef.d.ts +11 -0
- package/dist/config/typedef.js +17 -0
- package/dist/design/README.md +75 -0
- package/dist/design/generators/index.js +35 -0
- package/dist/design/themes/hkdev/components/buttons/button-text.css +20 -1
- package/dist/design/themes/hkdev/theme-ext.js +1 -1
- package/dist/{classes/data → generic/data/classes}/IterableTree.js +2 -2
- package/dist/{classes/data → generic/data/classes}/Selector.js +1 -1
- package/dist/generic/data/classes/typedef.d.ts +24 -0
- package/dist/generic/data/classes/typedef.js +14 -0
- package/dist/generic/data.d.ts +2 -0
- package/dist/generic/data.js +2 -0
- package/dist/generic/errors.d.ts +2 -0
- package/dist/generic/errors.js +2 -0
- package/dist/generic/events.d.ts +1 -0
- package/dist/generic/events.js +1 -0
- package/dist/{classes/promise → generic/promises/classes}/HkPromise.d.ts +17 -7
- package/dist/{classes/promise → generic/promises/classes}/HkPromise.js +20 -10
- package/dist/generic/promises.d.ts +1 -0
- package/dist/generic/promises.js +1 -0
- package/dist/{classes/streams → generic/streaming/classes}/ServerEventsStore.d.ts +1 -1
- package/dist/{classes/streams → generic/streaming/classes}/ServerEventsStore.js +2 -2
- package/dist/generic/streaming.d.ts +3 -0
- package/dist/generic/streaming.js +3 -0
- package/dist/generic/typedef.d.ts +1 -0
- package/dist/generic/typedef.js +1 -0
- package/dist/index.js +1 -0
- package/dist/logging/errors.d.ts +7 -0
- package/dist/logging/errors.js +11 -0
- package/dist/logging/internal/adapters/console.d.ts +1 -16
- package/dist/logging/internal/adapters/console.js +320 -8
- package/dist/logging/internal/adapters/formatting.d.ts +69 -0
- package/dist/logging/internal/adapters/formatting.js +395 -0
- package/dist/logging/internal/adapters/pino.js +112 -21
- package/dist/logging/internal/adapters/typedef.d.ts +30 -0
- package/dist/logging/internal/adapters/typedef.js +11 -0
- package/dist/logging/internal/factories/server.js +11 -1
- package/dist/logging/internal/logger/Logger.d.ts +7 -5
- package/dist/logging/internal/logger/Logger.js +41 -6
- package/dist/logging/internal/test-errors.d.ts +35 -0
- package/dist/logging/internal/test-errors.js +137 -0
- package/dist/network/cache/IndexedDbCache.d.ts +1 -1
- package/dist/network/cache/MemoryResponseCache.d.ts +5 -0
- package/dist/network/cache/MemoryResponseCache.js +5 -2
- package/dist/network/errors.d.ts +2 -0
- package/dist/network/errors.js +2 -0
- package/dist/network/http/caching.js +1 -1
- package/dist/network/http/errors.d.ts +2 -2
- package/dist/network/http/errors.js +5 -13
- package/dist/network/http/http-request.js +1 -1
- package/dist/network/http/json-request.js +1 -1
- package/dist/network/http/response.js +1 -1
- package/dist/network/http/url.js +1 -1
- package/dist/network/loaders/README.md +14 -7
- package/dist/network/loaders/audio/AudioScene.svelte.js +3 -2
- package/dist/network/loaders/image/ImageLoader.svelte.d.ts +2 -2
- package/dist/network/loaders/image/ImageLoader.svelte.js +1 -1
- package/dist/network/loaders/image/ImageScene.svelte.d.ts +2 -2
- package/dist/network/loaders/image/ImageScene.svelte.js +9 -8
- package/dist/network/loaders/image/ImageVariantsLoader.svelte.d.ts +5 -5
- package/dist/network/loaders/image/ImageVariantsLoader.svelte.js +14 -13
- package/dist/network/loaders/image/utils/index.d.ts +2 -2
- package/dist/network/loaders/image/utils/index.js +9 -12
- package/dist/network/loaders/typedef.d.ts +0 -9
- package/dist/network/loaders/typedef.js +0 -12
- package/dist/network/states/NetworkLoader.svelte.d.ts +1 -1
- package/dist/network/states/NetworkLoader.svelte.js +3 -2
- package/dist/services/service-base/ServiceBase.d.ts +2 -2
- package/dist/services/service-base/ServiceBase.js +15 -11
- package/dist/services/service-base/typedef.d.ts +2 -31
- package/dist/services/service-base/typedef.js +3 -2
- package/dist/services/service-manager/ServiceManager.d.ts +3 -3
- package/dist/services/service-manager/ServiceManager.js +2 -2
- package/dist/services/service-manager/typedef.d.ts +3 -3
- package/dist/services/service-manager/typedef.js +3 -3
- package/dist/{classes/svelte → state/classes}/loading-state-machine/LoadingStateMachine.svelte.d.ts +1 -1
- package/dist/{classes/svelte → state/classes}/loading-state-machine/LoadingStateMachine.svelte.js +1 -1
- package/dist/state/classes/subscribers-count/index.d.ts +1 -0
- package/dist/state/classes/subscribers-count/index.js +1 -0
- package/dist/state/classes.d.ts +3 -0
- package/dist/state/classes.js +3 -0
- package/dist/{util/svelte/state-context/index.d.ts → state/context/state-context.d.ts} +1 -1
- package/dist/{util/svelte/state-context/index.js → state/context/state-context.js} +4 -4
- package/dist/state/context.d.ts +1 -0
- package/dist/state/context.js +1 -0
- package/dist/state/stores.d.ts +1 -0
- package/dist/state/stores.js +1 -0
- package/dist/ui/README.md +49 -0
- package/dist/ui/components/button-group/index.d.ts +1 -0
- package/dist/ui/components/button-group/index.js +1 -0
- package/dist/ui/{primitives → components}/drag-drop/DragDropContext.svelte +1 -1
- package/dist/ui/{primitives → components}/drag-drop/DragDropContext.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/drag-drop/Draggable.svelte +2 -2
- package/dist/ui/{primitives → components}/drag-drop/Draggable.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/drag-drop/DropZone.svelte +4 -4
- package/dist/ui/{primitives → components}/drag-drop/DropZone.svelte.d.ts +3 -3
- package/dist/ui/{primitives → components}/drag-drop/DropZoneArea.svelte +3 -3
- package/dist/ui/{primitives → components}/drag-drop/DropZoneArea.svelte.d.ts +4 -4
- package/dist/ui/{primitives → components}/drag-drop/DropZoneList.svelte +3 -3
- package/dist/ui/{primitives → components}/drag-drop/DropZoneList.svelte.d.ts +3 -3
- package/dist/ui/{primitives → components}/drag-drop/drag-state.svelte.d.ts +11 -11
- package/dist/ui/{primitives → components}/drag-drop/drag-state.svelte.js +5 -5
- package/dist/ui/components/drag-drop/typedef.d.ts +2 -0
- package/dist/ui/components/drag-drop/typedef.js +2 -0
- package/dist/ui/components/game-box/index.d.ts +1 -0
- package/dist/ui/components/game-box/index.js +1 -0
- package/dist/ui/components/grid-layers/index.d.ts +1 -0
- package/dist/ui/components/grid-layers/index.js +1 -0
- package/dist/ui/{primitives/layout → components}/grid-layers/util.js +1 -1
- package/dist/ui/components/hk-app-layout/HkAppLayout.state.svelte.d.ts +3 -3
- package/dist/ui/components/hk-app-layout/HkAppLayout.state.svelte.js +3 -4
- package/dist/ui/components/hk-app-layout/index.d.ts +1 -0
- package/dist/ui/components/hk-app-layout/index.js +1 -0
- package/dist/ui/components/image-box/ImageBox.svelte +2 -2
- package/dist/ui/components/image-box/ImageBox.svelte.d.ts +3 -3
- package/dist/ui/components/image-box/index.d.ts +1 -1
- package/dist/ui/components/presenter/ImageSlide.svelte +1 -1
- package/dist/ui/components/presenter/ImageSlide.svelte.d.ts +2 -2
- package/dist/ui/components/presenter/Presenter.state.svelte.d.ts +3 -3
- package/dist/ui/components/presenter/Presenter.state.svelte.js +1 -1
- package/dist/ui/components/presenter/Presenter.svelte +1 -1
- package/dist/ui/components/presenter/Presenter.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/rows/panel-grid-row/PanelGridRow.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/rows/panel-row-2/PanelRow2.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/tab-bar/HkTabBar.state.svelte.d.ts +3 -3
- package/dist/ui/{primitives → components}/tab-bar/HkTabBar.state.svelte.js +4 -2
- package/dist/ui/{primitives → components}/tab-bar/HkTabBar.svelte +2 -2
- package/dist/ui/{primitives → components}/tab-bar/HkTabBar.svelte.d.ts +2 -2
- package/dist/ui/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +19 -0
- package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.state.svelte.js +2 -2
- package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.svelte +1 -1
- package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.svelte.d.ts +2 -2
- package/dist/ui/{primitives → components}/tab-bar/typedef.d.ts +1 -1
- package/dist/ui/{primitives → components}/tab-bar/typedef.js +1 -1
- package/dist/ui/components/typedef.d.ts +5 -0
- package/dist/ui/components/typedef.js +5 -0
- package/dist/ui/components/virtual-viewport/index.d.ts +1 -0
- package/dist/ui/components/virtual-viewport/index.js +1 -0
- package/dist/ui/components.d.ts +11 -0
- package/dist/ui/components.js +11 -0
- package/dist/ui/{primitives/hkdev → dev}/blocks/TextBlock.svelte +1 -1
- package/dist/ui/{primitives/debug → dev}/debug-panel-design-scaling/DebugPanelDesignScaling.svelte +1 -1
- package/dist/ui/dev.d.ts +3 -0
- package/dist/ui/dev.js +3 -0
- package/dist/ui/primitives/buttons/button/Button.svelte.d.ts +1 -1
- package/dist/ui/primitives/typedef.d.ts +1 -0
- package/dist/ui/primitives/typedef.js +1 -0
- package/dist/ui/primitives.d.ts +5 -0
- package/dist/ui/primitives.js +5 -0
- package/dist/ui/typedef.d.ts +2 -0
- package/dist/ui/typedef.js +2 -0
- package/dist/util/array/index.js +1 -1
- package/dist/util/bases/base58.d.ts +3 -3
- package/dist/util/bases/base58.js +3 -3
- package/dist/util/compare/index.d.ts +4 -5
- package/dist/util/compare/index.js +3 -4
- package/dist/util/exceptions/index.js +1 -1
- package/dist/util/expect/arrays.d.ts +11 -11
- package/dist/util/expect/arrays.js +14 -6
- package/dist/util/expect/index.js +2 -2
- package/dist/util/expect/primitives.d.ts +6 -5
- package/dist/util/expect/primitives.js +15 -5
- package/dist/util/expect/url.d.ts +6 -5
- package/dist/util/expect/url.js +15 -5
- package/dist/util/function/index.d.ts +1 -14
- package/dist/util/index.d.ts +5 -0
- package/dist/util/index.js +13 -0
- package/dist/util/is/index.d.ts +3 -2
- package/dist/util/is/index.js +2 -1
- package/dist/util/iterate/index.d.ts +6 -8
- package/dist/util/iterate/index.js +5 -5
- package/dist/util/object/index.d.ts +1 -2
- package/dist/util/object/index.js +2 -3
- package/dist/util/ssr/index.d.ts +16 -0
- package/dist/util/ssr/index.js +44 -0
- package/dist/util/svelte/index.d.ts +1 -1
- package/dist/util/svelte/index.js +1 -1
- package/dist/util/time/index.d.ts +2 -2
- package/dist/util/time/index.js +1 -1
- package/dist/valibot/index.d.ts +1 -1
- package/dist/valibot/index.js +27 -1
- package/package.json +3 -3
- package/dist/assets/autospuiten/car-paint-picker/army-green.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/electric-blue.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/lemon-yellow.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/opaque-purple.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/rusty.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/sunset-orange.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/tomato-red.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker.d.ts +0 -17
- package/dist/assets/autospuiten/car-paint-picker.js +0 -41
- package/dist/assets/autospuiten/labels.d.ts +0 -7
- package/dist/assets/autospuiten/labels.js +0 -7
- package/dist/classes/data/index.d.ts +0 -2
- package/dist/classes/data/index.js +0 -2
- package/dist/classes/event-emitter/index.d.ts +0 -1
- package/dist/classes/event-emitter/index.js +0 -2
- package/dist/classes/index.d.ts +0 -4
- package/dist/classes/index.js +0 -4
- package/dist/classes/promise/index.d.ts +0 -1
- package/dist/classes/promise/index.js +0 -1
- package/dist/classes/stores/index.d.ts +0 -1
- package/dist/classes/stores/index.js +0 -1
- package/dist/classes/streams/index.d.ts +0 -3
- package/dist/classes/streams/index.js +0 -3
- package/dist/classes/svelte/index.d.ts +0 -1
- package/dist/classes/svelte/index.js +0 -1
- package/dist/errors/index.d.ts +0 -5
- package/dist/errors/index.js +0 -5
- package/dist/services/service-base/index.d.ts +0 -3
- package/dist/services/service-base/index.js +0 -3
- package/dist/states/index.d.ts +0 -1
- package/dist/states/index.js +0 -1
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -1
- package/dist/typedef/index.d.ts +0 -3
- package/dist/typedef/index.js +0 -3
- package/dist/ui/primitives/debug/index.d.ts +0 -1
- package/dist/ui/primitives/debug/index.js +0 -1
- package/dist/ui/primitives/index.d.ts +0 -1
- package/dist/ui/primitives/index.js +0 -1
- package/dist/ui/primitives/layout/grid-layers/GridLayers.svelte__heightFrom__ +0 -372
- package/dist/ui/primitives/layout/index.d.ts +0 -1
- package/dist/ui/primitives/layout/index.js +0 -1
- package/dist/ui/primitives/tab-bar/HkTabBarSelector.state.svelte.d.ts +0 -19
- /package/dist/{errors → auth/errors}/jwt.d.ts +0 -0
- /package/dist/{errors → auth/errors}/jwt.js +0 -0
- /package/dist/{states → browser/navigation}/navigation.svelte.d.ts +0 -0
- /package/dist/{classes/data → generic/data/classes}/IterableTree.d.ts +0 -0
- /package/dist/{classes/data → generic/data/classes}/Selector.d.ts +0 -0
- /package/dist/{classes → generic}/data/typedef.d.ts +0 -0
- /package/dist/{classes → generic}/data/typedef.js +0 -0
- /package/dist/{errors → generic/errors}/generic.d.ts +0 -0
- /package/dist/{errors → generic/errors}/generic.js +0 -0
- /package/dist/{errors → generic/errors}/promise.d.ts +0 -0
- /package/dist/{errors → generic/errors}/promise.js +0 -0
- /package/dist/{classes/event-emitter → generic/events/classes}/EventEmitter.d.ts +0 -0
- /package/dist/{classes/event-emitter → generic/events/classes}/EventEmitter.js +0 -0
- /package/dist/{classes/streams → generic/streaming/classes}/LogTransformStream.d.ts +0 -0
- /package/dist/{classes/streams → generic/streaming/classes}/LogTransformStream.js +0 -0
- /package/dist/{classes/streams → generic/streaming/classes}/TimeStampSource.d.ts +0 -0
- /package/dist/{classes/streams → generic/streaming/classes}/TimeStampSource.js +0 -0
- /package/dist/{errors → network/errors}/api.d.ts +0 -0
- /package/dist/{errors → network/errors}/api.js +0 -0
- /package/dist/{errors → network/errors}/http.d.ts +0 -0
- /package/dist/{errors → network/errors}/http.js +0 -0
- /package/dist/{classes/svelte → state/classes}/finite-state-machine/FiniteStateMachine.svelte.d.ts +0 -0
- /package/dist/{classes/svelte → state/classes}/finite-state-machine/FiniteStateMachine.svelte.js +0 -0
- /package/dist/{classes/svelte → state/classes}/finite-state-machine/index.d.ts +0 -0
- /package/dist/{classes/svelte → state/classes}/finite-state-machine/index.js +0 -0
- /package/dist/{classes/svelte → state/classes}/loading-state-machine/constants.d.ts +0 -0
- /package/dist/{classes/svelte → state/classes}/loading-state-machine/constants.js +0 -0
- /package/dist/{classes/svelte → state/classes}/loading-state-machine/index.d.ts +0 -0
- /package/dist/{classes/svelte → state/classes}/loading-state-machine/index.js +0 -0
- /package/dist/{classes/stores → state/classes/subscribers-count}/SubscribersCount.d.ts +0 -0
- /package/dist/{classes/stores → state/classes/subscribers-count}/SubscribersCount.js +0 -0
- /package/dist/{typedef/context.d.ts → state/context/typedef.d.ts} +0 -0
- /package/dist/{typedef/context.js → state/context/typedef.js} +0 -0
- /package/dist/{stores → state/stores}/theme.d.ts +0 -0
- /package/dist/{stores → state/stores}/theme.js +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/DragController.d.ts +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/DragController.js +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/actions.d.ts +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/actions.js +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/index.d.ts +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/index.js +0 -0
- /package/dist/{typedef → ui/components/drag-drop/typedef}/drag.d.ts +0 -0
- /package/dist/{typedef → ui/components/drag-drop/typedef}/drag.js +0 -0
- /package/dist/{typedef → ui/components/drag-drop/typedef}/drop.d.ts +0 -0
- /package/dist/{typedef → ui/components/drag-drop/typedef}/drop.js +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/util.d.ts +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/util.js +0 -0
- /package/dist/ui/{primitives/layout → components}/grid-layers/GridLayers.svelte +0 -0
- /package/dist/ui/{primitives/layout → components}/grid-layers/GridLayers.svelte.d.ts +0 -0
- /package/dist/ui/{primitives/layout → components}/grid-layers/util.d.ts +0 -0
- /package/dist/ui/{primitives → components}/rows/index.d.ts +0 -0
- /package/dist/ui/{primitives → components}/rows/index.js +0 -0
- /package/dist/ui/{primitives → components}/rows/panel-grid-row/PanelGridRow.svelte +0 -0
- /package/dist/ui/{primitives → components}/rows/panel-row-2/PanelRow2.svelte +0 -0
- /package/dist/ui/{primitives → components}/tab-bar/index.d.ts +0 -0
- /package/dist/ui/{primitives → components}/tab-bar/index.js +0 -0
- /package/dist/ui/{primitives/hkdev → dev}/blocks/TextBlock.svelte.d.ts +0 -0
- /package/dist/ui/{primitives/hkdev → dev}/buttons/CheckButton.svelte +0 -0
- /package/dist/ui/{primitives/hkdev → dev}/buttons/CheckButton.svelte.d.ts +0 -0
- /package/dist/ui/{primitives/debug → dev}/debug-panel-design-scaling/DebugPanelDesignScaling.svelte.d.ts +0 -0
package/dist/ui/dev.js
ADDED
|
@@ -41,4 +41,4 @@ declare const Button: import("svelte").Component<{
|
|
|
41
41
|
snippetLoading?: import("svelte").Snippet;
|
|
42
42
|
snippetError?: import("svelte").Snippet;
|
|
43
43
|
children: import("svelte").Snippet;
|
|
44
|
-
}, {}, "error" | "
|
|
44
|
+
}, {}, "error" | "disabled" | "loading" | "selected" | "active">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./icons/typedef.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './icons/typedef.js';
|
package/dist/util/array/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { smallestFirst, largestFirst } from '../compare/index.js';
|
|
|
6
6
|
|
|
7
7
|
import { objectGet, PATH_SEPARATOR } from '../object/index.js';
|
|
8
8
|
|
|
9
|
-
import Selector from '../../
|
|
9
|
+
import { Selector } from '../../generic/data.js';
|
|
10
10
|
|
|
11
11
|
/* ---------------------------------------------------------------- Internals */
|
|
12
12
|
|
|
@@ -19,13 +19,13 @@ export function isBase58(str: string): boolean;
|
|
|
19
19
|
*
|
|
20
20
|
* @param {string} str - String to decode
|
|
21
21
|
*
|
|
22
|
-
* @param {
|
|
22
|
+
* @param {bigint} [exceptionValue]
|
|
23
23
|
* If specified, the exceptionValue will be returned instead of
|
|
24
24
|
* throwing an exception
|
|
25
25
|
*
|
|
26
|
-
* @returns {
|
|
26
|
+
* @returns {bigint} decoded decimal numerical representation
|
|
27
27
|
*/
|
|
28
|
-
export function base58toNumber(str: string, exceptionValue?:
|
|
28
|
+
export function base58toNumber(str: string, exceptionValue?: bigint, ...args: any[]): bigint;
|
|
29
29
|
/**
|
|
30
30
|
* Convert a base58 encoded string to an Uint8Array (bytes)
|
|
31
31
|
* - A base58 encoded string actually represents a (potentially very big)
|
|
@@ -114,15 +114,15 @@ export function isBase58( str )
|
|
|
114
114
|
*
|
|
115
115
|
* @param {string} str - String to decode
|
|
116
116
|
*
|
|
117
|
-
* @param {
|
|
117
|
+
* @param {bigint} [exceptionValue]
|
|
118
118
|
* If specified, the exceptionValue will be returned instead of
|
|
119
119
|
* throwing an exception
|
|
120
120
|
*
|
|
121
|
-
* @returns {
|
|
121
|
+
* @returns {bigint} decoded decimal numerical representation
|
|
122
122
|
*/
|
|
123
123
|
export function base58toNumber( str, exceptionValue )
|
|
124
124
|
{
|
|
125
|
-
expect.string(
|
|
125
|
+
expect.string( 'Missing or invalid parameter [str]' );
|
|
126
126
|
|
|
127
127
|
let num = BigInt(0);
|
|
128
128
|
|
|
@@ -60,9 +60,8 @@ export function compareUsingPath(compareFn: Function, a: any, b: any, path: stri
|
|
|
60
60
|
* Comparator that can be used for sorting using an object key
|
|
61
61
|
*
|
|
62
62
|
* @param {function} compareFn - Function to use to compare the values
|
|
63
|
-
* @param {string
|
|
64
|
-
*
|
|
65
|
-
* @param {any}
|
|
66
|
-
* @param {any} y - Second value
|
|
63
|
+
* @param {string} key - Object key or path
|
|
64
|
+
* @param {any} a - First value
|
|
65
|
+
* @param {any} b - Second value
|
|
67
66
|
*/
|
|
68
|
-
export function compareUsingKey(compareFn: Function, key:
|
|
67
|
+
export function compareUsingKey(compareFn: Function, key: string, a: any, b: any): any;
|
|
@@ -235,10 +235,9 @@ export function compareUsingPath(compareFn, a, b, path) {
|
|
|
235
235
|
* Comparator that can be used for sorting using an object key
|
|
236
236
|
*
|
|
237
237
|
* @param {function} compareFn - Function to use to compare the values
|
|
238
|
-
* @param {string
|
|
239
|
-
*
|
|
240
|
-
* @param {any}
|
|
241
|
-
* @param {any} y - Second value
|
|
238
|
+
* @param {string} key - Object key or path
|
|
239
|
+
* @param {any} a - First value
|
|
240
|
+
* @param {any} b - Second value
|
|
242
241
|
*/
|
|
243
242
|
export function compareUsingKey(compareFn, key, a, b) {
|
|
244
243
|
// @note assume a and b are objects
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws a validation error if value is not an array
|
|
3
|
+
*
|
|
4
|
+
* @param {any} value
|
|
5
|
+
*/
|
|
6
|
+
export function expect_array(value: any): void;
|
|
1
7
|
/**
|
|
2
8
|
* Throws a validation error if value is not an array of strings
|
|
3
9
|
*
|
|
4
10
|
* @param {any} value
|
|
5
11
|
*/
|
|
6
|
-
export function
|
|
12
|
+
export function expect_stringArray(value: any): void;
|
|
7
13
|
/**
|
|
8
14
|
* Throws a validation error if value is not an array of objects
|
|
9
15
|
*
|
|
10
16
|
* @param {any} value
|
|
11
17
|
*/
|
|
12
|
-
export function
|
|
18
|
+
export function expect_objectArray(value: any): void;
|
|
13
19
|
/**
|
|
14
20
|
* Throws an exception if the value is not an Array or the array is empty
|
|
15
21
|
*/
|
|
16
|
-
export function
|
|
22
|
+
export function expect_notEmptyArray(value: any): void;
|
|
17
23
|
/**
|
|
18
24
|
* Throws a validation error if value is not array like
|
|
19
25
|
* - Checks if the value is an object and has a property `length`
|
|
20
26
|
*
|
|
21
27
|
* @param {any} value
|
|
22
28
|
*/
|
|
23
|
-
export function
|
|
24
|
-
export {
|
|
25
|
-
/**
|
|
26
|
-
* Throws a validation error if value is not an array
|
|
27
|
-
*
|
|
28
|
-
* @param {any} value
|
|
29
|
-
*/
|
|
30
|
-
declare function array_(value: any): void;
|
|
29
|
+
export function expect_arrayLike(value: any): void;
|
|
30
|
+
export { expect_array as array, expect_stringArray as stringArray, expect_objectArray as objectArray, expect_notEmptyArray as notEmptyArray, expect_arrayLike as arrayLike };
|
|
@@ -5,43 +5,51 @@ import * as v from 'valibot';
|
|
|
5
5
|
*
|
|
6
6
|
* @param {any} value
|
|
7
7
|
*/
|
|
8
|
-
function
|
|
8
|
+
export function expect_array(value) {
|
|
9
9
|
v.parse(v.instance(Array), value);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { expect_array as array };
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Throws a validation error if value is not an array of strings
|
|
16
16
|
*
|
|
17
17
|
* @param {any} value
|
|
18
18
|
*/
|
|
19
|
-
export function
|
|
19
|
+
export function expect_stringArray(value) {
|
|
20
20
|
v.parse(v.array(v.string()), value);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export { expect_stringArray as stringArray };
|
|
24
|
+
|
|
23
25
|
/**
|
|
24
26
|
* Throws a validation error if value is not an array of objects
|
|
25
27
|
*
|
|
26
28
|
* @param {any} value
|
|
27
29
|
*/
|
|
28
|
-
export function
|
|
30
|
+
export function expect_objectArray(value) {
|
|
29
31
|
v.parse(v.array(v.looseObject({})), value);
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
export { expect_objectArray as objectArray };
|
|
35
|
+
|
|
32
36
|
/**
|
|
33
37
|
* Throws an exception if the value is not an Array or the array is empty
|
|
34
38
|
*/
|
|
35
|
-
export function
|
|
39
|
+
export function expect_notEmptyArray(value) {
|
|
36
40
|
v.parse(v.pipe(v.instance(Array), v.nonEmpty()), value);
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
export { expect_notEmptyArray as notEmptyArray };
|
|
44
|
+
|
|
39
45
|
/**
|
|
40
46
|
* Throws a validation error if value is not array like
|
|
41
47
|
* - Checks if the value is an object and has a property `length`
|
|
42
48
|
*
|
|
43
49
|
* @param {any} value
|
|
44
50
|
*/
|
|
45
|
-
export function
|
|
51
|
+
export function expect_arrayLike(value) {
|
|
46
52
|
v.parse(v.object({ length: v.number() }), value);
|
|
47
53
|
}
|
|
54
|
+
|
|
55
|
+
export { expect_arrayLike as arrayLike };
|
|
@@ -181,7 +181,7 @@ export function iterable(value) {
|
|
|
181
181
|
export function store(value) {
|
|
182
182
|
v.parse(
|
|
183
183
|
v.custom((value) => {
|
|
184
|
-
if (!is.object(value) || typeof value
|
|
184
|
+
if (!is.object(value) || typeof value?.subscribe !== 'function') {
|
|
185
185
|
return false;
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -240,7 +240,7 @@ export function objectNoFunction(value) {
|
|
|
240
240
|
* @param {any} value
|
|
241
241
|
*/
|
|
242
242
|
export function objectOrNull(value) {
|
|
243
|
-
v.parse(v.union([v.
|
|
243
|
+
v.parse(v.union([v.literal(null), v.looseObject({})]), value);
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
// objectOrUndefined
|
|
@@ -3,28 +3,29 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {any} value
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function expect_string(value: any): void;
|
|
7
7
|
/**
|
|
8
8
|
* Throws a validation error if value is not a boolean
|
|
9
9
|
*
|
|
10
10
|
* @param {any} value
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function expect_boolean(value: any): void;
|
|
13
13
|
/**
|
|
14
14
|
* Throws a validation error if value is not a number
|
|
15
15
|
*
|
|
16
16
|
* @param {any} value
|
|
17
17
|
*/
|
|
18
|
-
export function
|
|
18
|
+
export function expect_number(value: any): void;
|
|
19
19
|
/**
|
|
20
20
|
* Throws a validation error if value is not a Symbol
|
|
21
21
|
*
|
|
22
22
|
* @param {any} value
|
|
23
23
|
*/
|
|
24
|
-
export function
|
|
24
|
+
export function expect_symbol(value: any): void;
|
|
25
25
|
/**
|
|
26
26
|
* Throws a validation error if value is not defined
|
|
27
27
|
*
|
|
28
28
|
* @param {any} value
|
|
29
29
|
*/
|
|
30
|
-
export function
|
|
30
|
+
export function expect_defined(value: any): void;
|
|
31
|
+
export { expect_string as string, expect_boolean as boolean, expect_number as number, expect_symbol as symbol, expect_defined as defined };
|
|
@@ -5,43 +5,51 @@ import * as v from 'valibot';
|
|
|
5
5
|
*
|
|
6
6
|
* @param {any} value
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function expect_string(value) {
|
|
9
9
|
v.parse(v.string(), value);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
export { expect_string as string };
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* Throws a validation error if value is not a boolean
|
|
14
16
|
*
|
|
15
17
|
* @param {any} value
|
|
16
18
|
*/
|
|
17
|
-
export function
|
|
19
|
+
export function expect_boolean(value) {
|
|
18
20
|
v.parse(v.boolean(), value);
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
export { expect_boolean as boolean };
|
|
24
|
+
|
|
21
25
|
/**
|
|
22
26
|
* Throws a validation error if value is not a number
|
|
23
27
|
*
|
|
24
28
|
* @param {any} value
|
|
25
29
|
*/
|
|
26
|
-
export function
|
|
30
|
+
export function expect_number(value) {
|
|
27
31
|
v.parse(v.number(), value);
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
export { expect_number as number };
|
|
35
|
+
|
|
30
36
|
/**
|
|
31
37
|
* Throws a validation error if value is not a Symbol
|
|
32
38
|
*
|
|
33
39
|
* @param {any} value
|
|
34
40
|
*/
|
|
35
|
-
export function
|
|
41
|
+
export function expect_symbol(value) {
|
|
36
42
|
v.parse(v.symbol(), value);
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
export { expect_symbol as symbol };
|
|
46
|
+
|
|
39
47
|
/**
|
|
40
48
|
* Throws a validation error if value is not defined
|
|
41
49
|
*
|
|
42
50
|
* @param {any} value
|
|
43
51
|
*/
|
|
44
|
-
export function
|
|
52
|
+
export function expect_defined(value) {
|
|
45
53
|
v.parse(
|
|
46
54
|
v.custom((value) => {
|
|
47
55
|
if (value === undefined) {
|
|
@@ -53,3 +61,5 @@ export function defined(value) {
|
|
|
53
61
|
value
|
|
54
62
|
);
|
|
55
63
|
}
|
|
64
|
+
|
|
65
|
+
export { expect_defined as defined };
|
|
@@ -3,30 +3,31 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {any} value
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function expect_url(value: any): void;
|
|
7
7
|
/**
|
|
8
8
|
* Throws a parse error if value is not a URL or
|
|
9
9
|
* an empty string
|
|
10
10
|
*
|
|
11
11
|
* @param {any} value
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function expect_urlOrEmptyString(value: any): void;
|
|
14
14
|
/**
|
|
15
15
|
* Throws a parse error if value is not a URL path
|
|
16
16
|
*
|
|
17
17
|
* @param {any} value
|
|
18
18
|
*/
|
|
19
|
-
export function
|
|
19
|
+
export function expect_urlPath(value: any): void;
|
|
20
20
|
/**
|
|
21
21
|
* Throws a parse error if value is not a relative URL
|
|
22
22
|
*
|
|
23
23
|
* @param {any} value
|
|
24
24
|
*/
|
|
25
|
-
export function
|
|
25
|
+
export function expect_relativeUrl(value: any): void;
|
|
26
26
|
/**
|
|
27
27
|
* Throws a parse error if value is not an absolute
|
|
28
28
|
* or relative URL
|
|
29
29
|
*
|
|
30
30
|
* @param {any} value
|
|
31
31
|
*/
|
|
32
|
-
export function
|
|
32
|
+
export function expect_absOrRelUrl(value: any): void;
|
|
33
|
+
export { expect_url as url, expect_urlOrEmptyString as urlOrEmptyString, expect_urlPath as urlPath, expect_relativeUrl as relativeUrl, expect_absOrRelUrl as absOrRelUrl };
|
package/dist/util/expect/url.js
CHANGED
|
@@ -17,44 +17,54 @@ import {
|
|
|
17
17
|
*
|
|
18
18
|
* @param {any} value
|
|
19
19
|
*/
|
|
20
|
-
export function
|
|
20
|
+
export function expect_url(value) {
|
|
21
21
|
v.parse(HumanUrl, value);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export { expect_url as url };
|
|
25
|
+
|
|
24
26
|
/**
|
|
25
27
|
* Throws a parse error if value is not a URL or
|
|
26
28
|
* an empty string
|
|
27
29
|
*
|
|
28
30
|
* @param {any} value
|
|
29
31
|
*/
|
|
30
|
-
export function
|
|
32
|
+
export function expect_urlOrEmptyString(value) {
|
|
31
33
|
v.parse(UrlOrEmptyString, value);
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
export { expect_urlOrEmptyString as urlOrEmptyString };
|
|
37
|
+
|
|
34
38
|
/**
|
|
35
39
|
* Throws a parse error if value is not a URL path
|
|
36
40
|
*
|
|
37
41
|
* @param {any} value
|
|
38
42
|
*/
|
|
39
|
-
export function
|
|
43
|
+
export function expect_urlPath(value) {
|
|
40
44
|
v.parse(UrlPath, value);
|
|
41
45
|
}
|
|
42
46
|
|
|
47
|
+
export { expect_urlPath as urlPath };
|
|
48
|
+
|
|
43
49
|
/**
|
|
44
50
|
* Throws a parse error if value is not a relative URL
|
|
45
51
|
*
|
|
46
52
|
* @param {any} value
|
|
47
53
|
*/
|
|
48
|
-
export function
|
|
54
|
+
export function expect_relativeUrl(value) {
|
|
49
55
|
v.parse(RelativeUrl, value);
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
export { expect_relativeUrl as relativeUrl };
|
|
59
|
+
|
|
52
60
|
/**
|
|
53
61
|
* Throws a parse error if value is not an absolute
|
|
54
62
|
* or relative URL
|
|
55
63
|
*
|
|
56
64
|
* @param {any} value
|
|
57
65
|
*/
|
|
58
|
-
export function
|
|
66
|
+
export function expect_absOrRelUrl(value) {
|
|
59
67
|
v.parse(AbsOrRelUrl, value);
|
|
60
68
|
}
|
|
69
|
+
|
|
70
|
+
export { expect_absOrRelUrl as absOrRelUrl };
|
|
@@ -18,17 +18,4 @@ 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
|
-
|
|
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: any;
|
|
21
|
+
export function defer(fn: any): void;
|
package/dist/util/index.d.ts
CHANGED
|
@@ -3,3 +3,8 @@ export * as expect from "./expect/index.js";
|
|
|
3
3
|
export * as is from "./is/index.js";
|
|
4
4
|
export * as object from "./object/index.js";
|
|
5
5
|
export * as singleton from "./singleton/index.js";
|
|
6
|
+
/** @type {typeof originalValibot & { _parse: any }} */
|
|
7
|
+
export const v: typeof originalValibot & {
|
|
8
|
+
_parse: any;
|
|
9
|
+
};
|
|
10
|
+
import * as originalValibot from 'valibot';
|
package/dist/util/index.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
export { rethrow } from './exceptions/index.js';
|
|
2
2
|
|
|
3
|
+
import * as originalValibot from 'valibot';
|
|
4
|
+
|
|
5
|
+
// Create a modified version of valibot with wrapped parse methods
|
|
6
|
+
|
|
7
|
+
/** @type {typeof originalValibot & { _parse: any }} */
|
|
8
|
+
const v = { ...originalValibot, _parse: originalValibot.parse };
|
|
9
|
+
|
|
10
|
+
// Replace with wrappers for better stack trace detection
|
|
11
|
+
v.parse = function valibotParseWrapper(schema, input, config) {
|
|
12
|
+
return this._parse(schema, input, config);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { v };
|
|
3
16
|
export * as expect from './expect/index.js';
|
|
4
17
|
export * as is from './is/index.js';
|
|
5
18
|
export * as object from './object/index.js';
|
package/dist/util/is/index.d.ts
CHANGED
|
@@ -55,9 +55,10 @@ export function iterable(value: any): boolean;
|
|
|
55
55
|
*
|
|
56
56
|
* @param {any} value
|
|
57
57
|
*
|
|
58
|
-
* @returns {
|
|
58
|
+
* @returns {value is object}
|
|
59
|
+
* True if the value is an Object, but not a Promise
|
|
59
60
|
*/
|
|
60
|
-
export function object(value: any):
|
|
61
|
+
export function object(value: any): value is object;
|
|
61
62
|
export { argumentsCheck as arguments };
|
|
62
63
|
/**
|
|
63
64
|
* Check if a value is an Arguments object
|
package/dist/util/is/index.js
CHANGED
|
@@ -129,7 +129,8 @@ export function iterable(value) {
|
|
|
129
129
|
*
|
|
130
130
|
* @param {any} value
|
|
131
131
|
*
|
|
132
|
-
* @returns {
|
|
132
|
+
* @returns {value is object}
|
|
133
|
+
* True if the value is an Object, but not a Promise
|
|
133
134
|
*/
|
|
134
135
|
export function object(value) {
|
|
135
136
|
if (!(value instanceof Object)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {import('../../
|
|
2
|
+
* @typedef {import('../../generic/typedef.js').IterableTreeOptions} IterableTreeOptions
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Filter all iterated elements
|
|
@@ -45,7 +45,7 @@ export function map(iterable: Iterable<any>, transformFn: Function): Generator;
|
|
|
45
45
|
* @param {boolean} [options.depthFirst=true]
|
|
46
46
|
* If true, use depth-first traversal, otherwise breadth-first
|
|
47
47
|
*
|
|
48
|
-
* @return {
|
|
48
|
+
* @return {Iterable<[string[], any]>} iterable that yields [path, value] pairs
|
|
49
49
|
*/
|
|
50
50
|
export function iterateObjectEntries(obj: object, options?: {
|
|
51
51
|
walkArrays?: boolean;
|
|
@@ -53,19 +53,17 @@ export function iterateObjectEntries(obj: object, options?: {
|
|
|
53
53
|
outputIntermediateNodes?: boolean;
|
|
54
54
|
ignoreEmptyObjectLeaves?: boolean;
|
|
55
55
|
depthFirst?: boolean;
|
|
56
|
-
}):
|
|
56
|
+
}): Iterable<[string[], any]>;
|
|
57
57
|
/**
|
|
58
58
|
* Get an Iterator object that can be used to iterate over all paths in
|
|
59
59
|
* the object
|
|
60
60
|
*
|
|
61
61
|
* @param {object} obj - Object to iterate
|
|
62
|
-
* @param {IterableTreeOptions
|
|
62
|
+
* @param {import('../../generic/data/classes/typedef.js').IterableTreeOptions} [options]
|
|
63
63
|
*
|
|
64
64
|
* @return {Iterable<string[]>} iterable object that yields path arrays
|
|
65
65
|
*/
|
|
66
|
-
export function iterateObjectPaths(obj: object, options?: IterableTreeOptions
|
|
67
|
-
depthFirst: boolean;
|
|
68
|
-
}): Iterable<string[]>;
|
|
66
|
+
export function iterateObjectPaths(obj: object, options?: import("../../generic/data/classes/typedef.js").IterableTreeOptions): Iterable<string[]>;
|
|
69
67
|
/**
|
|
70
68
|
* Get an Iterator object that can be used to iterate over all values in
|
|
71
69
|
* the object (at the leaves of the object tree)
|
|
@@ -96,4 +94,4 @@ export function sortObjects({ it, getValueFn, reversed }: {
|
|
|
96
94
|
getValueFn: Function;
|
|
97
95
|
reversed?: boolean;
|
|
98
96
|
}): Promise<any[]>;
|
|
99
|
-
export type IterableTreeOptions = import("../../
|
|
97
|
+
export type IterableTreeOptions = import("../../generic/typedef.js").IterableTreeOptions;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import * as expect from '../expect/index.js';
|
|
4
4
|
import { smallestFirst, largestFirst } from '../compare/index.js';
|
|
5
5
|
|
|
6
|
-
import IterableTree from '../../
|
|
6
|
+
import { IterableTree } from '../../generic/data.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @typedef {import('../../
|
|
9
|
+
* @typedef {import('../../generic/typedef.js').IterableTreeOptions} IterableTreeOptions
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/* ------------------------------------------------------------------ Exports */
|
|
@@ -77,7 +77,7 @@ export function* map(iterable, transformFn) {
|
|
|
77
77
|
* @param {boolean} [options.depthFirst=true]
|
|
78
78
|
* If true, use depth-first traversal, otherwise breadth-first
|
|
79
79
|
*
|
|
80
|
-
* @return {
|
|
80
|
+
* @return {Iterable<[string[], any]>} iterable that yields [path, value] pairs
|
|
81
81
|
*/
|
|
82
82
|
export function iterateObjectEntries(obj, options = {}) {
|
|
83
83
|
let objectIterator;
|
|
@@ -108,11 +108,11 @@ export function iterateObjectEntries(obj, options = {}) {
|
|
|
108
108
|
* the object
|
|
109
109
|
*
|
|
110
110
|
* @param {object} obj - Object to iterate
|
|
111
|
-
* @param {IterableTreeOptions
|
|
111
|
+
* @param {import('../../generic/data/classes/typedef.js').IterableTreeOptions} [options]
|
|
112
112
|
*
|
|
113
113
|
* @return {Iterable<string[]>} iterable object that yields path arrays
|
|
114
114
|
*/
|
|
115
|
-
export function iterateObjectPaths(obj, options) {
|
|
115
|
+
export function iterateObjectPaths(obj, options = {}) {
|
|
116
116
|
let objectIterator;
|
|
117
117
|
|
|
118
118
|
const depthFirst =
|
|
@@ -93,9 +93,8 @@ export function objectSet(obj: object, path: string | any[], value: any, ...args
|
|
|
93
93
|
* Removes a value at the specified object path from the object.
|
|
94
94
|
* - All parent objects that remain empty will be removed too (recursively)
|
|
95
95
|
*
|
|
96
|
-
* @param {object} obj - Object to
|
|
96
|
+
* @param {object} obj - Object to delete the path from
|
|
97
97
|
* @param {string|Array} path - Dot separated string path or array path
|
|
98
|
-
* @param {any} value - value to set
|
|
99
98
|
*/
|
|
100
99
|
export function deletePath(obj: object, path: string | any[]): void;
|
|
101
100
|
/**
|
|
@@ -382,9 +382,8 @@ export function objectSet(obj, path, value) {
|
|
|
382
382
|
* Removes a value at the specified object path from the object.
|
|
383
383
|
* - All parent objects that remain empty will be removed too (recursively)
|
|
384
384
|
*
|
|
385
|
-
* @param {object} obj - Object to
|
|
385
|
+
* @param {object} obj - Object to delete the path from
|
|
386
386
|
* @param {string|Array} path - Dot separated string path or array path
|
|
387
|
-
* @param {any} value - value to set
|
|
388
387
|
*/
|
|
389
388
|
export function deletePath(obj, path) {
|
|
390
389
|
expect.object(obj);
|
|
@@ -777,7 +776,7 @@ export function patchObject(obj, changes, options = {}) {
|
|
|
777
776
|
throw new Error(`Cannot set value [${path}=undefined]`);
|
|
778
777
|
}
|
|
779
778
|
|
|
780
|
-
if (ignoreAdd &&
|
|
779
|
+
if (ignoreAdd && objectGet(obj, path) === undefined) {
|
|
781
780
|
// Ignore add
|
|
782
781
|
continue;
|
|
783
782
|
} else if (ignoreUpdate && objectGet(obj, path) !== undefined) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR context detection and prevention utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Detect if we're being called during SSR/build evaluation
|
|
6
|
+
* This helps catch improper usage that causes serialization issues
|
|
7
|
+
*
|
|
8
|
+
* @returns {boolean} True if in SSR context
|
|
9
|
+
*/
|
|
10
|
+
export function detectSSRContext(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Throws an error if called during SSR context with helpful guidance
|
|
13
|
+
*
|
|
14
|
+
* @throws {Error} When called in SSR context
|
|
15
|
+
*/
|
|
16
|
+
export function expectNoSSRContext(): void;
|