@malloy-publisher/sdk 0.0.249 → 0.0.250

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 (165) hide show
  1. package/README.md +5 -0
  2. package/TREE_SHAKING.md +5 -0
  3. package/bunfig.toml +3 -0
  4. package/dist/client/api.d.ts +9 -3
  5. package/dist/components/drill/resolveDrill.d.ts +0 -20
  6. package/dist/components/given/filterValue.d.ts +0 -20
  7. package/dist/components/styles.d.ts +12 -4
  8. package/dist/{core-DZk7z7ko.cjs.js → core-CVXEUnnm.cjs.js} +1 -1
  9. package/dist/{core-DFBwNhvb.es.js → core-Cr-9Wkp3.es.js} +1 -1
  10. package/dist/{index-CWQXhe0D.cjs.js → index-C-KeIwsG.cjs.js} +84 -83
  11. package/dist/{index-CLcRrkxd.es.js → index-DVkelll3.es.js} +6530 -6545
  12. package/dist/index.cjs.js +1 -1
  13. package/dist/index.es.js +1 -1
  14. package/dist/utils/malloyString.d.ts +7 -0
  15. package/package.json +1 -1
  16. package/src/client-entry.ts +3 -0
  17. package/src/components/AnalyzePackageButton.tsx +3 -0
  18. package/src/components/ApiErrorDisplay.tsx +3 -0
  19. package/src/components/Connections/AddConnectionDialog.tsx +3 -0
  20. package/src/components/Connections/DeleteConnectionDialog.tsx +3 -0
  21. package/src/components/Connections/EditConnectionDialog.tsx +3 -0
  22. package/src/components/Connections/common.ts +3 -0
  23. package/src/components/DOMElement/DOMElement.tsx +3 -0
  24. package/src/components/DOMElement/index.ts +3 -0
  25. package/src/components/Dashboard/Dashboard.tsx +3 -0
  26. package/src/components/Dashboard/DashboardTile.tsx +3 -0
  27. package/src/components/Dashboard/index.ts +3 -0
  28. package/src/components/DataAppViewer/DataAppViewer.tsx +3 -0
  29. package/src/components/DataAppViewer/index.ts +3 -0
  30. package/src/components/Environment/About.tsx +3 -0
  31. package/src/components/Environment/AddPackageDialog.tsx +3 -0
  32. package/src/components/Environment/ConnectionExplorer.tsx +3 -0
  33. package/src/components/Environment/Connections.tsx +3 -0
  34. package/src/components/Environment/DeletePackageDialog.tsx +3 -0
  35. package/src/components/Environment/EditPackageDialog.tsx +3 -0
  36. package/src/components/Environment/Environment.tsx +3 -0
  37. package/src/components/Environment/Packages.tsx +3 -0
  38. package/src/components/Environment/index.ts +3 -0
  39. package/src/components/Home/AddEnvironmentDialog.tsx +3 -0
  40. package/src/components/Home/DeleteEnvironmentDialog.tsx +3 -0
  41. package/src/components/Home/EditEnvironmentDialog.tsx +3 -0
  42. package/src/components/Home/Home.tsx +13 -14
  43. package/src/components/Home/index.ts +3 -0
  44. package/src/components/Loading.tsx +3 -0
  45. package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +3 -0
  46. package/src/components/Materializations/CreateMaterializationDialog.tsx +3 -0
  47. package/src/components/Materializations/DeleteMaterializationDialog.tsx +3 -0
  48. package/src/components/Materializations/EnvironmentMaterializations.tsx +3 -0
  49. package/src/components/Materializations/ManifestView.tsx +3 -0
  50. package/src/components/Materializations/MaterializationDetailDialog.tsx +3 -0
  51. package/src/components/Materializations/MaterializationRunsList.tsx +3 -0
  52. package/src/components/Materializations/Materializations.tsx +3 -0
  53. package/src/components/Materializations/ScheduleCard.tsx +3 -0
  54. package/src/components/Materializations/SectionLabel.tsx +3 -0
  55. package/src/components/Materializations/SetScheduleDialog.tsx +3 -0
  56. package/src/components/Materializations/TriggerChip.tsx +3 -0
  57. package/src/components/Materializations/cron.ts +3 -0
  58. package/src/components/Materializations/index.ts +3 -0
  59. package/src/components/Materializations/utils.ts +3 -0
  60. package/src/components/Model/Model.tsx +3 -0
  61. package/src/components/Model/ModelCell.tsx +3 -0
  62. package/src/components/Model/ModelExplorer.tsx +3 -0
  63. package/src/components/Model/ModelExplorerDialog.tsx +3 -0
  64. package/src/components/Model/SourcesExplorer.tsx +3 -0
  65. package/src/components/Model/index.ts +3 -0
  66. package/src/components/Model/useModelData.ts +3 -0
  67. package/src/components/Notebook/Notebook.tsx +3 -0
  68. package/src/components/Notebook/NotebookCell.tsx +3 -0
  69. package/src/components/Notebook/index.ts +3 -0
  70. package/src/components/Notebook/runPlan.spec.ts +3 -0
  71. package/src/components/Notebook/runPlan.ts +3 -0
  72. package/src/components/Notebook/types.ts +3 -0
  73. package/src/components/Package/ContentTypeIcon.spec.ts +3 -0
  74. package/src/components/Package/ContentTypeIcon.tsx +3 -0
  75. package/src/components/Package/FileTreeView.tsx +3 -0
  76. package/src/components/Package/Models.tsx +3 -0
  77. package/src/components/Package/Package.tsx +3 -0
  78. package/src/components/Package/index.ts +3 -0
  79. package/src/components/QueryResult/QueryResult.tsx +3 -0
  80. package/src/components/QueryResult/index.ts +3 -0
  81. package/src/components/RenderedResult/RenderedResult.tsx +3 -0
  82. package/src/components/RenderedResult/ResultContainer.tsx +3 -0
  83. package/src/components/RenderedResult/index.ts +3 -0
  84. package/src/components/RenderedResult/renderLogs.spec.ts +3 -0
  85. package/src/components/RenderedResult/renderLogs.ts +3 -0
  86. package/src/components/ResultsDialog.tsx +3 -0
  87. package/src/components/ServerProvider.tsx +3 -0
  88. package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
  89. package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
  90. package/src/components/Workbook/ModelPicker.tsx +3 -0
  91. package/src/components/Workbook/MutableCell.tsx +3 -0
  92. package/src/components/Workbook/Workbook.tsx +3 -0
  93. package/src/components/Workbook/WorkbookList.tsx +3 -0
  94. package/src/components/Workbook/WorkbookManager.ts +3 -0
  95. package/src/components/Workbook/WorkbookStorage.ts +3 -0
  96. package/src/components/Workbook/WorkbookStorageProvider.tsx +3 -0
  97. package/src/components/Workbook/index.ts +3 -0
  98. package/src/components/click_helper.ts +3 -0
  99. package/src/components/drill/index.ts +3 -0
  100. package/src/components/drill/markDrillableCells.dom.spec.ts +3 -0
  101. package/src/components/drill/markDrillableCells.spec.ts +3 -0
  102. package/src/components/drill/markDrillableCells.ts +3 -0
  103. package/src/components/drill/resolveDrill.spec.ts +3 -0
  104. package/src/components/drill/resolveDrill.ts +3 -0
  105. package/src/components/drill/useDrill.tsx +3 -0
  106. package/src/components/filter/DimensionFilter.tsx +3 -0
  107. package/src/components/filter/index.ts +3 -0
  108. package/src/components/filter/utils.ts +16 -5
  109. package/src/components/given/GivenInput.spec.tsx +3 -0
  110. package/src/components/given/GivenInput.tsx +3 -0
  111. package/src/components/given/GivensPanel.spec.tsx +3 -0
  112. package/src/components/given/GivensPanel.tsx +3 -0
  113. package/src/components/given/filterValue.spec.ts +3 -0
  114. package/src/components/given/filterValue.ts +3 -0
  115. package/src/components/given/index.ts +3 -0
  116. package/src/components/given/paramCodec.spec.ts +3 -0
  117. package/src/components/given/paramCodec.ts +3 -0
  118. package/src/components/given/utils.spec.ts +3 -0
  119. package/src/components/given/utils.ts +3 -0
  120. package/src/components/highlighter.ts +3 -0
  121. package/src/components/index.ts +3 -0
  122. package/src/components/styles.ts +15 -4
  123. package/src/constants/docLinks.spec.ts +3 -0
  124. package/src/constants/docLinks.ts +3 -0
  125. package/src/hooks/givenValue.ts +3 -0
  126. package/src/hooks/index.ts +3 -0
  127. package/src/hooks/useDimensionFilters.ts +4 -7
  128. package/src/hooks/useDimensionFiltersFromSpec.ts +3 -0
  129. package/src/hooks/useDimensionFiltersQuery.ts +4 -7
  130. package/src/hooks/useDimensionalFilterRangeData.ts +4 -7
  131. package/src/hooks/useGivensState.spec.ts +3 -0
  132. package/src/hooks/useGivensState.ts +3 -0
  133. package/src/hooks/useModelGivens.ts +3 -0
  134. package/src/hooks/useQueryWithApiError.ts +3 -0
  135. package/src/hooks/useRawQueryData.ts +3 -0
  136. package/src/hooks/useSuggestOptions.spec.ts +3 -0
  137. package/src/hooks/useSuggestOptions.ts +3 -0
  138. package/src/index.ts +3 -0
  139. package/src/react-app-env.d.ts +3 -0
  140. package/src/theme/ThemeContext.tsx +3 -0
  141. package/src/theme/buildMalloyExplicitTheme.ts +3 -0
  142. package/src/theme/buildTableCssVars.spec.ts +3 -0
  143. package/src/theme/buildTableCssVars.ts +3 -0
  144. package/src/theme/buildVegaThemeOverride.spec.ts +3 -0
  145. package/src/theme/buildVegaThemeOverride.ts +3 -0
  146. package/src/theme/defaults.ts +3 -0
  147. package/src/theme/index.ts +3 -0
  148. package/src/theme/keys.ts +3 -0
  149. package/src/theme/readChartAnnotations.spec.ts +3 -0
  150. package/src/theme/readChartAnnotations.ts +3 -0
  151. package/src/theme/resolveTheme.spec.ts +3 -0
  152. package/src/theme/resolveTheme.ts +3 -0
  153. package/src/theme/types.ts +3 -0
  154. package/src/utils/dataAppEmbed.spec.ts +3 -0
  155. package/src/utils/dataAppEmbed.ts +3 -0
  156. package/src/utils/formatting.spec.ts +3 -0
  157. package/src/utils/formatting.ts +3 -0
  158. package/src/utils/malloyString.spec.ts +24 -0
  159. package/src/utils/malloyString.ts +12 -0
  160. package/src/utils/parsing.spec.ts +3 -0
  161. package/src/utils/parsing.ts +3 -0
  162. package/src/utils/queryClient.ts +3 -0
  163. package/test/README.md +5 -0
  164. package/test/setup.ts +3 -0
  165. package/vite.config.ts +3 -0
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import type { ResolvedTheme } from "./types";
2
5
 
3
6
  /**
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { MALLOY_BRAND } from "../components/styles";
2
5
  import type { Theme } from "./types";
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export { buildMalloyExplicitTheme } from "./buildMalloyExplicitTheme";
2
5
  export { buildTableCssVars } from "./buildTableCssVars";
3
6
  export { buildVegaThemeOverride } from "./buildVegaThemeOverride";
package/src/theme/keys.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /**
2
5
  * The set of palette colour keys that have separate light and dark
3
6
  * variants. This is the SDK-side canonical list, consumed by the
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { parseAnnotation } from "@malloydata/malloy-tag";
2
5
  import { describe, expect, it } from "bun:test";
3
6
  import { readChartAnnotations } from "./readChartAnnotations";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import type { Tag } from "@malloydata/malloy-tag";
2
5
  import { PER_MODE_COLOR_KEYS } from "./keys";
3
6
  import type { Theme } from "./types";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { describe, expect, it } from "bun:test";
2
5
  import { resolveMode, resolveTheme } from "./resolveTheme";
3
6
  import type { Theme } from "./types";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { DEFAULT_THEME } from "./defaults";
2
5
  import { PER_MODE_COLOR_KEYS, type PerModeColorKey } from "./keys";
3
6
  import type { ResolvedTheme, Theme, ThemeMode } from "./types";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import type { Theme } from "../client";
2
5
 
3
6
  export type { Theme };
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { describe, expect, it } from "bun:test";
2
5
  import {
3
6
  isPublisherResizeMessage,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  // Shared contract for serving and embedding in-package HTML data apps.
2
5
  //
3
6
  // Both the Publisher SPA host (DataAppViewer.tsx, Package.tsx) and the
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { describe, expect, it } from "bun:test";
2
5
  import { encodeResourceUri, parseResourceUri } from "./formatting";
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export type ParsedResource = {
2
5
  environmentName: string;
3
6
  packageName?: string | undefined;
@@ -0,0 +1,24 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import { describe, expect, it } from "bun:test";
5
+ import { escapeMalloyString } from "./malloyString";
6
+
7
+ describe("escapeMalloyString", () => {
8
+ it("escapes a quote", () => {
9
+ expect(escapeMalloyString("O'Brien")).toBe("O\\'Brien");
10
+ });
11
+
12
+ it("escapes a backslash", () => {
13
+ expect(escapeMalloyString("C:\\temp")).toBe("C:\\\\temp");
14
+ });
15
+
16
+ it("escapes backslashes before quotes, so the quote escape is not doubled", () => {
17
+ // Quote-then-backslash order would turn ' into \' and then \\' .
18
+ expect(escapeMalloyString("a'\\b")).toBe("a\\'\\\\b");
19
+ });
20
+
21
+ it("leaves a plain string alone", () => {
22
+ expect(escapeMalloyString("plain value")).toBe("plain value");
23
+ });
24
+ });
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ /**
5
+ * Escape a value for use inside a single-quoted Malloy string literal.
6
+ *
7
+ * Backslashes are escaped first, then quotes: doing it the other way round
8
+ * would re-escape the backslash that the quote escape introduced.
9
+ */
10
+ export function escapeMalloyString(value: string): string {
11
+ return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
12
+ }
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { describe, expect, it } from "bun:test";
2
5
  import {
3
6
  generateEnvironmentReadme,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  // Helper function to extract a brief description from README content
2
5
  export const getEnvironmentDescription = (
3
6
  readme: string | undefined,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { QueryClient } from "@tanstack/react-query";
2
5
 
3
6
  // Global QueryClient instance - isolated to avoid circular dependencies
package/test/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ <!--
2
+ Copyright (c) Credible Data Inc.
3
+ SPDX-License-Identifier: MIT
4
+ -->
5
+
1
6
  # Testing React components and hooks in the SDK
2
7
 
3
8
  `bun test` in this package runs with a DOM, so components and hooks can be
package/test/setup.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /**
2
5
  * DOM environment for `bun test` in this package.
3
6
  *
package/vite.config.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import react from "@vitejs/plugin-react";
2
5
  import { defineConfig } from "vite";
3
6
  import dts from "vite-plugin-dts";