Git Product home page Git Product logo

gridsome-source-kentico-kontent's Introduction

Hi! ๐Ÿ‘‹

I'm a web developer at Ridgeway based in Witney, UK. Web development's also a hobby of mine so when I can find the time I'm working away on my own projects, which you can find here on GitHub.

๐Ÿ“ฌ You can find my blog and social links in my profile if you want to get in touch.

gridsome-source-kentico-kontent's People

Contributors

cmeeg avatar colliercz avatar markcoole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gridsome-source-kentico-kontent's Issues

Improve logging and debugging documentation

This issue was raised in #2:

I wanted to dig into this more and learn how the plugin was working.

I started with export DEBUG=* to turn on the debug package you're using.

The export DEBUG=* might be helpful to put in the README for devs looking to diagnose issues.

Preview mode using plugin?

Hello,

I am trying to get Preview Mode to work pulling in Draft content from Kentico Kontent.

Here's what I have in the gridsome.config.js file:

plugins: [
		{
			use: '@meeg/gridsome-source-kentico-kontent',
			options: {
				deliveryClientConfig: {
					projectId: process.env.KENTICO_KONTENT_PROJECT_ID,
					previewApiKey: process.env.KENTICO_KONTENT_PREVIEW_API_KEY,
					globalQueryConfig: {
						usePreviewMode: true,
						useSecuredMode: false,
					},
					contentItemsDepth: 6,
				}
			}
		}

If I use usePreviewMode: true I get the following error:

TypeError: schemaComposer.get(...).hasInterface is not a function

If I flip it to usePreviewMode: false it runs in develop mode just fine, but does not pull in the preview api call. I was able to get preview text by using other api calls, etc. I tried this in two different projects and can not get it to work.

Does it work? If so, what am I not doing in the config to set it properly?

Thank you for your help!

Plugin error when using Gridsome 0.7.2

This issue was raised on #2:

I updated Gridsome (I was previously using 0.6.9) to the current latest (0.7.2) and ran into an issue with Taxonomies... specifically ManufacturerTaxonomy (this is running on the same "Sample Project").

Here's my stacktrace

Load sources - 2.08s
Error: Cannot get field 'terms' from type 'TaxonomyManufacturer'. Field does not exist.
    at ObjectTypeComposer.getField (D:\path\to\app\node_modules\graphql-compose\lib\ObjectTypeComposer.js:167:13)
    at ObjectTypeComposer.isFieldPlural (D:\path\to\app\node_modules\graphql-compose\lib\ObjectTypeComposer.js:365:23)
    at mapValues (D:\path\to\app\node_modules\gridsome\lib\graphql\nodes\index.js:260:25)
    at D:\path\to\app\node_modules\lodash\lodash.js:13401:38
    at D:\path\to\app\node_modules\lodash\lodash.js:4905:15
    at baseForOwn (D:\path\to\app\node_modules\lodash\lodash.js:2990:24)
    at mapValues (D:\path\to\app\node_modules\lodash\lodash.js:13400:7)
    at createReferenceFields (D:\path\to\app\node_modules\gridsome\lib\graphql\nodes\index.js:257:16)
    at createNodesSchema (D:\path\to\app\node_modules\gridsome\lib\graphql\nodes\index.js:30:5)
    at createSchema (D:\path\to\app\node_modules\gridsome\lib\graphql\createSchema.js:59:3)
    at Schema.buildSchema (D:\path\to\app\node_modules\gridsome\lib\app\Schema.js:28:28)
    at Plugins.createSchema (D:\path\to\app\node_modules\gridsome\lib\app\Plugins.js:93:22)
    at process._tickCallback (internal/process/next_tick.js:68:7)

I have a feeling this is related to changes in the Kentico SDK / Cloud API.

Plugin fails when querying un-edited "Sample Project"

Hello!

I was exploring Gridsome and Kentico Cloud and was using your plugin to query for data.

I ran into an issue when trying to query from the Kentico Cloud demo project "Sample Project"

The line that fails is below

https://github.com/CMeeg/gridsome-source-kentico-cloud/blob/993313d6cc3656ee1692ff8139dd5f8ee5192f90/src/KenticoCloudSource.js#L181

The error is Cannot read property 'isComponent' of null

I resolved this issue by changing the line to if (!!collectionNode && !collectionNode.isComponent) {.

I'm also getting a large number of warnings about assets with duplicate keys being added:

Asset > Failed to add node: Duplicate key for property id: ...

I believe that the fields that are causing these warnings are metadataTwitterImage and metadataOgImage.

Rebranding

As @seangwright mentioned in A comment in #5, We just announced a rebrand of the product. When you get a chance it'd be great if you could update this plugin to reflect that new brand, "Kentico Kontent"

On an unrelated note, I've been working with the plugin in my free time the last couple of weeks converting the Vue travel blog sample I built and I'm nearly complete. I've run into very few issues that I couldn't resolve quickly and they were all mostly due to my lack of understanding of Gridsome or GraphQL. I've been super pleased with this plugin!

Asset related issues

I found that when I try to connect to a project with nothing published (I forgot that this was the case) I got this error:

Gridsome v0.7.11

Initializing plugins...
Load sources - 1.83s
Error: Cannot find ObjectTypeComposer with name Asset
    at SchemaComposer.getOTC (S:\Source\FCM\fcm-gridsome\node_modules\graphql-compose\lib\SchemaComposer.js:465:11)
    at resolvers.forEach.typeMap (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\graphql\createSchema.js:395:43)
    at Array.forEach (<anonymous>)
    at addResolvers (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\graphql\createSchema.js:392:13)
    at createSchema (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\graphql\createSchema.js:63:3)
    at Schema.buildSchema (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\app\Schema.js:28:28)
    at Plugins.createSchema (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\app\Plugins.js:94:22)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Once I realized that I had nothing published, I went ahead and published a bunch of things. This got rid of the above error, but then I got this error:

Gridsome v0.7.11

Initializing plugins...
Load sources - 2s
Error: Resolver for Asset.url must have a "type" property.
    at resolvers.forEach.typeMap (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\graphql\createSchema.js:420:19)
    at Array.forEach (<anonymous>)
    at addResolvers (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\graphql\createSchema.js:392:13)
    at createSchema (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\graphql\createSchema.js:63:3)
    at Schema.buildSchema (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\app\Schema.js:28:28)
    at Plugins.createSchema (S:\Source\FCM\fcm-gridsome\node_modules\gridsome\lib\app\Plugins.js:94:22)
    at process._tickCallback (internal/process/next_tick.js:68:7)

This turned out to be because my types didn't have any asset fields. Once I added an asset field the above was resolved. I think it got this far because I had referenced assets in rich text fields. If I didn't have those I think I would have seen the first error again.

As near as I can tell this has to do with how the Asset resolver is loaded. I think it works fine when an Asset type resolver is added because of an asset field, but if there isn't one because there's no field or asset referenced it throws an error.

I'm still super new to Gridsome plugin development, but if you could point me in the right direction as to how to develop this and some resources to start figuring out how to resolve the asset issues, I'd be happy to give it a shot.

Announce: Prepare for Fair user policy updates

Brief description

The plugin is loading all items per type, so some bigger project might stop to load all required content items.

From the 1st of February the /items endpoint is limited to 1000 (incl. linked items) as described in Kontent API changes.

After that date, queries resulting in more than 1K content items per language won't load more than that 1K items.

Additional context

In the SDK, there is a method itemsFeedAll that allows the loading of all of the items.

Update SDK version to latest

The JS SDK got some major updates in the V6 release which occured right around the time you released this plugin. Additionally, in support of the rebranding mentioned in #8, V7 was released yesterday.

There are a lot of changes in V6 from V5, but the Upgrade guide should cover just about all of them.

Thanks for all your efforts on this plugin!

Sample project: Cannot read property 'isComponent' of null

This issue originated in #2:

I ran into an issue when trying to query from the Kentico Cloud demo project "Sample Project"

The line that fails is below

https://github.com/CMeeg/gridsome-source-kentico-cloud/blob/993313d6cc3656ee1692ff8139dd5f8ee5192f90/src/KenticoCloudSource.js#L181

The error is Cannot read property 'isComponent' of null

I resolved this issue by changing the line to if (!!collectionNode && !collectionNode.isComponent) {.

Add a tracking header

There's a tracking header called X-KC-SOURCE that you can add to your plugin. We'll be then able to measure the adoption of your plugin and send you statistics of API calls made through the plugin.

You can set the header via the Kentico Kontent Delivery SDK.

v5 JS SDK approach: kontent-ai/gatsby-packages@e3612ae

v6 JS SDK: https://github.com/Kentico/gatsby-source-kentico-cloud/blob/js-sdk-ugrade-v6/src/gatsby-node.js#L96 or https://github.com/Kentico/gatsby-source-kentico-cloud/blob/master/src/gatsby-node.js#L96

Sample project: Duplicate asset keys being added

This issue originated in #2:

I'm also getting a large number of warnings about assets with duplicate keys being added:

Asset > Failed to add node: Duplicate key for property id: ...

I believe that the fields that are causing these warnings are metadataTwitterImage and metadataOgImage.

Assets that are only referenced in Rich Text Field not appearing in asset collection

I have a custom Post type that has two elements: and Asset element and a Rich Text element.
I have 2 images uploaded to assets.
1 has been selected for the Asset element and this appears in the assets collection.
The other asset is embedded in the rich text field. This asset does not appear in the assets collection.

The asset element in the rich text html passes in the URL as the id so I can render the images, however the fact that the full asset is not in the in the asset collection means I cannot add the asset description to the alt tag or request different sizes/formats via the api.

I believe I have a potential fix which I'm happy to push to a branch but wanted to check I haven't missed some configuration or done something wrong

Getting TypeError

Hello,

I am getting the following error when using the plugin:

Initializing plugins...
Load sources - 3.89s
TypeError: schemaComposer.get(...).hasInterface is not a function
    at createTypeComposers (/Users/johncherba/IdeaProjects/dotcom-gridsome/node_modules/gridsome/lib/graphql/nodes/index.js:72:41)
    at createNodesSchema (/Users/johncherba/IdeaProjects/dotcom-gridsome/node_modules/gridsome/lib/graphql/nodes/index.js:30:3)
    at createSchema (/Users/johncherba/IdeaProjects/dotcom-gridsome/node_modules/gridsome/lib/graphql/createSchema.js:59:3)
    at Schema.buildSchema (/Users/johncherba/IdeaProjects/dotcom-gridsome/node_modules/gridsome/lib/app/Schema.js:28:28)
    at Plugins.createSchema (/Users/johncherba/IdeaProjects/dotcom-gridsome/node_modules/gridsome/lib/app/Plugins.js:94:22)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
MacBook-Pro:dotcom-gridsome$ gridsome -v
@gridsome/cli v0.3.1
gridsome v0.7.13

In gridsome.config.js there is:

plugins: [
    {
      use: '@meeg/gridsome-source-kentico-kontent',
      options: {
        deliveryClientConfig: {
          projectId: process.env.KENTICO_KONTENT_PROJECT_ID
        }
      }
    },
  ],

and the schema it's trying to pull is, it should do it automagically but here is the schema.graphql file:

type SystemInfo {
    id: String!
    name: String!
    codename: String!
    language: String!
    type: String!
    lastModified: String!
}
interface ContentItem {
    system: SystemInfo!
}
type MultipleChoiceElementOption {
    name: String!
    codename: String
}
type TaxonomyTerm {
    name: String!
    codename: String
}
type Asset {
    name: String
    type: String
    size: Int
    description: String
    url: String
    width: Int
    height: Int
}
type Link {
    codename: String
    itemID: String
    urlSlug: String
    type: String
}
type RichTextImage {
    imageId: String!
    url: String!
    description: String
    width: Int
    height: Int
}
type TextElement {
    type: String!
    name: String!
    value: String
}
type NumberElement {
    type: String!
    name: String!
    value: Int
}
type DateTimeElement {
    type: String!
    name: String!
    value: String
}
type MultipleChoiceElement {
    type: String!
    name: String!
    value: [MultipleChoiceElementOption]
}
type UrlSlugElement {
    type: String!
    name: String!
    value: String
}
type TaxonomyElement {
    type: String!
    name: String!
    value: [TaxonomyTerm]
    taxonomyGroup: String
}
type AssetElement {
    type: String!
    name: String!
    value: [Asset]
}
type RichTextElement {
    type: String!
    name: String!
    value: String
    linkedItemCodenames: [String]
    links: [Link]
    images: [RichTextImage]
    resolvedHtml: String
}
type LinkedItemsElement {
    type: String!
    name: String!
    value: [ContentItem]
    itemCodenames: [String]
}
type CustomElement {
    type: String!
    name: String!
    value: String
}

type CarouselCardContentType implements ContentItem {
    system: SystemInfo!
    icon: LinkedItemsElement
    customer_story: LinkedItemsElement
    demo: LinkedItemsElement
    solution: TaxonomyElement
    video: LinkedItemsElement
    card_content: LinkedItemsElement
    whitepaper: LinkedItemsElement
    value_proposition: LinkedItemsElement
    url: TextElement
    overview_deck: LinkedItemsElement
    pdf: AssetElement
    use_case: TaxonomyElement
    carousel_content_types: TaxonomyElement
    card_title: TextElement
    original_content_link: TextElement
    visibility: TaxonomyElement
}

type CustomerStoryContentType implements ContentItem {
    system: SystemInfo!
    original_content_link: TextElement
    image: LinkedItemsElement
    use_case: TaxonomyElement
    lob: TaxonomyElement
    industry: TaxonomyElement
    url: TextElement
    content: AssetElement
    description: TextElement
    solution: TaxonomyElement
}

type DemoContentType implements ContentItem {
    system: SystemInfo!
    solution: TaxonomyElement
    description: TextElement
    pdf: AssetElement
    industry: TaxonomyElement
    original_content_link: TextElement
    video: TextElement
    use_case: TaxonomyElement
    image: LinkedItemsElement
    lob: TaxonomyElement
    app: TextElement
}

type HomepagePackageContentType implements ContentItem {
    system: SystemInfo!
    lob_description: TextElement
    metadata__metadata_description: TextElement
    industry_description: TextElement
    lob_industry_title: LinkedItemsElement
    metadata__metadata_title: TextElement
    anaplan_navigator: UrlSlugElement
    industry_tagline: TextElement
    intro_video: LinkedItemsElement
    intro_text: TextElement
    lob_tagline: TextElement
    banner_image: LinkedItemsElement
    intro_title: TextElement
}

type ImageContentType implements ContentItem {
    system: SystemInfo!
    image_use_description: TextElement
    lob: TaxonomyElement
    image: AssetElement
    industry: TaxonomyElement
    accessibility_description: TextElement
}

type IndustrySubSectorContentType implements ContentItem {
    system: SystemInfo!
    short_text: TextElement
    solution_package: LinkedItemsElement
    industry: TaxonomyElement
    medium_text: TextElement
    icon: AssetElement
}

type LobIndustryContentType implements ContentItem {
    system: SystemInfo!
    sitemap: TaxonomyElement
    banner_image: LinkedItemsElement
    industry: TaxonomyElement
    short_text: TextElement
    lob: TaxonomyElement
    medium_text: TextElement
}

type LobIndustryLandingPackageContentType implements ContentItem {
    system: SystemInfo!
    metadata__metadata_description: TextElement
    lob_industry: LinkedItemsElement
    metadata__metadata_title: TextElement
    anaplan_navigator: UrlSlugElement
    industry_sub_sector: LinkedItemsElement
    type: TaxonomyElement
    icon: AssetElement
    solution_package: LinkedItemsElement
}

type NavigationItemContentType implements ContentItem {
    system: SystemInfo!
    metadata__metadata_description: TextElement
    metadata__metadata_title: TextElement
    url: UrlSlugElement
    page_item: LinkedItemsElement
    subitems: LinkedItemsElement
    sitemap: TaxonomyElement
    title: TextElement
    description: TextElement
}

type OverviewContentType implements ContentItem {
    system: SystemInfo!
    description: TextElement
    original_content_link: TextElement
    pdf: AssetElement
}

type SolutionPackageContentType implements ContentItem {
    system: SystemInfo!
    video: LinkedItemsElement
    icon: AssetElement
    use_cases: LinkedItemsElement
    carousel_card_s_: LinkedItemsElement
    multi_length_description__long_text: TextElement
    multi_length_description__medium_text: TextElement
    differentiator___medium_text: TextElement
    sitemap: TaxonomyElement
    multi_length_description__short_text: TextElement
    connections_image: LinkedItemsElement
    solution: TaxonomyElement
    lob: TaxonomyElement
    differentiator___short_text: TextElement
    industry: TaxonomyElement
    differentiator___long_text: TextElement
}

type StandardPackageDescriptionsContentType implements ContentItem {
    system: SystemInfo!
    medium_description: TextElement
    short_description: TextElement
    image: LinkedItemsElement
}

type UseCasePackageContentType implements ContentItem {
    system: SystemInfo!
    scoping_checklist_description: LinkedItemsElement
    anaplan_navigator: UrlSlugElement
    metadata__metadata_description: TextElement
    carousel_card_s_: LinkedItemsElement
    solution: TaxonomyElement
    architectural_overview_description: LinkedItemsElement
    architectural_overview___original_content_link: TextElement
    metadata__metadata_title: TextElement
    banner_image: LinkedItemsElement
    scoping_checklist_pdf: AssetElement
    icon: AssetElement
    sitemap: TaxonomyElement
    scoping_checklist___original_content_link: TextElement
    multi_length_description__long_text: TextElement
    multi_length_description__medium_text: TextElement
    best_practices_video: LinkedItemsElement
    architectural_overview_pdf: AssetElement
    architectural_overview_image: LinkedItemsElement
    industry: TaxonomyElement
    multi_length_description__short_text: TextElement
    best_practices_description: LinkedItemsElement
    use_case: TaxonomyElement
    lob: TaxonomyElement
}

type ValuePropositionContentType implements ContentItem {
    system: SystemInfo!
    url: TextElement
    pdf: AssetElement
    description: TextElement
    original_content_link: TextElement
}

type VideoContentType implements ContentItem {
    system: SystemInfo!
    caption: TextElement
    lob: TaxonomyElement
    use_case: TaxonomyElement
    visibility: TaxonomyElement
    description: TextElement
    industry: TaxonomyElement
    solution: TaxonomyElement
    video_url: TextElement
}

type WhitepaperContentType implements ContentItem {
    system: SystemInfo!
    pdf: AssetElement
    description: TextElement
    original_content_link: TextElement
    url: TextElement
}

On newly created projects gridsome has worked great. I think it may be an issue with this plugin trying to parse data that has not had logic written for it in the plugin, I've tried to debug but need to learn more on how to get verbose output if that's possible from plugin.

Thanks! Any help appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.