derive-dashboards 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/README.md +8 -5
  2. package/dist/adapter/sql-adapter.mjs +4 -4
  3. package/dist/body.mjs +11 -1
  4. package/dist/cache.d.mts +1 -1
  5. package/dist/cli/add.mjs +130 -0
  6. package/dist/cli/check.mjs +14 -1
  7. package/dist/cli/cli.mjs +14 -12
  8. package/dist/cli/config.mjs +12 -1
  9. package/dist/cli/doctor.mjs +147 -0
  10. package/dist/cli/import/dbt-schema.mjs +2 -2
  11. package/dist/cli/import/index.mjs +2 -2
  12. package/dist/cli/init.mjs +3 -2
  13. package/dist/cli/json.mjs +21 -0
  14. package/dist/cli/layers.mjs +33 -0
  15. package/dist/core/conformance/cases.d.mts +3 -0
  16. package/dist/core/conformance/cases.mjs +20 -4
  17. package/dist/core/conformance/check.mjs +6 -3
  18. package/dist/core/conformance/drill-cases.mjs +120 -0
  19. package/dist/core/document/layout.mjs +1 -1
  20. package/dist/core/document/view-layout.d.mts +14 -0
  21. package/dist/core/document/view-layout.mjs +157 -0
  22. package/dist/core/document/view.d.mts +26 -7
  23. package/dist/core/document/view.mjs +42 -11
  24. package/dist/core/engine/filter.mjs +2 -2
  25. package/dist/core/engine/index.d.mts +14 -2
  26. package/dist/core/engine/index.mjs +12 -1
  27. package/dist/core/engine/leaf.mjs +9 -4
  28. package/dist/core/engine/members.mjs +2 -2
  29. package/dist/core/engine/postgres.mjs +1 -1
  30. package/dist/core/engine/record-layout.d.mts +11 -0
  31. package/dist/core/engine/record-layout.mjs +7 -7
  32. package/dist/core/engine/records.d.mts +3 -2
  33. package/dist/core/engine/records.mjs +2 -1
  34. package/dist/core/engine/segmented.mjs +5 -2
  35. package/dist/core/engine/sql-records.mjs +2 -1
  36. package/dist/core/engine/statement.mjs +37 -3
  37. package/dist/core/engine/types.d.mts +3 -0
  38. package/dist/core/engine/version.d.mts +1 -1
  39. package/dist/core/engine/version.mjs +1 -1
  40. package/dist/core/error/codes.d.mts +33 -1
  41. package/dist/core/error/codes.mjs +30 -2
  42. package/dist/core/index.d.mts +13 -7
  43. package/dist/core/index.mjs +9 -5
  44. package/dist/core/model/catalog/check.mjs +1 -1
  45. package/dist/core/model/hints.d.mts +36 -0
  46. package/dist/core/model/member.d.mts +4 -2
  47. package/dist/core/model/member.mjs +19 -3
  48. package/dist/core/model/types.d.mts +21 -19
  49. package/dist/core/model/validate/drill.mjs +70 -0
  50. package/dist/core/model/validate/index.mjs +3 -0
  51. package/dist/core/model/validate/members.mjs +7 -4
  52. package/dist/core/model/validate/shape.mjs +150 -0
  53. package/dist/core/model/validate/source.mjs +5 -3
  54. package/dist/core/policy/bind-query.d.mts +12 -0
  55. package/dist/core/policy/bind-query.mjs +53 -0
  56. package/dist/core/query/alias.mjs +7 -1
  57. package/dist/core/query/drill/compose.d.mts +22 -0
  58. package/dist/core/query/drill/compose.mjs +85 -0
  59. package/dist/core/query/drill/fields.d.mts +21 -0
  60. package/dist/core/query/drill/fields.mjs +91 -0
  61. package/dist/core/query/drill/internal.d.mts +11 -0
  62. package/dist/core/query/drill/items.d.mts +29 -0
  63. package/dist/core/query/drill/items.mjs +98 -0
  64. package/dist/core/query/drill/line.d.mts +31 -0
  65. package/dist/core/query/drill/line.mjs +183 -0
  66. package/dist/core/query/drill/links.d.mts +33 -0
  67. package/dist/core/query/drill/links.mjs +31 -0
  68. package/dist/core/query/drill/operand.mjs +7 -0
  69. package/dist/core/query/drill/scopes.d.mts +22 -0
  70. package/dist/core/query/drill/scopes.mjs +58 -0
  71. package/dist/core/query/drill/selection.d.mts +37 -0
  72. package/dist/core/query/drill/selection.mjs +144 -0
  73. package/dist/core/query/drill/steps.d.mts +14 -0
  74. package/dist/core/query/drill/steps.mjs +35 -0
  75. package/dist/core/query/drill/synthetic-expr.mjs +85 -0
  76. package/dist/core/query/drill/synthetic.d.mts +22 -0
  77. package/dist/core/query/drill/synthetic.mjs +165 -0
  78. package/dist/core/query/drill/time.d.mts +11 -0
  79. package/dist/core/query/drill/time.mjs +71 -0
  80. package/dist/core/query/drill/types.d.mts +155 -0
  81. package/dist/core/query/drill/types.mjs +4 -0
  82. package/dist/core/query/drill/views.d.mts +62 -0
  83. package/dist/core/query/drill/views.mjs +257 -0
  84. package/dist/core/query/filter.d.mts +6 -0
  85. package/dist/core/query/picks.d.mts +8 -2
  86. package/dist/core/query/picks.mjs +11 -4
  87. package/dist/core/query/segments.d.mts +12 -2
  88. package/dist/core/query/segments.mjs +5 -2
  89. package/dist/core/result/columns.mjs +20 -4
  90. package/dist/core/result/types.d.mts +5 -1
  91. package/dist/core/schema/aliases.d.mts +7 -0
  92. package/dist/core/schema/aliases.mjs +77 -0
  93. package/dist/core/schema/answer-parts.mjs +117 -0
  94. package/dist/core/schema/answers.d.mts +2109 -128
  95. package/dist/core/schema/answers.mjs +11 -113
  96. package/dist/core/schema/commands.d.mts +2 -2
  97. package/dist/core/schema/document.d.mts +1 -1
  98. package/dist/core/schema/drill-answers.mjs +179 -0
  99. package/dist/core/schema/drill.d.mts +260 -0
  100. package/dist/core/schema/drill.mjs +107 -0
  101. package/dist/core/schema/index.d.mts +6 -3
  102. package/dist/core/schema/index.mjs +6 -3
  103. package/dist/core/schema/picks.d.mts +35 -0
  104. package/dist/core/schema/picks.mjs +23 -0
  105. package/dist/core/schema/query.d.mts +82 -1
  106. package/dist/core/schema/query.mjs +9 -5
  107. package/dist/core/schema/tools.mjs +1 -1
  108. package/dist/core/schema/view.d.mts +0 -35
  109. package/dist/core/schema/view.mjs +19 -24
  110. package/dist/core/store/schema.d.mts +5 -0
  111. package/dist/core/store/schema.mjs +10 -0
  112. package/dist/core/types/api.d.mts +21 -1
  113. package/dist/core/types/api.mjs +1 -1
  114. package/dist/core/types/drill-api.d.mts +210 -0
  115. package/dist/core/types/options.d.mts +21 -0
  116. package/dist/core/types/viewer.d.mts +5 -0
  117. package/dist/cursor-seal.d.mts +8 -0
  118. package/dist/cursor-seal.mjs +98 -0
  119. package/dist/dashboard-id.mjs +1 -1
  120. package/dist/dashboards.mjs +4 -0
  121. package/dist/drill-access.mjs +93 -0
  122. package/dist/drill-change.mjs +76 -0
  123. package/dist/drill-crumbs.mjs +113 -0
  124. package/dist/drill-distinct.mjs +130 -0
  125. package/dist/drill-explain.mjs +64 -0
  126. package/dist/drill-identity.mjs +35 -0
  127. package/dist/drill-item-id.mjs +35 -0
  128. package/dist/drill-items.mjs +132 -0
  129. package/dist/drill-open.mjs +169 -0
  130. package/dist/drill-seal.mjs +170 -0
  131. package/dist/drill-secret.mjs +14 -0
  132. package/dist/drill-share.mjs +53 -0
  133. package/dist/drill-summary.mjs +158 -0
  134. package/dist/drill-targets.mjs +53 -0
  135. package/dist/drill-totals.mjs +8 -0
  136. package/dist/drill-views.mjs +175 -0
  137. package/dist/drill.mjs +157 -0
  138. package/dist/editing.mjs +3 -3
  139. package/dist/endpoints/dashboards.mjs +28 -5
  140. package/dist/endpoints/drill.mjs +55 -0
  141. package/dist/endpoints/index.d.mts +245 -4
  142. package/dist/endpoints/index.mjs +5 -1
  143. package/dist/endpoints/meta.mjs +10 -1
  144. package/dist/endpoints/query.mjs +26 -4
  145. package/dist/execute.d.mts +19 -1
  146. package/dist/execute.mjs +34 -27
  147. package/dist/handler.mjs +5 -1
  148. package/dist/index.d.mts +3 -1
  149. package/dist/index.mjs +29 -2
  150. package/dist/llms.txt +22 -0
  151. package/dist/mcp/drill.mjs +61 -0
  152. package/dist/mcp/format.mjs +69 -11
  153. package/dist/mcp/index.d.mts +15 -4
  154. package/dist/mcp/index.mjs +13 -7
  155. package/dist/mcp/query.d.mts +7 -2
  156. package/dist/mcp/query.mjs +40 -6
  157. package/dist/node-postgres.d.mts +8 -4
  158. package/dist/node-postgres.mjs +29 -6
  159. package/dist/owner.mjs +3 -3
  160. package/dist/postgres-connection.d.mts +8 -2
  161. package/dist/postgres-connection.mjs +2 -1
  162. package/dist/postgres-store.mjs +1 -0
  163. package/dist/react/Canvas.mjs +28 -5
  164. package/dist/react/Cell.mjs +2 -1
  165. package/dist/react/Dashboard.d.mts +10 -5
  166. package/dist/react/Dashboard.mjs +62 -22
  167. package/dist/react/DashboardList.mjs +52 -24
  168. package/dist/react/DashboardListRow.mjs +49 -0
  169. package/dist/react/Discard.mjs +12 -4
  170. package/dist/react/Editing.mjs +19 -5
  171. package/dist/react/FilterBar.d.mts +7 -9
  172. package/dist/react/Grid.mjs +19 -24
  173. package/dist/react/Header.mjs +10 -1
  174. package/dist/react/History.mjs +5 -0
  175. package/dist/react/Parts.mjs +6 -2
  176. package/dist/react/ReadFailed.mjs +23 -0
  177. package/dist/react/ReviewPanel.mjs +13 -2
  178. package/dist/react/RowBody.d.mts +19 -0
  179. package/dist/react/RowBody.mjs +55 -0
  180. package/dist/react/Spaces.mjs +15 -1
  181. package/dist/react/Tile.d.mts +3 -1
  182. package/dist/react/Tile.mjs +84 -32
  183. package/dist/react/_virtual/_rolldown/runtime.mjs +12 -0
  184. package/dist/react/arrange-steps.mjs +16 -13
  185. package/dist/react/arrange.mjs +10 -3
  186. package/dist/react/builder/Calcs.mjs +35 -11
  187. package/dist/react/builder/FilterEditor.mjs +196 -0
  188. package/dist/react/builder/Filters.mjs +172 -116
  189. package/dist/react/builder/Formula.mjs +82 -0
  190. package/dist/react/builder/Groups.mjs +1 -0
  191. package/dist/react/builder/Preview.mjs +1 -1
  192. package/dist/react/builder/RangeEditor.mjs +184 -0
  193. package/dist/react/builder/Sections.mjs +41 -6
  194. package/dist/react/builder/Time.mjs +138 -60
  195. package/dist/react/builder/Values.mjs +85 -0
  196. package/dist/react/builder/WidgetBuilder.mjs +50 -49
  197. package/dist/react/builder/base.d.mts +5 -0
  198. package/dist/react/builder/base.mjs +33 -8
  199. package/dist/react/builder/calc.mjs +15 -1
  200. package/dist/react/builder/escape.d.mts +1 -0
  201. package/dist/react/builder/escape.mjs +62 -0
  202. package/dist/react/builder/filter-tree.d.mts +9 -0
  203. package/dist/react/builder/filter-tree.mjs +186 -0
  204. package/dist/react/builder/formula-parse.d.mts +18 -0
  205. package/dist/react/builder/formula-parse.mjs +136 -0
  206. package/dist/react/builder/labels.d.mts +1 -1
  207. package/dist/react/builder/state.d.mts +2 -1
  208. package/dist/react/builder/state.mjs +23 -37
  209. package/dist/react/builder/useBuilder.d.mts +12 -1
  210. package/dist/react/builder/useBuilder.mjs +6 -3
  211. package/dist/react/builder/words.d.mts +59 -0
  212. package/dist/react/builder/words.mjs +73 -0
  213. package/dist/react/client.d.mts +2 -0
  214. package/dist/react/client.mjs +1 -0
  215. package/dist/react/context.d.mts +28 -1
  216. package/dist/react/context.mjs +25 -4
  217. package/dist/react/drill/Bars.mjs +179 -0
  218. package/dist/react/drill/Controls.mjs +173 -0
  219. package/dist/react/drill/DashboardTile.d.mts +18 -0
  220. package/dist/react/drill/DashboardTile.mjs +107 -0
  221. package/dist/react/drill/DrillPanel.d.mts +31 -0
  222. package/dist/react/drill/DrillPanel.mjs +104 -0
  223. package/dist/react/drill/DrillTabs.mjs +52 -0
  224. package/dist/react/drill/Header.mjs +131 -0
  225. package/dist/react/drill/Items.d.mts +22 -0
  226. package/dist/react/drill/Items.mjs +164 -0
  227. package/dist/react/drill/ItemsFoot.mjs +60 -0
  228. package/dist/react/drill/Notes.mjs +58 -0
  229. package/dist/react/drill/PanelBody.mjs +74 -0
  230. package/dist/react/drill/PanelStates.mjs +37 -0
  231. package/dist/react/drill/board.d.mts +18 -0
  232. package/dist/react/drill/board.mjs +91 -0
  233. package/dist/react/drill/counts.mjs +14 -0
  234. package/dist/react/drill/host.mjs +26 -0
  235. package/dist/react/drill/item-parts.d.mts +5 -0
  236. package/dist/react/drill/item-parts.mjs +76 -0
  237. package/dist/react/drill/item-type.d.mts +26 -0
  238. package/dist/react/drill/item-type.mjs +7 -0
  239. package/dist/react/drill/lazy.d.mts +6 -0
  240. package/dist/react/drill/lazy.mjs +17 -0
  241. package/dist/react/drill/pages.mjs +48 -0
  242. package/dist/react/drill/panel-focus.mjs +51 -0
  243. package/dist/react/drill/props.d.mts +25 -0
  244. package/dist/react/drill/props.mjs +72 -0
  245. package/dist/react/drill/state.d.mts +18 -0
  246. package/dist/react/drill/state.mjs +68 -0
  247. package/dist/react/drill/useDrill.d.mts +46 -0
  248. package/dist/react/drill/useDrill.mjs +194 -0
  249. package/dist/react/drill/words.d.mts +101 -0
  250. package/dist/react/drill/words.mjs +79 -0
  251. package/dist/react/english.mjs +29 -6
  252. package/dist/react/filters/bar.d.mts +12 -0
  253. package/dist/react/filters/bar.mjs +135 -0
  254. package/dist/react/filters/calendar.mjs +193 -0
  255. package/dist/react/filters/chip.mjs +174 -0
  256. package/dist/react/filters/context.d.mts +22 -0
  257. package/dist/react/filters/context.mjs +78 -0
  258. package/dist/react/filters/dates.mjs +89 -0
  259. package/dist/react/filters/days.d.mts +36 -0
  260. package/dist/react/filters/days.mjs +87 -0
  261. package/dist/react/filters/field-step.mjs +81 -0
  262. package/dist/react/filters/hooks.d.mts +34 -0
  263. package/dist/react/filters/hooks.mjs +94 -0
  264. package/dist/react/filters/listbox.mjs +131 -0
  265. package/dist/react/filters/logic.d.mts +59 -0
  266. package/dist/react/filters/logic.mjs +109 -0
  267. package/dist/react/filters/menu-search.mjs +211 -0
  268. package/dist/react/filters/menu.mjs +85 -0
  269. package/dist/react/filters/number.mjs +127 -0
  270. package/dist/react/filters/numbers.d.mts +47 -0
  271. package/dist/react/filters/numbers.mjs +151 -0
  272. package/dist/react/filters/operator.mjs +104 -0
  273. package/dist/react/filters/phone.mjs +104 -0
  274. package/dist/react/filters/popover.d.mts +19 -0
  275. package/dist/react/filters/popover.mjs +153 -0
  276. package/dist/react/filters/rules.d.mts +8 -0
  277. package/dist/react/filters/rules.mjs +55 -0
  278. package/dist/react/filters/sheet.mjs +196 -0
  279. package/dist/react/filters/state.mjs +132 -0
  280. package/dist/react/filters/suggest.d.mts +47 -0
  281. package/dist/react/filters/suggest.mjs +97 -0
  282. package/dist/react/filters/values.mjs +166 -0
  283. package/dist/react/filters/words.d.mts +81 -0
  284. package/dist/react/filters/words.mjs +73 -0
  285. package/dist/react/format.d.mts +3 -3
  286. package/dist/react/format.mjs +45 -16
  287. package/dist/react/index.d.mts +34 -5
  288. package/dist/react/index.mjs +15 -4
  289. package/dist/react/messages.d.mts +47 -2
  290. package/dist/react/place.mjs +7 -3
  291. package/dist/react/renderers/index.d.mts +10 -2
  292. package/dist/react/renderers/index.mjs +116 -14
  293. package/dist/react/renderers/list.d.mts +22 -0
  294. package/dist/react/renderers/list.mjs +118 -0
  295. package/dist/react/review-words.mjs +1 -1
  296. package/dist/react/review.mjs +2 -2
  297. package/dist/react/scope.mjs +2 -7
  298. package/dist/react/series.d.mts +54 -0
  299. package/dist/react/series.mjs +191 -0
  300. package/dist/react/theme.css +2734 -1296
  301. package/dist/react/theme.css.d.ts +1 -0
  302. package/dist/react/tile-store.mjs +15 -3
  303. package/dist/react/useBoard.d.mts +7 -0
  304. package/dist/react/useBoard.mjs +4 -1
  305. package/dist/react/useDashboard.d.mts +4 -0
  306. package/dist/react/useDashboard.mjs +8 -1
  307. package/dist/react/useTiles.mjs +50 -15
  308. package/dist/react/view-grid.mjs +16 -0
  309. package/dist/react/view.d.mts +9 -0
  310. package/dist/react/view.mjs +22 -10
  311. package/dist/reading.d.mts +2 -0
  312. package/dist/reading.mjs +9 -1
  313. package/dist/recharts/axes.mjs +28 -0
  314. package/dist/recharts/axis.mjs +84 -0
  315. package/dist/recharts/bar.d.mts +7 -0
  316. package/dist/recharts/bar.mjs +140 -0
  317. package/dist/recharts/charts.d.mts +4 -6
  318. package/dist/recharts/charts.mjs +2 -114
  319. package/dist/recharts/index.d.mts +5 -3
  320. package/dist/recharts/index.mjs +6 -3
  321. package/dist/recharts/line.d.mts +2 -0
  322. package/dist/recharts/line.mjs +111 -0
  323. package/dist/recharts/marks.mjs +112 -0
  324. package/dist/recharts/parts.mjs +88 -0
  325. package/dist/recharts/series.d.mts +2 -22
  326. package/dist/recharts/series.mjs +1 -64
  327. package/dist/recharts/table.mjs +71 -0
  328. package/dist/records-read.mjs +44 -0
  329. package/dist/registry/filter-bar.json +26 -0
  330. package/dist/skills/derive-dashboards/SKILL.md +69 -0
  331. package/dist/store/apply.mjs +5 -5
  332. package/dist/store/commands.mjs +4 -4
  333. package/dist/store/discard.mjs +7 -7
  334. package/dist/store/drafts.mjs +5 -5
  335. package/dist/store/editor.mjs +1 -1
  336. package/dist/store/publish.mjs +12 -12
  337. package/dist/store/reader.mjs +41 -22
  338. package/dist/store/review.mjs +16 -16
  339. package/dist/store/rows.mjs +20 -20
  340. package/dist/store/undo.mjs +3 -3
  341. package/dist/store/unpublished.mjs +4 -4
  342. package/dist/store/versions.mjs +14 -14
  343. package/dist/testing/adapter-suite.mjs +4 -4
  344. package/dist/tiles.mjs +37 -3
  345. package/package.json +12 -10
  346. package/dist/react/FilterBar.mjs +0 -119
  347. package/dist/react/Records.d.mts +0 -12
  348. package/dist/react/Records.mjs +0 -97
  349. package/src/adapter/sql-adapter.ts +0 -95
  350. package/src/adapter/statement.ts +0 -185
  351. package/src/authorize.ts +0 -73
  352. package/src/body.ts +0 -169
  353. package/src/bounded.ts +0 -43
  354. package/src/cache.ts +0 -192
  355. package/src/checks.ts +0 -170
  356. package/src/custom-source.ts +0 -59
  357. package/src/dashboard-id.ts +0 -36
  358. package/src/dashboards.ts +0 -132
  359. package/src/editing.ts +0 -148
  360. package/src/endpoints/access.ts +0 -41
  361. package/src/endpoints/dashboards.ts +0 -92
  362. package/src/endpoints/drafts.ts +0 -138
  363. package/src/endpoints/index.ts +0 -21
  364. package/src/endpoints/meta.ts +0 -137
  365. package/src/endpoints/query.ts +0 -86
  366. package/src/endpoints/read.ts +0 -92
  367. package/src/endpoints/review.ts +0 -89
  368. package/src/endpoints/values.ts +0 -62
  369. package/src/endpoints/versions.ts +0 -104
  370. package/src/execute.ts +0 -207
  371. package/src/handler.ts +0 -232
  372. package/src/http.ts +0 -66
  373. package/src/index.ts +0 -163
  374. package/src/introspect.ts +0 -205
  375. package/src/mcp/api.ts +0 -59
  376. package/src/mcp/format.ts +0 -67
  377. package/src/mcp/index.ts +0 -151
  378. package/src/mcp/query.ts +0 -153
  379. package/src/mcp/resolve.ts +0 -114
  380. package/src/node-postgres.ts +0 -81
  381. package/src/owner.ts +0 -36
  382. package/src/postgres-connection.ts +0 -143
  383. package/src/postgres-store.ts +0 -82
  384. package/src/principal.ts +0 -39
  385. package/src/reading.ts +0 -56
  386. package/src/request-rows.ts +0 -23
  387. package/src/request.ts +0 -22
  388. package/src/storage.ts +0 -63
  389. package/src/store/apply.ts +0 -129
  390. package/src/store/commands.ts +0 -75
  391. package/src/store/conflicts.ts +0 -98
  392. package/src/store/create-tables.ts +0 -104
  393. package/src/store/discard.ts +0 -42
  394. package/src/store/drafts.ts +0 -133
  395. package/src/store/editor.ts +0 -28
  396. package/src/store/log.ts +0 -28
  397. package/src/store/publish.ts +0 -199
  398. package/src/store/publisher.ts +0 -21
  399. package/src/store/reader.ts +0 -139
  400. package/src/store/review.ts +0 -239
  401. package/src/store/rows.ts +0 -250
  402. package/src/store/tenant.ts +0 -28
  403. package/src/store/undo.ts +0 -56
  404. package/src/store/unpublished.ts +0 -33
  405. package/src/store/versions.ts +0 -106
  406. package/src/store/writer.ts +0 -19
  407. package/src/testing/adapter-suite.ts +0 -239
  408. package/src/testing/index.ts +0 -2
  409. package/src/tile-doc.ts +0 -46
  410. package/src/tiles.ts +0 -120
@@ -0,0 +1,107 @@
1
+ import "../query/drill/types.mjs";
2
+ import { picksSchema } from "./picks.mjs";
3
+ import { grain, name, primitive, wireQuerySchema } from "./query.mjs";
4
+ import { z } from "zod";
5
+ // src/schema/drill.ts
6
+ /** What a drill shows. */
7
+ const drillViewSchema = z.union([
8
+ z.strictObject({
9
+ by: z.literal("breakdown"),
10
+ member: name.exactOptional(),
11
+ search: z.string().max(200).exactOptional()
12
+ }),
13
+ z.strictObject({
14
+ by: z.literal("trend"),
15
+ grain: grain.exactOptional()
16
+ }),
17
+ z.strictObject({
18
+ by: z.literal("items"),
19
+ numerator: z.literal(true).exactOptional()
20
+ }),
21
+ z.strictObject({ by: z.literal("explanation") })
22
+ ]);
23
+ const sealed = z.string().min(1).max(8e3);
24
+ /**
25
+ * A step of a path: a sealed selection, or, for a click the server has not normalized yet, a
26
+ * row of a sealed answer (`<answer>#<row>`, `#p<row>` for the comparison period's). The server
27
+ * answers with the path normalized to sealed selections, so only the first request carries one.
28
+ */
29
+ const pathEntry = z.union([sealed, z.string().max(4e6).regex(/^[\w.-]+#p?\d{1,6}$/u)]);
30
+ const origin = z.union([z.strictObject({
31
+ kind: z.literal("dashboard"),
32
+ dashboardId: name,
33
+ widgetId: name,
34
+ query: z.string().max(100).exactOptional(),
35
+ picks: picksSchema,
36
+ document: z.union([z.strictObject({ version: z.int().min(0) }), z.strictObject({ draft: z.literal(true) })]).exactOptional()
37
+ }), z.strictObject({
38
+ kind: z.literal("query"),
39
+ query: wireQuerySchema
40
+ })]);
41
+ /** A drill as plain data: its origin, line, sealed execution and path, and the view open. */
42
+ const drillStateSchema = z.strictObject({
43
+ origin,
44
+ entry: z.string().regex(/^[mc][1-9]\d{0,2}$/u).exactOptional(),
45
+ execution: sealed,
46
+ path: z.array(pathEntry).max(8).readonly(),
47
+ view: drillViewSchema,
48
+ views: z.array(drillViewSchema).max(8).readonly().exactOptional()
49
+ });
50
+ const step = z.union([
51
+ z.strictObject({ group: z.array(z.strictObject({
52
+ member: name,
53
+ value: primitive
54
+ })).readonly() }),
55
+ z.strictObject({ bucket: z.strictObject({
56
+ member: name,
57
+ from: z.string(),
58
+ to: z.string(),
59
+ grain: grain.exactOptional()
60
+ }) }),
61
+ z.strictObject({ other: z.strictObject({
62
+ members: z.array(name).readonly(),
63
+ kept: z.array(z.array(primitive).readonly()).readonly()
64
+ }) }),
65
+ z.strictObject({ search: z.strictObject({
66
+ member: name,
67
+ text: z.string().max(200)
68
+ }) })
69
+ ]);
70
+ const cell = z.union([primitive, z.strictObject({
71
+ t: z.enum(["int", "decimal"]),
72
+ v: z.string()
73
+ })]);
74
+ /** What a sealed selection opens to, checked again after it opens. */
75
+ const selectionSchema = z.strictObject({
76
+ steps: z.array(step).readonly(),
77
+ clicked: z.record(z.string(), cell).exactOptional(),
78
+ previous: z.literal(true).exactOptional(),
79
+ exec: z.string().max(100).exactOptional(),
80
+ parent: z.string().max(100).exactOptional()
81
+ });
82
+ /** What a sealed execution opens to. */
83
+ const pinnedSchema = z.strictObject({
84
+ id: z.string().max(100),
85
+ by: z.string().max(100),
86
+ revision: z.string().max(100).exactOptional(),
87
+ range: z.strictObject({
88
+ from: z.string(),
89
+ to: z.string()
90
+ }).exactOptional(),
91
+ compare: z.strictObject({
92
+ from: z.string(),
93
+ to: z.string()
94
+ }).exactOptional(),
95
+ now: z.string().max(40).exactOptional(),
96
+ calendar: z.strictObject({
97
+ timezone: z.string(),
98
+ weekStart: z.union([
99
+ z.literal(0),
100
+ z.literal(1),
101
+ z.literal(6)
102
+ ]),
103
+ fiscalYearStartMonth: z.int().min(1).max(12)
104
+ }),
105
+ version: z.int().min(0).exactOptional()
106
+ });
107
+ export { drillStateSchema, drillViewSchema, pinnedSchema, selectionSchema };
@@ -1,9 +1,12 @@
1
1
  import { DOCUMENT_UPGRADES, Loaded, SPEC_VERSION, Upgrade, loadDocument } from "../document/upgrade.mjs";
2
+ import { positional } from "./aliases.mjs";
2
3
  import { AnswerSchemas, answerSchemas, tileLineSchema } from "./answers.mjs";
3
4
  import { ParsedCommands, commandSchema, parseCommands } from "./commands.mjs";
4
5
  import { customReadSchemas, groupedReadSchema, recordsReadSchema } from "./custom.mjs";
5
6
  import { ParsedDocument, documentSchema, parseDocument } from "./document.mjs";
6
- import { ParsedQuery, parseWireQuery, wireQuerySchema } from "./query.mjs";
7
+ import { drillStateSchema, drillViewSchema, pinnedSchema, selectionSchema } from "./drill.mjs";
8
+ import { picksSchema } from "./picks.mjs";
9
+ import { ParsedQuery, parseWireQuery, wireQuerySchema, wireQueryShape } from "./query.mjs";
7
10
  import { JsonSchema, jsonSchema, toolSchemas } from "./tools.mjs";
8
- import { decodeView, picksSchema } from "./view.mjs";
9
- export { type AnswerSchemas, DOCUMENT_UPGRADES, type JsonSchema, type Loaded, type ParsedCommands, type ParsedDocument, type ParsedQuery, SPEC_VERSION, type Upgrade, answerSchemas, commandSchema, customReadSchemas, decodeView, documentSchema, groupedReadSchema, jsonSchema, loadDocument, parseCommands, parseDocument, parseWireQuery, picksSchema, recordsReadSchema, tileLineSchema, toolSchemas, wireQuerySchema };
11
+ import { decodeView } from "./view.mjs";
12
+ export { type AnswerSchemas, DOCUMENT_UPGRADES, type JsonSchema, type Loaded, type ParsedCommands, type ParsedDocument, type ParsedQuery, SPEC_VERSION, type Upgrade, answerSchemas, commandSchema, customReadSchemas, decodeView, documentSchema, drillStateSchema, drillViewSchema, groupedReadSchema, jsonSchema, loadDocument, parseCommands, parseDocument, parseWireQuery, picksSchema, pinnedSchema, positional, recordsReadSchema, selectionSchema, tileLineSchema, toolSchemas, wireQuerySchema, wireQueryShape };
@@ -1,9 +1,12 @@
1
1
  import { DOCUMENT_UPGRADES, SPEC_VERSION, loadDocument } from "../document/upgrade.mjs";
2
+ import { positional } from "./aliases.mjs";
2
3
  import { answerSchemas, tileLineSchema } from "./answers.mjs";
3
4
  import { commandSchema, parseCommands } from "./commands.mjs";
4
5
  import { customReadSchemas, groupedReadSchema, recordsReadSchema } from "./custom.mjs";
5
6
  import { documentSchema, parseDocument } from "./document.mjs";
6
- import { parseWireQuery, wireQuerySchema } from "./query.mjs";
7
+ import { drillStateSchema, drillViewSchema, pinnedSchema, selectionSchema } from "./drill.mjs";
8
+ import { picksSchema } from "./picks.mjs";
9
+ import { parseWireQuery, wireQuerySchema, wireQueryShape } from "./query.mjs";
7
10
  import { jsonSchema, toolSchemas } from "./tools.mjs";
8
- import { decodeView, picksSchema } from "./view.mjs";
9
- export { DOCUMENT_UPGRADES, SPEC_VERSION, answerSchemas, commandSchema, customReadSchemas, decodeView, documentSchema, groupedReadSchema, jsonSchema, loadDocument, parseCommands, parseDocument, parseWireQuery, picksSchema, recordsReadSchema, tileLineSchema, toolSchemas, wireQuerySchema };
11
+ import { decodeView } from "./view.mjs";
12
+ export { DOCUMENT_UPGRADES, SPEC_VERSION, answerSchemas, commandSchema, customReadSchemas, decodeView, documentSchema, drillStateSchema, drillViewSchema, groupedReadSchema, jsonSchema, loadDocument, parseCommands, parseDocument, parseWireQuery, picksSchema, pinnedSchema, positional, recordsReadSchema, selectionSchema, tileLineSchema, toolSchemas, wireQuerySchema, wireQueryShape };
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ /** A viewer's picks by control id, as the tile endpoints and a shared link accept them. */
3
+ export declare const picksSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
4
+ op: z.ZodEnum<{
5
+ equals: "equals";
6
+ in: "in";
7
+ contains: "contains";
8
+ startsWith: "startsWith";
9
+ gt: "gt";
10
+ gte: "gte";
11
+ lt: "lt";
12
+ lte: "lte";
13
+ between: "between";
14
+ notEquals: "notEquals";
15
+ notIn: "notIn";
16
+ notContains: "notContains";
17
+ set: "set";
18
+ notSet: "notSet";
19
+ }>;
20
+ values: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
21
+ }, z.core.$strict>, z.ZodObject<{
22
+ last: z.ZodInt;
23
+ unit: z.ZodEnum<{
24
+ hour: "hour";
25
+ day: "day";
26
+ week: "week";
27
+ month: "month";
28
+ quarter: "quarter";
29
+ year: "year";
30
+ }>;
31
+ includeCurrent: z.ZodBoolean;
32
+ }, z.core.$strict>, z.ZodObject<{
33
+ from: z.ZodString;
34
+ to: z.ZodString;
35
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>]>>;
@@ -0,0 +1,23 @@
1
+ import { grain, name, op, primitive } from "./query.mjs";
2
+ import { z } from "zod";
3
+ // src/schema/picks.ts
4
+ /** One control's pick as a viewer sends it: values with an operator, a date range, or one value. */
5
+ const pick = z.union([
6
+ z.strictObject({
7
+ op,
8
+ values: z.array(primitive).max(100).readonly()
9
+ }),
10
+ z.strictObject({
11
+ last: z.int().min(1).max(1e4),
12
+ unit: grain,
13
+ includeCurrent: z.boolean()
14
+ }),
15
+ z.strictObject({
16
+ from: z.string().max(40),
17
+ to: z.string().max(40)
18
+ }),
19
+ primitive
20
+ ]);
21
+ /** A viewer's picks by control id, as the tile endpoints and a shared link accept them. */
22
+ const picksSchema = z.record(name, pick);
23
+ export { pick, picksSchema };
@@ -2,7 +2,8 @@ import { WireFilter } from "../query/filter.mjs";
2
2
  import { FormulaNode, WireQuery } from "../query/types.mjs";
3
3
  import { Issue } from "../types/primitives.mjs";
4
4
  import { z } from "zod";
5
- export declare const wireQuerySchema: z.ZodObject<{
5
+ /** The query's fields, before its ids are checked against each other; extend this, not the schema. */
6
+ export declare const wireQueryShape: z.ZodObject<{
6
7
  kind: z.ZodLiteral<"aggregate">;
7
8
  source: z.ZodString;
8
9
  measures: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -77,8 +78,88 @@ export declare const wireQuerySchema: z.ZodObject<{
77
78
  other: z.ZodExactOptional<z.ZodBoolean>;
78
79
  total: z.ZodExactOptional<z.ZodBoolean>;
79
80
  fill: z.ZodExactOptional<z.ZodEnum<{
81
+ none: "none";
80
82
  zero: "zero";
83
+ }>>;
84
+ }, z.core.$strict>;
85
+ /** A query from outside: its fields, then each id checked to be its entry's position. */
86
+ export declare const wireQuerySchema: z.ZodObject<{
87
+ kind: z.ZodLiteral<"aggregate">;
88
+ source: z.ZodString;
89
+ measures: z.ZodReadonly<z.ZodArray<z.ZodObject<{
90
+ id: z.ZodTemplateLiteral<`m${number}`>;
91
+ measure: z.ZodString;
92
+ filter: z.ZodExactOptional<z.ZodType<WireFilter, unknown, z.core.$ZodTypeInternals<WireFilter, unknown>>>;
93
+ label: z.ZodExactOptional<z.ZodString>;
94
+ }, z.core.$strict>>>;
95
+ dimensions: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
96
+ id: z.ZodTemplateLiteral<`d${number}`>;
97
+ member: z.ZodString;
98
+ limit: z.ZodExactOptional<z.ZodNumber>;
99
+ other: z.ZodExactOptional<z.ZodBoolean>;
100
+ rankBy: z.ZodExactOptional<z.ZodObject<{
101
+ by: z.ZodUnion<readonly [z.ZodTemplateLiteral<`m${number}`>, z.ZodTemplateLiteral<`c${number}`>]>;
102
+ dir: z.ZodEnum<{
103
+ asc: "asc";
104
+ desc: "desc";
105
+ }>;
106
+ }, z.core.$strict>>;
107
+ }, z.core.$strict>>>>;
108
+ time: z.ZodExactOptional<z.ZodObject<{
109
+ dimension: z.ZodString;
110
+ grain: z.ZodExactOptional<z.ZodEnum<{
111
+ hour: "hour";
112
+ day: "day";
113
+ week: "week";
114
+ month: "month";
115
+ quarter: "quarter";
116
+ year: "year";
117
+ }>>;
118
+ range: z.ZodUnion<readonly [z.ZodObject<{
119
+ last: z.ZodNumber;
120
+ unit: z.ZodEnum<{
121
+ hour: "hour";
122
+ day: "day";
123
+ week: "week";
124
+ month: "month";
125
+ quarter: "quarter";
126
+ year: "year";
127
+ }>;
128
+ includeCurrent: z.ZodBoolean;
129
+ }, z.core.$strict>, z.ZodObject<{
130
+ from: z.ZodString;
131
+ to: z.ZodString;
132
+ }, z.core.$strict>]>;
133
+ compare: z.ZodExactOptional<z.ZodEnum<{
134
+ previous_period: "previous_period";
135
+ previous_year: "previous_year";
136
+ }>>;
137
+ }, z.core.$strict>>;
138
+ filters: z.ZodExactOptional<z.ZodType<WireFilter, unknown, z.core.$ZodTypeInternals<WireFilter, unknown>>>;
139
+ calc: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
140
+ id: z.ZodTemplateLiteral<`c${number}`>;
141
+ formula: z.ZodType<FormulaNode, unknown, z.core.$ZodTypeInternals<FormulaNode, unknown>>;
142
+ format: z.ZodExactOptional<z.ZodEnum<{
143
+ number: "number";
144
+ percent: "percent";
145
+ currency: "currency";
146
+ duration: "duration";
147
+ }>>;
148
+ label: z.ZodExactOptional<z.ZodString>;
149
+ }, z.core.$strict>>>>;
150
+ order: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
151
+ by: z.ZodUnion<readonly [z.ZodTemplateLiteral<`m${number}`>, z.ZodTemplateLiteral<`c${number}`>, z.ZodTemplateLiteral<`d${number}`>]>;
152
+ dir: z.ZodEnum<{
153
+ asc: "asc";
154
+ desc: "desc";
155
+ }>;
156
+ }, z.core.$strict>>>>;
157
+ limit: z.ZodExactOptional<z.ZodNumber>;
158
+ other: z.ZodExactOptional<z.ZodBoolean>;
159
+ total: z.ZodExactOptional<z.ZodBoolean>;
160
+ fill: z.ZodExactOptional<z.ZodEnum<{
81
161
  none: "none";
162
+ zero: "zero";
82
163
  }>>;
83
164
  }, z.core.$strict>;
84
165
  export type ParsedQuery = {
@@ -1,5 +1,6 @@
1
1
  import { NEGATIVE_OPS, NULL_OPS, POSITIVE_OPS } from "../query/filter.mjs";
2
2
  import { parseDate, parseTextTime } from "../time/instant.mjs";
3
+ import { checkPositions } from "./aliases.mjs";
3
4
  import { z } from "zod";
4
5
  // src/schema/query.ts
5
6
  /**
@@ -61,9 +62,9 @@ const filter = z.lazy(() => z.union([
61
62
  where: filter
62
63
  }) })
63
64
  ]));
64
- const measureAlias = z.templateLiteral(["m", z.number().int().nonnegative()], { error: "A measure's id in a query is m and a number: m0, m1." });
65
- const dimensionAlias = z.templateLiteral(["d", z.number().int().nonnegative()], { error: "A dimension's id in a query is d and a number: d0, d1." });
66
- const calcAlias = z.templateLiteral(["c", z.number().int().nonnegative()], { error: "A calculation's id in a query is c and a number: c0, c1." });
65
+ const measureAlias = z.templateLiteral(["m", z.number().int().nonnegative()], { error: "A measure's id in a query is m and a number: m1, m2." });
66
+ const dimensionAlias = z.templateLiteral(["d", z.number().int().nonnegative()], { error: "A dimension's id in a query is d and a number: d1, d2." });
67
+ const calcAlias = z.templateLiteral(["c", z.number().int().nonnegative()], { error: "A calculation's id in a query is c and a number: c1, c2." });
67
68
  const formula = z.lazy(() => z.union([
68
69
  z.strictObject({
69
70
  ref: z.union([measureAlias, calcAlias]),
@@ -105,7 +106,8 @@ const range = z.union([z.strictObject({
105
106
  from: rangeEnd,
106
107
  to: rangeEnd
107
108
  })]);
108
- const wireQuerySchema = z.strictObject({
109
+ /** The query's fields, before its ids are checked against each other; extend this, not the schema. */
110
+ const wireQueryShape = z.strictObject({
109
111
  kind: z.literal("aggregate"),
110
112
  source: name,
111
113
  measures: z.array(z.strictObject({
@@ -155,6 +157,8 @@ const wireQuerySchema = z.strictObject({
155
157
  total: z.boolean().exactOptional(),
156
158
  fill: z.enum(["zero", "none"]).exactOptional()
157
159
  });
160
+ /** A query from outside: its fields, then each id checked to be its entry's position. */
161
+ const wireQuerySchema = wireQueryShape.superRefine(checkPositions);
158
162
  /** Checks an untrusted query. Every problem is reported, with the path to it. */
159
163
  function parseWireQuery(input) {
160
164
  const result = wireQuerySchema.safeParse(input);
@@ -171,4 +175,4 @@ function parseWireQuery(input) {
171
175
  }))
172
176
  };
173
177
  }
174
- export { grain, idSchema, name, op, parseWireQuery, primitive, range, viewerRef, wireQuerySchema };
178
+ export { grain, idSchema, name, op, parseWireQuery, primitive, range, viewerRef, wireQuerySchema, wireQueryShape };
@@ -1,6 +1,6 @@
1
1
  import { commandSchema } from "./commands.mjs";
2
+ import { picksSchema } from "./picks.mjs";
2
3
  import { wireQuerySchema } from "./query.mjs";
3
- import { picksSchema } from "./view.mjs";
4
4
  import { z } from "zod";
5
5
  // src/schema/tools.ts
6
6
  /**
@@ -1,39 +1,4 @@
1
1
  import { ViewState } from "../document/view.mjs";
2
- import { z } from "zod";
3
- /** A viewer's picks by control id, as the tile endpoints and a shared link accept them. */
4
- export declare const picksSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
5
- op: z.ZodEnum<{
6
- equals: "equals";
7
- in: "in";
8
- contains: "contains";
9
- startsWith: "startsWith";
10
- gt: "gt";
11
- gte: "gte";
12
- lt: "lt";
13
- lte: "lte";
14
- between: "between";
15
- notEquals: "notEquals";
16
- notIn: "notIn";
17
- notContains: "notContains";
18
- set: "set";
19
- notSet: "notSet";
20
- }>;
21
- values: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
22
- }, z.core.$strict>, z.ZodObject<{
23
- last: z.ZodInt;
24
- unit: z.ZodEnum<{
25
- hour: "hour";
26
- day: "day";
27
- week: "week";
28
- month: "month";
29
- quarter: "quarter";
30
- year: "year";
31
- }>;
32
- includeCurrent: z.ZodBoolean;
33
- }, z.core.$strict>, z.ZodObject<{
34
- from: z.ZodString;
35
- to: z.ZodString;
36
- }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>]>>;
37
2
  /**
38
3
  * A view read back from URL search parameters (`encodeView` wrote them): each pick checked as
39
4
  * the tile endpoints check one, and a parameter that is not a view's left out and named in
@@ -1,26 +1,8 @@
1
1
  import { VIEW_KEYS } from "../document/view.mjs";
2
- import { grain, name, op, primitive } from "./query.mjs";
3
- import { z } from "zod";
2
+ import { drillStateSchema } from "./drill.mjs";
3
+ import { pick } from "./picks.mjs";
4
+ import { name } from "./query.mjs";
4
5
  // src/schema/view.ts
5
- /** One control's pick as a viewer sends it: values with an operator, a date range, or one value. */
6
- const pick = z.union([
7
- z.strictObject({
8
- op,
9
- values: z.array(primitive).max(100).readonly()
10
- }),
11
- z.strictObject({
12
- last: z.int().min(1).max(1e4),
13
- unit: grain,
14
- includeCurrent: z.boolean()
15
- }),
16
- z.strictObject({
17
- from: z.string().max(40),
18
- to: z.string().max(40)
19
- }),
20
- primitive
21
- ]);
22
- /** A viewer's picks by control id, as the tile endpoints and a shared link accept them. */
23
- const picksSchema = z.record(name, pick);
24
6
  /** A pick from its JSON, or null when it is not JSON or not a pick. */
25
7
  function readPick(text) {
26
8
  try {
@@ -30,9 +12,19 @@ function readPick(text) {
30
12
  return null;
31
13
  }
32
14
  }
33
- /** One parameter of a view: a tab, a pick, or something that is neither. */
15
+ /** A drill from its JSON, or null when it is not one. */
16
+ function readDrill(text) {
17
+ try {
18
+ const parsed = drillStateSchema.safeParse(JSON.parse(text));
19
+ return parsed.success ? { drill: parsed.data } : null;
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ /** One parameter of a view: a tab, a pick, a drill, or something that is neither. */
34
25
  function readParam(rest, text) {
35
26
  if (rest === VIEW_KEYS.tab) return { tab: text };
27
+ if (rest === VIEW_KEYS.drill) return readDrill(text);
36
28
  const id = rest.startsWith(VIEW_KEYS.filter) ? rest.slice(VIEW_KEYS.filter.length) : "";
37
29
  const read = readPick(text);
38
30
  if (!name.safeParse(id).success || read === null) return null;
@@ -52,20 +44,23 @@ function decodeView(params, prefix = "dd.") {
52
44
  const picks = {};
53
45
  const dropped = [];
54
46
  let tab;
47
+ let drill;
55
48
  for (const [key, text] of params) {
56
49
  if (!key.startsWith(prefix)) continue;
57
50
  const rest = key.slice(prefix.length);
58
51
  const read = readParam(rest, text);
59
52
  if (read === null) dropped.push(rest.startsWith(VIEW_KEYS.filter) ? rest.slice(VIEW_KEYS.filter.length) : rest);
60
53
  else if ("tab" in read) tab = read.tab;
54
+ else if ("drill" in read) drill = read.drill;
61
55
  else picks[read.pick.id] = read.pick.value;
62
56
  }
63
57
  return {
64
58
  view: {
65
59
  ...tab === void 0 ? {} : { tab },
66
- picks
60
+ picks,
61
+ drill
67
62
  },
68
63
  dropped
69
64
  };
70
65
  }
71
- export { decodeView, picksSchema };
66
+ export { decodeView };
@@ -242,6 +242,11 @@ export declare const TABLES: {
242
242
  readonly name: "dd_dashboard_draft_author";
243
243
  readonly fields: readonly ["dashboard_id", "author_kind", "author_id"];
244
244
  }];
245
+ /** A person's open drafts in their tenant, for the dashboard list, without a scan of every tenant's. */
246
+ readonly indexes: readonly [{
247
+ readonly name: "dd_dashboard_draft_open";
248
+ readonly fields: readonly ["tenant_hash", "author_kind", "author_id", "state"];
249
+ }];
245
250
  };
246
251
  /**
247
252
  * The commands a draft applied, in order, with their bodies: a retry is acknowledged and
@@ -140,6 +140,16 @@ const TABLES = {
140
140
  "author_kind",
141
141
  "author_id"
142
142
  ]
143
+ }],
144
+ /** A person's open drafts in their tenant, for the dashboard list, without a scan of every tenant's. */
145
+ indexes: [{
146
+ name: "dd_dashboard_draft_open",
147
+ fields: [
148
+ "tenant_hash",
149
+ "author_kind",
150
+ "author_id",
151
+ "state"
152
+ ]
143
153
  }]
144
154
  },
145
155
  /**
@@ -1,6 +1,7 @@
1
1
  import { Command, CommandBody, Doc } from "../document/types.mjs";
2
2
  import { Cell, Picks, WireQuery } from "../query/types.mjs";
3
3
  import { RecordColumn, Result } from "../result/types.mjs";
4
+ import { AnswerDrill, DrillAnswer, DrillBody } from "./drill-api.mjs";
4
5
  import { Issue, Primitive } from "./primitives.mjs";
5
6
  import { Draft, Preview, Published, VersionEntry } from "./store.mjs";
6
7
  /** The HTTP contract between the handler and its clients. */
@@ -18,6 +19,10 @@ export type MetaMember = {
18
19
  /** On a measure: how it aggregates ("count", "sum", "ratio" and so on) and its unit. */
19
20
  aggregate?: string;
20
21
  unit?: string;
22
+ /** On a dimension: the tone of each value, from the model's hints. */
23
+ tones?: Readonly<Record<string, "positive" | "negative" | "warning" | "neutral">>;
24
+ /** On a number dimension: its bucket edges, ascending, from the model's hints. */
25
+ buckets?: readonly number[];
21
26
  };
22
27
  /** A join a query can group by: `<source>.<join>.<dimension>` names a dimension of `source`. */
23
28
  export type MetaJoin = {
@@ -40,6 +45,8 @@ export type DashboardListResponse = {
40
45
  dashboards: {
41
46
  id: string;
42
47
  title: string;
48
+ /** What the dashboard shows, in a sentence, when it has one. */
49
+ description?: string;
43
50
  version: number;
44
51
  unpublished?: true;
45
52
  }[];
@@ -83,6 +90,7 @@ export type RecordsResponse = {
83
90
  /** A free query's answer. */
84
91
  export type QueryAnswer = Result & {
85
92
  unreadable?: true;
93
+ drill?: AnswerDrill;
86
94
  };
87
95
  /** One line of the `/query/batch` stream, as `/dashboards/tiles` streams tiles. */
88
96
  export type QueryLine = {
@@ -124,6 +132,8 @@ export type TileAnswer = Result & {
124
132
  widgetId: string;
125
133
  /** The viewer can read no row of this tile's source. */
126
134
  unreadable?: true;
135
+ /** What a click on a row sends to drill into it; absent where drilling is off. */
136
+ drill?: AnswerDrill;
127
137
  };
128
138
  /** One tile's answer, or why it was refused; the other tiles still answer. */
129
139
  export type TileResult = TileAnswer | {
@@ -209,12 +219,22 @@ export type CoreContract = {
209
219
  };
210
220
  answer: RecordsResponse;
211
221
  };
222
+ /** The rows behind a mark of a tile: broken down, over time, or as its items. */
223
+ "/dashboards/drill": {
224
+ body: DrillBody;
225
+ answer: DrillAnswer;
226
+ };
212
227
  "/query/run": {
213
228
  body: {
214
229
  query: WireQuery;
215
230
  };
216
231
  answer: QueryAnswer;
217
232
  };
233
+ /** The rows behind a mark of a free query, as `/dashboards/drill`. */
234
+ "/query/drill": {
235
+ body: DrillBody;
236
+ answer: DrillAnswer;
237
+ };
218
238
  "/dashboards/draft/start": {
219
239
  body: {
220
240
  dashboardId: string;
@@ -324,4 +344,4 @@ export type CoreContract = {
324
344
  * than reading a shape it does not know. A test recomputes it from the answer schemas, so a
325
345
  * change to an answer fails until this is updated.
326
346
  */
327
- export declare const CONTRACT_VERSION = "591ad19bc9615e38";
347
+ export declare const CONTRACT_VERSION = "f999ff7ebd6624b2";
@@ -5,5 +5,5 @@
5
5
  * than reading a shape it does not know. A test recomputes it from the answer schemas, so a
6
6
  * change to an answer fails until this is updated.
7
7
  */
8
- const CONTRACT_VERSION = "591ad19bc9615e38";
8
+ const CONTRACT_VERSION = "f999ff7ebd6624b2";
9
9
  export { CONTRACT_VERSION };