@apolitical/component-library 5.0.7-jc.4 → 5.1.0-jc.2
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/discussion/feeds/activities-feed/cache/hooks/edit/edit.hook.d.ts +1 -1
- package/discussion/feeds/activities-feed/cache/hooks/like/like.hook.d.ts +1 -1
- package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +1 -1
- package/discussion/feeds/activities-feed/cache/hooks/remove/remove.hook.d.ts +1 -1
- package/discussion/feeds/activities-feed/cache/hooks/unlike/unlike.hook.d.ts +1 -1
- package/discussion/feeds/activities-feed/cache/index.d.ts +0 -1
- package/discussion/feeds/likes-feed/cache/cache.interface.d.ts +2 -4
- package/discussion/feeds/likes-feed/cache/hooks/feed/feed.hook.d.ts +2 -2
- package/discussion/feeds/likes-feed/cache/hooks/list/list.hook.d.ts +2 -2
- package/discussion/feeds/likes-feed/cache/index.d.ts +0 -1
- package/discussion/feeds/replies-feed/cache/hooks/edit/edit.hook.d.ts +1 -1
- package/discussion/feeds/replies-feed/cache/hooks/like/like.hook.d.ts +1 -1
- package/discussion/feeds/replies-feed/cache/hooks/list/list.hook.d.ts +1 -1
- package/discussion/feeds/replies-feed/cache/hooks/remove/remove.hook.d.ts +1 -1
- package/discussion/feeds/replies-feed/cache/hooks/unlike/unlike.hook.d.ts +1 -1
- package/discussion/feeds/replies-feed/cache/index.d.ts +0 -1
- package/discussion/shared/helpers/cache.helper.d.ts +25 -0
- package/discussion/shared/helpers/index.d.ts +1 -0
- package/index.js +33 -33
- package/index.mjs +2093 -2150
- package/package.json +1 -1
- package/discussion/feeds/activities-feed/cache/cache.helper.d.ts +0 -5
- package/discussion/feeds/likes-feed/cache/cache.helper.d.ts +0 -16
- package/discussion/feeds/replies-feed/cache/cache.helper.d.ts +0 -16
|
@@ -4,5 +4,5 @@ interface IEditVars {
|
|
|
4
4
|
activityId: string;
|
|
5
5
|
content: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function useEditActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError
|
|
7
|
+
export declare function useEditActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, }: IMutationContext<ICacheItem, Error, IEditVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IActivity, Error, IEditVars, ICache>;
|
|
8
8
|
export {};
|
|
@@ -4,5 +4,5 @@ interface ILikeVars {
|
|
|
4
4
|
activityId: string;
|
|
5
5
|
reactionId?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function useLikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError
|
|
7
|
+
export declare function useLikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, queryClient, queryKey, }: IMutationContext<ICacheSubitem, Error, ILikeVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, ILikeVars, ICache>;
|
|
8
8
|
export {};
|
|
@@ -6,7 +6,7 @@ export interface IListActivitiesArgs {
|
|
|
6
6
|
rankingMethod?: string;
|
|
7
7
|
}
|
|
8
8
|
export declare function useListActivities({ queryFn, queryKey, rankingMethod, }: IListActivitiesArgs): {
|
|
9
|
-
activities: import(
|
|
9
|
+
activities: import('../../../../../../discussion/shared').IActivity[];
|
|
10
10
|
error: Error | null;
|
|
11
11
|
isLoading: boolean;
|
|
12
12
|
hasNextPage: boolean;
|
|
@@ -3,5 +3,5 @@ import type { ICache } from '../..';
|
|
|
3
3
|
interface IRemoveVars {
|
|
4
4
|
activityId: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function useRemoveActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError
|
|
6
|
+
export declare function useRemoveActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, }: IMutationContext<void, Error, IRemoveVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<void, Error, IRemoveVars, ICache>;
|
|
7
7
|
export {};
|
|
@@ -4,5 +4,5 @@ interface IUnlikeVars {
|
|
|
4
4
|
activityId: string;
|
|
5
5
|
reactionId?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function useUnlikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError
|
|
7
|
+
export declare function useUnlikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, user, }: IMutationContext<unknown, Error, IUnlikeVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IUnlikeVars, ICache>;
|
|
8
8
|
export {};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { InfiniteData } from '@tanstack/query-core';
|
|
2
2
|
import type { ReactionFilterAPIResponse } from 'getstream';
|
|
3
|
-
import type { IReaction
|
|
3
|
+
import type { IReaction } from '../../../../discussion/shared';
|
|
4
4
|
export type ICache = InfiniteData<ICachePage, string>;
|
|
5
5
|
export type ICachePage = ExtendedReactionFilterAPIResponse;
|
|
6
6
|
export type ICacheItems = ICacheItem[];
|
|
7
|
-
|
|
8
|
-
export type ICacheSubitem = IReaction;
|
|
9
|
-
export type ICacheUser = IUser;
|
|
7
|
+
type ICacheItem = IReaction;
|
|
10
8
|
interface ExtendedReactionFilterAPIResponse extends ReactionFilterAPIResponse {
|
|
11
9
|
results: IReaction[];
|
|
12
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryKey } from '@tanstack/react-query';
|
|
2
|
+
import { UR } from 'getstream';
|
|
2
3
|
import type { ICachePage } from '../..';
|
|
3
|
-
import { UR } from 'faye';
|
|
4
4
|
export interface IQueryFns {
|
|
5
5
|
list: (_: UR) => Promise<ICachePage>;
|
|
6
6
|
}
|
|
@@ -15,6 +15,6 @@ export declare function useLikesFeed({ queryFns: { list }, queryKey }: ILikesFee
|
|
|
15
15
|
hasNextPage: boolean;
|
|
16
16
|
fetchNextPage: (options?: import("@tanstack/query-core/build/legacy/queryClient-13f81fcb").a2 | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-13f81fcb").aj<import("../..").ICache, Error>>;
|
|
17
17
|
refetch: (options?: import("@tanstack/query-core/build/legacy/queryClient-13f81fcb").Z | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-13f81fcb").ac<import("../..").ICache, Error>>;
|
|
18
|
-
likes: import("
|
|
18
|
+
likes: import("../../../../../shared").IReaction[];
|
|
19
19
|
};
|
|
20
20
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { QueryKey } from '@tanstack/react-query';
|
|
2
|
+
import { UR } from 'getstream';
|
|
2
3
|
import type { ICache, ICachePage } from '../..';
|
|
3
|
-
import { UR } from 'faye';
|
|
4
4
|
export interface IListLikesArgs {
|
|
5
5
|
queryFn: (_: UR) => Promise<ICachePage>;
|
|
6
6
|
queryKey: QueryKey;
|
|
7
7
|
}
|
|
8
8
|
export declare function useListLikes({ queryFn, queryKey }: IListLikesArgs): {
|
|
9
|
-
likes: import(
|
|
9
|
+
likes: import('../../../../../../discussion/shared').IReaction[];
|
|
10
10
|
likesCount: string;
|
|
11
11
|
error: Error | null;
|
|
12
12
|
isLoading: boolean;
|
|
@@ -4,5 +4,5 @@ interface IEditVars {
|
|
|
4
4
|
replyId: string;
|
|
5
5
|
content: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function useEditReply({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError
|
|
7
|
+
export declare function useEditReply({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, }: IMutationContext<ICacheItem, Error, IEditVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, IEditVars, ICache>;
|
|
8
8
|
export {};
|
|
@@ -4,5 +4,5 @@ interface ILikeVars {
|
|
|
4
4
|
replyId: string;
|
|
5
5
|
reactionId?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function useLikeReply({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError
|
|
7
|
+
export declare function useLikeReply({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, queryClient, queryKey, }: IMutationContext<ICacheSubitem, Error, ILikeVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, ILikeVars, ICache>;
|
|
8
8
|
export {};
|
|
@@ -5,7 +5,7 @@ export interface IListRepliesArgs {
|
|
|
5
5
|
queryKey: QueryKey;
|
|
6
6
|
}
|
|
7
7
|
export declare function useListReplies({ queryFn, queryKey }: IListRepliesArgs): {
|
|
8
|
-
replies: import(
|
|
8
|
+
replies: import('../../../../../../discussion/shared').IReaction[];
|
|
9
9
|
repliesCount: string;
|
|
10
10
|
error: Error | null;
|
|
11
11
|
isLoading: boolean;
|
|
@@ -3,5 +3,5 @@ import type { ICache } from '../..';
|
|
|
3
3
|
interface IRemoveVars {
|
|
4
4
|
replyId: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function useRemoveReply({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError
|
|
6
|
+
export declare function useRemoveReply({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, }: IMutationContext<void, Error, IRemoveVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<void, Error, IRemoveVars, ICache>;
|
|
7
7
|
export {};
|
|
@@ -4,5 +4,5 @@ interface IUnlikeVars {
|
|
|
4
4
|
replyId: string;
|
|
5
5
|
reactionId?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function useUnlikeReply({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError
|
|
7
|
+
export declare function useUnlikeReply({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, user, }: IMutationContext<unknown, Error, IUnlikeVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IUnlikeVars, ICache>;
|
|
8
8
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { InfiniteData } from '@tanstack/query-core';
|
|
2
|
+
type ICacheItemBase = {
|
|
3
|
+
id: string;
|
|
4
|
+
};
|
|
5
|
+
export interface ICachePage<ICacheItem extends ICacheItemBase> {
|
|
6
|
+
results: ICacheItem[];
|
|
7
|
+
next: string;
|
|
8
|
+
}
|
|
9
|
+
export type ICache<ICacheItem extends ICacheItemBase> = InfiniteData<ICachePage<ICacheItem>, string>;
|
|
10
|
+
interface IAdditionOptions {
|
|
11
|
+
append?: boolean;
|
|
12
|
+
replace?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function buildEmptyCacheWithItem<ICacheItem>(item: ICacheItem): {
|
|
15
|
+
pages: {
|
|
16
|
+
next: string;
|
|
17
|
+
results: ICacheItem[];
|
|
18
|
+
}[];
|
|
19
|
+
pageParams: string[];
|
|
20
|
+
};
|
|
21
|
+
export declare function addItem<ICacheItem extends ICacheItemBase>(item: ICacheItem, cache?: ICache<ICacheItem>, opts?: IAdditionOptions): ICache<ICacheItem>;
|
|
22
|
+
export declare function findItem<ICacheItem extends ICacheItemBase>(itemId: string, cache?: ICache<ICacheItem>): ICacheItem | undefined;
|
|
23
|
+
export declare function removeItem<ICacheItem extends ICacheItemBase>(itemId: string, cache: ICache<ICacheItem>): ICache<ICacheItem>;
|
|
24
|
+
export declare function flattenCache<ICacheItem extends ICacheItemBase>(cache?: ICache<ICacheItem>): ICacheItem[];
|
|
25
|
+
export {};
|