|
|
@@ -371,7 +371,7 @@ export default async function (ctx) {
|
|
|
|
|
|
**A code push can never widen access.** `policy` is server state: a `policy` field sent with a `POST`/`PUT` body is ignored (not merged, not consulted as a fallback), and `enabled` is likewise preserved, so re-pushing code does not re-enable a function an operator turned off. A first registration inherits the project's default policy, which currently grants **no collection at all** - the function runs, logs and can call out, but reaches no data until an admin grants it a rule.
|
|
|
|
|
|
-- `GET /api/v1/projects/{project}/functions` - List functions **without their sources**: `{functions:[{function_id, path, content_hash, descriptor, policy, enabled, valid, last_error, created_at, updated_at}], runners:{configured, healthy}, runs_kept}`. The `runners` counts let a client warn that a write will fail with **503** *before* an author writes a script, rather than only after the push: `configured: 0` is the common first state, because installing the runner package does not switch functions on - the server needs a `functions.runners` list. `runs_kept` is this server's configured run-log retention, so a client need not guess the default.
|
|
|
+- `GET /api/v1/projects/{project}/functions` - List functions **without their sources**: `{functions:[{function_id, path, content_hash, descriptor, policy, enabled, valid, last_error, created_at, updated_at}], runners:{configured, healthy}, runs_kept}`. The `runners` counts let a client warn that a write will fail with **503** *before* an author writes a script, rather than only after the push: `configured: 0` is the common first state, because installing the runner package does not switch functions on - the server needs a `functions.runners` list. `runs_kept` is this SERVER's configured run-log retention (`functions.runs_kept`), so a client need not guess the default - but read it as covering `http` and `invoke` runs ONLY. Cron and job runs are appended and trimmed by the RUNNER, under its own `function_runs_kept` in runner.json, which this field cannot see and which ships with a DIFFERENT default (50 against the server's 500) - so on a host that has not set both, this number overstates a cron function's retention tenfold. Retention is a boot config on each binary: it is not settable per function or per project, and no request can change it.
|
|
|
- `POST /api/v1/projects/{project}/functions` `{source, path?}` - Register a new function; the id comes from the validated `on` block, so there is no `function_id` field to send. An id already in use is **409** `function_exists` (PUT it to update).
|
|
|
- `GET /api/v1/projects/{project}/functions/{id}` - Get one function, **including** `source`.
|
|
|
- `PUT /api/v1/projects/{project}/functions/{id}` `{source, path?}` - Push code. The id the script declares must equal the id in the URL; a mismatch is **422** `id_mismatch` (with `error.details.declared` and `error.details.url`) rather than a rename, because the URL would otherwise move code onto another function's policy. A PUT to an unused id registers it (**201**).
|