Skip to content

Commit a693fc4

Browse files
committed
add last_authenticated_at to bapi
1 parent 94c9437 commit a693fc4

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class EnterpriseAccount extends BaseResource implements EnterpriseAccount
2424
publicMetadata = {};
2525
verification: VerificationResource | null = null;
2626
enterpriseConnection: EnterpriseAccountConnectionResource | null = null;
27+
lastAuthenticatedAt: Date | null = null;
2728

2829
public constructor(data: Partial<EnterpriseAccountJSON | EnterpriseAccountJSONSnapshot>, pathRoot: string);
2930
public constructor(data: EnterpriseAccountJSON | EnterpriseAccountJSONSnapshot, pathRoot: string) {
@@ -46,7 +47,7 @@ export class EnterpriseAccount extends BaseResource implements EnterpriseAccount
4647
this.firstName = data.first_name;
4748
this.lastName = data.last_name;
4849
this.publicMetadata = data.public_metadata;
49-
50+
this.lastAuthenticatedAt = data.last_authenticated_at ? unixEpochToDate(data.last_authenticated_at) : null;
5051
if (data.verification) {
5152
this.verification = new Verification(data.verification);
5253
}
@@ -72,6 +73,7 @@ export class EnterpriseAccount extends BaseResource implements EnterpriseAccount
7273
public_metadata: this.publicMetadata,
7374
verification: this.verification?.__internal_toSnapshot() || null,
7475
enterprise_connection: this.enterpriseConnection?.__internal_toSnapshot() || null,
76+
last_authenticated_at: this.lastAuthenticatedAt ? this.lastAuthenticatedAt.getTime() : null,
7577
};
7678
}
7779
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class SamlAccount extends BaseResource implements SamlAccountResource {
2323
lastName = '';
2424
verification: VerificationResource | null = null;
2525
samlConnection: SamlAccountConnectionResource | null = null;
26+
lastAuthenticatedAt: Date | null = null;
2627

2728
public constructor(data: Partial<SamlAccountJSON | SamlAccountJSONSnapshot>, pathRoot: string);
2829
public constructor(data: SamlAccountJSON | SamlAccountJSONSnapshot, pathRoot: string) {
@@ -52,6 +53,8 @@ export class SamlAccount extends BaseResource implements SamlAccountResource {
5253
this.samlConnection = new SamlAccountConnection(data.saml_connection);
5354
}
5455

56+
this.lastAuthenticatedAt = data.last_authenticated_at ? unixEpochToDate(data.last_authenticated_at) : null;
57+
5558
return this;
5659
}
5760

@@ -67,6 +70,7 @@ export class SamlAccount extends BaseResource implements SamlAccountResource {
6770
last_name: this.lastName,
6871
verification: this.verification?.__internal_toSnapshot() || null,
6972
saml_connection: this.samlConnection?.__internal_toSnapshot(),
73+
last_authenticated_at: this.lastAuthenticatedAt ? this.lastAuthenticatedAt.getTime() : null,
7074
};
7175
}
7276
}

packages/types/src/json.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export interface EnterpriseAccountJSON extends ClerkResourceJSON {
252252
provider_user_id: string | null;
253253
public_metadata: Record<string, unknown>;
254254
verification: VerificationJSON | null;
255+
last_authenticated_at: number | null;
255256
}
256257

257258
export interface EnterpriseAccountConnectionJSON extends ClerkResourceJSON {
@@ -279,6 +280,7 @@ export interface SamlAccountJSON extends ClerkResourceJSON {
279280
last_name: string;
280281
verification?: VerificationJSON;
281282
saml_connection?: SamlAccountConnectionJSON;
283+
last_authenticated_at: number | null;
282284
}
283285

284286
export interface UserJSON extends ClerkResourceJSON {

0 commit comments

Comments
 (0)