Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce dev dash webhooks API #4884

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Introduce dev dash webhooks API #4884

wants to merge 1 commit into from

Conversation

cdarne
Copy link

@cdarne cdarne commented Nov 19, 2024

WHY are these changes introduced?

See https://github.com/Shopify/shopify/pull/554877 for the Core implementation and tophat instructions

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor

github-actions bot commented Nov 19, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
74.51% (-0% 🔻)
8552/11477
🟡 Branches
70.33% (+0.04% 🔼)
4176/5938
🟡 Functions
73.97% (-0.09% 🔻)
2248/3039
🟡 Lines
75.03% (-0.03% 🔻)
8087/10778
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / available-topics.ts
100% 100% 100% 100%
🟢
... / cli-testing.ts
100% 100% 100% 100%
🟢
... / public-api-versions.ts
100% 100% 100% 100%
🔴
... / webhooks.ts
0% 100% 0% 0%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / loader.ts
93.14% (-0.12% 🔻)
83.33% (-1.45% 🔻)
97.06% (-0.06% 🔻)
94.03% (-0.12% 🔻)
🟡
... / update-extension.ts
71.79% (-0.71% 🔻)
58.33% 60%
76.47% (-0.67% 🔻)
🟢
... / app-event-watcher.ts
84.72% (-5.94% 🔻)
76.67% (-3.33% 🔻)
80.95% (-9.52% 🔻)
89.06% (-6.46% 🔻)
🟢
... / app-watcher-esbuild.ts
82.76% (-0.57% 🔻)
100% (+12.5% 🔼)
78.57% (-1.43% 🔻)
85.19% (-2.69% 🔻)
🟢
... / bundler.ts
91.53% (-8.47% 🔻)
95.45% (-4.55% 🔻)
76.19% (-23.81% 🔻)
90.74% (-9.26% 🔻)
🟡
... / middlewares.ts
77.33% (-0.87% 🔻)
73.08% 70%
76.39% (-0.94% 🔻)
🔴
... / draftable-extension.ts
34.78%
33.33% (-16.67% 🔻)
12.5% 36.36%
🟢
... / bundle.ts
80.65% (-1.71% 🔻)
75.76% (+9.09% 🔼)
66.67% (-6.67% 🔻)
81.67% (-2.01% 🔻)
🟢
... / json-schema.ts
90.24% (-1.42% 🔻)
78.38% (-2.7% 🔻)
100%
90.12% (-1.44% 🔻)

Test suite run success

1950 tests passing in 888 suites.

Report generated by 🧪jest coverage report action from 14e92a0

@cdarne cdarne marked this pull request as ready for review November 21, 2024 15:49
@cdarne cdarne requested a review from a team as a code owner November 21, 2024 15:49
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

packages/cli-kit/dist/public/node/api/webhooks.d.ts
import { Variables } from 'graphql-request';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
/**
 * Executes an org-scoped GraphQL query against the App Management API.
 * Uses typed documents.
 *
 * @param query - GraphQL query to execute.
 * @param token - Partners token.
 * @param variables - GraphQL variables to pass to the query.
 * @returns The response of the query of generic type <T>.
 */
export declare function webhooksRequest<TResult, TVariables extends Variables>(query: TypedDocumentNode<TResult, TVariables>, token: string, variables?: TVariables): Promise<TResult>;

Existing type declarations

We found no diffs with existing type declarations

repo: 'shopify',
pathToFile: 'areas/core/shopify/db/graphql/webhooks_schema_unstable_public.graphql',
localPath: './packages/app/src/cli/api/graphql/webhooks/webhooks_schema.graphql',
branch: 'dev-dash-webhooks-api',
Copy link
Author

@cdarne cdarne Nov 21, 2024

Choose a reason for hiding this comment

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

This makes tophating possible for now (see the Core branch https://github.com/Shopify/shopify/pull/554877). Once the Core PR has been merged, I'll change this for dd.

Copy link
Contributor

@shauns shauns left a comment

Choose a reason for hiding this comment

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

Approving with caveat around your other PR merging and the branch name in codegen being updated.

@@ -80,15 +80,17 @@
"{projectRoot}/src/cli/api/graphql/business-platform-destinations/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/business-platform-organizations/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/app-dev/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/app-management/generated/**/*.ts"
"{projectRoot}/src/cli/api/graphql/app-management/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/webhooks/generated/**/*.ts"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wish we had a nicer way to do this but all the plumbing looks great 👌

headers: '{}',
success: true,
userErrors: [],
samplePayload: result.cliTesting?.samplePayload ?? '{}',
Copy link
Contributor

Choose a reason for hiding this comment

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

Lots of ?. here. Should cliTesting always be present, is it an error if its not? Maybe the schema should be adjusted?

query publicApiVersions {
publicApiVersions {
displayName
handle
Copy link
Contributor

Choose a reason for hiding this comment

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

Given handle is the only thing we use of this query, should we limit what we fetch to that?

})
})

describe('sendSampleWebhook', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe a thing relevant to test here is the mapping of input to the mutation variables

Copy link
Contributor

@dpeacock dpeacock left a comment

Choose a reason for hiding this comment

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

Agree w/ Shaun's comments otherwise LGTM

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