feat(user): rename loginId to loginIdOrUserId in user management methods#691
Merged
feat(user): rename loginId to loginIdOrUserId in user management methods#691
Conversation
Renames the `loginId` parameter to `loginIdOrUserId` across 22 user management methods to clarify that both login IDs and user IDs are accepted identifiers, aligning with the go-sdk naming convention. The JSON field sent to the Descope API remains `loginId` unchanged. Adds `PatchUserOptionsUsingIdentifier` interface for `patchBatch` with backward-compatible deprecated `loginId` field. Resolves: descope/etc#14620 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add runtime guard in patchBatch throwing if neither loginIdOrUserId nor loginId is provided - Replace PatchUserOptionsUsingIdentifier interface with a union type that enforces at least one identifier at compile time - Add tests for deprecated loginId backward-compat path and missing identifier error - Revert update() overload 1 to single-line form (no-op formatting) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rage The main test now mixes loginIdOrUserId (user1, user2) and loginId (user3), covering backward compatibility inline without a separate test case. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…test The error is thrown synchronously inside Array.map before any promise is created, so rejects.toThrow() never receives a rejected promise. Switch to the synchronous expect(() => ...).toThrow() form. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR clarifies user-identifier semantics in the Management User API by renaming loginId parameters to loginIdOrUserId (while keeping the wire format as loginId) and adds a backward-compatible identifier type for batch patch operations.
Changes:
- Renames user-management method parameters from
loginIdtologinIdOrUserIdwhile continuing to sendloginIdto the API. - Updates patch helpers (
buildPatchRequestBody,patch,patchBatch) to use the new identifier naming. - Introduces
PatchUserOptionsUsingIdentifierforpatchBatch, adds backward-compat test coverage for the legacyloginIdfield, and adds an invalid-input test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/management/user.ts | Renames identifier parameters to loginIdOrUserId, updates patch helpers, and introduces a new batch-patch identifier type. |
| lib/management/user.test.ts | Updates patchBatch call sites to use loginIdOrUserId and adds tests for legacy loginId support and invalid input. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Return Promise.reject instead of throwing synchronously in patchBatch, so errors surface consistently via .catch() like other SDK methods - Update test to use rejects.toThrow now that error is promise-based - Fix extra closing brace in update() comment example - Update patchBatch JSDoc to mention both loginIdOrUserId and deprecated loginId - Add @deprecated JSDoc to loginId in PatchUserOptionsUsingIdentifier union type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
@dorsha All issues addressed, ready for re-review 🙏 |
dorsha
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Resolves: https://github.com/descope/etc/issues/14620
Summary
loginIdparameter tologinIdOrUserIdacross 22 user management methods to clarify that both login IDs and user IDs are accepted as identifiersloginIDOrUserID)loginId— no wire-format changePatchUserOptionsUsingIdentifierinterface forpatchBatchwith backward-compatible deprecatedloginIdfieldMethods with renamed parameter:
🤖 Generated with Claude Code