@bjornpagen/bumbledb-log 0.20.2 → 1.0.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/README.md +275 -114
- package/dist/admin.d.ts +24 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +12 -0
- package/dist/admin.js.map +1 -0
- package/dist/bridge.d.ts +30 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +92 -0
- package/dist/bridge.js.map +1 -0
- package/dist/codes.d.ts +11 -0
- package/dist/codes.d.ts.map +1 -0
- package/dist/codes.js +53 -0
- package/dist/codes.js.map +1 -0
- package/dist/command.d.ts +21 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +12 -0
- package/dist/command.js.map +1 -0
- package/dist/errors.d.ts +78 -197
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +144 -114
- package/dist/errors.js.map +1 -1
- package/dist/history.d.ts +22 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +12 -0
- package/dist/history.js.map +1 -0
- package/dist/identity.d.ts +144 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +223 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +24 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -21
- package/dist/index.js.map +1 -1
- package/dist/machine.d.ts +151 -0
- package/dist/machine.d.ts.map +1 -0
- package/dist/machine.js +1128 -0
- package/dist/machine.js.map +1 -0
- package/dist/migration-ops.d.ts +20 -0
- package/dist/migration-ops.d.ts.map +1 -0
- package/dist/migration-ops.js +7 -0
- package/dist/migration-ops.js.map +1 -0
- package/dist/migrations/bin.d.ts +3 -0
- package/dist/migrations/bin.d.ts.map +1 -0
- package/dist/migrations/bin.js +43 -0
- package/dist/migrations/bin.js.map +1 -0
- package/dist/migrations/canonical.d.ts +40 -0
- package/dist/migrations/canonical.d.ts.map +1 -0
- package/dist/migrations/canonical.js +156 -0
- package/dist/migrations/canonical.js.map +1 -0
- package/dist/migrations/cli.d.ts +32 -0
- package/dist/migrations/cli.d.ts.map +1 -0
- package/dist/migrations/cli.js +147 -0
- package/dist/migrations/cli.js.map +1 -0
- package/dist/migrations/codec.d.ts +74 -0
- package/dist/migrations/codec.d.ts.map +1 -0
- package/dist/migrations/codec.js +2 -0
- package/dist/migrations/codec.js.map +1 -0
- package/dist/migrations/decode.d.ts +16 -0
- package/dist/migrations/decode.d.ts.map +1 -0
- package/dist/migrations/decode.js +302 -0
- package/dist/migrations/decode.js.map +1 -0
- package/dist/migrations/diff.d.ts +39 -0
- package/dist/migrations/diff.d.ts.map +1 -0
- package/dist/migrations/diff.js +385 -0
- package/dist/migrations/diff.js.map +1 -0
- package/dist/migrations/expr.d.ts +22 -0
- package/dist/migrations/expr.d.ts.map +1 -0
- package/dist/migrations/expr.js +228 -0
- package/dist/migrations/expr.js.map +1 -0
- package/dist/migrations/fail.d.ts +34 -0
- package/dist/migrations/fail.d.ts.map +1 -0
- package/dist/migrations/fail.js +69 -0
- package/dist/migrations/fail.js.map +1 -0
- package/dist/migrations/fsops.d.ts +37 -0
- package/dist/migrations/fsops.d.ts.map +1 -0
- package/dist/migrations/fsops.js +222 -0
- package/dist/migrations/fsops.js.map +1 -0
- package/dist/migrations/generate.d.ts +11 -0
- package/dist/migrations/generate.d.ts.map +1 -0
- package/dist/migrations/generate.js +479 -0
- package/dist/migrations/generate.js.map +1 -0
- package/dist/migrations/index.d.ts +25 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +6 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/intent.d.ts +86 -0
- package/dist/migrations/intent.d.ts.map +1 -0
- package/dist/migrations/intent.js +97 -0
- package/dist/migrations/intent.js.map +1 -0
- package/dist/migrations/lock.d.ts +27 -0
- package/dist/migrations/lock.d.ts.map +1 -0
- package/dist/migrations/lock.js +14 -0
- package/dist/migrations/lock.js.map +1 -0
- package/dist/migrations/native.d.ts +37 -0
- package/dist/migrations/native.d.ts.map +1 -0
- package/dist/migrations/native.js +135 -0
- package/dist/migrations/native.js.map +1 -0
- package/dist/migrations/repo.d.ts +38 -0
- package/dist/migrations/repo.d.ts.map +1 -0
- package/dist/migrations/repo.js +191 -0
- package/dist/migrations/repo.js.map +1 -0
- package/dist/migrations/theory.d.ts +21 -0
- package/dist/migrations/theory.d.ts.map +1 -0
- package/dist/migrations/theory.js +107 -0
- package/dist/migrations/theory.js.map +1 -0
- package/dist/migrations/types.d.ts +243 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations/types.js +2 -0
- package/dist/migrations/types.js.map +1 -0
- package/dist/migrations/workflow.d.ts +11 -0
- package/dist/migrations/workflow.d.ts.map +1 -0
- package/dist/migrations/workflow.js +14 -0
- package/dist/migrations/workflow.js.map +1 -0
- package/dist/native.d.ts +600 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +8 -0
- package/dist/native.js.map +1 -0
- package/dist/options.d.ts +106 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +2 -0
- package/dist/options.js.map +1 -0
- package/dist/outcome.d.ts +291 -0
- package/dist/outcome.d.ts.map +1 -0
- package/dist/outcome.js +2 -0
- package/dist/outcome.js.map +1 -0
- package/dist/production.d.ts +12 -0
- package/dist/production.d.ts.map +1 -0
- package/dist/production.js +29 -0
- package/dist/production.js.map +1 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +9 -0
- package/dist/schema.js.map +1 -0
- package/dist/surface.d.ts +80 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +2 -0
- package/dist/surface.js.map +1 -0
- package/dist/tenants.d.ts +20 -52
- package/dist/tenants.d.ts.map +1 -1
- package/dist/tenants.js +11 -330
- package/dist/tenants.js.map +1 -1
- package/pack-provenance.json +7 -0
- package/package.json +20 -23
- package/dist/braids.d.ts +0 -28
- package/dist/braids.d.ts.map +0 -1
- package/dist/braids.js +0 -45
- package/dist/braids.js.map +0 -1
- package/dist/bytes.d.ts +0 -26
- package/dist/bytes.d.ts.map +0 -1
- package/dist/bytes.js +0 -86
- package/dist/bytes.js.map +0 -1
- package/dist/chain.d.ts +0 -56
- package/dist/chain.d.ts.map +0 -1
- package/dist/chain.js +0 -137
- package/dist/chain.js.map +0 -1
- package/dist/codec.d.ts +0 -71
- package/dist/codec.d.ts.map +0 -1
- package/dist/codec.js +0 -179
- package/dist/codec.js.map +0 -1
- package/dist/descriptor.d.ts +0 -61
- package/dist/descriptor.d.ts.map +0 -1
- package/dist/descriptor.js +0 -160
- package/dist/descriptor.js.map +0 -1
- package/dist/keys.d.ts +0 -52
- package/dist/keys.d.ts.map +0 -1
- package/dist/keys.js +0 -166
- package/dist/keys.js.map +0 -1
- package/dist/manifest.d.ts +0 -42
- package/dist/manifest.d.ts.map +0 -1
- package/dist/manifest.js +0 -116
- package/dist/manifest.js.map +0 -1
- package/dist/replica.d.ts +0 -154
- package/dist/replica.d.ts.map +0 -1
- package/dist/replica.js +0 -820
- package/dist/replica.js.map +0 -1
- package/dist/store-s3.d.ts +0 -31
- package/dist/store-s3.d.ts.map +0 -1
- package/dist/store-s3.js +0 -299
- package/dist/store-s3.js.map +0 -1
- package/dist/store.d.ts +0 -129
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -577
- package/dist/store.js.map +0 -1
- package/dist/tilde-family.json +0 -21
- package/dist/vector.d.ts +0 -31
- package/dist/vector.d.ts.map +0 -1
- package/dist/vector.js +0 -87
- package/dist/vector.js.map +0 -1
- package/dist/writer.d.ts +0 -106
- package/dist/writer.d.ts.map +0 -1
- package/dist/writer.js +0 -677
- package/dist/writer.js.map +0 -1
package/dist/codes.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The log-specific error-code roster. This list must stay pinned to the
|
|
3
|
+
* native `logErrorCodes()` export (one speller, the internal Rust machine);
|
|
4
|
+
* an authored roster test compares them exactly. Core failures are never
|
|
5
|
+
* respelled here: a core failure crossing the log surface remains the exact
|
|
6
|
+
* core `DbError` with its own roster. These codes are only the protocol's
|
|
7
|
+
* additions.
|
|
8
|
+
*/
|
|
9
|
+
export const protocolErrorCodes = [
|
|
10
|
+
// Identity and authority refusals (chapter 20/30).
|
|
11
|
+
"ForeignIdentity",
|
|
12
|
+
"CommandIdentityConflict",
|
|
13
|
+
"DatabaseDeleted",
|
|
14
|
+
"DatabaseFrozen",
|
|
15
|
+
"CommandEpochClosed",
|
|
16
|
+
"ReceiptExpiredUnknown",
|
|
17
|
+
"NotInitialized",
|
|
18
|
+
"DatabaseMissing",
|
|
19
|
+
"AuthorityExists",
|
|
20
|
+
"CacheIdentityMismatch",
|
|
21
|
+
// Read-consistency refusals (chapter 30 published reads).
|
|
22
|
+
"WrongLineage",
|
|
23
|
+
"NotYetAvailable",
|
|
24
|
+
"WitnessUnavailable",
|
|
25
|
+
"SnapshotExpired",
|
|
26
|
+
// Maintenance and retention (chapters 21/22).
|
|
27
|
+
"MaintenanceRequired",
|
|
28
|
+
// The warm local materialization is behind the checkpoint base (older
|
|
29
|
+
// than the retained tail): recovery hydration is required. Native owns
|
|
30
|
+
// hydration — the reason's detail routes the caller to reopen the
|
|
31
|
+
// history/tenant (which runs recovery), never to a JS repair path.
|
|
32
|
+
"MaterializationStale",
|
|
33
|
+
"RootCapacityExceeded",
|
|
34
|
+
"SlotBorrowed",
|
|
35
|
+
"Contention",
|
|
36
|
+
"IncompleteRejectionEvidence",
|
|
37
|
+
// Migration workflow (chapters 22/33).
|
|
38
|
+
"MigrationRequired",
|
|
39
|
+
"MigrationDrift",
|
|
40
|
+
"MigrationIntentRequired",
|
|
41
|
+
"MigrationUnsupported",
|
|
42
|
+
"MigrationRepository",
|
|
43
|
+
"DatabaseAhead",
|
|
44
|
+
"MigrationOutputMismatch",
|
|
45
|
+
"OperationConflict",
|
|
46
|
+
// Host feasibility and transport (chapters 31/21).
|
|
47
|
+
"InsufficientLocalDisk",
|
|
48
|
+
"UnsupportedArtifact",
|
|
49
|
+
"Corruption",
|
|
50
|
+
"Backend",
|
|
51
|
+
"Misuse"
|
|
52
|
+
];
|
|
53
|
+
//# sourceMappingURL=codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../src/codes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,mDAAmD;IACnD,iBAAiB;IACjB,yBAAyB;IACzB,iBAAiB;IACjB,gBAAgB;IAChB,oBAAoB;IACpB,uBAAuB;IACvB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,uBAAuB;IACvB,0DAA0D;IAC1D,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,8CAA8C;IAC9C,qBAAqB;IACrB,sEAAsE;IACtE,uEAAuE;IACvE,kEAAkE;IAClE,mEAAmE;IACnE,sBAAsB;IACtB,sBAAsB;IACtB,cAAc;IACd,YAAY;IACZ,6BAA6B;IAC7B,uCAAuC;IACvC,mBAAmB;IACnB,gBAAgB;IAChB,yBAAyB;IACzB,sBAAsB;IACtB,qBAAqB;IACrB,eAAe;IACf,yBAAyB;IACzB,mBAAmB;IACnB,mDAAmD;IACnD,uBAAuB;IACvB,qBAAqB;IACrB,YAAY;IACZ,SAAS;IACT,QAAQ;CACC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owned sealed commands. `seal` retains the exact native core `ChangeSet`
|
|
3
|
+
* (no second row walk), checks its schema against the command scope on the
|
|
4
|
+
* bounded worker, and yields an immutable ref before any submission.
|
|
5
|
+
* `encode`/`decode` are the one bounded versioned native command codec for
|
|
6
|
+
* cross-process resubmission — a ref alone resolves uncertainty but cannot
|
|
7
|
+
* reconstruct a missing payload. Copy `command.ref` and retain it with the
|
|
8
|
+
* original intent BEFORE dispatch.
|
|
9
|
+
*/
|
|
10
|
+
import type { AnySchema, ExecutionPolicy, NativeRuntime } from "@bjornpagen/bumbledb";
|
|
11
|
+
import type { Effect, Scope } from "effect";
|
|
12
|
+
import type { LogError } from "./errors.js";
|
|
13
|
+
import type { CommandInput, Command as CommandInterface } from "./surface.js";
|
|
14
|
+
/** The owned sealed command value; `ref` is copyable before dispatch. */
|
|
15
|
+
export type Command<S extends AnySchema> = CommandInterface<S>;
|
|
16
|
+
export declare const Command: {
|
|
17
|
+
seal<S extends AnySchema>(input: CommandInput<S>, work: ExecutionPolicy): Effect.Effect<Command<S>, LogError, Scope.Scope>;
|
|
18
|
+
encode<S extends AnySchema>(command: Command<S>, work: ExecutionPolicy): Effect.Effect<Uint8Array, LogError>;
|
|
19
|
+
decode<S extends AnySchema>(bytes: Uint8Array, schema: S, work: ExecutionPolicy): Effect.Effect<Command<S>, LogError, NativeRuntime | Scope.Scope>;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACrF,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE5E,yEAAyE;AACzE,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,SAAS,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAA;AAE9D,eAAO,MAAM,OAAO,EAAE;IACrB,IAAI,CAAC,CAAC,SAAS,SAAS,EACvB,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EACtB,IAAI,EAAE,eAAe,GACnB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACnD,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC5G,MAAM,CAAC,CAAC,SAAS,SAAS,EACzB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,eAAe,GACnB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;CACrD,CAAA"}
|
package/dist/command.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owned sealed commands. `seal` retains the exact native core `ChangeSet`
|
|
3
|
+
* (no second row walk), checks its schema against the command scope on the
|
|
4
|
+
* bounded worker, and yields an immutable ref before any submission.
|
|
5
|
+
* `encode`/`decode` are the one bounded versioned native command codec for
|
|
6
|
+
* cross-process resubmission — a ref alone resolves uncertainty but cannot
|
|
7
|
+
* reconstruct a missing payload. Copy `command.ref` and retain it with the
|
|
8
|
+
* original intent BEFORE dispatch.
|
|
9
|
+
*/
|
|
10
|
+
import { log } from "#production.ts";
|
|
11
|
+
export const Command = log.Command;
|
|
12
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAMpC,MAAM,CAAC,MAAM,OAAO,GAWhB,GAAG,CAAC,OAAO,CAAA"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,202 +1,83 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* exhaustion. An unproved conditional write is the store verbs' own
|
|
13
|
-
* `ambiguous` outcome arm, never an error identity.
|
|
2
|
+
* The successor error vocabulary. `LogError = DbError | ProtocolError` and
|
|
3
|
+
* nothing else: a core failure crossing the log is the exact core `DbError`,
|
|
4
|
+
* unchanged; `ProtocolError` adds only the log-specific reason roster from
|
|
5
|
+
* `#codes.ts`, generated by the one native speller. Both classes are direct
|
|
6
|
+
* Effect `Schema.TaggedError` values with a tagged reason; any displayed
|
|
7
|
+
* `.code` is derived from the reason tag and there is no second mutable
|
|
8
|
+
* classification authority. Terminal receipts are data in A, never errors.
|
|
9
|
+
* Submit/admin interruption and finalizer defects stay in `Cause`.
|
|
10
|
+
* Resolve the original command/operation identity after cancellation;
|
|
11
|
+
* cancellation cannot establish whether publication happened.
|
|
14
12
|
*/
|
|
15
|
-
import
|
|
16
|
-
import type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
13
|
+
import { DbError } from "@bjornpagen/bumbledb";
|
|
14
|
+
import { type Cause, Schema } from "effect";
|
|
15
|
+
import { protocolErrorCodes } from "./codes.js";
|
|
16
|
+
declare const structured: readonly ["Contention", "NotYetAvailable", "InsufficientLocalDisk", "MaintenanceRequired", "MaterializationStale", "MigrationDrift", "MigrationUnsupported", "MigrationRepository", "MigrationIntentRequired"];
|
|
17
|
+
type StructuredTag = (typeof structured)[number];
|
|
18
|
+
type PlainTag = Exclude<(typeof protocolErrorCodes)[number], StructuredTag>;
|
|
19
|
+
export declare const ProtocolReason: Schema.Union<readonly [Schema.Struct<{
|
|
20
|
+
readonly _tag: Schema.Literal<"Contention">;
|
|
21
|
+
readonly attempts: Schema.Number;
|
|
22
|
+
}>, Schema.Struct<{
|
|
23
|
+
readonly _tag: Schema.Literal<"NotYetAvailable">;
|
|
24
|
+
readonly requestedSeq: Schema.BigInt;
|
|
25
|
+
readonly capturedSeq: Schema.BigInt;
|
|
26
|
+
}>, Schema.Struct<{
|
|
27
|
+
readonly _tag: Schema.Literal<"InsufficientLocalDisk">;
|
|
28
|
+
readonly requiredBytes: Schema.BigInt;
|
|
29
|
+
readonly availableBytes: Schema.BigInt;
|
|
30
|
+
}>, Schema.Struct<{
|
|
31
|
+
readonly _tag: Schema.Literal<"MaintenanceRequired">;
|
|
32
|
+
readonly count: Schema.BigInt;
|
|
33
|
+
readonly bytes: Schema.BigInt;
|
|
34
|
+
}>, Schema.Struct<{
|
|
35
|
+
readonly _tag: Schema.Literal<"MaterializationStale">;
|
|
36
|
+
readonly detail: Schema.String;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly _tag: Schema.Literal<"MigrationDrift">;
|
|
39
|
+
readonly detail: Schema.String;
|
|
40
|
+
}>, Schema.Struct<{
|
|
41
|
+
readonly _tag: Schema.Literal<"MigrationUnsupported">;
|
|
42
|
+
readonly detail: Schema.String;
|
|
43
|
+
}>, Schema.Struct<{
|
|
44
|
+
readonly _tag: Schema.Literal<"MigrationRepository">;
|
|
45
|
+
readonly path: Schema.String;
|
|
46
|
+
readonly detail: Schema.String;
|
|
47
|
+
}>, Schema.Struct<{
|
|
48
|
+
readonly _tag: Schema.Literal<"MigrationIntentRequired">;
|
|
49
|
+
readonly requirements: Schema.$Array<Schema.Struct<{
|
|
50
|
+
readonly code: Schema.Literals<readonly ["ambiguous", "destructive", "missing-backfill", "type-change", "unsupported", "stale-intent", "conflicting-intent"]>;
|
|
51
|
+
readonly relation: Schema.String;
|
|
52
|
+
readonly field: Schema.NullOr<Schema.String>;
|
|
53
|
+
readonly detail: Schema.String;
|
|
54
|
+
}>>;
|
|
55
|
+
readonly truncated: Schema.Boolean;
|
|
56
|
+
}>, Schema.Struct<{
|
|
57
|
+
readonly _tag: Schema.Literals<PlainTag[]>;
|
|
58
|
+
}>]>;
|
|
59
|
+
export type ProtocolReason = typeof ProtocolReason.Type;
|
|
60
|
+
declare const ProtocolErrorBase: Schema.Class<ProtocolError, Schema.TaggedStruct<"ProtocolError", {
|
|
61
|
+
operation: typeof Schema.String;
|
|
62
|
+
reason: typeof ProtocolReason;
|
|
63
|
+
}>, Cause.YieldableError>;
|
|
64
|
+
export declare class ProtocolError extends ProtocolErrorBase {
|
|
65
|
+
get code(): "Contention" | "InsufficientLocalDisk" | "MaintenanceRequired" | "MaterializationStale" | "MigrationDrift" | "MigrationIntentRequired" | "MigrationRepository" | "MigrationUnsupported" | "NotYetAvailable" | PlainTag;
|
|
66
|
+
}
|
|
67
|
+
export type LogError = DbError | ProtocolError;
|
|
47
68
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* core's one speller per family) or one of the three host-side kinds at
|
|
52
|
-
* the tail, which cross no bridge. The boundary carries
|
|
53
|
-
* `{ kind, message }` only, so a bridge-minted cause is the bare kind —
|
|
54
|
-
* the detail rides the message — and a payload field exists only where
|
|
55
|
-
* the minting seat owns the datum: a held document's version byte
|
|
56
|
-
* (`version`, byte 0 of every v:3 document) and length (`at`), the
|
|
57
|
-
* codec seat's own arity coordinates, the manifest audit's
|
|
58
|
-
* fingerprints, the counter object's key. The raw id of an
|
|
59
|
-
* `UnknownBraid` rides the message.
|
|
69
|
+
* Decode a thrown bridge value into the typed union. Already-typed errors
|
|
70
|
+
* pass through untouched (core errors are never rewrapped); an unrecognized
|
|
71
|
+
* local throw is a core `Internal`, not a fabricated protocol outcome.
|
|
60
72
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
readonly kind: "FingerprintMismatch";
|
|
72
|
-
readonly carried?: string;
|
|
73
|
-
readonly expected?: string;
|
|
74
|
-
} | {
|
|
75
|
-
readonly kind: "UnknownBraid";
|
|
76
|
-
} | {
|
|
77
|
-
readonly kind: "UnknownOpKind";
|
|
78
|
-
} | {
|
|
79
|
-
readonly kind: "UnknownRelation";
|
|
80
|
-
} | {
|
|
81
|
-
readonly kind: "ClosedRelation";
|
|
82
|
-
} | {
|
|
83
|
-
readonly kind: "OpRelationOutsideBraid";
|
|
84
|
-
} | {
|
|
85
|
-
readonly kind: "TagMismatch";
|
|
86
|
-
} | {
|
|
87
|
-
readonly kind: "BoolByte";
|
|
88
|
-
} | {
|
|
89
|
-
readonly kind: "InvalidUtf8";
|
|
90
|
-
} | {
|
|
91
|
-
readonly kind: "EmptyInterval";
|
|
92
|
-
} | {
|
|
93
|
-
readonly kind: "IntervalOverflow";
|
|
94
|
-
} | {
|
|
95
|
-
readonly kind: "TrailingBytes";
|
|
96
|
-
} | {
|
|
97
|
-
readonly kind: "Arity";
|
|
98
|
-
readonly op?: number;
|
|
99
|
-
readonly relation?: string;
|
|
100
|
-
readonly row?: number;
|
|
101
|
-
} | {
|
|
102
|
-
readonly kind: "Value";
|
|
103
|
-
} | {
|
|
104
|
-
readonly kind: "TooManyOps";
|
|
105
|
-
} | {
|
|
106
|
-
readonly kind: "TooManyRows";
|
|
107
|
-
} | {
|
|
108
|
-
readonly kind: "Malformed";
|
|
109
|
-
readonly at: number;
|
|
110
|
-
} | {
|
|
111
|
-
readonly kind: "Overflow";
|
|
112
|
-
} | {
|
|
113
|
-
readonly kind: "BraidSet";
|
|
114
|
-
} | {
|
|
115
|
-
readonly kind: "Counter";
|
|
116
|
-
readonly key: StoreKey;
|
|
117
|
-
} | {
|
|
118
|
-
readonly kind: "DigestWidth";
|
|
119
|
-
} | {
|
|
120
|
-
readonly kind: "CheckpointDigest";
|
|
121
|
-
readonly expected: string;
|
|
122
|
-
readonly computed: string;
|
|
123
|
-
} | {
|
|
124
|
-
readonly kind: "NoOpSlot";
|
|
125
|
-
readonly braid: Braid;
|
|
126
|
-
readonly slot: Generation;
|
|
127
|
-
readonly writer: bigint;
|
|
128
|
-
};
|
|
129
|
-
type ChainCause = "prev" | "slot" | "timestamp";
|
|
130
|
-
interface ChainMismatchData {
|
|
131
|
-
readonly cause: ChainCause;
|
|
132
|
-
readonly braid: Braid;
|
|
133
|
-
readonly slot: Generation;
|
|
134
|
-
readonly writer: bigint;
|
|
135
|
-
}
|
|
136
|
-
type ContentionCause = {
|
|
137
|
-
readonly kind: "hot-key";
|
|
138
|
-
readonly statement: string;
|
|
139
|
-
readonly determinants: ReadonlyArray<Readonly<Record<string, unknown>>>;
|
|
140
|
-
} | {
|
|
141
|
-
readonly kind: "slot-race";
|
|
142
|
-
readonly tip: Generation;
|
|
143
|
-
};
|
|
144
|
-
interface ContentionData {
|
|
145
|
-
readonly braid: Braid;
|
|
146
|
-
readonly cause: ContentionCause;
|
|
147
|
-
}
|
|
148
|
-
interface OverWidthData {
|
|
149
|
-
readonly requested: bigint;
|
|
150
|
-
}
|
|
151
|
-
interface RefillNeededData {
|
|
152
|
-
readonly relation: number;
|
|
153
|
-
readonly field: number;
|
|
154
|
-
readonly requested: bigint;
|
|
155
|
-
}
|
|
156
|
-
interface ExhaustedData {
|
|
157
|
-
readonly relation: number;
|
|
158
|
-
readonly field: number;
|
|
159
|
-
}
|
|
160
|
-
interface SlotRetiredData {
|
|
161
|
-
readonly braid: Braid;
|
|
162
|
-
readonly slot: Generation;
|
|
163
|
-
}
|
|
164
|
-
/** The id-lease algebra's refusal sum — the identity table's `counter`
|
|
165
|
-
* family, arm for arm: Counter | Exhausted | OverWidth. `Counter`
|
|
166
|
-
* carries the counter object's key, the datum this driver's parse gate
|
|
167
|
-
* owns (the core's twin carries relation and field). A cache refill is
|
|
168
|
-
* no arm: the shared algebra has none. */
|
|
169
|
-
type LeaseRefusal = {
|
|
170
|
-
readonly kind: "Counter";
|
|
171
|
-
readonly key: StoreKey;
|
|
172
|
-
} | {
|
|
173
|
-
readonly kind: "Exhausted";
|
|
174
|
-
readonly relation: number;
|
|
175
|
-
readonly field: number;
|
|
176
|
-
} | {
|
|
177
|
-
readonly kind: "OverWidth";
|
|
178
|
-
readonly requested: bigint;
|
|
179
|
-
};
|
|
180
|
-
declare function refuse(cause: RefusalCause, detail: string): never;
|
|
181
|
-
declare function refuseChain(data: ChainMismatchData, detail: string): never;
|
|
182
|
-
declare function throwContention(data: ContentionData, detail: string): never;
|
|
183
|
-
declare function refuseManifestMissing(detail: string): never;
|
|
184
|
-
declare function isManifestMissing(error: unknown): boolean;
|
|
185
|
-
declare function refuseOverWidth(data: OverWidthData, detail: string): never;
|
|
186
|
-
declare function throwRefillNeeded(data: RefillNeededData, detail: string): never;
|
|
187
|
-
declare function refuseExhausted(data: ExhaustedData, detail: string): never;
|
|
188
|
-
declare function refuseSlotRetired(data: SlotRetiredData, detail: string): never;
|
|
189
|
-
declare function refusalOf(error: Error): RefusalCause | undefined;
|
|
190
|
-
declare function chainMismatchOf(error: Error): ChainMismatchData | undefined;
|
|
191
|
-
declare function contentionOf(error: Error): ContentionData | undefined;
|
|
192
|
-
declare function overWidthOf(error: Error): OverWidthData | undefined;
|
|
193
|
-
declare function refillNeededOf(error: Error): RefillNeededData | undefined;
|
|
194
|
-
declare function exhaustedOf(error: Error): ExhaustedData | undefined;
|
|
195
|
-
declare function slotRetiredOf(error: Error): SlotRetiredData | undefined;
|
|
196
|
-
/** Every store failure wraps the exported sentinel itself, so
|
|
197
|
-
* `errors.is(e, ErrStore)` matches by identity; the vendor error's
|
|
198
|
-
* message rides the detail verbatim. */
|
|
199
|
-
declare function wrapStore(inner: Error, detail: string): Error;
|
|
200
|
-
export type { ChainCause, ChainMismatchData, ContentionCause, ContentionData, ExhaustedData, LeaseRefusal, OverWidthData, RefillNeededData, RefusalCause, SlotRetiredData };
|
|
201
|
-
export { chainMismatchOf, contentionOf, ErrChainMismatch, ErrContention, ErrExhausted, ErrOverWidth, ErrRefillNeeded, ErrRefused, ErrReplayDiverged, ErrSlotRetired, ErrSpanningCommit, ErrStore, exhaustedOf, isManifestMissing, overWidthOf, refillNeededOf, refusalOf, refuse, refuseChain, refuseExhausted, refuseManifestMissing, refuseOverWidth, refuseSlotRetired, slotRetiredOf, throwContention, throwRefillNeeded, wrapStore };
|
|
73
|
+
export declare function logFailure(operation: string, cause: unknown): LogError;
|
|
74
|
+
/** A plain-tag protocol failure, spelled once. */
|
|
75
|
+
export declare function protocolError(operation: string, code: Exclude<ProtocolReason["_tag"], (typeof structured)[number]>): ProtocolError;
|
|
76
|
+
/** The boundary-parser refusal: malformed public input, before any I/O. */
|
|
77
|
+
export declare function invalidInput(operation: string): DbError;
|
|
78
|
+
/** A closed/stale capability supplied dynamically. */
|
|
79
|
+
export declare function closedHandle(operation: string): DbError;
|
|
80
|
+
/** Post-dispatch fiber interrupt: afterDispatch arm, same original identity. */
|
|
81
|
+
export declare function cancelled(operation: string): DbError;
|
|
82
|
+
export {};
|
|
202
83
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,OAAO,EAAW,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAiE9C,QAAA,MAAM,UAAU,YACf,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,CAChB,CAAA;AACV,KAAK,aAAa,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAChD,KAAK,QAAQ,GAAG,OAAO,CAAC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAA;AAO3E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWzB,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,KAAK,CACpC,aAAa,EACb,MAAM,CAAC,YAAY,CAAC,eAAe,EAAE;IAAE,SAAS,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,cAAc,CAAA;CAAE,CAAC,EACxG,KAAK,CAAC,cAAc,CAInB,CAAA;AAEF,qBAAa,aAAc,SAAQ,iBAAiB;IACnD,IAAI,IAAI,2NAEP;CACD;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,aAAa,CAAA;AAS9C;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,CAYtE;AAED,kDAAkD;AAClD,wBAAgB,aAAa,CAC5B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GAChE,aAAa,CAEf;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEpD"}
|