@effect-agent/storage-sqlite 0.0.1-beta.2 → 0.0.1-beta.4
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/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/errors.ts +9 -9
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel van der Merwe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.mjs
CHANGED
|
@@ -5,19 +5,19 @@ import * as SqlClient from "effect/unstable/sql/SqlClient";
|
|
|
5
5
|
import { NodeCrypto } from "@effect/platform-node";
|
|
6
6
|
//#region src/errors.ts
|
|
7
7
|
/** The SQLite file uses a private-development format this adapter cannot read. */
|
|
8
|
-
var SqliteStorageCompatibilityError = class extends Schema.
|
|
8
|
+
var SqliteStorageCompatibilityError = class extends Schema.TaggedErrorClass()("SqliteStorageCompatibilityError", {
|
|
9
9
|
actualVersion: Schema.Int,
|
|
10
10
|
message: Schema.String,
|
|
11
11
|
supportedVersion: Schema.Int
|
|
12
12
|
}) {};
|
|
13
13
|
/** Stored bytes failed the current Schema and cannot be used as recovery truth. */
|
|
14
|
-
var SqliteStorageCorruptionError = class extends Schema.
|
|
14
|
+
var SqliteStorageCorruptionError = class extends Schema.TaggedErrorClass()("SqliteStorageCorruptionError", {
|
|
15
15
|
message: Schema.String,
|
|
16
16
|
rowKey: Schema.String,
|
|
17
17
|
table: Schema.String
|
|
18
18
|
}) {};
|
|
19
19
|
/** SQLite infrastructure failed while opening or operating the store. */
|
|
20
|
-
var SqliteStorageError = class extends Schema.
|
|
20
|
+
var SqliteStorageError = class extends Schema.TaggedErrorClass()("SqliteStorageError", {
|
|
21
21
|
cause: Schema.optionalKey(Schema.Defect()),
|
|
22
22
|
message: Schema.String,
|
|
23
23
|
operation: Schema.String
|
|
@@ -27,7 +27,7 @@ var SqliteStorageError = class extends Schema.TaggedError()("SqliteStorageError"
|
|
|
27
27
|
* SubmissionLedger port as the typed `LedgerError` with this error preserved as its cause,
|
|
28
28
|
* so the adapter-level tag is never erased.
|
|
29
29
|
*/
|
|
30
|
-
var SqliteLedgerError = class extends Schema.
|
|
30
|
+
var SqliteLedgerError = class extends Schema.TaggedErrorClass()("SqliteLedgerError", {
|
|
31
31
|
cause: Schema.optionalKey(Schema.Defect()),
|
|
32
32
|
message: Schema.String,
|
|
33
33
|
operation: Schema.String
|
|
@@ -36,7 +36,7 @@ var SqliteLedgerError = class extends Schema.TaggedError()("SqliteLedgerError",
|
|
|
36
36
|
* A canonical batch retry conflicts with existing append state. Tail conflicts carry the
|
|
37
37
|
* actual committed tail as a diagnostic resume hint.
|
|
38
38
|
*/
|
|
39
|
-
var SqliteAppendConflict = class extends Schema.
|
|
39
|
+
var SqliteAppendConflict = class extends Schema.TaggedErrorClass()("SqliteAppendConflict", {
|
|
40
40
|
message: Schema.String,
|
|
41
41
|
reason: Schema.Literals([
|
|
42
42
|
"batch-digest",
|
|
@@ -51,7 +51,7 @@ var SqliteAppendConflict = class extends Schema.TaggedError()("SqliteAppendConfl
|
|
|
51
51
|
* require the exact registered epoch, so both older and newer unregistered epochs are fenced;
|
|
52
52
|
* a newer epoch takes over by materializing first.
|
|
53
53
|
*/
|
|
54
|
-
var SqliteFenceRejected = class extends Schema.
|
|
54
|
+
var SqliteFenceRejected = class extends Schema.TaggedErrorClass()("SqliteFenceRejected", {
|
|
55
55
|
actualEpoch: ProducerEpoch,
|
|
56
56
|
message: Schema.String,
|
|
57
57
|
producerEpoch: ProducerEpoch
|
|
@@ -61,13 +61,13 @@ var SqliteFenceRejected = class extends Schema.TaggedError()("SqliteFenceRejecte
|
|
|
61
61
|
* timeout (SQLITE_BUSY / SQLITE_LOCKED). Another transiently coexisting owner is writing;
|
|
62
62
|
* the operation did not mutate canonical state and is safe to retry.
|
|
63
63
|
*/
|
|
64
|
-
var SqliteWriteContention = class extends Schema.
|
|
64
|
+
var SqliteWriteContention = class extends Schema.TaggedErrorClass()("SqliteWriteContention", {
|
|
65
65
|
cause: Schema.optionalKey(Schema.Defect()),
|
|
66
66
|
message: Schema.String,
|
|
67
67
|
operation: Schema.String
|
|
68
68
|
}) {};
|
|
69
69
|
/** A checkpoint conflicts with a previously stored checkpoint at the same offset. */
|
|
70
|
-
var SqliteCheckpointConflict = class extends Schema.
|
|
70
|
+
var SqliteCheckpointConflict = class extends Schema.TaggedErrorClass()("SqliteCheckpointConflict", { message: Schema.String }) {};
|
|
71
71
|
const SqliteStorageFailpointLocation = Schema.Literals([
|
|
72
72
|
"materialize:before",
|
|
73
73
|
"materialize:after",
|
|
@@ -123,7 +123,7 @@ const SqliteStorageFailpointLocation = Schema.Literals([
|
|
|
123
123
|
"ledger:child-settled:after"
|
|
124
124
|
]);
|
|
125
125
|
/** Deterministic test-only fault or pause injected at a SQLite operation boundary. */
|
|
126
|
-
var SqliteStorageFailpointError = class extends Schema.
|
|
126
|
+
var SqliteStorageFailpointError = class extends Schema.TaggedErrorClass()("SqliteStorageFailpointError", { location: SqliteStorageFailpointLocation }) {
|
|
127
127
|
get message() {
|
|
128
128
|
return `Injected SQLite storage failure at ${this.location}.`;
|
|
129
129
|
}
|