@axiom-lattice/pg-stores 3.1.13 → 3.1.14
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +10 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/PostgreSQLAgentWebAppStore.test.ts +18 -0
- package/src/stores/PostgreSQLAgentWebAppStore.ts +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiom-lattice/pg-stores",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.14",
|
|
4
4
|
"description": "PG stores implementation for Axiom Lattice framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@langchain/core": "1.1.30",
|
|
26
26
|
"pg": "^8.16.3",
|
|
27
27
|
"uuid": "^9.0.1",
|
|
28
|
-
"@axiom-lattice/core": "4.2.
|
|
29
|
-
"@axiom-lattice/protocols": "4.
|
|
28
|
+
"@axiom-lattice/core": "4.2.14",
|
|
29
|
+
"@axiom-lattice/protocols": "4.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/jest": "^29.5.14",
|
|
@@ -288,4 +288,22 @@ describe("PostgreSQLAgentWebAppStore", () => {
|
|
|
288
288
|
"Invalid agent web app row",
|
|
289
289
|
);
|
|
290
290
|
});
|
|
291
|
+
|
|
292
|
+
it("round-trips appearance quickPrompts and rejects malformed entries", async () => {
|
|
293
|
+
const appearance = {
|
|
294
|
+
quickPrompts: [
|
|
295
|
+
{ label: "Pricing", text: "How much does it cost?" },
|
|
296
|
+
{ label: "Support", text: "How do I contact support?" },
|
|
297
|
+
],
|
|
298
|
+
};
|
|
299
|
+
const store = new PostgreSQLAgentWebAppStore({ pool });
|
|
300
|
+
|
|
301
|
+
mockQuery.mockResolvedValueOnce({ rows: [{ ...row, appearance }] });
|
|
302
|
+
await expect(store.getById("tenant-1", "webapp_123")).resolves.toMatchObject({ appearance });
|
|
303
|
+
|
|
304
|
+
mockQuery.mockResolvedValueOnce({ rows: [{ ...row, appearance: { quickPrompts: [{ label: "missing text" }] } }] });
|
|
305
|
+
await expect(store.getById("tenant-1", "webapp_123")).rejects.toThrow(
|
|
306
|
+
"Invalid agent web app row",
|
|
307
|
+
);
|
|
308
|
+
});
|
|
291
309
|
});
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
AgentWebApp,
|
|
4
4
|
AgentWebAppAppearance,
|
|
5
5
|
AgentWebAppFeatures,
|
|
6
|
+
AgentWebAppQuickPrompt,
|
|
6
7
|
AgentWebAppScope,
|
|
7
8
|
AgentWebAppStatus,
|
|
8
9
|
AgentWebAppStore,
|
|
@@ -70,11 +71,19 @@ function isFeatures(value: unknown): value is AgentWebAppFeatures {
|
|
|
70
71
|
&& (value.files === undefined || typeof value.files === "boolean");
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
function isQuickPrompt(value: unknown): value is AgentWebAppQuickPrompt {
|
|
75
|
+
return isRecord(value)
|
|
76
|
+
&& typeof value.label === "string"
|
|
77
|
+
&& typeof value.text === "string";
|
|
78
|
+
}
|
|
79
|
+
|
|
73
80
|
function isAppearance(value: unknown): value is AgentWebAppAppearance {
|
|
74
81
|
return isRecord(value)
|
|
75
82
|
&& (value.title === undefined || typeof value.title === "string")
|
|
76
83
|
&& (value.welcomeMessage === undefined || typeof value.welcomeMessage === "string")
|
|
77
|
-
&& (value.primaryColor === undefined || typeof value.primaryColor === "string")
|
|
84
|
+
&& (value.primaryColor === undefined || typeof value.primaryColor === "string")
|
|
85
|
+
&& (value.quickPrompts === undefined
|
|
86
|
+
|| (Array.isArray(value.quickPrompts) && value.quickPrompts.every(isQuickPrompt)));
|
|
78
87
|
}
|
|
79
88
|
|
|
80
89
|
function isIdentity(value: unknown): boolean {
|