@axiom-lattice/pg-stores 3.1.4 → 3.1.6
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 +17 -0
- package/dist/index.js +35 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/PostgreSQLAgentWebAppStore.migrations.test.ts +2 -1
- package/src/__tests__/PostgreSQLAgentWebAppStore.test.ts +1 -0
- package/src/createPgStoreConfig.ts +2 -0
- package/src/migrations/add_agent_web_apps_identity_migration.ts +18 -0
- package/src/stores/PostgreSQLAgentWebAppStore.ts +25 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/pg-stores@3.1.
|
|
2
|
+
> @axiom-lattice/pg-stores@3.1.6 build /home/runner/work/agentic/agentic/packages/pg-stores
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m381.59 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m695.53 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 750ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m373.64 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m695.16 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 803ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 18546ms
|
|
19
19
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m78.61 KB[39m
|
|
20
20
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m78.61 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 3.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [0ba5903]
|
|
8
|
+
- Updated dependencies [a787438]
|
|
9
|
+
- @axiom-lattice/core@4.2.6
|
|
10
|
+
- @axiom-lattice/protocols@4.1.4
|
|
11
|
+
|
|
12
|
+
## 3.1.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [619c1d7]
|
|
17
|
+
- @axiom-lattice/core@4.2.5
|
|
18
|
+
- @axiom-lattice/protocols@4.1.3
|
|
19
|
+
|
|
3
20
|
## 3.1.4
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -6436,6 +6436,22 @@ var createAgentWebAppsTable = {
|
|
|
6436
6436
|
}
|
|
6437
6437
|
};
|
|
6438
6438
|
|
|
6439
|
+
// src/migrations/add_agent_web_apps_identity_migration.ts
|
|
6440
|
+
var addAgentWebAppsIdentity = {
|
|
6441
|
+
version: 176,
|
|
6442
|
+
name: "add_agent_web_apps_identity",
|
|
6443
|
+
up: async (client) => {
|
|
6444
|
+
await client.query(
|
|
6445
|
+
"ALTER TABLE lattice_agent_web_apps ADD COLUMN IF NOT EXISTS identity JSONB"
|
|
6446
|
+
);
|
|
6447
|
+
},
|
|
6448
|
+
down: async (client) => {
|
|
6449
|
+
await client.query(
|
|
6450
|
+
"ALTER TABLE lattice_agent_web_apps DROP COLUMN IF EXISTS identity"
|
|
6451
|
+
);
|
|
6452
|
+
}
|
|
6453
|
+
};
|
|
6454
|
+
|
|
6439
6455
|
// src/stores/PostgreSQLAgentWebAppStore.ts
|
|
6440
6456
|
function isRecord(value) {
|
|
6441
6457
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -6450,16 +6466,23 @@ function isScope(value) {
|
|
|
6450
6466
|
return isRecord(value) && typeof value.defaultProjectId === "string" && isStringArray(value.allowedProjectIds) && (value.defaultModelKey === void 0 || typeof value.defaultModelKey === "string") && (value.allowedModelKeys === void 0 || isStringArray(value.allowedModelKeys));
|
|
6451
6467
|
}
|
|
6452
6468
|
function isFeatures(value) {
|
|
6453
|
-
return isRecord(value) && typeof value.projectSelector === "boolean" && typeof value.modelSelector === "boolean" && typeof value.threadManagement === "boolean" && typeof value.attachments === "boolean" && typeof value.hitl === "boolean" && typeof value.genUI === "boolean";
|
|
6469
|
+
return isRecord(value) && typeof value.projectSelector === "boolean" && typeof value.modelSelector === "boolean" && typeof value.threadManagement === "boolean" && typeof value.attachments === "boolean" && typeof value.hitl === "boolean" && typeof value.genUI === "boolean" && (value.files === void 0 || typeof value.files === "boolean");
|
|
6454
6470
|
}
|
|
6455
6471
|
function isAppearance(value) {
|
|
6456
6472
|
return isRecord(value) && (value.title === void 0 || typeof value.title === "string") && (value.welcomeMessage === void 0 || typeof value.welcomeMessage === "string") && (value.primaryColor === void 0 || typeof value.primaryColor === "string");
|
|
6457
6473
|
}
|
|
6474
|
+
function isIdentity(value) {
|
|
6475
|
+
if (value === null || value === void 0) return true;
|
|
6476
|
+
if (!isRecord(value)) return false;
|
|
6477
|
+
const policyOk = value.policy === "unverified" || value.policy === "verified" || value.policy === "both";
|
|
6478
|
+
const issuersOk = Array.isArray(value.issuers) && value.issuers.every((issuer) => isRecord(issuer) && typeof issuer.iss === "string" && typeof issuer.aud === "string" && (issuer.alg === "HS256" || issuer.alg === "RS256"));
|
|
6479
|
+
return policyOk && issuersOk;
|
|
6480
|
+
}
|
|
6458
6481
|
function isStatus(value) {
|
|
6459
6482
|
return value === "draft" || value === "active" || value === "disabled";
|
|
6460
6483
|
}
|
|
6461
6484
|
function mapRow(row) {
|
|
6462
|
-
if (!isStatus(row.status) || !isIntegration(row.integration) || !isScope(row.scope) || !isFeatures(row.features) || !isAppearance(row.appearance)) {
|
|
6485
|
+
if (!isStatus(row.status) || !isIntegration(row.integration) || !isScope(row.scope) || !isFeatures(row.features) || !isAppearance(row.appearance) || !isIdentity(row.identity)) {
|
|
6463
6486
|
throw new Error(`Invalid agent web app row: ${row.id}`);
|
|
6464
6487
|
}
|
|
6465
6488
|
return {
|
|
@@ -6473,6 +6496,7 @@ function mapRow(row) {
|
|
|
6473
6496
|
scope: row.scope,
|
|
6474
6497
|
features: row.features,
|
|
6475
6498
|
appearance: row.appearance,
|
|
6499
|
+
identity: row.identity === null ? void 0 : row.identity,
|
|
6476
6500
|
createdAt: row.created_at,
|
|
6477
6501
|
updatedAt: row.updated_at
|
|
6478
6502
|
};
|
|
@@ -6493,6 +6517,7 @@ var PostgreSQLAgentWebAppStore = class {
|
|
|
6493
6517
|
})();
|
|
6494
6518
|
this.migrationManager = new MigrationManager(this.pool);
|
|
6495
6519
|
this.migrationManager.register(createAgentWebAppsTable);
|
|
6520
|
+
this.migrationManager.register(addAgentWebAppsIdentity);
|
|
6496
6521
|
if (options.autoMigrate !== false) {
|
|
6497
6522
|
this.startInitialization();
|
|
6498
6523
|
}
|
|
@@ -6553,8 +6578,8 @@ var PostgreSQLAgentWebAppStore = class {
|
|
|
6553
6578
|
const id = `webapp_${(0, import_crypto3.randomUUID)().replace(/-/g, "")}`;
|
|
6554
6579
|
const result = await this.pool.query(
|
|
6555
6580
|
`INSERT INTO lattice_agent_web_apps
|
|
6556
|
-
(id, tenant_id, assistant_id, name, description, status, integration, scope, features, appearance)
|
|
6557
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb, $8::jsonb, $9::jsonb, $10::jsonb)
|
|
6581
|
+
(id, tenant_id, assistant_id, name, description, status, integration, scope, features, appearance, identity)
|
|
6582
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb, $8::jsonb, $9::jsonb, $10::jsonb, $11::jsonb)
|
|
6558
6583
|
RETURNING *`,
|
|
6559
6584
|
[
|
|
6560
6585
|
id,
|
|
@@ -6566,7 +6591,8 @@ var PostgreSQLAgentWebAppStore = class {
|
|
|
6566
6591
|
JSON.stringify(input.integration),
|
|
6567
6592
|
JSON.stringify(input.scope),
|
|
6568
6593
|
JSON.stringify(input.features),
|
|
6569
|
-
JSON.stringify(input.appearance)
|
|
6594
|
+
JSON.stringify(input.appearance),
|
|
6595
|
+
input.identity ? JSON.stringify(input.identity) : null
|
|
6570
6596
|
]
|
|
6571
6597
|
);
|
|
6572
6598
|
return mapRow(result.rows[0]);
|
|
@@ -6592,6 +6618,9 @@ var PostgreSQLAgentWebAppStore = class {
|
|
|
6592
6618
|
if (patch.appearance !== void 0) {
|
|
6593
6619
|
add("appearance", JSON.stringify(patch.appearance));
|
|
6594
6620
|
}
|
|
6621
|
+
if (patch.identity !== void 0) {
|
|
6622
|
+
add("identity", JSON.stringify(patch.identity));
|
|
6623
|
+
}
|
|
6595
6624
|
if (patch.status !== void 0) add("status", patch.status);
|
|
6596
6625
|
if (assignments.length === 0) return this.getById(tenantId, webAppId);
|
|
6597
6626
|
values.push(tenantId, webAppId);
|
|
@@ -10538,6 +10567,7 @@ async function createPgStoreConfig(connectionString) {
|
|
|
10538
10567
|
mm.register(createProjectRoomTables);
|
|
10539
10568
|
mm.register(addTrustedRunContextColumn);
|
|
10540
10569
|
mm.register(addProjectLifecycleEventIndex);
|
|
10570
|
+
mm.register(addAgentWebAppsIdentity);
|
|
10541
10571
|
await mm.migrate();
|
|
10542
10572
|
const checkpoint = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(connectionString);
|
|
10543
10573
|
checkpoint.setup().catch((err) => {
|