@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
|
@@ -0,0 +1,996 @@
|
|
|
1
|
+
/* Generated by crates/bumbledb-node/dts.sh from the napi annotations. Do not edit. */
|
|
2
|
+
|
|
3
|
+
declare const handle: unique symbol
|
|
4
|
+
|
|
5
|
+
export interface ChangesCursorHandle {
|
|
6
|
+
readonly [handle]: 'ChangesCursorHandle'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ChangesHandle {
|
|
10
|
+
readonly [handle]: 'ChangesHandle'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CursorHandle {
|
|
14
|
+
readonly [handle]: 'CursorHandle'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DbHandle {
|
|
18
|
+
readonly [handle]: 'DbHandle'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface DirectoryHandle {
|
|
22
|
+
readonly [handle]: 'DirectoryHandle'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface DraftHandle {
|
|
26
|
+
readonly [handle]: 'DraftHandle'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface HostedHandle {
|
|
30
|
+
readonly [handle]: 'HostedHandle'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface OperationHandle {
|
|
34
|
+
readonly [handle]: 'OperationHandle'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PreparedHandle {
|
|
38
|
+
readonly [handle]: 'PreparedHandle'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface QueryHandle {
|
|
42
|
+
readonly [handle]: 'QueryHandle'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ResultHandle {
|
|
46
|
+
readonly [handle]: 'ResultHandle'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface RuntimeHandle {
|
|
50
|
+
readonly [handle]: 'RuntimeHandle'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface SchemaHandle {
|
|
54
|
+
readonly [handle]: 'SchemaHandle'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface SnapshotHandle {
|
|
58
|
+
readonly [handle]: 'SnapshotHandle'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface T {
|
|
62
|
+
readonly [handle]: 'T'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface WitnessHandle {
|
|
66
|
+
readonly [handle]: 'WitnessHandle'
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
export declare class ExternalObject<T> {
|
|
71
|
+
readonly '': {
|
|
72
|
+
readonly '': unique symbol
|
|
73
|
+
[K: symbol]: T
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* One apply outcome. `Committed.changed` is false when the change set
|
|
79
|
+
* matched the committed state (the generation did not move); `Moved` means
|
|
80
|
+
* the expected generation was not the current one.
|
|
81
|
+
*/
|
|
82
|
+
export type ApplyOutcome =
|
|
83
|
+
| { _tag: 'Committed'; generation: bigint; changed: boolean }
|
|
84
|
+
| { _tag: 'Rejected'; violations: Array<ViolationOut> }
|
|
85
|
+
| { _tag: 'Moved'; witnessed: bigint; current: bigint }
|
|
86
|
+
|
|
87
|
+
export interface AtomIn {
|
|
88
|
+
source: AtomSourceIn
|
|
89
|
+
bindings: Array<BindingIn>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type AtomSourceIn =
|
|
93
|
+
| { kind: 'Edb'; relation: number }
|
|
94
|
+
| { kind: 'Interior'; interior: number }
|
|
95
|
+
|
|
96
|
+
export interface BindingIn {
|
|
97
|
+
field: number
|
|
98
|
+
term: TermIn
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type BoundSpecIn =
|
|
102
|
+
| { kind: 'Lit'; value: string }
|
|
103
|
+
| { kind: 'Field'; field: string }
|
|
104
|
+
| { kind: 'Duration'; field: string }
|
|
105
|
+
|
|
106
|
+
export type BucketOut = 'Log' | 'Checkpoints'
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* One bundled migration: its name, content hash (64 hex digits) and the
|
|
110
|
+
* schema spec it migrates to. The first step is the initial schema.
|
|
111
|
+
*/
|
|
112
|
+
export interface BundleStepIn {
|
|
113
|
+
name: string
|
|
114
|
+
hash: string
|
|
115
|
+
schema: SchemaSpecIn
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type CapacityWindowSpecIn =
|
|
119
|
+
| { kind: 'Exact'; n: BoundSpecIn }
|
|
120
|
+
| { kind: 'Range'; lo: BoundSpecIn; hi: BoundSpecIn }
|
|
121
|
+
| { kind: 'Floor'; lo: BoundSpecIn }
|
|
122
|
+
|
|
123
|
+
/** A capacity ceiling; `Unbounded` is the `*` window end. */
|
|
124
|
+
export type CeilingOut =
|
|
125
|
+
| { _tag: 'Unbounded' }
|
|
126
|
+
| { _tag: 'Lit'; value: bigint }
|
|
127
|
+
| { _tag: 'TargetField'; field: number }
|
|
128
|
+
| { _tag: 'TargetDuration'; field: number }
|
|
129
|
+
|
|
130
|
+
/** One tagged data-plane value: an execute param's scalar, or a set member. */
|
|
131
|
+
export type CellIn =
|
|
132
|
+
| { kind: 'Bool'; value: boolean }
|
|
133
|
+
| { kind: 'U64'; value: bigint }
|
|
134
|
+
| { kind: 'I64'; value: bigint }
|
|
135
|
+
| { kind: 'F64'; value: number }
|
|
136
|
+
| { kind: 'String'; value: string }
|
|
137
|
+
| { kind: 'Uuid'; value: string }
|
|
138
|
+
| { kind: 'FixedBytes'; value: Uint8Array }
|
|
139
|
+
| { kind: 'IntervalU64'; start: bigint; end: bigint }
|
|
140
|
+
| { kind: 'IntervalI64'; start: bigint; end: bigint }
|
|
141
|
+
| { kind: 'IntervalF64'; start: number; end: number }
|
|
142
|
+
|
|
143
|
+
export interface CellInterval {
|
|
144
|
+
start: bigint | number
|
|
145
|
+
end: bigint | number
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* One row cell as JavaScript sees it: `u64`/`i64` as `bigint`, `f64` as
|
|
150
|
+
* `number`, text and UUIDs as `string`, bytes as `Uint8Array`, intervals as
|
|
151
|
+
* `{ start, end }` in their element's representation.
|
|
152
|
+
*/
|
|
153
|
+
export type CellValue = boolean | bigint | number | string | Uint8Array | CellInterval
|
|
154
|
+
|
|
155
|
+
export interface ChangeCounts {
|
|
156
|
+
added: bigint
|
|
157
|
+
removed: bigint
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export type ChangeKindOut = 'Add' | 'Remove'
|
|
161
|
+
|
|
162
|
+
/** One change record: an addition or removal of one row of `relation`. */
|
|
163
|
+
export interface ChangeRecordOut {
|
|
164
|
+
relation: number
|
|
165
|
+
kind: ChangeKindOut
|
|
166
|
+
values: Array<CellValue>
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** A sealed change set and its summary. */
|
|
170
|
+
export interface ChangesOut {
|
|
171
|
+
changes: ExternalObject<ChangesHandle>
|
|
172
|
+
fingerprint: string
|
|
173
|
+
counts: ChangeCounts
|
|
174
|
+
byteLength: bigint
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** One closed relation row: its handle, declaration-order id and columns. */
|
|
178
|
+
export interface ClosedRowOut {
|
|
179
|
+
handle: string
|
|
180
|
+
id: bigint
|
|
181
|
+
values: Array<NamedValueOut>
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface ClosedSpecIn {
|
|
185
|
+
newtype: string
|
|
186
|
+
rows: Array<RowSpecIn>
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* A close or cancel outcome: joined, timed out with work still
|
|
191
|
+
* outstanding, or failed (cleanup capacity exhausted or teardown failed).
|
|
192
|
+
*/
|
|
193
|
+
export type CloseOut =
|
|
194
|
+
| { _tag: 'Closed' }
|
|
195
|
+
| { _tag: 'Incomplete'; outstanding: InspectionOut }
|
|
196
|
+
| { _tag: 'Failed' }
|
|
197
|
+
|
|
198
|
+
/** A comparison operator; `Allen.mask` is a nonzero 13-bit relation set. */
|
|
199
|
+
export type CmpOpIn =
|
|
200
|
+
| { kind: 'Eq' }
|
|
201
|
+
| { kind: 'Ne' }
|
|
202
|
+
| { kind: 'Lt' }
|
|
203
|
+
| { kind: 'Le' }
|
|
204
|
+
| { kind: 'Gt' }
|
|
205
|
+
| { kind: 'Ge' }
|
|
206
|
+
| { kind: 'PointIn' }
|
|
207
|
+
| { kind: 'Allen'; mask: number }
|
|
208
|
+
|
|
209
|
+
/** Compile one schema spec (the schema file's JSON) into a validated handle. */
|
|
210
|
+
export declare function compileSchema(specJson: string): SchemaCompiled
|
|
211
|
+
|
|
212
|
+
export type ConditionIn =
|
|
213
|
+
| { kind: 'Leaf'; op: CmpOpIn; lhs: TermIn; rhs: TermIn }
|
|
214
|
+
| { kind: 'And'; children: Array<ConditionIn> }
|
|
215
|
+
| { kind: 'Or'; children: Array<ConditionIn> }
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* One relation a migration copies unchanged: `target` at the new schema
|
|
219
|
+
* from `source` at the old one.
|
|
220
|
+
*/
|
|
221
|
+
export interface CopyPair {
|
|
222
|
+
target: number
|
|
223
|
+
source: number
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Bounded database diagnostics, never rows. */
|
|
227
|
+
export interface DbInspection {
|
|
228
|
+
generation: bigint
|
|
229
|
+
diskBytes: bigint
|
|
230
|
+
retainedOperations: bigint
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** A database open outcome. Refusals are domain outcomes, not failures. */
|
|
234
|
+
export type DbOpened =
|
|
235
|
+
| { _tag: 'Opened'; db: ExternalObject<DbHandle> }
|
|
236
|
+
| { _tag: 'Rejected'; violations: Array<ViolationOut> }
|
|
237
|
+
| { _tag: 'FingerprintMismatch'; message: string }
|
|
238
|
+
| { _tag: 'DestinationExists'; message: string }
|
|
239
|
+
|
|
240
|
+
export interface DoneOut {
|
|
241
|
+
ticket: bigint
|
|
242
|
+
settled: SettledOut
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export declare function engineVersion(): string
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* A rejection's evidence, rendered against the schema it was judged under
|
|
249
|
+
* when this code bundles it.
|
|
250
|
+
*/
|
|
251
|
+
export interface EvidenceOut {
|
|
252
|
+
violations: Array<ViolationOut>
|
|
253
|
+
bytes: Uint8Array
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** One fact a violation cites, by relation and field names. */
|
|
257
|
+
export interface FactOut {
|
|
258
|
+
relation: string
|
|
259
|
+
fields: Array<NamedValueOut>
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface FieldOut {
|
|
263
|
+
name: string
|
|
264
|
+
id: number
|
|
265
|
+
valueType: ValueTypeOut
|
|
266
|
+
newtype?: string
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface FieldSpecIn {
|
|
270
|
+
name: string
|
|
271
|
+
valueType: ValueTypeIn
|
|
272
|
+
newtype?: string
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export type FindTermIn =
|
|
276
|
+
| { kind: 'Var'; var: number }
|
|
277
|
+
| { kind: 'Compute'; expr: ScalarExprIn }
|
|
278
|
+
| { kind: 'Segments'; op: SegmentOpIn; left: number; right: number }
|
|
279
|
+
| { kind: 'Count' }
|
|
280
|
+
| { kind: 'Aggregate'; op: FoldOpIn; over: number }
|
|
281
|
+
| { kind: 'Pack'; over: number }
|
|
282
|
+
|
|
283
|
+
export type FixedIntervalElementIn = 'U64' | 'I64'
|
|
284
|
+
|
|
285
|
+
export type FoldOpIn = 'Sum' | 'Mean' | 'Min' | 'Max'
|
|
286
|
+
|
|
287
|
+
export type HeadOpIn = 'Sum' | 'Mean' | 'Min' | 'Max' | 'Count' | 'Pack'
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The decided state: identity, position, revision, schema fingerprint, the
|
|
291
|
+
* migration ledger, and the store-time end of a freeze.
|
|
292
|
+
*/
|
|
293
|
+
export interface HeadOut {
|
|
294
|
+
database: string
|
|
295
|
+
seq: bigint
|
|
296
|
+
revision: bigint
|
|
297
|
+
schema: string
|
|
298
|
+
applied: Array<MigrationOut>
|
|
299
|
+
rejected: Array<MigrationOut>
|
|
300
|
+
frozenUntil?: bigint
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export type HeadTermIn =
|
|
304
|
+
| { kind: 'Var' }
|
|
305
|
+
| { kind: 'Compute' }
|
|
306
|
+
| { kind: 'Aggregate'; op: HeadOpIn }
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Close the machine and its cache. Step `Close` first to settle every
|
|
310
|
+
* pending ticket.
|
|
311
|
+
*/
|
|
312
|
+
export declare function hostedClose(hosted: ExternalObject<HostedHandle>, callback: (arg: CloseOut) => void): void
|
|
313
|
+
|
|
314
|
+
/** A machine input that carries no change set. */
|
|
315
|
+
export type HostedInput =
|
|
316
|
+
| { _tag: 'Open'; ticket: bigint }
|
|
317
|
+
| { _tag: 'Sync'; ticket: bigint }
|
|
318
|
+
| { _tag: 'Resolve'; ticket: bigint; request: string }
|
|
319
|
+
| { _tag: 'Freeze'; ticket: bigint; leaseMillis: bigint }
|
|
320
|
+
| { _tag: 'Close' }
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Apply bundled migration `step`, computed at `base` (the head the rows
|
|
324
|
+
* were computed from): `copy` relations carried over unchanged plus the
|
|
325
|
+
* computed `rows` at the new schema.
|
|
326
|
+
*/
|
|
327
|
+
export declare function hostedMigrate(hosted: ExternalObject<HostedHandle>, ticket: bigint, step: number, base: bigint, copy: Array<CopyPair>, rows: ExternalObject<ChangesHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Open the hosted database whose cache lives in `childName` of an owned
|
|
331
|
+
* directory. `openJson` is a `HostedOpenIn`.
|
|
332
|
+
*/
|
|
333
|
+
export declare function hostedOpen(directory: ExternalObject<DirectoryHandle>, childName: string, openJson: string, callback: () => void): ExternalObject<OperationHandle>
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Everything a hosted database opens with. `seed` (32 hex digits) is
|
|
337
|
+
* random per process; `create` (32 hex digits) is the identity a new
|
|
338
|
+
* database gets when its log is empty, absent to refuse creation.
|
|
339
|
+
*/
|
|
340
|
+
export interface HostedOpenIn {
|
|
341
|
+
bundle: Array<BundleStepIn>
|
|
342
|
+
seed: string
|
|
343
|
+
create?: string
|
|
344
|
+
probeWindow: number
|
|
345
|
+
checkpointEvery: string
|
|
346
|
+
checkpointKeep: number
|
|
347
|
+
maxEntryBytes: number
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Feed back one completed store request. `date` is the response's `Date`
|
|
352
|
+
* header in Unix milliseconds.
|
|
353
|
+
*/
|
|
354
|
+
export declare function hostedRespond(hosted: ExternalObject<HostedHandle>, id: bigint, date: bigint | undefined | null, outcome: IoOutcomeIn, callback: () => void): ExternalObject<OperationHandle>
|
|
355
|
+
|
|
356
|
+
/** Feed back one `GetMemory` request that found its object. */
|
|
357
|
+
export declare function hostedRespondBody(hosted: ExternalObject<HostedHandle>, id: bigint, date: bigint | undefined | null, lastModified: bigint, body: Uint8Array, callback: () => void): ExternalObject<OperationHandle>
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Pin a snapshot of the cache's current state; take it with
|
|
361
|
+
* `runtimeSnapshotTake`. Refuses `ClosedHandle` before the first state.
|
|
362
|
+
*/
|
|
363
|
+
export declare function hostedSnapshot(hosted: ExternalObject<HostedHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
364
|
+
|
|
365
|
+
export declare function hostedStep(hosted: ExternalObject<HostedHandle>, input: HostedInput, callback: () => void): ExternalObject<OperationHandle>
|
|
366
|
+
|
|
367
|
+
export declare function hostedStepTake(handle: ExternalObject<OperationHandle>): StepOut
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Submit one command: the request id (32 hex digits) is its idempotency
|
|
371
|
+
* key; `revision` present requires exactly that committed revision.
|
|
372
|
+
*/
|
|
373
|
+
export declare function hostedSubmit(hosted: ExternalObject<HostedHandle>, ticket: bigint, request: string, revision: bigint | undefined | null, changes: ExternalObject<ChangesHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
374
|
+
|
|
375
|
+
export declare function hostedTake(handle: ExternalObject<OperationHandle>): ExternalObject<HostedHandle>
|
|
376
|
+
|
|
377
|
+
/** The relations bundled migration `step` copies unchanged by default. */
|
|
378
|
+
export declare function hostedUnchanged(hosted: ExternalObject<HostedHandle>, step: number): Array<CopyPair>
|
|
379
|
+
|
|
380
|
+
/** Bounded runtime bookkeeping counts. */
|
|
381
|
+
export interface InspectionOut {
|
|
382
|
+
phase: Phase
|
|
383
|
+
queued: bigint
|
|
384
|
+
active: bigint
|
|
385
|
+
retained: bigint
|
|
386
|
+
owners: bigint
|
|
387
|
+
databases: bigint
|
|
388
|
+
natives: bigint
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export interface InteriorIn {
|
|
392
|
+
rules: Array<RuleIn>
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export type IntervalElementIn = 'U64' | 'I64' | 'F64'
|
|
396
|
+
|
|
397
|
+
export type IntervalElementOut = 'U64' | 'I64' | 'F64'
|
|
398
|
+
|
|
399
|
+
/** The outcome of one store request other than a body read. */
|
|
400
|
+
export type IoOutcomeIn =
|
|
401
|
+
| { _tag: 'Saved'; lastModified: bigint }
|
|
402
|
+
| { _tag: 'Missing' }
|
|
403
|
+
| { _tag: 'Created' }
|
|
404
|
+
| { _tag: 'Occupied' }
|
|
405
|
+
| { _tag: 'Keys'; keys: Array<string> }
|
|
406
|
+
| { _tag: 'Deleted' }
|
|
407
|
+
| { _tag: 'Failed' }
|
|
408
|
+
|
|
409
|
+
/** One store request; `key` is relative to the database's prefix. */
|
|
410
|
+
export interface IoRequestOut {
|
|
411
|
+
id: bigint
|
|
412
|
+
bucket: BucketOut
|
|
413
|
+
key: string
|
|
414
|
+
op: OpOut
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* One judgment of the change set against the current `generation`; the
|
|
419
|
+
* database never changes.
|
|
420
|
+
*/
|
|
421
|
+
export type JudgeOutcome =
|
|
422
|
+
| { _tag: 'Admitted'; generation: bigint; changes: ChangeCounts }
|
|
423
|
+
| { _tag: 'Rejected'; generation: bigint; violations: Array<ViolationOut> }
|
|
424
|
+
| { _tag: 'Moved'; witnessed: bigint; current: bigint }
|
|
425
|
+
|
|
426
|
+
/** One selection binding's right side; a literal set reads disjunctively. */
|
|
427
|
+
export type LiteralSetSpecIn =
|
|
428
|
+
| { kind: 'One'; literal: LiteralSpecIn }
|
|
429
|
+
| { kind: 'Many'; literals: Array<LiteralSpecIn> }
|
|
430
|
+
|
|
431
|
+
/** A literal as spelled: a plain value, or a closed relation's handle. */
|
|
432
|
+
export type LiteralSpecIn =
|
|
433
|
+
| { kind: 'Value'; value: ValueIn }
|
|
434
|
+
| { kind: 'Handle'; handle: string }
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* A JSON input that does not match its wire type: the serde path to the
|
|
438
|
+
* offending node (for example `rules[0].atoms[2].bindings`) and why.
|
|
439
|
+
*/
|
|
440
|
+
export interface Malformed {
|
|
441
|
+
path: string
|
|
442
|
+
message: string
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export interface MigrationOut {
|
|
446
|
+
name: string
|
|
447
|
+
hash: string
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** One named cell of a rendered fact or closed row. */
|
|
451
|
+
export interface NamedValueOut {
|
|
452
|
+
name: string
|
|
453
|
+
value: CellValue
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export type NumericCastIn = 'ToF64' | 'ToF64Exact' | 'ToI64Exact' | 'ToU64Exact'
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* One store operation. `GetFile` downloads into `path`; `PutFile` uploads
|
|
460
|
+
* the file at `path`; puts are create-only (`If-None-Match: *`).
|
|
461
|
+
*/
|
|
462
|
+
export type OpOut =
|
|
463
|
+
| { _tag: 'GetMemory' }
|
|
464
|
+
| { _tag: 'GetFile'; path: string }
|
|
465
|
+
| { _tag: 'PutBytes'; bytes: Uint8Array }
|
|
466
|
+
| { _tag: 'PutFile'; path: string }
|
|
467
|
+
| { _tag: 'List'; startAfter?: string; maxKeys: number }
|
|
468
|
+
| { _tag: 'Delete' }
|
|
469
|
+
|
|
470
|
+
export type OutcomeOut =
|
|
471
|
+
| { _tag: 'Committed'; added: bigint; removed: bigint }
|
|
472
|
+
| { _tag: 'NoChange' }
|
|
473
|
+
| { _tag: 'PreconditionFailed'; expected: bigint; observed: bigint }
|
|
474
|
+
| { _tag: 'InvariantRejected'; evidence: EvidenceOut }
|
|
475
|
+
|
|
476
|
+
/** One execute param, positional by `ParamId`. */
|
|
477
|
+
export type ParamIn = CellIn | ParamSetIn
|
|
478
|
+
|
|
479
|
+
/** A set param: membership in any of `values`. */
|
|
480
|
+
export interface ParamSetIn {
|
|
481
|
+
kind: 'Set'
|
|
482
|
+
values: Array<CellIn>
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export type Phase = 'Open' | 'Closing' | 'Closed'
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* The engine's refusal: `code` is its `ValidationError` variant, `refusal`
|
|
489
|
+
* the cited position's specific refusal (for example `Field` with
|
|
490
|
+
* `Unknown`, `Comparison` with `Unordered.Interval`), plus whichever
|
|
491
|
+
* rule-local coordinates it cites. `comparison` indexes the rule's
|
|
492
|
+
* flattened comparisons.
|
|
493
|
+
*/
|
|
494
|
+
export interface QueryDiagnostic {
|
|
495
|
+
code: string
|
|
496
|
+
refusal?: string
|
|
497
|
+
message: string
|
|
498
|
+
rule?: number
|
|
499
|
+
atom?: number
|
|
500
|
+
find?: number
|
|
501
|
+
field?: number
|
|
502
|
+
relation?: number
|
|
503
|
+
var?: number
|
|
504
|
+
param?: number
|
|
505
|
+
comparison?: number
|
|
506
|
+
interior?: number
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export interface QueryIn {
|
|
510
|
+
interiors: Array<InteriorIn>
|
|
511
|
+
head: Array<HeadTermIn>
|
|
512
|
+
rules: Array<RuleIn>
|
|
513
|
+
rec?: RecIn
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export type QueryValidated =
|
|
517
|
+
| { _tag: 'Valid'; query: ExternalObject<QueryHandle> }
|
|
518
|
+
| { _tag: 'Invalid'; diagnostic: QueryDiagnostic }
|
|
519
|
+
| { _tag: 'Malformed'; path: string; message: string }
|
|
520
|
+
|
|
521
|
+
/** One request's durable decision; `seq` is the read-your-writes bookmark. */
|
|
522
|
+
export interface ReceiptOut {
|
|
523
|
+
request: string
|
|
524
|
+
command: string
|
|
525
|
+
seq: bigint
|
|
526
|
+
revision: bigint
|
|
527
|
+
outcome: OutcomeOut
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** A recursive stage: nonempty base and step arms. */
|
|
531
|
+
export interface RecIn {
|
|
532
|
+
base: Array<RecRuleIn>
|
|
533
|
+
rec: Array<RecStepIn>
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export interface RecRuleIn {
|
|
537
|
+
finds: Array<number>
|
|
538
|
+
atoms: Array<AtomIn>
|
|
539
|
+
conditions: Array<ConditionIn>
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** A recursive step: `selfBindings` binds the stage's own previous output. */
|
|
543
|
+
export interface RecStepIn {
|
|
544
|
+
finds: Array<number>
|
|
545
|
+
selfBindings: Array<BindingIn>
|
|
546
|
+
atoms: Array<AtomIn>
|
|
547
|
+
conditions: Array<ConditionIn>
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Why a ticket settled without its effect. Every refusal of a submit except
|
|
552
|
+
* `Unknown` proves the log does not decide the command.
|
|
553
|
+
*/
|
|
554
|
+
export type RefusalOut =
|
|
555
|
+
| { _tag: 'NotOpen' }
|
|
556
|
+
| { _tag: 'Closed' }
|
|
557
|
+
| { _tag: 'NotFound' }
|
|
558
|
+
| { _tag: 'Frozen'; deadline: bigint }
|
|
559
|
+
| { _tag: 'SchemaAdvanced' }
|
|
560
|
+
| { _tag: 'MigrationPending'; next: number }
|
|
561
|
+
| { _tag: 'MigrationRejected'; migration: MigrationOut; evidence: EvidenceOut }
|
|
562
|
+
| { _tag: 'MigrationsDiverged'; index: number }
|
|
563
|
+
| { _tag: 'NotPending' }
|
|
564
|
+
| { _tag: 'Stale'; head: bigint }
|
|
565
|
+
| { _tag: 'RequestReused'; request: string; command: string }
|
|
566
|
+
| { _tag: 'ForeignSchema' }
|
|
567
|
+
| { _tag: 'TooLarge' }
|
|
568
|
+
| { _tag: 'Unknown' }
|
|
569
|
+
| { _tag: 'NotSubmitted' }
|
|
570
|
+
| { _tag: 'Cache'; message: string }
|
|
571
|
+
| { _tag: 'Corrupt'; seq: bigint }
|
|
572
|
+
|
|
573
|
+
export interface RelationOut {
|
|
574
|
+
name: string
|
|
575
|
+
id: number
|
|
576
|
+
fields: Array<FieldOut>
|
|
577
|
+
extension?: Array<ClosedRowOut>
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/** One relation; `closed` present declares it closed. */
|
|
581
|
+
export interface RelationSpecIn {
|
|
582
|
+
name: string
|
|
583
|
+
fields: Array<FieldSpecIn>
|
|
584
|
+
closed?: ClosedSpecIn
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export type RoundingIn = 'TowardZero' | 'NearestTiesAwayFromZero' | 'NearestTiesToEven'
|
|
588
|
+
|
|
589
|
+
export interface RowSpecIn {
|
|
590
|
+
handle: string
|
|
591
|
+
values: Array<LiteralSpecIn>
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export interface RuleIn {
|
|
595
|
+
finds: Array<FindTermIn>
|
|
596
|
+
atoms: Array<AtomIn>
|
|
597
|
+
negated: Array<AtomIn>
|
|
598
|
+
conditions: Array<ConditionIn>
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export declare function runtimeApplyTake(handle: ExternalObject<OperationHandle>): ApplyOutcome
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Cancel the next payload publication between producing a page and
|
|
605
|
+
* accepting its delivery. A page already accepted is kept.
|
|
606
|
+
*/
|
|
607
|
+
export declare function runtimeArmPublicationCancel(handle: ExternalObject<RuntimeHandle>): void
|
|
608
|
+
|
|
609
|
+
export declare function runtimeBytesTake(handle: ExternalObject<OperationHandle>): Uint8Array
|
|
610
|
+
|
|
611
|
+
export declare function runtimeCancel(handle: ExternalObject<OperationHandle>, callback: (arg: CloseOut) => void): void
|
|
612
|
+
|
|
613
|
+
/** One page of change records; `null` is the end of the cursor. */
|
|
614
|
+
export declare function runtimeChangePageTake(handle: ExternalObject<OperationHandle>): Array<ChangeRecordOut> | null
|
|
615
|
+
|
|
616
|
+
/** The change set's canonical bytes. */
|
|
617
|
+
export declare function runtimeChangesBytes(handle: ExternalObject<ChangesHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
618
|
+
|
|
619
|
+
export declare function runtimeChangesClose(handle: ExternalObject<ChangesHandle>, callback: (arg: CloseOut) => void): void
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Compose two change sets into one (`left` then `right`). The first stage
|
|
623
|
+
* retains only an `Arc` share, then returns its worker immediately.
|
|
624
|
+
*/
|
|
625
|
+
export declare function runtimeChangesCompose(left: ExternalObject<ChangesHandle>, right: ExternalObject<ChangesHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
626
|
+
|
|
627
|
+
/** Open a fresh read position over the change set's records. */
|
|
628
|
+
export declare function runtimeChangesCursor(handle: ExternalObject<ChangesHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
629
|
+
|
|
630
|
+
export declare function runtimeChangesCursorClose(handle: ExternalObject<ChangesCursorHandle>, callback: (arg: CloseOut) => void): void
|
|
631
|
+
|
|
632
|
+
export declare function runtimeChangesCursorNext(handle: ExternalObject<ChangesCursorHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
633
|
+
|
|
634
|
+
export declare function runtimeChangesCursorTake(handle: ExternalObject<OperationHandle>): ExternalObject<ChangesCursorHandle>
|
|
635
|
+
|
|
636
|
+
/** Parse canonical change-set bytes under a compiled schema. */
|
|
637
|
+
export declare function runtimeChangesParse(handle: ExternalObject<RuntimeHandle>, schema: ExternalObject<SchemaHandle>, bytes: Uint8Array, callback: () => void): ExternalObject<OperationHandle>
|
|
638
|
+
|
|
639
|
+
export declare function runtimeChangesTake(handle: ExternalObject<OperationHandle>): ChangesOut
|
|
640
|
+
|
|
641
|
+
export declare function runtimeClose(handle: ExternalObject<RuntimeHandle>, callback: (arg: CloseOut) => void): void
|
|
642
|
+
|
|
643
|
+
export declare function runtimeCursorClose(handle: ExternalObject<CursorHandle>, callback: (arg: CloseOut) => void): void
|
|
644
|
+
|
|
645
|
+
/** Publish the cursor's next page; a terminal store failure closes it. */
|
|
646
|
+
export declare function runtimeCursorNext(handle: ExternalObject<CursorHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
647
|
+
|
|
648
|
+
export declare function runtimeCursorTake(handle: ExternalObject<OperationHandle>): ExternalObject<CursorHandle>
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Apply a sealed change set as one judged commit; with `expected`, only if
|
|
652
|
+
* the state that witness observed is still current.
|
|
653
|
+
*/
|
|
654
|
+
export declare function runtimeDbApply(db: ExternalObject<DbHandle>, changes: ExternalObject<ChangesHandle>, expected: ExternalObject<WitnessHandle> | undefined | null, callback: () => void): ExternalObject<OperationHandle>
|
|
655
|
+
|
|
656
|
+
/** Drop the database's derived query caches. */
|
|
657
|
+
export declare function runtimeDbClearCache(db: ExternalObject<DbHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
658
|
+
|
|
659
|
+
export declare function runtimeDbInspect(db: ExternalObject<DbHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
660
|
+
|
|
661
|
+
export declare function runtimeDbInspectTake(handle: ExternalObject<OperationHandle>): DbInspection
|
|
662
|
+
|
|
663
|
+
/** Judge a sealed change set against the current state without committing. */
|
|
664
|
+
export declare function runtimeDbJudge(db: ExternalObject<DbHandle>, changes: ExternalObject<ChangesHandle>, expected: ExternalObject<WitnessHandle> | undefined | null, callback: () => void): ExternalObject<OperationHandle>
|
|
665
|
+
|
|
666
|
+
export declare function runtimeDbSnapshot(db: ExternalObject<DbHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
667
|
+
|
|
668
|
+
export declare function runtimeDbTake(handle: ExternalObject<OperationHandle>): DbOpened
|
|
669
|
+
|
|
670
|
+
/** Decode canonical-codec bytes holding only additions of `relation`. */
|
|
671
|
+
export declare function runtimeDecodeRows(handle: ExternalObject<RuntimeHandle>, schema: ExternalObject<SchemaHandle>, relation: number, bytes: Uint8Array, callback: () => void): ExternalObject<OperationHandle>
|
|
672
|
+
|
|
673
|
+
export declare function runtimeDirectoryAcquire(handle: ExternalObject<RuntimeHandle>, path: string, callback: () => void): ExternalObject<OperationHandle>
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Hold the directory open across awaited JavaScript work; end it with
|
|
677
|
+
* `runtimeDirectoryEnd`.
|
|
678
|
+
*/
|
|
679
|
+
export declare function runtimeDirectoryBegin(handle: ExternalObject<DirectoryHandle>): ExternalObject<OperationHandle>
|
|
680
|
+
|
|
681
|
+
export declare function runtimeDirectoryCheck(handle: ExternalObject<OperationHandle>): void
|
|
682
|
+
|
|
683
|
+
export declare function runtimeDirectoryClose(handle: ExternalObject<DirectoryHandle>, remove: boolean, callback: (arg: CloseOut) => void): void
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Open (or create) one database in a child directory of an owned
|
|
687
|
+
* directory, under a compiled schema.
|
|
688
|
+
*/
|
|
689
|
+
export declare function runtimeDirectoryDbOpen(handle: ExternalObject<DirectoryHandle>, childName: string, schema: ExternalObject<SchemaHandle>, create: boolean, callback: () => void): ExternalObject<OperationHandle>
|
|
690
|
+
|
|
691
|
+
export declare function runtimeDirectoryEnd(handle: ExternalObject<OperationHandle>): void
|
|
692
|
+
|
|
693
|
+
export declare function runtimeDirectoryTake(handle: ExternalObject<OperationHandle>): ExternalObject<DirectoryHandle>
|
|
694
|
+
|
|
695
|
+
export declare function runtimeDraftClose(handle: ExternalObject<DraftHandle>, callback: (arg: CloseOut) => void): void
|
|
696
|
+
|
|
697
|
+
/** Stage `rows` removals of `relation`, shaped like `runtimeDraftInsert`. */
|
|
698
|
+
export declare function runtimeDraftDelete(handle: ExternalObject<DraftHandle>, relation: number, rows: bigint, cells: Array<CellValue>, callback: () => void): ExternalObject<OperationHandle>
|
|
699
|
+
|
|
700
|
+
/** Seal the draft into an immutable change set; the draft is spent. */
|
|
701
|
+
export declare function runtimeDraftFinish(handle: ExternalObject<DraftHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Stage `rows` additions of `relation`; `cells` is row-major in sealed
|
|
705
|
+
* field order. A refused chunk spends the draft.
|
|
706
|
+
*/
|
|
707
|
+
export declare function runtimeDraftInsert(handle: ExternalObject<DraftHandle>, relation: number, rows: bigint, cells: Array<CellValue>, callback: () => void): ExternalObject<OperationHandle>
|
|
708
|
+
|
|
709
|
+
/** Open a database-free change draft under a compiled schema. */
|
|
710
|
+
export declare function runtimeDraftOpen(handle: ExternalObject<RuntimeHandle>, schema: ExternalObject<SchemaHandle>): ExternalObject<DraftHandle>
|
|
711
|
+
|
|
712
|
+
/** Encode `rows` rows of `relation` into the canonical change-set row codec. */
|
|
713
|
+
export declare function runtimeEncodeRows(handle: ExternalObject<RuntimeHandle>, schema: ExternalObject<SchemaHandle>, relation: number, rows: bigint, cells: Array<CellValue>, callback: () => void): ExternalObject<OperationHandle>
|
|
714
|
+
|
|
715
|
+
/** Why a bridge call failed. Thrown to JavaScript as this `_tag` object. */
|
|
716
|
+
export type RuntimeError =
|
|
717
|
+
| { _tag: 'RuntimeAlreadyLive' }
|
|
718
|
+
| { _tag: 'ForeignRuntime' }
|
|
719
|
+
| { _tag: 'ClosedHandle' }
|
|
720
|
+
| { _tag: 'HandleBusy' }
|
|
721
|
+
| { _tag: 'SpentHandle' }
|
|
722
|
+
| { _tag: 'QueueFull' }
|
|
723
|
+
| { _tag: 'InvalidArgument' }
|
|
724
|
+
| { _tag: 'InvalidValue'; message: string }
|
|
725
|
+
| { _tag: 'Internal' }
|
|
726
|
+
| { _tag: 'DirectoryBusy' }
|
|
727
|
+
| { _tag: 'WriterBusy' }
|
|
728
|
+
| { _tag: 'InvalidPath' }
|
|
729
|
+
| { _tag: 'Io'; kind: string; osCode?: number }
|
|
730
|
+
| { _tag: 'ResourceLimit'; dimension: string; used: bigint; requested: bigint; limit: bigint }
|
|
731
|
+
| { _tag: 'Engine'; kind: string; message: string }
|
|
732
|
+
| { _tag: 'Malformed'; path: string; message: string }
|
|
733
|
+
| { _tag: 'Cancelled' }
|
|
734
|
+
| { _tag: 'OutOfMemory' }
|
|
735
|
+
|
|
736
|
+
export declare function runtimeInspect(handle: ExternalObject<RuntimeHandle>): InspectionOut
|
|
737
|
+
|
|
738
|
+
export declare function runtimeJudgeTake(handle: ExternalObject<OperationHandle>): JudgeOutcome
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* The one close authority: begin the database's drain and report its
|
|
742
|
+
* real outcome.
|
|
743
|
+
*/
|
|
744
|
+
export declare function runtimeManagedDbClose(db: ExternalObject<DbHandle>, callback: (arg: CloseOut) => void): void
|
|
745
|
+
|
|
746
|
+
/** Start the one live runtime. `optionsJson` is a `RuntimeOptionsIn`. */
|
|
747
|
+
export declare function runtimeOpen(optionsJson: string): ExternalObject<RuntimeHandle>
|
|
748
|
+
|
|
749
|
+
export interface RuntimeOptionsIn {
|
|
750
|
+
workers?: number
|
|
751
|
+
queueCapacity?: number
|
|
752
|
+
cleanupCapacity?: number
|
|
753
|
+
ownerCapacity?: number
|
|
754
|
+
nativeHandleCapacity?: number
|
|
755
|
+
cleanupTimeoutMs?: number
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/** One page of rows; `null` is the end of the cursor. */
|
|
759
|
+
export declare function runtimePageTake(handle: ExternalObject<OperationHandle>): Array<Array<CellValue>> | null
|
|
760
|
+
|
|
761
|
+
export declare function runtimePreparedClose(handle: ExternalObject<PreparedHandle>, callback: (arg: CloseOut) => void): void
|
|
762
|
+
|
|
763
|
+
export declare function runtimePreparedExecute(handle: ExternalObject<PreparedHandle>, params: Array<ParamIn>, callback: () => void): ExternalObject<OperationHandle>
|
|
764
|
+
|
|
765
|
+
export declare function runtimePreparedReleaseMemory(handle: ExternalObject<PreparedHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Adopt one compiled worker-owned plan. Dropping an untaken output closes
|
|
769
|
+
* the same resource; JavaScript is never its only cleanup authority.
|
|
770
|
+
*/
|
|
771
|
+
export declare function runtimePreparedTake(handle: ExternalObject<OperationHandle>): ExternalObject<PreparedHandle>
|
|
772
|
+
|
|
773
|
+
/** One executor round trip with no payload. */
|
|
774
|
+
export declare function runtimeReady(handle: ExternalObject<RuntimeHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
775
|
+
|
|
776
|
+
export declare function runtimeResultClose(handle: ExternalObject<ResultHandle>, callback: (arg: CloseOut) => void): void
|
|
777
|
+
|
|
778
|
+
/** Collect every row of a sealed result; the result stays available. */
|
|
779
|
+
export declare function runtimeResultCollect(handle: ExternalObject<ResultHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
780
|
+
|
|
781
|
+
/** Move a sealed result's backing into its one cursor. */
|
|
782
|
+
export declare function runtimeResultCursor(handle: ExternalObject<ResultHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
783
|
+
|
|
784
|
+
export declare function runtimeResultTake(handle: ExternalObject<OperationHandle>): ExternalObject<ResultHandle>
|
|
785
|
+
|
|
786
|
+
export declare function runtimeRowsTake(handle: ExternalObject<OperationHandle>): Array<Array<CellValue>>
|
|
787
|
+
|
|
788
|
+
export declare function runtimeRowTake(handle: ExternalObject<OperationHandle>): Array<CellValue> | null
|
|
789
|
+
|
|
790
|
+
export declare function runtimeSnapshotClose(handle: ExternalObject<SnapshotHandle>, callback: (arg: CloseOut) => void): void
|
|
791
|
+
|
|
792
|
+
export declare function runtimeSnapshotExecute(handle: ExternalObject<SnapshotHandle>, query: ExternalObject<QueryHandle>, params: Array<ParamIn>, callback: () => void): ExternalObject<OperationHandle>
|
|
793
|
+
|
|
794
|
+
/** Read one row by a key statement of `relation`. */
|
|
795
|
+
export declare function runtimeSnapshotGet(handle: ExternalObject<SnapshotHandle>, relation: number, keyStatement: number, keyValues: Array<CellValue>, callback: () => void): ExternalObject<OperationHandle>
|
|
796
|
+
|
|
797
|
+
export declare function runtimeSnapshotPrepare(handle: ExternalObject<SnapshotHandle>, query: ExternalObject<QueryHandle>, callback: () => void): ExternalObject<OperationHandle>
|
|
798
|
+
|
|
799
|
+
export declare function runtimeSnapshotTake(handle: ExternalObject<OperationHandle>): SnapshotOpened
|
|
800
|
+
|
|
801
|
+
/** The number of rows one draft chunk staged. */
|
|
802
|
+
export declare function runtimeStagedTake(handle: ExternalObject<OperationHandle>): bigint
|
|
803
|
+
|
|
804
|
+
/** Take a payload-less completion. */
|
|
805
|
+
export declare function runtimeTake(handle: ExternalObject<OperationHandle>): void
|
|
806
|
+
|
|
807
|
+
/** A scalar expression over rule-local variables. */
|
|
808
|
+
export type ScalarExprIn =
|
|
809
|
+
| { kind: 'Var'; var: number }
|
|
810
|
+
| { kind: 'Literal'; value: ValueIn }
|
|
811
|
+
| { kind: 'Negate'; expr: ScalarExprIn }
|
|
812
|
+
| { kind: 'Add'; left: ScalarExprIn; right: ScalarExprIn }
|
|
813
|
+
| { kind: 'Subtract'; left: ScalarExprIn; right: ScalarExprIn }
|
|
814
|
+
| { kind: 'Multiply'; left: ScalarExprIn; right: ScalarExprIn }
|
|
815
|
+
| { kind: 'Divide'; left: ScalarExprIn; right: ScalarExprIn }
|
|
816
|
+
| { kind: 'MulDiv'; a: ScalarExprIn; b: ScalarExprIn; divisor: ScalarExprIn; rounding: RoundingIn }
|
|
817
|
+
| { kind: 'Measure'; expr: ScalarExprIn }
|
|
818
|
+
| { kind: 'Cast'; cast: NumericCastIn; expr: ScalarExprIn }
|
|
819
|
+
| { kind: 'IsNaN'; expr: ScalarExprIn }
|
|
820
|
+
| { kind: 'IsFinite'; expr: ScalarExprIn }
|
|
821
|
+
|
|
822
|
+
/** TypeScript SDK declarations for a compiled schema. */
|
|
823
|
+
export declare function schemaBindings(schema: ExternalObject<SchemaHandle>): SchemaBindings
|
|
824
|
+
|
|
825
|
+
export type SchemaBindings =
|
|
826
|
+
| { _tag: 'Bindings'; source: string }
|
|
827
|
+
| { _tag: 'Unrepresentable'; coordinate: string; reason: string }
|
|
828
|
+
|
|
829
|
+
export type SchemaCompiled =
|
|
830
|
+
| { _tag: 'Compiled'; schema: ExternalObject<SchemaHandle>; descriptor: SchemaDescriptorOut }
|
|
831
|
+
| { _tag: 'Invalid'; diagnostic: SchemaDiagnostic }
|
|
832
|
+
| { _tag: 'Malformed'; path: string; message: string }
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* The sealed descriptor: relations with ids, field types and newtypes,
|
|
836
|
+
* materialized statements, and the hex schema fingerprint.
|
|
837
|
+
*/
|
|
838
|
+
export interface SchemaDescriptorOut {
|
|
839
|
+
relations: Array<RelationOut>
|
|
840
|
+
statements: Array<StatementOut>
|
|
841
|
+
fingerprint: string
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Why a spec did not compile: unresolved names (`Spec`), or a resolved
|
|
846
|
+
* descriptor the engine refused (`Schema`, citing descriptor statement ids).
|
|
847
|
+
*/
|
|
848
|
+
export type SchemaDiagnostic =
|
|
849
|
+
| { _tag: 'Spec'; issues: Array<SpecIssueOut> }
|
|
850
|
+
| { _tag: 'Schema'; code: string; message: string; statement?: StatementCite; conflict?: StatementCite }
|
|
851
|
+
|
|
852
|
+
export interface SchemaSpecIn {
|
|
853
|
+
relations: Array<RelationSpecIn>
|
|
854
|
+
statements: Array<StatementSpecIn>
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
export type SegmentOpIn = 'Intersection' | 'Difference'
|
|
858
|
+
|
|
859
|
+
export interface SelectionIn {
|
|
860
|
+
field: string
|
|
861
|
+
set: LiteralSetSpecIn
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
export interface SelectionOut {
|
|
865
|
+
field: number
|
|
866
|
+
values: Array<CellValue>
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export type SettledOut =
|
|
870
|
+
| { _tag: 'Opened'; pending: number }
|
|
871
|
+
| { _tag: 'Decided'; receipt: ReceiptOut }
|
|
872
|
+
| { _tag: 'Synced'; seq: bigint }
|
|
873
|
+
| { _tag: 'Resolved'; receipt?: ReceiptOut }
|
|
874
|
+
| { _tag: 'Frozen'; seq: bigint }
|
|
875
|
+
| { _tag: 'Migrated'; seq: bigint }
|
|
876
|
+
| { _tag: 'Refused'; refusal: RefusalOut }
|
|
877
|
+
|
|
878
|
+
export interface SideOut {
|
|
879
|
+
relation: number
|
|
880
|
+
projection: Array<number>
|
|
881
|
+
selection: Array<SelectionOut>
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/** One side of a containment or capacity statement, all by name. */
|
|
885
|
+
export interface SideSpecIn {
|
|
886
|
+
relation: string
|
|
887
|
+
projection: Array<string>
|
|
888
|
+
selection: Array<SelectionIn>
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* A pinned snapshot, the witness of the state it observed, and that
|
|
893
|
+
* state's generation.
|
|
894
|
+
*/
|
|
895
|
+
export interface SnapshotOpened {
|
|
896
|
+
snapshot: ExternalObject<SnapshotHandle>
|
|
897
|
+
witness: ExternalObject<WitnessHandle>
|
|
898
|
+
generation: bigint
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* One spec resolution issue; `statement` indexes the spec's statements,
|
|
903
|
+
* `relation` and `row` its relations and a closed relation's rows.
|
|
904
|
+
*/
|
|
905
|
+
export interface SpecIssueOut {
|
|
906
|
+
code: string
|
|
907
|
+
message: string
|
|
908
|
+
statement?: number
|
|
909
|
+
relation?: number
|
|
910
|
+
row?: number
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
export interface StatementCite {
|
|
914
|
+
id: number
|
|
915
|
+
spelling: string
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/** One materialized statement; `id` is its `StatementId`. */
|
|
919
|
+
export type StatementOut =
|
|
920
|
+
| { _tag: 'Functionality'; id: number; spelling: string; relation: number; projection: Array<number> }
|
|
921
|
+
| { _tag: 'Containment'; id: number; spelling: string; source: SideOut; target: SideOut }
|
|
922
|
+
| { _tag: 'Capacity'; id: number; spelling: string; target: SideOut; weight: WeightOut; lo: bigint; hi: CeilingOut; source: SideOut }
|
|
923
|
+
|
|
924
|
+
/** One dependency statement; `bidirectional` containment is the `==` form. */
|
|
925
|
+
export type StatementSpecIn =
|
|
926
|
+
| { kind: 'Fd'; relation: string; projection: Array<string> }
|
|
927
|
+
| { kind: 'Containment'; source: SideSpecIn; target: SideSpecIn; bidirectional: boolean }
|
|
928
|
+
| { kind: 'Capacity'; target: SideSpecIn; weight: WeightSpecIn; window: CapacityWindowSpecIn; source: SideSpecIn }
|
|
929
|
+
|
|
930
|
+
/** One step: requests to perform now, tickets settled by it, and the head. */
|
|
931
|
+
export interface StepOut {
|
|
932
|
+
io: Array<IoRequestOut>
|
|
933
|
+
done: Array<DoneOut>
|
|
934
|
+
head?: HeadOut
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
export type TermIn =
|
|
938
|
+
| { kind: 'Var'; var: number }
|
|
939
|
+
| { kind: 'Param'; param: number }
|
|
940
|
+
| { kind: 'ParamSet'; param: number }
|
|
941
|
+
| { kind: 'Literal'; value: ValueIn }
|
|
942
|
+
|
|
943
|
+
/** Validate one query IR (JSON) against a compiled schema. */
|
|
944
|
+
export declare function validateQuery(schema: ExternalObject<SchemaHandle>, irJson: string): QueryValidated
|
|
945
|
+
|
|
946
|
+
/** One literal value as spelled. Intervals are half-open and nonempty. */
|
|
947
|
+
export type ValueIn =
|
|
948
|
+
| { kind: 'Bool'; value: boolean }
|
|
949
|
+
| { kind: 'U64'; value: string }
|
|
950
|
+
| { kind: 'I64'; value: string }
|
|
951
|
+
| { kind: 'F64'; value: string }
|
|
952
|
+
| { kind: 'String'; value: string }
|
|
953
|
+
| { kind: 'Uuid'; value: string }
|
|
954
|
+
| { kind: 'FixedBytes'; value: string }
|
|
955
|
+
| { kind: 'IntervalU64'; start: string; end: string }
|
|
956
|
+
| { kind: 'IntervalI64'; start: string; end: string }
|
|
957
|
+
| { kind: 'IntervalF64'; start: string; end: string }
|
|
958
|
+
|
|
959
|
+
/** One structural field type. */
|
|
960
|
+
export type ValueTypeIn =
|
|
961
|
+
| { kind: 'Bool' }
|
|
962
|
+
| { kind: 'U64' }
|
|
963
|
+
| { kind: 'I64' }
|
|
964
|
+
| { kind: 'F64' }
|
|
965
|
+
| { kind: 'String' }
|
|
966
|
+
| { kind: 'Uuid' }
|
|
967
|
+
| { kind: 'FixedBytes'; len: number }
|
|
968
|
+
| { kind: 'Interval'; element: IntervalElementIn }
|
|
969
|
+
| { kind: 'FixedInterval'; element: FixedIntervalElementIn; width: string }
|
|
970
|
+
|
|
971
|
+
export type ValueTypeOut =
|
|
972
|
+
| { _tag: 'Bool' }
|
|
973
|
+
| { _tag: 'U64' }
|
|
974
|
+
| { _tag: 'I64' }
|
|
975
|
+
| { _tag: 'F64' }
|
|
976
|
+
| { _tag: 'String' }
|
|
977
|
+
| { _tag: 'Uuid' }
|
|
978
|
+
| { _tag: 'FixedBytes'; len: number }
|
|
979
|
+
| { _tag: 'Interval'; element: IntervalElementOut }
|
|
980
|
+
| { _tag: 'FixedInterval'; element: IntervalElementOut; width: bigint }
|
|
981
|
+
|
|
982
|
+
/** One violated statement: its id, canonical spelling and the cited facts. */
|
|
983
|
+
export type ViolationOut =
|
|
984
|
+
| { _tag: 'Functionality'; statement: number; spelling: string; facts: Array<FactOut> }
|
|
985
|
+
| { _tag: 'Containment'; statement: number; spelling: string; facts: Array<FactOut> }
|
|
986
|
+
| { _tag: 'Capacity'; statement: number; spelling: string; measure: bigint; facts: Array<FactOut> }
|
|
987
|
+
|
|
988
|
+
export type WeightOut =
|
|
989
|
+
| { _tag: 'Unit' }
|
|
990
|
+
| { _tag: 'Field'; field: number }
|
|
991
|
+
| { _tag: 'Duration'; field: number }
|
|
992
|
+
|
|
993
|
+
export type WeightSpecIn =
|
|
994
|
+
| { kind: 'Unit' }
|
|
995
|
+
| { kind: 'Field'; field: string }
|
|
996
|
+
| { kind: 'Duration'; field: string }
|