added a name field to webhook subscriptions
closes https://github.com/shop/issues-event-foundations/issues/518
WHY are these changes introduced?
Adds support for the name field on webhook subscriptions when registered in the app's shopify.app.toml
WHAT is this pull request doing?
- Adds optional
namefield to webhook subscription TypeScript types - Adds validation for the
namefield in webhook subscription schemas (must be a non-empty string if provided) - Adds test coverage for webhook subscriptions with the
nameattribute
Name validation:
- Field is optional
- Must be a non-empty string if provided
How to test your changes
- Create a webhook subscription in your
shopify.app.tomlwith anamefield while running local app development in dev dash:
Example:
[[webhooks.subscriptions]]
name = "products-create"
topics = ["products/create"]
uri = "https://example.com/webhooks"
- Run
shopify app deployand verify it accepts the configuration - Try with an empty
name = ""and verify validation rejects it - Run the test suite:
pnpm vitest loader.test.ts --run
Tophat:
- [x] Tophatted changes locally verifying that the min and max char validations are working
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.
[!CAUTION] DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| π‘ | Statements | 79.51% (+0.28% πΌ) |
14177/17830 |
| π‘ | Branches | 73.57% (+0.46% πΌ) |
6952/9450 |
| π‘ | Functions | 79.68% (+0.31% πΌ) |
3639/4567 |
| π‘ | Lines | 79.88% (+0.3% πΌ) |
13401/16777 |
Show new covered files π£
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π’ | ... / admin-as-app.ts |
100% | 100% | 100% | 100% |
| π’ | ... / metafield_definitions.ts |
100% | 100% | 100% | 100% |
| π’ | ... / metaobject_definitions.ts |
100% | 100% | 100% | 100% |
| π’ | ... / bulk-operation-run-mutation.ts |
100% | 100% | 100% | 100% |
| π’ | ... / bulk-operation-run-query.ts |
100% | 100% | 100% | 100% |
| π’ | ... / get-bulk-operation-by-id.ts |
100% | 100% | 100% | 100% |
| π’ | ... / list-bulk-operations.ts |
100% | 100% | 100% | 100% |
| π’ | ... / staged-uploads-create.ts |
100% | 100% | 100% | 100% |
| π΄ | ... / execute.ts |
0% | 0% | 0% | 0% |
| π΄ | ... / status.ts |
0% | 0% | 0% | 0% |
| π΄ | ... / pull.ts |
0% | 100% | 0% | 0% |
| π’ | ... / execute-operation.ts |
92.59% | 75% | 100% | 92.31% |
| π΄ | ... / pull.ts |
0% | 0% | 0% | 0% |
| π’ | ... / bulk-operation-status.ts |
96.55% | 92.11% | 100% | 100% |
| π’ | ... / constants.ts |
100% | 100% | 100% | 100% |
| π’ | ... / download-bulk-operation-results.ts |
100% | 100% | 100% | 100% |
| π’ | ... / execute-bulk-operation.ts |
92.65% | 86.67% | 100% | 93.94% |
| π’ | ... / format-bulk-operation-status.ts |
100% | 100% | 100% | 100% |
| π’ | ... / run-mutation.ts |
100% | 100% | 100% | 100% |
| π’ | ... / run-query.ts |
100% | 100% | 100% | 100% |
| π‘ | ... / stage-file.ts |
73.53% | 62.5% | 85.71% | 72.73% |
| π’ | ... / watch-bulk-operation.ts |
100% | 94.74% | 100% | 100% |
| π’ | ... / declarative-definitions.ts |
98.54% | 93.18% | 100% | 98.51% |
| π’ | ... / common.ts |
97.22% | 93.75% | 100% | 96.55% |
| π’ | ... / execute-command-helpers.ts |
100% | 100% | 100% | 100% |
| π΄ | ... / promiseWithResolvers.ts |
33.33% | 50% | 50% | 33.33% |
Show files with reduced coverage π»
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π΄ | ... / execute.ts |
0% | 0% (-100% π») |
0% | 0% |
| π’ | ... / extension-instance.ts |
84.8% (+0.23% πΌ) |
77.6% (-0.91% π») |
92.06% (+0.13% πΌ) |
85.11% (+0.24% πΌ) |
| π‘ | ... / specification.ts |
69.09% | 75.61% (+2.44% πΌ) |
76.47% (-1.31% π») |
68.75% |
| π’ | ... / ui_extension.ts |
85.38% (-9.44% π») |
72.34% (-8.91% π») |
84% (-16% π») |
88% (-8.46% π») |
| π’ | ... / developer-platform-client.ts |
84.62% (-1.5% π») |
71.43% (+0.84% πΌ) |
81.82% (+1.82% πΌ) |
93.75% (+0.42% πΌ) |
| π’ | ... / api.ts |
87.07% (-0.43% π») |
76.71% (-0.1% π») |
100% | 86.49% (-0.43% π») |
| π’ | ... / SingleTask.tsx |
84.21% (-15.79% π») |
50% (-50% π») |
80% (-20% π») |
84.21% (-15.79% π») |
| π΄ | ... / environment.ts |
35% (-5% π») |
41.18% | 40% (-10% π») |
36.84% (-5.26% π») |
| π΄ | ... / ui.tsx |
50.82% (-0.79% π») |
42.86% (-5.53% π») |
54.55% (+1.42% πΌ) |
50% (-0.82% π») |
| π’ | ... / console.ts |
81.82% (+15.15% πΌ) |
75% (-25% π») |
100% (+33.33% πΌ) |
81.82% (+15.15% πΌ) |
| π΄ | ... / dev.ts |
14.29% (+0.95% πΌ) |
3.13% (+0.18% πΌ) |
50% (-7.14% π») |
14.29% (+0.95% πΌ) |
| π’ | ... / init.ts |
88% (-0.89% π») |
71.43% (+4.76% πΌ) |
86.67% (+4.85% πΌ) |
88% (-0.89% π») |
| π’ | ... / storefront-renderer.ts |
90.2% (-0.54% π») |
78.95% | 81.82% (-1.52% π») |
90.2% (-0.54% π») |
| π‘ | ... / theme-polling.ts |
67.12% (-0.93% π») |
68.75% | 78.57% | 66.67% (-0.98% π») |
Test suite run success
3554 tests passing in 1415 suites.
Report generated by π§ͺjest coverage report action from 833d75115f6410aefa89d95372335201291436bc
I have signed the CLA!
Note: Shopify core changes must be deployed first before the CLI or adding the name field would fail to be recognized and error
Note: Shopify core changes must be deployed first before the CLI or adding the name field would fail to be recognized and error
@georgge293 This PR is already approved but the core changes won't be deployed until after BFCM. I see some chances this PR is still accidentally merged. Which might be fine because afaik there won't be more CLI releases before BFCM, but core pending deploys could take a few days to deploy after BFCM and we should be careful to not release the CLI until that specific PR is deployed if we don't want to release a broken feature.
I may be a bit paranoid here, but what about moving this PR back to draft? You would keep the approvals and prevent an accidental merge from someone who hasn't read your comment on the core changes dependency
Note: Shopify core changes must be deployed first before the CLI or adding the name field would fail to be recognized and error
@georgge293 This PR is already approved but the core changes won't be deployed until after BFCM. I see some chances this PR is still accidentally merged. Which might be fine because afaik there won't be more CLI releases before BFCM, but core pending deploys could take a few days to deploy after BFCM and we should be careful to not release the CLI until that specific PR is deployed if we don't want to release a broken feature.
I may be a bit paranoid here, but what about moving this PR back to draft? You would keep the approvals and prevent an accidental merge from someone who hasn't read your comment on the core changes dependency
Sounds good, will do. Thanks!