@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 { Warning } from "@mui/icons-material";
2
5
  import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
3
6
  import { Box, Button, IconButton, Tooltip, Typography } from "@mui/material";
@@ -1,2 +1,5 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export { default as RenderedResult } from "./RenderedResult";
2
5
  export { default as ResultContainer } from "./ResultContainer";
@@ -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 { summarizeRenderLogs } from "./renderLogs";
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { LogMessage } from "../../client";
2
5
 
3
6
  export interface RenderLogSummary {
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import CloseIcon from "@mui/icons-material/Close";
2
5
  import { Dialog, DialogContent, DialogTitle, IconButton } from "@mui/material";
3
6
  import { LogMessage } from "../client";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { QueryClientProvider, useQuery } from "@tanstack/react-query";
2
5
  import axios from "axios";
3
6
  import React, {
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import type {
2
5
  WorkbookLocator,
3
6
  WorkbookStorage,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import {
2
5
  SourceAndPath,
3
6
  QueryExplorerResult,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import CloseIcon from "@mui/icons-material/Close";
2
5
  import FileUploadOutlinedIcon from "@mui/icons-material/FileUploadOutlined";
3
6
  import {
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import CheckIcon from "@mui/icons-material/Check";
2
5
  import CodeIcon from "@mui/icons-material/Code";
3
6
  import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  // TODO(jjs) - Export to .malloynb
2
5
  // TOOD(jjs) - Import via Publisher API that parses whole NB
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import {
2
5
  Box,
3
6
  Divider,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import type { WorkbookLocator, WorkbookStorage } from "./WorkbookStorage";
2
5
 
3
6
  /**
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export interface Workspace {
2
5
  name: string;
3
6
  writeable: boolean;
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import React, { createContext, useContext, useMemo } from "react";
2
5
  import type { WorkbookStorage } from "./WorkbookStorage";
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export type { WorkbookStorage } from "./WorkbookStorage";
2
5
  export { default as Workbook } from "./Workbook";
3
6
  export { WorkbookList } from "./WorkbookList";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useNavigate } from "react-router-dom";
2
5
  import { MouseEvent } from "react";
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export {
2
5
  DRILL_CELL_CLASS,
3
6
  drillableFieldNames,
@@ -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
  DRILL_CELL_CLASS,
@@ -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 { drillableFieldNames } from "./markDrillableCells";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /**
2
5
  * Making a drillable cell *look* drillable.
3
6
  *
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import {
2
5
  NumberFilterExpression,
3
6
  StringFilterExpression,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /**
2
5
  * Resolving a renderer click into a `# drill` intent.
3
6
  *
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { ListSubheader, Menu, MenuItem } from "@mui/material";
2
5
  import { useCallback, useMemo, useState, type ReactNode } from "react";
3
6
  import type { DrillField } from "./resolveDrill";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import Autocomplete from "@mui/material/Autocomplete";
2
5
  import Box from "@mui/material/Box";
3
6
  import CircularProgress from "@mui/material/CircularProgress";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export { DimensionFilter } from "./DimensionFilter";
2
5
  export type {
3
6
  DimensionFilterProps,
@@ -1,9 +1,13 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import * as Malloy from "@malloydata/malloy-interfaces";
2
5
  import {
3
6
  DimensionSpec,
4
7
  FilterType,
5
8
  } from "../../hooks/useDimensionalFilterRangeData";
6
9
  import { FilterSelection } from "../../hooks/useDimensionFilters";
10
+ import { escapeMalloyString } from "../../utils/malloyString";
7
11
 
8
12
  /**
9
13
  * A single filter specification with source and dimension
@@ -136,9 +140,16 @@ export function parseAllSourceInfos(
136
140
  if (cell.type === "code") {
137
141
  // Extract model path from the first import statement found
138
142
  if (!modelPath && cell.text) {
139
- const importMatch = cell.text.match(
140
- /import\s+(?:\{[^}]*\}\s+from\s+)?['"]([^'"]+)['"]/,
141
- );
143
+ // The first quoted string on the first `import` line is the
144
+ // module path, for both `import 'x'` and `import {a} from 'x'`.
145
+ // A line scan rather than one regex over the whole cell: the
146
+ // optional `{...} from` group made that regex backtrack
147
+ // polynomially on adversarial input.
148
+ const importLine = cell.text
149
+ .split("\n")
150
+ .map((line) => line.trim())
151
+ .find((line) => line.startsWith("import "));
152
+ const importMatch = importLine?.match(/['"]([^'"\n]+)['"]/);
142
153
  if (importMatch) {
143
154
  modelPath = importMatch[1];
144
155
  }
@@ -295,7 +306,7 @@ export function generateFilterClause(
295
306
  return `@${v.getFullYear()}-${String(v.getMonth() + 1).padStart(2, "0")}-${String(v.getDate()).padStart(2, "0")}`;
296
307
  }
297
308
  if (typeof v === "string") {
298
- return `'${v.replace(/'/g, "\\'")}'`;
309
+ return `'${escapeMalloyString(v)}'`;
299
310
  }
300
311
  if (typeof v === "boolean") return v ? "true" : "false";
301
312
  return String(v);
@@ -314,7 +325,7 @@ export function generateFilterClause(
314
325
 
315
326
  case "Contains":
316
327
  if (typeof value === "string") {
317
- return `${fieldName} ~ f'%${value.replace(/'/g, "\\'")}%'`;
328
+ return `${fieldName} ~ f'%${escapeMalloyString(value)}%'`;
318
329
  }
319
330
  return `${fieldName} = ${formatValue(value)}`;
320
331
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { describe, expect, it, mock } from "bun:test";
2
5
  import { cleanup, fireEvent, render, screen } from "@testing-library/react";
3
6
  import type { Given } from "../../client";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import ClearIcon from "@mui/icons-material/Clear";
2
5
  import {
3
6
  Autocomplete,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { fireEvent, render, screen } from "@testing-library/react";
2
5
  import { describe, expect, it } from "bun:test";
3
6
  import { useState } from "react";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { Box, Button, Paper, Stack, Typography } from "@mui/material";
2
5
  import { Given } from "../../client";
3
6
  import { GivenValue } from "../../hooks/givenValue";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { StringFilterExpression } from "@malloydata/malloy-filter";
2
5
  import { describe, expect, it } from "bun:test";
3
6
  import {
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /**
2
5
  * Encoding between control widgets and `filter<…>` given values.
3
6
  *
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export { GivenInput, type GivenInputProps } from "./GivenInput";
2
5
  export {
3
6
  GivensPanel,
@@ -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 dayjs from "dayjs";
3
6
  import utc from "dayjs/plugin/utc";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /**
2
5
  * Between a given's value and the two wire forms it takes: a URL query
3
6
  * parameter, and the `givens` map on a query request.
@@ -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 { renderGivenDefault } from "./utils";
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /**
2
5
  * Render a given's `default` (a raw Malloy source literal) for display in the
3
6
  * input as placeholder / helper text. Returns undefined when there is no
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
5
  import type { HighlighterCore } from "shiki/core";
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export { AnalyzePackageButton } from "./AnalyzePackageButton";
2
5
  export { useRouterClickHandler, type NavigationClick } from "./click_helper";
3
6
  export * from "./Dashboard";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { Card, CardContent, CardMedia, styled } from "@mui/material";
2
5
 
3
6
  /**
@@ -24,10 +27,18 @@ export const MALLOY_BRAND = {
24
27
  * WCAG minimum for a graphical object. The nearest series hues do not: `#aacd85`
25
28
  * sage is 1.8:1, `#ec72b8` pink 2.7:1, `#b87ced` violet 2.9:1.
26
29
  *
27
- * The bar is stated for these three only. `MALLOY_BRAND` above is inherited from
28
- * the logo and teal is 2.5:1, which is below it, so the row it backs has a
29
- * white-on-teal glyph that does not meet the same standard. Pre-existing, not
30
- * introduced here, and it is a brand decision rather than a component one.
30
+ * These three were picked against the bar, but they are not the only colors it
31
+ * now binds. `CONTENT_TINT` in `Package/ContentTypeIcon.tsx` paints all three of
32
+ * `MALLOY_BRAND` behind glyphs as well, and `ContentTypeIcon.spec.ts` holds two
33
+ * of them to the same 3:1: orange at 3.09:1 and darkBlue at 5.17:1. Orange
34
+ * clears it by 0.09, so retuning it lighter turns that suite red, in a file a
35
+ * brand change would not otherwise open. For those two the bar is a component
36
+ * constraint, not only a brand decision.
37
+ *
38
+ * Teal is the exception at 2.5:1, below the bar and inherited from the logo, so
39
+ * the row it backs carries a white-on-teal glyph that does not meet the
40
+ * standard. Pre-existing, not introduced here. The spec grandfathers it by
41
+ * content type rather than by color, so a new type handed teal still fails.
31
42
  */
32
43
  export const MALLOY_ACCENT = {
33
44
  violet: "#7c4dcc",
@@ -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 { readdirSync } from "fs";
3
6
  import { join } from "path";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  // Central list of the Malloy documentation URLs the Publisher UI links to.
2
5
  // Keeping them in one place means a docs move only needs updating here, rather
3
6
  // than hunting down hardcoded links across the app.
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /**
2
5
  * UI-side value for a given. Mirrors the JS shapes the server accepts for
3
6
  * `givens` runtime values, plus `Date` (serialized before send: see
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  // Filter hooks and types
2
5
  export {
3
6
  useDimensionFilters,
@@ -1,8 +1,12 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useCallback, useEffect, useState } from "react";
2
5
  import {
3
6
  DimensionSpec,
4
7
  getDimensionKey,
5
8
  } from "./useDimensionalFilterRangeData";
9
+ import { escapeMalloyString } from "../utils/malloyString";
6
10
 
7
11
  /**
8
12
  * Match types for filtering dimensions
@@ -75,13 +79,6 @@ export interface UseDimensionFiltersResult {
75
79
  generateWhereClause: () => string;
76
80
  }
77
81
 
78
- /**
79
- * Escapes special characters in strings for Malloy queries
80
- */
81
- function escapeMalloyString(value: string): string {
82
- return value.replace(/'/g, "\\'").replace(/\\/g, "\\\\");
83
- }
84
-
85
82
  /**
86
83
  * Formats a value for use in Malloy query
87
84
  */
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useMemo } from "react";
2
5
  import {
3
6
  DimensionSpec,
@@ -1,7 +1,11 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useCallback, useMemo, useState } from "react";
2
5
  import { createEmbeddedQueryResult } from "../components/QueryResult";
3
6
  import { encodeResourceUri } from "../utils/formatting";
4
7
  import { FilterSelection, FilterValuePrimitive } from "./useDimensionFilters";
8
+ import { escapeMalloyString } from "../utils/malloyString";
5
9
 
6
10
  /**
7
11
  * Parameters for the useDimensionFiltersQuery hook
@@ -39,13 +43,6 @@ export interface DimensionFiltersQueryResult {
39
43
  canExecute: boolean;
40
44
  }
41
45
 
42
- /**
43
- * Escapes special characters in strings for Malloy queries
44
- */
45
- function escapeMalloyString(value: string): string {
46
- return value.replace(/'/g, "\\'").replace(/\\/g, "\\\\");
47
- }
48
-
49
46
  /**
50
47
  * Formats a value for use in Malloy query
51
48
  */
@@ -1,7 +1,11 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useMemo } from "react";
2
5
  import { useServer } from "../components/ServerProvider";
3
6
  import { FilterSelection, FilterValuePrimitive } from "./useDimensionFilters";
4
7
  import { useQueryWithApiError } from "./useQueryWithApiError";
8
+ import { escapeMalloyString } from "../utils/malloyString";
5
9
 
6
10
  /**
7
11
  * Filter types for dimensions
@@ -114,13 +118,6 @@ export interface DimensionalFilterRangeDataResult {
114
118
  refetch: () => void;
115
119
  }
116
120
 
117
- /**
118
- * Escapes special characters in strings for Malloy queries
119
- */
120
- function escapeMalloyString(value: string): string {
121
- return value.replace(/'/g, "\\'").replace(/\\/g, "\\\\");
122
- }
123
-
124
121
  /**
125
122
  * Formats a value for use in Malloy query
126
123
  */
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { act, renderHook } from "@testing-library/react";
2
5
  import { describe, expect, it } from "bun:test";
3
6
  import { useGivensState } from "./useGivensState";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
5
  import { givensToParams, paramsToGivens } from "../components/given/paramCodec";
3
6
  import type { GivenValue } from "./givenValue";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useMemo } from "react";
2
5
  import { Given, RawNotebook } from "../client";
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import {
2
5
  useMutation,
3
6
  UseMutationOptions,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useServer } from "../components/ServerProvider";
2
5
  import { parseResourceUri } from "../utils/formatting";
3
6
  import { useQueryWithApiError } from "./useQueryWithApiError";
@@ -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
  buildSuggestQuery,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { useQueries } from "@tanstack/react-query";
2
5
  import { useMemo } from "react";
3
6
  import type { Given } from "../client";
package/src/index.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  export * from "./components";
2
5
  export { default as ConnectionExplorer } from "./components/Environment/ConnectionExplorer";
3
6
  export { useServer } from "./components/ServerProvider";
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  /* eslint-disable @typescript-eslint/triple-slash-reference */
2
5
  /// <reference types="node" />
3
6
  /// <reference types="react" />
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import React, {
2
5
  createContext,
3
6
  useContext,
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import type { MalloyExplicitTheme } from "@malloydata/render";
2
5
  import type { ResolvedTheme } from "./types";
3
6
 
@@ -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 { buildTableCssVars } from "./buildTableCssVars";
3
6
  import { resolveTheme } from "./resolveTheme";
@@ -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 { describe, expect, it } from "bun:test";
2
5
  import { buildVegaThemeOverride } from "./buildVegaThemeOverride";
3
6
  import { resolveTheme } from "./resolveTheme";