Skip to content

maintenance

Maintenance: HTTP endpoints for an app's operators, for when they can't reach its database themselves (a client's network that keeps their database user out).

On this page 6
TypeScript
import { maintenance } from "copilotz/plugins/interfaces";

What it keeps

It keeps nothing of its own.

What it lets callers do

Of its 2 Actions, people, agents, contacts and someone signed out may call none.

ActionPersonAgentContactAnyoneKeyMaintenanceWhat it does
maintenance.readnononononoyesOne collection read (find…aggregate) or named query, for the app's operators.
maintenance.writenononononoyesOne collection operation (insertOne…deleteMany), for the app's operators.

An agent works for a person, and calls what both may. A key calls only what its scope names.

It answers 1 route over HTTP:

MethodPath
ANY/maintenance/*

Where it shows

It has no Views: it shows nowhere on its own.

What it needs

You set it in resources.maintenance, and 1 is a secret, kept out of your code.

SettingTypeRequiredWhat it is
maintenance.keystringnoSecret. The secret requests show (Authorization: Bearer <key>): at least 32 random characters, from the app's environment.
maintenance.keysstring[]noMore keys, any of which works: for rotating one (add the new, then remove the old).
maintenance.limitnumbernoThe most rows (or documents) a read answers with (default 1,000).
maintenance.timeoutnumbernoThe longest a SQL statement may run, in ms (default 30,000).
maintenance.bytesnumbernoThe most bytes an answer's rows take (default 8 MB): past it they're cut, and truncated.
maintenance.logfunctionnoWhere a line for each request goes before it runs, so the record of it is also outside the database its holder can write (default: a JSON line on standard output, which hosts like Cloud Run keep).

It also reads org, resource kinds the app and other plugins fill.

What it requires

It builds on no other plugin.

It ships with copilotz@1.0.0-rc.34.

Listing

It keeps every listing rule.