@dudousxd/nestjs-agent-store-drizzle 0.22.0 → 0.22.1
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/README.md +1 -1
- package/dist/index.cjs +9 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ reader's `IN (…)` and `truncateFrom`'s delete) filter on it.
|
|
|
150
150
|
## Attachment housekeeping
|
|
151
151
|
|
|
152
152
|
`referencedMediaIds(actorRef, mediaIds)` answers which of a set of media ids a message that still
|
|
153
|
-
exists carries, for one actor — the inverse of the host's own staged-media inventory, and the half a
|
|
153
|
+
exists — or one still waiting in a thread's queue (`agent_queued_message`) — carries, for one actor — the inverse of the host's own staged-media inventory, and the half a
|
|
154
154
|
sweep cannot work out for itself. It needs **no schema change**: it reads the `attachments` JSON
|
|
155
155
|
column messages have carried since attachments shipped, so an existing database answers correctly
|
|
156
156
|
the moment you upgrade, with nothing to backfill.
|
package/dist/index.cjs
CHANGED
|
@@ -1235,7 +1235,8 @@ var DrizzleAgentStore = class {
|
|
|
1235
1235
|
return rows.length;
|
|
1236
1236
|
}
|
|
1237
1237
|
/**
|
|
1238
|
-
* Of `mediaIds`, the ones a surviving message in
|
|
1238
|
+
* Of `mediaIds`, the ones a surviving message — or a message waiting in the queue — in one of
|
|
1239
|
+
* this actor's threads still carries.
|
|
1239
1240
|
*
|
|
1240
1241
|
* Reads the `attachments` JSON back out and matches in memory rather than pushing the match into
|
|
1241
1242
|
* SQL: the column holds an array of objects, and every dialect this adapter's sibling targets
|
|
@@ -1254,9 +1255,15 @@ var DrizzleAgentStore = class {
|
|
|
1254
1255
|
const rows = await this.db.select({
|
|
1255
1256
|
attachments: agentMessage.attachments
|
|
1256
1257
|
}).from(agentMessage).innerJoin(agentThread, (0, import_drizzle_orm2.eq)(agentMessage.threadId, agentThread.id)).where((0, import_drizzle_orm2.and)((0, import_drizzle_orm2.eq)(agentThread.actorRef, actorRef), (0, import_drizzle_orm2.isNotNull)(agentMessage.attachments)));
|
|
1258
|
+
const queued = await this.db.select({
|
|
1259
|
+
attachments: agentQueuedMessage.attachments
|
|
1260
|
+
}).from(agentQueuedMessage).innerJoin(agentThread, (0, import_drizzle_orm2.eq)(agentQueuedMessage.threadId, agentThread.id)).where((0, import_drizzle_orm2.and)((0, import_drizzle_orm2.eq)(agentThread.actorRef, actorRef), (0, import_drizzle_orm2.isNotNull)(agentQueuedMessage.attachments)));
|
|
1257
1261
|
const wanted = new Set(mediaIds);
|
|
1258
1262
|
const found = /* @__PURE__ */ new Set();
|
|
1259
|
-
for (const row of
|
|
1263
|
+
for (const row of [
|
|
1264
|
+
...rows,
|
|
1265
|
+
...queued
|
|
1266
|
+
]) {
|
|
1260
1267
|
for (const attachment of row.attachments ?? []) {
|
|
1261
1268
|
if (wanted.has(attachment.mediaId)) {
|
|
1262
1269
|
found.add(attachment.mediaId);
|