File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @clerk/backend ' : patch
3+ ---
4+
5+ Adds the ability to verify proxy checks to the Backend API client.
6+
7+ ``` ts
8+ import { createClerkClient } from ' @clerk/backend' ;
9+
10+ const clerkClient = createClerkClient (... );
11+ await clerkClient .proxyChecks .verify ({
12+ domainId: ' dmn_xxxxxx' ,
13+ proxyUrl: ' https://[your-domain].com'
14+ });
15+ ```
Original file line number Diff line number Diff line change 1+ import type { ProxyCheck } from '../resources' ;
2+ import { AbstractAPI } from './AbstractApi' ;
3+
4+ const basePath = '/proxy_checks' ;
5+
6+ type VerifyParams = {
7+ domainId : string ;
8+ proxyUrl : string ;
9+ } ;
10+
11+ export class ProxyCheckAPI extends AbstractAPI {
12+ public async verify ( params : VerifyParams ) {
13+ return this . request < ProxyCheck > ( {
14+ method : 'POST' ,
15+ path : basePath ,
16+ bodyParams : params ,
17+ } ) ;
18+ }
19+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export * from './InvitationApi';
88export * from './JwksApi' ;
99export * from './OrganizationApi' ;
1010export * from './PhoneNumberApi' ;
11+ export * from './ProxyCheckApi' ;
1112export * from './RedirectUrlApi' ;
1213export * from './SessionApi' ;
1314export * from './SignInTokenApi' ;
Original file line number Diff line number Diff line change 88 JwksAPI ,
99 OrganizationAPI ,
1010 PhoneNumberAPI ,
11+ ProxyCheckAPI ,
1112 RedirectUrlAPI ,
1213 SamlConnectionAPI ,
1314 SessionAPI ,
@@ -35,6 +36,7 @@ export function createBackendApiClient(options: CreateBackendApiOptions) {
3536 jwks : new JwksAPI ( request ) ,
3637 organizations : new OrganizationAPI ( request ) ,
3738 phoneNumbers : new PhoneNumberAPI ( request ) ,
39+ proxyChecks : new ProxyCheckAPI ( request ) ,
3840 redirectUrls : new RedirectUrlAPI ( request ) ,
3941 sessions : new SessionAPI ( request ) ,
4042 signInTokens : new SignInTokenAPI ( request ) ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 OrganizationInvitation ,
1212 OrganizationMembership ,
1313 PhoneNumber ,
14+ ProxyCheck ,
1415 RedirectUrl ,
1516 Session ,
1617 SignInToken ,
@@ -91,6 +92,8 @@ function jsonToObject(item: any): any {
9192 return OrganizationMembership . fromJSON ( item ) ;
9293 case ObjectType . PhoneNumber :
9394 return PhoneNumber . fromJSON ( item ) ;
95+ case ObjectType . ProxyCheck :
96+ return ProxyCheck . fromJSON ( item ) ;
9497 case ObjectType . RedirectUrl :
9598 return RedirectUrl . fromJSON ( item ) ;
9699 case ObjectType . SignInToken :
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ export const ObjectType = {
2626 OrganizationInvitation : 'organization_invitation' ,
2727 OrganizationMembership : 'organization_membership' ,
2828 PhoneNumber : 'phone_number' ,
29+ ProxyCheck : 'proxy_check' ,
2930 RedirectUrl : 'redirect_url' ,
3031 SamlAccount : 'saml_account' ,
3132 Session : 'session' ,
@@ -271,6 +272,17 @@ export interface PhoneNumberJSON extends ClerkResourceJSON {
271272 backup_codes : string [ ] ;
272273}
273274
275+ export type ProxyCheckJSON = {
276+ object : typeof ObjectType . ProxyCheck ;
277+ id : string ;
278+ domain_id : string ;
279+ last_run_at : number | null ;
280+ proxy_url : string ;
281+ successful : boolean ;
282+ created_at : number ;
283+ updated_at : number ;
284+ } ;
285+
274286export interface RedirectUrlJSON extends ClerkResourceJSON {
275287 object : typeof ObjectType . RedirectUrl ;
276288 url : string ;
Original file line number Diff line number Diff line change 1+ import type { ProxyCheckJSON } from './JSON' ;
2+
3+ export class ProxyCheck {
4+ constructor (
5+ readonly id : string ,
6+ readonly domainId : string ,
7+ readonly lastRunAt : number | null ,
8+ readonly proxyUrl : string ,
9+ readonly successful : boolean ,
10+ readonly createdAt : number ,
11+ readonly updatedAt : number ,
12+ ) { }
13+
14+ static fromJSON ( data : ProxyCheckJSON ) : ProxyCheck {
15+ return new ProxyCheck (
16+ data . id ,
17+ data . domain_id ,
18+ data . last_run_at ,
19+ data . proxy_url ,
20+ data . successful ,
21+ data . created_at ,
22+ data . updated_at ,
23+ ) ;
24+ }
25+ }
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export * from './Organization';
2525export * from './OrganizationInvitation' ;
2626export * from './OrganizationMembership' ;
2727export * from './PhoneNumber' ;
28+ export * from './ProxyCheck' ;
2829export * from './RedirectUrl' ;
2930export * from './Session' ;
3031export * from './SignInTokens' ;
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ export type {
7373 OrganizationMembershipJSON ,
7474 OrganizationMembershipPublicUserDataJSON ,
7575 PhoneNumberJSON ,
76+ ProxyCheckJSON ,
7677 RedirectUrlJSON ,
7778 SessionJSON ,
7879 SignInJSON ,
You can’t perform that action at this time.
0 commit comments