Skip to content

Commit 7f7edca

Browse files
authored
feat(clerk-js): Include a claimed_at property inside AuthConfig (#4752)
1 parent 73f60ae commit 7f7edca

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

.changeset/slow-cars-worry.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/types': patch
4+
---
5+
6+
Add `claimedAt` proprty inside AuthConfig for the environment. It describes when a instance that was created from the Keyless mode was finally claimed.

packages/clerk-js/src/core/resources/AuthConfig.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import type { AuthConfigJSON, AuthConfigResource } from '@clerk/types';
22

3+
import { unixEpochToDate } from '../../utils/date';
34
import { BaseResource } from './internal';
45

56
export class AuthConfig extends BaseResource implements AuthConfigResource {
67
singleSessionMode!: boolean;
8+
claimedAt: Date | null = null;
79

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

1315
protected fromJSON(data: AuthConfigJSON | null): this {
1416
this.singleSessionMode = data ? data.single_session_mode : true;
17+
this.claimedAt = data?.claimed_at ? unixEpochToDate(data.claimed_at) : null;
1518
return this;
1619
}
1720
}

packages/types/src/authConfig.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ export interface AuthConfigResource extends ClerkResource {
55
* Enabled single session configuration at the instance level.
66
*/
77
singleSessionMode: boolean;
8+
/**
9+
* Timestamp of when the instance was claimed. This only applies to applications created with the Keyless mode.
10+
* Defaults to `null`.
11+
*/
12+
claimedAt: Date | null;
813
}

packages/types/src/json.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ export interface SessionWithActivitiesJSON extends Omit<SessionJSON, 'user'> {
288288
export interface AuthConfigJSON extends ClerkResourceJSON {
289289
single_session_mode: boolean;
290290
url_based_session_syncing: boolean;
291+
claimed_at: number | null;
291292
}
292293

293294
export interface VerificationJSON extends ClerkResourceJSON {

0 commit comments

Comments
 (0)