Skip to content

Conversation

@michaelphamcf
Copy link
Contributor

@michaelphamcf michaelphamcf commented Aug 28, 2025

Summary

JIRA: DX-209

  • entry.patch takes releaseId
  • if releaseId provided, use the release.entry.patch method instead
  • light refactor of existing entry method params that use releaseId

Description

Motivation and Context

Checklist (check all before merging)

  • Both unit and integration tests are passing
  • There are no breaking changes
  • Changes are reflected in the documentation

When adding a new method:

  • The new method is exported through the default and plain CMA client
  • All new public types are exported from ./lib/export-types.ts
  • Added a unit test for the new method
  • Added an integration test for the new method
  • The new method is added to the documentation

@michaelphamcf michaelphamcf marked this pull request as ready for review August 29, 2025 17:48
@michaelphamcf michaelphamcf requested a review from a team as a code owner August 29, 2025 17:48
headers?: RawAxiosRequestHeaders
) => {
if (params.releaseId) {
return releaseEntry.patch(http, { ...params, releaseId: params.releaseId }, data, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering about the spreading here, could it instead be written as:

if (params.releaseId) {
    return releaseEntry.patch(http, params, data, headers)
}

Copy link
Contributor Author

@michaelphamcf michaelphamcf Aug 30, 2025

Choose a reason for hiding this comment

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

yea, this one was a little weird. I had it this way because releaseEntry.patch's releaseId is required. For the headers spread, typescript didn't like it if I passed directly since it could be undefined and I think it wants those cases to be explicitly handled. Here's the TS error that shows:

Type 'undefined' is not assignable to type 'Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; } & { ...; }>'.ts(2345)

Updated to use typecasting for params.
Updated to be headers ?? {}

}
patch: {
params: GetSpaceEnvironmentParams & { entryId: string; version: number }
params: PatchEntryParams & { version: number }
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you also need to add QueryParams here? Also, is there a reason why { version: number} is not part of the PatchEntryParams type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, yea QueryParams looks like it should be here, but was missing originally -- I'll add it.

For the version, I agree it should be part of PatchEntryParams. I think I was deciding whether or not to have PatchEntryParams or to just tack on releaseId to the existing params list and this slip through somehow.

): Promise<EntryProps<T>>
patch<T extends KeyValueMap = KeyValueMap>(
params: OptionalDefaults<GetSpaceEnvironmentParams & { entryId: string; version?: number }>,
params: OptionalDefaults<PatchEntryParams & { version?: number }>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question about QueryParams and version here. Also line 305, should the get method have QueryParams as part of the type?

Copy link
Contributor Author

@michaelphamcf michaelphamcf Aug 30, 2025

Choose a reason for hiding this comment

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

Yes i think so. Wondering why QueryParams was missing in 305 also. Updated

@michaelphamcf michaelphamcf merged commit a70b34c into canary Sep 2, 2025
6 checks passed
@michaelphamcf michaelphamcf deleted the feat/DX-209-update-entry-patch-to-take-release-id branch September 2, 2025 18:28
@contentful-automation
Copy link
Contributor

🎉 This PR is included in version 11.55.0-canary.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@contentful-automation
Copy link
Contributor

🎉 This PR is included in version 11.58.0-canary.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@contentful-automation
Copy link
Contributor

🎉 This PR is included in version 11.59.0-canary.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

whitelisab added a commit that referenced this pull request Sep 24, 2025
* feat: add releaseSchema defaults to plain client creation [DX-184] (#2664)

* feat: add releaseSchema defaults to plain client creation

* fix: rename releaseSchema to releaseSchemaVersion

* fix: forgot to fix test

* feat(default): release-id (#2666)

* feat: add support for releaseSchemaVersion in create/query methods [DX-187] (#2665)

* feat: add releaseSchema defaults to plain client creation

* fix: rename releaseSchema to releaseSchemaVersion

* fix: forgot to fix test

* feat: add support for releaseSchemaVersion in create/query methods

* chore: lint fixes

* feat: add support for release.entry.* pattern

* chore: lint fixes

* chore: fix test description

* feat: add support for release.entry.* pattern [DX-192] (#2667)

* feat: add releaseSchema defaults to plain client creation

* fix: rename releaseSchema to releaseSchemaVersion

* fix: forgot to fix test

* feat: add support for releaseSchemaVersion in create/query methods

* chore: lint fixes

* feat: add support for release.entry.* pattern

* chore: lint fix

* chore: removing duplicate type

* feat: release/update endpoint reflects schemaVersion param [DX-188] (#2668)

* feat: add releaseSchema defaults to plain client creation

* fix: rename releaseSchema to releaseSchemaVersion

* fix: forgot to fix test

* feat: add support for releaseSchemaVersion in create/query methods

* chore: lint fixes

* feat: add support for release.entry.* pattern

* chore: lint fixes

* feat: add forTemplatedSpaces field for env template creation [DX-173] (#2663)

* chore: GetReleaseParams now extends GetReleaseEnvironmentParams

* feat: release/update enpoint updated to reflect Release.v2

* chore: removed unnecessary error handling from update endpoint

* chore: default integration test implemented

* chore: withoutDefault integration test implemented

* feat: all integrations tests passing

* fix: test:integration-watch action in package.json reverted to default

* fix: lint error resolved

* fix: prettier passing

---------

Co-authored-by: Ely Lucas <[email protected]>
Co-authored-by: Lisa White <[email protected]>

* Dx 194 Add unit tests for release.entry.get (#2674)

* add unit tests and mock for ReleaseEntry

* update test to use it.each

* Remove wrapper tests; move Rest endpoint tests to proper directory

* fix: lint prettier

* feat(releases): release.entry.getMany() (#2673)

* DX-202 Update entry.get to pass in releaseId (#2679)

* feat: entry.get takes releaseId from params to retrieve release entry

* add tests

* chore:prettier

* chore:prettier again

* chore: move entry w/ releaseId tests to existing entry integration tests file

* chore: cleanup comment, remove QueryParam that was added unnecessarily

* chore: cleanup code

* feat: update entry.getMany to include releasev2 params [DX-203] (#2685)

* chore: getMany first attempt

* chore: new integrations test file added (from Michael)

* chore: type fixes implemented

* chore: test shell added to entry-integration.test.ts

* chore: tests implemented with necessary unimplemented release metadata tests commented out

* chore: prettier fix

* fix: entry integration scope removed from test script

* chore: prettier fix

* fix: version logic cleaned up and test query modified

* chore: prettier fix

* feat: add release.entry.update method [DX-206] (#2692)

* feat: add release.entry.update method

* feat: add entry.release.patch method (#2695)

* fix: delete entry2 as part of entry integration test cleanup [DX-258] (#2700)

* chore: add canary build to release/releasev2 branch [DX-212] (#2696)

* chore: add canary build to release/releasev2 branch

* chore: update readme with info on current experimental features

* chore: creating canary branch for canary prerelease builds

* chore: add canary branch to release process in ci config

* feat: add release.entry.createWithId method [DX-61] (#2724)

* feat: add release.entry.createWithId method [DX-61]

* fix: update types for release entry params

* test: debug integration tests

* test: update unit tests and remove changes to integration tests

* feat: entry.patch handle releaseId [DX-209] (#2725)

* feat: entry.patch w/ releaseId alias for release.entry.patch

* chore: add unit tests

* chore: run prettier

* chore: add integration tests for entry.patch with releaseId

* chore: run lint

* chore: cleanup code

* chore: more cleanup

* chore(test): remove redundant assertion

* chore: cleanup params, console logs

* chore: handle undefined headers for typescript

* chore: use typecasting to pass param

* feat: update entry.createWithId to accept releaseId [DX-208] (#2727)

* feat: entry.update supports releaseId [DX-210] (#2728)

* feat: entry.update supports releaseId

* chore: add unit tests for entry.update

* chore: use typecasting to pass param

* test: add integration tests for entry.update

* chore: keep QueryParams consistent between entry.update and release.entry.update

* feat: add release.entry.create method (#2730)

* feat: entry.create supports releaseId [DX-207] (#2732)

* feat: add releaseId support to entry.create

* chore: add QueryParams to be consistent with release.entry.create

* fix: remove startDate from releasev2 payload [DX-380] (#2739)

* feat: remove release[lte] endpoint [TOL-3408] (#2747)

* feat: remove release[lte] endpoint

* fix: delete more old tests, fix return types

* fix(types): add release to entitymetasysprops [] (#2749)

* feat: add support for release asset endpoints [TOL-3357] (#2750)

* fix(types): add release to entitymetasysprops []

* feat(release-assets): add support for assets inside of a release [TOL-3357]

* fix(types): export ReleasePaylodV2 [] (#2754)

* fix: update types, add tests, and cleanup [DX-397] (#2755)

* chore: update experimental features in readme

---------

Co-authored-by: Ely Lucas <[email protected]>
Co-authored-by: ethan ozelius <[email protected]>
Co-authored-by: Tyler Pina <[email protected]>
Co-authored-by: Michael Pham <[email protected]>
Co-authored-by: MayaGillilan <[email protected]>
Co-authored-by: Chris Helgert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants