Skip to content

chore(shared): Add JSDocs to all organization resources#8748

Open
LauraBeatris wants to merge 3 commits into
mainfrom
laura/add-jsdocs-org-resources
Open

chore(shared): Add JSDocs to all organization resources#8748
LauraBeatris wants to merge 3 commits into
mainfrom
laura/add-jsdocs-org-resources

Conversation

@LauraBeatris
Copy link
Copy Markdown
Member

@LauraBeatris LauraBeatris commented Jun 4, 2026

Description

This PR introduces JSDocs coverage on all types from organization resources to improve docs generation

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

    • Added reject() method to organization membership requests for improved request handling.
  • Documentation

    • Expanded JSDoc documentation for organization-related resource types to improve API reference clarity.

@LauraBeatris LauraBeatris self-assigned this Jun 4, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jun 5, 2026 1:01am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 4, 2026

🦋 Changeset detected

Latest commit: 581b5c2

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

This PR includes changesets to release 20 packages
Name Type
@clerk/shared Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/expo-passkeys Patch
@clerk/expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/ui Patch
@clerk/vue 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

@LauraBeatris LauraBeatris changed the title chore(shared): Add JSDoc to all organization resources chore(shared): Add JSDocs to all organization resources Jun 4, 2026
@LauraBeatris LauraBeatris marked this pull request as ready for review June 4, 2026 01:05
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 4, 2026

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8748

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8748

@clerk/upgrade

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

@clerk/vue

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

commit: 581b5c2

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

API Changes Report

Generated by Break Check on 2026-06-05T01:04:40.413Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 2
🔴 Breaking changes 1
🟡 Non-breaking changes 5
🟢 Additions 0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

Note
Break Check could not snapshot 3 subpaths; the diff below excludes them.

  • @clerk/astro ./env: Internal Error: Unable to determine module for: /home/runner/_work/javascript/javascript/packages/astro/env.d.ts You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
  • @clerk/shared ./cookie: Internal Error: Unable to follow symbol for "Cookies" You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
  • @clerk/testing ./cypress: Symbol not found for identifier: Cypress

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

Package Subpath Change
@clerk/shared ./types OrganizationSettingsResource.__internal_toSnapshot

@clerk/shared

Current version: 4.15.0
Recommended bump: MAJOR → 5.0.0

Subpath ./types

🔴 Breaking Changes (1)

Changed: OrganizationSettingsResource.__internal_toSnapshot
- __internal_toSnapshot: () => OrganizationSettingsJSONSnapshot;

Static analyzer: Removed property OrganizationSettingsResource.__internal_toSnapshot

🤖 AI review (confirmed) (95%): The property __internal_toSnapshot was removed from OrganizationSettingsResource; any consumer code calling resource.__internal_toSnapshot() will fail to compile.

Migration: Remove all calls to __internal_toSnapshot() on OrganizationSettingsResource; if snapshot data is still needed, construct the equivalent plain object manually from the resource's public properties.

🟡 Non-breaking Changes (1)

Modified: OrganizationDomainVerification.strategy
- strategy: 'email_code';
+ strategy: OrganizationDomainVerificationStrategy;

Static analyzer: Breaking change in property OrganizationDomainVerification.strategy: Type changed: strategy:'email_code';strategy:import("@clerk/shared").~OrganizationDomainVerificationStrategy;

🤖 AI review (reclassified as non-breaking) (85%): The change widens strategy from the literal 'email_code' to OrganizationDomainVerificationStrategy; if that alias includes 'email_code' as a member (i.e. is a union of string literals), consumers reading this output field still receive a compatible value, and consumers narrowing against 'email_code' continue to compile. Without the full definition of OrganizationDomainVerificationStrategy this is slightly uncertain, but a strategy type that omits the previously-sole literal would be an unusual regression — the alias most likely broadens the type, which is safe for an output property.

Subpath ./apiUrlFromPublishableKey

🟡 Non-breaking Changes (1)

Modified: apiUrlFromPublishableKey
- apiUrlFromPublishableKey: (publishableKey: string) => "https://api.clerk.com" | "https://api.lclclerk.com" | "https://api.clerkstage.dev"
+ apiUrlFromPublishableKey: (publishableKey: string) => "https://api.lclclerk.com" | "https://api.clerkstage.dev" | "https://api.clerk.com"

Static analyzer: Breaking change in function apiUrlFromPublishableKey: Return type changed: "https://api.clerk.com"|"https://api.lclclerk.com"|"https://api.clerkstage.dev""https://api.lclclerk.com"|"https://api.clerkstage.dev"|"https://api.clerk.com"

🤖 AI review (reclassified as non-breaking) (99%): The return type is a union of the exact same three string literal members; reordering union members does not change the resolved type or any consumer code that handles it.


@clerk/astro

Current version: 3.3.3
Recommended bump: MINOR → 3.4.0

Subpath ./client

🟡 Non-breaking Changes (3)

Modified: $authStore
  $authStore: nanostores.ReadableAtom<{
      userId: string | null | undefined;
-     user: _clerk_shared__chunks_index_PY1DuvnM.gs | null | undefined;
+     user: _clerk_shared__chunks_index_DvogwjQs.gs | null | undefined;
      sessionId: string | null | undefined;
-     session: _clerk_shared__chunks_index_PY1DuvnM.ts | null | undefined;
+     session: _clerk_shared__chunks_index_DvogwjQs.ts | null | undefined;
      sessionStatus: "active" | "pending" | undefined;
-     sessionClaims: _clerk_shared__chunks_index_PY1DuvnM.io | null | undefined;
-     organization: _clerk_shared__chunks_index_PY1DuvnM.wo | null | undefined;
+     sessionClaims: _clerk_shared__chunks_index_DvogwjQs.io | null | undefined;
+     organization: _clerk_shared__chunks_index_DvogwjQs.wo | null | undefined;
      orgId: string | null | undefined;
      orgRole: string | null | undefined;
      orgSlug: string | null | undefined;
-     orgPermissions: _clerk_shared__chunks_index_PY1DuvnM.bm<_clerk_shared__chunks_index_PY1DuvnM.do>[] | null | undefined;
-     actor: _clerk_shared__chunks_index_PY1DuvnM.$a | null | undefined;
+     orgPermissions: _clerk_shared__chunks_index_DvogwjQs.bm<_clerk_shared__chunks_index_DvogwjQs.do>[] | null | undefined;
+     actor: _clerk_shared__chunks_index_DvogwjQs.$a | null | undefined;
      factorVerificationAge: [number, number] | null;
  }>

Static analyzer: Breaking change in variable $authStore: Type changed: $authStore:import("nanostores").ReadableAtom<{userId:string|null|undefined;user:!_clerk_shared__chunks_index_PY1DuvnM.g…$authStore:import("nanostores").ReadableAtom<{userId:string|null|undefined;user:!_clerk_shared__chunks_index_DvogwjQs.g…

🤖 AI review (reclassified as non-breaking) (85%): The only change is a rename of the internal chunk file hash (PY1DuvnMDvogwjQs) used as a namespace alias; the structural shape of every property in the ReadableAtom type parameter is identical between before and after, so no well-typed consumer code is affected.

Modified: $organizationStore
- $organizationStore: nanostores.ReadableAtom<_clerk_shared__chunks_index_PY1DuvnM.wo | null | undefined>
+ $organizationStore: nanostores.ReadableAtom<_clerk_shared__chunks_index_DvogwjQs.wo | null | undefined>

Static analyzer: Breaking change in variable $organizationStore: Type changed: $organizationStore:import("nanostores").ReadableAtom<!_clerk_shared__chunks_index_PY1DuvnM.wo:type|null|undefined>$organizationStore:import("nanostores").ReadableAtom<!_clerk_shared__chunks_index_DvogwjQs.wo:type|null|undefined>

🤖 AI review (reclassified as non-breaking) (85%): The change is purely a rename of the internal chunk file hash in the namespace alias (PY1DuvnMDvogwjQs); the resolved type wo exposed to consumers is structurally unchanged.

Modified: $userStore
- $userStore: nanostores.ReadableAtom<_clerk_shared__chunks_index_PY1DuvnM.gs | null | undefined>
+ $userStore: nanostores.ReadableAtom<_clerk_shared__chunks_index_DvogwjQs.gs | null | undefined>

Static analyzer: Breaking change in variable $userStore: Type changed: $userStore:import("nanostores").ReadableAtom<!_clerk_shared__chunks_index_PY1DuvnM.gs:type|null|undefined>$userStore:import("nanostores").ReadableAtom<!_clerk_shared__chunks_index_DvogwjQs.gs:type|null|undefined>

🤖 AI review (reclassified as non-breaking) (85%): The change is purely a rename of the internal chunk file hash in the namespace alias (PY1DuvnMDvogwjQs); the resolved type gs exposed to consumers is structurally unchanged.


Report generated by Break Check

Last ran on 581b5c2. Pushes that change no tracked declarations (no API surface change vs. base) are skipped and don't update this comment.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds comprehensive JSDoc documentation to organization-related resource types in @clerk/shared to improve Typedoc-generated API documentation. Two structural changes are included: OrganizationDomainVerification.strategy now uses a dedicated OrganizationDomainVerificationStrategy type instead of an inline literal, and OrganizationMembershipRequestResource adds a reject() method. Documentation is expanded across all seven organization type files with field-level, method-level, and parameter descriptions. The package is released as a patch version.

Changes

Organization types documentation improvements

Layer / File(s) Summary
Type refinements and added method
packages/shared/src/types/organizationDomain.ts, packages/shared/src/types/organizationMembershipRequest.ts
Extracts OrganizationDomainVerificationStrategy and updates OrganizationDomainVerification.strategy to reference it; adds reject() to OrganizationMembershipRequestResource.
JSDoc additions across organization types
packages/shared/src/types/organizationSuggestion.ts, packages/shared/src/types/organizationCreationDefaults.ts, packages/shared/src/types/organizationDomain.ts, packages/shared/src/types/organizationInvitation.ts, packages/shared/src/types/organizationMembership.ts, packages/shared/src/types/organizationSettings.ts
Adds or expands JSDoc/TSDoc for suggestion, creation defaults, domain fields/methods/params, invitation metadata and status docs, membership metadata and methods, and settings fields (no public type signatures changed except the strategy rename and added reject()).
Patch release declaration
.changeset/good-bottles-deny.md
Patch changeset added for @clerk/shared noting the documentation updates.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • SarahSoutoul
  • jacekradko

Poem

I'm a rabbit with a pen and cheer,
I hop through docs both far and near,
I leave small notes in every type,
So Typedoc sings and devs delight,
Hooray for clearer APIs! 🐇📜

🚥 Pre-merge checks | ✅ 5
✅ 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 accurately summarizes the main change: adding JSDoc documentation to organization resource types for improved documentation generation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
packages/shared/src/types/organizationMembershipRequest.ts (1)

41-47: ⚡ Quick win

Add tests for the newly exposed reject() contract.

This PR introduces/documents a new public API surface on OrganizationMembershipRequestResource; please add or update tests to cover reject() behavior and return-shape expectations.

As per coding guidelines, "If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/shared/src/types/organizationMembershipRequest.ts` around lines 41 -
47, Add unit tests that cover the newly exposed
OrganizationMembershipRequestResource.reject() contract: write tests that call
reject() on a mocked OrganizationMembershipRequestResource instance (or via the
factory that produces it), assert it returns a Promise resolving to the expected
OrganizationMembershipRequestResource-shaped object, and verify side effects
(e.g., status/state changes or API call invocation) and error handling. Ensure
tests check the returned object's shape/fields match the documented
OrganizationMembershipRequest (including any status field indicating rejection),
mock the underlying API/HTTP client to assert the correct endpoint/method is
invoked, and add cases for successful resolve and failure/rejection behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/shared/src/types/organizationMembershipRequest.ts`:
- Around line 41-47: Add unit tests that cover the newly exposed
OrganizationMembershipRequestResource.reject() contract: write tests that call
reject() on a mocked OrganizationMembershipRequestResource instance (or via the
factory that produces it), assert it returns a Promise resolving to the expected
OrganizationMembershipRequestResource-shaped object, and verify side effects
(e.g., status/state changes or API call invocation) and error handling. Ensure
tests check the returned object's shape/fields match the documented
OrganizationMembershipRequest (including any status field indicating rejection),
mock the underlying API/HTTP client to assert the correct endpoint/method is
invoked, and add cases for successful resolve and failure/rejection behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e4fc9d15-2d56-4a92-837b-94f5d4cc9f8c

📥 Commits

Reviewing files that changed from the base of the PR and between 9c9960a and 0b9ddeb.

📒 Files selected for processing (8)
  • .changeset/good-bottles-deny.md
  • packages/shared/src/types/organizationCreationDefaults.ts
  • packages/shared/src/types/organizationDomain.ts
  • packages/shared/src/types/organizationInvitation.ts
  • packages/shared/src/types/organizationMembership.ts
  • packages/shared/src/types/organizationMembershipRequest.ts
  • packages/shared/src/types/organizationSettings.ts
  • packages/shared/src/types/organizationSuggestion.ts

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
packages/shared/src/types/organizationDomain.ts (1)

25-26: ⚡ Quick win

Consider exporting OrganizationDomainVerificationStrategy for consistency.

The type alias OrganizationDomainVerificationStrategy is not exported, while similar types like OrganizationDomainVerificationStatus (line 29) and OrganizationEnrollmentMode (line 40) are both exported. This inconsistency may prevent TypeScript consumers from directly referencing the strategy type when needed (e.g., in type guards or conditional logic).

For consistency and to match the backend implementation (which exports this type), consider adding export:

-/** `@inline` */
-type OrganizationDomainVerificationStrategy = 'email_code';
+/** `@inline` */
+export type OrganizationDomainVerificationStrategy = 'email_code';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/shared/src/types/organizationDomain.ts` around lines 25 - 26, The
type alias OrganizationDomainVerificationStrategy is currently unexported while
related types like OrganizationDomainVerificationStatus and
OrganizationEnrollmentMode are exported; update the declaration of
OrganizationDomainVerificationStrategy to export it so consumers can import and
reference it (i.e., make OrganizationDomainVerificationStrategy exported to
match the other exported types and the backend contract).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/shared/src/types/organizationDomain.ts`:
- Around line 25-26: The type alias OrganizationDomainVerificationStrategy is
currently unexported while related types like
OrganizationDomainVerificationStatus and OrganizationEnrollmentMode are
exported; update the declaration of OrganizationDomainVerificationStrategy to
export it so consumers can import and reference it (i.e., make
OrganizationDomainVerificationStrategy exported to match the other exported
types and the backend contract).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 3dca1cce-30f6-4fa6-ae76-686f7ff8efbf

📥 Commits

Reviewing files that changed from the base of the PR and between 0b9ddeb and 581b5c2.

📒 Files selected for processing (6)
  • packages/shared/src/types/organizationCreationDefaults.ts
  • packages/shared/src/types/organizationDomain.ts
  • packages/shared/src/types/organizationInvitation.ts
  • packages/shared/src/types/organizationMembership.ts
  • packages/shared/src/types/organizationMembershipRequest.ts
  • packages/shared/src/types/organizationSettings.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/shared/src/types/organizationInvitation.ts
  • packages/shared/src/types/organizationSettings.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/shared/src/types/organizationMembership.ts
  • packages/shared/src/types/organizationMembershipRequest.ts

enabled: boolean;
};
/**
* @internal
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need to use @hidden to hide this from the documentation tooling, but still maintain the type as being part of the public API contract.

Suggested change
* @internal
* @hidden

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