Skip to content

Feat: release id [EXT-6547] #2287

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

Merged
merged 4 commits into from
Jul 21, 2025
Merged

Feat: release id [EXT-6547] #2287

merged 4 commits into from
Jul 21, 2025

Conversation

lewisjcs
Copy link
Contributor

@lewisjcs lewisjcs commented Jul 17, 2025

Purpose of PR

This pull request enhances the ui-extensions-sdk to support the "Releases v2" project by ensuring apps are aware of the release context they are operating in. This change specifically addresses ticket EXT-6547.

We are adding the releaseId to the sdk.ids object when an application is running within a release. This provides developers with a straightforward way to access the current release's ID, enabling them to build release-aware features.

A primary use case for this is to allow an app to fetch data or modify its behavior based on the specific release it's interacting with. This is a foundational requirement for many of the planned features in Releases v2.

PR Checklist

  • Tests are added/updated/not required
  • Tests are passing
  • Typescript typings are added/updated/not required

@lewisjcs lewisjcs force-pushed the feat/releaseId-EXT-6547 branch from 5d89a9d to d62e235 Compare July 17, 2025 17:58
@lewisjcs lewisjcs marked this pull request as ready for review July 17, 2025 17:59
@lewisjcs lewisjcs requested review from a team as code owners July 17, 2025 17:59
lib/api.ts Outdated
@@ -64,6 +64,8 @@ function makeSharedAPI(
const { user, parameters, locales, ids, initialContentTypes, hostnames, release } = data
const currentLocation = data.location || locations.LOCATION_ENTRY_FIELD

const idsWithRelease = release ? { ...ids, release: release.sys.id } : ids
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const idsWithRelease = release ? { ...ids, release: release.sys.id } : ids
const maybeIdsWithRelease = release ? { ...ids, release: release.sys.id } : ids

lib/api.ts Outdated
@@ -89,7 +91,7 @@ function makeSharedAPI(
error: (message: string) => channel.send('notify', { type: 'error', message }),
warning: (message: string) => channel.send('notify', { type: 'warning', message }),
},
ids,
ids: idsWithRelease,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ids: idsWithRelease,
ids: maybeIdsWithRelease,

lib/cma.ts Outdated
@@ -13,6 +13,8 @@ export function createCMAClient(ids: IdsAPI, channel: Channel): CMAClient {
environmentId: ids.environmentAlias ?? ids.environment,
spaceId: ids.space,
organizationId: ids.organization,
// TODO: Shipped in the CMA
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 this is a public repo, we might want to remove this TODO

Copy link
Contributor

@BobHemphill76 BobHemphill76 left a comment

Choose a reason for hiding this comment

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

We should probably remove the TODO here.

@lewisjcs lewisjcs requested a review from BobHemphill76 July 17, 2025 19:21
lib/api.ts Outdated
@@ -64,6 +64,8 @@ function makeSharedAPI(
const { user, parameters, locales, ids, initialContentTypes, hostnames, release } = data
const currentLocation = data.location || locations.LOCATION_ENTRY_FIELD

const effectiveIds = release ? { ...ids, release: release.sys.id } : ids
Copy link
Member

Choose a reason for hiding this comment

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

I'm not against this approach per se -- but I wonder why we append the releaseId here in the SDK instead of doing so upstream ie in the channel sender that provides the data attribute (where the other ids are).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed!

@lewisjcs lewisjcs force-pushed the feat/releaseId-EXT-6547 branch from 6905ba0 to 4b0cdf7 Compare July 21, 2025 20:35
@lewisjcs lewisjcs merged commit 8b2c442 into main Jul 21, 2025
8 checks passed
@lewisjcs lewisjcs deleted the feat/releaseId-EXT-6547 branch July 21, 2025 20:45
@lewisjcs lewisjcs changed the title Feat/release id [EXT-6547] Feat: release id [EXT-6547] Jul 21, 2025
@contentful-automation
Copy link
Contributor

🎉 This PR is included in version 4.34.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants