Skip to content

Conversation

@tmilewski
Copy link
Member

@tmilewski tmilewski commented Sep 10, 2025

Description

Adds the ability to create bulk invitations.

Fixes USER-2627

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Bulk invitation creation is now supported.
    • Template selection is optional when creating invitations.
  • Documentation

    • Added guidance for bulk invitation creation.
  • Chores

    • Prepared a minor version release for the backend package.

@tmilewski tmilewski self-assigned this Sep 10, 2025
@changeset-bot
Copy link

changeset-bot bot commented Sep 10, 2025

🦋 Changeset detected

Latest commit: c36dbe2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/backend Minor
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Sep 10, 2025 5:06pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 10, 2025

Walkthrough

Adds a changeset for @clerk/backend and extends InvitationAPI with bulk invitation creation via createInvitationBulk(params[]); makes templateSlug optional in CreateParams and introduces CreateBulkParams as an array of CreateParams. No other endpoint behaviors changed.

Changes

Cohort / File(s) Summary
Release / Changeset
/.changeset/full-ducks-run.md
Adds a changeset bumping @clerk/backend minor version; documents new bulk invitation creation capability via .createInvitationBulk([{...}]).
Backend Invitation API
/packages/backend/src/api/endpoints/InvitationApi.ts
Makes templateSlug optional in CreateParams; introduces CreateBulkParams (array of CreateParams); adds InvitationAPI.createInvitationBulk(params) which POSTs bulk payload to the invitations base path; other methods unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Caller (App/Server)
  participant S as InvitationAPI (Backend SDK)
  participant HTTP as HTTP Client
  participant B as Clerk Backend

  rect rgba(230,247,255,0.6)
    note over C,S: New flow — bulk invitation creation
    C->>S: createInvitationBulk(params[])
    S->>HTTP: POST /invitations (bulk payload)
    HTTP->>B: Request
    B-->>HTTP: 201 Created (bulk response)
    HTTP-->>S: Parsed response (Invitation[])
    S-->>C: Result (Invitation[])
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks (5 passed)

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely describes the introduction of bulk invitation creation in the backend SDK, directly reflecting the main change without extraneous details.
Linked Issues Check ✅ Passed The pull request adds the createInvitationBulk method with appropriate CreateBulkParams and posts to the REST API endpoint as specified in USER-2627, fulfilling the core coding requirement for bulk invitations in the backend SDK.
Out of Scope Changes Check ✅ Passed All modifications are scoped to adding the bulk invitation feature and its associated changelog entry, and no unrelated files or functionality have been altered.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I twitch my nose and tally paws,
A dozen carrots sent because—
One hop, one call, the warren sings,
Invitations on speedy wings.
Bulked and bundled, off they go, hooray! 🥕🐇


📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8761c39 and c36dbe2.

📒 Files selected for processing (1)
  • packages/backend/src/api/endpoints/InvitationApi.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/backend/src/api/endpoints/InvitationApi.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tm/user-2627-create-bulk-invites

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 10, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6751

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6751

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6751

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6751

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6751

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6751

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6751

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6751

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6751

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6751

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6751

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6751

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6751

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6751

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6751

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6751

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6751

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6751

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6751

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6751

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6751

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6751

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6751

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6751

commit: c36dbe2

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.changeset/full-ducks-run.md (1)

5-6: Clarify return shape in the changeset entry.

The API likely returns multiple invitations for a bulk call; consider explicitly documenting the return value (e.g., “returns Invitation[]”) to set the right expectations for consumers.

packages/backend/src/api/endpoints/InvitationApi.ts (1)

23-24: Make bulk params immutable and export the type.

Small DX improvement: prefer a readonly array and export the type for reuse in apps.

Apply:

-type CreateBulkParams = Array<CreateParams>;
+export type CreateBulkParams = ReadonlyArray<CreateParams>;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b598581 and 8761c39.

📒 Files selected for processing (2)
  • .changeset/full-ducks-run.md (1 hunks)
  • packages/backend/src/api/endpoints/InvitationApi.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/full-ducks-run.md
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/backend/src/api/endpoints/InvitationApi.ts (1)

20-21: Confirm templateSlug is a valid BAPI field for application invitations.

This param isn’t documented in the public createInvitation() docs. Please verify it’s supported server-side to avoid silent no-ops or 4xx responses. If internal-only, add JSDoc to mark it experimental.

For reference, public docs list the supported fields and do not include templateSlug. (clerk.com)

@tmilewski tmilewski enabled auto-merge (squash) September 10, 2025 17:05
@tmilewski tmilewski merged commit 7382e13 into main Sep 10, 2025
40 checks passed
@tmilewski tmilewski deleted the tm/user-2627-create-bulk-invites branch September 10, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants