@procedures/better-auth 0.46.0 → 0.47.2

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/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The browser half of the sign-in (Graph's split, wave 2, W8): the calls of a page to the auth routes of a
2
+ * The browser half of the sign-in: the calls of a page to the auth routes of a
3
3
  * procedures server with Better Auth. This entry has no framework and no global state: each function gives data,
4
4
  * and the app decides what the page does (a redirect, a reload).
5
5
  *
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The browser half of the sign-in (Graph's split, wave 2, W8): the calls of a page to the auth routes of a
2
+ * The browser half of the sign-in: the calls of a page to the auth routes of a
3
3
  * procedures server with Better Auth. This entry has no framework and no global state: each function gives data,
4
4
  * and the app decides what the page does (a redirect, a reload).
5
5
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@procedures/better-auth",
4
- "version": "0.46.0",
4
+ "version": "0.47.2",
5
5
  "description": "Better Auth for a procedures server: the sign-in with GitHub, Google and passkeys over MongoDB, and a request hook that gives the principal of a session or of an agent token.",
6
6
  "keywords": [
7
7
  "procedures",
@@ -42,7 +42,7 @@
42
42
  ],
43
43
  "sideEffects": false,
44
44
  "devDependencies": {
45
- "@mark1russell7/cue": "^1.0.0",
45
+ "@mark1russell7/cue": "^1.1.0",
46
46
  "mongodb": "^7.7.0",
47
47
  "typescript": "^7.0.2",
48
48
  "vitest": "^5.0.3"
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@better-auth/passkey": "^1.7.10",
60
- "@procedures/client": "0.46.0",
60
+ "@procedures/client": "0.47.2",
61
61
  "@simplewebauthn/browser": "^13.3.0",
62
62
  "better-auth": "^1.7.10",
63
63
  "zod": "^4.6.5"
@@ -67,9 +67,9 @@
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsc -b",
70
- "typecheck": "tsc --noEmit",
70
+ "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
71
71
  "clean": "rm -rf dist .tsbuildinfo",
72
- "test": "vitest run --passWithNoTests",
72
+ "test": "vitest run",
73
73
  "test:watch": "vitest"
74
74
  }
75
75
  }
@@ -241,9 +241,9 @@ describe("betterAuthPrincipalOf", () => {
241
241
 
242
242
  it("does not take another bearer token as the agent, and ignores the act-as header without the token", async () => {
243
243
  const { principals } = setup();
244
- const hook = betterAuthPrincipalOf({ principals, agentToken: TOKEN, actAsHeader: "X-Graph-As", actAs: () => true, anonymous: READ_ONLY });
245
- expect((await hook({ bearer: "wrong", headers: { "x-graph-as": "u1" } }, request))?.principal).toEqual({ id: ANONYMOUS_ID, via: VIA.anonymous });
246
- expect((await hook({ bearer: TOKEN, headers: { "x-graph-as": "u1" } }, request))?.principal?.id).toBe("u1");
244
+ const hook = betterAuthPrincipalOf({ principals, agentToken: TOKEN, actAsHeader: "X-App-As", actAs: () => true, anonymous: READ_ONLY });
245
+ expect((await hook({ bearer: "wrong", headers: { "x-app-as": "u1" } }, request))?.principal).toEqual({ id: ANONYMOUS_ID, via: VIA.anonymous });
246
+ expect((await hook({ bearer: TOKEN, headers: { "x-app-as": "u1" } }, request))?.principal?.id).toBe("u1");
247
247
  expect(await betterAuthPrincipalOf({ principals })({ bearer: TOKEN }, request)).toBeUndefined(); // no agent token: no agent
248
248
  });
249
249
  });
package/src/browser.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The browser half of the sign-in (Graph's split, wave 2, W8): the calls of a page to the auth routes of a
2
+ * The browser half of the sign-in: the calls of a page to the auth routes of a
3
3
  * procedures server with Better Auth. This entry has no framework and no global state: each function gives data,
4
4
  * and the app decides what the page does (a redirect, a reload).
5
5
  *