Skip to content

Conversation

@TRomesh
Copy link
Contributor

@TRomesh TRomesh commented Dec 1, 2025

This PR to check if we can use meta data query to check if we have cmp_Asset available in graph. Which should indicate that CMP DAM is enabled in a particular instance.

  • This simplifies the steps developers have to do when using dam assets in the sdk. With this methods we dont have to pass the attribute damEnabled to the GraphClient.
  const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
    graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
    damEnabled: true // not needed since we know if DAM is enabled from the meta data call just before we generate fragments
  });

@TRomesh TRomesh marked this pull request as ready for review December 2, 2025 09:31
@TRomesh TRomesh requested a review from Copilot December 2, 2025 09:32
Copilot finished reviewing on behalf of TRomesh December 2, 2025 09:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the GraphClient to automatically detect Digital Asset Management (DAM) availability by querying the GraphQL schema for the cmp_Asset type, eliminating the need for developers to manually specify a damEnabled option when constructing the client.

Key Changes:

  • Removes the damEnabled property from GraphOptions and the GraphClient class
  • Adds GraphQL introspection query for cmp_Asset type in the metadata query
  • Refactors getContentType() to getContentMetaData() which now returns both content type name and DAM availability status
  • Updates getContentByPath() and getPreviewContent() to use the dynamically determined DAM status

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@TRomesh TRomesh marked this pull request as draft December 2, 2025 09:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@TRomesh TRomesh requested a review from Copilot December 2, 2025 12:33
Copilot finished reviewing on behalf of TRomesh December 2, 2025 12:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@TRomesh TRomesh changed the title Refactor GraphClient to determine DAM availability based on cmp_Asset type Use Graph to determine DAM availability based on cmp_Asset type Dec 2, 2025
@TRomesh TRomesh merged commit 398fa88 into main Dec 2, 2025
10 checks passed
@TRomesh TRomesh deleted the feat/CMS-Use-graph-to-check-dam-availability branch December 2, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants