@mistriwork/engine 0.0.0 → 1.0.0-rc.11

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 (572) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -1
  3. package/dist/adapters/adapter.d.ts +726 -0
  4. package/dist/adapters/adapter.js +444 -0
  5. package/dist/adapters/cache/cacheStore.d.ts +75 -0
  6. package/dist/adapters/cache/cacheStore.js +160 -0
  7. package/dist/adapters/cache/resp.d.ts +52 -0
  8. package/dist/adapters/cache/resp.js +237 -0
  9. package/dist/adapters/commands/canonicalJson.d.ts +19 -0
  10. package/dist/adapters/commands/canonicalJson.js +154 -0
  11. package/dist/adapters/connect.d.ts +29 -0
  12. package/dist/adapters/connect.js +40 -0
  13. package/dist/adapters/connectionBudget.d.ts +101 -0
  14. package/dist/adapters/connectionBudget.js +128 -0
  15. package/dist/adapters/dbLatency.d.ts +35 -0
  16. package/dist/adapters/dbLatency.js +79 -0
  17. package/dist/adapters/epochCache.d.ts +50 -0
  18. package/dist/adapters/epochCache.js +85 -0
  19. package/dist/adapters/http/egress.d.ts +48 -0
  20. package/dist/adapters/http/egress.js +175 -0
  21. package/dist/adapters/http/httpAdapter.d.ts +71 -0
  22. package/dist/adapters/http/httpAdapter.js +512 -0
  23. package/dist/adapters/http/httpDescription.d.ts +32 -0
  24. package/dist/adapters/http/httpDescription.js +246 -0
  25. package/dist/adapters/http/openapi.d.ts +98 -0
  26. package/dist/adapters/http/openapi.js +487 -0
  27. package/dist/adapters/layoutRefusal.d.ts +24 -0
  28. package/dist/adapters/layoutRefusal.js +35 -0
  29. package/dist/adapters/net/networkPolicy.d.ts +44 -0
  30. package/dist/adapters/net/networkPolicy.js +123 -0
  31. package/dist/adapters/net/untrustedDatabase.d.ts +18 -0
  32. package/dist/adapters/net/untrustedDatabase.js +120 -0
  33. package/dist/adapters/poolAdmission.d.ts +43 -0
  34. package/dist/adapters/poolAdmission.js +184 -0
  35. package/dist/adapters/poolMetrics.d.ts +121 -0
  36. package/dist/adapters/poolMetrics.js +185 -0
  37. package/dist/adapters/postgres.d.ts +441 -0
  38. package/dist/adapters/postgres.js +1841 -0
  39. package/dist/adapters/postgresCatalog.d.ts +107 -0
  40. package/dist/adapters/postgresCatalog.js +421 -0
  41. package/dist/adapters/postgresCatalogDigest.d.ts +30 -0
  42. package/dist/adapters/postgresCatalogDigest.js +93 -0
  43. package/dist/adapters/postgresCatalogRows.d.ts +64 -0
  44. package/dist/adapters/postgresCatalogRows.js +37 -0
  45. package/dist/adapters/postgresDates.d.ts +1 -0
  46. package/dist/adapters/postgresDates.js +39 -0
  47. package/dist/adapters/postgresMaintenance.d.ts +33 -0
  48. package/dist/adapters/postgresMaintenance.js +179 -0
  49. package/dist/adapters/postgresPool.d.ts +255 -0
  50. package/dist/adapters/postgresPool.js +838 -0
  51. package/dist/adapters/postgresPooler.d.ts +28 -0
  52. package/dist/adapters/postgresPooler.js +267 -0
  53. package/dist/adapters/postgresReadCatalog.d.ts +31 -0
  54. package/dist/adapters/postgresReadCatalog.js +226 -0
  55. package/dist/adapters/postgresReadSnapshot.d.ts +46 -0
  56. package/dist/adapters/postgresReadSnapshot.js +133 -0
  57. package/dist/adapters/postgresSchemaEpoch.d.ts +24 -0
  58. package/dist/adapters/postgresSchemaEpoch.js +149 -0
  59. package/dist/adapters/postgresTransactionHandle.d.ts +173 -0
  60. package/dist/adapters/postgresTransactionHandle.js +524 -0
  61. package/dist/adapters/postgresValues.d.ts +30 -0
  62. package/dist/adapters/postgresValues.js +75 -0
  63. package/dist/adapters/postgresWriteAhead.d.ts +47 -0
  64. package/dist/adapters/postgresWriteAhead.js +209 -0
  65. package/dist/adapters/replicas.d.ts +70 -0
  66. package/dist/adapters/replicas.js +208 -0
  67. package/dist/adapters/reservedSql.d.ts +38 -0
  68. package/dist/adapters/reservedSql.js +264 -0
  69. package/dist/adapters/rolePrivileges.d.ts +17 -0
  70. package/dist/adapters/rolePrivileges.js +22 -0
  71. package/dist/adapters/scoped/keyRows.d.ts +65 -0
  72. package/dist/adapters/scoped/keyRows.js +179 -0
  73. package/dist/adapters/scoped/keyTypes.d.ts +34 -0
  74. package/dist/adapters/scoped/keyTypes.js +66 -0
  75. package/dist/adapters/scoped/postgresScopeCatalog.d.ts +34 -0
  76. package/dist/adapters/scoped/postgresScopeCatalog.js +457 -0
  77. package/dist/adapters/scoped/postgresTriggers.d.ts +137 -0
  78. package/dist/adapters/scoped/postgresTriggers.js +1545 -0
  79. package/dist/adapters/scoped/scopeTriggers.d.ts +122 -0
  80. package/dist/adapters/scoped/scopeTriggers.js +131 -0
  81. package/dist/adapters/scoped/scopedCommandOperations.d.ts +5 -0
  82. package/dist/adapters/scoped/scopedCommandOperations.js +48 -0
  83. package/dist/adapters/scoped/scopedReads.d.ts +22 -0
  84. package/dist/adapters/scoped/scopedReads.js +192 -0
  85. package/dist/adapters/scoped/scopedTransaction.d.ts +159 -0
  86. package/dist/adapters/scoped/scopedTransaction.js +547 -0
  87. package/dist/adapters/scoped/sqliteScopeCatalog.d.ts +32 -0
  88. package/dist/adapters/scoped/sqliteScopeCatalog.js +420 -0
  89. package/dist/adapters/scoped/sqliteTriggerSession.d.ts +64 -0
  90. package/dist/adapters/scoped/sqliteTriggerSession.js +245 -0
  91. package/dist/adapters/scoped/sqliteTriggers.d.ts +20 -0
  92. package/dist/adapters/scoped/sqliteTriggers.js +822 -0
  93. package/dist/adapters/scoped/storedText.d.ts +45 -0
  94. package/dist/adapters/scoped/storedText.js +61 -0
  95. package/dist/adapters/scoped/triggerEffects.d.ts +98 -0
  96. package/dist/adapters/scoped/triggerEffects.js +189 -0
  97. package/dist/adapters/scoped/triggerProof.d.ts +124 -0
  98. package/dist/adapters/scoped/triggerProof.js +366 -0
  99. package/dist/adapters/scoped/updateGuard.d.ts +3 -0
  100. package/dist/adapters/scoped/updateGuard.js +40 -0
  101. package/dist/adapters/serverSettings.d.ts +45 -0
  102. package/dist/adapters/serverSettings.js +46 -0
  103. package/dist/adapters/snapshotRead.d.ts +8 -0
  104. package/dist/adapters/snapshotRead.js +37 -0
  105. package/dist/adapters/sqlite.d.ts +273 -0
  106. package/dist/adapters/sqlite.js +1557 -0
  107. package/dist/adapters/sqliteCostlyReads.d.ts +33 -0
  108. package/dist/adapters/sqliteCostlyReads.js +49 -0
  109. package/dist/adapters/sqliteDecimals.d.ts +22 -0
  110. package/dist/adapters/sqliteDecimals.js +51 -0
  111. package/dist/adapters/sqliteHandles.d.ts +43 -0
  112. package/dist/adapters/sqliteHandles.js +143 -0
  113. package/dist/adapters/sqliteStatementProcess.d.ts +29 -0
  114. package/dist/adapters/sqliteStatementProcess.js +131 -0
  115. package/dist/adapters/statementControl.d.ts +34 -0
  116. package/dist/adapters/statementControl.js +90 -0
  117. package/dist/adapters/storeHost.d.ts +133 -0
  118. package/dist/adapters/storeHost.js +13 -0
  119. package/dist/adapters/telemetry/drivers.d.ts +21 -0
  120. package/dist/adapters/telemetry/drivers.js +321 -0
  121. package/dist/adapters/telemetry/metrics.d.ts +63 -0
  122. package/dist/adapters/telemetry/metrics.js +122 -0
  123. package/dist/adapters/telemetry/otlp.d.ts +12 -0
  124. package/dist/adapters/telemetry/otlp.js +320 -0
  125. package/dist/adapters/telemetry/otlpEncode.d.ts +48 -0
  126. package/dist/adapters/telemetry/otlpEncode.js +366 -0
  127. package/dist/adapters/telemetry/otlpEnv.d.ts +1 -0
  128. package/dist/adapters/telemetry/otlpEnv.js +12 -0
  129. package/dist/adapters/telemetry/serverTiming.d.ts +83 -0
  130. package/dist/adapters/telemetry/serverTiming.js +503 -0
  131. package/dist/adapters/telemetry/start.d.ts +10 -0
  132. package/dist/adapters/telemetry/start.js +25 -0
  133. package/dist/adapters/telemetry/statement.d.ts +16 -0
  134. package/dist/adapters/telemetry/statement.js +134 -0
  135. package/dist/adapters/telemetry/trace.d.ts +127 -0
  136. package/dist/adapters/telemetry/trace.js +295 -0
  137. package/dist/adapters/writeAhead.d.ts +27 -0
  138. package/dist/adapters/writeAhead.js +46 -0
  139. package/dist/adapters/writeAttribution.d.ts +18 -0
  140. package/dist/adapters/writeAttribution.js +23 -0
  141. package/dist/adapters/writeCapture.d.ts +80 -0
  142. package/dist/adapters/writeCapture.js +20 -0
  143. package/dist/adapters/writeLanes.d.ts +94 -0
  144. package/dist/adapters/writeLanes.js +232 -0
  145. package/dist/engine.d.ts +15 -0
  146. package/dist/engine.js +13 -0
  147. package/dist/server/auth/credentials.d.ts +61 -0
  148. package/dist/server/auth/credentials.js +260 -0
  149. package/dist/server/cacheService.d.ts +50 -0
  150. package/dist/server/cacheService.js +110 -0
  151. package/dist/server/cli/args.d.ts +182 -0
  152. package/dist/server/cli/args.js +348 -0
  153. package/dist/server/cli/bin.d.ts +5 -0
  154. package/dist/server/cli/bin.js +66 -0
  155. package/dist/server/cli/browser.d.ts +15 -0
  156. package/dist/server/cli/browser.js +37 -0
  157. package/dist/server/cli/config.d.ts +50 -0
  158. package/dist/server/cli/config.js +206 -0
  159. package/dist/server/cli/startup.d.ts +36 -0
  160. package/dist/server/cli/startup.js +128 -0
  161. package/dist/server/cli/startupOptions.d.ts +63 -0
  162. package/dist/server/cli/startupOptions.js +143 -0
  163. package/dist/server/cli/subcommand.d.ts +28 -0
  164. package/dist/server/cli/subcommand.js +32 -0
  165. package/dist/server/cli/usage.d.ts +13 -0
  166. package/dist/server/cli/usage.js +31 -0
  167. package/dist/server/clientHttp.d.ts +184 -0
  168. package/dist/server/clientHttp.js +700 -0
  169. package/dist/server/clientSurface.d.ts +128 -0
  170. package/dist/server/clientSurface.js +182 -0
  171. package/dist/server/columnGrants.d.ts +106 -0
  172. package/dist/server/columnGrants.js +741 -0
  173. package/dist/server/compileCache.d.ts +1 -0
  174. package/dist/server/compileCache.js +30 -0
  175. package/dist/server/config/locations.d.ts +1 -0
  176. package/dist/server/config/locations.js +15 -0
  177. package/dist/server/config/profile.d.ts +123 -0
  178. package/dist/server/config/profile.js +236 -0
  179. package/dist/server/configPaths.d.ts +7 -0
  180. package/dist/server/configPaths.js +34 -0
  181. package/dist/server/configSections.d.ts +64 -0
  182. package/dist/server/configSections.js +72 -0
  183. package/dist/server/connectionRedaction.d.ts +30 -0
  184. package/dist/server/connectionRedaction.js +77 -0
  185. package/dist/server/connections.d.ts +358 -0
  186. package/dist/server/connections.js +988 -0
  187. package/dist/server/constraints.d.ts +82 -0
  188. package/dist/server/constraints.js +169 -0
  189. package/dist/server/demo.d.ts +9 -0
  190. package/dist/server/demo.js +554 -0
  191. package/dist/server/devclient.d.ts +108 -0
  192. package/dist/server/devclient.js +361 -0
  193. package/dist/server/evidence.d.ts +55 -0
  194. package/dist/server/evidence.js +323 -0
  195. package/dist/server/hiddenColumns.d.ts +32 -0
  196. package/dist/server/hiddenColumns.js +244 -0
  197. package/dist/server/http/baselineHeaders.d.ts +24 -0
  198. package/dist/server/http/baselineHeaders.js +12 -0
  199. package/dist/server/http/captured.d.ts +35 -0
  200. package/dist/server/http/captured.js +73 -0
  201. package/dist/server/http/clock.d.ts +1 -0
  202. package/dist/server/http/clock.js +14 -0
  203. package/dist/server/http/connectionSource.d.ts +4 -0
  204. package/dist/server/http/connectionSource.js +48 -0
  205. package/dist/server/http/context.d.ts +189 -0
  206. package/dist/server/http/context.js +11 -0
  207. package/dist/server/http/crawlerText.d.ts +15 -0
  208. package/dist/server/http/crawlerText.js +32 -0
  209. package/dist/server/http/dataRoutes.d.ts +88 -0
  210. package/dist/server/http/dataRoutes.js +137 -0
  211. package/dist/server/http/door.d.ts +57 -0
  212. package/dist/server/http/door.js +39 -0
  213. package/dist/server/http/exportRoute.d.ts +15 -0
  214. package/dist/server/http/exportRoute.js +320 -0
  215. package/dist/server/http/firstPaint.d.ts +108 -0
  216. package/dist/server/http/firstPaint.js +262 -0
  217. package/dist/server/http/httpOperationRoutes.d.ts +11 -0
  218. package/dist/server/http/httpOperationRoutes.js +50 -0
  219. package/dist/server/http/pageReads.d.ts +20 -0
  220. package/dist/server/http/pageReads.js +205 -0
  221. package/dist/server/http/pageRoutes.d.ts +39 -0
  222. package/dist/server/http/pageRoutes.js +291 -0
  223. package/dist/server/http/probes.d.ts +22 -0
  224. package/dist/server/http/probes.js +27 -0
  225. package/dist/server/http/rateLimit.d.ts +131 -0
  226. package/dist/server/http/rateLimit.js +351 -0
  227. package/dist/server/http/readRoutes.d.ts +9 -0
  228. package/dist/server/http/readRoutes.js +131 -0
  229. package/dist/server/http/readRouting.d.ts +20 -0
  230. package/dist/server/http/readRouting.js +80 -0
  231. package/dist/server/http/recordCompose.d.ts +67 -0
  232. package/dist/server/http/recordCompose.js +167 -0
  233. package/dist/server/http/recordWrites.d.ts +89 -0
  234. package/dist/server/http/recordWrites.js +298 -0
  235. package/dist/server/http/refusalReport.d.ts +38 -0
  236. package/dist/server/http/refusalReport.js +75 -0
  237. package/dist/server/http/reply.d.ts +130 -0
  238. package/dist/server/http/reply.js +394 -0
  239. package/dist/server/http/requestOrigin.d.ts +11 -0
  240. package/dist/server/http/requestOrigin.js +8 -0
  241. package/dist/server/http/router.d.ts +45 -0
  242. package/dist/server/http/router.js +22 -0
  243. package/dist/server/http/serverCore.d.ts +68 -0
  244. package/dist/server/http/serverCore.js +177 -0
  245. package/dist/server/http/traceRequest.d.ts +30 -0
  246. package/dist/server/http/traceRequest.js +224 -0
  247. package/dist/server/http/trust.d.ts +261 -0
  248. package/dist/server/http/trust.js +472 -0
  249. package/dist/server/http/writeRefusal.d.ts +33 -0
  250. package/dist/server/http/writeRefusal.js +24 -0
  251. package/dist/server/httpConnection.d.ts +49 -0
  252. package/dist/server/httpConnection.js +170 -0
  253. package/dist/server/impact.d.ts +55 -0
  254. package/dist/server/impact.js +47 -0
  255. package/dist/server/journal.d.ts +134 -0
  256. package/dist/server/journal.js +398 -0
  257. package/dist/server/keysetReadHttp.d.ts +52 -0
  258. package/dist/server/keysetReadHttp.js +85 -0
  259. package/dist/server/layouts.d.ts +49 -0
  260. package/dist/server/layouts.js +192 -0
  261. package/dist/server/migrate/cli.d.ts +102 -0
  262. package/dist/server/migrate/cli.js +702 -0
  263. package/dist/server/migrate/database.d.ts +37 -0
  264. package/dist/server/migrate/database.js +247 -0
  265. package/dist/server/migrate/desired.d.ts +76 -0
  266. package/dist/server/migrate/desired.js +292 -0
  267. package/dist/server/migrate/files.d.ts +34 -0
  268. package/dist/server/migrate/files.js +141 -0
  269. package/dist/server/migrate/flyway.d.ts +7 -0
  270. package/dist/server/migrate/flyway.js +69 -0
  271. package/dist/server/migrate/history.d.ts +70 -0
  272. package/dist/server/migrate/history.js +211 -0
  273. package/dist/server/migrate/runner.d.ts +100 -0
  274. package/dist/server/migrate/runner.js +413 -0
  275. package/dist/server/migrate/snapshot.d.ts +30 -0
  276. package/dist/server/migrate/snapshot.js +239 -0
  277. package/dist/server/migrate/target.d.ts +33 -0
  278. package/dist/server/migrate/target.js +82 -0
  279. package/dist/server/openapiDraft.d.ts +25 -0
  280. package/dist/server/openapiDraft.js +171 -0
  281. package/dist/server/operations/diagnostics.d.ts +101 -0
  282. package/dist/server/operations/diagnostics.js +284 -0
  283. package/dist/server/operations/requestMetrics.d.ts +33 -0
  284. package/dist/server/operations/requestMetrics.js +94 -0
  285. package/dist/server/packageVersion.d.ts +1 -0
  286. package/dist/server/packageVersion.js +11 -0
  287. package/dist/server/poolConfig.d.ts +34 -0
  288. package/dist/server/poolConfig.js +114 -0
  289. package/dist/server/product.d.ts +20 -0
  290. package/dist/server/product.js +12 -0
  291. package/dist/server/recordHistoryOperations.d.ts +39 -0
  292. package/dist/server/recordHistoryOperations.js +43 -0
  293. package/dist/server/recordWriteOperations.d.ts +111 -0
  294. package/dist/server/recordWriteOperations.js +329 -0
  295. package/dist/server/resourceReadHttp.d.ts +81 -0
  296. package/dist/server/resourceReadHttp.js +606 -0
  297. package/dist/server/resourceReadOperations.d.ts +147 -0
  298. package/dist/server/resourceReadOperations.js +452 -0
  299. package/dist/server/scaffoldMachine.d.ts +54 -0
  300. package/dist/server/scaffoldMachine.js +184 -0
  301. package/dist/server/seed/cli.d.ts +20 -0
  302. package/dist/server/seed/cli.js +164 -0
  303. package/dist/server/seed/lexicon.d.ts +26 -0
  304. package/dist/server/seed/lexicon.js +585 -0
  305. package/dist/server/seed/seed.d.ts +70 -0
  306. package/dist/server/seed/seed.js +779 -0
  307. package/dist/server/seed/words.d.ts +21 -0
  308. package/dist/server/seed/words.js +164 -0
  309. package/dist/server/serverRequests.d.ts +6 -0
  310. package/dist/server/serverRequests.js +33 -0
  311. package/dist/server/serverTimeouts.d.ts +33 -0
  312. package/dist/server/serverTimeouts.js +32 -0
  313. package/dist/server/shapeonly.d.ts +32 -0
  314. package/dist/server/shapeonly.js +115 -0
  315. package/dist/server/startupWarnings.d.ts +32 -0
  316. package/dist/server/startupWarnings.js +92 -0
  317. package/dist/shared/addressParams.d.ts +28 -0
  318. package/dist/shared/addressParams.js +47 -0
  319. package/dist/shared/aggregate.d.ts +49 -0
  320. package/dist/shared/aggregate.js +107 -0
  321. package/dist/shared/appCards.d.ts +123 -0
  322. package/dist/shared/appCards.js +385 -0
  323. package/dist/shared/appComponents.d.ts +177 -0
  324. package/dist/shared/appComponents.js +422 -0
  325. package/dist/shared/appDocuments.d.ts +43 -0
  326. package/dist/shared/appDocuments.js +131 -0
  327. package/dist/shared/appEmbeds.d.ts +21 -0
  328. package/dist/shared/appEmbeds.js +24 -0
  329. package/dist/shared/appIcons.d.ts +28 -0
  330. package/dist/shared/appIcons.js +223 -0
  331. package/dist/shared/appLinks.d.ts +17 -0
  332. package/dist/shared/appLinks.js +124 -0
  333. package/dist/shared/appListColumns.d.ts +3 -0
  334. package/dist/shared/appListColumns.js +66 -0
  335. package/dist/shared/appLocale.d.ts +36 -0
  336. package/dist/shared/appLocale.js +86 -0
  337. package/dist/shared/appMessages.d.ts +44 -0
  338. package/dist/shared/appMessages.js +78 -0
  339. package/dist/shared/appNoun.d.ts +21 -0
  340. package/dist/shared/appNoun.js +32 -0
  341. package/dist/shared/autoBucket.d.ts +98 -0
  342. package/dist/shared/autoBucket.js +305 -0
  343. package/dist/shared/autoValues.d.ts +25 -0
  344. package/dist/shared/autoValues.js +25 -0
  345. package/dist/shared/breakdown.d.ts +228 -0
  346. package/dist/shared/breakdown.js +570 -0
  347. package/dist/shared/breakdowntext.d.ts +41 -0
  348. package/dist/shared/breakdowntext.js +400 -0
  349. package/dist/shared/builtInThemes.d.ts +2 -0
  350. package/dist/shared/builtInThemes.js +771 -0
  351. package/dist/shared/chartSeparation.d.ts +11 -0
  352. package/dist/shared/chartSeparation.js +58 -0
  353. package/dist/shared/clauses.d.ts +22 -0
  354. package/dist/shared/clauses.js +97 -0
  355. package/dist/shared/columnCaption.d.ts +16 -0
  356. package/dist/shared/columnCaption.js +90 -0
  357. package/dist/shared/commandFieldPath.d.ts +2 -0
  358. package/dist/shared/commandFieldPath.js +7 -0
  359. package/dist/shared/commandWire.d.ts +26 -0
  360. package/dist/shared/commandWire.js +41 -0
  361. package/dist/shared/computed.d.ts +161 -0
  362. package/dist/shared/computed.js +378 -0
  363. package/dist/shared/computedParse.d.ts +13 -0
  364. package/dist/shared/computedParse.js +278 -0
  365. package/dist/shared/computedValue.d.ts +47 -0
  366. package/dist/shared/computedValue.js +191 -0
  367. package/dist/shared/connection.d.ts +30 -0
  368. package/dist/shared/connection.js +1 -0
  369. package/dist/shared/csv.d.ts +20 -0
  370. package/dist/shared/csv.js +63 -0
  371. package/dist/shared/dashLayout.d.ts +30 -0
  372. package/dist/shared/dashLayout.js +132 -0
  373. package/dist/shared/dashboardAsks.d.ts +93 -0
  374. package/dist/shared/dashboardAsks.js +129 -0
  375. package/dist/shared/dashboardTrend.d.ts +20 -0
  376. package/dist/shared/dashboardTrend.js +50 -0
  377. package/dist/shared/decimals.d.ts +37 -0
  378. package/dist/shared/decimals.js +148 -0
  379. package/dist/shared/declaredReferences.d.ts +50 -0
  380. package/dist/shared/declaredReferences.js +202 -0
  381. package/dist/shared/definedFields.d.ts +63 -0
  382. package/dist/shared/definedFields.js +103 -0
  383. package/dist/shared/definedValues.d.ts +63 -0
  384. package/dist/shared/definedValues.js +184 -0
  385. package/dist/shared/displayDefaults.d.ts +135 -0
  386. package/dist/shared/displayDefaults.js +543 -0
  387. package/dist/shared/dueDate.d.ts +6 -0
  388. package/dist/shared/dueDate.js +6 -0
  389. package/dist/shared/duration.d.ts +4 -0
  390. package/dist/shared/duration.js +23 -0
  391. package/dist/shared/fileBounds.d.ts +9 -0
  392. package/dist/shared/fileBounds.js +9 -0
  393. package/dist/shared/filter.d.ts +238 -0
  394. package/dist/shared/filter.js +332 -0
  395. package/dist/shared/firstPaint.d.ts +24 -0
  396. package/dist/shared/firstPaint.js +33 -0
  397. package/dist/shared/form.d.ts +21 -0
  398. package/dist/shared/form.js +25 -0
  399. package/dist/shared/formValues.d.ts +104 -0
  400. package/dist/shared/formValues.js +352 -0
  401. package/dist/shared/funnel.d.ts +45 -0
  402. package/dist/shared/funnel.js +108 -0
  403. package/dist/shared/httpOperations.d.ts +48 -0
  404. package/dist/shared/httpOperations.js +9 -0
  405. package/dist/shared/iconGlyphs.d.ts +4 -0
  406. package/dist/shared/iconGlyphs.js +151 -0
  407. package/dist/shared/iconWeights.d.ts +3 -0
  408. package/dist/shared/iconWeights.js +162 -0
  409. package/dist/shared/imageWidths.d.ts +32 -0
  410. package/dist/shared/imageWidths.js +38 -0
  411. package/dist/shared/keysetPage.d.ts +64 -0
  412. package/dist/shared/keysetPage.js +161 -0
  413. package/dist/shared/like.d.ts +20 -0
  414. package/dist/shared/like.js +29 -0
  415. package/dist/shared/listEmpty.d.ts +12 -0
  416. package/dist/shared/listEmpty.js +36 -0
  417. package/dist/shared/listFilters.d.ts +28 -0
  418. package/dist/shared/listFilters.js +84 -0
  419. package/dist/shared/listPresentations.d.ts +199 -0
  420. package/dist/shared/listPresentations.js +7 -0
  421. package/dist/shared/listQuestion.d.ts +52 -0
  422. package/dist/shared/listQuestion.js +137 -0
  423. package/dist/shared/lookPalettes.d.ts +62 -0
  424. package/dist/shared/lookPalettes.js +306 -0
  425. package/dist/shared/maskQuoted.d.ts +24 -0
  426. package/dist/shared/maskQuoted.js +48 -0
  427. package/dist/shared/mentionLabel.d.ts +19 -0
  428. package/dist/shared/mentionLabel.js +38 -0
  429. package/dist/shared/mentionLookup.d.ts +17 -0
  430. package/dist/shared/mentionLookup.js +64 -0
  431. package/dist/shared/menuCounts.d.ts +16 -0
  432. package/dist/shared/menuCounts.js +74 -0
  433. package/dist/shared/model.d.ts +79 -0
  434. package/dist/shared/model.js +153 -0
  435. package/dist/shared/money.d.ts +53 -0
  436. package/dist/shared/money.js +98 -0
  437. package/dist/shared/moneyEntry.d.ts +7 -0
  438. package/dist/shared/moneyEntry.js +27 -0
  439. package/dist/shared/mount.d.ts +118 -0
  440. package/dist/shared/mount.js +248 -0
  441. package/dist/shared/niceTicks.d.ts +26 -0
  442. package/dist/shared/niceTicks.js +50 -0
  443. package/dist/shared/order.d.ts +59 -0
  444. package/dist/shared/order.js +133 -0
  445. package/dist/shared/page.d.ts +135 -0
  446. package/dist/shared/page.js +1187 -0
  447. package/dist/shared/pageAnatomy.d.ts +99 -0
  448. package/dist/shared/pageAnatomy.js +370 -0
  449. package/dist/shared/pageConfig.d.ts +25 -0
  450. package/dist/shared/pageConfig.js +1308 -0
  451. package/dist/shared/pageEmptyActions.d.ts +12 -0
  452. package/dist/shared/pageEmptyActions.js +20 -0
  453. package/dist/shared/pageLayouts.d.ts +72 -0
  454. package/dist/shared/pageLayouts.js +205 -0
  455. package/dist/shared/pageModel.d.ts +785 -0
  456. package/dist/shared/pageModel.js +121 -0
  457. package/dist/shared/pagePaths.d.ts +180 -0
  458. package/dist/shared/pagePaths.js +869 -0
  459. package/dist/shared/pagePlans.d.ts +52 -0
  460. package/dist/shared/pagePlans.js +108 -0
  461. package/dist/shared/pageRoutes.d.ts +9 -0
  462. package/dist/shared/pageRoutes.js +9 -0
  463. package/dist/shared/query.d.ts +166 -0
  464. package/dist/shared/query.js +1302 -0
  465. package/dist/shared/queryDates.d.ts +12 -0
  466. package/dist/shared/queryDates.js +101 -0
  467. package/dist/shared/queryOperands.d.ts +99 -0
  468. package/dist/shared/queryOperands.js +131 -0
  469. package/dist/shared/reads.d.ts +103 -0
  470. package/dist/shared/reads.js +154 -0
  471. package/dist/shared/recordLabel.d.ts +51 -0
  472. package/dist/shared/recordLabel.js +123 -0
  473. package/dist/shared/recordReadKeys.d.ts +30 -0
  474. package/dist/shared/recordReadKeys.js +51 -0
  475. package/dist/shared/recordReads.d.ts +268 -0
  476. package/dist/shared/recordReads.js +368 -0
  477. package/dist/shared/recordview.d.ts +198 -0
  478. package/dist/shared/recordview.js +356 -0
  479. package/dist/shared/referenceModel.d.ts +58 -0
  480. package/dist/shared/referenceModel.js +194 -0
  481. package/dist/shared/refusal.d.ts +80 -0
  482. package/dist/shared/refusal.js +184 -0
  483. package/dist/shared/relatedCreate.d.ts +30 -0
  484. package/dist/shared/relatedCreate.js +162 -0
  485. package/dist/shared/resourceHttp.d.ts +464 -0
  486. package/dist/shared/resourceHttp.js +1 -0
  487. package/dist/shared/richText.d.ts +85 -0
  488. package/dist/shared/richText.js +305 -0
  489. package/dist/shared/rollups.d.ts +143 -0
  490. package/dist/shared/rollups.js +64 -0
  491. package/dist/shared/rowScope.d.ts +72 -0
  492. package/dist/shared/rowScope.js +376 -0
  493. package/dist/shared/runtimeTables.d.ts +44 -0
  494. package/dist/shared/runtimeTables.js +79 -0
  495. package/dist/shared/schema.d.ts +529 -0
  496. package/dist/shared/schema.js +627 -0
  497. package/dist/shared/schematext.d.ts +38 -0
  498. package/dist/shared/schematext.js +101 -0
  499. package/dist/shared/scopeCatalog.d.ts +29 -0
  500. package/dist/shared/scopeCatalog.js +472 -0
  501. package/dist/shared/servedApp.d.ts +686 -0
  502. package/dist/shared/servedApp.js +45 -0
  503. package/dist/shared/sessionLease.d.ts +34 -0
  504. package/dist/shared/sessionLease.js +3 -0
  505. package/dist/shared/shape.d.ts +55 -0
  506. package/dist/shared/shape.js +168 -0
  507. package/dist/shared/slug.d.ts +1 -0
  508. package/dist/shared/slug.js +12 -0
  509. package/dist/shared/sortText.d.ts +14 -0
  510. package/dist/shared/sortText.js +26 -0
  511. package/dist/shared/sqlRelation.d.ts +4 -0
  512. package/dist/shared/sqlRelation.js +8 -0
  513. package/dist/shared/sqlsaved.d.ts +44 -0
  514. package/dist/shared/sqlsaved.js +63 -0
  515. package/dist/shared/stitchedPaths.d.ts +27 -0
  516. package/dist/shared/stitchedPaths.js +38 -0
  517. package/dist/shared/structuredFilter.d.ts +22 -0
  518. package/dist/shared/structuredFilter.js +1 -0
  519. package/dist/shared/subtitlePath.d.ts +20 -0
  520. package/dist/shared/subtitlePath.js +24 -0
  521. package/dist/shared/suggest.d.ts +18 -0
  522. package/dist/shared/suggest.js +59 -0
  523. package/dist/shared/tableSizing.d.ts +4 -0
  524. package/dist/shared/tableSizing.js +9 -0
  525. package/dist/shared/tagLists.d.ts +57 -0
  526. package/dist/shared/tagLists.js +34 -0
  527. package/dist/shared/textRules.d.ts +54 -0
  528. package/dist/shared/textRules.js +133 -0
  529. package/dist/shared/theme.d.ts +94 -0
  530. package/dist/shared/theme.js +800 -0
  531. package/dist/shared/themeColor.d.ts +34 -0
  532. package/dist/shared/themeColor.js +109 -0
  533. package/dist/shared/themeFaces.d.ts +30 -0
  534. package/dist/shared/themeFaces.js +42 -0
  535. package/dist/shared/themeInk.d.ts +20 -0
  536. package/dist/shared/themeInk.js +52 -0
  537. package/dist/shared/themeLooks.d.ts +9 -0
  538. package/dist/shared/themeLooks.js +572 -0
  539. package/dist/shared/themeParts.d.ts +26 -0
  540. package/dist/shared/themeParts.js +71 -0
  541. package/dist/shared/themePartsCheck.d.ts +21 -0
  542. package/dist/shared/themePartsCheck.js +91 -0
  543. package/dist/shared/themePresets.d.ts +85 -0
  544. package/dist/shared/themePresets.js +139 -0
  545. package/dist/shared/themeRecipeWords.d.ts +156 -0
  546. package/dist/shared/themeRecipeWords.js +156 -0
  547. package/dist/shared/themeRecipes.d.ts +213 -0
  548. package/dist/shared/themeRecipes.js +234 -0
  549. package/dist/shared/themeResolve.d.ts +55 -0
  550. package/dist/shared/themeResolve.js +52 -0
  551. package/dist/shared/themeTokens.d.ts +107 -0
  552. package/dist/shared/themeTokens.js +116 -0
  553. package/dist/shared/themeType.d.ts +38 -0
  554. package/dist/shared/themeType.js +205 -0
  555. package/dist/shared/unitWord.d.ts +4 -0
  556. package/dist/shared/unitWord.js +37 -0
  557. package/dist/shared/view.d.ts +195 -0
  558. package/dist/shared/view.js +987 -0
  559. package/dist/shared/viewLabels.d.ts +47 -0
  560. package/dist/shared/viewLabels.js +459 -0
  561. package/dist/shared/viewPaths.d.ts +248 -0
  562. package/dist/shared/viewPaths.js +294 -0
  563. package/dist/shared/viewtext.d.ts +57 -0
  564. package/dist/shared/viewtext.js +282 -0
  565. package/dist/shared/vocabulary.d.ts +71 -0
  566. package/dist/shared/vocabulary.js +249 -0
  567. package/dist/shared/weekStart.d.ts +7 -0
  568. package/dist/shared/weekStart.js +36 -0
  569. package/mark.svg +1 -0
  570. package/package.json +266 -3
  571. package/schema/model.d.ts +298 -0
  572. package/schema/theme.d.ts +587 -0
@@ -0,0 +1,726 @@
1
+ /**
2
+ * What a database adapter has to provide, and — just as importantly — what it
3
+ * is not allowed to decide.
4
+ *
5
+ * An adapter reads a dialect's catalog and runs parameterised reads. It does
6
+ * not build WHERE clauses from user input, does not decide what a row is
7
+ * called, and never returns SQL for something upstream to concatenate. Every
8
+ * value the user supplies reaches the database as a bound parameter, because
9
+ * a browsing tool that interpolates a filter into SQL is a SQL injection
10
+ * vulnerability with a nice front end.
11
+ */
12
+ import { type DatabaseSchema, type Order, type TableMeta } from '../shared/schema.js';
13
+ import type { CompiledColumn, CompiledJoin, ViewDef } from '../shared/view.js';
14
+ import type { BreakdownDef, CompiledMeasure } from '../shared/breakdown.js';
15
+ import type { AggregateRequest, AggregateResult } from '../shared/aggregate.js';
16
+ import type { RowScope } from '../shared/rowScope.js';
17
+ import type { QueryResult } from '../shared/reads.js';
18
+ import { type Filter, type SqlFragment, type SqlStyle } from '../shared/filter.js';
19
+ import type { PoolRoleStats } from './poolMetrics.js';
20
+ import type { ScopeTrigger } from './scoped/scopeTriggers.js';
21
+ import type { TriggerKeyFacts } from './scoped/triggerEffects.js';
22
+ export { ANSI_STYLE, OPS, POSTGRES_STYLE, buildWhere, type Condition, type Filter, type Op, type SqlFragment, type SqlStyle, } from '../shared/filter.js';
23
+ export type { AggregateMeasure, AggregateRequest, AggregateResult } from '../shared/aggregate.js';
24
+ export { DEFAULT_LIMIT, ESTIMATE_ABOVE, MAX_LIMIT, clampLimit, clampOffset, countStatement, countEachStatement, countEachRows, type CountResult, type QueryResult, } from '../shared/reads.js';
25
+ /** One count of `Adapter.countEach`: a table, and the rows of it to count. */
26
+ export interface CountItem {
27
+ table: string;
28
+ filter?: Filter;
29
+ }
30
+ /**
31
+ * Whether one scan can answer every item (countEachStatement's `together`):
32
+ * they all read one table, and the catalog says that table holds no more
33
+ * rows than the bound — so reading all of it costs no more than one bounded
34
+ * count would. Unbounded, one scan always beats one per item.
35
+ */
36
+ export declare function countsTogether(schema: DatabaseSchema | null, items: readonly CountItem[], limit?: number): boolean;
37
+ export { Refusal } from '../shared/refusal.js';
38
+ /**
39
+ * A read's ORDER BY, or nothing: each column by its value, or by its declared
40
+ * vocabulary where the catalog has one over text (shared/schema.ts
41
+ * `declaredOrder`), its values bound from `startIndex`. Every adapter's plain
42
+ * read and a scoped read say it the same way, so a list sorts alike on all
43
+ * three engines.
44
+ */
45
+ export declare function orderClause(order: readonly Order[] | undefined, table: TableMeta | undefined, style: SqlStyle, startIndex: number, quote?: (column: string) => string): SqlFragment;
46
+ declare const conflictBrand: unique symbol;
47
+ /** A conditional update matched no row and did not apply its proposed values. */
48
+ export declare class WriteConflict extends Error {
49
+ readonly [conflictBrand] = true;
50
+ constructor();
51
+ }
52
+ /** The native class, or a branded twin from another copy of the package. */
53
+ export declare function isWriteConflict(error: unknown): error is WriteConflict;
54
+ /** A transaction acknowledgement could not establish whether writes landed.
55
+ * Never inherit Refusal or driver constraint codes: callers must not turn a
56
+ * failed rollback of a rejected operation into permission to retry it. */
57
+ export declare class TransactionOutcomeUnknown extends Error {
58
+ readonly outcome: 'unknown';
59
+ constructor(cause: unknown);
60
+ }
61
+ export interface QueryRequest {
62
+ table: string;
63
+ filter?: Filter;
64
+ /** Column names to return. Empty means the adapter picks a sensible set. */
65
+ columns?: string[];
66
+ orderBy?: {
67
+ column: string;
68
+ direction: 'asc' | 'desc';
69
+ }[];
70
+ limit: number;
71
+ offset: number;
72
+ /** Binary columns come back as their bytes, not the `<n bytes>` label: a file download's read, never a grid's. */
73
+ binary?: true;
74
+ /**
75
+ * A PostgreSQL scoped read also selects the stored text of the table's reference columns, which a scoped write's
76
+ * parent check binds rather than the driver's reading of them (scoped/storedText.ts). Ignored elsewhere.
77
+ */
78
+ storedText?: true;
79
+ }
80
+ /**
81
+ * What running a view returns.
82
+ *
83
+ * `columns` is the ordered output names, as in `QueryResult`; `resolved`
84
+ * carries what each of them *is* — the table and column it came from, its
85
+ * type, and how many references were followed to reach it. The client needs
86
+ * that to group a hundred fields by their table and to render a date as a
87
+ * date, and re-deriving it in the browser would mean a second path resolver.
88
+ */
89
+ export interface ViewResult extends QueryResult {
90
+ resolved: CompiledColumn[];
91
+ joins: CompiledJoin[];
92
+ }
93
+ /**
94
+ * What a breakdown returns.
95
+ *
96
+ * `groups` rather than `rows` everywhere else in this file would be nicer and
97
+ * is not worth the split: the shape is a result set, the grid renders it, and
98
+ * `columns` still names the output. What is different is `resolved`, which
99
+ * says of each column whether it is a key or a measure — the interface needs
100
+ * that to right-align a count and to know that a key is clickable back into
101
+ * the rows behind it.
102
+ */
103
+ export interface BreakdownResult extends QueryResult {
104
+ resolved: CompiledMeasure[];
105
+ }
106
+ /**
107
+ * A statement the user typed, run as they typed it.
108
+ *
109
+ * This is the one place the tool hands the database text it did not build,
110
+ * which makes every guarantee elsewhere in this file inapplicable: there is no
111
+ * `Filter` to compile, no identifier to check against the catalog, no value to
112
+ * bind. The safety argument has to be made somewhere else entirely.
113
+ *
114
+ * It is made in three places, none of which involve reading the statement:
115
+ *
116
+ * 1. **The connection cannot write.** A read runs inside a transaction opened
117
+ * READ ONLY, which Postgres will not let a statement promote
118
+ * from the inside; SQLite's handle is opened read-only at the file level.
119
+ * A `DELETE` fails with the database's own error, not with our guess about
120
+ * what a `DELETE` looks like.
121
+ * 2. **One statement per call.** Stacking is refused before anything runs, so
122
+ * `SELECT 1; DROP TABLE customer` cannot smuggle a second statement past a
123
+ * check aimed at the first.
124
+ * 3. **The result is bounded.** The statement is wrapped in a subquery with a
125
+ * LIMIT, so a bare `SELECT * FROM huge` returns a page rather than a heap.
126
+ *
127
+ * Writing is possible and is a different request: `write: true`, refused unless
128
+ * the connection is marked writable, and run on the write handle.
129
+ */
130
+ export interface SqlRequest {
131
+ text: string;
132
+ /** Rows to return. Bounded by `clampLimit` like every other read. */
133
+ limit: number;
134
+ /** Run on the write handle. Refused unless the connection allows it. */
135
+ write?: boolean;
136
+ /**
137
+ * A cap below the default for this one statement, in milliseconds, held
138
+ * between a floor and STATEMENT_TIMEOUT_MS (statementControl.ts). Never
139
+ * raises the cap; politeness only lowers.
140
+ *
141
+ * Postgres sets it inside the statement's transaction. SQLite has no statement timeout, so it keeps
142
+ * this one only for a read a caller can stop — one run inside
143
+ * `withCancellation` — which it runs in a process it can kill; a read on
144
+ * the in-process handle cannot be interrupted.
145
+ */
146
+ timeoutMs?: number;
147
+ /**
148
+ * Refuse a statement that touches tablewalk's own runtime or sign-in tables
149
+ * before it runs (reservedSql.ts): the lexical check, then the engine's own
150
+ * account of what the statement reads where it gives one. A statement the
151
+ * check cannot read is refused rather than run.
152
+ */
153
+ refuseReserved?: boolean;
154
+ }
155
+ export interface SqlResult {
156
+ columns: string[];
157
+ /**
158
+ * Rows as arrays, not objects.
159
+ *
160
+ * `SELECT id, id FROM t` returns two columns with one name. An object keyed
161
+ * by column name can only hold one of them, so the second silently replaces
162
+ * the first and the grid shows a column of values from somewhere else. The
163
+ * adapters disagree about this today — SQLite builds rows with `Object.keys`
164
+ * and loses the duplicate outright, Postgres keeps both in the
165
+ * header and one in the row — and positional rows are the only shape that
166
+ * cannot lose data whatever the driver does.
167
+ */
168
+ rows: unknown[][];
169
+ ms: number;
170
+ /** A row beyond the limit existed: there is more than is being shown. */
171
+ truncated: boolean;
172
+ /** The LIMIT wrap applied. False means the database did the whole job. */
173
+ bounded: boolean;
174
+ /** Rows changed, for a write. Absent for a read. */
175
+ affected?: number;
176
+ sql: {
177
+ text: string;
178
+ params: unknown[];
179
+ };
180
+ }
181
+ export interface ExplainRequest {
182
+ text: string;
183
+ /** Bound values for the statement's placeholders, when it has them. */
184
+ params?: unknown[];
185
+ /** As on SqlRequest: refuse a statement that touches tablewalk's own tables. */
186
+ refuseReserved?: boolean;
187
+ }
188
+ export interface ExplainResult {
189
+ /** The plan, one line per node, in the engine's own words. */
190
+ plan: string[];
191
+ ms: number;
192
+ }
193
+ export interface ColumnProfile {
194
+ column: string;
195
+ type: string;
196
+ /** The share of rows where this column is null, 0..1. */
197
+ nullFrac?: number;
198
+ /** Distinct non-null values — estimated where the engine estimates. */
199
+ distinct?: number;
200
+ /** The edges of the range, as the engine reports them. Approximate where
201
+ the numbers come from a sample rather than a scan. */
202
+ min?: unknown;
203
+ max?: unknown;
204
+ /** The values that repeat most, each with its share of rows. Absent when
205
+ nothing repeats — a unique column's most common value is noise. */
206
+ common?: Array<{
207
+ value: unknown;
208
+ frac: number;
209
+ }>;
210
+ }
211
+ export interface ProfileResult {
212
+ table: string;
213
+ /** The table's row count. An estimate where `source` says statistics;
214
+ exact otherwise — a sample still counts the whole table first. */
215
+ rows?: number;
216
+ columns: ColumnProfile[];
217
+ /** What the answer cost to make: `statistics` read numbers the planner
218
+ already keeps (free, sample-based, stale until the next ANALYZE);
219
+ `scan` computed them by reading the table; `sample` read a bounded
220
+ slice of a table too large to scan while a synchronous driver holds
221
+ the process. */
222
+ source: 'statistics' | 'scan' | 'sample';
223
+ /** How many rows the fractions are relative to, when `source` is sample. */
224
+ sampled?: number;
225
+ /**
226
+ * Set when value-bearing fields were withheld — a shape-only connection.
227
+ *
228
+ * Present rather than implied: a profile with no `min` and no `common`
229
+ * looks identical to a profile of a column that has neither, and a reader
230
+ * cannot tell "nothing repeats here" from "you are not allowed to know".
231
+ */
232
+ redacted?: string;
233
+ ms: number;
234
+ }
235
+ /**
236
+ * When a profile stops scanning and starts sampling.
237
+ *
238
+ * Overridable per call so a test can exercise the sampling path against a
239
+ * five-hundred-row fixture instead of manufacturing a million rows.
240
+ */
241
+ export interface ProfileLimits {
242
+ /** Scan whole up to this many rows. */
243
+ scanAtMost?: number;
244
+ /** Aim for roughly this many rows when sampling. */
245
+ sampleSize?: number;
246
+ }
247
+ /**
248
+ * Refuse anything that is more than one statement.
249
+ *
250
+ * Not a SQL parser and not trying to be one — it answers exactly one question,
251
+ * "is there a second statement here", and it answers it by scanning for a
252
+ * semicolon that has something after it. Everything that can contain a
253
+ * semicolon harmlessly is skipped: quoted strings and names, line comments,
254
+ * block comments, and Postgres's dollar-quoted bodies, which is how a function
255
+ * definition carries semicolons without being several statements.
256
+ *
257
+ * Each of those is read the way the dialect's own lexer reads it, because a
258
+ * scanner that ends a string or a comment somewhere other than where the
259
+ * database does can hide a real `;`: Postgres nests block comments, honours
260
+ * backslash escapes in an E'…' string, and reads `x$$` as one identifier
261
+ * rather than an opening dollar-quote. It is not the only line: Postgres runs
262
+ * user text on the extended protocol (postgres.ts runSql), which carries one
263
+ * statement, and SQLite's prepare compiles only the first.
264
+ *
265
+ * Stacking is refused rather than truncated. Running the first half of what
266
+ * someone typed and discarding the rest is worse than refusing both: they
267
+ * asked for two things and would be told about neither.
268
+ *
269
+ * Returns null when the text is a single statement, or the reason it is not.
270
+ */
271
+ export declare function refuseStacked(text: string, dialect?: DatabaseSchema['dialect']): string | null;
272
+ /**
273
+ * Output column names, with collisions given a suffix.
274
+ *
275
+ * `SELECT id, id FROM t` names both columns `id`. Left alone, the grid draws
276
+ * one header twice and nothing says which value belongs to which. The suffix
277
+ * is the same answer `compileView` gives an explicit collision, for the same
278
+ * reason: one column quietly standing in for two is worse than an ugly name.
279
+ */
280
+ export declare function dedupe(names: string[]): string[];
281
+ /** A statement with its trailing semicolon and surrounding space removed. */
282
+ export declare function trimStatement(text: string): string;
283
+ /**
284
+ * Wrap a statement so it cannot return more rows than asked for.
285
+ *
286
+ * `clampLimit` is the invariant everywhere else in this file, and it has no
287
+ * application point in a statement this process did not build — there is no
288
+ * request object to clamp. Wrapping is the equivalent: the database is asked
289
+ * for a bounded result rather than trusted to have been asked politely.
290
+ *
291
+ * One more row than the caller wanted, so "there is more than this" is known
292
+ * without a second query — the same trick `runView` uses.
293
+ *
294
+ * The limit is interpolated rather than bound, which is the one deliberate
295
+ * exception to the rule that nothing is interpolated. It is an integer this
296
+ * process computed from `clampLimit`, never a value that came from outside,
297
+ * and it is asserted to be one before it is used. Binding it would need a
298
+ * dialect-specific placeholder here, which is a lot of machinery to parameterise a number we
299
+ * chose ourselves.
300
+ *
301
+ * Not every statement can be wrapped — `EXPLAIN`, `PRAGMA`, a `WITH` that ends
302
+ * in `INSERT … RETURNING` — so the caller is told whether it applied and can
303
+ * fall back to running the statement bare and saying so.
304
+ */
305
+ export declare function boundStatement(text: string, limit: number): string;
306
+ /**
307
+ * Refuse a statement that `EXPLAIN` would *execute* rather than plan.
308
+ *
309
+ * `EXPLAIN` is offered as the planner's account of a statement without
310
+ * running it. `EXPLAIN ANALYZE …` (Postgres) and the option
311
+ * form `EXPLAIN (ANALYZE) …` run the statement to measure it, so text that
312
+ * begins with `analyze` or `(` turned a plan-only tool into an execute tool.
313
+ * Both sit inside a read-only transaction, so no row could be written — but
314
+ * a `pg_sleep(60)` or a full scan runs all the same, and the contract said
315
+ * it would not. Leading comments are skipped so the check reads the
316
+ * statement, not a note above it.
317
+ */
318
+ export declare function refuseAnalyze(text: string): string | null;
319
+ /**
320
+ * Whether a statement is worth trying to wrap.
321
+ *
322
+ * A conservative first token test, and deliberately not a parse. Getting this
323
+ * wrong in the cautious direction costs a bounded result; getting it wrong in
324
+ * the other direction costs a confusing syntax error from the database about a
325
+ * statement the user did not write. `WITH` is included because a CTE ending in
326
+ * a SELECT is the common case, and the wrap failing on one that does not is
327
+ * handled by the fallback rather than by being clever here.
328
+ */
329
+ export declare function looksWrappable(text: string): boolean;
330
+ export interface DeleteRequest {
331
+ table: string;
332
+ /** The whole primary key, and nothing else. */
333
+ key: Record<string, string | number>;
334
+ }
335
+ export interface DeleteResult {
336
+ affected: number;
337
+ sql: {
338
+ text: string;
339
+ params: unknown[];
340
+ };
341
+ }
342
+ /** Create a new row. Primary-key and other unique conflicts must fail, never
343
+ * silently ignore, update, or replace an existing row through conflict policy.
344
+ * SQLite explicitly uses OR ABORT; PostgreSQL uses plain INSERT. */
345
+ export interface InsertRequest {
346
+ table: string;
347
+ /**
348
+ * Column name to value. The database fills whatever is left out — that is
349
+ * what defaults are for — and refuses what it must, in its own words.
350
+ */
351
+ values: Record<string, string | number | boolean | null>;
352
+ }
353
+ export interface InsertResult {
354
+ /** The new row's primary key, read back from the database. */
355
+ key: Record<string, string | number>;
356
+ /**
357
+ * The row as the database stored it — defaults filled, types settled.
358
+ * Absent only where the engine gives no way to read it back.
359
+ */
360
+ row?: Record<string, unknown>;
361
+ /** Values after coercion to their column types, for the caller to confirm. */
362
+ applied: Record<string, string | number | boolean | null>;
363
+ sql: {
364
+ text: string;
365
+ params: unknown[];
366
+ };
367
+ }
368
+ /**
369
+ * A queue of one.
370
+ *
371
+ * Every adapter here writes through a single connection, and a transaction is
372
+ * a span of statements on it that nothing else may enter. Node is
373
+ * single-threaded but `await` is not: two requests arriving together interleave
374
+ * at every await point, so a plain `/api/update` can land in the middle of
375
+ * somebody's open transaction and be rolled back with it — a write that
376
+ * succeeded, reported success, and then quietly did not happen.
377
+ *
378
+ * So writes queue. The cost is that two concurrent edits are applied one after
379
+ * the other rather than at once, which is what a single connection was always
380
+ * going to do anyway.
381
+ */
382
+ export declare class Serial {
383
+ private tail;
384
+ run<T>(work: () => Promise<T>): Promise<T>;
385
+ }
386
+ /**
387
+ * Structured reads and writes on the same transaction connection.
388
+ * This is not the whole adapter: no raw SQL, DDL, or cross-source access.
389
+ * Reads see earlier writes from this callback. Methods expire when it ends;
390
+ * callers must await operations and must not retain this handle for later.
391
+ */
392
+ export interface WriteTransaction {
393
+ /** Internal existing-row fence, held until this transaction ends. Call before
394
+ * reading stored originals or comparing an inverse image. Returns no data and
395
+ * grants no read/write authority. Missing keys do NOT reserve absence for a
396
+ * later restore. Scoped writers may omit this capability; never fall back to
397
+ * a plain SELECT when a fence is required. */
398
+ lockRecord?(request: DeleteRequest): Promise<void>;
399
+ query(request: QueryRequest): Promise<QueryResult>;
400
+ count(table: string, filter?: Filter): Promise<number>;
401
+ /** A command's sums, counts and groups over one table's own columns (shared/aggregate.ts), read as `count` reads:
402
+ * through the same scope, footprint and table names. Optional, and never approximated where absent: a facade that
403
+ * cannot bound it as it bounds `count` leaves it out, and the command's `db` refuses the call. */
404
+ aggregate?(request: AggregateRequest): Promise<AggregateResult>;
405
+ /** Non-replacing creation, including restoration: enforce InsertRequest's
406
+ * conflict contract in this transaction. A prior absent-key lock/read is not
407
+ * an absence reservation; uniqueness conflicts must still reject the insert. */
408
+ insert(request: InsertRequest): Promise<InsertResult>;
409
+ remove(request: DeleteRequest): Promise<DeleteResult>;
410
+ update(request: UpdateRequest): Promise<UpdateResult>;
411
+ /** Internal: a flow's notify step (appFlows.ts). The record's `notify` rules on `{ flow: audience }` tell their people
412
+ * in this transaction, as a write's rules do, with the step's words. Writes nothing to the record. Only the flows'
413
+ * own command reaches it, about its own target; a facade that cannot carry it omits it. */
414
+ tell?(request: TellRequest): Promise<void>;
415
+ }
416
+ /** What a flow's notify step tells: whom (an audience a `notify` rule names `on: { flow }`), about which record, and its words. */
417
+ export interface TellRequest {
418
+ table: string;
419
+ key: Record<string, string | number>;
420
+ audience: string;
421
+ message: string;
422
+ }
423
+ /**
424
+ * Drain accepted operations before commit/rollback, then refuse escaped handles.
425
+ *
426
+ * Each operation starts once every operation asked before it has settled
427
+ * (`run`), so a handler's statements reach the database in the order it asked
428
+ * them. Reads asked together — a handler's `Promise.all` — waited on each
429
+ * other all the same, a round trip each, though nothing in one could change
430
+ * what another reads. On a transaction told its writer sends together
431
+ * (`together`, a pipelining PostgreSQL writer), a read (`read`) starts beside
432
+ * the reads still in flight, in the order asked, so they leave in one flight;
433
+ * it still waits for every write asked before it, and every write waits for
434
+ * every read before it. Only operations in flight together overlap: one
435
+ * awaited before the next is asked is answered before the next starts.
436
+ *
437
+ * What a caller hears is unchanged. Each operation settles in the order asked,
438
+ * after the ones before it, and the first failure in that order is every later
439
+ * operation's failure, whether the later one had started or not — a read that
440
+ * ran beside a failed one is answered with that failure, never its own rows —
441
+ * and finish() rethrows it. Elsewhere `read` is `run`.
442
+ */
443
+ export declare class TransactionOperations {
444
+ private readonly together;
445
+ private active;
446
+ private failure;
447
+ /** Settles once every operation asked so far has: where the next write starts, and where each one settles. */
448
+ private settled;
449
+ /** Settles once the last operation that was not a read has: where a read starts, beside the reads after it. */
450
+ private written;
451
+ constructor(together?: boolean);
452
+ run<T>(work: () => Promise<T>): Promise<T>;
453
+ /** A read: it changes nothing another operation reads, so on a transaction that sends together it starts beside reads in flight. */
454
+ read<T>(work: () => Promise<T>): Promise<T>;
455
+ private enqueue;
456
+ finish(): Promise<void>;
457
+ }
458
+ /** Capture before queue waits, including failures: a caught malformed lock must
459
+ * still poison the owning transaction just like a failed database operation. */
460
+ export declare function queueRecordLock(operations: TransactionOperations, input: DeleteRequest, work: (request: DeleteRequest) => Promise<void>): Promise<void>;
461
+ /** Catalog-attested complete key only; callers supply the writer's metadata. */
462
+ export declare function recordLockFilter(request: DeleteRequest, primary: string[]): Filter;
463
+ /** A bound private read capability. No writer, raw SQL, lifecycle owner or
464
+ * way to replace its server-owned scope is handed to the consumer. */
465
+ export interface ScopedReads {
466
+ query(request: QueryRequest): Promise<QueryResult>;
467
+ /** With `limit`, stops after that many matching rows (countStatement). */
468
+ count(table: string, filter?: Filter, limit?: number): Promise<number>;
469
+ runView(view: ViewDef, offset?: number): Promise<ViewResult>;
470
+ /** With `limit`, stops after that many matching rows, as `count` does. */
471
+ countView(view: ViewDef, limit?: number): Promise<number>;
472
+ runBreakdown(breakdown: BreakdownDef, offset?: number): Promise<BreakdownResult>;
473
+ /** With `limit`, stops after that many groups, as `count` does. */
474
+ countBreakdown(breakdown: BreakdownDef, limit?: number): Promise<number>;
475
+ /** An aggregate over one table, under the scope (WriteTransaction.aggregate). */
476
+ aggregate?(request: AggregateRequest): Promise<AggregateResult>;
477
+ /** Several `count`s in one statement, each under the scope and its own filter
478
+ * (a menu's badges); absent on a reader that counts one at a time. */
479
+ countEach?(items: readonly CountItem[], limit?: number): Promise<number[]>;
480
+ }
481
+ /** A role's reach beyond reading: each a phrase for the startup notice. */
482
+ export interface RolePrivileges {
483
+ superuser: boolean;
484
+ /** Write privileges within what the connection browses, e.g. "INSERT/UPDATE/DELETE on 12 tables". */
485
+ writes: string[];
486
+ /** May create objects in a browsed schema or database. */
487
+ create: boolean;
488
+ }
489
+ export interface Adapter {
490
+ readonly dialect: DatabaseSchema['dialect'];
491
+ /** Optional explicit capability, never fall back to ordinary reads when absent.
492
+ * This read-only foundation does not authorize writes or resolve identity. */
493
+ scopeReads?(scope: RowScope): Promise<ScopedReads>;
494
+ /** Private same-source row enforcement; never substitute an ordinary
495
+ * transaction when this capability is absent. No command journal implied.
496
+ * Catalog evidence is detached, immutable and read on this same transaction;
497
+ * permission facades must attest it before using cached field/graph grants. */
498
+ scopeTransaction?<T>(scope: RowScope, run: (tx: WriteTransaction, catalog: DatabaseSchema) => Promise<T>): Promise<T>;
499
+ /** Read the catalog once on connect. Not per request. */
500
+ introspect(): Promise<DatabaseSchema>;
501
+ /**
502
+ * What this connection's database role could do beyond reading. Every read
503
+ * here runs in a read-only transaction, which holds for everything tablewalk
504
+ * sends but not for a superuser (`COPY … TO PROGRAM` is a read); the role is
505
+ * the boundary that always holds. Absent where there is no role (SQLite).
506
+ */
507
+ privileges?(): Promise<RolePrivileges>;
508
+ /**
509
+ * Each table's triggers, keyed by table id, read as a row-scoped write reads
510
+ * them (scoped/scopeTriggers.ts): which writes fire each, and whether it only
511
+ * checks the row it fires on. For `mistri check`, which names the commands a
512
+ * trigger blocks; a write never trusts this, and reads them again on its
513
+ * writer, under its own lock.
514
+ */
515
+ triggers?(): Promise<ReadonlyMap<string, readonly ScopeTrigger[]>>;
516
+ /**
517
+ * The keys of `tables` a trigger's effect may name, and how each column compares, read by the rules a scoped
518
+ * write judges effects by (triggerEffects.ts), so `mistri check` refuses the keys a write would refuse. As with
519
+ * `triggers`, a write never trusts this and reads them again on its writer.
520
+ */
521
+ triggerKeys?(tables: readonly string[]): Promise<TriggerKeyFacts>;
522
+ /**
523
+ * The connection pools' meters (poolMetrics.ts): checkouts, the wait for a
524
+ * connection, how long each was held, how many are in use and queued now.
525
+ * Absent where the adapter keeps no pool: SQLite, an HTTP source.
526
+ */
527
+ poolStats?(): readonly PoolRoleStats[];
528
+ /**
529
+ * What the database thinks a table holds, without counting.
530
+ *
531
+ * Optional, and unfiltered by nature: the catalog knows roughly how many rows
532
+ * a table has and nothing whatever about how many match a `WHERE`. An adapter
533
+ * whose engine keeps no such statistic returns undefined and gets an exact
534
+ * count, which is the honest outcome rather than a fabricated one.
535
+ *
536
+ * The number can be wrong — badly wrong on InnoDB, which samples index dives,
537
+ * and stale on Postgres until the next ANALYZE. That is why it is reported as
538
+ * an estimate everywhere it is shown, and why the exact count stays one click
539
+ * away.
540
+ */
541
+ estimateCount?(table: string): Promise<number | undefined>;
542
+ /**
543
+ * Run a statement the user wrote.
544
+ *
545
+ * Optional, because an adapter that cannot make the read genuinely read-only
546
+ * should not offer it at all. An implementation must:
547
+ *
548
+ * - run a read inside a transaction the statement cannot promote, not
549
+ * merely on a connection that is configured read-only — a session
550
+ * default the statement can reset is not a guarantee;
551
+ * - refuse `write` unless it has a separate write handle, and never run a
552
+ * write on the browsing connection;
553
+ * - report `bounded` honestly, so the caller can say "the database did the
554
+ * whole job" rather than implying a limit that was not applied.
555
+ */
556
+ runSql?(request: SqlRequest): Promise<SqlResult>;
557
+ /**
558
+ * The planner's account of how a statement would run, without running it.
559
+ *
560
+ * The question a query author actually has — "does this use the index or
561
+ * walk the table" — and the one `runSql` cannot answer, because its bounding
562
+ * wrap makes the statement it explains a different statement. Plans, never
563
+ * executes: implementations must not allow the analysing variants that run
564
+ * the statement to time it, which on a write would be the write.
565
+ */
566
+ explainSql?(request: ExplainRequest): Promise<ExplainResult>;
567
+ /**
568
+ * What a table's columns actually hold: null share, distinct count, range,
569
+ * and the values that repeat most.
570
+ *
571
+ * Optional because the honest cost differs by engine — Postgres reads
572
+ * numbers the planner already keeps, SQLite has to look — and the result
573
+ * says which happened, so the caller can decide whether to ask twice.
574
+ */
575
+ profile?(table: string, limits?: ProfileLimits): Promise<ProfileResult>;
576
+ /** Run a read. Adapters must reject anything that is not a read. */
577
+ query(request: QueryRequest): Promise<QueryResult>;
578
+ /**
579
+ * Run a multi-table view.
580
+ *
581
+ * Optional, and thin by design: `compileView` in shared/view.ts does all the
582
+ * work — resolving paths, planning joins, numbering placeholders — so an
583
+ * adapter that implements this only picks its `SqlStyle`, runs the statement
584
+ * and maps the rows. Anything an adapter decided for itself here would be a
585
+ * second join builder to keep in step with the first, and the join builder
586
+ * is exactly where the LEFT-versus-INNER mistake lives.
587
+ */
588
+ runView?(view: ViewDef, offset?: number): Promise<ViewResult>;
589
+ /**
590
+ * How many rows a view matches, ignoring the page.
591
+ *
592
+ * Separate from `count` because a view's WHERE clause addresses paths, not
593
+ * columns, so the joins have to exist for the predicate to compile at all.
594
+ * Optional alongside `runView`: an adapter that can run a view can count
595
+ * one, and one that cannot has no use for either. With `limit`, stops
596
+ * after that many matching rows (countStatement), as `count` does.
597
+ */
598
+ countView?(view: ViewDef, limit?: number): Promise<number>;
599
+ /**
600
+ * Run a breakdown: counts and sums, grouped by something.
601
+ *
602
+ * Thin for the same reason `runView` is thin — `compileBreakdown` does the
603
+ * work and the adapter picks a style and runs the statement. The one thing
604
+ * it contributes is `dateBucket`, because cutting a timestamp down to a
605
+ * month is the single part of this that no two engines spell alike.
606
+ */
607
+ runBreakdown?(breakdown: BreakdownDef, offset?: number): Promise<BreakdownResult>;
608
+ /** How many groups there are, ignoring the page. With `limit`, stops after that many. */
609
+ countBreakdown?(breakdown: BreakdownDef, limit?: number): Promise<number>;
610
+ /** A command's sums and groups over one table's own columns (shared/aggregate.ts), as `count` reads the table:
611
+ what a row policy's `db`, a page loader and a command's availability read through. Optional, and never
612
+ approximated where absent: a reader that cannot bound it as it bounds `count` leaves it out, and the `db` refuses. */
613
+ aggregate?(request: AggregateRequest): Promise<AggregateResult>;
614
+ /**
615
+ * Count matching rows, for pagination and the "how many point here" badge.
616
+ * With `limit`, stop after that many matching rows (countStatement): the
617
+ * answer is exact below the bound and the bound itself at or above it.
618
+ */
619
+ count(table: string, filter?: Filter, limit?: number): Promise<number>;
620
+ /**
621
+ * Several counts in one statement (countEachStatement), in the items' order,
622
+ * each with `limit` as `count` takes it. A list's tab badges and a record's
623
+ * references were a statement — and on a pool, a round trip — apiece.
624
+ *
625
+ * Optional, and absent on every wrapper that has not said how it guards it:
626
+ * an access layer builds its adapter from the methods it checks, so a
627
+ * missing one is refused rather than passed through, and the caller falls
628
+ * back to `count` per item (resourceReadOperations.readCounts). A row-scoped
629
+ * reader has none, so its counts keep compiling under its scope one by one.
630
+ */
631
+ countEach?(items: readonly CountItem[], limit?: number): Promise<number[]>;
632
+ /**
633
+ * The database's own stored DDL, when it keeps one.
634
+ *
635
+ * Optional on purpose. SQLite keeps the original `CREATE TABLE` text in
636
+ * `sqlite_master` and can hand it back exactly; Postgres does not store one
637
+ * (pg_dump reconstructs it too). Adapters that cannot be exact should not
638
+ * implement this — the caller falls back to `renderDDL` and labels the
639
+ * result as reconstructed, which is honest rather than convenient.
640
+ */
641
+ ddl?(table: string): Promise<string | undefined>;
642
+ /**
643
+ * Update exactly one column of exactly one row.
644
+ *
645
+ * Optional, and separate from `query` on purpose: the read path has no way
646
+ * to express a write, and adding one would mean every reader had to be
647
+ * trusted not to. An adapter that implements this opens its own write
648
+ * connection lazily — the browsing connection stays read-only for the life
649
+ * of the process.
650
+ *
651
+ * Implementations must refuse unless the filter matches exactly one row.
652
+ * The danger in a cell editor is never injection; it is an UPDATE whose
653
+ * WHERE is broader than the author believed.
654
+ */
655
+ update?(request: UpdateRequest): Promise<UpdateResult>;
656
+ /** Add one row. Absent on read-only dialects, like every other write. */
657
+ insert?(request: InsertRequest): Promise<InsertResult>;
658
+ /**
659
+ * Remove one row, having proved it is one row.
660
+ *
661
+ * The same contract as `update`: the exact primary key, a pre-flight count,
662
+ * and a refusal unless it matches exactly one. What is
663
+ * *not* an adapter's job is deciding whether the row should go — what
664
+ * references it, and what the database will do to those references, is
665
+ * answered above this layer where the schema is in hand.
666
+ *
667
+ * Constraint violations are left to the database. A `RESTRICT` that fires is
668
+ * the correct outcome reported in the engine's own words, and re-deriving
669
+ * that judgement here would be a second implementation of a rule the database
670
+ * already enforces — which is exactly how the two come to disagree.
671
+ */
672
+ remove?(request: DeleteRequest): Promise<DeleteResult>;
673
+ /**
674
+ * Several writes as one, or none of them.
675
+ *
676
+ * A fixture is a graph — an invoice needs its customer, the customer needs
677
+ * its country — and inserting it one call at a time means a ten-row fixture
678
+ * that fails at row seven leaves six rows and a dirty database. That is
679
+ * worse than failing, because the database now holds something nobody
680
+ * designed and nothing named.
681
+ *
682
+ * The callback gets same-connection reads and writes: see `WriteTransaction`. It is run
683
+ * behind the same queue as every other write, so nothing outside can land
684
+ * inside the transaction and be rolled back with it.
685
+ *
686
+ * Optional like the writes themselves. An adapter that cannot write cannot
687
+ * offer this, and one that can should: the guarantee is the engine's, and
688
+ * all three of these engines have it.
689
+ *
690
+ * A failure after a commit attempt or without confirmed rollback must throw
691
+ * TransactionOutcomeUnknown. Other failures mean no callback write committed.
692
+ * This outcome contract is required by Undo; atomicity alone cannot establish
693
+ * what happened when an acknowledgement was lost.
694
+ */
695
+ transaction?<T>(run: (tx: WriteTransaction) => Promise<T>): Promise<T>;
696
+ close(): Promise<void>;
697
+ }
698
+ export interface UpdateRequest {
699
+ table: string;
700
+ /** Primary key columns and their values. Must identify one row. */
701
+ key: Record<string, string | number>;
702
+ /**
703
+ * Column name to new value. Several at once on purpose.
704
+ *
705
+ * Editing three fields as three statements means three chances to fail
706
+ * half way, leaving a row in a state the user never asked for. One
707
+ * statement either applies or does not.
708
+ */
709
+ values: Record<string, string | number | boolean | null>;
710
+ /**
711
+ * Set only by history's revert: a record returning to its recorded
712
+ * before-image is not a new transition (server/app/appTransitions.ts).
713
+ */
714
+ restore?: true;
715
+ /** Original values for exactly the touched fields; checked atomically by UPDATE. */
716
+ expected?: Record<string, string | number | boolean | null>;
717
+ }
718
+ export interface UpdateResult {
719
+ affected: number;
720
+ /** Values after coercion to their column types, for the caller to confirm. */
721
+ applied: Record<string, string | number | boolean | null>;
722
+ sql: {
723
+ text: string;
724
+ params: unknown[];
725
+ };
726
+ }