Checks the JSON bodies that routes/dumps.ts takes to post a link and to edit a dump. A file dump arrives as a multipart form instead, and dump-service.ts checks its title and comment.

Functions

f
isCreateUrlDumpRequest(obj: unknown): obj is CreateUrlDumpRequest

Checks whether obj is a CreateUrlDumpRequest whose title and comment fit the VALIDATION limits. It leaves the URL to createUrlDump, which rejects anything but a public http(s) URL.

f
isUpdateDumpRequest(obj: unknown): obj is UpdateDumpRequest

Checks whether obj is an UpdateDumpRequest whose title and comment fit the VALIDATION limits. Unlike on creation, a title that is given must not be blank.

f
parseCategoryIds(value: FormDataEntryValue | null): string[]

Parses a multipart form's categoryIds, a JSON array sent as a string. A missing or malformed value counts as no category. The dumps and files routes read the forms that post and replace a file with it.