swarm-mail 0.2.0 → 0.3.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/{beads → hive}/adapter.d.ts +10 -10
- package/dist/hive/adapter.d.ts.map +1 -0
- package/dist/{beads → hive}/blocked-cache.d.ts +1 -1
- package/dist/hive/blocked-cache.d.ts.map +1 -0
- package/dist/{beads → hive}/comments.d.ts +3 -3
- package/dist/hive/comments.d.ts.map +1 -0
- package/dist/{beads → hive}/dependencies.d.ts +6 -6
- package/dist/hive/dependencies.d.ts.map +1 -0
- package/dist/hive/events.d.ts +163 -0
- package/dist/hive/events.d.ts.map +1 -0
- package/dist/{beads → hive}/flush-manager.d.ts +3 -3
- package/dist/hive/flush-manager.d.ts.map +1 -0
- package/dist/hive/index.d.ts +26 -0
- package/dist/hive/index.d.ts.map +1 -0
- package/dist/{beads → hive}/jsonl.d.ts +14 -14
- package/dist/hive/jsonl.d.ts.map +1 -0
- package/dist/{beads → hive}/labels.d.ts +2 -2
- package/dist/hive/labels.d.ts.map +1 -0
- package/dist/{beads → hive}/merge.d.ts +5 -5
- package/dist/hive/merge.d.ts.map +1 -0
- package/dist/hive/migrations.d.ts.map +1 -0
- package/dist/hive/operations.d.ts +56 -0
- package/dist/hive/operations.d.ts.map +1 -0
- package/dist/{beads → hive}/projections.d.ts +19 -19
- package/dist/hive/projections.d.ts.map +1 -0
- package/dist/{beads → hive}/queries.d.ts +10 -10
- package/dist/hive/queries.d.ts.map +1 -0
- package/dist/{beads → hive}/store.d.ts +9 -9
- package/dist/hive/store.d.ts.map +1 -0
- package/dist/{beads → hive}/validation.d.ts +7 -7
- package/dist/hive/validation.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +474 -379
- package/dist/streams/migrations.d.ts.map +1 -1
- package/dist/types/{beads-adapter.d.ts → hive-adapter.d.ts} +155 -103
- package/dist/types/hive-adapter.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/beads/adapter.d.ts.map +0 -1
- package/dist/beads/blocked-cache.d.ts.map +0 -1
- package/dist/beads/comments.d.ts.map +0 -1
- package/dist/beads/dependencies.d.ts.map +0 -1
- package/dist/beads/events.d.ts +0 -163
- package/dist/beads/events.d.ts.map +0 -1
- package/dist/beads/flush-manager.d.ts.map +0 -1
- package/dist/beads/index.d.ts +0 -25
- package/dist/beads/index.d.ts.map +0 -1
- package/dist/beads/jsonl.d.ts.map +0 -1
- package/dist/beads/labels.d.ts.map +0 -1
- package/dist/beads/merge.d.ts.map +0 -1
- package/dist/beads/migrations.d.ts.map +0 -1
- package/dist/beads/operations.d.ts +0 -56
- package/dist/beads/operations.d.ts.map +0 -1
- package/dist/beads/projections.d.ts.map +0 -1
- package/dist/beads/queries.d.ts.map +0 -1
- package/dist/beads/store.d.ts.map +0 -1
- package/dist/beads/validation.d.ts.map +0 -1
- package/dist/types/beads-adapter.d.ts.map +0 -1
- /package/dist/{beads → hive}/migrations.d.ts +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Beads Adapter - Factory for creating
|
|
2
|
+
* Beads Adapter - Factory for creating HiveAdapter instances
|
|
3
3
|
*
|
|
4
4
|
* This file implements the adapter pattern for beads event sourcing,
|
|
5
5
|
* enabling dependency injection of the database.
|
|
6
6
|
*
|
|
7
7
|
* ## Design Pattern
|
|
8
8
|
* - Accept DatabaseAdapter via factory parameter
|
|
9
|
-
* - Return
|
|
9
|
+
* - Return HiveAdapter interface
|
|
10
10
|
* - Delegate to store.ts for event operations
|
|
11
11
|
* - Delegate to projections.ts for queries
|
|
12
12
|
* - No direct database access (all via adapter)
|
|
@@ -14,25 +14,25 @@
|
|
|
14
14
|
* ## Usage
|
|
15
15
|
* ```typescript
|
|
16
16
|
* import { wrapPGlite } from '@opencode/swarm-mail/pglite';
|
|
17
|
-
* import {
|
|
17
|
+
* import { createHiveAdapter } from '@opencode/swarm-mail/beads';
|
|
18
18
|
*
|
|
19
19
|
* const pglite = new PGlite('./streams.db');
|
|
20
20
|
* const db = wrapPGlite(pglite);
|
|
21
|
-
* const beads =
|
|
21
|
+
* const beads = createHiveAdapter(db, '/path/to/project');
|
|
22
22
|
*
|
|
23
23
|
* // Use the adapter
|
|
24
|
-
* await beads.
|
|
25
|
-
* const bead = await beads.
|
|
24
|
+
* await beads.createCell(projectKey, { title: "Task", type: "task", priority: 2 });
|
|
25
|
+
* const bead = await beads.getCell(projectKey, "bd-123");
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
import type { DatabaseAdapter } from "../types/database.js";
|
|
29
|
-
import type {
|
|
29
|
+
import type { HiveAdapter } from "../types/hive-adapter.js";
|
|
30
30
|
/**
|
|
31
|
-
* Create a
|
|
31
|
+
* Create a HiveAdapter instance
|
|
32
32
|
*
|
|
33
33
|
* @param db - DatabaseAdapter instance (PGLite, SQLite, PostgreSQL, etc.)
|
|
34
34
|
* @param projectKey - Project identifier (typically the project path)
|
|
35
|
-
* @returns
|
|
35
|
+
* @returns HiveAdapter interface
|
|
36
36
|
*/
|
|
37
|
-
export declare function
|
|
37
|
+
export declare function createHiveAdapter(db: DatabaseAdapter, projectKey: string): HiveAdapter;
|
|
38
38
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/hive/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA6B5D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,GACjB,WAAW,CAkiBb"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* The actual implementation is in dependencies.ts to avoid circular dependencies.
|
|
6
6
|
*
|
|
7
7
|
* ## Cache Strategy
|
|
8
|
-
* - blocked_beads_cache table stores
|
|
8
|
+
* - blocked_beads_cache table stores cell_id → blocker_ids[]
|
|
9
9
|
* - Rebuilt when dependencies change or bead status changes
|
|
10
10
|
* - Enables fast "ready work" queries without recursive CTEs
|
|
11
11
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocked-cache.d.ts","sourceRoot":"","sources":["../../src/hive/blocked-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
* @module beads/comments
|
|
10
10
|
*/
|
|
11
11
|
import type { DatabaseAdapter } from "../types/database.js";
|
|
12
|
-
import type {
|
|
12
|
+
import type { CellComment } from "../types/hive-adapter.js";
|
|
13
13
|
/**
|
|
14
14
|
* Get a specific comment by ID
|
|
15
15
|
*/
|
|
16
|
-
export declare function getCommentById(db: DatabaseAdapter, commentId: number): Promise<
|
|
16
|
+
export declare function getCommentById(db: DatabaseAdapter, commentId: number): Promise<CellComment | null>;
|
|
17
17
|
/**
|
|
18
18
|
* Get comment thread (comment + all replies)
|
|
19
19
|
*/
|
|
20
|
-
export declare function getCommentThread(db: DatabaseAdapter, rootCommentId: number): Promise<
|
|
20
|
+
export declare function getCommentThread(db: DatabaseAdapter, rootCommentId: number): Promise<CellComment[]>;
|
|
21
21
|
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/hive/comments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,wBAAsB,cAAc,CAClC,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAM7B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,eAAe,EACnB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,EAAE,CAAC,CAgBxB"}
|
|
@@ -24,24 +24,24 @@ import type { DatabaseAdapter } from "../types/database.js";
|
|
|
24
24
|
/**
|
|
25
25
|
* Check if adding a dependency would create a cycle
|
|
26
26
|
*
|
|
27
|
-
* Uses recursive CTE to traverse from dependsOnId to see if we can reach
|
|
28
|
-
* If yes, adding "
|
|
27
|
+
* Uses recursive CTE to traverse from dependsOnId to see if we can reach cellId.
|
|
28
|
+
* If yes, adding "cellId depends on dependsOnId" would complete a cycle.
|
|
29
29
|
*/
|
|
30
|
-
export declare function wouldCreateCycle(db: DatabaseAdapter,
|
|
30
|
+
export declare function wouldCreateCycle(db: DatabaseAdapter, cellId: string, dependsOnId: string): Promise<boolean>;
|
|
31
31
|
/**
|
|
32
32
|
* Get all open blockers for a bead (including transitive)
|
|
33
33
|
*
|
|
34
34
|
* Returns bead IDs of all beads blocking this one that aren't closed.
|
|
35
35
|
* Only considers "blocks" relationship type.
|
|
36
36
|
*/
|
|
37
|
-
export declare function getOpenBlockers(db: DatabaseAdapter, projectKey: string,
|
|
37
|
+
export declare function getOpenBlockers(db: DatabaseAdapter, projectKey: string, cellId: string): Promise<string[]>;
|
|
38
38
|
/**
|
|
39
39
|
* Rebuild blocked cache for a specific bead
|
|
40
40
|
*
|
|
41
41
|
* Finds all open blockers and updates the cache.
|
|
42
42
|
* If no open blockers, removes from cache (bead is unblocked).
|
|
43
43
|
*/
|
|
44
|
-
export declare function rebuildBeadBlockedCache(db: DatabaseAdapter, projectKey: string,
|
|
44
|
+
export declare function rebuildBeadBlockedCache(db: DatabaseAdapter, projectKey: string, cellId: string): Promise<void>;
|
|
45
45
|
/**
|
|
46
46
|
* Rebuild blocked cache for all beads in a project
|
|
47
47
|
*
|
|
@@ -54,5 +54,5 @@ export declare function rebuildAllBlockedCaches(db: DatabaseAdapter, projectKey:
|
|
|
54
54
|
* Marks beads as needing cache rebuild.
|
|
55
55
|
* In this simple implementation, we just rebuild immediately.
|
|
56
56
|
*/
|
|
57
|
-
export declare function invalidateBlockedCache(db: DatabaseAdapter, projectKey: string,
|
|
57
|
+
export declare function invalidateBlockedCache(db: DatabaseAdapter, projectKey: string, cellId: string): Promise<void>;
|
|
58
58
|
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/hive/dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,eAAe,EACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC,CA6BlB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,EAAE,CAAC,CAwBnB;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cell Event Types - Minimal type definitions for swarm-mail
|
|
3
|
+
*
|
|
4
|
+
* These are simplified type definitions that match the cell-events from
|
|
5
|
+
* opencode-swarm-plugin but avoid cross-package TypeScript imports.
|
|
6
|
+
*
|
|
7
|
+
* The actual event schemas with Zod validation live in:
|
|
8
|
+
* packages/opencode-swarm-plugin/src/schemas/cell-events.ts
|
|
9
|
+
*
|
|
10
|
+
* This file provides just enough type information for the store to work.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Base cell event (all events extend this)
|
|
14
|
+
*/
|
|
15
|
+
export interface BaseCellEvent {
|
|
16
|
+
id?: number;
|
|
17
|
+
type: string;
|
|
18
|
+
project_key: string;
|
|
19
|
+
cell_id: string;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
sequence?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Union of all cell event types
|
|
25
|
+
*
|
|
26
|
+
* This matches the discriminated union in cell-events.ts but as pure TypeScript
|
|
27
|
+
*/
|
|
28
|
+
export type CellEvent = CellCreatedEvent | CellUpdatedEvent | CellStatusChangedEvent | CellClosedEvent | CellReopenedEvent | CellDeletedEvent | CellDependencyAddedEvent | CellDependencyRemovedEvent | CellLabelAddedEvent | CellLabelRemovedEvent | CellCommentAddedEvent | CellCommentUpdatedEvent | CellCommentDeletedEvent | CellEpicChildAddedEvent | CellEpicChildRemovedEvent | CellEpicClosureEligibleEvent | CellAssignedEvent | CellWorkStartedEvent | CellCompactedEvent;
|
|
29
|
+
export interface CellCreatedEvent extends BaseCellEvent {
|
|
30
|
+
type: "cell_created";
|
|
31
|
+
title: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
issue_type: "bug" | "feature" | "task" | "epic" | "chore";
|
|
34
|
+
priority: number;
|
|
35
|
+
parent_id?: string;
|
|
36
|
+
created_by?: string;
|
|
37
|
+
metadata?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface CellUpdatedEvent extends BaseCellEvent {
|
|
40
|
+
type: "cell_updated";
|
|
41
|
+
updated_by?: string;
|
|
42
|
+
changes: {
|
|
43
|
+
title?: {
|
|
44
|
+
old: string;
|
|
45
|
+
new: string;
|
|
46
|
+
};
|
|
47
|
+
description?: {
|
|
48
|
+
old: string;
|
|
49
|
+
new: string;
|
|
50
|
+
};
|
|
51
|
+
priority?: {
|
|
52
|
+
old: number;
|
|
53
|
+
new: number;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface CellStatusChangedEvent extends BaseCellEvent {
|
|
58
|
+
type: "cell_status_changed";
|
|
59
|
+
from_status: "open" | "in_progress" | "blocked" | "closed" | "tombstone";
|
|
60
|
+
to_status: "open" | "in_progress" | "blocked" | "closed" | "tombstone";
|
|
61
|
+
changed_by?: string;
|
|
62
|
+
reason?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface CellClosedEvent extends BaseCellEvent {
|
|
65
|
+
type: "cell_closed";
|
|
66
|
+
reason: string;
|
|
67
|
+
closed_by?: string;
|
|
68
|
+
files_touched?: string[];
|
|
69
|
+
duration_ms?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface CellReopenedEvent extends BaseCellEvent {
|
|
72
|
+
type: "cell_reopened";
|
|
73
|
+
reason?: string;
|
|
74
|
+
reopened_by?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface CellDeletedEvent extends BaseCellEvent {
|
|
77
|
+
type: "cell_deleted";
|
|
78
|
+
reason?: string;
|
|
79
|
+
deleted_by?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface CellDependencyAddedEvent extends BaseCellEvent {
|
|
82
|
+
type: "cell_dependency_added";
|
|
83
|
+
dependency: {
|
|
84
|
+
target: string;
|
|
85
|
+
type: "blocks" | "blocked-by" | "related" | "discovered-from";
|
|
86
|
+
};
|
|
87
|
+
added_by?: string;
|
|
88
|
+
reason?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface CellDependencyRemovedEvent extends BaseCellEvent {
|
|
91
|
+
type: "cell_dependency_removed";
|
|
92
|
+
dependency: {
|
|
93
|
+
target: string;
|
|
94
|
+
type: "blocks" | "blocked-by" | "related" | "discovered-from";
|
|
95
|
+
};
|
|
96
|
+
removed_by?: string;
|
|
97
|
+
reason?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface CellLabelAddedEvent extends BaseCellEvent {
|
|
100
|
+
type: "cell_label_added";
|
|
101
|
+
label: string;
|
|
102
|
+
added_by?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface CellLabelRemovedEvent extends BaseCellEvent {
|
|
105
|
+
type: "cell_label_removed";
|
|
106
|
+
label: string;
|
|
107
|
+
removed_by?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface CellCommentAddedEvent extends BaseCellEvent {
|
|
110
|
+
type: "cell_comment_added";
|
|
111
|
+
comment_id?: number;
|
|
112
|
+
author: string;
|
|
113
|
+
body: string;
|
|
114
|
+
parent_comment_id?: number;
|
|
115
|
+
metadata?: Record<string, unknown>;
|
|
116
|
+
}
|
|
117
|
+
export interface CellCommentUpdatedEvent extends BaseCellEvent {
|
|
118
|
+
type: "cell_comment_updated";
|
|
119
|
+
comment_id: number;
|
|
120
|
+
old_body: string;
|
|
121
|
+
new_body: string;
|
|
122
|
+
updated_by: string;
|
|
123
|
+
}
|
|
124
|
+
export interface CellCommentDeletedEvent extends BaseCellEvent {
|
|
125
|
+
type: "cell_comment_deleted";
|
|
126
|
+
comment_id: number;
|
|
127
|
+
deleted_by: string;
|
|
128
|
+
reason?: string;
|
|
129
|
+
}
|
|
130
|
+
export interface CellEpicChildAddedEvent extends BaseCellEvent {
|
|
131
|
+
type: "cell_epic_child_added";
|
|
132
|
+
child_id: string;
|
|
133
|
+
child_index?: number;
|
|
134
|
+
added_by?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface CellEpicChildRemovedEvent extends BaseCellEvent {
|
|
137
|
+
type: "cell_epic_child_removed";
|
|
138
|
+
child_id: string;
|
|
139
|
+
removed_by?: string;
|
|
140
|
+
reason?: string;
|
|
141
|
+
}
|
|
142
|
+
export interface CellEpicClosureEligibleEvent extends BaseCellEvent {
|
|
143
|
+
type: "cell_epic_closure_eligible";
|
|
144
|
+
child_ids: string[];
|
|
145
|
+
total_duration_ms?: number;
|
|
146
|
+
all_files_touched?: string[];
|
|
147
|
+
}
|
|
148
|
+
export interface CellAssignedEvent extends BaseCellEvent {
|
|
149
|
+
type: "cell_assigned";
|
|
150
|
+
agent_name: string;
|
|
151
|
+
task_description?: string;
|
|
152
|
+
}
|
|
153
|
+
export interface CellWorkStartedEvent extends BaseCellEvent {
|
|
154
|
+
type: "cell_work_started";
|
|
155
|
+
agent_name: string;
|
|
156
|
+
reserved_files?: string[];
|
|
157
|
+
}
|
|
158
|
+
export interface CellCompactedEvent extends BaseCellEvent {
|
|
159
|
+
type: "cell_compacted";
|
|
160
|
+
events_archived: number;
|
|
161
|
+
new_start_sequence: number;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/hive/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAEjB,gBAAgB,GAChB,gBAAgB,GAChB,sBAAsB,GACtB,eAAe,GACf,iBAAiB,GACjB,gBAAg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AAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA6B,SAAQ,aAAa;IACjE,IAAI,EAAE,4BAA4B,CAAC;IACnC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAMD,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,IAAI,EAAE,eAAe,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,IAAI,EAAE,mBAAmB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAMD,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,IAAI,EAAE,gBAAgB,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module beads/flush-manager
|
|
10
10
|
*/
|
|
11
|
-
import type {
|
|
11
|
+
import type { HiveAdapter } from "../types/hive-adapter.js";
|
|
12
12
|
export interface FlushManagerOptions {
|
|
13
|
-
adapter:
|
|
13
|
+
adapter: HiveAdapter;
|
|
14
14
|
projectKey: string;
|
|
15
15
|
outputPath: string;
|
|
16
16
|
debounceMs?: number;
|
|
17
17
|
onFlush?: (result: FlushResult) => void;
|
|
18
18
|
}
|
|
19
19
|
export interface FlushResult {
|
|
20
|
-
|
|
20
|
+
cellsExported: number;
|
|
21
21
|
bytesWritten: number;
|
|
22
22
|
duration: number;
|
|
23
23
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flush-manager.d.ts","sourceRoot":"","sources":["../../src/hive/flush-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,WAAW,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAC,CAAgC;IAChD,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,EAAE,mBAAmB;IAQxC;;;;OAIG;IACH,aAAa,IAAI,IAAI;IAcrB;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;IA8DnC;;;;OAIG;IACH,IAAI,IAAI,IAAI;CAMb"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beads Module - Event-sourced issue tracking
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - HiveAdapter interface and types
|
|
6
|
+
* - Migration definitions
|
|
7
|
+
* - Projection functions
|
|
8
|
+
* - Store operations (append, read, replay)
|
|
9
|
+
* - Event type definitions
|
|
10
|
+
*
|
|
11
|
+
* @module beads
|
|
12
|
+
*/
|
|
13
|
+
export type { Cell, CellAdapter, CellComment, CellDependency, CellLabel, HiveAdapter, HiveAdapterFactory, HiveSchemaAdapter, CellStatus, CellType, CommentAdapter, CreateCellOptions, DependencyAdapter, DependencyRelationship, EpicAdapter, LabelAdapter, QueryAdapter, QueryCellsOptions, UpdateCellOptions, Bead, BeadAdapter, BeadComment, BeadDependency, BeadLabel, BeadsAdapter, BeadsAdapterFactory, BeadsSchemaAdapter, BeadStatus, BeadType, CreateBeadOptions, UpdateBeadOptions, QueryBeadsOptions, } from "../types/hive-adapter.js";
|
|
14
|
+
export type { CellEvent, BaseCellEvent, CellCreatedEvent, CellUpdatedEvent, CellStatusChangedEvent, CellClosedEvent, CellReopenedEvent, CellDeletedEvent, CellDependencyAddedEvent, CellDependencyRemovedEvent, CellLabelAddedEvent, CellLabelRemovedEvent, CellCommentAddedEvent, CellCommentUpdatedEvent, CellCommentDeletedEvent, CellEpicChildAddedEvent, CellEpicChildRemovedEvent, CellEpicClosureEligibleEvent, CellAssignedEvent, CellWorkStartedEvent, CellCompactedEvent, } from "./events.js";
|
|
15
|
+
export { createHiveAdapter } from "./adapter.js";
|
|
16
|
+
export { createHiveAdapter as createBeadsAdapter } from "./adapter.js";
|
|
17
|
+
export { beadsMigration, beadsMigrations } from "./migrations.js";
|
|
18
|
+
export { appendCellEvent, readCellEvents, replayCellEvents, type ReadCellEventsOptions, } from "./store.js";
|
|
19
|
+
export { clearAllDirtyBeads, clearDirtyBead, getCell, getBlockedCells, getBlockers, getComments, getDependencies, getDependents, getDirtyCells, getInProgressCells, getLabels, getNextReadyCell, isBlocked, markBeadDirty, queryCells, updateProjections, } from "./projections.js";
|
|
20
|
+
export { wouldCreateCycle, getOpenBlockers, rebuildBeadBlockedCache, rebuildAllBlockedCaches, invalidateBlockedCache, } from "./dependencies.js";
|
|
21
|
+
export { getCellsByLabel, getAllLabels, } from "./labels.js";
|
|
22
|
+
export { getCommentById, getCommentThread, } from "./comments.js";
|
|
23
|
+
export { exportToJSONL, exportDirtyBeads, importFromJSONL, parseJSONL, serializeToJSONL, computeContentHash, type CellExport, type ExportOptions, type ImportOptions, type ImportResult, } from "./jsonl.js";
|
|
24
|
+
export { FlushManager, type FlushManagerOptions, type FlushResult, } from "./flush-manager.js";
|
|
25
|
+
export { merge3Way, mergeJsonl, isTombstone, isExpiredTombstone, DEFAULT_TOMBSTONE_TTL_MS, MIN_TOMBSTONE_TTL_MS, CLOCK_SKEW_GRACE_MS, STATUS_TOMBSTONE, type IssueKey, type MergeResult, type MergeOptions, } from "./merge.js";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hive/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,YAAY,EACV,IAAI,EACJ,WAAW,EACX,WAAW,EACX,cAAc,EACd,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EAEjB,IAAI,EACJ,WAAW,EACX,WAAW,EACX,cAAc,EACd,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,4BAA4B,EAC5B,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,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
|
*/
|
|
13
|
-
import type {
|
|
13
|
+
import type { HiveAdapter } from "../types/hive-adapter.js";
|
|
14
14
|
/**
|
|
15
15
|
* JSONL export format matching steveyegge/beads
|
|
16
16
|
*
|
|
17
17
|
* One JSON object per line. Field names match the Go struct tags.
|
|
18
18
|
*/
|
|
19
|
-
export interface
|
|
19
|
+
export interface CellExport {
|
|
20
20
|
id: string;
|
|
21
21
|
title: string;
|
|
22
22
|
description?: string;
|
|
@@ -40,7 +40,7 @@ export interface BeadExport {
|
|
|
40
40
|
}
|
|
41
41
|
export interface ExportOptions {
|
|
42
42
|
includeDeleted?: boolean;
|
|
43
|
-
|
|
43
|
+
cellIds?: string[];
|
|
44
44
|
}
|
|
45
45
|
export interface ImportOptions {
|
|
46
46
|
dryRun?: boolean;
|
|
@@ -51,53 +51,53 @@ export interface ImportResult {
|
|
|
51
51
|
updated: number;
|
|
52
52
|
skipped: number;
|
|
53
53
|
errors: Array<{
|
|
54
|
-
|
|
54
|
+
cellId: string;
|
|
55
55
|
error: string;
|
|
56
56
|
}>;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Serialize a bead to a JSONL line
|
|
60
60
|
*/
|
|
61
|
-
export declare function serializeToJSONL(
|
|
61
|
+
export declare function serializeToJSONL(cell: CellExport): string;
|
|
62
62
|
/**
|
|
63
63
|
* Parse JSONL string to bead exports
|
|
64
64
|
*
|
|
65
65
|
* Skips empty lines. Throws on invalid JSON.
|
|
66
66
|
*/
|
|
67
|
-
export declare function parseJSONL(jsonl: string):
|
|
67
|
+
export declare function parseJSONL(jsonl: string): CellExport[];
|
|
68
68
|
/**
|
|
69
69
|
* Compute SHA-256 content hash for deduplication
|
|
70
70
|
*
|
|
71
71
|
* Uses canonical JSON encoding (sorted keys) for stability.
|
|
72
72
|
* Includes timestamps to detect any change.
|
|
73
73
|
*/
|
|
74
|
-
export declare function computeContentHash(
|
|
74
|
+
export declare function computeContentHash(cell: CellExport): string;
|
|
75
75
|
/**
|
|
76
76
|
* Export all beads to JSONL string
|
|
77
77
|
*
|
|
78
78
|
* By default excludes deleted beads (tombstones).
|
|
79
79
|
* Includes dependencies, labels, and comments.
|
|
80
80
|
*/
|
|
81
|
-
export declare function exportToJSONL(adapter:
|
|
81
|
+
export declare function exportToJSONL(adapter: HiveAdapter, projectKey: string, options?: ExportOptions): Promise<string>;
|
|
82
82
|
/**
|
|
83
83
|
* Export only dirty beads (incremental)
|
|
84
84
|
*
|
|
85
85
|
* Returns JSONL and list of bead IDs that were exported.
|
|
86
86
|
*/
|
|
87
|
-
export declare function exportDirtyBeads(adapter:
|
|
87
|
+
export declare function exportDirtyBeads(adapter: HiveAdapter, projectKey: string): Promise<{
|
|
88
88
|
jsonl: string;
|
|
89
|
-
|
|
89
|
+
cellIds: string[];
|
|
90
90
|
}>;
|
|
91
91
|
/**
|
|
92
|
-
* Import
|
|
92
|
+
* Import cells from JSONL string
|
|
93
93
|
*
|
|
94
94
|
* Features:
|
|
95
|
-
* - Creates new
|
|
96
|
-
* - Updates existing
|
|
95
|
+
* - Creates new cells
|
|
96
|
+
* - Updates existing cells
|
|
97
97
|
* - Hash-based deduplication (skips if content unchanged)
|
|
98
98
|
* - Imports dependencies, labels, comments
|
|
99
99
|
* - Dry run mode for preview
|
|
100
100
|
* - Skip existing mode
|
|
101
101
|
*/
|
|
102
|
-
export declare function importFromJSONL(adapter:
|
|
102
|
+
export declare function importFromJSONL(adapter: HiveAdapter, projectKey: string, jsonl: string, options?: ImportOptions): Promise<ImportResult>;
|
|
103
103
|
//# sourceMappingURL=jsonl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../src/hive/jsonl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAa5D;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC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AC,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAyBtD;AAMD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAI3D;AAMD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA2EjB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAa/C;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAqBvB"}
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* @module beads/labels
|
|
10
10
|
*/
|
|
11
11
|
import type { DatabaseAdapter } from "../types/database.js";
|
|
12
|
-
import type {
|
|
12
|
+
import type { Cell } from "../types/hive-adapter.js";
|
|
13
13
|
/**
|
|
14
14
|
* Get all beads with a specific label
|
|
15
15
|
*/
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function getCellsByLabel(db: DatabaseAdapter, projectKey: string, label: string): Promise<Cell[]>;
|
|
17
17
|
/**
|
|
18
18
|
* Get all unique labels for a project
|
|
19
19
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/hive/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD;;GAEG;AACH,wBAAsB,eAAe,CACnC,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,EAAE,CAAC,CASjB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CASnB"}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* @module beads/merge
|
|
26
26
|
*/
|
|
27
|
-
import type {
|
|
27
|
+
import type { CellExport } from "./jsonl.js";
|
|
28
28
|
/** Default TTL for tombstones (30 days) */
|
|
29
29
|
export declare const DEFAULT_TOMBSTONE_TTL_MS: number;
|
|
30
30
|
/** Minimum TTL for tombstones (7 days) - safety limit */
|
|
@@ -48,7 +48,7 @@ export interface IssueKey {
|
|
|
48
48
|
*/
|
|
49
49
|
export interface MergeResult {
|
|
50
50
|
/** Successfully merged beads */
|
|
51
|
-
merged:
|
|
51
|
+
merged: CellExport[];
|
|
52
52
|
/** Conflict markers (for manual resolution if needed) */
|
|
53
53
|
conflicts: string[];
|
|
54
54
|
}
|
|
@@ -64,7 +64,7 @@ export interface MergeOptions {
|
|
|
64
64
|
/**
|
|
65
65
|
* Check if a bead is a tombstone (soft-deleted)
|
|
66
66
|
*/
|
|
67
|
-
export declare function isTombstone(
|
|
67
|
+
export declare function isTombstone(cell: CellExport): boolean;
|
|
68
68
|
/**
|
|
69
69
|
* Check if a tombstone has expired (resurrection allowed)
|
|
70
70
|
*
|
|
@@ -72,7 +72,7 @@ export declare function isTombstone(bead: BeadExport): boolean;
|
|
|
72
72
|
* @param ttlMs - TTL in milliseconds (default: 30 days)
|
|
73
73
|
* @returns true if tombstone is expired, false otherwise
|
|
74
74
|
*/
|
|
75
|
-
export declare function isExpiredTombstone(
|
|
75
|
+
export declare function isExpiredTombstone(cell: CellExport, ttlMs?: number): boolean;
|
|
76
76
|
/**
|
|
77
77
|
* Perform 3-way merge of JSONL bead arrays
|
|
78
78
|
*
|
|
@@ -82,7 +82,7 @@ export declare function isExpiredTombstone(bead: BeadExport, ttlMs?: number): bo
|
|
|
82
82
|
* @param options - Merge options
|
|
83
83
|
* @returns Merged beads and any conflicts
|
|
84
84
|
*/
|
|
85
|
-
export declare function merge3Way(base:
|
|
85
|
+
export declare function merge3Way(base: CellExport[], left: CellExport[], right: CellExport[], options?: MergeOptions): MergeResult;
|
|
86
86
|
/**
|
|
87
87
|
* Merge JSONL strings (convenience wrapper)
|
|
88
88
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/hive/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAM7C,2CAA2C;AAC3C,eAAO,MAAM,wBAAwB,QAA2B,CAAC;AAEjE,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,QAA0B,CAAC;AAE5D,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,QAAiB,CAAC;AAElD,gCAAgC;AAChC,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAM5C;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,yDAAyD;IACzD,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AA0BD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAErD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,KAAK,GAAE,MAAiC,GACvC,OAAO,CAyBT;AAwUD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,UAAU,EAAE,EAClB,IAAI,EAAE,UAAU,EAAE,EAClB,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,GAAE,YAAiB,GACzB,WAAW,CA0Jb;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,YAAiB,GACzB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAoBxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/hive/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,SAoH5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,EAAqB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cell Operations - High-level CRUD operations using HiveAdapter
|
|
3
|
+
*
|
|
4
|
+
* Convenience functions that wrap HiveAdapter with validation.
|
|
5
|
+
* Plugin tools should use these operations instead of calling adapter directly.
|
|
6
|
+
*
|
|
7
|
+
* ## Layering
|
|
8
|
+
* - HiveAdapter: Low-level event sourcing operations
|
|
9
|
+
* - operations.ts: High-level validated CRUD (THIS FILE)
|
|
10
|
+
* - Plugin tools: Type-safe Zod-validated wrappers
|
|
11
|
+
*/
|
|
12
|
+
import type { HiveAdapter, Cell, QueryCellsOptions } from "../types/hive-adapter.js";
|
|
13
|
+
import { type CreateCellOptions, type UpdateCellOptions } from "./validation.js";
|
|
14
|
+
/**
|
|
15
|
+
* Create a new bead with validation
|
|
16
|
+
*
|
|
17
|
+
* @throws {Error} If validation fails
|
|
18
|
+
*/
|
|
19
|
+
export declare function createCell(adapter: HiveAdapter, projectKey: string, options: CreateCellOptions): Promise<Cell>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a bead by ID
|
|
22
|
+
*
|
|
23
|
+
* @returns Cell or null if not found
|
|
24
|
+
*/
|
|
25
|
+
export declare function getCell(adapter: HiveAdapter, projectKey: string, cellId: string): Promise<Cell | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Update a bead with validation
|
|
28
|
+
*
|
|
29
|
+
* @throws {Error} If validation fails or bead not found
|
|
30
|
+
*/
|
|
31
|
+
export declare function updateCell(adapter: HiveAdapter, projectKey: string, cellId: string, updates: UpdateCellOptions): Promise<Cell>;
|
|
32
|
+
/**
|
|
33
|
+
* Close a bead
|
|
34
|
+
*
|
|
35
|
+
* @throws {Error} If bead not found
|
|
36
|
+
*/
|
|
37
|
+
export declare function closeCell(adapter: HiveAdapter, projectKey: string, cellId: string, reason: string, closedBy?: string): Promise<Cell>;
|
|
38
|
+
/**
|
|
39
|
+
* Reopen a closed bead
|
|
40
|
+
*
|
|
41
|
+
* @throws {Error} If bead not found or invalid transition
|
|
42
|
+
*/
|
|
43
|
+
export declare function reopenCell(adapter: HiveAdapter, projectKey: string, cellId: string, reopenedBy?: string): Promise<Cell>;
|
|
44
|
+
/**
|
|
45
|
+
* Delete a bead (soft delete - creates tombstone)
|
|
46
|
+
*
|
|
47
|
+
* @throws {Error} If bead not found
|
|
48
|
+
*/
|
|
49
|
+
export declare function deleteCell(adapter: HiveAdapter, projectKey: string, cellId: string, reason: string, deletedBy?: string): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Search beads by title
|
|
52
|
+
*
|
|
53
|
+
* Simple text search across bead titles with optional filters.
|
|
54
|
+
*/
|
|
55
|
+
export declare function searchBeads(adapter: HiveAdapter, projectKey: string, query: string, filter?: QueryCellsOptions): Promise<Cell[]>;
|
|
56
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/hive/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,IAAI,EACJ,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAEtB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,WAAW,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