feat(user): support userId in invite and inviteBatch#696
Merged
Conversation
Rename loginId → loginIdOrUserId in invite/inviteBatch so callers can pass either a loginId (creates user if not found) or a userId (resolves to the existing user's loginId and resends the invite, useful for re-inviting). The wire format is unchanged — loginId is still sent in the JSON body. Required For: descope/etc#14641 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dorsha
reviewed
Mar 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Management User invite APIs to accept either a loginId or a userId as the identifier, while keeping the wire payload field as loginId.
Changes:
- Renames the
inviteidentifier parameter fromloginIdtologinIdOrUserId(overloads + implementation) and documents re-invite behavior. - Renames the batch
Usertype field tologinIdOrUserIdand updatestransformUsersForBatchto map it back tologinIdin request bodies. - Updates/extends Jest tests to validate the new identifier behavior and updated batch shapes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/management/user.ts | Renames invite identifier parameter and adds JSDoc describing loginId vs userId behavior. |
| lib/management/helpers.ts | Updates batch user transform to emit loginId from loginIdOrUserId. |
| lib/management/types.ts | Renames batch User identifier field to loginIdOrUserId and adds documentation. |
| lib/management/user.test.ts | Adds/updates tests for invite(userId) and batch payload mapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keep loginId as a deprecated alias alongside the new loginIdOrUserId field using a union type (same pattern as PatchUserOptionsUsingIdentifier), so existing callers of createBatch/inviteBatch are not broken. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verify that inviteBatch and createBatch still correctly map the old loginId field to the wire payload, so JS consumers are not silently broken. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dorsha
approved these changes
Mar 24, 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.
Summary
loginId→loginIdOrUserIdin theinvitefunction (both overloads and implementation) and theUserbatch typetransformUsersForBatchinhelpers.tsto maploginIdOrUserIdback tologinIdon the wireloginIdin the request bodyRelated Issues and PRs
Depends On: https://github.com/descope/descope/pull/85
Resolves: https://github.com/descope/etc/issues/14641
🤖 Generated with Claude Code