Skip to content

TypeScript API / @laikacms/server/ai / User

Interface: User ​

Default user interface with required fields. Consumers can extend this by declaring the module:

Example ​

typescript
declare module '@laikacms/server/ai' {
  interface User {
    role: 'admin' | 'editor';
    organizationId: string;
  }
}

Properties ​

email ​

ts
email: string;

id ​

ts
id: string;

name? ​

ts
optional name?: string;

scopes? ​

ts
optional scopes?: Scope[];

Scopes granted to the credential that authenticated this request, in the resolveBearer shape from laikacms/auth ({ user, scopes }): a session token yields its full/granted scopes, a PAT yields its granted subset. authenticateAccessToken should spread its resolveBearer result as { ...ctx.user, scopes: ctx.scopes } rather than treating "authenticated" as "full admin". Omitted (matching a resolveBearer session with no scopes) is treated as full access, for backwards compatibility with consumers that do not scope AI access yet.

Released under the MIT License.