You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(client): Remove REST Page API from client.page.get (#32098)
This pull request focuses on transitioning the codebase to use the
updated `DotCMSPageResponse` type instead of the deprecated
`DotCMSEditablePage` and `DotCMSGraphQLPageResponse` types, while also
centralizing shared types into `@dotcms/types`. The changes span across
multiple files, including service implementations, tests, and client
APIs, with the goal of improving type consistency and maintainability.
### Transition to `DotCMSPageResponse` Type:
* Updated the `DotPageApiService` to replace `DotCMSGraphQLPageResponse`
with `DotCMSPageResponse` for type annotations and method calls.
(`dot-page-api.service.ts`,
[[1]](diffhunk://#diff-9acb0e7dc2619395c49047164381778d2b6d6c41f58b30aa3cd6a798044007c6L20-R20)
[[2]](diffhunk://#diff-9acb0e7dc2619395c49047164381778d2b6d6c41f58b30aa3cd6a798044007c6L202-R202)
* Refactored `DotCMSEditablePageService` to use `DotCMSPageResponse` for
internal subjects, observables, and mock data in both implementation and
tests. (`dotcms-editable-page.service.ts`,
[[1]](diffhunk://#diff-08ba5e2ca6377757a25ae71539af956c5b47f9f6b918a74bdca06a1e23b7438dL20-R28)
[[2]](diffhunk://#diff-08ba5e2ca6377757a25ae71539af956c5b47f9f6b918a74bdca06a1e23b7438dL63-R62);
`dotcms-editable-page.service.spec.ts`,
[[3]](diffhunk://#diff-9e99be6093c44be0c1ff531e7f2eee75185a56c63cd07e9ec60b8db26d98ccf4L26-R34)
[[4]](diffhunk://#diff-9e99be6093c44be0c1ff531e7f2eee75185a56c63cd07e9ec60b8db26d98ccf4L74-R70)
[[5]](diffhunk://#diff-9e99be6093c44be0c1ff531e7f2eee75185a56c63cd07e9ec60b8db26d98ccf4L87-R83)
[[6]](diffhunk://#diff-9e99be6093c44be0c1ff531e7f2eee75185a56c63cd07e9ec60b8db26d98ccf4L97-R93)
### Centralization of Shared Types:
* Removed redundant type definitions (e.g., `ContentTypeMainFields` and
`Contentlet`) from the SDK and replaced them with imports from
`@dotcms/types`. (`types.ts`,
[[1]](diffhunk://#diff-c8387d8c19477cb41407db77d2aa1068000323ec8c3ddc4390f2b1d791bff64bR1-R2)
[[2]](diffhunk://#diff-c8387d8c19477cb41407db77d2aa1068000323ec8c3ddc4390f2b1d791bff64bL27-L70)
* Consolidated `DotCMSClientConfig`, `RequestOptions`, and other shared
types into `@dotcms/types` and updated imports across client modules.
(`client.ts`,
[[1]](diffhunk://#diff-aa54238655bef05cdd48772e24046f2105dd74b1a20fac91e0b3ca610e3095a6R1-L38);
`content-api.ts`,
[[2]](diffhunk://#diff-7c81d474bc4a2de176c90dd7fc5a3b5584095ce7e19a8ae8e60e1f403f8344feL1-R3);
`navigation-api.ts`,
[[3]](diffhunk://#diff-ccca05575b5095ec6e63c7a7d3be4723cc9ed76a5ddf12197c6ad456b5785dc7L1-R1);
`page-api.spec.ts`,
[[4]](diffhunk://#diff-39f9fdbb6ffc97cc19b942165b9a66d212e4ab0d0e900b639687e28c393be0bcL2-L13)
### Cleanup and Simplification:
* Removed unused or redundant imports and mock implementations in test
files, such as `jest.mock` calls and mock data for deprecated types.
(`navigation-api.spec.ts`,
[[1]](diffhunk://#diff-6efa73174333c167644002586b5144107991d3c681a0bd0e982aefe0eeeca7a5L1-R3);
`page-api.spec.ts`,
[[2]](diffhunk://#diff-39f9fdbb6ffc97cc19b942165b9a66d212e4ab0d0e900b639687e28c393be0bcL28-L40)
[[3]](diffhunk://#diff-39f9fdbb6ffc97cc19b942165b9a66d212e4ab0d0e900b639687e28c393be0bcL58-L67)
* Simplified type annotations and method parameters in client APIs to
use centralized types like `DotCMSNavigationRequestParams`.
(`navigation-api.ts`,
[[1]](diffhunk://#diff-ccca05575b5095ec6e63c7a7d3be4723cc9ed76a5ddf12197c6ad456b5785dc7L37-R19)
[[2]](diffhunk://#diff-ccca05575b5095ec6e63c7a7d3be4723cc9ed76a5ddf12197c6ad456b5785dc7L59-R41)
These changes collectively enhance type safety, reduce redundancy, and
align the codebase with the latest `@dotcms/types` definitions.
If you are updating from a version that is lower than `0.0.1-beta.29`, be aware that the response from the `client.page.get` method changed the access to the page value from `page` to `pageAsset`.
134
+
This change was made to avoid redundancy on access inside of `page` object.
0 commit comments