The Riven Plugin SDK ships a set of MikroORM entities that are also decorated with type-graphqlDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/rivenmedia/riven-ts/llms.txt
Use this file to discover all available pages before exploring further.
@ObjectType / @InterfaceType annotations. These classes represent the canonical data model used across all plugins, resolvers, and event payloads. You can import any of them from @repo/util-plugin-sdk/dto/entities and use them directly in queries, mutations, or event handlers.
Entity classes are shared across plugins via the single MikroORM
EntityManager that Riven manages. Never instantiate entities with new inside a resolver — always use repositories or the EntityManager from the request context.Media Item Hierarchy
MediaItem
The abstract base for all media content. Mapped to themedia_item table with a discriminator column type.
MediaItem fields
MediaItem fields
Primary key. Auto-generated with
randomUUID() on construction.The canonical title of the media item as returned by the indexer.
The full title including subtitle or year suffix, used for display purposes.
IMDB identifier. Must match
/^tt\d+$/. Used as the primary external lookup key for most scrapers.URL or relative path to the poster image.
UTC timestamp when the entity was first persisted. Defaults to
DateTime.utc().toJSDate().UTC timestamp of the last update. Set automatically via
onUpdate hook.UTC timestamp when the item was indexed by an indexer plugin.
UTC timestamp of the most recent successful scrape.
Count of how many times this item has been successfully scraped. Defaults to
0.Number of consecutive scrape failures. Defaults to
0. Reset by .reset().A map of locale codes to alternative title strings, e.g.
{ "de": ["Deutsch Titel"] }.Computed (not persisted). Returns
true when language !== "en" and both "animation" and "anime" appear in genres.Computed (not persisted). Returns
true when releaseDate is in the past.Broadcasting network or streaming platform name.
Country of origin.
Language code.
The theatrical or first-air release date.
null for unreleased items.The release year, used in pretty-name generation.
Array of genre strings as returned by the indexer.
Audience rating on a 0–10 scale.
Current position in the processing state machine. See MediaItemState.
Discriminator column. One of
movie, show, season, or episode.All
Stream candidates associated with this item via a ManyToMany relation.The
Stream currently selected for download. null when no stream is active.All filesystem entries (media files and subtitles) linked to this item.
Subtitle entries linked to this item. Filtered view of
filesystemEntries where type === "subtitle".Streams that have been explicitly blocked from being selected again.
The originating
ItemRequest that triggered this item’s creation.Whether this item is directly requested (as opposed to being an inferred child like an unrequested season).
Movie
ExtendsMediaItem. Discriminator value: "movie".
Movie fields
Movie fields
TMDB identifier. Must be a numeric string. Used as the external ID in VFS pretty-name generation.
Runtime in minutes.
MPAA rating. One of
g, pg, pg-13, r, nc-17, or unknown.Always
"movie"."<Title> (<Year>) {tmdb-<tmdbId>}"e.g.
"The Dark Knight (2008) {tmdb-155}"ShowLikeMediaItem
AbstractInterfaceType that extends MediaItem and adds a tvdbId field shared by shows, seasons, and episodes.
ShowLikeMediaItem fields
ShowLikeMediaItem fields
Show
ExtendsShowLikeMediaItem. Discriminator value: "show".
Show fields
Show fields
Broadcast status. See ShowStatus.
All seasons belonging to this show, including specials (season 0).
Subset of
seasons where isRequested === true.Scheduled air date of the next episode. Used internally for scheduling re-indexing.
TV Parental Guidelines rating inherited from
ShowLikeMediaItem.Always
"show"."<Title> (<Year>) {tvdb-<tvdbId>}"Season
ExtendsShowLikeMediaItem. Discriminator value: "season".
Season fields
Season fields
Season number.
0 denotes a specials season. Minimum: 0.Reference to the parent
Show.All episodes belonging to this season.
Computed (persisted). Returns
true when number === 0.Always
"season"."Season 01" (zero-padded two digits)Episode
ExtendsShowLikeMediaItem. Discriminator value: "episode".
Episode fields
Episode fields
Episode number within its season. Minimum: 0.
Episode number across all seasons of the show. Used for anime ordering.
Reference to the parent
Season.Runtime in minutes.
Per-episode TV Parental Guidelines rating.
Always
"episode"."<Show> (<Year>) {tvdb-<id>} - s01e01"FileSystemEntry
Abstract base for files tracked in Riven’s virtual filesystem. Mapped with a discriminator columntype; concrete subclasses are MediaEntry ("media") and SubtitleEntry ("subtitle").
FileSystemEntry fields
FileSystemEntry fields
Primary key, auto-generated.
File size in bytes. Must be a positive integer (stored as
bigint).UTC creation timestamp.
UTC timestamp of the last update.
The
Movie or Episode this file belongs to. Only leaf items (Movie, Episode) have associated filesystem entries.Discriminator column. Either
"media" or "subtitle".VFS path for this entry, generated before first persist.
e.g.
e.g.
"The Dark Knight (2008) {tmdb-155}/The Dark Knight (2008) {tmdb-155}.mkv"MediaEntry
A concrete filesystem entry representing a downloaded media file. ExtendsFileSystemEntry with discriminator value "media".
MediaEntry fields
MediaEntry fields
The filename as returned by the debrid service.
Direct download URL provided by the debrid service.
A permanent stream URL, if one has been resolved and cached.
The plugin name that created this entry.
The debrid provider name (e.g.
"real-debrid", "all-debrid").The download/torrent ID assigned by the debrid provider. Used to poll status or generate stream links.
Identifiers of library profiles this entry has been linked into.
Arbitrary metadata blob stored as JSON. Plugin-defined.
Always
"media".Stream
Represents a torrent/magnet candidate identified by its SHA-1 info hash.Stream fields
Stream fields
Primary key. A 40-character hexadecimal SHA-1 hash identifying the torrent.
Structured torrent metadata parsed by
@repo/util-rank-torrent-name. Stored as a JSON column.All
MediaItem instances that include this stream as a candidate.MediaItem instances that currently have this stream selected as their activeStream.ItemRequest
Represents a user or content-service request to acquire a piece of media. Owns all theMediaItem records created in response.
ItemRequest fields
ItemRequest fields
Primary key, auto-generated with
randomUUID().IMDB identifier. Unique constraint. Must match
/^tt\d+$/.TMDB identifier. Unique constraint. Numeric string.
TVDB identifier. Unique constraint. Numeric string.
Either
"movie" or "show". See ItemRequestType.Free-form string identifying the requester (e.g. a username or service name).
An opaque ID passed by the requesting service for correlation.
Current lifecycle state. See ItemRequestState.
Specific season numbers requested.
null means all seasons.UTC creation timestamp.
UTC timestamp when all requested media reached
completed state.true when seasons specifies a subset of the show’s total seasons. Always false for movies. Defaults to false until indexer data resolves total season count.All
MediaItem records created for this request.Subset of
mediaItems where type === "season".Subset of
mediaItems where isRequested === true.Enums
MediaItemState
Tracks a media item’s position in the processing pipeline.
| Value | Description |
|---|---|
unknown | State could not be determined |
unreleased | Release date is in the future |
ongoing | Show is currently airing |
indexed | Metadata has been fetched by an indexer plugin |
scraped | Stream candidates have been found by a scraper plugin |
downloaded | Files have been downloaded to the debrid service |
completed | All files are available and stream links are valid |
partially_completed | Some (but not all) episodes/seasons are complete |
failed | Processing has permanently failed |
paused | Processing is temporarily suspended |
ItemRequestState
| Value | Description |
|---|---|
requested | Initial state after creation |
requested_additional_seasons | Additional seasons have been added to an existing show request |
completed | All requested media is complete |
failed | The request could not be fulfilled |
ongoing | Show is still airing; request remains open |
unreleased | All requested media is unreleased |
ItemRequestType
| Value | Description |
|---|---|
movie | A single film |
show | A TV series |
MediaItemType
| Value | Description |
|---|---|
movie | A movie entity |
show | A show entity |
season | A season entity |
episode | An episode entity |
ShowStatus
| Value | Description |
|---|---|
continuing | Show is actively airing new episodes |
upcoming | Show has been announced but not yet aired |
ended | Show has concluded |
unknown | Status could not be determined |
MediaItemContentRating
Umbrella enum covering both MPAA and TV Parental Guidelines ratings. Use the more specific MovieContentRating or ShowContentRating subsets where appropriate.
Movie Ratings (MPAA)
g · pg · pg-13 · r · nc-17 · unknownTV Ratings (TV Parental Guidelines)
tv-y · tv-y7 · tv-g · tv-pg · tv-14 · tv-ma · unknown