@data-client/core 0.15.7 → 0.16.7

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 (32) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/index.js +21 -4
  3. package/dist/index.umd.min.js +1 -1
  4. package/dist/mock.js +18 -4
  5. package/legacy/manager/DevtoolsManager.js +18 -4
  6. package/legacy/state/GCPolicy.js +4 -1
  7. package/legacy/state/reducer/setReducer.js +1 -1
  8. package/legacy/state/reducer/setResponseReducer.js +1 -1
  9. package/lib/manager/DevtoolsManager.d.ts +1 -0
  10. package/lib/manager/DevtoolsManager.d.ts.map +1 -1
  11. package/lib/manager/DevtoolsManager.js +19 -5
  12. package/lib/state/GCPolicy.d.ts.map +1 -1
  13. package/lib/state/GCPolicy.js +4 -1
  14. package/lib/state/reducer/expireReducer.d.ts +2 -2
  15. package/lib/state/reducer/invalidateReducer.d.ts +2 -2
  16. package/lib/state/reducer/setReducer.d.ts +1 -27
  17. package/lib/state/reducer/setReducer.d.ts.map +1 -1
  18. package/lib/state/reducer/setReducer.js +1 -1
  19. package/lib/state/reducer/setResponseReducer.d.ts +1 -30
  20. package/lib/state/reducer/setResponseReducer.d.ts.map +1 -1
  21. package/lib/state/reducer/setResponseReducer.js +1 -1
  22. package/package.json +3 -3
  23. package/src/manager/DevtoolsManager.ts +21 -6
  24. package/src/state/GCPolicy.ts +3 -0
  25. package/src/state/__tests__/GCPolicy.test.ts +2 -0
  26. package/src/state/reducer/setReducer.ts +1 -1
  27. package/src/state/reducer/setResponseReducer.ts +1 -1
  28. package/ts3.4/manager/DevtoolsManager.d.ts +1 -0
  29. package/ts3.4/state/reducer/expireReducer.d.ts +2 -2
  30. package/ts3.4/state/reducer/invalidateReducer.d.ts +2 -2
  31. package/ts3.4/state/reducer/setReducer.d.ts +1 -27
  32. package/ts3.4/state/reducer/setResponseReducer.d.ts +1 -30
@@ -254,5 +254,7 @@ describe('GCPolicy', () => {
254
254
 
255
255
  gcPolicy['runSweep']();
256
256
  expect(controller.dispatch).toHaveBeenCalled();
257
+
258
+ jest.useRealTimers();
257
259
  });
258
260
  });
@@ -7,7 +7,7 @@ export function setReducer(
7
7
  state: State<unknown>,
8
8
  action: SetAction,
9
9
  controller: Controller,
10
- ) {
10
+ ): State<unknown> {
11
11
  let value: any;
12
12
  if (typeof action.value === 'function') {
13
13
  const previousValue = controller.get(action.schema, ...action.args, state);
@@ -13,7 +13,7 @@ export function setResponseReducer(
13
13
  state: State<unknown>,
14
14
  action: OptimisticAction | SetResponseAction,
15
15
  controller: Controller,
16
- ) {
16
+ ): State<unknown> {
17
17
  if (action.error) {
18
18
  return reduceError(state, action, action.response);
19
19
  }
@@ -19,6 +19,7 @@ export default class DevToolsManager implements Manager {
19
19
  ][];
20
20
  protected controller: Controller;
21
21
  skipLogging?: (action: ActionTypes) => boolean;
22
+ devtoolsName: string;
22
23
  maxBufferLength: number;
23
24
  constructor(config?: DevToolsConfig, skipLogging?: (action: ActionTypes) => boolean);
24
25
  handleAction(action: any, state: any): void;
@@ -6,7 +6,7 @@ export declare function expireReducer(state: State<unknown>, action: ExpireAllAc
6
6
  readonly fetchedAt: number;
7
7
  readonly expiresAt: number;
8
8
  readonly prevExpiresAt?: number;
9
- readonly error?: import("packages/normalizr/lib/index.js").ErrorTypes;
9
+ readonly error?: import("@data-client/normalizr").ErrorTypes;
10
10
  readonly invalidated?: boolean;
11
11
  readonly errorPolicy?: "hard" | "soft" | undefined;
12
12
  };
@@ -19,7 +19,7 @@ export declare function expireReducer(state: State<unknown>, action: ExpireAllAc
19
19
  endpoints: {
20
20
  readonly [key: string]: unknown | import("../../types.js").PK[] | import("../../types.js").PK | undefined;
21
21
  };
22
- indexes: import("packages/normalizr/lib/interface.js").NormalizedIndex;
22
+ indexes: import("@data-client/normalizr").NormalizedIndex;
23
23
  entitiesMeta: {
24
24
  readonly [entityKey: string]: {
25
25
  readonly [pk: string]: {
@@ -9,7 +9,7 @@ export declare function invalidateReducer(state: State<unknown>, action: Invalid
9
9
  readonly fetchedAt: number;
10
10
  readonly expiresAt: number;
11
11
  readonly prevExpiresAt?: number;
12
- readonly error?: import("packages/normalizr/lib/index.js").ErrorTypes;
12
+ readonly error?: import("@data-client/normalizr").ErrorTypes;
13
13
  readonly invalidated?: boolean;
14
14
  readonly errorPolicy?: "hard" | "soft" | undefined;
15
15
  };
@@ -19,7 +19,7 @@ export declare function invalidateReducer(state: State<unknown>, action: Invalid
19
19
  readonly [pk: string]: unknown;
20
20
  } | undefined;
21
21
  };
22
- indexes: import("packages/normalizr/lib/interface.js").NormalizedIndex;
22
+ indexes: import("@data-client/normalizr").NormalizedIndex;
23
23
  entitiesMeta: {
24
24
  readonly [entityKey: string]: {
25
25
  readonly [pk: string]: {
@@ -1,30 +1,4 @@
1
1
  import Controller from '../../controller/Controller.js';
2
2
  import { State, SetAction } from '../../types.js';
3
- export declare function setReducer(state: State<unknown>, action: SetAction, controller: Controller): State<unknown> | {
4
- entities: {
5
- [x: string]: any;
6
- };
7
- endpoints: {
8
- readonly [key: string]: unknown;
9
- };
10
- indexes: import("@data-client/normalizr").NormalizedIndex;
11
- meta: {
12
- readonly [key: string]: {
13
- readonly date: number;
14
- readonly fetchedAt: number;
15
- readonly expiresAt: number;
16
- readonly prevExpiresAt?: number;
17
- readonly error?: import("@data-client/normalizr").ErrorTypes;
18
- readonly invalidated?: boolean;
19
- readonly errorPolicy?: "hard" | "soft" | undefined;
20
- };
21
- };
22
- entitiesMeta: import("packages/normalizr/lib/types.js").EntitiesToMeta<{
23
- [x: string]: any;
24
- }>;
25
- optimistic: (import("../../actions.js").OptimisticAction<import("@data-client/normalizr").EndpointInterface<import("@data-client/normalizr").FetchFunction, import("@data-client/normalizr").Schema | undefined, boolean | undefined> & {
26
- update?: import("../../index.js").EndpointUpdateFunction<import("@data-client/normalizr").EndpointInterface>;
27
- }> | import("../../actions.js").SetResponseAction)[];
28
- lastReset: number;
29
- };
3
+ export declare function setReducer(state: State<unknown>, action: SetAction, controller: Controller): State<unknown>;
30
4
  //# sourceMappingURL=setReducer.d.ts.map
@@ -1,33 +1,4 @@
1
1
  import Controller from '../../controller/Controller.js';
2
2
  import { State, SetResponseAction, OptimisticAction } from '../../types.js';
3
- export declare function setResponseReducer(state: State<unknown>, action: OptimisticAction | SetResponseAction, controller: Controller): State<unknown> | {
4
- entities: {
5
- [x: string]: any;
6
- };
7
- endpoints: Record<string, unknown>;
8
- indexes: import("@data-client/normalizr").NormalizedIndex;
9
- meta: {
10
- [x: string]: {
11
- readonly date: number;
12
- readonly fetchedAt: number;
13
- readonly expiresAt: number;
14
- readonly prevExpiresAt?: number;
15
- readonly error?: import("@data-client/normalizr").ErrorTypes;
16
- readonly invalidated?: boolean;
17
- readonly errorPolicy?: "hard" | "soft" | undefined;
18
- } | {
19
- date: number;
20
- fetchedAt: number;
21
- expiresAt: number;
22
- prevExpiresAt: number;
23
- };
24
- };
25
- entitiesMeta: import("packages/normalizr/lib/types.js").EntitiesToMeta<{
26
- [x: string]: any;
27
- }>;
28
- optimistic: (OptimisticAction<import("@data-client/normalizr").EndpointInterface<import("@data-client/normalizr").FetchFunction, import("@data-client/normalizr").Schema | undefined, boolean | undefined> & {
29
- update?: import("../../index.js").EndpointUpdateFunction<import("@data-client/normalizr").EndpointInterface>;
30
- }> | SetResponseAction)[];
31
- lastReset: number;
32
- };
3
+ export declare function setResponseReducer(state: State<unknown>, action: OptimisticAction | SetResponseAction, controller: Controller): State<unknown>;
33
4
  //# sourceMappingURL=setResponseReducer.d.ts.map