@clerk/types
Advanced tools
Comparing version
@@ -1,4 +0,5 @@ | ||
import { MembershipRole, OrganizationResource } from '.'; | ||
import { ClientResource } from './client'; | ||
import { DisplayThemeJSON } from './json'; | ||
import { OrganizationResource } from './organization'; | ||
import { MembershipRole } from './organizationMembership'; | ||
import { ActiveSessionResource } from './session'; | ||
@@ -5,0 +6,0 @@ import { UserResource } from './user'; |
/** | ||
* Currently representing API DTOs in their JSON form. | ||
*/ | ||
import { MembershipRole, OrganizationInvitationStatus } from '.'; | ||
import { ToggleType, ToggleTypeWithRequire } from './authConfig'; | ||
import { EmailAddressVerificationStrategy } from './emailAddress'; | ||
import { OAuthStrategy } from './oauth'; | ||
import { OrganizationInvitationStatus } from './organizationInvitation'; | ||
import { MembershipRole } from './organizationMembership'; | ||
import { SessionStatus } from './session'; | ||
@@ -289,2 +290,3 @@ import { IdentificationStrategy, PreferredSignInStrategy, SignInFactor, SignInIdentifier, SignInStatus, SignInStrategyName, UserData } from './signIn'; | ||
id: string; | ||
organization_id: string; | ||
public_user_data: PublicUserDataJSON; | ||
@@ -291,0 +293,0 @@ role: MembershipRole; |
@@ -0,1 +1,2 @@ | ||
import { MembershipRole } from './organizationMembership'; | ||
export interface JWTClaims { | ||
@@ -11,4 +12,6 @@ __raw: string; | ||
name?: string; | ||
orgs?: OrganizationsJWTClaim; | ||
[key: string]: unknown; | ||
} | ||
export declare type OrganizationsJWTClaim = Record<string, MembershipRole>; | ||
export interface JWT { | ||
@@ -15,0 +18,0 @@ encoded: { |
@@ -1,2 +0,4 @@ | ||
import { MembershipRole, OrganizationMembershipResource } from '.'; | ||
import { OrganizationInvitationResource } from './organizationInvitation'; | ||
import { OrganizationMembershipResource } from './organizationMembership'; | ||
import { MembershipRole } from './organizationMembership'; | ||
export interface OrganizationResource { | ||
@@ -10,8 +12,21 @@ id: string; | ||
updatedAt: Date; | ||
getMembers: (params?: GetMembersParams) => Promise<OrganizationMembershipResource[]>; | ||
getMemberships: (params?: GetMembershipsParams) => Promise<OrganizationMembershipResource[]>; | ||
getPendingInvitations: () => Promise<OrganizationInvitationResource[]>; | ||
inviteMember: (params: InviteMemberParams) => Promise<OrganizationInvitationResource>; | ||
updateMember: (params: UpdateMembershipParams) => Promise<OrganizationMembershipResource>; | ||
removeMember: (userId: string) => Promise<OrganizationMembershipResource>; | ||
} | ||
export interface GetMembersParams { | ||
export interface GetMembershipsParams { | ||
limit?: number; | ||
offset?: number; | ||
} | ||
export interface InviteMemberParams { | ||
emailAddress: string; | ||
role: MembershipRole; | ||
redirectUrl?: string; | ||
} | ||
export interface UpdateMembershipParams { | ||
userId: string; | ||
role: MembershipRole; | ||
} | ||
//# sourceMappingURL=organization.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { MembershipRole } from '.'; | ||
import { MembershipRole } from './organizationMembership'; | ||
export interface OrganizationInvitationResource { | ||
@@ -3,0 +3,0 @@ id: string; |
@@ -1,4 +0,5 @@ | ||
import { PublicUserData } from '.'; | ||
import { PublicUserData } from './session'; | ||
export interface OrganizationMembershipResource { | ||
id: string; | ||
organizationId: string; | ||
publicUserData: PublicUserData; | ||
@@ -8,4 +9,9 @@ role: MembershipRole; | ||
updatedAt: Date; | ||
destroy: () => Promise<OrganizationMembershipResource>; | ||
update: (updateParams: UpdateOrganizationMembershipParams) => Promise<OrganizationMembershipResource>; | ||
} | ||
export declare type MembershipRole = 'admin' | 'basic_member'; | ||
export declare type UpdateOrganizationMembershipParams = { | ||
role: MembershipRole; | ||
}; | ||
//# sourceMappingURL=organizationMembership.d.ts.map |
{ | ||
"name": "@clerk/types", | ||
"version": "1.28.0", | ||
"version": "1.28.1", | ||
"license": "MIT", | ||
@@ -51,3 +51,3 @@ "description": "Typings for Clerk libraries.", | ||
"homepage": "https://clerk.dev/", | ||
"gitHead": "b4e29d586d8f0a9b5405abc0e345fd055a17dd68" | ||
"gitHead": "4a9d27a97c622538107ddf79ab07904b812039e2" | ||
} |
@@ -0,3 +1,94 @@ | ||
<p align="center"> | ||
<a href="https://clerk.dev?utm_source=github&utm_medium=clerk_types" target="_blank" rel="noopener noreferrer"> | ||
<img src="https://images.clerk.dev/static/clerk.svg" alt="Clerk logo" height="50"> | ||
</a> | ||
<br /> | ||
</p> | ||
# @clerk/types | ||
Typings for Clerk.dev libraries. | ||
<div align="center"> | ||
[](https://discord.com/invite/b5rXHjAg7A) | ||
[](https://docs.clerk.dev?utm_source=github&utm_medium=clerk_types) | ||
[](https://twitter.com/intent/follow?screen_name=ClerkDev) | ||
[Changelog](CHANGELOG.md) | ||
· | ||
[Report a Bug](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=bug&template=bug_report.md&title=Bug%3A+) | ||
· | ||
[Request a Feature](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=Feature%3A+) | ||
· | ||
[Ask a Question](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=question&template=ask_a_question.md&title=Support%3A+) | ||
</div> | ||
--- | ||
## Overview | ||
This package provides the TypeScript type declarations for Clerk libraries. | ||
## Getting Started | ||
It is worth noting that Clerk packages automatically include their type declarations when installed so adding this package manually is not typically necessary. | ||
### Installation | ||
```sh | ||
npm install --save-dev @clerk/types | ||
``` | ||
### Build | ||
```sh | ||
npm run build | ||
``` | ||
To build types in watch mode, run the following: | ||
```sh | ||
npm run dev | ||
``` | ||
## Usage | ||
Example implementation: | ||
```ts | ||
import type { OAuthStrategy } from '@clerk/types'; | ||
export type OAuthProps = { | ||
oAuthOptions: OAuthStrategy[]; | ||
error?: string; | ||
setError?: React.Dispatch<React.SetStateAction<string | undefined>>; | ||
}; | ||
``` | ||
_For further details and examples, please refer to our [Documentation](https://docs.clerk.dev?utm_source=github&utm_medium=clerk_types)._ | ||
## Support | ||
You can get in touch with us in any of the following ways: | ||
- Join our official community [Discord server](https://discord.com/invite/b5rXHjAg7A) | ||
- Open a [GitHub support issue](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=question&template=ask_a_question.md&title=Support%3A+) | ||
- Contact options listed on [our Support page](https://clerk.dev/support?utm_source=github&utm_medium=clerk_types) | ||
## Contributing | ||
We're open to all community contributions! If you'd like to contribute in any way, please read [our contribution guidelines](docs/CONTRIBUTING.md). | ||
## Security | ||
`@clerk/types` follows good practices of security, but 100% security cannot be assured. | ||
`@clerk/types` is provided **"as is"** without any **warranty**. Use at your own risk. | ||
_For more information and to report security issues, please refer to our [security documentation](docs/SECURITY.md)._ | ||
## License | ||
This project is licensed under the **MIT license**. | ||
See [LICENSE](LICENSE) for more information. |
@@ -1,4 +0,5 @@ | ||
import { MembershipRole, OrganizationResource } from '.'; | ||
import { ClientResource } from './client'; | ||
import { DisplayThemeJSON } from './json'; | ||
import { OrganizationResource } from './organization'; | ||
import { MembershipRole } from './organizationMembership'; | ||
import { ActiveSessionResource } from './session'; | ||
@@ -5,0 +6,0 @@ import { UserResource } from './user'; |
@@ -5,6 +5,7 @@ /** | ||
import { MembershipRole, OrganizationInvitationStatus } from '.'; | ||
import { ToggleType, ToggleTypeWithRequire } from './authConfig'; | ||
import { EmailAddressVerificationStrategy } from './emailAddress'; | ||
import { OAuthStrategy } from './oauth'; | ||
import { OrganizationInvitationStatus } from './organizationInvitation'; | ||
import { MembershipRole } from './organizationMembership'; | ||
import { SessionStatus } from './session'; | ||
@@ -338,2 +339,3 @@ import { | ||
id: string; | ||
organization_id: string; | ||
public_user_data: PublicUserDataJSON; | ||
@@ -340,0 +342,0 @@ role: MembershipRole; |
@@ -0,1 +1,3 @@ | ||
import { MembershipRole } from './organizationMembership'; | ||
export interface JWTClaims { | ||
@@ -11,5 +13,7 @@ __raw: string; | ||
name?: string; | ||
orgs?: OrganizationsJWTClaim; | ||
[key: string]: unknown; | ||
} | ||
export type OrganizationsJWTClaim = Record<string, MembershipRole>; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
@@ -16,0 +20,0 @@ export interface JWT { |
@@ -1,2 +0,4 @@ | ||
import { MembershipRole, OrganizationMembershipResource } from '.'; | ||
import { OrganizationInvitationResource } from './organizationInvitation'; | ||
import { OrganizationMembershipResource } from './organizationMembership'; | ||
import { MembershipRole } from './organizationMembership'; | ||
@@ -11,10 +13,29 @@ export interface OrganizationResource { | ||
updatedAt: Date; | ||
getMembers: ( | ||
params?: GetMembersParams, | ||
getMemberships: ( | ||
params?: GetMembershipsParams, | ||
) => Promise<OrganizationMembershipResource[]>; | ||
getPendingInvitations: () => Promise<OrganizationInvitationResource[]>; | ||
inviteMember: ( | ||
params: InviteMemberParams, | ||
) => Promise<OrganizationInvitationResource>; | ||
updateMember: ( | ||
params: UpdateMembershipParams, | ||
) => Promise<OrganizationMembershipResource>; | ||
removeMember: (userId: string) => Promise<OrganizationMembershipResource>; | ||
} | ||
export interface GetMembersParams { | ||
export interface GetMembershipsParams { | ||
limit?: number; | ||
offset?: number; | ||
} | ||
export interface InviteMemberParams { | ||
emailAddress: string; | ||
role: MembershipRole; | ||
redirectUrl?: string; | ||
} | ||
export interface UpdateMembershipParams { | ||
userId: string; | ||
role: MembershipRole; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { MembershipRole } from '.'; | ||
import { MembershipRole } from './organizationMembership'; | ||
@@ -3,0 +3,0 @@ export interface OrganizationInvitationResource { |
@@ -1,5 +0,6 @@ | ||
import { PublicUserData } from '.'; | ||
import { PublicUserData } from './session'; | ||
export interface OrganizationMembershipResource { | ||
id: string; | ||
organizationId: string; | ||
publicUserData: PublicUserData; | ||
@@ -9,4 +10,12 @@ role: MembershipRole; | ||
updatedAt: Date; | ||
destroy: () => Promise<OrganizationMembershipResource>; | ||
update: ( | ||
updateParams: UpdateOrganizationMembershipParams, | ||
) => Promise<OrganizationMembershipResource>; | ||
} | ||
export type MembershipRole = 'admin' | 'basic_member'; | ||
export type UpdateOrganizationMembershipParams = { | ||
role: MembershipRole; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
175935
6.29%164
7.89%3532
3.27%95
2275%