@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,11 +0,0 @@
1
- import { SourceAndPath, QueryExplorerResult } from '../Model/SourcesExplorer';
2
- import { WorkbookCellValue } from './WorkbookManager';
3
- interface EditableMalloyCellProps {
4
- cell: WorkbookCellValue;
5
- sourceAndPaths: SourceAndPath[];
6
- resourceUri: string;
7
- onQueryChange: (query: QueryExplorerResult) => void;
8
- onSourceChange?: (index: number) => void;
9
- }
10
- export declare function EditableMalloyCell({ cell, sourceAndPaths, resourceUri, onQueryChange, onSourceChange, }: EditableMalloyCellProps): import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1,11 +0,0 @@
1
- interface ModelPickerProps {
2
- initialSelectedModels: string[];
3
- onModelChange: (models: string[]) => void;
4
- resourceUri: string;
5
- }
6
- /**
7
- * Picks Models that are available in the package.
8
- * Only "malloy" model files are shown.
9
- */
10
- export declare function ModelPicker({ initialSelectedModels, onModelChange, resourceUri, }: ModelPickerProps): import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1,17 +0,0 @@
1
- import { default as React } from 'react';
2
- import { SourceAndPath } from '../Model/SourcesExplorer';
3
- import { WorkbookCellValue } from './WorkbookManager';
4
- interface NotebookCellProps {
5
- cell: WorkbookCellValue;
6
- editingMalloy?: boolean;
7
- editingMarkdown?: boolean;
8
- sourceAndPaths: SourceAndPath[];
9
- resourceUri: string;
10
- onCellChange: (cell: WorkbookCellValue) => void;
11
- onClose: () => void;
12
- onEdit: () => void;
13
- onDelete: () => void;
14
- addButtonCallback: (isMarkdown: boolean) => React.ReactNode;
15
- }
16
- export declare function MutableCell({ cell, editingMalloy, editingMarkdown, sourceAndPaths, resourceUri, onCellChange, onClose, onEdit, onDelete, addButtonCallback, }: NotebookCellProps): import("react/jsx-runtime").JSX.Element;
17
- export {};
@@ -1,7 +0,0 @@
1
- import { WorkbookLocator } from './WorkbookStorage';
2
- interface WorkbookProps {
3
- workbookPath?: WorkbookLocator;
4
- resourceUri: string;
5
- }
6
- export default function Workbook({ workbookPath, resourceUri }: WorkbookProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- import { WorkbookLocator } from './WorkbookStorage';
3
- interface WorkbookListProps {
4
- onWorkbookClick: (workbook: WorkbookLocator, event: React.MouseEvent) => void;
5
- }
6
- export declare function WorkbookList({ onWorkbookClick }: WorkbookListProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,84 +0,0 @@
1
- import { WorkbookLocator, WorkbookStorage } from './WorkbookStorage';
2
- /**
3
- * Interface representing the data structure of a Mutable Workbook
4
- * @interface WorkbookData
5
- * @property {string[]} models - Array of model paths used in the workbook
6
- * @property {WorkbookCellValue[]} cells - Array of cells in the workbook
7
- * @property {WorkbookLocator} workbookPath - Path to the workbook file (relative to project/package)
8
- */
9
- export interface WorkbookData {
10
- models: string[];
11
- cells: WorkbookCellValue[];
12
- workbookPath: WorkbookLocator;
13
- }
14
- /**
15
- * Interface representing a cell in the workbook
16
- * @interface WorkbookCellValue
17
- * @property {boolean} isMarkdown - Whether the cell is a markdown cell
18
- * @property {string} [value] - The content of the cell
19
- * @property {string} [result] - The result of executing the cell
20
- * @property {string} [modelPath] - modelPath associated with the query in the cell
21
- * @property {string} [sourceName] - Name of the source associated with the cell
22
- * @property {string} [queryInfo] - Information about the query in the cell
23
- */
24
- export interface WorkbookCellValue {
25
- isMarkdown: boolean;
26
- value?: string;
27
- result?: string;
28
- modelPath?: string;
29
- sourceName?: string;
30
- queryInfo?: string;
31
- }
32
- /**
33
- * Class for managing workbook operations
34
- * @class WorkbookManager
35
- */
36
- export declare class WorkbookManager {
37
- private workbookData;
38
- private isSaved;
39
- private workbookStorage;
40
- /**
41
- * Creates a new WorkbookManager instance
42
- * @param {WorkbookStorage} workbookStorage - Storage implementation
43
- * @param {WorkbookData} workbookData - Initial workbook data
44
- */
45
- constructor(workbookStorage: WorkbookStorage, workbookData: WorkbookData);
46
- /**
47
- * Gets the current workbook data
48
- * @returns {WorkbookData} The current workbook data
49
- */
50
- getWorkbookData(): WorkbookData;
51
- /**
52
- * Gets the current workbook path
53
- * @returns {string} The path to the workbook
54
- */
55
- getWorkbookPath(): WorkbookLocator;
56
- /**
57
- * Renames the workbook and updates storage
58
- * @param {string} workbookPath - New path for the workbook
59
- * @returns {WorkbookManager} The updated WorkbookManager instance
60
- */
61
- renameWorkbook(workbookPath: string): Promise<WorkbookManager>;
62
- getCells(): WorkbookCellValue[];
63
- deleteCell(index: number): WorkbookManager;
64
- insertCell(index: number, cell: WorkbookCellValue): WorkbookManager;
65
- setCell(index: number, cell: WorkbookCellValue): WorkbookManager;
66
- setModels(models: string[]): WorkbookManager;
67
- getModels(): string[];
68
- updateWorkbookData(workbookData: WorkbookData): WorkbookManager;
69
- saveWorkbook(): Promise<WorkbookManager>;
70
- /**
71
- * Converts the workbook data to a Malloy workbook string.
72
- * @returns {string} The Malloy workbook string
73
- */
74
- toMalloyWorkbook(): string;
75
- static newWorkbook(workbookStorage: WorkbookStorage): WorkbookManager;
76
- /**
77
- * Creates a new workbook manager by loading from local storage.
78
- * Returns an empty instance if the workbook is not found.
79
- * @param workbookStorage - The storage implementation
80
- * @param userContext - The user context for storage
81
- * @param workbookPath - The path to the workbook file (relative to project/package)
82
- */
83
- static loadWorkbook(workbookStorage: WorkbookStorage, workbookPath: WorkbookLocator): Promise<WorkbookManager>;
84
- }
@@ -1,17 +0,0 @@
1
- export interface Workspace {
2
- name: string;
3
- writeable: boolean;
4
- description: string;
5
- }
6
- export interface WorkbookLocator {
7
- path: string;
8
- workspace: string;
9
- }
10
- export interface WorkbookStorage {
11
- listWorkspaces(writeableOnly: boolean): Promise<Workspace[]>;
12
- listWorkbooks(workspace: Workspace): Promise<WorkbookLocator[]>;
13
- getWorkbook(path: WorkbookLocator): Promise<string>;
14
- deleteWorkbook(path: WorkbookLocator): Promise<void>;
15
- saveWorkbook(path: WorkbookLocator, workbook: string): Promise<void>;
16
- moveWorkbook(from: WorkbookLocator, to: WorkbookLocator): Promise<void>;
17
- }
@@ -1,12 +0,0 @@
1
- import { default as React } from 'react';
2
- import { WorkbookStorage } from './WorkbookStorage';
3
- export interface WorkbookStorageProviderProps {
4
- children: React.ReactNode;
5
- workbookStorage: WorkbookStorage;
6
- }
7
- interface WorkbookStorageContextValue {
8
- workbookStorage: WorkbookStorage;
9
- }
10
- export declare function WorkbookStorageProvider({ children, workbookStorage, }: WorkbookStorageProviderProps): import("react/jsx-runtime").JSX.Element;
11
- export declare function useWorkbookStorage(): WorkbookStorageContextValue;
12
- export {};
@@ -1,7 +0,0 @@
1
- export type { WorkbookStorage } from './WorkbookStorage';
2
- export { default as Workbook } from './Workbook';
3
- export { WorkbookList } from './WorkbookList';
4
- export { WorkbookStorageProvider } from './WorkbookStorageProvider';
5
- export type { WorkbookLocator, Workspace } from './WorkbookStorage';
6
- export { BrowserWorkbookStorage } from './BrowserWorkbookStorage';
7
- export { WorkbookManager } from './WorkbookManager';