PLUG-131: Add shareDiagram API to Mermaid Chart SDK - #51
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
🟡 Changes recommended
The new shareDiagram() API is not covered by the existing unit test suite patterns used for other SDK methods, increasing regression risk for the endpoint URL and request payload shape.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new SDK surface area for generating diagram share links (and optionally emailing invites) by introducing a /rest-api/documents/:documentID/share URL helper, associated request/response types, and a MermaidChart.shareDiagram() method.
Changes:
- Added
shareURL helper underURLS.rest.documents.pick(...)for/rest-api/documents/:documentID/share. - Introduced
ShareDiagramAccess,ShareDiagramRequest, andShareDiagramResponsetypes and wired them into the SDK entrypoint. - Added
MermaidChart.shareDiagram(documentID, request)plus bumped the SDK version to0.2.8.
File summaries
| File | Description |
|---|---|
| packages/sdk/src/urls.ts | Adds a share REST URL helper for document sharing. |
| packages/sdk/src/types.ts | Defines share-link request/response types and access-level union. |
| packages/sdk/src/index.ts | Exposes share types and adds MermaidChart.shareDiagram() API method. |
| packages/sdk/package.json | Bumps SDK version to 0.2.8. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
A formatting issue in the newly added types section is likely to fail Prettier/lint checks.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
packages/sdk/src/types.ts:202
- There are two consecutive blank lines between ShareDiagramRequest and ShareDiagramResponse; this will likely fail
prettier --checkand should be reduced to a single blank line.
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The SDK version is being manually bumped despite the repo using Changesets to generate version bumps in a separate “Version Packages” PR, which can lead to release/versioning conflicts.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The changeset description should be corrected to accurately reflect the SDK feature being released.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
.changeset/fluffy-birds-vanish.md:5
- Changeset note is inaccurate/unclear for release notes (mentions “mermaid commercial plugin” rather than the SDK/API being added). Suggest rewording to describe the new
shareDiagramAPI in the Mermaid Chart SDK.
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
A few public-facing docs/release notes should be corrected to accurately reflect the SDK API scope and the emailAddresses invite capability.
Review details
Suppressed comments (4)
Previously missed (3) — in code that hasn't changed since the last review.
.changeset/fluffy-birds-vanish.md:5
- The changeset summary mentions a "commercial plugin", but this PR adds a shareDiagram API to the SDK itself. Updating the summary will make the release note accurate for SDK consumers.
packages/sdk/src/index.ts:328 - The JSDoc for
requestmentions only access level, butShareDiagramRequestalso supportsemailAddressesfor sending invites. Updating this docstring avoids hiding that functionality from SDK consumers.
packages/sdk/src/types.ts:199 - ShareDiagramRequest is part of the public SDK types, but unlike nearby request interfaces in this file it lacks field-level JSDoc. Adding brief comments keeps the type docs consistent and improves editor IntelliSense for
accessandemailAddresses.
This issue also appears on line 201 of the same file.
packages/sdk/src/types.ts:205
- ShareDiagramResponse is missing the short property docs that other response types in this file include. Adding JSDoc clarifies what
emailsSentcontains and makes the response shape self-documenting.
export interface ShareDiagramResponse {
shareUrl: string;
access: ShareDiagramAccess;
emailsSent?: string[];
}
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
Adds
shareDiagram(documentID, request)to the SDK, along withShareDiagramRequest/ShareDiagramResponsetypes and the/rest-api/documents/:documentID/shareURL helper, so clients can generate a share link and optionally send email invites.