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 MAPI resolver #54

Merged
merged 9 commits into from
Aug 22, 2024
Merged

Add MAPI resolver #54

merged 9 commits into from
Aug 22, 2024

Conversation

pokornyd
Copy link
Member

Motivation

DEVREL-1172

Adds transformation logic from portable text to MAPI valid rich text.

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

If manual testing is required, what are the steps?

@pokornyd pokornyd requested review from IvanKiral and a team as code owners August 19, 2024 08:49
@pokornyd pokornyd force-pushed the DEVREL-1172/add-mapi-resolver branch from f3ee9e4 to 7febf1a Compare August 19, 2024 12:51
@pokornyd pokornyd force-pushed the DEVREL-1172/add-mapi-resolver branch from 7febf1a to 64fc52e Compare August 19, 2024 20:04
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 91.76471% with 21 lines in your changes missing coverage. Please review.

Project coverage is 93.05%. Comparing base (850bd38) to head (64fc52e).
Report is 18 commits behind head on main.

Files Patch % Lines
src/utils/common-utils.ts 68.42% 6 Missing ⚠️
src/utils/resolution/mapi.ts 78.57% 6 Missing ⚠️
...able-text-transformer/portable-text-transformer.ts 95.90% 5 Missing ⚠️
src/parser/browser/rich-text-browser-parser.ts 80.00% 1 Missing ⚠️
src/parser/node/rich-text-node-parser.ts 83.33% 1 Missing ⚠️
.../transformers/json-transformer/json-transformer.ts 92.30% 1 Missing ⚠️
src/utils/transformer-utils.ts 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
- Coverage   94.79%   93.05%   -1.74%     
==========================================
  Files          19       21       +2     
  Lines         365      360       -5     
  Branches       68       82      +14     
==========================================
- Hits          346      335      -11     
- Misses         19       25       +6     

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

package.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/utils/resolution/mapi.ts Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
src/utils/resolution/mapi.ts Show resolved Hide resolved
src/utils/resolution/mapi.ts Show resolved Hide resolved
src/utils/transformer-utils.ts Outdated Show resolved Hide resolved
@pokornyd pokornyd force-pushed the DEVREL-1172/add-mapi-resolver branch from 94db595 to c4d8010 Compare August 21, 2024 08:38
}
}

return throwError("Cannot parse a node that is not a root node.");
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry for confusion, I wanted you to use this function only with ternary operators :D Here I would prefer to the normal

throw new Error("Cannot parse a node that is not a root node.")

return [block];
}
const transformImage: TransformElementFunction<FigureElementAttributes> = (node) => {
const imageTag = node.children[0] as DomHtmlNode<ImgElementAttributes> | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

this is still not correct, it would be better to use some kind of typeguard or conditions at least that the tagName really is in the image tag, even though this code will actually behave kind of correctly, it's still kind of feels a workaround :/

@pokornyd pokornyd force-pushed the DEVREL-1172/add-mapi-resolver branch from c4d8010 to 92c30c7 Compare August 21, 2024 11:51
@pokornyd pokornyd merged commit 97808ea into main Aug 22, 2024
1 check passed
@pokornyd pokornyd deleted the DEVREL-1172/add-mapi-resolver branch August 22, 2024 07:41
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