@volter/world-ui 1.0.28 → 1.0.30
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/src/session.d.ts +1 -1
- package/dist/src/session.js +2 -5
- package/package.json +2 -2
- package/src/session.ts +3 -6
package/dist/src/session.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export declare function signedIn(ctx: HandlerContext, cookie: string, scope?: st
|
|
|
8
8
|
export declare function redirect(location: string, cookie?: string): Response;
|
|
9
9
|
/** The person signed in: a session recorded (in `scope`, when the vendor signs a person in apart per dashboard), its
|
|
10
10
|
* cookie set, and the page they asked for next. */
|
|
11
|
-
export declare function startSession(ctx: HandlerContext, email: string, cookie: string, next: string, scope?: string): Promise<Response>;
|
|
11
|
+
export declare function startSession(ctx: Pick<HandlerContext, 'record' | 'secret' | 'occurredAt'>, email: string, cookie: string, next: string, scope?: string): Promise<Response>;
|
|
12
12
|
/** To the vendor's sign-in page, which returns the person to `path` (its parameter the vendor's: `next`, `return_to`). */
|
|
13
13
|
export declare const toSignIn: (signIn: string, path: string, param?: string) => Response;
|
package/dist/src/session.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// knows who is signed in, the same way in every pack. A person is the kernel's (`recordPerson`, `personWith`); signing
|
|
3
3
|
// in records a `_web_session` row and sets the vendor's session cookie on the answer; a page asks who the request's
|
|
4
4
|
// cookie names. Everything is written and read through the screen's context.
|
|
5
|
-
import { personOf } from '@volter/world-core';
|
|
5
|
+
import { startBrowserSession, personOf } from '@volter/world-core';
|
|
6
6
|
import { cookieOf } from "../client/sign-in.js";
|
|
7
7
|
const SESSION = '_web_session';
|
|
8
8
|
/** A form a page posted, by field. */
|
|
@@ -24,10 +24,7 @@ export function redirect(location, cookie) {
|
|
|
24
24
|
/** The person signed in: a session recorded (in `scope`, when the vendor signs a person in apart per dashboard), its
|
|
25
25
|
* cookie set, and the page they asked for next. */
|
|
26
26
|
export async function startSession(ctx, email, cookie, next, scope) {
|
|
27
|
-
|
|
28
|
-
const token = await ctx.secret(`web-session:${issued}`);
|
|
29
|
-
await ctx.record(SESSION, { token, email, ...(scope !== undefined ? { scope } : {}), created_at: ctx.occurredAt }, `websession:${token}`);
|
|
30
|
-
return redirect(next, `${cookie}=${token}; path=/; HttpOnly; Secure; SameSite=Lax`);
|
|
27
|
+
return redirect(next, await startBrowserSession(ctx, email, cookie, scope));
|
|
31
28
|
}
|
|
32
29
|
/** To the vendor's sign-in page, which returns the person to `path` (its parameter the vendor's: `next`, `return_to`). */
|
|
33
30
|
export const toSignIn = (signIn, path, param = 'next') => redirect(`${signIn}?${param}=${encodeURIComponent(path)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/world-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "Shared pieces and serving for derived packs' screens (hosted flows and workspaces), through each pack's own API; see docs/contributing/architecture.md, Screens.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Volter (https://github.com/volter-ai)",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@volter/world-core": "3.0.
|
|
31
|
+
"@volter/world-core": "3.0.30",
|
|
32
32
|
"react": "^19.2.7",
|
|
33
33
|
"react-dom": "^19.2.7"
|
|
34
34
|
},
|
package/src/session.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// knows who is signed in, the same way in every pack. A person is the kernel's (`recordPerson`, `personWith`); signing
|
|
3
3
|
// in records a `_web_session` row and sets the vendor's session cookie on the answer; a page asks who the request's
|
|
4
4
|
// cookie names. Everything is written and read through the screen's context.
|
|
5
|
-
import { personOf, type HandlerContext, type Person } from '@volter/world-core';
|
|
5
|
+
import { startBrowserSession, personOf, type HandlerContext, type Person } from '@volter/world-core';
|
|
6
6
|
import { cookieOf } from '../client/sign-in.tsx';
|
|
7
7
|
|
|
8
8
|
const SESSION = '_web_session';
|
|
@@ -27,11 +27,8 @@ export function redirect(location: string, cookie?: string): Response {
|
|
|
27
27
|
|
|
28
28
|
/** The person signed in: a session recorded (in `scope`, when the vendor signs a person in apart per dashboard), its
|
|
29
29
|
* cookie set, and the page they asked for next. */
|
|
30
|
-
export async function startSession(ctx: HandlerContext, email: string, cookie: string, next: string, scope?: string): Promise<Response> {
|
|
31
|
-
|
|
32
|
-
const token = await ctx.secret(`web-session:${issued}`);
|
|
33
|
-
await ctx.record(SESSION, { token, email, ...(scope !== undefined ? { scope } : {}), created_at: ctx.occurredAt }, `websession:${token}`);
|
|
34
|
-
return redirect(next, `${cookie}=${token}; path=/; HttpOnly; Secure; SameSite=Lax`);
|
|
30
|
+
export async function startSession(ctx: Pick<HandlerContext, 'record' | 'secret' | 'occurredAt'>, email: string, cookie: string, next: string, scope?: string): Promise<Response> {
|
|
31
|
+
return redirect(next, await startBrowserSession(ctx, email, cookie, scope));
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
/** To the vendor's sign-in page, which returns the person to `path` (its parameter the vendor's: `next`, `return_to`). */
|