Skip to content

feat(user): support userId in invite and inviteBatch#696

Merged
yosiharan merged 4 commits intomainfrom
feat/invite-by-userid
Mar 24, 2026
Merged

feat(user): support userId in invite and inviteBatch#696
yosiharan merged 4 commits intomainfrom
feat/invite-by-userid

Conversation

@yosiharan
Copy link
Contributor

@yosiharan yosiharan commented Mar 18, 2026

Summary

  • Rename loginIdloginIdOrUserId in the invite function (both overloads and implementation) and the User batch type
  • Update transformUsersForBatch in helpers.ts to map loginIdOrUserId back to loginId on the wire
  • Add JSDoc comments explaining the userId re-invite behavior
  • Add test verifying that a userId-format string is passed through correctly as loginId in the request body

Related Issues and PRs

Depends On: https://github.com/descope/descope/pull/85
Resolves: https://github.com/descope/etc/issues/14641

🤖 Generated with Claude Code

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>
@yosiharan yosiharan marked this pull request as ready for review March 24, 2026 09:38
Copilot AI review requested due to automatic review settings March 24, 2026 09:38
Copy link
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 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 invite identifier parameter from loginId to loginIdOrUserId (overloads + implementation) and documents re-invite behavior.
  • Renames the batch User type field to loginIdOrUserId and updates transformUsersForBatch to map it back to loginId in 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.

yosiharan and others added 2 commits March 24, 2026 11:44
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>
@yosiharan yosiharan marked this pull request as draft March 24, 2026 10:22
@yosiharan yosiharan marked this pull request as ready for review March 24, 2026 10:30
@yosiharan yosiharan requested a review from dorsha March 24, 2026 10:33
@yosiharan yosiharan enabled auto-merge (squash) March 24, 2026 10:33
@yosiharan yosiharan merged commit 717dde6 into main Mar 24, 2026
27 checks passed
@yosiharan yosiharan deleted the feat/invite-by-userid branch March 24, 2026 10:49
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