@absolutejs/auth 0.27.0-beta.5 → 0.27.0-beta.6

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.
@@ -0,0 +1,11 @@
1
+ import type { Cookie } from 'elysia';
2
+ import type { SessionData, SessionRecord, UserSessionId } from '../types';
3
+ import type { AuthSessionStore } from './types';
4
+ export declare const createAnonymousSession: <UserType>({ authSessionStore, cookie, guestUser, inMemorySession, sessionDurationMs }: {
5
+ authSessionStore?: AuthSessionStore<UserType>;
6
+ cookie: Cookie<UserSessionId | undefined>;
7
+ guestUser: UserType;
8
+ inMemorySession: SessionRecord<UserType>;
9
+ sessionDurationMs?: number;
10
+ }) => Promise<`${string}-${string}-${string}-${string}-${string}`>;
11
+ export declare const isAnonymousSession: <UserType>(session: SessionData<UserType> | undefined) => boolean;
@@ -0,0 +1,25 @@
1
+ import type { Cookie } from 'elysia';
2
+ import type { SessionRecord, UserSessionId } from '../types';
3
+ import type { AuthSessionStore } from './types';
4
+ export declare const addToSessionRing: (ring: Cookie<string | undefined>, sessionId: UserSessionId) => Cookie<string | undefined>;
5
+ export declare const listRingSessions: <UserType>({ authSessionStore, inMemorySession, ring }: {
6
+ authSessionStore?: AuthSessionStore<UserType>;
7
+ inMemorySession?: SessionRecord<UserType>;
8
+ ring: Cookie<string | undefined>;
9
+ }) => Promise<{
10
+ sessionId: UserSessionId;
11
+ user: UserType;
12
+ }[]>;
13
+ export declare const readSessionRing: (ring: Cookie<string | undefined>) => `${string}-${string}-${string}-${string}-${string}`[];
14
+ export declare const removeFromSessionRing: <UserType>({ activeCookie, authSessionStore, inMemorySession, ring, sessionId }: {
15
+ activeCookie?: Cookie<UserSessionId | undefined>;
16
+ authSessionStore?: AuthSessionStore<UserType>;
17
+ inMemorySession?: SessionRecord<UserType>;
18
+ ring: Cookie<string | undefined>;
19
+ sessionId: UserSessionId;
20
+ }) => Promise<void>;
21
+ export declare const switchActiveSession: ({ activeCookie, ring, sessionId }: {
22
+ activeCookie: Cookie<UserSessionId | undefined>;
23
+ ring: Cookie<string | undefined>;
24
+ sessionId: UserSessionId;
25
+ }) => boolean;
@@ -9,6 +9,7 @@ type ClearSessionProps<UserType> = {
9
9
  export declare const clearSession: <UserType>({ authSessionStore, cookie, inMemorySession }: ClearSessionProps<UserType>) => Promise<void>;
10
10
  export declare const persistWhen: (shouldPersist: boolean, persist: () => Promise<void>) => Promise<void>;
11
11
  type PromoteToSessionProps<UserType> = {
12
+ anonymous?: boolean;
12
13
  authSessionStore?: AuthSessionStore<UserType>;
13
14
  cookie: Cookie<UserSessionId | undefined>;
14
15
  impersonator?: SessionData<UserType>['impersonator'];
@@ -17,5 +18,5 @@ type PromoteToSessionProps<UserType> = {
17
18
  sessionDurationMs: number;
18
19
  user: UserType;
19
20
  };
20
- export declare const promoteToSession: <UserType>({ authSessionStore, cookie, impersonator, inMemorySession, samlLogout, sessionDurationMs, user }: PromoteToSessionProps<UserType>) => Promise<`${string}-${string}-${string}-${string}-${string}`>;
21
+ export declare const promoteToSession: <UserType>({ anonymous, authSessionStore, cookie, impersonator, inMemorySession, samlLogout, sessionDurationMs, user }: PromoteToSessionProps<UserType>) => Promise<`${string}-${string}-${string}-${string}-${string}`>;
21
22
  export {};
package/dist/types.d.ts CHANGED
@@ -67,6 +67,9 @@ export type SessionData<UserType> = {
67
67
  };
68
68
  /** Present only when this session was created via admin impersonation. */
69
69
  impersonator?: Impersonator;
70
+ /** True for a guest/anonymous session (createAnonymousSession) that can later be
71
+ * upgraded by a real login. */
72
+ anonymous?: boolean;
70
73
  };
71
74
  export type SessionRecord<UserType> = Record<UserSessionId, SessionData<UserType>>;
72
75
  export type UnregisteredSessionData = {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.27.0-beta.5",
2
+ "version": "0.27.0-beta.6",
3
3
  "name": "@absolutejs/auth",
4
4
  "description": "An authorization library for absolutejs",
5
5
  "repository": {