@malloy-publisher/sdk 0.12.0 → 0.12.2

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 (214) hide show
  1. package/README.md +79 -6
  2. package/dist/{RenderedResult-SgDlxzs9.cjs.js → RenderedResult-Cgw4iqev.cjs.js} +1 -1
  3. package/dist/{RenderedResult-D8bCgThO.es.js → RenderedResult-DEjFM1DL.es.js} +2 -2
  4. package/dist/ServerProvider-BRQl_cBo.cjs.js +1 -0
  5. package/dist/{ServerProvider-DBw-thY0.es.js → ServerProvider-RnliA2Ao.es.js} +1084 -723
  6. package/dist/builder/index.cjs.js +1 -1
  7. package/dist/builder/index.es.js +3 -3
  8. package/dist/client/api.d.ts +754 -41
  9. package/dist/client/index.cjs.js +1 -1
  10. package/dist/client/index.es.js +120 -110
  11. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +16 -1
  12. package/dist/components/Model/ExplorerPage.d.ts +9 -0
  13. package/dist/components/Model/Model.d.ts +27 -11
  14. package/dist/components/ModelViewer/AccessChips.d.ts +34 -0
  15. package/dist/components/ModelViewer/EmptyRow.d.ts +23 -0
  16. package/dist/components/ModelViewer/Facts.d.ts +15 -0
  17. package/dist/components/ModelViewer/FieldGroup.d.ts +31 -0
  18. package/dist/components/ModelViewer/FieldRow.d.ts +69 -0
  19. package/dist/components/ModelViewer/GivenFacts.d.ts +21 -0
  20. package/dist/components/ModelViewer/HeaderBar.d.ts +75 -0
  21. package/dist/components/ModelViewer/InlineDoc.d.ts +13 -0
  22. package/dist/components/ModelViewer/ModelGivensSection.d.ts +32 -0
  23. package/dist/components/ModelViewer/ModelSection.d.ts +21 -0
  24. package/dist/components/ModelViewer/ModelViewer.d.ts +91 -0
  25. package/dist/components/ModelViewer/QueriesGroup.d.ts +15 -0
  26. package/dist/components/ModelViewer/RowGlyph.d.ts +27 -0
  27. package/dist/components/ModelViewer/RunResult.d.ts +46 -0
  28. package/dist/components/ModelViewer/SampleValues.d.ts +20 -0
  29. package/dist/components/ModelViewer/SchemaJoin.d.ts +51 -0
  30. package/dist/components/ModelViewer/SchemaView.d.ts +52 -0
  31. package/dist/components/ModelViewer/SegmentIcons.d.ts +70 -0
  32. package/dist/components/ModelViewer/SourcesDropdown.d.ts +53 -0
  33. package/dist/components/ModelViewer/SourcesNav.d.ts +25 -0
  34. package/dist/components/ModelViewer/StatusPill.d.ts +56 -0
  35. package/dist/components/ModelViewer/ValueChip.d.ts +17 -0
  36. package/dist/components/ModelViewer/ViewRow.d.ts +36 -0
  37. package/dist/components/ModelViewer/clickableBox.d.ts +29 -0
  38. package/dist/components/ModelViewer/codeDisplay.d.ts +44 -0
  39. package/dist/components/ModelViewer/docAnnotations.d.ts +90 -0
  40. package/dist/components/ModelViewer/explorerModel.d.ts +12 -0
  41. package/dist/components/ModelViewer/extensions.d.ts +94 -0
  42. package/dist/components/ModelViewer/fieldCode.d.ts +74 -0
  43. package/dist/components/ModelViewer/fieldEntities.d.ts +45 -0
  44. package/dist/components/ModelViewer/fieldExpansion.d.ts +41 -0
  45. package/dist/components/ModelViewer/givenUsage.d.ts +71 -0
  46. package/dist/components/ModelViewer/headerCard.d.ts +31 -0
  47. package/dist/components/ModelViewer/httpStatus.d.ts +4 -0
  48. package/dist/components/ModelViewer/icons.d.ts +31 -0
  49. package/dist/components/ModelViewer/index.d.ts +9 -0
  50. package/dist/components/ModelViewer/joinAccess.d.ts +52 -0
  51. package/dist/components/ModelViewer/malloyRunText.d.ts +22 -0
  52. package/dist/components/ModelViewer/malloyText.d.ts +21 -0
  53. package/dist/components/ModelViewer/modelGivens.d.ts +61 -0
  54. package/dist/components/ModelViewer/modelGivensContext.d.ts +9 -0
  55. package/dist/components/ModelViewer/modelHeaderPresentation.d.ts +28 -0
  56. package/dist/components/ModelViewer/modelTextDeclarations.d.ts +32 -0
  57. package/dist/components/ModelViewer/modelTextParse.d.ts +27 -0
  58. package/dist/components/ModelViewer/namedQueryCode.d.ts +12 -0
  59. package/dist/components/ModelViewer/offSurface.d.ts +54 -0
  60. package/dist/components/ModelViewer/rowLayers.d.ts +30 -0
  61. package/dist/components/ModelViewer/runGate.d.ts +49 -0
  62. package/dist/components/ModelViewer/schemaModel.d.ts +109 -0
  63. package/dist/components/ModelViewer/sectionOpenCommand.d.ts +45 -0
  64. package/dist/components/ModelViewer/sourceAccess.d.ts +67 -0
  65. package/dist/components/ModelViewer/sourceLineage.d.ts +14 -0
  66. package/dist/components/ModelViewer/sourcePicker.d.ts +66 -0
  67. package/dist/components/ModelViewer/surface.d.ts +47 -0
  68. package/dist/components/ModelViewer/text.d.ts +6 -0
  69. package/dist/components/ModelViewer/theme.d.ts +63 -0
  70. package/dist/components/ModelViewer/tokens.d.ts +52 -0
  71. package/dist/components/ModelViewer/ui.d.ts +48 -0
  72. package/dist/components/ModelViewer/useDimensionSamples.d.ts +76 -0
  73. package/dist/components/ModelViewer/useModelSources.d.ts +92 -0
  74. package/dist/components/ModelViewer/useRunQuery.d.ts +115 -0
  75. package/dist/components/ReportBuilder/loadMalloy.d.ts +4 -0
  76. package/dist/components/ServerProvider.d.ts +17 -2
  77. package/dist/components/filter/utils.d.ts +1 -1
  78. package/dist/components/given/GivenInput.d.ts +7 -1
  79. package/dist/components/given/GivensPanel.d.ts +3 -1
  80. package/dist/components/given/filterSummary.d.ts +6 -0
  81. package/dist/components/given/useGivenUrlParams.d.ts +11 -0
  82. package/dist/components/index.d.ts +2 -1
  83. package/dist/components/modelPage.d.ts +36 -0
  84. package/dist/hooks/useDimensionalFilterRangeData.d.ts +9 -0
  85. package/dist/hooks/useSuggestOptions.d.ts +26 -2
  86. package/dist/index.cjs.js +47 -19
  87. package/dist/index.es.js +14137 -9697
  88. package/dist/useCompiledDocument-D88_2cGS.cjs.js +143 -0
  89. package/dist/{useCompiledDocument-CXMPtJkJ.es.js → useCompiledDocument-Dmm6xkom.es.js} +6975 -6893
  90. package/dist/utils/filterCondition.d.ts +14 -0
  91. package/dist/utils/malloyLiteral.d.ts +20 -1
  92. package/package.json +2 -2
  93. package/src/components/Materializations/MaterializationDetailDialog.tsx +33 -7
  94. package/src/components/Materializations/Materializations.tsx +47 -4
  95. package/src/components/Materializations/Materializations.versions.spec.tsx +140 -1
  96. package/src/components/Model/ExplorerPage.tsx +269 -0
  97. package/src/components/Model/Model.tsx +66 -250
  98. package/src/components/Model/ModelExplorer.spec.tsx +64 -1
  99. package/src/components/ModelViewer/AccessChips.tsx +149 -0
  100. package/src/components/ModelViewer/EmptyRow.tsx +71 -0
  101. package/src/components/ModelViewer/Facts.tsx +46 -0
  102. package/src/components/ModelViewer/FieldGroup.tsx +137 -0
  103. package/src/components/ModelViewer/FieldRow.tsx +566 -0
  104. package/src/components/ModelViewer/GivenFacts.tsx +89 -0
  105. package/src/components/ModelViewer/HeaderBar.tsx +362 -0
  106. package/src/components/ModelViewer/InlineDoc.tsx +50 -0
  107. package/src/components/ModelViewer/ModelGivensSection.tsx +142 -0
  108. package/src/components/ModelViewer/ModelSection.tsx +98 -0
  109. package/src/components/ModelViewer/ModelViewer.spec.tsx +937 -0
  110. package/src/components/ModelViewer/ModelViewer.tsx +777 -0
  111. package/src/components/ModelViewer/QueriesGroup.tsx +107 -0
  112. package/src/components/ModelViewer/RowGlyph.tsx +138 -0
  113. package/src/components/ModelViewer/RunResult.tsx +298 -0
  114. package/src/components/ModelViewer/SampleValues.tsx +97 -0
  115. package/src/components/ModelViewer/SchemaJoin.tsx +258 -0
  116. package/src/components/ModelViewer/SchemaView.tsx +222 -0
  117. package/src/components/ModelViewer/SegmentIcons.tsx +129 -0
  118. package/src/components/ModelViewer/SourcesDropdown.tsx +265 -0
  119. package/src/components/ModelViewer/SourcesNav.tsx +75 -0
  120. package/src/components/ModelViewer/StatusPill.tsx +145 -0
  121. package/src/components/ModelViewer/ValueChip.tsx +39 -0
  122. package/src/components/ModelViewer/ViewRow.tsx +274 -0
  123. package/src/components/ModelViewer/clickableBox.ts +59 -0
  124. package/src/components/ModelViewer/codeDisplay.spec.ts +176 -0
  125. package/src/components/ModelViewer/codeDisplay.ts +118 -0
  126. package/src/components/ModelViewer/docAnnotations.spec.ts +181 -0
  127. package/src/components/ModelViewer/docAnnotations.ts +244 -0
  128. package/src/components/ModelViewer/docAnnotations.typeDetail.spec.ts +114 -0
  129. package/src/components/ModelViewer/explorerModel.spec.ts +43 -0
  130. package/src/components/ModelViewer/explorerModel.ts +31 -0
  131. package/src/components/ModelViewer/extensions.tsx +112 -0
  132. package/src/components/ModelViewer/fieldCode.spec.ts +168 -0
  133. package/src/components/ModelViewer/fieldCode.ts +118 -0
  134. package/src/components/ModelViewer/fieldEntities.ts +63 -0
  135. package/src/components/ModelViewer/fieldExpansion.spec.ts +116 -0
  136. package/src/components/ModelViewer/fieldExpansion.ts +95 -0
  137. package/src/components/ModelViewer/givenUsage.spec.ts +304 -0
  138. package/src/components/ModelViewer/givenUsage.ts +325 -0
  139. package/src/components/ModelViewer/headerCard.tsx +102 -0
  140. package/src/components/ModelViewer/httpStatus.ts +15 -0
  141. package/src/components/ModelViewer/icons.tsx +67 -0
  142. package/src/components/ModelViewer/index.ts +26 -0
  143. package/src/components/ModelViewer/joinAccess.spec.ts +95 -0
  144. package/src/components/ModelViewer/joinAccess.ts +54 -0
  145. package/src/components/ModelViewer/malloyRunText.spec.ts +48 -0
  146. package/src/components/ModelViewer/malloyRunText.ts +51 -0
  147. package/src/components/ModelViewer/malloyText.spec.ts +47 -0
  148. package/src/components/ModelViewer/malloyText.ts +77 -0
  149. package/src/components/ModelViewer/modelGivens.ts +228 -0
  150. package/src/components/ModelViewer/modelGivensContext.ts +13 -0
  151. package/src/components/ModelViewer/modelHeaderPresentation.spec.ts +31 -0
  152. package/src/components/ModelViewer/modelHeaderPresentation.ts +41 -0
  153. package/src/components/ModelViewer/modelTextDeclarations.spec.ts +336 -0
  154. package/src/components/ModelViewer/modelTextDeclarations.ts +228 -0
  155. package/src/components/ModelViewer/modelTextParse.ts +112 -0
  156. package/src/components/ModelViewer/namedQueryCode.spec.ts +58 -0
  157. package/src/components/ModelViewer/namedQueryCode.ts +26 -0
  158. package/src/components/ModelViewer/offSurface.tsx +124 -0
  159. package/src/components/ModelViewer/rowLayers.tsx +104 -0
  160. package/src/components/ModelViewer/runGate.spec.ts +219 -0
  161. package/src/components/ModelViewer/runGate.ts +145 -0
  162. package/src/components/ModelViewer/schemaModel.defaultSource.spec.ts +126 -0
  163. package/src/components/ModelViewer/schemaModel.queries.spec.ts +37 -0
  164. package/src/components/ModelViewer/schemaModel.ts +300 -0
  165. package/src/components/ModelViewer/sectionOpenCommand.tsx +125 -0
  166. package/src/components/ModelViewer/sourceAccess.spec.ts +130 -0
  167. package/src/components/ModelViewer/sourceAccess.ts +194 -0
  168. package/src/components/ModelViewer/sourceLineage.spec.ts +73 -0
  169. package/src/components/ModelViewer/sourceLineage.ts +38 -0
  170. package/src/components/ModelViewer/sourcePicker.spec.ts +294 -0
  171. package/src/components/ModelViewer/sourcePicker.ts +162 -0
  172. package/src/components/ModelViewer/surface.ts +51 -0
  173. package/src/components/ModelViewer/text.tsx +33 -0
  174. package/src/components/ModelViewer/theme.spec.ts +38 -0
  175. package/src/components/ModelViewer/theme.ts +58 -0
  176. package/src/components/ModelViewer/tokens.ts +87 -0
  177. package/src/components/ModelViewer/ui.tsx +201 -0
  178. package/src/components/ModelViewer/useDimensionSamples.spec.tsx +139 -0
  179. package/src/components/ModelViewer/useDimensionSamples.ts +220 -0
  180. package/src/components/ModelViewer/useModelSources.spec.ts +110 -0
  181. package/src/components/ModelViewer/useModelSources.ts +238 -0
  182. package/src/components/ModelViewer/useRunQuery.spec.ts +50 -0
  183. package/src/components/ModelViewer/useRunQuery.ts +223 -0
  184. package/src/components/Package/Package.agents.spec.tsx +5 -4
  185. package/src/components/Package/Package.tsx +8 -1
  186. package/src/components/ReportBuilder/emptyStart.spec.ts +8 -0
  187. package/src/components/ReportBuilder/loadMalloy.ts +8 -1
  188. package/src/components/ServerProvider.tsx +29 -3
  189. package/src/components/filter/utils.ts +4 -60
  190. package/src/components/given/FilterButton.tsx +4 -1
  191. package/src/components/given/GivenInput.tsx +8 -0
  192. package/src/components/given/GivensPanel.tsx +6 -1
  193. package/src/components/given/filterSummary.spec.ts +31 -1
  194. package/src/components/given/filterSummary.ts +41 -19
  195. package/src/components/given/useGivenUrlParams.spec.tsx +32 -0
  196. package/src/components/given/useGivenUrlParams.ts +49 -14
  197. package/src/components/index.ts +6 -1
  198. package/src/components/legacy/malloynb/Notebook.spec.tsx +38 -4
  199. package/src/components/legacy/malloynb/NotebookCell.tsx +8 -2
  200. package/src/components/modelPage.spec.ts +79 -0
  201. package/src/components/modelPage.ts +48 -0
  202. package/src/hooks/useDimensionFilters.ts +3 -58
  203. package/src/hooks/useDimensionFiltersQuery.ts +3 -58
  204. package/src/hooks/useDimensionalFilterRangeData.spec.ts +57 -0
  205. package/src/hooks/useDimensionalFilterRangeData.ts +8 -63
  206. package/src/hooks/useSuggestOptions.dom.spec.ts +54 -1
  207. package/src/hooks/useSuggestOptions.spec.ts +71 -0
  208. package/src/hooks/useSuggestOptions.ts +102 -12
  209. package/src/utils/filterCondition.spec.ts +87 -0
  210. package/src/utils/filterCondition.ts +66 -0
  211. package/src/utils/malloyLiteral.spec.ts +53 -1
  212. package/src/utils/malloyLiteral.ts +47 -12
  213. package/dist/ServerProvider-BHfg1Ed6.cjs.js +0 -1
  214. package/dist/useCompiledDocument-D7X_K6YU.cjs.js +0 -142
@@ -0,0 +1,67 @@
1
+ /**
2
+ * What a source's access declarations say, read from the compiled model's
3
+ * `sources[]` (the publisher's `Source.authorize` and `Source.accessFilter`).
4
+ *
5
+ * Both lists are the RULE, never a verdict about the reader: the publisher is
6
+ * the only authority on whether a caller passes, and its docs forbid
7
+ * re-deriving that from these strings. So everything here answers "is this
8
+ * source restricted / row filtered, and what does the rule say", and nothing
9
+ * answers "can you query it".
10
+ */
11
+ export interface SourceAccess {
12
+ /** Effective `#(authorize)` expressions (own and inherited), AND-ed. */
13
+ authorize: string[];
14
+ /** Effective `#(access_filter)` expressions, AND-ed. */
15
+ accessFilter: string[];
16
+ }
17
+ /**
18
+ * Source name → its access declarations, for every source the compiled model
19
+ * lists. Shape-checked: through the router an older publisher sends neither
20
+ * field (or `null`), which reads as no declaration.
21
+ */
22
+ export declare function extractSourceAccess(body: unknown): Map<string, SourceAccess>;
23
+ /** The declarations of one source, or none. */
24
+ export declare function accessOf(bySource: ReadonlyMap<string, SourceAccess> | undefined, sourceName: string | undefined): SourceAccess;
25
+ /**
26
+ * Whether an `#(authorize)` rule locks the source. Read element-wise, as the
27
+ * publisher documents: the list is unlocked only when every element is the
28
+ * `"true"` sentinel (gates from different declaring sources AND together, so
29
+ * `["true", "'finance' in $GROUPS"]` is locked).
30
+ */
31
+ export declare function isRestricted(access: SourceAccess | undefined): boolean;
32
+ /** Whether an `#(access_filter)` scopes the source's rows per reader. */
33
+ export declare function isRowFiltered(access: SourceAccess | undefined): boolean;
34
+ /**
35
+ * Who the `#(authorize)` rule admits, in plain words: "members of finance".
36
+ * Several rules all apply, so they are joined with "and"; a rule this cannot
37
+ * say becomes "readers its access rule admits" rather than a guess.
38
+ */
39
+ export declare function restrictedToWords(access: SourceAccess): string;
40
+ /** What a Restricted chip's tooltip and accessible name say. */
41
+ export declare const RESTRICTED_MEANING = "Only some readers can query this source";
42
+ /** What a Row filtered chip's tooltip and accessible name say. */
43
+ export declare const ROW_FILTERED_MEANING = "Each reader sees only the rows they're allowed to see";
44
+ /**
45
+ * What a refused (403) run says: that the reader can't access the source, a
46
+ * restricted source's rule in words, and the way out — never a status code, and
47
+ * no Retry, since a second attempt meets the same rule. A 403 on a source with no
48
+ * rule this page knows (a package-level refusal, a rule the compiled model did
49
+ * not report) still says so in the same words.
50
+ */
51
+ export declare function refusalMessage(sourceName: string | undefined, access: SourceAccess): string;
52
+ /**
53
+ * The caption under an empty result on a row-filtered source: an access filter
54
+ * that admits none of a reader's rows answers 200 with zero rows, which reads as
55
+ * "there is no data" unless the page says why. Only for zero rows: an ungrouped
56
+ * aggregate over nothing returns one row (`count()` = 0), which the caption
57
+ * cannot tell from a real zero, so it says nothing there.
58
+ */
59
+ export declare function filteredEmptyCaption(access: SourceAccess, result: string | undefined): string | undefined;
60
+ /** Whether the source declares either rule, so there is something to show. */
61
+ export declare function hasAccessRules(access: SourceAccess | undefined): boolean;
62
+ /**
63
+ * What an editor is told on an open join to a gated source: a gate applies only
64
+ * on the source a query enters through, so through this join the joined
65
+ * source's rows are read under this source's rules, not its own.
66
+ */
67
+ export declare function joinGateWarning(sourceName: string, access: SourceAccess): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The immediate upstream SOURCE a derived source is built from, parsed from the
3
+ * model's own Malloy text — e.g. `raw_orders` for
4
+ * `source: order_rollup is raw_orders -> { … }`.
5
+ *
6
+ * Only a source-to-source derivation resolves. A table-backed source
7
+ * (`is conn.table('…')`, `is conn.sql('…')`) returns undefined — it has
8
+ * physical table provenance the header shows instead — and the parsed base
9
+ * must be one of the model's own sources, so a connection name or SQL slice is
10
+ * never mistaken for lineage. This is a best-effort read of source text: when
11
+ * the text is absent, or the declaration takes a form this doesn't recognise,
12
+ * it yields undefined and the header simply shows no `from`.
13
+ */
14
+ export declare function baseSourceName(sourceText: string | undefined, sourceName: string | undefined, knownSources: ReadonlySet<string>): string | undefined;
@@ -0,0 +1,66 @@
1
+ import { ExplorerSource } from './schemaModel';
2
+ /**
3
+ * The row's meta line: "16 views · 37 fields · 4 joins". The field count is the one the
4
+ * source's own header prints once it is picked (`fieldCount`), so the picker and the page it
5
+ * opens never disagree; joins are left out when there are none.
6
+ */
7
+ export declare function sourceMetaLine(source: ExplorerSource): string;
8
+ /** The picker's sources in the order it lists them, and the one its token marks. */
9
+ export interface PickerOrder {
10
+ sources: ExplorerSource[];
11
+ /** True on the package's root `index.malloy`, on the surface: its sources are the curated
12
+ * set, and the pill counts them as public. */
13
+ curated: boolean;
14
+ /** The curated sources are listed as the file's `export { … }` orders them, so the picker's
15
+ * header may say so. False when the file's text, and so its order, is unknown. */
16
+ exportOrdered: boolean;
17
+ /** The source the model opens on, when it really has the most views — the "Most views"
18
+ * token. Never set when the claim would be false. */
19
+ mostViews?: string;
20
+ }
21
+ /**
22
+ * The order the picker lists a model's sources in.
23
+ *
24
+ * - On the package's root `index.malloy`, when it is on the surface (`publicSurface`), the file
25
+ * IS the author's choice of what to publish, so its sources keep the order it exports them
26
+ * in, when its text says (`inExportOrder`); else the compiled model's, and `exportOrdered`
27
+ * is false so nothing claims an order.
28
+ * - On any other model, declaration order is not a ranking (`pickDefaultSource`), so the
29
+ * source the model opens on comes first and the rest follow by view count, most first;
30
+ * equal counts keep declaration order. A lookup table with no views sinks to the end.
31
+ *
32
+ * `mostViews` names the default only when no other source has more views than it and it has
33
+ * any: `pickDefaultSource` sets aside a source that extends another, so the default can be
34
+ * the base with fewer views than its extension, and the token must not claim otherwise.
35
+ */
36
+ export declare function orderPickerSources(sources: readonly ExplorerSource[], defaultSource: ExplorerSource | null,
37
+ /** Set on the root `index.malloy` on the surface: the names its `export { … }` lists, in
38
+ * order (`exportOrder`), empty when its text is unknown. */
39
+ publicSurface?: {
40
+ exportOrder: readonly string[];
41
+ }): PickerOrder;
42
+ /**
43
+ * The names a model file's `export { … }` statements list, in the order written. The compiled
44
+ * model lists its exports in declaration order (an imported source where the import brings it
45
+ * in), which is not the order an `index.malloy`'s author chose, so the text is read for it.
46
+ * Each item is a bare identifier (Malloy's `exportItem`), backquoted or not; the keyword is
47
+ * matched without case, as Malloy's are, and comments are skipped. Empty when the text is
48
+ * unknown or has no export statement.
49
+ */
50
+ export declare function exportOrder(sourceText: string | undefined): string[];
51
+ /**
52
+ * `items` in the order `order` names them; anything it does not name keeps its place after
53
+ * them, in the order given. Unchanged when `order` is empty.
54
+ */
55
+ export declare function inExportOrder<T>(items: readonly T[], nameOf: (item: T) => string, order: readonly string[]): T[];
56
+ /** A row's description: the author's words, else a host's generated one, marked. */
57
+ export interface PickerDescription {
58
+ text: string;
59
+ /** From the host, not the model's author: the row marks it Generated. */
60
+ generated: boolean;
61
+ }
62
+ /**
63
+ * The row's description: the source's own `#(doc)` when it has one — the author's words win —
64
+ * else a host's summary (`describePickerSource`), marked as generated. Nothing when neither.
65
+ */
66
+ export declare function pickerDescription(doc: string | undefined, summary: string | undefined): PickerDescription | undefined;
@@ -0,0 +1,47 @@
1
+ /** The model viewer's page column and pane geometry. */
2
+ /** The page's reading column. */
3
+ export declare const CONTENT_COLUMN_SX: {
4
+ readonly width: "100%";
5
+ readonly maxWidth: "1200px";
6
+ readonly mx: "auto";
7
+ };
8
+ /** The gap between a page's header and its first line (theme spacing units). */
9
+ export declare const FILE_VIEW_TOP_GAP = 3;
10
+ /** A card's inner inset (theme spacing units). */
11
+ export declare const PANE_INSET = 1.5;
12
+ /**
13
+ * A read-only card: bordered, rounded, on the paper colour. Text's I-beam
14
+ * cursor advertises an edit these cards don't offer, so the default cursor is
15
+ * set once; anything interactive declares `pointer`.
16
+ */
17
+ export declare const PANE_CARD_SX: {
18
+ readonly display: "flex";
19
+ readonly flexDirection: "column";
20
+ readonly minWidth: 0;
21
+ readonly minHeight: 0;
22
+ readonly border: "1px solid";
23
+ readonly borderColor: "divider";
24
+ readonly borderRadius: 2;
25
+ readonly bgcolor: "background.paper";
26
+ readonly overflow: "hidden";
27
+ readonly cursor: "default";
28
+ };
29
+ /** The same pane with no card around it: the page's own surface. */
30
+ export declare const FLAT_PANE_SX: {
31
+ readonly border: "none";
32
+ readonly borderRadius: 0;
33
+ readonly bgcolor: "transparent";
34
+ readonly overflow: "visible";
35
+ readonly display: "flex";
36
+ readonly flexDirection: "column";
37
+ readonly minWidth: 0;
38
+ readonly minHeight: 0;
39
+ readonly borderColor: "divider";
40
+ readonly cursor: "default";
41
+ };
42
+ /** A pane's body, under its header. */
43
+ export declare const PANE_BODY_SX: {
44
+ readonly flex: 1;
45
+ readonly minHeight: 0;
46
+ readonly py: 1;
47
+ };
@@ -0,0 +1,6 @@
1
+ import { TypographyProps } from '@mui/material';
2
+ import { ForwardRefExoticComponent, RefAttributes } from 'react';
3
+ /** Secondary body text: a row's explanation, an empty state's line. */
4
+ export declare const BodyText: ForwardRefExoticComponent<Omit<TypographyProps, "ref"> & RefAttributes<HTMLSpanElement>>;
5
+ /** Caption text: a note under a result, a meta line. */
6
+ export declare const CaptionText: ForwardRefExoticComponent<Omit<TypographyProps, "ref"> & RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The model viewer's type steps and colour roles, in one place so the rows,
3
+ * pills and cards are set from the same few values. Built on the SDK palette.
4
+ *
5
+ * Every neutral is one of MUI's own palette keys (`text.*`, `action.*`), which
6
+ * every theme defines in both modes, never a hex or a key only some hosts add:
7
+ * a fixed light grey was a near-white pill under light text in a dark theme.
8
+ * So each role is for an `sx` colour prop, where MUI resolves it.
9
+ */
10
+ /** The custom property the viewer's root sets from the host's `ui.font.mono`. */
11
+ export declare const MONO_FONT_VAR = "--model-viewer-mono";
12
+ /** The viewer's code face: the host theme's mono face, set on the viewer's root. */
13
+ export declare const MONO_FONT_FAMILY = "var(--model-viewer-mono, \"JetBrains Mono\", \"ui-monospace\", \"SFMono-Regular\", \"Menlo\", monospace)";
14
+ export declare const SANS_FONT_FAMILY = "inherit";
15
+ export declare const fontSizes: {
16
+ /** 11px: the floor, for a pill's text. */
17
+ readonly micro: "0.6875rem";
18
+ /** 12px: secondary row detail. */
19
+ readonly caption: "0.75rem";
20
+ /** 13px: dense rows. */
21
+ readonly small: "0.8125rem";
22
+ /** 14px: body. */
23
+ readonly body: "0.875rem";
24
+ /** 16px: prose meant to be read at length. */
25
+ readonly bodyLarge: "1rem";
26
+ };
27
+ export declare const fontWeights: {
28
+ readonly regular: 400;
29
+ readonly medium: 500;
30
+ readonly strong: 500;
31
+ };
32
+ export declare const roles: {
33
+ readonly text: {
34
+ readonly primary: "text.primary";
35
+ readonly secondary: "text.secondary";
36
+ readonly tertiary: "text.disabled";
37
+ };
38
+ /** A row's hover and a quiet pill's fill, then one step up: a selected row, a pill on a hovered row. */
39
+ readonly background: {
40
+ readonly muted: "action.hover";
41
+ readonly strong: "action.selected";
42
+ };
43
+ readonly accent: {
44
+ readonly sage: {
45
+ tint: string;
46
+ onTint: string;
47
+ };
48
+ };
49
+ readonly warning: {
50
+ tint: string;
51
+ onTint: string;
52
+ };
53
+ readonly error: {
54
+ tint: string;
55
+ onTint: string;
56
+ };
57
+ readonly info: {
58
+ tint: string;
59
+ onTint: string;
60
+ };
61
+ };
62
+ /** Tertiary text: lighter than MUI's `text.secondary`, for a row's least words. */
63
+ export declare const TEXT_TERTIARY: "text.disabled";
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Design tokens for the model viewer: its accents and its type scale, drawn
3
+ * from the SDK's palette so the viewer reads as part of the same Console.
4
+ */
5
+ export declare const ink = "text.primary";
6
+ export type AccentName = "steel" | "sage" | "brown" | "olive" | "amber";
7
+ /** An accent hue: `main` for a fill or glyph, `tint` behind it, `onTint` on top of `tint`. */
8
+ export interface Accent {
9
+ main: string;
10
+ tint: string;
11
+ onTint: string;
12
+ }
13
+ export declare const ACCENT: Record<AccentName, Accent>;
14
+ /**
15
+ * Accent per field kind: steel = dimensions, sage = measures, amber =
16
+ * calculations, olive = views. Joins render brown (see SchemaJoin).
17
+ */
18
+ export declare function kindAccent(kind: "dimension" | "measure" | "calculate" | "view"): Accent;
19
+ export declare function sourceAccentName(index: number): AccentName;
20
+ /** The type scale the rows are set in. */
21
+ export declare const FONT_SIZE: {
22
+ readonly body: 14;
23
+ readonly small: 13;
24
+ readonly caption: 12;
25
+ };
26
+ /**
27
+ * The identifier style for a CONTAINER row (a join): a thing you open to find
28
+ * more things. Mono, because it exists verbatim in a .malloy file. One step
29
+ * above the leaf rows it holds ({@link ENTITY_NAME_SX}).
30
+ */
31
+ export declare const CONTAINER_NAME_SX: {
32
+ readonly fontFamily: "var(--model-viewer-mono, \"JetBrains Mono\", \"ui-monospace\", \"SFMono-Regular\", \"Menlo\", monospace)";
33
+ readonly fontSize: 14;
34
+ readonly fontWeight: 500;
35
+ readonly color: "text.primary";
36
+ };
37
+ /** The identifier style for a LEAF row (a field): the thing you came to read. */
38
+ export declare const ENTITY_NAME_SX: {
39
+ readonly fontFamily: "var(--model-viewer-mono, \"JetBrains Mono\", \"ui-monospace\", \"SFMono-Regular\", \"Menlo\", monospace)";
40
+ readonly fontSize: 13;
41
+ readonly fontWeight: 500;
42
+ readonly color: "text.primary";
43
+ };
44
+ /**
45
+ * The secondary voice beside a row's name: a type annotation (`string`,
46
+ * `number`) or a dimmed count. Sans on purpose: it describes the row, it isn't
47
+ * a token you would type.
48
+ */
49
+ export declare const ROW_META_SX: {
50
+ readonly fontSize: 12;
51
+ readonly color: "text.secondary";
52
+ };
@@ -0,0 +1,48 @@
1
+ import { ButtonProps } from '@mui/material';
2
+ import { ReactNode, ForwardRefExoticComponent, RefAttributes } from 'react';
3
+ /**
4
+ * Malloy, highlighted, in a read-only block: a field's definition, a view's
5
+ * code, the query a failed run sent. Plain text until the highlighter answers,
6
+ * so the code is readable on the first frame.
7
+ */
8
+ export declare function QueryCode({ code, testId, framed, }: {
9
+ code: string;
10
+ testId?: string;
11
+ /** False: the code as one section of a card someone else frames (an open field row's). */
12
+ framed?: boolean;
13
+ }): import("react/jsx-runtime").JSX.Element;
14
+ /** A read that failed, in place of what it would have shown, with a Retry where one can help. */
15
+ export declare function LoadErrorAlert({ message, onRetry, severity, }: {
16
+ message: ReactNode;
17
+ onRetry?: () => void;
18
+ severity?: "error" | "warning";
19
+ }): import("react/jsx-runtime").JSX.Element;
20
+ /** The server's own reason for a failed request (its Error body's `message`), if it gave one. */
21
+ export declare function serverMessage(error: unknown): string | undefined;
22
+ /** The server's own reason for a failed request, else what was being done. */
23
+ export declare function describeApiError(context: string, error: unknown): string;
24
+ /**
25
+ * Can re-sending this query succeed? Not for a 400 (the query does not compile)
26
+ * or a 422 (a value it refuses), which hold until the query or the value
27
+ * changes, nor for a refusal (401/403/404).
28
+ */
29
+ export declare function isRetryableQueryFailure(error: unknown): boolean;
30
+ /**
31
+ * A failed query, wherever a result would have been. The query is shown
32
+ * verbatim above the error, so a compile error's `line:column` points into text
33
+ * the reader can see, and Retry is offered only when a second attempt can
34
+ * succeed.
35
+ */
36
+ export declare function QueryFailure({ query, error, onRetry, testId, forbiddenMessage, }: {
37
+ /** The query as it was sent; omitted when there is none to show. */
38
+ query?: string;
39
+ error: unknown;
40
+ onRetry?: () => void;
41
+ testId?: string;
42
+ /** What a refusal (403) says, where the caller knows the rule that refused it. */
43
+ forbiddenMessage?: string;
44
+ }): import("react/jsx-runtime").JSX.Element;
45
+ /** The one filled action on a card: Run. */
46
+ export declare const PrimaryButton: ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>;
47
+ /** A rounded, quiet button that opens a menu: the sources picker. */
48
+ export declare const PillButton: ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,76 @@
1
+ import { ExplorerField } from './schemaModel';
2
+ import { RunContext } from './useRunQuery';
3
+ export declare const SAMPLE_LIMIT = 12;
4
+ /** What a host's sample fetcher is asked for. */
5
+ export interface SampleValuesRequest {
6
+ modelPath: string;
7
+ sourceName: string;
8
+ fieldName: string;
9
+ /** At most this many values are shown. */
10
+ limit: number;
11
+ signal?: AbortSignal;
12
+ }
13
+ /** What a host's sample fetcher can say beyond the values themselves. */
14
+ export interface SampleValuesPage {
15
+ /** The most common values, most common first. */
16
+ values: string[];
17
+ /** How many distinct values the dimension has, for the card's caption. */
18
+ total?: number | null;
19
+ /** Why there are none to show ("the index is still building"), said in their place. */
20
+ unavailable?: string;
21
+ }
22
+ /**
23
+ * A host's way to read a dimension's sample values (an index it maintains, say)
24
+ * instead of the viewer's own query: the values alone, or a
25
+ * {@link SampleValuesPage}. Rejecting with a 4xx that says the field has nothing
26
+ * to sample reads as "no values" (see {@link isExpectedNoSamples}).
27
+ */
28
+ export type SampleValuesFetcher = (request: SampleValuesRequest) => Promise<string[] | SampleValuesPage>;
29
+ interface UseDimensionSamplesArgs {
30
+ run: RunContext;
31
+ /** Model path the source belongs to (e.g. "flights.malloy"). */
32
+ modelPath: string;
33
+ /** Source the selected field belongs to. */
34
+ sourceName: string;
35
+ /** The field to sample, or null while the card is collapsed (hook idles). */
36
+ field: ExplorerField | null;
37
+ /** The host's fetcher; the viewer runs {@link sampleValuesQuery} without one. */
38
+ fetchSamples?: SampleValuesFetcher;
39
+ /** A host's build of the values it serves: a new one is a new cache entry,
40
+ * so a reopened row never shows the old values. */
41
+ generation?: string;
42
+ }
43
+ /**
44
+ * Whether a rejected sample read is an answer that the dimension simply has
45
+ * nothing to sample, so the card says "no values" rather than "couldn't be
46
+ * loaded": a client error, except the ones that say nothing about the field (a
47
+ * lapsed session 401, a timeout 408, a rate limit 429). Every 5xx, and every
48
+ * rejection with no status (the network), is a read that failed.
49
+ */
50
+ export declare function isExpectedNoSamples(error: unknown): boolean;
51
+ /** The first column of each row of a result, as text. */
52
+ export declare function firstColumnValues(resultJson: string | undefined): string[];
53
+ /**
54
+ * Lazily fetch sample values for a dimension. Only for dimensions the model tags
55
+ * `#(index)` / `#(index_values)`: the tag is the modeler saying its values are
56
+ * worth listing, and without it opening a row costs nothing. Everything else
57
+ * resolves to "no samples", as does a host's refusal that answers the question.
58
+ * Any other error is reported as `failed`, never as an empty list: the card
59
+ * must not say there are no values when it could not ask.
60
+ *
61
+ * Without a host fetcher this is one capped `group_by` query through the
62
+ * Publisher, run as a view's is (`runQueryOptions`: the same request, cache
63
+ * and `onQueryRun`), with the given values of the givens its source reads, and
64
+ * gated the same way. Shared by every mount: opening, shutting and reopening a
65
+ * row reads it once.
66
+ */
67
+ export declare function useDimensionSamples({ run, modelPath, sourceName, field, fetchSamples, generation, }: UseDimensionSamplesArgs): {
68
+ samples: string[];
69
+ /** How many distinct values there are, when a host says. */
70
+ total?: number | null;
71
+ /** Why there are none: a host's reason, or the given a run needs first. */
72
+ unavailable?: string;
73
+ loading: boolean;
74
+ failed: boolean;
75
+ };
76
+ export {};
@@ -0,0 +1,92 @@
1
+ import { GivenInfo } from './modelGivens';
2
+ import { SourceAccess } from './sourceAccess';
3
+ import { useServer } from '../ServerProvider';
4
+ import { RefetchOptions, QueryObserverResult } from '@tanstack/query-core';
5
+ import type * as Malloy from "@malloydata/malloy-interfaces";
6
+ /** A model's named queries, as the publisher lists them on `CompiledModel.queries`. */
7
+ export interface ModelNamedQuery {
8
+ name?: string;
9
+ sourceName?: string;
10
+ annotations?: string[];
11
+ }
12
+ /** What the viewer keeps of a compiled model. */
13
+ export interface CompiledModelData {
14
+ sourceInfos: Malloy.SourceInfo[];
15
+ queries: ModelNamedQuery[];
16
+ /** The model file's Malloy text. Newer publishers return it on the compiled
17
+ * model (`sourceText`); older ones don't, and the SDK's type predates it,
18
+ * so it is read structurally and stays undefined when absent — the code
19
+ * view says so rather than showing an empty file. A SHAPE check, not a
20
+ * cast: through the router a declared-but-unsent field arrives as `null`,
21
+ * which must read as absent too. */
22
+ sourceText?: string;
23
+ /** The model's declared givens (shape-checked by extractCompiledModelGivens),
24
+ * so a run can say which defaults it used, or that it can't run without a
25
+ * value. */
26
+ givens: GivenInfo[];
27
+ /** Source name → its `#(authorize)` / `#(access_filter)` declarations (the
28
+ * compiled model's `sources[]`), for every source that declares either. */
29
+ access: ReadonlyMap<string, SourceAccess>;
30
+ /** The model file's own description (`##(doc)` / `##"`), from `modelInfo`. */
31
+ modelDoc?: string;
32
+ /** The model imports other files: an import-only model's page says why it
33
+ * is empty rather than reading as broken. */
34
+ hasImports: boolean;
35
+ }
36
+ /**
37
+ * The model's own doc: from the compiled model's `modelInfo` (a JSON string of
38
+ * Malloy's `ModelInfo`) where it carries the model's annotations, else from the
39
+ * model file's text. The publisher's `modelInfo` leaves `annotations` out today,
40
+ * and a `##` line is a model annotation wherever it sits at the top level, so
41
+ * the text answers the same question. Undefined when neither has one.
42
+ */
43
+ export declare function modelDocOf(modelInfo: unknown, sourceText: string | undefined): string | undefined;
44
+ /**
45
+ * The one shaping of a compiled-model response, for both hooks below: they
46
+ * share a cache key, so they must store one shape, and a function is a
47
+ * guarantee where a comment was not.
48
+ */
49
+ export declare function fetchCompiledModel(apiClients: ReturnType<typeof useServer>["apiClients"], projectName: string, packageName: string, modelPath: string, versionId?: string, includeHiddenFilesAndSources?: boolean): Promise<CompiledModelData>;
50
+ /**
51
+ * The viewer's cache key for a compiled model, for a host that reads the same
52
+ * model (and shares the one compile), or refreshes it after a republish.
53
+ * A hidden file's read is its own entry: the curated read's 404 must never be
54
+ * served in its place, nor its text to a reader who can't edit the package.
55
+ */
56
+ export declare function modelQueryKey(projectName: string, packageName: string, modelPath: string, versionId?: string, includeHiddenFilesAndSources?: boolean): readonly unknown[];
57
+ /**
58
+ * A compiled model's query: its one cache key and fetch, for every reader of a
59
+ * compiled model. Compiling is server work, so
60
+ * a pinned version — which can't change — is kept for the page's life; `latest`
61
+ * goes stale like any other read.
62
+ */
63
+ export declare function compiledModelQuery(apiClients: ReturnType<typeof useServer>["apiClients"], projectName: string, packageName: string, modelPath: string, versionId?: string, includeHiddenFilesAndSources?: boolean): {
64
+ staleTime?: number;
65
+ queryKey: readonly unknown[];
66
+ queryFn: () => Promise<CompiledModelData>;
67
+ };
68
+ /**
69
+ * Fetch the compiled sources for a published model and parse them into
70
+ * `Malloy.SourceInfo` objects (`sourceInfos` is an array of JSON strings). The same
71
+ * response lists the model's named queries, so they ride along rather than
72
+ * costing a second fetch of the compiled model.
73
+ */
74
+ export declare function useModelSources(projectName: string, packageName: string, modelPath: string, versionId?: string,
75
+ /** False holds the read, e.g. until the page has resolved `latest` to the
76
+ * version it will read everything at. */
77
+ enabled?: boolean,
78
+ /** Read a file the package's `index.malloy` hides, for a reader who can
79
+ * edit the package; anyone else is refused. */
80
+ includeHiddenFilesAndSources?: boolean): {
81
+ sources: Malloy.SourceInfo[];
82
+ queries: ModelNamedQuery[];
83
+ sourceText: string;
84
+ givens: GivenInfo[];
85
+ access: ReadonlyMap<string, SourceAccess>;
86
+ modelDoc: string;
87
+ hasImports: boolean;
88
+ isLoading: boolean;
89
+ isError: boolean;
90
+ error: Error | null;
91
+ refetch: (options?: RefetchOptions) => Promise< QueryObserverResult<CompiledModelData, Error>>;
92
+ };
@@ -0,0 +1,115 @@
1
+ import { ApiClients } from '../ServerProvider';
2
+ import { GivenInfo, GivenRequest } from './modelGivens';
3
+ import { SourceAccess } from './sourceAccess';
4
+ import { RefetchOptions, QueryObserverResult } from '@tanstack/query-core';
5
+ import { AxiosResponse } from 'axios';
6
+ import { QueryResult } from '../../client';
7
+ /** How one run ended, for a host that counts them. */
8
+ export interface QueryRunEvent {
9
+ outcome: "success" | "error";
10
+ durationMs: number;
11
+ }
12
+ /** What a run needs to address the served model: the same coordinates the
13
+ * explorer already reads the model's metadata with. */
14
+ export interface RunContext {
15
+ projectName: string;
16
+ packageName: string;
17
+ versionId?: string;
18
+ /** The model's declared givens — the declarations runGate reads to name a
19
+ * default a run fell back to, or to refuse where a blank one has none. The
20
+ * values a run sends are `givenValues` below. */
21
+ givens?: ReadonlyArray<GivenInfo>;
22
+ /** Source name → the givens a run on that source can use (givensForSource):
23
+ * what its declaration reads, plus the model-wide ones no source reads. The
24
+ * page's Givens section shows the same set, so a gate never asks for a given
25
+ * that section can't set. */
26
+ givensBySource?: ReadonlyMap<string, GivenInfo[]>;
27
+ /** Source name → the givens in `givensBySource` the scan can't tie to it
28
+ * either way (scanGivensForSource), for a source built on what its file
29
+ * doesn't declare: a run's card says it ran with them only where the source
30
+ * reads them. */
31
+ unknownGivensBySource?: ReadonlyMap<string, ReadonlySet<string>>;
32
+ /** Source name → labels of its `#(filter … required)` filters; a run can't
33
+ * supply them, so it refuses rather than 400. */
34
+ requiredFiltersBySource?: ReadonlyMap<string, string[]>;
35
+ /** Given values the reader set in the page's Givens section, in the request
36
+ * form a dashboard sends (`givensRequest`: typed, unset ones left out), sent
37
+ * with every run and part of its cache key (givensKeyFor). */
38
+ givenValues?: GivenRequest;
39
+ /** Run a file the package's index.malloy hides, for someone who can edit the
40
+ * package (offSurface.tsx). Anyone else is refused. */
41
+ includeHiddenFilesAndSources?: boolean;
42
+ /** Source name → its access declarations, so a refused run can say which
43
+ * rule refused it rather than a bare "no access". */
44
+ accessBySource?: ReadonlyMap<string, SourceAccess>;
45
+ /** Labels every run carries (`QueryRequest.queryMetadata`), for a host that
46
+ * tags its traffic by the surface it came from. */
47
+ queryMetadata?: Readonly<Record<string, string>>;
48
+ /** Called once per run that settles; a run the reader left is not reported. */
49
+ onQueryRun?: (event: QueryRunEvent) => void;
50
+ /** A result larger than this (bytes) is held behind a warning before it renders. */
51
+ maxResultSize?: number;
52
+ }
53
+ /** The givens a run on `sourceName` reads — the model's own for a named query. */
54
+ export declare function givensOfRun(run: Pick<RunContext, "givens" | "givensBySource">, sourceName: string | undefined): ReadonlyArray<GivenInfo> | undefined;
55
+ /**
56
+ * The run as one view, query or sample read sends it: with the given values of
57
+ * the givens it reads alone (`givens`, from {@link givensOfRun}, the set its
58
+ * gate and its source's Givens section use). A value set for a given it doesn't
59
+ * read neither reaches its request nor changes its cache key, so changing one
60
+ * leaves its result current rather than paying for the same query again.
61
+ */
62
+ export declare function runReading(run: RunContext, givens: ReadonlyArray<GivenInfo> | undefined): RunContext;
63
+ /**
64
+ * Run one Malloy query against a published model and hand back the publisher's
65
+ * `Result` JSON for `RenderedResult`: `executeQueryModel` with the query text,
66
+ * keyed by everything that decides its answer.
67
+ *
68
+ * Idle until `enabled`: browsing a source must cost nothing; a run happens on a
69
+ * click. And a result, once fetched, is final for this query text and version:
70
+ * it never goes stale and never refetches on focus or remount. Re-running is
71
+ * the card's own explicit control (`refetch`), because a warehouse query is
72
+ * billed.
73
+ */
74
+ export declare function useRunQuery({ run, modelPath, query, enabled, }: {
75
+ run: RunContext;
76
+ modelPath: string;
77
+ query: string;
78
+ enabled: boolean;
79
+ }): {
80
+ result: string;
81
+ isSuccess: boolean;
82
+ isLoading: boolean;
83
+ isFetching: boolean;
84
+ isError: boolean;
85
+ error: Error;
86
+ refetch: (options?: RefetchOptions) => Promise< QueryObserverResult<AxiosResponse<QueryResult, any, {}, any>, Error>>;
87
+ };
88
+ /**
89
+ * The viewer's cache key for one run (a view's, a named query's), for a host
90
+ * that refreshes it or runs the same query itself (a download, say).
91
+ */
92
+ export declare function runQueryKey(server: string, run: Pick<RunContext, "projectName" | "packageName" | "versionId" | "givenValues" | "includeHiddenFilesAndSources">, modelPath: string, query: string): readonly unknown[];
93
+ /**
94
+ * A viewer run's cache key, request and caching, apart from the hook, so a host
95
+ * that runs the same query (a download, say) reuses a result the reader already
96
+ * ran, and one it runs is cached for the reader to open without paying again.
97
+ *
98
+ * A run is kept until the page goes (`staleTime: Infinity`): its inputs are all in
99
+ * the key. A failed run is reported in place with its own Retry, so it never
100
+ * retries silently — that would re-bill a query the reader can see failed.
101
+ */
102
+ export declare function runQueryOptions({ server, apiClients, run, modelPath, query, }: {
103
+ server: string;
104
+ apiClients: ApiClients;
105
+ run: RunContext;
106
+ modelPath: string;
107
+ query: string;
108
+ }): {
109
+ readonly queryKey: readonly unknown[];
110
+ readonly queryFn: ({ signal }: {
111
+ signal?: AbortSignal;
112
+ }) => Promise< AxiosResponse<QueryResult, any, {}, any>>;
113
+ readonly staleTime: number;
114
+ readonly retry: false;
115
+ };