Changes and resolves the slugs of dumps and playlists. A slug changes only when someone edits it (the dump and playlist services call changeSlug with the slug their edit form sent), and the slug it leaves becomes an alias of the item, so that old links still reach it; the routes that read an item by its page path resolve the slug with resolveSlug, aliases included, and answer the item, whose current slug the client then puts in its URL.
Gives item the slug slug, keeping its current one as an alias. An alias
always names the item itself, so redirects never chain; taking back one of
the item's own aliases swaps it with the current slug. Unless exempt (a
moderator), an item's slug changes at most RENAME_LIMITS.SLUG.count times
in its window, counted from its aliases. A slug equal to the current one
changes nothing.
Returns a free slug for a new item of userId's titled title, for the
dump and playlist services to insert it with, inside their transaction.
Returns the id of userId's item of kind whose slug is or was slug, or
undefined when none is.
Usage
import * as mod from "api/services/slug-service.ts";