@data-client/core 0.1.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/LICENSE +201 -0
- package/README.md +71 -0
- package/dist/index.js +1643 -0
- package/dist/index.umd.min.js +1 -0
- package/dist/next.js +461 -0
- package/dist/package.json +1 -0
- package/legacy/actionTypes.js +12 -0
- package/legacy/compatibleActions.js +2 -0
- package/legacy/controller/BaseController.js +289 -0
- package/legacy/controller/Controller.js +20 -0
- package/legacy/controller/createFetch.js +42 -0
- package/legacy/controller/createInvalidate.js +12 -0
- package/legacy/controller/createInvalidateAll.js +8 -0
- package/legacy/controller/createOptimistic.js +33 -0
- package/legacy/controller/createReceive.js +36 -0
- package/legacy/controller/createReset.js +8 -0
- package/legacy/controller/createSubscription.js +30 -0
- package/legacy/controller/types.js +2 -0
- package/legacy/endpoint/index.js +2 -0
- package/legacy/endpoint/shapes.js +2 -0
- package/legacy/endpoint/types.js +2 -0
- package/legacy/fsa.js +2 -0
- package/legacy/index.js +22 -0
- package/legacy/internal.js +4 -0
- package/legacy/legacyActions.js +2 -0
- package/legacy/manager/ConnectionListener.js +2 -0
- package/legacy/manager/DefaultConnectionListener.js +40 -0
- package/legacy/manager/DevtoolsManager.js +73 -0
- package/legacy/manager/LogoutManager.js +34 -0
- package/legacy/manager/NetworkManager.js +291 -0
- package/legacy/manager/PollingSubscription.js +159 -0
- package/legacy/manager/SubscriptionManager.js +117 -0
- package/legacy/manager/applyManager.js +23 -0
- package/legacy/manager/devtoolsTypes.js +2 -0
- package/legacy/manager/index.js +6 -0
- package/legacy/middlewareTypes.js +2 -0
- package/legacy/newActions.js +2 -0
- package/legacy/next/Controller.js +24 -0
- package/legacy/next/index.js +3 -0
- package/legacy/previousActions.js +2 -0
- package/legacy/state/RIC.js +3 -0
- package/legacy/state/applyUpdatersToResults.js +4 -0
- package/legacy/state/legacy-actions/createFetch.js +62 -0
- package/legacy/state/legacy-actions/createReceive.js +37 -0
- package/legacy/state/legacy-actions/createReceiveError.js +28 -0
- package/legacy/state/legacy-actions/index.js +4 -0
- package/legacy/state/reducer/createReducer.js +54 -0
- package/legacy/state/reducer/fetchReducer.js +32 -0
- package/legacy/state/reducer/invalidateReducer.js +28 -0
- package/legacy/state/reducer/setReducer.js +113 -0
- package/legacy/state/reducerInstance.js +9 -0
- package/legacy/state/selectMeta.js +4 -0
- package/legacy/types.js +8 -0
- package/lib/actionTypes.d.ts +11 -0
- package/lib/actionTypes.d.ts.map +1 -0
- package/lib/actionTypes.js +12 -0
- package/lib/compatibleActions.d.ts +47 -0
- package/lib/compatibleActions.d.ts.map +1 -0
- package/lib/compatibleActions.js +2 -0
- package/lib/controller/BaseController.d.ts +128 -0
- package/lib/controller/BaseController.d.ts.map +1 -0
- package/lib/controller/BaseController.js +289 -0
- package/lib/controller/Controller.d.ts +14 -0
- package/lib/controller/Controller.d.ts.map +1 -0
- package/lib/controller/Controller.js +20 -0
- package/lib/controller/createFetch.d.ts +12 -0
- package/lib/controller/createFetch.d.ts.map +1 -0
- package/lib/controller/createFetch.js +42 -0
- package/lib/controller/createInvalidate.d.ts +6 -0
- package/lib/controller/createInvalidate.d.ts.map +1 -0
- package/lib/controller/createInvalidate.js +12 -0
- package/lib/controller/createInvalidateAll.d.ts +3 -0
- package/lib/controller/createInvalidateAll.d.ts.map +1 -0
- package/lib/controller/createInvalidateAll.js +8 -0
- package/lib/controller/createOptimistic.d.ts +10 -0
- package/lib/controller/createOptimistic.d.ts.map +1 -0
- package/lib/controller/createOptimistic.js +33 -0
- package/lib/controller/createReceive.d.ts +20 -0
- package/lib/controller/createReceive.d.ts.map +1 -0
- package/lib/controller/createReceive.js +36 -0
- package/lib/controller/createReset.d.ts +3 -0
- package/lib/controller/createReset.d.ts.map +1 -0
- package/lib/controller/createReset.js +8 -0
- package/lib/controller/createSubscription.d.ts +9 -0
- package/lib/controller/createSubscription.d.ts.map +1 -0
- package/lib/controller/createSubscription.js +30 -0
- package/lib/controller/types.d.ts +6 -0
- package/lib/controller/types.d.ts.map +1 -0
- package/lib/controller/types.js +2 -0
- package/lib/endpoint/index.d.ts +3 -0
- package/lib/endpoint/index.d.ts.map +1 -0
- package/lib/endpoint/index.js +2 -0
- package/lib/endpoint/shapes.d.ts +25 -0
- package/lib/endpoint/shapes.d.ts.map +1 -0
- package/lib/endpoint/shapes.js +2 -0
- package/lib/endpoint/types.d.ts +45 -0
- package/lib/endpoint/types.d.ts.map +1 -0
- package/lib/endpoint/types.js +2 -0
- package/lib/fsa.d.ts +41 -0
- package/lib/fsa.d.ts.map +1 -0
- package/lib/fsa.js +2 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +22 -0
- package/lib/internal.d.ts +4 -0
- package/lib/internal.d.ts.map +1 -0
- package/lib/internal.js +4 -0
- package/lib/legacyActions.d.ts +92 -0
- package/lib/legacyActions.d.ts.map +1 -0
- package/lib/legacyActions.js +2 -0
- package/lib/manager/ConnectionListener.d.ts +8 -0
- package/lib/manager/ConnectionListener.d.ts.map +1 -0
- package/lib/manager/ConnectionListener.js +2 -0
- package/lib/manager/DefaultConnectionListener.d.ts +20 -0
- package/lib/manager/DefaultConnectionListener.d.ts.map +1 -0
- package/lib/manager/DefaultConnectionListener.js +40 -0
- package/lib/manager/DevtoolsManager.d.ts +24 -0
- package/lib/manager/DevtoolsManager.d.ts.map +1 -0
- package/lib/manager/DevtoolsManager.js +74 -0
- package/lib/manager/LogoutManager.d.ts +25 -0
- package/lib/manager/LogoutManager.d.ts.map +1 -0
- package/lib/manager/LogoutManager.js +34 -0
- package/lib/manager/NetworkManager.d.ts +82 -0
- package/lib/manager/NetworkManager.d.ts.map +1 -0
- package/lib/manager/NetworkManager.js +295 -0
- package/lib/manager/PollingSubscription.d.ts +45 -0
- package/lib/manager/PollingSubscription.d.ts.map +1 -0
- package/lib/manager/PollingSubscription.js +159 -0
- package/lib/manager/SubscriptionManager.d.ts +55 -0
- package/lib/manager/SubscriptionManager.d.ts.map +1 -0
- package/lib/manager/SubscriptionManager.js +117 -0
- package/lib/manager/applyManager.d.ts +10 -0
- package/lib/manager/applyManager.d.ts.map +1 -0
- package/lib/manager/applyManager.js +23 -0
- package/lib/manager/devtoolsTypes.d.ts +205 -0
- package/lib/manager/devtoolsTypes.d.ts.map +1 -0
- package/lib/manager/devtoolsTypes.js +2 -0
- package/lib/manager/index.d.ts +8 -0
- package/lib/manager/index.d.ts.map +1 -0
- package/lib/manager/index.js +6 -0
- package/lib/middlewareTypes.d.ts +18 -0
- package/lib/middlewareTypes.d.ts.map +1 -0
- package/lib/middlewareTypes.js +2 -0
- package/lib/newActions.d.ts +85 -0
- package/lib/newActions.d.ts.map +1 -0
- package/lib/newActions.js +2 -0
- package/lib/next/Controller.d.ts +14 -0
- package/lib/next/Controller.d.ts.map +1 -0
- package/lib/next/Controller.js +24 -0
- package/lib/next/index.d.ts +3 -0
- package/lib/next/index.d.ts.map +1 -0
- package/lib/next/index.js +3 -0
- package/lib/previousActions.d.ts +91 -0
- package/lib/previousActions.d.ts.map +1 -0
- package/lib/previousActions.js +2 -0
- package/lib/state/RIC.d.ts +2 -0
- package/lib/state/RIC.js +3 -0
- package/lib/state/applyUpdatersToResults.d.ts +13 -0
- package/lib/state/applyUpdatersToResults.d.ts.map +1 -0
- package/lib/state/applyUpdatersToResults.js +7 -0
- package/lib/state/legacy-actions/createFetch.d.ts +19 -0
- package/lib/state/legacy-actions/createFetch.d.ts.map +1 -0
- package/lib/state/legacy-actions/createFetch.js +62 -0
- package/lib/state/legacy-actions/createReceive.d.ts +14 -0
- package/lib/state/legacy-actions/createReceive.d.ts.map +1 -0
- package/lib/state/legacy-actions/createReceive.js +37 -0
- package/lib/state/legacy-actions/createReceiveError.d.ts +9 -0
- package/lib/state/legacy-actions/createReceiveError.d.ts.map +1 -0
- package/lib/state/legacy-actions/createReceiveError.js +28 -0
- package/lib/state/legacy-actions/index.d.ts +4 -0
- package/lib/state/legacy-actions/index.d.ts.map +1 -0
- package/lib/state/legacy-actions/index.js +4 -0
- package/lib/state/reducer/createReducer.d.ts +7 -0
- package/lib/state/reducer/createReducer.d.ts.map +1 -0
- package/lib/state/reducer/createReducer.js +55 -0
- package/lib/state/reducer/fetchReducer.d.ts +4 -0
- package/lib/state/reducer/fetchReducer.d.ts.map +1 -0
- package/lib/state/reducer/fetchReducer.js +34 -0
- package/lib/state/reducer/invalidateReducer.d.ts +37 -0
- package/lib/state/reducer/invalidateReducer.d.ts.map +1 -0
- package/lib/state/reducer/invalidateReducer.js +34 -0
- package/lib/state/reducer/setReducer.d.ts +40 -0
- package/lib/state/reducer/setReducer.d.ts.map +1 -0
- package/lib/state/reducer/setReducer.js +119 -0
- package/lib/state/reducerInstance.d.ts +7 -0
- package/lib/state/reducerInstance.d.ts.map +1 -0
- package/lib/state/reducerInstance.js +9 -0
- package/lib/state/selectMeta.d.ts +3 -0
- package/lib/state/selectMeta.d.ts.map +1 -0
- package/lib/state/selectMeta.js +4 -0
- package/lib/types.d.ts +71 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +8 -0
- package/node.mjs +1 -0
- package/package.json +127 -0
- package/src/actionTypes.ts +11 -0
- package/src/compatibleActions.ts +96 -0
- package/src/controller/BaseController.ts +508 -0
- package/src/controller/Controller.ts +32 -0
- package/src/controller/__tests__/Controller.ts +29 -0
- package/src/controller/__tests__/__snapshots__/getResponse.ts.snap +35 -0
- package/src/controller/__tests__/getResponse.ts +182 -0
- package/src/controller/createFetch.ts +54 -0
- package/src/controller/createInvalidate.ts +16 -0
- package/src/controller/createInvalidateAll.ts +11 -0
- package/src/controller/createOptimistic.ts +47 -0
- package/src/controller/createReceive.ts +85 -0
- package/src/controller/createReset.ts +9 -0
- package/src/controller/createSubscription.ts +39 -0
- package/src/controller/types.ts +22 -0
- package/src/endpoint/index.ts +14 -0
- package/src/endpoint/shapes.ts +53 -0
- package/src/endpoint/types.ts +72 -0
- package/src/fsa.ts +99 -0
- package/src/index.ts +61 -0
- package/src/internal.ts +3 -0
- package/src/legacyActions.ts +163 -0
- package/src/manager/ConnectionListener.ts +7 -0
- package/src/manager/DefaultConnectionListener.ts +54 -0
- package/src/manager/DevtoolsManager.ts +99 -0
- package/src/manager/LogoutManager.ts +57 -0
- package/src/manager/NetworkManager.ts +346 -0
- package/src/manager/PollingSubscription.ts +190 -0
- package/src/manager/SubscriptionManager.ts +156 -0
- package/src/manager/__tests__/__snapshots__/pollingSubscription-endpoint.ts.snap +49 -0
- package/src/manager/__tests__/__snapshots__/pollingSubscription.ts.snap +43 -0
- package/src/manager/__tests__/logoutManager.ts +112 -0
- package/src/manager/__tests__/manager.ts +44 -0
- package/src/manager/__tests__/networkManager-legacy.ts +394 -0
- package/src/manager/__tests__/networkManager.ts +426 -0
- package/src/manager/__tests__/pollingSubscription-endpoint.ts +423 -0
- package/src/manager/__tests__/pollingSubscription.ts +313 -0
- package/src/manager/__tests__/subscriptionManager.ts +208 -0
- package/src/manager/applyManager.ts +33 -0
- package/src/manager/devtoolsTypes.ts +210 -0
- package/src/manager/index.ts +7 -0
- package/src/middlewareTypes.ts +49 -0
- package/src/newActions.ts +140 -0
- package/src/next/Controller.ts +39 -0
- package/src/next/index.ts +2 -0
- package/src/package.json +1 -0
- package/src/previousActions.ts +159 -0
- package/src/state/RIC.d.ts +2 -0
- package/src/state/RIC.js +5 -0
- package/src/state/__tests__/RIC.web.ts +16 -0
- package/src/state/__tests__/__snapshots__/reducer.ts.snap +56 -0
- package/src/state/__tests__/applyUpdatersToResults.ts +40 -0
- package/src/state/__tests__/reducer.ts +868 -0
- package/src/state/applyUpdatersToResults.ts +29 -0
- package/src/state/legacy-actions/createFetch.ts +95 -0
- package/src/state/legacy-actions/createReceive.ts +68 -0
- package/src/state/legacy-actions/createReceiveError.ts +43 -0
- package/src/state/legacy-actions/index.ts +3 -0
- package/src/state/reducer/createReducer.ts +80 -0
- package/src/state/reducer/fetchReducer.ts +48 -0
- package/src/state/reducer/invalidateReducer.ts +39 -0
- package/src/state/reducer/setReducer.ts +157 -0
- package/src/state/reducerInstance.ts +14 -0
- package/src/state/selectMeta.ts +8 -0
- package/src/types.ts +125 -0
- package/ts3.4/actionTypes.d.ts +11 -0
- package/ts3.4/compatibleActions.d.ts +47 -0
- package/ts3.4/controller/BaseController.d.ts +170 -0
- package/ts3.4/controller/Controller.d.ts +14 -0
- package/ts3.4/controller/createFetch.d.ts +14 -0
- package/ts3.4/controller/createInvalidate.d.ts +8 -0
- package/ts3.4/controller/createInvalidateAll.d.ts +3 -0
- package/ts3.4/controller/createOptimistic.d.ts +12 -0
- package/ts3.4/controller/createReceive.d.ts +24 -0
- package/ts3.4/controller/createReset.d.ts +3 -0
- package/ts3.4/controller/createSubscription.d.ts +13 -0
- package/ts3.4/controller/types.d.ts +6 -0
- package/ts3.4/endpoint/index.d.ts +3 -0
- package/ts3.4/endpoint/shapes.d.ts +25 -0
- package/ts3.4/endpoint/types.d.ts +45 -0
- package/ts3.4/fsa.d.ts +41 -0
- package/ts3.4/index.d.ts +22 -0
- package/ts3.4/internal.d.ts +4 -0
- package/ts3.4/legacyActions.d.ts +95 -0
- package/ts3.4/manager/ConnectionListener.d.ts +8 -0
- package/ts3.4/manager/DefaultConnectionListener.d.ts +20 -0
- package/ts3.4/manager/DevtoolsManager.d.ts +24 -0
- package/ts3.4/manager/LogoutManager.d.ts +25 -0
- package/ts3.4/manager/NetworkManager.d.ts +82 -0
- package/ts3.4/manager/PollingSubscription.d.ts +45 -0
- package/ts3.4/manager/SubscriptionManager.d.ts +55 -0
- package/ts3.4/manager/applyManager.d.ts +10 -0
- package/ts3.4/manager/devtoolsTypes.d.ts +205 -0
- package/ts3.4/manager/index.d.ts +8 -0
- package/ts3.4/middlewareTypes.d.ts +18 -0
- package/ts3.4/newActions.d.ts +88 -0
- package/ts3.4/next/Controller.d.ts +14 -0
- package/ts3.4/next/index.d.ts +3 -0
- package/ts3.4/previousActions.d.ts +94 -0
- package/ts3.4/state/RIC.d.ts +2 -0
- package/ts3.4/state/applyUpdatersToResults.d.ts +13 -0
- package/ts3.4/state/legacy-actions/createFetch.d.ts +19 -0
- package/ts3.4/state/legacy-actions/createReceive.d.ts +14 -0
- package/ts3.4/state/legacy-actions/createReceiveError.d.ts +9 -0
- package/ts3.4/state/legacy-actions/index.d.ts +4 -0
- package/ts3.4/state/reducer/createReducer.d.ts +7 -0
- package/ts3.4/state/reducer/fetchReducer.d.ts +4 -0
- package/ts3.4/state/reducer/invalidateReducer.d.ts +37 -0
- package/ts3.4/state/reducer/setReducer.d.ts +40 -0
- package/ts3.4/state/reducerInstance.d.ts +7 -0
- package/ts3.4/state/selectMeta.d.ts +3 -0
- package/ts3.4/types.d.ts +73 -0
- package/typescript.svg +8 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { UpdateFunction, Schema, EndpointExtraOptions, EndpointInterface } from '@data-client/normalizr';
|
|
2
|
+
import { FSAWithPayloadAndMeta, FSAWithMeta } from 'flux-standard-action';
|
|
3
|
+
import { RECEIVE_TYPE, RESET_TYPE, FETCH_TYPE, SUBSCRIBE_TYPE, UNSUBSCRIBE_TYPE, INVALIDATE_TYPE, GC_TYPE, OPTIMISTIC_TYPE } from './actionTypes.js';
|
|
4
|
+
import { EndpointUpdateFunction } from './controller/types.js';
|
|
5
|
+
import { FetchShape } from './endpoint/index.js';
|
|
6
|
+
import { ErrorableFSAWithPayloadAndMeta } from './fsa.js';
|
|
7
|
+
export interface ReceiveMeta<S extends Schema | undefined> {
|
|
8
|
+
schema?: S;
|
|
9
|
+
key: string;
|
|
10
|
+
args?: readonly any[];
|
|
11
|
+
updaters?: Record<string, UpdateFunction<S, any>>;
|
|
12
|
+
update?: (result: any, ...args: any) => Record<string, (...args: any) => any>;
|
|
13
|
+
fetchedAt?: number;
|
|
14
|
+
date: number;
|
|
15
|
+
expiresAt: number;
|
|
16
|
+
errorPolicy?: (error: any) => 'hard' | 'soft' | undefined;
|
|
17
|
+
}
|
|
18
|
+
export type ReceiveAction<Payload extends object | string | number | null = object | string | number | null, S extends Schema | undefined = any> = ErrorableFSAWithPayloadAndMeta<typeof RECEIVE_TYPE, Payload, ReceiveMeta<S>>;
|
|
19
|
+
export type OptimisticAction<E extends EndpointInterface & {
|
|
20
|
+
update?: EndpointUpdateFunction<E>;
|
|
21
|
+
} = EndpointInterface & {
|
|
22
|
+
update?: EndpointUpdateFunction<EndpointInterface>;
|
|
23
|
+
}> = {
|
|
24
|
+
type: typeof OPTIMISTIC_TYPE;
|
|
25
|
+
meta: {
|
|
26
|
+
schema: E['schema'];
|
|
27
|
+
key: string;
|
|
28
|
+
args: readonly any[];
|
|
29
|
+
update?: (result: any, ...args: any) => Record<string, (...args: any) => any>;
|
|
30
|
+
fetchedAt: number;
|
|
31
|
+
date: number;
|
|
32
|
+
expiresAt: number;
|
|
33
|
+
errorPolicy?: (error: any) => 'hard' | 'soft' | undefined;
|
|
34
|
+
};
|
|
35
|
+
endpoint: E;
|
|
36
|
+
error?: undefined;
|
|
37
|
+
};
|
|
38
|
+
export interface ResetAction {
|
|
39
|
+
type: typeof RESET_TYPE;
|
|
40
|
+
date: number | Date;
|
|
41
|
+
}
|
|
42
|
+
interface FetchMeta<Payload extends object | string | number | null = object | string | number | null, S extends Schema | undefined = any> {
|
|
43
|
+
type: FetchShape<any, any>['type'];
|
|
44
|
+
schema?: S;
|
|
45
|
+
key: string;
|
|
46
|
+
args?: readonly any[];
|
|
47
|
+
updaters?: Record<string, UpdateFunction<S, any>>;
|
|
48
|
+
update?: (result: any, ...args: any) => Record<string, (...args: any) => any>;
|
|
49
|
+
options?: EndpointExtraOptions;
|
|
50
|
+
throttle: boolean;
|
|
51
|
+
resolve: (value?: any | PromiseLike<any>) => void;
|
|
52
|
+
reject: (reason?: any) => void;
|
|
53
|
+
promise: PromiseLike<any>;
|
|
54
|
+
createdAt: number | Date;
|
|
55
|
+
optimisticResponse?: Payload;
|
|
56
|
+
nm?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface FetchAction<Payload extends object | string | number | null = object | string | number | null, S extends Schema | undefined = any> extends FSAWithPayloadAndMeta<typeof FETCH_TYPE, () => Promise<Payload>, FetchMeta<any, any>> {
|
|
59
|
+
meta: FetchMeta<Payload, S>;
|
|
60
|
+
endpoint?: undefined;
|
|
61
|
+
}
|
|
62
|
+
export interface SubscribeAction extends FSAWithMeta<typeof SUBSCRIBE_TYPE, undefined, any> {
|
|
63
|
+
meta: {
|
|
64
|
+
args?: readonly any[];
|
|
65
|
+
schema: Schema | undefined;
|
|
66
|
+
fetch: () => Promise<any>;
|
|
67
|
+
key: string;
|
|
68
|
+
options: EndpointExtraOptions | undefined;
|
|
69
|
+
};
|
|
70
|
+
endpoint?: undefined;
|
|
71
|
+
}
|
|
72
|
+
export interface UnsubscribeAction extends FSAWithMeta<typeof UNSUBSCRIBE_TYPE, undefined, any> {
|
|
73
|
+
meta: {
|
|
74
|
+
args?: readonly any[];
|
|
75
|
+
key: string;
|
|
76
|
+
options: EndpointExtraOptions | undefined;
|
|
77
|
+
};
|
|
78
|
+
endpoint?: undefined;
|
|
79
|
+
}
|
|
80
|
+
export interface InvalidateAction extends FSAWithMeta<typeof INVALIDATE_TYPE, undefined, any> {
|
|
81
|
+
meta: {
|
|
82
|
+
key: string;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export interface GCAction {
|
|
86
|
+
type: typeof GC_TYPE;
|
|
87
|
+
entities: [
|
|
88
|
+
string,
|
|
89
|
+
string
|
|
90
|
+
][];
|
|
91
|
+
results: string[];
|
|
92
|
+
}
|
|
93
|
+
export type ActionTypes = FetchAction | OptimisticAction | ReceiveAction | SubscribeAction | UnsubscribeAction | InvalidateAction | ResetAction | GCAction;
|
|
94
|
+
export {};
|
|
95
|
+
//# sourceMappingURL=legacyActions.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default interface ConnectionListener {
|
|
2
|
+
isOnline: () => boolean;
|
|
3
|
+
addOnlineListener: (handler: () => void) => void;
|
|
4
|
+
removeOnlineListener: (handler: () => void) => void;
|
|
5
|
+
addOfflineListener: (handler: () => void) => void;
|
|
6
|
+
removeOfflineListener: (handler: () => void) => void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ConnectionListener.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ConnectionListener from './ConnectionListener.js';
|
|
2
|
+
export declare class BrowserConnectionListener implements ConnectionListener {
|
|
3
|
+
isOnline(): boolean;
|
|
4
|
+
addOnlineListener(handler: () => void): void;
|
|
5
|
+
removeOnlineListener(handler: () => void): void;
|
|
6
|
+
addOfflineListener(handler: () => void): void;
|
|
7
|
+
removeOfflineListener(handler: () => void): void;
|
|
8
|
+
}
|
|
9
|
+
export declare class AlwaysOnlineConnectionListener implements ConnectionListener {
|
|
10
|
+
isOnline(): boolean;
|
|
11
|
+
addOnlineListener(): void;
|
|
12
|
+
removeOnlineListener(): void;
|
|
13
|
+
addOfflineListener(): void;
|
|
14
|
+
removeOfflineListener(): void;
|
|
15
|
+
}
|
|
16
|
+
declare let DefaultConnectionListener: {
|
|
17
|
+
new (): ConnectionListener;
|
|
18
|
+
};
|
|
19
|
+
export default DefaultConnectionListener;
|
|
20
|
+
//# sourceMappingURL=DefaultConnectionListener.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DevToolsConfig } from './devtoolsTypes.js';
|
|
2
|
+
import { Middleware } from './LogoutManager.js';
|
|
3
|
+
import { Manager, State, ActionTypes } from '../types.js';
|
|
4
|
+
export { DevToolsConfig };
|
|
5
|
+
/** Integrates with https://github.com/reduxjs/redux-devtools
|
|
6
|
+
*
|
|
7
|
+
* Options: https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md
|
|
8
|
+
*
|
|
9
|
+
* @see https://resthooks.io/docs/api/DevToolsManager
|
|
10
|
+
*/
|
|
11
|
+
export default class DevToolsManager implements Manager {
|
|
12
|
+
protected middleware: Middleware;
|
|
13
|
+
protected devTools: undefined | any;
|
|
14
|
+
constructor(config?: DevToolsConfig, skipLogging?: (action: ActionTypes) => boolean);
|
|
15
|
+
/** Called when initial state is ready */
|
|
16
|
+
init(state: State<any>): void;
|
|
17
|
+
/** Ensures all subscriptions are cleaned up. */
|
|
18
|
+
cleanup(): void;
|
|
19
|
+
/** Attaches Manager to store
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
getMiddleware(): Middleware;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=DevtoolsManager.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Controller from '../controller/Controller.js';
|
|
2
|
+
import { UnknownError } from '../index.js';
|
|
3
|
+
import { CombinedActionTypes } from '../types.js';
|
|
4
|
+
import { Manager } from '../types.js';
|
|
5
|
+
/** Handling network unauthorized indicators like HTTP 401
|
|
6
|
+
*
|
|
7
|
+
* @see https://resthooks.io/docs/api/LogoutManager
|
|
8
|
+
*/
|
|
9
|
+
export default class LogoutManager implements Manager<CombinedActionTypes> {
|
|
10
|
+
protected middleware: Middleware;
|
|
11
|
+
constructor({ handleLogout, shouldLogout }?: Props);
|
|
12
|
+
cleanup(): void;
|
|
13
|
+
getMiddleware(): Middleware;
|
|
14
|
+
protected shouldLogout(error: UnknownError): boolean;
|
|
15
|
+
handleLogout(controller: Controller<Dispatch>): void;
|
|
16
|
+
}
|
|
17
|
+
type Dispatch = (value: CombinedActionTypes) => Promise<void>;
|
|
18
|
+
export type Middleware = <C extends Controller<Dispatch>>(controller: C) => (next: C['dispatch']) => C['dispatch'];
|
|
19
|
+
type HandleLogout = (controller: Controller<Dispatch>) => void;
|
|
20
|
+
interface Props {
|
|
21
|
+
handleLogout?: HandleLogout;
|
|
22
|
+
shouldLogout?: (error: UnknownError) => boolean;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=LogoutManager.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import Controller from '../controller/Controller.js';
|
|
2
|
+
import { FetchAction, ReceiveAction, Manager, ActionTypes, Middleware, State } from '../types.js';
|
|
3
|
+
export declare class ResetError extends Error {
|
|
4
|
+
name: string;
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
/** Handles all async network dispatches
|
|
8
|
+
*
|
|
9
|
+
* Dedupes concurrent requests by keeping track of all fetches in flight
|
|
10
|
+
* and returning existing promises for requests already in flight.
|
|
11
|
+
*
|
|
12
|
+
* Interfaces with store via a redux-compatible middleware.
|
|
13
|
+
*
|
|
14
|
+
* @see https://resthooks.io/docs/api/NetworkManager
|
|
15
|
+
*/
|
|
16
|
+
export default class NetworkManager implements Manager {
|
|
17
|
+
protected fetched: {
|
|
18
|
+
[k: string]: Promise<any>;
|
|
19
|
+
};
|
|
20
|
+
protected resolvers: {
|
|
21
|
+
[k: string]: (value?: any) => void;
|
|
22
|
+
};
|
|
23
|
+
protected rejectors: {
|
|
24
|
+
[k: string]: (value?: any) => void;
|
|
25
|
+
};
|
|
26
|
+
protected fetchedAt: {
|
|
27
|
+
[k: string]: number;
|
|
28
|
+
};
|
|
29
|
+
readonly dataExpiryLength: number;
|
|
30
|
+
readonly errorExpiryLength: number;
|
|
31
|
+
protected middleware: Middleware;
|
|
32
|
+
protected getState: () => State<unknown>;
|
|
33
|
+
protected controller: Controller;
|
|
34
|
+
cleanupDate?: number;
|
|
35
|
+
constructor(dataExpiryLength?: number, errorExpiryLength?: number);
|
|
36
|
+
/** Used by DevtoolsManager to determine whether to log an action */
|
|
37
|
+
skipLogging(action: ActionTypes): boolean;
|
|
38
|
+
/** On mount */
|
|
39
|
+
init(): void;
|
|
40
|
+
/** Ensures all promises are completed by rejecting remaining. */
|
|
41
|
+
cleanup(): void;
|
|
42
|
+
allSettled(): Promise<PromiseSettledResult<any>[]> | undefined;
|
|
43
|
+
/** Clear all promise state */
|
|
44
|
+
protected clearAll(): void;
|
|
45
|
+
/** Clear promise state for a given key */
|
|
46
|
+
protected clear(key: string): void;
|
|
47
|
+
protected getLastReset(): number;
|
|
48
|
+
/** Called when middleware intercepts 'rest-hooks/fetch' action.
|
|
49
|
+
*
|
|
50
|
+
* Will then start a promise for a key and potentially start the network
|
|
51
|
+
* fetch.
|
|
52
|
+
*
|
|
53
|
+
* Uses throttle only when instructed by action meta. This is valuable
|
|
54
|
+
* for ensures mutation requests always go through.
|
|
55
|
+
*/
|
|
56
|
+
protected handleFetch(action: FetchAction, dispatch: (action: any) => Promise<void>, controller: Controller): Promise<any>;
|
|
57
|
+
/** Called when middleware intercepts a receive action.
|
|
58
|
+
*
|
|
59
|
+
* Will resolve the promise associated with receive key.
|
|
60
|
+
*/
|
|
61
|
+
protected handleReceive(action: ReceiveAction): void;
|
|
62
|
+
/** Attaches NetworkManager to store
|
|
63
|
+
*
|
|
64
|
+
* Intercepts 'rest-hooks/fetch' actions to start requests.
|
|
65
|
+
*
|
|
66
|
+
* Resolve/rejects a request when matching 'rest-hooks/receive' event
|
|
67
|
+
* is seen.
|
|
68
|
+
*/
|
|
69
|
+
getMiddleware(): Middleware;
|
|
70
|
+
/** Ensures only one request for a given key is in flight at any time
|
|
71
|
+
*
|
|
72
|
+
* Uses key to either retrieve in-flight promise, or if not
|
|
73
|
+
* create a new promise and call fetch.
|
|
74
|
+
*
|
|
75
|
+
* Note: The new promise is not actually tied to fetch at all,
|
|
76
|
+
* but is resolved when the expected 'recieve' action is processed.
|
|
77
|
+
* This ensures promises are resolved only once their data is processed
|
|
78
|
+
* by the reducer.
|
|
79
|
+
*/
|
|
80
|
+
protected throttle(key: string, fetch: () => Promise<any>, createdAt: number): Promise<any>;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=NetworkManager.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Schema } from '@data-client/normalizr';
|
|
2
|
+
import ConnectionListener from './ConnectionListener.js';
|
|
3
|
+
import { Subscription, SubscriptionInit } from './SubscriptionManager.js';
|
|
4
|
+
import { State, Dispatch } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* PollingSubscription keeps a given resource updated by
|
|
7
|
+
* dispatching a fetch at a rate equal to the minimum update
|
|
8
|
+
* interval requested.
|
|
9
|
+
*
|
|
10
|
+
* @see https://resthooks.io/docs/api/PollingSubscription
|
|
11
|
+
*/
|
|
12
|
+
export default class PollingSubscription implements Subscription {
|
|
13
|
+
protected readonly schema: Schema | undefined;
|
|
14
|
+
protected readonly fetch: () => Promise<any>;
|
|
15
|
+
protected readonly key: string;
|
|
16
|
+
protected frequency: number;
|
|
17
|
+
protected frequencyHistogram: Map<number, number>;
|
|
18
|
+
protected dispatch: Dispatch<any>;
|
|
19
|
+
protected getState: () => State<unknown>;
|
|
20
|
+
protected intervalId?: ReturnType<typeof setInterval>;
|
|
21
|
+
protected lastIntervalId?: ReturnType<typeof setInterval>;
|
|
22
|
+
protected startId?: ReturnType<typeof setTimeout>;
|
|
23
|
+
private connectionListener;
|
|
24
|
+
constructor({ key, schema, fetch, frequency, getState }: SubscriptionInit, dispatch: Dispatch<any>, connectionListener?: ConnectionListener);
|
|
25
|
+
/** Subscribe to a frequency */
|
|
26
|
+
add(frequency?: number): void;
|
|
27
|
+
/** Unsubscribe from a frequency */
|
|
28
|
+
remove(frequency?: number): boolean;
|
|
29
|
+
/** Cleanup means clearing out background interval. */
|
|
30
|
+
cleanup(): void;
|
|
31
|
+
/** Trigger request for latest resource */
|
|
32
|
+
protected update(): void;
|
|
33
|
+
/** What happens when browser goes offline */
|
|
34
|
+
protected offlineListener: () => void;
|
|
35
|
+
/** What happens when browser comes online */
|
|
36
|
+
protected onlineListener: () => void;
|
|
37
|
+
/** Run polling process with current frequency
|
|
38
|
+
*
|
|
39
|
+
* Will clean up old poll interval on next run
|
|
40
|
+
*/
|
|
41
|
+
protected run(): void;
|
|
42
|
+
/** Last fetch time */
|
|
43
|
+
protected lastFetchTime(): number;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=PollingSubscription.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Schema } from '@data-client/normalizr';
|
|
2
|
+
import { Manager, State, Middleware, Dispatch, UnsubscribeAction, SubscribeAction } from '../types.js';
|
|
3
|
+
/** Properties sent to Subscription constructor */
|
|
4
|
+
export interface SubscriptionInit {
|
|
5
|
+
schema?: Schema | undefined;
|
|
6
|
+
fetch: () => Promise<any>;
|
|
7
|
+
key: string;
|
|
8
|
+
getState: () => State<unknown>;
|
|
9
|
+
frequency?: number | undefined;
|
|
10
|
+
}
|
|
11
|
+
/** Interface handling a single resource subscription */
|
|
12
|
+
export interface Subscription {
|
|
13
|
+
add(frequency?: number): void;
|
|
14
|
+
remove(frequency?: number): boolean;
|
|
15
|
+
cleanup(): void;
|
|
16
|
+
}
|
|
17
|
+
/** The static class that constructs Subscription */
|
|
18
|
+
export interface SubscriptionConstructable {
|
|
19
|
+
new (init: SubscriptionInit, dispatch: Dispatch<any>): Subscription;
|
|
20
|
+
}
|
|
21
|
+
/** Handles subscription actions -> fetch or receive actions
|
|
22
|
+
*
|
|
23
|
+
* Constructor takes a SubscriptionConstructable class to control how
|
|
24
|
+
* subscriptions are handled. (e.g., polling, websockets)
|
|
25
|
+
*
|
|
26
|
+
* @see https://resthooks.io/docs/api/SubscriptionManager
|
|
27
|
+
*/
|
|
28
|
+
export default class SubscriptionManager<S extends SubscriptionConstructable> implements Manager {
|
|
29
|
+
protected subscriptions: {
|
|
30
|
+
[key: string]: InstanceType<S>;
|
|
31
|
+
};
|
|
32
|
+
protected readonly Subscription: S;
|
|
33
|
+
protected middleware: Middleware;
|
|
34
|
+
constructor(Subscription: S);
|
|
35
|
+
/** Ensures all subscriptions are cleaned up. */
|
|
36
|
+
cleanup(): void;
|
|
37
|
+
/** Called when middleware intercepts 'rest-hooks/subscribe' action.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
protected handleSubscribe(action: SubscribeAction, dispatch: (action: any) => Promise<void>, getState: () => State<unknown>): void;
|
|
41
|
+
/** Called when middleware intercepts 'rest-hooks/unsubscribe' action.
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
protected handleUnsubscribe(action: UnsubscribeAction, dispatch: (action: any) => Promise<void>): void;
|
|
45
|
+
/** Attaches Manager to store
|
|
46
|
+
*
|
|
47
|
+
* Intercepts 'rest-hooks/subscribe'/'rest-hooks/unsubscribe' to register resources that
|
|
48
|
+
* need to be kept up to date.
|
|
49
|
+
*
|
|
50
|
+
* Will possibly dispatch 'rest-hooks/fetch' or 'rest-hooks/receive' to keep resources fresh
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
getMiddleware(): Middleware;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=SubscriptionManager.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Controller from '../controller/Controller.js';
|
|
2
|
+
import { Reducer, Dispatch, ReducerState } from '../middlewareTypes.js';
|
|
3
|
+
import { Manager } from '../types.js';
|
|
4
|
+
export default function applyManager(managers: Manager[], controller: Controller): Middleware[];
|
|
5
|
+
export interface MiddlewareAPI<R extends Reducer<any, any> = Reducer<any, any>> {
|
|
6
|
+
getState: () => ReducerState<R>;
|
|
7
|
+
dispatch: Dispatch<R>;
|
|
8
|
+
}
|
|
9
|
+
export type Middleware = <R extends Reducer<any, any>>({ dispatch, }: MiddlewareAPI<R>) => (next: Dispatch<R>) => Dispatch<R>;
|
|
10
|
+
//# sourceMappingURL=applyManager.d.ts.map
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
type Action = any;
|
|
2
|
+
type ActionCreator<T> = any;
|
|
3
|
+
export interface EnhancerOptions {
|
|
4
|
+
/**
|
|
5
|
+
* the instance name to be showed on the monitor page. Default value is `document.title`.
|
|
6
|
+
* If not specified and there's no document title, it will consist of `tabId` and `instanceId`.
|
|
7
|
+
*/
|
|
8
|
+
name?: string;
|
|
9
|
+
/**
|
|
10
|
+
* action creators functions to be available in the Dispatcher.
|
|
11
|
+
*/
|
|
12
|
+
actionCreators?: ActionCreator<any>[] | {
|
|
13
|
+
[key: string]: ActionCreator<any>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once.
|
|
17
|
+
* It is the joint between performance and speed. When set to `0`, all actions will be sent instantly.
|
|
18
|
+
* Set it to a higher value when experiencing perf issues (also `maxAge` to a lower value).
|
|
19
|
+
*
|
|
20
|
+
* @default 500 ms.
|
|
21
|
+
*/
|
|
22
|
+
latency?: number;
|
|
23
|
+
/**
|
|
24
|
+
* (> 1) - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance.
|
|
25
|
+
*
|
|
26
|
+
* @default 50
|
|
27
|
+
*/
|
|
28
|
+
maxAge?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Customizes how actions and state are serialized and deserialized. Can be a boolean or object. If given a boolean, the behavior is the same as if you
|
|
31
|
+
* were to pass an object and specify `options` as a boolean. Giving an object allows fine-grained customization using the `replacer` and `reviver`
|
|
32
|
+
* functions.
|
|
33
|
+
*/
|
|
34
|
+
serialize?: boolean | {
|
|
35
|
+
/**
|
|
36
|
+
* - `undefined` - will use regular `JSON.stringify` to send data (it's the fast mode).
|
|
37
|
+
* - `false` - will handle also circular references.
|
|
38
|
+
* - `true` - will handle also date, regex, undefined, error objects, symbols, maps, sets and functions.
|
|
39
|
+
* - object, which contains `date`, `regex`, `undefined`, `error`, `symbol`, `map`, `set` and `function` keys.
|
|
40
|
+
* For each of them you can indicate if to include (by setting as `true`).
|
|
41
|
+
* For `function` key you can also specify a custom function which handles serialization.
|
|
42
|
+
* See [`jsan`](https://github.com/kolodny/jsan) for more details.
|
|
43
|
+
*/
|
|
44
|
+
options?: undefined | boolean | {
|
|
45
|
+
date?: true;
|
|
46
|
+
regex?: true;
|
|
47
|
+
undefined?: true;
|
|
48
|
+
error?: true;
|
|
49
|
+
symbol?: true;
|
|
50
|
+
map?: true;
|
|
51
|
+
set?: true;
|
|
52
|
+
function?: true | ((fn: (...args: any[]) => any) => string);
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* [JSON replacer function](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) used for both actions and states stringify.
|
|
56
|
+
* In addition, you can specify a data type by adding a [`__serializedType__`](https://github.com/zalmoxisus/remotedev-serialize/blob/master/helpers/index.js#L4)
|
|
57
|
+
* key. So you can deserialize it back while importing or persisting data.
|
|
58
|
+
* Moreover, it will also [show a nice preview showing the provided custom type](https://cloud.githubusercontent.com/assets/7957859/21814330/a17d556a-d761-11e6-85ef-159dd12f36c5.png):
|
|
59
|
+
*/
|
|
60
|
+
replacer?: (key: string, value: unknown) => any;
|
|
61
|
+
/**
|
|
62
|
+
* [JSON `reviver` function](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter)
|
|
63
|
+
* used for parsing the imported actions and states. See [`remotedev-serialize`](https://github.com/zalmoxisus/remotedev-serialize/blob/master/immutable/serialize.js#L8-L41)
|
|
64
|
+
* as an example on how to serialize special data types and get them back.
|
|
65
|
+
*/
|
|
66
|
+
reviver?: (key: string, value: unknown) => any;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* function which takes `action` object and id number as arguments, and should return `action` object back.
|
|
70
|
+
*/
|
|
71
|
+
actionSanitizer?: <A extends Action>(action: A, id: number) => A;
|
|
72
|
+
/**
|
|
73
|
+
* function which takes `state` object and index as arguments, and should return `state` object back.
|
|
74
|
+
*/
|
|
75
|
+
stateSanitizer?: <S>(state: S, index: number) => S;
|
|
76
|
+
/**
|
|
77
|
+
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
|
|
78
|
+
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
|
|
79
|
+
* @deprecated Use actionsDenylist instead.
|
|
80
|
+
*/
|
|
81
|
+
actionsBlacklist?: string | string[];
|
|
82
|
+
/**
|
|
83
|
+
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
|
|
84
|
+
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
|
|
85
|
+
* @deprecated Use actionsAllowlist instead.
|
|
86
|
+
*/
|
|
87
|
+
actionsWhitelist?: string | string[];
|
|
88
|
+
/**
|
|
89
|
+
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
|
|
90
|
+
* If `actionsAllowlist` specified, `actionsDenylist` is ignored.
|
|
91
|
+
*/
|
|
92
|
+
actionsDenylist?: string | string[];
|
|
93
|
+
/**
|
|
94
|
+
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
|
|
95
|
+
* If `actionsAllowlist` specified, `actionsDenylist` is ignored.
|
|
96
|
+
*/
|
|
97
|
+
actionsAllowlist?: string | string[];
|
|
98
|
+
/**
|
|
99
|
+
* called for every action before sending, takes `state` and `action` object, and returns `true` in case it allows sending the current data to the monitor.
|
|
100
|
+
* Use it as a more advanced version of `actionsDenylist`/`actionsAllowlist` parameters.
|
|
101
|
+
*/
|
|
102
|
+
predicate?: <S, A extends Action>(state: S, action: A) => boolean;
|
|
103
|
+
/**
|
|
104
|
+
* if specified as `false`, it will not record the changes till clicking on `Start recording` button.
|
|
105
|
+
* Available only for Redux enhancer, for others use `autoPause`.
|
|
106
|
+
*
|
|
107
|
+
* @default true
|
|
108
|
+
*/
|
|
109
|
+
shouldRecordChanges?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* if specified, whenever clicking on `Pause recording` button and there are actions in the history log, will add this action type.
|
|
112
|
+
* If not specified, will commit when paused. Available only for Redux enhancer.
|
|
113
|
+
*
|
|
114
|
+
* @default "@@PAUSED""
|
|
115
|
+
*/
|
|
116
|
+
pauseActionType?: string;
|
|
117
|
+
/**
|
|
118
|
+
* auto pauses when the extension’s window is not opened, and so has zero impact on your app when not in use.
|
|
119
|
+
* Not available for Redux enhancer (as it already does it but storing the data to be sent).
|
|
120
|
+
*
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
autoPause?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* if specified as `true`, it will not allow any non-monitor actions to be dispatched till clicking on `Unlock changes` button.
|
|
126
|
+
* Available only for Redux enhancer.
|
|
127
|
+
*
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
shouldStartLocked?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Available only for Redux enhancer.
|
|
133
|
+
*
|
|
134
|
+
* @default true
|
|
135
|
+
*/
|
|
136
|
+
shouldHotReload?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* if specified as `true`, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched.
|
|
139
|
+
*
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
shouldCatchErrors?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* If you want to restrict the extension, specify the features you allow.
|
|
145
|
+
* If not specified, all of the features are enabled. When set as an object, only those included as `true` will be allowed.
|
|
146
|
+
* Note that except `true`/`false`, `import` and `export` can be set as `custom` (which is by default for Redux enhancer), meaning that the importing/exporting occurs on the client side.
|
|
147
|
+
* Otherwise, you'll get/set the data right from the monitor part.
|
|
148
|
+
*/
|
|
149
|
+
features?: {
|
|
150
|
+
/**
|
|
151
|
+
* start/pause recording of dispatched actions
|
|
152
|
+
*/
|
|
153
|
+
pause?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* lock/unlock dispatching actions and side effects
|
|
156
|
+
*/
|
|
157
|
+
lock?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* persist states on page reloading
|
|
160
|
+
*/
|
|
161
|
+
persist?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* export history of actions in a file
|
|
164
|
+
*/
|
|
165
|
+
export?: boolean | 'custom';
|
|
166
|
+
/**
|
|
167
|
+
* import history of actions from a file
|
|
168
|
+
*/
|
|
169
|
+
import?: boolean | 'custom';
|
|
170
|
+
/**
|
|
171
|
+
* jump back and forth (time travelling)
|
|
172
|
+
*/
|
|
173
|
+
jump?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* skip (cancel) actions
|
|
176
|
+
*/
|
|
177
|
+
skip?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* drag and drop actions in the history list
|
|
180
|
+
*/
|
|
181
|
+
reorder?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* dispatch custom actions or action creators
|
|
184
|
+
*/
|
|
185
|
+
dispatch?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* generate tests for the selected actions
|
|
188
|
+
*/
|
|
189
|
+
test?: boolean;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Set to true or a stacktrace-returning function to record call stack traces for dispatched actions.
|
|
193
|
+
* Defaults to false.
|
|
194
|
+
*/
|
|
195
|
+
trace?: boolean | (<A extends Action>(action: A) => string);
|
|
196
|
+
/**
|
|
197
|
+
* The maximum number of stack trace entries to record per action. Defaults to 10.
|
|
198
|
+
*/
|
|
199
|
+
traceLimit?: number;
|
|
200
|
+
}
|
|
201
|
+
export interface DevToolsConfig extends EnhancerOptions {
|
|
202
|
+
type?: string;
|
|
203
|
+
}
|
|
204
|
+
export {};
|
|
205
|
+
//# sourceMappingURL=devtoolsTypes.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as ConnectionListener } from './ConnectionListener.js';
|
|
2
|
+
export { default as DefaultConnectionListener } from './DefaultConnectionListener.js';
|
|
3
|
+
export { default as PollingSubscription } from './PollingSubscription.js';
|
|
4
|
+
export { default as SubscriptionManager } from './SubscriptionManager.js';
|
|
5
|
+
export { default as DevToolsManager } from './DevtoolsManager.js';
|
|
6
|
+
export { default as LogoutManager } from './LogoutManager.js';
|
|
7
|
+
export { DevToolsConfig } from './DevtoolsManager.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Controller from './controller/Controller.js';
|
|
2
|
+
import { ActionTypes } from './newActions.js';
|
|
3
|
+
import { ActionTypes as LegacyActionTypes, CombinedActionTypes, State } from './types.js';
|
|
4
|
+
type RHDispatch<Actions = any> = (value: Actions) => Promise<void>;
|
|
5
|
+
export interface MiddlewareAPI<R extends RestHooksReducer = RestHooksReducer> extends Controller<RHDispatch<CombinedActionTypes>> {
|
|
6
|
+
controller: Controller<RHDispatch<CombinedActionTypes>>;
|
|
7
|
+
}
|
|
8
|
+
export interface MiddlewareController<Actions = LegacyActionTypes> extends Controller<RHDispatch<Actions>> {
|
|
9
|
+
controller: Controller<RHDispatch<Actions>>;
|
|
10
|
+
}
|
|
11
|
+
export type Middleware<Actions = any> = <C extends MiddlewareController<Actions>>(controller: C) => (next: C['dispatch']) => C['dispatch'];
|
|
12
|
+
export type RestHooksReducer = (prevState: State<unknown>, action: ActionTypes) => State<unknown>;
|
|
13
|
+
export type Dispatch<R extends Reducer<any, any>> = (action: ReducerAction<R>) => Promise<void>;
|
|
14
|
+
export type Reducer<S, A> = (prevState: S, action: A) => S;
|
|
15
|
+
export type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
|
|
16
|
+
export type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=middlewareTypes.d.ts.map
|