@malloy-publisher/sdk 0.0.143 → 0.0.145

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/dist/index.es.js CHANGED
@@ -48179,7 +48179,7 @@ function hd(e) {
48179
48179
  case "DateMinMax":
48180
48180
  return ["Equals", "Before", "After", "Between"];
48181
48181
  case "Retrieval":
48182
- return ["Concept Search"];
48182
+ return ["Semantic Search"];
48183
48183
  case "Boolean":
48184
48184
  return ["Equals"];
48185
48185
  case "NONE":
@@ -48327,7 +48327,7 @@ function kz({
48327
48327
  }
48328
48328
  )
48329
48329
  ] }),
48330
- e.filterType === "Retrieval" && i === "Concept Search" && /* @__PURE__ */ m(
48330
+ e.filterType === "Retrieval" && i === "Semantic Search" && /* @__PURE__ */ m(
48331
48331
  mp,
48332
48332
  {
48333
48333
  multiple: !0,
@@ -48358,7 +48358,13 @@ function kz({
48358
48358
  InputProps: {
48359
48359
  ...w.InputProps,
48360
48360
  endAdornment: /* @__PURE__ */ z(Ct, { children: [
48361
- h ? /* @__PURE__ */ m(wf, { color: "inherit", size: 20 }) : null,
48361
+ h ? /* @__PURE__ */ m(
48362
+ wf,
48363
+ {
48364
+ color: "inherit",
48365
+ size: 20
48366
+ }
48367
+ ) : null,
48362
48368
  w.InputProps.endAdornment
48363
48369
  ] })
48364
48370
  }
@@ -48687,7 +48693,7 @@ function Pz(e, t, n) {
48687
48693
  const { dimensionName: a, matchType: i, value: s, value2: l } = o, u = t.get(a), d = u && u !== n ? `\`${u}\`.\`${a}\`` : `\`${a}\``, f = s instanceof Date, p = (h, b = !1) => h == null ? "null" : b && h instanceof Date ? `@${h.getFullYear()}-${String(h.getMonth() + 1).padStart(2, "0")}-${String(h.getDate()).padStart(2, "0")}` : typeof h == "string" ? `'${h.replace(/'/g, "\\'")}'` : typeof h == "boolean" ? h ? "true" : "false" : String(h);
48688
48694
  switch (i) {
48689
48695
  case "Equals":
48690
- case "Concept Search":
48696
+ case "Semantic Search":
48691
48697
  return Array.isArray(s) && s.length > 0 ? `(${s.map(
48692
48698
  (b) => `${d} = ${p(b, f)}`
48693
48699
  ).join(" or ")})` : `${d} = ${p(s, f)}`;
@@ -50545,7 +50551,7 @@ function lV(e) {
50545
50551
  const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
50546
50552
  switch (n) {
50547
50553
  case "Equals":
50548
- case "Concept Search":
50554
+ case "Semantic Search":
50549
50555
  return Array.isArray(r) && r.length > 0 ? `(${r.map(
50550
50556
  (l) => `${a} = ${Er(l, i)}`
50551
50557
  ).join(" or ")})` : Array.isArray(r) ? "" : `${a} = ${Er(r, i)}`;
@@ -50809,7 +50815,7 @@ function pV(e) {
50809
50815
  const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
50810
50816
  switch (n) {
50811
50817
  case "Equals":
50812
- case "Concept Search":
50818
+ case "Semantic Search":
50813
50819
  return Array.isArray(r) && r.length > 0 ? `(${r.map(
50814
50820
  (l) => `${a} = ${vr(l, i)}`
50815
50821
  ).join(" or ")})` : Array.isArray(r) ? "" : `${a} = ${vr(r, i)}`;
@@ -51089,7 +51095,7 @@ function gV({
51089
51095
  gap: "8px",
51090
51096
  marginBottom: "16px"
51091
51097
  },
51092
- children: e.newSources && e.newSources.length > 0 && R && /* @__PURE__ */ m(
51098
+ children: e.newSources && e.newSources.length > 0 && /* @__PURE__ */ m(
51093
51099
  El,
51094
51100
  {
51095
51101
  sx: {
@@ -51121,7 +51127,7 @@ function gV({
51121
51127
  }
51122
51128
  }
51123
51129
  ),
51124
- /* @__PURE__ */ m(
51130
+ R && /* @__PURE__ */ m(
51125
51131
  Pt,
51126
51132
  {
51127
51133
  sx: {
@@ -51529,7 +51535,7 @@ function bV({
51529
51535
  U,
51530
51536
  i
51531
51537
  )).data;
51532
- te = Q.result, O = Q.newSources || B.newSources;
51538
+ te = Q.result, O = B.newSources || Q.newSources;
51533
51539
  }
51534
51540
  p((pe) => {
51535
51541
  const Q = [...pe];
@@ -56598,7 +56604,7 @@ function EW(e) {
56598
56604
  const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
56599
56605
  switch (n) {
56600
56606
  case "Equals":
56601
- case "Concept Search":
56607
+ case "Semantic Search":
56602
56608
  return Array.isArray(r) && r.length > 0 ? `(${r.map(
56603
56609
  (l) => `${a} = ${Tr(l, i)}`
56604
56610
  ).join(" or ")})` : Array.isArray(r) ? "" : `${a} = ${Tr(r, i)}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/sdk",
3
3
  "description": "Malloy Publisher SDK",
4
- "version": "0.0.143",
4
+ "version": "0.0.145",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
@@ -255,7 +255,7 @@ export default function Notebook({
255
255
 
256
256
  const executedCell = response.data;
257
257
  result = executedCell.result;
258
- newSources = executedCell.newSources || rawCell.newSources;
258
+ newSources = rawCell.newSources || executedCell.newSources;
259
259
  }
260
260
 
261
261
  // Update state incrementally
@@ -217,38 +217,37 @@ export function NotebookCell({
217
217
  marginBottom: "16px",
218
218
  }}
219
219
  >
220
- {cell.newSources &&
221
- cell.newSources.length > 0 &&
222
- hasValidImport && (
223
- <CleanMetricCard
220
+ {cell.newSources && cell.newSources.length > 0 && (
221
+ <CleanMetricCard
222
+ sx={{
223
+ position: "relative",
224
+ padding: "0",
225
+ }}
226
+ >
227
+ <Box
224
228
  sx={{
225
- position: "relative",
226
- padding: "0",
229
+ display: "flex",
230
+ alignItems: "center",
231
+ justifyContent: "space-between",
232
+ paddingLeft: "24px",
233
+ paddingRight: "8px",
227
234
  }}
228
235
  >
229
- <Box
230
- sx={{
231
- display: "flex",
232
- alignItems: "center",
233
- justifyContent: "space-between",
234
- paddingLeft: "24px",
235
- paddingRight: "8px",
236
- }}
237
- >
238
- {/* This shouldn't be needed but there's a compiler bug */}
239
- {highlightedMalloyCode && (
240
- <span
241
- dangerouslySetInnerHTML={{
242
- __html: highlightedMalloyCode,
243
- }}
244
- style={{
245
- fontFamily: "monospace",
246
- fontSize: "14px",
247
- flex: 1,
248
- marginRight: "8px",
249
- }}
250
- />
251
- )}
236
+ {/* This shouldn't be needed but there's a compiler bug */}
237
+ {highlightedMalloyCode && (
238
+ <span
239
+ dangerouslySetInnerHTML={{
240
+ __html: highlightedMalloyCode,
241
+ }}
242
+ style={{
243
+ fontFamily: "monospace",
244
+ fontSize: "14px",
245
+ flex: 1,
246
+ marginRight: "8px",
247
+ }}
248
+ />
249
+ )}
250
+ {hasValidImport && (
252
251
  <IconButton
253
252
  sx={{
254
253
  backgroundColor: "rgba(255, 255, 255, 0.9)",
@@ -266,9 +265,10 @@ export function NotebookCell({
266
265
  sx={{ fontSize: "18px", color: "#666666" }}
267
266
  />
268
267
  </IconButton>
269
- </Box>
270
- </CleanMetricCard>
271
- )}
268
+ )}
269
+ </Box>
270
+ </CleanMetricCard>
271
+ )}
272
272
  </Stack>
273
273
  )}
274
274
 
@@ -64,7 +64,7 @@ function getAvailableMatchTypes(
64
64
  case "DateMinMax":
65
65
  return ["Equals", "Before", "After", "Between"];
66
66
  case "Retrieval":
67
- return ["Concept Search"];
67
+ return ["Semantic Search"];
68
68
  case "Boolean":
69
69
  return ["Equals"];
70
70
  case "NONE":
@@ -421,87 +421,95 @@ export function DimensionFilter({
421
421
  </FormControl>
422
422
  )}
423
423
 
424
- {spec.filterType === "Retrieval" && matchType === "Concept Search" && (
425
- <Autocomplete
426
- multiple
427
- size="small"
428
- options={retrievalOptions}
429
- loading={retrievalLoading}
430
- getOptionLabel={(option) => {
431
- if (typeof option === "string") {
432
- return option;
433
- }
434
- if (
435
- typeof option === "object" &&
436
- option !== null &&
437
- "value" in option
438
- ) {
439
- return String((option as DimensionValue).value);
440
- }
441
- return String(option);
442
- }}
443
- value={
444
- Array.isArray(value1)
445
- ? value1.map((v: string) => {
446
- const found = retrievalOptions.find(
447
- (opt) => opt.value === v,
448
- );
449
- return found || { value: v };
450
- })
451
- : value1
452
- ? [{ value: value1 }]
453
- : []
454
- }
455
- onInputChange={(_, newInputValue) => {
456
- setRetrievalInputValue(newInputValue);
457
- }}
458
- onChange={(_, newValue) => {
459
- const newValues = newValue.map((item) => {
460
- if (typeof item === "string") return item;
461
- if (item && typeof item === "object" && "value" in item) {
462
- return (item as DimensionValue).value;
424
+ {spec.filterType === "Retrieval" &&
425
+ matchType === "Semantic Search" && (
426
+ <Autocomplete
427
+ multiple
428
+ size="small"
429
+ options={retrievalOptions}
430
+ loading={retrievalLoading}
431
+ getOptionLabel={(option) => {
432
+ if (typeof option === "string") {
433
+ return option;
463
434
  }
464
- return item;
465
- }) as FilterValuePrimitive[];
466
- handleValueChange(newValues);
467
- }}
468
- noOptionsText={
469
- retrievalInputValue.trim().length <= 2
470
- ? "Type at least 3 characters to search"
471
- : "No matches found"
472
- }
473
- renderInput={(params) => (
474
- <TextField
475
- {...params}
476
- label="Search Values"
477
- placeholder="Type to search..."
478
- onFocus={() => setRetrievalFocused(true)}
479
- onBlur={() => setRetrievalFocused(false)}
480
- helperText={
481
- retrievalFocused &&
482
- !retrievalLoading &&
483
- retrievalSearched &&
484
- retrievalOptions.length === 0
485
- ? "No matches found"
486
- : undefined
435
+ if (
436
+ typeof option === "object" &&
437
+ option !== null &&
438
+ "value" in option
439
+ ) {
440
+ return String((option as DimensionValue).value);
487
441
  }
488
- InputProps={{
489
- ...params.InputProps,
490
- endAdornment: (
491
- <>
492
- {retrievalLoading ? (
493
- <CircularProgress color="inherit" size={20} />
494
- ) : null}
495
- {params.InputProps.endAdornment}
496
- </>
497
- ),
498
- }}
499
- />
500
- )}
501
- freeSolo
502
- filterOptions={(x) => x}
503
- />
504
- )}
442
+ return String(option);
443
+ }}
444
+ value={
445
+ Array.isArray(value1)
446
+ ? value1.map((v: string) => {
447
+ const found = retrievalOptions.find(
448
+ (opt) => opt.value === v,
449
+ );
450
+ return found || { value: v };
451
+ })
452
+ : value1
453
+ ? [{ value: value1 }]
454
+ : []
455
+ }
456
+ onInputChange={(_, newInputValue) => {
457
+ setRetrievalInputValue(newInputValue);
458
+ }}
459
+ onChange={(_, newValue) => {
460
+ const newValues = newValue.map((item) => {
461
+ if (typeof item === "string") return item;
462
+ if (
463
+ item &&
464
+ typeof item === "object" &&
465
+ "value" in item
466
+ ) {
467
+ return (item as DimensionValue).value;
468
+ }
469
+ return item;
470
+ }) as FilterValuePrimitive[];
471
+ handleValueChange(newValues);
472
+ }}
473
+ noOptionsText={
474
+ retrievalInputValue.trim().length <= 2
475
+ ? "Type at least 3 characters to search"
476
+ : "No matches found"
477
+ }
478
+ renderInput={(params) => (
479
+ <TextField
480
+ {...params}
481
+ label="Search Values"
482
+ placeholder="Type to search..."
483
+ onFocus={() => setRetrievalFocused(true)}
484
+ onBlur={() => setRetrievalFocused(false)}
485
+ helperText={
486
+ retrievalFocused &&
487
+ !retrievalLoading &&
488
+ retrievalSearched &&
489
+ retrievalOptions.length === 0
490
+ ? "No matches found"
491
+ : undefined
492
+ }
493
+ InputProps={{
494
+ ...params.InputProps,
495
+ endAdornment: (
496
+ <>
497
+ {retrievalLoading ? (
498
+ <CircularProgress
499
+ color="inherit"
500
+ size={20}
501
+ />
502
+ ) : null}
503
+ {params.InputProps.endAdornment}
504
+ </>
505
+ ),
506
+ }}
507
+ />
508
+ )}
509
+ freeSolo
510
+ filterOptions={(x) => x}
511
+ />
512
+ )}
505
513
 
506
514
  {spec.filterType === "MinMax" && !needsTwoValues && (
507
515
  <TextField
@@ -278,7 +278,7 @@ export function generateFilterClause(
278
278
 
279
279
  switch (matchType) {
280
280
  case "Equals":
281
- case "Concept Search":
281
+ case "Semantic Search":
282
282
  if (Array.isArray(value) && value.length > 0) {
283
283
  const conditions = value.map(
284
284
  (v) => `${fieldName} = ${formatValue(v, isDate)}`,
@@ -12,7 +12,7 @@ export type MatchType =
12
12
  | "Less Than"
13
13
  | "Greater Than"
14
14
  | "Between"
15
- | "Concept Search";
15
+ | "Semantic Search";
16
16
 
17
17
  /**
18
18
  * Primitive types that can be used as filter values
@@ -125,7 +125,7 @@ function generateFilterCondition(selection: FilterSelection): string {
125
125
 
126
126
  switch (matchType) {
127
127
  case "Equals":
128
- case "Concept Search":
128
+ case "Semantic Search":
129
129
  if (Array.isArray(value) && value.length > 0) {
130
130
  // Handle multi-select: (field = val1 or field = val2)
131
131
  const conditions = value.map(
@@ -93,7 +93,7 @@ function generateFilterCondition(selection: FilterSelection): string {
93
93
 
94
94
  switch (matchType) {
95
95
  case "Equals":
96
- case "Concept Search":
96
+ case "Semantic Search":
97
97
  if (Array.isArray(value) && value.length > 0) {
98
98
  // Handle multi-select: (field = val1 or field = val2)
99
99
  const conditions = value.map(
@@ -137,7 +137,7 @@ function generateFilterCondition(selection: FilterSelection): string {
137
137
 
138
138
  switch (matchType) {
139
139
  case "Equals":
140
- case "Concept Search":
140
+ case "Semantic Search":
141
141
  if (Array.isArray(value) && value.length > 0) {
142
142
  // Handle multi-select: (field = val1 or field = val2)
143
143
  const conditions = value.map(