@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.
- package/README.md +79 -6
- package/dist/{RenderedResult-SgDlxzs9.cjs.js → RenderedResult-Cgw4iqev.cjs.js} +1 -1
- package/dist/{RenderedResult-D8bCgThO.es.js → RenderedResult-DEjFM1DL.es.js} +2 -2
- package/dist/ServerProvider-BRQl_cBo.cjs.js +1 -0
- package/dist/{ServerProvider-DBw-thY0.es.js → ServerProvider-RnliA2Ao.es.js} +1084 -723
- package/dist/builder/index.cjs.js +1 -1
- package/dist/builder/index.es.js +3 -3
- package/dist/client/api.d.ts +754 -41
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +120 -110
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +16 -1
- package/dist/components/Model/ExplorerPage.d.ts +9 -0
- package/dist/components/Model/Model.d.ts +27 -11
- package/dist/components/ModelViewer/AccessChips.d.ts +34 -0
- package/dist/components/ModelViewer/EmptyRow.d.ts +23 -0
- package/dist/components/ModelViewer/Facts.d.ts +15 -0
- package/dist/components/ModelViewer/FieldGroup.d.ts +31 -0
- package/dist/components/ModelViewer/FieldRow.d.ts +69 -0
- package/dist/components/ModelViewer/GivenFacts.d.ts +21 -0
- package/dist/components/ModelViewer/HeaderBar.d.ts +75 -0
- package/dist/components/ModelViewer/InlineDoc.d.ts +13 -0
- package/dist/components/ModelViewer/ModelGivensSection.d.ts +32 -0
- package/dist/components/ModelViewer/ModelSection.d.ts +21 -0
- package/dist/components/ModelViewer/ModelViewer.d.ts +91 -0
- package/dist/components/ModelViewer/QueriesGroup.d.ts +15 -0
- package/dist/components/ModelViewer/RowGlyph.d.ts +27 -0
- package/dist/components/ModelViewer/RunResult.d.ts +46 -0
- package/dist/components/ModelViewer/SampleValues.d.ts +20 -0
- package/dist/components/ModelViewer/SchemaJoin.d.ts +51 -0
- package/dist/components/ModelViewer/SchemaView.d.ts +52 -0
- package/dist/components/ModelViewer/SegmentIcons.d.ts +70 -0
- package/dist/components/ModelViewer/SourcesDropdown.d.ts +53 -0
- package/dist/components/ModelViewer/SourcesNav.d.ts +25 -0
- package/dist/components/ModelViewer/StatusPill.d.ts +56 -0
- package/dist/components/ModelViewer/ValueChip.d.ts +17 -0
- package/dist/components/ModelViewer/ViewRow.d.ts +36 -0
- package/dist/components/ModelViewer/clickableBox.d.ts +29 -0
- package/dist/components/ModelViewer/codeDisplay.d.ts +44 -0
- package/dist/components/ModelViewer/docAnnotations.d.ts +90 -0
- package/dist/components/ModelViewer/explorerModel.d.ts +12 -0
- package/dist/components/ModelViewer/extensions.d.ts +94 -0
- package/dist/components/ModelViewer/fieldCode.d.ts +74 -0
- package/dist/components/ModelViewer/fieldEntities.d.ts +45 -0
- package/dist/components/ModelViewer/fieldExpansion.d.ts +41 -0
- package/dist/components/ModelViewer/givenUsage.d.ts +71 -0
- package/dist/components/ModelViewer/headerCard.d.ts +31 -0
- package/dist/components/ModelViewer/httpStatus.d.ts +4 -0
- package/dist/components/ModelViewer/icons.d.ts +31 -0
- package/dist/components/ModelViewer/index.d.ts +9 -0
- package/dist/components/ModelViewer/joinAccess.d.ts +52 -0
- package/dist/components/ModelViewer/malloyRunText.d.ts +22 -0
- package/dist/components/ModelViewer/malloyText.d.ts +21 -0
- package/dist/components/ModelViewer/modelGivens.d.ts +61 -0
- package/dist/components/ModelViewer/modelGivensContext.d.ts +9 -0
- package/dist/components/ModelViewer/modelHeaderPresentation.d.ts +28 -0
- package/dist/components/ModelViewer/modelTextDeclarations.d.ts +32 -0
- package/dist/components/ModelViewer/modelTextParse.d.ts +27 -0
- package/dist/components/ModelViewer/namedQueryCode.d.ts +12 -0
- package/dist/components/ModelViewer/offSurface.d.ts +54 -0
- package/dist/components/ModelViewer/rowLayers.d.ts +30 -0
- package/dist/components/ModelViewer/runGate.d.ts +49 -0
- package/dist/components/ModelViewer/schemaModel.d.ts +109 -0
- package/dist/components/ModelViewer/sectionOpenCommand.d.ts +45 -0
- package/dist/components/ModelViewer/sourceAccess.d.ts +67 -0
- package/dist/components/ModelViewer/sourceLineage.d.ts +14 -0
- package/dist/components/ModelViewer/sourcePicker.d.ts +66 -0
- package/dist/components/ModelViewer/surface.d.ts +47 -0
- package/dist/components/ModelViewer/text.d.ts +6 -0
- package/dist/components/ModelViewer/theme.d.ts +63 -0
- package/dist/components/ModelViewer/tokens.d.ts +52 -0
- package/dist/components/ModelViewer/ui.d.ts +48 -0
- package/dist/components/ModelViewer/useDimensionSamples.d.ts +76 -0
- package/dist/components/ModelViewer/useModelSources.d.ts +92 -0
- package/dist/components/ModelViewer/useRunQuery.d.ts +115 -0
- package/dist/components/ReportBuilder/loadMalloy.d.ts +4 -0
- package/dist/components/ServerProvider.d.ts +17 -2
- package/dist/components/filter/utils.d.ts +1 -1
- package/dist/components/given/GivenInput.d.ts +7 -1
- package/dist/components/given/GivensPanel.d.ts +3 -1
- package/dist/components/given/filterSummary.d.ts +6 -0
- package/dist/components/given/useGivenUrlParams.d.ts +11 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/modelPage.d.ts +36 -0
- package/dist/hooks/useDimensionalFilterRangeData.d.ts +9 -0
- package/dist/hooks/useSuggestOptions.d.ts +26 -2
- package/dist/index.cjs.js +47 -19
- package/dist/index.es.js +14137 -9697
- package/dist/useCompiledDocument-D88_2cGS.cjs.js +143 -0
- package/dist/{useCompiledDocument-CXMPtJkJ.es.js → useCompiledDocument-Dmm6xkom.es.js} +6975 -6893
- package/dist/utils/filterCondition.d.ts +14 -0
- package/dist/utils/malloyLiteral.d.ts +20 -1
- package/package.json +2 -2
- package/src/components/Materializations/MaterializationDetailDialog.tsx +33 -7
- package/src/components/Materializations/Materializations.tsx +47 -4
- package/src/components/Materializations/Materializations.versions.spec.tsx +140 -1
- package/src/components/Model/ExplorerPage.tsx +269 -0
- package/src/components/Model/Model.tsx +66 -250
- package/src/components/Model/ModelExplorer.spec.tsx +64 -1
- package/src/components/ModelViewer/AccessChips.tsx +149 -0
- package/src/components/ModelViewer/EmptyRow.tsx +71 -0
- package/src/components/ModelViewer/Facts.tsx +46 -0
- package/src/components/ModelViewer/FieldGroup.tsx +137 -0
- package/src/components/ModelViewer/FieldRow.tsx +566 -0
- package/src/components/ModelViewer/GivenFacts.tsx +89 -0
- package/src/components/ModelViewer/HeaderBar.tsx +362 -0
- package/src/components/ModelViewer/InlineDoc.tsx +50 -0
- package/src/components/ModelViewer/ModelGivensSection.tsx +142 -0
- package/src/components/ModelViewer/ModelSection.tsx +98 -0
- package/src/components/ModelViewer/ModelViewer.spec.tsx +937 -0
- package/src/components/ModelViewer/ModelViewer.tsx +777 -0
- package/src/components/ModelViewer/QueriesGroup.tsx +107 -0
- package/src/components/ModelViewer/RowGlyph.tsx +138 -0
- package/src/components/ModelViewer/RunResult.tsx +298 -0
- package/src/components/ModelViewer/SampleValues.tsx +97 -0
- package/src/components/ModelViewer/SchemaJoin.tsx +258 -0
- package/src/components/ModelViewer/SchemaView.tsx +222 -0
- package/src/components/ModelViewer/SegmentIcons.tsx +129 -0
- package/src/components/ModelViewer/SourcesDropdown.tsx +265 -0
- package/src/components/ModelViewer/SourcesNav.tsx +75 -0
- package/src/components/ModelViewer/StatusPill.tsx +145 -0
- package/src/components/ModelViewer/ValueChip.tsx +39 -0
- package/src/components/ModelViewer/ViewRow.tsx +274 -0
- package/src/components/ModelViewer/clickableBox.ts +59 -0
- package/src/components/ModelViewer/codeDisplay.spec.ts +176 -0
- package/src/components/ModelViewer/codeDisplay.ts +118 -0
- package/src/components/ModelViewer/docAnnotations.spec.ts +181 -0
- package/src/components/ModelViewer/docAnnotations.ts +244 -0
- package/src/components/ModelViewer/docAnnotations.typeDetail.spec.ts +114 -0
- package/src/components/ModelViewer/explorerModel.spec.ts +43 -0
- package/src/components/ModelViewer/explorerModel.ts +31 -0
- package/src/components/ModelViewer/extensions.tsx +112 -0
- package/src/components/ModelViewer/fieldCode.spec.ts +168 -0
- package/src/components/ModelViewer/fieldCode.ts +118 -0
- package/src/components/ModelViewer/fieldEntities.ts +63 -0
- package/src/components/ModelViewer/fieldExpansion.spec.ts +116 -0
- package/src/components/ModelViewer/fieldExpansion.ts +95 -0
- package/src/components/ModelViewer/givenUsage.spec.ts +304 -0
- package/src/components/ModelViewer/givenUsage.ts +325 -0
- package/src/components/ModelViewer/headerCard.tsx +102 -0
- package/src/components/ModelViewer/httpStatus.ts +15 -0
- package/src/components/ModelViewer/icons.tsx +67 -0
- package/src/components/ModelViewer/index.ts +26 -0
- package/src/components/ModelViewer/joinAccess.spec.ts +95 -0
- package/src/components/ModelViewer/joinAccess.ts +54 -0
- package/src/components/ModelViewer/malloyRunText.spec.ts +48 -0
- package/src/components/ModelViewer/malloyRunText.ts +51 -0
- package/src/components/ModelViewer/malloyText.spec.ts +47 -0
- package/src/components/ModelViewer/malloyText.ts +77 -0
- package/src/components/ModelViewer/modelGivens.ts +228 -0
- package/src/components/ModelViewer/modelGivensContext.ts +13 -0
- package/src/components/ModelViewer/modelHeaderPresentation.spec.ts +31 -0
- package/src/components/ModelViewer/modelHeaderPresentation.ts +41 -0
- package/src/components/ModelViewer/modelTextDeclarations.spec.ts +336 -0
- package/src/components/ModelViewer/modelTextDeclarations.ts +228 -0
- package/src/components/ModelViewer/modelTextParse.ts +112 -0
- package/src/components/ModelViewer/namedQueryCode.spec.ts +58 -0
- package/src/components/ModelViewer/namedQueryCode.ts +26 -0
- package/src/components/ModelViewer/offSurface.tsx +124 -0
- package/src/components/ModelViewer/rowLayers.tsx +104 -0
- package/src/components/ModelViewer/runGate.spec.ts +219 -0
- package/src/components/ModelViewer/runGate.ts +145 -0
- package/src/components/ModelViewer/schemaModel.defaultSource.spec.ts +126 -0
- package/src/components/ModelViewer/schemaModel.queries.spec.ts +37 -0
- package/src/components/ModelViewer/schemaModel.ts +300 -0
- package/src/components/ModelViewer/sectionOpenCommand.tsx +125 -0
- package/src/components/ModelViewer/sourceAccess.spec.ts +130 -0
- package/src/components/ModelViewer/sourceAccess.ts +194 -0
- package/src/components/ModelViewer/sourceLineage.spec.ts +73 -0
- package/src/components/ModelViewer/sourceLineage.ts +38 -0
- package/src/components/ModelViewer/sourcePicker.spec.ts +294 -0
- package/src/components/ModelViewer/sourcePicker.ts +162 -0
- package/src/components/ModelViewer/surface.ts +51 -0
- package/src/components/ModelViewer/text.tsx +33 -0
- package/src/components/ModelViewer/theme.spec.ts +38 -0
- package/src/components/ModelViewer/theme.ts +58 -0
- package/src/components/ModelViewer/tokens.ts +87 -0
- package/src/components/ModelViewer/ui.tsx +201 -0
- package/src/components/ModelViewer/useDimensionSamples.spec.tsx +139 -0
- package/src/components/ModelViewer/useDimensionSamples.ts +220 -0
- package/src/components/ModelViewer/useModelSources.spec.ts +110 -0
- package/src/components/ModelViewer/useModelSources.ts +238 -0
- package/src/components/ModelViewer/useRunQuery.spec.ts +50 -0
- package/src/components/ModelViewer/useRunQuery.ts +223 -0
- package/src/components/Package/Package.agents.spec.tsx +5 -4
- package/src/components/Package/Package.tsx +8 -1
- package/src/components/ReportBuilder/emptyStart.spec.ts +8 -0
- package/src/components/ReportBuilder/loadMalloy.ts +8 -1
- package/src/components/ServerProvider.tsx +29 -3
- package/src/components/filter/utils.ts +4 -60
- package/src/components/given/FilterButton.tsx +4 -1
- package/src/components/given/GivenInput.tsx +8 -0
- package/src/components/given/GivensPanel.tsx +6 -1
- package/src/components/given/filterSummary.spec.ts +31 -1
- package/src/components/given/filterSummary.ts +41 -19
- package/src/components/given/useGivenUrlParams.spec.tsx +32 -0
- package/src/components/given/useGivenUrlParams.ts +49 -14
- package/src/components/index.ts +6 -1
- package/src/components/legacy/malloynb/Notebook.spec.tsx +38 -4
- package/src/components/legacy/malloynb/NotebookCell.tsx +8 -2
- package/src/components/modelPage.spec.ts +79 -0
- package/src/components/modelPage.ts +48 -0
- package/src/hooks/useDimensionFilters.ts +3 -58
- package/src/hooks/useDimensionFiltersQuery.ts +3 -58
- package/src/hooks/useDimensionalFilterRangeData.spec.ts +57 -0
- package/src/hooks/useDimensionalFilterRangeData.ts +8 -63
- package/src/hooks/useSuggestOptions.dom.spec.ts +54 -1
- package/src/hooks/useSuggestOptions.spec.ts +71 -0
- package/src/hooks/useSuggestOptions.ts +102 -12
- package/src/utils/filterCondition.spec.ts +87 -0
- package/src/utils/filterCondition.ts +66 -0
- package/src/utils/malloyLiteral.spec.ts +53 -1
- package/src/utils/malloyLiteral.ts +47 -12
- package/dist/ServerProvider-BHfg1Ed6.cjs.js +0 -1
- package/dist/useCompiledDocument-D7X_K6YU.cjs.js +0 -142
|
@@ -11,5 +11,9 @@ export declare const unwrapQueryBuilder: (ns: QueryBuilder) => QueryBuilder;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function loadMalloy(): Promise<Malloy>;
|
|
13
13
|
export declare function loadMalloyTag(): Promise<MalloyTag>;
|
|
14
|
+
/**
|
|
15
|
+
* The Explorer's query builder, for `SourcesExplorer` alone: ESLint lets only
|
|
16
|
+
* the Explorer's callers import this (`EXPLORER_CALLERS`).
|
|
17
|
+
*/
|
|
14
18
|
export declare function loadQueryBuilder(): Promise<QueryBuilder>;
|
|
15
19
|
export {};
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
-
import { ConnectionsApi, DashboardsApi, DataAppsApi, DatabasesApi, EnvironmentsApi, MaterializationsApi, ModelsApi, NotebooksApi, PackagesApi, PublisherApi, ReportsApi, VersionsApi, WatchModeApi } from '../client';
|
|
2
|
+
import { ConnectionsApi, DashboardsApi, DataAppsApi, DatabasesApi, EnvironmentsApi, MaterializationsApi, ModelsApi, NotebooksApi, PackagesApi, AgentsApi, PublisherApi, ReportsApi, VersionsApi, WatchModeApi } from '../client';
|
|
3
3
|
import { ReportUiOverrides } from '../theme/ui';
|
|
4
4
|
import { Theme } from '../theme/types';
|
|
5
|
+
import { ModelPage } from './modelPage';
|
|
6
|
+
export type { ModelPage };
|
|
5
7
|
export interface ServerContextValue {
|
|
6
8
|
server: string;
|
|
7
9
|
getAccessToken?: () => Promise<string>;
|
|
8
10
|
apiClients: ApiClients;
|
|
9
11
|
/** `undefined` while `/status` loads (or failed) and the host passed no `mutable`. */
|
|
10
12
|
mutable: boolean | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* `/status` has neither answered nor failed yet, including while a retry is
|
|
15
|
+
* paused (offline, or a hidden tab).
|
|
16
|
+
*/
|
|
11
17
|
isLoadingStatus: boolean;
|
|
12
18
|
/**
|
|
13
19
|
* Instance-wide default theme, pulled from the `/api/v0/status` response.
|
|
@@ -15,6 +21,15 @@ export interface ServerContextValue {
|
|
|
15
21
|
* theme in `publisher.config.json`.
|
|
16
22
|
*/
|
|
17
23
|
instanceTheme?: Theme;
|
|
24
|
+
/**
|
|
25
|
+
* Which page `Model` shows, the server's `PUBLISHER_MODEL_PAGE` from
|
|
26
|
+
* `/status`: `explorer`, the Malloy Explorer, unless the server says
|
|
27
|
+
* `viewer`, and `viewer` when `/status` could not be read (see
|
|
28
|
+
* `modelPageOf`). `explorer` while `/status` loads and from a server
|
|
29
|
+
* that predates the setting, so wait on `isLoadingStatus` before showing
|
|
30
|
+
* anything the Explorer would replace.
|
|
31
|
+
*/
|
|
32
|
+
modelPage: ModelPage;
|
|
18
33
|
}
|
|
19
34
|
export interface ServerProviderProps {
|
|
20
35
|
children: ReactNode;
|
|
@@ -57,6 +72,7 @@ declare const getApiClients: (baseURL?: string, accessToken?: () => Promise<stri
|
|
|
57
72
|
publisher: PublisherApi;
|
|
58
73
|
environments: EnvironmentsApi;
|
|
59
74
|
packages: PackagesApi;
|
|
75
|
+
agents: AgentsApi;
|
|
60
76
|
dashboards: DashboardsApi;
|
|
61
77
|
dataApps: DataAppsApi;
|
|
62
78
|
notebooks: NotebooksApi;
|
|
@@ -75,4 +91,3 @@ export type ApiClients = ReturnType<typeof getApiClients>;
|
|
|
75
91
|
*/
|
|
76
92
|
export declare const ServerProvider: React.FC<ServerProviderProps>;
|
|
77
93
|
export declare const useServer: () => ServerContextValue;
|
|
78
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DimensionSpec, FilterType } from '../../hooks/useDimensionalFilterRangeData';
|
|
2
2
|
import { FilterSelection } from '../../hooks/useDimensionFilters';
|
|
3
|
-
import * as Malloy from "@malloydata/malloy-interfaces";
|
|
3
|
+
import type * as Malloy from "@malloydata/malloy-interfaces";
|
|
4
4
|
/**
|
|
5
5
|
* A single filter specification with source and dimension
|
|
6
6
|
* Parsed from "source.dimension" string format
|
|
@@ -40,6 +40,12 @@ export interface GivenInputProps {
|
|
|
40
40
|
* that was cut off. Absent, typing filters `options` in the browser.
|
|
41
41
|
*/
|
|
42
42
|
optionSearch?: OptionSearch;
|
|
43
|
+
/**
|
|
44
|
+
* The control is opening, for a caller that fetches `options` only when
|
|
45
|
+
* one is wanted (see `useSuggestOptions`' `only`). Called by a picker's
|
|
46
|
+
* list and by a filter button's popover; harmless to call again.
|
|
47
|
+
*/
|
|
48
|
+
onOpen?: () => void;
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
51
|
* Renders an input widget appropriate for the declared given type.
|
|
@@ -61,7 +67,7 @@ export interface GivenInputProps {
|
|
|
61
67
|
* `Default: …` helper line on every widget — including the boolean checkbox,
|
|
62
68
|
* which gets a wrapping FormControl for the slot.
|
|
63
69
|
*/
|
|
64
|
-
export declare function GivenInput({ given, value, onChange, options, optionsLoading, optionsFailed, optionsTruncated, optionSearch, }: GivenInputProps): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export declare function GivenInput({ given, value, onChange, options, optionsLoading, optionsFailed, optionsTruncated, optionSearch, onOpen, }: GivenInputProps): import("react/jsx-runtime").JSX.Element;
|
|
65
71
|
/**
|
|
66
72
|
* What the dropdown says about its options, if anything. Only a cut-off list
|
|
67
73
|
* has something to say: a whole list needs no footnote.
|
|
@@ -45,6 +45,8 @@ export interface GivensPanelProps {
|
|
|
45
45
|
};
|
|
46
46
|
/** Overrides the `panel` layout's "Filters" heading. */
|
|
47
47
|
title?: string;
|
|
48
|
+
/** A control is opening: for options fetched only once one is wanted. */
|
|
49
|
+
onControlOpen?: (name: string) => void;
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
52
|
* Renders the control row: one input per declared `given:`.
|
|
@@ -56,4 +58,4 @@ export interface GivensPanelProps {
|
|
|
56
58
|
* puts the document's starting values back rather than emptying the row, so the
|
|
57
59
|
* button and the state agree on what "Reset" means.
|
|
58
60
|
*/
|
|
59
|
-
export declare function GivensPanel({ givens, values, onChange, onReset, canReset, layout, options, optionsLoading, optionsFailed, optionsTruncated, optionSearch, apply, title, }: GivensPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
export declare function GivensPanel({ givens, values, onChange, onReset, canReset, layout, options, optionsLoading, optionsFailed, optionsTruncated, optionSearch, apply, title, onControlOpen, }: GivensPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,3 +7,9 @@ import { GivenValue } from '../../hooks/givenValue';
|
|
|
7
7
|
* is rather than a hint under the control. The full value is the popover's.
|
|
8
8
|
*/
|
|
9
9
|
export declare function summarizeGivenValue(given: Given, value: GivenValue | undefined): string;
|
|
10
|
+
/**
|
|
11
|
+
* A given's value in the same words, but whole: every picked value and no
|
|
12
|
+
* cut-off text. For a record of what produced a result, where nothing else
|
|
13
|
+
* holds the full value.
|
|
14
|
+
*/
|
|
15
|
+
export declare function describeGivenValue(given: Given, value: GivenValue | undefined): string;
|
|
@@ -6,6 +6,12 @@ export interface UseGivenUrlParamsResult {
|
|
|
6
6
|
* query string, in place, leaving every parameter that is not a given alone.
|
|
7
7
|
*/
|
|
8
8
|
onGivensChange: (next: Record<string, string>, managed: readonly string[]) => void;
|
|
9
|
+
/**
|
|
10
|
+
* One parameter of the host's own (the source on screen, say), written the
|
|
11
|
+
* same way: merged into the query string, in place, keeping the fragment;
|
|
12
|
+
* `undefined` removes it.
|
|
13
|
+
*/
|
|
14
|
+
setParam: (name: string, value: string | undefined) => void;
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* Keep a document's control values in the page's query string, so a filtered
|
|
@@ -35,5 +41,10 @@ export interface UseGivenUrlParamsResult {
|
|
|
35
41
|
* every value tried. And a navigation that names only `search` resolves to an
|
|
36
42
|
* empty fragment, which dropped whatever anchor the reader arrived on;
|
|
37
43
|
* `setSearchParams` has that problem, which is why this navigates itself.
|
|
44
|
+
* A host's own parameter goes through the same write (`setParam`).
|
|
45
|
+
* - **Writes in one tick build on each other.** Each starts from the query
|
|
46
|
+
* string the last one wrote while the router has yet to commit it, not from
|
|
47
|
+
* the location this render saw, so a given's report beside a source pick
|
|
48
|
+
* keeps both.
|
|
38
49
|
*/
|
|
39
50
|
export declare function useGivenUrlParams(): UseGivenUrlParamsResult;
|
|
@@ -19,6 +19,7 @@ export * from './Home';
|
|
|
19
19
|
export * from './Loading';
|
|
20
20
|
export * from './Materializations';
|
|
21
21
|
export * from './Model';
|
|
22
|
+
export * from './ModelViewer';
|
|
22
23
|
export * from './Package';
|
|
23
24
|
export { Prose, type ProseLinkContext, type ProseProps, type ProseVariant, } from './Prose';
|
|
24
25
|
export * from './QueryResult';
|
|
@@ -26,5 +27,5 @@ export * from './RenderedResult';
|
|
|
26
27
|
export * from './Report';
|
|
27
28
|
export * from './legacy';
|
|
28
29
|
export { ServerProvider, useServer } from './ServerProvider';
|
|
29
|
-
export type { ServerContextValue, ServerProviderProps } from './ServerProvider';
|
|
30
|
+
export type { ModelPage, ServerContextValue, ServerProviderProps, } from './ServerProvider';
|
|
30
31
|
export * from './DocumentStorage';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model page a server asks for, its `PUBLISHER_MODEL_PAGE`. The Explorer
|
|
3
|
+
* writes the queries it builds back to Malloy text with string values unescaped
|
|
4
|
+
* (`escapeString` in `@malloydata/malloy-interfaces` is a TODO), so a drilled
|
|
5
|
+
* value holding a double quote rewrites its query; `viewer` shows a page that
|
|
6
|
+
* builds none.
|
|
7
|
+
*/
|
|
8
|
+
export type ModelPage = "explorer" | "viewer";
|
|
9
|
+
/**
|
|
10
|
+
* The page to show, from what `/status` answered: `viewer` when it says so, and
|
|
11
|
+
* when it could not be read at all, since a deployment that chose `viewer` has
|
|
12
|
+
* chosen not to show the Explorer and the viewer writes no value into Malloy on
|
|
13
|
+
* any server. `explorer` otherwise, a server that predates the setting
|
|
14
|
+
* included. While `/status` is still loading this says `explorer`; a caller
|
|
15
|
+
* that would draw the Explorer waits on loading first.
|
|
16
|
+
*/
|
|
17
|
+
export declare function modelPageOf(status: {
|
|
18
|
+
modelPage?: unknown;
|
|
19
|
+
} | undefined, failed: boolean): ModelPage;
|
|
20
|
+
/**
|
|
21
|
+
* The model page, and whether to wait for it, from the `/status` query as
|
|
22
|
+
* react-query reports it. It waits while the query is pending, with no answer
|
|
23
|
+
* and no error yet, which includes a retry paused offline or in a hidden tab:
|
|
24
|
+
* there react-query's `isLoading` is false although nothing has answered, and
|
|
25
|
+
* a `viewer` server would draw the Explorer.
|
|
26
|
+
*/
|
|
27
|
+
export declare function modelPageState(query: {
|
|
28
|
+
data: {
|
|
29
|
+
modelPage?: unknown;
|
|
30
|
+
} | undefined;
|
|
31
|
+
isPending: boolean;
|
|
32
|
+
isError: boolean;
|
|
33
|
+
}): {
|
|
34
|
+
modelPage: ModelPage;
|
|
35
|
+
isLoadingStatus: boolean;
|
|
36
|
+
};
|
|
@@ -92,6 +92,15 @@ export interface DimensionalFilterRangeDataResult {
|
|
|
92
92
|
/** Refetch function to manually trigger the query */
|
|
93
93
|
refetch: () => void;
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Builds a Malloy index query to fetch dimension values for a single source
|
|
97
|
+
* Uses Malloy's built-in index operator for dimensional search
|
|
98
|
+
* Reference: https://docs.malloydata.dev/documentation/patterns/dim_index
|
|
99
|
+
*
|
|
100
|
+
* Exported for its spec: the active filters are written by `filterCondition`,
|
|
101
|
+
* the same as the result rows' query, so both agree on what a filter matches.
|
|
102
|
+
*/
|
|
103
|
+
export declare function buildDimensionalIndexQuery(source: string, dimensionSpecs: DimensionSpec[], indexLimit: number, activeFilters?: FilterSelection[]): string;
|
|
95
104
|
/**
|
|
96
105
|
* Custom hook to fetch dimensional filter values from a Malloy model
|
|
97
106
|
*
|
|
@@ -50,7 +50,19 @@ export interface OptionSearch {
|
|
|
50
50
|
*/
|
|
51
51
|
export declare function buildSuggestQuery(source: string, dimension: string,
|
|
52
52
|
/** Text the values must contain, ignoring case: a search of a truncated list. */
|
|
53
|
-
search?: string): string;
|
|
53
|
+
search?: string, options?: SuggestQueryOptions): string;
|
|
54
|
+
/** How {@link buildSuggestQuery} writes its names. */
|
|
55
|
+
export interface SuggestQueryOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Backtick-quote every name (the source, each segment of the dimension's
|
|
58
|
+
* path, the output column), so a reserved word (`year`, `source`) or a name
|
|
59
|
+
* with a space is still read as a name. Off, the names are written as the
|
|
60
|
+
* `suggest` gave them, as before; a keyword then fails the query. On for a
|
|
61
|
+
* server whose `PUBLISHER_MODEL_PAGE` is `viewer`, and always in the model
|
|
62
|
+
* viewer.
|
|
63
|
+
*/
|
|
64
|
+
quoteNames?: boolean;
|
|
65
|
+
}
|
|
54
66
|
/**
|
|
55
67
|
* Text as a Malloy string literal, whatever it holds: a backslash and a
|
|
56
68
|
* single quote escaped, in that order, so neither can end the literal early.
|
|
@@ -110,7 +122,19 @@ applied?: AppliedGivens,
|
|
|
110
122
|
* Text-source mode: the document's definitions, sent ahead of the suggest as
|
|
111
123
|
* the viewer's own text. Absent, a suggest runs by name or by view as before.
|
|
112
124
|
*/
|
|
113
|
-
preamble?: string
|
|
125
|
+
preamble?: string,
|
|
126
|
+
/**
|
|
127
|
+
* Only these givens' options are fetched, for a page that loads a picker's
|
|
128
|
+
* list when it is opened rather than on render (the model viewer, where
|
|
129
|
+
* nothing runs until the reader asks). Absent, every picker's list is.
|
|
130
|
+
*/
|
|
131
|
+
only?: ReadonlySet<string>,
|
|
132
|
+
/**
|
|
133
|
+
* Quote every name in a generated suggest query (see
|
|
134
|
+
* {@link SuggestQueryOptions}). Absent, the server's model page decides:
|
|
135
|
+
* quoted on a `viewer` server, written as given otherwise.
|
|
136
|
+
*/
|
|
137
|
+
quoteNames?: boolean): {
|
|
114
138
|
options: Map<string, string[]>;
|
|
115
139
|
isLoading: boolean;
|
|
116
140
|
/**
|