@better-auth/infra 0.4.7 → 0.4.8
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 +6 -0
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +2 -2
- package/dist/{constants-BypXAAvQ.mjs → constants-C8_UJzzu.mjs} +1 -1
- package/dist/{crypto-C9Iqqv8l.mjs → crypto-DRS7yhmR.mjs} +11 -8
- package/dist/email.d.mts +5 -0
- package/dist/email.mjs +4 -3
- package/dist/{identify-client-options-Be9mAljS.d.mts → identify-client-options-DgKA4Eq8.d.mts} +1 -1
- package/dist/index.d.mts +170 -165
- package/dist/index.mjs +55 -28
- package/dist/native.d.mts +1 -1
- package/dist/native.mjs +2 -2
- package/dist/{pow-retry-Bk5otjQT.mjs → pow-retry-Di0eUKbA.mjs} +1 -1
- package/dist/{types-Ba7NK8JV.d.mts → types-BkUWsMpe.d.mts} +67 -196
- package/package.json +18 -10
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ 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.8] - 2026-09-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`apiOptions.headers` / `kvOptions.headers`** — Extra headers on dash, sentinel, email, and SMS HTTP clients. Built-in auth headers cannot be overridden.
|
|
13
|
+
|
|
8
14
|
## [0.4.7] - 2026-09-07
|
|
9
15
|
|
|
10
16
|
### Fixed
|
package/dist/client.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DashGetAllAuditLogsInput, i as DashClientOptions, n as DashAuditLog, o as DashGetAuditLogsInput, r as DashAuditLogsResponse, s as dashClient, t as IdentifyClientOptions } from "./identify-client-options-
|
|
1
|
+
import { a as DashGetAllAuditLogsInput, i as DashClientOptions, n as DashAuditLog, o as DashGetAuditLogsInput, r as DashAuditLogsResponse, s as dashClient, t as IdentifyClientOptions } from "./identify-client-options-DgKA4Eq8.mjs";
|
|
2
2
|
import { BetterFetchPlugin } from "@better-fetch/fetch";
|
|
3
3
|
//#region src/sentinel/client.d.ts
|
|
4
4
|
interface SentinelClientOptions {
|
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-DRS7yhmR.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-Di0eUKbA.mjs";
|
|
3
3
|
import { env } from "@better-auth/core/env";
|
|
4
4
|
//#region src/sentinel/fingerprint.ts
|
|
5
5
|
function murmurhash3(str, seed = 0) {
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { i as INFRA_USER_AGENT } from "./constants-
|
|
1
|
+
import { i as INFRA_USER_AGENT } from "./constants-C8_UJzzu.mjs";
|
|
2
2
|
import { createFetch } from "@better-fetch/fetch";
|
|
3
3
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
4
4
|
//#region src/fetch.ts
|
|
5
5
|
function createAPI(options, fetchOptions) {
|
|
6
6
|
return createFetch({
|
|
7
7
|
baseURL: options.apiUrl,
|
|
8
|
+
timeout: options.apiOptions.timeout,
|
|
9
|
+
...fetchOptions,
|
|
8
10
|
headers: {
|
|
11
|
+
...options.apiOptions.headers,
|
|
9
12
|
"user-agent": INFRA_USER_AGENT,
|
|
10
13
|
"x-api-key": options.apiKey
|
|
11
|
-
}
|
|
12
|
-
timeout: options.apiOptions.timeout,
|
|
13
|
-
...fetchOptions
|
|
14
|
+
}
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
17
|
function createKV(options, fetchOptions) {
|
|
17
|
-
const headers = { "user-agent": INFRA_USER_AGENT };
|
|
18
|
-
if (options.apiKey) headers["x-api-key"] = options.apiKey;
|
|
19
18
|
return createFetch({
|
|
20
19
|
baseURL: options.kvUrl,
|
|
21
|
-
headers,
|
|
22
20
|
timeout: options.timeout ?? 1e3,
|
|
23
|
-
...fetchOptions
|
|
21
|
+
...fetchOptions,
|
|
22
|
+
headers: {
|
|
23
|
+
...options.headers,
|
|
24
|
+
"user-agent": INFRA_USER_AGENT,
|
|
25
|
+
...options.apiKey ? { "x-api-key": options.apiKey } : {}
|
|
26
|
+
}
|
|
24
27
|
});
|
|
25
28
|
}
|
|
26
29
|
//#endregion
|
package/dist/email.d.mts
CHANGED
|
@@ -155,6 +155,11 @@ interface EmailConfig {
|
|
|
155
155
|
* @default 3000
|
|
156
156
|
*/
|
|
157
157
|
timeout?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Extra headers on every email API request.
|
|
160
|
+
* Cannot override built-in headers (`user-agent`, `Authorization`).
|
|
161
|
+
*/
|
|
162
|
+
headers?: Record<string, string>;
|
|
158
163
|
};
|
|
159
164
|
/**
|
|
160
165
|
* Timeout for Dash email API HTTP requests (milliseconds).
|
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-C8_UJzzu.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";
|
|
@@ -37,11 +37,12 @@ function createEmailSender(config) {
|
|
|
37
37
|
if (!apiKey) logger.warn("[Dash] No API key provided for email sending. Set BETTER_AUTH_API_KEY environment variable or pass apiKey in config.");
|
|
38
38
|
const $api = createFetch({
|
|
39
39
|
baseURL: apiUrl,
|
|
40
|
+
timeout: config?.apiOptions?.timeout ?? config?.apiTimeout ?? 3e3,
|
|
40
41
|
headers: {
|
|
42
|
+
...config?.apiOptions?.headers,
|
|
41
43
|
"user-agent": INFRA_USER_AGENT,
|
|
42
44
|
Authorization: `Bearer ${apiKey}`
|
|
43
|
-
}
|
|
44
|
-
timeout: config?.apiOptions?.timeout ?? config?.apiTimeout ?? 3e3
|
|
45
|
+
}
|
|
45
46
|
});
|
|
46
47
|
/**
|
|
47
48
|
* Send an email using a template from Better Auth Infra
|
package/dist/{identify-client-options-Be9mAljS.d.mts → identify-client-options-DgKA4Eq8.d.mts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as KvRetryOptions } from "./types-BkUWsMpe.mjs";
|
|
2
2
|
import { BetterAuthClientOptions, ClientStore } from "better-auth";
|
|
3
3
|
import { BetterFetch } from "@better-fetch/fetch";
|
|
4
4
|
//#region src/dash-client.d.ts
|