@tinyshed/tinystore 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/records.js CHANGED
@@ -12,7 +12,7 @@ import { parseJson } from './json.js';
12
12
  import { encodeFields, newStoreLogger, } from './logger.js';
13
13
  import { ms } from './time.js';
14
14
  import { currentTrace } from './trace.js';
15
- import { Empty, Handle, methods, RecordsAggregateAsked, RecordsAppend, RecordsAppended, RecordsBatch, RecordsCount, RecordsDamage, RecordsDamages, RecordsDropped, RecordsFieldNamesAsked, RecordsNames, RecordsOpen, RecordsPage, RecordsPiece, RecordsPollAsked, RecordsQuery, RecordsRows, RecordsStreams, RecordsTailBatch, RecordsTopAsked, RecordsTops, } from './wire/protocol.js';
15
+ import { Empty, Handle, methods, RecordsAggregateAsked, RecordsAppend, RecordsAppended, RecordsBatch, RecordsCount, RecordsDamage, RecordsDamages, RecordsDropped, RecordsFieldNamesAsked, RecordsFieldsAsked, RecordsNames, RecordsOpen, RecordsPage, RecordsPiece, RecordsPollAsked, RecordsQuery, RecordsRows, RecordsStreamFields, RecordsStreams, RecordsTailBatch, RecordsTopAsked, RecordsTops, } from './wire/protocol.js';
16
16
  const newline = 0x0a;
17
17
  /** What a writer of lines holds for the server at most: past it, lines are dropped and counted. */
18
18
  const linesHeld = 1 << 20;
@@ -30,7 +30,10 @@ const levelNumbers = {
30
30
  const levelNames = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'];
31
31
  /** What every read takes: a stream's handle, or every stream without one. */
32
32
  class Reads {
33
- /** One page, from one moment of the file: `{ events, next }`. */
33
+ /**
34
+ * One page: `{ events, next }`, its `limit` of events that match, fewer
35
+ * only on the last, which has no `next`.
36
+ */
34
37
  async list(query) {
35
38
  const asked = queryOf(query);
36
39
  const answer = await this.ask('records.list', handle => RecordsQuery.encode({ ...asked, handle }));
@@ -132,23 +135,44 @@ class Reads {
132
135
  }
133
136
  /** Opens a stream of events: lazily, at its first call on a connection. */
134
137
  export function openEvents(link, stream, options) {
138
+ return new Events(link, stream, eventsOpen(stream, options));
139
+ }
140
+ /** A stream's open, through the database of `database`, a handle on the connection, when given. */
141
+ export function eventsOpen(stream, options, database) {
135
142
  checkName(stream, 'stream');
136
143
  const keep = options?.keep === undefined ? undefined : ms(options.keep);
137
- return new Events(link, stream, RecordsOpen.encode({ stream, keep }));
144
+ return RecordsOpen.encode({ stream, keep, database });
138
145
  }
146
+ let eventsPartsOf;
139
147
  /** A stream of events: written with `append`, which waits for the file, and read back. */
140
148
  export class Events extends Reads {
141
149
  stream;
142
150
  #link;
143
151
  #via;
144
152
  #open;
145
- /** Events come from `store.events(stream)`. */
146
- constructor(link, stream, open) {
153
+ #home;
154
+ /** Events come from `store.events(stream)`, or `db.events(stream)` through a database. */
155
+ constructor(link, stream, open, home) {
147
156
  super();
148
157
  this.stream = stream;
149
158
  this.#link = link;
150
- this.#via = viaLink(link);
159
+ this.#via = home === undefined ? viaLink(link) : home.via(`events ${stream}`);
151
160
  this.#open = open;
161
+ this.#home = home;
162
+ }
163
+ static {
164
+ eventsPartsOf = events => ({ stream: events.stream, open: events.#open, home: events.#home });
165
+ }
166
+ /**
167
+ * An event's append for a batch of the database the stream was opened
168
+ * from, `db.events`: it is kept with the batch's rows and reaches the
169
+ * stream once they commit, before the batch returns, or never.
170
+ *
171
+ * await db.batch([sql`update roles set role = ${role} where user_id = ${id}`, audit.appending('role.changed', { userId: id, role })])
172
+ */
173
+ appending(name, fields, options) {
174
+ const event = newEventOf(oneEvent(name, fields, options), 0);
175
+ return new Appending({ ...eventsPartsOf(this), event });
152
176
  }
153
177
  async append(first, fields, options) {
154
178
  const events = typeof first === 'string' ? [oneEvent(first, fields, options)] : first;
@@ -204,6 +228,68 @@ export class Events extends Reads {
204
228
  return this.#via.call(methods['records.open'], this.#open, methods[method], body, idempotence);
205
229
  }
206
230
  }
231
+ /** The parts of a stream, when `handle` is one. */
232
+ export function eventsParts(handle) {
233
+ return handle instanceof Events ? eventsPartsOf(handle) : undefined;
234
+ }
235
+ /**
236
+ * A stream's appends inside a transaction of the database it was opened
237
+ * from, `tx.with(audit)`: each is kept with the transaction's rows and
238
+ * reaches the stream once it commits, before `db.tx` returns. A read goes
239
+ * through the stream itself, and finds what committed.
240
+ */
241
+ export class TxEvents {
242
+ stream;
243
+ #open;
244
+ #via;
245
+ /** TxEvents come from `tx.with(events)`. */
246
+ constructor(parts, via) {
247
+ this.stream = parts.stream;
248
+ this.#open = parts.open;
249
+ this.#via = via;
250
+ }
251
+ /**
252
+ * Appends an event once the transaction commits, and says whether it
253
+ * will be written: false when its stream, or this transaction, holds its id.
254
+ */
255
+ async append(name, fields, options) {
256
+ const event = newEventOf(oneEvent(name, fields, options), 0);
257
+ const answer = await this.#via.call(methods['records.open'], this.#open, methods['records.append'], handle => RecordsAppend.encode({ handle, events: [event] }), 'write');
258
+ return (RecordsAppended.decode(answer).held ?? 0) === 0;
259
+ }
260
+ }
261
+ let appendingPartsOf;
262
+ /** An event's append for a database's batch, from `events.appending`. */
263
+ export class Appending {
264
+ #parts;
265
+ /** Comes from `events.appending`. */
266
+ constructor(parts) {
267
+ this.#parts = parts;
268
+ }
269
+ static {
270
+ appendingPartsOf = appending => appending.#parts;
271
+ }
272
+ }
273
+ /**
274
+ * What a batch of `home` sends of an append, on the connection it goes on:
275
+ * the append's call, its stream's handle opened there first. A stream opened
276
+ * from the store or another database is refused, since its event would not
277
+ * commit with the rows.
278
+ */
279
+ export function appendingIn(appending, home) {
280
+ const { stream, open, home: kept, event } = appendingPartsOf(appending);
281
+ if (kept !== home) {
282
+ const where = kept === undefined ? 'records.db' : kept.describe;
283
+ throw new InvalidError(`${home.describe}: events ${stream}: kept in ${where}, outside this batch of ${home.describe}`);
284
+ }
285
+ return async (connection) => {
286
+ const handle = await handleOn(connection, methods['records.open'], open);
287
+ return {
288
+ method: methods['records.append'],
289
+ body: RecordsAppend.encode({ handle, events: [event] }),
290
+ };
291
+ };
292
+ }
207
293
  /** Every stream's events, to read: `store.events()`. */
208
294
  export class AllEvents extends Reads {
209
295
  #link;
@@ -222,6 +308,28 @@ export class AllEvents extends Reads {
222
308
  newest: dateOf(stream.newest ?? 0n),
223
309
  }));
224
310
  }
311
+ /**
312
+ * What the events of `stream` carry, none of it read from a packed event: each name with how
313
+ * many events have it, and each key of their fields and contexts with the kinds of value it
314
+ * holds and how many events carry it. A stream with no events carries nothing.
315
+ */
316
+ async fields(stream) {
317
+ const answer = await this.ask('records.fields', () => RecordsFieldsAsked.encode({ stream }));
318
+ const carried = RecordsStreamFields.decode(answer);
319
+ const info = (field) => ({
320
+ name: field.name ?? '',
321
+ kinds: (field.kinds ?? []),
322
+ count: field.count ?? 0,
323
+ });
324
+ return {
325
+ eventNames: (carried.eventNames ?? []).map(name => ({
326
+ name: name.name ?? '',
327
+ count: name.count ?? 0,
328
+ })),
329
+ fields: (carried.fields ?? []).map(info),
330
+ context: (carried.context ?? []).map(info),
331
+ };
332
+ }
225
333
  /**
226
334
  * Every event once, a batch a call, from a cursor the program keeps, the
227
335
  * oldest event kept without one: `{ events, cursor, expired }`. With no
package/dist/sql.d.ts CHANGED
@@ -5,6 +5,7 @@ import { type Home, type Open, type Via } from './handles.ts';
5
5
  import { Adding, type Queue, type QueueOptions, type TxQueue, type Worker } from './jobs.ts';
6
6
  import { Bucket, type BucketOptions } from './kv.ts';
7
7
  import { Table, type TableOptions } from './query.ts';
8
+ import { Appending, Events, type EventsOptions, TxEvents } from './records.ts';
8
9
  import type { StandardSchemaV1 } from './schema.ts';
9
10
  import { TableIndex, type TableIndexOptions } from './search.ts';
10
11
  import { type Stream } from './session.ts';
@@ -181,6 +182,18 @@ export declare class Database implements Runner, Home {
181
182
  * const packages = db.files('packages', { maxFileSize: '10MiB' })
182
183
  */
183
184
  files(name: string, options?: FilesOptions): Files;
185
+ /**
186
+ * The store's stream of events `stream`, opened through this database:
187
+ * the same calls and reads as `store.events(stream)` gives, the stream in
188
+ * records.db where every stream lives. Its appends inside `db.tx`,
189
+ * through `tx.with(audit)`, and in `db.batch`, through `audit.appending`,
190
+ * are kept in this database's file with the rows and reach the stream
191
+ * once they commit, before the call returns: an event exists exactly when
192
+ * the change it records does.
193
+ *
194
+ * const audit = db.events('audit')
195
+ */
196
+ events(stream: string, options?: EventsOptions): Events;
184
197
  /**
185
198
  * An index of a table of this database, kept in its file: its rows found
186
199
  * again by their words, vectors or both, each hit's value its row as
@@ -228,12 +241,14 @@ export declare class Database implements Runner, Home {
228
241
  /**
229
242
  * Writes known before they run, written as one: all of them or none, in a
230
243
  * shared commit, and what each did, in their order. A write is a statement,
231
- * or a job's add of a queue opened from the database, `queue.adding`, which
232
- * commits with the rows and changed 1 job, or 0 when its id was taken.
244
+ * a job's add of a queue opened from the database, `queue.adding`, which
245
+ * commits with the rows and changed 1 job, or 0 when its id was taken, or
246
+ * an event's append of a stream opened from it, `audit.appending`, which
247
+ * reaches the stream before the batch returns.
233
248
  *
234
249
  * await db.batch([sql`update notes set body = ${body} where id = ${id}`, indexing.adding({ noteId: id })])
235
250
  */
236
- batch(writes: readonly (Sql | Adding)[]): Promise<Done[]>;
251
+ batch(writes: readonly (Sql | Adding | Appending)[]): Promise<Done[]>;
237
252
  /**
238
253
  * Runs fn in a transaction that holds the writer, for writes that depend on
239
254
  * what its reads found: returning commits, a throw rolls back. It runs
@@ -277,6 +292,7 @@ export declare class SqlTx implements Runner {
277
292
  with<T>(queue: Queue<T>): TxQueue<T>;
278
293
  with<T>(channel: Channel<T>): TxChannel<T>;
279
294
  with(files: Files): Files;
295
+ with(events: Events): TxEvents;
280
296
  all<T = Row>(...statement: Statement): Promise<T[]>;
281
297
  one<T = Row>(...statement: Statement): Promise<T | undefined>;
282
298
  scalar<T = SqlValue>(...statement: Statement): Promise<T>;
package/dist/sql.js CHANGED
@@ -14,6 +14,7 @@ import { askByCall, checkName, handleOn, viaLink, } from './handles.js';
14
14
  import { Adding, addingIn, openQueue, queueParts, queueVia, } from './jobs.js';
15
15
  import { Bucket, bucketOpen, partsOf, valuesOf } from './kv.js';
16
16
  import { Table } from './query.js';
17
+ import { Appending, appendingIn, Events, eventsOpen, eventsParts, TxEvents, } from './records.js';
17
18
  import { TableIndex, tableIndexOpen } from './search.js';
18
19
  import { ConnectionLostError } from './session.js';
19
20
  import { int64Of } from './wire/msgpack.js';
@@ -560,6 +561,22 @@ export class Database {
560
561
  const open = this.keep(methods['blobs.open'], bytes, async (connection) => filesOpen(name, options, await this.handle(connection)));
561
562
  return new Files(this.#link, name, open, [], this);
562
563
  }
564
+ /**
565
+ * The store's stream of events `stream`, opened through this database:
566
+ * the same calls and reads as `store.events(stream)` gives, the stream in
567
+ * records.db where every stream lives. Its appends inside `db.tx`,
568
+ * through `tx.with(audit)`, and in `db.batch`, through `audit.appending`,
569
+ * are kept in this database's file with the rows and reach the stream
570
+ * once they commit, before the call returns: an event exists exactly when
571
+ * the change it records does.
572
+ *
573
+ * const audit = db.events('audit')
574
+ */
575
+ events(stream, options) {
576
+ const bytes = eventsOpen(stream, options);
577
+ const open = this.keep(methods['records.open'], bytes, async (connection) => eventsOpen(stream, options, await this.handle(connection)));
578
+ return new Events(this.#link, stream, open, this);
579
+ }
563
580
  /**
564
581
  * An index of a table of this database, kept in its file: its rows found
565
582
  * again by their words, vectors or both, each hit's value its row as
@@ -652,8 +669,10 @@ export class Database {
652
669
  /**
653
670
  * Writes known before they run, written as one: all of them or none, in a
654
671
  * shared commit, and what each did, in their order. A write is a statement,
655
- * or a job's add of a queue opened from the database, `queue.adding`, which
656
- * commits with the rows and changed 1 job, or 0 when its id was taken.
672
+ * a job's add of a queue opened from the database, `queue.adding`, which
673
+ * commits with the rows and changed 1 job, or 0 when its id was taken, or
674
+ * an event's append of a stream opened from it, `audit.appending`, which
675
+ * reaches the stream before the batch returns.
657
676
  *
658
677
  * await db.batch([sql`update notes set body = ${body} where id = ${id}`, indexing.adding({ noteId: id })])
659
678
  */
@@ -665,7 +684,10 @@ export class Database {
665
684
  if (each instanceof Adding) {
666
685
  return addingIn(each, this);
667
686
  }
668
- throw new InvalidError("a batch takes pieces of SQL, sql`…`, and a queue's adding");
687
+ if (each instanceof Appending) {
688
+ return appendingIn(each, this);
689
+ }
690
+ throw new InvalidError("a batch takes pieces of SQL, sql`…`, a queue's adding and a stream's appending");
669
691
  });
670
692
  this.#refuseAround('a batch');
671
693
  const answered = await this.#link.run('write', async (connection) => {
@@ -806,7 +828,12 @@ export class SqlTx {
806
828
  this.#takes(files.home, files.open, `files ${files.name}`);
807
829
  return files.inside(this.#via);
808
830
  }
809
- throw new InvalidError(`${this.describe}: a transaction takes in a bucket, a queue or files opened from its database`);
831
+ const events = eventsParts(handle);
832
+ if (events !== undefined) {
833
+ this.#takes(events.home, events.open, `events ${events.stream}`);
834
+ return new TxEvents(events, this.#via);
835
+ }
836
+ throw new InvalidError(`${this.describe}: a transaction takes in a bucket, a queue, files or events opened from its database`);
810
837
  }
811
838
  async all(...statement) {
812
839
  return all(this, statementOf(statement));
@@ -105,6 +105,11 @@ export declare const methods: {
105
105
  * nothing written and lets go of what came.
106
106
  */
107
107
  readonly 'metrics.uploadPrometheus': 1552;
108
+ /**
109
+ * A gauge's range replaced in one write: a read sees it as it was or as it
110
+ * is, never half; the same samples sent again write nothing.
111
+ */
112
+ readonly 'metrics.replace': 1553;
108
113
  readonly 'records.open': 1281;
109
114
  readonly 'records.append': 1282;
110
115
  readonly 'records.list': 1283;
@@ -118,6 +123,7 @@ export declare const methods: {
118
123
  readonly 'records.lines': 1291;
119
124
  readonly 'records.damaged': 1292;
120
125
  readonly 'records.drop': 1293;
126
+ readonly 'records.fields': 1294;
121
127
  readonly 'search.open': 2817;
122
128
  readonly 'search.set': 2818;
123
129
  readonly 'search.setMany': 2819;
@@ -1605,6 +1611,28 @@ export declare const MetricsIngest: import("./codec.ts").Message<{
1605
1611
  readonly keep: readonly [6, import("./codec.ts").Codec<number, number>];
1606
1612
  }>[]>];
1607
1613
  }>;
1614
+ /**
1615
+ * A gauge's samples of from to to, packed or not, replaced by the series'
1616
+ * own: a time given takes its value, a time not there before is added, and a
1617
+ * time the series does not give goes.
1618
+ */
1619
+ export declare const MetricsReplace: import("./codec.ts").Message<{
1620
+ readonly series: readonly [1, import("./codec.ts").Message<{
1621
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
1622
+ /** gauge, counter or histogram */
1623
+ readonly kind: readonly [2, import("./codec.ts").Codec<string, string>];
1624
+ readonly labels: readonly [3, import("./codec.ts").Codec<Record<string, string>, Record<string, string>>];
1625
+ /** an int64 a sample */
1626
+ readonly times: readonly [4, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
1627
+ /** a float64 a sample */
1628
+ readonly values: readonly [5, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
1629
+ /** how long the name's samples stay: its own, kept in the file */
1630
+ readonly keep: readonly [6, import("./codec.ts").Codec<number, number>];
1631
+ }>];
1632
+ readonly from: readonly [2, import("./codec.ts").Codec<number, number>];
1633
+ /** excluded */
1634
+ readonly to: readonly [3, import("./codec.ts").Codec<number, number>];
1635
+ }>;
1608
1636
  /**
1609
1637
  * A text an exporter serves, in Prometheus' format or OpenMetrics', whose
1610
1638
  * series the store writes every one or none, each with labels beside its own.
@@ -1877,13 +1905,19 @@ export declare const MetricsAck: import("./codec.ts").Message<{
1877
1905
  }>[]>];
1878
1906
  }>;
1879
1907
  /**
1880
- * Opens a stream of events by name, made with its first event.
1908
+ * Opens a stream of events by name, made with its first event. Opened
1909
+ * through a database, the stream is records.db's all the same, and its
1910
+ * appends inside the database's transactions and batches are kept in the
1911
+ * database's file until they commit, then written to the stream before the
1912
+ * transaction or the batch answers.
1881
1913
  */
1882
1914
  export declare const RecordsOpen: import("./codec.ts").Message<{
1883
1915
  /** [a-z0-9][a-z0-9_-]{0,63} */
1884
1916
  readonly stream: readonly [1, import("./codec.ts").Codec<string, string>];
1885
1917
  /** how long it keeps its events: its own, kept in the file */
1886
1918
  readonly keep: readonly [2, import("./codec.ts").Codec<number, number>];
1919
+ /** a database's handle: its appends join its transactions and batches; none when absent */
1920
+ readonly database: readonly [3, import("./codec.ts").Codec<number, number>];
1887
1921
  }>;
1888
1922
  /**
1889
1923
  * An event to write.
@@ -2193,6 +2227,62 @@ export declare const RecordsStreams: import("./codec.ts").Message<{
2193
2227
  readonly newest: readonly [4, import("./codec.ts").Codec<bigint, number | bigint>];
2194
2228
  }>[]>];
2195
2229
  }>;
2230
+ /**
2231
+ * What the events of a stream carry, counted as they are packed and from
2232
+ * what waits, none of it read from a packed event.
2233
+ */
2234
+ export declare const RecordsFieldsAsked: import("./codec.ts").Message<{
2235
+ readonly stream: readonly [1, import("./codec.ts").Codec<string, string>];
2236
+ }>;
2237
+ export declare const RecordsNameCount: import("./codec.ts").Message<{
2238
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
2239
+ readonly count: readonly [2, import("./codec.ts").Codec<number, number>];
2240
+ }>;
2241
+ /**
2242
+ * A key of a stream's events' fields or contexts.
2243
+ */
2244
+ export declare const RecordsFieldInfo: import("./codec.ts").Message<{
2245
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
2246
+ /** float, integer, text, bool, object, list or null, in that order */
2247
+ readonly kinds: readonly [2, import("./codec.ts").Codec<string[], readonly string[]>];
2248
+ /** the events that carry it */
2249
+ readonly count: readonly [3, import("./codec.ts").Codec<number, number>];
2250
+ }>;
2251
+ export declare const RecordsStreamFields: import("./codec.ts").Message<{
2252
+ readonly eventNames: readonly [1, import("./codec.ts").Codec<Read<{
2253
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
2254
+ readonly count: readonly [2, import("./codec.ts").Codec<number, number>];
2255
+ }>[], readonly import("./codec.ts").Written<{
2256
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
2257
+ readonly count: readonly [2, import("./codec.ts").Codec<number, number>];
2258
+ }>[]>];
2259
+ readonly fields: readonly [2, import("./codec.ts").Codec<Read<{
2260
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
2261
+ /** float, integer, text, bool, object, list or null, in that order */
2262
+ readonly kinds: readonly [2, import("./codec.ts").Codec<string[], readonly string[]>];
2263
+ /** the events that carry it */
2264
+ readonly count: readonly [3, import("./codec.ts").Codec<number, number>];
2265
+ }>[], readonly import("./codec.ts").Written<{
2266
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
2267
+ /** float, integer, text, bool, object, list or null, in that order */
2268
+ readonly kinds: readonly [2, import("./codec.ts").Codec<string[], readonly string[]>];
2269
+ /** the events that carry it */
2270
+ readonly count: readonly [3, import("./codec.ts").Codec<number, number>];
2271
+ }>[]>];
2272
+ readonly context: readonly [3, import("./codec.ts").Codec<Read<{
2273
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
2274
+ /** float, integer, text, bool, object, list or null, in that order */
2275
+ readonly kinds: readonly [2, import("./codec.ts").Codec<string[], readonly string[]>];
2276
+ /** the events that carry it */
2277
+ readonly count: readonly [3, import("./codec.ts").Codec<number, number>];
2278
+ }>[], readonly import("./codec.ts").Written<{
2279
+ readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
2280
+ /** float, integer, text, bool, object, list or null, in that order */
2281
+ readonly kinds: readonly [2, import("./codec.ts").Codec<string[], readonly string[]>];
2282
+ /** the events that carry it */
2283
+ readonly count: readonly [3, import("./codec.ts").Codec<number, number>];
2284
+ }>[]>];
2285
+ }>;
2196
2286
  /**
2197
2287
  * The keys the events a query finds hold, sorted.
2198
2288
  */
@@ -2513,13 +2603,15 @@ export declare const SqlOpen: import("./codec.ts").Message<{
2513
2603
  }>;
2514
2604
  /**
2515
2605
  * A statement's text and the values of its ?s, in order. In a batch it may
2516
- * be a call of jobs on a queue kept in the database's file instead, jobs.add
2517
- * with its request in body and no text, which commits with the batch's rows.
2606
+ * be a call of another engine instead, with its request in body and no
2607
+ * text, which commits with the batch's rows: jobs.add on a queue kept in the
2608
+ * database's file, or records.append on a stream opened through the
2609
+ * database, whose events reach the stream before the batch answers.
2518
2610
  */
2519
2611
  export declare const SqlText: import("./codec.ts").Message<{
2520
2612
  readonly text: readonly [1, import("./codec.ts").Codec<string, string>];
2521
2613
  readonly values: readonly [2, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2522
- /** in a batch, jobs.add: the call in body */
2614
+ /** in a batch, jobs.add or records.append: the call in body */
2523
2615
  readonly method: readonly [3, import("./codec.ts").Codec<number, number>];
2524
2616
  readonly body: readonly [4, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
2525
2617
  }>;
@@ -2608,27 +2700,29 @@ export declare const SqlDone: import("./codec.ts").Message<{
2608
2700
  }>;
2609
2701
  /**
2610
2702
  * Writes known before they run, written as one in a shared commit: its
2611
- * statements, and the adds of a queue kept in the database's file.
2703
+ * statements, the adds of a queue kept in the database's file, and the
2704
+ * appends of a stream opened through the database.
2612
2705
  */
2613
2706
  export declare const SqlBatch: import("./codec.ts").Message<{
2614
2707
  readonly handle: readonly [1, import("./codec.ts").Codec<number, number>];
2615
2708
  readonly statements: readonly [2, import("./codec.ts").Codec<Read<{
2616
2709
  readonly text: readonly [1, import("./codec.ts").Codec<string, string>];
2617
2710
  readonly values: readonly [2, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2618
- /** in a batch, jobs.add: the call in body */
2711
+ /** in a batch, jobs.add or records.append: the call in body */
2619
2712
  readonly method: readonly [3, import("./codec.ts").Codec<number, number>];
2620
2713
  readonly body: readonly [4, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
2621
2714
  }>[], readonly import("./codec.ts").Written<{
2622
2715
  readonly text: readonly [1, import("./codec.ts").Codec<string, string>];
2623
2716
  readonly values: readonly [2, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2624
- /** in a batch, jobs.add: the call in body */
2717
+ /** in a batch, jobs.add or records.append: the call in body */
2625
2718
  readonly method: readonly [3, import("./codec.ts").Codec<number, number>];
2626
2719
  readonly body: readonly [4, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
2627
2720
  }>[]>];
2628
2721
  }>;
2629
2722
  /**
2630
2723
  * What each write of a batch did, in their order: a job's add changed one
2631
- * job, or none when its id was taken.
2724
+ * job, or none when its id was taken, and a stream's append the events its
2725
+ * stream holds no id of.
2632
2726
  */
2633
2727
  export declare const SqlBatched: import("./codec.ts").Message<{
2634
2728
  readonly done: readonly [1, import("./codec.ts").Codec<Read<{
@@ -2650,7 +2744,9 @@ export declare const SqlTxOpen: import("./codec.ts").Message<{
2650
2744
  * A transaction's call, or its end: the last DATA commits, or not. A call is
2651
2745
  * a statement, or a call of kv or jobs on a bucket or a queue kept in the
2652
2746
  * database's file: a method of theirs with its request, kv.set or jobs.add,
2653
- * which runs in the transaction.
2747
+ * which runs in the transaction; or records.append on a stream opened
2748
+ * through the database, whose events reach the stream once the transaction
2749
+ * commits, before its last DATA answers.
2654
2750
  */
2655
2751
  export declare const SqlTxCall: import("./codec.ts").Message<{
2656
2752
  readonly text: readonly [1, import("./codec.ts").Codec<string, string>];