@sixb/sqlite 0.1.20 → 0.1.22
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/action-run-storage.d.ts +4 -0
- package/dist/action-run-storage.d.ts.map +1 -1
- package/dist/activity-storage.d.ts +20 -0
- package/dist/activity-storage.d.ts.map +1 -0
- package/dist/agents/agent-storage.d.ts +8 -2
- package/dist/agents/agent-storage.d.ts.map +1 -1
- package/dist/agents/approvals.d.ts +51 -0
- package/dist/agents/approvals.d.ts.map +1 -0
- package/dist/agents/checkpoints.d.ts +1 -0
- package/dist/agents/checkpoints.d.ts.map +1 -1
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/memory.d.ts +21 -0
- package/dist/agents/memory.d.ts.map +1 -0
- package/dist/agents/messages.d.ts.map +1 -1
- package/dist/agents/rows.d.ts +15 -1
- package/dist/agents/rows.d.ts.map +1 -1
- package/dist/agents/runs.d.ts +14 -1
- package/dist/agents/runs.d.ts.map +1 -1
- package/dist/agents/settings.d.ts +29 -0
- package/dist/agents/settings.d.ts.map +1 -0
- package/dist/agents/threads.d.ts +16 -1
- package/dist/agents/threads.d.ts.map +1 -1
- package/dist/ai-cost-groups.d.ts.map +1 -1
- package/dist/ai-cost-storage.d.ts.map +1 -1
- package/dist/ai-usage-storage.d.ts +4 -1
- package/dist/ai-usage-storage.d.ts.map +1 -1
- package/dist/artifact-storage.d.ts +31 -0
- package/dist/artifact-storage.d.ts.map +1 -0
- package/dist/auth-storage/auth-storage.d.ts +3 -2
- package/dist/auth-storage/auth-storage.d.ts.map +1 -1
- package/dist/auth-storage/sessions.d.ts +2 -1
- package/dist/auth-storage/sessions.d.ts.map +1 -1
- package/dist/auth-storage/users.d.ts +7 -3
- package/dist/auth-storage/users.d.ts.map +1 -1
- package/dist/execution-storage.d.ts +3 -1
- package/dist/execution-storage.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5216 -2517
- package/dist/index.js.map +39 -31
- package/dist/migrations.d.ts +0 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/objects/conditional-reader.d.ts +8 -0
- package/dist/objects/conditional-reader.d.ts.map +1 -0
- package/dist/objects/query-compiler.d.ts +26 -1
- package/dist/objects/query-compiler.d.ts.map +1 -1
- package/dist/objects/read-scope.d.ts +10 -1
- package/dist/objects/read-scope.d.ts.map +1 -1
- package/dist/objects/reader.d.ts +2 -0
- package/dist/objects/reader.d.ts.map +1 -1
- package/dist/objects/scoped-reader.d.ts +15 -0
- package/dist/objects/scoped-reader.d.ts.map +1 -0
- package/dist/objects/selected-reader.d.ts.map +1 -1
- package/dist/objects/storage.d.ts +6 -1
- package/dist/objects/storage.d.ts.map +1 -1
- package/dist/ontology-storage/index.d.ts +2 -0
- package/dist/ontology-storage/index.d.ts.map +1 -1
- package/dist/ontology-storage/materialization-writer.d.ts +2 -0
- package/dist/ontology-storage/materialization-writer.d.ts.map +1 -1
- package/dist/ontology-storage/materializations.d.ts.map +1 -1
- package/dist/ontology-storage/sources.d.ts +2 -1
- package/dist/ontology-storage/sources.d.ts.map +1 -1
- package/dist/ontology-storage/unique-values.d.ts +42 -0
- package/dist/ontology-storage/unique-values.d.ts.map +1 -0
- package/dist/share-grant-storage.d.ts +2 -1
- package/dist/share-grant-storage.d.ts.map +1 -1
- package/dist/workflow-run-storage.d.ts +4 -0
- package/dist/workflow-run-storage.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/action-run-storage.ts +27 -0
- package/src/activity-storage.ts +588 -0
- package/src/agents/agent-storage.ts +11 -2
- package/src/agents/approvals.ts +456 -0
- package/src/agents/checkpoints.ts +9 -4
- package/src/agents/index.ts +1 -0
- package/src/agents/memory.ts +195 -0
- package/src/agents/messages.ts +21 -18
- package/src/agents/rows.ts +46 -1
- package/src/agents/runs.ts +202 -21
- package/src/agents/settings.ts +112 -0
- package/src/agents/threads.ts +412 -1
- package/src/ai-cost-groups.ts +11 -1
- package/src/ai-cost-storage.ts +54 -12
- package/src/ai-usage-storage.ts +79 -2
- package/src/artifact-storage.ts +553 -0
- package/src/auth-storage/auth-storage.ts +58 -26
- package/src/auth-storage/sessions.ts +27 -0
- package/src/auth-storage/users.ts +106 -60
- package/src/execution-storage.ts +95 -0
- package/src/index.ts +10 -0
- package/src/migrations/062-artifacts.sql +71 -0
- package/src/migrations/063-drop-output-diagnostics.sql +19 -0
- package/src/migrations/064-activity.sql +61 -0
- package/src/migrations/065-activity-timeline.sql +19 -0
- package/src/migrations/066-activity-interactions.sql +20 -0
- package/src/migrations/067-artifact-kinds.sql +32 -0
- package/src/migrations/068-artifact-state.sql +15 -0
- package/src/migrations/069-agent-thread-participants.sql +16 -0
- package/src/migrations/070-forked-context-checkpoints.sql +45 -0
- package/src/migrations/071-unique-values.sql +22 -0
- package/src/migrations/072-generated-media-usage.sql +32 -0
- package/src/migrations/073-model-call-files.sql +11 -0
- package/src/migrations/074-agent-memory.sql +32 -0
- package/src/migrations/075-artifact-threads.sql +21 -0
- package/src/migrations/076-agent-approvals.sql +59 -0
- package/src/migrations/077-agent-approval-resume.sql +20 -0
- package/src/migrations/078-subagent-threads.sql +241 -0
- package/src/migrations/079-subagent-questions.sql +6 -0
- package/src/migrations.ts +89 -1
- package/src/objects/README.md +7 -0
- package/src/objects/conditional-reader.ts +27 -0
- package/src/objects/query-compiler.ts +36 -6
- package/src/objects/read-scope.ts +140 -23
- package/src/objects/reader.ts +47 -14
- package/src/objects/scoped-reader.ts +103 -0
- package/src/objects/selected-reader.ts +12 -75
- package/src/objects/storage.ts +16 -0
- package/src/ontology-storage/index.ts +3 -0
- package/src/ontology-storage/materialization-writer.ts +14 -0
- package/src/ontology-storage/materializations.ts +16 -1
- package/src/ontology-storage/sources.ts +41 -0
- package/src/ontology-storage/unique-values.ts +187 -0
- package/src/share-grant-storage.ts +25 -0
- package/src/transactions.ts +1 -1
- package/src/workflow-run-storage.ts +27 -0
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import type {
|
|
10
10
|
CreateShareGrantInput,
|
|
11
11
|
GetShareGrantByIdInput,
|
|
12
|
+
GetShareGrantsByIdsInput,
|
|
12
13
|
ListShareGrantsInput,
|
|
13
14
|
ListShareGrantsResult,
|
|
14
15
|
RevokeShareGrantInput,
|
|
@@ -85,6 +86,30 @@ export class SqliteShareGrantStorage implements ShareGrantStorage {
|
|
|
85
86
|
return this.getRow(normalized.projectId, normalized.id)
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
async getByIds(input: GetShareGrantsByIdsInput): Promise<readonly ShareGrantRecord[]> {
|
|
90
|
+
const ids = [...new Set(input.ids)]
|
|
91
|
+
if (ids.length === 0) {
|
|
92
|
+
return []
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const rows = this.db
|
|
96
|
+
.query(
|
|
97
|
+
`
|
|
98
|
+
SELECT *
|
|
99
|
+
FROM share_grants
|
|
100
|
+
WHERE project_id = ?
|
|
101
|
+
AND id IN (SELECT value FROM json_each(?))
|
|
102
|
+
`
|
|
103
|
+
)
|
|
104
|
+
.all(input.projectId, JSON.stringify(ids)) as SqliteShareGrantRow[]
|
|
105
|
+
|
|
106
|
+
const byId = new Map(rows.map((row) => [row.id, row]))
|
|
107
|
+
return ids.flatMap((id) => {
|
|
108
|
+
const row = byId.get(id)
|
|
109
|
+
return row ? [rowToRecord(row)] : []
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
88
113
|
async list(input: ListShareGrantsInput): Promise<ListShareGrantsResult> {
|
|
89
114
|
const normalized = normalizeListShareGrantsInput(input)
|
|
90
115
|
const where = ["project_id = ?"]
|
package/src/transactions.ts
CHANGED
|
@@ -108,7 +108,7 @@ export function runDeferredReadTransaction<T>(db: Database, run: () => T): T {
|
|
|
108
108
|
}
|
|
109
109
|
if (db.inTransaction) {
|
|
110
110
|
throw new Error(
|
|
111
|
-
"[SixbSqlite]
|
|
111
|
+
"[SixbSqlite] Scoped object reads cannot join an unverified SQLite transaction."
|
|
112
112
|
)
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -358,6 +358,33 @@ export class SqliteWorkflowRunStorage implements WorkflowRunStorage {
|
|
|
358
358
|
return row ? rowToWorkflowRunRecord(row) : null
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
async getByExecutionIds(params: {
|
|
362
|
+
readonly projectId: string
|
|
363
|
+
readonly executionIds: readonly string[]
|
|
364
|
+
}): Promise<readonly WorkflowRunRecord[]> {
|
|
365
|
+
const executionIds = [...new Set(params.executionIds)]
|
|
366
|
+
if (executionIds.length === 0) {
|
|
367
|
+
return []
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const rows = this.db
|
|
371
|
+
.query(
|
|
372
|
+
`
|
|
373
|
+
SELECT *
|
|
374
|
+
FROM workflow_runs
|
|
375
|
+
WHERE project_id = ?
|
|
376
|
+
AND execution_id IN (SELECT value FROM json_each(?))
|
|
377
|
+
`
|
|
378
|
+
)
|
|
379
|
+
.all(params.projectId, JSON.stringify(executionIds)) as WorkflowRunDatabaseRow[]
|
|
380
|
+
|
|
381
|
+
const byExecution = new Map(rows.map((row) => [row.execution_id, row]))
|
|
382
|
+
return executionIds.flatMap((executionId) => {
|
|
383
|
+
const row = byExecution.get(executionId)
|
|
384
|
+
return row ? [rowToWorkflowRunRecord(row)] : []
|
|
385
|
+
})
|
|
386
|
+
}
|
|
387
|
+
|
|
361
388
|
async list(input: ListWorkflowRunsInput): Promise<ListWorkflowRunsResult> {
|
|
362
389
|
if (hasEmptyStatuses(input) || input.workflowIds?.length === 0) {
|
|
363
390
|
return {
|