@axiom-lattice/pg-stores 3.1.11 → 3.1.13
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 +10 -10
- package/CHANGELOG.md +16 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/PostgreSQLProjectRoomMessageStore.test.ts +25 -0
- package/src/createPgStoreConfig.ts +2 -0
- package/src/migrations/project_room_message_retention_migration.ts +23 -0
- package/src/stores/PostgreSQLProjectRoomMessageStore.ts +25 -0
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.13 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
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m399.36 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m728.38 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 593ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m391.15 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m728.02 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 631ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 11532ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m82.14 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m82.14 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 3.1.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [669fadb]
|
|
8
|
+
- @axiom-lattice/core@4.2.13
|
|
9
|
+
|
|
10
|
+
## 3.1.12
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- b11b823: fix version
|
|
15
|
+
- Updated dependencies [b11b823]
|
|
16
|
+
- @axiom-lattice/core@4.2.12
|
|
17
|
+
- @axiom-lattice/protocols@4.2.3
|
|
18
|
+
|
|
3
19
|
## 3.1.11
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1636,6 +1636,17 @@ declare class PostgreSQLProjectRoomMessageStore implements ProjectRoomMessageSto
|
|
|
1636
1636
|
after: Date;
|
|
1637
1637
|
excludeAuthorUserId?: string;
|
|
1638
1638
|
}): Promise<number>;
|
|
1639
|
+
/**
|
|
1640
|
+
* Deletes one bounded batch of chat messages older than a horizon.
|
|
1641
|
+
*
|
|
1642
|
+
* @param input Exclusive upper time bound and requested batch size (clamped to 1..1000).
|
|
1643
|
+
* @returns The number of deleted rows.
|
|
1644
|
+
* @remarks Only `source IN ('user','agent')` rows are eligible; task/system events are retained.
|
|
1645
|
+
*/
|
|
1646
|
+
deleteChatOlderThan(input: {
|
|
1647
|
+
before: Date;
|
|
1648
|
+
limit: number;
|
|
1649
|
+
}): Promise<number>;
|
|
1639
1650
|
private parameters;
|
|
1640
1651
|
}
|
|
1641
1652
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1636,6 +1636,17 @@ declare class PostgreSQLProjectRoomMessageStore implements ProjectRoomMessageSto
|
|
|
1636
1636
|
after: Date;
|
|
1637
1637
|
excludeAuthorUserId?: string;
|
|
1638
1638
|
}): Promise<number>;
|
|
1639
|
+
/**
|
|
1640
|
+
* Deletes one bounded batch of chat messages older than a horizon.
|
|
1641
|
+
*
|
|
1642
|
+
* @param input Exclusive upper time bound and requested batch size (clamped to 1..1000).
|
|
1643
|
+
* @returns The number of deleted rows.
|
|
1644
|
+
* @remarks Only `source IN ('user','agent')` rows are eligible; task/system events are retained.
|
|
1645
|
+
*/
|
|
1646
|
+
deleteChatOlderThan(input: {
|
|
1647
|
+
before: Date;
|
|
1648
|
+
limit: number;
|
|
1649
|
+
}): Promise<number>;
|
|
1639
1650
|
private parameters;
|
|
1640
1651
|
}
|
|
1641
1652
|
|
package/dist/index.js
CHANGED
|
@@ -10001,6 +10001,22 @@ var createProjectRoomReadStates = {
|
|
|
10001
10001
|
}
|
|
10002
10002
|
};
|
|
10003
10003
|
|
|
10004
|
+
// src/migrations/project_room_message_retention_migration.ts
|
|
10005
|
+
var addProjectRoomMessageRetentionIndex = {
|
|
10006
|
+
version: 179,
|
|
10007
|
+
name: "add_project_room_message_retention_index",
|
|
10008
|
+
up: async (client) => {
|
|
10009
|
+
await client.query(`
|
|
10010
|
+
CREATE INDEX IF NOT EXISTS idx_lattice_project_room_messages_chat_created
|
|
10011
|
+
ON lattice_project_room_messages (created_at)
|
|
10012
|
+
WHERE source IN ('user', 'agent')
|
|
10013
|
+
`);
|
|
10014
|
+
},
|
|
10015
|
+
down: async (client) => {
|
|
10016
|
+
await client.query("DROP INDEX IF EXISTS idx_lattice_project_room_messages_chat_created");
|
|
10017
|
+
}
|
|
10018
|
+
};
|
|
10019
|
+
|
|
10004
10020
|
// src/migrations/user_push_subscription_migration.ts
|
|
10005
10021
|
var createUserPushSubscriptions = {
|
|
10006
10022
|
version: 178,
|
|
@@ -10845,6 +10861,30 @@ var PostgreSQLProjectRoomMessageStore = class {
|
|
|
10845
10861
|
);
|
|
10846
10862
|
return result.rows[0]?.count ?? 0;
|
|
10847
10863
|
}
|
|
10864
|
+
/**
|
|
10865
|
+
* Deletes one bounded batch of chat messages older than a horizon.
|
|
10866
|
+
*
|
|
10867
|
+
* @param input Exclusive upper time bound and requested batch size (clamped to 1..1000).
|
|
10868
|
+
* @returns The number of deleted rows.
|
|
10869
|
+
* @remarks Only `source IN ('user','agent')` rows are eligible; task/system events are retained.
|
|
10870
|
+
*/
|
|
10871
|
+
async deleteChatOlderThan(input) {
|
|
10872
|
+
if (!(input.before instanceof Date) || Number.isNaN(input.before.getTime())) {
|
|
10873
|
+
throw new RangeError("Project room message retention horizon date is invalid");
|
|
10874
|
+
}
|
|
10875
|
+
const limit = Math.min(1e3, Math.max(1, Math.trunc(Number.isFinite(input.limit) ? input.limit : 1)));
|
|
10876
|
+
const result = await this.pool.query(
|
|
10877
|
+
`DELETE FROM lattice_project_room_messages
|
|
10878
|
+
WHERE ctid IN (
|
|
10879
|
+
SELECT ctid FROM lattice_project_room_messages
|
|
10880
|
+
WHERE created_at < $1 AND source IN ('user','agent')
|
|
10881
|
+
ORDER BY created_at ASC
|
|
10882
|
+
LIMIT $2
|
|
10883
|
+
)`,
|
|
10884
|
+
[input.before, limit]
|
|
10885
|
+
);
|
|
10886
|
+
return result.rowCount ?? 0;
|
|
10887
|
+
}
|
|
10848
10888
|
parameters(input) {
|
|
10849
10889
|
return [
|
|
10850
10890
|
input.id,
|
|
@@ -11022,6 +11062,7 @@ async function createPgStoreConfig(connectionString) {
|
|
|
11022
11062
|
mm.register(addAgentWebAppsIdentity);
|
|
11023
11063
|
mm.register(createProjectRoomReadStates);
|
|
11024
11064
|
mm.register(createUserPushSubscriptions);
|
|
11065
|
+
mm.register(addProjectRoomMessageRetentionIndex);
|
|
11025
11066
|
await mm.migrate();
|
|
11026
11067
|
const checkpoint = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(connectionString);
|
|
11027
11068
|
checkpoint.setup().catch((err) => {
|