createArtifactService
@forge/monorepo / backend/src / createArtifactService
Function: createArtifactService()
createArtifactService(
deps):object
Defined in: backend/src/artifacts/index.ts:79
Parameters
deps
Returns
create()
create(
context,input):Promise<Artifact>
Create an artifact at version 1.
Parameters
context
input
content
conversationId
name
string
provenance
Returns
Promise<Artifact>
history()
history(
context,input):Promise<Page<ArtifactVersion>>
The version history, for a restore or an audit. Metadata only — no content is loaded.
Parameters
context
input
cursor?
string
id
limit
number
Returns
Promise<Page<ArtifactVersion>>
listForConversation()
listForConversation(
context,input):Promise<Page<Artifact>>
Parameters
context
input
conversationId
cursor?
string
limit
number
Returns
read()
read(
context,input):Promise<{artifact:Artifact;content:unknown;version:ArtifactVersion; }>
A version's row and its content together. The latest when no version is asked for.
Parameters
context
input
id
version?
number
Returns
Promise<{ artifact: Artifact; content: unknown; version: ArtifactVersion; }>
regenerate()
regenerate(
context,input):Promise<{version:number; }>
Regenerate: a new version, never an overwrite — AC-2.
expectedLatestVersion is read here rather than taken from the caller, and then passed through as the
compare. That is not redundant: the read establishes what the caller is regenerating from, and the
compare makes a concurrent regeneration lose loudly instead of silently replacing this one.
Parameters
context
input
content
id
provenance
Returns
Promise<{ version: number; }>
restore()
restore(
context,input):Promise<{version:number; }>
Restore an earlier version by making it the newest one.
A new version whose content is the old one's, not a pointer moved backwards. Moving a pointer would make the history lie about what happened — and "the version that was current on Tuesday" is exactly the question a shared link asks.
Parameters
context
input
id
producedBy?
string
version
number
Returns
Promise<{ version: number; }>
softDelete()
softDelete(
context,id):Promise<{deleted:boolean; }>
Parameters
context
id
Returns
Promise<{ deleted: boolean; }>