@malloy-publisher/sdk 0.2.6 → 0.3.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 (100) hide show
  1. package/README.md +172 -204
  2. package/dist/ServerProvider-CGnLjzag.cjs.js +1 -0
  3. package/dist/{ServerProvider-ksC5Su_x.es.js → ServerProvider-DSK9rfSY.es.js} +245 -245
  4. package/dist/client/api.d.ts +13 -1
  5. package/dist/client/index.cjs.js +1 -1
  6. package/dist/client/index.es.js +1 -1
  7. package/dist/components/ApiErrorDisplay.d.ts +1 -2
  8. package/dist/components/Dashboard/Dashboard.d.ts +4 -2
  9. package/dist/components/Dashboard/promoteMeasureRow.d.ts +36 -0
  10. package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +14 -0
  11. package/dist/components/DocumentStorage/DocumentStorage.d.ts +58 -0
  12. package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +18 -0
  13. package/dist/components/DocumentStorage/index.d.ts +3 -0
  14. package/dist/components/Model/index.d.ts +0 -1
  15. package/dist/components/RenderedResult/RenderedResult.d.ts +12 -0
  16. package/dist/components/RenderedResult/ResultContainer.d.ts +7 -1
  17. package/dist/components/RenderedResult/index.d.ts +1 -0
  18. package/dist/components/RenderedResult/resultSizing.d.ts +183 -0
  19. package/dist/components/drill/index.d.ts +1 -0
  20. package/dist/components/drill/useDrillSelf.d.ts +46 -0
  21. package/dist/components/given/filterValue.d.ts +63 -0
  22. package/dist/components/given/index.d.ts +1 -0
  23. package/dist/components/given/useGivenUrlParams.d.ts +39 -0
  24. package/dist/components/index.d.ts +2 -3
  25. package/dist/components/styles.d.ts +3 -3
  26. package/dist/core-8NVBCLZh.cjs.js +148 -0
  27. package/dist/{core-xdZbLgaF.es.js → core-B8oMW4sm.es.js} +3540 -2335
  28. package/dist/hooks/index.d.ts +1 -1
  29. package/dist/hooks/useSuggestOptions.d.ts +28 -12
  30. package/dist/index.cjs.js +281 -1
  31. package/dist/index.es.js +45803 -79
  32. package/dist/sdk.css +1 -1
  33. package/dist/styles.css +0 -1
  34. package/package.json +2 -6
  35. package/src/components/ApiErrorDisplay.tsx +1 -1
  36. package/src/components/Connections/EditConnectionDialog.tsx +96 -86
  37. package/src/components/Dashboard/Dashboard.tsx +60 -95
  38. package/src/components/Dashboard/DashboardTile.tsx +25 -2
  39. package/src/components/Dashboard/promoteMeasureRow.spec.ts +137 -0
  40. package/src/components/Dashboard/promoteMeasureRow.ts +129 -0
  41. package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +81 -0
  42. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +105 -0
  43. package/src/components/DocumentStorage/DocumentStorage.ts +73 -0
  44. package/src/components/DocumentStorage/DocumentStorageProvider.tsx +46 -0
  45. package/src/components/DocumentStorage/index.ts +15 -0
  46. package/src/components/Environment/Connections.tsx +15 -15
  47. package/src/components/Model/ModelCell.tsx +2 -1
  48. package/src/components/Model/index.ts +0 -1
  49. package/src/components/Notebook/Notebook.tsx +10 -76
  50. package/src/components/Notebook/NotebookCell.tsx +2 -8
  51. package/src/components/RenderedResult/RenderedResult.tsx +86 -76
  52. package/src/components/RenderedResult/ResultContainer.tsx +21 -24
  53. package/src/components/RenderedResult/index.ts +15 -0
  54. package/src/components/RenderedResult/resultSizing.spec.ts +249 -0
  55. package/src/components/RenderedResult/resultSizing.ts +308 -0
  56. package/src/components/ResultsDialog.tsx +2 -1
  57. package/src/components/drill/index.ts +5 -0
  58. package/src/components/drill/useDrillSelf.spec.tsx +64 -0
  59. package/src/components/drill/useDrillSelf.ts +110 -0
  60. package/src/components/given/GivenInput.spec.tsx +196 -2
  61. package/src/components/given/GivenInput.tsx +300 -25
  62. package/src/components/given/filterValue.spec.ts +112 -0
  63. package/src/components/given/filterValue.ts +188 -0
  64. package/src/components/given/index.ts +4 -0
  65. package/src/components/given/useGivenUrlParams.spec.tsx +74 -0
  66. package/src/components/given/useGivenUrlParams.ts +87 -0
  67. package/src/components/index.ts +5 -3
  68. package/src/hooks/index.ts +0 -1
  69. package/src/hooks/useGivensState.spec.ts +158 -0
  70. package/src/hooks/useGivensState.ts +114 -23
  71. package/src/hooks/useSuggestOptions.dom.spec.ts +60 -1
  72. package/src/hooks/useSuggestOptions.ts +94 -51
  73. package/vite.config.ts +0 -1
  74. package/dist/ServerProvider-xXW1HJOJ.cjs.js +0 -1
  75. package/dist/components/AnalyzePackageButton.d.ts +0 -6
  76. package/dist/components/Workbook/BrowserWorkbookStorage.d.ts +0 -9
  77. package/dist/components/Workbook/EditableMalloyCell.d.ts +0 -11
  78. package/dist/components/Workbook/ModelPicker.d.ts +0 -11
  79. package/dist/components/Workbook/MutableCell.d.ts +0 -17
  80. package/dist/components/Workbook/Workbook.d.ts +0 -7
  81. package/dist/components/Workbook/WorkbookList.d.ts +0 -7
  82. package/dist/components/Workbook/WorkbookManager.d.ts +0 -84
  83. package/dist/components/Workbook/WorkbookStorage.d.ts +0 -17
  84. package/dist/components/Workbook/WorkbookStorageProvider.d.ts +0 -12
  85. package/dist/components/Workbook/index.d.ts +0 -7
  86. package/dist/core-RvrkY1Ss.cjs.js +0 -148
  87. package/dist/index-B3scIDRd.cjs.js +0 -356
  88. package/dist/index-Bda7HuZc.es.js +0 -66409
  89. package/dist/markdown-editor.css +0 -341
  90. package/src/components/AnalyzePackageButton.tsx +0 -319
  91. package/src/components/Workbook/BrowserWorkbookStorage.ts +0 -64
  92. package/src/components/Workbook/EditableMalloyCell.tsx +0 -49
  93. package/src/components/Workbook/ModelPicker.tsx +0 -134
  94. package/src/components/Workbook/MutableCell.tsx +0 -458
  95. package/src/components/Workbook/Workbook.tsx +0 -501
  96. package/src/components/Workbook/WorkbookList.tsx +0 -110
  97. package/src/components/Workbook/WorkbookManager.ts +0 -214
  98. package/src/components/Workbook/WorkbookStorage.ts +0 -35
  99. package/src/components/Workbook/WorkbookStorageProvider.tsx +0 -40
  100. package/src/components/Workbook/index.ts +0 -10
@@ -1,7 +1,7 @@
1
1
  export { useDimensionFilters, type DimensionFilterState, type FilterSelection, type MatchType, type UseDimensionFiltersParams, type UseDimensionFiltersResult, } from './useDimensionFilters';
2
2
  export { useDimensionFiltersFromSpec, type DimensionFiltersConfig, type UseDimensionFiltersFromSpecOptions, } from './useDimensionFiltersFromSpec';
3
3
  export { useDimensionFiltersQuery, type DimensionFiltersQueryResult, type UseDimensionFiltersQueryParams, } from './useDimensionFiltersQuery';
4
- export { useDimensionalFilterRangeData, getDimensionKey, makeDimensionKey, type DimensionalFilterRangeDataResult, type DimensionSpec, type DimensionValue, type DimensionValues, type FilterType, type UseDimensionalFilterRangeDataParams, } from './useDimensionalFilterRangeData';
4
+ export { useDimensionalFilterRangeData, getDimensionKey, type DimensionalFilterRangeDataResult, type DimensionSpec, type DimensionValue, type DimensionValues, type FilterType, type UseDimensionalFilterRangeDataParams, } from './useDimensionalFilterRangeData';
5
5
  export { useModelGivens } from './useModelGivens';
6
6
  export { type GivenValue } from './givenValue';
7
7
  export { useGivensState, type UseGivensStateOptions, type UseGivensStateResult, } from './useGivensState';
@@ -1,4 +1,5 @@
1
1
  import { Given } from '../client';
2
+ import { GivenValue } from './givenValue';
2
3
  /**
3
4
  * How many options a generated `suggest { source=… dimension=… }` asks for.
4
5
  *
@@ -37,19 +38,34 @@ export declare function buildSuggestQuery(source: string, dimension: string): st
37
38
  * flat row form is what the widget needs, and asking for the full Malloy result
38
39
  * would mean parsing rendering metadata to get at a list of strings.
39
40
  *
40
- * KNOWN GAP, latent until something populates `suggest`. The request carries no
41
- * `givens`, and `QueryRequest` has a field for them. That is fine for row caps
42
- * but not for `#(authorize)`: a gate is evaluated against the request's givens,
43
- * so a `suggest` over a gated source is denied and every dropdown on it resolves
44
- * to "Options unavailable": the failure surfaces honestly, but the control is
45
- * unusable. Deliberately not guessed at here, because *which* givens a suggest
46
- * should carry is a real decision: the applied ones make the option list depend
47
- * on the current filters, which this hook's caching deliberately avoids, while
48
- * only the gate-relevant ones means knowing which those are. Whoever populates
49
- * `suggest` server-side should settle it, and this hook's signature will need
50
- * the values passed in.
41
+ * The request carries the givens the suggest query NEEDS and no others. An
42
+ * `#(authorize)` gate is evaluated against the request's givens, so a suggest
43
+ * over a gated source was denied outright and its dropdown read "Options
44
+ * unavailable". Sending every applied value would have fixed that but made the
45
+ * option list depend on the page's other filters, which this hook's caching
46
+ * deliberately avoids. So the server says, per suggest, which givens its source
47
+ * is gated or scoped by (`suggest.givenNames`), and {@link suggestRequestGivens}
48
+ * sends the current values of exactly those; the cache is keyed on them too.
49
+ * A server too old to name them sends none, and the request is as before.
51
50
  */
52
- export declare function useSuggestOptions(environmentName: string, packageName: string, modelPath: string | undefined, specs: Given[], versionId?: string): {
51
+ /**
52
+ * The current values a suggest query has to carry: the applied values of the
53
+ * givens the server named on it, encoded for the request. Undefined when the
54
+ * suggest names none, or when the caller has no applied values to offer.
55
+ */
56
+ export declare function suggestRequestGivens(spec: Given, applied: AppliedGivens | undefined): Record<string, unknown> | undefined;
57
+ /** The applied control row and the declared types that encode it. */
58
+ export interface AppliedGivens {
59
+ values: ReadonlyMap<string, GivenValue>;
60
+ declaredTypes: ReadonlyMap<string, string | undefined>;
61
+ }
62
+ export declare function useSuggestOptions(environmentName: string, packageName: string, modelPath: string | undefined, specs: Given[], versionId?: string,
63
+ /**
64
+ * The page's applied values, so a suggest can carry the givens its source
65
+ * is gated or scoped by. Optional for the same reason as `versionId`; a
66
+ * caller that omits it gets the pre-gating behaviour.
67
+ */
68
+ applied?: AppliedGivens): {
53
69
  options: Map<string, string[]>;
54
70
  isLoading: boolean;
55
71
  /**