@shivaedev/identity 0.34.2 → 0.36.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/CHANGELOG.md +25 -0
- package/README.md +59 -7
- package/dist/client/SessionMemory.d.ts +57 -0
- package/dist/client/SessionMemory.d.ts.map +1 -0
- package/dist/client/SessionMemory.js +57 -0
- package/dist/client/SessionMemory.js.map +1 -0
- package/dist/client/adapters/browserSessionMemory.d.ts +4 -0
- package/dist/client/adapters/browserSessionMemory.d.ts.map +1 -0
- package/dist/client/adapters/browserSessionMemory.js +15 -0
- package/dist/client/adapters/browserSessionMemory.js.map +1 -0
- package/dist/server/account-preferences/Rows.d.ts +34 -1
- package/dist/server/account-preferences/Rows.d.ts.map +1 -1
- package/dist/server/adapters/betterAuthSessions.d.ts +1 -1
- package/dist/server/adapters/betterAuthSessions.d.ts.map +1 -1
- package/dist/server/adapters/betterAuthSessions.js +2 -2
- package/dist/server/adapters/betterAuthSessions.js.map +1 -1
- package/dist/server/adapters/currentSessionContext.d.ts +2 -2
- package/dist/server/adapters/currentSessionContext.d.ts.map +1 -1
- package/dist/server/adapters/currentSessionContext.js +2 -2
- package/dist/server/adapters/currentSessionContext.js.map +1 -1
- package/dist/server/better-auth/adapters/mount.d.ts.map +1 -1
- package/dist/server/better-auth/adapters/mount.js +3 -1
- package/dist/server/better-auth/adapters/mount.js.map +1 -1
- package/dist/server/better-auth/assignRole.js +1 -1
- package/dist/server/better-auth/assignRole.js.map +1 -1
- package/dist/server/better-auth/changeHooks.d.ts +3 -0
- package/dist/server/better-auth/changeHooks.d.ts.map +1 -0
- package/dist/server/better-auth/changeHooks.js +36 -0
- package/dist/server/better-auth/changeHooks.js.map +1 -0
- package/dist/server/better-auth/sessionAdministration.js +1 -1
- package/dist/server/better-auth/sessionAdministration.js.map +1 -1
- package/dist/server/better-auth/sweepExpiredSessions.d.ts.map +1 -1
- package/dist/server/better-auth/sweepExpiredSessions.js +17 -6
- package/dist/server/better-auth/sweepExpiredSessions.js.map +1 -1
- package/dist/server/better-auth/testDatabase.d.ts +1 -0
- package/dist/server/better-auth/testDatabase.d.ts.map +1 -1
- package/dist/server/better-auth/testDatabase.js +1 -0
- package/dist/server/better-auth/testDatabase.js.map +1 -1
- package/dist/server/better-auth/userDirectoryReads.js +1 -1
- package/dist/server/better-auth/userDirectoryReads.js.map +1 -1
- package/dist/server/lookupSession.d.ts.map +1 -1
- package/dist/server/lookupSession.js +3 -1
- package/dist/server/lookupSession.js.map +1 -1
- package/dist/server/resolveRole.js +1 -1
- package/dist/server/resolveRole.js.map +1 -1
- package/dist/server/session.d.ts +2 -2
- package/dist/server/session.d.ts.map +1 -1
- package/dist/server/session.js +4 -4
- package/dist/server/session.js.map +1 -1
- package/dist/server/subjectResolverLayer.js +3 -3
- package/dist/server/subjectResolverLayer.js.map +1 -1
- package/package.json +13 -13
- package/src/client/SessionMemory.ts +75 -0
- package/src/client/adapters/browserSessionMemory.ts +17 -0
- package/src/server/adapters/betterAuthSessions.ts +3 -2
- package/src/server/adapters/currentSessionContext.ts +3 -2
- package/src/server/better-auth/adapters/mount.ts +3 -1
- package/src/server/better-auth/assignRole.ts +1 -1
- package/src/server/better-auth/changeHooks.ts +49 -0
- package/src/server/better-auth/sessionAdministration.ts +1 -1
- package/src/server/better-auth/sweepExpiredSessions.ts +17 -6
- package/src/server/better-auth/testDatabase.ts +1 -0
- package/src/server/better-auth/userDirectoryReads.ts +1 -1
- package/src/server/lookupSession.ts +5 -1
- package/src/server/resolveRole.ts +1 -1
- package/src/server/session.ts +5 -4
- package/src/server/subjectResolverLayer.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.36.0 - 2026-11-20
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `forgetSession` also wipes the stored query results when its Layer supplies contract's `QueryStorageProvider`, so a signed-out answer, another user, a passed expiry and `session.signOut` clear them with the memory.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- every `Unauthorized` it raises says "Sign in to continue", as access's `unauthorized()` does, instead of "Authentication required". A request from an origin the session policy refuses says "Open this application from its own address to continue." and the server logs a warning that names the refused origin and the RPC. A user without a stored role is told "Your account has no role yet. Ask an administrator to assign one.", a missing user "This user no longer exists." and a missing session "This session has already ended."
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Sign-ups, profile changes, sign-ins and sign-outs made through a Better Auth mount now announce identity's `userKeys` and `sessionKeys`, so open users and sessions lists refresh without a reload. A mount created inside `transact` announces on that transaction's commit and a rollback announces nothing; a startup mount announces right after Better Auth's own commit. Applications need no hooks of their own, and their own Better Auth hooks keep running.
|
|
16
|
+
- `sweepExpiredSessions` announces `sessionKeys.list` when it removes expired sessions.
|
|
17
|
+
|
|
18
|
+
### Breaking
|
|
19
|
+
|
|
20
|
+
- code that compared the message of identity's `Unauthorized`, `Forbidden` or `NotFound` with the old text branches on the tag instead.
|
|
21
|
+
|
|
22
|
+
## 0.35.0 - 2026-11-20
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `SessionMemory` in `client/SessionMemory.ts` is the port for the last verified session on a device, with `recallSession`, `rememberSession` and `forgetSession`, the one wipe behind sign-out, another user, a signed-out answer and a passed expiry. It keeps the user id, the session id, the permissions and the session's expiry, never a credential. `browserSessionMemory` in `client/adapters/browserSessionMemory.ts` stores it in `localStorage`.
|
|
27
|
+
|
|
3
28
|
## 0.34.2 - 2026-11-20
|
|
4
29
|
|
|
5
30
|
### Changed
|
package/README.md
CHANGED
|
@@ -179,9 +179,10 @@ Pass `requestServices` beside `services` and `handlers` to `appHost`, or put it
|
|
|
179
179
|
|
|
180
180
|
Declare authentication middleware for actor-only boundaries. When a request acts on an account's data, declare its subject on the contract instead of accepting an owner id and checking it in each handler.
|
|
181
181
|
|
|
182
|
-
Provide one `SessionPolicy` Layer as the host's `sessions` input. Middleware, permission routes and session resolution read that service from the Effect environment. For a Better Auth provider, adapt its existing session lookup
|
|
182
|
+
Provide one `SessionPolicy` Layer as the host's `sessions` input. Middleware, permission routes and session resolution read that service from the Effect environment. For a Better Auth provider, adapt its existing session lookup. The lookup returns Better Auth's Promise, so the module lives in `adapters/`:
|
|
183
183
|
|
|
184
184
|
```ts
|
|
185
|
+
// src/server/adapters/sessions.ts
|
|
185
186
|
import { Layer } from "effect";
|
|
186
187
|
import { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
|
|
187
188
|
import { betterAuthSessions } from "@shivaedev/identity/server/adapters/betterAuthSessions.ts";
|
|
@@ -194,7 +195,7 @@ export const sessions = Layer.succeed(SessionPolicy, {
|
|
|
194
195
|
});
|
|
195
196
|
```
|
|
196
197
|
|
|
197
|
-
`trustedOrigins({ allow, missing })` accepts an exact allowlist and supports `missing: "reject"` or `"allow"`; a custom `OriginPolicy` can decide from the RPC name or transport headers. A denied policy fails with `Forbidden` before provider lookup. On `appHost`, that same `allow` list admits sibling browser origins through the HTTP RPC guard and credentialed CORS on RPC and mounted auth routes. Responses reflect the exact Origin with `Access-Control-Allow-Credentials: true`; undeclared origins get no credentialed CORS. Wildcards and patterns are not expanded. A custom policy without a `trustedOrigins` list does not enable credentialed CORS.
|
|
198
|
+
`trustedOrigins({ allow, missing })` accepts an exact allowlist and supports `missing: "reject"` or `"allow"`; a custom `OriginPolicy` can decide from the RPC name or transport headers. A denied policy fails with `Forbidden` before provider lookup and logs a warning that names the refused origin and the RPC, so an origin missing from the allowlist shows in the server's logs. On `appHost`, that same `allow` list admits sibling browser origins through the HTTP RPC guard and credentialed CORS on RPC and mounted auth routes. Responses reflect the exact Origin with `Access-Control-Allow-Credentials: true`; undeclared origins get no credentialed CORS. Wildcards and patterns are not expanded. A custom policy without a `trustedOrigins` list does not enable credentialed CORS.
|
|
198
199
|
|
|
199
200
|
To also accept the transport guard's same-origin requests, pass `sameOrigin: { trustedProxy }`, with the same proxy IP addresses or CIDR ranges as the host. This admits direct loopback HTTP and the forwarded HTTP or HTTPS authority only from a matching transport peer. Session resolution supplies that peer from the HTTP request, including the WebSocket upgrade; RPC message headers cannot supply it. Missing Origins still follow `missing`. Leave `sameOrigin` absent when an explicit public-origin allowlist should be the only authority.
|
|
200
201
|
|
|
@@ -271,16 +272,35 @@ const authentication = Effect.gen(function* () {
|
|
|
271
272
|
|
|
272
273
|
The adapter captures the SQL transaction at creation. An adapter created at startup does not join a later `transact` around an `auth.api` call: its auth writes commit independently and survive the application's rollback. For a shared boundary, create the adapter inside `transact`, and use it only within that transaction. Create the mount there too when its Effect hooks must share the application transaction:
|
|
273
274
|
|
|
275
|
+
`auth.api` answers with Promises, so the call goes through a module in `adapters/` that returns an Effect:
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
// src/server/adapters/signUpEmail.ts
|
|
279
|
+
import { Effect } from "effect";
|
|
280
|
+
|
|
281
|
+
interface EmailAccount {
|
|
282
|
+
readonly email: string;
|
|
283
|
+
readonly name: string;
|
|
284
|
+
readonly password: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const signUpEmail = <TCreated>(
|
|
288
|
+
auth: { readonly api: { readonly signUpEmail: (request: { readonly body: EmailAccount }) => Promise<TCreated> } },
|
|
289
|
+
body: EmailAccount,
|
|
290
|
+
) => Effect.tryPromise(() => auth.api.signUpEmail({ body }));
|
|
291
|
+
```
|
|
292
|
+
|
|
274
293
|
```ts
|
|
275
294
|
import { SqlClient } from "effect/sql";
|
|
276
295
|
import { transact } from "@shivaedev/sql/transact.ts";
|
|
296
|
+
import { signUpEmail } from "#server/adapters/signUpEmail.ts";
|
|
277
297
|
|
|
278
298
|
const register = (body: { email: string; name: string; password: string }) =>
|
|
279
299
|
Effect.gen(function* () {
|
|
280
300
|
const sql = yield* SqlClient.SqlClient;
|
|
281
301
|
const database = yield* betterAuthDatabase();
|
|
282
302
|
const { auth } = yield* betterAuthMount({ database, emailAndPassword: { enabled: true } });
|
|
283
|
-
const created = yield*
|
|
303
|
+
const created = yield* signUpEmail(auth, body);
|
|
284
304
|
yield* sql`insert into registrations (email) values (${created.user.email})`;
|
|
285
305
|
return created.user;
|
|
286
306
|
}).pipe(transact(), Effect.scoped);
|
|
@@ -356,6 +376,8 @@ Fail a `before` hook with `{ code: "MEMBERS_ONLY", message: "Membership is requi
|
|
|
356
376
|
|
|
357
377
|
Effect hook SQL uses the hook runtime's Effect context; it does not inherit Better Auth's internal write transaction. In a startup mount, a `before` hook's application SQL can commit even when that hook refuses the operation and Better Auth rolls back its auth rows. Use the transaction-local adapter and mount composition above when those writes must roll back together. Completing an `after` hook does not mean the outer application transaction has committed.
|
|
358
378
|
|
|
379
|
+
The mount announces identity's change keys after Better Auth writes a user or a session, so live readers of `userKeys` and `sessionKeys` refresh after a sign-up, a profile change, a sign-in or a sign-out; the application writes nothing for it. A mount created inside `transact` binds the announcement to that transaction's commit, and a rollback announces nothing. A startup mount announces in a transaction of its own after Better Auth's write commits, so a reader can briefly see the new row before its screen refreshes. The announcement needs the application's `SqlClient` and `Reactivity` in the mount's context, as `appHost`'s `application` Effect provides.
|
|
380
|
+
|
|
359
381
|
Native callbacks in the first argument run before the corresponding Effect callbacks. A native `before` returning `false` stops the Effect callback too. Data changes compose in order. Identity's sign-in policy still runs after the application's session hook.
|
|
360
382
|
|
|
361
383
|
#### Application password-reset hook
|
|
@@ -490,12 +512,12 @@ const mounted = yield* betterAuthMount(
|
|
|
490
512
|
);
|
|
491
513
|
const sessions = Layer.succeed(SessionPolicy, {
|
|
492
514
|
origin: trustedOrigins({ allow: [publicOrigin, ...nativeOrigins], missing: "allow" }),
|
|
493
|
-
|
|
515
|
+
...mounted.sessions,
|
|
494
516
|
});
|
|
495
517
|
const host = appHost({ group, handlers, routes: mounted.routes, sessions, nativeOrigins });
|
|
496
518
|
```
|
|
497
519
|
|
|
498
|
-
Always
|
|
520
|
+
Always take the provider from the mount's `sessions`, or wrap a custom lookup in `admittedSessions`, even without a sign-in policy: both apply the mount's credential selection to the same request-local identity, profile and role middleware used by cookies. A same-origin request or a request without an Origin carrying the session cookie uses only that cookie, even if invalid or revoked; its bearer header cannot switch accounts or rescue it. Otherwise the signed bearer is resolved by Better Auth. Missing, unsigned, tampered, expired and revoked bearer sessions produce `Unauthorized` at protected RPCs.
|
|
499
521
|
|
|
500
522
|
A native client signs in through `/api/auth/sign-in/email` with `credentials: "omit"` and its bundled Origin, reads the signed credential from the `set-auth-token` response header, and sends that exact value as `Authorization: Bearer <credential>` with `credentials: "omit"` on later auth and RPC requests. Persist it only in OS-backed secure storage, such as iOS Keychain or Android Keystore-backed storage; never use localStorage, sessionStorage or IndexedDB. Browser responses keep HttpOnly cookies and omit the plugin's token header and JSON token fields. Clients without a bundled Origin receive cookie responses.
|
|
501
523
|
|
|
@@ -541,7 +563,7 @@ const authentication = Effect.gen(function* () {
|
|
|
541
563
|
yield* mounted.revokeUnadmitted;
|
|
542
564
|
const sessions = Layer.succeed(SessionPolicy, {
|
|
543
565
|
origin: trustedOrigins({ allow: ["https://app.example"], missing: "reject" }),
|
|
544
|
-
|
|
566
|
+
...mounted.sessions,
|
|
545
567
|
});
|
|
546
568
|
return { ...mounted, sessions };
|
|
547
569
|
});
|
|
@@ -636,6 +658,7 @@ import { AuthenticatedUserWithProviderAccounts } from "@shivaedev/identity/middl
|
|
|
636
658
|
import { AuthUnavailable, Unauthorized } from "@shivaedev/errors/taxonomy.ts";
|
|
637
659
|
import { authenticatedUserWithProviderAccountsLayer } from "@shivaedev/identity/server/session.ts";
|
|
638
660
|
|
|
661
|
+
// src/server/adapters/sessions.ts: the lookups return Better Auth's Promises.
|
|
639
662
|
const sessions = Layer.succeed(SessionPolicy, {
|
|
640
663
|
origin: trustedOrigins({ allow: ["https://app.example"], missing: "reject" }),
|
|
641
664
|
...mounted.sessions,
|
|
@@ -731,6 +754,34 @@ The failure's `_tag` remains `AuthFailure`; its `code` union includes the declar
|
|
|
731
754
|
|
|
732
755
|
React's `authAction`, `authQuery` and `authSession` consume these Effects to create atoms. See [React's Better Auth usage](https://github.com/ShivaeDev/platform/blob/main/packages/react/README.md#better-auth-actions).
|
|
733
756
|
|
|
757
|
+
#### Start from the last verified session
|
|
758
|
+
|
|
759
|
+
A returning person's app can render at once from the session it last verified, while the real check runs in the background. Pass `remember` to React's `authSession`:
|
|
760
|
+
|
|
761
|
+
```ts
|
|
762
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
763
|
+
import { authCall } from "@shivaedev/identity/client/adapters/authCall.ts";
|
|
764
|
+
import { authSession as readSession } from "@shivaedev/identity/client/adapters/authSession.ts";
|
|
765
|
+
import { browserSessionMemory } from "@shivaedev/identity/client/adapters/browserSessionMemory.ts";
|
|
766
|
+
import { authSession } from "@shivaedev/react/client/authSession.ts";
|
|
767
|
+
|
|
768
|
+
const session = authSession(
|
|
769
|
+
readSession((signal) => authClient.getSession({ fetchOptions: { signal }, query: { disableCookieCache: true } })),
|
|
770
|
+
{ remember: browserSessionMemory },
|
|
771
|
+
);
|
|
772
|
+
const signOut = Atom.fn<void>()(() =>
|
|
773
|
+
session.signOut(authCall((_: undefined, signal) => authClient.signOut({ fetchOptions: { signal } }))(undefined)),
|
|
774
|
+
);
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
After each verified answer the session memory keeps the user id, the session id, the permissions and the session's `expiresAt`, never a credential: the cookie stays the browser's. At launch the session atom answers at once with that remembered session, marked as refreshing, so `SessionBoundary` renders, connects and opens the live socket while `get-session` is on the wire. With `remember`, the atom's value is `RememberedSession | null` from `@shivaedev/identity/client/SessionMemory.ts` for remembered and fresh answers alike, so a screen cannot read a field the launch does not have. The reader must return the provider's `session.id` and `session.expiresAt`; Better Auth's `getSession` does.
|
|
778
|
+
|
|
779
|
+
When the check answers, the same user keeps the session generation and gets the fresh permissions; another user replaces the memory and starts a new generation; a signed-out answer wipes the memory before the atom answers `null`, so the signed-out screen never renders with a session still remembered. A check that fails, for example without a network, keeps the remembered session rendering instead of failing the launch. Past the remembered `expiresAt` the memory is wiped and ignored, and the launch waits for the check. Wrap the sign-out request in `session.signOut`: when the request succeeds the memory is wiped at once, so a relaunch starts without a remembered session even when the session check after the sign-out never answers. `forgetSession` in the same module is the one wipe behind sign-out, another user, a signed-out answer and a passed expiry. When the `remember` Layer also supplies contract's `QueryStorageProvider`, such as `Layer.merge(browserSessionMemory, browserQueryStorage)`, `forgetSession` wipes the device's stored query results too; React's [stored results](https://github.com/ShivaeDev/platform/tree/main/packages/react#keep-query-results-across-a-reload) describe the rest.
|
|
780
|
+
|
|
781
|
+
What this means for the people using the app: until the check answers, the shell renders with the remembered user and permissions. After someone signs out elsewhere or their session is revoked, a device still shows its shell at its next launch for one round trip, and while it stays offline until the session's expiry; the host still refuses every call from the ended session, so only what the device already holds can show. A user id and their grants rest in the browser's local storage. When the refreshed session changes the grants, React's `PermissionBoundary` reruns the router's guards, so a screen that needs a removed grant is replaced by the refusal without a navigation.
|
|
782
|
+
|
|
783
|
+
`browserSessionMemory` stores the session under one `localStorage` key. Another platform supplies its own `SessionMemory` Layer with `read`, `write` and `clear`.
|
|
784
|
+
|
|
734
785
|
### Auth tables owned by another migrator
|
|
735
786
|
|
|
736
787
|
An application moving from Prisma can keep Prisma in charge of its auth tables while adopting identity's mount. Apply the existing migrator first, then run `assertBetterAuthSchema` as a startup guard before `betterAuthMount`. Both use the same application `SqlClient`; keep Better Auth's table and field mappings aligned with the existing schema.
|
|
@@ -911,6 +962,7 @@ The application host installs `CommandGuard` from `@shivaedev/contract/CommandGu
|
|
|
911
962
|
Set `streamRevalidationInterval` in the `SessionPolicy` Layer to an Effect `Duration.Input` to change the interval for middleware using that policy:
|
|
912
963
|
|
|
913
964
|
```ts
|
|
965
|
+
// src/server/adapters/sessions.ts
|
|
914
966
|
import { Layer } from "effect";
|
|
915
967
|
import { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
|
|
916
968
|
const sessions = Layer.succeed(SessionPolicy, {
|
|
@@ -1080,7 +1132,7 @@ Auth emails reserve one delivery attempt per account id and message kind for one
|
|
|
1080
1132
|
|
|
1081
1133
|
### Sweep expired sessions in a worker
|
|
1082
1134
|
|
|
1083
|
-
Better Auth removes an expired session when it is presented. Use `sweepExpiredSessions` from `@shivaedev/identity/server/better-auth/sweepExpiredSessions.ts` to remove expired rows that are never presented again. The Effect reads the application's `SqlClient`, deletes sessions whose `expiresAt` is at or before Effect's current time, and returns the number removed. It preserves live sessions and needs no Better Auth mount or auth pool. It assumes the default Better Auth PostgreSQL table and column mappings.
|
|
1135
|
+
Better Auth removes an expired session when it is presented. Use `sweepExpiredSessions` from `@shivaedev/identity/server/better-auth/sweepExpiredSessions.ts` to remove expired rows that are never presented again. The Effect reads the application's `SqlClient`, deletes sessions whose `expiresAt` is at or before Effect's current time, and returns the number removed. It announces `sessionKeys.list` when it removes a session. It preserves live sessions and needs no Better Auth mount or auth pool. It assumes the default Better Auth PostgreSQL table and column mappings.
|
|
1084
1136
|
|
|
1085
1137
|
Register the Effect with a worker schedule, as the starter does at midnight UTC. SQL and result-decoding failures stay in the Effect's error channel.
|
|
1086
1138
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Context, Effect, Option, Schema } from "effect";
|
|
2
|
+
import { Permission } from "@shivaedev/access/permission.ts";
|
|
3
|
+
declare const SessionMemoryUnavailable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
4
|
+
readonly _tag: "SessionMemoryUnavailable";
|
|
5
|
+
} & Readonly<A>;
|
|
6
|
+
export declare class SessionMemoryUnavailable extends SessionMemoryUnavailable_base<{
|
|
7
|
+
readonly cause: unknown;
|
|
8
|
+
}> {
|
|
9
|
+
}
|
|
10
|
+
declare const SessionMemory_base: Context.ServiceClass<SessionMemory, "@shivaedev/identity/SessionMemory", {
|
|
11
|
+
readonly clear: Effect.Effect<void, SessionMemoryUnavailable>;
|
|
12
|
+
readonly read: Effect.Effect<string | null, SessionMemoryUnavailable>;
|
|
13
|
+
readonly write: (value: string) => Effect.Effect<void, SessionMemoryUnavailable>;
|
|
14
|
+
}>;
|
|
15
|
+
export declare class SessionMemory extends SessionMemory_base {
|
|
16
|
+
}
|
|
17
|
+
export interface VerifiedSession {
|
|
18
|
+
readonly session: {
|
|
19
|
+
readonly expiresAt: Date;
|
|
20
|
+
readonly id: string;
|
|
21
|
+
};
|
|
22
|
+
readonly user: {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly permissions?: readonly Permission[] | undefined;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare const RememberedSession: Schema.Struct<{
|
|
28
|
+
readonly session: Schema.Struct<{
|
|
29
|
+
readonly expiresAt: Schema.DateFromString;
|
|
30
|
+
readonly id: Schema.String;
|
|
31
|
+
}>;
|
|
32
|
+
readonly user: Schema.Struct<{
|
|
33
|
+
readonly id: Schema.String;
|
|
34
|
+
readonly permissions: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
35
|
+
readonly name: Schema.String;
|
|
36
|
+
readonly strength: Schema.Literals<readonly ["own", "any"]>;
|
|
37
|
+
}>>>;
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
40
|
+
export type RememberedSession = typeof RememberedSession.Type;
|
|
41
|
+
export declare const forgetSession: Effect.Effect<void, never, SessionMemory>;
|
|
42
|
+
export declare const recallSession: Effect.Effect<Option.Option<RememberedSession>, never, SessionMemory>;
|
|
43
|
+
export declare const rememberSession: (answer: VerifiedSession | null) => Effect.Effect<{
|
|
44
|
+
readonly session: {
|
|
45
|
+
readonly expiresAt: Date;
|
|
46
|
+
readonly id: string;
|
|
47
|
+
};
|
|
48
|
+
readonly user: {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly permissions?: readonly {
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly strength: "any" | "own";
|
|
53
|
+
}[];
|
|
54
|
+
};
|
|
55
|
+
} | null, never, SessionMemory>;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=SessionMemory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionMemory.d.ts","sourceRoot":"","sources":["../../src/client/SessionMemory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAQ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;;;;AAI7D,qBAAa,wBAAyB,SAAQ,8BAA6C;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;CAAG;;oBAKxG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,wBAAwB,CAAC;mBAC9C,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,EAAE,wBAAwB,CAAC;oBACrD,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,wBAAwB,CAAC;;AALlF,qBAAa,aAAc,SAAQ,kBAOK;CAAG;AAE3C,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,CAAA;KAAE,CAAC;CACjG;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAG5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAO9D,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa,CAOlE,CAAC;AAQH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,aAAa,CAQ9F,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;+BAiB1B,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Clock, Context, Data, Effect, Option, Schema } from "effect";
|
|
2
|
+
import { Permission } from "@shivaedev/access/permission.ts";
|
|
3
|
+
import { clearStoredQueries } from "@shivaedev/contract/adapters/storedQueryAccess.ts";
|
|
4
|
+
import { QueryStorageProvider } from "@shivaedev/contract/QueryStorage.ts";
|
|
5
|
+
export class SessionMemoryUnavailable extends Data.TaggedError("SessionMemoryUnavailable") {
|
|
6
|
+
}
|
|
7
|
+
export class SessionMemory extends Context.Service()("@shivaedev/identity/SessionMemory") {
|
|
8
|
+
}
|
|
9
|
+
export const RememberedSession = Schema.Struct({
|
|
10
|
+
session: Schema.Struct({ expiresAt: Schema.DateFromString, id: Schema.String }),
|
|
11
|
+
user: Schema.Struct({ id: Schema.String, permissions: Schema.optionalKey(Schema.Array(Permission)) }),
|
|
12
|
+
});
|
|
13
|
+
const Stored = Schema.fromJsonString(RememberedSession);
|
|
14
|
+
const decodeStored = Schema.decodeEffect(Stored);
|
|
15
|
+
const encodeStored = Schema.encodeEffect(Stored);
|
|
16
|
+
// A Layer that also supplies query storage gets the device's stored query results wiped with the memory, by every path that forgets.
|
|
17
|
+
export const forgetSession = Effect.gen(function* () {
|
|
18
|
+
const memory = yield* SessionMemory;
|
|
19
|
+
yield* Effect.ignore(memory.clear);
|
|
20
|
+
const queries = yield* Effect.serviceOption(QueryStorageProvider);
|
|
21
|
+
if (Option.isSome(queries)) {
|
|
22
|
+
yield* clearStoredQueries().pipe(Effect.provideService(QueryStorageProvider, queries.value));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const stored = Effect.gen(function* () {
|
|
26
|
+
const memory = yield* SessionMemory;
|
|
27
|
+
const value = yield* Effect.orElseSucceed(memory.read, () => null);
|
|
28
|
+
return value === null ? Option.none() : yield* Effect.option(decodeStored(value));
|
|
29
|
+
});
|
|
30
|
+
export const recallSession = Effect.gen(function* () {
|
|
31
|
+
const remembered = yield* stored;
|
|
32
|
+
const now = yield* Clock.currentTimeMillis;
|
|
33
|
+
const current = Option.filter(remembered, ({ session }) => session.expiresAt.getTime() > now);
|
|
34
|
+
if (Option.isNone(current)) {
|
|
35
|
+
yield* forgetSession;
|
|
36
|
+
}
|
|
37
|
+
return current;
|
|
38
|
+
});
|
|
39
|
+
export const rememberSession = Effect.fnUntraced(function* (answer) {
|
|
40
|
+
if (answer === null) {
|
|
41
|
+
yield* forgetSession;
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const { permissions } = answer.user;
|
|
45
|
+
const remembered = {
|
|
46
|
+
session: { expiresAt: answer.session.expiresAt, id: answer.session.id },
|
|
47
|
+
user: { id: answer.user.id, ...(permissions === undefined ? {} : { permissions }) },
|
|
48
|
+
};
|
|
49
|
+
const previous = yield* stored;
|
|
50
|
+
if (Option.exists(previous, ({ user }) => user.id !== remembered.user.id)) {
|
|
51
|
+
yield* forgetSession;
|
|
52
|
+
}
|
|
53
|
+
const memory = yield* SessionMemory;
|
|
54
|
+
yield* encodeStored(remembered).pipe(Effect.flatMap(memory.write), Effect.ignore);
|
|
55
|
+
return remembered;
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=SessionMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionMemory.js","sourceRoot":"","sources":["../../src/client/SessionMemory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,O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M,oBAAoB,0CAI/B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
|
+
import { SessionMemory, SessionMemoryUnavailable } from "#client/SessionMemory.ts";
|
|
3
|
+
const STORAGE_KEY = "@shivaedev/identity/session";
|
|
4
|
+
function storage(run) {
|
|
5
|
+
return Effect.try({
|
|
6
|
+
catch: (cause) => new SessionMemoryUnavailable({ cause }),
|
|
7
|
+
try: () => run(globalThis.localStorage),
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export const browserSessionMemory = Layer.succeed(SessionMemory, {
|
|
11
|
+
clear: storage((store) => store.removeItem(STORAGE_KEY)),
|
|
12
|
+
read: storage((store) => store.getItem(STORAGE_KEY)),
|
|
13
|
+
write: (value) => storage((store) => store.setItem(STORAGE_KEY, value)),
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=browserSessionMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserSessionMemory.js","sourceRoot":"","sources":["../../../src/client/adapters/browserSessionMemory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAElD,SAAS,OAAO,CAAI,GAA0B;IAC7C,OAAO,MAAM,CAAC,GAAG,CAAC;QACjB,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,wBAAwB,CAAC,EAAE,KAAK,EAAE,CAAC;QACzD,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;KACvC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE;IAChE,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACxD,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACpD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;CACvE,CAAC,CAAC"}
|
|
@@ -50,7 +50,40 @@ declare const StoredPreferences_base: import("effect/schema/VariantSchema").Clas
|
|
|
50
50
|
declare class StoredPreferences extends StoredPreferences_base {
|
|
51
51
|
}
|
|
52
52
|
export declare const AccountPreferenceRows: import("effect/Context").Service<"@shivaedev/identity/AccountPreferenceRows", import("@shivaedev/sql/batchedDelete.ts").BatchedDelete<typeof StoredPreferences> & Omit<import("@shivaedev/sql/versionedRepository.ts").NativeRepository<typeof StoredPreferences, "id">, "delete" | "update" | "updateVoid"> & {
|
|
53
|
-
readonly delete: ((id: string) => import("effect/Effect").Effect<void, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>) & ((where: import("@shivaedev/sql/
|
|
53
|
+
readonly delete: ((id: string) => import("effect/Effect").Effect<void, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>) & ((where: import("@shivaedev/sql/deleteFilter.ts").DeleteFilter<typeof StoredPreferences>) => import("effect/Effect").Effect<void, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>) & ((where: Partial<import("@shivaedev/sql/tupleIn.ts").TupleFilter<typeof StoredPreferences>> & {
|
|
54
|
+
readonly locale?: string | import("@shivaedev/sql/filterOperators.ts").Listed<string> | ({
|
|
55
|
+
readonly gt?: string;
|
|
56
|
+
readonly gte?: string;
|
|
57
|
+
readonly lt?: string;
|
|
58
|
+
readonly lte?: string;
|
|
59
|
+
} & import("@shivaedev/sql/filterOperators.ts").Without<"in" | "not"> & {
|
|
60
|
+
readonly like?: string;
|
|
61
|
+
}) | undefined;
|
|
62
|
+
readonly timezone?: string | import("@shivaedev/sql/filterOperators.ts").Listed<string> | ({
|
|
63
|
+
readonly gt?: string;
|
|
64
|
+
readonly gte?: string;
|
|
65
|
+
readonly lt?: string;
|
|
66
|
+
readonly lte?: string;
|
|
67
|
+
} & import("@shivaedev/sql/filterOperators.ts").Without<"in" | "not"> & {
|
|
68
|
+
readonly like?: string;
|
|
69
|
+
}) | undefined;
|
|
70
|
+
readonly units?: "imperial" | "metric" | import("@shivaedev/sql/filterOperators.ts").Listed<"imperial" | "metric"> | ({
|
|
71
|
+
readonly gt?: NonNullable<"imperial" | "metric">;
|
|
72
|
+
readonly gte?: NonNullable<"imperial" | "metric">;
|
|
73
|
+
readonly lt?: NonNullable<"imperial" | "metric">;
|
|
74
|
+
readonly lte?: NonNullable<"imperial" | "metric">;
|
|
75
|
+
} & import("@shivaedev/sql/filterOperators.ts").Without<"in" | "not"> & {
|
|
76
|
+
readonly like?: NonNullable<"imperial" | "metric">;
|
|
77
|
+
}) | undefined;
|
|
78
|
+
readonly id?: string | import("@shivaedev/sql/filterOperators.ts").Listed<string> | ({
|
|
79
|
+
readonly gt?: string;
|
|
80
|
+
readonly gte?: string;
|
|
81
|
+
readonly lt?: string;
|
|
82
|
+
readonly lte?: string;
|
|
83
|
+
} & import("@shivaedev/sql/filterOperators.ts").Without<"in" | "not"> & {
|
|
84
|
+
readonly like?: string;
|
|
85
|
+
}) | undefined;
|
|
86
|
+
} & import("@shivaedev/sql/deleteFilter.ts").DefinedEntryRequired) => import("effect/Effect").Effect<void, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>);
|
|
54
87
|
readonly update: import("@shivaedev/sql/repositoryUpdate.ts").Update<typeof StoredPreferences, "id">;
|
|
55
88
|
readonly updateVoid: import("@shivaedev/sql/repositoryUpdate.ts").UpdateVoid<typeof StoredPreferences, "id">;
|
|
56
89
|
} & import("@shivaedev/sql/batchWrites.ts").BatchWrites<typeof StoredPreferences> & import("@shivaedev/sql/insertFromSelect.ts").SelectWrites<typeof StoredPreferences> & import("@shivaedev/sql/repositoryQueries.ts").Queries<typeof StoredPreferences> & import("@shivaedev/sql/conflictWrites.ts").ConflictWrites<typeof StoredPreferences, "id", never>> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rows.d.ts","sourceRoot":"","sources":["../../../src/server/account-preferences/Rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMhC,cAAM,iBAAkB,SAAQ,sBAG9B;CAAG;AASL,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"Rows.d.ts","sourceRoot":"","sources":["../../../src/server/account-preferences/Rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMhC,cAAM,iBAAkB,SAAQ,sBAG9B;CAAG;AASL,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGhC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { AuthUnavailable, Unauthorized } from "@shivaedev/errors/taxonomy.ts";
|
|
3
3
|
import type { ProviderAccountValue } from "#identity.ts";
|
|
4
4
|
import type { SessionProvider, SessionShape } from "#server/session.ts";
|
|
5
5
|
export type GetSession<TSession extends SessionShape> = (headers: globalThis.Headers) => Promise<TSession | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"betterAuthSessions.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/betterAuthSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAA6B,MAAM,QA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|
1
1
|
import { Clock, Effect, Option, Predicate, Schema } from "effect";
|
|
2
2
|
import * as HttpStatus from "effect/http/HttpStatus";
|
|
3
|
-
import {
|
|
3
|
+
import { unauthorized } from "@shivaedev/access/refusal.ts";
|
|
4
4
|
import { authCall } from "#server/adapters/authCall.ts";
|
|
5
5
|
import { providerFailure } from "#server/providerFailure.ts";
|
|
6
6
|
const ExpiringSession = Schema.Struct({ session: Schema.Struct({ expiresAt: Schema.Date }) });
|
|
@@ -15,7 +15,7 @@ export function betterAuthSessions(getSession, getProviderAccounts) {
|
|
|
15
15
|
return Option.fromNullishOr(session);
|
|
16
16
|
}
|
|
17
17
|
const providerAccounts = authCall(() => getProviderAccounts(transport)).pipe(Effect.catch(({ cause }) => Predicate.hasProperty(cause, "statusCode") && cause.statusCode === HttpStatus.fromLiteral("Unauthorized")
|
|
18
|
-
? Effect.fail(
|
|
18
|
+
? Effect.fail(unauthorized())
|
|
19
19
|
: providerFailure(cause)));
|
|
20
20
|
return Option.some({ ...session, user: { ...session.user, providerAccounts } });
|
|
21
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"betterAuthSessions.js","sourceRoot":"","sources":["../../../src/server/adapters/betterAuthSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAElE,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"betterAuthSessions.js","sourceRoot":"","sources":["../../../src/server/adapters/betterAuthSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAElE,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO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,EAAE,EAAwD,EAAE,CACnE,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC;YACxG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7B,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAC1B,CACD,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, Effect, Option } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { AuthUnavailable, Forbidden } from "@shivaedev/errors/taxonomy.ts";
|
|
3
3
|
import type { SessionShape } from "#server/session.ts";
|
|
4
|
-
export declare const currentSessionContext: <TSession extends SessionShape, R, E = AuthUnavailable | Forbidden>(id: string, lookup: Effect.Effect<Option.Option<TSession>, E, R>) => Effect.Effect<Context.Context<never>, E | Unauthorized, R>;
|
|
4
|
+
export declare const currentSessionContext: <TSession extends SessionShape, R, E = AuthUnavailable | Forbidden>(id: string, lookup: Effect.Effect<Option.Option<TSession>, E, R>) => Effect.Effect<Context.Context<never>, E | import("@shivaedev/errors/taxonomy.ts").Unauthorized, R>;
|
|
5
5
|
//# sourceMappingURL=currentSessionContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currentSessionContext.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/currentSessionContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"currentSessionContext.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/currentSessionContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAGhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,GAAgC,QAAQ,SAAS,YAAY,EAAE,CAAC,EAAE,CAAC,uMAgBnG,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Context, Effect, Option, Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import { unauthorized } from "@shivaedev/access/refusal.ts";
|
|
3
3
|
import { SessionUser, SessionUserSchema, SessionUserWithProviderAccounts } from "#identity.ts";
|
|
4
4
|
import { providerAccountsUser } from "#server/providerAccountsUser.ts";
|
|
5
5
|
export const currentSessionContext = Effect.fnUntraced(function* (id, lookup) {
|
|
6
6
|
const session = yield* lookup;
|
|
7
7
|
if (Option.isNone(session) || session.value.user.id !== id) {
|
|
8
|
-
return yield*
|
|
8
|
+
return yield* unauthorized();
|
|
9
9
|
}
|
|
10
10
|
let context = yield* Effect.context();
|
|
11
11
|
if (Option.isSome(Context.getOption(context, SessionUser))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currentSessionContext.js","sourceRoot":"","sources":["../../../src/server/adapters/currentSessionContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"currentSessionContext.js","sourceRoot":"","sources":["../../../src/server/adapters/currentSessionContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ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version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../../src/server/better-auth/adapters/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAG5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAGvF,OAAO,EAAE,KAAK,qBAAqB,EAAsB,MAAM,gDAAgD,CAAC;AAIhH,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,2CAA2C,CAAC;AAU3G,OAAO,EAAmC,KAAK,YAAY,EAAc,MAAM,4CAA4C,CAAC;AAE5H,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../../src/server/better-auth/adapters/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAG5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAGvF,OAAO,EAAE,KAAK,qBAAqB,EAAsB,MAAM,gDAAgD,CAAC;AAIhH,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,2CAA2C,CAAC;AAU3G,OAAO,EAAmC,KAAK,YAAY,EAAc,MAAM,4CAA4C,CAAC;AAE5H,OAAO,EAAE,KA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AAC;AAC1H,wBAAgB,eAAe,CAAC,KAAK,CAAC,QAAQ,SAAS,iBAAiB,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,EAC7F,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,GACjC,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -20,6 +20,7 @@ import { authRouteHandler } from "#server/better-auth/adapters/routeHandler.ts";
|
|
|
20
20
|
import { fromStorage, signInGate } from "#server/better-auth/adapters/signInGate.ts";
|
|
21
21
|
import { signInPolicyOptions } from "#server/better-auth/adapters/signInPolicyOptions.ts";
|
|
22
22
|
import { storedRoleOptions } from "#server/better-auth/adapters/storedRoleOptions.ts";
|
|
23
|
+
import { changeHooks } from "#server/better-auth/changeHooks.ts";
|
|
23
24
|
import { AuthRouteHandler, mountRoutes } from "#server/better-auth/mountRoutes.ts";
|
|
24
25
|
import { UndeclaredDefaultRole } from "#server/better-auth/UndeclaredDefaultRole.ts";
|
|
25
26
|
import { providerFailure } from "#server/providerFailure.ts";
|
|
@@ -36,7 +37,8 @@ const mountAuth = Effect.fn("Identity.mountAuth")(function* (options, mount = {}
|
|
|
36
37
|
const runtime = yield* hookRuntime();
|
|
37
38
|
const preferences = mount.accountPreferences === true ? yield* accountPreferenceOptions(options).pipe(Effect.provide(accountPreferencesStore)) : options;
|
|
38
39
|
const reset = passwordResetOptions(preferences, mount.onPasswordReset, runtime);
|
|
39
|
-
const
|
|
40
|
+
const announced = effectHookOptions(yield* emailOptions(reset, mount.emails, runtime), changeHooks, runtime);
|
|
41
|
+
const hooked = effectHookOptions(announced, mount.databaseHooks, runtime);
|
|
40
42
|
const configured = mount.roles === undefined ? hooked : storedRoleOptions(closeRoleEndpoints(hooked), mount);
|
|
41
43
|
const gated = yield* signInPolicyOptions(configured, gate, () => auth.$context);
|
|
42
44
|
const seed = mount.roleSeed === undefined ? undef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AM,UAAU,eAAe,CAC9B,OAAiB,EACjB,KAAK,GAAiC,EAAE;IAExC,OAAO,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -24,7 +24,7 @@ export const assignRole = Effect.fn("Identity.assignRole")(function* (access, us
|
|
|
24
24
|
});
|
|
25
25
|
const target = yield* readTarget(userId).pipe(Effect.mapError(unavailable));
|
|
26
26
|
if (Option.isNone(target)) {
|
|
27
|
-
return yield* Effect.fail(new NotFound({ message: "
|
|
27
|
+
return yield* Effect.fail(new NotFound({ message: "This user no longer exists." }));
|
|
28
28
|
}
|
|
29
29
|
if (target.value.role === role) {
|
|
30
30
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignRole.js","sourceRoot":"","sources":["../../../src/server/better-auth/assignRole.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAyB,MAAM,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,SAAS,WAAW;IACnB,OAAO,IAAI,eAAe,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC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