Skip to content

Support single-subscription events modules when reading remote configuration - #8425

Draft
rezaansyed wants to merge 1 commit into
mainfrom
events-config-link-shape-tolerance
Draft

Support single-subscription events modules when reading remote configuration#8425
rezaansyed wants to merge 1 commit into
mainfrom
events-config-link-shape-tolerance

Conversation

@rezaansyed

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Shopify Core is adding a single-subscription shape for events app modules: the :events module config will accept either the existing subscription list (subscription: [...], one module with uid "events") or a new single-subscription object (subscription: {...}, one module per subscription, uid = subscription handle). This enables shop-scoped (imperative) event subscriptions and a migration from one list module to N single-subscription modules.

The CLI's events transforms are currently hard-typed to the list shape: transformToEventsConfig calls .map on subscription and crashes on an object, and config link would need N single-subscription modules to merge back into one [[events.subscription]] list in the local TOML.

WHAT is this pull request doing?

  • transformToEventsConfig (remote → local): accepts a single-subscription object or the legacy array. Single objects are normalized to a one-element array (after stripping the server-managed identifier), so merging N single-subscription modules via deepMergeObjects implodes them into one subscription list in the TOML.
  • transformFromEventsConfig (local → remote): resolves relative subscription URIs for both shapes, preserving the input shape.

The local TOML format is unchanged: [[events.subscription]] stays a list. This is read-side tolerance only.

How to test your changes?

  • pnpm vitest run src/cli/models/extensions/specifications/transform/app_config_events.test.ts (14 tests, 5 new covering single-object stripping, multi-module merge, mixed-shape merge, and relative-URI resolution for the object shape).

Post-release steps

None.

Measuring impact

  • n/a: covered by existing events module metrics in Core

Checklist

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

…uration

Assisted-By: devx/aa56a38c-289a-416e-8a9a-0de281e4e3e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/app @shopify/app package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant