Skip to content

apollo-code


apollo-code / storage/src / DefaultMemoryService

Class: DefaultMemoryService

Implements

Constructors

Constructor

new DefaultMemoryService(repository, policy?, now?, createId?, preWrite?): DefaultMemoryService

Parameters

repository

MemoryRepository

policy?

MemoryPolicy = ...

now?

() => Date

createId?

() => string

preWrite?

MemoryPreWrite = ...

Returns

DefaultMemoryService

Properties

createId

readonly createId: () => string = randomUUID

Returns

string


now

readonly now: () => Date

Returns

Date


policy

readonly policy: MemoryPolicy


preWrite

readonly preWrite: MemoryPreWrite


repository

readonly repository: MemoryRepository

Methods

create()

create(input): Promise<MemoryRecord>

Parameters

input

NewMemoryRecord

Returns

Promise<MemoryRecord>

Implementation of

MemoryService.create


delete()

delete(scope, id, options?): Promise<MemoryRecord>

Parameters

scope

MemoryRecordScope

id

string

options?

MemoryMutationOptions = {}

Returns

Promise<MemoryRecord>

Implementation of

MemoryService.delete


deleteAttachment()

deleteAttachment(scope, id, attachmentId, options?): Promise<MemoryRecord>

Parameters

scope

MemoryRecordScope

id

string

attachmentId

string

options?

MemoryMutationOptions

Returns

Promise<MemoryRecord>

Implementation of

MemoryService.deleteAttachment


flush()

flush(): Promise<void>

Returns

Promise<void>

Implementation of

MemoryService.flush


get()

get(scope, id): Promise<MemoryRecord | undefined>

Parameters

scope

MemoryRecordScope

id

string

Returns

Promise<MemoryRecord | undefined>

Implementation of

MemoryService.get


invalidateAttachment()

invalidateAttachment(scope, id, attachmentId, options?): Promise<MemoryRecord>

Parameters

scope

MemoryRecordScope

id

string

attachmentId

string

options?

MemoryMutationOptions

Returns

Promise<MemoryRecord>

Implementation of

MemoryService.invalidateAttachment


list()

list(scope, options?): Promise<MemoryRecord[]>

Parameters

scope

MemoryRecordScope

options?

Omit<MemoryListOptions, "cursor"> = {}

Returns

Promise<MemoryRecord[]>

Implementation of

MemoryService.list


listPage()

listPage(scope, options?): Promise<MemoryPage>

Parameters

scope

MemoryRecordScope

options?

MemoryListOptions = {}

Returns

Promise<MemoryPage>

Implementation of

MemoryService.listPage


onDidChange()

onDidChange(listener): object

Parameters

listener

() => void

Returns

object

dispose()

dispose(): void

Returns

void

Implementation of

MemoryService.onDidChange


pin()

pin(scope, id, options?): Promise<MemoryRecord>

Parameters

scope

MemoryRecordScope

id

string

options?

MemoryMutationOptions

Returns

Promise<MemoryRecord>

Implementation of

MemoryService.pin


start()

start(): Promise<void>

Returns

Promise<void>

Implementation of

MemoryService.start


unpin()

unpin(scope, id, options?): Promise<MemoryRecord>

Parameters

scope

MemoryRecordScope

id

string

options?

MemoryMutationOptions

Returns

Promise<MemoryRecord>

Implementation of

MemoryService.unpin


update()

update(scope, id, patch, options?): Promise<MemoryRecord>

Parameters

scope

MemoryRecordScope

id

string

patch

Partial<Pick<MemoryRecord, "content" | "tags" | "pinned" | "provenance" | "attachments">>

options?

MemoryMutationOptions = {}

Returns

Promise<MemoryRecord>

Implementation of

MemoryService.update


validateWrite()

validateWrite(input, operation?): Promise<void>

Parameters

input

NewMemoryRecord

operation?

"create" | "update"

Returns

Promise<void>

Implementation of

MemoryService.validateWrite