@data-client/core 0.14.10 → 0.14.16

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.
Files changed (75) hide show
  1. package/README.md +7 -1
  2. package/data_client_logo_and_text.svg +9 -8
  3. package/dist/index.js +62 -40
  4. package/dist/index.umd.min.js +1 -1
  5. package/legacy/actionTypes.js +23 -12
  6. package/legacy/actions.js +1 -1
  7. package/legacy/controller/actions/createExpireAll.js +3 -3
  8. package/legacy/controller/actions/createFetch.js +3 -3
  9. package/legacy/controller/actions/createInvalidate.js +3 -3
  10. package/legacy/controller/actions/createInvalidateAll.js +3 -3
  11. package/legacy/controller/actions/createOptimistic.js +3 -3
  12. package/legacy/controller/actions/createReset.js +3 -3
  13. package/legacy/controller/actions/createSet.js +3 -3
  14. package/legacy/controller/actions/createSetResponse.js +3 -3
  15. package/legacy/controller/actions/createSubscription.js +4 -4
  16. package/legacy/index.js +2 -1
  17. package/legacy/manager/LogoutManager.js +3 -3
  18. package/legacy/manager/NetworkManager.js +6 -6
  19. package/legacy/manager/SubscriptionManager.js +4 -4
  20. package/legacy/state/reducer/createReducer.js +11 -11
  21. package/legacy/state/reducer/invalidateReducer.js +3 -3
  22. package/legacy/state/reducer/setResponseReducer.js +4 -4
  23. package/lib/actionTypes.d.ts +11 -0
  24. package/lib/actionTypes.d.ts.map +1 -1
  25. package/lib/actionTypes.js +23 -12
  26. package/lib/actions.d.ts +13 -12
  27. package/lib/actions.d.ts.map +1 -1
  28. package/lib/actions.js +1 -1
  29. package/lib/controller/Controller.d.ts +2 -2
  30. package/lib/controller/Controller.d.ts.map +1 -1
  31. package/lib/controller/actions/createExpireAll.js +3 -3
  32. package/lib/controller/actions/createFetch.js +3 -3
  33. package/lib/controller/actions/createInvalidate.js +3 -3
  34. package/lib/controller/actions/createInvalidateAll.js +3 -3
  35. package/lib/controller/actions/createOptimistic.js +3 -3
  36. package/lib/controller/actions/createReset.js +3 -3
  37. package/lib/controller/actions/createSet.js +3 -3
  38. package/lib/controller/actions/createSetResponse.js +3 -3
  39. package/lib/controller/actions/createSubscription.js +4 -4
  40. package/lib/index.d.ts +1 -0
  41. package/lib/index.d.ts.map +1 -1
  42. package/lib/index.js +2 -1
  43. package/lib/manager/LogoutManager.js +3 -3
  44. package/lib/manager/NetworkManager.js +6 -6
  45. package/lib/manager/SubscriptionManager.js +4 -4
  46. package/lib/state/reducer/createReducer.js +11 -11
  47. package/lib/state/reducer/invalidateReducer.js +3 -3
  48. package/lib/state/reducer/setResponseReducer.js +4 -4
  49. package/package.json +2 -2
  50. package/src/actionTypes.ts +23 -11
  51. package/src/actions.ts +23 -22
  52. package/src/controller/actions/createExpireAll.ts +2 -2
  53. package/src/controller/actions/createFetch.ts +2 -2
  54. package/src/controller/actions/createInvalidate.ts +2 -2
  55. package/src/controller/actions/createInvalidateAll.ts +2 -2
  56. package/src/controller/actions/createOptimistic.ts +2 -2
  57. package/src/controller/actions/createReset.ts +2 -2
  58. package/src/controller/actions/createSet.ts +2 -2
  59. package/src/controller/actions/createSetResponse.ts +2 -2
  60. package/src/controller/actions/createSubscription.ts +3 -3
  61. package/src/index.ts +1 -0
  62. package/src/manager/LogoutManager.ts +2 -2
  63. package/src/manager/NetworkManager.ts +5 -5
  64. package/src/manager/SubscriptionManager.ts +3 -3
  65. package/src/manager/__tests__/logoutManager.ts +3 -3
  66. package/src/manager/__tests__/networkManager.ts +6 -6
  67. package/src/manager/__tests__/subscriptionManager.ts +4 -4
  68. package/src/state/__tests__/reducer.ts +22 -22
  69. package/src/state/reducer/createReducer.ts +18 -18
  70. package/src/state/reducer/invalidateReducer.ts +2 -2
  71. package/src/state/reducer/setResponseReducer.ts +3 -3
  72. package/ts3.4/actionTypes.d.ts +11 -0
  73. package/ts3.4/actions.d.ts +13 -12
  74. package/ts3.4/controller/Controller.d.ts +2 -2
  75. package/ts3.4/index.d.ts +1 -0
@@ -1,5 +1,5 @@
1
1
  import { Denormalize, EndpointInterface, Queryable, ResolveType, UnknownError } from '@data-client/normalizr';
2
- import { SET_TYPE, RESET_TYPE, FETCH_TYPE, SUBSCRIBE_TYPE, UNSUBSCRIBE_TYPE, INVALIDATE_TYPE, GC_TYPE, OPTIMISTIC_TYPE, INVALIDATEALL_TYPE, EXPIREALL_TYPE, SET_RESPONSE_TYPE } from './actionTypes.js';
2
+ import { SET, RESET, FETCH, SUBSCRIBE, UNSUBSCRIBE, INVALIDATE, GC, OPTIMISTIC, INVALIDATEALL, EXPIREALL, SET_RESPONSE } from './actionTypes.js';
3
3
  import { EndpointUpdateFunction } from './controller/types.js';
4
4
  type EndpointAndUpdate<E extends EndpointInterface> = EndpointInterface & {
5
5
  update?: EndpointUpdateFunction<E>;
@@ -15,14 +15,14 @@ export interface ActionMeta {
15
15
  }
16
16
  /** Action for Controller.set() */
17
17
  export interface SetAction<S extends Queryable = any> {
18
- type: typeof SET_TYPE;
18
+ type: typeof SET;
19
19
  schema: S;
20
20
  args: readonly any[];
21
21
  meta: ActionMeta;
22
22
  value: {} | ((previousValue: Denormalize<S>) => {});
23
23
  }
24
24
  export interface SetResponseActionBase<E extends EndpointAndUpdate<E> = EndpointDefault> {
25
- type: typeof SET_RESPONSE_TYPE;
25
+ type: typeof SET_RESPONSE;
26
26
  endpoint: E;
27
27
  args: readonly any[];
28
28
  key: string;
@@ -46,7 +46,7 @@ export interface FetchMeta {
46
46
  }
47
47
  /** Action for Controller.fetch() */
48
48
  export interface FetchAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
49
- type: typeof FETCH_TYPE;
49
+ type: typeof FETCH;
50
50
  endpoint: E;
51
51
  args: readonly [
52
52
  ...Parameters<E>
@@ -56,7 +56,7 @@ export interface FetchAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
56
56
  }
57
57
  /** Action for Endpoint.getOptimisticResponse() */
58
58
  export interface OptimisticAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
59
- type: typeof OPTIMISTIC_TYPE;
59
+ type: typeof OPTIMISTIC;
60
60
  endpoint: E;
61
61
  args: readonly any[];
62
62
  key: string;
@@ -65,42 +65,43 @@ export interface OptimisticAction<E extends EndpointAndUpdate<E> = EndpointDefau
65
65
  }
66
66
  /** Action for Controller.subscribe() */
67
67
  export interface SubscribeAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
68
- type: typeof SUBSCRIBE_TYPE;
68
+ type: typeof SUBSCRIBE;
69
69
  endpoint: E;
70
70
  args: readonly any[];
71
71
  key: string;
72
72
  }
73
73
  /** Action for Controller.unsubscribe() */
74
74
  export interface UnsubscribeAction<E extends EndpointAndUpdate<E> = EndpointDefault> {
75
- type: typeof UNSUBSCRIBE_TYPE;
75
+ type: typeof UNSUBSCRIBE;
76
76
  endpoint: E;
77
77
  args: readonly any[];
78
78
  key: string;
79
79
  }
80
80
  export interface ExpireAllAction {
81
- type: typeof EXPIREALL_TYPE;
81
+ type: typeof EXPIREALL;
82
82
  testKey: (key: string) => boolean;
83
83
  }
84
84
  export interface InvalidateAllAction {
85
- type: typeof INVALIDATEALL_TYPE;
85
+ type: typeof INVALIDATEALL;
86
86
  testKey: (key: string) => boolean;
87
87
  }
88
88
  export interface InvalidateAction {
89
- type: typeof INVALIDATE_TYPE;
89
+ type: typeof INVALIDATE;
90
90
  key: string;
91
91
  }
92
92
  export interface ResetAction {
93
- type: typeof RESET_TYPE;
93
+ type: typeof RESET;
94
94
  date: number;
95
95
  }
96
96
  export interface GCAction {
97
- type: typeof GC_TYPE;
97
+ type: typeof GC;
98
98
  entities: [
99
99
  string,
100
100
  string
101
101
  ][];
102
102
  endpoints: string[];
103
103
  }
104
+ /** @see https://dataclient.io/docs/api/Actions */
104
105
  export type ActionTypes = FetchAction | OptimisticAction | SetAction | SetResponseAction | SubscribeAction | UnsubscribeAction | InvalidateAction | InvalidateAllAction | ExpireAllAction | ResetAction | GCAction;
105
106
  export {};
106
107
  //# sourceMappingURL=actions.d.ts.map
@@ -40,14 +40,14 @@ export default class Controller<D extends GenericDispatch = DataClientDispatch>
40
40
  */
41
41
  fetch: <E extends EndpointInterface & {
42
42
  update?: EndpointUpdateFunction<E>;
43
- }>(endpoint: E, ...args_0: Parameters<E>) => E["schema"] extends undefined | null ? ReturnType<E> : Promise<Denormalize<E["schema"]>>;
43
+ }>(endpoint: E, ...args: Parameters<E>) => E["schema"] extends undefined | null ? ReturnType<E> : Promise<Denormalize<E["schema"]>>;
44
44
  /**
45
45
  * Fetches only if endpoint is considered 'stale'; otherwise returns undefined
46
46
  * @see https://dataclient.io/docs/api/Controller#fetchIfStale
47
47
  */
48
48
  fetchIfStale: <E extends EndpointInterface & {
49
49
  update?: EndpointUpdateFunction<E>;
50
- }>(endpoint: E, ...args_0: Parameters<E>) => E["schema"] extends undefined | null ? ReturnType<E> | ResolveType<E> : Promise<Denormalize<E["schema"]>> | Denormalize<E["schema"]>;
50
+ }>(endpoint: E, ...args: Parameters<E>) => E["schema"] extends undefined | null ? ReturnType<E> | ResolveType<E> : Promise<Denormalize<E["schema"]>> | Denormalize<E["schema"]>;
51
51
  /**
52
52
  * Forces refetching and suspense on useSuspense with the same Endpoint and parameters.
53
53
  * @see https://dataclient.io/docs/api/Controller#invalidate
package/ts3.4/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import * as actions_1 from './controller/actions/index.js';
11
11
  export { actions_1 as actions };
12
12
  export * from './controller/types.js';
13
13
  import * as actionTypes_1 from './actionTypes.js';
14
+ /*@see https://dataclient.io/docs/api/Actions */
14
15
  export { actionTypes_1 as actionTypes };
15
16
  export * from './types.js';
16
17
  export * from './manager/index.js';