yamchart 0.4.13 → 0.4.15

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 (37) hide show
  1. package/dist/{chunk-UDJXQQKL.js → chunk-2LNDAMKT.js} +2 -2
  2. package/dist/{chunk-6XQITSPY.js → chunk-WHBVCIPG.js} +2 -2
  3. package/dist/{chunk-R7EULFJG.js → chunk-YL6BW3HW.js} +16 -4
  4. package/dist/chunk-YL6BW3HW.js.map +1 -0
  5. package/dist/{connection-utils-U6MCBYCX.js → connection-utils-Y7AWIC5M.js} +3 -3
  6. package/dist/{describe-LTV7YMPM.js → describe-ZAEVM3XT.js} +3 -3
  7. package/dist/{dev-PV6RXXCP.js → dev-7XROGYXG.js} +3 -3
  8. package/dist/index.js +11 -11
  9. package/dist/public/assets/{LoginPage-CbdZWMo9.js → LoginPage-BMdw0UeV.js} +1 -1
  10. package/dist/public/assets/{PublicViewer-Bmou0C7a.js → PublicViewer-CXSc3vVz.js} +1 -1
  11. package/dist/public/assets/{SetupWizard-QKYmGhuZ.js → SetupWizard-Bcnury1N.js} +1 -1
  12. package/dist/public/assets/{ShareManagement-DqAZn-XZ.js → ShareManagement-C9y5c4sK.js} +1 -1
  13. package/dist/public/assets/{UserManagement-CH3vPfqJ.js → UserManagement-CP7s55yb.js} +1 -1
  14. package/dist/public/assets/index-B4-bDimp.js +164 -0
  15. package/dist/public/assets/{index-DIn_Wjra.css → index-BbU_22FF.css} +1 -1
  16. package/dist/public/assets/{index.es-Czu18YDf.js → index.es-CYXSYXqH.js} +1 -1
  17. package/dist/public/assets/{jspdf.es.min-D-4pZi5g.js → jspdf.es.min-DGs_y_ZH.js} +3 -3
  18. package/dist/public/index.html +2 -2
  19. package/dist/{query-J2SD4BID.js → query-3KIMOYUD.js} +3 -3
  20. package/dist/{sample-3PF7ZJFO.js → sample-PR4P7ZXF.js} +3 -3
  21. package/dist/{search-IUXXHMPL.js → search-E53W6CR5.js} +3 -3
  22. package/dist/{tables-I3WOUJ2I.js → tables-X2GY5AVA.js} +3 -3
  23. package/dist/templates/default/docs/yamchart-reference.md +15 -4
  24. package/dist/{test-3PFV2KAP.js → test-7R7EGFOI.js} +3 -3
  25. package/package.json +3 -3
  26. package/dist/chunk-R7EULFJG.js.map +0 -1
  27. package/dist/public/assets/index-DfVKHqnj.js +0 -164
  28. /package/dist/{chunk-UDJXQQKL.js.map → chunk-2LNDAMKT.js.map} +0 -0
  29. /package/dist/{chunk-6XQITSPY.js.map → chunk-WHBVCIPG.js.map} +0 -0
  30. /package/dist/{connection-utils-U6MCBYCX.js.map → connection-utils-Y7AWIC5M.js.map} +0 -0
  31. /package/dist/{describe-LTV7YMPM.js.map → describe-ZAEVM3XT.js.map} +0 -0
  32. /package/dist/{dev-PV6RXXCP.js.map → dev-7XROGYXG.js.map} +0 -0
  33. /package/dist/{query-J2SD4BID.js.map → query-3KIMOYUD.js.map} +0 -0
  34. /package/dist/{sample-3PF7ZJFO.js.map → sample-PR4P7ZXF.js.map} +0 -0
  35. /package/dist/{search-IUXXHMPL.js.map → search-E53W6CR5.js.map} +0 -0
  36. /package/dist/{tables-I3WOUJ2I.js.map → tables-X2GY5AVA.js.map} +0 -0
  37. /package/dist/{test-3PFV2KAP.js.map → test-7R7EGFOI.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ConnectionSchema
3
- } from "./chunk-R7EULFJG.js";
3
+ } from "./chunk-YL6BW3HW.js";
4
4
  import {
5
5
  DuckDBConnector,
6
6
  MySQLConnector,
@@ -166,4 +166,4 @@ export {
166
166
  formatTable,
167
167
  formatJSON
168
168
  };
169
- //# sourceMappingURL=chunk-UDJXQQKL.js.map
169
+ //# sourceMappingURL=chunk-2LNDAMKT.js.map
@@ -4,7 +4,7 @@ import {
4
4
  DashboardSchema,
5
5
  ProjectSchema,
6
6
  ScheduleSchema
7
- } from "./chunk-R7EULFJG.js";
7
+ } from "./chunk-YL6BW3HW.js";
8
8
  import {
9
9
  parseModelMetadata
10
10
  } from "./chunk-23E6YT4S.js";
@@ -365,4 +365,4 @@ export {
365
365
  findProjectRoot,
366
366
  loadEnvFile
367
367
  };
368
- //# sourceMappingURL=chunk-6XQITSPY.js.map
368
+ //# sourceMappingURL=chunk-WHBVCIPG.js.map
@@ -109,7 +109,8 @@ var AxisSchema = z2.object({
109
109
  field: z2.string().min(1),
110
110
  type: AxisTypeSchema,
111
111
  format: z2.string().optional(),
112
- label: z2.string().optional()
112
+ label: z2.string().optional(),
113
+ scale: z2.enum(["linear", "log"]).optional()
113
114
  });
114
115
  var ChartTypeSchema = z2.enum([
115
116
  "line",
@@ -230,6 +231,7 @@ var StandardChartConfigSchema = z2.object({
230
231
  y: AxisSchema.optional(),
231
232
  series: SeriesConfigSchema.optional(),
232
233
  stacking: z2.enum(["stacked", "percent"]).optional(),
234
+ orientation: z2.enum(["vertical", "horizontal"]).optional(),
233
235
  color: ColorSchema.optional(),
234
236
  gradient: GradientSchema.optional(),
235
237
  legend: LegendSchema.optional(),
@@ -320,13 +322,23 @@ var GaugeChartConfigSchema = z2.object({
320
322
  thresholds: z2.array(GaugeThresholdSchema).optional(),
321
323
  format: z2.string().optional()
322
324
  });
325
+ var TableColumnSummarySchema = z2.enum(["sum", "avg", "min", "max", "count"]);
323
326
  var TableChartConfigSchema = z2.object({
324
327
  type: z2.literal("table"),
325
328
  columns: z2.array(z2.object({
326
329
  field: z2.string().min(1),
327
330
  label: z2.string().optional(),
328
- format: z2.string().optional()
329
- })).optional()
331
+ format: z2.string().optional(),
332
+ sticky: z2.boolean().optional(),
333
+ summary: TableColumnSummarySchema.optional()
334
+ })).optional(),
335
+ summary: z2.object({
336
+ label: z2.string().optional()
337
+ }).optional(),
338
+ sort: z2.object({
339
+ field: z2.string().min(1),
340
+ direction: z2.enum(["asc", "desc"]).optional()
341
+ }).optional()
330
342
  });
331
343
  var ChartConfigSchema = z2.union([
332
344
  ScatterChartConfigSchema,
@@ -661,4 +673,4 @@ export {
661
673
  DashboardSchema,
662
674
  ScheduleSchema
663
675
  };
664
- //# sourceMappingURL=chunk-R7EULFJG.js.map
676
+ //# sourceMappingURL=chunk-YL6BW3HW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/schema/src/connection.ts","../../../packages/schema/src/chart.ts","../../../packages/schema/src/project.ts","../../../packages/schema/src/model.ts","../../../packages/schema/src/dashboard.ts","../../../packages/schema/src/schedule.ts"],"sourcesContent":["import { z } from 'zod';\n\n// Auth configuration for connections\nconst EnvAuthSchema = z.object({\n type: z.literal('env'),\n user_var: z.string(),\n password_var: z.string(),\n});\n\nconst KeyPairAuthSchema = z.object({\n type: z.literal('key_pair'),\n user_var: z.string(),\n private_key_path: z.string(),\n});\n\nconst SecretManagerAuthSchema = z.object({\n type: z.literal('secret_manager'),\n provider: z.enum(['aws_secrets_manager', 'gcp_secret_manager', 'vault']),\n secret_id: z.string(),\n});\n\nconst ExternalBrowserAuthSchema = z.object({\n type: z.literal('externalbrowser'),\n user_var: z.string(),\n cache_token: z.boolean().optional(),\n});\n\nconst AuthSchema = z.discriminatedUnion('type', [\n EnvAuthSchema,\n KeyPairAuthSchema,\n SecretManagerAuthSchema,\n ExternalBrowserAuthSchema,\n]);\n\n// Connection pool configuration\nconst PoolConfigSchema = z.object({\n min_connections: z.number().int().positive().optional(),\n max_connections: z.number().int().positive().optional(),\n idle_timeout: z.number().int().positive().optional(),\n});\n\n// Query settings\nconst QueryConfigSchema = z.object({\n timeout: z.number().int().positive().optional(),\n max_rows: z.number().int().positive().optional(),\n});\n\n// DuckDB-specific config\nconst DuckDBConfigSchema = z.object({\n path: z.string(), // file path or :memory:\n});\n\n// Postgres-specific config\nconst PostgresConfigSchema = z.object({\n host: z.string(),\n port: z.number().int().positive().default(5432),\n database: z.string(),\n schema: z.string().optional(),\n ssl: z.boolean().optional(),\n});\n\n// Snowflake-specific config\nconst SnowflakeConfigSchema = z.object({\n account: z.string(),\n warehouse: z.string(),\n database: z.string(),\n schema: z.string().optional(),\n role: z.string().optional(),\n});\n\n// MySQL-specific config\nconst MySQLConfigSchema = z.object({\n host: z.string(),\n port: z.number().int().positive().default(3306),\n database: z.string(),\n ssl: z.boolean().optional(),\n});\n\n// SQLite-specific config\nconst SQLiteConfigSchema = z.object({\n path: z.string(), // file path or :memory:\n});\n\n// Base connection schema\nconst BaseConnectionSchema = z.object({\n name: z.string().min(1),\n description: z.string().optional(),\n pool: PoolConfigSchema.optional(),\n query: QueryConfigSchema.optional(),\n});\n\n// Type-specific connection schemas\nconst DuckDBConnectionSchema = BaseConnectionSchema.extend({\n type: z.literal('duckdb'),\n config: DuckDBConfigSchema,\n auth: z.undefined().optional(),\n});\n\nconst PostgresConnectionSchema = BaseConnectionSchema.extend({\n type: z.literal('postgres'),\n config: PostgresConfigSchema,\n auth: AuthSchema.optional(),\n});\n\nconst SnowflakeConnectionSchema = BaseConnectionSchema.extend({\n type: z.literal('snowflake'),\n config: SnowflakeConfigSchema,\n auth: AuthSchema,\n});\n\nconst MySQLConnectionSchema = BaseConnectionSchema.extend({\n type: z.literal('mysql'),\n config: MySQLConfigSchema,\n auth: AuthSchema.optional(),\n});\n\nconst SQLiteConnectionSchema = BaseConnectionSchema.extend({\n type: z.literal('sqlite'),\n config: SQLiteConfigSchema,\n auth: z.undefined().optional(),\n});\n\n// Union of all connection types\nexport const ConnectionSchema = z.discriminatedUnion('type', [\n DuckDBConnectionSchema,\n PostgresConnectionSchema,\n SnowflakeConnectionSchema,\n MySQLConnectionSchema,\n SQLiteConnectionSchema,\n]);\n\nexport type Connection = z.infer<typeof ConnectionSchema>;\nexport type DuckDBConnection = z.infer<typeof DuckDBConnectionSchema>;\nexport type PostgresConnection = z.infer<typeof PostgresConnectionSchema>;\nexport type SnowflakeConnection = z.infer<typeof SnowflakeConnectionSchema>;\nexport type MySQLConnection = z.infer<typeof MySQLConnectionSchema>;\nexport type SQLiteConnection = z.infer<typeof SQLiteConnectionSchema>;\n","import { z } from 'zod';\n\n// Axis types\nconst AxisTypeSchema = z.enum(['temporal', 'quantitative', 'ordinal', 'nominal']);\n\n// Axis configuration\nconst AxisSchema = z.object({\n field: z.string().min(1),\n type: AxisTypeSchema,\n format: z.string().optional(),\n label: z.string().optional(),\n scale: z.enum(['linear', 'log']).optional(),\n});\n\n// Chart types supported (scatter has its own dedicated schema)\nconst ChartTypeSchema = z.enum([\n 'line',\n 'bar',\n 'area',\n 'pie',\n 'donut',\n 'table',\n 'metric',\n 'map',\n 'heatmap',\n 'funnel',\n 'sankey',\n 'treemap',\n 'waterfall',\n 'gauge',\n]);\n\n// Gradient configuration - boolean shorthand or explicit from/to\nconst GradientSchema = z.union([\n z.boolean(),\n z.object({\n from: z.string(),\n to: z.string(),\n }),\n]);\n\n// Long format series: group by a field in the data (one row per series value)\nconst LongFormatSeriesSchema = z.object({\n field: z.string().min(1),\n colors: z.record(z.string(), z.string()).optional(),\n});\n\n// Wide format column: each column becomes a separate series\nconst WideFormatColumnSchema = z.object({\n field: z.string().min(1),\n name: z.string().optional(),\n type: z.enum(['line', 'bar', 'area']).optional(),\n axis: z.enum(['left', 'right']).optional(),\n color: z.string().optional(),\n style: z.enum(['solid', 'dashed', 'dotted']).optional(),\n opacity: z.number().min(0).max(1).optional(),\n gradient: GradientSchema.optional(),\n});\n\n// Wide format series: explicit list of columns\nconst WideFormatSeriesSchema = z.object({\n columns: z.array(WideFormatColumnSchema).min(1),\n});\n\n// Series config is either long format (group by field) or wide format (explicit columns)\nconst SeriesConfigSchema = z.union([\n LongFormatSeriesSchema,\n WideFormatSeriesSchema,\n]);\n\n// Color condition for conditional coloring\nconst ColorConditionSchema = z.object({\n when: z.string(),\n color: z.string(),\n});\n\n// Conditional color configuration\nconst ConditionalColorSchema = z.object({\n conditions: z.array(ColorConditionSchema).min(1),\n default: z.string().optional(),\n});\n\n// Color - either a simple string or conditional config\nconst ColorSchema = z.union([\n z.string(),\n ConditionalColorSchema,\n]);\n\n// Legend configuration\nconst LegendSchema = z.object({\n show: z.boolean().optional(),\n position: z.enum(['top', 'bottom', 'left', 'right']).optional(),\n});\n\n// Annotation configuration\nconst LineAnnotationSchema = z.object({\n type: z.literal('line'),\n value: z.number(),\n label: z.string().optional(),\n color: z.string().optional(),\n style: z.enum(['solid', 'dashed', 'dotted']).optional(),\n});\n\nconst BandAnnotationSchema = z.object({\n type: z.literal('band'),\n from: z.number(),\n to: z.number(),\n label: z.string().optional(),\n color: z.string().optional(),\n});\n\nconst AnnotationSchema = z.discriminatedUnion('type', [\n LineAnnotationSchema,\n BandAnnotationSchema,\n]);\n\n// Interactivity options\nconst InteractionsSchema = z.object({\n tooltip: z.boolean().default(true),\n zoom: z.boolean().default(false),\n brush: z.boolean().default(false),\n});\n\n// KPI format types\nconst KpiFormatSchema = z.object({\n type: z.enum(['number', 'currency', 'percent']),\n currency: z.string().optional(), // e.g., 'USD', 'EUR'\n decimals: z.number().optional(),\n});\n\n// KPI comparison configuration\nconst KpiComparisonSchema = z.object({\n enabled: z.boolean(),\n field: z.string().min(1).optional(),\n period: z.enum(['previous']).optional(),\n label: z.string().optional(),\n type: z.enum(['percent_change', 'absolute']),\n}).refine(\n (data) => !(data.field && data.period),\n { message: 'Cannot set both field and period — use one or the other' }\n).refine(\n (data) => data.field || data.period,\n { message: 'Must set either field or period for comparison' }\n);\n\n// KPI value configuration\nconst KpiValueSchema = z.object({\n field: z.string().min(1),\n});\n\n// KPI-specific config\nconst KpiConfigSchema = z.object({\n type: z.literal('kpi'),\n value: KpiValueSchema,\n format: KpiFormatSchema,\n comparison: KpiComparisonSchema.optional(),\n unit: z.string().optional(), // e.g., 'min', 'sessions', 'users'\n});\n\n// Center value for donut charts\nconst CenterValueSchema = z.object({\n field: z.string().optional(), // 'total' for sum, or specific field\n label: z.string().optional(),\n format: z.string().optional(),\n});\n\n// Standard chart config (existing)\nconst StandardChartConfigSchema = z.object({\n type: ChartTypeSchema,\n x: AxisSchema,\n y: AxisSchema.optional(),\n series: SeriesConfigSchema.optional(),\n stacking: z.enum(['stacked', 'percent']).optional(),\n orientation: z.enum(['vertical', 'horizontal']).optional(),\n color: ColorSchema.optional(),\n gradient: GradientSchema.optional(),\n legend: LegendSchema.optional(),\n annotations: z.array(AnnotationSchema).optional(),\n interactions: InteractionsSchema.optional(),\n centerValue: CenterValueSchema.optional(), // For donut charts\n});\n\n// Dual axes for combo charts\nconst DualAxesSchema = z.object({\n left: AxisSchema.optional(),\n right: AxisSchema.optional(),\n});\n\n// Combo chart config - requires dual axes\nconst ComboChartConfigSchema = z.object({\n type: z.literal('combo'),\n x: AxisSchema,\n series: WideFormatSeriesSchema,\n axes: DualAxesSchema,\n legend: LegendSchema.optional(),\n interactions: InteractionsSchema.optional(),\n gradient: GradientSchema.optional(),\n});\n\n// Scatter chart size encoding\nconst ScatterSizeSchema = z.object({\n field: z.string().min(1),\n min: z.number().optional(),\n max: z.number().optional(),\n label: z.string().optional(),\n});\n\n// Scatter chart grouping\nconst ScatterGroupSchema = z.object({\n field: z.string().min(1),\n});\n\n// Regression line configuration\nconst RegressionSchema = z.object({\n type: z.literal('linear'),\n show_equation: z.boolean().optional(),\n show_r_squared: z.boolean().optional(),\n});\n\n// Scatter/bubble chart config\nconst ScatterChartConfigSchema = z.object({\n type: z.literal('scatter'),\n x: AxisSchema,\n y: AxisSchema,\n size: ScatterSizeSchema.optional(),\n group: ScatterGroupSchema.optional(),\n regression: RegressionSchema.optional(),\n color: ColorSchema.optional(),\n legend: LegendSchema.optional(),\n interactions: InteractionsSchema.optional(),\n});\n\n// Heatmap chart config\nconst HeatmapChartConfigSchema = z.object({\n type: z.literal('heatmap'),\n x: AxisSchema,\n y: AxisSchema,\n value: z.object({\n field: z.string().min(1),\n label: z.string().optional(),\n }),\n color_range: z.object({\n min: z.string().optional(),\n max: z.string().optional(),\n }).optional(),\n show_values: z.boolean().optional(),\n});\n\n// Funnel chart config\nconst FunnelChartConfigSchema = z.object({\n type: z.literal('funnel'),\n stage: z.object({ field: z.string().min(1) }),\n value: z.object({ field: z.string().min(1) }),\n show_conversion: z.boolean().optional(),\n color: ColorSchema.optional(),\n});\n\n// Waterfall chart config\nconst WaterfallChartConfigSchema = z.object({\n type: z.literal('waterfall'),\n category: z.object({ field: z.string().min(1) }),\n value: z.object({ field: z.string().min(1) }),\n total_field: z.string().optional(),\n colors: z.object({\n increase: z.string().optional(),\n decrease: z.string().optional(),\n total: z.string().optional(),\n }).optional(),\n});\n\n// Gauge chart config\nconst GaugeThresholdSchema = z.object({\n value: z.number(),\n color: z.string(),\n});\n\nconst GaugeChartConfigSchema = z.object({\n type: z.literal('gauge'),\n value: z.object({ field: z.string().min(1) }),\n min: z.number().optional(),\n max: z.number().optional(),\n thresholds: z.array(GaugeThresholdSchema).optional(),\n format: z.string().optional(),\n});\n\nconst TableColumnSummarySchema = z.enum(['sum', 'avg', 'min', 'max', 'count']);\n\nconst TableChartConfigSchema = z.object({\n type: z.literal('table'),\n columns: z.array(z.object({\n field: z.string().min(1),\n label: z.string().optional(),\n format: z.string().optional(),\n sticky: z.boolean().optional(),\n summary: TableColumnSummarySchema.optional(),\n })).optional(),\n summary: z.object({\n label: z.string().optional(),\n }).optional(),\n sort: z.object({\n field: z.string().min(1),\n direction: z.enum(['asc', 'desc']).optional(),\n }).optional(),\n});\n\n// Chart visualization config - standard, KPI, combo, scatter, heatmap, funnel, waterfall, gauge, or table\nconst ChartConfigSchema = z.union([\n ScatterChartConfigSchema,\n ComboChartConfigSchema,\n HeatmapChartConfigSchema,\n FunnelChartConfigSchema,\n WaterfallChartConfigSchema,\n GaugeChartConfigSchema,\n TableChartConfigSchema,\n StandardChartConfigSchema,\n KpiConfigSchema,\n]);\n\n// Parameter types\nconst ParameterTypeSchema = z.enum([\n 'date_range',\n 'select',\n 'multi_select',\n 'dynamic_select',\n 'text',\n 'number',\n 'boolean',\n]);\n\n// Parameter option\nconst ParameterOptionSchema = z.union([\n z.string(),\n z.object({\n value: z.string(),\n label: z.string(),\n }),\n]);\n\n// Parameter source (for dynamic options)\nconst ParameterSourceSchema = z.object({\n model: z.string(),\n value_field: z.string(),\n label_field: z.string(),\n});\n\n// Parameter definition\nconst ParameterSchema = z.object({\n name: z.string().min(1),\n type: ParameterTypeSchema,\n label: z.string().optional(),\n default: z.union([z.string(), z.number(), z.array(z.string())]).optional(),\n options: z.array(ParameterOptionSchema).optional(),\n source: ParameterSourceSchema.optional(),\n});\n\n// Data source - either model reference or inline SQL\nconst SourceSchema = z.object({\n model: z.string().optional(),\n sql: z.string().optional(),\n}).refine(\n (data) => data.model !== undefined || data.sql !== undefined,\n { message: 'Source must specify either model or sql' }\n).refine(\n (data) => !(data.model !== undefined && data.sql !== undefined),\n { message: 'Source cannot specify both model and sql' }\n);\n\n// Refresh/cache configuration\nconst RefreshSchema = z.object({\n schedule: z.string().optional(), // cron expression\n timezone: z.string().optional(),\n cache_ttl: z.string().optional(), // e.g., \"1h\", \"30m\"\n});\n\n// Drill-down column config for data table display\nconst DrillDownColumnSchema = z.object({\n field: z.string().min(1),\n label: z.string().optional(),\n format: z.string().optional(),\n});\n\n// Drill-down configuration\nconst DrillDownConfigSchema = z.object({\n chart: z.string().optional(), // target chart name (source side)\n field: z.string().optional(), // field to pass as filter, defaults to x-axis field\n columns: z.array(DrillDownColumnSchema).optional(), // data table columns (target side)\n});\n\n// Main chart schema\nexport const ChartSchema = z.object({\n // Identity\n name: z.string().min(1),\n title: z.string().min(1),\n description: z.string().optional(),\n\n // Metadata\n owner: z.string().optional(),\n tags: z.array(z.string()).optional(),\n created: z.string().optional(),\n updated: z.string().optional(),\n\n // Data\n source: SourceSchema,\n parameters: z.array(ParameterSchema).optional(),\n\n // Visualization\n chart: ChartConfigSchema,\n\n // Caching\n refresh: RefreshSchema.optional(),\n\n // Drill-down navigation\n drillDown: DrillDownConfigSchema.optional(),\n});\n\nexport type Chart = z.infer<typeof ChartSchema>;\nexport type ChartConfig = z.infer<typeof ChartConfigSchema>;\nexport type ChartType = z.infer<typeof ChartTypeSchema>;\nexport type Parameter = z.infer<typeof ParameterSchema>;\nexport type Axis = z.infer<typeof AxisSchema>;\nexport type SeriesConfig = z.infer<typeof SeriesConfigSchema>;\nexport type LongFormatSeries = z.infer<typeof LongFormatSeriesSchema>;\nexport type WideFormatSeries = z.infer<typeof WideFormatSeriesSchema>;\nexport type WideFormatColumn = z.infer<typeof WideFormatColumnSchema>;\nexport type ColorConfig = z.infer<typeof ColorSchema>;\nexport type ConditionalColor = z.infer<typeof ConditionalColorSchema>;\nexport type ColorCondition = z.infer<typeof ColorConditionSchema>;\nexport type GradientConfig = z.infer<typeof GradientSchema>;\nexport type LegendConfig = z.infer<typeof LegendSchema>;\nexport type ComboChartConfig = z.infer<typeof ComboChartConfigSchema>;\nexport type DualAxes = z.infer<typeof DualAxesSchema>;\nexport type ScatterChartConfig = z.infer<typeof ScatterChartConfigSchema>;\nexport type ScatterSize = z.infer<typeof ScatterSizeSchema>;\nexport type ScatterGroup = z.infer<typeof ScatterGroupSchema>;\nexport type RegressionConfig = z.infer<typeof RegressionSchema>;\nexport type DrillDownConfig = z.infer<typeof DrillDownConfigSchema>;\nexport type DrillDownColumn = z.infer<typeof DrillDownColumnSchema>;\nexport type HeatmapChartConfig = z.infer<typeof HeatmapChartConfigSchema>;\nexport type FunnelChartConfig = z.infer<typeof FunnelChartConfigSchema>;\nexport type WaterfallChartConfig = z.infer<typeof WaterfallChartConfigSchema>;\nexport type GaugeChartConfig = z.infer<typeof GaugeChartConfigSchema>;\nexport type TableChartConfig = z.infer<typeof TableChartConfigSchema>;\n\nexport { ParameterSchema };\n","import { z } from 'zod';\n\n// Default settings\nconst DefaultsSchema = z.object({\n connection: z.string().optional(),\n theme: z.string().optional(),\n timezone: z.string().optional(),\n cache_ttl: z.string().optional(),\n base_url: z.string().url().optional(),\n week_start: z.enum(['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']).optional(),\n});\n\n// Environment-specific settings\nconst EnvironmentSchema = z.object({\n connection: z.string().optional(),\n base_url: z.string().url().optional(),\n});\n\n// Git integration settings\nconst GitSchema = z.object({\n provider: z.enum(['github', 'gitlab', 'bitbucket']).optional(),\n repo: z.string().optional(),\n branch: z.string().optional(),\n preview_branches: z.boolean().optional(),\n});\n\n// SSO provider configuration\nconst SSOProviderSchema = z.object({\n client_id: z.string(),\n client_secret: z.string(),\n tenant: z.string().optional(),\n issuer: z.string().optional(),\n display_name: z.string().optional(),\n});\n\n// Authentication settings (built-in local auth)\nconst AuthSchema = z.object({\n enabled: z.boolean(),\n db_path: z.string().optional(),\n session_ttl: z.string().optional(),\n providers: z.object({\n google: SSOProviderSchema.optional(),\n microsoft: SSOProviderSchema.optional(),\n oidc: SSOProviderSchema.optional(),\n }).optional(),\n});\n\n// Feature flags\nconst FeaturesSchema = z.object({\n enable_sql_editor: z.boolean().optional(),\n enable_csv_export: z.boolean().optional(),\n enable_scheduling: z.boolean().optional(),\n});\n\n// Sidebar link for external navigation\nconst SidebarLinkSchema = z.object({\n label: z.string(),\n url: z.string(),\n icon: z.string().optional(),\n});\n\n// Sidebar configuration\nconst SidebarConfigSchema = z.object({\n show: z.boolean().optional(),\n collapsed: z.boolean().optional(),\n links: z.array(SidebarLinkSchema).optional(),\n sections: z.object({\n dashboards: z.boolean().optional(),\n charts: z.boolean().optional(),\n }).optional(),\n});\n\n// Color configuration\nconst ColorsSchema = z.object({\n primary: z.string().optional(),\n background: z.string().optional(),\n surface: z.string().optional(),\n sidebar: z.string().optional(),\n text: z.string().optional(),\n});\n\n// Font configuration\nconst FontsSchema = z.object({\n heading: z.string().optional(),\n body: z.string().optional(),\n mono: z.string().optional(),\n size: z.enum(['compact', 'default', 'comfortable']).optional(),\n});\n\n// Logo can be a string path or light/dark object\nconst LogoSchema = z.union([\n z.string(),\n z.object({\n light: z.string(),\n dark: z.string(),\n }),\n]);\n\n// Theme configuration\nconst ThemeSchema = z.object({\n base: z.enum(['modern', 'executive', 'minimal']).optional(),\n logo: LogoSchema.optional(),\n favicon: z.string().optional(),\n title: z.string().optional(),\n colors: ColorsSchema.optional(),\n palette: z.array(z.string()).optional(),\n gradient: z.boolean().default(false),\n opacity: z.number().min(0).max(1).default(1.0),\n fonts: FontsSchema.optional(),\n sidebar: SidebarConfigSchema.optional(),\n customCss: z.string().optional(),\n});\n\n// Main project schema\nexport const ProjectSchema = z.object({\n version: z.string().min(1),\n name: z.string().min(1),\n description: z.string().optional(),\n\n defaults: DefaultsSchema.optional(),\n\n environments: z.record(z.string(), EnvironmentSchema).optional(),\n\n git: GitSchema.optional(),\n auth: AuthSchema.optional(),\n features: FeaturesSchema.optional(),\n theme: ThemeSchema.optional(),\n});\n\nexport type Project = z.infer<typeof ProjectSchema>;\nexport type Auth = z.infer<typeof AuthSchema>;\nexport type Defaults = z.infer<typeof DefaultsSchema>;\nexport type Environment = z.infer<typeof EnvironmentSchema>;\nexport type Theme = z.infer<typeof ThemeSchema>;\nexport type SidebarConfig = z.infer<typeof SidebarConfigSchema>;\nexport type FontsConfig = z.infer<typeof FontsSchema>;\nexport type ColorsConfig = z.infer<typeof ColorsSchema>;\n","import { z } from 'zod';\n\n// Parameter type\nconst ParamTypeSchema = z.enum(['string', 'number', 'date', 'boolean', 'string[]', 'number[]']);\n\n// Model parameter\nconst ModelParamSchema = z.object({\n name: z.string().min(1),\n type: ParamTypeSchema,\n default: z.string().optional(),\n options: z.array(z.string()).optional(), // For enum-like params\n description: z.string().optional(),\n});\n\n// Return column definition\nconst ReturnColumnSchema = z.object({\n name: z.string().min(1),\n type: z.string(),\n description: z.string().optional(),\n});\n\n// Model metadata (extracted from SQL comments)\nexport const ModelMetadataSchema = z.object({\n name: z.string().min(1),\n description: z.string().optional(),\n owner: z.string().optional(),\n tags: z.array(z.string()).optional(),\n\n params: z.array(ModelParamSchema).optional(),\n returns: z.array(ReturnColumnSchema).optional(),\n tests: z.array(z.string()).optional(), // SQL assertions\n});\n\n// Full model (metadata + SQL)\nexport const ModelSchema = z.object({\n metadata: ModelMetadataSchema,\n sql: z.string().min(1),\n filePath: z.string().optional(),\n});\n\nexport type ModelMetadata = z.infer<typeof ModelMetadataSchema>;\nexport type ModelParam = z.infer<typeof ModelParamSchema>;\nexport type ReturnColumn = z.infer<typeof ReturnColumnSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\n","import { z } from 'zod';\nimport { ParameterSchema } from './chart.js';\n\n// Widget types\nconst ChartWidgetSchema = z.object({\n type: z.literal('chart'),\n ref: z.string().min(1),\n cols: z.number().min(1).max(12),\n height: z.number().min(38).optional(),\n x: z.number().min(0).max(11).optional(),\n y: z.number().min(0).optional(),\n});\n\nconst TextWidgetSchema = z.object({\n type: z.literal('text'),\n content: z.string().min(1),\n cols: z.number().min(1).max(12),\n height: z.number().min(38).optional(),\n x: z.number().min(0).max(11).optional(),\n y: z.number().min(0).optional(),\n});\n\nconst WidgetSchema = z.discriminatedUnion('type', [\n ChartWidgetSchema,\n TextWidgetSchema,\n]);\n\n// Row configuration\nconst RowSchema = z.object({\n height: z.number().min(38),\n widgets: z.array(WidgetSchema).min(1),\n});\n\n// Layout configuration\nconst LayoutSchema = z.object({\n gap: z.number().min(0).default(16),\n rows: z.array(RowSchema).min(1),\n});\n\n// Tab configuration\nconst TabSchema = z.object({\n name: z.string().min(1),\n label: z.string().min(1),\n filters: z.array(ParameterSchema).optional(),\n layout: LayoutSchema,\n});\n\n// Main dashboard schema\nexport const DashboardSchema = z.object({\n // Identity\n name: z.string().min(1),\n title: z.string().min(1),\n description: z.string().optional(),\n\n // Filters inherited by all widgets (shared across tabs)\n filters: z.array(ParameterSchema).optional(),\n\n // Layout definition (mutually exclusive with tabs)\n layout: LayoutSchema.optional(),\n\n // Tabbed layout\n tabs: z.array(TabSchema).min(1).optional(),\n}).superRefine((data, ctx) => {\n if (data.layout && data.tabs) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Dashboard must have either \"layout\" or \"tabs\", not both',\n path: ['tabs'],\n });\n }\n if (!data.layout && !data.tabs) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Dashboard must have either \"layout\" or \"tabs\"',\n path: [],\n });\n }\n});\n\nexport type Dashboard = z.infer<typeof DashboardSchema>;\nexport type DashboardTab = z.infer<typeof TabSchema>;\nexport type DashboardLayout = z.infer<typeof LayoutSchema>;\nexport type DashboardRow = z.infer<typeof RowSchema>;\nexport type DashboardWidget = z.infer<typeof WidgetSchema>;\nexport type ChartWidget = z.infer<typeof ChartWidgetSchema>;\nexport type TextWidget = z.infer<typeof TextWidgetSchema>;\n","import { z } from 'zod';\n\nconst SlackChannelSchema = z.object({\n webhook_url: z.string().min(1),\n channel: z.string().optional(),\n});\n\nconst ChannelSchema = z.object({\n slack: SlackChannelSchema,\n});\n\nconst ConditionOperatorSchema = z.enum(['lt', 'gt', 'lte', 'gte', 'eq']);\n\nconst ConditionSchema = z.object({\n field: z.string().min(1),\n operator: ConditionOperatorSchema,\n value: z.number(),\n});\n\nconst ReportScheduleSchema = z.object({\n name: z.string().min(1),\n type: z.literal('report'),\n schedule: z.string().min(1),\n timezone: z.string().optional(),\n channel: ChannelSchema,\n charts: z.array(z.string().min(1)).min(1),\n params: z.record(z.unknown()).optional(),\n message: z.string().optional(),\n notify_on_error: z.boolean().optional(),\n});\n\nconst AlertScheduleSchema = z.object({\n name: z.string().min(1),\n type: z.literal('alert'),\n schedule: z.string().min(1),\n timezone: z.string().optional(),\n channel: ChannelSchema,\n chart: z.string().min(1),\n params: z.record(z.unknown()).optional(),\n condition: ConditionSchema,\n cooldown: z.string().optional(),\n message: z.string().optional(),\n notify_on_error: z.boolean().optional(),\n});\n\nexport const ScheduleSchema = z.discriminatedUnion('type', [\n ReportScheduleSchema,\n AlertScheduleSchema,\n]);\n\nexport type Schedule = z.infer<typeof ScheduleSchema>;\nexport type ReportSchedule = z.infer<typeof ReportScheduleSchema>;\nexport type AlertSchedule = z.infer<typeof AlertScheduleSchema>;\nexport type Condition = z.infer<typeof ConditionSchema>;\nexport type ConditionOperator = z.infer<typeof ConditionOperatorSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAGl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EAAG,SAAQ;CACtC;AAED,IAAM,sBAAsBA,GAAE,OAAO;EACnC,MAAMA,GAAE,OAAM,EAAG,IAAI,CAAC;EACtB,MAAMA,GAAE,QAAQ,OAAO;EACvB,UAAUA,GAAE,OAAM,EAAG,IAAI,CAAC;EAC1B,UAAUA,GAAE,OAAM,EAAG,SAAQ;EAC7B,SAAS;EACT,OAAOA,GAAE,OAAM,EAAG,IAAI,CAAC;EACvB,QAAQA,GAAE,OAAOA,GAAE,QAAO,CAAE,EAAE,SAAQ;EACtC,WAAW;EACX,UAAUA,GAAE,OAAM,EAAG,SAAQ;EAC7B,SAASA,GAAE,OAAM,EAAG,SAAQ;EAC5B,iBAAiBA,GAAE,QAAO,EAAG,SAAQ;CACtC;AAEM,IAAM,iBAAiBA,GAAE,mBAAmB,QAAQ;EACzD;EACA;CACD;","names":["z","z","AuthSchema","z","z","z","z"]}
@@ -4,8 +4,8 @@ import {
4
4
  formatTable,
5
5
  loadProjectConfig,
6
6
  resolveConnection
7
- } from "./chunk-UDJXQQKL.js";
8
- import "./chunk-R7EULFJG.js";
7
+ } from "./chunk-2LNDAMKT.js";
8
+ import "./chunk-YL6BW3HW.js";
9
9
  import "./chunk-23E6YT4S.js";
10
10
  import "./chunk-DGUM43GV.js";
11
11
  export {
@@ -15,4 +15,4 @@ export {
15
15
  loadProjectConfig,
16
16
  resolveConnection
17
17
  };
18
- //# sourceMappingURL=connection-utils-U6MCBYCX.js.map
18
+ //# sourceMappingURL=connection-utils-Y7AWIC5M.js.map
@@ -7,8 +7,8 @@ import {
7
7
  import {
8
8
  createConnector,
9
9
  resolveConnection
10
- } from "./chunk-UDJXQQKL.js";
11
- import "./chunk-R7EULFJG.js";
10
+ } from "./chunk-2LNDAMKT.js";
11
+ import "./chunk-YL6BW3HW.js";
12
12
  import "./chunk-23E6YT4S.js";
13
13
  import "./chunk-DGUM43GV.js";
14
14
 
@@ -40,4 +40,4 @@ async function describeTable(projectDir, table, options) {
40
40
  export {
41
41
  describeTable
42
42
  };
43
- //# sourceMappingURL=describe-LTV7YMPM.js.map
43
+ //# sourceMappingURL=describe-ZAEVM3XT.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadEnvFile,
3
3
  validateProject
4
- } from "./chunk-6XQITSPY.js";
4
+ } from "./chunk-WHBVCIPG.js";
5
5
  import {
6
6
  box,
7
7
  detail,
@@ -25,7 +25,7 @@ import {
25
25
  DashboardSchema,
26
26
  ProjectSchema,
27
27
  ScheduleSchema
28
- } from "./chunk-R7EULFJG.js";
28
+ } from "./chunk-YL6BW3HW.js";
29
29
  import {
30
30
  DuckDBConnector,
31
31
  MySQLConnector,
@@ -13790,4 +13790,4 @@ async function runDevServer(projectDir, options) {
13790
13790
  export {
13791
13791
  runDevServer
13792
13792
  };
13793
- //# sourceMappingURL=dev-PV6RXXCP.js.map
13793
+ //# sourceMappingURL=dev-7XROGYXG.js.map
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  findProjectRoot,
7
7
  loadEnvFile,
8
8
  validateProject
9
- } from "./chunk-6XQITSPY.js";
9
+ } from "./chunk-WHBVCIPG.js";
10
10
  import {
11
11
  detail,
12
12
  error,
@@ -17,7 +17,7 @@ import {
17
17
  success,
18
18
  warning
19
19
  } from "./chunk-HJVVHYVN.js";
20
- import "./chunk-R7EULFJG.js";
20
+ import "./chunk-YL6BW3HW.js";
21
21
  import "./chunk-23E6YT4S.js";
22
22
  import "./chunk-DGUM43GV.js";
23
23
 
@@ -96,7 +96,7 @@ program.command("dev").description("Start development server with hot reload").a
96
96
  detail("Run this command from a yamchart project directory");
97
97
  process.exit(2);
98
98
  }
99
- const { runDevServer } = await import("./dev-PV6RXXCP.js");
99
+ const { runDevServer } = await import("./dev-7XROGYXG.js");
100
100
  await runDevServer(projectDir, {
101
101
  port: parseInt(options.port, 10),
102
102
  apiOnly: options.apiOnly ?? false,
@@ -195,7 +195,7 @@ program.command("test").description("Run model tests (@returns schema checks and
195
195
  }
196
196
  loadEnvFile(projectDir);
197
197
  try {
198
- const { testProject, formatTestOutput } = await import("./test-3PFV2KAP.js");
198
+ const { testProject, formatTestOutput } = await import("./test-7R7EGFOI.js");
199
199
  const result = await testProject(projectDir, model, {
200
200
  connection: options.connection,
201
201
  json: options.json
@@ -243,7 +243,7 @@ program.command("tables").description("List tables and views in the connected da
243
243
  }
244
244
  loadEnvFile(projectDir);
245
245
  try {
246
- const { listTables } = await import("./tables-I3WOUJ2I.js");
246
+ const { listTables } = await import("./tables-X2GY5AVA.js");
247
247
  const result = await listTables(projectDir, options);
248
248
  if (options.json) {
249
249
  console.log(JSON.stringify(result.tables, null, 2));
@@ -276,7 +276,7 @@ program.command("describe").description("Show columns and types for a table").ar
276
276
  }
277
277
  loadEnvFile(projectDir);
278
278
  try {
279
- const { describeTable } = await import("./describe-LTV7YMPM.js");
279
+ const { describeTable } = await import("./describe-ZAEVM3XT.js");
280
280
  const result = await describeTable(projectDir, table, options);
281
281
  if (options.json) {
282
282
  console.log(JSON.stringify(result.columns, null, 2));
@@ -311,8 +311,8 @@ program.command("query").description("Execute SQL against a connection").argumen
311
311
  }
312
312
  loadEnvFile(projectDir);
313
313
  try {
314
- const { executeQuery } = await import("./query-J2SD4BID.js");
315
- const { formatTable, formatJSON } = await import("./connection-utils-U6MCBYCX.js");
314
+ const { executeQuery } = await import("./query-3KIMOYUD.js");
315
+ const { formatTable, formatJSON } = await import("./connection-utils-Y7AWIC5M.js");
316
316
  const limit = options.limit ? parseInt(options.limit, 10) : void 0;
317
317
  const result = await executeQuery(projectDir, sql, {
318
318
  connection: options.connection,
@@ -339,8 +339,8 @@ program.command("sample").description("Show sample rows from a table or dbt mode
339
339
  }
340
340
  loadEnvFile(projectDir);
341
341
  try {
342
- const { sampleTable } = await import("./sample-3PF7ZJFO.js");
343
- const { formatTable, formatJSON } = await import("./connection-utils-U6MCBYCX.js");
342
+ const { sampleTable } = await import("./sample-PR4P7ZXF.js");
343
+ const { formatTable, formatJSON } = await import("./connection-utils-Y7AWIC5M.js");
344
344
  const limit = options.limit ? parseInt(options.limit, 10) : void 0;
345
345
  const result = await sampleTable(projectDir, table, {
346
346
  connection: options.connection,
@@ -370,7 +370,7 @@ program.command("search").description("Search for tables and columns by keyword"
370
370
  }
371
371
  loadEnvFile(projectDir);
372
372
  try {
373
- const { searchDatabase } = await import("./search-IUXXHMPL.js");
373
+ const { searchDatabase } = await import("./search-E53W6CR5.js");
374
374
  const result = await searchDatabase(projectDir, keyword, options);
375
375
  if (options.json) {
376
376
  console.log(JSON.stringify(result.results, null, 2));
@@ -1 +1 @@
1
- import{u as m,j as e,A as f}from"./index-DfVKHqnj.js";import{a as r}from"./echarts-DtOYsfLX.js";const p="",y={google:"Google",microsoft:"Microsoft",oidc:"SSO"};function v(){const u=m(s=>s.login),a=m(s=>s.providers),[o,x]=r.useState(""),[l,h]=r.useState(""),[i,t]=r.useState(""),[n,d]=r.useState(!1);r.useEffect(()=>{window.location.hash.includes("error=account_conflict")&&(t("An account with this email already exists. Please sign in with your password."),window.location.hash="#/")},[]);const b=async s=>{s.preventDefault(),t(""),d(!0);try{await u(o,l)}catch(c){c instanceof f?t(c.message):t("An unexpected error occurred")}finally{d(!1)}},g=s=>{window.location.href=`${p}/api/auth/sso/${s}`};return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-8 w-full max-w-md",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 mb-2",children:"Sign in to Yamchart"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Enter your credentials to access dashboards."}),i&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-md px-4 py-3 mb-4",children:i}),a.length>0&&e.jsxs("div",{className:"space-y-2 mb-6",children:[a.map(s=>e.jsxs("button",{onClick:()=>g(s),className:"w-full py-2 px-4 border border-gray-300 text-gray-700 text-sm font-medium rounded-md hover:bg-gray-50",children:["Sign in with ",y[s]??s]},s)),e.jsxs("div",{className:"relative my-4",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-gray-200"})}),e.jsx("div",{className:"relative flex justify-center text-xs text-gray-400",children:e.jsx("span",{className:"bg-white px-2",children:"or"})})]})]}),e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),e.jsx("input",{id:"email",type:"email",value:o,onChange:s=>x(s.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"you@example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),e.jsx("input",{id:"password",type:"password",value:l,onChange:s=>h(s.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Password"})]}),e.jsx("button",{type:"submit",disabled:n,className:"w-full py-2 px-4 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",children:n?"Signing in...":"Sign in"})]})]})})}export{v as LoginPage};
1
+ import{u as m,j as e,A as f}from"./index-B4-bDimp.js";import{a as r}from"./echarts-DtOYsfLX.js";const p="",y={google:"Google",microsoft:"Microsoft",oidc:"SSO"};function v(){const u=m(s=>s.login),a=m(s=>s.providers),[o,x]=r.useState(""),[l,h]=r.useState(""),[i,t]=r.useState(""),[n,d]=r.useState(!1);r.useEffect(()=>{window.location.hash.includes("error=account_conflict")&&(t("An account with this email already exists. Please sign in with your password."),window.location.hash="#/")},[]);const b=async s=>{s.preventDefault(),t(""),d(!0);try{await u(o,l)}catch(c){c instanceof f?t(c.message):t("An unexpected error occurred")}finally{d(!1)}},g=s=>{window.location.href=`${p}/api/auth/sso/${s}`};return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-8 w-full max-w-md",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 mb-2",children:"Sign in to Yamchart"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Enter your credentials to access dashboards."}),i&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-md px-4 py-3 mb-4",children:i}),a.length>0&&e.jsxs("div",{className:"space-y-2 mb-6",children:[a.map(s=>e.jsxs("button",{onClick:()=>g(s),className:"w-full py-2 px-4 border border-gray-300 text-gray-700 text-sm font-medium rounded-md hover:bg-gray-50",children:["Sign in with ",y[s]??s]},s)),e.jsxs("div",{className:"relative my-4",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-gray-200"})}),e.jsx("div",{className:"relative flex justify-center text-xs text-gray-400",children:e.jsx("span",{className:"bg-white px-2",children:"or"})})]})]}),e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),e.jsx("input",{id:"email",type:"email",value:o,onChange:s=>x(s.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"you@example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),e.jsx("input",{id:"password",type:"password",value:l,onChange:s=>h(s.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Password"})]}),e.jsx("button",{type:"submit",disabled:n,className:"w-full py-2 px-4 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",children:n?"Signing in...":"Sign in"})]})]})})}export{v as LoginPage};
@@ -1 +1 @@
1
- import{j as t,c as S,b as U,d as I,e as Y,f as q,g as H,F as z,S as G,D as K,C as X,T as Q,G as J,W as Z,h as ee,H as te,i as re,k as se,l as ae,P as ne,m as ie,B as le,L as ce,a as oe,n as de}from"./index-DfVKHqnj.js";import{a as f}from"./echarts-DtOYsfLX.js";function xe({title:s,description:n,loading:e=!1,error:l=null,cached:a,durationMs:i,hasDrillDown:D,onRefresh:r,children:h}){return t.jsxs("div",{className:"chart-container",children:[t.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-gray-100",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:s}),D&&t.jsxs("svg",{className:"w-4 h-4 text-gray-400 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[t.jsx("title",{children:"Right-click to drill down"}),t.jsx("path",{fillRule:"evenodd",d:"M5.22 14.78a.75.75 0 001.06 0l7.22-7.22v5.69a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75h-7.5a.75.75 0 000 1.5h5.69l-7.22 7.22a.75.75 0 000 1.06z",clipRule:"evenodd"})]})]}),n&&t.jsx("p",{className:"text-sm text-gray-500 mt-1",children:n})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[a!==void 0&&t.jsx("span",{className:S("text-xs px-2 py-1 rounded",a?"bg-green-100 text-green-700":"bg-blue-100 text-blue-700"),children:a?"Cached":"Fresh"}),i!==void 0&&t.jsxs("span",{className:"text-xs text-gray-400",children:[i,"ms"]}),r&&t.jsx("button",{onClick:r,disabled:e,className:"p-1.5 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded transition-colors disabled:opacity-50",title:"Refresh",children:t.jsx("svg",{className:S("w-4 h-4",e&&"animate-spin"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]}),t.jsx("div",{className:"p-4",children:l?t.jsx("div",{className:"flex items-center justify-center h-64 text-red-500",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"font-medium",children:"Failed to load chart"}),t.jsx("p",{className:"text-sm mt-1",children:l.message})]})}):h})]})}const he={day:{label:"Date",format:"%b %d, %Y"},week:{label:"Week Starting",format:"%b %d"},month:{label:"Month",format:"%b '%y"},quarter:{label:"Quarter",format:"quarter"},year:{label:"Year",format:"%Y"}};function me({chartName:s}){const[n,e]=f.useState(!1),l=async()=>{const a=`{{${s}}}`;try{await navigator.clipboard.writeText(a),e(!0),setTimeout(()=>e(!1),2e3)}catch(i){console.error("Failed to copy:",i)}};return t.jsx("button",{onClick:l,className:"text-sm text-gray-500 hover:text-gray-700 flex items-center gap-1.5 px-2 py-1 rounded hover:bg-gray-100 transition-colors",title:`Copy {{${s}}} for use in markdown widgets`,children:n?t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-4 h-4 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"text-green-600",children:"Copied!"})]}):t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),t.jsx("span",{children:"Copy Reference"})]})})}function M(s,n){if(!n)return s.toLocaleString();const e=n.decimals??0;switch(n.type){case"currency":return new Intl.NumberFormat("en-US",{style:"currency",currency:n.currency||"USD",minimumFractionDigits:e,maximumFractionDigits:e}).format(s);case"percent":return new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:e,maximumFractionDigits:e}).format(s/100);default:return s.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})}}function ue(s,n){const e=s>=0?"+":"";return n==="percent_change"?`${e}${s.toFixed(1)}%`:`${e}${s.toLocaleString()}`}function fe({data:s,config:n,title:e,comparison:l}){var p,b,w;if(!(s!=null&&s[0])||!((p=n.value)!=null&&p.field))return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-400",children:"No data available"});const a=s[0],i=a[n.value.field],D=M(i,n.format);let r=null,h="percent_change",C,k,g;if(l)r=l.change,h=l.changeType,C=l.currentPeriodLabel,k=l.previousPeriodLabel,g=M(l.previousValue,n.format);else if((b=n.comparison)!=null&&b.enabled&&n.comparison.field){const o=a[n.comparison.field];h=n.comparison.type,o&&o!==0&&(h==="percent_change"?r=(i-o)/o*100:r=i-o,g=M(o,n.format))}return t.jsxs("div",{className:"h-80 flex flex-col items-center justify-center p-8",children:[t.jsxs("div",{className:"text-6xl font-bold text-gray-900 tabular-nums",children:[D,n.unit&&t.jsx("span",{className:"text-3xl font-normal text-gray-400 ml-2",children:n.unit})]}),C&&t.jsx("div",{className:"text-sm text-gray-400 mt-2",children:C}),e&&t.jsx("div",{className:"text-lg text-gray-500 mt-3",children:e}),r!==null&&t.jsxs("div",{className:"mt-4 flex flex-col items-center gap-1",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:S("text-lg font-medium px-3 py-1 rounded",r>=0?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:ue(r,h)}),g&&t.jsxs("span",{className:"text-sm text-gray-400",children:["vs ",g]}),!g&&((w=n.comparison)==null?void 0:w.label)&&t.jsx("span",{className:"text-sm text-gray-400",children:n.comparison.label})]}),k&&t.jsx("div",{className:"text-xs text-gray-400",children:k})]})]})}function ge({chartName:s,drillParams:n}){var V,$,B,R;const{data:e,isLoading:l}=U(s),{data:a,isLoading:i,error:D}=I(s),{data:r}=Y(),h=q(),C=H(c=>c.getEffectiveFilters),k=H(c=>c.setChartFilter),g=l||i,p=n==null?void 0:n._from,b=n?Object.fromEntries(Object.entries(n).filter(([c])=>!c.startsWith("_"))):{},w=Object.keys(b).length>0,o=Object.entries(b).map(([c,x])=>`${c}: ${x}`).join(", ");f.useEffect(()=>{if(w)for(const[c,x]of Object.entries(b))k(s,c,x)},[s,w]);const[y,A]=f.useState(null),N=f.useCallback((c,x,m)=>{var u;(u=e==null?void 0:e.drillDown)!=null&&u.chart&&A({x:m.x,y:m.y,field:c,value:x})},[(V=e==null?void 0:e.drillDown)==null?void 0:V.chart]),O=f.useCallback(()=>{var m,u;if(!y||!((m=e==null?void 0:e.drillDown)!=null&&m.chart))return;const c=e.drillDown.field??((u=e.chart.x)==null?void 0:u.field)??y.field,x=new URLSearchParams({[c]:y.value,_from:s});window.location.hash=`/charts/${e.drillDown.chart}?${x.toString()}`,A(null)},[y,e,s]),T=C(s).granularity,d=T?he[T]:void 0,F=d==null?void 0:d.label,L=d==null?void 0:d.format;if(l)return t.jsxs("div",{className:"chart-container animate-pulse",children:[t.jsx("div",{className:"p-4 border-b border-gray-100",children:t.jsx("div",{className:"h-6 bg-gray-200 rounded w-48"})}),t.jsx("div",{className:"p-4",children:t.jsx("div",{className:"h-80 bg-gray-100 rounded"})})]});if(!e)return t.jsxs("div",{className:"chart-container p-8 text-center text-gray-500",children:["Chart not found: ",s]});const P=()=>{var x,m,u,E,W,_;if(!a)return t.jsx("div",{className:"h-80 bg-gray-50 rounded animate-pulse"});const c=e.chart.type;switch(c){case"line":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(x=e.drillDown)!=null&&x.chart?N:void 0;return t.jsx(ce,{data:a.rows,columns:a.columns,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"bar":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(m=e.drillDown)!=null&&m.chart?N:void 0;return t.jsx(le,{data:a.rows,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"area":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(u=e.drillDown)!=null&&u.chart?N:void 0;return t.jsx(ie,{data:a.rows,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"pie":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing pie chart configuration"}):t.jsx(ne,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,theme:r==null?void 0:r.theme,loading:i,onDrillDown:(E=e.drillDown)!=null&&E.chart?N:void 0});case"donut":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing donut chart configuration"}):t.jsx(ae,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,centerValue:e.chart.centerValue,theme:r==null?void 0:r.theme,loading:i,onDrillDown:(W=e.drillDown)!=null&&W.chart?N:void 0});case"scatter":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"}):t.jsx(se,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"combo":if(!e.chart.x)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(_=e.drillDown)!=null&&_.chart?N:void 0;return t.jsx(re,{data:a.rows,xAxis:j,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"kpi":return t.jsx(fe,{data:a.rows,config:e.chart,title:e.title,comparison:a.comparison});case"heatmap":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"}):t.jsx(te,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"funnel":return t.jsx(ee,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"waterfall":return t.jsx(Z,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"gauge":return t.jsx(J,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"table":return t.jsx(Q,{data:a.rows,columns:a.columns,height:"100%",loading:i});default:return t.jsxs("div",{className:"h-80 flex items-center justify-center text-gray-500",children:['Chart type "',c,'" not yet implemented']})}};return t.jsxs("div",{className:"space-y-4",children:[p&&t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[t.jsx("button",{onClick:()=>{window.location.hash=`/charts/${p}`},className:"hover:text-blue-600 transition-colors",children:p}),t.jsx("span",{children:"/"}),t.jsx("span",{className:"text-gray-700 font-medium",children:e.title}),o&&t.jsxs("span",{className:"text-gray-400",children:["(",o,")"]})]}),t.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.parameters.length>0?t.jsx(z,{parameters:e.parameters,chartName:s}):t.jsx("div",{}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(me,{chartName:s}),t.jsx(G,{resourceType:"chart",resourceName:s})]})]}),t.jsx(xe,{title:e.title,description:e.description,loading:g,error:D,cached:a==null?void 0:a.meta.cached,durationMs:a==null?void 0:a.meta.durationMs,hasDrillDown:!!(($=e.drillDown)!=null&&$.chart),onRefresh:()=>h(s),children:P()}),w&&a&&t.jsx(K,{data:a.rows,columns:a.columns,drillDownColumns:(B=e.drillDown)==null?void 0:B.columns,filterDisplay:o,chartName:s}),y&&((R=e.drillDown)==null?void 0:R.chart)&&t.jsx(X,{x:y.x,y:y.y,targetChartTitle:e.drillDown.chart,onDrillDown:O,onClose:()=>A(null)})]})}function pe({parsed:s}){const n=s.params.token,[e,l]=f.useState(null),[a,i]=f.useState(!1);return f.useEffect(()=>{if(!n){l("No share token provided");return}oe.getPublicConfig(n).then(()=>i(!0)).catch(()=>l("This link has expired or been revoked"))},[n]),e?t.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:t.jsx("div",{className:"text-center",children:t.jsx("div",{className:"text-gray-400 text-lg",children:e})})}):a?t.jsxs("div",{className:"min-h-screen bg-gray-50",children:[t.jsx("div",{className:"max-w-7xl mx-auto py-6 px-4",children:s.type==="public_chart"?t.jsx(ge,{chartName:s.name}):t.jsx(de,{dashboardId:s.name,initialTab:s.params.tab})}),t.jsx("div",{className:"text-center py-4 text-xs text-gray-400",children:"Shared via yamchart"})]}):t.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:t.jsx("div",{className:"text-gray-500",children:"Loading..."})})}export{pe as PublicViewer};
1
+ import{j as t,c as S,b as U,d as I,e as Y,f as q,g as H,F as z,S as G,D as K,C as X,T as Q,G as J,W as Z,h as ee,H as te,i as re,k as se,l as ae,P as ne,m as ie,B as le,L as ce,a as oe,n as de}from"./index-B4-bDimp.js";import{a as f}from"./echarts-DtOYsfLX.js";function xe({title:s,description:n,loading:e=!1,error:l=null,cached:a,durationMs:i,hasDrillDown:D,onRefresh:r,children:h}){return t.jsxs("div",{className:"chart-container",children:[t.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-gray-100",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:s}),D&&t.jsxs("svg",{className:"w-4 h-4 text-gray-400 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[t.jsx("title",{children:"Right-click to drill down"}),t.jsx("path",{fillRule:"evenodd",d:"M5.22 14.78a.75.75 0 001.06 0l7.22-7.22v5.69a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75h-7.5a.75.75 0 000 1.5h5.69l-7.22 7.22a.75.75 0 000 1.06z",clipRule:"evenodd"})]})]}),n&&t.jsx("p",{className:"text-sm text-gray-500 mt-1",children:n})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[a!==void 0&&t.jsx("span",{className:S("text-xs px-2 py-1 rounded",a?"bg-green-100 text-green-700":"bg-blue-100 text-blue-700"),children:a?"Cached":"Fresh"}),i!==void 0&&t.jsxs("span",{className:"text-xs text-gray-400",children:[i,"ms"]}),r&&t.jsx("button",{onClick:r,disabled:e,className:"p-1.5 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded transition-colors disabled:opacity-50",title:"Refresh",children:t.jsx("svg",{className:S("w-4 h-4",e&&"animate-spin"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]}),t.jsx("div",{className:"p-4",children:l?t.jsx("div",{className:"flex items-center justify-center h-64 text-red-500",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"font-medium",children:"Failed to load chart"}),t.jsx("p",{className:"text-sm mt-1",children:l.message})]})}):h})]})}const he={day:{label:"Date",format:"%b %d, %Y"},week:{label:"Week Starting",format:"%b %d"},month:{label:"Month",format:"%b '%y"},quarter:{label:"Quarter",format:"quarter"},year:{label:"Year",format:"%Y"}};function me({chartName:s}){const[n,e]=f.useState(!1),l=async()=>{const a=`{{${s}}}`;try{await navigator.clipboard.writeText(a),e(!0),setTimeout(()=>e(!1),2e3)}catch(i){console.error("Failed to copy:",i)}};return t.jsx("button",{onClick:l,className:"text-sm text-gray-500 hover:text-gray-700 flex items-center gap-1.5 px-2 py-1 rounded hover:bg-gray-100 transition-colors",title:`Copy {{${s}}} for use in markdown widgets`,children:n?t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-4 h-4 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"text-green-600",children:"Copied!"})]}):t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),t.jsx("span",{children:"Copy Reference"})]})})}function M(s,n){if(!n)return s.toLocaleString();const e=n.decimals??0;switch(n.type){case"currency":return new Intl.NumberFormat("en-US",{style:"currency",currency:n.currency||"USD",minimumFractionDigits:e,maximumFractionDigits:e}).format(s);case"percent":return new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:e,maximumFractionDigits:e}).format(s/100);default:return s.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})}}function ue(s,n){const e=s>=0?"+":"";return n==="percent_change"?`${e}${s.toFixed(1)}%`:`${e}${s.toLocaleString()}`}function fe({data:s,config:n,title:e,comparison:l}){var p,b,w;if(!(s!=null&&s[0])||!((p=n.value)!=null&&p.field))return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-400",children:"No data available"});const a=s[0],i=a[n.value.field],D=M(i,n.format);let r=null,h="percent_change",C,k,g;if(l)r=l.change,h=l.changeType,C=l.currentPeriodLabel,k=l.previousPeriodLabel,g=M(l.previousValue,n.format);else if((b=n.comparison)!=null&&b.enabled&&n.comparison.field){const o=a[n.comparison.field];h=n.comparison.type,o&&o!==0&&(h==="percent_change"?r=(i-o)/o*100:r=i-o,g=M(o,n.format))}return t.jsxs("div",{className:"h-80 flex flex-col items-center justify-center p-8",children:[t.jsxs("div",{className:"text-6xl font-bold text-gray-900 tabular-nums",children:[D,n.unit&&t.jsx("span",{className:"text-3xl font-normal text-gray-400 ml-2",children:n.unit})]}),C&&t.jsx("div",{className:"text-sm text-gray-400 mt-2",children:C}),e&&t.jsx("div",{className:"text-lg text-gray-500 mt-3",children:e}),r!==null&&t.jsxs("div",{className:"mt-4 flex flex-col items-center gap-1",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:S("text-lg font-medium px-3 py-1 rounded",r>=0?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:ue(r,h)}),g&&t.jsxs("span",{className:"text-sm text-gray-400",children:["vs ",g]}),!g&&((w=n.comparison)==null?void 0:w.label)&&t.jsx("span",{className:"text-sm text-gray-400",children:n.comparison.label})]}),k&&t.jsx("div",{className:"text-xs text-gray-400",children:k})]})]})}function ge({chartName:s,drillParams:n}){var V,$,B,R;const{data:e,isLoading:l}=U(s),{data:a,isLoading:i,error:D}=I(s),{data:r}=Y(),h=q(),C=H(c=>c.getEffectiveFilters),k=H(c=>c.setChartFilter),g=l||i,p=n==null?void 0:n._from,b=n?Object.fromEntries(Object.entries(n).filter(([c])=>!c.startsWith("_"))):{},w=Object.keys(b).length>0,o=Object.entries(b).map(([c,x])=>`${c}: ${x}`).join(", ");f.useEffect(()=>{if(w)for(const[c,x]of Object.entries(b))k(s,c,x)},[s,w]);const[y,A]=f.useState(null),N=f.useCallback((c,x,m)=>{var u;(u=e==null?void 0:e.drillDown)!=null&&u.chart&&A({x:m.x,y:m.y,field:c,value:x})},[(V=e==null?void 0:e.drillDown)==null?void 0:V.chart]),O=f.useCallback(()=>{var m,u;if(!y||!((m=e==null?void 0:e.drillDown)!=null&&m.chart))return;const c=e.drillDown.field??((u=e.chart.x)==null?void 0:u.field)??y.field,x=new URLSearchParams({[c]:y.value,_from:s});window.location.hash=`/charts/${e.drillDown.chart}?${x.toString()}`,A(null)},[y,e,s]),T=C(s).granularity,d=T?he[T]:void 0,F=d==null?void 0:d.label,L=d==null?void 0:d.format;if(l)return t.jsxs("div",{className:"chart-container animate-pulse",children:[t.jsx("div",{className:"p-4 border-b border-gray-100",children:t.jsx("div",{className:"h-6 bg-gray-200 rounded w-48"})}),t.jsx("div",{className:"p-4",children:t.jsx("div",{className:"h-80 bg-gray-100 rounded"})})]});if(!e)return t.jsxs("div",{className:"chart-container p-8 text-center text-gray-500",children:["Chart not found: ",s]});const P=()=>{var x,m,u,E,W,_;if(!a)return t.jsx("div",{className:"h-80 bg-gray-50 rounded animate-pulse"});const c=e.chart.type;switch(c){case"line":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(x=e.drillDown)!=null&&x.chart?N:void 0;return t.jsx(ce,{data:a.rows,columns:a.columns,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"bar":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(m=e.drillDown)!=null&&m.chart?N:void 0;return t.jsx(le,{data:a.rows,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"area":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(u=e.drillDown)!=null&&u.chart?N:void 0;return t.jsx(ie,{data:a.rows,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"pie":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing pie chart configuration"}):t.jsx(ne,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,theme:r==null?void 0:r.theme,loading:i,onDrillDown:(E=e.drillDown)!=null&&E.chart?N:void 0});case"donut":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing donut chart configuration"}):t.jsx(ae,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,centerValue:e.chart.centerValue,theme:r==null?void 0:r.theme,loading:i,onDrillDown:(W=e.drillDown)!=null&&W.chart?N:void 0});case"scatter":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"}):t.jsx(se,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"combo":if(!e.chart.x)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(_=e.drillDown)!=null&&_.chart?N:void 0;return t.jsx(re,{data:a.rows,xAxis:j,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"kpi":return t.jsx(fe,{data:a.rows,config:e.chart,title:e.title,comparison:a.comparison});case"heatmap":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"}):t.jsx(te,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"funnel":return t.jsx(ee,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"waterfall":return t.jsx(Z,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"gauge":return t.jsx(J,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"table":return t.jsx(Q,{data:a.rows,columns:a.columns,chartConfig:e.chart,height:"100%",loading:i});default:return t.jsxs("div",{className:"h-80 flex items-center justify-center text-gray-500",children:['Chart type "',c,'" not yet implemented']})}};return t.jsxs("div",{className:"space-y-4",children:[p&&t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[t.jsx("button",{onClick:()=>{window.location.hash=`/charts/${p}`},className:"hover:text-blue-600 transition-colors",children:p}),t.jsx("span",{children:"/"}),t.jsx("span",{className:"text-gray-700 font-medium",children:e.title}),o&&t.jsxs("span",{className:"text-gray-400",children:["(",o,")"]})]}),t.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.parameters.length>0?t.jsx(z,{parameters:e.parameters,chartName:s}):t.jsx("div",{}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(me,{chartName:s}),t.jsx(G,{resourceType:"chart",resourceName:s})]})]}),t.jsx(xe,{title:e.title,description:e.description,loading:g,error:D,cached:a==null?void 0:a.meta.cached,durationMs:a==null?void 0:a.meta.durationMs,hasDrillDown:!!(($=e.drillDown)!=null&&$.chart),onRefresh:()=>h(s),children:P()}),w&&a&&t.jsx(K,{data:a.rows,columns:a.columns,drillDownColumns:(B=e.drillDown)==null?void 0:B.columns,filterDisplay:o,chartName:s}),y&&((R=e.drillDown)==null?void 0:R.chart)&&t.jsx(X,{x:y.x,y:y.y,targetChartTitle:e.drillDown.chart,onDrillDown:O,onClose:()=>A(null)})]})}function pe({parsed:s}){const n=s.params.token,[e,l]=f.useState(null),[a,i]=f.useState(!1);return f.useEffect(()=>{if(!n){l("No share token provided");return}oe.getPublicConfig(n).then(()=>i(!0)).catch(()=>l("This link has expired or been revoked"))},[n]),e?t.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:t.jsx("div",{className:"text-center",children:t.jsx("div",{className:"text-gray-400 text-lg",children:e})})}):a?t.jsxs("div",{className:"min-h-screen bg-gray-50",children:[t.jsx("div",{className:"max-w-7xl mx-auto py-6 px-4",children:s.type==="public_chart"?t.jsx(ge,{chartName:s.name}):t.jsx(de,{dashboardId:s.name,initialTab:s.params.tab})}),t.jsx("div",{className:"text-center py-4 text-xs text-gray-400",children:"Shared via yamchart"})]}):t.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:t.jsx("div",{className:"text-gray-500",children:"Loading..."})})}export{pe as PublicViewer};
@@ -1 +1 @@
1
- import{u as g,j as e,A as y}from"./index-DfVKHqnj.js";import{a as s}from"./echarts-DtOYsfLX.js";function N(){const c=g(r=>r.setup),[o,b]=s.useState(""),[l,x]=s.useState(""),[a,p]=s.useState(""),[d,f]=s.useState(""),[n,t]=s.useState(""),[u,m]=s.useState(!1),h=async r=>{if(r.preventDefault(),t(""),a!==d){t("Passwords do not match");return}if(a.length<8){t("Password must be at least 8 characters");return}m(!0);try{await c(o,l,a)}catch(i){i instanceof y?t(i.message):t("An unexpected error occurred")}finally{m(!1)}};return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-8 w-full max-w-md",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 mb-2",children:"Welcome to Yamchart"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Create your admin account to get started."}),n&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-md px-4 py-3 mb-4",children:n}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:"Name"}),e.jsx("input",{id:"name",type:"text",value:l,onChange:r=>x(r.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Your Name"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"setup-email",className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),e.jsx("input",{id:"setup-email",type:"email",value:o,onChange:r=>b(r.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"admin@example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"setup-password",className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),e.jsx("input",{id:"setup-password",type:"password",value:a,onChange:r=>p(r.target.value),required:!0,minLength:8,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"At least 8 characters"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium text-gray-700 mb-1",children:"Confirm Password"}),e.jsx("input",{id:"confirm-password",type:"password",value:d,onChange:r=>f(r.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Confirm password"})]}),e.jsx("button",{type:"submit",disabled:u,className:"w-full py-2 px-4 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",children:u?"Creating account...":"Create Admin Account"})]})]})})}export{N as SetupWizard};
1
+ import{u as g,j as e,A as y}from"./index-B4-bDimp.js";import{a as s}from"./echarts-DtOYsfLX.js";function N(){const c=g(r=>r.setup),[o,b]=s.useState(""),[l,x]=s.useState(""),[a,p]=s.useState(""),[d,f]=s.useState(""),[n,t]=s.useState(""),[u,m]=s.useState(!1),h=async r=>{if(r.preventDefault(),t(""),a!==d){t("Passwords do not match");return}if(a.length<8){t("Password must be at least 8 characters");return}m(!0);try{await c(o,l,a)}catch(i){i instanceof y?t(i.message):t("An unexpected error occurred")}finally{m(!1)}};return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-8 w-full max-w-md",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 mb-2",children:"Welcome to Yamchart"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Create your admin account to get started."}),n&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-md px-4 py-3 mb-4",children:n}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:"Name"}),e.jsx("input",{id:"name",type:"text",value:l,onChange:r=>x(r.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Your Name"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"setup-email",className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),e.jsx("input",{id:"setup-email",type:"email",value:o,onChange:r=>b(r.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"admin@example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"setup-password",className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),e.jsx("input",{id:"setup-password",type:"password",value:a,onChange:r=>p(r.target.value),required:!0,minLength:8,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"At least 8 characters"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium text-gray-700 mb-1",children:"Confirm Password"}),e.jsx("input",{id:"confirm-password",type:"password",value:d,onChange:r=>f(r.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Confirm password"})]}),e.jsx("button",{type:"submit",disabled:u,className:"w-full py-2 px-4 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",children:u?"Creating account...":"Create Admin Account"})]})]})})}export{N as SetupWizard};
@@ -1 +1 @@
1
- import{j as e,a as c}from"./index-DfVKHqnj.js";import{a as s}from"./echarts-DtOYsfLX.js";function p(){const[r,l]=s.useState([]),[d,i]=s.useState(!0),x=async()=>{try{const t=await c.listShareLinks();l(t.links)}catch(t){console.error("Failed to load share links:",t)}finally{i(!1)}};s.useEffect(()=>{x()},[]);const n=async t=>{try{await c.revokeShareLink(t),l(a=>a.filter(o=>o.id!==t))}catch(a){console.error("Failed to revoke share link:",a)}};return d?e.jsx("div",{className:"p-6 text-gray-500",children:"Loading..."}):e.jsxs("div",{className:"p-6 max-w-4xl",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Shared Links"}),r.length===0?e.jsx("p",{className:"text-gray-500 text-sm",children:"No active share links."}):e.jsx("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium text-gray-600",children:"Resource"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium text-gray-600",children:"Type"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium text-gray-600",children:"Created"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium text-gray-600",children:"Expires"}),e.jsx("th",{className:"px-4 py-2"})]})}),e.jsx("tbody",{children:r.map(t=>e.jsxs("tr",{className:"border-b border-gray-100 last:border-0",children:[e.jsx("td",{className:"px-4 py-3 font-medium text-gray-900",children:t.resource_name}),e.jsx("td",{className:"px-4 py-3 text-gray-600 capitalize",children:t.resource_type}),e.jsx("td",{className:"px-4 py-3 text-gray-500",children:new Date(t.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-gray-500",children:t.expires_at?new Date(t.expires_at).toLocaleDateString():"Never"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{onClick:()=>n(t.id),className:"text-red-600 hover:text-red-700 text-sm",children:"Revoke"})})]},t.id))})]})})]})}export{p as ShareManagement};
1
+ import{j as e,a as c}from"./index-B4-bDimp.js";import{a as s}from"./echarts-DtOYsfLX.js";function p(){const[r,l]=s.useState([]),[d,i]=s.useState(!0),x=async()=>{try{const t=await c.listShareLinks();l(t.links)}catch(t){console.error("Failed to load share links:",t)}finally{i(!1)}};s.useEffect(()=>{x()},[]);const n=async t=>{try{await c.revokeShareLink(t),l(a=>a.filter(o=>o.id!==t))}catch(a){console.error("Failed to revoke share link:",a)}};return d?e.jsx("div",{className:"p-6 text-gray-500",children:"Loading..."}):e.jsxs("div",{className:"p-6 max-w-4xl",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Shared Links"}),r.length===0?e.jsx("p",{className:"text-gray-500 text-sm",children:"No active share links."}):e.jsx("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium text-gray-600",children:"Resource"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium text-gray-600",children:"Type"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium text-gray-600",children:"Created"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium text-gray-600",children:"Expires"}),e.jsx("th",{className:"px-4 py-2"})]})}),e.jsx("tbody",{children:r.map(t=>e.jsxs("tr",{className:"border-b border-gray-100 last:border-0",children:[e.jsx("td",{className:"px-4 py-3 font-medium text-gray-900",children:t.resource_name}),e.jsx("td",{className:"px-4 py-3 text-gray-600 capitalize",children:t.resource_type}),e.jsx("td",{className:"px-4 py-3 text-gray-500",children:new Date(t.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-gray-500",children:t.expires_at?new Date(t.expires_at).toLocaleDateString():"Never"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{onClick:()=>n(t.id),className:"text-red-600 hover:text-red-700 text-sm",children:"Revoke"})})]},t.id))})]})})]})}export{p as ShareManagement};
@@ -1 +1 @@
1
- import{j as e,a as p,A as v}from"./index-DfVKHqnj.js";import{a as r}from"./echarts-DtOYsfLX.js";function O(){var k;const[c,N]=r.useState([]),[b,w]=r.useState(!0),[g,y]=r.useState(!1),[x,A]=r.useState(""),[n,f]=r.useState(null),[u,d]=r.useState([]),[m,h]=r.useState(!1),o=async()=>{try{const{users:t}=await p.authListUsers();N(t)}catch{A("Failed to load users")}finally{w(!1)}};r.useEffect(()=>{o()},[]);const l=async(t,s)=>{try{await p.authUpdateUser(t,{role:s}),await o()}catch(a){alert(a instanceof v?a.message:"Failed to update role")}},j=async(t,s)=>{if(confirm(`Delete user "${s}"? This cannot be undone.`))try{await p.authDeleteUser(t),await o()}catch(a){alert(a instanceof v?a.message:"Failed to delete user")}},U=t=>{if(n===t.id)f(null),d([]);else{f(t.id);const s=JSON.parse(t.attributes||"{}");d(Object.entries(s).map(([a,i])=>({key:a,value:i})))}},C=(t,s,a)=>{d(i=>i.map((S,M)=>M===t?{...S,[s]:a}:S))},E=()=>{d(t=>[...t,{key:"",value:""}])},L=t=>{d(s=>s.filter((a,i)=>i!==t))},D=async()=>{if(n){h(!0);try{const t={};for(const{key:s,value:a}of u){const i=s.trim();i&&(t[i]=a)}await p.authUpdateUser(n,{attributes:t}),await o(),d(Object.entries(t).map(([s,a])=>({key:s,value:a})))}catch(t){alert(t instanceof v?t.message:"Failed to save attributes")}finally{h(!1)}}};return b?e.jsx("div",{className:"p-6 text-gray-500",children:"Loading users..."}):e.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900",children:"User Management"}),e.jsx("button",{onClick:()=>y(!0),className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700",children:"Add User"})]}),x&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-md px-4 py-3 mb-4",children:x}),e.jsx("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Name"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Email"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Role"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Created"}),e.jsx("th",{className:"px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:c.map(t=>e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:"px-4 py-3 text-sm text-gray-900",children:t.name}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-500",children:t.email}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("select",{value:t.role,onChange:s=>l(t.id,s.target.value),className:"text-sm border border-gray-300 rounded px-2 py-1",children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"viewer",children:"Viewer"})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-500",children:new Date(t.created_at).toLocaleDateString()}),e.jsxs("td",{className:"px-4 py-3 text-right space-x-3",children:[e.jsx("button",{onClick:()=>U(t),className:"text-sm text-blue-600 hover:text-blue-800",children:n===t.id?"Hide Attrs":"Attrs"}),e.jsx("button",{onClick:()=>j(t.id,t.name),className:"text-sm text-red-600 hover:text-red-800",children:"Delete"})]})]},t.id))})]})}),n&&e.jsxs("div",{className:"mt-4 bg-white border border-gray-200 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700",children:["Attributes for ",(k=c.find(t=>t.id===n))==null?void 0:k.name]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:E,className:"px-3 py-1 text-xs font-medium text-blue-600 border border-blue-300 rounded hover:bg-blue-50",children:"Add Attribute"}),e.jsx("button",{onClick:D,disabled:m,className:"px-3 py-1 text-xs font-medium text-white bg-blue-600 rounded hover:bg-blue-700 disabled:opacity-50",children:m?"Saving...":"Save"})]})]}),u.length===0?e.jsx("p",{className:"text-sm text-gray-400",children:'No attributes. Click "Add Attribute" to define key-value pairs for row-level security.'}):e.jsx("div",{className:"space-y-2",children:u.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",placeholder:"Key (e.g. department)",value:t.key,onChange:a=>C(s,"key",a.target.value),className:"flex-1 px-3 py-1.5 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),e.jsx("input",{type:"text",placeholder:"Value (e.g. Sales)",value:t.value,onChange:a=>C(s,"value",a.target.value),className:"flex-1 px-3 py-1.5 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),e.jsx("button",{onClick:()=>L(s),className:"p-1.5 text-gray-400 hover:text-red-500",title:"Remove attribute",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},s))})]}),g&&e.jsx(R,{onClose:()=>y(!1),onCreated:o})]})}function R({onClose:c,onCreated:N}){const[b,w]=r.useState(""),[g,y]=r.useState(""),[x,A]=r.useState(""),[n,f]=r.useState("viewer"),[u,d]=r.useState(""),[m,h]=r.useState(!1),o=async l=>{l.preventDefault(),d(""),h(!0);try{await p.authCreateUser({email:b,name:g,password:x,role:n}),N(),c()}catch(j){d(j instanceof v?j.message:"Failed to create user")}finally{h(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:c,children:e.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6 w-full max-w-md",onClick:l=>l.stopPropagation(),children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Add User"}),u&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-md px-4 py-3 mb-4",children:u}),e.jsxs("form",{onSubmit:o,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Name"}),e.jsx("input",{type:"text",value:g,onChange:l=>y(l.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),e.jsx("input",{type:"email",value:b,onChange:l=>w(l.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Temporary Password"}),e.jsx("input",{type:"password",value:x,onChange:l=>A(l.target.value),required:!0,minLength:8,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Role"}),e.jsxs("select",{value:n,onChange:l=>f(l.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"viewer",children:"Viewer"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"admin",children:"Admin"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:c,className:"px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-md",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:m,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50",children:m?"Creating...":"Create User"})]})]})]})})}export{O as UserManagement};
1
+ import{j as e,a as p,A as v}from"./index-B4-bDimp.js";import{a as r}from"./echarts-DtOYsfLX.js";function O(){var k;const[c,N]=r.useState([]),[b,w]=r.useState(!0),[g,y]=r.useState(!1),[x,A]=r.useState(""),[n,f]=r.useState(null),[u,d]=r.useState([]),[m,h]=r.useState(!1),o=async()=>{try{const{users:t}=await p.authListUsers();N(t)}catch{A("Failed to load users")}finally{w(!1)}};r.useEffect(()=>{o()},[]);const l=async(t,s)=>{try{await p.authUpdateUser(t,{role:s}),await o()}catch(a){alert(a instanceof v?a.message:"Failed to update role")}},j=async(t,s)=>{if(confirm(`Delete user "${s}"? This cannot be undone.`))try{await p.authDeleteUser(t),await o()}catch(a){alert(a instanceof v?a.message:"Failed to delete user")}},U=t=>{if(n===t.id)f(null),d([]);else{f(t.id);const s=JSON.parse(t.attributes||"{}");d(Object.entries(s).map(([a,i])=>({key:a,value:i})))}},C=(t,s,a)=>{d(i=>i.map((S,M)=>M===t?{...S,[s]:a}:S))},E=()=>{d(t=>[...t,{key:"",value:""}])},L=t=>{d(s=>s.filter((a,i)=>i!==t))},D=async()=>{if(n){h(!0);try{const t={};for(const{key:s,value:a}of u){const i=s.trim();i&&(t[i]=a)}await p.authUpdateUser(n,{attributes:t}),await o(),d(Object.entries(t).map(([s,a])=>({key:s,value:a})))}catch(t){alert(t instanceof v?t.message:"Failed to save attributes")}finally{h(!1)}}};return b?e.jsx("div",{className:"p-6 text-gray-500",children:"Loading users..."}):e.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900",children:"User Management"}),e.jsx("button",{onClick:()=>y(!0),className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700",children:"Add User"})]}),x&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-md px-4 py-3 mb-4",children:x}),e.jsx("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Name"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Email"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Role"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Created"}),e.jsx("th",{className:"px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:c.map(t=>e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:"px-4 py-3 text-sm text-gray-900",children:t.name}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-500",children:t.email}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("select",{value:t.role,onChange:s=>l(t.id,s.target.value),className:"text-sm border border-gray-300 rounded px-2 py-1",children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"viewer",children:"Viewer"})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-500",children:new Date(t.created_at).toLocaleDateString()}),e.jsxs("td",{className:"px-4 py-3 text-right space-x-3",children:[e.jsx("button",{onClick:()=>U(t),className:"text-sm text-blue-600 hover:text-blue-800",children:n===t.id?"Hide Attrs":"Attrs"}),e.jsx("button",{onClick:()=>j(t.id,t.name),className:"text-sm text-red-600 hover:text-red-800",children:"Delete"})]})]},t.id))})]})}),n&&e.jsxs("div",{className:"mt-4 bg-white border border-gray-200 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700",children:["Attributes for ",(k=c.find(t=>t.id===n))==null?void 0:k.name]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:E,className:"px-3 py-1 text-xs font-medium text-blue-600 border border-blue-300 rounded hover:bg-blue-50",children:"Add Attribute"}),e.jsx("button",{onClick:D,disabled:m,className:"px-3 py-1 text-xs font-medium text-white bg-blue-600 rounded hover:bg-blue-700 disabled:opacity-50",children:m?"Saving...":"Save"})]})]}),u.length===0?e.jsx("p",{className:"text-sm text-gray-400",children:'No attributes. Click "Add Attribute" to define key-value pairs for row-level security.'}):e.jsx("div",{className:"space-y-2",children:u.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",placeholder:"Key (e.g. department)",value:t.key,onChange:a=>C(s,"key",a.target.value),className:"flex-1 px-3 py-1.5 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),e.jsx("input",{type:"text",placeholder:"Value (e.g. Sales)",value:t.value,onChange:a=>C(s,"value",a.target.value),className:"flex-1 px-3 py-1.5 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),e.jsx("button",{onClick:()=>L(s),className:"p-1.5 text-gray-400 hover:text-red-500",title:"Remove attribute",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},s))})]}),g&&e.jsx(R,{onClose:()=>y(!1),onCreated:o})]})}function R({onClose:c,onCreated:N}){const[b,w]=r.useState(""),[g,y]=r.useState(""),[x,A]=r.useState(""),[n,f]=r.useState("viewer"),[u,d]=r.useState(""),[m,h]=r.useState(!1),o=async l=>{l.preventDefault(),d(""),h(!0);try{await p.authCreateUser({email:b,name:g,password:x,role:n}),N(),c()}catch(j){d(j instanceof v?j.message:"Failed to create user")}finally{h(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:c,children:e.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6 w-full max-w-md",onClick:l=>l.stopPropagation(),children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Add User"}),u&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 text-sm rounded-md px-4 py-3 mb-4",children:u}),e.jsxs("form",{onSubmit:o,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Name"}),e.jsx("input",{type:"text",value:g,onChange:l=>y(l.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),e.jsx("input",{type:"email",value:b,onChange:l=>w(l.target.value),required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Temporary Password"}),e.jsx("input",{type:"password",value:x,onChange:l=>A(l.target.value),required:!0,minLength:8,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Role"}),e.jsxs("select",{value:n,onChange:l=>f(l.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"viewer",children:"Viewer"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"admin",children:"Admin"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:c,className:"px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-md",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:m,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50",children:m?"Creating...":"Create User"})]})]})]})})}export{O as UserManagement};