Skip to content

Commit c9ba489

Browse files
committed
fix(sdk): make id in setDocument() optional
1 parent b5ac9e4 commit c9ba489

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/sdk/src/index.e2e.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ describe('setDocument', () => {
8484

8585
await client.setDocument({
8686
documentID: newDocument.documentID,
87-
id: newDocument.id, // diagram ID
8887
projectID: newDocument.projectID,
8988
title: "@mermaidchart/sdk E2E test diagram",
9089
code,
@@ -106,8 +105,8 @@ describe('setDocument', () => {
106105

107106
await expect(client.setDocument({
108107
documentID: newDocument.documentID,
109-
// @ts-expect-error not setting diagram `id` should throw an error
110-
id: null,
108+
// @ts-expect-error not setting diagram `projectID` should throw an error
109+
projectID: null,
111110
})).rejects.toThrowError("400"); // should throw HTTP 400 error
112111
});
113112
});

packages/sdk/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export class MermaidChart {
210210
* @param document The document to update.
211211
*/
212212
public async setDocument(
213-
document: Pick<MCDocument, 'id' | 'documentID' | 'projectID'> & Partial<MCDocument>,
213+
document: Pick<MCDocument, 'documentID' | 'projectID'> & Partial<MCDocument>,
214214
) {
215215
const {data} = await this.axios.put<{result: "ok"} | {result: "failed", error: any}>(
216216
URLS.rest.documents.pick(document).self,

0 commit comments

Comments
 (0)