Skip to content

Commit

Permalink
Merge pull request #21 from vernaillen/replace-schema
Browse files Browse the repository at this point in the history
Allow user to replace schema
  • Loading branch information
vernaillen authored Mar 1, 2024
2 parents 3555a02 + afe9abd commit faa346e
Show file tree
Hide file tree
Showing 6 changed files with 1,556 additions and 105 deletions.
5 changes: 3 additions & 2 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export default defineNuxtConfig({
frontendUrl: 'https://demo.wpnuxt.com',
faustSecretKey: '',
showBlockInfo: false,
debug: false
debug: false,
replaceSchema: true
},
graphqlMiddleware: {
downloadSchema: false,
downloadSchema: true,
},
ui: {
icons: ['heroicons', 'uil', 'mdi']
Expand Down
6 changes: 5 additions & 1 deletion playground/pages/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ if (post?.data?.title) {
/>
</div>
<div class="test-sm mt-10">
published:
published:<br>
{{ post.data.date.split('T')[0] }}
</div>
<div class="test-sm mt-10">
meta:<br>
{{ post.data.seo.metaDesc }}
</div>
<div
v-if="isStaging"
class="test-sm mt-5"
Expand Down
316 changes: 316 additions & 0 deletions playground/queries/testyoastseo.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
fragment ContentNode on ContentNode {
# contentType
contentTypeName
databaseId
date
dateGmt
desiredSlug
# editingLockedBy
enclosure
# enqueuedScripts
# enqueuedStylesheets
guid
id
isContentNode
isPreview
isRestricted
isTermNode
# lastEditedBy
link
modified
modifiedGmt
previewRevisionDatabaseId
previewRevisionId
slug
status
# template
uri
}
fragment CoreGallery on CoreGallery {
...EditorBlock
innerBlocks {
...CoreImage
}
}
fragment CoreImage on CoreImage {
...EditorBlock
attributes {
align
alt
anchor
aspectRatio
borderColor
caption
className
cssClassName
height
href
id
linkClass
linkDestination
linkTarget
lock
rel
scale
sizeSlug
src
style
title
url
width
}
}
fragment CoreParagraph on CoreParagraph {
...EditorBlock
attributes {
content
}
}
fragment CoreQuote on CoreQuote {
...EditorBlock
}
fragment EditorBlock on EditorBlock {
apiVersion
blockEditorCategoryName
clientId
cssClassNames
isDynamic
name
parentClientId
renderedHtml
}
fragment MediaItem on MediaItem {
altText
# ancestors
# author
authorDatabaseId
authorId
caption
# children
commentCount
commentStatus
# comments
# contentType
contentTypeName
databaseId
date
dateGmt
description
desiredSlug
# editingLockedBy
enclosure
# enqueuedScripts
# enqueuedStylesheets
fileSize
guid
id
isContentNode
isPreview
isRestricted
isTermNode
# lastEditedBy
link
# mediaDetails
mediaItemId
mediaItemUrl
mediaType
mimeType
modified
modifiedGmt
# parent
parentDatabaseId
parentId
previewRevisionDatabaseId
previewRevisionId
sizes
slug
sourceUrl
srcSet
status
# template
title
uri
}
fragment NodeWithExcerpt on NodeWithExcerpt {
excerpt
id
}
fragment NodeWithFeaturedImage on NodeWithFeaturedImage {
featuredImage {
...NodeWithFeaturedImageToMediaItemConnectionEdge
}
featuredImageDatabaseId
featuredImageId
id
}
fragment NodeWithFeaturedImageToMediaItemConnectionEdge on NodeWithFeaturedImageToMediaItemConnectionEdge {
cursor
node {
...MediaItem
}
}
fragment Page on Page {
...ContentNode
content
isFrontPage
isPostsPage
isPreview
isPrivacyPage
isRestricted
isRevision
title
editorBlocks {
name
...CoreGallery
...CoreImage
...CoreParagraph
...CoreQuote
...EditorBlock
}
}
fragment Post on Post {
...ContentNode
...NodeWithFeaturedImage
content
title
editorBlocks {
name
...CoreGallery
...CoreImage
...CoreParagraph
...CoreQuote
...EditorBlock
}
}

query Pages($limit: Int = 10) {
pages(first: $limit) {
nodes {
...Page
}
}
}
query Posts($limit: Int = 10) {
posts(first: $limit) {
nodes {
...Post
...NodeWithExcerpt
}
}
}
query LatestPost {
posts(first: 1) {
nodes {
...Post
...NodeWithExcerpt
}
}
}
query PostByUri($uri: String!) {
nodeByUri(uri: $uri) {
...Page
...Post
}
}
query PostById($id: ID!, $asPreview: Boolean = false) {
post(id: $id, idType: DATABASE_ID, asPreview: $asPreview) {
...Post
}
}
query PageById($id: ID!) {
page(id: $id, idType: DATABASE_ID, asPreview: true) {
...Page
}
}
query Settings {
generalSettings {
title
description
url
email
dateFormat
language
startOfWeek
timezone
timeFormat
}
}
query Menu($name: ID! = "main", $idType: MenuNodeIdTypeEnum! = NAME) {
menu(id: $name, idType: $idType) {
id
name
menuItems {
nodes {
label
uri
}
}
}
}
query Viewer {
viewer {
username
userId
id
email
description
firstName
lastName
locale
url
uri
}
}
query Revisions {
revisions {
nodes {
date
uri
isPreview
}
}
}

fragment Page on Page {
...ContentNode
content
isFrontPage
isPostsPage
isPreview
isPrivacyPage
isRestricted
isRevision
title
editorBlocks {
name
...CoreGallery
...CoreImage
...CoreParagraph
...CoreQuote
...EditorBlock
}
seo {
metaDesc
title
fullHead
}
}
fragment Post on Post {
...ContentNode
...NodeWithFeaturedImage
content
title
editorBlocks {
name
...CoreGallery
...CoreImage
...CoreParagraph
...CoreQuote
...EditorBlock
}
seo {
metaDesc
title
fullHead
}
}
Loading

0 comments on commit faa346e

Please sign in to comment.