@bjornpagen/bumbledb 1.3.0 → 2.0.0-rc.1
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/COOKBOOK.md +224 -95
- package/README.md +114 -45
- package/dist/alternatives.d.ts +5 -6
- package/dist/alternatives.d.ts.map +1 -1
- package/dist/alternatives.js +5 -6
- package/dist/alternatives.js.map +1 -1
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +85 -0
- package/dist/bin.js.map +1 -0
- package/dist/capacity.d.ts +14 -17
- package/dist/capacity.d.ts.map +1 -1
- package/dist/capacity.js +7 -7
- package/dist/capacity.js.map +1 -1
- package/dist/changes.d.ts +32 -41
- package/dist/changes.d.ts.map +1 -1
- package/dist/changes.js +86 -110
- package/dist/changes.js.map +1 -1
- package/dist/closed.d.ts +2 -2
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +5 -5
- package/dist/closed.js.map +1 -1
- package/dist/codec.d.ts +20 -27
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +48 -22
- package/dist/codec.js.map +1 -1
- package/dist/compile.d.ts +26 -50
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +75 -64
- package/dist/compile.js.map +1 -1
- package/dist/database/database.d.ts +98 -0
- package/dist/database/database.d.ts.map +1 -0
- package/dist/database/database.js +249 -0
- package/dist/database/database.js.map +1 -0
- package/dist/database/driver.d.ts +40 -0
- package/dist/database/driver.d.ts.map +1 -0
- package/dist/database/driver.js +68 -0
- package/dist/database/driver.js.map +1 -0
- package/dist/database/fs.d.ts +12 -0
- package/dist/database/fs.d.ts.map +1 -0
- package/dist/database/fs.js +120 -0
- package/dist/database/fs.js.map +1 -0
- package/dist/database/generate.d.ts +26 -0
- package/dist/database/generate.d.ts.map +1 -0
- package/dist/database/generate.js +102 -0
- package/dist/database/generate.js.map +1 -0
- package/dist/database/hosted.d.ts +32 -0
- package/dist/database/hosted.d.ts.map +1 -0
- package/dist/database/hosted.js +44 -0
- package/dist/database/hosted.js.map +1 -0
- package/dist/database/io.d.ts +94 -0
- package/dist/database/io.d.ts.map +1 -0
- package/dist/database/io.js +35 -0
- package/dist/database/io.js.map +1 -0
- package/dist/database/mem.d.ts +26 -0
- package/dist/database/mem.d.ts.map +1 -0
- package/dist/database/mem.js +67 -0
- package/dist/database/mem.js.map +1 -0
- package/dist/database/migration.d.ts +55 -0
- package/dist/database/migration.d.ts.map +1 -0
- package/dist/database/migration.js +46 -0
- package/dist/database/migration.js.map +1 -0
- package/dist/database/s3.d.ts +36 -0
- package/dist/database/s3.d.ts.map +1 -0
- package/dist/database/s3.js +141 -0
- package/dist/database/s3.js.map +1 -0
- package/dist/db.d.ts +44 -128
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +163 -287
- package/dist/db.js.map +1 -1
- package/dist/engine.d.ts +7 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +2 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors.d.ts +152 -46
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +107 -19
- package/dist/errors.js.map +1 -1
- package/dist/face.d.ts +5 -5
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js +6 -6
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +4 -5
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +3 -3
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +60 -58
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -29
- package/dist/index.js.map +1 -1
- package/dist/judgment.d.ts +1 -1
- package/dist/judgment.js +1 -1
- package/dist/law.d.ts +16 -68
- package/dist/law.d.ts.map +1 -1
- package/dist/law.js +3 -3
- package/dist/law.js.map +1 -1
- package/dist/lower.d.ts +3 -3
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +35 -39
- package/dist/lower.js.map +1 -1
- package/dist/native/addon.d.ts +23 -0
- package/dist/native/addon.d.ts.map +1 -0
- package/dist/native/addon.js +15 -0
- package/dist/native/addon.js.map +1 -0
- package/dist/native/binding.d.ts +996 -0
- package/dist/native/json.d.ts +14 -0
- package/dist/native/json.d.ts.map +1 -0
- package/dist/native/json.js +73 -0
- package/dist/native/json.js.map +1 -0
- package/dist/native/load.d.ts +9 -0
- package/dist/native/load.d.ts.map +1 -0
- package/dist/native/load.js +30 -0
- package/dist/native/load.js.map +1 -0
- package/dist/native/op.d.ts +29 -0
- package/dist/native/op.d.ts.map +1 -0
- package/dist/native/op.js +50 -0
- package/dist/native/op.js.map +1 -0
- package/dist/query/atom.d.ts +13 -14
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +2 -2
- package/dist/query/atom.js.map +1 -1
- package/dist/query/compute.d.ts +7 -7
- package/dist/query/compute.d.ts.map +1 -1
- package/dist/query/compute.js +7 -16
- package/dist/query/compute.js.map +1 -1
- package/dist/query/find.d.ts +8 -8
- package/dist/query/find.d.ts.map +1 -1
- package/dist/query/find.js +1 -1
- package/dist/query/lower.d.ts +31 -17
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +260 -368
- package/dist/query/lower.js.map +1 -1
- package/dist/query/run.d.ts +5 -5
- package/dist/query/run.d.ts.map +1 -1
- package/dist/query/run.js +32 -15
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +20 -28
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +13 -8
- package/dist/query/scope.js.map +1 -1
- package/dist/query/segments.d.ts +2 -2
- package/dist/query/segments.d.ts.map +1 -1
- package/dist/query/segments.js +3 -3
- package/dist/query/segments.js.map +1 -1
- package/dist/relation.d.ts +1 -1
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +4 -4
- package/dist/relation.js.map +1 -1
- package/dist/result.d.ts +15 -22
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +30 -39
- package/dist/result.js.map +1 -1
- package/dist/rows.d.ts +9 -33
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +8 -12
- package/dist/rows.js.map +1 -1
- package/dist/runtime.d.ts +17 -43
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +41 -241
- package/dist/runtime.js.map +1 -1
- package/dist/scalar.d.ts +36 -106
- package/dist/scalar.d.ts.map +1 -1
- package/dist/scalar.js +36 -185
- package/dist/scalar.js.map +1 -1
- package/dist/schema.d.ts +7 -18
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +18 -228
- package/dist/schema.js.map +1 -1
- package/dist/selection.d.ts +4 -4
- package/dist/selection.d.ts.map +1 -1
- package/dist/selection.js +5 -5
- package/dist/selection.js.map +1 -1
- package/dist/shape.d.ts +5 -5
- package/dist/shape.d.ts.map +1 -1
- package/dist/spec.d.ts +7 -79
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +3 -3
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +10 -10
- package/dist/statements.js.map +1 -1
- package/dist/uuid.d.ts +1 -1
- package/dist/uuid.d.ts.map +1 -1
- package/dist/uuid.js +1 -1
- package/dist/uuid.js.map +1 -1
- package/dist/values.d.ts +2 -2
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +2 -2
- package/dist/values.js.map +1 -1
- package/package.json +18 -18
- package/src/alternatives.ts +7 -8
- package/src/bin.ts +82 -0
- package/src/capacity.ts +20 -23
- package/src/changes.ts +134 -197
- package/src/closed.ts +5 -5
- package/src/codec.ts +77 -51
- package/src/compile.ts +91 -113
- package/src/database/database.ts +413 -0
- package/src/database/driver.ts +134 -0
- package/src/database/fs.ts +119 -0
- package/src/database/generate.ts +116 -0
- package/src/database/hosted.ts +102 -0
- package/src/database/io.ts +134 -0
- package/src/database/mem.ts +113 -0
- package/src/database/migration.ts +107 -0
- package/src/database/s3.ts +231 -0
- package/src/db.ts +290 -547
- package/src/engine.ts +14 -0
- package/src/errors.ts +118 -39
- package/src/face.ts +9 -9
- package/src/fields.ts +6 -7
- package/src/index.ts +102 -109
- package/src/judgment.ts +1 -1
- package/src/law.ts +18 -70
- package/src/lower.ts +61 -72
- package/src/native/addon.ts +54 -0
- package/src/native/binding.d.ts +996 -0
- package/src/native/json.ts +100 -0
- package/src/native/load.ts +31 -0
- package/src/native/op.ts +73 -0
- package/src/query/atom.ts +15 -16
- package/src/query/compute.ts +13 -22
- package/src/query/find.ts +8 -8
- package/src/query/lower.ts +323 -414
- package/src/query/run.ts +42 -21
- package/src/query/scope.ts +37 -38
- package/src/query/segments.ts +4 -4
- package/src/relation.ts +4 -4
- package/src/result.ts +53 -80
- package/src/rows.ts +18 -46
- package/src/runtime.ts +50 -346
- package/src/scalar.ts +76 -336
- package/src/schema.ts +23 -284
- package/src/selection.ts +6 -6
- package/src/shape.ts +5 -5
- package/src/spec.ts +7 -85
- package/src/statements.ts +11 -11
- package/src/uuid.ts +1 -1
- package/src/values.ts +4 -4
- package/dist/close.d.ts +0 -24
- package/dist/close.d.ts.map +0 -1
- package/dist/close.js +0 -34
- package/dist/close.js.map +0 -1
- package/dist/db-native.d.ts +0 -196
- package/dist/db-native.d.ts.map +0 -1
- package/dist/db-native.js +0 -13
- package/dist/db-native.js.map +0 -1
- package/dist/internal/log.d.ts +0 -26
- package/dist/internal/log.d.ts.map +0 -1
- package/dist/internal/log.js +0 -12
- package/dist/internal/log.js.map +0 -1
- package/dist/migration.d.ts +0 -31
- package/dist/migration.d.ts.map +0 -1
- package/dist/migration.js +0 -47
- package/dist/migration.js.map +0 -1
- package/dist/native.d.ts +0 -562
- package/dist/native.d.ts.map +0 -1
- package/dist/native.js +0 -123
- package/dist/native.js.map +0 -1
- package/dist/query/description.d.ts +0 -41
- package/dist/query/description.d.ts.map +0 -1
- package/dist/query/description.js +0 -311
- package/dist/query/description.js.map +0 -1
- package/dist/query/parse-ir.d.ts +0 -10
- package/dist/query/parse-ir.d.ts.map +0 -1
- package/dist/query/parse-ir.js +0 -280
- package/dist/query/parse-ir.js.map +0 -1
- package/dist/runtime-codes.d.ts +0 -2
- package/dist/runtime-codes.d.ts.map +0 -1
- package/dist/runtime-codes.js +0 -18
- package/dist/runtime-codes.js.map +0 -1
- package/dist/runtime-errors.d.ts +0 -118
- package/dist/runtime-errors.d.ts.map +0 -1
- package/dist/runtime-errors.js +0 -98
- package/dist/runtime-errors.js.map +0 -1
- package/dist/runtime-native.d.ts +0 -141
- package/dist/runtime-native.d.ts.map +0 -1
- package/dist/runtime-native.js +0 -5
- package/dist/runtime-native.js.map +0 -1
- package/pack-provenance.json +0 -7
- package/src/close.ts +0 -53
- package/src/db-native.ts +0 -243
- package/src/internal/log.ts +0 -48
- package/src/migration.ts +0 -61
- package/src/native.ts +0 -736
- package/src/query/description.ts +0 -424
- package/src/query/parse-ir.ts +0 -291
- package/src/runtime-codes.ts +0 -17
- package/src/runtime-errors.ts +0 -109
- package/src/runtime-native.ts +0 -189
package/dist/runtime-native.d.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/** Exact-version internal bridge, shared by core and log. Not a public API. */
|
|
2
|
-
import type { DbHandle, LogChainKind, LogCommandKind, LogCommandMetadata, LogCommandRef, LogCondition, LogDecisionStamp, LogIdentity, LogLimits, LogOutcomeWire, LogSchemaHandle, LogStateStamp, Violation } from "./native.js";
|
|
3
|
-
import { native } from "./native.js";
|
|
4
|
-
import type { SchemaSpec } from "./spec.js";
|
|
5
|
-
export interface RuntimeHandle {
|
|
6
|
-
readonly __runtime: unique symbol;
|
|
7
|
-
}
|
|
8
|
-
export interface OperationHandle {
|
|
9
|
-
readonly __operation: unique symbol;
|
|
10
|
-
}
|
|
11
|
-
export interface DirectoryHandle {
|
|
12
|
-
readonly __directory: unique symbol;
|
|
13
|
-
}
|
|
14
|
-
/** Stamped `NativeKind::RepositoryLock` mint — not a directory-owner twin. */
|
|
15
|
-
export interface RepositoryLockHandle {
|
|
16
|
-
readonly __repositoryLock: unique symbol;
|
|
17
|
-
}
|
|
18
|
-
/** Resource kinds installed in native worker tables. */
|
|
19
|
-
export type NativeKind = "snapshot" | "prepared" | "result" | "cursor" | "draft" | "changes" | "repository-lock";
|
|
20
|
-
/**
|
|
21
|
-
* Checked capability into the native registry. JS tokens validate
|
|
22
|
-
* these five fields; native re-judges kind/generation/owner on every verb.
|
|
23
|
-
*/
|
|
24
|
-
export interface Capability {
|
|
25
|
-
readonly runtime: bigint;
|
|
26
|
-
readonly worker: number;
|
|
27
|
-
readonly kind: NativeKind;
|
|
28
|
-
readonly id: bigint;
|
|
29
|
-
readonly generation: bigint;
|
|
30
|
-
}
|
|
31
|
-
export type ManagedDbOutcome = {
|
|
32
|
-
readonly tag: "accepted";
|
|
33
|
-
readonly db: DbHandle;
|
|
34
|
-
} | {
|
|
35
|
-
readonly tag: "rejected";
|
|
36
|
-
readonly violations: readonly Violation[];
|
|
37
|
-
} | {
|
|
38
|
-
readonly tag: "refused";
|
|
39
|
-
readonly kind: "schemaError" | "newtypeMismatch" | "fingerprintMismatch" | "destinationExists";
|
|
40
|
-
readonly message: string;
|
|
41
|
-
};
|
|
42
|
-
export type LogTakeWire = {
|
|
43
|
-
readonly ok: false;
|
|
44
|
-
readonly kind: LogCommandKind | LogChainKind;
|
|
45
|
-
readonly message: string;
|
|
46
|
-
} | {
|
|
47
|
-
/** Command sealed: envelope bytes + reference. */
|
|
48
|
-
readonly ok: true;
|
|
49
|
-
readonly bytes: Uint8Array;
|
|
50
|
-
readonly ref: LogCommandRef;
|
|
51
|
-
} | {
|
|
52
|
-
/** Command parsed. */
|
|
53
|
-
readonly ok: true;
|
|
54
|
-
readonly identity: LogIdentity;
|
|
55
|
-
readonly receiptEpoch: bigint;
|
|
56
|
-
readonly requestId: string;
|
|
57
|
-
readonly condition: LogCondition;
|
|
58
|
-
readonly changes: Uint8Array;
|
|
59
|
-
readonly result: Uint8Array;
|
|
60
|
-
readonly ref: LogCommandRef;
|
|
61
|
-
} | {
|
|
62
|
-
/** Decision framed. */
|
|
63
|
-
readonly ok: true;
|
|
64
|
-
readonly bytes: Uint8Array;
|
|
65
|
-
readonly digest: Uint8Array;
|
|
66
|
-
} | {
|
|
67
|
-
/** Decision decoded (and chain-verified when a parent was given). */
|
|
68
|
-
readonly ok: true;
|
|
69
|
-
readonly identity: LogIdentity;
|
|
70
|
-
readonly seq: bigint;
|
|
71
|
-
readonly parent: LogDecisionStamp;
|
|
72
|
-
readonly beforeState: LogStateStamp;
|
|
73
|
-
readonly afterState: LogStateStamp;
|
|
74
|
-
readonly commandBytes: Uint8Array;
|
|
75
|
-
readonly command: LogCommandRef;
|
|
76
|
-
readonly outcome: LogOutcomeWire;
|
|
77
|
-
readonly digest: Uint8Array;
|
|
78
|
-
};
|
|
79
|
-
export interface OptionsWire {
|
|
80
|
-
readonly workers?: number | undefined;
|
|
81
|
-
readonly queueCapacity?: number | undefined;
|
|
82
|
-
readonly cleanupCapacity?: number | undefined;
|
|
83
|
-
readonly ownerCapacity?: number | undefined;
|
|
84
|
-
readonly nativeHandleCapacity?: number | undefined;
|
|
85
|
-
readonly cleanupTimeoutMs?: number | undefined;
|
|
86
|
-
}
|
|
87
|
-
export interface InspectionWire {
|
|
88
|
-
readonly phase: "open" | "closing" | "closed";
|
|
89
|
-
readonly queued: bigint;
|
|
90
|
-
readonly active: bigint;
|
|
91
|
-
readonly retained: bigint;
|
|
92
|
-
readonly owners: bigint;
|
|
93
|
-
readonly databases: bigint;
|
|
94
|
-
readonly natives: bigint;
|
|
95
|
-
}
|
|
96
|
-
export type CloseWire = {
|
|
97
|
-
readonly kind: "closed";
|
|
98
|
-
} | {
|
|
99
|
-
readonly kind: "incomplete";
|
|
100
|
-
readonly outstanding: InspectionWire;
|
|
101
|
-
} | {
|
|
102
|
-
readonly kind: "failed";
|
|
103
|
-
};
|
|
104
|
-
interface RuntimeNative {
|
|
105
|
-
runtimeErrorCodes(): readonly string[];
|
|
106
|
-
runtimeOpen(options: OptionsWire): RuntimeHandle;
|
|
107
|
-
runtimeReady(runtime: RuntimeHandle, callback: () => void): OperationHandle;
|
|
108
|
-
runtimeHash(runtime: RuntimeHandle, bytes: Uint8Array, callback: () => void): OperationHandle;
|
|
109
|
-
runtimeTake(operation: OperationHandle): Uint8Array | null;
|
|
110
|
-
runtimeCancel(operation: OperationHandle, callback: (report: CloseWire) => void): void;
|
|
111
|
-
runtimeClose(runtime: RuntimeHandle, callback: (report: CloseWire) => void): void;
|
|
112
|
-
runtimeInspect(runtime: RuntimeHandle): InspectionWire;
|
|
113
|
-
/**
|
|
114
|
-
* L12 request (D12/D25): one-shot arm. Next `dispatch_payload_message`
|
|
115
|
-
* must cancel after `work()` returns and the post-work `checkpoint()`
|
|
116
|
-
* (`runtime.rs` ~860–862), before `complete_operation` writes
|
|
117
|
-
* `operation.output`. A local `QueuedOutput` is not registration.
|
|
118
|
-
* Predelivery: no JS take; cursor stays on row1 so retry does not skip.
|
|
119
|
-
*/
|
|
120
|
-
runtimeArmPublicationCancel(runtime: RuntimeHandle): void;
|
|
121
|
-
runtimeDirectoryAcquire(runtime: RuntimeHandle, path: string, callback: () => void): OperationHandle;
|
|
122
|
-
runtimeDirectoryTake(operation: OperationHandle): DirectoryHandle;
|
|
123
|
-
runtimeDirectoryBegin(owner: DirectoryHandle): OperationHandle;
|
|
124
|
-
runtimeDirectoryCheck(operation: OperationHandle): void;
|
|
125
|
-
runtimeDirectoryEnd(operation: OperationHandle): void;
|
|
126
|
-
runtimeDirectoryClose(owner: DirectoryHandle, remove: boolean, callback: (report: CloseWire) => void): void;
|
|
127
|
-
runtimeDirectoryDbOpen(owner: DirectoryHandle, childName: string, spec: SchemaSpec, create: boolean, callback: () => void): OperationHandle;
|
|
128
|
-
runtimeDbTake(operation: OperationHandle): ManagedDbOutcome;
|
|
129
|
-
runtimeManagedDbClose(db: DbHandle, callback: (report: CloseWire) => void): void;
|
|
130
|
-
runtimeLogCommandSeal(runtime: RuntimeHandle, schema: LogSchemaHandle, metadata: LogCommandMetadata, changes: Uint8Array, result: Uint8Array | null, limits: LogLimits, callback: () => void): OperationHandle;
|
|
131
|
-
runtimeLogCommandParse(runtime: RuntimeHandle, schema: LogSchemaHandle, bytes: Uint8Array, limits: LogLimits, callback: () => void): OperationHandle;
|
|
132
|
-
runtimeLogDecisionDecode(runtime: RuntimeHandle, bytes: Uint8Array, parent: LogDecisionStamp | null, limits: LogLimits, callback: () => void): OperationHandle;
|
|
133
|
-
runtimeLogTake(operation: OperationHandle): LogTakeWire;
|
|
134
|
-
/** L14 mint: `Runtime::mint_repository_lock` stamps `NativeKind::RepositoryLock` at take. */
|
|
135
|
-
logRepositoryLockAcquire(runtime: RuntimeHandle, directory: string, callback: () => void): OperationHandle;
|
|
136
|
-
logRepositoryLockTake(operation: OperationHandle): RepositoryLockHandle;
|
|
137
|
-
logRepositoryLockRelease(owner: RepositoryLockHandle, callback: (report: CloseWire) => void): void;
|
|
138
|
-
}
|
|
139
|
-
export declare const runtimeNative: typeof native & RuntimeNative;
|
|
140
|
-
export {};
|
|
141
|
-
//# sourceMappingURL=runtime-native.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-native.d.ts","sourceRoot":"","sources":["../src/runtime-native.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,KAAK,EACX,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,cAAc,EACd,eAAe,EACf,aAAa,EACb,SAAS,EACT,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,MAAM,CAAA;CACjC;AACD,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,WAAW,EAAE,OAAO,MAAM,CAAA;CACnC;AACD,MAAM,WAAW,eAAe;IAC/B,QAAQ,C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AQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,IAAI,GAClB,eAAe,CAAA;IAClB,sBAAsB,CACrB,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,IAAI,GAClB,eAAe,CAAA;IAClB,wBAAwB,CACvB,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,gBAAgB,GAAG,IAAI,EAC/B,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,IAAI,GAClB,eAAe,CAAA;IAClB,cAAc,CAAC,SAAS,EAAE,eAAe,GAAG,WAAW,CAAA;IACvD,6FAA6F;IAC7F,wBAAwB,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,eAAe,CAAA;IAC1G,qBAAqB,CAAC,SAAS,EAAE,eAAe,GAAG,oBAAoB,CAAA;IACvE,wBAAwB,CAAC,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI,CAAA;CAClG;AAGD,eAAO,MAAM,aAAa,EAAa,OAAO,MAAM,GAAG,aAAa,CAAA"}
|
package/dist/runtime-native.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** Exact-version internal bridge, shared by core and log. Not a public API. */
|
|
2
|
-
import { native } from "#native.ts";
|
|
3
|
-
// The checked source/fresh-addon roster test pins this private declaration.
|
|
4
|
-
export const runtimeNative = native;
|
|
5
|
-
//# sourceMappingURL=runtime-native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-native.js","sourceRoot":"","sources":["../src/runtime-native.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAiB/E,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AA0KnC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAG,MAAuC,CAAA"}
|
package/pack-provenance.json
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"candidateSourceDigest": "cf0cd07de3f8596acc7b15601063911472272a859f0fad176c3f75cd48f95719",
|
|
3
|
-
"specificationRevision": "87e9a83ee21d1f843c73ac6e7057b2b740db75aae70a553b8053b4f38e87bd2d",
|
|
4
|
-
"stagedAt": "2026-09-11T16:23:11.093Z",
|
|
5
|
-
"package": "@bjornpagen/bumbledb",
|
|
6
|
-
"version": "1.3.0"
|
|
7
|
-
}
|
package/src/close.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect"
|
|
2
|
-
import { finalizeClose } from "#runtime.ts"
|
|
3
|
-
import type { CloseReport } from "#runtime-errors.ts"
|
|
4
|
-
import { DbError } from "#runtime-errors.ts"
|
|
5
|
-
/**
|
|
6
|
-
* Shared close/drain adapters for scoped core owners (drafts, changes,
|
|
7
|
-
* snapshots, sessions, results, cursors, databases). Early `close()` joins
|
|
8
|
-
* the native close transition and
|
|
9
|
-
* returns the honest {@link CloseReport}; a scope FINALIZER runs the same
|
|
10
|
-
* close and surfaces `incomplete`/`failed` as a structured `CloseFailure`
|
|
11
|
-
* DEFECT in the finalizer Cause — never catch-and-log, never false
|
|
12
|
-
* quiescence. Teardown uses the runtime's reserved cleanup envelope
|
|
13
|
-
* natively; repeated close joins the same stored transition (idempotent).
|
|
14
|
-
*/
|
|
15
|
-
import type { CloseWire } from "#runtime-native.ts"
|
|
16
|
-
|
|
17
|
-
function reportOf(operation: string, wire: CloseWire): CloseReport {
|
|
18
|
-
if (wire.kind === "failed") {
|
|
19
|
-
return { kind: "failed", error: new DbError({ operation, reason: { _tag: "Internal" } }) }
|
|
20
|
-
}
|
|
21
|
-
return wire
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Adapts one native close verb to `Effect<CloseReport>`: registration is
|
|
26
|
-
* synchronous, completion resumes exactly once, and the whole wait is
|
|
27
|
-
* uninterruptible — a close is a bounded registration/drain handshake, not
|
|
28
|
-
* long maskable work (the native side owns the cleanup deadline).
|
|
29
|
-
*/
|
|
30
|
-
function drainClose(
|
|
31
|
-
operation: string,
|
|
32
|
-
start: (callback: (report: CloseWire) => void) => void
|
|
33
|
-
): Effect.Effect<CloseReport> {
|
|
34
|
-
return Effect.callback<CloseReport>((resume) => {
|
|
35
|
-
try {
|
|
36
|
-
start((report) => resume(Effect.succeed(reportOf(operation, report))))
|
|
37
|
-
} catch (cause) {
|
|
38
|
-
resume(
|
|
39
|
-
Effect.succeed({
|
|
40
|
-
kind: "failed",
|
|
41
|
-
error: cause instanceof DbError ? cause : new DbError({ operation, reason: { _tag: "Internal" } })
|
|
42
|
-
})
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
}).pipe(Effect.uninterruptible)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** The finalizer policy: run the close, then die on incomplete/failed (E stays never). */
|
|
49
|
-
function releaseOwner(operation: string, start: (callback: (report: CloseWire) => void) => void): Effect.Effect<void> {
|
|
50
|
-
return drainClose(operation, start).pipe(Effect.flatMap((report) => finalizeClose(operation, report)))
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { drainClose, releaseOwner }
|
package/src/db-native.ts
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Private database bridge over worker-owned core snapshots and results.
|
|
3
|
-
* The implementation lives in `ts/crate/src/`; this is not a public API.
|
|
4
|
-
* Every verb runs on the shared bounded executor, registers under its
|
|
5
|
-
* operation ownership and completes through the registered callback; `runtimeCancel` cancels
|
|
6
|
-
* and joins any of them. Close verbs report the real drain outcome through
|
|
7
|
-
* `CloseWire`.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { ChangeCounts } from "#changes.ts"
|
|
11
|
-
import type { DbHandle, ParsedQuery, QueryParam, SealedDescriptor, Violation } from "#native.ts"
|
|
12
|
-
import { native } from "#native.ts"
|
|
13
|
-
import type { CellValue } from "#rows.ts"
|
|
14
|
-
import type { CloseWire, OperationHandle, RuntimeHandle } from "#runtime-native.ts"
|
|
15
|
-
import type { SchemaSpec } from "#spec.ts"
|
|
16
|
-
|
|
17
|
-
export interface SnapshotHandle {
|
|
18
|
-
readonly __snapshot: unique symbol
|
|
19
|
-
}
|
|
20
|
-
export interface PreparedHandle {
|
|
21
|
-
readonly __prepared: unique symbol
|
|
22
|
-
}
|
|
23
|
-
export interface ResultHandle {
|
|
24
|
-
readonly __result: unique symbol
|
|
25
|
-
}
|
|
26
|
-
export interface CursorHandle {
|
|
27
|
-
readonly __cursor: unique symbol
|
|
28
|
-
}
|
|
29
|
-
export interface DraftHandle {
|
|
30
|
-
readonly __draft: unique symbol
|
|
31
|
-
}
|
|
32
|
-
export interface ChangesHandle {
|
|
33
|
-
readonly __changes: unique symbol
|
|
34
|
-
}
|
|
35
|
-
export interface ChangesCursorHandle {
|
|
36
|
-
readonly __changesCursor: unique symbol
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** The core-local witness: catalog/store identity plus generation, never a StateStamp. */
|
|
40
|
-
export interface WitnessWire {
|
|
41
|
-
readonly store: string
|
|
42
|
-
readonly generation: bigint
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type ExpectedWire =
|
|
46
|
-
| { readonly kind: "any" }
|
|
47
|
-
| { readonly kind: "exact"; readonly store: string; readonly generation: bigint }
|
|
48
|
-
|
|
49
|
-
export type ApplyOutcomeWire =
|
|
50
|
-
| { readonly tag: "accepted"; readonly witness: WitnessWire }
|
|
51
|
-
| { readonly tag: "no-change"; readonly witness: WitnessWire }
|
|
52
|
-
| { readonly tag: "invariant-rejected"; readonly violations: readonly Violation[] }
|
|
53
|
-
| { readonly tag: "moved"; readonly witnessed: WitnessWire; readonly current: WitnessWire }
|
|
54
|
-
|
|
55
|
-
export type JudgeOutcomeWire =
|
|
56
|
-
| { readonly tag: "admitted"; readonly base: WitnessWire; readonly changes: ChangeCounts }
|
|
57
|
-
| {
|
|
58
|
-
readonly tag: "invariant-rejected"
|
|
59
|
-
readonly base: WitnessWire
|
|
60
|
-
readonly changes: ChangeCounts
|
|
61
|
-
readonly violations: readonly Violation[]
|
|
62
|
-
}
|
|
63
|
-
| { readonly tag: "moved"; readonly witnessed: WitnessWire; readonly current: WitnessWire }
|
|
64
|
-
|
|
65
|
-
/** Bounded database diagnostics: measurements, never retained row payloads. */
|
|
66
|
-
export interface DbInspectionWire {
|
|
67
|
-
readonly generation: bigint
|
|
68
|
-
readonly storage: import("#db.ts").StorageInspection
|
|
69
|
-
readonly retainedOperations: bigint
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface SnapshotWire {
|
|
73
|
-
readonly snapshot: SnapshotHandle
|
|
74
|
-
readonly witness: WitnessWire
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface ChangesWire {
|
|
78
|
-
readonly changes: ChangesHandle
|
|
79
|
-
readonly fingerprint: string
|
|
80
|
-
readonly counts: ChangeCounts
|
|
81
|
-
readonly byteLength: bigint
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface ChangeRecordWire {
|
|
85
|
-
readonly relation: number
|
|
86
|
-
readonly kind: "add" | "remove"
|
|
87
|
-
readonly values: readonly CellValue[]
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface MutationReportWire {
|
|
91
|
-
readonly submitted: bigint
|
|
92
|
-
readonly changed: bigint
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
interface DbBridge {
|
|
96
|
-
/** Schema admission/compilation; take yields detached descriptor data. */
|
|
97
|
-
runtimeSchemaCompile(runtime: RuntimeHandle, spec: SchemaSpec, callback: () => void): OperationHandle
|
|
98
|
-
runtimeSchemaTake(operation: OperationHandle): SealedDescriptor
|
|
99
|
-
|
|
100
|
-
/** Coherent owned snapshot acquisition off a managed database. */
|
|
101
|
-
runtimeDbSnapshot(db: DbHandle, callback: () => void): OperationHandle
|
|
102
|
-
runtimeSnapshotTake(operation: OperationHandle): SnapshotWire
|
|
103
|
-
runtimeSnapshotClose(snapshot: SnapshotHandle, callback: (report: CloseWire) => void): void
|
|
104
|
-
|
|
105
|
-
/** One compiled query, with an independent share of the snapshot pin. */
|
|
106
|
-
runtimeSnapshotPrepare(snapshot: SnapshotHandle, query: ParsedQuery, callback: () => void): OperationHandle
|
|
107
|
-
runtimePreparedTake(operation: OperationHandle): PreparedHandle
|
|
108
|
-
runtimePreparedClose(prepared: PreparedHandle, callback: (report: CloseWire) => void): void
|
|
109
|
-
runtimePreparedReleaseMemory(prepared: PreparedHandle, callback: () => void): OperationHandle
|
|
110
|
-
|
|
111
|
-
/** Exact-key point read; take yields one owned row or null (absent). */
|
|
112
|
-
runtimeSnapshotGet(
|
|
113
|
-
snapshot: SnapshotHandle,
|
|
114
|
-
relationId: number,
|
|
115
|
-
keyStatementId: number,
|
|
116
|
-
keyCells: readonly CellValue[],
|
|
117
|
-
callback: () => void
|
|
118
|
-
): OperationHandle
|
|
119
|
-
runtimeRowTake(operation: OperationHandle): readonly CellValue[] | null
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Complete execution. One-shot preparation drops before publication;
|
|
123
|
-
* explicit preparation reuses its compiled plan and scratch. The result is
|
|
124
|
-
* sealed and independent only after ALL evaluation succeeded.
|
|
125
|
-
*/
|
|
126
|
-
runtimeSnapshotExecute(
|
|
127
|
-
snapshot: SnapshotHandle,
|
|
128
|
-
query: ParsedQuery,
|
|
129
|
-
params: readonly QueryParam[],
|
|
130
|
-
callback: () => void
|
|
131
|
-
): OperationHandle
|
|
132
|
-
runtimePreparedExecute(prepared: PreparedHandle, params: readonly QueryParam[], callback: () => void): OperationHandle
|
|
133
|
-
runtimeResultTake(operation: OperationHandle): ResultHandle
|
|
134
|
-
runtimeResultClose(result: ResultHandle, callback: (report: CloseWire) => void): void
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Explicit full materialization into final native row arrays.
|
|
138
|
-
* Failure leaves the sealed backing available.
|
|
139
|
-
*/
|
|
140
|
-
runtimeResultCollect(result: ResultHandle, callback: () => void): OperationHandle
|
|
141
|
-
runtimeRowsTake(operation: OperationHandle): readonly (readonly CellValue[])[]
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Atomic spend: moves the completed result's backing storage into one
|
|
145
|
-
* private cursor. A second transfer, or transfer racing collect,
|
|
146
|
-
* refuses (SpentHandle) before touching the backing.
|
|
147
|
-
*/
|
|
148
|
-
runtimeResultCursor(result: ResultHandle, callback: () => void): OperationHandle
|
|
149
|
-
runtimeCursorTake(operation: OperationHandle): CursorHandle
|
|
150
|
-
/** One bounded delivery batch; null is EOF. Execution is already complete. */
|
|
151
|
-
runtimeCursorNext(cursor: CursorHandle, callback: () => void): OperationHandle
|
|
152
|
-
runtimePageTake(operation: OperationHandle): readonly (readonly CellValue[])[] | null
|
|
153
|
-
runtimeCursorClose(cursor: CursorHandle, callback: (report: CloseWire) => void): void
|
|
154
|
-
|
|
155
|
-
/** Database-free draft acquisition (schema compiled/checked on the executor). */
|
|
156
|
-
runtimeDraftOpen(runtime: RuntimeHandle, spec: SchemaSpec, callback: () => void): OperationHandle
|
|
157
|
-
runtimeDraftTake(operation: OperationHandle): DraftHandle
|
|
158
|
-
/**
|
|
159
|
-
* One bounded ingestion chunk (rows × arity cells, row-major, sealed
|
|
160
|
-
* field order). Rows are owned by the draft until finish. Failure spends
|
|
161
|
-
* the draft and starts tracked
|
|
162
|
-
* drain natively.
|
|
163
|
-
*/
|
|
164
|
-
runtimeDraftInsert(
|
|
165
|
-
draft: DraftHandle,
|
|
166
|
-
relationId: number,
|
|
167
|
-
rows: bigint,
|
|
168
|
-
cells: readonly CellValue[],
|
|
169
|
-
callback: () => void
|
|
170
|
-
): OperationHandle
|
|
171
|
-
runtimeDraftDelete(
|
|
172
|
-
draft: DraftHandle,
|
|
173
|
-
relationId: number,
|
|
174
|
-
rows: bigint,
|
|
175
|
-
cells: readonly CellValue[],
|
|
176
|
-
callback: () => void
|
|
177
|
-
): OperationHandle
|
|
178
|
-
runtimeReportTake(operation: OperationHandle): MutationReportWire
|
|
179
|
-
/** Consumes the draft into an immutable schema-bound ChangeSet (one command, add-wins normalization). */
|
|
180
|
-
runtimeDraftFinish(draft: DraftHandle, callback: () => void): OperationHandle
|
|
181
|
-
runtimeChangesTake(operation: OperationHandle): ChangesWire
|
|
182
|
-
runtimeDraftClose(draft: DraftHandle, callback: (report: CloseWire) => void): void
|
|
183
|
-
runtimeChangesClose(changes: ChangesHandle, callback: (report: CloseWire) => void): void
|
|
184
|
-
/** Owned immutable bytes; parsing checks canonical order and the supplied schema. */
|
|
185
|
-
runtimeChangesBytes(changes: ChangesHandle, callback: () => void): OperationHandle
|
|
186
|
-
runtimeChangesParse(
|
|
187
|
-
runtime: RuntimeHandle,
|
|
188
|
-
spec: SchemaSpec,
|
|
189
|
-
bytes: Uint8Array,
|
|
190
|
-
callback: () => void
|
|
191
|
-
): OperationHandle
|
|
192
|
-
/** One command's add-wins composition, not sequential application. */
|
|
193
|
-
runtimeChangesCompose(left: ChangesHandle, right: ChangesHandle, callback: () => void): OperationHandle
|
|
194
|
-
/** Independent bounded traversal; never spends the immutable source. */
|
|
195
|
-
runtimeChangesCursor(changes: ChangesHandle, callback: () => void): OperationHandle
|
|
196
|
-
runtimeChangesCursorTake(operation: OperationHandle): ChangesCursorHandle
|
|
197
|
-
runtimeChangesCursorNext(cursor: ChangesCursorHandle, callback: () => void): OperationHandle
|
|
198
|
-
runtimeChangePageTake(operation: OperationHandle): readonly ChangeRecordWire[] | null
|
|
199
|
-
runtimeChangesCursorClose(cursor: ChangesCursorHandle, callback: (report: CloseWire) => void): void
|
|
200
|
-
|
|
201
|
-
/** One immutable final-state admission/commit under the managed owner. */
|
|
202
|
-
runtimeDbApply(db: DbHandle, changes: ChangesHandle, expected: ExpectedWire, callback: () => void): OperationHandle
|
|
203
|
-
runtimeApplyTake(operation: OperationHandle): ApplyOutcomeWire
|
|
204
|
-
/** Same candidate admission as apply, aborted on its worker before returning. */
|
|
205
|
-
runtimeDbJudge(db: DbHandle, changes: ChangesHandle, expected: ExpectedWire, callback: () => void): OperationHandle
|
|
206
|
-
runtimeJudgeTake(operation: OperationHandle): JudgeOutcomeWire
|
|
207
|
-
|
|
208
|
-
runtimeDbInspect(db: DbHandle, callback: () => void): OperationHandle
|
|
209
|
-
runtimeDbClearCache(db: DbHandle, callback: () => void): OperationHandle
|
|
210
|
-
runtimeDbInspectTake(operation: OperationHandle): DbInspectionWire
|
|
211
|
-
|
|
212
|
-
/** Shared canonical row codec (also the log/migration encoding). */
|
|
213
|
-
runtimeEncodeRows(
|
|
214
|
-
runtime: RuntimeHandle,
|
|
215
|
-
spec: SchemaSpec,
|
|
216
|
-
relationId: number,
|
|
217
|
-
rows: bigint,
|
|
218
|
-
cells: readonly CellValue[],
|
|
219
|
-
callback: () => void
|
|
220
|
-
): OperationHandle
|
|
221
|
-
runtimeBytesTake(operation: OperationHandle): Uint8Array
|
|
222
|
-
runtimeDecodeRows(
|
|
223
|
-
runtime: RuntimeHandle,
|
|
224
|
-
spec: SchemaSpec,
|
|
225
|
-
relationId: number,
|
|
226
|
-
bytes: Uint8Array,
|
|
227
|
-
callback: () => void
|
|
228
|
-
): OperationHandle
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Read-only migration-codec integration over native `schema_file` and
|
|
232
|
-
* `migration::{plan, manifest}` through the shared executor: bounded
|
|
233
|
-
* owned input, bounded owned JSON response bytes, one registered
|
|
234
|
-
* cancellable operation. Neither verb opens, initializes, freezes or
|
|
235
|
-
* migrates a database.
|
|
236
|
-
*/
|
|
237
|
-
runtimeMigrationSchema(runtime: RuntimeHandle, spec: SchemaSpec, callback: () => void): OperationHandle
|
|
238
|
-
runtimeMigrationRead(runtime: RuntimeHandle, request: Uint8Array, callback: () => void): OperationHandle
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// The fresh-addon roster test pins this private declaration exactly as it
|
|
242
|
-
// pins #runtime-native.ts's; the two casts re-type the SAME single binding.
|
|
243
|
-
export const dbNative = native as typeof native & DbBridge
|
package/src/internal/log.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @bjornpagen/bumbledb/internal/log — the exact-version cross-package seam
|
|
3
|
-
* consumed by `@bjornpagen/bumbledb-log`. Unsupported application surface;
|
|
4
|
-
* not a security boundary. Native kind/runtime/owner/state validation remains
|
|
5
|
-
* mandatory on every verb. Real types are shipped; this is not stripInternal.
|
|
6
|
-
*/
|
|
7
|
-
export type { ChangeDraft } from "#changes.ts"
|
|
8
|
-
export { ChangeSet, internalChanges } from "#changes.ts"
|
|
9
|
-
export type { CompiledSchema, SchemaId } from "#compile.ts"
|
|
10
|
-
export { Schema } from "#compile.ts"
|
|
11
|
-
export type { PreparedQuery, QueryReader } from "#db.ts"
|
|
12
|
-
export { Db, internalPublishedReader } from "#db.ts"
|
|
13
|
-
export type { SnapshotHandle } from "#db-native.ts"
|
|
14
|
-
export { lower } from "#lower.ts"
|
|
15
|
-
export { internalMigrationRead, internalMigrationSchema } from "#migration.ts"
|
|
16
|
-
export {
|
|
17
|
-
internalBlake3,
|
|
18
|
-
internalDescriptor,
|
|
19
|
-
internalLogIdentities,
|
|
20
|
-
internalLogSchema,
|
|
21
|
-
nativeBindingIsLoaded
|
|
22
|
-
} from "#native.ts"
|
|
23
|
-
export type { CompleteResult } from "#result.ts"
|
|
24
|
-
export { factCellsOf } from "#rows.ts"
|
|
25
|
-
export type { NativeRuntimeOptions, RepositoryLock } from "#runtime.ts"
|
|
26
|
-
export {
|
|
27
|
-
finalizeClose,
|
|
28
|
-
hashChunk,
|
|
29
|
-
internalAcquireRepositoryLock,
|
|
30
|
-
NativeRuntime,
|
|
31
|
-
nativeOperation,
|
|
32
|
-
nativeOperationWith,
|
|
33
|
-
runtimeHandle
|
|
34
|
-
} from "#runtime.ts"
|
|
35
|
-
export type { CloseReport, OutstandingWork } from "#runtime-errors.ts"
|
|
36
|
-
export { CloseFailure, DbError, dbError, runtimeErrorCodes } from "#runtime-errors.ts"
|
|
37
|
-
export type {
|
|
38
|
-
Capability,
|
|
39
|
-
CloseWire,
|
|
40
|
-
DirectoryHandle,
|
|
41
|
-
InspectionWire,
|
|
42
|
-
NativeKind,
|
|
43
|
-
OperationHandle,
|
|
44
|
-
RepositoryLockHandle,
|
|
45
|
-
RuntimeHandle
|
|
46
|
-
} from "#runtime-native.ts"
|
|
47
|
-
export { runtimeNative } from "#runtime-native.ts"
|
|
48
|
-
export { schemasAgree } from "#schema.ts"
|
package/src/migration.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Private log-migration integration entrypoints: the two read-only
|
|
3
|
-
* native migration-codec verbs the `@bjornpagen/bumbledb-log/migrations`
|
|
4
|
-
* generator imports, wired over the shared executor onto the native
|
|
5
|
-
* `schema_file`, `migration::plan` and `migration::manifest` modules.
|
|
6
|
-
*
|
|
7
|
-
* Both follow `hashChunk`'s shape: bounded owned input, bounded owned JSON
|
|
8
|
-
* response bytes, ONE registered cancellable operation under the acquired
|
|
9
|
-
* `NativeRuntime`. The schema verb takes the SDK `SchemaSpec` object — the
|
|
10
|
-
* same wire that already crosses the bridge for open/create — never a
|
|
11
|
-
* respelled text form. Neither verb opens, initializes, freezes or migrates
|
|
12
|
-
* a database; the durable migrate/activate/abort workflow is the log's
|
|
13
|
-
* admin surface, not this seam.
|
|
14
|
-
*/
|
|
15
|
-
import { Effect } from "effect"
|
|
16
|
-
import { dbNative } from "#db-native.ts"
|
|
17
|
-
import { nativeOperationWith, runtimeHandle } from "#runtime.ts"
|
|
18
|
-
import { DbError, dbError } from "#runtime-errors.ts"
|
|
19
|
-
import type { SchemaSpec } from "#spec.ts"
|
|
20
|
-
|
|
21
|
-
function owned(operation: string, value: Uint8Array | null): Uint8Array {
|
|
22
|
-
if (value === null) {
|
|
23
|
-
throw dbError(operation, { _tag: "Internal" })
|
|
24
|
-
}
|
|
25
|
-
return value
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Canonical schema admission for the migration generator: validates the
|
|
30
|
-
* spec natively and yields bounded JSON bytes carrying the canonical
|
|
31
|
-
* `schemaId` and the rendered schema snapshot.
|
|
32
|
-
*/
|
|
33
|
-
const internalMigrationSchema = Effect.fn("internalMigrationSchema")(function* (spec: SchemaSpec) {
|
|
34
|
-
const runtime = yield* runtimeHandle()
|
|
35
|
-
return yield* nativeOperationWith(
|
|
36
|
-
"internalMigrationSchema",
|
|
37
|
-
(callback) => dbNative.runtimeMigrationSchema(runtime, spec, callback),
|
|
38
|
-
dbNative.runtimeBytesTake,
|
|
39
|
-
(bytes) => owned("internalMigrationSchema", bytes)
|
|
40
|
-
)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* One bounded read-only migration-codec request (plan parse/validate/
|
|
45
|
-
* render/digest, manifest verify/append preview, plan-set digests): owned
|
|
46
|
-
* JSON request bytes in, owned JSON response bytes out.
|
|
47
|
-
*/
|
|
48
|
-
const internalMigrationRead = Effect.fn("internalMigrationRead")(function* (request: Uint8Array) {
|
|
49
|
-
if (!(request instanceof Uint8Array) || !(request.buffer instanceof ArrayBuffer)) {
|
|
50
|
-
return yield* Effect.fail(new DbError({ operation: "internalMigrationRead", reason: { _tag: "InvalidArgument" } }))
|
|
51
|
-
}
|
|
52
|
-
const runtime = yield* runtimeHandle()
|
|
53
|
-
return yield* nativeOperationWith(
|
|
54
|
-
"internalMigrationRead",
|
|
55
|
-
(callback) => dbNative.runtimeMigrationRead(runtime, request, callback),
|
|
56
|
-
dbNative.runtimeBytesTake,
|
|
57
|
-
(bytes) => owned("internalMigrationRead", bytes)
|
|
58
|
-
)
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
export { internalMigrationRead, internalMigrationSchema }
|