Skip to content

feat(user): rename loginId to loginIdOrUserId in user management methods#691

Merged
yosiharan merged 10 commits intomainfrom
feat/rename-loginid-to-loginidoruserid
Mar 17, 2026
Merged

feat(user): rename loginId to loginIdOrUserId in user management methods#691
yosiharan merged 10 commits intomainfrom
feat/rename-loginid-to-loginidoruserid

Conversation

@yosiharan
Copy link
Copy Markdown
Contributor

@yosiharan yosiharan commented Mar 17, 2026

Related Issues

Resolves: https://github.com/descope/etc/issues/14620

Summary

  • Renames the loginId parameter to loginIdOrUserId across 22 user management methods to clarify that both login IDs and user IDs are accepted as identifiers
  • Aligns naming with the go-sdk convention (loginIDOrUserID)
  • The JSON field sent to the Descope API remains loginId — no wire-format change
  • Adds PatchUserOptionsUsingIdentifier interface for patchBatch with backward-compatible deprecated loginId field

Methods with renamed parameter:

     ✓  activate                     → loginIdOrUserId
     ✓  addRoles                     → loginIdOrUserId
     ✓  addSSOApps                   → loginIdOrUserId
     ✓  addTenant                    → loginIdOrUserId
     ✓  addTenantRoles               → loginIdOrUserId
     ✓  deactivate                   → loginIdOrUserId
     ✓  delete                       → loginIdOrUserId
     ✓  load                         → loginIdOrUserId
     ✓  patch                        → loginIdOrUserId
     ✓  removeRoles                  → loginIdOrUserId
     ✓  removeSSOApps                → loginIdOrUserId
     ✓  removeTenant                 → loginIdOrUserId
     ✓  removeTenantRoles            → loginIdOrUserId
     ✓  setRoles                     → loginIdOrUserId
     ✓  setSSOApps                   → loginIdOrUserId
     ✓  setTenantRoles               → loginIdOrUserId
     ✓  update                       → loginIdOrUserId
     ✓  updateCustomAttribute        → loginIdOrUserId
     ✓  updateDisplayName            → loginIdOrUserId
     ✓  updateEmail                  → loginIdOrUserId
     ✓  updatePhone                  → loginIdOrUserId
     ✓  updatePicture                → loginIdOrUserId
     ✓  updateUserNames              → loginIdOrUserId

🤖 Generated with Claude Code

yosiharan and others added 6 commits March 17, 2026 12:27
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>
@yosiharan yosiharan marked this pull request as ready for review March 17, 2026 11:03
Copilot AI review requested due to automatic review settings March 17, 2026 11:04
@yosiharan yosiharan enabled auto-merge (squash) March 17, 2026 11:04
@yosiharan yosiharan requested a review from dorsha March 17, 2026 11:04
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

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 loginId to loginIdOrUserId while continuing to send loginId to the API.
  • Updates patch helpers (buildPatchRequestBody, patch, patchBatch) to use the new identifier naming.
  • Introduces PatchUserOptionsUsingIdentifier for patchBatch, adds backward-compat test coverage for the legacy loginId field, 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.

dorsha
dorsha previously approved these changes Mar 17, 2026
Copy link
Copy Markdown
Member

@dorsha dorsha left a comment

Choose a reason for hiding this comment

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

Check other review comments.

yosiharan and others added 2 commits March 17, 2026 13:57
- 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>
@yosiharan yosiharan requested a review from dorsha March 17, 2026 12:15
@yosiharan
Copy link
Copy Markdown
Contributor Author

@dorsha All issues addressed, ready for re-review 🙏

@yosiharan yosiharan merged commit f22b8b0 into main Mar 17, 2026
27 checks passed
@yosiharan yosiharan deleted the feat/rename-loginid-to-loginidoruserid branch March 17, 2026 13:12
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.

3 participants