@effect-agent/storage-cloudflare 0.0.1-beta.0 → 0.0.1-beta.3
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 +13 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -13
- package/src/errors.ts +17 -14
- package/src/port-protocol.ts +1 -1
- package/src/routing.ts +2 -18
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
|
@@ -6,19 +6,19 @@ import { BrowserCrypto } from "@effect/platform-browser";
|
|
|
6
6
|
import { SqlError } from "effect/unstable/sql/SqlError";
|
|
7
7
|
//#region src/errors.ts
|
|
8
8
|
/** The Durable Object's SQLite storage uses a private-development format this adapter cannot read. */
|
|
9
|
-
var DoStorageCompatibilityError = class extends Schema.
|
|
9
|
+
var DoStorageCompatibilityError = class extends Schema.TaggedErrorClass()("DoStorageCompatibilityError", {
|
|
10
10
|
actualVersion: Schema.Int,
|
|
11
11
|
message: Schema.String,
|
|
12
12
|
supportedVersion: Schema.Int
|
|
13
13
|
}) {};
|
|
14
14
|
/** Stored bytes failed the current Schema and cannot be used as recovery truth. */
|
|
15
|
-
var DoStorageCorruptionError = class extends Schema.
|
|
15
|
+
var DoStorageCorruptionError = class extends Schema.TaggedErrorClass()("DoStorageCorruptionError", {
|
|
16
16
|
message: Schema.String,
|
|
17
17
|
rowKey: Schema.String,
|
|
18
18
|
table: Schema.String
|
|
19
19
|
}) {};
|
|
20
20
|
/** Durable Object SQLite infrastructure failed while opening or operating the store. */
|
|
21
|
-
var DoStorageError = class extends Schema.
|
|
21
|
+
var DoStorageError = class extends Schema.TaggedErrorClass()("DoStorageError", {
|
|
22
22
|
cause: Schema.optionalKey(Schema.Defect()),
|
|
23
23
|
message: Schema.String,
|
|
24
24
|
operation: Schema.String
|
|
@@ -28,7 +28,7 @@ var DoStorageError = class extends Schema.TaggedError()("DoStorageError", {
|
|
|
28
28
|
* at the SubmissionLedger port as the typed `LedgerError` with this error preserved as its
|
|
29
29
|
* cause, so the adapter-level tag is never erased.
|
|
30
30
|
*/
|
|
31
|
-
var DoLedgerError = class extends Schema.
|
|
31
|
+
var DoLedgerError = class extends Schema.TaggedErrorClass()("DoLedgerError", {
|
|
32
32
|
cause: Schema.optionalKey(Schema.Defect()),
|
|
33
33
|
message: Schema.String,
|
|
34
34
|
operation: Schema.String
|
|
@@ -40,7 +40,7 @@ var DoLedgerError = class extends Schema.TaggedError()("DoLedgerError", {
|
|
|
40
40
|
* Payloads of this size are the designed overflow case for a future R2-backed AttachmentStore
|
|
41
41
|
* (deployment spec §3.1, deferred until a real attachment requirement exists).
|
|
42
42
|
*/
|
|
43
|
-
var DoValueBoundExceeded = class extends Schema.
|
|
43
|
+
var DoValueBoundExceeded = class extends Schema.TaggedErrorClass()("DoValueBoundExceeded", {
|
|
44
44
|
actualBytes: Schema.Int,
|
|
45
45
|
maxBytes: Schema.Int,
|
|
46
46
|
operation: Schema.String
|
|
@@ -53,7 +53,7 @@ var DoValueBoundExceeded = class extends Schema.TaggedError()("DoValueBoundExcee
|
|
|
53
53
|
* A canonical batch retry conflicts with existing append state. Tail conflicts carry the
|
|
54
54
|
* actual committed tail as a diagnostic resume hint.
|
|
55
55
|
*/
|
|
56
|
-
var DoAppendConflict = class extends Schema.
|
|
56
|
+
var DoAppendConflict = class extends Schema.TaggedErrorClass()("DoAppendConflict", {
|
|
57
57
|
message: Schema.String,
|
|
58
58
|
reason: Schema.Literals([
|
|
59
59
|
"batch-digest",
|
|
@@ -68,13 +68,13 @@ var DoAppendConflict = class extends Schema.TaggedError()("DoAppendConflict", {
|
|
|
68
68
|
* require the exact registered epoch, so both older and newer unregistered epochs are fenced;
|
|
69
69
|
* a newer epoch takes over by materializing first.
|
|
70
70
|
*/
|
|
71
|
-
var DoFenceRejected = class extends Schema.
|
|
71
|
+
var DoFenceRejected = class extends Schema.TaggedErrorClass()("DoFenceRejected", {
|
|
72
72
|
actualEpoch: ProducerEpoch,
|
|
73
73
|
message: Schema.String,
|
|
74
74
|
producerEpoch: ProducerEpoch
|
|
75
75
|
}) {};
|
|
76
76
|
/** A checkpoint conflicts with a previously stored checkpoint at the same offset. */
|
|
77
|
-
var DoCheckpointConflict = class extends Schema.
|
|
77
|
+
var DoCheckpointConflict = class extends Schema.TaggedErrorClass()("DoCheckpointConflict", { message: Schema.String }) {};
|
|
78
78
|
/**
|
|
79
79
|
* Deterministic fault-injection locations at Durable Object storage operation boundaries.
|
|
80
80
|
*
|
|
@@ -138,7 +138,7 @@ const DoStorageFailpointLocation = Schema.Literals([
|
|
|
138
138
|
"ledger:child-settled:after"
|
|
139
139
|
]);
|
|
140
140
|
/** Deterministic test-only fault or pause injected at a Durable Object storage boundary. */
|
|
141
|
-
var DoStorageFailpointError = class extends Schema.
|
|
141
|
+
var DoStorageFailpointError = class extends Schema.TaggedErrorClass()("DoStorageFailpointError", { location: DoStorageFailpointLocation }) {
|
|
142
142
|
get message() {
|
|
143
143
|
return `Injected Durable Object storage failure at ${this.location}.`;
|
|
144
144
|
}
|
|
@@ -3237,7 +3237,7 @@ const boundPortDiagnostic = (value) => value.length > 4096 ? `${value.slice(0, M
|
|
|
3237
3237
|
* except `resolveAdmission`, which folds it into `AdmissionIndeterminate` because a
|
|
3238
3238
|
* non-answer is never proof of absence (SUB-031).
|
|
3239
3239
|
*/
|
|
3240
|
-
var PortProtocolError = class extends Schema.
|
|
3240
|
+
var PortProtocolError = class extends Schema.TaggedErrorClass()("PortProtocolError", { message: BoundedDiagnostic }) {};
|
|
3241
3241
|
/** Routed `SubmissionLedger.admit` — child establishment admits INTO the owning Object. */
|
|
3242
3242
|
var LedgerAdmitCall = class extends Schema.TaggedClass("@effect-agent/storage-cloudflare/LedgerAdmitCall")("LedgerAdmit", { request: AdmissionRequest }) {};
|
|
3243
3243
|
/** Routed `SubmissionLedger.markReady` for a Submission owned by another Object. */
|
|
@@ -3346,7 +3346,7 @@ const UUID_HEAD_PATTERN = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-f
|
|
|
3346
3346
|
* authority was unreachable, which is exactly the case `AdmissionIndeterminate` was
|
|
3347
3347
|
* specified for (SUB-031).
|
|
3348
3348
|
*/
|
|
3349
|
-
var PortTransportError = class extends Schema.
|
|
3349
|
+
var PortTransportError = class extends Schema.TaggedErrorClass()("PortTransportError", {
|
|
3350
3350
|
target: Schema.String,
|
|
3351
3351
|
message: Schema.String,
|
|
3352
3352
|
retryable: Schema.optionalKey(Schema.Boolean),
|
|
@@ -3518,19 +3518,8 @@ const makeRoutedLedgerServices = Effect.fn("DoPortRouting.makeRoutedLedgerServic
|
|
|
3518
3518
|
if (attachment !== void 0) ordered.push(attachment);
|
|
3519
3519
|
}
|
|
3520
3520
|
return RecoverySnapshot.make({
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
approvalDecisions: snapshot.approvalDecisions,
|
|
3524
|
-
unknownResolutions: snapshot.unknownResolutions,
|
|
3525
|
-
childReservations: snapshot.childReservations,
|
|
3526
|
-
childAttachments: ordered,
|
|
3527
|
-
...snapshot.ownership === void 0 ? {} : { ownership: snapshot.ownership },
|
|
3528
|
-
...snapshot.inputApplied === void 0 ? {} : { inputApplied: snapshot.inputApplied },
|
|
3529
|
-
...snapshot.reservation === void 0 ? {} : { reservation: snapshot.reservation },
|
|
3530
|
-
...snapshot.abortIntent === void 0 ? {} : { abortIntent: snapshot.abortIntent },
|
|
3531
|
-
...snapshot.hostSubmissionId === void 0 ? {} : { hostSubmissionId: snapshot.hostSubmissionId },
|
|
3532
|
-
...snapshot.suspension === void 0 ? {} : { suspension: snapshot.suspension },
|
|
3533
|
-
...snapshot.parentLinkage === void 0 ? {} : { parentLinkage: snapshot.parentLinkage }
|
|
3521
|
+
...snapshot,
|
|
3522
|
+
childAttachments: ordered
|
|
3534
3523
|
});
|
|
3535
3524
|
});
|
|
3536
3525
|
const routed = SubmissionLedger.of({
|