@paraharness/sqlite 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +64 -2
- package/dist/builders/compaction-config-builder.d.ts +66 -0
- package/dist/builders/compaction-config-builder.d.ts.map +1 -0
- package/dist/builders/compaction-config-builder.js +2 -0
- package/dist/builders/compaction-config-builder.js.map +1 -0
- package/dist/builders/create-compaction-config-builder.d.ts +14 -0
- package/dist/builders/create-compaction-config-builder.d.ts.map +1 -0
- package/dist/builders/create-compaction-config-builder.js +66 -0
- package/dist/builders/create-compaction-config-builder.js.map +1 -0
- package/dist/builders/create-sqlite-global-rules-builder.d.ts +15 -0
- package/dist/builders/create-sqlite-global-rules-builder.d.ts.map +1 -0
- package/dist/builders/create-sqlite-global-rules-builder.js +30 -0
- package/dist/builders/create-sqlite-global-rules-builder.js.map +1 -0
- package/dist/builders/create-sqlite-ledger-builder.d.ts +15 -0
- package/dist/builders/create-sqlite-ledger-builder.d.ts.map +1 -0
- package/dist/builders/create-sqlite-ledger-builder.js +31 -0
- package/dist/builders/create-sqlite-ledger-builder.js.map +1 -0
- package/dist/builders/create-sqlite-lessons-builder.d.ts +12 -0
- package/dist/builders/create-sqlite-lessons-builder.d.ts.map +1 -0
- package/dist/builders/create-sqlite-lessons-builder.js +23 -0
- package/dist/builders/create-sqlite-lessons-builder.js.map +1 -0
- package/dist/builders/create-sqlite-topology-builder.d.ts +12 -0
- package/dist/builders/create-sqlite-topology-builder.d.ts.map +1 -0
- package/dist/builders/create-sqlite-topology-builder.js +23 -0
- package/dist/builders/create-sqlite-topology-builder.js.map +1 -0
- package/dist/builders/internal/compaction-config-builder-state.d.ts +16 -0
- package/dist/builders/internal/compaction-config-builder-state.d.ts.map +1 -0
- package/dist/builders/internal/compaction-config-builder-state.js +2 -0
- package/dist/builders/internal/compaction-config-builder-state.js.map +1 -0
- package/dist/builders/sqlite-global-rules-builder.d.ts +17 -0
- package/dist/builders/sqlite-global-rules-builder.d.ts.map +1 -0
- package/dist/builders/sqlite-global-rules-builder.js +2 -0
- package/dist/builders/sqlite-global-rules-builder.js.map +1 -0
- package/dist/builders/sqlite-ledger-builder.d.ts +21 -0
- package/dist/builders/sqlite-ledger-builder.d.ts.map +1 -0
- package/dist/builders/sqlite-ledger-builder.js +2 -0
- package/dist/builders/sqlite-ledger-builder.js.map +1 -0
- package/dist/builders/sqlite-lessons-builder.d.ts +18 -0
- package/dist/builders/sqlite-lessons-builder.d.ts.map +1 -0
- package/dist/builders/sqlite-lessons-builder.js +2 -0
- package/dist/builders/sqlite-lessons-builder.js.map +1 -0
- package/dist/builders/sqlite-namespace-contract.d.ts +64 -0
- package/dist/builders/sqlite-namespace-contract.d.ts.map +1 -0
- package/dist/builders/sqlite-namespace-contract.js +2 -0
- package/dist/builders/sqlite-namespace-contract.js.map +1 -0
- package/dist/builders/sqlite-namespace.d.ts +9 -0
- package/dist/builders/sqlite-namespace.d.ts.map +1 -0
- package/dist/builders/sqlite-namespace.js +17 -0
- package/dist/builders/sqlite-namespace.js.map +1 -0
- package/dist/builders/sqlite-topology-builder.d.ts +18 -0
- package/dist/builders/sqlite-topology-builder.d.ts.map +1 -0
- package/dist/builders/sqlite-topology-builder.js +2 -0
- package/dist/builders/sqlite-topology-builder.js.map +1 -0
- package/dist/ddl/internal/open-sqlite-connection.d.ts +24 -0
- package/dist/ddl/internal/open-sqlite-connection.d.ts.map +1 -0
- package/dist/ddl/internal/open-sqlite-connection.js +65 -0
- package/dist/ddl/internal/open-sqlite-connection.js.map +1 -0
- package/dist/ddl/sqlite-schema.constants.d.ts +21 -0
- package/dist/ddl/sqlite-schema.constants.d.ts.map +1 -0
- package/dist/ddl/sqlite-schema.constants.js +134 -0
- package/dist/ddl/sqlite-schema.constants.js.map +1 -0
- package/dist/executors/create-sqlite-executors.d.ts +11 -0
- package/dist/executors/create-sqlite-executors.d.ts.map +1 -0
- package/dist/executors/create-sqlite-executors.js +38 -0
- package/dist/executors/create-sqlite-executors.js.map +1 -0
- package/dist/executors/sqlite-executors.constants.d.ts +9 -0
- package/dist/executors/sqlite-executors.constants.d.ts.map +1 -0
- package/dist/executors/sqlite-executors.constants.js +9 -0
- package/dist/executors/sqlite-executors.constants.js.map +1 -0
- package/dist/executors/sqlite-rules-source-executor.d.ts +15 -0
- package/dist/executors/sqlite-rules-source-executor.d.ts.map +1 -0
- package/dist/executors/sqlite-rules-source-executor.js +47 -0
- package/dist/executors/sqlite-rules-source-executor.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/stores/internal/admit-lesson-params.d.ts +16 -0
- package/dist/stores/internal/admit-lesson-params.d.ts.map +1 -0
- package/dist/stores/internal/admit-lesson-params.js +2 -0
- package/dist/stores/internal/admit-lesson-params.js.map +1 -0
- package/dist/stores/internal/compute-normalized-relevance.d.ts +47 -0
- package/dist/stores/internal/compute-normalized-relevance.d.ts.map +1 -0
- package/dist/stores/internal/compute-normalized-relevance.js +63 -0
- package/dist/stores/internal/compute-normalized-relevance.js.map +1 -0
- package/dist/stores/internal/mark-frame-tombstone-params.d.ts +16 -0
- package/dist/stores/internal/mark-frame-tombstone-params.d.ts.map +1 -0
- package/dist/stores/internal/mark-frame-tombstone-params.js +2 -0
- package/dist/stores/internal/mark-frame-tombstone-params.js.map +1 -0
- package/dist/stores/internal/record-terminal-receipt-params.d.ts +16 -0
- package/dist/stores/internal/record-terminal-receipt-params.d.ts.map +1 -0
- package/dist/stores/internal/record-terminal-receipt-params.js +2 -0
- package/dist/stores/internal/record-terminal-receipt-params.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-compaction-ops.d.ts +14 -0
- package/dist/stores/internal/sqlite-ledger-compaction-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-compaction-ops.js +29 -0
- package/dist/stores/internal/sqlite-ledger-compaction-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-fork-operations.d.ts +33 -0
- package/dist/stores/internal/sqlite-ledger-fork-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-fork-operations.js +44 -0
- package/dist/stores/internal/sqlite-ledger-fork-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-frame-operations.d.ts +24 -0
- package/dist/stores/internal/sqlite-ledger-frame-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-frame-operations.js +40 -0
- package/dist/stores/internal/sqlite-ledger-frame-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-frame-ops.d.ts +50 -0
- package/dist/stores/internal/sqlite-ledger-frame-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-frame-ops.js +90 -0
- package/dist/stores/internal/sqlite-ledger-frame-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-plan-and-fork-ops.d.ts +59 -0
- package/dist/stores/internal/sqlite-ledger-plan-and-fork-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-plan-and-fork-ops.js +90 -0
- package/dist/stores/internal/sqlite-ledger-plan-and-fork-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-plan-operations.d.ts +40 -0
- package/dist/stores/internal/sqlite-ledger-plan-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-plan-operations.js +39 -0
- package/dist/stores/internal/sqlite-ledger-plan-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-run-operations.d.ts +41 -0
- package/dist/stores/internal/sqlite-ledger-run-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-run-operations.js +89 -0
- package/dist/stores/internal/sqlite-ledger-run-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-run-ops.d.ts +58 -0
- package/dist/stores/internal/sqlite-ledger-run-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-run-ops.js +80 -0
- package/dist/stores/internal/sqlite-ledger-run-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-step-operations.d.ts +28 -0
- package/dist/stores/internal/sqlite-ledger-step-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-step-operations.js +53 -0
- package/dist/stores/internal/sqlite-ledger-step-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-step-ops.d.ts +47 -0
- package/dist/stores/internal/sqlite-ledger-step-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-step-ops.js +89 -0
- package/dist/stores/internal/sqlite-ledger-step-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-lesson-ops.d.ts +100 -0
- package/dist/stores/internal/sqlite-lesson-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-lesson-ops.js +178 -0
- package/dist/stores/internal/sqlite-lesson-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-lesson-row.d.ts +28 -0
- package/dist/stores/internal/sqlite-lesson-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-lesson-row.js +2 -0
- package/dist/stores/internal/sqlite-lesson-row.js.map +1 -0
- package/dist/stores/internal/sqlite-overlay-step-mutation-entry.d.ts +21 -0
- package/dist/stores/internal/sqlite-overlay-step-mutation-entry.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-overlay-step-mutation-entry.js +2 -0
- package/dist/stores/internal/sqlite-overlay-step-mutation-entry.js.map +1 -0
- package/dist/stores/internal/sqlite-run-row.d.ts +36 -0
- package/dist/stores/internal/sqlite-run-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-run-row.js +2 -0
- package/dist/stores/internal/sqlite-run-row.js.map +1 -0
- package/dist/stores/internal/sqlite-step-row.d.ts +32 -0
- package/dist/stores/internal/sqlite-step-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-step-row.js +2 -0
- package/dist/stores/internal/sqlite-step-row.js.map +1 -0
- package/dist/stores/internal/sqlite-suspended-fork-row.d.ts +22 -0
- package/dist/stores/internal/sqlite-suspended-fork-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-suspended-fork-row.js +2 -0
- package/dist/stores/internal/sqlite-suspended-fork-row.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-base-row.d.ts +18 -0
- package/dist/stores/internal/sqlite-topology-base-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-base-row.js +2 -0
- package/dist/stores/internal/sqlite-topology-base-row.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-commit-ops.d.ts +37 -0
- package/dist/stores/internal/sqlite-topology-commit-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-commit-ops.js +58 -0
- package/dist/stores/internal/sqlite-topology-commit-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-commit.d.ts +25 -0
- package/dist/stores/internal/sqlite-topology-overlay-commit.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-commit.js +51 -0
- package/dist/stores/internal/sqlite-topology-overlay-commit.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-ops.d.ts +61 -0
- package/dist/stores/internal/sqlite-topology-overlay-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-ops.js +156 -0
- package/dist/stores/internal/sqlite-topology-overlay-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-row.d.ts +40 -0
- package/dist/stores/internal/sqlite-topology-overlay-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-row.js +2 -0
- package/dist/stores/internal/sqlite-topology-overlay-row.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-sync.d.ts +72 -0
- package/dist/stores/internal/sqlite-topology-overlay-sync.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-sync.js +116 -0
- package/dist/stores/internal/sqlite-topology-overlay-sync.js.map +1 -0
- package/dist/stores/internal/sqlite-wire-frame-row.d.ts +26 -0
- package/dist/stores/internal/sqlite-wire-frame-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-wire-frame-row.js +2 -0
- package/dist/stores/internal/sqlite-wire-frame-row.js.map +1 -0
- package/dist/stores/internal/three-way-merge-contract.d.ts +25 -0
- package/dist/stores/internal/three-way-merge-contract.d.ts.map +1 -0
- package/dist/stores/internal/three-way-merge-contract.js +76 -0
- package/dist/stores/internal/three-way-merge-contract.js.map +1 -0
- package/dist/stores/internal/update-continuation-stack-params.d.ts +17 -0
- package/dist/stores/internal/update-continuation-stack-params.d.ts.map +1 -0
- package/dist/stores/internal/update-continuation-stack-params.js +2 -0
- package/dist/stores/internal/update-continuation-stack-params.js.map +1 -0
- package/dist/stores/internal/update-contract-in-overlay-params.d.ts +16 -0
- package/dist/stores/internal/update-contract-in-overlay-params.d.ts.map +1 -0
- package/dist/stores/internal/update-contract-in-overlay-params.js +2 -0
- package/dist/stores/internal/update-contract-in-overlay-params.js.map +1 -0
- package/dist/stores/internal/validate-lane-dag.d.ts +59 -0
- package/dist/stores/internal/validate-lane-dag.d.ts.map +1 -0
- package/dist/stores/internal/validate-lane-dag.js +117 -0
- package/dist/stores/internal/validate-lane-dag.js.map +1 -0
- package/dist/stores/sqlite-ledger-store.d.ts +222 -0
- package/dist/stores/sqlite-ledger-store.d.ts.map +1 -0
- package/dist/stores/sqlite-ledger-store.js +295 -0
- package/dist/stores/sqlite-ledger-store.js.map +1 -0
- package/dist/stores/sqlite-lesson-store.d.ts +96 -0
- package/dist/stores/sqlite-lesson-store.d.ts.map +1 -0
- package/dist/stores/sqlite-lesson-store.js +121 -0
- package/dist/stores/sqlite-lesson-store.js.map +1 -0
- package/dist/stores/sqlite-topology-store.d.ts +112 -0
- package/dist/stores/sqlite-topology-store.d.ts.map +1 -0
- package/dist/stores/sqlite-topology-store.js +137 -0
- package/dist/stores/sqlite-topology-store.js.map +1 -0
- package/package.json +70 -3
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import PQueue from 'p-queue';
|
|
2
|
+
import { openSqliteConnection } from '../ddl/internal/open-sqlite-connection.js';
|
|
3
|
+
import { admitLessonInSqlite, markLessonSignalEmittedInSqlite, queryLessonCandidatesInSqlite, recordLessonOutcomesInSqlite, retireLessonsInSqlite, syncLessonEpochsInSqlite, } from './internal/sqlite-lesson-ops.js';
|
|
4
|
+
/**
|
|
5
|
+
* WAL-mode SQLite implementation of the `@paraharness/core` `LessonStore` runtime port.
|
|
6
|
+
*
|
|
7
|
+
* Persists distilled empirical lessons, computes normalized candidate relevance $R(L, Q) \in [0, 1]$,
|
|
8
|
+
* tracks 4-state execution outcomes, synchronizes creation epochs, and enforces signal cooldowns.
|
|
9
|
+
*/
|
|
10
|
+
export class SqliteLessonStore {
|
|
11
|
+
/** Underlying `better-sqlite3` database connection. */
|
|
12
|
+
db;
|
|
13
|
+
/** Single-concurrency FIFO queue serializing asynchronous store operations. */
|
|
14
|
+
queue = new PQueue({ concurrency: 1 });
|
|
15
|
+
/**
|
|
16
|
+
* Initializes a `SqliteLessonStore` against a SQLite file path, `:memory:`, or existing `Database` handle.
|
|
17
|
+
*
|
|
18
|
+
* Applies WAL-mode PRAGMAs and idempotent lesson store DDL statements on initialization.
|
|
19
|
+
*
|
|
20
|
+
* @param {string | Database.Database} uriOrDb - SQLite database URI or open `better-sqlite3` handle.
|
|
21
|
+
*/
|
|
22
|
+
constructor(uriOrDb) {
|
|
23
|
+
this.db = openSqliteConnection(uriOrDb);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Queries non-retired candidate lessons relevant to `req.queryText` and `req.partitions`.
|
|
27
|
+
*
|
|
28
|
+
* Populates `relevanceScore` in `[0, 1]` on each returned `LessonRecord`.
|
|
29
|
+
*
|
|
30
|
+
* @param {QueryLessonCandidatesParams} req - Search query and active partitions.
|
|
31
|
+
*
|
|
32
|
+
* @returns {Promise<readonly LessonRecord[]>} Candidate lesson records with `relevanceScore` populated.
|
|
33
|
+
*/
|
|
34
|
+
queryCandidates(req) {
|
|
35
|
+
return this.queue.add(() => queryLessonCandidatesInSqlite(this.db, req));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Persists a newly distilled lesson into the store and returns its assigned `lessonId`.
|
|
39
|
+
*
|
|
40
|
+
* Deduplicates identical `(partition, directive)` entries and records `epochAtCreation` and `createdByRunId`.
|
|
41
|
+
*
|
|
42
|
+
* @param {AdmitLessonParams} lesson - Lesson definition to admit.
|
|
43
|
+
*
|
|
44
|
+
* @returns {Promise<string>} Newly assigned or content-addressed `lessonId`.
|
|
45
|
+
*/
|
|
46
|
+
admit(lesson) {
|
|
47
|
+
return this.queue.add(() => this.db.transaction(() => admitLessonInSqlite(this.db, lesson))());
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Appends deduplicated step execution outcomes to the specified lessons and returns their updated records.
|
|
51
|
+
*
|
|
52
|
+
* Increments `totalCleanPasses` or `totalViolated` and updates each lesson's `recentOutcomes` window.
|
|
53
|
+
*
|
|
54
|
+
* @param {readonly LessonOutcomeEntryParams[]} outcomes - Batch of `(lessonId, outcome)` pairs.
|
|
55
|
+
*
|
|
56
|
+
* @returns {Promise<readonly LessonRecord[]>} Updated lesson records reflecting the recorded outcomes.
|
|
57
|
+
*/
|
|
58
|
+
recordOutcomes(outcomes) {
|
|
59
|
+
return this.queue.add(() => this.db.transaction(() => recordLessonOutcomesInSqlite(this.db, outcomes))());
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Aligns `epochAtCreation` for lessons created by `runIds` when their topology overlays commit to the base store.
|
|
63
|
+
*
|
|
64
|
+
* Prevents lessons authored in a run that also updated a partition's contract from being falsely penalized for epoch drift.
|
|
65
|
+
*
|
|
66
|
+
* @param {readonly string[]} runIds - Run IDs whose topology overlays were committed.
|
|
67
|
+
* @param {ReadonlyMap<string, number>} updatedEpochs - Map of `partitionId` to newly committed base epoch.
|
|
68
|
+
*
|
|
69
|
+
* @returns {Promise<void>} Resolves when creation epochs are synchronized.
|
|
70
|
+
*/
|
|
71
|
+
syncCreationEpochsForRuns(runIds, updatedEpochs) {
|
|
72
|
+
return this.queue.add(() => {
|
|
73
|
+
this.db.transaction(() => syncLessonEpochsInSqlite(this.db, runIds, updatedEpochs))();
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Records the ISO-8601 timestamp when a promotion signal was emitted for `lessonId`.
|
|
78
|
+
*
|
|
79
|
+
* Persists the timestamp in `signalLastEmittedAt[signalId]` to enforce `cooldownHours` across restarts.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} lessonId - Identifier of the lesson that triggered the signal.
|
|
82
|
+
* @param {string} signalId - Identifier of the emitted signal.
|
|
83
|
+
* @param {string} emittedAt - ISO-8601 timestamp string of the emission.
|
|
84
|
+
*
|
|
85
|
+
* @returns {Promise<void>} Resolves when the cooldown timestamp is persisted.
|
|
86
|
+
*/
|
|
87
|
+
markSignalEmitted(lessonId, signalId, emittedAt) {
|
|
88
|
+
return this.queue.add(() => {
|
|
89
|
+
this.db.transaction(() => {
|
|
90
|
+
markLessonSignalEmittedInSqlite(this.db, { lessonId, signalId, emittedAt });
|
|
91
|
+
})();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Permanently retires lessons that breached violation or low clean-pass-rate thresholds.
|
|
96
|
+
*
|
|
97
|
+
* Excludes retired lessons from all subsequent `queryCandidates()` recalls.
|
|
98
|
+
*
|
|
99
|
+
* @param {readonly string[]} lessonIds - Identifiers of lessons to retire.
|
|
100
|
+
*
|
|
101
|
+
* @returns {Promise<void>} Resolves when all specified lessons are retired.
|
|
102
|
+
*/
|
|
103
|
+
retire(lessonIds) {
|
|
104
|
+
return this.queue.add(() => {
|
|
105
|
+
this.db.transaction(() => {
|
|
106
|
+
retireLessonsInSqlite(this.db, lessonIds);
|
|
107
|
+
})();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Closes the underlying `better-sqlite3` database connection.
|
|
112
|
+
*
|
|
113
|
+
* Releases file descriptors and WAL shared-memory locks held by this store instance.
|
|
114
|
+
*
|
|
115
|
+
* @returns {void} Returns nothing once the connection is closed.
|
|
116
|
+
*/
|
|
117
|
+
close() {
|
|
118
|
+
this.db.close();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=sqlite-lesson-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-lesson-store.js","sourceRoot":"","sources":["../../src/stores/sqlite-lesson-store.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAGL,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAC5B,uDAAuD;IACtC,EAAE,CAAoB;IACvC,+EAA+E;IAC9D,KAAK,GAAG,IAAI,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC;IAExD;;;;;;OAMG;IACH,YAAY,OAAmC;QAC7C,IAAI,CAAC,EAAE,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;OAQG;IACH,eAAe,CAAC,GAAgC;QAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAyB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IACjG,CAAC;IAED;;;;;;;;OAQG;IACH,cAAc,CAAC,QAA6C;QAC1D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CACzB,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,EAAE,CAC7E,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACH,yBAAyB,CACvB,MAAyB,EACzB,aAA0C;QAE1C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACzB,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC;QACxF,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,QAAgB,EAAE,QAAgB,EAAE,SAAiB;QACrE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACzB,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;gBACvB,+BAA+B,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YAC9E,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,SAA4B;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACzB,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;gBACvB,qBAAqB,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YAC5C,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { CommitRunOverlayResult, TopologyPartitionState, TopologyStore } from '@paraharness/core';
|
|
2
|
+
import type Database from 'better-sqlite3';
|
|
3
|
+
import { type ResetRunOverlayOptions } from './internal/sqlite-topology-overlay-ops.js';
|
|
4
|
+
/**
|
|
5
|
+
* WAL-mode SQLite implementation of the `@paraharness/core` `TopologyStore` runtime port.
|
|
6
|
+
*
|
|
7
|
+
* Manages canonical base partition contracts alongside per-run Copy-on-Write overlays,
|
|
8
|
+
* stacked prerequisite synchronization, step/run-scoped resets, and 3-way overlay commits.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SqliteTopologyStore implements TopologyStore {
|
|
11
|
+
/** Underlying `better-sqlite3` database connection. */
|
|
12
|
+
private readonly db;
|
|
13
|
+
/** Single-concurrency FIFO queue serializing asynchronous store operations. */
|
|
14
|
+
private readonly queue;
|
|
15
|
+
/**
|
|
16
|
+
* Initializes a `SqliteTopologyStore` against a SQLite file path, `:memory:`, or existing `Database` handle.
|
|
17
|
+
*
|
|
18
|
+
* Applies WAL-mode PRAGMAs and idempotent topology DDL statements on initialization.
|
|
19
|
+
*
|
|
20
|
+
* @param {string | Database.Database} uriOrDb - SQLite database URI or open `better-sqlite3` handle.
|
|
21
|
+
*/
|
|
22
|
+
constructor(uriOrDb: string | Database.Database);
|
|
23
|
+
/**
|
|
24
|
+
* Loads the partition state map for `runId` (merging any uncommitted per-run CoW overlay over the base store).
|
|
25
|
+
*
|
|
26
|
+
* Pins each partition's initial `baseContractTextAtAcquire` when `runId` first inspects the partition.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} [runId] - Optional active flow run identifier.
|
|
29
|
+
*
|
|
30
|
+
* @returns {Promise<ReadonlyMap<string, TopologyPartitionState>>} Map of `partitionId` to partition state.
|
|
31
|
+
*/
|
|
32
|
+
getPartitions(runId?: string): Promise<ReadonlyMap<string, TopologyPartitionState>>;
|
|
33
|
+
/**
|
|
34
|
+
* Writes a contract update to `runId`'s isolated Copy-on-Write overlay.
|
|
35
|
+
*
|
|
36
|
+
* Increments the partition's overlay epoch at most once per `(runId, partitionId)` unless reset
|
|
37
|
+
* by `resetRunOverlay()`, and tags the mutation with `stepExecId` for step-scoped rollback.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} runId - Active flow run identifier.
|
|
40
|
+
* @param {string} partitionId - Target partition identifier.
|
|
41
|
+
* @param {string} newContractText - Updated contract text.
|
|
42
|
+
* @param {string} [stepExecId] - Optional active step execution identifier.
|
|
43
|
+
*
|
|
44
|
+
* @returns {Promise<{ readonly newEpoch: number }>} Updated overlay epoch for `partitionId`.
|
|
45
|
+
*/
|
|
46
|
+
updateContract(runId: string, partitionId: string, newContractText: string, stepExecId?: string): Promise<{
|
|
47
|
+
readonly newEpoch: number;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Merges prerequisite runs' `ACTIVE` or `SEALED_UNMERGED` overlays into `targetRunId`'s overlay.
|
|
51
|
+
*
|
|
52
|
+
* Advances `targetRunId`'s 3-way merge-base text for each absorbed partition so stacked PRs
|
|
53
|
+
* never false-conflict when committed sequentially.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} targetRunId - Dependent run absorbing the prerequisite overlays.
|
|
56
|
+
* @param {readonly string[]} prerequisiteRunIds - Prerequisite run identifiers to merge from.
|
|
57
|
+
*
|
|
58
|
+
* @returns {Promise<void>} Resolves once prerequisite overlays are merged.
|
|
59
|
+
*/
|
|
60
|
+
syncRunOverlays(targetRunId: string, prerequisiteRunIds: readonly string[]): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Resets uncommitted overlay mutations for `runId` at either the `'step'` or `'run'` scope.
|
|
63
|
+
*
|
|
64
|
+
* Preserves completed step mutations when `scope === 'step'` and rolls back the entire run overlay when `scope === 'run'`.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} runId - Target flow run identifier.
|
|
67
|
+
* @param {ResetRunOverlayOptions} [opts] - Reset scope options.
|
|
68
|
+
*
|
|
69
|
+
* @returns {Promise<void>} Resolves once matching uncommitted overlay mutations are rolled back.
|
|
70
|
+
*/
|
|
71
|
+
resetRunOverlay(runId: string, opts?: ResetRunOverlayOptions): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Transitions `runId`'s overlay to `SEALED_UNMERGED` upon flow exit `'done'` when awaiting an external merge signal.
|
|
74
|
+
*
|
|
75
|
+
* Allows dependent stacked runs to absorb the sealed overlay via `syncRunOverlays` without polluting the base store.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} runId - Completed flow run identifier.
|
|
78
|
+
*
|
|
79
|
+
* @returns {Promise<void>} Resolves once the overlay is sealed.
|
|
80
|
+
*/
|
|
81
|
+
sealRunOverlay(runId: string): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Atomically commits `runId`'s overlay (and any absorbed ancestor/prerequisite `SEALED_UNMERGED` overlays)
|
|
84
|
+
* to the base store using a 3-way merge against `baseContractTextAtAcquire`.
|
|
85
|
+
*
|
|
86
|
+
* Allocates monotonic base epoch numbers at commit time and returns the committed run IDs and updated epochs.
|
|
87
|
+
*
|
|
88
|
+
* @param {string} runId - Flow run identifier whose changes landed.
|
|
89
|
+
*
|
|
90
|
+
* @returns {Promise<CommitRunOverlayResult>} Committed run IDs and newly allocated base epoch numbers.
|
|
91
|
+
*/
|
|
92
|
+
commitRunOverlay(runId: string): Promise<CommitRunOverlayResult>;
|
|
93
|
+
/**
|
|
94
|
+
* Discards `runId`'s overlay when a run fails, a PR closes unmerged, or `maxSealedAgeHours` expires.
|
|
95
|
+
*
|
|
96
|
+
* Removes all uncommitted or sealed overlay rows for `runId` without modifying the base store.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} runId - Flow run identifier whose overlay should be discarded.
|
|
99
|
+
*
|
|
100
|
+
* @returns {Promise<void>} Resolves once the overlay is removed.
|
|
101
|
+
*/
|
|
102
|
+
discardRunOverlay(runId: string): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Closes the underlying `better-sqlite3` database connection.
|
|
105
|
+
*
|
|
106
|
+
* Releases file descriptors and WAL shared-memory locks held by this store instance.
|
|
107
|
+
*
|
|
108
|
+
* @returns {void} Returns nothing once the connection is closed.
|
|
109
|
+
*/
|
|
110
|
+
close(): void;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=sqlite-topology-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-topology-store.d.ts","sourceRoot":"","sources":["../../src/stores/sqlite-topology-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAQ3C,OAAO,EACL,KAAK,sBAAsB,EAK5B,MAAM,2CAA2C,CAAC;AAEnD;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,aAAa;IACvD,uDAAuD;IACvD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IACvC,+EAA+E;IAC/E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkC;IAExD;;;;;;OAMG;gBACS,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ;IAI/C;;;;;;;;OAQG;IACH,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAMnF;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAQzC;;;;;;;;;;OAUG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1F;;;;;;;;;OASG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5E;;;;;;;;OAQG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5C;;;;;;;;;OASG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAMhE;;;;;;;;OAQG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/C;;;;;;OAMG;IACH,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import PQueue from 'p-queue';
|
|
2
|
+
import { openSqliteConnection } from '../ddl/internal/open-sqlite-connection.js';
|
|
3
|
+
import { commitOverlayThreeWayMerge, discardOverlayForRun, sealOverlayForRun, } from './internal/sqlite-topology-commit-ops.js';
|
|
4
|
+
import { getPartitionsWithOverlay, resetOverlayByScope, syncPrerequisiteOverlays, updateContractInOverlay, } from './internal/sqlite-topology-overlay-ops.js';
|
|
5
|
+
/**
|
|
6
|
+
* WAL-mode SQLite implementation of the `@paraharness/core` `TopologyStore` runtime port.
|
|
7
|
+
*
|
|
8
|
+
* Manages canonical base partition contracts alongside per-run Copy-on-Write overlays,
|
|
9
|
+
* stacked prerequisite synchronization, step/run-scoped resets, and 3-way overlay commits.
|
|
10
|
+
*/
|
|
11
|
+
export class SqliteTopologyStore {
|
|
12
|
+
/** Underlying `better-sqlite3` database connection. */
|
|
13
|
+
db;
|
|
14
|
+
/** Single-concurrency FIFO queue serializing asynchronous store operations. */
|
|
15
|
+
queue = new PQueue({ concurrency: 1 });
|
|
16
|
+
/**
|
|
17
|
+
* Initializes a `SqliteTopologyStore` against a SQLite file path, `:memory:`, or existing `Database` handle.
|
|
18
|
+
*
|
|
19
|
+
* Applies WAL-mode PRAGMAs and idempotent topology DDL statements on initialization.
|
|
20
|
+
*
|
|
21
|
+
* @param {string | Database.Database} uriOrDb - SQLite database URI or open `better-sqlite3` handle.
|
|
22
|
+
*/
|
|
23
|
+
constructor(uriOrDb) {
|
|
24
|
+
this.db = openSqliteConnection(uriOrDb);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Loads the partition state map for `runId` (merging any uncommitted per-run CoW overlay over the base store).
|
|
28
|
+
*
|
|
29
|
+
* Pins each partition's initial `baseContractTextAtAcquire` when `runId` first inspects the partition.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} [runId] - Optional active flow run identifier.
|
|
32
|
+
*
|
|
33
|
+
* @returns {Promise<ReadonlyMap<string, TopologyPartitionState>>} Map of `partitionId` to partition state.
|
|
34
|
+
*/
|
|
35
|
+
getPartitions(runId) {
|
|
36
|
+
return this.queue.add(() => this.db.transaction(() => getPartitionsWithOverlay(this.db, runId))());
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Writes a contract update to `runId`'s isolated Copy-on-Write overlay.
|
|
40
|
+
*
|
|
41
|
+
* Increments the partition's overlay epoch at most once per `(runId, partitionId)` unless reset
|
|
42
|
+
* by `resetRunOverlay()`, and tags the mutation with `stepExecId` for step-scoped rollback.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} runId - Active flow run identifier.
|
|
45
|
+
* @param {string} partitionId - Target partition identifier.
|
|
46
|
+
* @param {string} newContractText - Updated contract text.
|
|
47
|
+
* @param {string} [stepExecId] - Optional active step execution identifier.
|
|
48
|
+
*
|
|
49
|
+
* @returns {Promise<{ readonly newEpoch: number }>} Updated overlay epoch for `partitionId`.
|
|
50
|
+
*/
|
|
51
|
+
updateContract(runId, partitionId, newContractText, stepExecId) {
|
|
52
|
+
return this.queue.add(() => this.db.transaction(() => updateContractInOverlay(this.db, { runId, partitionId, newContractText, stepExecId }))());
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Merges prerequisite runs' `ACTIVE` or `SEALED_UNMERGED` overlays into `targetRunId`'s overlay.
|
|
56
|
+
*
|
|
57
|
+
* Advances `targetRunId`'s 3-way merge-base text for each absorbed partition so stacked PRs
|
|
58
|
+
* never false-conflict when committed sequentially.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} targetRunId - Dependent run absorbing the prerequisite overlays.
|
|
61
|
+
* @param {readonly string[]} prerequisiteRunIds - Prerequisite run identifiers to merge from.
|
|
62
|
+
*
|
|
63
|
+
* @returns {Promise<void>} Resolves once prerequisite overlays are merged.
|
|
64
|
+
*/
|
|
65
|
+
syncRunOverlays(targetRunId, prerequisiteRunIds) {
|
|
66
|
+
return this.queue.add(() => {
|
|
67
|
+
this.db.transaction(() => syncPrerequisiteOverlays(this.db, targetRunId, prerequisiteRunIds))();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resets uncommitted overlay mutations for `runId` at either the `'step'` or `'run'` scope.
|
|
72
|
+
*
|
|
73
|
+
* Preserves completed step mutations when `scope === 'step'` and rolls back the entire run overlay when `scope === 'run'`.
|
|
74
|
+
*
|
|
75
|
+
* @param {string} runId - Target flow run identifier.
|
|
76
|
+
* @param {ResetRunOverlayOptions} [opts] - Reset scope options.
|
|
77
|
+
*
|
|
78
|
+
* @returns {Promise<void>} Resolves once matching uncommitted overlay mutations are rolled back.
|
|
79
|
+
*/
|
|
80
|
+
resetRunOverlay(runId, opts) {
|
|
81
|
+
return this.queue.add(() => {
|
|
82
|
+
this.db.transaction(() => resetOverlayByScope(this.db, runId, opts))();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Transitions `runId`'s overlay to `SEALED_UNMERGED` upon flow exit `'done'` when awaiting an external merge signal.
|
|
87
|
+
*
|
|
88
|
+
* Allows dependent stacked runs to absorb the sealed overlay via `syncRunOverlays` without polluting the base store.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} runId - Completed flow run identifier.
|
|
91
|
+
*
|
|
92
|
+
* @returns {Promise<void>} Resolves once the overlay is sealed.
|
|
93
|
+
*/
|
|
94
|
+
sealRunOverlay(runId) {
|
|
95
|
+
return this.queue.add(() => {
|
|
96
|
+
sealOverlayForRun(this.db, runId);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Atomically commits `runId`'s overlay (and any absorbed ancestor/prerequisite `SEALED_UNMERGED` overlays)
|
|
101
|
+
* to the base store using a 3-way merge against `baseContractTextAtAcquire`.
|
|
102
|
+
*
|
|
103
|
+
* Allocates monotonic base epoch numbers at commit time and returns the committed run IDs and updated epochs.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} runId - Flow run identifier whose changes landed.
|
|
106
|
+
*
|
|
107
|
+
* @returns {Promise<CommitRunOverlayResult>} Committed run IDs and newly allocated base epoch numbers.
|
|
108
|
+
*/
|
|
109
|
+
commitRunOverlay(runId) {
|
|
110
|
+
return this.queue.add(() => this.db.transaction(() => commitOverlayThreeWayMerge(this.db, runId))());
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Discards `runId`'s overlay when a run fails, a PR closes unmerged, or `maxSealedAgeHours` expires.
|
|
114
|
+
*
|
|
115
|
+
* Removes all uncommitted or sealed overlay rows for `runId` without modifying the base store.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} runId - Flow run identifier whose overlay should be discarded.
|
|
118
|
+
*
|
|
119
|
+
* @returns {Promise<void>} Resolves once the overlay is removed.
|
|
120
|
+
*/
|
|
121
|
+
discardRunOverlay(runId) {
|
|
122
|
+
return this.queue.add(() => {
|
|
123
|
+
discardOverlayForRun(this.db, runId);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Closes the underlying `better-sqlite3` database connection.
|
|
128
|
+
*
|
|
129
|
+
* Releases file descriptors and WAL shared-memory locks held by this store instance.
|
|
130
|
+
*
|
|
131
|
+
* @returns {void} Returns nothing once the connection is closed.
|
|
132
|
+
*/
|
|
133
|
+
close() {
|
|
134
|
+
this.db.close();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=sqlite-topology-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-topology-store.js","sourceRoot":"","sources":["../../src/stores/sqlite-topology-store.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraharness/sqlite",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "WAL-mode SQLite runtime drivers for Paraharness LedgerStore, Copy-on-Write TopologyStore, LessonStore, and global rules sources.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"paraharness",
|
|
7
|
+
"sqlite",
|
|
8
|
+
"better-sqlite3",
|
|
9
|
+
"ledger",
|
|
10
|
+
"topology",
|
|
11
|
+
"lessons",
|
|
12
|
+
"ai-agents"
|
|
13
|
+
],
|
|
14
|
+
"author": "Tornike Tsomaia",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"homepage": "https://paraharness.github.io/paraharness/modules/_paraharness_sqlite.html",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/paraharness/paraharness.git",
|
|
20
|
+
"directory": "packages/sqlite"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/paraharness/paraharness/issues"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md",
|
|
38
|
+
"LICENSE"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=22.0.0"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@dagrejs/graphlib": "^4.0.7",
|
|
48
|
+
"better-sqlite3": "^12.8.0",
|
|
49
|
+
"minisearch": "^7.2.0",
|
|
50
|
+
"node-diff3": "^3.2.1",
|
|
51
|
+
"p-queue": "^9.1.0",
|
|
52
|
+
"zod": "^4.6.7",
|
|
53
|
+
"@paraharness/core": "0.1.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/better-sqlite3": "^9.6.0",
|
|
57
|
+
"@types/node": "^22.9.0",
|
|
58
|
+
"typescript": "^5.8.2",
|
|
59
|
+
"vitest": "^3.2.0"
|
|
60
|
+
},
|
|
61
|
+
"typedocOptions": {
|
|
62
|
+
"entryPoints": [
|
|
63
|
+
"src/index.ts"
|
|
64
|
+
],
|
|
65
|
+
"tsconfig": "tsconfig.build.json"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "tsc -p tsconfig.build.json",
|
|
69
|
+
"lint": "eslint \"{src,test}/**/*.ts\"",
|
|
70
|
+
"typecheck": "tsc --noEmit",
|
|
71
|
+
"test": "vitest run --config ../../vitest.config.ts --dir . --passWithNoTests"
|
|
72
|
+
}
|
|
6
73
|
}
|