@prismshadow/penguin-library-auth · library/auth/src/account-data.ts:25

UserDraftsStore

interface

UserDraftsStore: the mechanism UserDraftsRepo implements.

API

@Interface()
export abstract class UserDraftsStore {
  abstract list(userId: string): StoredDraft[];
  abstract apply(
      userId: string,
      writes: readonly DraftWrite[],
      bounds: { maxCount: number; maxChars: number },
    ): void;
  abstract deleteBySession(sessionId: string): void;
  abstract deleteByProject(projectId: string): void;
  abstract deleteByAgent(projectId: string, agentId: string): void;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use

Members (5)

list

list(userId: string): StoredDraft[]
@paramuserIdstring
@returnsStoredDraft[]

apply

apply(userId: string, writes: readonly DraftWrite[], bounds: { maxCount: number; maxChars: number }): void

Applies the writes together, then drops the user's least recently written drafts outside them until the user holds at most maxCount drafts of at most maxChars characters in all.

@paramuserIdstring
@paramwritesreadonly DraftWrite[]
@parambounds{ maxCount: number; maxChars: number }
@returnsvoid

deleteBySession

deleteBySession(sessionId: string): void

Every user's drafts of one Session (the Session is being deleted).

@paramsessionIdstring
@returnsvoid

deleteByProject

deleteByProject(projectId: string): void

Every user's drafts of one Project and of the Sessions indexed under it (the Project is being deleted).

@paramprojectIdstring
@returnsvoid

deleteByAgent

deleteByAgent(projectId: string, agentId: string): void

Every user's drafts of the Sessions indexed under one Agent (the Agent is being deleted).

@paramprojectIdstring
@paramagentIdstring
@returnsvoid