@hyper-fetch/react 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -2
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.d.ts +674 -12
- package/dist/index.esm.js.map +2 -2
- package/package.json +2 -2
- package/src/hooks/use-event-messages/use-event-messages.hooks.ts +2 -2
- package/src/hooks/use-fetch/use-fetch.hooks.ts +5 -5
- package/dist/config-provider/config-provider.d.ts +0 -13
- package/dist/config-provider/config-provider.types.d.ts +0 -23
- package/dist/config-provider/index.d.ts +0 -2
- package/dist/helpers/index.d.ts +0 -3
- package/dist/helpers/use-request-events/index.d.ts +0 -2
- package/dist/helpers/use-request-events/use-request-events.hooks.d.ts +0 -8
- package/dist/helpers/use-request-events/use-request-events.types.d.ts +0 -80
- package/dist/helpers/use-socket-state/index.d.ts +0 -3
- package/dist/helpers/use-socket-state/use-socket-state.constants.d.ts +0 -2
- package/dist/helpers/use-socket-state/use-socket-state.hooks.d.ts +0 -16
- package/dist/helpers/use-socket-state/use-socket-state.types.d.ts +0 -9
- package/dist/helpers/use-tracked-state/index.d.ts +0 -4
- package/dist/helpers/use-tracked-state/use-tracked-state.constants.d.ts +0 -2
- package/dist/helpers/use-tracked-state/use-tracked-state.hooks.d.ts +0 -10
- package/dist/helpers/use-tracked-state/use-tracked-state.types.d.ts +0 -72
- package/dist/helpers/use-tracked-state/use-tracked-state.utils.d.ts +0 -7
- package/dist/hooks/use-app-manager/index.d.ts +0 -2
- package/dist/hooks/use-app-manager/use-app-manager.hooks.d.ts +0 -2
- package/dist/hooks/use-app-manager/use-app-manager.types.d.ts +0 -18
- package/dist/hooks/use-cache/index.d.ts +0 -3
- package/dist/hooks/use-cache/use-cache.constants.d.ts +0 -5
- package/dist/hooks/use-cache/use-cache.hooks.d.ts +0 -2
- package/dist/hooks/use-cache/use-cache.types.d.ts +0 -35
- package/dist/hooks/use-emitter/index.d.ts +0 -2
- package/dist/hooks/use-emitter/use-emitter.hooks.d.ts +0 -19
- package/dist/hooks/use-emitter/use-emitter.types.d.ts +0 -3
- package/dist/hooks/use-event-messages/index.d.ts +0 -2
- package/dist/hooks/use-event-messages/use-event-messages.hooks.d.ts +0 -24
- package/dist/hooks/use-event-messages/use-event-messages.types.d.ts +0 -4
- package/dist/hooks/use-fetch/index.d.ts +0 -4
- package/dist/hooks/use-fetch/use-fetch.constants.d.ts +0 -7
- package/dist/hooks/use-fetch/use-fetch.hooks.d.ts +0 -8
- package/dist/hooks/use-fetch/use-fetch.types.d.ts +0 -89
- package/dist/hooks/use-fetch/use-fetch.utils.d.ts +0 -1
- package/dist/hooks/use-listener/index.d.ts +0 -2
- package/dist/hooks/use-listener/use-listener.hooks.d.ts +0 -20
- package/dist/hooks/use-listener/use-listener.types.d.ts +0 -3
- package/dist/hooks/use-queue/index.d.ts +0 -3
- package/dist/hooks/use-queue/use-queue.constants.d.ts +0 -3
- package/dist/hooks/use-queue/use-queue.hooks.d.ts +0 -8
- package/dist/hooks/use-queue/use-queue.types.d.ts +0 -48
- package/dist/hooks/use-submit/index.d.ts +0 -3
- package/dist/hooks/use-submit/use-submit.constants.d.ts +0 -7
- package/dist/hooks/use-submit/use-submit.hooks.d.ts +0 -8
- package/dist/hooks/use-submit/use-submit.types.d.ts +0 -105
- package/dist/types/index.d.ts +0 -1
- package/dist/types/invalidation.types.d.ts +0 -2
- package/dist/utils/bounce.utils.d.ts +0 -7
- package/dist/utils/deep-equal.utils.d.ts +0 -13
- package/dist/utils/index.d.ts +0 -2
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { CacheValueType, ExtractErrorType, ExtractResponseType, RequestInstance, RequestSendType } from "@hyper-fetch/core";
|
|
2
|
-
import { isEqual } from "utils";
|
|
3
|
-
import { OnErrorCallbackType, OnFinishedCallbackType, OnProgressCallbackType, OnStartCallbackType, OnSuccessCallbackType, UseTrackedStateType, UseTrackedStateActions } from "helpers";
|
|
4
|
-
import { InvalidationKeyType } from "types";
|
|
5
|
-
export type UseSubmitOptionsType<T extends RequestInstance> = {
|
|
6
|
-
/**
|
|
7
|
-
* Disable fetching
|
|
8
|
-
*/
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* If cache is empty we can use placeholder data.
|
|
12
|
-
*/
|
|
13
|
-
initialData?: CacheValueType<ExtractResponseType<T>, ExtractErrorType<T>>["data"] | null;
|
|
14
|
-
/**
|
|
15
|
-
* Enable/disable debouncing for often changing keys or refreshing, to limit requests to server.
|
|
16
|
-
*/
|
|
17
|
-
bounce?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Possibility to choose between debounce and throttle approaches
|
|
20
|
-
*/
|
|
21
|
-
bounceType?: "debounce" | "throttle";
|
|
22
|
-
/**
|
|
23
|
-
* How long it should bounce requests.
|
|
24
|
-
*/
|
|
25
|
-
bounceTime?: number;
|
|
26
|
-
/**
|
|
27
|
-
* ONLY in throttle mode - options for handling last bounce event
|
|
28
|
-
*/
|
|
29
|
-
bounceTimeout?: number;
|
|
30
|
-
/**
|
|
31
|
-
* If `true` it will rerender only when values used by our component gets changed. Otherwise it will rerender on any change.
|
|
32
|
-
*/
|
|
33
|
-
dependencyTracking?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Deep comparison function for hook to check for equality in incoming data, to limit rerenders.
|
|
36
|
-
*/
|
|
37
|
-
deepCompare?: boolean | typeof isEqual;
|
|
38
|
-
};
|
|
39
|
-
export type UseSubmitReturnType<RequestType extends RequestInstance> = Omit<UseTrackedStateType<RequestType>, "loading"> & UseTrackedStateActions<RequestType> & {
|
|
40
|
-
/**
|
|
41
|
-
* Callback which allows to cancel ongoing requests from given queueKey.
|
|
42
|
-
*/
|
|
43
|
-
abort: () => void;
|
|
44
|
-
/**
|
|
45
|
-
* Helper hook listening on success response.
|
|
46
|
-
*/
|
|
47
|
-
onSubmitSuccess: (callback: OnSuccessCallbackType<RequestType>) => void;
|
|
48
|
-
/**
|
|
49
|
-
* Helper hook listening on error response.
|
|
50
|
-
*/
|
|
51
|
-
onSubmitError: (callback: OnErrorCallbackType<RequestType>) => void;
|
|
52
|
-
/**
|
|
53
|
-
* Helper hook listening on any response.
|
|
54
|
-
*/
|
|
55
|
-
onSubmitFinished: (callback: OnFinishedCallbackType<RequestType>) => void;
|
|
56
|
-
/**
|
|
57
|
-
* Helper hook listening on request start.
|
|
58
|
-
*/
|
|
59
|
-
onSubmitRequestStart: (callback: OnStartCallbackType<RequestType>) => void;
|
|
60
|
-
/**
|
|
61
|
-
* Helper hook listening on response start(before we receive all data from server).
|
|
62
|
-
*/
|
|
63
|
-
onSubmitResponseStart: (callback: OnStartCallbackType<RequestType>) => void;
|
|
64
|
-
/**
|
|
65
|
-
* Helper hook listening on download progress ETA. We can later match given requests by their id's or request instance which holds all data which is being transferred.
|
|
66
|
-
*/
|
|
67
|
-
onSubmitDownloadProgress: (callback: OnProgressCallbackType) => void;
|
|
68
|
-
/**
|
|
69
|
-
* Helper hook listening on upload progress ETA. We can later match given requests by their id's or request instance which holds all data which is being transferred.
|
|
70
|
-
*/
|
|
71
|
-
onSubmitUploadProgress: (callback: OnProgressCallbackType) => void;
|
|
72
|
-
/**
|
|
73
|
-
* Helper hook listening on aborting of requests. Abort events are not triggering onError callbacks.
|
|
74
|
-
*/
|
|
75
|
-
onSubmitAbort: (callback: OnErrorCallbackType<RequestType>) => void;
|
|
76
|
-
/**
|
|
77
|
-
* Helper hook listening on request going into offline awaiting for network connection to be restored. It will not trigger onError when 'offline' mode is set on request.
|
|
78
|
-
*/
|
|
79
|
-
onSubmitOfflineError: (callback: OnErrorCallbackType<RequestType>) => void;
|
|
80
|
-
/**
|
|
81
|
-
* Method responsible for triggering requests. It return Promise which will be resolved with the request.
|
|
82
|
-
*/
|
|
83
|
-
submit: RequestSendType<RequestType>;
|
|
84
|
-
/**
|
|
85
|
-
* Request loading state
|
|
86
|
-
*/
|
|
87
|
-
submitting: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Data related to current state of the bounce usage
|
|
90
|
-
*/
|
|
91
|
-
bounce: {
|
|
92
|
-
/**
|
|
93
|
-
* Active state of the bounce method
|
|
94
|
-
*/
|
|
95
|
-
active: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Method to stop the active bounce method execution
|
|
98
|
-
*/
|
|
99
|
-
reset: () => void;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Revalidate current request resource or pass custom key to trigger it by invalidationKey(Regex / cacheKey).
|
|
103
|
-
*/
|
|
104
|
-
revalidate: (invalidateKey: InvalidationKeyType | InvalidationKeyType[]) => void;
|
|
105
|
-
};
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./invalidation.types";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check if value is empty
|
|
3
|
-
* @param value any object or primitive
|
|
4
|
-
* @returns true when value is empty
|
|
5
|
-
*/
|
|
6
|
-
export declare const isEmpty: (value: unknown) => boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Allow to deep compare any passed values
|
|
9
|
-
* @param firstValue unknown
|
|
10
|
-
* @param secondValue unknown
|
|
11
|
-
* @returns true when elements are equal
|
|
12
|
-
*/
|
|
13
|
-
export declare const isEqual: (firstValue: unknown, secondValue: unknown) => boolean;
|
package/dist/utils/index.d.ts
DELETED