@terreno/api 58.0.3 → 58.0.5

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.
package/CHANGELOG.md CHANGED
@@ -20,6 +20,19 @@ Upgrade notes for consumer action live in [`mcp-server/src/docs/upgrades/`](mcp-
20
20
 
21
21
  Unreleased changes live in [`changelog/unreleased/`](changelog/unreleased/). Add one Markdown file per feature (see that directory's README) instead of editing this section.
22
22
 
23
+ ## [58.0.5] - 2026-11-14
24
+
25
+ ### Fixed
26
+
27
+ - GPT chat no longer shows an image twice for Gemini image models such as `gemini-3-pro-image`. The draft images Gemini returns while it reasons (`thought: true`) are no longer streamed or saved; the last draft is kept only when there is no final image.
28
+ - `@terreno/ai` works with Gemini and Vertex again on `ai` 6. 58.0.0 moved the Google providers to the `ai` 7 line (`@ai-sdk/google-vertex` 5, `@ai-sdk/provider` 4, `@ai-sdk/mcp` 2), whose models `ai` 6 rejects with `Unsupported model version v4`. The `@ai-sdk/google-vertex` peer is back to `^4.0.199`, the `@ai-sdk/provider` peer is removed, and `@ai-sdk/mcp` is back to `^1.0.104`. Apps should install `@ai-sdk/google-vertex` 4.x and `@ai-sdk/google` 3.x.
29
+
30
+ ## [58.0.4] - 2026-11-11
31
+
32
+ ### Fixed
33
+
34
+ - The admin consent form list loads again. `ConsentFormList` sorts by `-created` (and by its Title, Type, Version, Active, and Order columns), but `ConsentApp`'s `/consent-forms` router did not declare those as `sortFields`, so every list request returned 400 `sort-field-not-allowed`. Both `/consent-forms` and `/consent-responses` now allow sorting by the fields their admin metadata marks sortable; other fields are still rejected.
35
+
23
36
  ## [58.0.3] - 2026-11-11
24
37
 
25
38
  Upgrade note: [`mcp-server/src/docs/upgrades/58.0.3.md`](mcp-server/src/docs/upgrades/58.0.3.md).
@@ -91,6 +91,14 @@ const buildConsentOpenApi = (openApi) => {
91
91
  .build(),
92
92
  };
93
93
  };
94
+ /**
95
+ * Fields the consent form admin list sorts by: `ConsentFormList` defaults to `-created` and sorts
96
+ * by each data column. The router needs them as `sortFields` because list sorts are limited to
97
+ * declared fields; without them the admin list loads with a 400.
98
+ */
99
+ const CONSENT_FORM_SORT_FIELDS = ["title", "type", "version", "active", "order", "created"];
100
+ /** Fields the consent response admin metadata marks sortable, allowed on the response list too. */
101
+ const CONSENT_RESPONSE_SORT_FIELDS = ["agreed", "provisional", "locale", "agreedAt", "created"];
94
102
  const PROVISIONAL_NOTE_MAX_LENGTH = 2000;
95
103
  const provisionalSignBody = zodOpenApi_1.z
96
104
  .object({
@@ -284,7 +292,7 @@ class ConsentApp {
284
292
  listDisplay: ["title", "type", "version", "active", "order"],
285
293
  listFields: ["title", "type", "version", "active", "order"],
286
294
  searchFields: ["title", "slug"],
287
- sortableFields: ["title", "type", "version", "active", "order", "created"],
295
+ sortableFields: CONSENT_FORM_SORT_FIELDS,
288
296
  },
289
297
  model: consentForm_1.ConsentForm,
290
298
  routePath: "/consent-forms",
@@ -306,7 +314,7 @@ class ConsentApp {
306
314
  group: "Compliance",
307
315
  listFields: ["userId", "agreed", "provisional", "locale", "agreedAt"],
308
316
  searchFields: ["locale"],
309
- sortableFields: ["agreed", "provisional", "locale", "agreedAt", "created"],
317
+ sortableFields: CONSENT_RESPONSE_SORT_FIELDS,
310
318
  },
311
319
  model: consentResponse_1.ConsentResponse,
312
320
  populatePaths: exports.consentResponsePopulatePaths,
@@ -425,6 +433,7 @@ class ConsentApp {
425
433
  },
426
434
  queryFields: ["slug", "type", "active", "version"],
427
435
  sort: "order",
436
+ sortFields: CONSENT_FORM_SORT_FIELDS,
428
437
  }));
429
438
  // Admin read-only access to consent responses, plus provisional signing actions
430
439
  app.use("/consent-responses", (0, api_1.modelRouter)(consentResponse_1.ConsentResponse, {
@@ -591,6 +600,7 @@ class ConsentApp {
591
600
  update: [],
592
601
  },
593
602
  populatePaths: exports.consentResponsePopulatePaths,
603
+ sortFields: CONSENT_RESPONSE_SORT_FIELDS,
594
604
  }));
595
605
  // User-facing consent endpoints
596
606
  const router = (0, express_1.Router)();
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@modelcontextprotocol/node": "^2.1.2",
14
14
  "@modelcontextprotocol/server": "^2.0.0",
15
15
  "@sentry/bun": "^11.0.0",
16
- "@terreno/test": "58.0.3",
16
+ "@terreno/test": "58.0.5",
17
17
  "@thream/socketio-jwt": "^3.1.4",
18
18
  "@types/qs": "^6.14.0",
19
19
  "ajv": "8.20.0",
@@ -51,7 +51,7 @@
51
51
  "devDependencies": {
52
52
  "@biomejs/biome": "2.5.13",
53
53
  "@modelcontextprotocol/client": "^2.0.0",
54
- "@terreno/syncdb": "58.0.3",
54
+ "@terreno/syncdb": "58.0.5",
55
55
  "@types/bun": "^1.4.0",
56
56
  "@types/cors": "^2.8.17",
57
57
  "@types/express": "^5.0.6",
@@ -152,5 +152,5 @@
152
152
  "updateSnapshot": "bun test --update-snapshots"
153
153
  },
154
154
  "types": "dist/index.d.ts",
155
- "version": "58.0.3"
155
+ "version": "58.0.5"
156
156
  }
@@ -107,6 +107,30 @@ describe("ConsentApp", () => {
107
107
  await userAgent.get("/consent-forms").expect(405);
108
108
  });
109
109
 
110
+ it("accepts every sort the admin consent form list sends", async () => {
111
+ await ConsentForm.create({
112
+ active: true,
113
+ content: new Map([["en", "# Terms"]]),
114
+ order: 1,
115
+ slug: "terms-sort",
116
+ title: "Terms",
117
+ type: "terms",
118
+ version: 1,
119
+ });
120
+
121
+ // ConsentFormList defaults to -created and sorts by each data column.
122
+ for (const sort of ["-created", "title", "-type", "version", "-active", "order"]) {
123
+ const res = await adminAgent.get(`/consent-forms?limit=20&page=1&sort=${sort}`);
124
+ expect({sort, status: res.status}).toEqual({sort, status: 200});
125
+ expect(res.body.data).toHaveLength(1);
126
+ }
127
+ });
128
+
129
+ it("still rejects sorting consent forms by fields that are not sortable", async () => {
130
+ const res = await adminAgent.get("/consent-forms?sort=content").expect(400);
131
+ expect(res.body.code).toBe("sort-field-not-allowed");
132
+ });
133
+
110
134
  it("creates a consent form as admin", async () => {
111
135
  const res = await adminAgent
112
136
  .post("/consent-forms")
@@ -230,6 +254,18 @@ describe("ConsentApp", () => {
230
254
  expect(res.body.data[0].agreed).toBe(true);
231
255
  });
232
256
 
257
+ it("accepts sorting responses by the fields the admin metadata marks sortable", async () => {
258
+ for (const sort of ["-created", "-agreedAt", "agreed", "provisional", "locale"]) {
259
+ const res = await adminAgent.get(`/consent-responses?limit=20&page=1&sort=${sort}`);
260
+ expect({sort, status: res.status}).toEqual({sort, status: 200});
261
+ }
262
+ });
263
+
264
+ it("still rejects sorting responses by fields that are not sortable", async () => {
265
+ const res = await adminAgent.get("/consent-responses?sort=signature").expect(400);
266
+ expect(res.body.code).toBe("sort-field-not-allowed");
267
+ });
268
+
233
269
  it("populates consentFormId and userId on read", async () => {
234
270
  const form = await ConsentForm.create({
235
271
  active: true,
package/src/consentApp.ts CHANGED
@@ -114,6 +114,16 @@ const buildConsentOpenApi = (
114
114
  };
115
115
  };
116
116
 
117
+ /**
118
+ * Fields the consent form admin list sorts by: `ConsentFormList` defaults to `-created` and sorts
119
+ * by each data column. The router needs them as `sortFields` because list sorts are limited to
120
+ * declared fields; without them the admin list loads with a 400.
121
+ */
122
+ const CONSENT_FORM_SORT_FIELDS = ["title", "type", "version", "active", "order", "created"];
123
+
124
+ /** Fields the consent response admin metadata marks sortable, allowed on the response list too. */
125
+ const CONSENT_RESPONSE_SORT_FIELDS = ["agreed", "provisional", "locale", "agreedAt", "created"];
126
+
117
127
  const PROVISIONAL_NOTE_MAX_LENGTH = 2000;
118
128
 
119
129
  const provisionalSignBody = z
@@ -384,7 +394,7 @@ export class ConsentApp implements TerrenoPlugin {
384
394
  listDisplay: ["title", "type", "version", "active", "order"],
385
395
  listFields: ["title", "type", "version", "active", "order"],
386
396
  searchFields: ["title", "slug"],
387
- sortableFields: ["title", "type", "version", "active", "order", "created"],
397
+ sortableFields: CONSENT_FORM_SORT_FIELDS,
388
398
  },
389
399
  model: ConsentForm as unknown as import("mongoose").Model<unknown>,
390
400
  routePath: "/consent-forms",
@@ -406,7 +416,7 @@ export class ConsentApp implements TerrenoPlugin {
406
416
  group: "Compliance",
407
417
  listFields: ["userId", "agreed", "provisional", "locale", "agreedAt"],
408
418
  searchFields: ["locale"],
409
- sortableFields: ["agreed", "provisional", "locale", "agreedAt", "created"],
419
+ sortableFields: CONSENT_RESPONSE_SORT_FIELDS,
410
420
  },
411
421
  model: ConsentResponse as unknown as import("mongoose").Model<unknown>,
412
422
  populatePaths: consentResponsePopulatePaths,
@@ -547,6 +557,7 @@ export class ConsentApp implements TerrenoPlugin {
547
557
  },
548
558
  queryFields: ["slug", "type", "active", "version"],
549
559
  sort: "order",
560
+ sortFields: CONSENT_FORM_SORT_FIELDS,
550
561
  })
551
562
  );
552
563
 
@@ -735,6 +746,7 @@ export class ConsentApp implements TerrenoPlugin {
735
746
  update: [],
736
747
  },
737
748
  populatePaths: consentResponsePopulatePaths,
749
+ sortFields: CONSENT_RESPONSE_SORT_FIELDS,
738
750
  })
739
751
  );
740
752