@better-auth/infra 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/client.mjs +2 -2
- package/dist/{constants-D81vWTXm.mjs → constants-CQiIiY9L.mjs} +1 -1
- package/dist/{crypto-BlYEkWgT.mjs → crypto-Deqoay7H.mjs} +1 -1
- package/dist/email.mjs +1 -1
- package/dist/index.d.mts +16 -12
- package/dist/index.mjs +489 -429
- package/dist/native.mjs +2 -2
- package/dist/{pow-retry-BN8NVM3m.mjs → pow-retry-DXiVsZkt.mjs} +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ All notable changes to `@better-auth/infra` are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.6] - 2026-07-09
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Activity tracking writes** — `lastActiveAt` updates now run through Better Auth background tasks (`runInBackgroundOrAwait`) instead of blocking the request or using fire-and-forget promises, so activity tracking no longer delays responses when a background runner is available.
|
|
13
|
+
|
|
14
|
+
## [0.3.5] - 2026-07-06
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **`GET /dash/users` partial fetches** — Endpoint was optimized to load only the requested fields (sessions or accounts) instead of all fields.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **SCIM organization ownership model** — On Better Auth 1.7+, directory sync ownership is tied to the organization; this version closely follows the new ownership model while maintaining backwards compatibility with older versions.
|
|
24
|
+
- **Dashboard query performance** — Organization, team, user, and invitation routes use narrower `select` clauses, adapter joins instead of sequential lookups, parallel independent queries, and a shared concurrency cap (`DASH_DB_QUERY_CONCURRENCY`, 5) for analytics workloads.
|
|
25
|
+
- **Activity tracking writes** — `lastActiveAt` updates were optimized to avoid unnecessary row returns.
|
|
26
|
+
- **Sentinel on dashboard routes** — `/dash` routes skip device identification and Sentinel security checks (free-trial abuse, impossible travel, credential stuffing, and related hooks).
|
|
27
|
+
- **Event tracking** — Session lifecycle events reuse user data from the request context when available, avoiding redundant user lookups after sign-in.
|
|
28
|
+
|
|
8
29
|
## [0.3.4] - 2026-06-26
|
|
9
30
|
|
|
10
31
|
### Fixed
|
|
@@ -115,6 +136,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
115
136
|
|
|
116
137
|
- Fixed impossible travel security challenges.
|
|
117
138
|
|
|
139
|
+
[0.3.5]: https://github.com/better-auth/infrastructure/compare/infra@v0.3.4...infra@v0.3.5
|
|
118
140
|
[0.3.4]: https://github.com/better-auth/infrastructure/compare/infra@v0.3.3...infra@v0.3.4
|
|
119
141
|
[0.3.3]: https://github.com/better-auth/infrastructure/compare/infra@v0.3.2...infra@v0.3.3
|
|
120
142
|
[0.3.2]: https://github.com/better-auth/infrastructure/compare/infra@v0.3.1...infra@v0.3.2
|
package/dist/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as hash, o as createKV } from "./crypto-
|
|
2
|
-
import { a as resolveSentinelClientIdentifyUrl, c as dashClient, i as solvePoWChallenge, n as decodePoWChallenge, o as generateRequestId, r as encodePoWSolution, s as identify, t as createPowRetryTimeout } from "./pow-retry-
|
|
1
|
+
import { n as hash, o as createKV } from "./crypto-Deqoay7H.mjs";
|
|
2
|
+
import { a as resolveSentinelClientIdentifyUrl, c as dashClient, i as solvePoWChallenge, n as decodePoWChallenge, o as generateRequestId, r as encodePoWSolution, s as identify, t as createPowRetryTimeout } from "./pow-retry-DXiVsZkt.mjs";
|
|
3
3
|
import { env } from "@better-auth/core/env";
|
|
4
4
|
//#region src/sentinel/fingerprint.ts
|
|
5
5
|
function murmurhash3(str, seed = 0) {
|
package/dist/email.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as INFRA_USER_AGENT, n as INFRA_API_URL } from "./constants-
|
|
1
|
+
import { i as INFRA_USER_AGENT, n as INFRA_API_URL } from "./constants-CQiIiY9L.mjs";
|
|
2
2
|
import { logger } from "better-auth";
|
|
3
3
|
import { env } from "@better-auth/core/env";
|
|
4
4
|
import { createFetch } from "@better-fetch/fetch";
|
package/dist/index.d.mts
CHANGED
|
@@ -966,6 +966,8 @@ interface DashCompleteInvitationResponse {
|
|
|
966
966
|
}
|
|
967
967
|
//#endregion
|
|
968
968
|
//#region src/routes/organizations/types.d.ts
|
|
969
|
+
declare const ORGANIZATION_USER_PREVIEW_SELECT: readonly ["id", "name", "email", "image"];
|
|
970
|
+
type OrganizationUserPreview = Pick<User, (typeof ORGANIZATION_USER_PREVIEW_SELECT)[number]>;
|
|
969
971
|
type DashOrganizationUpdateResponse = Organization;
|
|
970
972
|
/** Mirrors joined `user` row fields exposed on dash org APIs. Omitted when the user has no email (e.g. phone-only). */
|
|
971
973
|
type DashOrganizationMemberUser = {
|
|
@@ -1243,7 +1245,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1243
1245
|
emailVerified: boolean;
|
|
1244
1246
|
name: string;
|
|
1245
1247
|
image?: string | null | undefined;
|
|
1246
|
-
} & Record<string, unknown>, _ctx:
|
|
1248
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1247
1249
|
};
|
|
1248
1250
|
update: {
|
|
1249
1251
|
after(user: {
|
|
@@ -1254,7 +1256,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1254
1256
|
emailVerified: boolean;
|
|
1255
1257
|
name: string;
|
|
1256
1258
|
image?: string | null | undefined;
|
|
1257
|
-
} & Record<string, unknown>, _ctx:
|
|
1259
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1258
1260
|
};
|
|
1259
1261
|
delete: {
|
|
1260
1262
|
after(user: {
|
|
@@ -1265,7 +1267,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1265
1267
|
emailVerified: boolean;
|
|
1266
1268
|
name: string;
|
|
1267
1269
|
image?: string | null | undefined;
|
|
1268
|
-
} & Record<string, unknown>, _ctx:
|
|
1270
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1269
1271
|
};
|
|
1270
1272
|
};
|
|
1271
1273
|
session: {
|
|
@@ -1279,7 +1281,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1279
1281
|
token: string;
|
|
1280
1282
|
ipAddress?: string | null | undefined;
|
|
1281
1283
|
userAgent?: string | null | undefined;
|
|
1282
|
-
} & Record<string, unknown>, _ctx:
|
|
1284
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<{
|
|
1283
1285
|
data: {
|
|
1284
1286
|
loginMethod: string | null;
|
|
1285
1287
|
};
|
|
@@ -1293,7 +1295,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1293
1295
|
token: string;
|
|
1294
1296
|
ipAddress?: string | null | undefined;
|
|
1295
1297
|
userAgent?: string | null | undefined;
|
|
1296
|
-
} & Record<string, unknown>, _ctx:
|
|
1298
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1297
1299
|
};
|
|
1298
1300
|
delete: {
|
|
1299
1301
|
after(session: {
|
|
@@ -1305,7 +1307,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1305
1307
|
token: string;
|
|
1306
1308
|
ipAddress?: string | null | undefined;
|
|
1307
1309
|
userAgent?: string | null | undefined;
|
|
1308
|
-
} & Record<string, unknown>, _ctx:
|
|
1310
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1309
1311
|
};
|
|
1310
1312
|
};
|
|
1311
1313
|
account: {
|
|
@@ -1324,7 +1326,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1324
1326
|
refreshTokenExpiresAt?: Date | null | undefined;
|
|
1325
1327
|
scope?: string | null | undefined;
|
|
1326
1328
|
password?: string | null | undefined;
|
|
1327
|
-
}, _ctx:
|
|
1329
|
+
}, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1328
1330
|
};
|
|
1329
1331
|
update: {
|
|
1330
1332
|
after(account: {
|
|
@@ -1341,7 +1343,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1341
1343
|
refreshTokenExpiresAt?: Date | null | undefined;
|
|
1342
1344
|
scope?: string | null | undefined;
|
|
1343
1345
|
password?: string | null | undefined;
|
|
1344
|
-
} & Record<string, unknown>, _ctx:
|
|
1346
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1345
1347
|
};
|
|
1346
1348
|
delete: {
|
|
1347
1349
|
after(account: {
|
|
@@ -1358,7 +1360,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1358
1360
|
refreshTokenExpiresAt?: Date | null | undefined;
|
|
1359
1361
|
scope?: string | null | undefined;
|
|
1360
1362
|
password?: string | null | undefined;
|
|
1361
|
-
} & Record<string, unknown>, _ctx:
|
|
1363
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1362
1364
|
};
|
|
1363
1365
|
};
|
|
1364
1366
|
verification: {
|
|
@@ -1370,7 +1372,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1370
1372
|
value: string;
|
|
1371
1373
|
expiresAt: Date;
|
|
1372
1374
|
identifier: string;
|
|
1373
|
-
} & Record<string, unknown>, _ctx:
|
|
1375
|
+
} & Record<string, unknown>, _ctx: GenericEndpointContext | null): Promise<void>;
|
|
1374
1376
|
};
|
|
1375
1377
|
delete: {
|
|
1376
1378
|
after(verification: {
|
|
@@ -1380,7 +1382,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1380
1382
|
value: string;
|
|
1381
1383
|
expiresAt: Date;
|
|
1382
1384
|
identifier: string;
|
|
1383
|
-
} & Record<string, unknown>, ctx:
|
|
1385
|
+
} & Record<string, unknown>, ctx: GenericEndpointContext | null): Promise<void>;
|
|
1384
1386
|
};
|
|
1385
1387
|
};
|
|
1386
1388
|
};
|
|
@@ -1784,6 +1786,8 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1784
1786
|
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
1785
1787
|
payload: {
|
|
1786
1788
|
userId: string;
|
|
1789
|
+
sessionOnly?: boolean | undefined;
|
|
1790
|
+
accountOnly?: boolean | undefined;
|
|
1787
1791
|
};
|
|
1788
1792
|
}>)[];
|
|
1789
1793
|
query: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -2626,4 +2630,4 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
2626
2630
|
} : {};
|
|
2627
2631
|
};
|
|
2628
2632
|
//#endregion
|
|
2629
|
-
export { type APIError, CHALLENGE_TTL, type CompromisedPasswordResult, type CredentialStuffingResult, type DBField, DEFAULT_DIFFICULTY, type DashAddTeamMemberResponse, type DashBanManyResponse, type DashCheckUserByEmailResponse, type DashCheckUserExistsResponse, type DashCompleteInvitationResponse, type DashConfigResponse, type DashCreateOrganizationBody, type DashCreateOrganizationResponse, type DashCreateTeamResponse, type DashCreateUserResponse, type DashDeleteManyUsersResponse, type DashDirectoryCreateResponse, type DashDirectoryDeleteResponse, type DashDirectoryItem, type DashDirectoryRegenerateTokenResponse, type DashExecuteAdapterCountResponse, type DashExecuteAdapterFindManyResponse, type DashExecuteAdapterFindOneResponse, type DashExecuteAdapterMutationResponse, type DashExecuteAdapterResponse, type DashExportOrganizationsResponse, type DashIdRow, type DashInviteMemberResponse, type DashMaybeSuccessResponse, type DashOptions, type DashOptionsInternal, type DashOptionsResolved, type DashOrganizationAddMemberResponse, type DashOrganizationDeleteManyResponse, type DashOrganizationDetailResponse, type DashOrganizationInvitationItem, type DashOrganizationInvitationListResponse, type DashOrganizationInvitationStatusItem, type DashOrganizationListResponse, type DashOrganizationMember, type DashOrganizationMemberListItem, type DashOrganizationMemberListResponse, type DashOrganizationMemberUser, type DashOrganizationOptionsResponse, type DashOrganizationTeamItem, type DashOrganizationTeamListResponse, type DashOrganizationUpdateMemberRoleResponse, type DashOrganizationUpdateResponse, type DashSendManyVerificationEmailsResponse, type DashSessionRevokeManyResponse, type DashSsoCreateProviderResponse, type DashSsoDeleteResponse, type DashSsoMarkDomainVerifiedResponse, type DashSsoProviderItem, type DashSsoProviderSummary, type DashSsoUpdateProviderResponse, type DashSsoVerificationTokenResponse, type DashSsoVerifyDomainResponse, type DashSuccessResponse, type DashTeam, type DashTeamMember, type DashTeamMemberListResponse, type DashTwoFactorBackupCodesResponse, type DashTwoFactorEnableResponse, type DashTwoFactorStatus, type DashTwoFactorTotpViewResponse, type DashUpdateTeamResponse, type DashUpdateUserResponse, type DashUserDetailsResponse, type DashUserGraphDataResponse, type DashUserListResponse, type DashUserOrganizationsResponse, type DashUserRetentionDataResponse, type DashUserStatsActivePeriod, type DashUserStatsResponse, type DashUserStatsSignUpPeriod, type DashValidateResponse, type DirectorySyncConnection, EMAIL_TEMPLATES, type EmailConfig, type EmailTemplateId, type EmailTemplateVariables, type Endpoint, type EndpointOptions, type EventLocation, type EventTypesResponse, type ImpossibleTravelResult, type InfraEndpointContext, type InfraPluginConnectionOptions, type InfraPluginConnectionOptionsInternal, type LocationData, type LocationDataContext, type PoWChallenge, type PoWSolution, type SCIMPlugin, type SMSConfig, type SMSTemplateId, type SMSTemplateVariables, SMS_TEMPLATES, type SecurityEvent, type SecurityEventType, type SecurityOptions, type SecurityVerdict, type SendBulkEmailsOptions, type SendBulkEmailsResult, type SendEmailOptions, type SendEmailResult, type SendSMSOptions, type SendSMSResult, type SentinelOptions, type SentinelOptionsInternal, type StaleUserResult, type ThresholdConfig, USER_EVENT_TYPES, type UserEvent, type UserEventType, type UserEventsResponse, createEmailSender, createSMSSender, dash, decodePoWChallenge, encodePoWSolution, normalizeEmail, sendBulkEmails, sendEmail, sendSMS, sentinel, solvePoWChallenge, verifyPoWSolution };
|
|
2633
|
+
export { type APIError, CHALLENGE_TTL, type CompromisedPasswordResult, type CredentialStuffingResult, type DBField, DEFAULT_DIFFICULTY, type DashAddTeamMemberResponse, type DashBanManyResponse, type DashCheckUserByEmailResponse, type DashCheckUserExistsResponse, type DashCompleteInvitationResponse, type DashConfigResponse, type DashCreateOrganizationBody, type DashCreateOrganizationResponse, type DashCreateTeamResponse, type DashCreateUserResponse, type DashDeleteManyUsersResponse, type DashDirectoryCreateResponse, type DashDirectoryDeleteResponse, type DashDirectoryItem, type DashDirectoryRegenerateTokenResponse, type DashExecuteAdapterCountResponse, type DashExecuteAdapterFindManyResponse, type DashExecuteAdapterFindOneResponse, type DashExecuteAdapterMutationResponse, type DashExecuteAdapterResponse, type DashExportOrganizationsResponse, type DashIdRow, type DashInviteMemberResponse, type DashMaybeSuccessResponse, type DashOptions, type DashOptionsInternal, type DashOptionsResolved, type DashOrganizationAddMemberResponse, type DashOrganizationDeleteManyResponse, type DashOrganizationDetailResponse, type DashOrganizationInvitationItem, type DashOrganizationInvitationListResponse, type DashOrganizationInvitationStatusItem, type DashOrganizationListResponse, type DashOrganizationMember, type DashOrganizationMemberListItem, type DashOrganizationMemberListResponse, type DashOrganizationMemberUser, type DashOrganizationOptionsResponse, type DashOrganizationTeamItem, type DashOrganizationTeamListResponse, type DashOrganizationUpdateMemberRoleResponse, type DashOrganizationUpdateResponse, type DashSendManyVerificationEmailsResponse, type DashSessionRevokeManyResponse, type DashSsoCreateProviderResponse, type DashSsoDeleteResponse, type DashSsoMarkDomainVerifiedResponse, type DashSsoProviderItem, type DashSsoProviderSummary, type DashSsoUpdateProviderResponse, type DashSsoVerificationTokenResponse, type DashSsoVerifyDomainResponse, type DashSuccessResponse, type DashTeam, type DashTeamMember, type DashTeamMemberListResponse, type DashTwoFactorBackupCodesResponse, type DashTwoFactorEnableResponse, type DashTwoFactorStatus, type DashTwoFactorTotpViewResponse, type DashUpdateTeamResponse, type DashUpdateUserResponse, type DashUserDetailsResponse, type DashUserGraphDataResponse, type DashUserListResponse, type DashUserOrganizationsResponse, type DashUserRetentionDataResponse, type DashUserStatsActivePeriod, type DashUserStatsResponse, type DashUserStatsSignUpPeriod, type DashValidateResponse, type DirectorySyncConnection, EMAIL_TEMPLATES, type EmailConfig, type EmailTemplateId, type EmailTemplateVariables, type Endpoint, type EndpointOptions, type EventLocation, type EventTypesResponse, type ImpossibleTravelResult, type InfraEndpointContext, type InfraPluginConnectionOptions, type InfraPluginConnectionOptionsInternal, type LocationData, type LocationDataContext, type ORGANIZATION_USER_PREVIEW_SELECT, type OrganizationUserPreview, type PoWChallenge, type PoWSolution, type SCIMPlugin, type SMSConfig, type SMSTemplateId, type SMSTemplateVariables, SMS_TEMPLATES, type SecurityEvent, type SecurityEventType, type SecurityOptions, type SecurityVerdict, type SendBulkEmailsOptions, type SendBulkEmailsResult, type SendEmailOptions, type SendEmailResult, type SendSMSOptions, type SendSMSResult, type SentinelOptions, type SentinelOptionsInternal, type StaleUserResult, type ThresholdConfig, USER_EVENT_TYPES, type UserEvent, type UserEventType, type UserEventsResponse, createEmailSender, createSMSSender, dash, decodePoWChallenge, encodePoWSolution, normalizeEmail, sendBulkEmails, sendEmail, sendSMS, sentinel, solvePoWChallenge, verifyPoWSolution };
|