@better-auth/infra 0.4.10 → 0.4.12
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 +14 -2
- package/dist/client.mjs +2 -2
- package/dist/{constants-DLZKaIkd.mjs → constants-D1m_WRqw.mjs} +1 -1
- package/dist/{crypto-Doziv2tH.mjs → crypto-DZ0e3fu4.mjs} +1 -1
- package/dist/email.mjs +1 -1
- package/dist/index.d.mts +16 -2
- package/dist/index.mjs +18 -3
- package/dist/native.mjs +2 -2
- package/dist/{pow-retry-DIkxDwZf.mjs → pow-retry-Cl7MAw6O.mjs} +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,23 @@ 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/).
|
|
7
7
|
|
|
8
|
+
## [0.4.12] - 2026-09-28
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **`GET /dash/directory-sync/connection-count`** — When directory sync mode is unavailable (no SCIM / managed not enabled), returns `{ count: 0, mode: "unavailable" }` instead of **404**. Platform usage/billing treated 404 as “old plugin” and walked every customer org, which could time out on large tenants.
|
|
13
|
+
|
|
14
|
+
## [0.4.11] - 2026-09-23
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`GET /dash/sso/connection-count`** — Project-wide SSO connection count (`{ count }`). Counts `ssoProvider` rows across organizations. Returns `{ count: 0 }` when the organization plugin or SSO plugin is unavailable.
|
|
19
|
+
|
|
8
20
|
## [0.4.10] - 2026-09-21
|
|
9
21
|
|
|
10
22
|
### Added
|
|
11
23
|
|
|
12
|
-
- **`GET /dash/directory-sync/connection-count`** — Project-wide directory sync connection count (`{ count, mode }`). Managed mode counts `active` / `decommissioning` connections; legacy mode counts `scimProvider` rows.
|
|
24
|
+
- **`GET /dash/directory-sync/connection-count`** — Project-wide directory sync connection count (`{ count, mode }`). Managed mode counts `active` / `decommissioning` connections; legacy mode counts `scimProvider` rows. When directory sync is unavailable, returns `{ count: 0, mode: "unavailable" }` (see Unreleased; previously 404).
|
|
13
25
|
|
|
14
26
|
### Fixed
|
|
15
27
|
|
|
@@ -251,4 +263,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
251
263
|
[0.3.1]: https://github.com/better-auth/infrastructure/compare/infra@v0.3.0...infra@v0.3.1
|
|
252
264
|
[0.3.0]: https://github.com/better-auth/infrastructure/compare/infra@v0.2.14...infra@v0.3.0
|
|
253
265
|
[0.2.14]: https://github.com/better-auth/better-auth-infra/compare/@better-auth/infra@0.2.13...@better-auth/infra@0.2.14
|
|
254
|
-
[0.2.13]: https://github.com/better-auth/better-auth-infra/compare/@better-auth/infra@0.2.12...@better-auth/infra@0.2.13
|
|
266
|
+
[0.2.13]: https://github.com/better-auth/better-auth-infra/compare/@better-auth/infra@0.2.12...@better-auth/infra@0.2.13
|
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 identify, i as solvePoWChallenge, l as dashClient, n as decodePoWChallenge, o as resolveIdentifyClientRetry, r as encodePoWSolution, s as generateRequestId, t as createPowRetryTimeout } from "./pow-retry-
|
|
1
|
+
import { n as hash, o as createKV } from "./crypto-DZ0e3fu4.mjs";
|
|
2
|
+
import { a as resolveSentinelClientIdentifyUrl, c as identify, i as solvePoWChallenge, l as dashClient, n as decodePoWChallenge, o as resolveIdentifyClientRetry, r as encodePoWSolution, s as generateRequestId, t as createPowRetryTimeout } from "./pow-retry-Cl7MAw6O.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-D1m_WRqw.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
|
@@ -372,7 +372,12 @@ interface DashDirectoryRegenerateTokenResponse {
|
|
|
372
372
|
}
|
|
373
373
|
interface DashDirectorySyncConnectionCountResponse {
|
|
374
374
|
count: number;
|
|
375
|
-
|
|
375
|
+
/**
|
|
376
|
+
* `unavailable` = SCIM/managed directory sync is not configured on this
|
|
377
|
+
* auth server. Still a successful count (0) so platform callers do not
|
|
378
|
+
* fall back to walking every organization.
|
|
379
|
+
*/
|
|
380
|
+
mode: "managed" | "legacy" | "unavailable";
|
|
376
381
|
}
|
|
377
382
|
//#endregion
|
|
378
383
|
//#region src/events/constants.d.ts
|
|
@@ -666,6 +671,9 @@ interface DashSsoVerifyDomainResponse {
|
|
|
666
671
|
verified: boolean;
|
|
667
672
|
message?: string;
|
|
668
673
|
}
|
|
674
|
+
interface DashSsoConnectionCountResponse {
|
|
675
|
+
count: number;
|
|
676
|
+
}
|
|
669
677
|
//#endregion
|
|
670
678
|
//#region src/routes/two-factor/types.d.ts
|
|
671
679
|
interface DashTwoFactorEnableResponse {
|
|
@@ -1307,6 +1315,12 @@ export declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1307
1315
|
verified: import("zod").ZodLiteral<false>;
|
|
1308
1316
|
}, import("zod/v4/core").$strip>;
|
|
1309
1317
|
}, DashSsoMarkDomainVerifiedResponse>;
|
|
1318
|
+
countDashSsoConnections: import("better-call").StrictEndpoint<"/dash/sso/connection-count", {
|
|
1319
|
+
method: "GET";
|
|
1320
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
1321
|
+
payload: Record<string, unknown>;
|
|
1322
|
+
}>>[];
|
|
1323
|
+
}, DashSsoConnectionCountResponse>;
|
|
1310
1324
|
listDashTeamMembers: import("better-call").StrictEndpoint<"/dash/organization/:orgId/teams/:teamId/members", {
|
|
1311
1325
|
method: "GET";
|
|
1312
1326
|
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
@@ -2351,4 +2365,4 @@ export declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
2351
2365
|
} : {});
|
|
2352
2366
|
};
|
|
2353
2367
|
//#endregion
|
|
2354
|
-
export { type APIError, type ApiOptions, type ApiOptionsResolved, type CompromisedPasswordResult, type CredentialStuffingResult, type DBField, 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 DashDirectoryCredential, type DashDirectoryDeleteResponse, type DashDirectoryEvent, type DashDirectoryEventsResponse, type DashDirectoryItem, type DashDirectoryRegenerateTokenResponse, type DashDirectoryRotateCredentialResponse, type DashDirectorySyncConnectionCountResponse, type DashDirectorySyncSSOPairing, 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 DashSCIMManagedConnectionEventType, type DashSCIMManagedCredentialStatus, type DashSCIMScope, 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, type DirectorySyncConnectionStatus, type DirectorySyncMode, EMAIL_TEMPLATES, type EmailConfig, type EmailTemplateId, type EmailTemplateVariables, type Endpoint, type EndpointOptions, type EventLocation, type EventTypesResponse, type ImpossibleTravelResult, type InfraAuthContext, type InfraEndpointContext, type InfraEndpointContextValue, type InfraPluginConnectionOptions, type InfraPluginConnectionOptionsInternal, type KvOptions, type KvOptionsResolved, type KvRetryOptions, type KvRetryOptionsResolved, type LegacyDashDirectoryCreateResponse, type LegacyDashDirectoryItem, type LocationData, type LocationDataContext, type ORGANIZATION_USER_PREVIEW_SELECT, type OrganizationUserPreview, type PoWChallenge, type PoWSolution, type SCIMPlugin, type SMSConfig, type SMSTemplateId, type SMSTemplateVariables, 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, type UserEvent, type UserEventType, type UserEventsResponse, type asInfraContext, type createAuthMiddleware, createEmailSender, sendBulkEmails, sendEmail, sentinel };
|
|
2368
|
+
export { type APIError, type ApiOptions, type ApiOptionsResolved, type CompromisedPasswordResult, type CredentialStuffingResult, type DBField, 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 DashDirectoryCredential, type DashDirectoryDeleteResponse, type DashDirectoryEvent, type DashDirectoryEventsResponse, type DashDirectoryItem, type DashDirectoryRegenerateTokenResponse, type DashDirectoryRotateCredentialResponse, type DashDirectorySyncConnectionCountResponse, type DashDirectorySyncSSOPairing, 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 DashSCIMManagedConnectionEventType, type DashSCIMManagedCredentialStatus, type DashSCIMScope, type DashSendManyVerificationEmailsResponse, type DashSessionRevokeManyResponse, type DashSsoConnectionCountResponse, 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, type DirectorySyncConnectionStatus, type DirectorySyncMode, EMAIL_TEMPLATES, type EmailConfig, type EmailTemplateId, type EmailTemplateVariables, type Endpoint, type EndpointOptions, type EventLocation, type EventTypesResponse, type ImpossibleTravelResult, type InfraAuthContext, type InfraEndpointContext, type InfraEndpointContextValue, type InfraPluginConnectionOptions, type InfraPluginConnectionOptionsInternal, type KvOptions, type KvOptionsResolved, type KvRetryOptions, type KvRetryOptionsResolved, type LegacyDashDirectoryCreateResponse, type LegacyDashDirectoryItem, type LocationData, type LocationDataContext, type ORGANIZATION_USER_PREVIEW_SELECT, type OrganizationUserPreview, type PoWChallenge, type PoWSolution, type SCIMPlugin, type SMSConfig, type SMSTemplateId, type SMSTemplateVariables, 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, type UserEvent, type UserEventType, type UserEventsResponse, type asInfraContext, type createAuthMiddleware, createEmailSender, sendBulkEmails, sendEmail, sentinel };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as INFRA_USER_AGENT, n as INFRA_API_URL, o as PLUGIN_VERSION, r as INFRA_KV_URL } from "./constants-
|
|
2
|
-
import { a as createAPI, n as hash$1, o as createKV, r as hmacSha256Hex } from "./crypto-
|
|
1
|
+
import { i as INFRA_USER_AGENT, n as INFRA_API_URL, o as PLUGIN_VERSION, r as INFRA_KV_URL } from "./constants-D1m_WRqw.mjs";
|
|
2
|
+
import { a as createAPI, n as hash$1, o as createKV, r as hmacSha256Hex } from "./crypto-DZ0e3fu4.mjs";
|
|
3
3
|
import { EMAIL_TEMPLATES, createEmailSender, sendBulkEmails, sendEmail } from "./email.mjs";
|
|
4
4
|
import { getCurrentAdapter, getCurrentAuthContext, getCurrentDBAdapterAsyncLocalStorage, runWithTransaction } from "@better-auth/core/context";
|
|
5
5
|
import { APIError, generateId, getAuthTables, logger } from "better-auth";
|
|
@@ -5707,7 +5707,10 @@ const countDirectorySyncConnections = (options) => {
|
|
|
5707
5707
|
mode: "legacy"
|
|
5708
5708
|
};
|
|
5709
5709
|
}
|
|
5710
|
-
|
|
5710
|
+
return {
|
|
5711
|
+
count: 0,
|
|
5712
|
+
mode: "unavailable"
|
|
5713
|
+
};
|
|
5711
5714
|
});
|
|
5712
5715
|
};
|
|
5713
5716
|
const listOrganizationDirectories = (options) => {
|
|
@@ -8597,6 +8600,17 @@ async function resolveOIDCConfig(oidcConfig, _domain, ctx) {
|
|
|
8597
8600
|
issuer: oidcConfig.issuer
|
|
8598
8601
|
};
|
|
8599
8602
|
}
|
|
8603
|
+
const countSsoConnections = (options) => {
|
|
8604
|
+
return createAuthEndpoint("/dash/sso/connection-count", {
|
|
8605
|
+
method: "GET",
|
|
8606
|
+
use: [jwtMiddleware(options)]
|
|
8607
|
+
}, async (ctx) => {
|
|
8608
|
+
if (!isOrganizationEnabled(ctx)) return { count: 0 };
|
|
8609
|
+
if (!ctx.context.getPlugin("sso")) return { count: 0 };
|
|
8610
|
+
const count = await ctx.context.adapter.count({ model: "ssoProvider" });
|
|
8611
|
+
return { count: typeof count === "number" && Number.isFinite(count) && count >= 0 ? Math.floor(count) : 0 };
|
|
8612
|
+
});
|
|
8613
|
+
};
|
|
8600
8614
|
const listOrganizationSsoProviders = (options) => {
|
|
8601
8615
|
return createAuthEndpoint("/dash/organization/:id/sso-providers", {
|
|
8602
8616
|
method: "GET",
|
|
@@ -11181,6 +11195,7 @@ const dash = (options) => {
|
|
|
11181
11195
|
verifyDashSsoProviderDomain: verifySsoProviderDomain(settings),
|
|
11182
11196
|
deleteDashSsoProvider: deleteSsoProvider(settings),
|
|
11183
11197
|
markDashSsoProviderDomainVerified: markSsoProviderDomainVerified(settings),
|
|
11198
|
+
countDashSsoConnections: countSsoConnections(settings),
|
|
11184
11199
|
listDashTeamMembers: listTeamMembers(settings),
|
|
11185
11200
|
createDashOrganization: createOrganization(settings),
|
|
11186
11201
|
deleteDashOrganization: deleteOrganization(settings),
|
package/dist/native.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as createKV, t as bytesToHex } from "./crypto-
|
|
2
|
-
import { a as resolveSentinelClientIdentifyUrl, c as identify, i as solvePoWChallenge, l as dashClient, n as decodePoWChallenge, o as resolveIdentifyClientRetry, r as encodePoWSolution, t as createPowRetryTimeout } from "./pow-retry-
|
|
1
|
+
import { o as createKV, t as bytesToHex } from "./crypto-DZ0e3fu4.mjs";
|
|
2
|
+
import { a as resolveSentinelClientIdentifyUrl, c as identify, i as solvePoWChallenge, l as dashClient, n as decodePoWChallenge, o as resolveIdentifyClientRetry, r as encodePoWSolution, t as createPowRetryTimeout } from "./pow-retry-Cl7MAw6O.mjs";
|
|
3
3
|
import { env } from "@better-auth/core/env";
|
|
4
4
|
import { Dimensions, InteractionManager, PixelRatio, Platform } from "react-native";
|
|
5
5
|
//#region src/sentinel/native/components.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as randomBytes, n as hash, t as bytesToHex } from "./crypto-
|
|
1
|
+
import { i as randomBytes, n as hash, t as bytesToHex } from "./crypto-DZ0e3fu4.mjs";
|
|
2
2
|
//#region src/dash-client.ts
|
|
3
3
|
function resolveDashUserId(input, options) {
|
|
4
4
|
return input.userId || options?.resolveUserId?.({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/infra",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"description": "Dashboard and analytics plugin for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -66,16 +66,16 @@
|
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://better-auth.com",
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@better-auth/kysely-adapter": "1.7.
|
|
70
|
-
"@better-auth/scim": "1.7.
|
|
71
|
-
"@better-auth/sso": "1.7.
|
|
69
|
+
"@better-auth/kysely-adapter": "1.7.6",
|
|
70
|
+
"@better-auth/scim": "1.7.6",
|
|
71
|
+
"@better-auth/sso": "1.7.6",
|
|
72
72
|
"@infra/mocks": "0.0.0",
|
|
73
73
|
"@infra/utils": "0.0.0",
|
|
74
74
|
"@types/bun": "latest",
|
|
75
75
|
"@types/node": "^24.12.0",
|
|
76
76
|
"@vitest/browser-playwright": "5.0.0",
|
|
77
77
|
"@vitest/coverage-istanbul": "^5.0.0",
|
|
78
|
-
"better-auth": "1.7.
|
|
78
|
+
"better-auth": "1.7.6",
|
|
79
79
|
"expo-crypto": "^57.0.3",
|
|
80
80
|
"msw": "^2.14.6",
|
|
81
81
|
"playwright": "^1.63.0",
|