@shivaedev/platform 0.23.1 → 0.24.1
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/CHANGELOG.md +12 -0
- package/README.md +3 -0
- package/dist/server/better-auth/testDatabase.d.ts +16 -0
- package/dist/server/better-auth/testDatabase.d.ts.map +1 -0
- package/dist/server/better-auth/testDatabase.js +20 -0
- package/dist/server/better-auth/testDatabase.js.map +1 -0
- package/package.json +6 -6
- package/src/server/better-auth/testDatabase.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.24.1 - 2026-10-24
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Align published dependency and peer pins and the generated starter with React and React DOM 19.3.1, TanStack Router 1.170.45, Better Auth 1.7.10, happy-dom 21.0.3 and Vitest 5.0.5. The starter also uses pg-boss dashboard 1.12.1.
|
|
8
|
+
|
|
9
|
+
## 0.24.0 - 2026-10-21
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Expose test-only Better Auth database readouts and faults for the default auth schema so application stories do not issue SQL against provider-owned tables.
|
|
14
|
+
|
|
3
15
|
## 0.23.1 - 2026-10-19
|
|
4
16
|
|
|
5
17
|
### Fixed
|
package/README.md
CHANGED
|
@@ -631,6 +631,8 @@ Without `signIn`, the mount installs no hooks, `admittedSessions` returns the lo
|
|
|
631
631
|
|
|
632
632
|
Use `authTestUtils()` from `@shivaedev/platform/server/better-auth/testing.ts` in a test-only Better Auth instance with the host's database, secret and cookie policy. The wrapper preserves the plugin's typed `$context.test` under `exactOptionalPropertyTypes`. Keep the plugin out of production auth options.
|
|
633
633
|
|
|
634
|
+
Use `authTestDatabase(pool)` from `@shivaedev/platform/server/better-auth/testDatabase.ts` when a story needs observations or faults in the default Better Auth PostgreSQL schema. It returns Effect readouts `users` (IDs and emails) and `sessions` (IDs, user IDs and emails), plus the test-only faults `expireSessions` and `omitImageColumn`. It never returns tokens, password hashes or provider credentials. These fixtures assume the default table and column mappings and operate on the supplied pool; use only an isolated test database. Application stories keep their auth SQL in this provider-owned boundary.
|
|
635
|
+
|
|
634
636
|
```ts
|
|
635
637
|
import { betterAuth } from "better-auth";
|
|
636
638
|
import { authTestUtils, signedInUser } from "@shivaedev/platform/server/better-auth/testing.ts";
|
|
@@ -747,6 +749,7 @@ Import the module that defines the name; there is no package-root entry. Paths b
|
|
|
747
749
|
| `server/better-auth/allowedAccounts.ts` | `AllowedAccounts`, `allowedAccounts`: the provider-account list Schema and its `AUTH_ALLOWED_ACCOUNTS` Config. |
|
|
748
750
|
| `server/better-auth/signInGate.ts` | `SignInPolicy`: the `accounts`, `rule` and `recheckInterval` of a sign-in policy. |
|
|
749
751
|
| `server/better-auth/revokeUnadmitted.ts` | `RevokedSessions`: the `{ users, sessions }` counts of a revocation. |
|
|
752
|
+
| `server/better-auth/testDatabase.ts` | `authTestDatabase(pool)`: test-only identity/session readouts and faults for the default PostgreSQL auth schema. |
|
|
750
753
|
| `server/better-auth/testing.ts` | `authTestUtils(options?)`, `signedInUser(auth, fields)`: test-only typed Better Auth helpers and minted user sessions. |
|
|
751
754
|
| `server/better-auth/adapter.ts` | `effectPrismaAdapter(Database, runtime, options?)`: a Better Auth adapter over Effect Prisma; `modelName` maps model names. |
|
|
752
755
|
| `server/testing/makePlatformIt.ts` | `makePlatformIt(Database)({ adapter, createCaller, layer, extend? })`. |
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { Pool } from "pg";
|
|
3
|
+
export declare function authTestDatabase(pool: Pool): {
|
|
4
|
+
expireSessions: Effect.Effect<void, import("effect/Cause").UnknownError, never>;
|
|
5
|
+
omitImageColumn: Effect.Effect<void, import("effect/Cause").UnknownError, never>;
|
|
6
|
+
sessions: Effect.Effect<{
|
|
7
|
+
email: string;
|
|
8
|
+
id: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
}[], import("effect/Cause").UnknownError, never>;
|
|
11
|
+
users: Effect.Effect<{
|
|
12
|
+
email: string;
|
|
13
|
+
id: string;
|
|
14
|
+
}[], import("effect/Cause").UnknownError, never>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=testDatabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testDatabase.d.ts","sourceRoot":"","sources":["../../../src/server/better-auth/testDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI;IAEzC,cAAc;IAGd,eAAe;IAGf,QAAQ;eACkC,MAAM;YAAM,MAAM;gBAAU,MAAM;;IAK5E,KAAK;eACqC,MAAM;YAAM,MAAM;;EAI7D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
export function authTestDatabase(pool) {
|
|
3
|
+
return {
|
|
4
|
+
expireSessions: Effect.tryPromise(async () => {
|
|
5
|
+
await pool.query('update "session" set "expiresAt" = now() - interval \'1 second\'');
|
|
6
|
+
}),
|
|
7
|
+
omitImageColumn: Effect.tryPromise(async () => {
|
|
8
|
+
await pool.query('alter table "user" drop column image');
|
|
9
|
+
}),
|
|
10
|
+
sessions: Effect.tryPromise(async () => {
|
|
11
|
+
const result = await pool.query('select s.id, s."userId", u.email from "session" s join "user" u on u.id = s."userId" order by u.email, s.id');
|
|
12
|
+
return result.rows;
|
|
13
|
+
}),
|
|
14
|
+
users: Effect.tryPromise(async () => {
|
|
15
|
+
const result = await pool.query('select id, email from "user" order by email');
|
|
16
|
+
return result.rows;
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=testDatabase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testDatabase.js","sourceRoot":"","sources":["../../../src/server/better-auth/testDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,MAAM,UAAU,gBAAgB,CAAC,IAAU;IAC1C,OAAO;QACN,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;YAC5C,MAAM,IAAI,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC,CAAC;QACF,eAAe,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;YAC7C,MAAM,IAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC,CAAC;QACF,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;YACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAC9B,6GAA6G,CAC7G,CAAC;YACF,OAAO,MAAM,CAAC,IAAI,CAAC;QACpB,CAAC,CAAC;QACF,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;YACnC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAgC,6CAA6C,CAAC,CAAC;YAC9G,OAAO,MAAM,CAAC,IAAI,CAAC;QACpB,CAAC,CAAC;KACF,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "Opinionated Effect application infrastructure for ShivaeDev services",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/platform#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -58,18 +58,18 @@
|
|
|
58
58
|
"@shivaedev/effect-test": "0.7.1",
|
|
59
59
|
"@shivaedev/effect-test-sql": "0.8.2",
|
|
60
60
|
"@shivaedev/effect-trpc": "0.8.2",
|
|
61
|
-
"@shivaedev/quality": "0.
|
|
62
|
-
"@shivaedev/test-story": "0.
|
|
61
|
+
"@shivaedev/quality": "0.33.2",
|
|
62
|
+
"@shivaedev/test-story": "0.18.1",
|
|
63
63
|
"@trpc/client": "11.19.0",
|
|
64
64
|
"@trpc/server": "11.19.0",
|
|
65
65
|
"@types/node": "24.19.2",
|
|
66
66
|
"@types/pg": "8.20.0",
|
|
67
|
-
"better-auth": "1.7.
|
|
67
|
+
"better-auth": "1.7.10",
|
|
68
68
|
"effect": "4.0.4",
|
|
69
69
|
"pg": "8.23.0",
|
|
70
70
|
"superjson": "2.2.6",
|
|
71
71
|
"typescript": "7.0.2",
|
|
72
|
-
"vitest": "5.0.
|
|
72
|
+
"vitest": "5.0.5"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@effect/platform-node": "4.0.4",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@shivaedev/effect-prisma": "0.10.2",
|
|
80
80
|
"@shivaedev/effect-trpc": "0.8.2",
|
|
81
81
|
"@trpc/server": "11.19.0",
|
|
82
|
-
"better-auth": "1.7.
|
|
82
|
+
"better-auth": "1.7.10",
|
|
83
83
|
"effect": "4.0.4",
|
|
84
84
|
"pg": "8.23.0"
|
|
85
85
|
},
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { Pool } from "pg";
|
|
3
|
+
|
|
4
|
+
export function authTestDatabase(pool: Pool) {
|
|
5
|
+
return {
|
|
6
|
+
expireSessions: Effect.tryPromise(async () => {
|
|
7
|
+
await pool.query('update "session" set "expiresAt" = now() - interval \'1 second\'');
|
|
8
|
+
}),
|
|
9
|
+
omitImageColumn: Effect.tryPromise(async () => {
|
|
10
|
+
await pool.query('alter table "user" drop column image');
|
|
11
|
+
}),
|
|
12
|
+
sessions: Effect.tryPromise(async () => {
|
|
13
|
+
const result = await pool.query<{ email: string; id: string; userId: string }>(
|
|
14
|
+
'select s.id, s."userId", u.email from "session" s join "user" u on u.id = s."userId" order by u.email, s.id',
|
|
15
|
+
);
|
|
16
|
+
return result.rows;
|
|
17
|
+
}),
|
|
18
|
+
users: Effect.tryPromise(async () => {
|
|
19
|
+
const result = await pool.query<{ email: string; id: string }>('select id, email from "user" order by email');
|
|
20
|
+
return result.rows;
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
}
|