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,59 @@
|
||||
"""The parts of a web app that are the pipeline's, not the application's.
|
||||
|
||||
from pipeline.web import connect
|
||||
queue = connect(app, Jobs("app.db"), config, store)
|
||||
|
||||
An app of this shape has a queue, and therefore has the same endpoints and the
|
||||
same socket over it: list, kinds, enqueue, cancel, and `/ws/jobs`. None of that
|
||||
knows what the work is *for*, so it is here rather than copied into each app —
|
||||
and a socket's reconnect and fan-out behaviour is exactly the sort of thing a
|
||||
second copy gets subtly wrong.
|
||||
|
||||
app.py `connect`: all of the below wired into a FastAPI app, and
|
||||
the worker started and stopped with it, in one call
|
||||
broadcaster.py one message out to every connected socket
|
||||
jobs.py the queue over HTTP, the socket that reports on it, and
|
||||
the one route that serves the element below
|
||||
schedules.py schedules over HTTP: list, add, edit, delete, run now,
|
||||
with the readable refusals a thing that runs while nobody
|
||||
is watching has to have
|
||||
deps.py how those routes reach the queue and the bus
|
||||
schemas.py the request bodies they take
|
||||
static/jobs.js `<desk-jobs>`: the queue on screen. Two lines in a
|
||||
template and a new app has a job list with progress and a
|
||||
Kill button, before it has written any UI of its own
|
||||
static/schedules.js
|
||||
`<desk-schedules>`: the same two lines for the schedule
|
||||
table, themed from the same custom properties
|
||||
|
||||
<script type="module" src="/_jobs/jobs.js"></script>
|
||||
<desk-jobs></desk-jobs>
|
||||
|
||||
The element is the one thing here with an opinion about how something looks,
|
||||
and it is deliberate: this is the part nobody wants to write twice. It keeps
|
||||
to a shadow root and themes from custom properties, so an app overrides it
|
||||
without forking it, and it says nothing about *failures* — it raises an event
|
||||
and leaves the wording to the app, which is the same split `notices.py` makes
|
||||
on the server. newsdesk does not use it: it had a richer strip of its own
|
||||
before this existed, which is what an app is expected to grow into.
|
||||
|
||||
What an app still owns: its own factory, its own store and config
|
||||
dependencies, its own routers, its own page.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pipeline.web.app import connect
|
||||
from pipeline.web.broadcaster import Broadcaster
|
||||
from pipeline.web.deps import BroadcasterDep, QueueDep, get_broadcaster, get_queue
|
||||
from pipeline.web.jobs import STATIC, router as jobs_router
|
||||
from pipeline.web.schedules import router as schedules_router, served
|
||||
from pipeline.web.schemas import (
|
||||
EnqueueBody, JobKind, NewSchedule, ScheduleEdit, ScheduleRow,
|
||||
)
|
||||
|
||||
__all__ = ["STATIC", "Broadcaster", "BroadcasterDep", "EnqueueBody",
|
||||
"JobKind", "NewSchedule", "QueueDep", "ScheduleEdit", "ScheduleRow",
|
||||
"connect", "get_broadcaster", "get_queue", "jobs_router",
|
||||
"schedules_router", "served",
|
||||
]
|
||||
Reference in new issue
Block a user