@mereb/app-feed 0.0.8 → 0.0.10

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.
@@ -1,10 +1,27 @@
1
- import type { CreatePostMutation, CreatePostMutationVariables, DiscoverUsersQuery, FeedQuery } from '@mereb/shared-graphql';
2
- export { FeedDocument, CreatePostDocument, DiscoverUsersDocument } from '@mereb/shared-graphql';
1
+ import type { CreateCommentMutation, CreateCommentMutationVariables, CreatePostMutation, CreatePostMutationVariables, DeleteCommentMutation, DeleteCommentMutationVariables, DiscoverUsersQuery, FeedQuery, LikePostMutation, LikePostMutationVariables, PostCommentsQuery, PostCommentsQueryVariables, PostQuery, RepostPostMutation, RepostPostMutationVariables, UnlikePostMutation, UnlikePostMutationVariables } from '@mereb/shared-graphql';
2
+ export { CreateCommentDocument, CreatePostDocument, DeleteCommentDocument, DiscoverUsersDocument, FeedDocument, LikePostDocument, PostCommentsDocument, PostDocument, RepostPostDocument, UnlikePostDocument } from '@mereb/shared-graphql';
3
3
  export type FeedNode = FeedQuery['feedHome']['edges'][number]['node'];
4
+ export type PostNode = NonNullable<PostQuery['post']>;
5
+ export type PostCommentNode = NonNullable<PostCommentsQuery['post']>['comments']['edges'][number]['node'];
4
6
  export type DiscoverUser = DiscoverUsersQuery['discoverUsers'][number];
5
7
  export type CreatePostResponse = CreatePostMutation;
6
8
  export type CreatePostVariables = CreatePostMutationVariables;
9
+ export type CreateCommentResponse = CreateCommentMutation;
10
+ export type CreateCommentVariables = CreateCommentMutationVariables;
11
+ export type DeleteCommentResponse = DeleteCommentMutation;
12
+ export type DeleteCommentVariables = DeleteCommentMutationVariables;
13
+ export type LikePostResponse = LikePostMutation;
14
+ export type LikePostVariables = LikePostMutationVariables;
15
+ export type PostResponse = PostQuery;
16
+ export type PostCommentsResponse = PostCommentsQuery;
17
+ export type PostCommentsVariables = PostCommentsQueryVariables;
18
+ export type RepostPostResponse = RepostPostMutation;
19
+ export type RepostPostVariables = RepostPostMutationVariables;
20
+ export type UnlikePostResponse = UnlikePostMutation;
21
+ export type UnlikePostVariables = UnlikePostMutationVariables;
7
22
  export declare const FEED_PAGE_SIZE = 20;
8
23
  export declare function parseFeedTimestamp(value?: string | null): Date | null;
9
24
  export declare function formatRelativeFeedTimestamp(value?: string | null, now?: number): string;
10
25
  export declare function selectFeedNodes(data?: FeedQuery | null): FeedNode[];
26
+ export declare function selectPost(data?: PostQuery | null): PostNode | null;
27
+ export declare function selectPostComments(data?: PostCommentsQuery | null): PostCommentNode[];
package/dist/headless.js CHANGED
@@ -1,4 +1,4 @@
1
- export { FeedDocument, CreatePostDocument, DiscoverUsersDocument } from '@mereb/shared-graphql';
1
+ export { CreateCommentDocument, CreatePostDocument, DeleteCommentDocument, DiscoverUsersDocument, FeedDocument, LikePostDocument, PostCommentsDocument, PostDocument, RepostPostDocument, UnlikePostDocument } from '@mereb/shared-graphql';
2
2
  export const FEED_PAGE_SIZE = 20;
3
3
  const MINUTE = 60 * 1000;
4
4
  const HOUR = 60 * MINUTE;
@@ -44,3 +44,12 @@ export function selectFeedNodes(data) {
44
44
  }
45
45
  return data.feedHome.edges.map((edge) => edge.node);
46
46
  }
47
+ export function selectPost(data) {
48
+ return data?.post ?? null;
49
+ }
50
+ export function selectPostComments(data) {
51
+ if (!data?.post?.comments?.edges?.length) {
52
+ return [];
53
+ }
54
+ return data.post.comments.edges.map((edge) => edge.node);
55
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mereb/app-feed",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Feed experience building blocks for Mereb apps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -27,9 +27,9 @@
27
27
  "package.json"
28
28
  ],
29
29
  "dependencies": {
30
- "@mereb/shared-graphql": "^0.0.14",
31
- "@mereb/ui-shared": "^0.0.4",
32
- "@mereb/tokens": "^0.0.4"
30
+ "@mereb/shared-graphql": "^0.0.16",
31
+ "@mereb/ui-shared": "^0.0.6",
32
+ "@mereb/tokens": "^0.0.8"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@apollo/client": ">=3.8.0",