@better-auth/electron 1.5.6 → 1.6.0-beta.0

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/preload.mjs CHANGED
@@ -1,73 +1,9 @@
1
1
  import electron, { contextBridge } from "electron";
2
-
3
- //#region ../core/dist/utils/error-codes.mjs
4
- function defineErrorCodes(codes) {
5
- return Object.fromEntries(Object.entries(codes).map(([key, value]) => [key, {
6
- code: key,
7
- message: value,
8
- toString: () => key
9
- }]));
10
- }
11
-
12
- //#endregion
13
- //#region ../core/dist/error/codes.mjs
14
- const BASE_ERROR_CODES = defineErrorCodes({
15
- USER_NOT_FOUND: "User not found",
16
- FAILED_TO_CREATE_USER: "Failed to create user",
17
- FAILED_TO_CREATE_SESSION: "Failed to create session",
18
- FAILED_TO_UPDATE_USER: "Failed to update user",
19
- FAILED_TO_GET_SESSION: "Failed to get session",
20
- INVALID_PASSWORD: "Invalid password",
21
- INVALID_EMAIL: "Invalid email",
22
- INVALID_EMAIL_OR_PASSWORD: "Invalid email or password",
23
- INVALID_USER: "Invalid user",
24
- SOCIAL_ACCOUNT_ALREADY_LINKED: "Social account already linked",
25
- PROVIDER_NOT_FOUND: "Provider not found",
26
- INVALID_TOKEN: "Invalid token",
27
- TOKEN_EXPIRED: "Token expired",
28
- ID_TOKEN_NOT_SUPPORTED: "id_token not supported",
29
- FAILED_TO_GET_USER_INFO: "Failed to get user info",
30
- USER_EMAIL_NOT_FOUND: "User email not found",
31
- EMAIL_NOT_VERIFIED: "Email not verified",
32
- PASSWORD_TOO_SHORT: "Password too short",
33
- PASSWORD_TOO_LONG: "Password too long",
34
- USER_ALREADY_EXISTS: "User already exists.",
35
- USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.",
36
- EMAIL_CAN_NOT_BE_UPDATED: "Email can not be updated",
37
- CREDENTIAL_ACCOUNT_NOT_FOUND: "Credential account not found",
38
- SESSION_EXPIRED: "Session expired. Re-authenticate to perform this action.",
39
- FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account",
40
- ACCOUNT_NOT_FOUND: "Account not found",
41
- USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.",
42
- CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: "Cross-site navigation login blocked. This request appears to be a CSRF attack.",
43
- VERIFICATION_EMAIL_NOT_ENABLED: "Verification email isn't enabled",
44
- EMAIL_ALREADY_VERIFIED: "Email is already verified",
45
- EMAIL_MISMATCH: "Email mismatch",
46
- SESSION_NOT_FRESH: "Session is not fresh",
47
- LINKED_ACCOUNT_ALREADY_EXISTS: "Linked account already exists",
48
- INVALID_ORIGIN: "Invalid origin",
49
- INVALID_CALLBACK_URL: "Invalid callbackURL",
50
- INVALID_REDIRECT_URL: "Invalid redirectURL",
51
- INVALID_ERROR_CALLBACK_URL: "Invalid errorCallbackURL",
52
- INVALID_NEW_USER_CALLBACK_URL: "Invalid newUserCallbackURL",
53
- MISSING_OR_NULL_ORIGIN: "Missing or null Origin",
54
- CALLBACK_URL_REQUIRED: "callbackURL is required",
55
- FAILED_TO_CREATE_VERIFICATION: "Unable to create verification",
56
- FIELD_NOT_ALLOWED: "Field not allowed to be set",
57
- ASYNC_VALIDATION_NOT_SUPPORTED: "Async validation is not supported",
58
- VALIDATION_ERROR: "Validation Error",
59
- MISSING_FIELD: "Field is required",
60
- METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED: "POST method requires deferSessionRefresh to be enabled in session config",
61
- BODY_MUST_BE_AN_OBJECT: "Body must be an object",
62
- PASSWORD_ALREADY_SET: "User already has a password set"
63
- });
64
-
65
- //#endregion
66
- //#region ../../node_modules/.pnpm/better-call@1.3.2_zod@4.3.6/node_modules/better-call/dist/error.mjs
2
+ //#region ../../node_modules/.pnpm/better-call@2.0.3_zod@4.3.6/node_modules/better-call/dist/error.mjs
67
3
  function isErrorStackTraceLimitWritable() {
68
4
  const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
69
5
  if (desc === void 0) return Object.isExtensible(Error);
70
- return Object.prototype.hasOwnProperty.call(desc, "writable") ? desc.writable : desc.set !== void 0;
6
+ return Object.hasOwn(desc, "writable") ? desc.writable : desc.set !== void 0;
71
7
  }
72
8
  /**
73
9
  * Hide internal stack frames from the error stack trace.
@@ -173,9 +109,7 @@ var InternalAPIError = class extends Error {
173
109
  this.body = body;
174
110
  }
175
111
  };
176
- const kAPIErrorHeaderSymbol = Symbol.for("better-call:api-error-headers");
177
- const APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
178
-
112
+ makeErrorForHideStackFrame(InternalAPIError, Error);
179
113
  //#endregion
180
114
  //#region ../core/dist/error/index.mjs
181
115
  var BetterAuthError = class extends Error {
@@ -186,7 +120,6 @@ var BetterAuthError = class extends Error {
186
120
  this.stack = "";
187
121
  }
188
122
  };
189
-
190
123
  //#endregion
191
124
  //#region src/utils.ts
192
125
  function isProcessType(type) {
@@ -195,7 +128,6 @@ function isProcessType(type) {
195
128
  function getChannelPrefixWithDelimiter(ns = "better-auth") {
196
129
  return ns.length > 0 ? ns + ":" : ns;
197
130
  }
198
-
199
131
  //#endregion
200
132
  //#region src/preload.ts
201
133
  const { ipcRenderer } = electron;
@@ -252,6 +184,5 @@ function setupRenderer(options = {}) {
252
184
  if (!isProcessType("renderer")) throw new BetterAuthError("setupRenderer can only be called in the renderer process.");
253
185
  exposeBridges(options);
254
186
  }
255
-
256
187
  //#endregion
257
- export { setupRenderer };
188
+ export { setupRenderer };
package/dist/proxy.d.mts CHANGED
@@ -1,9 +1,10 @@
1
- import { l as ElectronProxyClientOptions } from "./client-DVs5eLfi.mjs";
1
+ import { l as ElectronProxyClientOptions } from "./client-CMv-uqSO.mjs";
2
2
  import { electron } from "./index.mjs";
3
3
 
4
4
  //#region src/proxy.d.ts
5
5
  declare const electronProxyClient: (options: ElectronProxyClientOptions) => {
6
6
  id: "electron-proxy";
7
+ version: string;
7
8
  getActions: () => {
8
9
  electron: {
9
10
  /**
package/dist/proxy.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { r as parseProtocolScheme } from "./utils-DecLU66o.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-BqMHXjG-.mjs";
2
+ import { r as parseProtocolScheme } from "./utils-DxDKRT6e.mjs";
2
3
  import { parseCookies } from "better-auth/cookies";
3
-
4
4
  //#region src/proxy.ts
5
5
  const electronProxyClient = (options) => {
6
6
  const opts = {
@@ -13,6 +13,7 @@ const electronProxyClient = (options) => {
13
13
  const { scheme } = parseProtocolScheme(opts.protocol);
14
14
  return {
15
15
  id: "electron-proxy",
16
+ version: PACKAGE_VERSION,
16
17
  getActions: () => {
17
18
  const getAuthorizationCode = () => {
18
19
  if (typeof document === "undefined") return null;
@@ -42,6 +43,5 @@ const electronProxyClient = (options) => {
42
43
  $InferServerPlugin: {}
43
44
  };
44
45
  };
45
-
46
46
  //#endregion
47
- export { electronProxyClient };
47
+ export { electronProxyClient };
@@ -1,4 +1,4 @@
1
- import { d as Storage } from "./client-DVs5eLfi.mjs";
1
+ import { d as Storage } from "./client-CMv-uqSO.mjs";
2
2
  import { Options } from "conf";
3
3
 
4
4
  //#region src/storage.d.ts
package/dist/storage.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import electron from "electron";
2
2
  import Conf from "conf";
3
-
4
3
  //#region src/storage.ts
5
4
  const { app } = electron;
6
5
  const storage = (opts) => {
@@ -23,6 +22,5 @@ const storage = (opts) => {
23
22
  }
24
23
  };
25
24
  };
26
-
27
25
  //#endregion
28
- export { storage };
26
+ export { storage };
@@ -15,6 +15,5 @@ function parseProtocolScheme(protocolOption) {
15
15
  function getChannelPrefixWithDelimiter(ns = "better-auth") {
16
16
  return ns.length > 0 ? ns + ":" : ns;
17
17
  }
18
-
19
18
  //#endregion
20
- export { isProcessType as n, parseProtocolScheme as r, getChannelPrefixWithDelimiter as t };
19
+ export { isProcessType as n, parseProtocolScheme as r, getChannelPrefixWithDelimiter as t };
@@ -0,0 +1,5 @@
1
+ //#endregion
2
+ //#region src/version.ts
3
+ const PACKAGE_VERSION = "1.6.0-beta.0";
4
+ //#endregion
5
+ export { PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/electron",
3
- "version": "1.5.6",
3
+ "version": "1.6.0-beta.0",
4
4
  "description": "Better Auth integration for Electron applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
+ "sideEffects": false,
22
23
  "files": [
23
24
  "dist"
24
25
  ],
@@ -78,18 +79,18 @@
78
79
  "@types/better-sqlite3": "^7.6.13",
79
80
  "better-sqlite3": "^12.6.2",
80
81
  "electron": "^38.8.4",
81
- "tsdown": "0.21.0-beta.2",
82
- "@better-auth/core": "1.5.6",
83
- "better-auth": "1.5.6"
82
+ "tsdown": "0.21.1",
83
+ "@better-auth/core": "1.6.0-beta.0",
84
+ "better-auth": "1.6.0-beta.0"
84
85
  },
85
86
  "peerDependencies": {
86
- "@better-auth/utils": "0.3.1",
87
+ "@better-auth/utils": "0.4.0",
87
88
  "@better-fetch/fetch": "1.1.21",
88
- "better-call": "1.3.2",
89
+ "better-call": "2.0.3",
89
90
  "conf": "^15.0.2",
90
91
  "electron": ">=36.0.0",
91
- "@better-auth/core": "1.5.6",
92
- "better-auth": "1.5.6"
92
+ "@better-auth/core": "^1.6.0-beta.0",
93
+ "better-auth": "^1.6.0-beta.0"
93
94
  },
94
95
  "peerDependenciesMeta": {
95
96
  "electron": {
@@ -105,7 +106,7 @@
105
106
  "scripts": {
106
107
  "build": "tsdown",
107
108
  "dev": "tsdown --watch",
108
- "lint:package": "publint run --strict",
109
+ "lint:package": "publint run --strict --pack false",
109
110
  "lint:types": "attw --profile esm-only --pack .",
110
111
  "typecheck": "tsc --project tsconfig.json",
111
112
  "test": "vitest",