Skip to content

Commit 9fbb7a9

Browse files
committed
feat: add support for edit tracking in OuroborosDB
- Introduced EditOf field in StoreOptions and RetrievedData structures to link edits to their original content. - Implemented resolveLatestEdit function to traverse the edit chain and return the most recent edit for a given key. - Updated StoreData method to handle metadata for edits, including storing the EditOf hash. - Enhanced GetData method to return SuggestedEdit and EditOf fields in the RetrievedData response. - Modified API server to expose new headers for SuggestedEdit and EditOf in HTTP responses. - Updated bulk data handling to include resolved keys and suggested edits in the response structure. - Added tests to verify the correct behavior of edit tracking and retrieval of latest edits. - Adjusted metadata structure to include EditOf field for JSON serialization.
1 parent 1b15d32 commit 9fbb7a9

File tree

15 files changed

+710
-96
lines changed

15 files changed

+710
-96
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
main
22
*.log
3-
data/
3+
data/
4+
.cache/

frontend/src/lib/apiClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type ThreadSummaryPayload = {
88
childCount: number;
99
createdAt?: string;
1010
computedId?: string;
11+
suggestedEdit?: string;
1112
};
1213

1314
export type ThreadNodePayload = {
@@ -21,10 +22,15 @@ export type ThreadNodePayload = {
2122
depth: number;
2223
children: string[];
2324
computedId?: string;
25+
suggestedEdit?: string;
26+
editOf?: string;
2427
};
2528

2629
export type BulkDataRecord = {
2730
key: string;
31+
resolvedKey?: string;
32+
suggestedEdit?: string;
33+
editOf?: string;
2834
found: boolean;
2935
mimeType?: string;
3036
isText?: boolean;

frontend/src/lib/indexedDb2.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export type ThreadSummaryRecord = {
1717

1818
export type MessageRecord = {
1919
key: string;
20+
resolvedKey?: string;
21+
suggestedEdit?: string;
22+
editOf?: string;
2023
mimeType: string;
2124
isText: boolean;
2225
sizeBytes: number;

frontend/src/lib/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export type Message = {
2121
depth?: number;
2222
title?: string;
2323
computedId?: string;
24+
// When an edited version exists, resolvedKey/suggestedEdit point to the latest hash.
25+
resolvedKey?: string;
26+
suggestedEdit?: string;
27+
editOf?: string;
2428
};
2529

2630
export type LookupResult = {

0 commit comments

Comments
 (0)