@better-auth/i18n 1.7.0-rc.4 → 1.7.0-rc.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/dist/client.d.mts +2 -1
- package/dist/client.mjs +1 -1
- package/dist/{index-BQCZ4CCj.d.mts → index-CYmtmQve.d.mts} +4 -3
- package/dist/{index-DE9mahtb.d.mts → index-Cy3_CEi-.d.mts} +30 -24
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/locales/index.d.mts +1 -1
- package/dist/locales/index.mjs +1 -1
- package/dist/{locales-Bf12c6T-.mjs → locales-CSRpG5Mc.mjs} +1 -1
- package/dist/{version-Do0kTnv7.mjs → version-CeAd3ooE.mjs} +1 -1
- package/package.json +6 -6
- /package/dist/{rolldown-runtime-D7D4PA-g.mjs → chunk-CfYAbeIz.mjs} +0 -0
package/dist/client.d.mts
CHANGED
package/dist/client.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BetterAuthPluginRegistry, BetterAuthPluginRegistryIdentifier, GenericEndpointContext, UnionToIntersection } from "@better-auth/core";
|
|
2
|
+
|
|
2
3
|
//#region src/types.d.ts
|
|
3
4
|
type ALL_PLUGIN_ERROR_CODE_KEYS = keyof UnionToIntersection<{ [Key in Exclude<BetterAuthPluginRegistryIdentifier, "i18n">]: BetterAuthPluginRegistry<unknown, unknown>[Key] extends {
|
|
4
5
|
creator: infer C;
|
|
5
6
|
} ? C extends ((...args: any[]) => infer P) ? P extends {
|
|
6
7
|
$ERROR_CODES: infer E;
|
|
7
|
-
} ? E : {} : {} : {}
|
|
8
|
-
type InternalTranslationDictionary = Partial<{ [Key in ALL_PLUGIN_ERROR_CODE_KEYS]: string
|
|
8
|
+
} ? E : {} : {} : {} }[Exclude<BetterAuthPluginRegistryIdentifier, "i18n">]>;
|
|
9
|
+
type InternalTranslationDictionary = Partial<{ [Key in ALL_PLUGIN_ERROR_CODE_KEYS]: string }>;
|
|
9
10
|
/**
|
|
10
11
|
* Translation dictionary mapping error codes to translated messages
|
|
11
12
|
*/
|
|
@@ -26,7 +27,7 @@ interface I18nOptions<Locales extends string[]> {
|
|
|
26
27
|
* fr: { USER_NOT_FOUND: "Utilisateur non trouvé" }
|
|
27
28
|
* }
|
|
28
29
|
*/
|
|
29
|
-
translations: { [Locale in Locales[number]]: TranslationDictionary
|
|
30
|
+
translations: { [Locale in Locales[number]]: TranslationDictionary };
|
|
30
31
|
/**
|
|
31
32
|
* Default/fallback locale when detection fails
|
|
32
33
|
* @default "en"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { E as TranslationDictionary, T as LocaleDetectionStrategy, w as I18nOptions } from "./index-
|
|
1
|
+
import { E as TranslationDictionary, T as LocaleDetectionStrategy, w as I18nOptions } from "./index-CYmtmQve.mjs";
|
|
2
2
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/standard-schema.d.mts
|
|
4
5
|
//#region src/standard-schema.d.ts
|
|
5
6
|
/** The Standard Schema interface. */
|
|
6
7
|
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
@@ -56,9 +57,9 @@ declare namespace StandardSchemaV1 {
|
|
|
56
57
|
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
57
58
|
/** Infers the output type of a Standard Schema. */
|
|
58
59
|
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
59
|
-
}
|
|
60
|
+
} //#endregion
|
|
60
61
|
//#endregion
|
|
61
|
-
//#region ../../node_modules/.pnpm/better-call@1.
|
|
62
|
+
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/error.d.mts
|
|
62
63
|
declare const statusCodes: {
|
|
63
64
|
OK: number;
|
|
64
65
|
CREATED: number;
|
|
@@ -134,9 +135,9 @@ declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "
|
|
|
134
135
|
cause?: unknown;
|
|
135
136
|
} & Record<string, any>) | undefined, headers?: HeadersInit | undefined, statusCode?: number | undefined) => InternalAPIError & {
|
|
136
137
|
errorStack: string | undefined;
|
|
137
|
-
};
|
|
138
|
+
}; //#endregion
|
|
138
139
|
//#endregion
|
|
139
|
-
//#region ../../node_modules/.pnpm/better-call@1.
|
|
140
|
+
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/openapi.d.mts
|
|
140
141
|
//#region src/openapi.d.ts
|
|
141
142
|
type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
|
|
142
143
|
interface OpenAPIParameter {
|
|
@@ -158,7 +159,7 @@ interface OpenAPIParameter {
|
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
//#endregion
|
|
161
|
-
//#region ../../node_modules/.pnpm/better-call@1.
|
|
162
|
+
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/endpoint.d.mts
|
|
162
163
|
//#region src/endpoint.d.ts
|
|
163
164
|
interface EndpointBaseOptions {
|
|
164
165
|
/**
|
|
@@ -316,7 +317,7 @@ interface EndpointBaseOptions {
|
|
|
316
317
|
/**
|
|
317
318
|
* List of middlewares to use
|
|
318
319
|
*/
|
|
319
|
-
use?:
|
|
320
|
+
use?: MiddlewareHandler[];
|
|
320
321
|
/**
|
|
321
322
|
* A callback to run before any API error is throw or returned
|
|
322
323
|
*
|
|
@@ -328,7 +329,10 @@ interface EndpointBaseOptions {
|
|
|
328
329
|
* A callback to run before a validation error is thrown
|
|
329
330
|
* You can customize the validation error message by throwing your own APIError
|
|
330
331
|
*/
|
|
331
|
-
onValidationError?: ({
|
|
332
|
+
onValidationError?: ({
|
|
333
|
+
issues,
|
|
334
|
+
message
|
|
335
|
+
}: {
|
|
332
336
|
message: string;
|
|
333
337
|
issues: readonly StandardSchemaV1.Issue[];
|
|
334
338
|
}) => void | Promise<void>;
|
|
@@ -372,19 +376,7 @@ type EndpointBodyMethodOptions = {
|
|
|
372
376
|
};
|
|
373
377
|
type EndpointOptions = EndpointBaseOptions & EndpointBodyMethodOptions;
|
|
374
378
|
//#endregion
|
|
375
|
-
//#region ../../node_modules/.pnpm/better-call@1.
|
|
376
|
-
//#region src/middleware.d.ts
|
|
377
|
-
interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
|
|
378
|
-
type MiddlewareInputContext<Options extends MiddlewareOptions> = InferBodyInput<Options> & InferQueryInput<Options> & InferRequestInput<Options> & InferHeadersInput<Options> & {
|
|
379
|
-
asResponse?: boolean;
|
|
380
|
-
returnHeaders?: boolean;
|
|
381
|
-
use?: Middleware[];
|
|
382
|
-
};
|
|
383
|
-
type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler extends (inputCtx: any) => Promise<any> = any> = Handler & {
|
|
384
|
-
options: Options;
|
|
385
|
-
};
|
|
386
|
-
//#endregion
|
|
387
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/context.d.mts
|
|
379
|
+
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/context.d.mts
|
|
388
380
|
type InferBodyInput<Options extends EndpointOptions | MiddlewareOptions, Body = (Options["metadata"] extends {
|
|
389
381
|
$Infer: {
|
|
390
382
|
body: infer B;
|
|
@@ -414,6 +406,20 @@ type InferHeadersInput<Option extends EndpointOptions | MiddlewareOptions> = Opt
|
|
|
414
406
|
headers?: HeadersInit;
|
|
415
407
|
};
|
|
416
408
|
//#endregion
|
|
409
|
+
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/middleware.d.mts
|
|
410
|
+
//#region src/middleware.d.ts
|
|
411
|
+
interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
|
|
412
|
+
type MiddlewareInputContext<Options extends MiddlewareOptions> = InferBodyInput<Options> & InferQueryInput<Options> & InferRequestInput<Options> & InferHeadersInput<Options> & {
|
|
413
|
+
asResponse?: boolean;
|
|
414
|
+
returnHeaders?: boolean;
|
|
415
|
+
use?: MiddlewareHandler[];
|
|
416
|
+
};
|
|
417
|
+
type MiddlewareFunction = (...args: never[]) => Promise<unknown>;
|
|
418
|
+
type MiddlewareHandler = (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<unknown>;
|
|
419
|
+
type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler extends MiddlewareFunction = MiddlewareHandler> = Handler & {
|
|
420
|
+
options: Options;
|
|
421
|
+
}; //#endregion
|
|
422
|
+
//#endregion
|
|
417
423
|
//#region src/index.d.ts
|
|
418
424
|
declare module "@better-auth/core" {
|
|
419
425
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -451,11 +457,11 @@ declare const i18n: <Locales extends string[]>(options: I18nOptions<Locales>) =>
|
|
|
451
457
|
hooks: {
|
|
452
458
|
after: {
|
|
453
459
|
matcher: () => true;
|
|
454
|
-
handler: (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<void
|
|
460
|
+
handler: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<void>>;
|
|
455
461
|
}[];
|
|
456
462
|
};
|
|
457
463
|
options: {
|
|
458
|
-
translations: { [Locale in Locales[number]]: TranslationDictionary
|
|
464
|
+
translations: { [Locale in Locales[number]]: TranslationDictionary };
|
|
459
465
|
defaultLocale: Locales[number];
|
|
460
466
|
detection: LocaleDetectionStrategy[];
|
|
461
467
|
localeCookie: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as i18n } from "./index-
|
|
2
|
-
import { E as TranslationDictionary, T as LocaleDetectionStrategy, t as index_d_exports, w as I18nOptions } from "./index-
|
|
3
|
-
export {
|
|
1
|
+
import { t as i18n } from "./index-Cy3_CEi-.mjs";
|
|
2
|
+
import { E as TranslationDictionary, T as LocaleDetectionStrategy, t as index_d_exports, w as I18nOptions } from "./index-CYmtmQve.mjs";
|
|
3
|
+
export { I18nOptions, LocaleDetectionStrategy, TranslationDictionary, i18n, index_d_exports as locales };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
2
|
-
import { t as locales_exports } from "./locales-
|
|
1
|
+
import { t as PACKAGE_VERSION } from "./version-CeAd3ooE.mjs";
|
|
2
|
+
import { t as locales_exports } from "./locales-CSRpG5Mc.mjs";
|
|
3
3
|
import { APIError, createAuthMiddleware, isAPIError } from "better-auth/api";
|
|
4
4
|
import { parseCookies } from "better-auth/cookies";
|
|
5
5
|
//#region src/index.ts
|
package/dist/locales/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as ar, S as bn, _ as fr, a as tr, b as en, c as ru, d as nl, f as ko, g as hi, h as id, i as uk, l as pt, m as it, n as zh, o as th, p as ja, r as vi, s as sv, u as pl, v as fa, x as de, y as es } from "../index-
|
|
1
|
+
import { C as ar, S as bn, _ as fr, a as tr, b as en, c as ru, d as nl, f as ko, g as hi, h as id, i as uk, l as pt, m as it, n as zh, o as th, p as ja, r as vi, s as sv, u as pl, v as fa, x as de, y as es } from "../index-CYmtmQve.mjs";
|
|
2
2
|
export { ar, bn, de, en, es, fa, fr, hi, id, it, ja, ko, nl, pl, pt, ru, sv, th, tr, uk, vi, zh };
|
package/dist/locales/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as ar, S as bn, _ as fr, a as tr, b as en, c as ru, d as nl, f as ko, g as hi, h as id, i as uk, l as pt, m as it, n as zh, o as th, p as ja, r as vi, s as sv, u as pl, v as fa, x as de, y as es } from "../locales-
|
|
1
|
+
import { C as ar, S as bn, _ as fr, a as tr, b as en, c as ru, d as nl, f as ko, g as hi, h as id, i as uk, l as pt, m as it, n as zh, o as th, p as ja, r as vi, s as sv, u as pl, v as fa, x as de, y as es } from "../locales-CSRpG5Mc.mjs";
|
|
2
2
|
export { ar, bn, de, en, es, fa, fr, hi, id, it, ja, ko, nl, pl, pt, ru, sv, th, tr, uk, vi, zh };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/i18n",
|
|
3
|
-
"version": "1.7.0-rc.
|
|
3
|
+
"version": "1.7.0-rc.6",
|
|
4
4
|
"description": "i18n plugin for Better Auth - translate error messages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"tsdown": "0.
|
|
62
|
-
"@better-auth/core": "1.7.0-rc.
|
|
63
|
-
"better-auth": "1.7.0-rc.
|
|
61
|
+
"tsdown": "0.21.10",
|
|
62
|
+
"@better-auth/core": "1.7.0-rc.6",
|
|
63
|
+
"better-auth": "1.7.0-rc.6"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@better-auth/core": "^1.7.0-rc.
|
|
67
|
-
"better-auth": "^1.7.0-rc.
|
|
66
|
+
"@better-auth/core": "^1.7.0-rc.6",
|
|
67
|
+
"better-auth": "^1.7.0-rc.6"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "tsdown",
|
|
File without changes
|