@mittwald/react-ghostmaker 1.0.1 → 1.0.3
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/README.md +832 -0
- package/dist/esm/context.js +1 -1
- package/dist/esm/hash.js +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/invalidate.js +9 -16
- package/dist/esm/makeGhost.js +11 -12
- package/dist/esm/makeGhost.test.js +97 -67
- package/dist/esm/queries.js +13 -13
- package/dist/esm/resolveGhostChain.js +5 -5
- package/dist/esm/testMocks.js +12 -7
- package/dist/esm/useGhostChain.js +51 -49
- package/dist/types/context.d.ts +10 -2
- package/dist/types/hash.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/invalidate.d.ts +2 -3
- package/dist/types/makeGhost.d.ts +1 -1
- package/dist/types/queries.d.ts +3 -6
- package/dist/types/resolveGhostChain.d.ts +2 -2
- package/dist/types/testMocks.d.ts +3 -1
- package/dist/types/types.d.ts +4 -5
- package/dist/types/useGhostChain.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { type QueryClient } from "@tanstack/react-query";
|
|
2
|
-
import type {
|
|
3
|
-
export declare
|
|
4
|
-
export declare function invalidateGhosts(queryClient: QueryClient, model: unknown, chain: GhostChain): void;
|
|
2
|
+
import type { QueryKey } from "./types";
|
|
3
|
+
export declare function invalidateGhosts(queryClient: QueryClient, queryKey: QueryKey): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type ReactGhost } from "./types";
|
|
2
|
-
export declare function makeGhost<T>(
|
|
2
|
+
export declare function makeGhost<T>(target: T): ReactGhost<T>;
|
package/dist/types/queries.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { GhostChain, GhostChainItem, QueryKey } from "./types";
|
|
2
|
-
export declare const getObjectQueryKey: (something: unknown) => string;
|
|
3
|
-
export declare const ghostmakerQueryKey = "react-ghostmaker";
|
|
4
|
-
export declare const getGhostId: (queryKey: QueryKey) => string;
|
|
5
2
|
export declare const queries: {
|
|
6
3
|
ghostmaker: () => string[];
|
|
7
|
-
|
|
8
|
-
chainItem: (chainItem: GhostChainItem) =>
|
|
9
|
-
ghostChain: (
|
|
4
|
+
target: (target: unknown) => string[];
|
|
5
|
+
chainItem: (prev: QueryKey, chainItem: GhostChainItem) => unknown[];
|
|
6
|
+
ghostChain: (target: unknown, chain: GhostChain) => unknown[];
|
|
10
7
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type GhostChain
|
|
2
|
-
export declare const resolveGhostChain: (
|
|
1
|
+
import { type GhostChain } from "./types";
|
|
2
|
+
export declare const resolveGhostChain: (target: unknown, stack: GhostChain) => Promise<unknown>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { QueryFunctionContext } from "@tanstack/react-query";
|
|
2
|
+
export declare const advanceSleepTimer: (times?: number) => Promise<void>;
|
|
1
3
|
export declare let customerMocks: {
|
|
2
4
|
getName: () => void;
|
|
3
5
|
getDetailed: (id: string) => CustomerDetailed;
|
|
@@ -9,7 +11,7 @@ export declare let projectMocks: {
|
|
|
9
11
|
getStatus: () => void;
|
|
10
12
|
};
|
|
11
13
|
export declare const getCustomerNameGhostIds: {
|
|
12
|
-
current?:
|
|
14
|
+
current?: QueryFunctionContext | undefined;
|
|
13
15
|
};
|
|
14
16
|
export declare class CustomerDetailed {
|
|
15
17
|
readonly id: string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface ReactGhostMethods<T> extends Promise<T> {
|
|
|
13
13
|
use: (options?: useGhostOptions) => T;
|
|
14
14
|
render: (transform?: (item: T) => ReactNode) => ReactNode;
|
|
15
15
|
transform: <U, U2 = U>(fn: (item: T extends ReactGhost<infer T2> ? T2 : T) => U2, dependencies?: DependencyList) => ReactGhost<U2>;
|
|
16
|
-
invalidate: (queryClient: QueryClient) => void
|
|
16
|
+
invalidate: (queryClient: QueryClient) => Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
export declare const transformFnProp: "___transformFn";
|
|
19
19
|
export declare const isGhostMarker: "___ghostMarker";
|
|
@@ -25,12 +25,11 @@ export interface GhostChainItem {
|
|
|
25
25
|
args?: ExplicitAny[];
|
|
26
26
|
}
|
|
27
27
|
export type GhostChain = GhostChainItem[];
|
|
28
|
-
export type
|
|
29
|
-
export type QueryKey =
|
|
30
|
-
export type InvalidateGhostFn = () => void
|
|
28
|
+
export type GhostChainTargetType = UnknownRecord | Class<unknown> | null | undefined;
|
|
29
|
+
export type QueryKey = readonly unknown[];
|
|
30
|
+
export type InvalidateGhostFn = () => Promise<void>;
|
|
31
31
|
export interface GhostChainContext {
|
|
32
32
|
queryKey: QueryKey;
|
|
33
|
-
ghostId: string;
|
|
34
33
|
}
|
|
35
34
|
export interface UseGhostReturn<T> {
|
|
36
35
|
value: T;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type GhostChain, type useGhostOptions, type UseGhostReturn } from "./types";
|
|
2
|
-
export declare const useGhostChain: <T>(
|
|
2
|
+
export declare const useGhostChain: <T>(target: unknown, chain: GhostChain, options?: useGhostOptions) => UseGhostReturn<T>;
|