Skip to content
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

Add support for MAPI format #45

Merged
merged 9 commits into from
Apr 8, 2024
Merged

Add support for MAPI format #45

merged 9 commits into from
Apr 8, 2024

Conversation

pokornyd
Copy link
Member

Motivation

Adjusts transformation logic for assets and components/linked items so that their representation in management API can also be parsed and transformed. Adds a new dataType attribute to PortableTextComponent in order to differentiate between components and linked items.

Important

HTML attributes on object tag are used to differentiate between linked items and components in the rich text.

In DAPI, data-rel is used with either component or link value, data-type is item in both cases
In MAPI, data-type is used with either item or component value, data-rel is not present

For simplicity, I unionized all three possible values as a type for dataType property, to mirror the API response.
Should we consider adding logic to determine whether the representation is DAPI/MAPI and get rid of the redundant third value (i.e. using only item | component)?

Checklist

  • Code follows coding conventions held in this repo
  • Automated tests have been added
  • Tests are passing
  • Docs have been updated (if applicable)
  • Temporary settings (e.g. variables used during development and testing) have been reverted to defaults

How to test

Try transforming an output from management API with all the Kontent.ai specific objects (links, components, linked items, assets...).

@pokornyd pokornyd added this to the 1.1.0 milestone Mar 13, 2024
@pokornyd pokornyd requested review from IvanKiral and a team as code owners March 13, 2024 19:08
@IvanKiral
Copy link
Contributor

also plz fix lint

Copy link

codecov bot commented Apr 2, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 94.80%. Comparing base (850bd38) to head (8da1dab).

Files Patch % Lines
src/utils/common-utils.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
+ Coverage   94.79%   94.80%   +0.01%     
==========================================
  Files          19       19              
  Lines         365      366       +1     
  Branches       68       71       +3     
==========================================
+ Hits          346      347       +1     
  Misses         19       19              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/parser/parser-models.ts Outdated Show resolved Hide resolved
src/utils/common-utils.ts Show resolved Hide resolved
src/utils/common-utils.ts Show resolved Hide resolved
@pokornyd pokornyd requested a review from IvanKiral April 5, 2024 09:49
@pokornyd pokornyd merged commit e6f3908 into main Apr 8, 2024
2 of 3 checks passed
@pokornyd pokornyd deleted the mapi-support branch April 8, 2024 10:27
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