Skip to content

refactor: migrate to use "plain client" CMA. [AIS-188]#2341

Draft
ethan ozelius (ethan-ozelius-contentful) wants to merge 2 commits into
mainfrom
cma-plain-client
Draft

refactor: migrate to use "plain client" CMA. [AIS-188]#2341
ethan ozelius (ethan-ozelius-contentful) wants to merge 2 commits into
mainfrom
cma-plain-client

Conversation

@ethan-ozelius-contentful

@ethan-ozelius-contentful ethan ozelius (ethan-ozelius-contentful) commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Refactor to use "plain" client of CMA

Description

  • lib/tasks/init-client.js: Dropped the { type: 'legacy' } second argument from createClient — plain client is now the default.
  • lib/tasks/get-space-data.js: Rewrote all CMA calls to use the flat plain client API:
    • client.getSpace() + space.getEnvironment() → client.space.get() + client.environment.get()
    • environment.getContentTypes(query) → client.contentType.getMany({ spaceId, environmentId, query })
    • Same pattern for tag, entry, asset, locale, webhook, role
    • contentType.getEditorInterface() → client.editorInterface.get({ spaceId, environmentId, contentTypeId })
    • pagedGet refactored to take a fetchFn(query) lambda instead of { source, method } — query params are now passed under the query key as the plain client expects
  • test/unit/tasks/get-space-data.test.js: Mocks updated to reflect the flat client.entity.method() structure.

@ethan-ozelius-contentful ethan ozelius (ethan-ozelius-contentful) changed the title refactor: migrate to use "plain client" CMA. refactor: migrate to use "plain client" CMA. [AIS-188] Jul 9, 2026
…IS-188]

The plain client's webhook.getMany and role.getMany pass query params directly
to the API, unlike the legacy space.getWebhooks() which silently dropped all
arguments. The webhook and roles endpoints reject 'order' with a 400 Bad Request.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants