@tinyshed/tinystore 0.1.0-rc.4 → 0.1.0-rc.6

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.
Files changed (122) hide show
  1. package/README.md +37 -37
  2. package/bin/tinystore.js +12 -1
  3. package/dist/backup.d.ts +33 -0
  4. package/dist/backup.js +49 -0
  5. package/dist/blobs.d.ts +160 -79
  6. package/dist/blobs.js +510 -217
  7. package/dist/channels.d.ts +90 -0
  8. package/dist/channels.js +291 -0
  9. package/dist/clock.js +3 -3
  10. package/dist/config.d.ts +209 -86
  11. package/dist/config.js +581 -538
  12. package/dist/connection.d.ts +64 -2
  13. package/dist/connection.js +201 -16
  14. package/dist/console.d.ts +27 -3
  15. package/dist/console.js +165 -12
  16. package/dist/dotenv.d.ts +7 -0
  17. package/dist/dotenv.js +79 -0
  18. package/dist/errors.d.ts +61 -1
  19. package/dist/errors.js +81 -1
  20. package/dist/handles.d.ts +44 -2
  21. package/dist/handles.js +81 -2
  22. package/dist/index.d.ts +17 -11
  23. package/dist/index.js +5 -3
  24. package/dist/instruments.d.ts +177 -0
  25. package/dist/instruments.js +819 -0
  26. package/dist/jobs.d.ts +335 -239
  27. package/dist/jobs.js +716 -536
  28. package/dist/json.d.ts +2 -0
  29. package/dist/json.js +122 -0
  30. package/dist/kv.d.ts +130 -243
  31. package/dist/kv.js +273 -640
  32. package/dist/limits.d.ts +80 -0
  33. package/dist/limits.js +139 -0
  34. package/dist/locks.d.ts +62 -0
  35. package/dist/locks.js +237 -0
  36. package/dist/logger.d.ts +45 -9
  37. package/dist/logger.js +150 -38
  38. package/dist/metrics.d.ts +210 -209
  39. package/dist/metrics.js +319 -556
  40. package/dist/once.d.ts +19 -18
  41. package/dist/once.js +74 -63
  42. package/dist/query.d.ts +181 -0
  43. package/dist/query.js +788 -0
  44. package/dist/records.d.ts +241 -150
  45. package/dist/records.js +507 -291
  46. package/dist/runtime/addon.d.ts +14 -0
  47. package/dist/runtime/addon.js +69 -0
  48. package/dist/runtime/bun.js +5 -7
  49. package/dist/runtime/node.js +5 -7
  50. package/dist/runtime/pipe.d.ts +17 -0
  51. package/dist/runtime/pipe.js +133 -0
  52. package/dist/runtime/shared.d.ts +6 -0
  53. package/dist/runtime/shared.js +19 -0
  54. package/dist/runtime.d.ts +5 -2
  55. package/dist/search.d.ts +189 -0
  56. package/dist/search.js +281 -0
  57. package/dist/session.d.ts +31 -3
  58. package/dist/session.js +153 -41
  59. package/dist/sql.d.ts +228 -78
  60. package/dist/sql.js +745 -240
  61. package/dist/store.d.ts +244 -24
  62. package/dist/store.js +270 -67
  63. package/dist/time.d.ts +5 -1
  64. package/dist/time.js +22 -2
  65. package/dist/tx.d.ts +61 -0
  66. package/dist/tx.js +314 -0
  67. package/dist/wire/codec.d.ts +23 -7
  68. package/dist/wire/codec.js +56 -35
  69. package/dist/wire/frame.d.ts +2 -0
  70. package/dist/wire/frame.js +31 -14
  71. package/dist/wire/messages.d.ts +259 -0
  72. package/dist/wire/messages.js +22 -0
  73. package/dist/wire/msgpack.d.ts +49 -1
  74. package/dist/wire/msgpack.js +293 -56
  75. package/dist/wire/protocol.d.ts +2683 -0
  76. package/dist/wire/protocol.js +10846 -0
  77. package/package.json +39 -38
  78. package/src/backup.ts +81 -0
  79. package/src/blobs.ts +678 -301
  80. package/src/channels.ts +377 -0
  81. package/src/clock.ts +4 -4
  82. package/src/config.ts +902 -612
  83. package/src/connection.ts +279 -21
  84. package/src/console.ts +180 -12
  85. package/src/dotenv.ts +82 -0
  86. package/src/errors.ts +105 -0
  87. package/src/handles.ts +157 -8
  88. package/src/index.ts +158 -52
  89. package/src/instruments.ts +1042 -0
  90. package/src/jobs.ts +1017 -733
  91. package/src/json.ts +133 -0
  92. package/src/kv.ts +424 -847
  93. package/src/limits.ts +202 -0
  94. package/src/locks.ts +320 -0
  95. package/src/logger.ts +209 -40
  96. package/src/metrics.ts +557 -752
  97. package/src/once.ts +86 -83
  98. package/src/query.ts +1005 -0
  99. package/src/records.ts +795 -418
  100. package/src/runtime/addon.ts +99 -0
  101. package/src/runtime/bun.ts +5 -7
  102. package/src/runtime/node.ts +5 -7
  103. package/src/runtime/pipe.ts +178 -0
  104. package/src/runtime/shared.ts +20 -0
  105. package/src/runtime.ts +5 -2
  106. package/src/search.ts +480 -0
  107. package/src/session.ts +187 -41
  108. package/src/sql.ts +993 -306
  109. package/src/store.ts +473 -78
  110. package/src/time.ts +48 -3
  111. package/src/tx.ts +426 -0
  112. package/src/wire/codec.ts +78 -37
  113. package/src/wire/frame.ts +44 -14
  114. package/src/wire/messages.ts +25 -0
  115. package/src/wire/msgpack.ts +327 -56
  116. package/src/wire/protocol.ts +11709 -0
  117. package/dist/limiter.d.ts +0 -45
  118. package/dist/limiter.js +0 -68
  119. package/dist/quota.d.ts +0 -44
  120. package/dist/quota.js +0 -98
  121. package/src/limiter.ts +0 -99
  122. package/src/quota.ts +0 -137
package/src/dotenv.ts ADDED
@@ -0,0 +1,82 @@
1
+ // A .env file's variables, as a store-less logger reads them for LOG_LEVEL and
2
+ // the rest; a config sends its .env files to the core, which reads them with
3
+ // the same rules (testdata/config/env.json).
4
+
5
+ import { InvalidError } from './errors.ts'
6
+
7
+ /**
8
+ * The variables of a .env file, as Go's and Python's configs read one: NAME=value
9
+ * lines, export before a name, # comments, a comment after a space, double
10
+ * quotes reading \n \r \t \" and \\, single quotes reading nothing, a quoted
11
+ * value over lines; a later name wins.
12
+ */
13
+ export function parseDotenv(text: string): Record<string, string> {
14
+ const values: Record<string, string> = {}
15
+ let line = 1
16
+ let rest = text
17
+ while (rest !== '') {
18
+ const [name, value, after] = dotenvAssignment(rest, line)
19
+ line += rest.slice(0, rest.length - after.length).split('\n').length - 1
20
+ if (name !== '') {
21
+ values[name] = value
22
+ }
23
+ rest = after
24
+ }
25
+ return values
26
+ }
27
+
28
+ function dotenvAssignment(text: string, number: number): [string, string, string] {
29
+ const end = text.indexOf('\n')
30
+ const line = end < 0 ? text : text.slice(0, end)
31
+ const rest = end < 0 ? '' : text.slice(end + 1)
32
+ const trimmed = line.trim()
33
+ if (trimmed === '' || trimmed.startsWith('#')) {
34
+ return ['', '', rest]
35
+ }
36
+ const equals = line.indexOf('=')
37
+ if (equals < 0) {
38
+ throw new InvalidError(`line ${number}: ${JSON.stringify(line)} is no NAME=value`)
39
+ }
40
+ let name = line.slice(0, equals).trim()
41
+ if (name.startsWith('export ')) {
42
+ name = name.slice('export '.length).trim()
43
+ }
44
+ if (!/^[\p{L}_][\p{L}\p{Nd}_]*$/u.test(name)) {
45
+ throw new InvalidError(`line ${number}: ${JSON.stringify(name)} is no variable's name`)
46
+ }
47
+ let start = equals + 1
48
+ while (line[start] === ' ' || line[start] === '\t') {
49
+ start++
50
+ }
51
+ if (line[start] === '"' || line[start] === "'") {
52
+ return [name, ...dotenvQuoted(text.slice(start), number)]
53
+ }
54
+ let value = line.slice(start)
55
+ const comment = value.indexOf(' #')
56
+ if (comment >= 0) {
57
+ value = value.slice(0, comment)
58
+ }
59
+ return [name, value.replace(/[ \t\r]+$/, ''), rest]
60
+ }
61
+
62
+ function dotenvQuoted(text: string, number: number): [string, string] {
63
+ const quote = text[0]
64
+ let out = ''
65
+ for (let i = 1; i < text.length; i++) {
66
+ const c = text[i] as string
67
+ if (c === quote) {
68
+ const end = text.indexOf('\n', i + 1)
69
+ return [out, end < 0 ? '' : text.slice(end + 1)]
70
+ }
71
+ if (c === '\\' && quote === '"' && i + 1 < text.length) {
72
+ i++
73
+ const escaped = text[i] as string
74
+ // only the five escapes are read: "D:\dev" keeps its backslash
75
+ const read: Record<string, string> = { n: '\n', r: '\r', t: '\t', '"': '"', '\\': '\\' }
76
+ out += read[escaped] ?? `\\${escaped}`
77
+ } else {
78
+ out += c
79
+ }
80
+ }
81
+ throw new InvalidError(`line ${number}: a value opened with ${quote} is never closed`)
82
+ }
package/src/errors.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export type Code =
7
7
  | 'invalid'
8
+ | 'not_found'
8
9
  | 'limit'
9
10
  | 'closed'
10
11
  | 'in_use'
@@ -14,6 +15,8 @@ export type Code =
14
15
  | 'too_new'
15
16
  | 'suspended'
16
17
  | 'outcome_unknown'
18
+ | 'committed_locally'
19
+ | 'lost'
17
20
  | 'permission'
18
21
  | 'unimplemented'
19
22
  | 'cancelled'
@@ -29,15 +32,61 @@ export type Code =
29
32
  */
30
33
  export type What = Record<string, string | Uint8Array>
31
34
 
35
+ /**
36
+ * A constraint a database's write broke, as SQLite names it: a unique or a
37
+ * primary key already held is a ConflictError, any other an InvalidError.
38
+ *
39
+ * if (err instanceof ConflictError && err.constraint?.columns.includes('email')) return 'that email is taken'
40
+ */
41
+ export interface Constraint {
42
+ kind: 'unique' | 'primaryKey' | 'foreignKey' | 'check' | 'notNull'
43
+ /** the table, when SQLite names it */
44
+ table: string | undefined
45
+ /** the columns, when SQLite names them */
46
+ columns: string[]
47
+ /** a check's name, or its text when it has none; the index of a unique key on an expression */
48
+ name: string | undefined
49
+ }
50
+
51
+ const constraintKinds: readonly string[] = [
52
+ 'unique',
53
+ 'primaryKey',
54
+ 'foreignKey',
55
+ 'check',
56
+ 'notNull',
57
+ ]
58
+
32
59
  export class TinystoreError extends Error {
33
60
  readonly code: Code
34
61
  readonly what: What
62
+ /** the constraint a database's write broke; undefined for any other failure */
63
+ readonly constraint: Constraint | undefined
35
64
 
36
65
  constructor(code: Code, message: string, what: What = {}) {
37
66
  super(message)
38
67
  this.name = new.target.name
39
68
  this.code = code
40
69
  this.what = what
70
+ this.constraint = constraintOf(what)
71
+ }
72
+ }
73
+
74
+ /** The constraint the server named in what, by its constraint, table, columns and name. */
75
+ function constraintOf(what: What): Constraint | undefined {
76
+ const text = (name: string) => {
77
+ const value = what[name]
78
+ return typeof value === 'string' ? value : undefined
79
+ }
80
+ const kind = text('constraint')
81
+ if (kind === undefined || !constraintKinds.includes(kind)) {
82
+ return undefined
83
+ }
84
+ const columns = text('columns')
85
+ return {
86
+ kind: kind as Constraint['kind'],
87
+ table: text('table'),
88
+ columns: columns === undefined ? [] : columns.split(', '),
89
+ name: text('name'),
41
90
  }
42
91
  }
43
92
 
@@ -66,6 +115,38 @@ export class LimitError extends TinystoreError {
66
115
  }
67
116
  }
68
117
 
118
+ /**
119
+ * The names a LimitError's `limit` holds, as Go's constants and Python's
120
+ * `tinystore.limits` spell them, to map a limit without matching its text.
121
+ *
122
+ * ```ts
123
+ * if (err instanceof LimitError && err.limit === limits.decodedSamples) { … }
124
+ * ```
125
+ */
126
+ export const limits = Object.freeze({
127
+ storeMemory: 'store memory',
128
+ storeMemoryNow: 'store memory, now',
129
+ matchedSeries: 'matched series',
130
+ decodedBlocks: 'decoded blocks',
131
+ fetchedBytes: 'fetched bytes',
132
+ decodedSamples: 'decoded samples',
133
+ outputSamples: 'output samples',
134
+ outputBuckets: 'output buckets',
135
+ recordBytes: "bytes of a record, a block's",
136
+ appendBytes: "bytes of records in one Append, a segment's; split it",
137
+ jobValueBytes: "bytes of a job's value",
138
+ stepBytes: "bytes of a step's answer",
139
+ objectBytes: "bytes of an object, the bucket's MaxSize",
140
+ rowBytes: "bytes of a call's rows",
141
+ } as const)
142
+
143
+ /** What the call needs is not there: a file to copy or rename. */
144
+ export class NotFoundError extends TinystoreError {
145
+ constructor(message: string, what?: What) {
146
+ super('not_found', message, what)
147
+ }
148
+ }
149
+
69
150
  /** The store, the handle or the connection closed. */
70
151
  export class ClosedError extends TinystoreError {
71
152
  constructor(message: string, what?: What) {
@@ -126,6 +207,16 @@ export class OutcomeUnknownError extends TinystoreError {
126
207
  }
127
208
  }
128
209
 
210
+ /**
211
+ * A synchronous commit its home made that no copy it waits for held in time:
212
+ * the write stands, and losing that home's disk would lose it.
213
+ */
214
+ export class CommittedLocallyError extends TinystoreError {
215
+ constructor(message: string, what?: What) {
216
+ super('committed_locally', message, what)
217
+ }
218
+ }
219
+
129
220
  /** The connection's capability does not allow it: a data token changing a schema. */
130
221
  export class PermissionDeniedError extends TinystoreError {
131
222
  constructor(message: string, what?: What) {
@@ -161,6 +252,17 @@ export class InternalError extends TinystoreError {
161
252
  }
162
253
  }
163
254
 
255
+ /**
256
+ * A lease that ran out or was revoked at its maxHold while its function ran:
257
+ * another holder may have run beside it. The function's work stands, and a
258
+ * system that compares fences refused what came late.
259
+ */
260
+ export class LostError extends TinystoreError {
261
+ constructor(message: string, what?: What) {
262
+ super('lost', message, what)
263
+ }
264
+ }
265
+
164
266
  /** A frame or a message that breaks the protocol; the connection ends with it. */
165
267
  export class ProtocolError extends TinystoreError {
166
268
  constructor(message: string, what?: What) {
@@ -177,6 +279,7 @@ export class UnauthenticatedError extends TinystoreError {
177
279
 
178
280
  const classes: Record<Code, new (message: string, what?: What) => TinystoreError> = {
179
281
  invalid: InvalidError,
282
+ not_found: NotFoundError,
180
283
  limit: LimitError,
181
284
  closed: ClosedError,
182
285
  in_use: InUseError,
@@ -186,6 +289,8 @@ const classes: Record<Code, new (message: string, what?: What) => TinystoreError
186
289
  too_new: TooNewError,
187
290
  suspended: SuspendedError,
188
291
  outcome_unknown: OutcomeUnknownError,
292
+ committed_locally: CommittedLocallyError,
293
+ lost: LostError,
189
294
  permission: PermissionDeniedError,
190
295
  unimplemented: UnimplementedError,
191
296
  cancelled: CancelledError,
package/src/handles.ts CHANGED
@@ -1,25 +1,174 @@
1
- import type { Connection } from './connection.ts'
1
+ import { type Connection, goesAgain, type Idempotence, type Link } from './connection.ts'
2
2
  import { InvalidError } from './errors.ts'
3
3
  import type { Key } from './wire/codec.ts'
4
- import { Handle } from './wire/messages.ts'
4
+ import { Reader, Writer } from './wire/msgpack.ts'
5
+ import { Handle } from './wire/protocol.ts'
6
+
7
+ /**
8
+ * What opens a handle: its open's bytes, or, for a bucket or a queue kept in
9
+ * a database's file, what makes them once the database is open on the
10
+ * connection, since the open names the database by its handle there.
11
+ */
12
+ export type Open = Uint8Array | ((connection: Connection) => Promise<Uint8Array>)
13
+
14
+ /** A database a bucket or a queue is kept in: its handle on a connection, and its name as errors say it. */
15
+ export interface Home {
16
+ readonly describe: string
17
+ handle(connection: Connection): Promise<number>
18
+ /**
19
+ * The opener of a handle kept in the database's file: the one made first
20
+ * for the same open, so that the database's transaction opens each once,
21
+ * before it holds the writer, and knows the handles it opened.
22
+ */
23
+ keep(
24
+ method: number,
25
+ bytes: Uint8Array,
26
+ make: (connection: Connection) => Promise<Uint8Array>,
27
+ ): Open
28
+ /**
29
+ * How a handle kept in the database's file reaches the server outside a
30
+ * transaction: on the link's connection, and refused from inside the
31
+ * database's own transaction, where it would wait for the writer the
32
+ * transaction holds.
33
+ */
34
+ via(what: string): Via
35
+ }
36
+
37
+ /**
38
+ * How a handle's calls reach the server: on the link's connection, the handle
39
+ * opened there first, or inside a database's transaction, on its stream.
40
+ */
41
+ export interface Via {
42
+ call(
43
+ openMethod: number,
44
+ open: Open,
45
+ method: number,
46
+ body: (handle: number) => Uint8Array,
47
+ idempotence: Idempotence,
48
+ ): Promise<Uint8Array>
49
+ /**
50
+ * The same call, its body written by `write` and its answer read by `read`
51
+ * where the bytes are: on a connection that takes it at once it costs a
52
+ * promise and no copy. What `read` returns holds none of the bytes it read.
53
+ */
54
+ ask<T>(
55
+ openMethod: number,
56
+ open: Open,
57
+ method: number,
58
+ write: (w: Writer, handle: number) => void,
59
+ read: (r: Reader) => T,
60
+ idempotence: Idempotence,
61
+ ): Promise<T>
62
+ }
63
+
64
+ /** Asks through `call`, the body and the answer each in bytes of their own. */
65
+ export function askByCall<T>(
66
+ call: Via['call'],
67
+ openMethod: number,
68
+ open: Open,
69
+ method: number,
70
+ write: (w: Writer, handle: number) => void,
71
+ read: (r: Reader) => T,
72
+ idempotence: Idempotence,
73
+ ): Promise<T> {
74
+ const body = (handle: number) => {
75
+ const w = new Writer()
76
+ write(w, handle)
77
+ return w.bytes()
78
+ }
79
+ return call(openMethod, open, method, body, idempotence).then(answer => {
80
+ const r = new Reader(answer)
81
+ const value = read(r)
82
+ r.end()
83
+ return value
84
+ })
85
+ }
86
+
87
+ /** Calls on whichever connection the link has, dialled again as it says. */
88
+ export function viaLink(link: Link): Via {
89
+ const call: Via['call'] = (openMethod, open, method, body, idempotence) =>
90
+ link.run(idempotence, async connection => {
91
+ const handle = await handleOn(connection, openMethod, open)
92
+ return connection.session.call(method, body(handle))
93
+ })
94
+ return {
95
+ call,
96
+ ask: (openMethod, open, method, write, read, idempotence) => {
97
+ const waiting = () => askByCall(call, openMethod, open, method, write, read, idempotence)
98
+ const connection = link.ready()
99
+ const handle = connection?.opened.get(open)
100
+ if (connection === undefined || handle === undefined) {
101
+ return waiting()
102
+ }
103
+ return new Promise((resolve, reject) => {
104
+ // a call that fails here goes on as its first try through the link would
105
+ const failed = (err: Error) => {
106
+ try {
107
+ if (!goesAgain(err, idempotence)) {
108
+ return reject(err)
109
+ }
110
+ } catch (unknown) {
111
+ return reject(unknown)
112
+ }
113
+ waiting().then(resolve, reject)
114
+ }
115
+ if (!connection.session.direct(method, w => write(w, handle), read, resolve, failed)) {
116
+ waiting().then(resolve, reject)
117
+ }
118
+ })
119
+ },
120
+ }
121
+ }
122
+
123
+ // the base64 of an open's bytes, made once: a database's open holds its migrations
124
+ const openKeys = new WeakMap<Uint8Array, string>()
125
+
126
+ // what an opener of a database's file opened, by connection
127
+ const opened = new WeakMap<object, WeakMap<Connection, Promise<number>>>()
5
128
 
6
129
  /**
7
130
  * The handle an open answers on a connection, opened once a connection: the
8
131
  * open's own bytes name it, so a bucket opened twice with the same options
9
132
  * shares its handle. An open that fails is tried again by the next call.
10
133
  */
11
- export function handleOn(
12
- connection: Connection,
13
- method: number,
14
- open: Uint8Array,
15
- ): Promise<number> {
16
- const key = `${method}:${Buffer.from(open).toString('base64')}`
134
+ export function handleOn(connection: Connection, method: number, open: Open): Promise<number> {
135
+ if (typeof open === 'function') {
136
+ let byConnection = opened.get(open)
137
+ if (byConnection === undefined) {
138
+ byConnection = new WeakMap()
139
+ opened.set(open, byConnection)
140
+ }
141
+ let opening = byConnection.get(connection)
142
+ if (opening === undefined) {
143
+ const kept = byConnection
144
+ opening = open(connection).then(bytes => handleOn(connection, method, bytes))
145
+ kept.set(connection, opening)
146
+ opening.then(
147
+ handle => connection.opened.set(open, handle),
148
+ () => kept.delete(connection),
149
+ )
150
+ }
151
+ return opening
152
+ }
153
+ let encoded = openKeys.get(open)
154
+ if (encoded === undefined) {
155
+ encoded = Buffer.from(open).toString('base64')
156
+ openKeys.set(open, encoded)
157
+ }
158
+ const key = `${method}:${encoded}`
17
159
  let opening = connection.handles.get(key)
18
160
  if (opening === undefined) {
19
161
  opening = connection.session.call(method, open).then(body => Handle.decode(body).handle ?? 0)
20
162
  connection.handles.set(key, opening)
21
163
  opening.catch(() => connection.handles.delete(key))
22
164
  }
165
+ // by these bytes themselves too: a second handle of the same open has bytes of its own
166
+ if (!connection.opened.has(open)) {
167
+ opening.then(
168
+ handle => connection.opened.set(open, handle),
169
+ () => {},
170
+ )
171
+ }
23
172
  return opening
24
173
  }
25
174
 
package/src/index.ts CHANGED
@@ -1,100 +1,205 @@
1
- export type { BlobBucket, BlobObject, Blobs, Body, Download, PutOptions } from './blobs.ts'
1
+ export type { Backup, BackupOptions } from './backup.ts'
2
+ export type {
3
+ Body,
4
+ FileBytes,
5
+ FileInfo,
6
+ FileListOptions,
7
+ FileOptions,
8
+ FilePage,
9
+ Files,
10
+ FilesOptions,
11
+ Size,
12
+ StoredFile,
13
+ Upload,
14
+ } from './blobs.ts'
2
15
  export { withSignal } from './cancel.ts'
16
+ export type {
17
+ Channel,
18
+ EachOptions,
19
+ Message as ChannelMessage,
20
+ Missed,
21
+ SubscribeOptions,
22
+ Subscription,
23
+ TxChannel,
24
+ } from './channels.ts'
3
25
  export type { Clock } from './clock.ts'
4
26
  export {
27
+ type Bounds,
28
+ type Changes,
5
29
  type Config,
6
- type ConfigLayer,
7
- type ConfigValue,
8
- type DeepPartial,
9
- type FromEnv,
10
- fromEnv,
30
+ type ConfigOptions,
31
+ type DurationBounds,
32
+ duration,
33
+ type EnvLayer,
34
+ type EnvOptions,
35
+ type Explained,
36
+ type ExplainLine,
37
+ env,
38
+ type FileLayer,
39
+ file,
40
+ int,
41
+ type Layer,
42
+ list,
43
+ live,
44
+ type Overlay,
45
+ oneOf,
11
46
  required,
47
+ Secret,
12
48
  type Setting,
13
- type Source,
14
49
  secret,
15
- type Validate,
16
- validate,
50
+ type UpdateOptions,
51
+ type Value,
52
+ type Vars,
17
53
  } from './config.ts'
18
- export type { ConsoleFormat, ConsoleTime } from './console.ts'
54
+ export type { Durability, SelfMetrics } from './connection.ts'
55
+ export { type ConsoleFormat, type ConsoleTime, secrets } from './console.ts'
19
56
  export * from './errors.ts'
20
57
  export type { Page } from './handles.ts'
21
58
  export type {
22
- ClaimedJob,
23
- EnqueueOptions,
59
+ AddOptions,
60
+ Answer,
61
+ Backoff,
62
+ Concurrency,
63
+ Handler,
24
64
  Job,
25
- JobEntry,
65
+ JobOptions,
66
+ JobPage,
26
67
  JobState,
27
- Jobs,
68
+ ListOptions,
28
69
  Queue,
29
70
  QueueOptions,
30
- QueueTx,
31
- Repeat,
71
+ Run,
72
+ Schedule,
73
+ ScheduleOptions,
74
+ ScheduleWhen,
75
+ StoreTxQueue,
76
+ TxQueue,
77
+ Worker,
32
78
  WorkOptions,
33
79
  } from './jobs.ts'
34
80
  export type {
35
- Batch,
36
81
  Bucket,
37
82
  BucketOptions,
38
- BucketTx,
39
- CounterOptions,
40
83
  Counters,
84
+ CountersOptions,
41
85
  Entry,
42
- Kind,
43
- Scanned,
44
- Tx,
86
+ Page as KvPage,
87
+ ValueType,
45
88
  WriteOptions,
46
89
  } from './kv.ts'
47
- export type { Allowance, Limiter, LimiterOptions, Rate } from './limiter.ts'
90
+ export type { Allowance, Quota, Rate, RateLimit, RateLimitOptions, WindowUse } from './limits.ts'
91
+ export type {
92
+ HoldOptions,
93
+ Lease,
94
+ Lock,
95
+ LockOptions,
96
+ Permit,
97
+ Semaphore,
98
+ SemaphoreOptions,
99
+ Tried,
100
+ } from './locks.ts'
48
101
  export { type ConsoleOut, type Logger, type LoggerOptions, logger } from './logger.ts'
49
102
  export {
50
103
  type Aggregate,
51
- type AggregateOp,
52
- type AggregateRange,
104
+ type AggregateQuery,
53
105
  type Bucket as MetricsBucket,
54
- Condition,
106
+ type Buckets,
107
+ type Condition as MetricsCondition,
55
108
  type Counter,
109
+ type Damage as MetricsDamage,
110
+ type Description as MetricsDescription,
111
+ exponentialBuckets,
56
112
  type Gauge,
113
+ type GaugeFuncOptions,
114
+ type Histogram,
115
+ type HistogramOptions,
116
+ type InstrumentLabels,
117
+ type InstrumentOptions,
118
+ type LabelPage,
57
119
  type Labels,
120
+ type LabelValue,
58
121
  type Metrics,
59
- noneOf,
60
- oneOf,
122
+ type NameInfo,
123
+ type NamePage,
124
+ type Newest,
125
+ type Op as MetricsOp,
126
+ type PageOptions,
127
+ type Percentile,
128
+ type PercentileBucket,
61
129
  type Plan,
62
- prefix,
63
- type Range,
130
+ type Query as MetricsQuery,
64
131
  type Series,
65
132
  type SeriesInput,
66
133
  type SeriesKind,
67
134
  type Timer,
135
+ type TimerOptions,
136
+ type Timing,
137
+ type ValueBucket,
138
+ type ValuePage,
68
139
  } from './metrics.ts'
69
140
  export type { Once, OnceOptions } from './once.ts'
70
- export type { Quota, QuotaUsage, WindowUsage } from './quota.ts'
71
- export {
72
- type Cursor,
73
- type Damage,
74
- type Fields,
75
- fields,
76
- type Level,
77
- type LinesWriter,
78
- type LogRecord,
79
- type RecordInput,
80
- type Records,
81
- type RecordsQuery,
141
+ export type { ColumnType, Query, RowPage, Table, TableOptions, UpsertOptions } from './query.ts'
142
+ export type {
143
+ Aggregate as EventsAggregate,
144
+ AllEvents,
145
+ AppendOptions,
146
+ Counted,
147
+ Damage,
148
+ Event,
149
+ EventLevel,
150
+ Events,
151
+ EventsOptions,
152
+ Fields,
153
+ Level,
154
+ Lines,
155
+ NewEvent,
156
+ Page as EventsPage,
157
+ PollBatch,
158
+ Query as EventsQuery,
159
+ Row as EventsRow,
160
+ Stats,
161
+ StoreLoggerOptions,
162
+ StreamInfo,
163
+ TailBatch,
164
+ TailQuery,
165
+ Top,
82
166
  } from './records.ts'
83
167
  export type { StandardSchemaV1 } from './schema.ts'
84
- export type {
85
- Database,
86
- Done,
87
- Migrations,
88
- Row,
89
- SqlArg,
90
- SqlBatch,
91
- SqlOptions,
92
- SqlValue,
93
- Statement,
168
+ export {
169
+ type Found as SearchFound,
170
+ type Hit as SearchHit,
171
+ type IndexDocument,
172
+ type IndexInfo,
173
+ type IndexOptions,
174
+ type IndexStatus,
175
+ type Query as SearchQuery,
176
+ SearchIndex,
177
+ search,
178
+ TableIndex,
179
+ type TableIndexOptions,
180
+ type Vector,
181
+ type Where,
182
+ type WhereValue,
183
+ } from './search.ts'
184
+ export {
185
+ type Columns,
186
+ type Database,
187
+ type DatabaseOptions,
188
+ type Done,
189
+ type Migrations,
190
+ type Row,
191
+ Sql,
192
+ type SqlArg,
193
+ type SqlTag,
194
+ type SqlTx,
195
+ type SqlValue,
196
+ type Statement,
197
+ sql,
94
198
  } from './sql.ts'
95
199
  export {
96
200
  type ConnectOptions,
97
201
  connect,
202
+ type NodeOptions,
98
203
  type OpenOptions,
99
204
  open,
100
205
  type Status,
@@ -102,4 +207,5 @@ export {
102
207
  } from './store.ts'
103
208
  export type { Duration, DurationText, Time } from './time.ts'
104
209
  export { type Trace, withTrace } from './trace.ts'
210
+ export type { Tx, TxBucket, TxCounters } from './tx.ts'
105
211
  export type { Key } from './wire/codec.ts'