@better-auth/i18n 1.8.0-beta.1 → 1.8.0-beta.3

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 CHANGED
@@ -1,5 +1,4 @@
1
- import { t as i18n } from "./index-ClrKZ6Oa.mjs";
2
-
1
+ import { t as i18n } from "./index-C2g2UF2B.mjs";
3
2
  //#region src/client.d.ts
4
3
  /**
5
4
  * i18n client plugin for Better Auth
@@ -18,10 +17,9 @@ import { t as i18n } from "./index-ClrKZ6Oa.mjs";
18
17
  * });
19
18
  * ```
20
19
  */
21
- declare const i18nClient: () => {
20
+ export declare const i18nClient: () => {
22
21
  id: "i18n";
23
22
  version: string;
24
23
  $InferServerPlugin: ReturnType<typeof i18n>;
25
24
  };
26
- //#endregion
27
- export { i18nClient };
25
+ //#endregion
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-CJhU1MNF.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-HRaJjPrD.mjs";
2
2
  //#region src/client.ts
3
3
  /**
4
4
  * i18n client plugin for Better Auth
@@ -1,12 +1,11 @@
1
1
  import { BetterAuthPluginRegistry, BetterAuthPluginRegistryIdentifier, GenericEndpointContext, UnionToIntersection } from "@better-auth/core";
2
-
3
2
  //#region src/types.d.ts
4
3
  type ALL_PLUGIN_ERROR_CODE_KEYS = keyof UnionToIntersection<{ [Key in Exclude<BetterAuthPluginRegistryIdentifier, "i18n">]: BetterAuthPluginRegistry<unknown, unknown>[Key] extends {
5
4
  creator: infer C;
6
5
  } ? C extends ((...args: any[]) => infer P) ? P extends {
7
6
  $ERROR_CODES: infer E;
8
- } ? E : {} : {} : {} }[Exclude<BetterAuthPluginRegistryIdentifier, "i18n">]>;
9
- type InternalTranslationDictionary = Partial<{ [Key in ALL_PLUGIN_ERROR_CODE_KEYS]: string }>;
7
+ } ? E : {} : {} : {}; }[Exclude<BetterAuthPluginRegistryIdentifier, "i18n">]>;
8
+ type InternalTranslationDictionary = Partial<{ [Key in ALL_PLUGIN_ERROR_CODE_KEYS]: string; }>;
10
9
  /**
11
10
  * Translation dictionary mapping error codes to translated messages
12
11
  */
@@ -27,7 +26,7 @@ interface I18nOptions<Locales extends string[]> {
27
26
  * fr: { USER_NOT_FOUND: "Utilisateur non trouvé" }
28
27
  * }
29
28
  */
30
- translations: { [Locale in Locales[number]]: TranslationDictionary };
29
+ translations: { [Locale in Locales[number]]: TranslationDictionary; };
31
30
  /**
32
31
  * Default/fallback locale when detection fails
33
32
  * @default "en"
@@ -1,7 +1,6 @@
1
- import { E as TranslationDictionary, T as LocaleDetectionStrategy, w as I18nOptions } from "./index-CYmtmQve.mjs";
1
+ import { E as TranslationDictionary, T as LocaleDetectionStrategy, w as I18nOptions } from "./index-BQCZ4CCj.mjs";
2
2
  import { GenericEndpointContext } from "@better-auth/core";
3
-
4
- //#region ../../node_modules/.pnpm/better-call@1.4.2_zod@4.5.4/node_modules/better-call/dist/standard-schema.d.mts
3
+ //#region ../../node_modules/.pnpm/better-call@1.4.4_zod@4.5.4/node_modules/better-call/dist/standard-schema.d.mts
5
4
  //#region src/standard-schema.d.ts
6
5
  /** The Standard Schema interface. */
7
6
  interface StandardSchemaV1<Input = unknown, Output = Input> {
@@ -57,9 +56,9 @@ declare namespace StandardSchemaV1 {
57
56
  type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
58
57
  /** Infers the output type of a Standard Schema. */
59
58
  type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
60
- } //#endregion
59
+ }
61
60
  //#endregion
62
- //#region ../../node_modules/.pnpm/better-call@1.4.2_zod@4.5.4/node_modules/better-call/dist/error.d.mts
61
+ //#region ../../node_modules/.pnpm/better-call@1.4.4_zod@4.5.4/node_modules/better-call/dist/error.d.mts
63
62
  declare const statusCodes: {
64
63
  OK: number;
65
64
  CREATED: number;
@@ -135,9 +134,9 @@ declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "
135
134
  cause?: unknown;
136
135
  } & Record<string, any>) | undefined, headers?: HeadersInit | undefined, statusCode?: number | undefined) => InternalAPIError & {
137
136
  errorStack: string | undefined;
138
- }; //#endregion
137
+ };
139
138
  //#endregion
140
- //#region ../../node_modules/.pnpm/better-call@1.4.2_zod@4.5.4/node_modules/better-call/dist/openapi.d.mts
139
+ //#region ../../node_modules/.pnpm/better-call@1.4.4_zod@4.5.4/node_modules/better-call/dist/openapi.d.mts
141
140
  //#region src/openapi.d.ts
142
141
  type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
143
142
  interface OpenAPIParameter {
@@ -159,7 +158,7 @@ interface OpenAPIParameter {
159
158
  } | undefined;
160
159
  }
161
160
  //#endregion
162
- //#region ../../node_modules/.pnpm/better-call@1.4.2_zod@4.5.4/node_modules/better-call/dist/endpoint.d.mts
161
+ //#region ../../node_modules/.pnpm/better-call@1.4.4_zod@4.5.4/node_modules/better-call/dist/endpoint.d.mts
163
162
  //#region src/endpoint.d.ts
164
163
  interface EndpointBaseOptions {
165
164
  /**
@@ -329,10 +328,7 @@ interface EndpointBaseOptions {
329
328
  * A callback to run before a validation error is thrown
330
329
  * You can customize the validation error message by throwing your own APIError
331
330
  */
332
- onValidationError?: ({
333
- issues,
334
- message
335
- }: {
331
+ onValidationError?: ({ issues, message }: {
336
332
  message: string;
337
333
  issues: readonly StandardSchemaV1.Issue[];
338
334
  }) => void | Promise<void>;
@@ -376,21 +372,21 @@ type EndpointBodyMethodOptions = {
376
372
  };
377
373
  type EndpointOptions = EndpointBaseOptions & EndpointBodyMethodOptions;
378
374
  //#endregion
379
- //#region ../../node_modules/.pnpm/better-call@1.4.2_zod@4.5.4/node_modules/better-call/dist/context.d.mts
380
- type InferBodyInput<Options extends EndpointOptions | MiddlewareOptions, Body = (Options["metadata"] extends {
375
+ //#region ../../node_modules/.pnpm/better-call@1.4.4_zod@4.5.4/node_modules/better-call/dist/context.d.mts
376
+ type InferBodyInput<Options extends EndpointOptions | MiddlewareOptions, Body = Options["metadata"] extends {
381
377
  $Infer: {
382
378
  body: infer B;
383
379
  };
384
- } ? B : Options["body"] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Options["body"]> : undefined)> = undefined extends Body ? {
380
+ } ? B : Options["body"] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Options["body"]> : undefined> = undefined extends Body ? {
385
381
  body?: Body;
386
382
  } : {
387
383
  body: Body;
388
384
  };
389
- type InferQueryInput<Options extends EndpointOptions | MiddlewareOptions, Query = (Options["metadata"] extends {
385
+ type InferQueryInput<Options extends EndpointOptions | MiddlewareOptions, Query = Options["metadata"] extends {
390
386
  $Infer: {
391
387
  query: infer Query;
392
388
  };
393
- } ? Query : Options["query"] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Options["query"]> : Record<string, any> | undefined)> = undefined extends Query ? {
389
+ } ? Query : Options["query"] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Options["query"]> : Record<string, any> | undefined> = undefined extends Query ? {
394
390
  query?: Query;
395
391
  } : {
396
392
  query: Query;
@@ -406,7 +402,7 @@ type InferHeadersInput<Option extends EndpointOptions | MiddlewareOptions> = Opt
406
402
  headers?: HeadersInit | undefined;
407
403
  };
408
404
  //#endregion
409
- //#region ../../node_modules/.pnpm/better-call@1.4.2_zod@4.5.4/node_modules/better-call/dist/middleware.d.mts
405
+ //#region ../../node_modules/.pnpm/better-call@1.4.4_zod@4.5.4/node_modules/better-call/dist/middleware.d.mts
410
406
  //#region src/middleware.d.ts
411
407
  interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
412
408
  type MiddlewareInputContext<Options extends MiddlewareOptions> = InferBodyInput<Options> & InferQueryInput<Options> & InferRequestInput<Options> & InferHeadersInput<Options> & {
@@ -418,7 +414,7 @@ type MiddlewareFunction = (...args: never[]) => Promise<unknown>;
418
414
  type MiddlewareHandler = (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<unknown>;
419
415
  type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler extends MiddlewareFunction = MiddlewareHandler> = Handler & {
420
416
  options: Options;
421
- }; //#endregion
417
+ };
422
418
  //#endregion
423
419
  //#region src/index.d.ts
424
420
  declare module "@better-auth/core" {
@@ -461,7 +457,7 @@ declare const i18n: <Locales extends string[]>(options: I18nOptions<Locales>) =>
461
457
  }[];
462
458
  };
463
459
  options: {
464
- translations: { [Locale in Locales[number]]: TranslationDictionary };
460
+ translations: { [Locale in Locales[number]]: TranslationDictionary; };
465
461
  defaultLocale: Locales[number];
466
462
  detection: LocaleDetectionStrategy[];
467
463
  localeCookie: string;
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as i18n } from "./index-ClrKZ6Oa.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 };
1
+ import { t as i18n } from "./index-C2g2UF2B.mjs";
2
+ import { E as TranslationDictionary, T as LocaleDetectionStrategy, t as index_d_exports, w as I18nOptions } from "./index-BQCZ4CCj.mjs";
3
+ export { type I18nOptions, type LocaleDetectionStrategy, type TranslationDictionary, i18n, index_d_exports as locales };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { t as PACKAGE_VERSION } from "./version-CJhU1MNF.mjs";
2
- import { t as locales_exports } from "./locales-CSRpG5Mc.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-HRaJjPrD.mjs";
2
+ import { t as locales_exports } from "./locales-Bf12c6T-.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
@@ -74,12 +74,10 @@ const i18n = (options) => {
74
74
  if (typeof userLocale === "string" && availableLocales.includes(userLocale)) locale = userLocale;
75
75
  }
76
76
  break;
77
- case "callback":
78
- if (opts.getLocale) {
79
- const callbackLocale = await opts.getLocale(ctx);
80
- if (callbackLocale && availableLocales.includes(callbackLocale)) locale = callbackLocale;
81
- }
82
- break;
77
+ case "callback": if (opts.getLocale) {
78
+ const callbackLocale = await opts.getLocale(ctx);
79
+ if (callbackLocale && availableLocales.includes(callbackLocale)) locale = callbackLocale;
80
+ }
83
81
  }
84
82
  if (locale) return locale;
85
83
  }
@@ -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-CYmtmQve.mjs";
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-BQCZ4CCj.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 };
@@ -1,2 +1 @@
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
- export { ar, bn, de, en, es, fa, fr, hi, id, it, ja, ko, nl, pl, pt, ru, sv, th, tr, uk, vi, zh };
1
+ export { C as ar, S as bn, x as de, b as en, y as es, v as fa, _ as fr, g as hi, h as id, m as it, p as ja, f as ko, d as nl, u as pl, l as pt, c as ru, s as sv, o as th, a as tr, i as uk, r as vi, n as zh } from "../locales-Bf12c6T-.mjs";
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  //#region src/locales/ar.ts
3
3
  /**
4
4
  * Arabic translations
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const PACKAGE_VERSION = "1.8.0-beta.1";
3
+ const PACKAGE_VERSION = "1.8.0-beta.3";
4
4
  //#endregion
5
5
  export { PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/i18n",
3
- "version": "1.8.0-beta.1",
3
+ "version": "1.8.0-beta.3",
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.21.10",
62
- "@better-auth/core": "1.8.0-beta.1",
63
- "better-auth": "1.8.0-beta.1"
61
+ "tsdown": "0.23.1",
62
+ "@better-auth/core": "1.8.0-beta.3",
63
+ "better-auth": "1.8.0-beta.3"
64
64
  },
65
65
  "peerDependencies": {
66
- "@better-auth/core": "^1.8.0-beta.1",
67
- "better-auth": "^1.8.0-beta.1"
66
+ "@better-auth/core": "^1.8.0-beta.3",
67
+ "better-auth": "^1.8.0-beta.3"
68
68
  },
69
69
  "scripts": {
70
70
  "build": "tsdown",