├── .gitignore ├── lerna.json ├── package.json ├── packages ├── apollo-wordpress │ ├── .babelrc │ ├── .editorconfig │ ├── .env │ ├── .eslintrc.json │ ├── .flowconfig │ ├── .gitignore │ ├── .stylelintrc.json │ ├── README.md │ ├── kyt.dev.js │ ├── kyt.prod.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── apollo │ │ │ ├── fragmentMatcher.js │ │ │ ├── networkInterface.js │ │ │ └── queries.json │ │ ├── client │ │ │ └── index.js │ │ ├── components │ │ │ ├── Comments │ │ │ │ ├── Comment │ │ │ │ │ ├── DeleteButton.js │ │ │ │ │ ├── Edit.js │ │ │ │ │ ├── SubmitButton.js │ │ │ │ │ └── index.js │ │ │ │ ├── Form.js │ │ │ │ ├── Walker.js │ │ │ │ ├── constants.js │ │ │ │ ├── index.js │ │ │ │ └── types.js │ │ │ ├── ContentNode │ │ │ │ ├── Element.js │ │ │ │ ├── Embed.js │ │ │ │ └── index.js │ │ │ ├── Post.js │ │ │ ├── PostLink.js │ │ │ ├── Settings.js │ │ │ └── __tests__ │ │ │ │ └── App.test.js │ │ ├── containers │ │ │ ├── App.js │ │ │ ├── Archive.js │ │ │ └── Media.js │ │ ├── decorators │ │ │ ├── IntlProvider.js │ │ │ └── withIntl.js │ │ ├── graphql │ │ │ ├── fragment │ │ │ │ ├── Archive_posts.graphql │ │ │ │ ├── Comment_comment.graphql │ │ │ │ ├── Comments_comments.graphql │ │ │ │ ├── ContentNode_content.graphql │ │ │ │ ├── Element_node.graphql │ │ │ │ ├── Embed_node.graphql │ │ │ │ ├── Image_image.graphql │ │ │ │ ├── Media_media.graphql │ │ │ │ ├── NavMenu_navMenu.graphql │ │ │ │ ├── PostLink_post.graphql │ │ │ │ ├── Post_post.graphql │ │ │ │ ├── Settings_settings.graphql │ │ │ │ ├── Sidebar_sidebar.graphql │ │ │ │ └── Walker_comments.graphql │ │ │ ├── mutation │ │ │ │ ├── AddComment.graphql │ │ │ │ ├── DeleteComment.graphql │ │ │ │ └── UpdateComment.graphql │ │ │ └── query │ │ │ │ ├── App.graphql │ │ │ │ ├── Author.graphql │ │ │ │ ├── Chart.graphql │ │ │ │ ├── Date.graphql │ │ │ │ ├── Home.graphql │ │ │ │ ├── Page.graphql │ │ │ │ ├── Search.graphql │ │ │ │ ├── Single.graphql │ │ │ │ └── Term.graphql │ │ ├── langs │ │ │ └── en.js │ │ ├── public │ │ │ ├── css │ │ │ │ └── gigpress.css │ │ │ ├── favicon.ico │ │ │ ├── icons │ │ │ │ ├── 120x120.jpg │ │ │ │ ├── 152x152.png │ │ │ │ ├── 60x60.png │ │ │ │ ├── 76x76.png │ │ │ │ └── favicon.ico │ │ │ ├── images │ │ │ │ ├── icons │ │ │ │ │ └── icon-activity-indicator.gif │ │ │ │ └── react-graphql.png │ │ │ ├── js │ │ │ │ └── tota11y.min.js │ │ │ └── kyt-favicon.png │ │ ├── routes │ │ │ ├── Chart.js │ │ │ ├── Date.js │ │ │ ├── Home.js │ │ │ ├── Page.js │ │ │ ├── Search.js │ │ │ ├── Single.js │ │ │ ├── Term.js │ │ │ ├── __tests__ │ │ │ │ └── Home.test.js │ │ │ └── index.js │ │ ├── server │ │ │ ├── index.js │ │ │ ├── router.js │ │ │ └── template.js │ │ ├── types │ │ │ ├── index.js │ │ │ └── index.ts │ │ └── utils │ │ │ ├── constants.js │ │ │ ├── regex.js │ │ │ └── walker.js │ ├── tools │ │ ├── fragmentMatcher.json │ │ ├── schema.graphql │ │ └── schema.json │ └── yarn.lock ├── draft-server │ └── README.md ├── draft │ └── README.md ├── graphql-wordpress-components │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintrc.json │ ├── .flowconfig │ ├── .gitignore │ ├── .npmignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── App │ │ │ └── index.js │ │ ├── Archive │ │ │ └── index.js │ │ ├── Chart │ │ │ └── index.js │ │ ├── Comments │ │ │ └── index.js │ │ ├── Error │ │ │ └── index.js │ │ ├── Header │ │ │ └── index.js │ │ ├── Home │ │ │ └── index.js │ │ ├── Image │ │ │ └── index.js │ │ ├── Loading │ │ │ └── index.js │ │ ├── NavMenu │ │ │ └── index.js │ │ ├── Post │ │ │ └── index.js │ │ ├── Search │ │ │ └── index.js │ │ ├── Sidebar │ │ │ └── index.js │ │ ├── Single │ │ │ └── index.js │ │ ├── global.js │ │ ├── index.js │ │ ├── responsive.js │ │ ├── server.js │ │ ├── theme.js │ │ └── walker.js │ └── yarn.lock ├── graphql-wordpress-middleware │ ├── README.md │ ├── cli.php │ ├── composer.json │ ├── composer.lock │ ├── lib │ │ ├── Commands │ │ │ └── OEmbed.php │ │ ├── Parser │ │ │ └── HTML.php │ │ ├── REST │ │ │ └── Controller │ │ │ │ ├── Comments.php │ │ │ │ ├── NavMenus.php │ │ │ │ ├── PostTypes.php │ │ │ │ ├── Posts.php │ │ │ │ ├── Settings.php │ │ │ │ ├── Sidebars.php │ │ │ │ └── Taxonomies.php │ │ ├── functions.php │ │ └── rest-api.php │ ├── vendor │ │ ├── autoload.php │ │ ├── composer │ │ │ ├── ClassLoader.php │ │ │ ├── LICENSE │ │ │ ├── autoload_classmap.php │ │ │ ├── autoload_files.php │ │ │ ├── autoload_namespaces.php │ │ │ ├── autoload_psr4.php │ │ │ ├── autoload_real.php │ │ │ ├── autoload_static.php │ │ │ └── installed.json │ │ └── masterminds │ │ │ └── html5 │ │ │ ├── .gitignore │ │ │ ├── .scrutinizer.yml │ │ │ ├── .travis.yml │ │ │ ├── CREDITS │ │ │ ├── LICENSE.txt │ │ │ ├── README.md │ │ │ ├── RELEASE.md │ │ │ ├── UPGRADING.md │ │ │ ├── bin │ │ │ └── entities.php │ │ │ ├── composer.json │ │ │ ├── example.php │ │ │ ├── phpunit.xml.dist │ │ │ ├── sami.php │ │ │ ├── src │ │ │ ├── HTML5.php │ │ │ └── HTML5 │ │ │ │ ├── Elements.php │ │ │ │ ├── Entities.php │ │ │ │ ├── Exception.php │ │ │ │ ├── InstructionProcessor.php │ │ │ │ ├── Parser │ │ │ │ ├── CharacterReference.php │ │ │ │ ├── DOMTreeBuilder.php │ │ │ │ ├── EventHandler.php │ │ │ │ ├── FileInputStream.php │ │ │ │ ├── InputStream.php │ │ │ │ ├── ParseError.php │ │ │ │ ├── README.md │ │ │ │ ├── Scanner.php │ │ │ │ ├── StringInputStream.php │ │ │ │ ├── Tokenizer.php │ │ │ │ ├── TreeBuildingRules.php │ │ │ │ └── UTF8Utils.php │ │ │ │ └── Serializer │ │ │ │ ├── HTML5Entities.php │ │ │ │ ├── OutputRules.php │ │ │ │ ├── README.md │ │ │ │ ├── RulesInterface.php │ │ │ │ └── Traverser.php │ │ │ └── test │ │ │ ├── HTML5 │ │ │ ├── ElementsTest.php │ │ │ ├── Html5Test.html │ │ │ ├── Html5Test.php │ │ │ ├── Parser │ │ │ │ ├── CharacterReferenceTest.php │ │ │ │ ├── DOMTreeBuilderTest.php │ │ │ │ ├── EventStack.php │ │ │ │ ├── EventStackError.php │ │ │ │ ├── FileInputStreamTest.html │ │ │ │ ├── FileInputStreamTest.php │ │ │ │ ├── InstructionProcessorMock.php │ │ │ │ ├── ScannerTest.php │ │ │ │ ├── StringInputStreamTest.php │ │ │ │ ├── TokenizerTest.php │ │ │ │ ├── TreeBuildingRulesTest.php │ │ │ │ └── UTF8UtilsTest.php │ │ │ ├── Serializer │ │ │ │ ├── OutputRulesTest.php │ │ │ │ └── TraverserTest.php │ │ │ └── TestCase.php │ │ │ └── benchmark │ │ │ ├── example.html │ │ │ └── run.php │ └── wp-graphql-middleware.php ├── graphql-wordpress-native-components │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintrc.json │ ├── .gitignore │ ├── .npmignore │ ├── package.json │ ├── src │ │ ├── Content.js │ │ ├── Element.js │ │ ├── Embed.js │ │ └── index.js │ └── yarn.lock ├── graphql-wordpress │ ├── .babelrc │ ├── .editorconfig │ ├── .env │ ├── .eslintrc.json │ ├── .gitignore │ ├── .nginx │ ├── README.md │ ├── __mocks__ │ │ └── dataloader.js │ ├── generated │ │ ├── fragmentMatcher.json │ │ ├── queries.json │ │ ├── schema.graphql │ │ └── schema.json │ ├── jest │ │ ├── setup.js │ │ └── utils.js │ ├── package.json │ ├── src │ │ ├── data │ │ │ ├── Category.js │ │ │ ├── Chart.js │ │ │ ├── Comment.js │ │ │ ├── Media.js │ │ │ ├── NavMenu.js │ │ │ ├── Page.js │ │ │ ├── Post.js │ │ │ ├── Settings.js │ │ │ ├── Sidebar.js │ │ │ ├── Tag.js │ │ │ ├── Taxonomy.js │ │ │ ├── User.js │ │ │ ├── __tests__ │ │ │ │ ├── Category.test.js │ │ │ │ ├── Chart.test.js │ │ │ │ ├── Comment │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ ├── collection.test.js.snap │ │ │ │ │ │ ├── create.test.js.snap │ │ │ │ │ │ ├── delete.test.js.snap │ │ │ │ │ │ ├── empty.test.js.snap │ │ │ │ │ │ ├── error.test.js.snap │ │ │ │ │ │ └── update.test.js.snap │ │ │ │ │ ├── collection.test.js │ │ │ │ │ ├── create.test.js │ │ │ │ │ ├── delete.test.js │ │ │ │ │ ├── empty.test.js │ │ │ │ │ ├── error.test.js │ │ │ │ │ └── update.test.js │ │ │ │ ├── Media.test.js │ │ │ │ ├── NavMenu.test.js │ │ │ │ ├── Page.test.js │ │ │ │ ├── Post.test.js │ │ │ │ ├── Settings.test.js │ │ │ │ ├── Sidebar.test.js │ │ │ │ ├── Tag.test.js │ │ │ │ ├── Taxonomy.test.js │ │ │ │ ├── User.test.js │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── Category.test.js.snap │ │ │ │ │ ├── Chart.test.js.snap │ │ │ │ │ ├── Media.test.js.snap │ │ │ │ │ ├── NavMenu.test.js.snap │ │ │ │ │ ├── Page.test.js.snap │ │ │ │ │ ├── Post.test.js.snap │ │ │ │ │ ├── Settings.test.js.snap │ │ │ │ │ ├── Sidebar.test.js.snap │ │ │ │ │ ├── Tag.test.js.snap │ │ │ │ │ ├── Taxonomy.test.js.snap │ │ │ │ │ ├── User.test.js.snap │ │ │ │ │ └── utils.test.js.snap │ │ │ │ └── utils.test.js │ │ │ ├── client.js │ │ │ ├── loaders │ │ │ │ ├── Category.js │ │ │ │ ├── Chart.js │ │ │ │ ├── Comment.js │ │ │ │ ├── Media.js │ │ │ │ ├── NavMenu.js │ │ │ │ ├── Page.js │ │ │ │ ├── Post.js │ │ │ │ ├── Settings.js │ │ │ │ ├── Sidebar.js │ │ │ │ ├── Tag.js │ │ │ │ ├── Taxonomy.js │ │ │ │ ├── User.js │ │ │ │ ├── __tests__ │ │ │ │ │ ├── Category.test.js │ │ │ │ │ ├── Chart.test.js │ │ │ │ │ ├── Comment.test.js │ │ │ │ │ ├── Media.test.js │ │ │ │ │ ├── NavMenu.test.js │ │ │ │ │ ├── Page.test.js │ │ │ │ │ ├── Post.test.js │ │ │ │ │ ├── Settings.test.js │ │ │ │ │ ├── Sidebar.test.js │ │ │ │ │ ├── Tag.test.js │ │ │ │ │ ├── Taxonomy.test.js │ │ │ │ │ ├── User.test.js │ │ │ │ │ └── __snapshots__ │ │ │ │ │ │ ├── Category.test.js.snap │ │ │ │ │ │ ├── Chart.test.js.snap │ │ │ │ │ │ ├── Comment.test.js.snap │ │ │ │ │ │ ├── Media.test.js.snap │ │ │ │ │ │ ├── NavMenu.test.js.snap │ │ │ │ │ │ ├── Page.test.js.snap │ │ │ │ │ │ ├── Post.test.js.snap │ │ │ │ │ │ ├── Settings.test.js.snap │ │ │ │ │ │ ├── Sidebar.test.js.snap │ │ │ │ │ │ ├── Tag.test.js.snap │ │ │ │ │ │ ├── Taxonomy.test.js.snap │ │ │ │ │ │ └── User.test.js.snap │ │ │ │ └── index.js │ │ │ └── utils.js │ │ ├── middleware │ │ │ └── queryLogger.js │ │ ├── schema │ │ │ ├── __tests__ │ │ │ │ ├── Category.test.js │ │ │ │ ├── Image.test.js │ │ │ │ ├── NavMenu.test.js │ │ │ │ ├── Node.test.js │ │ │ │ ├── Page.test.js │ │ │ │ ├── Post.test.js │ │ │ │ ├── Schema.test.js │ │ │ │ ├── Sidebar.test.js │ │ │ │ ├── Tag.test.js │ │ │ │ ├── Term.test.js │ │ │ │ ├── User.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ ├── Category.test.js.snap │ │ │ │ │ ├── Image.test.js.snap │ │ │ │ │ ├── NavMenu.test.js.snap │ │ │ │ │ ├── Node.test.js.snap │ │ │ │ │ ├── Page.test.js.snap │ │ │ │ │ ├── Post.test.js.snap │ │ │ │ │ ├── Schema.test.js.snap │ │ │ │ │ ├── Sidebar.test.js.snap │ │ │ │ │ ├── Tag.test.js.snap │ │ │ │ │ ├── Term.test.js.snap │ │ │ │ │ └── User.test.js.snap │ │ │ ├── connection │ │ │ │ ├── Comment.js │ │ │ │ └── Post.js │ │ │ ├── enum │ │ │ │ ├── CommentOrderby.js │ │ │ │ ├── CommentStatus.js │ │ │ │ ├── Format.js │ │ │ │ ├── MediaType.js │ │ │ │ ├── Order.js │ │ │ │ ├── PageOrderby.js │ │ │ │ ├── PingStatus.js │ │ │ │ ├── PostOrderby.js │ │ │ │ ├── TaxonomyOrderby.js │ │ │ │ ├── UserOrderby.js │ │ │ │ └── __tests__ │ │ │ │ │ ├── CommentOrderby.test.js │ │ │ │ │ ├── CommentStatus.test.js │ │ │ │ │ ├── Format.test.js │ │ │ │ │ ├── MediaType.test.js │ │ │ │ │ ├── Order.test.js │ │ │ │ │ ├── PageOrderby.test.js │ │ │ │ │ ├── PingStatus.test.js │ │ │ │ │ ├── PostOrderby.test.js │ │ │ │ │ ├── TaxonomyOrderby.test.js │ │ │ │ │ ├── UserOrderby.test.js │ │ │ │ │ └── __snapshots__ │ │ │ │ │ ├── CommentOrderby.test.js.snap │ │ │ │ │ ├── CommentStatus.test.js.snap │ │ │ │ │ ├── Format.test.js.snap │ │ │ │ │ ├── MediaType.test.js.snap │ │ │ │ │ ├── Order.test.js.snap │ │ │ │ │ ├── PageOrderby.test.js.snap │ │ │ │ │ ├── PingStatus.test.js.snap │ │ │ │ │ ├── PostOrderby.test.js.snap │ │ │ │ │ ├── TaxonomyOrderby.test.js.snap │ │ │ │ │ └── UserOrderby.test.js.snap │ │ │ ├── field │ │ │ │ ├── __tests__ │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ ├── author.test.js.snap │ │ │ │ │ │ ├── content.test.js.snap │ │ │ │ │ │ ├── date.test.js.snap │ │ │ │ │ │ ├── description.test.js.snap │ │ │ │ │ │ ├── identifier.test.js.snap │ │ │ │ │ │ ├── media.test.js.snap │ │ │ │ │ │ ├── meta.test.js.snap │ │ │ │ │ │ ├── post.test.js.snap │ │ │ │ │ │ ├── protected.test.js.snap │ │ │ │ │ │ ├── raw.test.js.snap │ │ │ │ │ │ ├── rendered.test.js.snap │ │ │ │ │ │ ├── status.test.js.snap │ │ │ │ │ │ └── taxonomy.test.js.snap │ │ │ │ │ ├── author.test.js │ │ │ │ │ ├── content.test.js │ │ │ │ │ ├── date.test.js │ │ │ │ │ ├── description.test.js │ │ │ │ │ ├── identifier.test.js │ │ │ │ │ ├── media.test.js │ │ │ │ │ ├── meta.test.js │ │ │ │ │ ├── post.test.js │ │ │ │ │ ├── protected.test.js │ │ │ │ │ ├── raw.test.js │ │ │ │ │ ├── rendered.test.js │ │ │ │ │ ├── status.test.js │ │ │ │ │ └── taxonomy.test.js │ │ │ │ ├── author.js │ │ │ │ ├── content.js │ │ │ │ ├── date.js │ │ │ │ ├── description.js │ │ │ │ ├── identifier.js │ │ │ │ ├── media.js │ │ │ │ ├── meta.js │ │ │ │ ├── post.js │ │ │ │ ├── protected.js │ │ │ │ ├── raw.js │ │ │ │ ├── rendered.js │ │ │ │ ├── status.js │ │ │ │ └── taxonomy.js │ │ │ ├── index.js │ │ │ ├── interface │ │ │ │ ├── Media.js │ │ │ │ ├── Post.js │ │ │ │ └── Term.js │ │ │ ├── mutation │ │ │ │ └── Comment.js │ │ │ └── type │ │ │ │ ├── Avatar.js │ │ │ │ ├── Caption.js │ │ │ │ ├── Category.js │ │ │ │ ├── Chart │ │ │ │ ├── Chart.js │ │ │ │ ├── ChartItem.js │ │ │ │ ├── ChartItemImage.js │ │ │ │ ├── __tests__ │ │ │ │ │ ├── Chart.test.js │ │ │ │ │ ├── ChartItem.test.js │ │ │ │ │ ├── ChartItemImage.test.js │ │ │ │ │ └── __snapshots__ │ │ │ │ │ │ ├── Chart.test.js.snap │ │ │ │ │ │ ├── ChartItem.test.js.snap │ │ │ │ │ │ └── ChartItemImage.test.js.snap │ │ │ │ └── index.js │ │ │ │ ├── Comment.js │ │ │ │ ├── Content.js │ │ │ │ ├── ContentNode │ │ │ │ ├── Element.js │ │ │ │ ├── Embed.js │ │ │ │ ├── Text.js │ │ │ │ └── index.js │ │ │ │ ├── Description.js │ │ │ │ ├── Excerpt.js │ │ │ │ ├── Guid.js │ │ │ │ ├── Labels.js │ │ │ │ ├── Media │ │ │ │ ├── Audio │ │ │ │ │ ├── Details.js │ │ │ │ │ └── index.js │ │ │ │ ├── Image │ │ │ │ │ ├── Details.js │ │ │ │ │ └── index.js │ │ │ │ ├── Size.js │ │ │ │ ├── Video │ │ │ │ │ ├── Details.js │ │ │ │ │ └── index.js │ │ │ │ ├── __tests__ │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ └── fields.test.js.snap │ │ │ │ │ └── fields.test.js │ │ │ │ ├── fields.js │ │ │ │ └── index.js │ │ │ │ ├── Meta.js │ │ │ │ ├── Mutation.js │ │ │ │ ├── NavMenu.js │ │ │ │ ├── NavMenuItem.js │ │ │ │ ├── Page.js │ │ │ │ ├── Post.js │ │ │ │ ├── Query.js │ │ │ │ ├── Rewrite.js │ │ │ │ ├── Settings.js │ │ │ │ ├── Sidebar.js │ │ │ │ ├── Tag.js │ │ │ │ ├── Taxonomy.js │ │ │ │ ├── Title.js │ │ │ │ ├── User.js │ │ │ │ ├── Viewer.js │ │ │ │ ├── Widget.js │ │ │ │ ├── __tests__ │ │ │ │ ├── Category.test.js │ │ │ │ ├── Comment.test.js │ │ │ │ ├── NavMenu.test.js │ │ │ │ ├── NavMenuItem.test.js │ │ │ │ ├── Page.test.js │ │ │ │ ├── Post.test.js │ │ │ │ ├── Query.test.js │ │ │ │ ├── Sidebar.test.js │ │ │ │ ├── Tag.test.js │ │ │ │ ├── Taxonomy.test.js │ │ │ │ ├── User.test.js │ │ │ │ ├── Viewer.test.js │ │ │ │ ├── Widget.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ ├── Category.test.js.snap │ │ │ │ │ ├── Comment.test.js.snap │ │ │ │ │ ├── NavMenu.test.js.snap │ │ │ │ │ ├── NavMenuItem.test.js.snap │ │ │ │ │ ├── Page.test.js.snap │ │ │ │ │ ├── Post.test.js.snap │ │ │ │ │ ├── Query.test.js.snap │ │ │ │ │ ├── Sidebar.test.js.snap │ │ │ │ │ ├── Tag.test.js.snap │ │ │ │ │ ├── Taxonomy.test.js.snap │ │ │ │ │ ├── User.test.js.snap │ │ │ │ │ ├── Viewer.test.js.snap │ │ │ │ │ └── Widget.test.js.snap │ │ │ │ └── relayNode.js │ │ └── server.js │ ├── updateSchema.js │ └── yarn.lock ├── react-native-apollo-wordpress │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintrc.json │ ├── .flowconfig │ ├── .gitignore │ ├── .watchmanconfig │ ├── App.js │ ├── App.test.js │ ├── README.md │ ├── app.json │ ├── package.json │ ├── src │ │ ├── components │ │ │ ├── Archive.js │ │ │ ├── Content.js │ │ │ ├── Element.js │ │ │ ├── Embed.js │ │ │ ├── Error.js │ │ │ ├── Header.js │ │ │ ├── Loading.js │ │ │ ├── NavMenu.js │ │ │ ├── Post.js │ │ │ ├── PostLink.js │ │ │ ├── ResponsiveImage.js │ │ │ └── Wrapper.js │ │ ├── graphql │ │ │ ├── Author_Query.graphql │ │ │ ├── Content_content.graphql │ │ │ ├── Content_content_data.graphql │ │ │ ├── Date_Query.graphql │ │ │ ├── Element_node.graphql │ │ │ ├── Embed_node.graphql │ │ │ ├── Home_Query.graphql │ │ │ ├── NavMenu_navMenu.graphql │ │ │ ├── Page_Query.graphql │ │ │ ├── PostLink_post.graphql │ │ │ ├── Post_post.graphql │ │ │ ├── ResponsiveImage_featuredMedia.graphql │ │ │ ├── Single_Query.graphql │ │ │ ├── Term_Query.graphql │ │ │ └── Wrapper_Query.graphql │ │ ├── routes │ │ │ ├── Date.js │ │ │ ├── Home.js │ │ │ ├── Page.js │ │ │ ├── Single.js │ │ │ └── Term.js │ │ ├── styles │ │ │ └── archive.js │ │ └── utils │ │ │ ├── regex.js │ │ │ └── walker.js │ ├── tools │ │ ├── fragmentMatcher.json │ │ ├── schema.graphql │ │ └── schema.json │ └── yarn.lock ├── react-native-relay-wordpress │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintrc.json │ ├── .flowconfig │ ├── .gitignore │ ├── .watchmanconfig │ ├── App.js │ ├── App.test.js │ ├── README.md │ ├── app.json │ ├── package.json │ ├── src │ │ ├── components │ │ │ ├── Archive.js │ │ │ ├── Content.js │ │ │ ├── Element.js │ │ │ ├── Embed.js │ │ │ ├── Error.js │ │ │ ├── Header.js │ │ │ ├── NavMenu.js │ │ │ ├── Post.js │ │ │ ├── PostLink.js │ │ │ ├── ResponsiveImage.js │ │ │ ├── Wrapper.js │ │ │ └── __generated__ │ │ │ │ ├── Content_content.graphql.js │ │ │ │ ├── Content_content_data.graphql.js │ │ │ │ ├── Element_node.graphql.js │ │ │ │ ├── Embed_node.graphql.js │ │ │ │ ├── NavMenu_navMenu.graphql.js │ │ │ │ ├── PostLink_post.graphql.js │ │ │ │ ├── Post_post.graphql.js │ │ │ │ └── ResponsiveImage_featuredMedia.graphql.js │ │ ├── queries │ │ │ ├── Author.js │ │ │ ├── Date.js │ │ │ ├── Home.js │ │ │ ├── Page.js │ │ │ ├── Single.js │ │ │ ├── Term.js │ │ │ ├── Wrapper.js │ │ │ └── __generated__ │ │ │ │ ├── Author_Query.graphql.js │ │ │ │ ├── Date_Query.graphql.js │ │ │ │ ├── Home_Query.graphql.js │ │ │ │ ├── Page_Query.graphql.js │ │ │ │ ├── Single_Query.graphql.js │ │ │ │ ├── Term_Query.graphql.js │ │ │ │ └── Wrapper_Query.graphql.js │ │ ├── relay │ │ │ └── environment.js │ │ ├── routes │ │ │ ├── Author.js │ │ │ ├── Date.js │ │ │ ├── Home.js │ │ │ ├── Page.js │ │ │ ├── Single.js │ │ │ ├── Term.js │ │ │ └── __generated__ │ │ │ │ ├── Author_viewer.graphql.js │ │ │ │ ├── Date_viewer.graphql.js │ │ │ │ ├── Home_viewer.graphql.js │ │ │ │ ├── Page_viewer.graphql.js │ │ │ │ ├── Single_viewer.graphql.js │ │ │ │ └── Term_viewer.graphql.js │ │ ├── styles │ │ │ └── archive.js │ │ └── utils │ │ │ ├── regex.js │ │ │ └── walker.js │ ├── tools │ │ ├── fragmentMatcher.json │ │ ├── schema.graphql │ │ └── schema.json │ └── yarn.lock ├── react-router-relay-modern │ ├── .babelrc │ ├── .eslintrc.json │ ├── .flowconfig │ ├── .gitignore │ ├── package.json │ ├── src │ │ ├── QuerySubscription.js │ │ ├── environment.js │ │ ├── fetcher.js │ │ ├── handlerProvider.js │ │ ├── prepareData.js │ │ └── utils │ │ │ └── index.js │ └── yarn.lock └── relay-wordpress │ ├── .babelrc │ ├── .editorconfig │ ├── .env │ ├── .eslintrc.json │ ├── .flowconfig │ ├── .gitignore │ ├── .prettierignore │ ├── .stylelintrc.json │ ├── README.md │ ├── flow-typed │ └── npm │ │ ├── express_v4.x.x.js │ │ └── react-intl_v2.x.x.js │ ├── kyt.dev.js │ ├── kyt.prod.js │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── client │ │ └── index.js │ ├── components │ │ ├── Comments │ │ │ ├── Comment │ │ │ │ ├── Edit │ │ │ │ │ └── index.js │ │ │ │ ├── __generated__ │ │ │ │ │ └── Comment_comment.graphql.js │ │ │ │ └── index.js │ │ │ ├── Form │ │ │ │ └── index.js │ │ │ ├── Walker │ │ │ │ └── index.js │ │ │ ├── constants.js │ │ │ └── index.js │ │ ├── ContentNode │ │ │ ├── Element.js │ │ │ ├── Embed.js │ │ │ ├── __generated__ │ │ │ │ ├── ContentNode_content.graphql.js │ │ │ │ ├── ContentNode_content_data.graphql.js │ │ │ │ ├── Element_node.graphql.js │ │ │ │ └── Embed_node.graphql.js │ │ │ └── index.js │ │ ├── ErrorBoundary.js │ │ ├── Post │ │ │ ├── PostLink.js │ │ │ ├── __generated__ │ │ │ │ ├── PostLink_post.graphql.js │ │ │ │ └── Post_post.graphql.js │ │ │ └── index.js │ │ └── Settings │ │ │ └── index.js │ ├── containers │ │ ├── App.js │ │ ├── Archive.js │ │ ├── Image.js │ │ ├── Media.js │ │ └── __generated__ │ │ │ ├── App_viewer.graphql.js │ │ │ ├── Image_image.graphql.js │ │ │ └── Media_media.graphql.js │ ├── decorators │ │ └── IntlProvider.js │ ├── langs │ │ └── en.js │ ├── mutations │ │ ├── AddComment.js │ │ ├── DeleteComment.js │ │ ├── UpdateComment.js │ │ └── __generated__ │ │ │ ├── AddComment_Mutation.graphql.js │ │ │ ├── DeleteComment_Mutation.graphql.js │ │ │ └── UpdateComment_Mutation.graphql.js │ ├── public │ │ ├── css │ │ │ └── gigpress.css │ │ ├── favicon.ico │ │ ├── icons │ │ │ ├── 120x120.jpg │ │ │ ├── 152x152.png │ │ │ ├── 60x60.png │ │ │ ├── 76x76.png │ │ │ ├── favicon.ico │ │ │ └── icon-activity-indicator.gif │ │ ├── images │ │ │ ├── calendar-links-bg.png │ │ │ ├── calendar-toggle.png │ │ │ ├── feed-icon-10x10.png │ │ │ ├── feed-icon-12x12.png │ │ │ ├── gigpress-icon-16.png │ │ │ ├── gigpress-icon-32.png │ │ │ ├── icalendar-icon.gif │ │ │ └── sort.png │ │ ├── js │ │ │ └── tota11y.min.js │ │ └── kyt-favicon.png │ ├── queries │ │ ├── App.js │ │ ├── Author.js │ │ ├── Chart.js │ │ ├── Date.js │ │ ├── Home.js │ │ ├── Page.js │ │ ├── Search.js │ │ ├── Single.js │ │ ├── Term.js │ │ └── __generated__ │ │ │ ├── App_Query.graphql.js │ │ │ ├── Author_Query.graphql.js │ │ │ ├── Chart_Query.graphql.js │ │ │ ├── Date_Query.graphql.js │ │ │ ├── Home_Query.graphql.js │ │ │ ├── Page_Query.graphql.js │ │ │ ├── Search_Query.graphql.js │ │ │ ├── Single_Query.graphql.js │ │ │ └── Term_Query.graphql.js │ ├── relay │ │ ├── environment.js │ │ ├── fetcher.js │ │ └── handlerProvider.js │ ├── routes │ │ ├── Author.js │ │ ├── Chart.js │ │ ├── Date.js │ │ ├── Home.js │ │ ├── Page.js │ │ ├── Search.js │ │ ├── Single.js │ │ ├── Term.js │ │ ├── __generated__ │ │ │ ├── Author_viewer.graphql.js │ │ │ ├── Chart_viewer.graphql.js │ │ │ ├── Date_viewer.graphql.js │ │ │ ├── Home_viewer.graphql.js │ │ │ ├── Page_viewer.graphql.js │ │ │ ├── Search_viewer.graphql.js │ │ │ ├── Single_viewer.graphql.js │ │ │ └── Term_viewer.graphql.js │ │ ├── __tests__ │ │ │ └── Home.test.js │ │ └── index.js │ ├── server │ │ ├── index.js │ │ ├── router.js │ │ └── template.js │ └── utils │ │ ├── constants.js │ │ ├── regex.js │ │ └── walker.js │ ├── tools │ ├── fragmentMatcher.json │ ├── persistedQueries.js │ ├── schema.graphql │ └── schema.json │ ├── types │ └── relay-wordpress.js │ └── yarn.lock └── scripts ├── apollo ├── graphql └── relay /.gitignore: -------------------------------------------------------------------------------- 1 | lerna-debug.log 2 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.2.0", 3 | "packages": [ 4 | "packages/*" 5 | ], 6 | "npmClient": "yarn", 7 | "commands": { 8 | "publish": { 9 | "ignore": [ 10 | "packages/graphql-wordpress-middleware" 11 | ] 12 | }, 13 | "bootstrap": { 14 | "ignore": [ 15 | "packages/graphql-wordpress-middleware" 16 | ] 17 | } 18 | }, 19 | "version": "0.0.2-13" 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIT", 3 | "devDependencies": { 4 | "lerna": "^2.2.0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "kyt-react" 4 | ], 5 | "plugins": [ 6 | "transform-decorators-legacy", 7 | "transform-class-properties", 8 | "transform-object-rest-spread", 9 | ["module-resolver",{ 10 | "root": ["./src"] 11 | }] 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | trim_trailing_whitespace = true 7 | end_of_line = lf 8 | insert_final_newline = true 9 | 10 | [docs/rules/linebreak-style.md] 11 | end_of_line = disabled 12 | 13 | [{docs/rules/{indent.md,no-mixed-spaces-and-tabs.md}] 14 | indent_style = disabled 15 | indent_size = disabled 16 | 17 | [docs/rules/no-trailing-spaces.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/.env: -------------------------------------------------------------------------------- 1 | GQL_HOST=http://localhost:8080 2 | GQL_PATH=/graphql 3 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint-config-kyt" 4 | ], 5 | 6 | "rules": { 7 | "jsx-a11y/href-no-hash": "off", 8 | "jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["invalidHref"] }], 9 | "no-underscore-dangle": ["error", { "allow": ["__typename"] }] 10 | }, 11 | 12 | "settings": { 13 | "import/resolver": { 14 | "babel-module": {} 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | 3 | [options] 4 | esproposal.decorators=ignore 5 | module.system.node.resolve_dirname=node_modules 6 | module.system.node.resolve_dirname=src 7 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | yarn-error.log 4 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/kyt/config/.stylelintrc.base.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/README.md: -------------------------------------------------------------------------------- 1 | [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) 2 | 3 | # apollo-wordpress 4 | Universal WordPress Theme powered by Apollo/GraphQL 5 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/kyt.dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | reactHotLoader: false, 3 | debug: false, 4 | 5 | modifyWebpackConfig(kytConfig, opts) { 6 | const config = Object.assign({}, kytConfig); 7 | if (opts.type === 'client' && !opts.reactHotLoader) { 8 | config.plugins.shift(); 9 | config.entry.main = [config.entry.main[0]]; 10 | } 11 | 12 | config.module.rules.push({ 13 | test: /\.(graphql|gql)$/, 14 | exclude: /node_modules/, 15 | loader: 'graphql-tag/loader', 16 | }); 17 | return config; 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/kyt.prod.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | serverURL: 'http://localhost:3004', 3 | modifyWebpackConfig(kytConfig) { 4 | const config = Object.assign({}, kytConfig); 5 | config.module.rules.push({ 6 | test: /\.(graphql|gql)$/, 7 | exclude: /node_modules/, 8 | loader: 'graphql-tag/loader', 9 | }); 10 | return config; 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/apollo/fragmentMatcher.js: -------------------------------------------------------------------------------- 1 | import { IntrospectionFragmentMatcher } from 'react-apollo'; 2 | import introspectionQueryResultData from '../../tools/fragmentMatcher.json'; 3 | 4 | const fragmentMatcher = new IntrospectionFragmentMatcher({ 5 | introspectionQueryResultData, 6 | }); 7 | 8 | export default fragmentMatcher; 9 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/apollo/networkInterface.js: -------------------------------------------------------------------------------- 1 | import { PersistedQueryNetworkInterface } from 'persistgraphql'; 2 | import queryMap from 'apollo/queries.json'; 3 | 4 | export default uri => { 5 | const networkInterface = new PersistedQueryNetworkInterface({ 6 | queryMap, 7 | uri, 8 | opts: { 9 | headers: { 10 | 'X-App-Name': 'apollo-wordpress', 11 | }, 12 | }, 13 | }); 14 | 15 | return networkInterface; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/components/Comments/constants.js: -------------------------------------------------------------------------------- 1 | export const AUTHOR_NAME_COOKIE = 'comment_author'; 2 | export const AUTHOR_EMAIL_COOKIE = 'comment_author_email'; 3 | export const AUTHOR_URL_COOKIE = 'comment_author_url'; 4 | export const COMMENTS_PER_PAGE = 100; 5 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/components/Comments/types.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types'; 2 | 3 | export const CommentConnectionType = PropTypes.shape({ 4 | edges: PropTypes.arrayOf( 5 | PropTypes.shape({ 6 | node: PropTypes.shape({ 7 | id: PropTypes.string, 8 | parent: PropTypes.string, 9 | }), 10 | }) 11 | ), 12 | }); 13 | 14 | export const CommentType = PropTypes.shape({ 15 | id: PropTypes.string, 16 | authorName: PropTypes.string, 17 | authorUrl: PropTypes.string, 18 | authorHash: PropTypes.string, 19 | date: PropTypes.string, 20 | content: PropTypes.shape({ 21 | rendered: PropTypes.string, 22 | raw: PropTypes.string, 23 | }), 24 | authorAvatarUrls: PropTypes.arrayOf( 25 | PropTypes.shape({ 26 | size: PropTypes.number, 27 | url: PropTypes.string, 28 | }) 29 | ), 30 | parent: PropTypes.string, 31 | post: PropTypes.string, 32 | }); 33 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/components/PostLink.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { Link } from 'found'; 4 | import { dateRegex } from 'utils/regex'; 5 | 6 | const PostLink = ({ children, post: { slug, date, title } }) => { 7 | const [, year, month, day] = dateRegex.exec(date); 8 | const url = `/${year}/${month}/${day}/${slug}`; 9 | if (children) { 10 | return {children}; 11 | } 12 | return {title.raw}; 13 | }; 14 | 15 | PostLink.propTypes = { 16 | // eslint-disable-next-line react/forbid-prop-types 17 | post: PropTypes.object.isRequired, 18 | children: PropTypes.node, 19 | }; 20 | 21 | PostLink.defaultProps = { 22 | children: null, 23 | }; 24 | 25 | export default PostLink; 26 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/components/__tests__/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { shallow } from 'enzyme'; 3 | import App from '../'; 4 | 5 | it('Test example', () => { 6 | const wrapper = shallow(); 7 | expect(wrapper.is('div')).toBeTruthy(); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/containers/Media.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import Image from '@wonderboymusic/graphql-wordpress-components/lib/Image'; 4 | 5 | const Media = ({ media, crop = null }) => { 6 | switch (media.__typename) { 7 | case 'Image': 8 | return ; 9 | default: 10 | return null; 11 | } 12 | }; 13 | 14 | Media.propTypes = { 15 | crop: PropTypes.string, 16 | // eslint-disable-next-line react/forbid-prop-types 17 | media: PropTypes.object.isRequired, 18 | }; 19 | 20 | Media.defaultProps = { 21 | crop: 'large', 22 | }; 23 | 24 | export default Media; 25 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/decorators/withIntl.js: -------------------------------------------------------------------------------- 1 | import { injectIntl } from 'react-intl'; 2 | 3 | export default component => injectIntl(component); 4 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Archive_posts.graphql: -------------------------------------------------------------------------------- 1 | #import "./Post_post.graphql" 2 | 3 | fragment Archive_posts on PostConnection { 4 | edges { 5 | node { 6 | ...Post_post 7 | } 8 | cursor 9 | } 10 | pageInfo { 11 | startCursor 12 | endCursor 13 | hasNextPage 14 | hasPreviousPage 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Comment_comment.graphql: -------------------------------------------------------------------------------- 1 | fragment Comment_comment on Comment { 2 | id 3 | authorName 4 | authorUrl 5 | authorHash 6 | date 7 | content { 8 | rendered 9 | raw 10 | } 11 | authorAvatarUrls { 12 | size 13 | url 14 | } 15 | parent 16 | post 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Comments_comments.graphql: -------------------------------------------------------------------------------- 1 | #import "./Walker_comments.graphql" 2 | 3 | fragment Comments_comments on CommentConnection { 4 | ...Walker_comments 5 | } 6 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Element_node.graphql: -------------------------------------------------------------------------------- 1 | fragment Element_node on Element { 2 | tagName 3 | attributes { 4 | name 5 | value 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Embed_node.graphql: -------------------------------------------------------------------------------- 1 | fragment Embed_node on Embed { 2 | title 3 | thumbnailUrl 4 | html 5 | width 6 | height 7 | } 8 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Image_image.graphql: -------------------------------------------------------------------------------- 1 | fragment Image_image on Media { 2 | ... on Image { 3 | sourceUrl 4 | mediaDetails { 5 | sizes { 6 | name 7 | sourceUrl 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Media_media.graphql: -------------------------------------------------------------------------------- 1 | #import "./Image_image.graphql" 2 | 3 | fragment Media_media on Media { 4 | __typename 5 | ...Image_image 6 | } 7 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/NavMenu_navMenu.graphql: -------------------------------------------------------------------------------- 1 | fragment NavMenu_navMenu on NavMenu { 2 | id 3 | name 4 | items { 5 | id 6 | title 7 | url 8 | parent 9 | order 10 | type 11 | typeName 12 | typeSlug 13 | dataSlug 14 | dataID 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/PostLink_post.graphql: -------------------------------------------------------------------------------- 1 | fragment PostLink_post on Post { 2 | slug 3 | date 4 | title { 5 | raw 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Post_post.graphql: -------------------------------------------------------------------------------- 1 | #import "./ContentNode_content.graphql" 2 | #import "./Media_media.graphql" 3 | #import "./PostLink_post.graphql" 4 | 5 | fragment Post_post on Post { 6 | id 7 | slug 8 | date 9 | title { 10 | raw 11 | } 12 | content { 13 | data { 14 | ...ContentNode_content 15 | } 16 | } 17 | excerpt { 18 | raw 19 | } 20 | featuredMedia { 21 | ...Media_media 22 | } 23 | ...PostLink_post 24 | } 25 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Settings_settings.graphql: -------------------------------------------------------------------------------- 1 | fragment Settings_settings on Settings { 2 | title 3 | description 4 | language 5 | } 6 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Sidebar_sidebar.graphql: -------------------------------------------------------------------------------- 1 | fragment Sidebar_sidebar on Sidebar { 2 | widgets { 3 | id 4 | classname 5 | content { 6 | rendered 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/fragment/Walker_comments.graphql: -------------------------------------------------------------------------------- 1 | #import "./Comment_comment.graphql" 2 | 3 | fragment Walker_comments on CommentConnection { 4 | edges { 5 | node { 6 | id 7 | parent 8 | ...Comment_comment 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/mutation/AddComment.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/Comment_comment.graphql" 2 | 3 | mutation AddComment($input: AddCommentInput!) { 4 | addComment(input: $input) { 5 | comment { 6 | ...Comment_comment 7 | } 8 | cookies 9 | status 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/mutation/DeleteComment.graphql: -------------------------------------------------------------------------------- 1 | mutation DeleteComment($input: DeleteCommentInput!) { 2 | deleteComment(input: $input) { 3 | status 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/mutation/UpdateComment.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/Comment_comment.graphql" 2 | 3 | mutation UpdateComment($input: UpdateCommentInput!) { 4 | updateComment(input: $input) { 5 | comment { 6 | ...Comment_comment 7 | } 8 | cookies 9 | status 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/App.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/Settings_settings.graphql" 2 | #import "../fragment/NavMenu_navMenu.graphql" 3 | #import "../fragment/Sidebar_sidebar.graphql" 4 | 5 | query App($menuID: ID!, $sidebarID: ID!) { 6 | viewer { 7 | settings { 8 | ...Settings_settings 9 | } 10 | navMenu(id: $menuID) { 11 | ...NavMenu_navMenu 12 | } 13 | sidebar(id: $sidebarID) { 14 | ...Sidebar_sidebar 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/Author.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/Archive_posts.graphql" 2 | 3 | query Author($id: ID!, $cursor: String, $count: Int) { 4 | viewer { 5 | author(id: $id) { 6 | id 7 | name 8 | } 9 | posts(author: $id, after: $cursor, first: $count) { 10 | ...Archive_posts 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/Chart.graphql: -------------------------------------------------------------------------------- 1 | query Chart { 2 | viewer { 3 | chart { 4 | title 5 | copyright 6 | updated 7 | authorName 8 | authorUri 9 | items { 10 | title 11 | artist 12 | releaseDate 13 | releaseDateFormatted 14 | url 15 | copyright 16 | images { 17 | url 18 | height 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/Date.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/Archive_posts.graphql" 2 | 3 | query Date($year: Int!, $month: Int, $day: Int, $cursor: String, $count: Int) { 4 | viewer { 5 | posts( 6 | year: $year 7 | month: $month 8 | day: $day 9 | after: $cursor 10 | first: $count 11 | ) { 12 | ...Archive_posts 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/Home.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/Archive_posts.graphql" 2 | 3 | query Home( 4 | $stickiesTotal: Int 5 | $watchThisTotal: Int 6 | $readThisTotal: Int 7 | $listenToThisTotal: Int 8 | ) { 9 | viewer { 10 | stickies: posts(sticky: true, first: $stickiesTotal) { 11 | ...Archive_posts 12 | } 13 | readThis: posts( 14 | category: "read-this" 15 | sticky: false 16 | first: $readThisTotal 17 | ) { 18 | ...Archive_posts 19 | } 20 | watchThis: posts(category: "watch-this", first: $watchThisTotal) { 21 | ...Archive_posts 22 | } 23 | listenToThis: posts(category: "listen-to-this", first: $listenToThisTotal) { 24 | ...Archive_posts 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/Page.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/ContentNode_content.graphql" 2 | #import "../fragment/Media_media.graphql" 3 | 4 | query Page($slug: String!) { 5 | viewer { 6 | page(slug: $slug) { 7 | id 8 | slug 9 | title { 10 | raw 11 | } 12 | content { 13 | data { 14 | ...ContentNode_content 15 | } 16 | } 17 | featuredMedia { 18 | ... on Image { 19 | sourceUrl 20 | } 21 | ...Media_media 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/Search.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/Archive_posts.graphql" 2 | 3 | query Search($search: String, $count: Int, $cursor: String) { 4 | viewer { 5 | posts(search: $search, first: $count, after: $cursor) { 6 | ...Archive_posts 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/Single.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/ContentNode_content.graphql" 2 | #import "../fragment/Media_media.graphql" 3 | #import "../fragment/Comments_comments.graphql" 4 | 5 | query Single($slug: String!, $commentCount: Int) { 6 | viewer { 7 | post(slug: $slug) { 8 | id 9 | slug 10 | date 11 | title { 12 | raw 13 | } 14 | content { 15 | data { 16 | ...ContentNode_content 17 | } 18 | } 19 | excerpt { 20 | raw 21 | } 22 | featuredMedia { 23 | ...Media_media 24 | ... on Image { 25 | sourceUrl 26 | } 27 | } 28 | tags { 29 | id 30 | name 31 | slug 32 | } 33 | comments(slug: $slug, first: $commentCount) { 34 | ...Comments_comments 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/graphql/query/Term.graphql: -------------------------------------------------------------------------------- 1 | #import "../fragment/Archive_posts.graphql" 2 | 3 | query Term($slug: String!, $taxonomy: String!, $cursor: String, $count: Int) { 4 | viewer { 5 | term(slug: $slug, taxonomy: $taxonomy) { 6 | id 7 | name 8 | slug 9 | taxonomy { 10 | rewrite { 11 | slug 12 | } 13 | labels { 14 | singular 15 | plural 16 | } 17 | } 18 | } 19 | posts(term: $slug, taxonomy: $taxonomy, after: $cursor, first: $count) { 20 | ...Archive_posts 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/langs/en.js: -------------------------------------------------------------------------------- 1 | export default {}; 2 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/favicon.ico -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/icons/120x120.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/icons/120x120.jpg -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/icons/152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/icons/152x152.png -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/icons/60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/icons/60x60.png -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/icons/76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/icons/76x76.png -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/icons/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/icons/favicon.ico -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/images/icons/icon-activity-indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/images/icons/icon-activity-indicator.gif -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/images/react-graphql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/images/react-graphql.png -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/public/kyt-favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/apollo-wordpress/src/public/kyt-favicon.png -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/routes/__tests__/Home.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { shallow } from 'enzyme'; 3 | import Home from '../'; 4 | 5 | it('Test example', () => { 6 | const wrapper = shallow(); 7 | expect(wrapper.is('section')).toBeTruthy(); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/utils/constants.js: -------------------------------------------------------------------------------- 1 | export const SITE_URL = 'https://highforthis.com'; 2 | 3 | export const SITE_DESCRIPTION = 'High for This aggregates the best music content on the web.'; 4 | 5 | export const TWITTER_USERNAME = '@highforthisss'; 6 | 7 | export const TWITTER_CREATOR = '@wonderboymusic'; 8 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/utils/regex.js: -------------------------------------------------------------------------------- 1 | export const newlineRegex = /(?:\r\n|\r|\n)/g; 2 | 3 | export const dateRegex = /^([0-9]{4})-([0-1][0-9])-([0-3][0-9])T([0-2][0-9]):([0-5][0-9]):([0-5][0-9])/; 4 | -------------------------------------------------------------------------------- /packages/apollo-wordpress/src/utils/walker.js: -------------------------------------------------------------------------------- 1 | export function sortHierarchy(list) { 2 | const nested = { 3 | top: [], 4 | }; 5 | list.forEach(({ node }) => { 6 | if (!node.parent) { 7 | nested.top.push(node); 8 | return; 9 | } 10 | 11 | if (!nested[node.parent]) { 12 | nested[node.parent] = []; 13 | } 14 | nested[node.parent].push(node); 15 | }); 16 | 17 | return nested; 18 | } 19 | -------------------------------------------------------------------------------- /packages/draft-server/README.md: -------------------------------------------------------------------------------- 1 | # draft-server 2 | 3 | ## DEPRECATED 4 | 5 | This project has been merged with [draft](https://github.com/staylor/graphql-wordpress/tree/master/packages/draft) 6 | -------------------------------------------------------------------------------- /packages/draft/README.md: -------------------------------------------------------------------------------- 1 | This repo has moved to staylor/reformation 2 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["kyt-react", {"modules": true}], 4 | "flow" 5 | ], 6 | "plugins": [ 7 | "emotion", 8 | "transform-class-properties", 9 | "transform-es2015-modules-commonjs", 10 | "transform-flow-strip-types", 11 | "transform-regenerator" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | trim_trailing_whitespace = true 7 | end_of_line = lf 8 | insert_final_newline = true 9 | 10 | [docs/rules/linebreak-style.md] 11 | end_of_line = disabled 12 | 13 | [{docs/rules/{indent.md,no-mixed-spaces-and-tabs.md}] 14 | indent_style = disabled 15 | indent_size = disabled 16 | 17 | [docs/rules/no-trailing-spaces.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint-config-kyt" 4 | ], 5 | 6 | "rules": { 7 | "jsx-a11y/href-no-hash": "off", 8 | "jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["invalidHref"] }] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | ./types/ 3 | 4 | [options] 5 | esproposal.decorators=ignore 6 | module.system.node.resolve_dirname=node_modules 7 | module.system.node.resolve_dirname=src 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | yarn-error.log 4 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/.npmignore: -------------------------------------------------------------------------------- 1 | yarn-error.log 2 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/src/Chart/index.js: -------------------------------------------------------------------------------- 1 | import styled from 'react-emotion'; 2 | import { clear } from '../global'; 3 | 4 | export const Title = styled.h1` 5 | font-family: ${p => p.theme.fonts.futura}; 6 | font-size: 36px; 7 | font-weight: bold; 8 | line-height: 42px; 9 | margin: 0 0 10px; 10 | 11 | & a { 12 | color: ${p => p.theme.colors.dark}; 13 | text-decoration: none; 14 | } 15 | `; 16 | 17 | export const List = styled.ol` 18 | list-style: decimal; 19 | `; 20 | 21 | export const Item = styled.li` 22 | ${clear}; 23 | display: list-item; 24 | margin: 10px 0 10px 20px; 25 | padding: 0 0 0 7px; 26 | `; 27 | 28 | export const Image = styled.img` 29 | display: block; 30 | float: left; 31 | margin: 0 10px 0 0; 32 | `; 33 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/src/Error/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Heading } from '../'; 3 | 4 | export default function Error() { 5 | return ( 6 |
7 |
8 | Not Found 9 |
10 |

Sorry not sorry.

11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/src/Post/index.js: -------------------------------------------------------------------------------- 1 | import styled from 'react-emotion'; 2 | 3 | export const Article = styled.article` 4 | margin: 0 0 ${p => p.theme.padding}px; 5 | `; 6 | 7 | export const Title = styled.h1` 8 | font-family: ${p => p.theme.fonts.futura}; 9 | font-size: 18px; 10 | line-height: 24px; 11 | margin: 0 0 ${p => p.theme.padding}px; 12 | 13 | & a { 14 | color: ${p => p.theme.colors.subhead}; 15 | text-decoration: none; 16 | } 17 | `; 18 | 19 | export const Content = styled.section` 20 | & p { 21 | margin: 0 0 ${p => p.theme.padding}px; 22 | } 23 | `; 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/src/Search/index.js: -------------------------------------------------------------------------------- 1 | import styled from 'react-emotion'; 2 | 3 | export const SearchBox = styled.section` 4 | margin-bottom: 40px; 5 | `; 6 | 7 | export const SearchInput = styled.input` 8 | border: 1px solid ${p => p.theme.colors.detail}; 9 | display: block; 10 | font-size: 16px; 11 | line-height: 20px; 12 | padding: 8px; 13 | width: 100%; 14 | `; 15 | 16 | export const A11Y = styled.label` 17 | display: none; 18 | `; 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/src/Single/index.js: -------------------------------------------------------------------------------- 1 | import { css } from 'emotion'; 2 | import styled from 'react-emotion'; 3 | import { Link } from 'found'; 4 | import responsive from '../responsive'; 5 | 6 | export const iframe = css` 7 | margin: 0 0 20px; 8 | `; 9 | 10 | export const Title = styled.h1` 11 | font-family: ${p => p.theme.fonts.futura}; 12 | font-size: 24px; 13 | font-weight: bold; 14 | line-height: 30px; 15 | margin: 0 0 ${p => p.theme.padding}px; 16 | 17 | ${responsive.tablet} { 18 | font-size: 36px; 19 | line-height: 42px; 20 | } 21 | `; 22 | 23 | export const Meta = styled.div` 24 | clear: both; 25 | color: ${p => p.theme.colors.meta}; 26 | font-size: 12px; 27 | line-height: 18px; 28 | margin-bottom: ${p => p.theme.padding}px; 29 | `; 30 | 31 | export const Tag = styled(Link)` 32 | display: inline-block; 33 | margin: 0 0 0 ${p => p.theme.padding / 4}px; 34 | `; 35 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/src/responsive.js: -------------------------------------------------------------------------------- 1 | // const breakSmall = 320; 2 | // const breakMedium = 360; 3 | // const breakBig = 375; 4 | // const breakPlus = 412; 5 | const tablet = 768; 6 | // const breakTabletpro = 1024; 7 | const desktop = 1050; 8 | // const breakBiggest = 1200; 9 | 10 | export default { 11 | tablet: `@media only screen and (min-width: ${tablet}px)`, 12 | desktop: `@media only screen and (min-width: ${desktop}px)`, 13 | }; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/src/server.js: -------------------------------------------------------------------------------- 1 | import { extractCritical } from 'emotion-server'; 2 | 3 | // eslint-disable-next-line 4 | export { extractCritical }; 5 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-components/src/theme.js: -------------------------------------------------------------------------------- 1 | export default { 2 | fonts: { 3 | body: 4 | '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', 5 | futura: "'futura-pt', 'Helvetica Neue', sans-serif", 6 | }, 7 | colors: { 8 | background: '#e2e2e2', 9 | topBorder: '#bbb', 10 | white: '#fff', 11 | black: '#000', 12 | pink: '#e50082', 13 | dark: '#444', 14 | detail: '#eee', 15 | inactive: '#767676', 16 | subhead: '#222', 17 | meta: '#666', 18 | subnav: { 19 | background: '#f9f9f9', 20 | details: '#ddd', 21 | hoverBackground: '#efefef', 22 | }, 23 | }, 24 | 25 | contentWidth: 1080, 26 | padding: 15, 27 | weightBold: 700, 28 | }; 29 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/cli.php: -------------------------------------------------------------------------------- 1 | namespace = 'graphql/v1'; 9 | $this->rest_base = 'settings'; 10 | } 11 | 12 | // @codingStandardsIgnoreLine 13 | public function get_item_permissions_check($request) { 14 | return \WP_REST_Server::READABLE === $request->get_method(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/autoload.php: -------------------------------------------------------------------------------- 1 | $baseDir . '/lib/functions.php', 10 | '3d0b7557fbcd8fce30fe6074336bd69b' => $baseDir . '/lib/rest-api.php', 11 | ); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/composer/autoload_namespaces.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/masterminds/html5/src'), 10 | 'GraphQL\\' => array($baseDir . '/lib'), 11 | ); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | scratch.php 3 | composer.lock 4 | build/ -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/CREDITS: -------------------------------------------------------------------------------- 1 | Matt Butcher [technosophos] (lead) 2 | Matt Farina [mattfarina] (lead) 3 | Asmir Mustafic [goetas] (contributor) 4 | Edward Z. Yang [ezyang] (contributor) 5 | Geoffrey Sneddon [gsnedders] (contributor) 6 | Kukhar Vasily [ngreduce] (contributor) 7 | Rune Christensen [MrElectronic] (contributor) 8 | Mišo Belica [miso-belica] (contributor) 9 | Asmir Mustafic [goetas] (contributor) 10 | KITAITI Makoto [KitaitiMakoto] (contributor) 11 | Jacob Floyd [cognifloyd] (contributor) 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/UPGRADING.md: -------------------------------------------------------------------------------- 1 | From 1.x to 2.x 2 | ================= 3 | 4 | - All classes uses `Masterminds` namespace. 5 | - All public static methods has been removed from `HTML5` class and the general API to access the HTML5 functionalities has changed. 6 | 7 | Before: 8 | 9 | $dom = \HTML5::loadHTML('....'); 10 | \HTML5::saveHTML($dom); 11 | 12 | After: 13 | 14 | use Masterminds\HTML5; 15 | 16 | $html5 = new HTML5(); 17 | 18 | $dom = $html5->loadHTML('....'); 19 | echo $html5->saveHTML($dom); 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/bin/entities.php: -------------------------------------------------------------------------------- 1 | $obj) { 14 | $sname = substr($name, 1, -1); 15 | $table[$sname] = $obj->characters; 16 | } 17 | 18 | print ' 9 | 10 | TEST 11 | 14 | 15 | 16 | 17 |
18 |

Hello World

This is a test of the HTML5 parser.

19 |
20 | & Nobody nowhere. 21 |
22 | TEST 23 | 24 | © 25 | 26 | HERE; 27 | 28 | $html5 = new HTML5(); 29 | $dom = $html5->loadHTML($html); 30 | 31 | print "Converting to HTML 5\n"; 32 | 33 | $html5->save($dom, fopen("php://stdin", 'w')); 34 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | test/HTML5/ 6 | 7 | 8 | 9 | 10 | systemlib.phpreflection_hni 11 | src/HTML5/Parser/InputStream.php 12 | src/HTML5/Serializer/RulesInterface.php 13 | src/HTML5/Entities.php 14 | src/HTML5/Serializer/HTML5Entities.php 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/sami.php: -------------------------------------------------------------------------------- 1 | 'HTML5-PHP API', 7 | 'build_dir' => __DIR__.'/build/apidoc', 8 | 'cache_dir' => __DIR__.'/build/sami-cache', 9 | 'default_opened_level' => 1, 10 | )); -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/src/HTML5/Exception.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

This is a test.

9 | 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

This is a test.

9 | 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php: -------------------------------------------------------------------------------- 1 | name = $name; 16 | $this->data = $data; 17 | $this->count ++; 18 | 19 | $div = $element->ownerDocument->createElement("div"); 20 | $div->nodeValue = 'foo'; 21 | 22 | $element->appendChild($div); 23 | 24 | return $div; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php: -------------------------------------------------------------------------------- 1 | assertEquals('éàa', $out); 12 | } 13 | 14 | /** 15 | * @todo add tests for invalid codepoints 16 | */ 17 | public function testCheckForIllegalCodepoints() { 18 | $smoke = "Smoke test"; 19 | $err = UTF8Utils::checkForIllegalCodepoints($smoke); 20 | $this->assertEmpty($err); 21 | 22 | $data = "Foo Bar \0 Baz"; 23 | $errors = UTF8Utils::checkForIllegalCodepoints($data); 24 | $this->assertContains('null-character', $errors); 25 | } 26 | } -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/vendor/masterminds/html5/test/HTML5/TestCase.php: -------------------------------------------------------------------------------- 1 | test'; 10 | 11 | const DOC_CLOSE = ''; 12 | 13 | public function testFoo() 14 | { 15 | // Placeholder. Why is PHPUnit emitting warnings about no tests? 16 | } 17 | 18 | public function getInstance(array $options = array()) 19 | { 20 | return new HTML5($options); 21 | } 22 | 23 | protected function wrap($fragment) 24 | { 25 | return self::DOC_OPEN . $fragment . self::DOC_CLOSE; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-middleware/wp-graphql-middleware.php: -------------------------------------------------------------------------------- 1 | { 7 | const responsiveWidth = Dimensions.get('window').width; 8 | const responsiveHeight = responsiveWidth * node.height / node.width; 9 | 10 | return ( 11 | 20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress-native-components/src/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/graphql-wordpress-native-components/src/index.js -------------------------------------------------------------------------------- /packages/graphql-wordpress/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["kyt-core", {"modules": true}] 4 | ], 5 | "plugins": [ 6 | "transform-class-properties", 7 | "transform-es2015-modules-commonjs", 8 | "transform-object-rest-spread", 9 | "transform-regenerator", 10 | ["module-resolver", { 11 | "root": ["./"], 12 | "alias": { 13 | "jest": "./jest", 14 | "data": "./src/data", 15 | "schema": "./src/schema", 16 | "type": "./src/schema/type", 17 | "connection": "./src/schema/connection", 18 | "enum": "./src/schema/enum", 19 | "interface": "./src/schema/interface", 20 | "query": "./src/schema/query", 21 | "mutation": "./src/schema/mutation", 22 | "field": "./src/schema/field" 23 | } 24 | }] 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | trim_trailing_whitespace = true 7 | end_of_line = lf 8 | insert_final_newline = true 9 | 10 | [docs/rules/linebreak-style.md] 11 | end_of_line = disabled 12 | 13 | [{docs/rules/{indent.md,no-mixed-spaces-and-tabs.md}] 14 | indent_style = disabled 15 | indent_size = disabled 16 | 17 | [docs/rules/no-trailing-spaces.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/.env: -------------------------------------------------------------------------------- 1 | WP_API_HOST=http://highforthis.dev/wp-json/ 2 | GRAPHQL_PORT=8080 3 | REQUEST_CACHE_TTL=60 4 | WP_CATEGORIES_ENDPOINT=wp/v2/categories 5 | WP_USERS_ENDPOINT=wp/v2/users 6 | WP_COMMENTS_ENDPOINT=graphql/v1/comments 7 | WP_MEDIA_ENDPOINT=wp/v2/media 8 | WP_NAV_MENUS_ENDPOINT=graphql/v1/nav-menus 9 | WP_PAGES_ENDPOINT=graphql/v1/pages 10 | WP_POSTS_ENDPOINT=graphql/v1/posts 11 | WP_SIDEBARS_ENDPOINT=graphql/v1/sidebars 12 | WP_TYPES_ENDPOINT=graphql/v1/types 13 | WP_TAXONOMIES_ENDPOINT=graphql/v1/taxonomies 14 | WP_TAGS_ENDPOINT=wp/v2/tags 15 | WP_STATUSES_ENDPOINT=wp/v2/statuses 16 | WP_SETTINGS_ENDPOINT=graphql/v1/settings 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint-config-kyt" 4 | ], 5 | 6 | "settings": { 7 | "import/resolver": { 8 | "babel-module": {} 9 | } 10 | }, 11 | 12 | "env": { 13 | "jasmine": true, 14 | "jest": true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/.gitignore: -------------------------------------------------------------------------------- 1 | .nyc_output 2 | build 3 | node_modules 4 | public 5 | yarn-error.log 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/.nginx: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name graphql.highforthis.com; 4 | root /var/www/graphql.highforthis.com/public_html; 5 | access_log /var/www/graphql.highforthis.com/logs/access.log; 6 | error_log /var/www/graphql.highforthis.com/logs/error.log; 7 | 8 | location / { 9 | try_files $uri @proxy; 10 | } 11 | 12 | location @proxy { 13 | proxy_pass http://graphql.highforthis.com:8080; 14 | proxy_set_header Host $host; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/__mocks__/dataloader.js: -------------------------------------------------------------------------------- 1 | import Dataloader from 'dataloader'; 2 | 3 | class DataloaderMock extends Dataloader { 4 | constructor(batchLoadFn, options) { 5 | super(batchLoadFn, options); 6 | // eslint-disable-next-line no-underscore-dangle 7 | this._batchLoadFn = ids => 8 | Promise.resolve( 9 | ids.map(id => { 10 | const isNumber = String(id).match(/^[0-9]+$/); 11 | if (typeof id === 'string' && !isNumber) { 12 | return { slug: id }; 13 | } 14 | return { id: parseInt(id, 10) }; 15 | }) 16 | ); 17 | } 18 | } 19 | 20 | export default DataloaderMock; 21 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/jest/setup.js: -------------------------------------------------------------------------------- 1 | import 'dotenv/config'; 2 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/jest/utils.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import path from 'path'; 3 | import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools'; 4 | 5 | const schemaFile = path.resolve('./generated/schema.graphql'); 6 | 7 | export const getMockSchema = (mocks = {}, preserveResolvers = false) => { 8 | const graphqlSchema = fs.readFileSync(schemaFile, 'utf8'); 9 | const schema = makeExecutableSchema({ typeDefs: graphqlSchema }); 10 | // Add mocks, modifies schema in place 11 | addMockFunctionsToSchema({ schema, mocks, preserveResolvers }); 12 | return schema; 13 | }; 14 | 15 | export const dateRegex = /[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}/; 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Category.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class Category { 4 | getID() { 5 | return toGlobalId(this.constructor.name, this.id); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_CATEGORIES_ENDPOINT || 'wp/v2/categories'; 10 | } 11 | } 12 | 13 | export default Category; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Chart.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class Chart { 4 | getID() { 5 | return toGlobalId(this.constructor.name, 'me'); 6 | } 7 | 8 | static getEndpoint() { 9 | return 'https://itunes.apple.com/us/rss/topalbums/limit=25/explicit=true/json'; 10 | } 11 | } 12 | 13 | export default Chart; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Media.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class Media { 4 | getID() { 5 | return toGlobalId(this.constructor.name, this.id); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_MEDIA_ENDPOINT || 'wp/v2/media'; 10 | } 11 | } 12 | 13 | export default Media; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/NavMenu.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class NavMenu { 4 | getID() { 5 | return toGlobalId(this.constructor.name, this.id); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_NAV_MENUS_ENDPOINT || 'graphql/v1/nav-menus'; 10 | } 11 | } 12 | 13 | export default NavMenu; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Page.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class Page { 4 | getID() { 5 | return toGlobalId(this.constructor.name, this.id); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_PAGES_ENDPOINT || 'graphql/v1/pages'; 10 | } 11 | } 12 | 13 | export default Page; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Post.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | import fetchData from 'data/utils'; 3 | 4 | class Post { 5 | getID() { 6 | return toGlobalId(this.constructor.name, this.id); 7 | } 8 | 9 | static getEndpoint() { 10 | return process.env.WP_POSTS_ENDPOINT || 'graphql/v1/posts'; 11 | } 12 | 13 | static async collection(args = {}) { 14 | const { data: { body, headers } } = await fetchData(Post.getEndpoint(), { 15 | qs: args, 16 | }); 17 | return { 18 | total: headers['x-wp-total'], 19 | items: body.map(item => Object.assign(new Post(), item)), 20 | }; 21 | } 22 | } 23 | 24 | export default Post; 25 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Settings.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class Settings { 4 | getID() { 5 | return toGlobalId(this.constructor.name, 'me'); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_SETTINGS_ENDPOINT || 'graphql/v1/settings'; 10 | } 11 | } 12 | 13 | export default Settings; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Sidebar.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class Sidebar { 4 | getID() { 5 | return toGlobalId(this.constructor.name, this.id); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_SIDEBARS_ENDPOINT || 'graphql/v1/sidebars'; 10 | } 11 | } 12 | 13 | export default Sidebar; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Tag.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class Tag { 4 | getID() { 5 | return toGlobalId(this.constructor.name, this.id); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_TAGS_ENDPOINT || 'wp/v2/tags'; 10 | } 11 | } 12 | 13 | export default Tag; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/Taxonomy.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class Taxonomy { 4 | getID() { 5 | return toGlobalId(this.constructor.name, this.slug); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_TAXONOMIES_ENDPOINT || 'graphql/v1/taxonomies'; 10 | } 11 | } 12 | 13 | export default Taxonomy; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/User.js: -------------------------------------------------------------------------------- 1 | import { toGlobalId } from 'graphql-relay'; 2 | 3 | class User { 4 | getID() { 5 | return toGlobalId(this.constructor.name, this.id); 6 | } 7 | 8 | static getEndpoint() { 9 | return process.env.WP_USERS_ENDPOINT || 'wp/v2/users'; 10 | } 11 | } 12 | 13 | export default User; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Category.test.js: -------------------------------------------------------------------------------- 1 | import Category from 'data/Category'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test Category data access', () => { 10 | test('Get endpoint', () => { 11 | expect(Category.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_CATEGORIES_ENDPOINT; 16 | expect(Category.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Chart.test.js: -------------------------------------------------------------------------------- 1 | import Chart from 'data/Chart'; 2 | 3 | describe('Test Chart data access', () => { 4 | test('Get endpoint', () => { 5 | expect(Chart.getEndpoint()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Comment/__snapshots__/collection.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Comment data access Get backup endpoint 1`] = `"graphql/v1/comments"`; 4 | 5 | exports[`Test Comment data access Get endpoint 1`] = `"graphql/v1/comments"`; 6 | 7 | exports[`Test Comment data access Load Comment collection 1`] = ` 8 | Object { 9 | "items": Array [ 10 | Comment { 11 | "id": 1, 12 | }, 13 | Comment { 14 | "id": 2, 15 | }, 16 | Comment { 17 | "id": 3, 18 | }, 19 | Comment { 20 | "id": 4, 21 | }, 22 | Comment { 23 | "id": 5, 24 | }, 25 | ], 26 | "total": 5, 27 | } 28 | `; 29 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Comment/__snapshots__/create.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Comment CRUD: create Test create 1`] = ` 4 | Object { 5 | "comment": Comment { 6 | "id": 13, 7 | "post": 1, 8 | }, 9 | "cookies": "foo=bar", 10 | "status": "new", 11 | } 12 | `; 13 | 14 | exports[`Test Comment CRUD: create Test create error: no input 1`] = `"You must provide author data to create a comment."`; 15 | 16 | exports[`Test Comment CRUD: create Test create error: no post 1`] = `"You must provide a post to assign the comment to."`; 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Comment/__snapshots__/delete.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Comment CRUD: delete Test delete 1`] = ` 4 | Object { 5 | "status": "delete", 6 | } 7 | `; 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Comment/__snapshots__/empty.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Comment CRUD: Empty response Test create response 1`] = ` 4 | Object { 5 | "comment": null, 6 | "cookies": null, 7 | "status": "new", 8 | } 9 | `; 10 | 11 | exports[`Test Comment CRUD: Empty response Test delete response 1`] = ` 12 | Object { 13 | "status": "unknown", 14 | } 15 | `; 16 | 17 | exports[`Test Comment CRUD: Empty response Test update response 1`] = ` 18 | Object { 19 | "comment": null, 20 | "cookies": null, 21 | "status": "update", 22 | } 23 | `; 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Comment/__snapshots__/error.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Comment CRUD Errors Test create error 1`] = ` 4 | Object { 5 | "comment": null, 6 | "cookies": null, 7 | "status": "Error testing comment CRUD.", 8 | } 9 | `; 10 | 11 | exports[`Test Comment CRUD Errors Test delete error 1`] = ` 12 | Object { 13 | "status": "Error testing comment CRUD.", 14 | } 15 | `; 16 | 17 | exports[`Test Comment CRUD Errors Test update error 1`] = ` 18 | Object { 19 | "comment": null, 20 | "cookies": null, 21 | "status": "Error testing comment CRUD.", 22 | } 23 | `; 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Comment/__snapshots__/update.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Comment CRUD: update Test update 1`] = ` 4 | Object { 5 | "comment": Comment { 6 | "id": 13, 7 | "post": 1, 8 | }, 9 | "cookies": "foo=bar", 10 | "status": "update", 11 | } 12 | `; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Comment/delete.test.js: -------------------------------------------------------------------------------- 1 | import Comment from 'data/Comment'; 2 | import * as utils from 'data/utils'; 3 | 4 | utils.default = jest.fn(() => ({ 5 | data: { 6 | body: { 7 | id: 13, 8 | status: 'trash', 9 | }, 10 | }, 11 | })); 12 | 13 | utils.clearEndpointCache = jest.fn(() => Promise.resolve()); 14 | 15 | describe('Test Comment CRUD: delete', () => { 16 | test('Test delete', async () => { 17 | const input = { 18 | id: 13, 19 | }; 20 | const deletion = await Comment.delete(input); 21 | expect(deletion).toMatchSnapshot(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Comment/update.test.js: -------------------------------------------------------------------------------- 1 | import Comment from 'data/Comment'; 2 | import * as utils from 'data/utils'; 3 | 4 | utils.default = jest.fn(() => ({ 5 | data: { 6 | body: { 7 | id: 13, 8 | post: 1, 9 | }, 10 | headers: { 11 | 'set-cookie': 'foo=bar', 12 | }, 13 | }, 14 | })); 15 | 16 | utils.clearEndpointCache = jest.fn(() => Promise.resolve()); 17 | 18 | describe('Test Comment CRUD: update', () => { 19 | test('Test update', async () => { 20 | const input = { 21 | id: 13, 22 | content: 'Updated comment!', 23 | }; 24 | const update = await Comment.update(input); 25 | expect(update).toMatchSnapshot(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Media.test.js: -------------------------------------------------------------------------------- 1 | import Media from 'data/Media'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test Media data access', () => { 10 | test('Get endpoint', () => { 11 | expect(Media.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_MEDIA_ENDPOINT; 16 | expect(Media.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/NavMenu.test.js: -------------------------------------------------------------------------------- 1 | import NavMenu from 'data/NavMenu'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test NavMenu data access', () => { 10 | test('Get endpoint', () => { 11 | expect(NavMenu.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_NAV_MENUS_ENDPOINT; 16 | expect(NavMenu.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Page.test.js: -------------------------------------------------------------------------------- 1 | import Page from 'data/Page'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test Page data access', () => { 10 | test('Get endpoint', () => { 11 | expect(Page.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_PAGES_ENDPOINT; 16 | expect(Page.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Settings.test.js: -------------------------------------------------------------------------------- 1 | import Settings from 'data/Settings'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test Settings data access', () => { 10 | test('Get endpoint', () => { 11 | expect(Settings.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_SETTINGS_ENDPOINT; 16 | expect(Settings.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Sidebar.test.js: -------------------------------------------------------------------------------- 1 | import Sidebar from 'data/Sidebar'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test Sidebar data access', () => { 10 | test('Get endpoint', () => { 11 | expect(Sidebar.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_SIDEBARS_ENDPOINT; 16 | expect(Sidebar.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Tag.test.js: -------------------------------------------------------------------------------- 1 | import Tag from 'data/Tag'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test Tag data access', () => { 10 | test('Get endpoint', () => { 11 | expect(Tag.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_TAGS_ENDPOINT; 16 | expect(Tag.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/Taxonomy.test.js: -------------------------------------------------------------------------------- 1 | import Taxonomy from 'data/Taxonomy'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test Taxonomy data access', () => { 10 | test('Get endpoint', () => { 11 | expect(Taxonomy.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_TAXONOMIES_ENDPOINT; 16 | expect(Taxonomy.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/User.test.js: -------------------------------------------------------------------------------- 1 | import User from 'data/User'; 2 | 3 | const backupEnv = Object.assign({}, process.env); 4 | 5 | afterAll(() => { 6 | process.env = backupEnv; 7 | }); 8 | 9 | describe('Test User data access', () => { 10 | test('Get endpoint', () => { 11 | expect(User.getEndpoint()).toMatchSnapshot(); 12 | }); 13 | 14 | test('Get backup endpoint', () => { 15 | delete process.env.WP_USERS_ENDPOINT; 16 | expect(User.getEndpoint()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Category.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Category data access Get backup endpoint 1`] = `"wp/v2/categories"`; 4 | 5 | exports[`Test Category data access Get endpoint 1`] = `"wp/v2/categories"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Chart.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Chart data access Get endpoint 1`] = `"https://itunes.apple.com/us/rss/topalbums/limit=25/explicit=true/json"`; 4 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Media.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Media data access Get backup endpoint 1`] = `"wp/v2/media"`; 4 | 5 | exports[`Test Media data access Get endpoint 1`] = `"wp/v2/media"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/NavMenu.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test NavMenu data access Get backup endpoint 1`] = `"graphql/v1/nav-menus"`; 4 | 5 | exports[`Test NavMenu data access Get endpoint 1`] = `"graphql/v1/nav-menus"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Page.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Page data access Get backup endpoint 1`] = `"graphql/v1/pages"`; 4 | 5 | exports[`Test Page data access Get endpoint 1`] = `"graphql/v1/pages"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Post.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Post data access Get backup endpoint 1`] = `"graphql/v1/posts"`; 4 | 5 | exports[`Test Post data access Get endpoint 1`] = `"graphql/v1/posts"`; 6 | 7 | exports[`Test Post data access Load Post collection 1`] = ` 8 | Object { 9 | "items": Array [ 10 | Post { 11 | "id": 1, 12 | }, 13 | Post { 14 | "id": 2, 15 | }, 16 | Post { 17 | "id": 3, 18 | }, 19 | Post { 20 | "id": 4, 21 | }, 22 | Post { 23 | "id": 5, 24 | }, 25 | ], 26 | "total": 5, 27 | } 28 | `; 29 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Settings.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Settings data access Get backup endpoint 1`] = `"graphql/v1/settings"`; 4 | 5 | exports[`Test Settings data access Get endpoint 1`] = `"graphql/v1/settings"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Sidebar.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Sidebar data access Get backup endpoint 1`] = `"graphql/v1/sidebars"`; 4 | 5 | exports[`Test Sidebar data access Get endpoint 1`] = `"graphql/v1/sidebars"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Tag.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Tag data access Get backup endpoint 1`] = `"wp/v2/tags"`; 4 | 5 | exports[`Test Tag data access Get endpoint 1`] = `"wp/v2/tags"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/Taxonomy.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Taxonomy data access Get backup endpoint 1`] = `"graphql/v1/taxonomies"`; 4 | 5 | exports[`Test Taxonomy data access Get endpoint 1`] = `"graphql/v1/taxonomies"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/User.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test User data access Get backup endpoint 1`] = `"wp/v2/users"`; 4 | 5 | exports[`Test User data access Get endpoint 1`] = `"wp/v2/users"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/__snapshots__/utils.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test data fetching Data is returned 1`] = ` 4 | Object { 5 | "data": Object { 6 | "body": Array [ 7 | Object { 8 | "id": 1, 9 | }, 10 | Object { 11 | "id": 2, 12 | }, 13 | Object { 14 | "id": 3, 15 | }, 16 | Object { 17 | "id": 4, 18 | }, 19 | Object { 20 | "id": 5, 21 | }, 22 | ], 23 | "headers": Object { 24 | "x-wp-total": 5, 25 | }, 26 | }, 27 | } 28 | `; 29 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/__tests__/utils.test.js: -------------------------------------------------------------------------------- 1 | import fetchData from 'data/utils'; 2 | 3 | jest.mock('../utils', () => 4 | jest.fn(() => 5 | Promise.resolve({ 6 | data: { 7 | body: [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 }], 8 | headers: { 9 | 'x-wp-total': 5, 10 | }, 11 | }, 12 | }) 13 | ) 14 | ); 15 | 16 | describe('Test data fetching', () => { 17 | test('Data is returned', async () => { 18 | const data = await fetchData('/scott'); 19 | expect(data).toMatchSnapshot(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/Chart.js: -------------------------------------------------------------------------------- 1 | import Dataloader from 'dataloader'; 2 | import fetchData from 'data/utils'; 3 | import Chart from 'data/Chart'; 4 | 5 | export default function getChartLoaders() { 6 | // there is no batch mechanism on this endpoint 7 | const endpoint = Chart.getEndpoint(); 8 | 9 | const chartLoader = new Dataloader(chartPaths => 10 | Promise.all( 11 | chartPaths.map(chartPath => fetchData(chartPath).then(({ data: { body } }) => body.feed)) 12 | ) 13 | ); 14 | 15 | return { 16 | load: async () => { 17 | const chart = await chartLoader.load(endpoint); 18 | return chart ? Object.assign(new Chart(), chart) : null; 19 | }, 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/Comment.js: -------------------------------------------------------------------------------- 1 | import Dataloader from 'dataloader'; 2 | import fetchData from 'data/utils'; 3 | import Comment from 'data/Comment'; 4 | 5 | // Dataloader expects IDs that can be read by the REST API 6 | 7 | export default function getCommentLoaders() { 8 | const endpoint = Comment.getEndpoint(); 9 | 10 | const commentLoader = new Dataloader(ids => 11 | fetchData(endpoint, { 12 | qs: { include: ids, orderby: 'include', per_page: 100 }, 13 | }).then(({ data: { body } }) => body) 14 | ); 15 | 16 | return { 17 | load: async id => { 18 | const data = await commentLoader.load(id); 19 | return data ? Object.assign(new Comment(), data) : null; 20 | }, 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/NavMenu.js: -------------------------------------------------------------------------------- 1 | import Dataloader from 'dataloader'; 2 | import fetchData from 'data/utils'; 3 | import NavMenu from 'data/NavMenu'; 4 | 5 | // Dataloader expects IDs that can be read by the REST API 6 | 7 | export default function getNavMenuLoaders() { 8 | const endpoint = NavMenu.getEndpoint(); 9 | 10 | const navMenuLoader = new Dataloader(ids => 11 | fetchData(endpoint) 12 | .then(({ data: { body } }) => body) 13 | .then(menus => ids.map(id => menus.find(item => item.id === parseInt(id, 10)))) 14 | ); 15 | 16 | return { 17 | load: async id => { 18 | const data = await navMenuLoader.load(id); 19 | return data ? Object.assign(new NavMenu(), data) : null; 20 | }, 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/Settings.js: -------------------------------------------------------------------------------- 1 | import Dataloader from 'dataloader'; 2 | import fetchData from 'data/utils'; 3 | import Settings from 'data/Settings'; 4 | 5 | // Dataloader expects IDs that can be read by the REST API 6 | 7 | export default function getSettingsLoaders() { 8 | // there is no batch mechanism on this endpoint 9 | const endpoint = Settings.getEndpoint(); 10 | 11 | const settingsLoader = new Dataloader(settingsPaths => 12 | Promise.all( 13 | settingsPaths.map(settingsPath => fetchData(settingsPath).then(({ data: { body } }) => body)) 14 | ) 15 | ); 16 | 17 | return { 18 | load: async () => { 19 | const settings = await settingsLoader.load(endpoint); 20 | return settings ? Object.assign(new Settings(), settings) : null; 21 | }, 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/Sidebar.js: -------------------------------------------------------------------------------- 1 | import Dataloader from 'dataloader'; 2 | import fetchData from 'data/utils'; 3 | import Sidebar from 'data/Sidebar'; 4 | 5 | // Dataloader expects IDs that can be read by the REST API 6 | 7 | export default function getSidebarLoaders() { 8 | const endpoint = Sidebar.getEndpoint(); 9 | 10 | const sidebarLoader = new Dataloader(slugs => 11 | fetchData(endpoint).then(({ data: { body } }) => 12 | slugs.map(id => body.find(item => item.id === id)) 13 | ) 14 | ); 15 | 16 | return { 17 | load: async id => { 18 | const data = await sidebarLoader.load(id); 19 | return data ? Object.assign(new Sidebar(), data) : null; 20 | }, 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/Taxonomy.js: -------------------------------------------------------------------------------- 1 | import Dataloader from 'dataloader'; 2 | import fetchData from 'data/utils'; 3 | import Taxonomy from 'data/Taxonomy'; 4 | 5 | // Dataloader expects IDs that can be read by the REST API 6 | 7 | export default function getTaxonomyLoaders() { 8 | // there is no batch mechanism on this endpoint 9 | const endpoint = Taxonomy.getEndpoint(); 10 | 11 | const taxonomyLoader = new Dataloader(slugs => 12 | fetchData(endpoint).then(({ data: { body } }) => slugs.map(slug => body[slug])) 13 | ); 14 | 15 | return { 16 | load: async slug => { 17 | const data = await taxonomyLoader.load(slug); 18 | return data ? Object.assign(new Taxonomy(), data) : null; 19 | }, 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Category.test.js: -------------------------------------------------------------------------------- 1 | import getCategoryLoaders from 'data/loaders/Category'; 2 | 3 | const Category = getCategoryLoaders(); 4 | 5 | describe('Test Category loader', () => { 6 | test('Load a category', async () => { 7 | const cat = await Category.load(13); 8 | expect(cat.getID()).toMatchSnapshot(); 9 | expect(cat).toMatchSnapshot(); 10 | }); 11 | 12 | test('Load a category by slug', async () => { 13 | const cat = await Category.loadBySlug('watch-this'); 14 | expect(cat).toMatchSnapshot(); 15 | }); 16 | 17 | test('Load categories', async () => { 18 | const cat = await Category.loadMany([13, 17]); 19 | expect(cat).toMatchSnapshot(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Comment.test.js: -------------------------------------------------------------------------------- 1 | import getCommentLoaders from 'data/loaders/Comment'; 2 | 3 | const Comment = getCommentLoaders(); 4 | 5 | describe('Test Comment loader', () => { 6 | test('Load a comment', async () => { 7 | const comment = await Comment.load(13); 8 | expect(comment.getID()).toMatchSnapshot(); 9 | expect(comment).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Media.test.js: -------------------------------------------------------------------------------- 1 | import getMediaLoaders from 'data/loaders/Media'; 2 | 3 | const Media = getMediaLoaders(); 4 | 5 | describe('Test Media loader', () => { 6 | test('Load a media item', async () => { 7 | const media = await Media.load(13); 8 | expect(media.getID()).toMatchSnapshot(); 9 | expect(media).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/NavMenu.test.js: -------------------------------------------------------------------------------- 1 | import getNavMenuLoaders from 'data/loaders/NavMenu'; 2 | 3 | const NavMenu = getNavMenuLoaders(); 4 | 5 | describe('Test NavMenu loader', () => { 6 | test('Load a NavMenu', async () => { 7 | const menu = await NavMenu.load('main-nav'); 8 | expect(menu.getID()).toMatchSnapshot(); 9 | expect(menu).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Page.test.js: -------------------------------------------------------------------------------- 1 | import getPageLoaders from 'data/loaders/Page'; 2 | 3 | const Page = getPageLoaders(); 4 | 5 | describe('Test Page loader', () => { 6 | test('Load a page', async () => { 7 | const page = await Page.load(13); 8 | expect(page.getID()).toMatchSnapshot(); 9 | expect(page).toMatchSnapshot(); 10 | }); 11 | 12 | test('Load a page by slug', async () => { 13 | const page = await Page.loadBySlug('go-to-this'); 14 | expect(page).toMatchSnapshot(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Post.test.js: -------------------------------------------------------------------------------- 1 | import getPostLoaders from 'data/loaders/Post'; 2 | 3 | const Post = getPostLoaders(); 4 | 5 | describe('Test Post loader', () => { 6 | test('Load a post', async () => { 7 | const post = await Post.load(13); 8 | expect(post.getID()).toMatchSnapshot(); 9 | expect(post).toMatchSnapshot(); 10 | }); 11 | 12 | test('Load a post by slug', async () => { 13 | const post = await Post.loadBySlug('whatever'); 14 | expect(post).toMatchSnapshot(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Settings.test.js: -------------------------------------------------------------------------------- 1 | import getSettingsLoaders from 'data/loaders/Settings'; 2 | 3 | const Settings = getSettingsLoaders(); 4 | 5 | describe('Test Settings loader', () => { 6 | test('Load settings', async () => { 7 | const settings = await Settings.load(); 8 | expect(settings.getID()).toMatchSnapshot(); 9 | expect(settings).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Sidebar.test.js: -------------------------------------------------------------------------------- 1 | import getSidebarLoaders from 'data/loaders/Sidebar'; 2 | 3 | const Sidebar = getSidebarLoaders(); 4 | 5 | describe('Test Sidebar loader', () => { 6 | test('Load a Sidebar', async () => { 7 | const sidebar = await Sidebar.load('main-nav'); 8 | expect(sidebar.getID()).toMatchSnapshot(); 9 | expect(sidebar).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Tag.test.js: -------------------------------------------------------------------------------- 1 | import getTagLoaders from 'data/loaders/Tag'; 2 | 3 | const Tag = getTagLoaders(); 4 | 5 | describe('Test Tag loader', () => { 6 | test('Load a tag', async () => { 7 | const tag = await Tag.load(13); 8 | expect(tag.getID()).toMatchSnapshot(); 9 | expect(tag).toMatchSnapshot(); 10 | }); 11 | 12 | test('Load a tag by slug', async () => { 13 | const tag = await Tag.loadBySlug('dirty-projectors'); 14 | expect(tag).toMatchSnapshot(); 15 | }); 16 | 17 | test('Load tags', async () => { 18 | const tag = await Tag.loadMany([13, 17]); 19 | expect(tag).toMatchSnapshot(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/Taxonomy.test.js: -------------------------------------------------------------------------------- 1 | import getTaxonomyLoaders from 'data/loaders/Taxonomy'; 2 | 3 | const Taxonomy = getTaxonomyLoaders(); 4 | 5 | describe('Test Taxonomy loader', () => { 6 | test('Load a taxonomy', async () => { 7 | const tax = await Taxonomy.load('tag'); 8 | expect(tax.getID()).toMatchSnapshot(); 9 | expect(tax).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/User.test.js: -------------------------------------------------------------------------------- 1 | import getUserLoaders from 'data/loaders/User'; 2 | 3 | const User = getUserLoaders(); 4 | 5 | describe('Test User loader', () => { 6 | test('Load a user', async () => { 7 | const user = await User.load(1); 8 | expect(user.getID()).toMatchSnapshot(); 9 | expect(user).toMatchSnapshot(); 10 | }); 11 | 12 | test('Load a user by slug', async () => { 13 | const user = await User.loadBySlug('admin'); 14 | expect(user).toMatchSnapshot(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Category.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Category loader Load a category 1`] = `"Q2F0ZWdvcnk6MTM="`; 4 | 5 | exports[`Test Category loader Load a category 2`] = ` 6 | Category { 7 | "id": 13, 8 | } 9 | `; 10 | 11 | exports[`Test Category loader Load a category by slug 1`] = ` 12 | Category { 13 | "slug": "watch-this", 14 | } 15 | `; 16 | 17 | exports[`Test Category loader Load categories 1`] = ` 18 | Array [ 19 | Category { 20 | "id": 13, 21 | }, 22 | Category { 23 | "id": 17, 24 | }, 25 | ] 26 | `; 27 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Chart.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Chart loader Load a chart 1`] = `"Q2hhcnQ6bWU="`; 4 | 5 | exports[`Test Chart loader Load a chart 2`] = ` 6 | Chart { 7 | "slug": "https://itunes.apple.com/us/rss/topalbums/limit=25/explicit=true/json", 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Comment.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Comment loader Load a comment 1`] = `"Q29tbWVudDoxMw=="`; 4 | 5 | exports[`Test Comment loader Load a comment 2`] = ` 6 | Comment { 7 | "id": 13, 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Media.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Media loader Load a media item 1`] = `"TWVkaWE6MTM="`; 4 | 5 | exports[`Test Media loader Load a media item 2`] = ` 6 | Media { 7 | "id": 13, 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/NavMenu.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test NavMenu loader Load a NavMenu 1`] = `"TmF2TWVudTo="`; 4 | 5 | exports[`Test NavMenu loader Load a NavMenu 2`] = ` 6 | NavMenu { 7 | "slug": "main-nav", 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Page.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Page loader Load a page 1`] = `"UGFnZToxMw=="`; 4 | 5 | exports[`Test Page loader Load a page 2`] = ` 6 | Page { 7 | "id": 13, 8 | } 9 | `; 10 | 11 | exports[`Test Page loader Load a page by slug 1`] = ` 12 | Page { 13 | "slug": "go-to-this", 14 | } 15 | `; 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Post.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Post loader Load a post 1`] = `"UG9zdDoxMw=="`; 4 | 5 | exports[`Test Post loader Load a post 2`] = ` 6 | Post { 7 | "id": 13, 8 | } 9 | `; 10 | 11 | exports[`Test Post loader Load a post by slug 1`] = ` 12 | Post { 13 | "slug": "whatever", 14 | } 15 | `; 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Settings.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Settings loader Load settings 1`] = `"U2V0dGluZ3M6bWU="`; 4 | 5 | exports[`Test Settings loader Load settings 2`] = ` 6 | Settings { 7 | "slug": "graphql/v1/settings", 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Sidebar.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Sidebar loader Load a Sidebar 1`] = `"U2lkZWJhcjo="`; 4 | 5 | exports[`Test Sidebar loader Load a Sidebar 2`] = ` 6 | Sidebar { 7 | "slug": "main-nav", 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Tag.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Tag loader Load a tag 1`] = `"VGFnOjEz"`; 4 | 5 | exports[`Test Tag loader Load a tag 2`] = ` 6 | Tag { 7 | "id": 13, 8 | } 9 | `; 10 | 11 | exports[`Test Tag loader Load a tag by slug 1`] = ` 12 | Tag { 13 | "slug": "dirty-projectors", 14 | } 15 | `; 16 | 17 | exports[`Test Tag loader Load tags 1`] = ` 18 | Array [ 19 | Tag { 20 | "id": 13, 21 | }, 22 | Tag { 23 | "id": 17, 24 | }, 25 | ] 26 | `; 27 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/Taxonomy.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Taxonomy loader Load a taxonomy 1`] = `"VGF4b25vbXk6dGFn"`; 4 | 5 | exports[`Test Taxonomy loader Load a taxonomy 2`] = ` 6 | Taxonomy { 7 | "slug": "tag", 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/data/loaders/__tests__/__snapshots__/User.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test User loader Load a user 1`] = `"VXNlcjox"`; 4 | 5 | exports[`Test User loader Load a user 2`] = ` 6 | User { 7 | "id": 1, 8 | } 9 | `; 10 | 11 | exports[`Test User loader Load a user by slug 1`] = ` 12 | User { 13 | "slug": "admin", 14 | } 15 | `; 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/__tests__/Schema.test.js: -------------------------------------------------------------------------------- 1 | import Schema from '../../schema'; 2 | 3 | describe('Test Schema', () => { 4 | test('Types', () => { 5 | expect(Schema.getTypeMap()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/__tests__/__snapshots__/Sidebar.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test NavMenu queries GraphQL should return a Sidebar by ID 1`] = ` 4 | Object { 5 | "data": Object { 6 | "viewer": Object { 7 | "sidebar": Object { 8 | "widgets": Array [ 9 | Object { 10 | "classname": "cool-widget", 11 | "content": Object { 12 | "rendered": "This is a bunch of WIDGET content.", 13 | }, 14 | }, 15 | Object { 16 | "classname": "cool-widget", 17 | "content": Object { 18 | "rendered": "This is a bunch of WIDGET content.", 19 | }, 20 | }, 21 | ], 22 | }, 23 | }, 24 | }, 25 | } 26 | `; 27 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/CommentOrderby.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const COMMENT_ORDERBY = new GraphQLEnumType({ 4 | name: 'COMMENT_ORDERBY', 5 | description: 'Sort collection by object attribute.', 6 | values: { 7 | ID: { value: 'id' }, 8 | INCLUDE: { value: 'include' }, 9 | DATE: { value: 'date' }, 10 | DATE_GMT: { value: 'date_gmt' }, 11 | POST: { value: 'post' }, 12 | PARENT: { value: 'parent' }, 13 | TYPE: { value: 'type' }, 14 | }, 15 | }); 16 | 17 | export default COMMENT_ORDERBY; 18 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/CommentStatus.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const COMMENT_STATUS = new GraphQLEnumType({ 4 | name: 'COMMENT_STATUS', 5 | description: 'Whether or not comments are open on the object.', 6 | values: { 7 | OPEN: { value: 'open' }, 8 | CLOSED: { value: 'closed' }, 9 | }, 10 | }); 11 | 12 | export default COMMENT_STATUS; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/Format.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const FORMAT = new GraphQLEnumType({ 4 | name: 'FORMAT', 5 | description: 'The format for the object.', 6 | values: { 7 | STANDARD: { value: 'standard' }, 8 | ASIDE: { value: 'aside' }, 9 | CHAT: { value: 'chat' }, 10 | GALLERY: { value: 'gallery' }, 11 | LINK: { value: 'link' }, 12 | IMAGE: { value: 'image' }, 13 | QUOTE: { value: 'quote' }, 14 | STATUS: { value: 'status' }, 15 | VIDEO: { value: 'video' }, 16 | AUDIO: { value: 'audio' }, 17 | }, 18 | }); 19 | 20 | export default FORMAT; 21 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/MediaType.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const MEDIA_TYPE = new GraphQLEnumType({ 4 | name: 'MEDIA_TYPE', 5 | description: 'Attachment type.', 6 | values: { 7 | IMAGE: { value: 'image' }, 8 | VIDEO: { value: 'video' }, 9 | AUDIO: { value: 'audio' }, 10 | APPLICATION: { value: 'application' }, 11 | FILE: { value: 'file' }, 12 | }, 13 | }); 14 | 15 | export default MEDIA_TYPE; 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/Order.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const ORDER = new GraphQLEnumType({ 4 | name: 'ORDER', 5 | description: 'Order sort attribute ascending or descending.', 6 | values: { 7 | ASC: { value: 'asc' }, 8 | DESC: { value: 'desc' }, 9 | }, 10 | }); 11 | 12 | export default ORDER; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/PageOrderby.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const PAGE_ORDERBY = new GraphQLEnumType({ 4 | name: 'PAGE_ORDERBY', 5 | description: 'Sort collection by object attribute.', 6 | values: { 7 | DATE: { value: 'date' }, 8 | RELEVANCE: { value: 'relevance' }, 9 | ID: { value: 'id' }, 10 | INCLUDE: { value: 'include' }, 11 | TITLE: { value: 'title' }, 12 | SLUG: { value: 'slug' }, 13 | MENU_ORDER: { value: 'menu_order' }, 14 | }, 15 | }); 16 | 17 | export default PAGE_ORDERBY; 18 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/PingStatus.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const PING_STATUS = new GraphQLEnumType({ 4 | name: 'PING_STATUS', 5 | description: 'Whether or not the object can be pinged.', 6 | values: { 7 | OPEN: { value: 'open' }, 8 | CLOSED: { value: 'closed' }, 9 | }, 10 | }); 11 | 12 | export default PING_STATUS; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/PostOrderby.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const POST_ORDERBY = new GraphQLEnumType({ 4 | name: 'POST_ORDERBY', 5 | description: 'Sort collection by object attribute.', 6 | values: { 7 | DATE: { value: 'date' }, 8 | RELEVANCE: { value: 'relevance' }, 9 | ID: { value: 'id' }, 10 | INCLUDE: { value: 'include' }, 11 | TITLE: { value: 'title' }, 12 | SLUG: { value: 'slug' }, 13 | }, 14 | }); 15 | 16 | export default POST_ORDERBY; 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/TaxonomyOrderby.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const TAXONOMY_ORDERBY = new GraphQLEnumType({ 4 | name: 'TAXONOMY_ORDERBY', 5 | description: 'Sort collection by term attribute.', 6 | values: { 7 | ID: { value: 'id' }, 8 | INCLUDE: { value: 'include' }, 9 | NAME: { value: 'name' }, 10 | SLUG: { value: 'slug' }, 11 | TERM_GROUP: { value: 'term_group' }, 12 | DESCRIPTION: { value: 'description' }, 13 | COUNT: { value: 'count' }, 14 | }, 15 | }); 16 | 17 | export default TAXONOMY_ORDERBY; 18 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/UserOrderby.js: -------------------------------------------------------------------------------- 1 | import { GraphQLEnumType } from 'graphql'; 2 | 3 | const USER_ORDERBY = new GraphQLEnumType({ 4 | name: 'USER_ORDERBY', 5 | description: 'Sort collection by object attribute.', 6 | values: { 7 | ID: { value: 'id' }, 8 | INCLUDE: { value: 'include' }, 9 | NAME: { value: 'name' }, 10 | REGISTERED_DATE: { value: 'registered_date' }, 11 | SLUG: { value: 'slug' }, 12 | EMAIL: { value: 'email' }, 13 | URL: { value: 'url' }, 14 | }, 15 | }); 16 | 17 | export default USER_ORDERBY; 18 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/CommentOrderby.test.js: -------------------------------------------------------------------------------- 1 | import COMMENT_ORDERBY from 'enum/CommentOrderby'; 2 | 3 | describe('Test enum values', () => { 4 | test('COMMENT_ORDERBY values', () => { 5 | expect(COMMENT_ORDERBY.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/CommentStatus.test.js: -------------------------------------------------------------------------------- 1 | import COMMENT_STATUS from 'enum/CommentStatus'; 2 | 3 | describe('Test enum values', () => { 4 | test('COMMENT_STATUS values', () => { 5 | expect(COMMENT_STATUS.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/Format.test.js: -------------------------------------------------------------------------------- 1 | import FORMAT from 'enum/Format'; 2 | 3 | describe('Test enum values', () => { 4 | test('FORMAT values', () => { 5 | expect(FORMAT.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/MediaType.test.js: -------------------------------------------------------------------------------- 1 | import MEDIA_TYPE from 'enum/MediaType'; 2 | 3 | describe('Test enum values', () => { 4 | test('MEDIA_TYPE values', () => { 5 | expect(MEDIA_TYPE.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/Order.test.js: -------------------------------------------------------------------------------- 1 | import ORDER from 'enum/Order'; 2 | 3 | describe('Test enum values', () => { 4 | test('ORDER values', () => { 5 | expect(ORDER.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/PageOrderby.test.js: -------------------------------------------------------------------------------- 1 | import PAGE_ORDERBY from 'enum/PageOrderby'; 2 | 3 | describe('Test enum values', () => { 4 | test('PAGE_ORDERBY values', () => { 5 | expect(PAGE_ORDERBY.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/PingStatus.test.js: -------------------------------------------------------------------------------- 1 | import PING_STATUS from 'enum/PingStatus'; 2 | 3 | describe('Test enum values', () => { 4 | test('PING_STATUS values', () => { 5 | expect(PING_STATUS.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/PostOrderby.test.js: -------------------------------------------------------------------------------- 1 | import POST_ORDERBY from 'enum/PostOrderby'; 2 | 3 | describe('Test enum values', () => { 4 | test('POST_ORDERBY values', () => { 5 | expect(POST_ORDERBY.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/TaxonomyOrderby.test.js: -------------------------------------------------------------------------------- 1 | import TAXONOMY_ORDERBY from 'enum/TaxonomyOrderby'; 2 | 3 | describe('Test enum values', () => { 4 | test('TAXONOMY_ORDERBY values', () => { 5 | expect(TAXONOMY_ORDERBY.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/UserOrderby.test.js: -------------------------------------------------------------------------------- 1 | import USER_ORDERBY from 'enum/UserOrderby'; 2 | 3 | describe('Test enum values', () => { 4 | test('USER_ORDERBY values', () => { 5 | expect(USER_ORDERBY.getValues()).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/__snapshots__/CommentStatus.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test enum values COMMENT_STATUS values 1`] = ` 4 | Array [ 5 | Object { 6 | "deprecationReason": undefined, 7 | "description": undefined, 8 | "isDeprecated": false, 9 | "name": "OPEN", 10 | "value": "open", 11 | }, 12 | Object { 13 | "deprecationReason": undefined, 14 | "description": undefined, 15 | "isDeprecated": false, 16 | "name": "CLOSED", 17 | "value": "closed", 18 | }, 19 | ] 20 | `; 21 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/__snapshots__/Order.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test enum values ORDER values 1`] = ` 4 | Array [ 5 | Object { 6 | "deprecationReason": undefined, 7 | "description": undefined, 8 | "isDeprecated": false, 9 | "name": "ASC", 10 | "value": "asc", 11 | }, 12 | Object { 13 | "deprecationReason": undefined, 14 | "description": undefined, 15 | "isDeprecated": false, 16 | "name": "DESC", 17 | "value": "desc", 18 | }, 19 | ] 20 | `; 21 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/enum/__tests__/__snapshots__/PingStatus.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test enum values PING_STATUS values 1`] = ` 4 | Array [ 5 | Object { 6 | "deprecationReason": undefined, 7 | "description": undefined, 8 | "isDeprecated": false, 9 | "name": "OPEN", 10 | "value": "open", 11 | }, 12 | Object { 13 | "deprecationReason": undefined, 14 | "description": undefined, 15 | "isDeprecated": false, 16 | "name": "CLOSED", 17 | "value": "closed", 18 | }, 19 | ] 20 | `; 21 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/author.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test author field 1`] = `"User"`; 4 | 5 | exports[`Test schema type field definition Test resolve author field 1`] = ` 6 | User { 7 | "id": 1, 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/content.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test content field 1`] = `"Content"`; 4 | 5 | exports[`Test schema type field definition Test excerpt field 1`] = `"Excerpt"`; 6 | 7 | exports[`Test schema type field definition Test title field 1`] = `"Title"`; 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/date.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test date fields 1`] = `"String"`; 4 | 5 | exports[`Test schema type field definition Test date fields 2`] = `"String"`; 6 | 7 | exports[`Test schema type field definition Test modified fields 1`] = `"String"`; 8 | 9 | exports[`Test schema type field definition Test modified fields 2`] = `"String"`; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/description.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test description field 1`] = `"String"`; 4 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/identifier.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test globalIdField field 1`] = `"ID!"`; 4 | 5 | exports[`Test schema type field definition Test globalIdField field 2`] = `"TW9ja0RhdGE6ODY3NTM5"`; 6 | 7 | exports[`Test schema type field definition Test guid field 1`] = `"Guid"`; 8 | 9 | exports[`Test schema type field definition Test id field 1`] = `"ID"`; 10 | 11 | exports[`Test schema type field definition Test link field 1`] = `"String"`; 12 | 13 | exports[`Test schema type field definition Test name field 1`] = `"String"`; 14 | 15 | exports[`Test schema type field definition Test slug field 1`] = `"String"`; 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/media.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test altText field 1`] = `"String"`; 4 | 5 | exports[`Test schema type field definition Test caption field 1`] = `"Caption"`; 6 | 7 | exports[`Test schema type field definition Test description field 1`] = `"Description"`; 8 | 9 | exports[`Test schema type field definition Test featuredMedia field 1`] = `"Media"`; 10 | 11 | exports[`Test schema type field definition Test featuredMedia field resolver 1`] = ` 12 | Media { 13 | "id": 69, 14 | } 15 | `; 16 | 17 | exports[`Test schema type field definition Test mediaType field 1`] = `"MEDIA_TYPE"`; 18 | 19 | exports[`Test schema type field definition Test mimeType field 1`] = `"String"`; 20 | 21 | exports[`Test schema type field definition Test sourceUrl field 1`] = `"String"`; 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/meta.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test meta field 1`] = `"[Meta]"`; 4 | 5 | exports[`Test schema type field definition Test meta field resolver 1`] = ` 6 | Array [ 7 | Object { 8 | "name": "taco", 9 | "value": "bell", 10 | }, 11 | Object { 12 | "name": "doritos", 13 | "value": "loco", 14 | }, 15 | ] 16 | `; 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/post.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test format field 1`] = `"FORMAT"`; 4 | 5 | exports[`Test schema type field definition Test sticky field 1`] = `"Boolean"`; 6 | 7 | exports[`Test schema type field definition Test template field 1`] = `"String"`; 8 | 9 | exports[`Test schema type field definition Test type field 1`] = `"String"`; 10 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/protected.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test protected field 1`] = `"Boolean"`; 4 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/raw.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test raw field 1`] = `"String"`; 4 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/rendered.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test rendered field 1`] = `"String"`; 4 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/status.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test commentStatus field 1`] = `"COMMENT_STATUS"`; 4 | 5 | exports[`Test schema type field definition Test pingStatus field 1`] = `"PING_STATUS"`; 6 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/__snapshots__/taxonomy.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test schema type field definition Test count field 1`] = `"Int"`; 4 | 5 | exports[`Test schema type field definition Test taxonomy field 1`] = `"Taxonomy"`; 6 | 7 | exports[`Test schema type field definition Test taxonomy field resolver 1`] = ` 8 | Taxonomy { 9 | "slug": "tag", 10 | } 11 | `; 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/author.test.js: -------------------------------------------------------------------------------- 1 | import fields from 'field/author'; 2 | import getLoaders from 'data/loaders'; 3 | 4 | const args = {}; 5 | const context = {}; 6 | const info = { 7 | rootValue: { 8 | loaders: getLoaders(), 9 | }, 10 | }; 11 | 12 | describe('Test schema type field definition', () => { 13 | test('Test author field', () => { 14 | expect(fields.author.type.name).toMatchSnapshot(); 15 | }); 16 | 17 | test('Test resolve author field', async () => { 18 | const author = await fields.author.resolve({ author: 1 }, args, context, info); 19 | return expect(author).toMatchSnapshot(); 20 | }); 21 | 22 | test('Test resolve author field null', () => { 23 | expect(fields.author.resolve({ author: 0 }, args, context, info)).toBeNull(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/content.test.js: -------------------------------------------------------------------------------- 1 | import { title, content, excerpt } from 'field/content'; 2 | 3 | describe('Test schema type field definition', () => { 4 | test('Test title field', () => { 5 | const { title: field } = title; 6 | expect(field.type).toMatchSnapshot(); 7 | }); 8 | 9 | test('Test content field', () => { 10 | const { content: field } = content; 11 | expect(field.type).toMatchSnapshot(); 12 | }); 13 | 14 | test('Test excerpt field', () => { 15 | const { excerpt: field } = excerpt; 16 | expect(field.type).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/date.test.js: -------------------------------------------------------------------------------- 1 | import { date, modified } from 'field/date'; 2 | 3 | describe('Test schema type field definition', () => { 4 | test('Test date fields', () => { 5 | expect(date.date.type.name).toMatchSnapshot(); 6 | expect(date.dateGMT.type.name).toMatchSnapshot(); 7 | }); 8 | 9 | test('Test modified fields', () => { 10 | expect(modified.modified.type.name).toMatchSnapshot(); 11 | expect(modified.modifiedGMT.type.name).toMatchSnapshot(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/description.test.js: -------------------------------------------------------------------------------- 1 | import fields from 'field/description'; 2 | 3 | describe('Test schema type field definition', () => { 4 | test('Test description field', () => { 5 | expect(fields.description.type.name).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/meta.test.js: -------------------------------------------------------------------------------- 1 | import meta from 'field/meta'; 2 | 3 | describe('Test schema type field definition', () => { 4 | const field = meta(); 5 | 6 | test('Test meta field', () => { 7 | expect(field.type).toMatchSnapshot(); 8 | }); 9 | 10 | test('Test meta field resolver', () => { 11 | expect(field.resolve({ meta: { taco: 'bell', doritos: 'loco' } })).toMatchSnapshot(); 12 | }); 13 | 14 | test('Test meta field resolver null', () => { 15 | expect(field.resolve({ meta: null })).toBeNull(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/post.test.js: -------------------------------------------------------------------------------- 1 | import { type, template, format, sticky } from 'field/post'; 2 | 3 | describe('Test schema type field definition', () => { 4 | test('Test type field', () => { 5 | const { type: field } = type; 6 | expect(field.type.name).toMatchSnapshot(); 7 | }); 8 | 9 | test('Test template field', () => { 10 | const { template: field } = template; 11 | expect(field.type).toMatchSnapshot(); 12 | }); 13 | 14 | test('Test format field', () => { 15 | const { format: field } = format; 16 | expect(field.type.name).toMatchSnapshot(); 17 | }); 18 | 19 | test('Test sticky field', () => { 20 | const { sticky: field } = sticky; 21 | expect(field.type).toMatchSnapshot(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/protected.test.js: -------------------------------------------------------------------------------- 1 | import fields from 'field/protected'; 2 | 3 | describe('Test schema type field definition', () => { 4 | test('Test protected field', () => { 5 | expect(fields.protected.type.name).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/raw.test.js: -------------------------------------------------------------------------------- 1 | import fields from 'field/raw'; 2 | 3 | describe('Test schema type field definition', () => { 4 | test('Test raw field', () => { 5 | expect(fields.raw.type.name).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/rendered.test.js: -------------------------------------------------------------------------------- 1 | import fields from 'field/rendered'; 2 | 3 | describe('Test schema type field definition', () => { 4 | test('Test rendered field', () => { 5 | expect(fields.rendered.type.name).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/status.test.js: -------------------------------------------------------------------------------- 1 | import { commentStatus, pingStatus } from 'field/status'; 2 | 3 | describe('Test schema type field definition', () => { 4 | test('Test commentStatus field', () => { 5 | const { commentStatus: field } = commentStatus; 6 | expect(field.type.name).toMatchSnapshot(); 7 | }); 8 | 9 | test('Test pingStatus field', () => { 10 | const { pingStatus: field } = pingStatus; 11 | expect(field.type.name).toMatchSnapshot(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/__tests__/taxonomy.test.js: -------------------------------------------------------------------------------- 1 | import fields from 'field/taxonomy'; 2 | import getLoaders from 'data/loaders'; 3 | 4 | const args = {}; 5 | const context = {}; 6 | const info = { 7 | rootValue: { 8 | loaders: getLoaders(), 9 | }, 10 | }; 11 | 12 | describe('Test schema type field definition', () => { 13 | test('Test taxonomy field', () => { 14 | expect(fields.taxonomy.type.name).toMatchSnapshot(); 15 | }); 16 | 17 | test('Test taxonomy field resolver', async () => { 18 | const taxonomy = await fields.taxonomy.resolve({ taxonomy: 'tag' }, args, context, info); 19 | expect(taxonomy).toMatchSnapshot(); 20 | }); 21 | 22 | test('Test count field', () => { 23 | expect(fields.count.type).toMatchSnapshot(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/author.js: -------------------------------------------------------------------------------- 1 | import UserType from 'type/User'; 2 | 3 | export default { 4 | author: { 5 | type: UserType, 6 | description: 'The author object of the item.', 7 | resolve: (data, args, context, { rootValue: { loaders: { User } } }) => 8 | data.author > 0 ? User.load(data.author) : null, 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/content.js: -------------------------------------------------------------------------------- 1 | import Title from 'type/Title'; 2 | import Content from 'type/Content'; 3 | import Excerpt from 'type/Excerpt'; 4 | 5 | export const title = { 6 | title: { 7 | type: Title, 8 | }, 9 | }; 10 | 11 | export const content = { 12 | content: { 13 | type: Content, 14 | }, 15 | }; 16 | 17 | export const excerpt = { 18 | excerpt: { 19 | type: Excerpt, 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/date.js: -------------------------------------------------------------------------------- 1 | import { GraphQLString } from 'graphql'; 2 | 3 | export const date = { 4 | date: { 5 | type: GraphQLString, 6 | description: 'The date the object was published, in the timezone of the site.', 7 | }, 8 | dateGMT: { 9 | type: GraphQLString, 10 | description: 'The date the object was published, as GMT.', 11 | }, 12 | }; 13 | 14 | export const modified = { 15 | modified: { 16 | type: GraphQLString, 17 | description: 'The date the object was modified, in the timezone of the site.', 18 | }, 19 | modifiedGMT: { 20 | type: GraphQLString, 21 | description: 'The date the object was modified, as GMT.', 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/description.js: -------------------------------------------------------------------------------- 1 | import { GraphQLString } from 'graphql'; 2 | 3 | export default { 4 | description: { 5 | type: GraphQLString, 6 | description: 'The object description.', 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/meta.js: -------------------------------------------------------------------------------- 1 | import { GraphQLList } from 'graphql'; 2 | import Meta from 'type/Meta'; 3 | 4 | const metaResolver = data => { 5 | if (!data.meta || !Object.keys(data.meta).length) { 6 | return null; 7 | } 8 | return Object.keys(data.meta).map(key => ({ 9 | name: key, 10 | value: data.meta[key], 11 | })); 12 | }; 13 | 14 | export default () => ({ 15 | type: new GraphQLList(Meta), 16 | description: 'Meta fields.', 17 | resolve: metaResolver, 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/post.js: -------------------------------------------------------------------------------- 1 | import { GraphQLString, GraphQLBoolean } from 'graphql'; 2 | 3 | import FORMAT from 'enum/Format'; 4 | 5 | export const type = { 6 | type: { 7 | type: GraphQLString, 8 | description: 'Type of Post for the object.', 9 | }, 10 | }; 11 | 12 | export const template = { 13 | template: { 14 | type: GraphQLString, 15 | description: 'The theme file to use to display the object.', 16 | }, 17 | }; 18 | 19 | export const format = { 20 | format: { 21 | type: FORMAT, 22 | }, 23 | }; 24 | 25 | export const sticky = { 26 | sticky: { 27 | type: GraphQLBoolean, 28 | description: 'Whether or not the object should be treated as sticky.', 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/protected.js: -------------------------------------------------------------------------------- 1 | import { GraphQLBoolean } from 'graphql'; 2 | 3 | export default { 4 | protected: { 5 | type: GraphQLBoolean, 6 | description: 'Whether the field is protected with a password.', 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/raw.js: -------------------------------------------------------------------------------- 1 | import { GraphQLString } from 'graphql'; 2 | 3 | export default { 4 | raw: { 5 | type: GraphQLString, 6 | description: 'Content for the object, as it exists in the database.', 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/rendered.js: -------------------------------------------------------------------------------- 1 | import { GraphQLString } from 'graphql'; 2 | 3 | export default { 4 | rendered: { 5 | type: GraphQLString, 6 | description: 'HTML for the object, transformed for display.', 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/status.js: -------------------------------------------------------------------------------- 1 | import COMMENT_STATUS from 'enum/CommentStatus'; 2 | import PING_STATUS from 'enum/PingStatus'; 3 | 4 | export const commentStatus = { 5 | commentStatus: { 6 | type: COMMENT_STATUS, 7 | }, 8 | }; 9 | 10 | export const pingStatus = { 11 | pingStatus: { 12 | type: PING_STATUS, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/field/taxonomy.js: -------------------------------------------------------------------------------- 1 | import { GraphQLInt } from 'graphql'; 2 | 3 | import TaxonomyType from 'type/Taxonomy'; 4 | 5 | export default { 6 | taxonomy: { 7 | type: TaxonomyType, 8 | description: 'Type attribution for the term.', 9 | resolve: (term, args, context, { rootValue: { loaders: { Taxonomy } } }) => 10 | Taxonomy.load(term.taxonomy), 11 | }, 12 | count: { 13 | type: GraphQLInt, 14 | description: 'Number of published posts for the term.', 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/index.js: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema } from 'graphql'; 2 | import Query from 'type/Query'; 3 | import Mutation from 'type/Mutation'; 4 | 5 | const Schema = new GraphQLSchema({ 6 | query: Query, 7 | mutation: Mutation, 8 | }); 9 | 10 | export default Schema; 11 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/interface/Term.js: -------------------------------------------------------------------------------- 1 | import { GraphQLInterfaceType, GraphQLNonNull, GraphQLID, GraphQLInt, GraphQLList } from 'graphql'; 2 | 3 | import Meta from 'type/Meta'; 4 | import TaxonomyType from 'type/Taxonomy'; 5 | import { slug, name, link } from 'field/identifier'; 6 | import description from 'field/description'; 7 | 8 | const TermInterface = new GraphQLInterfaceType({ 9 | name: 'TermInterface', 10 | description: 'Term fields.', 11 | fields: { 12 | id: { 13 | type: new GraphQLNonNull(GraphQLID), 14 | description: 'Unique identifier for the object.', 15 | }, 16 | ...description, 17 | ...link, 18 | ...name, 19 | ...slug, 20 | count: { type: GraphQLInt }, 21 | taxonomy: { type: TaxonomyType }, 22 | meta: { type: new GraphQLList(Meta) }, 23 | }, 24 | }); 25 | 26 | export default TermInterface; 27 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Avatar.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLInt, GraphQLString } from 'graphql'; 2 | 3 | const Avatar = new GraphQLObjectType({ 4 | name: 'Avatar', 5 | description: 'Avatar info.', 6 | fields: { 7 | size: { type: GraphQLInt }, 8 | url: { type: GraphQLString }, 9 | }, 10 | }); 11 | 12 | export default Avatar; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Caption.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | import rendered from 'field/rendered'; 3 | 4 | const Caption = new GraphQLObjectType({ 5 | name: 'Caption', 6 | description: 'The caption for the object.', 7 | fields: { 8 | ...rendered, 9 | }, 10 | }); 11 | 12 | export default Caption; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Chart/ChartItemImage.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString, GraphQLInt } from 'graphql'; 2 | 3 | const ChartItemImageType = new GraphQLObjectType({ 4 | name: 'ChartItemImage', 5 | description: 'iTunes chart item image.', 6 | fields: { 7 | url: { 8 | type: GraphQLString, 9 | description: 'Image URL.', 10 | resolve: image => image.label, 11 | }, 12 | height: { 13 | type: GraphQLInt, 14 | description: 'Image height.', 15 | resolve: image => image.attributes.height, 16 | }, 17 | }, 18 | }); 19 | 20 | export default ChartItemImageType; 21 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Chart/__tests__/ChartItemImage.test.js: -------------------------------------------------------------------------------- 1 | import ChartItemImageType from 'type/Chart/ChartItemImage'; 2 | 3 | // eslint-disable-next-line no-underscore-dangle 4 | const fields = ChartItemImageType._typeConfig.fields; 5 | 6 | describe('Test ChartItem type', () => { 7 | test('Test name', () => { 8 | expect(ChartItemImageType.name).toMatchSnapshot(); 9 | }); 10 | 11 | test('Test fields', () => { 12 | expect(Object.keys(ChartItemImageType.getFields())).toMatchSnapshot(); 13 | }); 14 | 15 | test('Test resolve url', () => { 16 | expect(fields.url.resolve({ label: 'https://scott.com/image.jpg' })).toMatchSnapshot(); 17 | }); 18 | 19 | test('Test resolve height', () => { 20 | expect(fields.height.resolve({ attributes: { height: 80 } })).toMatchSnapshot(); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Chart/__tests__/__snapshots__/ChartItemImage.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test ChartItem type Test fields 1`] = ` 4 | Array [ 5 | "url", 6 | "height", 7 | ] 8 | `; 9 | 10 | exports[`Test ChartItem type Test name 1`] = `"ChartItemImage"`; 11 | 12 | exports[`Test ChartItem type Test resolve height 1`] = `80`; 13 | 14 | exports[`Test ChartItem type Test resolve url 1`] = `"https://scott.com/image.jpg"`; 15 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Chart/index.js: -------------------------------------------------------------------------------- 1 | import ChartType from './Chart'; 2 | 3 | export default ChartType; 4 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Content.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLList } from 'graphql'; 2 | 3 | import rendered from 'field/rendered'; 4 | import raw from 'field/raw'; 5 | // 'protected' is a reserved word in JS 6 | import protectedField from 'field/protected'; 7 | import ContentNode from 'type/ContentNode'; 8 | 9 | const Content = new GraphQLObjectType({ 10 | name: 'Content', 11 | description: 'The content for the object.', 12 | fields: () => ({ 13 | ...rendered, 14 | ...raw, 15 | ...protectedField, 16 | data: { 17 | type: new GraphQLList(ContentNode), 18 | }, 19 | }), 20 | }); 21 | 22 | export default Content; 23 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/ContentNode/Element.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString, GraphQLList } from 'graphql'; 2 | import ContentNode from 'type/ContentNode'; 3 | import Meta from 'type/Meta'; 4 | 5 | const ElementType = new GraphQLObjectType({ 6 | name: 'Element', 7 | description: 'An element node.', 8 | isTypeOf(node) { 9 | return node.type === 'element'; 10 | }, 11 | fields: () => ({ 12 | tagName: { 13 | type: GraphQLString, 14 | }, 15 | attributes: { 16 | type: new GraphQLList(Meta), 17 | }, 18 | children: { 19 | type: new GraphQLList(ContentNode), 20 | }, 21 | }), 22 | }); 23 | 24 | export default ElementType; 25 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/ContentNode/Text.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString } from 'graphql'; 2 | 3 | const TextType = new GraphQLObjectType({ 4 | name: 'Text', 5 | description: 'A text node.', 6 | isTypeOf(node) { 7 | return node.type === 'text'; 8 | }, 9 | fields: () => ({ 10 | text: { 11 | type: GraphQLString, 12 | }, 13 | }), 14 | }); 15 | 16 | export default TextType; 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/ContentNode/index.js: -------------------------------------------------------------------------------- 1 | import { GraphQLUnionType } from 'graphql'; 2 | 3 | import ElementType from 'type/ContentNode/Element'; 4 | import TextType from 'type/ContentNode/Text'; 5 | import EmbedType from 'type/ContentNode/Embed'; 6 | 7 | const ContentNodeType = new GraphQLUnionType({ 8 | name: 'ContentNode', 9 | types: [ElementType, TextType, EmbedType], 10 | }); 11 | 12 | export default ContentNodeType; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Description.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | 3 | import rendered from 'field/rendered'; 4 | 5 | const Description = new GraphQLObjectType({ 6 | name: 'Description', 7 | description: 'The description for the object.', 8 | fields: { 9 | ...rendered, 10 | }, 11 | }); 12 | 13 | export default Description; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Excerpt.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLList } from 'graphql'; 2 | 3 | import rendered from 'field/rendered'; 4 | import raw from 'field/raw'; 5 | // 'protected' is a reserved word in JS 6 | import protectedField from 'field/protected'; 7 | import ContentNode from 'type/ContentNode'; 8 | 9 | const Excerpt = new GraphQLObjectType({ 10 | name: 'Excerpt', 11 | description: 'The excerpt for the object.', 12 | fields: { 13 | ...rendered, 14 | ...raw, 15 | ...protectedField, 16 | data: { 17 | type: new GraphQLList(ContentNode), 18 | }, 19 | }, 20 | }); 21 | 22 | export default Excerpt; 23 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Guid.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | 3 | import rendered from 'field/rendered'; 4 | 5 | const Guid = new GraphQLObjectType({ 6 | name: 'Guid', 7 | description: 'The globally unique identifier for the object.', 8 | fields: { 9 | ...rendered, 10 | }, 11 | }); 12 | 13 | export default Guid; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Labels.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString } from 'graphql'; 2 | 3 | const LabelsType = new GraphQLObjectType({ 4 | name: 'Labels', 5 | fields: { 6 | singular: { 7 | type: GraphQLString, 8 | }, 9 | plural: { 10 | type: GraphQLString, 11 | }, 12 | }, 13 | }); 14 | 15 | export default LabelsType; 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/Audio/index.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | import MediaInterface from 'interface/Media'; 3 | import mediaFields from 'type/Media/fields'; 4 | import AudioDetails from 'type/Media/Audio/Details'; 5 | import { featuredMedia } from 'field/media'; 6 | 7 | const AudioType = new GraphQLObjectType({ 8 | name: 'Audio', 9 | description: 'An object.', 10 | interfaces: [MediaInterface], 11 | isTypeOf(media) { 12 | return media.mime_type.indexOf('audio') === 0; 13 | }, 14 | fields: () => ({ 15 | ...mediaFields, 16 | mediaDetails: { 17 | type: AudioDetails, 18 | resolve: media => media.media_details, 19 | }, 20 | featuredMedia: featuredMedia(), 21 | }), 22 | }); 23 | 24 | export default AudioType; 25 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/Image/Details.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString, GraphQLList } from 'graphql'; 2 | import MediaSize from 'type/Media/Size'; 3 | import { dimensions } from 'field/media'; 4 | 5 | const ImageDetails = new GraphQLObjectType({ 6 | name: 'ImageDetails', 7 | description: 'The details for the media.', 8 | fields: { 9 | ...dimensions, 10 | file: { type: GraphQLString }, 11 | sizes: { 12 | type: new GraphQLList(MediaSize), 13 | resolve: media => 14 | Object.keys(media.sizes).map(size => ({ 15 | ...media.sizes[size], 16 | sourceUrl: media.sizes[size].source_url, 17 | name: size, 18 | })), 19 | }, 20 | }, 21 | }); 22 | 23 | export default ImageDetails; 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/Image/index.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | 3 | import MediaInterface from 'interface/Media'; 4 | import mediaFields from 'type/Media/fields'; 5 | import ImageDetails from 'type/Media/Image/Details'; 6 | 7 | const ImageType = new GraphQLObjectType({ 8 | name: 'Image', 9 | description: 'An object.', 10 | interfaces: [MediaInterface], 11 | isTypeOf(media) { 12 | return media.mime_type.indexOf('image') === 0; 13 | }, 14 | fields: { 15 | ...mediaFields, 16 | mediaDetails: { 17 | type: ImageDetails, 18 | resolve: media => media.media_details, 19 | }, 20 | }, 21 | }); 22 | 23 | export default ImageType; 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/Size.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString } from 'graphql'; 2 | import { dimensions } from 'field/media'; 3 | 4 | const MediaSizeType = new GraphQLObjectType({ 5 | name: 'MediaSize', 6 | description: 'The details for the media size.', 7 | fields: { 8 | name: { type: GraphQLString }, 9 | ...dimensions, 10 | file: { type: GraphQLString }, 11 | mimeType: { type: GraphQLString }, 12 | sourceUrl: { type: GraphQLString }, 13 | }, 14 | }); 15 | 16 | export default MediaSizeType; 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/Video/Details.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | import { lengthFields, fileFields, dimensions, dataFormat } from 'field/media'; 3 | 4 | const VideoDetails = new GraphQLObjectType({ 5 | name: 'VideoDetails', 6 | description: 'Details of the video file.', 7 | fields: { 8 | ...lengthFields, 9 | ...fileFields, 10 | ...dimensions, 11 | ...dataFormat, 12 | }, 13 | }); 14 | 15 | export default VideoDetails; 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/Video/index.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | 3 | import MediaInterface from 'interface/Media'; 4 | import mediaFields from 'type/Media/fields'; 5 | import VideoDetails from 'type/Media/Video/Details'; 6 | import { featuredMedia } from 'field/media'; 7 | 8 | const VideoType = new GraphQLObjectType({ 9 | name: 'Video', 10 | description: 'An object.', 11 | interfaces: [MediaInterface], 12 | isTypeOf(media) { 13 | return media.mime_type.indexOf('video') === 0; 14 | }, 15 | fields: () => ({ 16 | ...mediaFields, 17 | mediaDetails: { 18 | type: VideoDetails, 19 | resolve: media => media.media_details, 20 | }, 21 | featuredMedia: featuredMedia(), 22 | }), 23 | }); 24 | 25 | export default VideoType; 26 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/__tests__/__snapshots__/fields.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Media fields Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "date", 7 | "dateGMT", 8 | "guid", 9 | "modified", 10 | "modifiedGMT", 11 | "slug", 12 | "type", 13 | "link", 14 | "title", 15 | "commentStatus", 16 | "pingStatus", 17 | "template", 18 | "author", 19 | "meta", 20 | "description", 21 | "caption", 22 | "altText", 23 | "mediaType", 24 | "mimeType", 25 | "sourceUrl", 26 | "post", 27 | ] 28 | `; 29 | 30 | exports[`Test Media fields Test resolve post 1`] = `"UG9zdDoxMw=="`; 31 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/__tests__/fields.test.js: -------------------------------------------------------------------------------- 1 | import fields from 'type/Media/fields'; 2 | 3 | describe('Test Media fields', () => { 4 | test('Test fields', () => { 5 | expect(Object.keys(fields)).toMatchSnapshot(); 6 | }); 7 | 8 | test('Test resolve post', () => { 9 | const post = fields.post.resolve({ post: 13 }); 10 | expect(post).toMatchSnapshot(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Media/index.js: -------------------------------------------------------------------------------- 1 | import { GraphQLUnionType } from 'graphql'; 2 | 3 | import ImageType from 'type/Media/Image'; 4 | import AudioType from 'type/Media/Audio'; 5 | import VideoType from 'type/Media/Video'; 6 | 7 | const MediaType = new GraphQLUnionType({ 8 | name: 'Media', 9 | types: [ImageType, AudioType, VideoType], 10 | }); 11 | 12 | export default MediaType; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Meta.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString } from 'graphql'; 2 | 3 | const Meta = new GraphQLObjectType({ 4 | name: 'Meta', 5 | description: 'A metadata field for an object.', 6 | fields: { 7 | name: { 8 | type: GraphQLString, 9 | description: 'Name for the metadata field.', 10 | }, 11 | value: { 12 | type: GraphQLString, 13 | description: 'Value for the metadata field.', 14 | }, 15 | }, 16 | }); 17 | 18 | export default Meta; 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Mutation.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | import CommentMutations from 'mutation/Comment'; 3 | 4 | const Mutation = new GraphQLObjectType({ 5 | name: 'Mutation', 6 | description: 'WordPress API mutations', 7 | fields: () => ({ 8 | ...CommentMutations, 9 | }), 10 | }); 11 | 12 | export default Mutation; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/NavMenu.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLList } from 'graphql'; 2 | import NavMenuItemType from 'type/NavMenuItem'; 3 | import { globalIdField, name } from 'field/identifier'; 4 | import description from 'field/description'; 5 | import { registerNodeType, NodeInterface } from 'type/relayNode'; 6 | 7 | const NavMenuType = new GraphQLObjectType({ 8 | name: 'NavMenu', 9 | description: 'A nav menu.', 10 | interfaces: [NodeInterface], 11 | fields: { 12 | id: globalIdField(), 13 | ...name, 14 | ...description, 15 | items: { 16 | type: new GraphQLList(NavMenuItemType), 17 | description: 'Items associated with the menu.', 18 | }, 19 | }, 20 | }); 21 | 22 | registerNodeType(NavMenuType); 23 | 24 | export default NavMenuType; 25 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Query.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | import { nodeField } from 'type/relayNode'; 3 | import ViewerType from 'type/Viewer'; 4 | 5 | const VIEWER_ID = 'me'; 6 | 7 | const Query = new GraphQLObjectType({ 8 | name: 'Query', 9 | description: 'WordPress Relay App queries', 10 | fields: () => ({ 11 | node: nodeField, 12 | viewer: { 13 | type: ViewerType, 14 | resolve: () => ({ id: VIEWER_ID }), 15 | }, 16 | }), 17 | }); 18 | 19 | export default Query; 20 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Rewrite.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | 3 | import { slug } from 'field/identifier'; 4 | 5 | const RewriteType = new GraphQLObjectType({ 6 | name: 'Rewrite', 7 | description: 'Information that can be used to create pretty permalinks.', 8 | fields: { 9 | ...slug, 10 | }, 11 | }); 12 | 13 | export default RewriteType; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Settings.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString } from 'graphql'; 2 | 3 | const SettingsType = new GraphQLObjectType({ 4 | name: 'Settings', 5 | description: '.', 6 | fields: { 7 | title: { 8 | type: GraphQLString, 9 | description: 'Site title.', 10 | }, 11 | description: { 12 | type: GraphQLString, 13 | description: 'Site tagline.', 14 | }, 15 | timezone: { 16 | type: GraphQLString, 17 | description: 'A city in the same timezone as you.', 18 | }, 19 | language: { 20 | type: GraphQLString, 21 | description: 'Site locale code.', 22 | }, 23 | }, 24 | }); 25 | 26 | export default SettingsType; 27 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Tag.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType } from 'graphql'; 2 | import TermInterface from 'interface/Term'; 3 | import { globalIdField, slug, name, link } from 'field/identifier'; 4 | import taxonomy from 'field/taxonomy'; 5 | import description from 'field/description'; 6 | import metaField from 'field/meta'; 7 | import { registerNodeType, NodeInterface } from 'type/relayNode'; 8 | 9 | const TagType = new GraphQLObjectType({ 10 | name: 'Tag', 11 | description: 'A unique identifier for a post.', 12 | interfaces: [TermInterface, NodeInterface], 13 | isTypeOf(term) { 14 | return term.taxonomy === 'post_tag'; 15 | }, 16 | fields: { 17 | id: globalIdField(), 18 | ...description, 19 | ...link, 20 | ...name, 21 | ...slug, 22 | ...taxonomy, 23 | meta: metaField(), 24 | }, 25 | }); 26 | 27 | registerNodeType(TagType); 28 | 29 | export default TagType; 30 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Title.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLList } from 'graphql'; 2 | 3 | import raw from 'field/raw'; 4 | import rendered from 'field/rendered'; 5 | import ContentNode from 'type/ContentNode'; 6 | 7 | const Title = new GraphQLObjectType({ 8 | name: 'Title', 9 | description: 'The title for an object.', 10 | fields: { 11 | ...raw, 12 | ...rendered, 13 | data: { 14 | type: new GraphQLList(ContentNode), 15 | }, 16 | }, 17 | }); 18 | 19 | export default Title; 20 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/Widget.js: -------------------------------------------------------------------------------- 1 | import { GraphQLObjectType, GraphQLString } from 'graphql'; 2 | 3 | import { name } from 'field/identifier'; 4 | import description from 'field/description'; 5 | import { content } from 'field/content'; 6 | 7 | const WidgetType = new GraphQLObjectType({ 8 | name: 'Widget', 9 | description: 'A widget.', 10 | fields: { 11 | id: { 12 | type: GraphQLString, 13 | description: 'Identifier for widget.', 14 | }, 15 | ...name, 16 | ...description, 17 | classname: { 18 | type: GraphQLString, 19 | description: 'CSS class for the widget.', 20 | }, 21 | ...content, 22 | }, 23 | }); 24 | 25 | export default WidgetType; 26 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/NavMenu.test.js: -------------------------------------------------------------------------------- 1 | import NavMenuType from 'type/NavMenu'; 2 | 3 | describe('Test NavMenu type', () => { 4 | test('Test name', () => { 5 | expect(NavMenuType.name).toMatchSnapshot(); 6 | }); 7 | 8 | test('Test fields', () => { 9 | expect(Object.keys(NavMenuType.getFields())).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/Query.test.js: -------------------------------------------------------------------------------- 1 | import QueryType from 'type/Query'; 2 | 3 | // eslint-disable-next-line no-underscore-dangle 4 | const fields = QueryType._typeConfig.fields(); 5 | 6 | describe('Test Query type', () => { 7 | test('Test name', () => { 8 | expect(QueryType.name).toMatchSnapshot(); 9 | }); 10 | 11 | test('Test fields', () => { 12 | expect(Object.keys(QueryType.getFields())).toMatchSnapshot(); 13 | }); 14 | 15 | test('Test resolve viewer', () => { 16 | expect(fields.viewer.resolve()).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/Sidebar.test.js: -------------------------------------------------------------------------------- 1 | import SidebarType from 'type/Sidebar'; 2 | 3 | // eslint-disable-next-line no-underscore-dangle 4 | const fields = SidebarType._typeConfig.fields; 5 | 6 | describe('Test Sidebar type', () => { 7 | test('Test name', () => { 8 | expect(SidebarType.name).toMatchSnapshot(); 9 | }); 10 | 11 | test('Test fields', () => { 12 | expect(Object.keys(SidebarType.getFields())).toMatchSnapshot(); 13 | }); 14 | 15 | test('Test resolve name', () => { 16 | const classname = fields.classname.resolve({ class: 'cool-widget' }); 17 | expect(classname).toMatchSnapshot(); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/Tag.test.js: -------------------------------------------------------------------------------- 1 | import TagType from 'type/Tag'; 2 | 3 | describe('Test Tag type', () => { 4 | test('Test name', () => { 5 | expect(TagType.name).toMatchSnapshot(); 6 | }); 7 | 8 | test('Test type', () => { 9 | expect(TagType.isTypeOf({ taxonomy: 'post_tag' })).toBe(true); 10 | }); 11 | 12 | test('Test fields', () => { 13 | expect(Object.keys(TagType.getFields())).toMatchSnapshot(); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/Taxonomy.test.js: -------------------------------------------------------------------------------- 1 | import TaxonomyType from 'type/Taxonomy'; 2 | 3 | // eslint-disable-next-line no-underscore-dangle 4 | const fields = TaxonomyType._typeConfig.fields; 5 | 6 | describe('Test Taxonomy type', () => { 7 | test('Test name', () => { 8 | expect(TaxonomyType.name).toMatchSnapshot(); 9 | }); 10 | 11 | test('Test fields', () => { 12 | expect(Object.keys(TaxonomyType.getFields())).toMatchSnapshot(); 13 | }); 14 | 15 | test('Test resolve name', () => { 16 | const name = fields.name.resolve({ slug: 'category' }); 17 | expect(name).toMatchSnapshot(); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/User.test.js: -------------------------------------------------------------------------------- 1 | import UserType from 'type/User'; 2 | 3 | // eslint-disable-next-line no-underscore-dangle 4 | const fields = UserType._typeConfig.fields; 5 | 6 | describe('Test User type', () => { 7 | test('Test name', () => { 8 | expect(UserType.name).toMatchSnapshot(); 9 | }); 10 | 11 | test('Test fields', () => { 12 | expect(Object.keys(UserType.getFields())).toMatchSnapshot(); 13 | }); 14 | 15 | test('Test resolve avatars', () => { 16 | const avatars = fields.avatarUrls.resolve({ 17 | avatar_urls: { 18 | thumbnail: 'https://scott.com/avi.jpg', 19 | }, 20 | }); 21 | expect(avatars).toMatchSnapshot(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/Widget.test.js: -------------------------------------------------------------------------------- 1 | import WidgetType from 'type/Widget'; 2 | 3 | describe('Test Widget type', () => { 4 | test('Test name', () => { 5 | expect(WidgetType.name).toMatchSnapshot(); 6 | }); 7 | 8 | test('Test fields', () => { 9 | expect(Object.keys(WidgetType.getFields())).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Category.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Category type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "description", 7 | "link", 8 | "name", 9 | "slug", 10 | "taxonomy", 11 | "count", 12 | "meta", 13 | "parent", 14 | ] 15 | `; 16 | 17 | exports[`Test Category type Test name 1`] = `"Category"`; 18 | 19 | exports[`Test Category type Test resolve parent 1`] = ` 20 | Category { 21 | "id": 69, 22 | } 23 | `; 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Comment.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Comment type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "author", 7 | "date", 8 | "dateGMT", 9 | "content", 10 | "link", 11 | "post", 12 | "parent", 13 | "authorName", 14 | "authorUrl", 15 | "authorHash", 16 | "status", 17 | "type", 18 | "authorAvatarUrls", 19 | "meta", 20 | ] 21 | `; 22 | 23 | exports[`Test Comment type Test name 1`] = `"Comment"`; 24 | 25 | exports[`Test Comment type Test resolve avatars 1`] = ` 26 | Array [ 27 | Object { 28 | "size": "thumbnail", 29 | "url": "https://scott.com/avi.jpg", 30 | }, 31 | ] 32 | `; 33 | 34 | exports[`Test Comment type Test resolve parent 1`] = `"Q29tbWVudDo2OQ=="`; 35 | 36 | exports[`Test Comment type Test resolve post 1`] = `"UG9zdDoxMw=="`; 37 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/NavMenu.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test NavMenu type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "name", 7 | "description", 8 | "items", 9 | ] 10 | `; 11 | 12 | exports[`Test NavMenu type Test name 1`] = `"NavMenu"`; 13 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Page.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Page type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "date", 7 | "dateGMT", 8 | "guid", 9 | "modified", 10 | "modifiedGMT", 11 | "slug", 12 | "type", 13 | "link", 14 | "title", 15 | "content", 16 | "excerpt", 17 | "commentStatus", 18 | "pingStatus", 19 | "template", 20 | "author", 21 | "featuredMedia", 22 | "meta", 23 | "parent", 24 | "menuOrder", 25 | ] 26 | `; 27 | 28 | exports[`Test Page type Test name 1`] = `"Page"`; 29 | 30 | exports[`Test Page type Test resolve parent 1`] = ` 31 | Page { 32 | "id": 69, 33 | } 34 | `; 35 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Post.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Post type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "date", 7 | "dateGMT", 8 | "guid", 9 | "modified", 10 | "modifiedGMT", 11 | "slug", 12 | "type", 13 | "link", 14 | "title", 15 | "content", 16 | "excerpt", 17 | "commentStatus", 18 | "pingStatus", 19 | "template", 20 | "format", 21 | "author", 22 | "featuredMedia", 23 | "meta", 24 | "sticky", 25 | "categories", 26 | "tags", 27 | "comments", 28 | ] 29 | `; 30 | 31 | exports[`Test Post type Test name 1`] = `"Post"`; 32 | 33 | exports[`Test Post type Test resolve categories 1`] = ` 34 | Array [ 35 | Category { 36 | "id": 69, 37 | }, 38 | ] 39 | `; 40 | 41 | exports[`Test Post type Test resolve tags 1`] = ` 42 | Array [ 43 | Tag { 44 | "id": 69, 45 | }, 46 | ] 47 | `; 48 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Query.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Query type Test fields 1`] = ` 4 | Array [ 5 | "node", 6 | "viewer", 7 | ] 8 | `; 9 | 10 | exports[`Test Query type Test name 1`] = `"Query"`; 11 | 12 | exports[`Test Query type Test resolve viewer 1`] = ` 13 | Object { 14 | "id": "me", 15 | } 16 | `; 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Sidebar.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Sidebar type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "name", 7 | "description", 8 | "classname", 9 | "beforeWidget", 10 | "afterWidget", 11 | "beforeTitle", 12 | "afterTitle", 13 | "widgets", 14 | ] 15 | `; 16 | 17 | exports[`Test Sidebar type Test name 1`] = `"Sidebar"`; 18 | 19 | exports[`Test Sidebar type Test resolve name 1`] = `"cool-widget"`; 20 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Tag.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Tag type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "description", 7 | "link", 8 | "name", 9 | "slug", 10 | "taxonomy", 11 | "count", 12 | "meta", 13 | ] 14 | `; 15 | 16 | exports[`Test Tag type Test name 1`] = `"Tag"`; 17 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Taxonomy.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Taxonomy type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "name", 7 | "description", 8 | "types", 9 | "hierarchical", 10 | "rewrite", 11 | "labels", 12 | ] 13 | `; 14 | 15 | exports[`Test Taxonomy type Test name 1`] = `"Taxonomy"`; 16 | 17 | exports[`Test Taxonomy type Test resolve name 1`] = `"category"`; 18 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/User.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test User type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "name", 7 | "description", 8 | "link", 9 | "slug", 10 | "avatarUrls", 11 | ] 12 | `; 13 | 14 | exports[`Test User type Test name 1`] = `"User"`; 15 | 16 | exports[`Test User type Test resolve avatars 1`] = ` 17 | Array [ 18 | Object { 19 | "size": "thumbnail", 20 | "url": "https://scott.com/avi.jpg", 21 | }, 22 | ] 23 | `; 24 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/__tests__/__snapshots__/Widget.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Test Widget type Test fields 1`] = ` 4 | Array [ 5 | "id", 6 | "name", 7 | "description", 8 | "classname", 9 | "content", 10 | ] 11 | `; 12 | 13 | exports[`Test Widget type Test name 1`] = `"Widget"`; 14 | -------------------------------------------------------------------------------- /packages/graphql-wordpress/src/schema/type/relayNode.js: -------------------------------------------------------------------------------- 1 | import { nodeDefinitions, fromGlobalId } from 'graphql-relay'; 2 | 3 | const registeredTypes = {}; 4 | 5 | export function registerNodeType(type) { 6 | registeredTypes[type.name] = type; 7 | return type; 8 | } 9 | 10 | export const { 11 | nodeInterface: NodeInterface, 12 | nodeField, 13 | } = nodeDefinitions((globalId, context, { rootValue: { loaders } }) => { 14 | const { id, type } = fromGlobalId(globalId); 15 | return loaders[type] ? loaders[type].load(id) : null; 16 | }, obj => registeredTypes[obj.constructor.name] || null); 17 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["expo"], 3 | "plugins": [ 4 | "transform-class-properties", 5 | "transform-object-rest-spread", 6 | "inline-import-graphql-ast", 7 | ["module-resolver", { 8 | "root": ["./src", "./types"] 9 | }] 10 | ], 11 | "env": { 12 | "development": { 13 | "plugins": ["transform-react-jsx-source"] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | trim_trailing_whitespace = true 7 | end_of_line = lf 8 | insert_final_newline = true 9 | 10 | [docs/rules/linebreak-style.md] 11 | end_of_line = disabled 12 | 13 | [{docs/rules/{indent.md,no-mixed-spaces-and-tabs.md}] 14 | indent_style = disabled 15 | indent_size = disabled 16 | 17 | [docs/rules/no-trailing-spaces.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint-config-kyt" 4 | ], 5 | "rules": { 6 | "jsx-a11y/href-no-hash": "off", 7 | "jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["invalidHref"] }], 8 | "no-underscore-dangle": ["error", { "allow": ["__typename"] }] 9 | }, 10 | 11 | "settings": { 12 | "import/resolver": { 13 | "babel-module": {} 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .expo/ 3 | npm-debug.* 4 | yarn-error.log 5 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NativeRouter } from 'react-router-native'; 3 | import { 4 | ApolloClient, 5 | ApolloProvider, 6 | createNetworkInterface, 7 | IntrospectionFragmentMatcher, 8 | } from 'react-apollo'; 9 | import Wrapper from 'components/Wrapper'; 10 | import __schema from './tools/fragmentMatcher.json'; 11 | 12 | const client = new ApolloClient({ 13 | networkInterface: createNetworkInterface({ 14 | uri: 'http://graphql.highforthis.com/graphql', 15 | }), 16 | fragmentMatcher: new IntrospectionFragmentMatcher({ 17 | introspectionQueryResultData: __schema, 18 | }), 19 | }); 20 | 21 | export default function App() { 22 | return ( 23 | 24 | 25 | 26 | 27 | 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import App from './App'; 3 | 4 | import renderer from 'react-test-renderer'; 5 | 6 | it('renders without crashing', () => { 7 | const rendered = renderer.create().toJSON(); 8 | expect(rendered).toBeTruthy(); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "Apollo WordPress", 4 | "slug": "apollo-wordpress", 5 | "sdkVersion": "21.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/components/Embed.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Image, Dimensions } from 'react-native'; 3 | 4 | /* eslint-disable react/prop-types */ 5 | 6 | export default ({ node }) => { 7 | const responsiveWidth = Dimensions.get('window').width; 8 | const responsiveHeight = responsiveWidth * node.height / node.width; 9 | 10 | return ( 11 | 20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/components/Error.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet, Text, View } from 'react-native'; 3 | 4 | /* eslint-disable react/prop-types */ 5 | 6 | const styles = StyleSheet.create({ 7 | container: { 8 | flex: 1, 9 | padding: 20, 10 | backgroundColor: '#fff', 11 | }, 12 | }); 13 | 14 | export default function Error({ error, children = null }) { 15 | return ( 16 | 17 | {error.message} 18 | {children} 19 | 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/components/Header.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet, Text, View } from 'react-native'; 3 | import { Link } from 'react-router-native'; 4 | import NavMenu from './NavMenu'; 5 | 6 | /* eslint-disable react/prop-types */ 7 | 8 | const styles = StyleSheet.create({ 9 | header: { 10 | padding: 10, 11 | }, 12 | title: { 13 | fontSize: 48, 14 | fontWeight: 'bold', 15 | }, 16 | description: { 17 | fontSize: 18, 18 | }, 19 | }); 20 | 21 | export default ({ navMenu, settings: { title, description } }) => ( 22 | 23 | 24 | {title} 25 | 26 | {description} 27 | 28 | 29 | ); 30 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/components/Loading.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet, View, ActivityIndicator } from 'react-native'; 3 | 4 | const styles = StyleSheet.create({ 5 | appLoading: { 6 | flex: 2, 7 | justifyContent: 'center', 8 | alignItems: 'center', 9 | backgroundColor: '#fff', 10 | }, 11 | }); 12 | 13 | export default function Loading() { 14 | return ( 15 | 16 | 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/components/PostLink.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { View, Text } from 'react-native'; 3 | import { Link } from 'react-router-native'; 4 | import { dateRegex } from 'utils/regex'; 5 | 6 | /* eslint-disable react/prop-types */ 7 | 8 | export default ({ post, children, style = null }) => { 9 | const [, year, month, day] = dateRegex.exec(post.date); 10 | const url = `/${year}/${month}/${day}/${post.id}`; 11 | return ( 12 | 13 | 14 | {post.title.raw} 15 | {children} 16 | 17 | 18 | ); 19 | }; 20 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/components/ResponsiveImage.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Image, Dimensions } from 'react-native'; 3 | 4 | /* eslint-disable react/prop-types */ 5 | 6 | export default ({ featuredMedia, style = null }) => { 7 | if (!featuredMedia || !featuredMedia.sourceUrl) { 8 | return null; 9 | } 10 | 11 | const { width: imageWidth, height: imageHeight } = featuredMedia.mediaDetails; 12 | const responsiveWidth = Dimensions.get('window').width; 13 | const responsiveHeight = responsiveWidth * imageHeight / imageWidth; 14 | 15 | return ( 16 | 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Author_Query.graphql: -------------------------------------------------------------------------------- 1 | #import "./Post_post.graphql" 2 | 3 | query Author_Query($id: ID!) { 4 | viewer { 5 | author(id: $id) { 6 | id 7 | name 8 | } 9 | posts(author: $id, after: $cursor, first: $count) { 10 | edges { 11 | node { 12 | id 13 | ...Post_post 14 | } 15 | cursor 16 | } 17 | pageInfo { 18 | startCursor 19 | endCursor 20 | hasNextPage 21 | hasPreviousPage 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Content_content_data.graphql: -------------------------------------------------------------------------------- 1 | #import "./Embed_node.graphql" 2 | #import "./Element_node.graphql" 3 | 4 | fragment Content_content_data on ContentNode { 5 | __typename 6 | ... on Embed { 7 | ...Embed_node 8 | } 9 | ... on Text { 10 | text 11 | } 12 | ... on Element { 13 | ...Element_node 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Date_Query.graphql: -------------------------------------------------------------------------------- 1 | #import "./Post_post.graphql" 2 | 3 | query Date_Query( 4 | $year: Int! 5 | $month: Int 6 | $day: Int 7 | $cursor: String 8 | $count: Int = 10 9 | ) { 10 | viewer { 11 | posts( 12 | year: $year 13 | month: $month 14 | day: $day 15 | after: $cursor 16 | first: $count 17 | ) { 18 | edges { 19 | node { 20 | id 21 | ...Post_post 22 | } 23 | cursor 24 | } 25 | pageInfo { 26 | startCursor 27 | endCursor 28 | hasNextPage 29 | hasPreviousPage 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Element_node.graphql: -------------------------------------------------------------------------------- 1 | fragment Element_node on Element { 2 | tagName 3 | attributes { 4 | name 5 | value 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Embed_node.graphql: -------------------------------------------------------------------------------- 1 | fragment Embed_node on Embed { 2 | title 3 | thumbnailUrl 4 | html 5 | width 6 | height 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/NavMenu_navMenu.graphql: -------------------------------------------------------------------------------- 1 | fragment NavMenu_navMenu on NavMenu { 2 | id 3 | name 4 | items { 5 | id 6 | title 7 | url 8 | parent 9 | order 10 | type 11 | typeName 12 | typeSlug 13 | dataSlug 14 | dataID 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Page_Query.graphql: -------------------------------------------------------------------------------- 1 | query Page_Query($slug: String!) { 2 | viewer { 3 | page(slug: $slug) { 4 | date 5 | title { 6 | raw 7 | } 8 | featuredMedia { 9 | ... on Image { 10 | sourceUrl 11 | } 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/PostLink_post.graphql: -------------------------------------------------------------------------------- 1 | fragment PostLink_post on Post { 2 | id 3 | date 4 | title { 5 | raw 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Post_post.graphql: -------------------------------------------------------------------------------- 1 | #import "./Content_content.graphql" 2 | #import "./ResponsiveImage_featuredMedia.graphql" 3 | #import "./PostLink_post.graphql" 4 | 5 | fragment Post_post on Post { 6 | id 7 | title { 8 | raw 9 | } 10 | content { 11 | data { 12 | ...Content_content 13 | } 14 | } 15 | excerpt { 16 | raw 17 | } 18 | featuredMedia { 19 | ... on Image { 20 | imageUrl: sourceUrl 21 | ...ResponsiveImage_featuredMedia 22 | } 23 | } 24 | ...PostLink_post 25 | } 26 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/ResponsiveImage_featuredMedia.graphql: -------------------------------------------------------------------------------- 1 | fragment ResponsiveImage_featuredMedia on Image { 2 | sourceUrl 3 | mediaDetails { 4 | width 5 | height 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Single_Query.graphql: -------------------------------------------------------------------------------- 1 | #import "./ResponsiveImage_featuredMedia.graphql" 2 | #import "./Content_content.graphql" 3 | 4 | query Single_Query($id: ID!) { 5 | viewer { 6 | post(id: $id) { 7 | id 8 | date 9 | title { 10 | raw 11 | } 12 | featuredMedia { 13 | ... on Image { 14 | imageUrl: sourceUrl 15 | ...ResponsiveImage_featuredMedia 16 | } 17 | } 18 | content { 19 | data { 20 | ...Content_content 21 | } 22 | } 23 | tags { 24 | id 25 | name 26 | slug 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Term_Query.graphql: -------------------------------------------------------------------------------- 1 | #import "./Post_post.graphql" 2 | 3 | query Term_Query( 4 | $slug: String! 5 | $taxonomy: String! 6 | $cursor: String 7 | $count: Int = 10 8 | ) { 9 | viewer { 10 | term(slug: $slug, taxonomy: $taxonomy) { 11 | id 12 | name 13 | slug 14 | taxonomy { 15 | rewrite { 16 | slug 17 | } 18 | labels { 19 | singular 20 | plural 21 | } 22 | } 23 | } 24 | posts(term: $slug, taxonomy: $taxonomy, after: $cursor, first: $count) { 25 | edges { 26 | node { 27 | id 28 | ...Post_post 29 | } 30 | cursor 31 | } 32 | pageInfo { 33 | startCursor 34 | endCursor 35 | hasNextPage 36 | hasPreviousPage 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/graphql/Wrapper_Query.graphql: -------------------------------------------------------------------------------- 1 | #import "./NavMenu_navMenu.graphql" 2 | 3 | query Wrapper_Query($menuID: ID!) { 4 | viewer { 5 | settings { 6 | title 7 | description 8 | language 9 | } 10 | navMenu(id: $menuID) { 11 | ...NavMenu_navMenu 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/styles/archive.js: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | export default StyleSheet.create({ 4 | container: { 5 | flex: 2, 6 | backgroundColor: '#fff', 7 | }, 8 | 9 | title: { 10 | fontSize: 24, 11 | fontWeight: 'bold', 12 | padding: 10, 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /packages/react-native-apollo-wordpress/src/utils/regex.js: -------------------------------------------------------------------------------- 1 | export const newlineRegex = /(?:\r\n|\r|\n)/g; 2 | 3 | export const dateRegex = /^([0-9]{4})-([0-1][0-9])-([0-3][0-9])T([0-2][0-9]):([0-5][0-9]):([0-5][0-9])/; 4 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "expo", 4 | "flow" 5 | ], 6 | "plugins": [ 7 | "relay", 8 | "transform-flow-strip-types", 9 | "transform-class-properties", 10 | "transform-object-rest-spread", 11 | ["module-resolver", { 12 | "root": ["./src", "./types"] 13 | }] 14 | ], 15 | "env": { 16 | "development": { 17 | "plugins": ["transform-react-jsx-source"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | trim_trailing_whitespace = true 7 | end_of_line = lf 8 | insert_final_newline = true 9 | 10 | [docs/rules/linebreak-style.md] 11 | end_of_line = disabled 12 | 13 | [{docs/rules/{indent.md,no-mixed-spaces-and-tabs.md}] 14 | indent_style = disabled 15 | indent_size = disabled 16 | 17 | [docs/rules/no-trailing-spaces.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint-config-kyt" 4 | ], 5 | 6 | "rules": { 7 | "jsx-a11y/href-no-hash": "off", 8 | "jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["invalidHref"] }], 9 | "no-underscore-dangle": ["error", { "allow": ["__typename"] }] 10 | }, 11 | 12 | "settings": { 13 | "import/resolver": { 14 | "babel-module": {} 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .expo/ 3 | npm-debug.* 4 | yarn-error.log 5 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NativeRouter } from 'react-router-native'; 3 | import Wrapper from 'components/Wrapper'; 4 | 5 | export default function App() { 6 | return ( 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import App from './App'; 3 | 4 | import renderer from 'react-test-renderer'; 5 | 6 | it('renders without crashing', () => { 7 | const rendered = renderer.create().toJSON(); 8 | expect(rendered).toBeTruthy(); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "Relay WordPress", 4 | "slug": "relay-wordpress", 5 | "sdkVersion": "21.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/components/Embed.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { graphql, createFragmentContainer } from 'react-relay'; 3 | import { Image, Dimensions } from 'react-native'; 4 | 5 | export default createFragmentContainer( 6 | ({ node }) => { 7 | const responsiveWidth = Dimensions.get('window').width; 8 | const responsiveHeight = responsiveWidth * node.height / node.width; 9 | 10 | return ( 11 | 20 | ); 21 | }, 22 | graphql` 23 | fragment Embed_node on Embed { 24 | title 25 | thumbnailUrl 26 | html 27 | width 28 | height 29 | } 30 | ` 31 | ); 32 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/components/Error.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { StyleSheet, Text, View } from 'react-native'; 4 | 5 | const styles = StyleSheet.create({ 6 | container: { 7 | flex: 1, 8 | padding: 20, 9 | backgroundColor: '#fff', 10 | }, 11 | }); 12 | 13 | export default class Error extends Component { 14 | static propTypes = { 15 | error: PropTypes.shape({ 16 | message: PropTypes.string, 17 | }).isRequired, 18 | children: PropTypes.node, 19 | }; 20 | 21 | static defaultProps = { 22 | children: null, 23 | }; 24 | 25 | render() { 26 | const { error } = this.props; 27 | return ( 28 | 29 | {error.message} 30 | {this.props.children} 31 | 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/components/Header.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet, Text, View } from 'react-native'; 3 | import { Link } from 'react-router-native'; 4 | import NavMenu from './NavMenu'; 5 | 6 | /* eslint-disable react/prop-types */ 7 | 8 | const styles = StyleSheet.create({ 9 | header: { 10 | padding: 10, 11 | }, 12 | title: { 13 | fontSize: 48, 14 | fontWeight: 'bold', 15 | }, 16 | description: { 17 | fontSize: 18, 18 | }, 19 | }); 20 | 21 | export default ({ navMenu, settings: { title, description } }) => ( 22 | 23 | 24 | {title} 25 | 26 | {description} 27 | 28 | 29 | ); 30 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/components/PostLink.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { graphql, createFragmentContainer } from 'react-relay'; 3 | import { View, Text } from 'react-native'; 4 | import { Link } from 'react-router-native'; 5 | import { dateRegex } from 'utils/regex'; 6 | 7 | export default createFragmentContainer( 8 | ({ post, children, style = null }) => { 9 | const [, year, month, day] = dateRegex.exec(post.date); 10 | const url = `/${year}/${month}/${day}/${post.id}`; 11 | return ( 12 | 13 | 14 | {post.title.raw} 15 | {children} 16 | 17 | 18 | ); 19 | }, 20 | graphql` 21 | fragment PostLink_post on Post { 22 | id 23 | date 24 | title { 25 | raw 26 | } 27 | } 28 | ` 29 | ); 30 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/queries/Author.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Author_Query($id: ID!) { 5 | viewer { 6 | ...Author_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/queries/Date.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Date_Query($year: Int!, $month: Int, $day: Int, $cursor: String, $count: Int = 10) { 5 | viewer { 6 | ...Date_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/queries/Home.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Home_Query( 5 | $stickiesTotal: Int = 2 6 | $watchThisTotal: Int = 5 7 | $readThisTotal: Int = 5 8 | $listenToThisTotal: Int = 5 9 | ) { 10 | viewer { 11 | ...Home_viewer 12 | } 13 | } 14 | `; 15 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/queries/Page.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Page_Query($slug: String!) { 5 | viewer { 6 | ...Page_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/queries/Single.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Single_Query($id: ID!) { 5 | viewer { 6 | ...Single_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/queries/Term.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Term_Query($slug: String!, $taxonomy: String!, $cursor: String, $count: Int = 10) { 5 | viewer { 6 | ...Term_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/queries/Wrapper.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Wrapper_Query($menuID: ID!) { 5 | viewer { 6 | settings { 7 | title 8 | description 9 | language 10 | } 11 | navMenu(id: $menuID) { 12 | ...NavMenu_navMenu 13 | } 14 | } 15 | } 16 | `; 17 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/styles/archive.js: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | export default StyleSheet.create({ 4 | container: { 5 | flex: 2, 6 | backgroundColor: '#fff', 7 | }, 8 | 9 | title: { 10 | fontSize: 24, 11 | fontWeight: 'bold', 12 | padding: 10, 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /packages/react-native-relay-wordpress/src/utils/regex.js: -------------------------------------------------------------------------------- 1 | export const newlineRegex = /(?:\r\n|\r|\n)/g; 2 | 3 | export const dateRegex = /^([0-9]{4})-([0-1][0-9])-([0-3][0-9])T([0-2][0-9]):([0-5][0-9]):([0-5][0-9])/; 4 | -------------------------------------------------------------------------------- /packages/react-router-relay-modern/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["kyt-react", {"modules": true}], 4 | "flow" 5 | ], 6 | "plugins": [ 7 | "transform-class-properties", 8 | "transform-object-rest-spread", 9 | "transform-flow-strip-types" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /packages/react-router-relay-modern/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint-config-kyt" 4 | ], 5 | 6 | "rules": { 7 | "jsx-a11y/href-no-hash": "off", 8 | "jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["invalidHref"] }], 9 | "no-underscore-dangle": ["error", { "allow": ["__typename"] }] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/react-router-relay-modern/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | ./types/ 3 | 4 | [options] 5 | esproposal.decorators=ignore 6 | module.system.node.resolve_dirname=node_modules 7 | module.system.node.resolve_dirname=src 8 | -------------------------------------------------------------------------------- /packages/react-router-relay-modern/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | yarn-error.log 4 | -------------------------------------------------------------------------------- /packages/react-router-relay-modern/src/environment.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { Environment, Network, RecordSource, Store } from 'relay-runtime'; 3 | import createFetch from './fetcher'; 4 | 5 | function createEnviroment(url: string, requestCache: Object = {}) { 6 | const recordSource = new RecordSource(); 7 | const store = new Store(recordSource); 8 | 9 | const environment = new Environment({ 10 | network: Network.create(createFetch(url, requestCache)), 11 | store, 12 | }); 13 | 14 | return environment; 15 | } 16 | 17 | export default createEnviroment; 18 | -------------------------------------------------------------------------------- /packages/react-router-relay-modern/src/handlerProvider.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { ConnectionHandler, ViewerHandler } from 'relay-runtime'; 3 | 4 | export default function handlerProvider(handle: string) { 5 | switch (handle) { 6 | // Augment (or remove from) this list: 7 | case 'connection': 8 | return ConnectionHandler; 9 | case 'viewer': 10 | return ViewerHandler; 11 | default: 12 | break; 13 | } 14 | throw new Error(`handlerProvider: No handler provided for ${handle}`); 15 | } 16 | -------------------------------------------------------------------------------- /packages/react-router-relay-modern/src/utils/index.js: -------------------------------------------------------------------------------- 1 | import isPromise from 'is-promise'; 2 | 3 | const UNRESOLVED = {}; 4 | 5 | export function isResolved(value) { 6 | return value !== UNRESOLVED; 7 | } 8 | 9 | export function checkResolved(value) { 10 | if (!isPromise(value)) { 11 | return value; 12 | } 13 | 14 | return Promise.race([ 15 | value, 16 | new Promise(resolve => { 17 | setImmediate(resolve, UNRESOLVED); 18 | }), 19 | ]); 20 | } 21 | -------------------------------------------------------------------------------- /packages/relay-wordpress/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["kyt-react", {"modules": true}], 4 | "flow" 5 | ], 6 | "plugins": [ 7 | "relay", 8 | "transform-decorators-legacy", 9 | "transform-class-properties", 10 | "transform-object-rest-spread", 11 | "transform-flow-strip-types", 12 | ["module-resolver", { 13 | "root": ["./src", "./types"] 14 | }] 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/relay-wordpress/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | trim_trailing_whitespace = true 7 | end_of_line = lf 8 | insert_final_newline = true 9 | 10 | [docs/rules/linebreak-style.md] 11 | end_of_line = disabled 12 | 13 | [{docs/rules/{indent.md,no-mixed-spaces-and-tabs.md}] 14 | indent_style = disabled 15 | indent_size = disabled 16 | 17 | [docs/rules/no-trailing-spaces.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /packages/relay-wordpress/.env: -------------------------------------------------------------------------------- 1 | GQL_HOST=http://localhost:8080 2 | GQL_PATH=/graphql 3 | -------------------------------------------------------------------------------- /packages/relay-wordpress/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint-config-kyt" 4 | ], 5 | 6 | "rules": { 7 | "jsx-a11y/href-no-hash": "off", 8 | "jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["invalidHref"] }], 9 | "no-underscore-dangle": ["error", { "allow": ["__typename"] }] 10 | }, 11 | 12 | "settings": { 13 | "import/resolver": { 14 | "babel-module": {} 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/relay-wordpress/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | ./types/ 3 | 4 | [options] 5 | esproposal.decorators=ignore 6 | module.system.node.resolve_dirname=node_modules 7 | module.system.node.resolve_dirname=src 8 | -------------------------------------------------------------------------------- /packages/relay-wordpress/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | yarn-error.log 4 | -------------------------------------------------------------------------------- /packages/relay-wordpress/.prettierignore: -------------------------------------------------------------------------------- 1 | **/__generated__/** 2 | -------------------------------------------------------------------------------- /packages/relay-wordpress/.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/kyt/config/.stylelintrc.base.json", 3 | "rules": { 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/relay-wordpress/README.md: -------------------------------------------------------------------------------- 1 | [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) 2 | 3 | # relay-wordpress 4 | Universal WordPress Theme powered by Relay/GraphQL 5 | -------------------------------------------------------------------------------- /packages/relay-wordpress/kyt.dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | reactHotLoader: true, 3 | debug: false, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/relay-wordpress/kyt.prod.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | serverURL: 'http://localhost:3003', 3 | }; 4 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/components/Comments/constants.js: -------------------------------------------------------------------------------- 1 | export const AUTHOR_NAME_COOKIE = 'comment_author'; 2 | export const AUTHOR_EMAIL_COOKIE = 'comment_author_email'; 3 | export const AUTHOR_URL_COOKIE = 'comment_author_url'; 4 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/components/Comments/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React from 'react'; 3 | import { Heading } from '@wonderboymusic/graphql-wordpress-components'; 4 | import { CommentsWrapper } from '@wonderboymusic/graphql-wordpress-components/lib/Comments'; 5 | import Walker from 'components/Comments/Walker'; 6 | import type { Connection, Comment } from 'relay-wordpress'; 7 | 8 | type CommentsProps = { 9 | post: string, 10 | comments?: Connection, 11 | }; 12 | 13 | export default function Comments({ post, comments }: CommentsProps) { 14 | return ( 15 | 16 | Comments 17 | 18 | 19 | ); 20 | } 21 | 22 | Comments.defaultProps = { 23 | comments: null, 24 | }; 25 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/components/ErrorBoundary.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as React from 'react'; 3 | 4 | export default class ErrorBoundary extends React.Component<*, *> { 5 | constructor(props: any) { 6 | super(props); 7 | this.state = { hasError: false }; 8 | } 9 | 10 | componentDidCatch(error: any, info: any) { 11 | this.setState({ hasError: true }); 12 | // eslint-disable-next-line no-console 13 | console.log(error, info); 14 | } 15 | 16 | render() { 17 | if (this.state.hasError) { 18 | return

Something went wrong.

; 19 | } 20 | return this.props.children; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/containers/Media.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { graphql, createFragmentContainer } from 'react-relay'; 3 | import Image from 'containers/Image'; 4 | 5 | type MediaProps = { 6 | crop: string, 7 | media: Object, 8 | }; 9 | 10 | const Media = ({ media, crop = 'large' }: MediaProps) => { 11 | switch (media.__typename) { 12 | case 'Image': 13 | return ; 14 | default: 15 | return null; 16 | } 17 | }; 18 | 19 | export default createFragmentContainer( 20 | Media, 21 | graphql` 22 | fragment Media_media on Media { 23 | __typename 24 | ...Image_image 25 | } 26 | ` 27 | ); 28 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/containers/__generated__/Media_media.graphql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | /* eslint-disable */ 6 | 7 | 'use strict'; 8 | 9 | /*:: 10 | import type {ConcreteFragment} from 'relay-runtime'; 11 | export type Media_media = {| 12 | +__typename: string; 13 | |}; 14 | */ 15 | 16 | 17 | const fragment /*: ConcreteFragment*/ = { 18 | "argumentDefinitions": [], 19 | "kind": "Fragment", 20 | "metadata": null, 21 | "name": "Media_media", 22 | "selections": [ 23 | { 24 | "kind": "ScalarField", 25 | "alias": null, 26 | "args": null, 27 | "name": "__typename", 28 | "storageKey": null 29 | }, 30 | { 31 | "kind": "FragmentSpread", 32 | "name": "Image_image", 33 | "args": null 34 | } 35 | ], 36 | "type": "Media" 37 | }; 38 | 39 | module.exports = fragment; 40 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/langs/en.js: -------------------------------------------------------------------------------- 1 | export default {}; 2 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/favicon.ico -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/icons/120x120.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/icons/120x120.jpg -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/icons/152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/icons/152x152.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/icons/60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/icons/60x60.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/icons/76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/icons/76x76.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/icons/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/icons/favicon.ico -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/icons/icon-activity-indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/icons/icon-activity-indicator.gif -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/images/calendar-links-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/images/calendar-links-bg.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/images/calendar-toggle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/images/calendar-toggle.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/images/feed-icon-10x10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/images/feed-icon-10x10.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/images/feed-icon-12x12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/images/feed-icon-12x12.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/images/gigpress-icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/images/gigpress-icon-16.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/images/gigpress-icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/images/gigpress-icon-32.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/images/icalendar-icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/images/icalendar-icon.gif -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/images/sort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/images/sort.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/public/kyt-favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staylor/graphql-wordpress/956b9a83b3da26464f6e8bbe902255820a577646/packages/relay-wordpress/src/public/kyt-favicon.png -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/App.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query App_Query($menuID: ID!, $sidebarID: ID!) { 5 | viewer { 6 | ...App_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/Author.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Author_Query($id: ID!) { 5 | viewer { 6 | ...Author_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/Chart.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Chart_Query { 5 | viewer { 6 | ...Chart_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/Date.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Date_Query($year: Int!, $month: Int, $day: Int, $cursor: String, $count: Int = 10) { 5 | viewer { 6 | ...Date_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/Home.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Home_Query( 5 | $stickiesTotal: Int = 2 6 | $watchThisTotal: Int = 5 7 | $readThisTotal: Int = 5 8 | $listenToThisTotal: Int = 5 9 | ) { 10 | viewer { 11 | ...Home_viewer 12 | } 13 | } 14 | `; 15 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/Page.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Page_Query($slug: String!) { 5 | viewer { 6 | ...Page_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/Search.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Search_Query($search: String, $count: Int = 10) { 5 | viewer { 6 | ...Search_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/Single.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Single_Query($id: ID!) { 5 | viewer { 6 | ...Single_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/queries/Term.js: -------------------------------------------------------------------------------- 1 | import { graphql } from 'react-relay'; 2 | 3 | export default graphql` 4 | query Term_Query($slug: String!, $taxonomy: String!, $cursor: String, $count: Int = 10) { 5 | viewer { 6 | ...Term_viewer 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/relay/environment.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { Environment, Network, RecordSource, Store } from 'relay-runtime'; 3 | import createFetch from 'relay/fetcher'; 4 | 5 | function createEnviroment(url: string, requestCache: Object = {}) { 6 | const recordSource = new RecordSource(); 7 | const store = new Store(recordSource); 8 | 9 | const environment = new Environment({ 10 | network: Network.create(createFetch(url, requestCache)), 11 | store, 12 | }); 13 | 14 | return environment; 15 | } 16 | 17 | export default createEnviroment; 18 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/relay/handlerProvider.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { ConnectionHandler, ViewerHandler } from 'relay-runtime'; 3 | 4 | export default function handlerProvider(handle: string) { 5 | switch (handle) { 6 | // Augment (or remove from) this list: 7 | case 'connection': 8 | return ConnectionHandler; 9 | case 'viewer': 10 | return ViewerHandler; 11 | default: 12 | break; 13 | } 14 | throw new Error(`handlerProvider: No handler provided for ${handle}`); 15 | } 16 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/routes/__tests__/Home.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { shallow } from 'enzyme'; 3 | import Home from '../'; 4 | 5 | it('Test example', () => { 6 | const wrapper = shallow(); 7 | expect(wrapper.is('section')).toBeTruthy(); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/utils/constants.js: -------------------------------------------------------------------------------- 1 | export const SITE_URL = 'https://highforthis.com'; 2 | 3 | export const SITE_DESCRIPTION = 'High for This aggregates the best music content on the web.'; 4 | 5 | export const TWITTER_USERNAME = '@highforthisss'; 6 | 7 | export const TWITTER_CREATOR = '@wonderboymusic'; 8 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/utils/regex.js: -------------------------------------------------------------------------------- 1 | export const newlineRegex = /(?:\r\n|\r|\n)/g; 2 | 3 | export const dateRegex = /^([0-9]{4})-([0-1][0-9])-([0-3][0-9])T([0-2][0-9]):([0-5][0-9]):([0-5][0-9])/; 4 | -------------------------------------------------------------------------------- /packages/relay-wordpress/src/utils/walker.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | type HierarchyItem = { 3 | parent: String, 4 | }; 5 | 6 | // eslint-disable-next-line import/prefer-default-export 7 | export function sortHierarchy(list: Array) { 8 | const nested = { 9 | top: [], 10 | }; 11 | list.forEach(node => { 12 | if (!node.parent) { 13 | nested.top.push(node); 14 | return; 15 | } 16 | 17 | if (!nested[node.parent]) { 18 | nested[node.parent] = []; 19 | } 20 | nested[node.parent].push(node); 21 | }); 22 | 23 | return nested; 24 | } 25 | -------------------------------------------------------------------------------- /scripts/apollo: -------------------------------------------------------------------------------- 1 | git init 2 | git remote add -f origin https://github.com/staylor/graphql-wordpress 3 | git config core.sparseCheckout true 4 | echo "packages/apollo-wordpress/" >> .git/info/sparse-checkout 5 | git pull origin master 6 | -------------------------------------------------------------------------------- /scripts/graphql: -------------------------------------------------------------------------------- 1 | git init 2 | git remote add -f origin https://github.com/staylor/graphql-wordpress 3 | git config core.sparseCheckout true 4 | echo "packages/graphql-wordpress/" >> .git/info/sparse-checkout 5 | git pull origin master 6 | -------------------------------------------------------------------------------- /scripts/relay: -------------------------------------------------------------------------------- 1 | git init 2 | git remote add -f origin https://github.com/staylor/graphql-wordpress 3 | git config core.sparseCheckout true 4 | echo "packages/relay-wordpress/" >> .git/info/sparse-checkout 5 | git pull origin master 6 | --------------------------------------------------------------------------------