Skip to content

Commit

Permalink
feat(clerk-js): Include a claimed_at property inside AuthConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Dec 11, 2024
1 parent 73f60ae commit b9a4bec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/AuthConfig.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { AuthConfigJSON, AuthConfigResource } from '@clerk/types';

import { unixEpochToDate } from '../../utils/date';
import { BaseResource } from './internal';

export class AuthConfig extends BaseResource implements AuthConfigResource {
singleSessionMode!: boolean;
claimedAt: Date | null = null;

public constructor(data: AuthConfigJSON) {
super();
Expand All @@ -12,6 +14,7 @@ export class AuthConfig extends BaseResource implements AuthConfigResource {

protected fromJSON(data: AuthConfigJSON | null): this {
this.singleSessionMode = data ? data.single_session_mode : true;
this.claimedAt = data?.claimed_at ? unixEpochToDate(data.claimed_at) : null;
return this;
}
}
5 changes: 5 additions & 0 deletions packages/types/src/authConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ export interface AuthConfigResource extends ClerkResource {
* Enabled single session configuration at the instance level.
*/
singleSessionMode: boolean;
/**
* Timestamp of when the instance was claimed. This only applies to applications created with the Keyless mode.
* Defaults to `null`.
*/
claimedAt: Date | null;
}
1 change: 1 addition & 0 deletions packages/types/src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export interface SessionWithActivitiesJSON extends Omit<SessionJSON, 'user'> {
export interface AuthConfigJSON extends ClerkResourceJSON {
single_session_mode: boolean;
url_based_session_syncing: boolean;
claimed_at: number | null;
}

export interface VerificationJSON extends ClerkResourceJSON {
Expand Down

0 comments on commit b9a4bec

Please sign in to comment.