Bring in pipeline, auth, deploy and docs from the boilerplate
roledesk is built on the boilerplate from here on: pipeline 2.0 (queue and scheduler), auth (one password, sessions, passkeys), the deploy kit and its docs, plus the coupling and packaging tests. Downstream copies, unedited. Refreshed from boilerplate/d56949f7d0f6c0bfe5745478e09007bfad67ae87 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1f436104f3
commit
9d666d0937
76 files changed
+15235
No files matched your search
@@ -0,0 +1,75 @@
|
||||
"""What the queue's endpoints accept and promise back.
|
||||
|
||||
Job-shaped, so they live with the router that serves them rather than in an
|
||||
app's schema module. The `Job`, `JobsSnapshot` and `Schedule` they sit
|
||||
alongside are in `pipeline/models.py`; these are only ever request bodies, or a
|
||||
stored shape with one derived field added for the client.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from pipeline.models import Schedule
|
||||
|
||||
|
||||
class EnqueueBody(BaseModel):
|
||||
"""Start a job. `payload` is spread over the handler's keyword arguments,
|
||||
so what a kind accepts is the signature of its function and nothing else
|
||||
has to restate it."""
|
||||
|
||||
kind: str
|
||||
payload: dict[str, Any] = {}
|
||||
|
||||
|
||||
class JobKind(BaseModel):
|
||||
"""One entry from the job registry, for a UI that wants to offer them."""
|
||||
|
||||
kind: str
|
||||
label: str
|
||||
solo: bool
|
||||
|
||||
|
||||
class NewSchedule(BaseModel):
|
||||
"""Add a schedule. `name` is optional because the kind is usually answer
|
||||
enough — one `tick` schedule wants no name of its own, and the second is
|
||||
named by counting rather than by making somebody think of one."""
|
||||
|
||||
kind: str
|
||||
cadence: str
|
||||
name: str = ""
|
||||
label: str = ""
|
||||
payload: dict[str, Any] = {}
|
||||
enabled: bool = True
|
||||
|
||||
|
||||
class ScheduleEdit(BaseModel):
|
||||
"""Change part of a schedule. Every field optional, and read with
|
||||
`exclude_unset`, so sending `{"enabled": false}` switches one off without
|
||||
also resubmitting a cadence somebody edited in another tab a second ago.
|
||||
|
||||
`name` is not here: it is the handle a declared default is matched on, and
|
||||
renaming a row would hand its edits to a fresh one inserted under the old
|
||||
name on the next start.
|
||||
"""
|
||||
|
||||
kind: str | None = None
|
||||
label: str | None = None
|
||||
cadence: str | None = None
|
||||
payload: dict[str, Any] | None = None
|
||||
enabled: bool | None = None
|
||||
|
||||
|
||||
class ScheduleRow(Schedule):
|
||||
"""A schedule as it is served: the row, plus whether anything still runs it.
|
||||
|
||||
`unknown` is not stored, because it is a fact about the code that is loaded
|
||||
rather than about the row — a handler removed in a deploy makes it true
|
||||
without the table changing, and reinstalling the plugin makes it false
|
||||
again. The element greys such a row and says `unknown kind`; the queue
|
||||
never fires one.
|
||||
"""
|
||||
|
||||
unknown: bool = False
|
||||
Reference in new issue
Block a user