Skip to content

Commit

Permalink
fix: publish codegen module metadata for Graph ui (#4959)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrove authored Aug 16, 2022
1 parent c90adde commit c6eb30e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/lib/one-graph/cli-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,12 +828,32 @@ const detectLocalCLISessionMetadata = async ({ siteRoot }) => {
* @param {string} input.jwt The GraphJWT string
* @param {string} input.sessionId The id of the cli session to fetch the current metadata for
* @param {string} input.siteRoot Path to the root of the project
* @param {object} input.config The parsed netlify.toml config file
* @param {string} input.docId The GraphQL operations document id to fetch
* @param {string} input.schemaId The GraphQL schemaId to use when generating code
*/
const publishCliSessionMetadataPublishEvent = async ({ docId, jwt, schemaId, sessionId, siteRoot }) => {
const publishCliSessionMetadataPublishEvent = async ({ config, docId, jwt, schemaId, sessionId, siteRoot }) => {
const detectedMetadata = await detectLocalCLISessionMetadata({ siteRoot })

/** @type {CodegenHelpers.CodegenModuleMeta | null} */
let codegen = null

const codegenModule = await getCodegenModule({ config })

if (codegenModule) {
codegen = {
id: codegenModule.id,
version: codegenModule.id,
generators: codegenModule.generators.map((generator) => ({
id: generator.id,
name: generator.name,
options: generator.generateHandlerOptions || null,
supportedDefinitionTypes: generator.supportedDefinitionTypes,
version: generator.version,
})),
}
}

/** @type {CliEventHelper.OneGraphNetlifyCliSessionMetadataPublishEvent} */
const event = {
__typename: 'OneGraphNetlifyCliSessionMetadataPublishEvent',
Expand All @@ -848,7 +868,7 @@ const publishCliSessionMetadataPublishEvent = async ({ docId, jwt, schemaId, ses
siteRootFriendly: detectedMetadata.siteRoot,
persistedDocId: docId,
schemaId,
codegenModule: detectedMetadata.codegen,
codegenModule: codegen,
arch: detectedMetadata.arch,
nodeVersion: detectedMetadata.nodeVersion,
platform: detectedMetadata.platform,
Expand Down

1 comment on commit c6eb30e

@github-actions
Copy link

Choose a reason for hiding this comment

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

📊 Benchmark results

Package size: 222 MB

Please sign in to comment.