Skip to content

Support user id in API methods#143

Open
gohabereg wants to merge 2 commits into
feature/model-apifrom
feature/api-user-id
Open

Support user id in API methods#143
gohabereg wants to merge 2 commits into
feature/model-apifrom
feature/api-user-id

Conversation

@gohabereg
Copy link
Copy Markdown
Member

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

⏭️ No files to mutate for ./packages/model

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

⏭️ No files to mutate for ./packages/core

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

⏭️ No files to mutate for ./packages/dom-adapters

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Coverage report for ./packages/dom-adapters

St.
Category Percentage Covered / Total
🟢 Statements 96.43% 27/28
🟢 Branches 86.96% 20/23
🟢 Functions 100% 5/5
🟢 Lines 96.43% 27/28

Test suite run success

11 tests passing in 2 suites.

Report generated by 🧪jest coverage report action from a5d2c36

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Coverage report for ./packages/core

St.
Category Percentage Covered / Total
🟢 Statements 90.41% 132/146
🟢 Branches
91.94% (-4.14% 🔻)
57/62
🟡 Functions 69.23% 27/39
🟢 Lines 89.78% 123/137
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡 api/BlocksAPI.ts 70%
76.92% (-23.08% 🔻)
57.14% 68.42%

Test suite run success

75 tests passing in 7 suites.

Report generated by 🧪jest coverage report action from a5d2c36

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Coverage report for ./packages/model

St.
Category Percentage Covered / Total
🟢 Statements 99.8% 988/990
🟢 Branches 98.98% 292/295
🟢 Functions 97.45% 229/235
🟢 Lines 99.79% 948/950

Test suite run success

538 tests passing in 25 suites.

Report generated by 🧪jest coverage report action from a5d2c36

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Coverage report for ./packages/ot-server

St.
Category Percentage Covered / Total
🟡 Statements 70.97% 22/31
🔴 Branches 20% 1/5
🟡 Functions 75% 6/8
🟡 Lines 68.97% 20/29

Test suite run success

4 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from a5d2c36

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Coverage report for ./packages/collaboration-manager

St.
Category Percentage Covered / Total
🟢 Statements 92.51% 358/387
🟢 Branches 85.51% 118/138
🟢 Functions 98.15% 53/54
🟢 Lines 92.41% 353/382

Test suite run success

117 tests passing in 7 suites.

Report generated by 🧪jest coverage report action from a5d2c36

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an optional userId parameter to the public SDK API methods (BlocksAPI and TextAPI) and threads it through the core implementations and the underlying BlocksManager. When omitted, the API falls back to the user id stored in the core config, preserving existing behavior. This allows callers to attribute mutations to a specific user (e.g., for collaborative editing scenarios) without having to instantiate a different API.

Changes:

  • Extend SDK BlocksAPI and TextAPI interfaces with an optional userId?: string | number field on all mutating methods.
  • Plumb userId through core BlocksAPI/TextAPI to BlocksManager/EditorJSModel, defaulting to this.#config.userId.
  • Update BlocksAPI unit tests to include userId in the config and assert it is forwarded to BlocksManager.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/sdk/src/api/TextAPI.ts Adds UserIdParam mixin and applies it to insert/remove/format/unformat signatures.
packages/sdk/src/api/BlocksAPI.ts Adds optional userId to insert/delete/move/insertMany/removeData/createData/updateValue parameter objects.
packages/core/src/components/BlockManager.ts Accepts optional userId in insert/insertMany/deleteBlock/move, defaulting to config; forwards to model.
packages/core/src/api/TextAPI.ts Destructures userId from params (defaulting to config) and forwards to model calls.
packages/core/src/api/BlocksAPI.ts Destructures userId from params (defaulting to config) and forwards to manager/model calls.
packages/core/src/api/BlocksAPI.spec.ts Updates tests to include userId in config and assertions to verify forwarding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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