References
FileInfo
Re-exports FileInfoFileRef
Re-exports FileRefStagedFileRef
Re-exports StagedFileRefType Aliases
SeriesOccurrence
Ƭ SeriesOccurrence:Readonly<{ table: string ; id: string ; key: string ; time: string }>
The exact occurrence of a native series whose declared file property an
attachment names. Decimal time preserves every signed 64-bit instant.
RecordRef
Ƭ RecordRef:string | Readonly<{ series: SeriesOccurrence }>
The record an attachment belongs to: a document ID, or a series
occurrence.
GrantRef
Ƭ GrantRef:string & { __grantRef: unique symbol }
A grant’s lookup identity. It is not a bearer secret: the server checks
its recipient on every read.
AttachmentLocator
Ƭ AttachmentLocator:Readonly<{ kind: "attachment" ; record: RecordRef ; field: string ; file: FileRef }>
A file read through the record field that attaches it. field is the
field’s path, its segments joined by / (JSON pointer escaping, without
the leading slash), such as source or files/0/file. The locator names
the expected file too: a read refuses with FileAttachmentChanged when
the field now names another file. It carries no permission; the server
evaluates the route on every new read.
GrantLocator
Ƭ GrantLocator:Readonly<{ kind: "grant" ; grant: GrantRef ; file: FileRef }>
A file read through a grant to its recipient.
FileLocator
Ƭ FileLocator:AttachmentLocator | GrantLocator
Which file to read, and the relationship that authorizes the read.
FileGrant
Ƭ FileGrant:GrantLocator
A grant ctx.files.grant issued: itself the locator its recipient reads
the file with.
FileFieldPath
Ƭ FileFieldPath<T, Depth>: 0 extends 1 & T ? string : Depth["length"] extends 8 ? never : NonNullable<T> extends FileRef ? never : NonNullable<T> extends string | number | boolean | bigint | ArrayBuffer ? never : NonNullable<T> extends readonly infer Element[] ? NonNullable<Element> extends FileRef ? `\{number}\` : \`{number}/\{FileFieldPath\<Element, [...Depth, unknown]\>}\` : `NonNullable`\<`T`\> extends `object` ? \{ [Key in keyof NonNullable\<T\> & string]: NonNullable\<NonNullable\<T\>[Key]\> extends FileRef ? FilePointerSegment\<Key\> : \`{FilePointerSegment<Key>}/${FileFieldPath<NonNullable<T>[Key], […Depth, unknown]>}` }[keyof NonNullable<T> & string] : never
A record’s file field paths, inferred from its value type: source,
files/${number}/file.
Type parameters
Functions
attachment
▸ attachment<Document>(document, field): AttachmentLocator
Locate the file a record’s field attaches, read from the record itself:
attachment(document, "source"). The record must hold a file there.
Type parameters
Parameters
Returns
AttachmentLocator
▸ attachment(record, field, file): AttachmentLocator
Locate a file by its record, field path and expected file, such as a
series occurrence’s file property:
attachment({ series: seriesOccurrence("footage", event) }, "values/file", file).
Parameters
Returns
AttachmentLocator
seriesOccurrence
▸ seriesOccurrence(table, event): SeriesOccurrence
A series occurrence as an attachment’s record, from the event just read.
Parameters
Returns
SeriesOccurrence