@data-client/core 0.13.5 → 0.14.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/dist/index.js +164 -191
- package/dist/index.umd.min.js +1 -1
- package/legacy/actions.js +1 -1
- package/legacy/controller/Controller.js +8 -17
- package/legacy/controller/actions/createExpireAll.js +8 -0
- package/legacy/controller/actions/createFetch.js +27 -0
- package/legacy/controller/actions/createInvalidate.js +10 -0
- package/legacy/controller/actions/createInvalidateAll.js +8 -0
- package/legacy/controller/actions/createMeta.js +9 -0
- package/legacy/controller/actions/createOptimistic.js +17 -0
- package/legacy/controller/actions/createReset.js +8 -0
- package/legacy/controller/actions/createSet.js +17 -0
- package/legacy/controller/actions/createSetResponse.js +26 -0
- package/legacy/controller/actions/createSubscription.js +22 -0
- package/legacy/controller/actions/index.js +11 -0
- package/legacy/index.js +3 -4
- package/legacy/manager/LogoutManager.js +2 -2
- package/legacy/manager/NetworkManager.js +27 -29
- package/legacy/manager/PollingSubscription.js +3 -3
- package/legacy/manager/SubscriptionManager.js +3 -3
- package/legacy/state/reducer/fetchReducer.js +6 -10
- package/legacy/state/reducer/invalidateReducer.js +2 -2
- package/legacy/state/reducer/setReducer.js +3 -3
- package/legacy/state/reducer/setResponseReducer.js +17 -17
- package/legacy/types.js +1 -1
- package/lib/actions.d.ts +34 -40
- package/lib/actions.d.ts.map +1 -1
- package/lib/actions.js +1 -1
- package/lib/controller/Controller.d.ts +1 -1
- package/lib/controller/Controller.d.ts.map +1 -1
- package/lib/controller/Controller.js +8 -17
- package/lib/controller/actions/createExpireAll.d.ts +3 -0
- package/lib/controller/actions/createExpireAll.d.ts.map +1 -0
- package/lib/controller/actions/createExpireAll.js +8 -0
- package/lib/controller/{createFetch.d.ts → actions/createFetch.d.ts} +3 -3
- package/lib/controller/actions/createFetch.d.ts.map +1 -0
- package/lib/controller/actions/createFetch.js +27 -0
- package/lib/controller/actions/createInvalidate.d.ts +6 -0
- package/lib/controller/actions/createInvalidate.d.ts.map +1 -0
- package/lib/controller/actions/createInvalidate.js +10 -0
- package/lib/controller/actions/createInvalidateAll.d.ts +3 -0
- package/lib/controller/actions/createInvalidateAll.d.ts.map +1 -0
- package/lib/controller/actions/createInvalidateAll.js +8 -0
- package/lib/controller/actions/createMeta.d.ts +3 -0
- package/lib/controller/actions/createMeta.d.ts.map +1 -0
- package/lib/controller/actions/createMeta.js +9 -0
- package/lib/controller/actions/createOptimistic.d.ts +7 -0
- package/lib/controller/actions/createOptimistic.d.ts.map +1 -0
- package/lib/controller/actions/createOptimistic.js +17 -0
- package/lib/controller/actions/createReset.d.ts +3 -0
- package/lib/controller/actions/createReset.d.ts.map +1 -0
- package/lib/controller/actions/createReset.js +8 -0
- package/lib/controller/{createSet.d.ts → actions/createSet.d.ts} +2 -2
- package/lib/controller/actions/createSet.d.ts.map +1 -0
- package/lib/controller/actions/createSet.js +17 -0
- package/lib/controller/{createSetResponse.d.ts → actions/createSetResponse.d.ts} +4 -4
- package/lib/controller/actions/createSetResponse.d.ts.map +1 -0
- package/lib/controller/actions/createSetResponse.js +26 -0
- package/lib/controller/{createSubscription.d.ts → actions/createSubscription.d.ts} +1 -1
- package/lib/controller/actions/createSubscription.d.ts.map +1 -0
- package/lib/controller/actions/createSubscription.js +22 -0
- package/lib/controller/actions/index.d.ts +11 -0
- package/lib/controller/actions/index.d.ts.map +1 -0
- package/lib/controller/actions/index.js +11 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -4
- package/lib/manager/LogoutManager.js +2 -2
- package/lib/manager/NetworkManager.d.ts +2 -2
- package/lib/manager/NetworkManager.d.ts.map +1 -1
- package/lib/manager/NetworkManager.js +27 -29
- package/lib/manager/PollingSubscription.js +3 -3
- package/lib/manager/SubscriptionManager.js +3 -3
- package/lib/state/reducer/expireReducer.d.ts +2 -2
- package/lib/state/reducer/fetchReducer.d.ts.map +1 -1
- package/lib/state/reducer/fetchReducer.js +8 -12
- package/lib/state/reducer/invalidateReducer.d.ts +2 -2
- package/lib/state/reducer/invalidateReducer.js +2 -2
- package/lib/state/reducer/setReducer.d.ts.map +1 -1
- package/lib/state/reducer/setReducer.js +3 -3
- package/lib/state/reducer/setResponseReducer.d.ts.map +1 -1
- package/lib/state/reducer/setResponseReducer.js +17 -17
- package/lib/types.d.ts +3 -3
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +1 -1
- package/package.json +2 -2
- package/src/actions.ts +36 -42
- package/src/controller/Controller.ts +15 -22
- package/src/controller/__tests__/Controller.ts +2 -2
- package/src/controller/actions/createExpireAll.ts +11 -0
- package/src/controller/{createFetch.ts → actions/createFetch.ts} +9 -13
- package/src/controller/actions/createInvalidate.ts +14 -0
- package/src/controller/actions/createInvalidateAll.ts +11 -0
- package/src/controller/actions/createMeta.ts +13 -0
- package/src/controller/actions/createOptimistic.ts +32 -0
- package/src/controller/actions/createReset.ts +9 -0
- package/src/controller/actions/createSet.ts +31 -0
- package/src/controller/{createSetResponse.ts → actions/createSetResponse.ts} +17 -23
- package/src/controller/{createSubscription.ts → actions/createSubscription.ts} +6 -10
- package/src/controller/actions/index.ts +13 -0
- package/src/index.ts +1 -3
- package/src/manager/LogoutManager.ts +1 -1
- package/src/manager/NetworkManager.ts +26 -27
- package/src/manager/PollingSubscription.ts +2 -2
- package/src/manager/SubscriptionManager.ts +2 -2
- package/src/manager/__tests__/__snapshots__/pollingSubscription.ts.snap +4 -10
- package/src/manager/__tests__/logoutManager.ts +1 -1
- package/src/manager/__tests__/networkManager.ts +37 -25
- package/src/manager/__tests__/pollingSubscription.ts +3 -3
- package/src/manager/__tests__/subscriptionManager.ts +22 -27
- package/src/state/__tests__/reducer.ts +42 -45
- package/src/state/reducer/fetchReducer.ts +12 -18
- package/src/state/reducer/invalidateReducer.ts +1 -1
- package/src/state/reducer/setReducer.ts +4 -10
- package/src/state/reducer/setResponseReducer.ts +18 -20
- package/src/types.ts +4 -4
- package/ts3.4/actions.d.ts +35 -41
- package/ts3.4/controller/Controller.d.ts +1 -1
- package/ts3.4/controller/actions/createExpireAll.d.ts +3 -0
- package/ts3.4/controller/{createFetch.d.ts → actions/createFetch.d.ts} +3 -3
- package/ts3.4/controller/{createInvalidate.d.ts → actions/createInvalidate.d.ts} +2 -2
- package/ts3.4/controller/actions/createInvalidateAll.d.ts +3 -0
- package/ts3.4/controller/actions/createMeta.d.ts +3 -0
- package/ts3.4/controller/actions/createOptimistic.d.ts +9 -0
- package/ts3.4/controller/actions/createReset.d.ts +3 -0
- package/ts3.4/controller/{createSet.d.ts → actions/createSet.d.ts} +2 -2
- package/ts3.4/controller/{createSetResponse.d.ts → actions/createSetResponse.d.ts} +4 -4
- package/ts3.4/controller/{createSubscription.d.ts → actions/createSubscription.d.ts} +1 -1
- package/ts3.4/controller/actions/index.d.ts +11 -0
- package/ts3.4/index.d.ts +2 -3
- package/ts3.4/manager/NetworkManager.d.ts +2 -2
- package/ts3.4/state/reducer/expireReducer.d.ts +2 -2
- package/ts3.4/state/reducer/invalidateReducer.d.ts +2 -2
- package/ts3.4/types.d.ts +3 -3
- package/legacy/controller/createExpireAll.js +0 -8
- package/legacy/controller/createFetch.js +0 -31
- package/legacy/controller/createInvalidate.js +0 -12
- package/legacy/controller/createInvalidateAll.js +0 -8
- package/legacy/controller/createOptimistic.js +0 -27
- package/legacy/controller/createReset.js +0 -8
- package/legacy/controller/createSet.js +0 -28
- package/legacy/controller/createSetResponse.js +0 -32
- package/legacy/controller/createSubscription.js +0 -26
- package/lib/controller/createExpireAll.d.ts +0 -3
- package/lib/controller/createExpireAll.d.ts.map +0 -1
- package/lib/controller/createExpireAll.js +0 -8
- package/lib/controller/createFetch.d.ts.map +0 -1
- package/lib/controller/createFetch.js +0 -31
- package/lib/controller/createInvalidate.d.ts +0 -6
- package/lib/controller/createInvalidate.d.ts.map +0 -1
- package/lib/controller/createInvalidate.js +0 -12
- package/lib/controller/createInvalidateAll.d.ts +0 -3
- package/lib/controller/createInvalidateAll.d.ts.map +0 -1
- package/lib/controller/createInvalidateAll.js +0 -8
- package/lib/controller/createOptimistic.d.ts +0 -10
- package/lib/controller/createOptimistic.d.ts.map +0 -1
- package/lib/controller/createOptimistic.js +0 -27
- package/lib/controller/createReset.d.ts +0 -3
- package/lib/controller/createReset.d.ts.map +0 -1
- package/lib/controller/createReset.js +0 -8
- package/lib/controller/createSet.d.ts.map +0 -1
- package/lib/controller/createSet.js +0 -28
- package/lib/controller/createSetResponse.d.ts.map +0 -1
- package/lib/controller/createSetResponse.js +0 -32
- package/lib/controller/createSubscription.d.ts.map +0 -1
- package/lib/controller/createSubscription.js +0 -26
- package/src/controller/createExpireAll.ts +0 -11
- package/src/controller/createInvalidate.ts +0 -16
- package/src/controller/createInvalidateAll.ts +0 -11
- package/src/controller/createOptimistic.ts +0 -41
- package/src/controller/createReset.ts +0 -9
- package/src/controller/createSet.ts +0 -43
- package/ts3.4/controller/createExpireAll.d.ts +0 -3
- package/ts3.4/controller/createInvalidateAll.d.ts +0 -3
- package/ts3.4/controller/createOptimistic.d.ts +0 -12
- package/ts3.4/controller/createReset.d.ts +0 -3
|
@@ -15,21 +15,21 @@ export function setResponseReducer(
|
|
|
15
15
|
controller: Controller,
|
|
16
16
|
) {
|
|
17
17
|
if (action.error) {
|
|
18
|
-
return reduceError(state, action, action.
|
|
18
|
+
return reduceError(state, action, action.response);
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
|
-
let
|
|
22
|
-
// for true set's
|
|
21
|
+
let response: any;
|
|
22
|
+
// for true set's response is contained in action
|
|
23
23
|
if (action.type === OPTIMISTIC_TYPE) {
|
|
24
24
|
// this should never happen
|
|
25
25
|
/* istanbul ignore if */
|
|
26
26
|
if (!action.endpoint.getOptimisticResponse) return state;
|
|
27
27
|
try {
|
|
28
28
|
// compute optimistic response based on current state
|
|
29
|
-
|
|
29
|
+
response = action.endpoint.getOptimisticResponse.call(
|
|
30
30
|
action.endpoint,
|
|
31
31
|
controller.snapshot(state, action.meta.fetchedAt),
|
|
32
|
-
...action.
|
|
32
|
+
...action.args,
|
|
33
33
|
);
|
|
34
34
|
} catch (e: any) {
|
|
35
35
|
// AbortOptimistic means 'do nothing', otherwise we count the exception as endpoint failure
|
|
@@ -39,24 +39,22 @@ export function setResponseReducer(
|
|
|
39
39
|
throw e;
|
|
40
40
|
}
|
|
41
41
|
} else {
|
|
42
|
-
|
|
42
|
+
response = action.response;
|
|
43
43
|
}
|
|
44
44
|
const { result, entities, indexes, entityMeta } = normalize(
|
|
45
|
-
payload,
|
|
46
45
|
action.endpoint.schema,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
state
|
|
50
|
-
state.entityMeta,
|
|
46
|
+
response,
|
|
47
|
+
action.args,
|
|
48
|
+
state,
|
|
51
49
|
action.meta,
|
|
52
50
|
);
|
|
53
51
|
const endpoints: Record<string, unknown> = {
|
|
54
52
|
...state.endpoints,
|
|
55
|
-
[action.
|
|
53
|
+
[action.key]: result,
|
|
56
54
|
};
|
|
57
55
|
try {
|
|
58
56
|
if (action.endpoint.update) {
|
|
59
|
-
const updaters = action.endpoint.update(result, ...action.
|
|
57
|
+
const updaters = action.endpoint.update(result, ...action.args);
|
|
60
58
|
Object.keys(updaters).forEach(key => {
|
|
61
59
|
endpoints[key] = updaters[key](endpoints[key]);
|
|
62
60
|
});
|
|
@@ -65,7 +63,7 @@ export function setResponseReducer(
|
|
|
65
63
|
// integrity of this state update is still guaranteed
|
|
66
64
|
} catch (error) {
|
|
67
65
|
console.error(
|
|
68
|
-
`The following error occured during Endpoint.update() for ${action.
|
|
66
|
+
`The following error occured during Endpoint.update() for ${action.key}`,
|
|
69
67
|
);
|
|
70
68
|
console.error(error);
|
|
71
69
|
}
|
|
@@ -76,10 +74,10 @@ export function setResponseReducer(
|
|
|
76
74
|
entityMeta,
|
|
77
75
|
meta: {
|
|
78
76
|
...state.meta,
|
|
79
|
-
[action.
|
|
77
|
+
[action.key]: {
|
|
80
78
|
date: action.meta.date,
|
|
81
79
|
expiresAt: action.meta.expiresAt,
|
|
82
|
-
prevExpiresAt: state.meta[action.
|
|
80
|
+
prevExpiresAt: state.meta[action.key]?.expiresAt,
|
|
83
81
|
},
|
|
84
82
|
},
|
|
85
83
|
optimistic: filterOptimistic(state, action),
|
|
@@ -89,13 +87,13 @@ export function setResponseReducer(
|
|
|
89
87
|
} catch (error: any) {
|
|
90
88
|
if (typeof error === 'object') {
|
|
91
89
|
error.message = `Error processing ${
|
|
92
|
-
action.
|
|
90
|
+
action.key
|
|
93
91
|
}\n\nFull Schema: ${JSON.stringify(
|
|
94
92
|
action.endpoint.schema,
|
|
95
93
|
undefined,
|
|
96
94
|
2,
|
|
97
95
|
)}\n\nError:\n${error.message}`;
|
|
98
|
-
if ('
|
|
96
|
+
if ('response' in action) error.response = action.response;
|
|
99
97
|
error.status = 400;
|
|
100
98
|
}
|
|
101
99
|
|
|
@@ -126,7 +124,7 @@ function reduceError(
|
|
|
126
124
|
...state,
|
|
127
125
|
meta: {
|
|
128
126
|
...state.meta,
|
|
129
|
-
[action.
|
|
127
|
+
[action.key]: {
|
|
130
128
|
date: action.meta.date,
|
|
131
129
|
error,
|
|
132
130
|
expiresAt: action.meta.expiresAt,
|
|
@@ -143,7 +141,7 @@ function filterOptimistic(
|
|
|
143
141
|
) {
|
|
144
142
|
return state.optimistic.filter(
|
|
145
143
|
optimisticAction =>
|
|
146
|
-
optimisticAction.
|
|
144
|
+
optimisticAction.key !== resolvingAction.key ||
|
|
147
145
|
(optimisticAction.type === OPTIMISTIC_TYPE ?
|
|
148
146
|
optimisticAction.meta.fetchedAt !== resolvingAction.meta.fetchedAt
|
|
149
147
|
: optimisticAction.meta.date > resolvingAction.meta.date),
|
package/src/types.ts
CHANGED
|
@@ -12,6 +12,8 @@ import type {
|
|
|
12
12
|
} from './actions.js';
|
|
13
13
|
import type { Dispatch, Middleware, MiddlewareAPI } from './middlewareTypes.js';
|
|
14
14
|
|
|
15
|
+
export * from './actions.js';
|
|
16
|
+
|
|
15
17
|
export type { AbstractInstanceType, UpdateFunction };
|
|
16
18
|
|
|
17
19
|
export type PK = string;
|
|
@@ -27,9 +29,9 @@ export interface State<T> {
|
|
|
27
29
|
readonly meta: {
|
|
28
30
|
readonly [key: string]: {
|
|
29
31
|
readonly date: number;
|
|
30
|
-
readonly error?: ErrorTypes;
|
|
31
32
|
readonly expiresAt: number;
|
|
32
33
|
readonly prevExpiresAt?: number;
|
|
34
|
+
readonly error?: ErrorTypes;
|
|
33
35
|
readonly invalidated?: boolean;
|
|
34
36
|
readonly errorPolicy?: 'hard' | 'soft' | undefined;
|
|
35
37
|
};
|
|
@@ -37,9 +39,9 @@ export interface State<T> {
|
|
|
37
39
|
readonly entityMeta: {
|
|
38
40
|
readonly [entityKey: string]: {
|
|
39
41
|
readonly [pk: string]: {
|
|
42
|
+
readonly fetchedAt: number;
|
|
40
43
|
readonly date: number;
|
|
41
44
|
readonly expiresAt: number;
|
|
42
|
-
readonly fetchedAt: number;
|
|
43
45
|
};
|
|
44
46
|
};
|
|
45
47
|
};
|
|
@@ -47,8 +49,6 @@ export interface State<T> {
|
|
|
47
49
|
readonly lastReset: number;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
export * from './actions.js';
|
|
51
|
-
|
|
52
52
|
export interface Manager<Actions = ActionTypes> {
|
|
53
53
|
getMiddleware(): Middleware<Actions>;
|
|
54
54
|
cleanup(): void;
|
package/ts3.4/actions.d.ts
CHANGED
|
@@ -7,79 +7,75 @@ type EndpointAndUpdate<E extends EndpointInterface> = EndpointInterface & {
|
|
|
7
7
|
type EndpointDefault = EndpointInterface & {
|
|
8
8
|
update?: EndpointUpdateFunction<EndpointInterface>;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
fetchedAt: number;
|
|
13
|
-
date: number;
|
|
14
|
-
expiresAt: number;
|
|
10
|
+
/** General meta-data for operators */
|
|
11
|
+
export interface ActionMeta {
|
|
12
|
+
readonly fetchedAt: number;
|
|
13
|
+
readonly date: number;
|
|
14
|
+
readonly expiresAt: number;
|
|
15
15
|
}
|
|
16
|
+
/** Action for Controller.set() */
|
|
16
17
|
export interface SetAction<S extends Queryable = any> {
|
|
17
18
|
type: typeof SET_TYPE;
|
|
18
19
|
schema: S;
|
|
19
|
-
|
|
20
|
+
args: readonly any[];
|
|
21
|
+
meta: ActionMeta;
|
|
20
22
|
value: {} | ((previousValue: Denormalize<S>) => {});
|
|
21
23
|
}
|
|
22
|
-
export interface
|
|
24
|
+
export interface SetResponseActionBase<E extends EndpointAndUpdate<E> = EndpointDefault> {
|
|
25
|
+
type: typeof SET_RESPONSE_TYPE;
|
|
26
|
+
endpoint: E;
|
|
23
27
|
args: readonly any[];
|
|
24
28
|
key: string;
|
|
25
|
-
|
|
26
|
-
date: number;
|
|
27
|
-
expiresAt: number;
|
|
29
|
+
meta: ActionMeta;
|
|
28
30
|
}
|
|
29
|
-
export interface SetResponseActionSuccess<E extends EndpointAndUpdate<E> = EndpointDefault> {
|
|
30
|
-
|
|
31
|
-
endpoint: E;
|
|
32
|
-
meta: SetResponseMeta;
|
|
33
|
-
payload: ResolveType<E>;
|
|
31
|
+
export interface SetResponseActionSuccess<E extends EndpointAndUpdate<E> = EndpointDefault> extends SetResponseActionBase<E> {
|
|
32
|
+
response: ResolveType<E>;
|
|
34
33
|
error?: false;
|
|
35
34
|
}
|
|
36
|
-
export interface SetResponseActionError<E extends EndpointAndUpdate<E> = EndpointDefault> {
|
|
37
|
-
|
|
38
|
-
endpoint: E;
|
|
39
|
-
meta: SetResponseMeta;
|
|
40
|
-
payload: UnknownError;
|
|
35
|
+
export interface SetResponseActionError<E extends EndpointAndUpdate<E> = EndpointDefault> extends SetResponseActionBase<E> {
|
|
36
|
+
response: UnknownError;
|
|
41
37
|
error: true;
|
|
42
38
|
}
|
|
39
|
+
/** Action for Controller.setResponse() */
|
|
43
40
|
export type SetResponseAction<E extends EndpointAndUpdate<E> = EndpointDefault> = SetResponseActionSuccess<E> | SetResponseActionError<E>;
|
|
44
|
-
export interface FetchMeta
|
|
45
|
-
|
|
46
|
-
key: string;
|
|
47
|
-
throttle: boolean;
|
|
41
|
+
export interface FetchMeta {
|
|
42
|
+
fetchedAt: number;
|
|
48
43
|
resolve: (value?: any | PromiseLike<any>) => void;
|
|
49
44
|
reject: (reason?: any) => void;
|
|
50
45
|
promise: PromiseLike<any>;
|
|
51
|
-
createdAt: number;
|
|
52
|
-
nm?: boolean;
|
|
53
46
|
}
|
|
47
|
+
/** Action for Controller.fetch() */
|
|
54
48
|
export interface FetchAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
|
|
55
49
|
type: typeof FETCH_TYPE;
|
|
56
50
|
endpoint: E;
|
|
57
|
-
|
|
51
|
+
args: readonly [
|
|
58
52
|
...Parameters<E>
|
|
59
|
-
]
|
|
60
|
-
|
|
53
|
+
];
|
|
54
|
+
key: string;
|
|
55
|
+
meta: FetchMeta;
|
|
61
56
|
}
|
|
57
|
+
/** Action for Endpoint.getOptimisticResponse() */
|
|
62
58
|
export interface OptimisticAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
|
|
63
59
|
type: typeof OPTIMISTIC_TYPE;
|
|
64
60
|
endpoint: E;
|
|
65
|
-
|
|
61
|
+
args: readonly any[];
|
|
62
|
+
key: string;
|
|
63
|
+
meta: ActionMeta;
|
|
66
64
|
error?: false;
|
|
67
65
|
}
|
|
66
|
+
/** Action for Controller.subscribe() */
|
|
68
67
|
export interface SubscribeAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
|
|
69
68
|
type: typeof SUBSCRIBE_TYPE;
|
|
70
69
|
endpoint: E;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
key: string;
|
|
74
|
-
};
|
|
70
|
+
args: readonly any[];
|
|
71
|
+
key: string;
|
|
75
72
|
}
|
|
73
|
+
/** Action for Controller.unsubscribe() */
|
|
76
74
|
export interface UnsubscribeAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
|
|
77
75
|
type: typeof UNSUBSCRIBE_TYPE;
|
|
78
76
|
endpoint: E;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
key: string;
|
|
82
|
-
};
|
|
77
|
+
args: readonly any[];
|
|
78
|
+
key: string;
|
|
83
79
|
}
|
|
84
80
|
export interface ExpireAllAction {
|
|
85
81
|
type: typeof EXPIREALL_TYPE;
|
|
@@ -91,9 +87,7 @@ export interface InvalidateAllAction {
|
|
|
91
87
|
}
|
|
92
88
|
export interface InvalidateAction {
|
|
93
89
|
type: typeof INVALIDATE_TYPE;
|
|
94
|
-
|
|
95
|
-
key: string;
|
|
96
|
-
};
|
|
90
|
+
key: string;
|
|
97
91
|
}
|
|
98
92
|
export interface ResetAction {
|
|
99
93
|
type: typeof RESET_TYPE;
|
|
@@ -111,7 +111,7 @@ export default class Controller<D extends GenericDispatch = DataClientDispatch>
|
|
|
111
111
|
Error
|
|
112
112
|
]) => Promise<void>;
|
|
113
113
|
/**
|
|
114
|
-
* Resolves an inflight fetch.
|
|
114
|
+
* Resolves an inflight fetch.
|
|
115
115
|
* @see https://dataclient.io/docs/api/Controller#resolve
|
|
116
116
|
*/
|
|
117
117
|
resolve: <E extends EndpointInterface & {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EndpointInterface } from '@data-client/normalizr';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FetchAction } from '../../types.js';
|
|
3
|
+
import { EndpointUpdateFunction } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Requesting a fetch to begin
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function createFetch<E extends EndpointInterface & {
|
|
8
8
|
update?: EndpointUpdateFunction<E>;
|
|
9
9
|
}>(endpoint: E, { args }: {
|
|
10
10
|
args: readonly [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EndpointInterface } from '@data-client/normalizr';
|
|
2
|
-
import { InvalidateAction } from '
|
|
3
|
-
export
|
|
2
|
+
import { InvalidateAction } from '../../types.js';
|
|
3
|
+
export declare function createInvalidate<E extends EndpointInterface>(endpoint: E, { args }: {
|
|
4
4
|
args: readonly [
|
|
5
5
|
...Parameters<E>
|
|
6
6
|
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EndpointInterface } from '@data-client/normalizr';
|
|
2
|
+
import { OptimisticAction } from '../../types.js';
|
|
3
|
+
import { EndpointUpdateFunction } from '../types.js';
|
|
4
|
+
export declare function createOptimistic<E extends EndpointInterface & {
|
|
5
|
+
update?: EndpointUpdateFunction<E>;
|
|
6
|
+
}>(endpoint: E, args: readonly [
|
|
7
|
+
...Parameters<E>
|
|
8
|
+
], fetchedAt: number): OptimisticAction<E>;
|
|
9
|
+
//# sourceMappingURL=createOptimistic.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Denormalize, Queryable, SchemaArgs } from '@data-client/normalizr';
|
|
2
|
-
import { SetAction } from '
|
|
3
|
-
export
|
|
2
|
+
import { SetAction } from '../../types.js';
|
|
3
|
+
export declare function createSet<S extends Queryable>(schema: S, { args, fetchedAt, value, }: {
|
|
4
4
|
args: readonly [
|
|
5
5
|
...SchemaArgs<S>
|
|
6
6
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EndpointInterface, ResolveType } from '@data-client/normalizr';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
2
|
+
import { SetResponseAction } from '../../types.js';
|
|
3
|
+
import { EndpointUpdateFunction } from '../types.js';
|
|
4
|
+
export declare function createSetResponse<E extends EndpointInterface & {
|
|
5
5
|
update?: EndpointUpdateFunction<E>;
|
|
6
6
|
}>(endpoint: E, options: {
|
|
7
7
|
args: readonly [
|
|
@@ -11,7 +11,7 @@ export default function createSetResponse<E extends EndpointInterface & {
|
|
|
11
11
|
fetchedAt?: number;
|
|
12
12
|
error: true;
|
|
13
13
|
}): SetResponseAction<E>;
|
|
14
|
-
export
|
|
14
|
+
export declare function createSetResponse<E extends EndpointInterface & {
|
|
15
15
|
update?: EndpointUpdateFunction<E>;
|
|
16
16
|
}>(endpoint: E, options: {
|
|
17
17
|
args: readonly [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EndpointInterface } from '@data-client/normalizr';
|
|
2
|
-
import { SubscribeAction, UnsubscribeAction } from '
|
|
2
|
+
import { SubscribeAction, UnsubscribeAction } from '../../types.js';
|
|
3
3
|
export declare function createSubscription<E extends EndpointInterface>(endpoint: E, { args }: {
|
|
4
4
|
args: readonly [
|
|
5
5
|
...Parameters<E>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { createSubscription, createUnsubscription, } from './createSubscription.js';
|
|
2
|
+
export { createSetResponse } from './createSetResponse.js';
|
|
3
|
+
export { createSet } from './createSet.js';
|
|
4
|
+
export { createReset } from './createReset.js';
|
|
5
|
+
export { createOptimistic } from './createOptimistic.js';
|
|
6
|
+
export { createMeta } from './createMeta.js';
|
|
7
|
+
export { createInvalidateAll } from './createInvalidateAll.js';
|
|
8
|
+
export { createInvalidate } from './createInvalidate.js';
|
|
9
|
+
export { createFetch } from './createFetch.js';
|
|
10
|
+
export { createExpireAll } from './createExpireAll.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/ts3.4/index.d.ts
CHANGED
|
@@ -7,9 +7,8 @@ export { default as createReducer, initialState, } from './state/reducer/createR
|
|
|
7
7
|
export { default as applyManager } from './manager/applyManager.js';
|
|
8
8
|
export { default as Controller } from './controller/Controller.js';
|
|
9
9
|
export { DataClientDispatch, GenericDispatch, } from './controller/Controller.js';
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
export { default as createSetResponse } from './controller/createSetResponse.js';
|
|
10
|
+
import * as actions_1 from './controller/actions/index.js';
|
|
11
|
+
export { actions_1 as actions };
|
|
13
12
|
export * from './controller/types.js';
|
|
14
13
|
import * as actionTypes_1 from './actionTypes.js';
|
|
15
14
|
export { actionTypes_1 as actionTypes };
|
|
@@ -49,7 +49,7 @@ export default class NetworkManager implements Manager {
|
|
|
49
49
|
* Will then start a promise for a key and potentially start the network
|
|
50
50
|
* fetch.
|
|
51
51
|
*
|
|
52
|
-
* Uses throttle
|
|
52
|
+
* Uses throttle endpoints without sideEffects. This is valuable
|
|
53
53
|
* for ensures mutation requests always go through.
|
|
54
54
|
*/
|
|
55
55
|
protected handleFetch(action: FetchAction): Promise<any>;
|
|
@@ -76,7 +76,7 @@ export default class NetworkManager implements Manager {
|
|
|
76
76
|
* This ensures promises are resolved only once their data is processed
|
|
77
77
|
* by the reducer.
|
|
78
78
|
*/
|
|
79
|
-
protected throttle(key: string, fetch: () => Promise<any>,
|
|
79
|
+
protected throttle(key: string, fetch: () => Promise<any>, fetchedAt: number): Promise<any>;
|
|
80
80
|
/** Calls the callback when client is not 'busy' with high priority interaction tasks
|
|
81
81
|
*
|
|
82
82
|
* Override for platform-specific implementations
|
|
@@ -3,9 +3,9 @@ export declare function expireReducer(state: State<unknown>, action: ExpireAllAc
|
|
|
3
3
|
meta: {
|
|
4
4
|
[x: string]: {
|
|
5
5
|
readonly date: number;
|
|
6
|
-
readonly error?: import("packages/normalizr/lib/index.js").ErrorTypes;
|
|
7
6
|
readonly expiresAt: number;
|
|
8
7
|
readonly prevExpiresAt?: number;
|
|
8
|
+
readonly error?: import("packages/normalizr/lib/index.js").ErrorTypes;
|
|
9
9
|
readonly invalidated?: boolean;
|
|
10
10
|
readonly errorPolicy?: "hard" | "soft" | undefined;
|
|
11
11
|
};
|
|
@@ -22,9 +22,9 @@ export declare function expireReducer(state: State<unknown>, action: ExpireAllAc
|
|
|
22
22
|
entityMeta: {
|
|
23
23
|
readonly [entityKey: string]: {
|
|
24
24
|
readonly [pk: string]: {
|
|
25
|
+
readonly fetchedAt: number;
|
|
25
26
|
readonly date: number;
|
|
26
27
|
readonly expiresAt: number;
|
|
27
|
-
readonly fetchedAt: number;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
};
|
|
@@ -6,9 +6,9 @@ export declare function invalidateReducer(state: State<unknown>, action: Invalid
|
|
|
6
6
|
meta: {
|
|
7
7
|
[x: string]: {
|
|
8
8
|
readonly date: number;
|
|
9
|
-
readonly error?: import("packages/normalizr/lib/index.js").ErrorTypes;
|
|
10
9
|
readonly expiresAt: number;
|
|
11
10
|
readonly prevExpiresAt?: number;
|
|
11
|
+
readonly error?: import("packages/normalizr/lib/index.js").ErrorTypes;
|
|
12
12
|
readonly invalidated?: boolean;
|
|
13
13
|
readonly errorPolicy?: "hard" | "soft" | undefined;
|
|
14
14
|
};
|
|
@@ -22,9 +22,9 @@ export declare function invalidateReducer(state: State<unknown>, action: Invalid
|
|
|
22
22
|
entityMeta: {
|
|
23
23
|
readonly [entityKey: string]: {
|
|
24
24
|
readonly [pk: string]: {
|
|
25
|
+
readonly fetchedAt: number;
|
|
25
26
|
readonly date: number;
|
|
26
27
|
readonly expiresAt: number;
|
|
27
|
-
readonly fetchedAt: number;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
};
|
package/ts3.4/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { UpdateFunction, AbstractInstanceType } from '@data-client/normalizr';
|
|
|
3
3
|
import { ErrorTypes } from '@data-client/normalizr';
|
|
4
4
|
import { ActionTypes, SetResponseAction, OptimisticAction } from './actions.js';
|
|
5
5
|
import { Dispatch, Middleware, MiddlewareAPI } from './middlewareTypes.js';
|
|
6
|
+
export * from './actions.js';
|
|
6
7
|
export { AbstractInstanceType, UpdateFunction };
|
|
7
8
|
export type PK = string;
|
|
8
9
|
export interface State<T> {
|
|
@@ -18,9 +19,9 @@ export interface State<T> {
|
|
|
18
19
|
readonly meta: {
|
|
19
20
|
readonly [key: string]: {
|
|
20
21
|
readonly date: number;
|
|
21
|
-
readonly error?: ErrorTypes;
|
|
22
22
|
readonly expiresAt: number;
|
|
23
23
|
readonly prevExpiresAt?: number;
|
|
24
|
+
readonly error?: ErrorTypes;
|
|
24
25
|
readonly invalidated?: boolean;
|
|
25
26
|
readonly errorPolicy?: 'hard' | 'soft' | undefined;
|
|
26
27
|
};
|
|
@@ -28,16 +29,15 @@ export interface State<T> {
|
|
|
28
29
|
readonly entityMeta: {
|
|
29
30
|
readonly [entityKey: string]: {
|
|
30
31
|
readonly [pk: string]: {
|
|
32
|
+
readonly fetchedAt: number;
|
|
31
33
|
readonly date: number;
|
|
32
34
|
readonly expiresAt: number;
|
|
33
|
-
readonly fetchedAt: number;
|
|
34
35
|
};
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
readonly optimistic: (SetResponseAction | OptimisticAction)[];
|
|
38
39
|
readonly lastReset: number;
|
|
39
40
|
}
|
|
40
|
-
export * from './actions.js';
|
|
41
41
|
export interface Manager<Actions = ActionTypes> {
|
|
42
42
|
getMiddleware(): Middleware<Actions>;
|
|
43
43
|
cleanup(): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { EXPIREALL_TYPE } from '../actionTypes.js';
|
|
2
|
-
export default function createExpireAll(testKey) {
|
|
3
|
-
return {
|
|
4
|
-
type: EXPIREALL_TYPE,
|
|
5
|
-
testKey
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJFWFBJUkVBTExfVFlQRSIsImNyZWF0ZUV4cGlyZUFsbCIsInRlc3RLZXkiLCJ0eXBlIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyb2xsZXIvY3JlYXRlRXhwaXJlQWxsLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEVYUElSRUFMTF9UWVBFIH0gZnJvbSAnLi4vYWN0aW9uVHlwZXMuanMnO1xuaW1wb3J0IHR5cGUgeyBFeHBpcmVBbGxBY3Rpb24gfSBmcm9tICcuLi90eXBlcy5qcyc7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGNyZWF0ZUV4cGlyZUFsbChcbiAgdGVzdEtleTogKGtleTogc3RyaW5nKSA9PiBib29sZWFuLFxuKTogRXhwaXJlQWxsQWN0aW9uIHtcbiAgcmV0dXJuIHtcbiAgICB0eXBlOiBFWFBJUkVBTExfVFlQRSxcbiAgICB0ZXN0S2V5LFxuICB9O1xufVxuIl0sIm1hcHBpbmdzIjoiQUFBQSxTQUFTQSxjQUFjLFFBQVEsbUJBQW1CO0FBR2xELGVBQWUsU0FBU0MsZUFBZUEsQ0FDckNDLE9BQWlDLEVBQ2hCO0VBQ2pCLE9BQU87SUFDTEMsSUFBSSxFQUFFSCxjQUFjO0lBQ3BCRTtFQUNGLENBQUM7QUFDSCIsImlnbm9yZUxpc3QiOltdfQ==
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { FETCH_TYPE } from '../actionTypes.js';
|
|
2
|
-
/**
|
|
3
|
-
* Requesting a fetch to begin
|
|
4
|
-
*/
|
|
5
|
-
export default function createFetch(endpoint, {
|
|
6
|
-
args
|
|
7
|
-
}) {
|
|
8
|
-
const key = endpoint.key(...args);
|
|
9
|
-
let resolve = 0;
|
|
10
|
-
let reject = 0;
|
|
11
|
-
const promise = new Promise((a, b) => {
|
|
12
|
-
[resolve, reject] = [a, b];
|
|
13
|
-
});
|
|
14
|
-
const meta = {
|
|
15
|
-
args,
|
|
16
|
-
key,
|
|
17
|
-
throttle: !endpoint.sideEffect,
|
|
18
|
-
resolve,
|
|
19
|
-
reject,
|
|
20
|
-
promise,
|
|
21
|
-
createdAt: Date.now(),
|
|
22
|
-
nm: false
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
type: FETCH_TYPE,
|
|
26
|
-
payload: () => endpoint(...args),
|
|
27
|
-
meta,
|
|
28
|
-
endpoint
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJGRVRDSF9UWVBFIiwiY3JlYXRlRmV0Y2giLCJlbmRwb2ludCIsImFyZ3MiLCJrZXk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QzVCLENBQUMsQ0FBQztFQUNGLE1BQU1DLElBQTRCLEdBQUc7SUFDbkNSLElBQUk7SUFDSkMsR0FBRztJQUNIUSxRQUFRLEVBQUUsQ0FBQ1YsUUFBUSxDQUFDVyxVQUFVO0lBQzlCUixPQUFPO0lBQ1BDLE1BQU07SUFDTkMsT0FBTztJQUNQTyxTQUFTLEVBQUVDLElBQUksQ0FBQ0MsR0FBRyxDQUFDLENBQUM7SUFDckJDLEVBQUUsRUFBRTtFQUNOLENBQUM7RUFFRCxPQUFPO0lBQ0xDLElBQUksRUFBRWxCLFVBQVU7SUFDaEJtQixPQUFPLEVBQUVBLENBQUEsS0FBTWpCLFFBQVEsQ0FBQyxHQUFHQyxJQUFJLENBQVE7SUFDdkNRLElBQUk7SUFDSlQ7RUFDRixDQUFDO0FBQ0giLCJpZ25vcmVMaXN0IjpbXX0=
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { INVALIDATE_TYPE } from '../actionTypes.js';
|
|
2
|
-
export default function createInvalidate(endpoint, {
|
|
3
|
-
args
|
|
4
|
-
}) {
|
|
5
|
-
return {
|
|
6
|
-
type: INVALIDATE_TYPE,
|
|
7
|
-
meta: {
|
|
8
|
-
key: endpoint.key(...args)
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJJTlZBTElEQVRFX1RZUEUiLCJjcmVhdGVJbnZhbGlkYXRlIiwiZW5kcG9pbnQiLCJhcmdzIiwidHlwZSIsIm1ldGEiLCJrZXkiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJvbGxlci9jcmVhdGVJbnZhbGlkYXRlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgRW5kcG9pbnRJbnRlcmZhY2UgfSBmcm9tICdAZGF0YS1jbGllbnQvbm9ybWFsaXpyJztcblxuaW1wb3J0IHsgSU5WQUxJREFURV9UWVBFIH0gZnJvbSAnLi4vYWN0aW9uVHlwZXMuanMnO1xuaW1wb3J0IHR5cGUgeyBJbnZhbGlkYXRlQWN0aW9uIH0gZnJvbSAnLi4vdHlwZXMuanMnO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBjcmVhdGVJbnZhbGlkYXRlPEUgZXh0ZW5kcyBFbmRwb2ludEludGVyZmFjZT4oXG4gIGVuZHBvaW50OiBFLFxuICB7IGFyZ3MgfTogeyBhcmdzOiByZWFkb25seSBbLi4uUGFyYW1ldGVyczxFPl0gfSxcbik6IEludmFsaWRhdGVBY3Rpb24ge1xuICByZXR1cm4ge1xuICAgIHR5cGU6IElOVkFMSURBVEVfVFlQRSxcbiAgICBtZXRhOiB7XG4gICAgICBrZXk6IGVuZHBvaW50LmtleSguLi5hcmdzKSxcbiAgICB9LFxuICB9O1xufVxuIl0sIm1hcHBpbmdzIjoiQUFFQSxTQUFTQSxlQUFlLFFBQVEsbUJBQW1CO0FBR25ELGVBQWUsU0FBU0MsZ0JBQWdCQSxDQUN0Q0MsUUFBVyxFQUNYO0VBQUVDO0FBQTRDLENBQUMsRUFDN0I7RUFDbEIsT0FBTztJQUNMQyxJQUFJLEVBQUVKLGVBQWU7SUFDckJLLElBQUksRUFBRTtNQUNKQyxHQUFHLEVBQUVKLFFBQVEsQ0FBQ0ksR0FBRyxDQUFDLEdBQUdILElBQUk7SUFDM0I7RUFDRixDQUFDO0FBQ0giLCJpZ25vcmVMaXN0IjpbXX0=
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { INVALIDATEALL_TYPE } from '../actionTypes.js';
|
|
2
|
-
export default function createInvalidateAll(testKey) {
|
|
3
|
-
return {
|
|
4
|
-
type: INVALIDATEALL_TYPE,
|
|
5
|
-
testKey
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJJTlZBTElEQVRFQUxMX1RZUEUiLCJjcmVhdGVJbnZhbGlkYXRlQWxsIiwidGVzdEtleSIsInR5cGUiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJvbGxlci9jcmVhdGVJbnZhbGlkYXRlQWxsLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IElOVkFMSURBVEVBTExfVFlQRSB9IGZyb20gJy4uL2FjdGlvblR5cGVzLmpzJztcbmltcG9ydCB0eXBlIHsgSW52YWxpZGF0ZUFsbEFjdGlvbiB9IGZyb20gJy4uL3R5cGVzLmpzJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gY3JlYXRlSW52YWxpZGF0ZUFsbChcbiAgdGVzdEtleTogKGtleTogc3RyaW5nKSA9PiBib29sZWFuLFxuKTogSW52YWxpZGF0ZUFsbEFjdGlvbiB7XG4gIHJldHVybiB7XG4gICAgdHlwZTogSU5WQUxJREFURUFMTF9UWVBFLFxuICAgIHRlc3RLZXksXG4gIH07XG59XG4iXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLGtCQUFrQixRQUFRLG1CQUFtQjtBQUd0RCxlQUFlLFNBQVNDLG1CQUFtQkEsQ0FDekNDLE9BQWlDLEVBQ1o7RUFDckIsT0FBTztJQUNMQyxJQUFJLEVBQUVILGtCQUFrQjtJQUN4QkU7RUFDRixDQUFDO0FBQ0giLCJpZ25vcmVMaXN0IjpbXX0=
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { OPTIMISTIC_TYPE } from '../actionTypes.js';
|
|
2
|
-
export default function createOptimistic(endpoint, {
|
|
3
|
-
args,
|
|
4
|
-
fetchedAt
|
|
5
|
-
}) {
|
|
6
|
-
var _endpoint$dataExpiryL;
|
|
7
|
-
const expiryLength = (_endpoint$dataExpiryL = endpoint.dataExpiryLength) != null ? _endpoint$dataExpiryL : 60000;
|
|
8
|
-
/* istanbul ignore next */
|
|
9
|
-
if (process.env.NODE_ENV === 'development' && expiryLength < 0) {
|
|
10
|
-
throw new Error('Negative expiry length are not allowed.');
|
|
11
|
-
}
|
|
12
|
-
const now = Date.now();
|
|
13
|
-
const meta = {
|
|
14
|
-
args,
|
|
15
|
-
fetchedAt,
|
|
16
|
-
date: now,
|
|
17
|
-
expiresAt: now + expiryLength,
|
|
18
|
-
key: endpoint.key(...args)
|
|
19
|
-
};
|
|
20
|
-
const action = {
|
|
21
|
-
type: OPTIMISTIC_TYPE,
|
|
22
|
-
endpoint,
|
|
23
|
-
meta
|
|
24
|
-
};
|
|
25
|
-
return action;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJPUFRJTUlTVElDX1RZUEUiLCJjcmVhdGVPcHRpbWlzdGljIiwiZW5kcG9pbnQiLCJhcmdzIiwiZmV0Y2hlZEF0IiwiX2VuZHBvaW50JGRhdGFFeHBpcnlMIiwiZXhwaXJ5TGVuZ3RoIiwiZGF0YUV4cGlyeUxlbmd0aCIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIkVycm9yIiwibm93IiwiRGF0ZSIsIm1ldGEiLCJkYXRlIiwiZXhwaXJlc0F0Iiwia2V5IiwiYWN0aW9uIiwidHlwZSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cm9sbGVyL2NyZWF0ZU9wdGltaXN0aWMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBFbmRwb2ludEludGVyZmFjZSB9IGZyb20gJ0BkYXRhLWNsaWVudC9ub3JtYWxpenInO1xuXG5pbXBvcnQgdHlwZSB7IEVuZHBvaW50VXBkYXRlRnVuY3Rpb24gfSBmcm9tICcuL3R5cGVzLmpzJztcbmltcG9ydCB7IE9QVElNSVNUSUNfVFlQRSB9IGZyb20gJy4uL2FjdGlvblR5cGVzLmpzJztcbmltcG9ydCB0eXBlIHsgT3B0aW1pc3RpY0FjdGlvbiB9I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
|
5
|
-
date: Date.now()
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJSRVNFVF9UWVBFIiwiY3JlYXRlUmVzZXQiLCJ0eXBlIiwiZGF0ZSIsIkRhdGUiLCJub3ciXSwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJvbGxlci9jcmVhdGVSZXNldC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBSRVNFVF9UWVBFIH0gZnJvbSAnLi4vYWN0aW9uVHlwZXMuanMnO1xuaW1wb3J0IHR5cGUgeyBSZXNldEFjdGlvbiB9IGZyb20gJy4uL3R5cGVzLmpzJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gY3JlYXRlUmVzZXQoKTogUmVzZXRBY3Rpb24ge1xuICByZXR1cm4ge1xuICAgIHR5cGU6IFJFU0VUX1RZUEUsXG4gICAgZGF0ZTogRGF0ZS5ub3coKSxcbiAgfTtcbn1cbiJdLCJtYXBwaW5ncyI6IkFBQUEsU0FBU0EsVUFBVSxRQUFRLG1CQUFtQjtBQUc5QyxlQUFlLFNBQVNDLFdBQVdBLENBQUEsRUFBZ0I7RUFDakQsT0FBTztJQUNMQyxJQUFJLEVBQUVGLFVBQVU7SUFDaEJHLElBQUksRUFBRUMsSUFBSSxDQUFDQyxHQUFHLENBQUM7RUFDakIsQ0FBQztBQUNIIiwiaWdub3JlTGlzdCI6W119
|