@grackle-ai/database 0.87.0 → 0.89.0
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/dist/finding-store.d.ts
CHANGED
|
@@ -2,6 +2,12 @@ import { type FindingRow } from "./schema.js";
|
|
|
2
2
|
export type { FindingRow };
|
|
3
3
|
/** Insert a new finding record. */
|
|
4
4
|
export declare function postFinding(id: string, workspaceId: string, taskId: string, sessionId: string, category: string, title: string, content: string, tags: string[]): void;
|
|
5
|
-
/**
|
|
5
|
+
/** Retrieve a single finding by ID. */
|
|
6
|
+
export declare function getFinding(id: string): FindingRow | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Query findings, optionally filtering by workspace, categories, and tags.
|
|
9
|
+
*
|
|
10
|
+
* When `workspaceId` is empty, returns findings across all workspaces.
|
|
11
|
+
*/
|
|
6
12
|
export declare function queryFindings(workspaceId: string, categories?: string[], tags?: string[], limit?: number): FindingRow[];
|
|
7
13
|
//# sourceMappingURL=finding-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finding-store.d.ts","sourceRoot":"","sources":["../src/finding-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAIxD,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,mCAAmC;AACnC,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,GACb,IAAI,CAWN;AAED,
|
|
1
|
+
{"version":3,"file":"finding-store.d.ts","sourceRoot":"","sources":["../src/finding-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAIxD,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,mCAAmC;AACnC,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,GACb,IAAI,CAWN;AAED,uCAAuC;AACvC,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAI7D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,EAAE,EACrB,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,KAAK,CAAC,EAAE,MAAM,GACb,UAAU,EAAE,CA4Cd"}
|
package/dist/finding-store.js
CHANGED
|
@@ -15,24 +15,49 @@ export function postFinding(id, workspaceId, taskId, sessionId, category, title,
|
|
|
15
15
|
tags: JSON.stringify(tags),
|
|
16
16
|
}).run();
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
18
|
+
/** Retrieve a single finding by ID. */
|
|
19
|
+
export function getFinding(id) {
|
|
20
|
+
return db.select().from(findings)
|
|
21
|
+
.where(eq(findings.id, id))
|
|
22
|
+
.get();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Query findings, optionally filtering by workspace, categories, and tags.
|
|
26
|
+
*
|
|
27
|
+
* When `workspaceId` is empty, returns findings across all workspaces.
|
|
28
|
+
*/
|
|
19
29
|
export function queryFindings(workspaceId, categories, tags, limit) {
|
|
20
30
|
const maxResults = Math.min(limit || 50, 100);
|
|
31
|
+
const hasWorkspaceFilter = workspaceId.length > 0;
|
|
32
|
+
const hasCategoryFilter = categories !== undefined && categories.length > 0;
|
|
21
33
|
let results;
|
|
22
|
-
if (
|
|
34
|
+
if (hasWorkspaceFilter && hasCategoryFilter) {
|
|
23
35
|
results = db.select().from(findings)
|
|
24
36
|
.where(and(eq(findings.workspaceId, workspaceId), sql `${findings.category} IN (SELECT value FROM json_each(${JSON.stringify(categories)}))`))
|
|
25
37
|
.orderBy(desc(findings.createdAt))
|
|
26
38
|
.limit(maxResults)
|
|
27
39
|
.all();
|
|
28
40
|
}
|
|
29
|
-
else {
|
|
41
|
+
else if (hasWorkspaceFilter) {
|
|
30
42
|
results = db.select().from(findings)
|
|
31
43
|
.where(eq(findings.workspaceId, workspaceId))
|
|
32
44
|
.orderBy(desc(findings.createdAt))
|
|
33
45
|
.limit(maxResults)
|
|
34
46
|
.all();
|
|
35
47
|
}
|
|
48
|
+
else if (hasCategoryFilter) {
|
|
49
|
+
results = db.select().from(findings)
|
|
50
|
+
.where(sql `${findings.category} IN (SELECT value FROM json_each(${JSON.stringify(categories)}))`)
|
|
51
|
+
.orderBy(desc(findings.createdAt))
|
|
52
|
+
.limit(maxResults)
|
|
53
|
+
.all();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
results = db.select().from(findings)
|
|
57
|
+
.orderBy(desc(findings.createdAt))
|
|
58
|
+
.limit(maxResults)
|
|
59
|
+
.all();
|
|
60
|
+
}
|
|
36
61
|
// Client-side tag filtering (simple approach)
|
|
37
62
|
if (tags && tags.length > 0) {
|
|
38
63
|
results = results.filter((r) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finding-store.js","sourceRoot":"","sources":["../src/finding-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAIvD,mCAAmC;AACnC,MAAM,UAAU,WAAW,CACzB,EAAU,EACV,WAAmB,EACnB,MAAc,EACd,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oCAAoC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;aAChG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;aACjC,KAAK,CAAC,UAAU,CAAC;aACjB,GAAG,EAAE,CAAC;IACX,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;aACjC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;aACjC,KAAK,CAAC,UAAU,CAAC;aACjB,GAAG,EAAE,CAAC;IACX,CAAC;IAED,8CAA8C;IAC9C,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;YAC7B,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grackle-ai/database",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.89.0",
|
|
4
4
|
"description": "SQLite persistence layer for Grackle — schema, stores, and migrations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"better-sqlite3": "^11.0.0",
|
|
33
33
|
"drizzle-orm": "^0.38.0",
|
|
34
34
|
"uuid": "^11.0.0",
|
|
35
|
-
"@grackle-ai/common": "0.
|
|
35
|
+
"@grackle-ai/common": "0.89.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@rushstack/heft": "1.2.7",
|