DVContentWorkflow<T> class

The workflow for one kind of stored document.

Constructors

DVContentWorkflow({required String kind, required Map<String, Object?> encode(T document), required T decode(Map<String, Object?> json), required String documentId(T document), required String actorId(Object? user), DVDatabaseAdapter? database, DVAuthAuthorization authorization = const DVAuthAuthorization(), Future<Object?> findActor(String actorId)?, List<int>? previewKey, List<String> cacheTags(DVContentVersion<T> version)?, FutureOr<void> revalidateTag(String tag)?, Future<void> notify(String recipient, DVNotificationMessage message)?, FutureOr<void> onPublished(DVContentVersion<T> version)?, FutureOr<void> onWithdrawn(DVContentVersion<T> version)?, String queue = 'default', bool requireApproval = true, Duration missedAfter = const Duration(minutes: 5), DateTime clock()?})

Properties

database → DVDatabaseAdapter
no setter
hashCode → int
The hash code for this object.
no setterinherited
kind → String
The document kind, e.g. page, scene, theme, catalog.
final
missedAfter → Duration
How late a slot may be run before it counts as missed.
final
queue → String
The queue scheduled jobs are dispatched to.
final
reports → List<DVContentReport>
What this workflow reported, oldest first; the last 1000 are kept.
no setter
requireApproval → bool
Whether a publish needs an approval that matches the content. Off only for an application where one person edits their own site.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

approve(DVContentVersion<T> version, {required Object? as}) → Future<DVContentVersion<T>>
Approves version as it was read, pinning the approval to its revision.
cancelSchedule(DVContentVersion<T> version, {required Object? as}) → Future<DVContentVersion<T>>
Cancels version's scheduled publish. A job already dispatched for it finds the schedule gone and does nothing.
confirmTranslations(DVContentVersion<T> version, Set<String> keys, {required Object? as}) → Future<DVContentVersion<T>>
Marks keys as reviewed by a human without changing them.
current(String documentId) → Future<DVContentVersion<T>?>
The published version of documentId, or null.
diff(DVContentVersion<T> version, {DVContentVersion<T>? against}) → Future<Map<String, DVFieldChange>>
The top-level fields version changes relative to against, or to the published version when against is null.
dispatchDue() → Future<List<DVContentScheduledJob>>
Dispatches a job for every schedule whose slot has arrived, and reports every slot missed by more than missedAfter as DV-CONTENT-005 -- including one whose job was dispatched and never ran.
documentTag(String documentId) → String
The tag every response for documentId is cached under.
draft(T document, {required Object? as, Set<String> machineTranslated = const <String>{}}) → Future<DVContentVersion<T>>
Opens a draft of document beside whatever is published.
edit(DVContentVersion<T> version, T document, {required Object? as}) → Future<DVContentVersion<T>>
Sets version's content to document.
ensureSchema() → Future<void>
history(String documentId) → Future<List<DVContentTransition>>
Every state change of every version of documentId, version by version.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
previewToken(DVContentVersion<T> version, {required Object? as, Duration expiresIn = const Duration(hours: 1)}) → Future<String>
A signed link token naming version, valid for expiresIn.
publicVersions() → Future<List<DVContentVersion<T>>>
Every published version of this kind: the set static generation, the sitemap and a bundle may read. Nothing unpublished is ever in it.
publish(DVContentVersion<T> version, {required Object? as}) → Future<DVContentVersion<T>>
Publishes version now, superseding whatever was published.
registerJobs(DVQueues queues) → void
Registers the scheduled-job handler on queues, and the payload codec a database queue needs to persist it.
requestChanges(DVContentVersion<T> version, {required Object? as, String? note}) → Future<DVContentVersion<T>>
Sends version back to draft.
resolve(String documentId, {String? preview}) → Future<DVContentServed<T>?>
What to serve for documentId.
restore(DVContentVersion<T> version, {required Object? as}) → Future<DVContentVersion<T>>
Publishes a superseded version again: a rollback. Its approval is the one it was published with.
runScheduled(DVContentScheduledJob job) → Future<DVContentScheduleOutcome>
Runs one scheduled job. Safe to deliver more than once.
schedule(DVContentVersion<T> version, {required DateTime at, required Object? as}) → Future<DVContentVersion<T>>
Schedules version to be published at at, by a job on DVQueues.
scheduleWithdraw(DVContentVersion<T> version, {required DateTime at, required Object? as}) → Future<DVContentVersion<T>>
Schedules the published version to be withdrawn at at.
submit(DVContentVersion<T> version, {required String to, required Object? as}) → Future<DVContentVersion<T>>
Asks to to review version, freezing it. The request is sent through DV.Notifications after the transition commits.
toString() → String
A string representation of this object.
inherited
version(String id) → Future<DVContentVersion<T>?>
The version with id, as it stands.
versions(String documentId) → Future<List<DVContentVersion<T>>>
Every version of documentId, oldest first.
withdraw(DVContentVersion<T> version, {required Object? as}) → Future<DVContentVersion<T>>
Withdraws version. A published version stops being served; an open one is abandoned, and any schedule on it stops.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

table → const String
Where every kind's versions are stored, told apart by kind.