@hot-updater/server 1.0.0-rc.16 → 1.0.0-rc.18

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 (309) hide show
  1. package/dist/adapters/drizzle.cjs +5 -5
  2. package/dist/adapters/drizzle.mjs +4 -4
  3. package/dist/adapters/kysely.cjs +3 -3
  4. package/dist/adapters/kysely.mjs +2 -2
  5. package/dist/adapters/mongodb.cjs +3 -3
  6. package/dist/adapters/mongodb.mjs +2 -2
  7. package/dist/adapters/mongodbAdapter.cjs +19 -1
  8. package/dist/adapters/mongodbAdapter.mjs +19 -1
  9. package/dist/adapters/prisma.cjs +5 -5
  10. package/dist/adapters/prisma.mjs +4 -4
  11. package/dist/assembly/assemblePlugins.cjs +47 -28
  12. package/dist/assembly/assemblePlugins.d.cts +3 -7
  13. package/dist/assembly/assemblePlugins.d.mts +3 -7
  14. package/dist/assembly/assemblePlugins.mjs +46 -27
  15. package/dist/assembly/clientPlugins.cjs +86 -0
  16. package/dist/assembly/clientPlugins.d.cts +16 -0
  17. package/dist/assembly/clientPlugins.d.mts +16 -0
  18. package/dist/assembly/clientPlugins.mjs +86 -0
  19. package/dist/assembly/configError.cjs +7 -0
  20. package/dist/assembly/configError.d.cts +7 -0
  21. package/dist/assembly/configError.d.mts +7 -0
  22. package/dist/assembly/configError.mjs +7 -0
  23. package/dist/assembly/databasePlugins.cjs +5 -1
  24. package/dist/assembly/databasePlugins.d.cts +5 -5
  25. package/dist/assembly/databasePlugins.d.mts +5 -5
  26. package/dist/assembly/databasePlugins.mjs +5 -1
  27. package/dist/assembly/pluginCli.cjs +125 -0
  28. package/dist/assembly/pluginCli.d.cts +59 -0
  29. package/dist/assembly/pluginCli.d.mts +59 -0
  30. package/dist/assembly/pluginCli.mjs +121 -0
  31. package/dist/createHotUpdaterCore.cjs +14 -16
  32. package/dist/createHotUpdaterCore.d.cts +10 -3
  33. package/dist/createHotUpdaterCore.d.mts +10 -3
  34. package/dist/createHotUpdaterCore.mjs +11 -13
  35. package/dist/database/aggregateBatching.cjs +626 -0
  36. package/dist/database/aggregateBatching.d.cts +10 -0
  37. package/dist/database/aggregateBatching.d.mts +10 -0
  38. package/dist/database/aggregateBatching.mjs +625 -0
  39. package/dist/{insights/errors.cjs → database/busy.cjs} +2 -15
  40. package/dist/database/busy.d.cts +12 -0
  41. package/dist/database/busy.d.mts +12 -0
  42. package/dist/{insights/errors.mjs → database/busy.mjs} +3 -14
  43. package/dist/database/database.cjs +22 -3
  44. package/dist/database/database.d.cts +15 -2
  45. package/dist/database/database.d.mts +15 -2
  46. package/dist/database/database.mjs +22 -3
  47. package/dist/database/definitions.d.cts +10 -0
  48. package/dist/database/definitions.d.mts +10 -0
  49. package/dist/database/engine.d.cts +2 -1
  50. package/dist/database/engine.d.mts +2 -1
  51. package/dist/database/engineAggregates.cjs +7 -4
  52. package/dist/database/engineAggregates.mjs +8 -5
  53. package/dist/database/engineReads.cjs +5 -3
  54. package/dist/database/engineReads.mjs +6 -4
  55. package/dist/database/engineTransaction.cjs +2 -6
  56. package/dist/database/engineTransaction.mjs +2 -6
  57. package/dist/database/fence.cjs +2 -1
  58. package/dist/database/fence.mjs +2 -1
  59. package/dist/database/index.cjs +17 -8
  60. package/dist/database/index.d.cts +5 -4
  61. package/dist/database/index.d.mts +5 -4
  62. package/dist/database/index.mjs +6 -5
  63. package/dist/database/kv/kvAdapter.cjs +15 -3
  64. package/dist/database/kv/kvAdapter.d.cts +8 -0
  65. package/dist/database/kv/kvAdapter.d.mts +8 -0
  66. package/dist/database/kv/kvAdapter.mjs +16 -4
  67. package/dist/database/resolveSchema.cjs +4 -1
  68. package/dist/database/resolveSchema.d.cts +1 -1
  69. package/dist/database/resolveSchema.d.mts +1 -1
  70. package/dist/database/resolveSchema.mjs +4 -1
  71. package/dist/database/retention.cjs +92 -0
  72. package/dist/database/retention.mjs +90 -0
  73. package/dist/database/schema.cjs +5 -2
  74. package/dist/database/schema.d.cts +30 -1
  75. package/dist/database/schema.d.mts +30 -1
  76. package/dist/database/schema.mjs +5 -2
  77. package/dist/database/sql/sqlAdapter.cjs +8 -0
  78. package/dist/database/sql/sqlAdapter.mjs +9 -1
  79. package/dist/database/sql/sqlSchema.cjs +56 -0
  80. package/dist/database/sql/sqlSchema.mjs +55 -1
  81. package/dist/db/coreDatabase.cjs +85 -0
  82. package/dist/db/coreDatabase.d.cts +57 -0
  83. package/dist/db/coreDatabase.d.mts +57 -0
  84. package/dist/db/coreDatabase.mjs +78 -0
  85. package/dist/db/index.cjs +11 -3
  86. package/dist/db/index.d.cts +7 -3
  87. package/dist/db/index.d.mts +7 -3
  88. package/dist/db/index.mjs +6 -3
  89. package/dist/db/types.d.cts +3 -3
  90. package/dist/db/types.d.mts +3 -3
  91. package/dist/diff.cjs +3 -0
  92. package/dist/diff.d.cts +2 -0
  93. package/dist/diff.d.mts +2 -0
  94. package/dist/diff.mjs +2 -0
  95. package/dist/handler.cjs +2 -14
  96. package/dist/handler.mjs +1 -13
  97. package/dist/handlerReleaseCatalogRoutes.cjs +21 -2
  98. package/dist/handlerReleaseCatalogRoutes.mjs +21 -2
  99. package/dist/index.cjs +2 -6
  100. package/dist/index.d.cts +4 -7
  101. package/dist/index.d.mts +4 -7
  102. package/dist/index.mjs +2 -4
  103. package/dist/package.cjs +1 -1
  104. package/dist/package.mjs +1 -1
  105. package/dist/{apiKeys.cjs → plugins/api-keys/apiKeys.cjs} +1 -1
  106. package/dist/{apiKeys.d.cts → plugins/api-keys/apiKeys.d.cts} +2 -2
  107. package/dist/{apiKeys.d.mts → plugins/api-keys/apiKeys.d.mts} +2 -2
  108. package/dist/{apiKeys.mjs → plugins/api-keys/apiKeys.mjs} +1 -1
  109. package/dist/plugins/api-keys/cli.cjs +115 -0
  110. package/dist/plugins/api-keys/cli.mjs +114 -0
  111. package/dist/plugins/api-keys/index.cjs +9 -6
  112. package/dist/plugins/api-keys/index.d.cts +4 -5
  113. package/dist/plugins/api-keys/index.d.mts +4 -5
  114. package/dist/plugins/api-keys/index.mjs +9 -7
  115. package/dist/plugins/api-keys/model.d.cts +20 -2
  116. package/dist/plugins/api-keys/model.d.mts +20 -2
  117. package/dist/plugins/definePlugin.cjs +1 -1
  118. package/dist/plugins/definePlugin.d.cts +130 -3
  119. package/dist/plugins/definePlugin.d.mts +130 -3
  120. package/dist/plugins/definePlugin.mjs +1 -1
  121. package/dist/plugins/index.cjs +25 -4
  122. package/dist/plugins/index.d.cts +7 -4
  123. package/dist/plugins/index.d.mts +7 -4
  124. package/dist/plugins/index.mjs +6 -4
  125. package/dist/plugins/insights/contract.cjs +193 -0
  126. package/dist/plugins/insights/contract.mjs +189 -0
  127. package/dist/{insights → plugins/insights}/domain.d.cts +60 -15
  128. package/dist/{insights → plugins/insights}/domain.d.mts +60 -15
  129. package/dist/plugins/insights/errors.cjs +15 -0
  130. package/dist/plugins/insights/errors.mjs +14 -0
  131. package/dist/{insights → plugins/insights}/eventInput.cjs +155 -22
  132. package/dist/{insights → plugins/insights}/eventInput.mjs +155 -22
  133. package/dist/plugins/insights/eventRow.cjs +49 -0
  134. package/dist/plugins/insights/eventRow.d.cts +64 -0
  135. package/dist/plugins/insights/eventRow.d.mts +64 -0
  136. package/dist/plugins/insights/eventRow.mjs +47 -0
  137. package/dist/plugins/insights/index.cjs +106 -26
  138. package/dist/plugins/insights/index.d.cts +130 -27
  139. package/dist/plugins/insights/index.d.mts +130 -27
  140. package/dist/plugins/insights/index.mjs +106 -29
  141. package/dist/plugins/insights/model.cjs +2 -2
  142. package/dist/plugins/insights/model.d.cts +1 -1
  143. package/dist/plugins/insights/model.d.mts +1 -1
  144. package/dist/plugins/insights/model.mjs +1 -1
  145. package/dist/plugins/insights/modelTypes.d.cts +176 -0
  146. package/dist/plugins/insights/modelTypes.d.mts +176 -0
  147. package/dist/plugins/insights/overview.cjs +109 -0
  148. package/dist/plugins/insights/overview.d.cts +15 -0
  149. package/dist/plugins/insights/overview.d.mts +15 -0
  150. package/dist/plugins/insights/overview.mjs +107 -0
  151. package/dist/{insights → plugins/insights}/provider.cjs +33 -14
  152. package/dist/{insights → plugins/insights}/provider.d.cts +2 -2
  153. package/dist/{insights → plugins/insights}/provider.d.mts +2 -2
  154. package/dist/{insights → plugins/insights}/provider.mjs +30 -11
  155. package/dist/{insights → plugins/insights}/queryInput.cjs +2 -2
  156. package/dist/{insights → plugins/insights}/queryInput.mjs +2 -2
  157. package/dist/plugins/insights/reads.cjs +298 -88
  158. package/dist/plugins/insights/reads.d.cts +61 -0
  159. package/dist/plugins/insights/reads.d.mts +61 -0
  160. package/dist/plugins/insights/reads.mjs +298 -90
  161. package/dist/plugins/insights/recordEvent.cjs +223 -39
  162. package/dist/plugins/insights/recordEvent.d.cts +9 -4
  163. package/dist/plugins/insights/recordEvent.d.mts +9 -4
  164. package/dist/plugins/insights/recordEvent.mjs +221 -37
  165. package/dist/{insights → plugins/insights}/routes.cjs +3 -30
  166. package/dist/{insights → plugins/insights}/routes.mjs +4 -28
  167. package/dist/plugins/insights/schema.cjs +182 -40
  168. package/dist/plugins/insights/schema.d.cts +446 -6
  169. package/dist/plugins/insights/schema.d.mts +446 -6
  170. package/dist/plugins/insights/schema.mjs +180 -41
  171. package/dist/plugins/insights/testing/eventRow.d.mts +64 -0
  172. package/dist/plugins/insights/testing/expectInsightsIndex.mjs +18 -0
  173. package/dist/plugins/insights/testing/fixtures.d.mts +8 -0
  174. package/dist/plugins/insights/testing/fixtures.mjs +25 -0
  175. package/dist/plugins/insights/testing/index.d.mts +24 -0
  176. package/dist/plugins/insights/testing/index.mjs +25 -0
  177. package/dist/plugins/insights/testing/insightsModelTests.mjs +714 -0
  178. package/dist/plugins/insights/testing/modelTypes.d.mts +176 -0
  179. package/dist/plugins/insights/testing/setupInsightsHttpTestSuite.d.mts +11 -0
  180. package/dist/plugins/insights/testing/setupInsightsHttpTestSuite.mjs +107 -0
  181. package/dist/plugins/insights/testing/setupInsightsModelTestSuite.d.mts +11 -0
  182. package/dist/plugins/insights/testing/setupInsightsModelTestSuite.mjs +31 -0
  183. package/dist/plugins/insights/testing/types.d.mts +26 -0
  184. package/dist/{insights → plugins/insights}/types.d.cts +3 -2
  185. package/dist/{insights → plugins/insights}/types.d.mts +3 -2
  186. package/package.json +18 -7
  187. package/src/adapters/drizzle.conformance.integration.spec.ts +2 -2
  188. package/src/adapters/drizzle.readBudgets.integration.spec.ts +6 -4
  189. package/src/adapters/drizzle.spec.ts +15 -7
  190. package/src/adapters/drizzle.ts +6 -6
  191. package/src/adapters/kysely.conformance.integration.spec.ts +2 -2
  192. package/src/adapters/kysely.readBudgets.integration.spec.ts +4 -2
  193. package/src/adapters/kysely.spec.ts +13 -9
  194. package/src/adapters/kysely.ts +2 -2
  195. package/src/adapters/mongodb.integration.spec.ts +98 -7
  196. package/src/adapters/mongodb.ts +2 -2
  197. package/src/adapters/mongodbAdapter.ts +14 -0
  198. package/src/adapters/prisma.conformance.integration.spec.ts +2 -2
  199. package/src/adapters/prisma.integration.spec.ts +16 -8
  200. package/src/adapters/prisma.readBudgets.integration.spec.ts +5 -2
  201. package/src/adapters/prisma.spec.ts +17 -9
  202. package/src/adapters/prisma.ts +6 -6
  203. package/src/adapters/prismaTestClients.ts +8 -1
  204. package/src/assembly/assemblePlugins.ts +73 -40
  205. package/src/assembly/assembly.spec.ts +63 -11
  206. package/src/assembly/assembly.types.spec.ts +50 -2
  207. package/src/assembly/clientPlugins.ts +113 -0
  208. package/src/assembly/configError.ts +4 -0
  209. package/src/assembly/databasePlugins.ts +11 -5
  210. package/src/assembly/pluginCli.spec.ts +254 -0
  211. package/src/assembly/pluginCli.ts +248 -0
  212. package/src/assembly/{builtInRoutes.spec.ts → pluginRoutes.spec.ts} +10 -37
  213. package/src/createHotUpdaterCore.ts +21 -17
  214. package/src/database/aggregateBatching.spec.ts +577 -0
  215. package/src/database/aggregateBatching.ts +803 -0
  216. package/src/{insights/errors.spec.ts → database/busy.spec.ts} +2 -5
  217. package/src/{insights/errors.ts → database/busy.ts} +1 -13
  218. package/src/database/database.ts +39 -8
  219. package/src/database/definitions.ts +4 -0
  220. package/src/database/engineAggregates.spec.ts +4 -7
  221. package/src/database/engineAggregates.ts +5 -9
  222. package/src/database/engineReads.ts +7 -5
  223. package/src/database/engineTransaction.ts +1 -7
  224. package/src/database/fence.spec.ts +5 -5
  225. package/src/database/fence.ts +4 -0
  226. package/src/database/index.ts +13 -7
  227. package/src/database/kv/kvAdapter.batching.integration.spec.ts +15 -0
  228. package/src/database/kv/kvAdapter.conformance.integration.spec.ts +2 -0
  229. package/src/database/kv/kvAdapter.spec.ts +128 -1
  230. package/src/database/kv/kvAdapter.ts +30 -1
  231. package/src/database/kv/kvTestStore.ts +28 -1
  232. package/src/database/resolveSchema.ts +4 -1
  233. package/src/database/retention.spec.ts +314 -0
  234. package/src/database/retention.ts +129 -0
  235. package/src/database/schema.ts +44 -0
  236. package/src/database/sql/sqlAdapter.integration.spec.ts +4 -7
  237. package/src/database/sql/sqlAdapter.readBudgets.integration.spec.ts +18 -4
  238. package/src/database/sql/sqlAdapter.spec.ts +91 -3
  239. package/src/database/sql/sqlAdapter.ts +20 -0
  240. package/src/database/sql/sqlSchema.ts +81 -0
  241. package/src/databaseTestSuite.spec.ts +9 -4
  242. package/src/db/coreDatabase.ts +153 -0
  243. package/src/db/engineSql.spec.ts +8 -7
  244. package/src/db/index.ts +19 -2
  245. package/src/db/pluginTables.spec.ts +57 -27
  246. package/src/db/types.ts +3 -3
  247. package/src/diff.ts +6 -0
  248. package/src/handler-standalone.integration.spec.ts +2 -3
  249. package/src/handler.ts +1 -32
  250. package/src/handlerReleaseCatalogRoutes.ts +26 -2
  251. package/src/index.ts +0 -10
  252. package/src/{apiKeys.integration.spec.ts → plugins/api-keys/apiKeys.integration.spec.ts} +4 -4
  253. package/src/{apiKeys.spec.ts → plugins/api-keys/apiKeys.spec.ts} +3 -3
  254. package/src/{apiKeys.ts → plugins/api-keys/apiKeys.ts} +1 -1
  255. package/src/plugins/api-keys/apiKeysPlugin.spec.ts +11 -15
  256. package/src/plugins/api-keys/cli.spec.ts +187 -0
  257. package/src/plugins/api-keys/cli.ts +140 -0
  258. package/src/plugins/api-keys/index.ts +48 -41
  259. package/src/plugins/api-keys/model.ts +21 -2
  260. package/src/plugins/definePlugin.ts +144 -2
  261. package/src/plugins/index.ts +20 -2
  262. package/src/plugins/insights/contract.spec.ts +285 -0
  263. package/src/plugins/insights/contract.ts +372 -0
  264. package/src/{insights → plugins/insights}/domain.ts +73 -15
  265. package/src/plugins/insights/errors.ts +11 -0
  266. package/src/{insights → plugins/insights}/eventInput.ts +189 -29
  267. package/src/plugins/insights/eventRow.ts +209 -0
  268. package/src/plugins/insights/index.ts +181 -45
  269. package/src/{insights → plugins/insights}/insights.integration.spec.ts +330 -34
  270. package/src/plugins/insights/insightsRollout.integration.spec.ts +1 -2
  271. package/src/plugins/insights/model.spec.ts +3 -5
  272. package/src/plugins/insights/model.ts +2 -3
  273. package/src/plugins/insights/modelTypes.ts +197 -0
  274. package/src/plugins/insights/overview.spec.ts +64 -0
  275. package/src/plugins/insights/overview.ts +214 -0
  276. package/src/{insights → plugins/insights}/provider.spec.ts +21 -10
  277. package/src/{insights → plugins/insights}/provider.ts +58 -21
  278. package/src/{insights → plugins/insights}/queryInput.ts +2 -2
  279. package/src/plugins/insights/reads.spec.ts +340 -52
  280. package/src/plugins/insights/reads.ts +453 -123
  281. package/src/plugins/insights/recordEvent.spec.ts +474 -20
  282. package/src/plugins/insights/recordEvent.ts +301 -63
  283. package/src/plugins/insights/retention.spec.ts +115 -0
  284. package/src/{insights → plugins/insights}/routes.ts +1 -31
  285. package/src/plugins/insights/schema.ts +356 -176
  286. package/src/plugins/insights/testing/expectInsightsIndex.spec.ts +42 -0
  287. package/src/plugins/insights/testing/expectInsightsIndex.ts +20 -0
  288. package/src/plugins/insights/testing/fixtures.ts +30 -0
  289. package/src/plugins/insights/testing/index.ts +45 -0
  290. package/src/plugins/insights/testing/insightsModelTests.ts +860 -0
  291. package/src/plugins/insights/testing/setupInsightsHttpTestSuite.ts +152 -0
  292. package/src/plugins/insights/testing/setupInsightsModelTestSuite.ts +36 -0
  293. package/src/plugins/insights/testing/types.ts +30 -0
  294. package/src/{insights → plugins/insights}/types.ts +1 -1
  295. package/src/readBudgets.testFixtures.ts +2 -2
  296. package/src/releaseCatalogRoutes.integration.spec.ts +7 -0
  297. package/src/retention.spec.ts +73 -0
  298. package/src/runtime.spec.ts +11 -12
  299. package/src/runtime.testFixtures.ts +7 -2
  300. package/src/testUtilsMutation.integration.spec.ts +2 -1
  301. package/src/testUtilsPackage.integration.spec.ts +7 -3
  302. package/dist/db/builtInDatabase.cjs +0 -104
  303. package/dist/db/builtInDatabase.d.cts +0 -38
  304. package/dist/db/builtInDatabase.d.mts +0 -38
  305. package/dist/db/builtInDatabase.mjs +0 -97
  306. package/dist/plugins/builtIn.cjs +0 -7
  307. package/dist/plugins/builtIn.mjs +0 -6
  308. package/src/db/builtInDatabase.ts +0 -149
  309. package/src/plugins/builtIn.ts +0 -5
@@ -1,11 +1,20 @@
1
+ const require_aggregateBatching = require("./aggregateBatching.cjs");
1
2
  const require_engineTransaction = require("./engineTransaction.cjs");
2
3
  const require_engine = require("./engine.cjs");
3
4
  let _hot_updater_plugin_core_internal = require("@hot-updater/plugin-core/internal");
4
5
  //#region src/database/database.ts
5
6
  /** The engine plus `database(module)`, which hands a module its typed handle. */
6
- const createDatabaseEngine = (options) => {
7
+ const createDatabaseEngine = ({ batching, now = Date.now, ...options }) => {
7
8
  const engine = require_engine.createEngine(options);
8
9
  const { reads } = engine;
10
+ const batches = batching && require_aggregateBatching.createAggregateBatches({
11
+ engine,
12
+ adapter: options.adapter,
13
+ schema: options.schema,
14
+ batching,
15
+ now
16
+ });
17
+ const transaction = batches?.transaction ?? engine.transaction;
9
18
  const outside = (read) => (...args) => {
10
19
  require_engineTransaction.assertOutsideTransaction();
11
20
  return read(...args);
@@ -21,14 +30,24 @@ const createDatabaseEngine = (options) => {
21
30
  };
22
31
  return {
23
32
  ...engine,
33
+ /** Applies batched aggregate changes still pending: this process's buffer and the log. */
34
+ flush: async () => {
35
+ await batches?.flush();
36
+ },
37
+ dispose: async () => {
38
+ await batches?.dispose();
39
+ },
24
40
  database(module) {
25
41
  const name = (model) => module.namespace ? `${module.namespace}_${model}` : model;
26
42
  return {
27
43
  findOne: outside(async (model, lookup) => bare(await reads.findOne(name(model), lookup))),
28
44
  findByKeys: outside(async (model, keys) => (await reads.findByKeys(name(model), keys)).map(bare)),
29
45
  findMany: outside((model, input) => barePage(reads.findMany(name(model), input))),
30
- findAggregates: outside((model, input) => barePage(reads.findAggregates(name(model), input))),
31
- transaction: (fn) => engine.transaction((tx) => fn({
46
+ findAggregates: outside(async (model, input) => {
47
+ await batches?.beforeRead(name(model));
48
+ return await barePage(reads.findAggregates(name(model), input));
49
+ }),
50
+ transaction: (fn) => transaction((tx) => fn({
32
51
  findOne: (model, lookup) => tx.findOne(name(model), lookup),
33
52
  findMany: (model, input) => tx.findMany(name(model), input),
34
53
  create: (model, row) => tx.create(name(model), row),
@@ -1,9 +1,10 @@
1
1
  import { FieldType } from "./definitions.cjs";
2
- import { SchemaModule } from "./resolveSchema.cjs";
2
+ import { ResolvedModel, SchemaModule } from "./resolveSchema.cjs";
3
3
  import { AggregateDefinition, FieldValue, ModuleSchema, RowOf, TableDefinition } from "./schema.cjs";
4
4
  import { EngineReadCount, Page, ReadInput } from "./engineReads.cjs";
5
5
  import { TransactionEngine } from "./engineTransaction.cjs";
6
6
  import { DatabaseEngineOptions, ReadMeasurement } from "./engine.cjs";
7
+ import { AggregateBatching } from "@hot-updater/plugin-core";
7
8
  import { DatabaseKeyValue, StoredRow } from "@hot-updater/plugin-core/internal";
8
9
  //#region src/database/database.d.ts
9
10
  type TableNames<S extends ModuleSchema> = { [K in keyof S]: S[K] extends TableDefinition ? K : never; }[keyof S] & string;
@@ -100,12 +101,24 @@ interface HotUpdaterDatabase<S extends ModuleSchema> {
100
101
  transaction<R>(fn: (tx: HotUpdaterTransaction<S>) => Promise<R>): Promise<R>;
101
102
  }
102
103
  /** The engine plus `database(module)`, which hands a module its typed handle. */
103
- declare const createDatabaseEngine: (options: DatabaseEngineOptions) => {
104
+ declare const createDatabaseEngine: ({ batching, now, ...options }: DatabaseEngineOptions & {
105
+ /**
106
+ * Batches changes to aggregates declared `batched`; the schema must
107
+ * include `aggregateBatchingModule`.
108
+ */
109
+ readonly batching?: AggregateBatching;
110
+ /** The clock batching times its flushes and compactions by. */
111
+ readonly now?: () => number;
112
+ }) => {
113
+ /** Applies batched aggregate changes still pending: this process's buffer and the log. */
114
+ flush: () => Promise<void>;
115
+ dispose: () => Promise<void>;
104
116
  database<S extends ModuleSchema>(module: SchemaModule & {
105
117
  readonly schema: S;
106
118
  }): HotUpdaterDatabase<S>;
107
119
  reads: {
108
120
  maxPageSize: number;
121
+ modelOf: (name: string, kind?: "table" | "aggregate") => ResolvedModel;
109
122
  reads: {
110
123
  total: () => EngineReadCount;
111
124
  reset: () => void;
@@ -1,9 +1,10 @@
1
1
  import { FieldType } from "./definitions.mjs";
2
- import { SchemaModule } from "./resolveSchema.mjs";
2
+ import { ResolvedModel, SchemaModule } from "./resolveSchema.mjs";
3
3
  import { AggregateDefinition, FieldValue, ModuleSchema, RowOf, TableDefinition } from "./schema.mjs";
4
4
  import { EngineReadCount, Page, ReadInput } from "./engineReads.mjs";
5
5
  import { TransactionEngine } from "./engineTransaction.mjs";
6
6
  import { DatabaseEngineOptions, ReadMeasurement } from "./engine.mjs";
7
+ import { AggregateBatching } from "@hot-updater/plugin-core";
7
8
  import { DatabaseKeyValue, StoredRow } from "@hot-updater/plugin-core/internal";
8
9
  //#region src/database/database.d.ts
9
10
  type TableNames<S extends ModuleSchema> = { [K in keyof S]: S[K] extends TableDefinition ? K : never; }[keyof S] & string;
@@ -100,12 +101,24 @@ interface HotUpdaterDatabase<S extends ModuleSchema> {
100
101
  transaction<R>(fn: (tx: HotUpdaterTransaction<S>) => Promise<R>): Promise<R>;
101
102
  }
102
103
  /** The engine plus `database(module)`, which hands a module its typed handle. */
103
- declare const createDatabaseEngine: (options: DatabaseEngineOptions) => {
104
+ declare const createDatabaseEngine: ({ batching, now, ...options }: DatabaseEngineOptions & {
105
+ /**
106
+ * Batches changes to aggregates declared `batched`; the schema must
107
+ * include `aggregateBatchingModule`.
108
+ */
109
+ readonly batching?: AggregateBatching;
110
+ /** The clock batching times its flushes and compactions by. */
111
+ readonly now?: () => number;
112
+ }) => {
113
+ /** Applies batched aggregate changes still pending: this process's buffer and the log. */
114
+ flush: () => Promise<void>;
115
+ dispose: () => Promise<void>;
104
116
  database<S extends ModuleSchema>(module: SchemaModule & {
105
117
  readonly schema: S;
106
118
  }): HotUpdaterDatabase<S>;
107
119
  reads: {
108
120
  maxPageSize: number;
121
+ modelOf: (name: string, kind?: "table" | "aggregate") => ResolvedModel;
109
122
  reads: {
110
123
  total: () => EngineReadCount;
111
124
  reset: () => void;
@@ -1,11 +1,20 @@
1
+ import { createAggregateBatches } from "./aggregateBatching.mjs";
1
2
  import { assertOutsideTransaction } from "./engineTransaction.mjs";
2
3
  import { createEngine } from "./engine.mjs";
3
4
  import { DATABASE_VERSION_COLUMN } from "@hot-updater/plugin-core/internal";
4
5
  //#region src/database/database.ts
5
6
  /** The engine plus `database(module)`, which hands a module its typed handle. */
6
- const createDatabaseEngine = (options) => {
7
+ const createDatabaseEngine = ({ batching, now = Date.now, ...options }) => {
7
8
  const engine = createEngine(options);
8
9
  const { reads } = engine;
10
+ const batches = batching && createAggregateBatches({
11
+ engine,
12
+ adapter: options.adapter,
13
+ schema: options.schema,
14
+ batching,
15
+ now
16
+ });
17
+ const transaction = batches?.transaction ?? engine.transaction;
9
18
  const outside = (read) => (...args) => {
10
19
  assertOutsideTransaction();
11
20
  return read(...args);
@@ -21,14 +30,24 @@ const createDatabaseEngine = (options) => {
21
30
  };
22
31
  return {
23
32
  ...engine,
33
+ /** Applies batched aggregate changes still pending: this process's buffer and the log. */
34
+ flush: async () => {
35
+ await batches?.flush();
36
+ },
37
+ dispose: async () => {
38
+ await batches?.dispose();
39
+ },
24
40
  database(module) {
25
41
  const name = (model) => module.namespace ? `${module.namespace}_${model}` : model;
26
42
  return {
27
43
  findOne: outside(async (model, lookup) => bare(await reads.findOne(name(model), lookup))),
28
44
  findByKeys: outside(async (model, keys) => (await reads.findByKeys(name(model), keys)).map(bare)),
29
45
  findMany: outside((model, input) => barePage(reads.findMany(name(model), input))),
30
- findAggregates: outside((model, input) => barePage(reads.findAggregates(name(model), input))),
31
- transaction: (fn) => engine.transaction((tx) => fn({
46
+ findAggregates: outside(async (model, input) => {
47
+ await batches?.beforeRead(name(model));
48
+ return await barePage(reads.findAggregates(name(model), input));
49
+ }),
50
+ transaction: (fn) => transaction((tx) => fn({
32
51
  findOne: (model, lookup) => tx.findOne(name(model), lookup),
33
52
  findMany: (model, input) => tx.findMany(name(model), input),
34
53
  create: (model, row) => tx.create(name(model), row),
@@ -45,6 +45,11 @@ interface TableShape {
45
45
  readonly key: readonly string[];
46
46
  readonly derived: Readonly<Record<string, DerivedShape>>;
47
47
  readonly indexes: Readonly<Record<string, IndexDefinition>>;
48
+ /** Rows expire `days` after the epoch milliseconds in `field`. */
49
+ readonly retention?: {
50
+ readonly field: string;
51
+ readonly days: number;
52
+ };
48
53
  }
49
54
  interface AggregateShape {
50
55
  readonly kind: "aggregate";
@@ -60,6 +65,11 @@ interface AggregateShape {
60
65
  /** Fixed once data exists. */
61
66
  readonly shards: number;
62
67
  readonly indexes: Readonly<Record<string, IndexDefinition>>;
68
+ /** On an identity field; a change to a row past it is dropped. */
69
+ readonly retention?: {
70
+ readonly field: string;
71
+ readonly days: number;
72
+ };
63
73
  }
64
74
  type ModelShape = TableShape | AggregateShape;
65
75
  /** A module's models by name: core, or one plugin. */
@@ -45,6 +45,11 @@ interface TableShape {
45
45
  readonly key: readonly string[];
46
46
  readonly derived: Readonly<Record<string, DerivedShape>>;
47
47
  readonly indexes: Readonly<Record<string, IndexDefinition>>;
48
+ /** Rows expire `days` after the epoch milliseconds in `field`. */
49
+ readonly retention?: {
50
+ readonly field: string;
51
+ readonly days: number;
52
+ };
48
53
  }
49
54
  interface AggregateShape {
50
55
  readonly kind: "aggregate";
@@ -60,6 +65,11 @@ interface AggregateShape {
60
65
  /** Fixed once data exists. */
61
66
  readonly shards: number;
62
67
  readonly indexes: Readonly<Record<string, IndexDefinition>>;
68
+ /** On an identity field; a change to a row past it is dropped. */
69
+ readonly retention?: {
70
+ readonly field: string;
71
+ readonly days: number;
72
+ };
63
73
  }
64
74
  type ModelShape = TableShape | AggregateShape;
65
75
  /** A module's models by name: core, or one plugin. */
@@ -1,4 +1,4 @@
1
- import { ResolvedSchema } from "./resolveSchema.cjs";
1
+ import { ResolvedModel, ResolvedSchema } from "./resolveSchema.cjs";
2
2
  import { EngineReadCount, Page, ReadInput } from "./engineReads.cjs";
3
3
  import { RetryOptions, TransactionEngine } from "./engineTransaction.cjs";
4
4
  import { DatabaseAdapter, DatabaseReadCount } from "@hot-updater/plugin-core/internal";
@@ -22,6 +22,7 @@ interface ReadMeasurement<T> {
22
22
  declare const createEngine: ({ adapter: given, schema, maxPageSize, verify, retry }: DatabaseEngineOptions) => {
23
23
  reads: {
24
24
  maxPageSize: number;
25
+ modelOf: (name: string, kind?: "table" | "aggregate") => ResolvedModel;
25
26
  reads: {
26
27
  total: () => EngineReadCount;
27
28
  reset: () => void;
@@ -1,4 +1,4 @@
1
- import { ResolvedSchema } from "./resolveSchema.mjs";
1
+ import { ResolvedModel, ResolvedSchema } from "./resolveSchema.mjs";
2
2
  import { EngineReadCount, Page, ReadInput } from "./engineReads.mjs";
3
3
  import { RetryOptions, TransactionEngine } from "./engineTransaction.mjs";
4
4
  import { DatabaseAdapter, DatabaseReadCount } from "@hot-updater/plugin-core/internal";
@@ -22,6 +22,7 @@ interface ReadMeasurement<T> {
22
22
  declare const createEngine: ({ adapter: given, schema, maxPageSize, verify, retry }: DatabaseEngineOptions) => {
23
23
  reads: {
24
24
  maxPageSize: number;
25
+ modelOf: (name: string, kind?: "table" | "aggregate") => ResolvedModel;
25
26
  reads: {
26
27
  total: () => EngineReadCount;
27
28
  reset: () => void;
@@ -1,5 +1,5 @@
1
- const require_errors = require("./errors.cjs");
2
1
  const require_cursor = require("./cursor.cjs");
2
+ const require_errors = require("./errors.cjs");
3
3
  let _hot_updater_plugin_core_internal = require("@hot-updater/plugin-core/internal");
4
4
  //#region src/database/engineAggregates.ts
5
5
  const definitionOf = (model) => model.definition;
@@ -21,7 +21,7 @@ const recordAggregate = (changes, model, identity, values, shardBy) => {
21
21
  sketches: {}
22
22
  };
23
23
  changes.set(id, change);
24
- for (const [metric, value] of Object.entries(values)) if (distinct.includes(metric) && typeof value === "string") change.sketches[metric] = (0, _hot_updater_plugin_core_internal.mergeInsightsDistinct)([change.sketches[metric], value]);
24
+ for (const [metric, value] of Object.entries(values)) if (distinct.includes(metric) && typeof value === "string") change.sketches[metric] = (0, _hot_updater_plugin_core_internal.mergeDistinct)([change.sketches[metric], value]);
25
25
  else if ((counters.includes(metric) || gauges.includes(metric)) && Number.isSafeInteger(value)) change.deltas[metric] = (change.deltas[metric] ?? 0) + Number(value);
26
26
  else throw fail(`${metric} is not a counter, gauge, or sketch of this aggregate.`);
27
27
  };
@@ -47,13 +47,16 @@ const rewrite = ({ model, key, deltas, sketches }, current) => {
47
47
  const base = current ?? blank(model, key);
48
48
  const set = {};
49
49
  for (const [metric, delta] of Object.entries(deltas)) set[metric] = Number(base[metric] ?? 0) + delta;
50
- for (const [metric, sketch] of Object.entries(sketches)) set[metric] = (0, _hot_updater_plugin_core_internal.mergeInsightsDistinct)([base[metric], sketch]);
50
+ for (const [metric, sketch] of Object.entries(sketches)) set[metric] = (0, _hot_updater_plugin_core_internal.mergeDistinct)([base[metric], sketch]);
51
51
  if (current && Object.entries(set).every(([metric, value]) => current[metric] === value)) return;
52
52
  const row = {
53
53
  ...base,
54
54
  ...set
55
55
  };
56
- if (gauges.some((gauge) => Number(row[gauge]) < 0)) throw new NegativeGaugeError(`${table.name}: a gauge went below 0.`);
56
+ if (gauges.some((gauge) => Number(row[gauge]) < 0)) {
57
+ if (current === null && table.retention) return void 0;
58
+ throw new NegativeGaugeError(`${table.name}: a gauge went below 0.`);
59
+ }
57
60
  const zero = distinct.length === 0 && [...counters, ...gauges].every((metric) => Number(row[metric]) === 0);
58
61
  if (current === null) return zero ? void 0 : {
59
62
  type: "insert",
@@ -1,6 +1,6 @@
1
- import { DatabaseTransactionError } from "./errors.mjs";
2
1
  import { fnv1a } from "./cursor.mjs";
3
- import { DATABASE_VERSION_COLUMN, isKeyValue, mergeInsightsDistinct } from "@hot-updater/plugin-core/internal";
2
+ import { DatabaseTransactionError } from "./errors.mjs";
3
+ import { DATABASE_VERSION_COLUMN, isKeyValue, mergeDistinct } from "@hot-updater/plugin-core/internal";
4
4
  //#region src/database/engineAggregates.ts
5
5
  const definitionOf = (model) => model.definition;
6
6
  /** Every change keyed by one value lands on one shard. */
@@ -21,7 +21,7 @@ const recordAggregate = (changes, model, identity, values, shardBy) => {
21
21
  sketches: {}
22
22
  };
23
23
  changes.set(id, change);
24
- for (const [metric, value] of Object.entries(values)) if (distinct.includes(metric) && typeof value === "string") change.sketches[metric] = mergeInsightsDistinct([change.sketches[metric], value]);
24
+ for (const [metric, value] of Object.entries(values)) if (distinct.includes(metric) && typeof value === "string") change.sketches[metric] = mergeDistinct([change.sketches[metric], value]);
25
25
  else if ((counters.includes(metric) || gauges.includes(metric)) && Number.isSafeInteger(value)) change.deltas[metric] = (change.deltas[metric] ?? 0) + Number(value);
26
26
  else throw fail(`${metric} is not a counter, gauge, or sketch of this aggregate.`);
27
27
  };
@@ -47,13 +47,16 @@ const rewrite = ({ model, key, deltas, sketches }, current) => {
47
47
  const base = current ?? blank(model, key);
48
48
  const set = {};
49
49
  for (const [metric, delta] of Object.entries(deltas)) set[metric] = Number(base[metric] ?? 0) + delta;
50
- for (const [metric, sketch] of Object.entries(sketches)) set[metric] = mergeInsightsDistinct([base[metric], sketch]);
50
+ for (const [metric, sketch] of Object.entries(sketches)) set[metric] = mergeDistinct([base[metric], sketch]);
51
51
  if (current && Object.entries(set).every(([metric, value]) => current[metric] === value)) return;
52
52
  const row = {
53
53
  ...base,
54
54
  ...set
55
55
  };
56
- if (gauges.some((gauge) => Number(row[gauge]) < 0)) throw new NegativeGaugeError(`${table.name}: a gauge went below 0.`);
56
+ if (gauges.some((gauge) => Number(row[gauge]) < 0)) {
57
+ if (current === null && table.retention) return void 0;
58
+ throw new NegativeGaugeError(`${table.name}: a gauge went below 0.`);
59
+ }
57
60
  const zero = distinct.length === 0 && [...counters, ...gauges].every((metric) => Number(row[metric]) === 0);
58
61
  if (current === null) return zero ? void 0 : {
59
62
  type: "insert",
@@ -35,10 +35,11 @@ const createEngineReads = ({ adapter, schema, maxPageSize: requested = _hot_upda
35
35
  };
36
36
  return rows;
37
37
  };
38
- const modelOf = (name, kind) => {
38
+ /** A model of `kind` by physical table name, for reads and transactions. */
39
+ const modelOf = (name, kind = "table") => {
39
40
  const model = schema.models.get(name);
40
41
  if (model?.definition.kind === kind) return model;
41
- throw new DatabaseQueryError(model === void 0 ? `Unknown model ${name}.` : kind === "table" ? `${name} is an aggregate; read it with findAggregates.` : `${name} is a table; read it with findMany.`);
42
+ throw new DatabaseQueryError(model === void 0 ? `Unknown model ${name}.` : kind === "table" ? `${name} is an aggregate; read it with findAggregates and change it with aggregate.` : `${name} is a table; read it with findMany and change it with create, update, or delete.`);
42
43
  };
43
44
  const plan = ({ table }, input) => {
44
45
  const index = table.indexes.find(({ name }) => name === input.index);
@@ -95,6 +96,7 @@ const createEngineReads = ({ adapter, schema, maxPageSize: requested = _hot_upda
95
96
  };
96
97
  return {
97
98
  maxPageSize,
99
+ modelOf,
98
100
  reads: {
99
101
  total: () => count,
100
102
  reset: () => {
@@ -162,7 +164,7 @@ const createEngineReads = ({ adapter, schema, maxPageSize: requested = _hot_upda
162
164
  const merged = [...groups.values()].map((shards) => {
163
165
  const row = Object.fromEntries(definition.key.map((field) => [field, shards[0][field]]));
164
166
  for (const metric of [...definition.counters, ...definition.gauges]) row[metric] = shards.reduce((sum, shard) => sum + Number(shard[metric] ?? 0), 0);
165
- for (const metric of definition.distinct) row[metric] = (0, _hot_updater_plugin_core_internal.mergeInsightsDistinct)(shards.map((shard) => shard[metric]));
167
+ for (const metric of definition.distinct) row[metric] = (0, _hot_updater_plugin_core_internal.mergeDistinct)(shards.map((shard) => shard[metric]));
166
168
  return row;
167
169
  });
168
170
  returned(merged);
@@ -1,6 +1,6 @@
1
1
  import { cursorScope, decodeCursor, encodeCursor } from "./cursor.mjs";
2
2
  import { SHARD_COLUMN } from "./resolveSchema.mjs";
3
- import { DATABASE_MAX_QUERY_LIMIT, indexOrderColumns, indexOrderTuple, isKeyValue, mergeInsightsDistinct } from "@hot-updater/plugin-core/internal";
3
+ import { DATABASE_MAX_QUERY_LIMIT, indexOrderColumns, indexOrderTuple, isKeyValue, mergeDistinct } from "@hot-updater/plugin-core/internal";
4
4
  //#region src/database/engineReads.ts
5
5
  var DatabaseQueryError = class extends Error {
6
6
  name = "DatabaseQueryError";
@@ -35,10 +35,11 @@ const createEngineReads = ({ adapter, schema, maxPageSize: requested = DATABASE_
35
35
  };
36
36
  return rows;
37
37
  };
38
- const modelOf = (name, kind) => {
38
+ /** A model of `kind` by physical table name, for reads and transactions. */
39
+ const modelOf = (name, kind = "table") => {
39
40
  const model = schema.models.get(name);
40
41
  if (model?.definition.kind === kind) return model;
41
- throw new DatabaseQueryError(model === void 0 ? `Unknown model ${name}.` : kind === "table" ? `${name} is an aggregate; read it with findAggregates.` : `${name} is a table; read it with findMany.`);
42
+ throw new DatabaseQueryError(model === void 0 ? `Unknown model ${name}.` : kind === "table" ? `${name} is an aggregate; read it with findAggregates and change it with aggregate.` : `${name} is a table; read it with findMany and change it with create, update, or delete.`);
42
43
  };
43
44
  const plan = ({ table }, input) => {
44
45
  const index = table.indexes.find(({ name }) => name === input.index);
@@ -95,6 +96,7 @@ const createEngineReads = ({ adapter, schema, maxPageSize: requested = DATABASE_
95
96
  };
96
97
  return {
97
98
  maxPageSize,
99
+ modelOf,
98
100
  reads: {
99
101
  total: () => count,
100
102
  reset: () => {
@@ -162,7 +164,7 @@ const createEngineReads = ({ adapter, schema, maxPageSize: requested = DATABASE_
162
164
  const merged = [...groups.values()].map((shards) => {
163
165
  const row = Object.fromEntries(definition.key.map((field) => [field, shards[0][field]]));
164
166
  for (const metric of [...definition.counters, ...definition.gauges]) row[metric] = shards.reduce((sum, shard) => sum + Number(shard[metric] ?? 0), 0);
165
- for (const metric of definition.distinct) row[metric] = mergeInsightsDistinct(shards.map((shard) => shard[metric]));
167
+ for (const metric of definition.distinct) row[metric] = mergeDistinct(shards.map((shard) => shard[metric]));
166
168
  return row;
167
169
  });
168
170
  returned(merged);
@@ -1,6 +1,6 @@
1
1
  const require_errors = require("./errors.cjs");
2
- const require_engineReads = require("./engineReads.cjs");
3
2
  const require_engineAggregates = require("./engineAggregates.cjs");
3
+ const require_engineReads = require("./engineReads.cjs");
4
4
  let _hot_updater_plugin_core_internal = require("@hot-updater/plugin-core/internal");
5
5
  //#region src/database/engineTransaction.ts
6
6
  /** A row this attempt read changed while it ran; the attempt reruns. */
@@ -18,11 +18,7 @@ const assertOutsideTransaction = () => {
18
18
  };
19
19
  const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
20
20
  const { attempts = 8, baseDelayMs = 5, maxDelayMs = 250, onRetry } = retry;
21
- const modelOf = (name, kind = "table") => {
22
- const model = schema.models.get(name);
23
- if (model?.definition.kind !== kind) throw new require_engineReads.DatabaseQueryError(`Unknown ${kind} ${name}.`);
24
- return model;
25
- };
21
+ const { modelOf } = reads;
26
22
  /**
27
23
  * A key-value index copy has no `_v`. A transaction guards what it reads,
28
24
  * so it reads such a row whole, and reruns if it changed since the copy.
@@ -1,6 +1,6 @@
1
1
  import { DatabaseAmbiguousCommitError, DatabaseConflictError, DatabaseConstraintError, DatabaseTransactionError } from "./errors.mjs";
2
- import { DatabaseQueryError } from "./engineReads.mjs";
3
2
  import { NegativeGaugeError, compileAggregates, recordAggregate } from "./engineAggregates.mjs";
3
+ import { DatabaseQueryError } from "./engineReads.mjs";
4
4
  import { DATABASE_VERSION_COLUMN, canonicalJson, compareTuples, indexEntries, rowKey } from "@hot-updater/plugin-core/internal";
5
5
  //#region src/database/engineTransaction.ts
6
6
  /** A row this attempt read changed while it ran; the attempt reruns. */
@@ -18,11 +18,7 @@ const assertOutsideTransaction = () => {
18
18
  };
19
19
  const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
20
20
  const { attempts = 8, baseDelayMs = 5, maxDelayMs = 250, onRetry } = retry;
21
- const modelOf = (name, kind = "table") => {
22
- const model = schema.models.get(name);
23
- if (model?.definition.kind !== kind) throw new DatabaseQueryError(`Unknown ${kind} ${name}.`);
24
- return model;
25
- };
21
+ const { modelOf } = reads;
26
22
  /**
27
23
  * A key-value index copy has no `_v`. A transaction guards what it reads,
28
24
  * so it reads such a row whole, and reruns if it changed since the copy.
@@ -109,7 +109,8 @@ const withSchemaFence = (adapter, adapterName, expected) => {
109
109
  [FENCED]: adapterName,
110
110
  get: (table, keys) => fence().then(() => adapter.get(table, keys)),
111
111
  query: (table, request) => fence().then(() => adapter.query(table, request)),
112
- write: (ops) => fence().then(() => adapter.write(ops))
112
+ write: (ops) => fence().then(() => adapter.write(ops)),
113
+ ...adapter.prune && { prune: (table, before, limit) => fence().then(() => adapter.prune(table, before, limit)) }
113
114
  };
114
115
  };
115
116
  //#endregion
@@ -109,7 +109,8 @@ const withSchemaFence = (adapter, adapterName, expected) => {
109
109
  [FENCED]: adapterName,
110
110
  get: (table, keys) => fence().then(() => adapter.get(table, keys)),
111
111
  query: (table, request) => fence().then(() => adapter.query(table, request)),
112
- write: (ops) => fence().then(() => adapter.write(ops))
112
+ write: (ops) => fence().then(() => adapter.write(ops)),
113
+ ...adapter.prune && { prune: (table, before, limit) => fence().then(() => adapter.prune(table, before, limit)) }
113
114
  };
114
115
  };
115
116
  //#endregion
@@ -1,15 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_errors = require("./errors.cjs");
3
2
  const require_cursor = require("./cursor.cjs");
3
+ const require_errors = require("./errors.cjs");
4
+ const require_schema = require("./schema.cjs");
5
+ const require_aggregateBatching = require("./aggregateBatching.cjs");
4
6
  const require_resolveSchema = require("./resolveSchema.cjs");
5
7
  const require_engineReads = require("./engineReads.cjs");
6
8
  const require_engine = require("./engine.cjs");
7
9
  const require_database = require("./database.cjs");
8
- const require_schema = require("./schema.cjs");
9
10
  const require_fence = require("./fence.cjs");
10
11
  const require_schemaSettings = require("../db/schemaSettings.cjs");
11
12
  const require_sqlSchema = require("./sql/sqlSchema.cjs");
12
- const require_builtInDatabase = require("../db/builtInDatabase.cjs");
13
+ const require_coreDatabase = require("../db/coreDatabase.cjs");
13
14
  const require_sqlAdapter = require("./sql/sqlAdapter.cjs");
14
15
  const require_kvAdapter = require("./kv/kvAdapter.cjs");
15
16
  let _hot_updater_plugin_core_internal = require("@hot-updater/plugin-core/internal");
@@ -61,9 +62,7 @@ exports.MAX_SHARDS = require_resolveSchema.MAX_SHARDS;
61
62
  exports.SETTINGS_TABLE = require_fence.SETTINGS_TABLE;
62
63
  exports.SHARD_COLUMN = require_resolveSchema.SHARD_COLUMN;
63
64
  exports.WRITE_GUARD_TABLE = require_sqlAdapter.WRITE_GUARD_TABLE;
64
- exports.builtInSchema = require_builtInDatabase.builtInSchema;
65
- exports.builtInSettings = require_builtInDatabase.builtInSettings;
66
- exports.builtInTarget = require_builtInDatabase.builtInTarget;
65
+ exports.aggregateBatchingModule = require_aggregateBatching.aggregateBatchingModule;
67
66
  exports.checkSchemaFence = require_fence.checkSchemaFence;
68
67
  exports.classifySqlError = require_sqlAdapter.classifySqlError;
69
68
  Object.defineProperty(exports, "compareTuples", {
@@ -78,9 +77,12 @@ Object.defineProperty(exports, "compareUtf8", {
78
77
  return _hot_updater_plugin_core_internal.compareUtf8;
79
78
  }
80
79
  });
80
+ exports.coreSchema = require_coreDatabase.coreSchema;
81
+ exports.coreSettings = require_coreDatabase.coreSettings;
82
+ exports.coreTarget = require_coreDatabase.coreTarget;
81
83
  exports.createDatabaseEngine = require_database.createDatabaseEngine;
82
84
  exports.createEngine = require_engine.createEngine;
83
- exports.createEngineDatabase = require_builtInDatabase.createEngineDatabase;
85
+ exports.createEngineDatabase = require_coreDatabase.createEngineDatabase;
84
86
  exports.createKvAdapter = require_kvAdapter.createKvAdapter;
85
87
  Object.defineProperty(exports, "createMemoryAdapter", {
86
88
  enumerable: true,
@@ -93,6 +95,12 @@ exports.createTableStatements = require_sqlSchema.createTableStatements;
93
95
  exports.defineAggregate = require_schema.defineAggregate;
94
96
  exports.defineTable = require_schema.defineTable;
95
97
  exports.encodeKvKey = require_kvAdapter.encodeKvKey;
98
+ Object.defineProperty(exports, "expiresAt", {
99
+ enumerable: true,
100
+ get: function() {
101
+ return _hot_updater_plugin_core_internal.expiresAt;
102
+ }
103
+ });
96
104
  Object.defineProperty(exports, "indexOrderColumns", {
97
105
  enumerable: true,
98
106
  get: function() {
@@ -101,7 +109,7 @@ Object.defineProperty(exports, "indexOrderColumns", {
101
109
  });
102
110
  exports.isMissingSchemaError = require_fence.isMissingSchemaError;
103
111
  exports.isMultiIndex = require_sqlSchema.isMultiIndex;
104
- exports.migrateBuiltInSchema = require_builtInDatabase.migrateBuiltInSchema;
112
+ exports.migrateCoreSchema = require_coreDatabase.migrateCoreSchema;
105
113
  exports.migrateSchema = require_schemaSettings.migrateSchema;
106
114
  Object.defineProperty(exports, "normalizeStoredRow", {
107
115
  enumerable: true,
@@ -116,6 +124,7 @@ Object.defineProperty(exports, "normalizeStoredValue", {
116
124
  }
117
125
  });
118
126
  exports.resolveSchema = require_resolveSchema.resolveSchema;
127
+ exports.toolingTargetOf = require_coreDatabase.toolingTargetOf;
119
128
  exports.validateSchema = require_resolveSchema.validateSchema;
120
129
  Object.defineProperty(exports, "verifyAdapter", {
121
130
  enumerable: true,
@@ -3,15 +3,16 @@ import { FieldDefinition, FieldReference, FieldType, IndexDefinition, ReferenceA
3
3
  import { MAX_SHARDS, ResolvedModel, ResolvedReference, ResolvedSchema, SHARD_COLUMN, SchemaModule, resolveSchema, validateSchema } from "./resolveSchema.cjs";
4
4
  import { SqlDialect, createTableStatements, isMultiIndex } from "./sql/sqlSchema.cjs";
5
5
  import { SqlAdapterOptions, SqlConnection, SqlExecutor, SqlResult, SqlStatement, WRITE_GUARD_TABLE, classifySqlError, createSqlAdapter } from "./sql/sqlAdapter.cjs";
6
- import { AggregateDefinition, CheckIndex, DerivedDefinition, DerivedFields, FieldValue, ModelDefinition, ModuleSchema, RowOf, TableDefinition, defineAggregate, defineTable } from "./schema.cjs";
6
+ import { AggregateDefinition, CheckIndex, DerivedDefinition, DerivedFields, FieldValue, ModelDefinition, ModuleSchema, RetentionDefinition, RowOf, TableDefinition, defineAggregate, defineTable } from "./schema.cjs";
7
7
  import { DatabaseCursorError } from "./cursor.cjs";
8
8
  import { DatabaseQueryError, EngineReadCount, Page, ReadRange } from "./engineReads.cjs";
9
9
  import { RetryOptions } from "./engineTransaction.cjs";
10
10
  import { DatabaseEngineOptions, Engine, ReadMeasurement, createEngine } from "./engine.cjs";
11
+ import { aggregateBatchingModule } from "./aggregateBatching.cjs";
11
12
  import { AggregateChanges, AggregateIdentity, AggregateRow, CreateRow, DatabaseEngine, EngineColumns, FindAggregatesModel, FindManyModel, HotUpdaterDatabase, HotUpdaterTransaction, KeyLookup, Lookup, ReadOptions, ReadRow, TableRow, UpdateSet, createDatabaseEngine } from "./database.cjs";
12
13
  import { ConstraintReason, DatabaseAmbiguousCommitError, DatabaseConflictError, DatabaseConstraintError, DatabaseTransactionError } from "./errors.cjs";
13
14
  import { KeyValueStore, KvAdapterOptions, KvCondition, KvItem, KvKey, KvOp, KvRange, createKvAdapter, encodeKvKey } from "./kv/kvAdapter.cjs";
14
- import { EngineDatabaseOptions, builtInSchema, builtInSettings, builtInTarget, createEngineDatabase, migrateBuiltInSchema } from "../db/builtInDatabase.cjs";
15
+ import { EngineDatabaseOptions, PluginTables, coreSchema, coreSettings, coreTarget, createEngineDatabase, migrateCoreSchema, toolingTargetOf } from "../db/coreDatabase.cjs";
15
16
  import { migrateSchema, writeSchemaSettings } from "../db/schemaSettings.cjs";
16
- import { DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseAdapterContractError, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseReadCount, DatabaseReadMeter, DatabaseSchemaError, DatabaseValue, DatabaseValueError, MemoryAdapterOptions, NormalizeOptions, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalTable, QueryBound, QueryRequest, StoredRow, VerifiedDatabaseAdapter, VerifyAdapterOptions, WriteGuard, WriteOp, WriteResult, compareTuples, compareUtf8, createMemoryAdapter, indexOrderColumns, normalizeStoredRow, normalizeStoredValue, verifyAdapter } from "@hot-updater/plugin-core/internal";
17
- export { type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type CheckIndex, type ConstraintReason, type CreateRow, DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAmbiguousCommitError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseEngine, type DatabaseEngineOptions, type DatabaseJson, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseSchemaError, DatabaseTransactionError, type DatabaseValue, DatabaseValueError, type DerivedDefinition, type DerivedFields, ENGINE_SCHEMA_KEY, ENGINE_SCHEMA_VERSION, type Engine, type EngineColumns, type EngineDatabaseOptions, type EngineReadCount, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, type HotUpdaterDatabase, type HotUpdaterTransaction, type IndexDefinition, type KeyLookup, type KeyValueStore, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, type Lookup, MAX_SHARDS, type MemoryAdapterOptions, type ModelDefinition, type ModuleSchema, type NormalizeOptions, type Page, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalTable, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRange, type ReadRow, type ReferenceAction, type ResolvedModel, type ResolvedReference, type ResolvedSchema, type RetryOptions, type RowOf, SETTINGS_TABLE, SHARD_COLUMN, type SchemaModule, type SchemaSettings, type SqlAdapterOptions, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type StoredRow, type TableDefinition, type TableRow, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, builtInSchema, builtInSettings, builtInTarget, checkSchemaFence, classifySqlError, compareTuples, compareUtf8, createDatabaseEngine, createEngine, createEngineDatabase, createKvAdapter, createMemoryAdapter, createSqlAdapter, createTableStatements, defineAggregate, defineTable, encodeKvKey, indexOrderColumns, isMissingSchemaError, isMultiIndex, migrateBuiltInSchema, migrateSchema, normalizeStoredRow, normalizeStoredValue, resolveSchema, validateSchema, verifyAdapter, withSchemaFence, writeSchemaSettings };
17
+ import { DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseAdapterContractError, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseReadCount, DatabaseReadMeter, DatabaseSchemaError, DatabaseValue, DatabaseValueError, MemoryAdapterOptions, NormalizeOptions, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, StoredRow, VerifiedDatabaseAdapter, VerifyAdapterOptions, WriteGuard, WriteOp, WriteResult, compareTuples, compareUtf8, createMemoryAdapter, expiresAt, indexOrderColumns, normalizeStoredRow, normalizeStoredValue, verifyAdapter } from "@hot-updater/plugin-core/internal";
18
+ export { type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type CheckIndex, type ConstraintReason, type CreateRow, DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAmbiguousCommitError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseEngine, type DatabaseEngineOptions, type DatabaseJson, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseSchemaError, DatabaseTransactionError, type DatabaseValue, DatabaseValueError, type DerivedDefinition, type DerivedFields, ENGINE_SCHEMA_KEY, ENGINE_SCHEMA_VERSION, type Engine, type EngineColumns, type EngineDatabaseOptions, type EngineReadCount, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, type HotUpdaterDatabase, type HotUpdaterTransaction, type IndexDefinition, type KeyLookup, type KeyValueStore, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, type Lookup, MAX_SHARDS, type MemoryAdapterOptions, type ModelDefinition, type ModuleSchema, type NormalizeOptions, type Page, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type PluginTables, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRange, type ReadRow, type ReferenceAction, type ResolvedModel, type ResolvedReference, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, SHARD_COLUMN, type SchemaModule, type SchemaSettings, type SqlAdapterOptions, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type StoredRow, type TableDefinition, type TableRow, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, aggregateBatchingModule, checkSchemaFence, classifySqlError, compareTuples, compareUtf8, coreSchema, coreSettings, coreTarget, createDatabaseEngine, createEngine, createEngineDatabase, createKvAdapter, createMemoryAdapter, createSqlAdapter, createTableStatements, defineAggregate, defineTable, encodeKvKey, expiresAt, indexOrderColumns, isMissingSchemaError, isMultiIndex, migrateCoreSchema, migrateSchema, normalizeStoredRow, normalizeStoredValue, resolveSchema, toolingTargetOf, validateSchema, verifyAdapter, withSchemaFence, writeSchemaSettings };
@@ -3,15 +3,16 @@ import { FieldDefinition, FieldReference, FieldType, IndexDefinition, ReferenceA
3
3
  import { MAX_SHARDS, ResolvedModel, ResolvedReference, ResolvedSchema, SHARD_COLUMN, SchemaModule, resolveSchema, validateSchema } from "./resolveSchema.mjs";
4
4
  import { SqlDialect, createTableStatements, isMultiIndex } from "./sql/sqlSchema.mjs";
5
5
  import { SqlAdapterOptions, SqlConnection, SqlExecutor, SqlResult, SqlStatement, WRITE_GUARD_TABLE, classifySqlError, createSqlAdapter } from "./sql/sqlAdapter.mjs";
6
- import { AggregateDefinition, CheckIndex, DerivedDefinition, DerivedFields, FieldValue, ModelDefinition, ModuleSchema, RowOf, TableDefinition, defineAggregate, defineTable } from "./schema.mjs";
6
+ import { AggregateDefinition, CheckIndex, DerivedDefinition, DerivedFields, FieldValue, ModelDefinition, ModuleSchema, RetentionDefinition, RowOf, TableDefinition, defineAggregate, defineTable } from "./schema.mjs";
7
7
  import { DatabaseCursorError } from "./cursor.mjs";
8
8
  import { DatabaseQueryError, EngineReadCount, Page, ReadRange } from "./engineReads.mjs";
9
9
  import { RetryOptions } from "./engineTransaction.mjs";
10
10
  import { DatabaseEngineOptions, Engine, ReadMeasurement, createEngine } from "./engine.mjs";
11
+ import { aggregateBatchingModule } from "./aggregateBatching.mjs";
11
12
  import { AggregateChanges, AggregateIdentity, AggregateRow, CreateRow, DatabaseEngine, EngineColumns, FindAggregatesModel, FindManyModel, HotUpdaterDatabase, HotUpdaterTransaction, KeyLookup, Lookup, ReadOptions, ReadRow, TableRow, UpdateSet, createDatabaseEngine } from "./database.mjs";
12
13
  import { ConstraintReason, DatabaseAmbiguousCommitError, DatabaseConflictError, DatabaseConstraintError, DatabaseTransactionError } from "./errors.mjs";
13
14
  import { KeyValueStore, KvAdapterOptions, KvCondition, KvItem, KvKey, KvOp, KvRange, createKvAdapter, encodeKvKey } from "./kv/kvAdapter.mjs";
14
- import { EngineDatabaseOptions, builtInSchema, builtInSettings, builtInTarget, createEngineDatabase, migrateBuiltInSchema } from "../db/builtInDatabase.mjs";
15
+ import { EngineDatabaseOptions, PluginTables, coreSchema, coreSettings, coreTarget, createEngineDatabase, migrateCoreSchema, toolingTargetOf } from "../db/coreDatabase.mjs";
15
16
  import { migrateSchema, writeSchemaSettings } from "../db/schemaSettings.mjs";
16
- import { DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseAdapterContractError, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseReadCount, DatabaseReadMeter, DatabaseSchemaError, DatabaseValue, DatabaseValueError, MemoryAdapterOptions, NormalizeOptions, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalTable, QueryBound, QueryRequest, StoredRow, VerifiedDatabaseAdapter, VerifyAdapterOptions, WriteGuard, WriteOp, WriteResult, compareTuples, compareUtf8, createMemoryAdapter, indexOrderColumns, normalizeStoredRow, normalizeStoredValue, verifyAdapter } from "@hot-updater/plugin-core/internal";
17
- export { type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type CheckIndex, type ConstraintReason, type CreateRow, DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAmbiguousCommitError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseEngine, type DatabaseEngineOptions, type DatabaseJson, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseSchemaError, DatabaseTransactionError, type DatabaseValue, DatabaseValueError, type DerivedDefinition, type DerivedFields, ENGINE_SCHEMA_KEY, ENGINE_SCHEMA_VERSION, type Engine, type EngineColumns, type EngineDatabaseOptions, type EngineReadCount, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, type HotUpdaterDatabase, type HotUpdaterTransaction, type IndexDefinition, type KeyLookup, type KeyValueStore, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, type Lookup, MAX_SHARDS, type MemoryAdapterOptions, type ModelDefinition, type ModuleSchema, type NormalizeOptions, type Page, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalTable, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRange, type ReadRow, type ReferenceAction, type ResolvedModel, type ResolvedReference, type ResolvedSchema, type RetryOptions, type RowOf, SETTINGS_TABLE, SHARD_COLUMN, type SchemaModule, type SchemaSettings, type SqlAdapterOptions, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type StoredRow, type TableDefinition, type TableRow, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, builtInSchema, builtInSettings, builtInTarget, checkSchemaFence, classifySqlError, compareTuples, compareUtf8, createDatabaseEngine, createEngine, createEngineDatabase, createKvAdapter, createMemoryAdapter, createSqlAdapter, createTableStatements, defineAggregate, defineTable, encodeKvKey, indexOrderColumns, isMissingSchemaError, isMultiIndex, migrateBuiltInSchema, migrateSchema, normalizeStoredRow, normalizeStoredValue, resolveSchema, validateSchema, verifyAdapter, withSchemaFence, writeSchemaSettings };
17
+ import { DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseAdapterContractError, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseReadCount, DatabaseReadMeter, DatabaseSchemaError, DatabaseValue, DatabaseValueError, MemoryAdapterOptions, NormalizeOptions, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, StoredRow, VerifiedDatabaseAdapter, VerifyAdapterOptions, WriteGuard, WriteOp, WriteResult, compareTuples, compareUtf8, createMemoryAdapter, expiresAt, indexOrderColumns, normalizeStoredRow, normalizeStoredValue, verifyAdapter } from "@hot-updater/plugin-core/internal";
18
+ export { type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type CheckIndex, type ConstraintReason, type CreateRow, DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAmbiguousCommitError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseEngine, type DatabaseEngineOptions, type DatabaseJson, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseSchemaError, DatabaseTransactionError, type DatabaseValue, DatabaseValueError, type DerivedDefinition, type DerivedFields, ENGINE_SCHEMA_KEY, ENGINE_SCHEMA_VERSION, type Engine, type EngineColumns, type EngineDatabaseOptions, type EngineReadCount, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, type HotUpdaterDatabase, type HotUpdaterTransaction, type IndexDefinition, type KeyLookup, type KeyValueStore, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, type Lookup, MAX_SHARDS, type MemoryAdapterOptions, type ModelDefinition, type ModuleSchema, type NormalizeOptions, type Page, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type PluginTables, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRange, type ReadRow, type ReferenceAction, type ResolvedModel, type ResolvedReference, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, SHARD_COLUMN, type SchemaModule, type SchemaSettings, type SqlAdapterOptions, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type StoredRow, type TableDefinition, type TableRow, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, aggregateBatchingModule, checkSchemaFence, classifySqlError, compareTuples, compareUtf8, coreSchema, coreSettings, coreTarget, createDatabaseEngine, createEngine, createEngineDatabase, createKvAdapter, createMemoryAdapter, createSqlAdapter, createTableStatements, defineAggregate, defineTable, encodeKvKey, expiresAt, indexOrderColumns, isMissingSchemaError, isMultiIndex, migrateCoreSchema, migrateSchema, normalizeStoredRow, normalizeStoredValue, resolveSchema, toolingTargetOf, validateSchema, verifyAdapter, withSchemaFence, writeSchemaSettings };