Support user id in API methods#143
Conversation
|
⏭️ No files to mutate for |
|
⏭️ No files to mutate for |
|
⏭️ No files to mutate for |
Coverage report for
|
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
Coverage report for
|
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
Coverage report for
|
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
Coverage report for
|
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
Coverage report for
|
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
There was a problem hiding this comment.
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
BlocksAPIandTextAPIinterfaces with an optionaluserId?: string | numberfield on all mutating methods. - Plumb
userIdthrough coreBlocksAPI/TextAPItoBlocksManager/EditorJSModel, defaulting tothis.#config.userId. - Update
BlocksAPIunit tests to includeuserIdin the config and assert it is forwarded toBlocksManager.
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.
No description provided.