@formancy/server 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -604,8 +604,9 @@ const MODEL_BODY_LIMIT_BYTES = 1048576;
604
604
  /**
605
605
  * The builders' requests to the deployment's model (0165).
606
606
  *
607
- * `GET /model` says whether there is one, and which, to somebody who may edit a form: the
608
- * admin draws the prompt pane only when there is. `POST /model/complete` takes
607
+ * `GET /model` says whether there is one, and which, to somebody who may edit a form —
608
+ * `{ provider, model }`, both `null` when there is none (0183) — and the admin draws the
609
+ * prompt pane only when there is. `POST /model/complete` takes
609
610
  * `{ kind, user }` and answers `{ text }` — the model's answer, for the browser to check
610
611
  * — or `{ declined }` when the provider refused, which the admin's `AskModel` hands back as
611
612
  * a decline (0158). Everything else is an error with a sentence for the person.
@@ -613,13 +614,13 @@ const MODEL_BODY_LIMIT_BYTES = 1048576;
613
614
  * One route family per plugin, the seam `app.ts`'s size budget names.
614
615
  */
615
616
  async function modelRoutes(app, { model, requires, audit, limit }) {
616
- app.get("/model", { preHandler: requires("form.publish") }, async (_request, reply) => {
617
- if (model === void 0) return reply.code(404).send({ error: "model_not_configured" });
618
- return reply.send({
619
- provider: model.provider,
620
- model: model.model
621
- });
622
- });
617
+ app.get("/model", { preHandler: requires("form.publish") }, async (_request, reply) => reply.send(model === void 0 ? {
618
+ provider: null,
619
+ model: null
620
+ } : {
621
+ provider: model.provider,
622
+ model: model.model
623
+ }));
623
624
  app.post("/model/complete", {
624
625
  preHandler: requires("form.publish"),
625
626
  bodyLimit: MODEL_BODY_LIMIT_BYTES,
@@ -3107,4 +3108,4 @@ function createCompleter(settings, fetch) {
3107
3108
  //#endregion
3108
3109
  export { SUBMISSION_TOKEN_HEADER as _, createLocalFileStore as a, createPostgresStorage as c, LOG_LEVELS as d, createServerLog as f, SCHEMA_HASH_HEADER as g, maxFileBytesFrom as h, startFileCollector as i, bootstrapSchema as l, workerLog as m, MODEL_PROVIDERS as n, sha256 as o, databaseNotices as p, modelSettings as r, createPostgresRateLimitStore as s, createCompleter as t, createApp as u };
3109
3110
 
3110
- //# sourceMappingURL=completers-DCFoZpo3.mjs.map
3111
+ //# sourceMappingURL=completers-C-E2b7Jm.mjs.map