Skip to content

Commit

Permalink
add publication fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysu committed Aug 9, 2023
1 parent 214d6b5 commit 9d93f09
Show file tree
Hide file tree
Showing 7 changed files with 562 additions and 798 deletions.
194 changes: 194 additions & 0 deletions packages/client/src/graphql/fragments.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,58 @@ export type ProfileFragment = { invitedBy: ProfileFieldsFragment | null } & Prof

export type PaginatedResultInfoFragment = { prev: string | null; next: string | null };

export type AppFragment = { id: string };

export type MomokaInfoFragment = { proof: string };

export type PostFragment = {
id: string;
isHidden: boolean;
isGated: boolean;
createdAt: string;
by: ProfileFieldsFragment;
publishedOn: AppFragment | null;
momoka: MomokaInfoFragment | null;
};

export type CommentBaseFragment = {
id: string;
isHidden: boolean;
isGated: boolean;
createdAt: string;
by: ProfileFieldsFragment;
publishedOn: AppFragment | null;
momoka: MomokaInfoFragment | null;
};

export type CommentFragment = {
root: PostFragment;
commentOn: CommentBaseFragment | PostFragment | QuoteBaseFragment | null;
firstComment: CommentBaseFragment | null;
} & CommentBaseFragment;

export type MirrorFragment = {
id: string;
createdAt: string;
by: ProfileFieldsFragment;
momoka: MomokaInfoFragment | null;
mirrorOf: CommentFragment | PostFragment | QuoteFragment;
};

export type QuoteBaseFragment = {
id: string;
isHidden: boolean;
isGated: boolean;
createdAt: string;
by: ProfileFieldsFragment;
publishedOn: AppFragment | null;
momoka: MomokaInfoFragment | null;
};

export type QuoteFragment = {
quotedOn: CommentBaseFragment | PostFragment | QuoteBaseFragment | null;
} & QuoteBaseFragment;

export const ImageFragmentDoc = gql`
fragment Image on Image {
url
Expand Down Expand Up @@ -357,6 +409,148 @@ export const PaginatedResultInfoFragmentDoc = gql`
next
}
`;
export const MomokaInfoFragmentDoc = gql`
fragment MomokaInfo on MomokaInfo {
proof
}
`;
export const AppFragmentDoc = gql`
fragment App on App {
id
}
`;
export const PostFragmentDoc = gql`
fragment Post on Post {
id
by {
...ProfileFields
}
publishedOn {
...App
}
isHidden
isGated
momoka {
...MomokaInfo
}
createdAt
}
${ProfileFieldsFragmentDoc}
${AppFragmentDoc}
${MomokaInfoFragmentDoc}
`;
export const CommentBaseFragmentDoc = gql`
fragment CommentBase on Comment {
id
by {
...ProfileFields
}
publishedOn {
...App
}
isHidden
isGated
momoka {
...MomokaInfo
}
createdAt
}
${ProfileFieldsFragmentDoc}
${AppFragmentDoc}
${MomokaInfoFragmentDoc}
`;
export const QuoteBaseFragmentDoc = gql`
fragment QuoteBase on Quote {
id
by {
...ProfileFields
}
publishedOn {
...App
}
isHidden
isGated
momoka {
...MomokaInfo
}
createdAt
}
${ProfileFieldsFragmentDoc}
${AppFragmentDoc}
${MomokaInfoFragmentDoc}
`;
export const CommentFragmentDoc = gql`
fragment Comment on Comment {
...CommentBase
root {
...Post
}
commentOn {
... on Post {
...Post
}
... on Comment {
...CommentBase
}
... on Quote {
...QuoteBase
}
}
firstComment {
...CommentBase
}
}
${CommentBaseFragmentDoc}
${PostFragmentDoc}
${QuoteBaseFragmentDoc}
`;
export const QuoteFragmentDoc = gql`
fragment Quote on Quote {
...QuoteBase
quotedOn {
... on Post {
...Post
}
... on Comment {
...CommentBase
}
... on Quote {
...QuoteBase
}
}
}
${QuoteBaseFragmentDoc}
${PostFragmentDoc}
${CommentBaseFragmentDoc}
`;
export const MirrorFragmentDoc = gql`
fragment Mirror on Mirror {
id
by {
...ProfileFields
}
momoka {
...MomokaInfo
}
mirrorOf {
... on Post {
...Post
}
... on Comment {
...Comment
}
... on Quote {
...Quote
}
}
createdAt
}
${ProfileFieldsFragmentDoc}
${MomokaInfoFragmentDoc}
${PostFragmentDoc}
${CommentFragmentDoc}
${QuoteFragmentDoc}
`;

export type SdkFunctionWrapper = <T>(
action: (requestHeaders?: Record<string, string>) => Promise<T>,
Expand Down
153 changes: 153 additions & 0 deletions packages/client/src/graphql/fragments.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,156 @@ fragment PaginatedResultInfo on PaginatedResultInfo {
prev
next
}

fragment App on App {
id
}

fragment MomokaInfo on MomokaInfo {
proof
}

fragment Post on Post {
id
by {
...ProfileFields
}

# The metadata for the post
# metadata: PublicationMetadata!

# # The open action module
# openActionModules: [OpenActionModule!]

# # The reference module
# referenceModule: ReferenceModule

publishedOn {
...App
}
isHidden
isGated
momoka {
...MomokaInfo
}

# operations(by: ProfileId): PublicationOperations

createdAt
}

fragment CommentBase on Comment {
id
by {
...ProfileFields
}

# The metadata for the post
# metadata: PublicationMetadata!

# # The collect module
# openActionModules: [OpenActionModule!]!

# # The reference module
# referenceModule: ReferenceModule

publishedOn {
...App
}
isHidden
isGated
momoka {
...MomokaInfo
}

# operations(by: ProfileId): PublicationOperations

createdAt
}

fragment Comment on Comment {
...CommentBase
root {
...Post
}
commentOn {
... on Post {
...Post
}
... on Comment {
...CommentBase
}
... on Quote {
...QuoteBase
}
}
firstComment {
...CommentBase
}
}

fragment Mirror on Mirror {
id
by {
...ProfileFields
}
momoka {
...MomokaInfo
}
mirrorOf {
... on Post {
...Post
}
... on Comment {
...Comment
}
... on Quote {
...Quote
}
}
createdAt
}

fragment QuoteBase on Quote {
id
by {
...ProfileFields
}

# # The metadata for the post
# metadata: PublicationMetadata!

# # The collect module
# openActionModules: [OpenActionModule!]!

# # The reference module
# referenceModule: ReferenceModule

publishedOn {
...App
}
isHidden
isGated
momoka {
...MomokaInfo
}

# operations(by: ProfileId): PublicationOperations

createdAt
}

fragment Quote on Quote {
...QuoteBase
quotedOn {
... on Post {
...Post
}
... on Comment {
...CommentBase
}
... on Quote {
...QuoteBase
}
}
}
8 changes: 4 additions & 4 deletions packages/client/src/profile/graphql/profile.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export type ProfilesQuery = {
export const ProfileDocument = gql`
query Profile(
$request: ProfileRequest!
$profileCoverTransform: ImageTransform
$profilePictureTransform: ImageTransform
$profileCoverTransform: ImageTransform = {}
$profilePictureTransform: ImageTransform = {}
) {
result: profile(request: $request) {
...Profile
Expand All @@ -43,8 +43,8 @@ export const ProfileDocument = gql`
export const ProfilesDocument = gql`
query Profiles(
$request: ProfilesRequest!
$profileCoverTransform: ImageTransform
$profilePictureTransform: ImageTransform
$profileCoverTransform: ImageTransform = {}
$profilePictureTransform: ImageTransform = {}
) {
result: profiles(request: $request) {
items {
Expand Down
Loading

0 comments on commit 9d93f09

Please sign in to comment.