@finos/legend-lego 2.0.211 → 2.0.213

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 (74) hide show
  1. package/lib/index.css +2 -2
  2. package/lib/index.css.map +1 -1
  3. package/lib/legend-ai/LegendAIDocEnrichment.d.ts +12 -12
  4. package/lib/legend-ai/LegendAIDocEnrichment.d.ts.map +1 -1
  5. package/lib/legend-ai/LegendAIDocEnrichment.js +317 -86
  6. package/lib/legend-ai/LegendAIDocEnrichment.js.map +1 -1
  7. package/lib/legend-ai/LegendAIHostIntegration.d.ts +31 -0
  8. package/lib/legend-ai/LegendAIHostIntegration.d.ts.map +1 -0
  9. package/lib/legend-ai/LegendAIHostIntegration.js +50 -0
  10. package/lib/legend-ai/LegendAIHostIntegration.js.map +1 -0
  11. package/lib/legend-ai/LegendAIServiceRetrieval.d.ts.map +1 -1
  12. package/lib/legend-ai/LegendAIServiceRetrieval.js +34 -35
  13. package/lib/legend-ai/LegendAIServiceRetrieval.js.map +1 -1
  14. package/lib/legend-ai/LegendAITypes.d.ts +85 -7
  15. package/lib/legend-ai/LegendAITypes.d.ts.map +1 -1
  16. package/lib/legend-ai/LegendAITypes.js +99 -1
  17. package/lib/legend-ai/LegendAITypes.js.map +1 -1
  18. package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.d.ts +36 -3
  19. package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.d.ts.map +1 -1
  20. package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.js +29 -0
  21. package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.js.map +1 -1
  22. package/lib/legend-ai/__test-utils__/LegendAITestUtils.d.ts.map +1 -1
  23. package/lib/legend-ai/__test-utils__/LegendAITestUtils.js +7 -0
  24. package/lib/legend-ai/__test-utils__/LegendAITestUtils.js.map +1 -1
  25. package/lib/legend-ai/components/LegendAICharts.d.ts.map +1 -1
  26. package/lib/legend-ai/components/LegendAICharts.js +6 -10
  27. package/lib/legend-ai/components/LegendAICharts.js.map +1 -1
  28. package/lib/legend-ai/components/LegendAIChat.d.ts.map +1 -1
  29. package/lib/legend-ai/components/LegendAIChat.js +263 -41
  30. package/lib/legend-ai/components/LegendAIChat.js.map +1 -1
  31. package/lib/legend-ai/components/LegendAIChatInput.d.ts +1 -1
  32. package/lib/legend-ai/components/LegendAIChatInput.d.ts.map +1 -1
  33. package/lib/legend-ai/components/LegendAIChatInput.js +2 -1
  34. package/lib/legend-ai/components/LegendAIChatInput.js.map +1 -1
  35. package/lib/legend-ai/index.d.ts +5 -2
  36. package/lib/legend-ai/index.d.ts.map +1 -1
  37. package/lib/legend-ai/index.js +5 -2
  38. package/lib/legend-ai/index.js.map +1 -1
  39. package/lib/legend-ai/stores/LegendAIChatProcessors.d.ts +9 -3
  40. package/lib/legend-ai/stores/LegendAIChatProcessors.d.ts.map +1 -1
  41. package/lib/legend-ai/stores/LegendAIChatProcessors.js +794 -220
  42. package/lib/legend-ai/stores/LegendAIChatProcessors.js.map +1 -1
  43. package/lib/legend-ai/stores/LegendAIChatState.d.ts.map +1 -1
  44. package/lib/legend-ai/stores/LegendAIChatState.js +47 -21
  45. package/lib/legend-ai/stores/LegendAIChatState.js.map +1 -1
  46. package/lib/legend-ai/stores/LegendAIJoinAnalysis.d.ts +29 -0
  47. package/lib/legend-ai/stores/LegendAIJoinAnalysis.d.ts.map +1 -0
  48. package/lib/legend-ai/stores/LegendAIJoinAnalysis.js +124 -0
  49. package/lib/legend-ai/stores/LegendAIJoinAnalysis.js.map +1 -0
  50. package/lib/legend-ai/stores/LegendAISqlHelpers.d.ts +25 -0
  51. package/lib/legend-ai/stores/LegendAISqlHelpers.d.ts.map +1 -0
  52. package/lib/legend-ai/stores/LegendAISqlHelpers.js +64 -0
  53. package/lib/legend-ai/stores/LegendAISqlHelpers.js.map +1 -0
  54. package/lib/legend-ai/stores/LegendAISqlJoinSanitizers.d.ts +22 -0
  55. package/lib/legend-ai/stores/LegendAISqlJoinSanitizers.d.ts.map +1 -0
  56. package/lib/legend-ai/stores/LegendAISqlJoinSanitizers.js +411 -0
  57. package/lib/legend-ai/stores/LegendAISqlJoinSanitizers.js.map +1 -0
  58. package/package.json +6 -6
  59. package/src/legend-ai/LegendAIDocEnrichment.ts +435 -97
  60. package/src/legend-ai/LegendAIHostIntegration.tsx +80 -0
  61. package/src/legend-ai/LegendAIServiceRetrieval.ts +50 -35
  62. package/src/legend-ai/LegendAITypes.ts +169 -5
  63. package/src/legend-ai/LegendAI_LegendApplicationPlugin_Extension.ts +73 -1
  64. package/src/legend-ai/__test-utils__/LegendAITestUtils.ts +10 -0
  65. package/src/legend-ai/components/LegendAICharts.tsx +30 -33
  66. package/src/legend-ai/components/LegendAIChat.tsx +555 -91
  67. package/src/legend-ai/components/LegendAIChatInput.tsx +6 -2
  68. package/src/legend-ai/index.ts +22 -3
  69. package/src/legend-ai/stores/LegendAIChatProcessors.ts +1286 -322
  70. package/src/legend-ai/stores/LegendAIChatState.ts +73 -28
  71. package/src/legend-ai/stores/LegendAIJoinAnalysis.ts +165 -0
  72. package/src/legend-ai/stores/LegendAISqlHelpers.ts +82 -0
  73. package/src/legend-ai/stores/LegendAISqlJoinSanitizers.ts +515 -0
  74. package/tsconfig.json +4 -0
@@ -170,6 +170,7 @@ export const LegendAIDonutChart = (props: {
170
170
  const LINE_SVG_WIDTH = 400;
171
171
  const LINE_SVG_HEIGHT = 180;
172
172
  const LINE_PADDING = { top: 16, right: 16, bottom: 28, left: 52 };
173
+ const AXIS_LABEL_MAX_CHARS = 10;
173
174
 
174
175
  export const LegendAILineChart = (props: {
175
176
  data: LegendAIChartDataPoint[];
@@ -203,7 +204,7 @@ export const LegendAILineChart = (props: {
203
204
  LINE_PADDING.left +
204
205
  (data.length > 1 ? (i / (data.length - 1)) * plotW : plotW / 2);
205
206
  const y = LINE_PADDING.top + (1 - (d.value - lo) / range) * plotH;
206
- return { x, y, ...d };
207
+ return { x, y, label: d.label, value: d.value };
207
208
  });
208
209
  return {
209
210
  points: pts,
@@ -219,6 +220,10 @@ export const LegendAILineChart = (props: {
219
220
 
220
221
  const plotBottom = LINE_SVG_HEIGHT - LINE_PADDING.bottom;
221
222
  const color = getChartColor(0);
223
+ const firstPt = points[0];
224
+ const lastPt = points[points.length - 1];
225
+ const axisEndpoints =
226
+ firstPt && lastPt ? { first: firstPt, last: lastPt } : undefined;
222
227
 
223
228
  return (
224
229
  <div className="legend-ai-chart legend-ai-chart--line">
@@ -280,7 +285,7 @@ export const LegendAILineChart = (props: {
280
285
  {/* Dots */}
281
286
  {points.map((p) => (
282
287
  <circle
283
- key={`${p.label}-${String(p.value)}`}
288
+ key={`${p.x}-${p.y}`}
284
289
  cx={p.x}
285
290
  cy={p.y}
286
291
  r={3}
@@ -289,37 +294,29 @@ export const LegendAILineChart = (props: {
289
294
  />
290
295
  ))}
291
296
 
292
- {/* X-axis labels (first, mid, last) */}
293
- {points.length > 0 &&
294
- (() => {
295
- const firstPt = points[0];
296
- const lastPt = points[points.length - 1];
297
- if (!firstPt || !lastPt) {
298
- return null;
299
- }
300
- return (
301
- <>
302
- <text
303
- x={firstPt.x}
304
- y={plotBottom + 16}
305
- className="legend-ai-chart__axis-label"
306
- textAnchor="start"
307
- >
308
- {firstPt.label.slice(0, 10)}
309
- </text>
310
- {points.length > 2 && (
311
- <text
312
- x={lastPt.x}
313
- y={plotBottom + 16}
314
- className="legend-ai-chart__axis-label"
315
- textAnchor="end"
316
- >
317
- {lastPt.label.slice(0, 10)}
318
- </text>
319
- )}
320
- </>
321
- );
322
- })()}
297
+ {/* X-axis labels (first, last) */}
298
+ {axisEndpoints && (
299
+ <>
300
+ <text
301
+ x={axisEndpoints.first.x}
302
+ y={plotBottom + 16}
303
+ className="legend-ai-chart__axis-label"
304
+ textAnchor="start"
305
+ >
306
+ {axisEndpoints.first.label.slice(0, AXIS_LABEL_MAX_CHARS)}
307
+ </text>
308
+ {points.length > 2 && (
309
+ <text
310
+ x={axisEndpoints.last.x}
311
+ y={plotBottom + 16}
312
+ className="legend-ai-chart__axis-label"
313
+ textAnchor="end"
314
+ >
315
+ {axisEndpoints.last.label.slice(0, AXIS_LABEL_MAX_CHARS)}
316
+ </text>
317
+ )}
318
+ </>
319
+ )}
323
320
  </svg>
324
321
  </div>
325
322
  );