@better-auth/i18n 1.6.26 → 1.6.28

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,4 +1,5 @@
1
- import { t as i18n } from "./index-DB9G0sAf.mjs";
1
+ import { t as i18n } from "./index-CJ7rDBMd.mjs";
2
+
2
3
  //#region src/client.d.ts
3
4
  /**
4
5
  * i18n client plugin for Better Auth
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-CPj5-4mL.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-6ZHwEASO.mjs";
2
2
  //#region src/client.ts
3
3
  /**
4
4
  * i18n client plugin for Better Auth
@@ -1,5 +1,6 @@
1
1
  import { BetterAuthPluginRegistry, BetterAuthPluginRegistryIdentifier, GenericEndpointContext, UnionToIntersection } from "@better-auth/core";
2
- //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/standard-schema.d.mts
2
+
3
+ //#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/standard-schema.d.mts
3
4
  //#region src/standard-schema.d.ts
4
5
  /** The Standard Schema interface. */
5
6
  interface StandardSchemaV1<Input = unknown, Output = Input> {
@@ -55,9 +56,9 @@ declare namespace StandardSchemaV1 {
55
56
  type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
56
57
  /** Infers the output type of a Standard Schema. */
57
58
  type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
58
- }
59
+ } //#endregion
59
60
  //#endregion
60
- //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/error.d.mts
61
+ //#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/error.d.mts
61
62
  declare const statusCodes: {
62
63
  OK: number;
63
64
  CREATED: number;
@@ -133,9 +134,9 @@ declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "
133
134
  cause?: unknown;
134
135
  } & Record<string, any>) | undefined, headers?: HeadersInit | undefined, statusCode?: number | undefined) => InternalAPIError & {
135
136
  errorStack: string | undefined;
136
- };
137
+ }; //#endregion
137
138
  //#endregion
138
- //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/openapi.d.mts
139
+ //#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/openapi.d.mts
139
140
  //#region src/openapi.d.ts
140
141
  type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
141
142
  interface OpenAPIParameter {
@@ -157,7 +158,7 @@ interface OpenAPIParameter {
157
158
  };
158
159
  }
159
160
  //#endregion
160
- //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/endpoint.d.mts
161
+ //#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/endpoint.d.mts
161
162
  //#region src/endpoint.d.ts
162
163
  interface EndpointBaseOptions {
163
164
  /**
@@ -315,7 +316,7 @@ interface EndpointBaseOptions {
315
316
  /**
316
317
  * List of middlewares to use
317
318
  */
318
- use?: Middleware[];
319
+ use?: MiddlewareHandler[];
319
320
  /**
320
321
  * A callback to run before any API error is throw or returned
321
322
  *
@@ -327,7 +328,10 @@ interface EndpointBaseOptions {
327
328
  * A callback to run before a validation error is thrown
328
329
  * You can customize the validation error message by throwing your own APIError
329
330
  */
330
- onValidationError?: ({ issues, message }: {
331
+ onValidationError?: ({
332
+ issues,
333
+ message
334
+ }: {
331
335
  message: string;
332
336
  issues: readonly StandardSchemaV1.Issue[];
333
337
  }) => void | Promise<void>;
@@ -371,19 +375,7 @@ type EndpointBodyMethodOptions = {
371
375
  };
372
376
  type EndpointOptions = EndpointBaseOptions & EndpointBodyMethodOptions;
373
377
  //#endregion
374
- //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/middleware.d.mts
375
- //#region src/middleware.d.ts
376
- interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
377
- type MiddlewareInputContext<Options extends MiddlewareOptions> = InferBodyInput<Options> & InferQueryInput<Options> & InferRequestInput<Options> & InferHeadersInput<Options> & {
378
- asResponse?: boolean;
379
- returnHeaders?: boolean;
380
- use?: Middleware[];
381
- };
382
- type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler extends (inputCtx: any) => Promise<any> = any> = Handler & {
383
- options: Options;
384
- };
385
- //#endregion
386
- //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/context.d.mts
378
+ //#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/context.d.mts
387
379
  type InferBodyInput<Options extends EndpointOptions | MiddlewareOptions, Body = (Options["metadata"] extends {
388
380
  $Infer: {
389
381
  body: infer B;
@@ -413,13 +405,27 @@ type InferHeadersInput<Option extends EndpointOptions | MiddlewareOptions> = Opt
413
405
  headers?: HeadersInit;
414
406
  };
415
407
  //#endregion
408
+ //#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.3.6/node_modules/better-call/dist/middleware.d.mts
409
+ //#region src/middleware.d.ts
410
+ interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
411
+ type MiddlewareInputContext<Options extends MiddlewareOptions> = InferBodyInput<Options> & InferQueryInput<Options> & InferRequestInput<Options> & InferHeadersInput<Options> & {
412
+ asResponse?: boolean;
413
+ returnHeaders?: boolean;
414
+ use?: MiddlewareHandler[];
415
+ };
416
+ type MiddlewareFunction = (...args: never[]) => Promise<unknown>;
417
+ type MiddlewareHandler = (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<unknown>;
418
+ type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler extends MiddlewareFunction = MiddlewareHandler> = Handler & {
419
+ options: Options;
420
+ }; //#endregion
421
+ //#endregion
416
422
  //#region src/types.d.ts
417
423
  type ALL_PLUGIN_ERROR_CODE_KEYS = keyof UnionToIntersection<{ [Key in Exclude<BetterAuthPluginRegistryIdentifier, "i18n">]: BetterAuthPluginRegistry<unknown, unknown>[Key] extends {
418
424
  creator: infer C;
419
425
  } ? C extends ((...args: any[]) => infer P) ? P extends {
420
426
  $ERROR_CODES: infer E;
421
- } ? E : {} : {} : {}; }[Exclude<BetterAuthPluginRegistryIdentifier, "i18n">]>;
422
- type InternalTranslationDictionary = Partial<{ [Key in ALL_PLUGIN_ERROR_CODE_KEYS]: string; }>;
427
+ } ? E : {} : {} : {} }[Exclude<BetterAuthPluginRegistryIdentifier, "i18n">]>;
428
+ type InternalTranslationDictionary = Partial<{ [Key in ALL_PLUGIN_ERROR_CODE_KEYS]: string }>;
423
429
  /**
424
430
  * Translation dictionary mapping error codes to translated messages
425
431
  */
@@ -440,7 +446,7 @@ interface I18nOptions<Locales extends string[]> {
440
446
  * fr: { USER_NOT_FOUND: "Utilisateur non trouvé" }
441
447
  * }
442
448
  */
443
- translations: { [Locale in Locales[number]]: TranslationDictionary; };
449
+ translations: { [Locale in Locales[number]]: TranslationDictionary };
444
450
  /**
445
451
  * Default/fallback locale when detection fails
446
452
  * @default "en"
@@ -508,11 +514,11 @@ declare const i18n: <Locales extends string[]>(options: I18nOptions<Locales>) =>
508
514
  hooks: {
509
515
  after: {
510
516
  matcher: () => true;
511
- handler: (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<void>;
517
+ handler: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<void>>;
512
518
  }[];
513
519
  };
514
520
  options: {
515
- translations: { [Locale in Locales[number]]: TranslationDictionary; };
521
+ translations: { [Locale in Locales[number]]: TranslationDictionary };
516
522
  defaultLocale: Locales[number];
517
523
  detection: LocaleDetectionStrategy[];
518
524
  localeCookie: string;
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as TranslationDictionary, n as I18nOptions, r as LocaleDetectionStrategy, t as i18n } from "./index-DB9G0sAf.mjs";
2
- export { type I18nOptions, type LocaleDetectionStrategy, type TranslationDictionary, i18n };
1
+ import { i as TranslationDictionary, n as I18nOptions, r as LocaleDetectionStrategy, t as i18n } from "./index-CJ7rDBMd.mjs";
2
+ export { I18nOptions, LocaleDetectionStrategy, TranslationDictionary, i18n };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-CPj5-4mL.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-6ZHwEASO.mjs";
2
2
  import { APIError, createAuthMiddleware, isAPIError } from "better-auth/api";
3
3
  import { parseCookies } from "better-auth/cookies";
4
4
  //#region src/index.ts
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const PACKAGE_VERSION = "1.6.26";
3
+ const PACKAGE_VERSION = "1.6.28";
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.6.26",
3
+ "version": "1.6.28",
4
4
  "description": "i18n plugin for Better Auth - translate error messages",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -50,13 +50,13 @@
50
50
  }
51
51
  },
52
52
  "devDependencies": {
53
- "tsdown": "0.22.7",
54
- "@better-auth/core": "1.6.26",
55
- "better-auth": "1.6.26"
53
+ "tsdown": "0.21.10",
54
+ "@better-auth/core": "1.6.28",
55
+ "better-auth": "1.6.28"
56
56
  },
57
57
  "peerDependencies": {
58
- "@better-auth/core": "^1.6.26",
59
- "better-auth": "^1.6.26"
58
+ "@better-auth/core": "^1.6.28",
59
+ "better-auth": "^1.6.28"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsdown",