yamchart 0.9.5 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{advisor-SC64RTZO.js → advisor-5TJDNAY7.js} +24 -14
- package/dist/advisor-5TJDNAY7.js.map +1 -0
- package/dist/agent-TZZHNDPK.js +1 -0
- package/dist/{chunk-NXQ6ZO3V.js → chunk-5FHV22X2.js} +7 -6
- package/dist/chunk-5FHV22X2.js.map +1 -0
- package/dist/{dist-MNXSMGV6.js → chunk-64CI3HSY.js} +184 -15
- package/dist/chunk-64CI3HSY.js.map +1 -0
- package/dist/chunk-7D4SUZUM.js +1 -0
- package/dist/chunk-DZVT6PHW.js +1 -0
- package/dist/chunk-EAQXUGP6.js +1 -0
- package/dist/chunk-HJVVHYVN.js +1 -0
- package/dist/chunk-IVD4OP3K.js +1 -0
- package/dist/{chunk-S7YQXEKM.js → chunk-QUIDZO5G.js} +104 -275
- package/dist/chunk-QUIDZO5G.js.map +1 -0
- package/dist/{chunk-RMIDEBHD.js → chunk-S2CH4HUZ.js} +7 -6
- package/dist/chunk-TZKNU5TD.js +1 -0
- package/dist/chunk-UFDQ3C7Q.js +919 -0
- package/dist/chunk-UFDQ3C7Q.js.map +1 -0
- package/dist/chunk-VJC24RKT.js +1 -0
- package/dist/chunk-WYS4ULBE.js +1 -0
- package/dist/{chunk-H4L3FNLS.js → chunk-ZBCQNWVN.js} +3 -2
- package/dist/{chunk-RM6MNDVF.js → chunk-ZIY22VO7.js} +193 -11
- package/dist/chunk-ZIY22VO7.js.map +1 -0
- package/dist/chunk-ZMJPRNOA.js +1 -0
- package/dist/compare-RQFCEZIK.js +1 -0
- package/dist/connection-utils-FEUWER5I.js +20 -0
- package/dist/{describe-X75C2VDU.js → describe-MEP72B56.js} +7 -6
- package/dist/{dev-GWXHBBWB.js → dev-H6SJZ5UA.js} +1315 -73
- package/dist/dev-H6SJZ5UA.js.map +1 -0
- package/dist/dist-5DQO6L2S.js +48 -0
- package/dist/dist-MIKFZKSD.js +1 -0
- package/dist/dist-PPAD6KOM.js +99 -0
- package/dist/{dist-JMLAZUL7.js → dist-XNCED7JW.js} +30 -12
- package/dist/generate-B7FAWVIQ.js +1 -0
- package/dist/index.js +25 -24
- package/dist/init-SECXKD5G.js +1 -0
- package/dist/lineage-HYO4RKZT.js +1 -0
- package/dist/public/assets/DataView-DUCz_96y.js +9 -0
- package/dist/public/assets/{EventManagement-CTuAJ0eF.js → EventManagement-BnmeJDQl.js} +1 -1
- package/dist/public/assets/{ExplorePage-ZJ3zNjNQ.js → ExplorePage-kk4z9ldZ.js} +1 -1
- package/dist/public/assets/{LoginPage-wygea4BI.js → LoginPage-CzaFkkjg.js} +1 -1
- package/dist/public/assets/{PublicViewer-8YqGrVVB.js → PublicViewer-irjxqH6a.js} +1 -1
- package/dist/public/assets/{SetupWizard-DqDBwHrF.js → SetupWizard-ConWIcmy.js} +1 -1
- package/dist/public/assets/{ShareManagement-TAAdI_gY.js → ShareManagement-CP4wdwLR.js} +1 -1
- package/dist/public/assets/SourceDetailView-DZS5518E.js +1 -0
- package/dist/public/assets/{UserManagement-B4kZHyri.js → UserManagement-AubGd9hl.js} +1 -1
- package/dist/public/assets/data-3vtzSuAZ.js +1 -0
- package/dist/public/assets/{index-CfyF2Wf-.css → index-C1X8RW4Z.css} +1 -1
- package/dist/public/assets/{index-BgzSjgIu.js → index-jlfTO7f5.js} +44 -44
- package/dist/public/assets/{index.es-AB-GdGyc.js → index.es-CgnvEWi5.js} +1 -1
- package/dist/public/assets/{jspdf.es.min-ChRx2mOQ.js → jspdf.es.min-Cw5WefMt.js} +3 -3
- package/dist/public/index.html +2 -2
- package/dist/{query-QNRDS74I.js → query-2H3YOPI2.js} +6 -5
- package/dist/reset-password-YVCZKZPC.js +1 -0
- package/dist/rewrite-database-BOA4QPUR.js +1 -0
- package/dist/{sample-SKLHBZBU.js → sample-ODUGGSFA.js} +6 -5
- package/dist/{search-4KMETZVX.js → search-IPE4ISFB.js} +7 -6
- package/dist/{semantic-6WKELH5V.js → semantic-K3MYXXJI.js} +4 -2
- package/dist/{semantic-6WKELH5V.js.map → semantic-K3MYXXJI.js.map} +1 -1
- package/dist/source-resolver-HZQLOODU.js +19 -0
- package/dist/source-resolver-HZQLOODU.js.map +1 -0
- package/dist/sync-dbt-72GVO75P.js +1 -0
- package/dist/{sync-warehouse-UWRNUXE7.js → sync-warehouse-TUNULDUY.js} +6 -5
- package/dist/{tables-V65QUGHK.js → tables-K5NAN2WK.js} +7 -6
- package/dist/templates/default/docs/yamchart-reference.md +42 -0
- package/dist/{test-UE5OWG3E.js → test-SRHVOXZB.js} +9 -7
- package/dist/{test-UE5OWG3E.js.map → test-SRHVOXZB.js.map} +1 -1
- package/dist/update-HWCJNQRP.js +1 -0
- package/package.json +8 -6
- package/dist/advisor-SC64RTZO.js.map +0 -1
- package/dist/chunk-NXQ6ZO3V.js.map +0 -1
- package/dist/chunk-RM6MNDVF.js.map +0 -1
- package/dist/chunk-S7YQXEKM.js.map +0 -1
- package/dist/chunk-UND73EOB.js +0 -449
- package/dist/chunk-UND73EOB.js.map +0 -1
- package/dist/connection-utils-C4FQGBW6.js +0 -19
- package/dist/dev-GWXHBBWB.js.map +0 -1
- package/dist/dist-MNXSMGV6.js.map +0 -1
- package/dist/dist-MX5K2ABB.js +0 -56
- package/dist/source-resolver-R7WBIL7M.js +0 -18
- /package/dist/{chunk-RMIDEBHD.js.map → chunk-S2CH4HUZ.js.map} +0 -0
- /package/dist/{chunk-H4L3FNLS.js.map → chunk-ZBCQNWVN.js.map} +0 -0
- /package/dist/{connection-utils-C4FQGBW6.js.map → connection-utils-FEUWER5I.js.map} +0 -0
- /package/dist/{describe-X75C2VDU.js.map → describe-MEP72B56.js.map} +0 -0
- /package/dist/{dist-JMLAZUL7.js.map → dist-5DQO6L2S.js.map} +0 -0
- /package/dist/{dist-MX5K2ABB.js.map → dist-PPAD6KOM.js.map} +0 -0
- /package/dist/{source-resolver-R7WBIL7M.js.map → dist-XNCED7JW.js.map} +0 -0
- /package/dist/{query-QNRDS74I.js.map → query-2H3YOPI2.js.map} +0 -0
- /package/dist/{sample-SKLHBZBU.js.map → sample-ODUGGSFA.js.map} +0 -0
- /package/dist/{search-4KMETZVX.js.map → search-IPE4ISFB.js.map} +0 -0
- /package/dist/{sync-warehouse-UWRNUXE7.js.map → sync-warehouse-TUNULDUY.js.map} +0 -0
- /package/dist/{tables-V65QUGHK.js.map → tables-K5NAN2WK.js.map} +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createRequire as __yamchartCreateRequire } from 'module'; if (!globalThis.require) globalThis.require = __yamchartCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
AdvisorAgent,
|
|
4
|
+
AnthropicProvider,
|
|
5
|
+
KNOWLEDGE_TOPICS,
|
|
6
|
+
OpenAICompatibleProvider,
|
|
7
|
+
SYSTEM_PROMPT,
|
|
8
|
+
TOOL_DEFINITIONS,
|
|
9
|
+
buildModelPath,
|
|
10
|
+
buildProvider,
|
|
11
|
+
buildSchemaYmlEntry,
|
|
12
|
+
createEmbedder,
|
|
13
|
+
createProviderForTask,
|
|
14
|
+
detectConventions,
|
|
15
|
+
formatModelSql,
|
|
16
|
+
getKnowledgeOverview,
|
|
17
|
+
listDbtModels,
|
|
18
|
+
loadKnowledge,
|
|
19
|
+
readDbtModel,
|
|
20
|
+
updateSchemaYml,
|
|
21
|
+
writeDbtModel
|
|
22
|
+
} from "./chunk-64CI3HSY.js";
|
|
23
|
+
import "./chunk-QUIDZO5G.js";
|
|
24
|
+
import "./chunk-UFDQ3C7Q.js";
|
|
25
|
+
import "./chunk-ZIY22VO7.js";
|
|
26
|
+
import "./chunk-7D4SUZUM.js";
|
|
27
|
+
export {
|
|
28
|
+
AdvisorAgent,
|
|
29
|
+
AnthropicProvider,
|
|
30
|
+
KNOWLEDGE_TOPICS,
|
|
31
|
+
OpenAICompatibleProvider,
|
|
32
|
+
SYSTEM_PROMPT,
|
|
33
|
+
TOOL_DEFINITIONS,
|
|
34
|
+
buildModelPath,
|
|
35
|
+
buildProvider,
|
|
36
|
+
buildSchemaYmlEntry,
|
|
37
|
+
createEmbedder,
|
|
38
|
+
createProviderForTask,
|
|
39
|
+
detectConventions,
|
|
40
|
+
formatModelSql,
|
|
41
|
+
getKnowledgeOverview,
|
|
42
|
+
listDbtModels,
|
|
43
|
+
loadKnowledge,
|
|
44
|
+
readDbtModel,
|
|
45
|
+
updateSchemaYml,
|
|
46
|
+
writeDbtModel
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=dist-5DQO6L2S.js.map
|
package/dist/dist-MIKFZKSD.js
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { createRequire as __yamchartCreateRequire } from 'module'; if (!globalThis.require) globalThis.require = __yamchartCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
AgentDefinitionSchema,
|
|
4
|
+
AiConfigSchema,
|
|
5
|
+
BlindspotKindSchema,
|
|
6
|
+
BlindspotSchema,
|
|
7
|
+
BlindspotStatusSchema,
|
|
8
|
+
ChartSchema,
|
|
9
|
+
ColumnProfileSchema,
|
|
10
|
+
ConnectionSchema,
|
|
11
|
+
CuratedDimensionSchema,
|
|
12
|
+
CuratedMetricSchema,
|
|
13
|
+
CuratedSourceSchema,
|
|
14
|
+
DashboardSchema,
|
|
15
|
+
DimensionSchema,
|
|
16
|
+
DimensionTypeSchema,
|
|
17
|
+
EventSchema,
|
|
18
|
+
EventsFileSchema,
|
|
19
|
+
HunchSampleSchema,
|
|
20
|
+
HunchSchema,
|
|
21
|
+
HunchStatusSchema,
|
|
22
|
+
KnowledgeDocSchema,
|
|
23
|
+
MeasureSchema,
|
|
24
|
+
MeasureTypeSchema,
|
|
25
|
+
ModelMetadataSchema,
|
|
26
|
+
ModelSchema,
|
|
27
|
+
NamedFilterSchema,
|
|
28
|
+
NewBlindspotSchema,
|
|
29
|
+
NewHunchSchema,
|
|
30
|
+
NewKnowledgeDocSchema,
|
|
31
|
+
ParameterSchema,
|
|
32
|
+
ProjectSchema,
|
|
33
|
+
ProviderConfigSchema,
|
|
34
|
+
RelationshipSchema,
|
|
35
|
+
ScheduleSchema,
|
|
36
|
+
SemanticConfigSchema,
|
|
37
|
+
SemanticDefinitionSchema,
|
|
38
|
+
SemanticEntitySchema,
|
|
39
|
+
SemanticFilterOperatorSchema,
|
|
40
|
+
SemanticFilterSchema,
|
|
41
|
+
SemanticModelSchema,
|
|
42
|
+
SemanticQuerySchema,
|
|
43
|
+
SourceProfileSchema,
|
|
44
|
+
SuggestedModelSchema,
|
|
45
|
+
TableProfileSchema,
|
|
46
|
+
VERSION,
|
|
47
|
+
deepMerge,
|
|
48
|
+
resolveProjectConfig
|
|
49
|
+
} from "./chunk-ZIY22VO7.js";
|
|
50
|
+
import "./chunk-7D4SUZUM.js";
|
|
51
|
+
export {
|
|
52
|
+
AgentDefinitionSchema,
|
|
53
|
+
AiConfigSchema,
|
|
54
|
+
BlindspotKindSchema,
|
|
55
|
+
BlindspotSchema,
|
|
56
|
+
BlindspotStatusSchema,
|
|
57
|
+
ChartSchema,
|
|
58
|
+
ColumnProfileSchema,
|
|
59
|
+
ConnectionSchema,
|
|
60
|
+
CuratedDimensionSchema,
|
|
61
|
+
CuratedMetricSchema,
|
|
62
|
+
CuratedSourceSchema,
|
|
63
|
+
DashboardSchema,
|
|
64
|
+
DimensionSchema,
|
|
65
|
+
DimensionTypeSchema,
|
|
66
|
+
EventSchema,
|
|
67
|
+
EventsFileSchema,
|
|
68
|
+
HunchSampleSchema,
|
|
69
|
+
HunchSchema,
|
|
70
|
+
HunchStatusSchema,
|
|
71
|
+
KnowledgeDocSchema,
|
|
72
|
+
MeasureSchema,
|
|
73
|
+
MeasureTypeSchema,
|
|
74
|
+
ModelMetadataSchema,
|
|
75
|
+
ModelSchema,
|
|
76
|
+
NamedFilterSchema,
|
|
77
|
+
NewBlindspotSchema,
|
|
78
|
+
NewHunchSchema,
|
|
79
|
+
NewKnowledgeDocSchema,
|
|
80
|
+
ParameterSchema,
|
|
81
|
+
ProjectSchema,
|
|
82
|
+
ProviderConfigSchema,
|
|
83
|
+
RelationshipSchema,
|
|
84
|
+
ScheduleSchema,
|
|
85
|
+
SemanticConfigSchema,
|
|
86
|
+
SemanticDefinitionSchema,
|
|
87
|
+
SemanticEntitySchema,
|
|
88
|
+
SemanticFilterOperatorSchema,
|
|
89
|
+
SemanticFilterSchema,
|
|
90
|
+
SemanticModelSchema,
|
|
91
|
+
SemanticQuerySchema,
|
|
92
|
+
SourceProfileSchema,
|
|
93
|
+
SuggestedModelSchema,
|
|
94
|
+
TableProfileSchema,
|
|
95
|
+
VERSION,
|
|
96
|
+
deepMerge,
|
|
97
|
+
resolveProjectConfig
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=dist-PPAD6KOM.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { createRequire as __yamchartCreateRequire } from 'module'; if (!globalThis.require) globalThis.require = __yamchartCreateRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
BigQueryConnector,
|
|
3
|
-
DATE_PRESETS,
|
|
4
4
|
DuckDBConnector,
|
|
5
5
|
MySQLConnector,
|
|
6
6
|
PostgresConnector,
|
|
@@ -11,18 +11,14 @@ import {
|
|
|
11
11
|
SqlList,
|
|
12
12
|
VERSION,
|
|
13
13
|
bigQueryTypeToString,
|
|
14
|
+
buildSourceProfile,
|
|
15
|
+
buildTableStatsSql,
|
|
16
|
+
buildTopValuesSql,
|
|
14
17
|
checkSchema,
|
|
15
|
-
computePreviousPeriod,
|
|
16
18
|
createTemplateContext,
|
|
17
|
-
expandCustomDateRange,
|
|
18
|
-
expandDatePreset,
|
|
19
|
-
expandRelativeDateRange,
|
|
20
19
|
expandThis,
|
|
21
20
|
extractTemplateVariables,
|
|
22
|
-
|
|
23
|
-
isCustomDateRange,
|
|
24
|
-
isDatePreset,
|
|
25
|
-
isRelativeDateRange,
|
|
21
|
+
isReadOnlySql,
|
|
26
22
|
parseModelMetadata,
|
|
27
23
|
renderTemplate,
|
|
28
24
|
resolveBigQueryAuth,
|
|
@@ -35,16 +31,30 @@ import {
|
|
|
35
31
|
runModel,
|
|
36
32
|
serializeDateValue,
|
|
37
33
|
templateHasVariable
|
|
38
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-QUIDZO5G.js";
|
|
39
35
|
import {
|
|
36
|
+
DATE_PRESETS,
|
|
40
37
|
SemanticModelBuilder,
|
|
41
38
|
SemanticQueryCompiler,
|
|
42
39
|
SemanticValidationError,
|
|
40
|
+
buildSemanticLayer,
|
|
43
41
|
classifyCatalogColumns,
|
|
44
42
|
classifyField,
|
|
43
|
+
compileMetricQuery,
|
|
44
|
+
computePreviousPeriod,
|
|
45
|
+
expandCustomDateRange,
|
|
46
|
+
expandDatePreset,
|
|
47
|
+
expandRelativeDateRange,
|
|
48
|
+
formatPeriodLabel,
|
|
49
|
+
getDialect,
|
|
45
50
|
inferAggregationType,
|
|
51
|
+
isCustomDateRange,
|
|
52
|
+
isDatePreset,
|
|
53
|
+
isRelativeDateRange,
|
|
54
|
+
loadSemanticDefinitions,
|
|
46
55
|
validateSemanticQuery
|
|
47
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-UFDQ3C7Q.js";
|
|
57
|
+
import "./chunk-ZIY22VO7.js";
|
|
48
58
|
import "./chunk-7D4SUZUM.js";
|
|
49
59
|
export {
|
|
50
60
|
BigQueryConnector,
|
|
@@ -62,9 +72,14 @@ export {
|
|
|
62
72
|
SqlList,
|
|
63
73
|
VERSION,
|
|
64
74
|
bigQueryTypeToString,
|
|
75
|
+
buildSemanticLayer,
|
|
76
|
+
buildSourceProfile,
|
|
77
|
+
buildTableStatsSql,
|
|
78
|
+
buildTopValuesSql,
|
|
65
79
|
checkSchema,
|
|
66
80
|
classifyCatalogColumns,
|
|
67
81
|
classifyField,
|
|
82
|
+
compileMetricQuery,
|
|
68
83
|
computePreviousPeriod,
|
|
69
84
|
createTemplateContext,
|
|
70
85
|
expandCustomDateRange,
|
|
@@ -73,10 +88,13 @@ export {
|
|
|
73
88
|
expandThis,
|
|
74
89
|
extractTemplateVariables,
|
|
75
90
|
formatPeriodLabel,
|
|
91
|
+
getDialect,
|
|
76
92
|
inferAggregationType,
|
|
77
93
|
isCustomDateRange,
|
|
78
94
|
isDatePreset,
|
|
95
|
+
isReadOnlySql,
|
|
79
96
|
isRelativeDateRange,
|
|
97
|
+
loadSemanticDefinitions,
|
|
80
98
|
parseModelMetadata,
|
|
81
99
|
renderTemplate,
|
|
82
100
|
resolveBigQueryAuth,
|
|
@@ -91,4 +109,4 @@ export {
|
|
|
91
109
|
templateHasVariable,
|
|
92
110
|
validateSemanticQuery
|
|
93
111
|
};
|
|
94
|
-
//# sourceMappingURL=dist-
|
|
112
|
+
//# sourceMappingURL=dist-XNCED7JW.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __yamchartCreateRequire } from 'module'; if (!globalThis.require) globalThis.require = __yamchartCreateRequire(import.meta.url);
|
|
2
3
|
import {
|
|
3
4
|
checkForUpdate
|
|
4
5
|
} from "./chunk-TZKNU5TD.js";
|
|
@@ -6,7 +7,7 @@ import {
|
|
|
6
7
|
findProjectRoot,
|
|
7
8
|
loadEnvFile,
|
|
8
9
|
validateProject
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-S2CH4HUZ.js";
|
|
10
11
|
import {
|
|
11
12
|
detail,
|
|
12
13
|
error,
|
|
@@ -17,9 +18,9 @@ import {
|
|
|
17
18
|
success,
|
|
18
19
|
warning
|
|
19
20
|
} from "./chunk-HJVVHYVN.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-QUIDZO5G.js";
|
|
22
|
+
import "./chunk-UFDQ3C7Q.js";
|
|
23
|
+
import "./chunk-ZIY22VO7.js";
|
|
23
24
|
import "./chunk-7D4SUZUM.js";
|
|
24
25
|
|
|
25
26
|
// src/index.ts
|
|
@@ -105,7 +106,7 @@ program.command("dev").description("Start development server with hot reload").a
|
|
|
105
106
|
process.exit(2);
|
|
106
107
|
}
|
|
107
108
|
const globalOpts = program.opts();
|
|
108
|
-
const { runDevServer } = await import("./dev-
|
|
109
|
+
const { runDevServer } = await import("./dev-H6SJZ5UA.js");
|
|
109
110
|
await runDevServer(projectDir, {
|
|
110
111
|
port: parseInt(options.port, 10),
|
|
111
112
|
apiOnly: options.apiOnly ?? false,
|
|
@@ -179,7 +180,7 @@ program.command("sync-dbt").description("Sync dbt project metadata into AI-reada
|
|
|
179
180
|
if (!options.targetDatabase) {
|
|
180
181
|
try {
|
|
181
182
|
const { readFile } = await import("fs/promises");
|
|
182
|
-
const { resolveConnection } = await import("./connection-utils-
|
|
183
|
+
const { resolveConnection } = await import("./connection-utils-FEUWER5I.js");
|
|
183
184
|
const { detectDatabaseMismatch } = await import("./rewrite-database-BOA4QPUR.js");
|
|
184
185
|
const catalogJsonStr = await readFile(join(projectDir, ".yamchart", "catalog.json"), "utf-8");
|
|
185
186
|
const catalogData = JSON.parse(catalogJsonStr);
|
|
@@ -233,7 +234,7 @@ program.command("test").description("Run model tests (@returns schema checks and
|
|
|
233
234
|
}
|
|
234
235
|
loadEnvFile(projectDir);
|
|
235
236
|
try {
|
|
236
|
-
const { testProject, formatTestOutput } = await import("./test-
|
|
237
|
+
const { testProject, formatTestOutput } = await import("./test-SRHVOXZB.js");
|
|
237
238
|
const result = await testProject(projectDir, model, {
|
|
238
239
|
connection: options.connection,
|
|
239
240
|
json: options.json
|
|
@@ -282,7 +283,7 @@ program.command("tables").description("List tables and views in the connected da
|
|
|
282
283
|
loadEnvFile(projectDir);
|
|
283
284
|
try {
|
|
284
285
|
if (options.compare) {
|
|
285
|
-
const { resolveTablesSource } = await import("./source-resolver-
|
|
286
|
+
const { resolveTablesSource } = await import("./source-resolver-HZQLOODU.js");
|
|
286
287
|
const { compareTables, formatCompareTables } = await import("./compare-RQFCEZIK.js");
|
|
287
288
|
let localResult;
|
|
288
289
|
try {
|
|
@@ -313,7 +314,7 @@ program.command("tables").description("List tables and views in the connected da
|
|
|
313
314
|
}
|
|
314
315
|
return;
|
|
315
316
|
}
|
|
316
|
-
const { listTables } = await import("./tables-
|
|
317
|
+
const { listTables } = await import("./tables-K5NAN2WK.js");
|
|
317
318
|
const result = await listTables(projectDir, {
|
|
318
319
|
...options,
|
|
319
320
|
source: options.source || "auto"
|
|
@@ -351,7 +352,7 @@ program.command("describe").description("Show columns and types for a table").ar
|
|
|
351
352
|
loadEnvFile(projectDir);
|
|
352
353
|
try {
|
|
353
354
|
if (options.compare) {
|
|
354
|
-
const { resolveDescribeSource } = await import("./source-resolver-
|
|
355
|
+
const { resolveDescribeSource } = await import("./source-resolver-HZQLOODU.js");
|
|
355
356
|
const { compareColumns, formatCompareColumns } = await import("./compare-RQFCEZIK.js");
|
|
356
357
|
let localResult;
|
|
357
358
|
try {
|
|
@@ -373,7 +374,7 @@ program.command("describe").description("Show columns and types for a table").ar
|
|
|
373
374
|
}
|
|
374
375
|
return;
|
|
375
376
|
}
|
|
376
|
-
const { describeTable } = await import("./describe-
|
|
377
|
+
const { describeTable } = await import("./describe-MEP72B56.js");
|
|
377
378
|
const result = await describeTable(projectDir, table, {
|
|
378
379
|
...options,
|
|
379
380
|
source: options.source || "auto"
|
|
@@ -412,8 +413,8 @@ program.command("query").description("Execute SQL against a connection").argumen
|
|
|
412
413
|
}
|
|
413
414
|
loadEnvFile(projectDir);
|
|
414
415
|
try {
|
|
415
|
-
const { executeQuery } = await import("./query-
|
|
416
|
-
const { formatTable, formatJSON } = await import("./connection-utils-
|
|
416
|
+
const { executeQuery } = await import("./query-2H3YOPI2.js");
|
|
417
|
+
const { formatTable, formatJSON } = await import("./connection-utils-FEUWER5I.js");
|
|
417
418
|
const limit = options.limit ? parseInt(options.limit, 10) : void 0;
|
|
418
419
|
const result = await executeQuery(projectDir, sql, {
|
|
419
420
|
connection: options.connection,
|
|
@@ -440,8 +441,8 @@ program.command("sample").description("Show sample rows from a table or dbt mode
|
|
|
440
441
|
}
|
|
441
442
|
loadEnvFile(projectDir);
|
|
442
443
|
try {
|
|
443
|
-
const { sampleTable } = await import("./sample-
|
|
444
|
-
const { formatTable, formatJSON } = await import("./connection-utils-
|
|
444
|
+
const { sampleTable } = await import("./sample-ODUGGSFA.js");
|
|
445
|
+
const { formatTable, formatJSON } = await import("./connection-utils-FEUWER5I.js");
|
|
445
446
|
const limit = options.limit ? parseInt(options.limit, 10) : void 0;
|
|
446
447
|
const result = await sampleTable(projectDir, table, {
|
|
447
448
|
connection: options.connection,
|
|
@@ -471,7 +472,7 @@ program.command("search").description("Search for tables and columns by keyword"
|
|
|
471
472
|
}
|
|
472
473
|
loadEnvFile(projectDir);
|
|
473
474
|
try {
|
|
474
|
-
const { searchDatabase } = await import("./search-
|
|
475
|
+
const { searchDatabase } = await import("./search-IPE4ISFB.js");
|
|
475
476
|
const result = await searchDatabase(projectDir, keyword, {
|
|
476
477
|
...options,
|
|
477
478
|
source: options.source || "auto"
|
|
@@ -525,7 +526,7 @@ catalogCmd.command("tables").description("List tables from cached catalog").opti
|
|
|
525
526
|
process.exit(2);
|
|
526
527
|
}
|
|
527
528
|
try {
|
|
528
|
-
const { listTables } = await import("./tables-
|
|
529
|
+
const { listTables } = await import("./tables-K5NAN2WK.js");
|
|
529
530
|
const result = await listTables(projectDir, {
|
|
530
531
|
source: "catalog",
|
|
531
532
|
schema: options.schema
|
|
@@ -567,7 +568,7 @@ catalogCmd.command("describe").description("Show cached columns and types for a
|
|
|
567
568
|
process.exit(2);
|
|
568
569
|
}
|
|
569
570
|
try {
|
|
570
|
-
const { describeTable } = await import("./describe-
|
|
571
|
+
const { describeTable } = await import("./describe-MEP72B56.js");
|
|
571
572
|
const result = await describeTable(projectDir, table, { source: "catalog" });
|
|
572
573
|
if (options.json) {
|
|
573
574
|
console.log(JSON.stringify(result.columns, null, 2));
|
|
@@ -609,7 +610,7 @@ catalogCmd.command("search").description("Search cached metadata for tables and
|
|
|
609
610
|
process.exit(2);
|
|
610
611
|
}
|
|
611
612
|
try {
|
|
612
|
-
const { searchDatabase } = await import("./search-
|
|
613
|
+
const { searchDatabase } = await import("./search-IPE4ISFB.js");
|
|
613
614
|
const result = await searchDatabase(projectDir, keyword, { source: "catalog" });
|
|
614
615
|
if (options.json) {
|
|
615
616
|
console.log(JSON.stringify(result.results, null, 2));
|
|
@@ -734,7 +735,7 @@ program.command("sync-warehouse").description("Sync warehouse table metadata int
|
|
|
734
735
|
}
|
|
735
736
|
loadEnvFile(projectDir);
|
|
736
737
|
try {
|
|
737
|
-
const { runSyncWarehouse } = await import("./sync-warehouse-
|
|
738
|
+
const { runSyncWarehouse } = await import("./sync-warehouse-TUNULDUY.js");
|
|
738
739
|
await runSyncWarehouse(projectDir, options);
|
|
739
740
|
} catch (err) {
|
|
740
741
|
error(err instanceof Error ? err.message : String(err));
|
|
@@ -785,7 +786,7 @@ program.command("advisor").description("AI-powered dbt model advisor \u2014 sugg
|
|
|
785
786
|
process.exit(2);
|
|
786
787
|
}
|
|
787
788
|
loadEnvFile(projectDir);
|
|
788
|
-
const { runAdvisor } = await import("./advisor-
|
|
789
|
+
const { runAdvisor } = await import("./advisor-5TJDNAY7.js");
|
|
789
790
|
await runAdvisor(projectDir, question, {
|
|
790
791
|
top: options.top ? parseInt(options.top, 10) : 5,
|
|
791
792
|
json: options.json,
|
|
@@ -806,7 +807,7 @@ var semanticCmd = program.command("semantic").description("Explore the semantic
|
|
|
806
807
|
const { readFile } = await import("fs/promises");
|
|
807
808
|
const catalogPath = join(projectDir, ".yamchart", "catalog.json");
|
|
808
809
|
const catalogJson = JSON.parse(await readFile(catalogPath, "utf-8"));
|
|
809
|
-
const { listSemanticEntities } = await import("./semantic-
|
|
810
|
+
const { listSemanticEntities } = await import("./semantic-K3MYXXJI.js");
|
|
810
811
|
const result = listSemanticEntities(catalogJson);
|
|
811
812
|
if (options.json) {
|
|
812
813
|
console.log(JSON.stringify(result.entities, null, 2));
|
|
@@ -853,7 +854,7 @@ semanticCmd.command("query").description("Run a structured query against the sem
|
|
|
853
854
|
const { readFile } = await import("fs/promises");
|
|
854
855
|
const catalogPath = join(projectDir, ".yamchart", "catalog.json");
|
|
855
856
|
const catalogJson = JSON.parse(await readFile(catalogPath, "utf-8"));
|
|
856
|
-
const { querySemanticEntity } = await import("./semantic-
|
|
857
|
+
const { querySemanticEntity } = await import("./semantic-K3MYXXJI.js");
|
|
857
858
|
const filters = (options.filter || []).map((f) => {
|
|
858
859
|
const eqIdx = f.indexOf("=");
|
|
859
860
|
if (eqIdx === -1) throw new Error(`Invalid filter format: "${f}". Use dimension=value`);
|
|
@@ -875,7 +876,7 @@ semanticCmd.command("query").description("Run a structured query against the sem
|
|
|
875
876
|
console.log(result.sql);
|
|
876
877
|
return;
|
|
877
878
|
}
|
|
878
|
-
const { resolveConnection, createConnector, formatTable, formatJSON } = await import("./connection-utils-
|
|
879
|
+
const { resolveConnection, createConnector, formatTable, formatJSON } = await import("./connection-utils-FEUWER5I.js");
|
|
879
880
|
const connection = await resolveConnection(projectDir, options.connection, program.opts().env);
|
|
880
881
|
const connector = createConnector(connection, projectDir);
|
|
881
882
|
const start = performance.now();
|
package/dist/init-SECXKD5G.js
CHANGED
package/dist/lineage-HYO4RKZT.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{v as S,j as e,Q as $,e as W}from"./index-jlfTO7f5.js";import{a as h}from"./echarts-DtOYsfLX.js";import{l as I}from"./data-3vtzSuAZ.js";function O({label:o,value:s}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsx("span",{style:{fontSize:"18px",fontWeight:600,color:"var(--yc-color-text)"},children:s}),e.jsx("span",{style:{fontSize:"12px",color:"var(--yc-color-text-secondary)"},children:o})]})}function M({source:o,onOpen:s}){return e.jsxs("div",{onClick:()=>s(o.name),style:{border:"1px solid var(--yc-color-border)",borderRadius:"8px",padding:"16px",background:"var(--yc-color-surface)",cursor:"pointer",display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontSize:"15px",fontWeight:600,color:"var(--yc-color-text)"},children:o.name}),e.jsx("span",{style:{fontSize:"11px",fontWeight:500,padding:"2px 8px",borderRadius:"9999px",background:"var(--yc-color-bg)",color:"var(--yc-color-text-secondary)",border:"1px solid var(--yc-color-border)",letterSpacing:"0.04em"},children:o.type.toUpperCase()})]}),e.jsxs("div",{style:{display:"flex",gap:"24px"},children:[e.jsx(O,{label:"Tables",value:o.counts.tables}),e.jsx(O,{label:"Hunches",value:o.counts.pendingHunches}),e.jsx(O,{label:"Blindspots",value:o.counts.openBlindspots})]}),e.jsx("button",{onClick:t=>{t.stopPropagation(),s(o.name)},style:{alignSelf:"flex-start",fontSize:"13px",fontWeight:500,color:"var(--yc-color-primary)",background:"none",border:"none",padding:0,cursor:"pointer"},children:"Open →"})]})}function K(){const{data:o,isLoading:s,error:t}=S({queryKey:["sources"],queryFn:I}),n=c=>{window.location.hash=`/data/sources/${encodeURIComponent(c)}`};return e.jsxs("div",{className:"p-6 w-full",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"var(--yc-color-text)"},children:"Data Sources"}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--yc-color-text-secondary)"},children:"Your connected data sources. Open one to browse its tables and add business context."}),t&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-danger)"},children:"Failed to load sources."}),s?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):!o||o.length===0?e.jsxs("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:["No connections configured. Add one in your project's ",e.jsx("code",{children:"connections/"})," directory."]}):e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px, 1fr))",gap:"16px"},children:o.map(c=>e.jsx(M,{source:c,onOpen:n},c.name))})]})}function J(o){const s=o.match(/event:\s*(\w+)\s*\ndata:\s*(\{[\s\S]*\})/);if(!s)return null;try{return{event:s[1],data:JSON.parse(s[2])}}catch{return null}}async function L(o,s="pending"){const t=new URLSearchParams({status:s,...o?{connection:o}:{}}),n=await fetch(`/api/hunches?${t}`);if(!n.ok)throw new Error("Failed to load hunches");return n.json()}async function U(o,s){return(await fetch(`/api/hunches/${o}/confirm`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{sql:s}:{})})).json()}async function V(o){return(await fetch(`/api/hunches/${o}/reject`,{method:"POST"})).json()}async function Q(o){return(await fetch(`/api/hunches/${o}/run`,{method:"POST"})).json()}async function G(o,s){const n=(await fetch("/api/learn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connection:o})})).body.getReader(),c=new TextDecoder;let d="";for(;;){const{done:p,value:a}=await n.read();if(p)break;d+=c.decode(a,{stream:!0});const l=d.split(`
|
|
2
|
+
|
|
3
|
+
`);d=l.pop()??"";for(const y of l){const u=J(y+`
|
|
4
|
+
|
|
5
|
+
`);u&&s(u)}}}async function R(o="open",s){const t=new URLSearchParams({status:o});return s&&t.set("connection",s),(await fetch(`/api/blindspots?${t}`)).json()}async function Y(o,s){return(await fetch(`/api/blindspots/${o}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:s})})).json()}async function D(o){return(await fetch(`/api/blindspots/${o}/dismiss`,{method:"POST"})).json()}async function X(o,s){const n=(await fetch("/api/blindspots/scan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connection:o})})).body.getReader(),c=new TextDecoder;let d="";for(;;){const{done:p,value:a}=await n.read();if(p)break;d+=c.decode(a,{stream:!0});const l=d.split(`
|
|
6
|
+
|
|
7
|
+
`);d=l.pop()??"";for(const y of l){const u=J(y+`
|
|
8
|
+
|
|
9
|
+
`);u&&s(u)}}}const x=$(o=>({learning:!1,hunches:[],setLearning:s=>o({learning:s}),setPhase:s=>o({phase:s}),setHunches:s=>o({hunches:s}),removeHunch:s=>o(t=>({hunches:t.hunches.filter(n=>n.id!==s)}))}));function z({hunch:o,onConfirm:s,onReject:t,onRun:n,running:c}){const[d,p]=h.useState(o.sql);return e.jsxs("div",{className:"rounded-lg p-4 mb-3",style:{border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)"},children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"font-medium",style:{color:"var(--yc-color-text)"},children:o.question}),o.confidence!=null&&e.jsxs("span",{className:"text-xs whitespace-nowrap",style:{color:"var(--yc-color-text-muted)"},children:[Math.round(o.confidence*100),"%"]})]}),o.rationale&&e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--yc-color-text-secondary)"},children:o.rationale}),e.jsx("textarea",{className:"w-full font-mono text-sm mt-2 p-2 rounded",style:{backgroundColor:"var(--yc-color-input-bg)",border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text)"},rows:3,value:d,onChange:a=>p(a.target.value),spellCheck:!1}),o.lastRunSample&&e.jsx("div",{className:"text-xs mt-2 overflow-auto max-h-40 rounded p-2",style:{backgroundColor:"var(--yc-color-input-bg)",color:"var(--yc-color-text-secondary)"},children:e.jsx("pre",{className:"font-mono",children:JSON.stringify(o.lastRunSample.rows.slice(0,5),null,2)})}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsx("button",{onClick:()=>s(o.id,d),className:"px-3 py-1 rounded text-white text-sm hover:opacity-90",style:{backgroundColor:"var(--yc-color-primary)"},children:"Confirm"}),e.jsx("button",{onClick:()=>n(o.id,d),disabled:c,className:"px-3 py-1 rounded text-sm hover:opacity-80 disabled:opacity-50",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text)"},children:c?"Running…":"Run"}),e.jsx("button",{onClick:()=>t(o.id),className:"px-3 py-1 rounded text-sm hover:opacity-80",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text-secondary)"},children:"Reject"})]})]})}function Z({connection:o,onComplete:s}){const t=x(l=>l.learning),n=x(l=>l.phase),c=x(l=>l.setLearning),d=x(l=>l.setPhase),p=l=>l==="profiling"?"Profiling the source…":l==="generating"?"Generating hunches…":l==="error"?"Something went wrong.":"Learning…",a=async()=>{c(!0),d("profiling");try{await G(o,l=>{if(l.event==="status")d(l.data.phase);else if(l.event==="done"){const y=l.data.hunches??[];s==null||s(y)}else l.event==="error"&&d("error")})}catch{d("error")}finally{c(!1)}};return e.jsxs("div",{className:"rounded-lg p-5 mb-4 flex items-center justify-between gap-4",style:{border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)"},children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",style:{color:"var(--yc-color-text)"},children:"Learn this source"}),e.jsxs("p",{className:"text-sm mt-1",style:{color:"var(--yc-color-text-secondary)"},children:["Profile ",e.jsx("span",{className:"font-mono",children:o})," and propose business questions you can confirm or edit."]}),t&&e.jsx("p",{className:"text-sm mt-2",style:{color:"var(--yc-color-primary)"},children:p(n)})]}),e.jsx("button",{onClick:a,disabled:t,className:"px-4 py-2 rounded text-white text-sm whitespace-nowrap hover:opacity-90 disabled:opacity-50",style:{backgroundColor:"var(--yc-color-primary)"},children:t?"Learning…":"Learn this source"})]})}function _({connection:o}={}){var r,g,A;const{data:s}=W(),t=((r=s==null?void 0:s.defaults)==null?void 0:r.connection)??((A=(g=s==null?void 0:s.connections)==null?void 0:g[0])==null?void 0:A.name)??"",n=o??t,[c,d]=h.useState("pending"),p=x(i=>i.hunches),a=x(i=>i.setHunches),l=x(i=>i.removeHunch),[y,u]=h.useState(null),{data:f,isLoading:P,error:H}=S({queryKey:["hunches",n,"pending"],queryFn:()=>L(n||void 0,"pending"),enabled:!!n&&c==="pending"}),{data:b,isLoading:T,error:q}=S({queryKey:["hunches",n,"confirmed"],queryFn:()=>L(n||void 0,"confirmed"),enabled:!!n&&c==="approved"});h.useEffect(()=>{f&&a(f)},[f,a]);const C=async(i,m)=>{l(i);try{await U(i,m)}catch{a(await L(n||void 0,"pending"))}},k=async i=>{l(i);try{await V(i)}catch{a(await L(n||void 0,"pending"))}},j=async i=>{u(i);try{const m=await Q(i);m.sample&&a(x.getState().hunches.map(N=>N.id===i?{...N,lastRunSample:m.sample}:N))}finally{u(null)}},B=i=>{const m=new Set(x.getState().hunches.map(F=>F.id)),N=i.filter(F=>!m.has(F.id));a([...N,...x.getState().hunches])},w=(i,m)=>e.jsx("button",{onClick:()=>d(i),style:{color:c===i?"var(--yc-color-primary)":"var(--yc-color-text-secondary)",borderBottom:c===i?"2px solid var(--yc-color-primary)":"2px solid transparent",paddingBottom:"6px",marginRight:"16px",background:"none",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:c===i?600:400},children:m});return e.jsxs("div",{className:"p-6 max-w-3xl mx-auto w-full",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"var(--yc-color-text)"},children:"Hunches"}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--yc-color-text-secondary)"},children:"Confirm, edit, run, or reject the questions learned from your source."}),e.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--yc-color-border)",marginBottom:"16px"},children:[w("pending","Pending"),w("approved","Approved")]}),c==="pending"&&e.jsxs(e.Fragment,{children:[n?e.jsx(Z,{connection:n,onComplete:B}):e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"No connection configured."}),H&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-danger)"},children:"Failed to load hunches."}),P?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):p.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"No pending hunches. Learn this source to generate some."}):p.map(i=>e.jsx(z,{hunch:i,onConfirm:C,onReject:k,onRun:j,running:y===i.id},i.id))]}),c==="approved"&&e.jsxs(e.Fragment,{children:[q&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-danger)"},children:"Failed to load approved hunches."}),T?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):!b||b.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"No approved hunches yet. Confirm some from the Pending tab."}):b.map(i=>e.jsx(z,{hunch:i,onConfirm:C,onReject:k,onRun:j,running:y===i.id},i.id))]})]})}const v=$(o=>({scanning:!1,blindspots:[],setScanning:s=>o({scanning:s}),setPhase:s=>o({phase:s}),setBlindspots:s=>o({blindspots:s}),removeBlindspot:s=>o(t=>({blindspots:t.blindspots.filter(n=>n.id!==s)}))}));function ee({blindspot:o,onAnswer:s,onDismiss:t,onAccept:n}){const[c,d]=h.useState(""),p=o.kind==="opportunity";return e.jsxs("div",{className:"rounded-lg p-4 mb-3",style:{border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text-secondary)"},children:p?"opportunity":"context"}),e.jsx("h3",{className:"font-medium",style:{color:"var(--yc-color-text)"},children:o.title})]}),e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--yc-color-text-secondary)"},children:o.detail}),p&&o.suggestedModel&&e.jsxs("div",{className:"text-xs mt-2 p-2 rounded",style:{backgroundColor:"var(--yc-color-input-bg)"},children:[e.jsx("div",{className:"font-mono",style:{color:"var(--yc-color-text)"},children:o.suggestedModel.name}),e.jsx("div",{style:{color:"var(--yc-color-text-secondary)"},children:o.suggestedModel.description}),o.suggestedModel.columns.length>0&&e.jsxs("div",{className:"mt-1",style:{color:"var(--yc-color-text-secondary)"},children:["cols: ",o.suggestedModel.columns.map(a=>a.name).join(", ")]})]}),!p&&e.jsx("textarea",{className:"w-full text-sm mt-2 p-2 rounded",style:{backgroundColor:"var(--yc-color-input-bg)",border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text)"},rows:2,placeholder:"Explain this in business terms…",value:c,onChange:a=>d(a.target.value)}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[p?e.jsx("button",{onClick:()=>n(o.id),className:"px-3 py-1 rounded text-white text-sm hover:opacity-90",style:{backgroundColor:"var(--yc-color-primary)"},children:"Accept"}):e.jsx("button",{onClick:()=>s(o.id,c),className:"px-3 py-1 rounded text-white text-sm hover:opacity-90",style:{backgroundColor:"var(--yc-color-primary)"},children:"Save"}),e.jsx("button",{onClick:()=>t(o.id),className:"px-3 py-1 rounded text-sm hover:opacity-80",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text-secondary)"},children:"Dismiss"})]})]})}function oe({connection:o}={}){var j,B,w;const{data:s}=W(),t=((j=s==null?void 0:s.defaults)==null?void 0:j.connection)??((w=(B=s==null?void 0:s.connections)==null?void 0:B[0])==null?void 0:w.name)??"",n=o??t,c=v(r=>r.blindspots),d=v(r=>r.setBlindspots),p=v(r=>r.removeBlindspot),a=v(r=>r.scanning),l=v(r=>r.phase),y=v(r=>r.setScanning),u=v(r=>r.setPhase),{data:f,isLoading:P,error:H}=S({queryKey:["blindspots",n,"open"],queryFn:()=>R("open",n||void 0),enabled:!!n});h.useEffect(()=>{f&&d(f)},[f,d]);const b=async(r,g)=>{if(g.trim()){p(r);try{await Y(r,g)}catch{d(await R("open",n||void 0))}}},T=async r=>{p(r);try{await D(r)}catch{d(await R("open",n||void 0))}},q=async r=>{p(r);try{await D(r),alert("Sent to the dbt advisor — coming soon")}catch{d(await R("open",n||void 0))}},C=async()=>{if(n){y(!0),u("scanning");try{await X(n,r=>{if(r.event==="status")u(r.data.phase);else if(r.event==="done"){const g=r.data.blindspots??[];d(g)}else r.event==="error"&&u("error")})}catch{u("error")}finally{y(!1)}}},k=r=>r==="scanning"?"Scanning the source…":r==="error"?"Something went wrong.":"Scanning…";return e.jsxs("div",{className:"p-6 max-w-3xl mx-auto w-full",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"var(--yc-color-text)"},children:"Blindspots"}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--yc-color-text-secondary)"},children:"Where the system lacks business context, plus useful marts it thinks are missing."}),e.jsxs("div",{className:"rounded-lg p-5 mb-4 flex items-center justify-between gap-4",style:{border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)"},children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",style:{color:"var(--yc-color-text)"},children:"Scan for blindspots"}),e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--yc-color-text-secondary)"},children:n?e.jsxs(e.Fragment,{children:["Audit ",e.jsx("span",{className:"font-mono",children:n})," for ambiguities and missing marts."]}):"No connection configured."}),a&&e.jsx("p",{className:"text-sm mt-2",style:{color:"var(--yc-color-primary)"},children:k(l)})]}),e.jsx("button",{onClick:C,disabled:a||!n,className:"px-4 py-2 rounded text-white text-sm whitespace-nowrap hover:opacity-90 disabled:opacity-50",style:{backgroundColor:"var(--yc-color-primary)"},children:a?"Scanning…":"Scan for blindspots"})]}),H&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-danger)"},children:"Failed to load blindspots."}),P?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):c.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"No open blindspots. Scan this source to find some."}):c.map(r=>e.jsx(ee,{blindspot:r,onAnswer:b,onDismiss:T,onAccept:q},r.id))]})}const se=[{id:"sources",label:"Data Sources"},{id:"hunches",label:"Hunches"},{id:"blindspots",label:"Blindspots"}];function E({value:o,onChange:s}){const{data:t}=S({queryKey:["sources"],queryFn:I});return e.jsxs("div",{style:{padding:"12px 24px 0",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("label",{htmlFor:"source-selector",style:{fontSize:"13px",color:"var(--yc-color-text-secondary)",whiteSpace:"nowrap"},children:"Source:"}),e.jsxs("select",{id:"source-selector",value:o,onChange:n=>s(n.target.value),style:{fontSize:"13px",padding:"4px 8px",borderRadius:"6px",border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)",color:"var(--yc-color-text)",cursor:"pointer"},children:[e.jsx("option",{value:"",children:"All sources"}),t==null?void 0:t.map(n=>e.jsx("option",{value:n.name,children:n.name},n.name))]})]})}function ce({tab:o,onTabChange:s}){const[t,n]=h.useState(""),[c,d]=h.useState(""),p=(a,l)=>e.jsx("button",{onClick:()=>s(a),style:{color:o===a?"var(--yc-color-primary)":"var(--yc-color-text-secondary)",borderBottom:o===a?"2px solid var(--yc-color-primary)":"2px solid transparent",paddingBottom:"6px",marginRight:"16px",background:"none",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:o===a?600:400},children:l},a);return e.jsxs("div",{className:"flex flex-col h-full w-full",children:[e.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--yc-color-border)",padding:"16px 24px 0"},children:se.map(a=>p(a.id,a.label))}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o==="sources"&&e.jsx(K,{}),o==="hunches"&&e.jsxs(e.Fragment,{children:[e.jsx(E,{value:t,onChange:n}),e.jsx(_,{connection:t||void 0})]}),o==="blindspots"&&e.jsxs(e.Fragment,{children:[e.jsx(E,{value:c,onChange:d}),e.jsx(oe,{connection:c||void 0})]})]})]})}export{ce as DataView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as xe,u as he,v as me,e as be,w as $,j as t,x as E,E as ce,M as fe,y as ve,z as je,I as Ce,a as S}from"./index-
|
|
1
|
+
import{t as xe,u as he,v as me,e as be,w as $,j as t,x as E,E as ce,M as fe,y as ve,z as je,I as Ce,a as S}from"./index-jlfTO7f5.js";import{a as s}from"./echarts-DtOYsfLX.js";const ge=`
|
|
2
2
|
.rdp-root {
|
|
3
3
|
--rdp-accent-color: var(--yc-color-primary, #2563eb);
|
|
4
4
|
--rdp-accent-background-color: color-mix(in srgb, var(--yc-color-primary, #2563eb) 15%, transparent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,i as k,J as E,K as B,v as M,N as W,O as $,a as D}from"./index-BgzSjgIu.js";import{a}from"./echarts-DtOYsfLX.js";const T=["What data do I have?","Show me recent trends","What are the top items by revenue?","Compare this month to last month"];function P({summary:t,onPromptClick:i}){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-6 py-12 gap-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",style:{color:"var(--yc-color-text)"},children:"Data Explorer"}),e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Ask questions about your data in plain English"})]}),t&&(t.tableCount>0||t.modelCount>0)&&e.jsxs("div",{className:"rounded-xl px-5 py-4 w-full max-w-md flex flex-col gap-3",style:{background:"var(--yc-color-surface)",border:"1px solid var(--yc-color-border)"},children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--yc-color-text-secondary)"},children:"Connected data"}),e.jsxs("div",{className:"flex gap-6",children:[t.tableCount>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xl font-bold",style:{color:"var(--yc-color-text)"},children:t.tableCount}),e.jsx("span",{className:"text-xs ml-1",style:{color:"var(--yc-color-text-secondary)"},children:t.tableCount===1?"table":"tables"})]}),t.modelCount>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xl font-bold",style:{color:"var(--yc-color-text)"},children:t.modelCount}),e.jsx("span",{className:"text-xs ml-1",style:{color:"var(--yc-color-text-secondary)"},children:t.modelCount===1?"model":"models"})]})]}),t.connections.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.connections.map(l=>e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"var(--yc-color-bg)",color:"var(--yc-color-text-secondary)",border:"1px solid var(--yc-color-border)"},children:l.name},l.name))})]}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center max-w-lg",children:T.map(l=>e.jsx("button",{onClick:()=>i(l),className:"text-sm px-3 py-1.5 rounded-full transition-opacity hover:opacity-80",style:{background:"var(--yc-color-surface)",color:"var(--yc-color-text)",border:"1px solid var(--yc-color-border)"},children:l},l))})]})}function R({summary:t,onTableClick:i}){const[l,x]=a.useState(new Set),[n,h]=a.useState(new Set),v=s=>{x(o=>{const c=new Set(o);return c.has(s)?c.delete(s):c.add(s),c})},f=s=>{h(o=>{const c=new Set(o);return c.has(s)?c.delete(s):c.add(s),c})},y=((t==null?void 0:t.connections)??[]).map(s=>({connection:s.name,tables:((t==null?void 0:t.tables)??[]).filter(o=>o.connection===s.name)})),u=(t==null?void 0:t.models)??[];return e.jsxs("div",{className:"w-64 flex-shrink-0 flex flex-col h-full overflow-y-auto",style:{borderRight:"1px solid var(--yc-color-border)",background:"var(--yc-color-surface)"},children:[e.jsx("div",{className:"px-3 py-2 flex items-center",style:{borderBottom:"1px solid var(--yc-color-border)"},children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--yc-color-text-secondary)"},children:"Catalog"})}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-2",children:[y.map(s=>e.jsxs("div",{children:[e.jsxs("button",{className:"w-full flex items-center gap-1.5 px-3 py-1.5 hover:opacity-80 text-left",onClick:()=>v(s.connection),children:[e.jsx(g,{expanded:l.has(s.connection)}),e.jsx(I,{}),e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"var(--yc-color-text)"},children:s.connection}),e.jsx("span",{className:"ml-auto text-xs",style:{color:"var(--yc-color-text-secondary)"},children:s.tables.length})]}),l.has(s.connection)&&e.jsx("div",{children:s.tables.map(o=>{const c=`${s.connection}:${o.name}`,m=n.has(c);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1 pl-6 pr-2 py-1 group",children:[e.jsxs("button",{className:"flex items-center gap-1 flex-1 min-w-0 hover:opacity-80 text-left",onClick:()=>f(c),children:[e.jsx(g,{expanded:m}),e.jsx(A,{}),e.jsx("span",{className:"text-xs truncate",style:{color:"var(--yc-color-text)"},children:o.schema?`${o.schema}.${o.name}`:o.name})]}),e.jsx("button",{className:"opacity-0 group-hover:opacity-100 text-xs px-1.5 py-0.5 rounded transition-opacity flex-shrink-0",style:{background:"var(--yc-color-primary)",color:"#fff"},onClick:()=>i(o.schema?`${o.schema}.${o.name}`:o.name),title:`Ask about ${o.name}`,children:"Ask"})]}),m&&o.columns.length>0&&e.jsx("div",{className:"pl-12 pb-1",children:o.columns.map(d=>e.jsxs("div",{className:"flex items-center gap-1.5 py-0.5 pr-2",children:[e.jsx("span",{className:"text-xs truncate",style:{color:"var(--yc-color-text)"},children:d.name}),d.type&&e.jsx("span",{className:"text-xs ml-auto flex-shrink-0",style:{color:"var(--yc-color-text-secondary)"},children:d.type})]},d.name))})]},c)})})]},s.connection)),u.length>0&&e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-3 py-1.5",style:{borderTop:"1px solid var(--yc-color-border)"},children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--yc-color-text-secondary)"},children:"Models"})}),u.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5 pl-3 pr-2 py-1.5 group",children:[e.jsx(O,{}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs truncate",style:{color:"var(--yc-color-text)"},children:s.name}),s.description&&e.jsx("p",{className:"text-xs truncate",style:{color:"var(--yc-color-text-secondary)"},children:s.description})]}),e.jsx("button",{className:"opacity-0 group-hover:opacity-100 text-xs px-1.5 py-0.5 rounded transition-opacity flex-shrink-0",style:{background:"var(--yc-color-primary)",color:"#fff"},onClick:()=>i(s.name),title:`Ask about ${s.name}`,children:"Ask"})]},s.name))]}),!t||y.length===0&&u.length===0?e.jsx("div",{className:"px-3 py-4 text-center",children:e.jsxs("p",{className:"text-xs",style:{color:"var(--yc-color-text-secondary)"},children:["No catalog data available. Run ",e.jsx("code",{className:"font-mono",children:"yamchart sync-warehouse"})," to populate."]})}):null]})]})}function g({expanded:t}){return e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-text-secondary)",transform:t?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s",flexShrink:0},children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}function I(){return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-text-secondary)",flexShrink:0},children:[e.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),e.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]})}function A(){return e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-text-secondary)",flexShrink:0},children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M3 9h18M3 15h18M9 3v18"})]})}function O(){return e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-text-secondary)",flexShrink:0},children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function q(){const t=k(n=>n.savedCharts),[i,l]=a.useState(!1),x=a.useRef(null);return a.useEffect(()=>{if(!i)return;function n(h){x.current&&!x.current.contains(h.target)&&l(!1)}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[i]),t.length===0?null:e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{onClick:()=>l(n=>!n),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-opacity hover:opacity-80",style:{background:"var(--yc-color-surface)",border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text)"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7"})]}),e.jsxs("span",{children:[t.length," saved ",t.length===1?"chart":"charts"]}),e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full text-xs font-bold text-white",style:{background:"var(--yc-color-primary)"},children:t.length})]}),i&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 rounded-lg shadow-lg z-50 py-1",style:{background:"var(--yc-color-bg)",border:"1px solid var(--yc-color-border)"},children:[e.jsx("p",{className:"px-3 py-1.5 text-xs font-semibold uppercase tracking-wide",style:{color:"var(--yc-color-text-secondary)"},children:"Saved charts"}),t.map(n=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-primary)",flexShrink:0},children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),e.jsx("span",{className:"text-sm truncate",style:{color:"var(--yc-color-text)"},children:n})]},n))]})]})}function V(){const t=E(),{messages:i,isStreaming:l,savedCharts:x,openPanel:n,setPanelMode:h,snapshotExploreHistory:v,clearConversation:f}=k(),[y,u]=a.useState(!0),[s,o]=a.useState(void 0),c=a.useRef(null);a.useEffect(()=>(h("explore"),n({type:"explore"}),()=>{h("panel")}),[h,n]),a.useEffect(()=>{var r;(r=c.current)==null||r.scrollIntoView({behavior:"smooth"})},[i]);const m=a.useCallback((r,p,S)=>{v(p),h("panel");const L=r==="chart"?"charts":"dashboards";window.location.hash=`/${L}/${encodeURIComponent(p)}${S?"?edit=true":""}`,n({type:r==="chart"?"chart":"dashboard",name:p})},[v,h,n]),{sendMessage:d}=B(m),{data:j}=M({queryKey:["catalog-summary"],queryFn:()=>D.getCatalogSummary(),staleTime:6e4,retry:!1}),b=a.useCallback(r=>{o(`Tell me about the ${r} table`)},[]),w=a.useCallback(r=>{d(r)},[d]),N=a.useCallback(r=>{d(r),o(void 0)},[d]),C=a.useCallback(()=>{const r=x.join(", ");d(`Build a dashboard using these charts: ${r}. Arrange them in a logical layout.`)},[x,d]);return t==="sm"?e.jsx("div",{className:"flex items-center justify-center h-screen px-6",style:{background:"var(--yc-color-bg)"},children:e.jsxs("div",{className:"text-center max-w-xs",children:[e.jsx("p",{className:"text-lg font-semibold mb-2",style:{color:"var(--yc-color-text)"},children:"Desktop required"}),e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Data Explorer is designed for larger screens. Please open it on a desktop or laptop."})]})}):e.jsxs("div",{className:"flex h-screen overflow-hidden",style:{background:"var(--yc-color-bg)"},children:[y&&e.jsx(R,{summary:j??null,onTableClick:b}),e.jsxs("div",{className:"flex-1 flex flex-col h-full min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 flex-shrink-0",style:{borderBottom:"1px solid var(--yc-color-border)"},children:[e.jsxs("a",{href:"#/",className:"flex items-center gap-1.5 text-sm hover:opacity-80",style:{color:"var(--yc-color-text-secondary)"},onClick:r=>{r.preventDefault(),window.location.hash="/"},children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Dashboards"]}),e.jsx("div",{className:"w-px h-4 mx-1",style:{background:"var(--yc-color-border)"}}),e.jsx("button",{className:"p-1.5 rounded hover:opacity-80",style:{color:"var(--yc-color-text-secondary)"},onClick:()=>u(r=>!r),title:y?"Hide catalog":"Show catalog",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"})]})}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--yc-color-text)"},children:"Data Explorer"}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsx(q,{}),e.jsxs("button",{disabled:x.length===0||l,onClick:C,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-opacity disabled:opacity-40",style:{background:"var(--yc-color-primary)",color:"#fff"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7"})]}),"Build Dashboard"]}),i.length>0&&e.jsx("button",{className:"p-1.5 rounded hover:opacity-80",style:{color:"var(--yc-color-text-secondary)"},onClick:f,title:"New conversation",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4 flex flex-col gap-3 min-h-0",children:i.length===0?e.jsx(P,{summary:j??null,onPromptClick:w}):e.jsxs(e.Fragment,{children:[i.map((r,p)=>e.jsx(W,{message:r,isStreaming:l&&p===i.length-1&&r.role==="assistant",onSendMessage:d},p)),e.jsx("div",{ref:c})]})}),e.jsx("div",{className:"px-6 py-3 flex-shrink-0",style:{borderTop:"1px solid var(--yc-color-border)"},children:e.jsx($,{onSend:N,placeholder:"Ask about your data...",disabled:l,initialValue:s})})]})]})}export{V as default};
|
|
1
|
+
import{j as e,i as k,J as E,K as B,v as M,N as W,O as $,a as D}from"./index-jlfTO7f5.js";import{a}from"./echarts-DtOYsfLX.js";const T=["What data do I have?","Show me recent trends","What are the top items by revenue?","Compare this month to last month"];function P({summary:t,onPromptClick:i}){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-6 py-12 gap-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",style:{color:"var(--yc-color-text)"},children:"Data Explorer"}),e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Ask questions about your data in plain English"})]}),t&&(t.tableCount>0||t.modelCount>0)&&e.jsxs("div",{className:"rounded-xl px-5 py-4 w-full max-w-md flex flex-col gap-3",style:{background:"var(--yc-color-surface)",border:"1px solid var(--yc-color-border)"},children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--yc-color-text-secondary)"},children:"Connected data"}),e.jsxs("div",{className:"flex gap-6",children:[t.tableCount>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xl font-bold",style:{color:"var(--yc-color-text)"},children:t.tableCount}),e.jsx("span",{className:"text-xs ml-1",style:{color:"var(--yc-color-text-secondary)"},children:t.tableCount===1?"table":"tables"})]}),t.modelCount>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xl font-bold",style:{color:"var(--yc-color-text)"},children:t.modelCount}),e.jsx("span",{className:"text-xs ml-1",style:{color:"var(--yc-color-text-secondary)"},children:t.modelCount===1?"model":"models"})]})]}),t.connections.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.connections.map(l=>e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"var(--yc-color-bg)",color:"var(--yc-color-text-secondary)",border:"1px solid var(--yc-color-border)"},children:l.name},l.name))})]}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center max-w-lg",children:T.map(l=>e.jsx("button",{onClick:()=>i(l),className:"text-sm px-3 py-1.5 rounded-full transition-opacity hover:opacity-80",style:{background:"var(--yc-color-surface)",color:"var(--yc-color-text)",border:"1px solid var(--yc-color-border)"},children:l},l))})]})}function R({summary:t,onTableClick:i}){const[l,x]=a.useState(new Set),[n,h]=a.useState(new Set),v=s=>{x(o=>{const c=new Set(o);return c.has(s)?c.delete(s):c.add(s),c})},f=s=>{h(o=>{const c=new Set(o);return c.has(s)?c.delete(s):c.add(s),c})},y=((t==null?void 0:t.connections)??[]).map(s=>({connection:s.name,tables:((t==null?void 0:t.tables)??[]).filter(o=>o.connection===s.name)})),u=(t==null?void 0:t.models)??[];return e.jsxs("div",{className:"w-64 flex-shrink-0 flex flex-col h-full overflow-y-auto",style:{borderRight:"1px solid var(--yc-color-border)",background:"var(--yc-color-surface)"},children:[e.jsx("div",{className:"px-3 py-2 flex items-center",style:{borderBottom:"1px solid var(--yc-color-border)"},children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--yc-color-text-secondary)"},children:"Catalog"})}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-2",children:[y.map(s=>e.jsxs("div",{children:[e.jsxs("button",{className:"w-full flex items-center gap-1.5 px-3 py-1.5 hover:opacity-80 text-left",onClick:()=>v(s.connection),children:[e.jsx(g,{expanded:l.has(s.connection)}),e.jsx(I,{}),e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"var(--yc-color-text)"},children:s.connection}),e.jsx("span",{className:"ml-auto text-xs",style:{color:"var(--yc-color-text-secondary)"},children:s.tables.length})]}),l.has(s.connection)&&e.jsx("div",{children:s.tables.map(o=>{const c=`${s.connection}:${o.name}`,m=n.has(c);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1 pl-6 pr-2 py-1 group",children:[e.jsxs("button",{className:"flex items-center gap-1 flex-1 min-w-0 hover:opacity-80 text-left",onClick:()=>f(c),children:[e.jsx(g,{expanded:m}),e.jsx(A,{}),e.jsx("span",{className:"text-xs truncate",style:{color:"var(--yc-color-text)"},children:o.schema?`${o.schema}.${o.name}`:o.name})]}),e.jsx("button",{className:"opacity-0 group-hover:opacity-100 text-xs px-1.5 py-0.5 rounded transition-opacity flex-shrink-0",style:{background:"var(--yc-color-primary)",color:"#fff"},onClick:()=>i(o.schema?`${o.schema}.${o.name}`:o.name),title:`Ask about ${o.name}`,children:"Ask"})]}),m&&o.columns.length>0&&e.jsx("div",{className:"pl-12 pb-1",children:o.columns.map(d=>e.jsxs("div",{className:"flex items-center gap-1.5 py-0.5 pr-2",children:[e.jsx("span",{className:"text-xs truncate",style:{color:"var(--yc-color-text)"},children:d.name}),d.type&&e.jsx("span",{className:"text-xs ml-auto flex-shrink-0",style:{color:"var(--yc-color-text-secondary)"},children:d.type})]},d.name))})]},c)})})]},s.connection)),u.length>0&&e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-3 py-1.5",style:{borderTop:"1px solid var(--yc-color-border)"},children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--yc-color-text-secondary)"},children:"Models"})}),u.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5 pl-3 pr-2 py-1.5 group",children:[e.jsx(O,{}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs truncate",style:{color:"var(--yc-color-text)"},children:s.name}),s.description&&e.jsx("p",{className:"text-xs truncate",style:{color:"var(--yc-color-text-secondary)"},children:s.description})]}),e.jsx("button",{className:"opacity-0 group-hover:opacity-100 text-xs px-1.5 py-0.5 rounded transition-opacity flex-shrink-0",style:{background:"var(--yc-color-primary)",color:"#fff"},onClick:()=>i(s.name),title:`Ask about ${s.name}`,children:"Ask"})]},s.name))]}),!t||y.length===0&&u.length===0?e.jsx("div",{className:"px-3 py-4 text-center",children:e.jsxs("p",{className:"text-xs",style:{color:"var(--yc-color-text-secondary)"},children:["No catalog data available. Run ",e.jsx("code",{className:"font-mono",children:"yamchart sync-warehouse"})," to populate."]})}):null]})]})}function g({expanded:t}){return e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-text-secondary)",transform:t?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s",flexShrink:0},children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}function I(){return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-text-secondary)",flexShrink:0},children:[e.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),e.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]})}function A(){return e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-text-secondary)",flexShrink:0},children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M3 9h18M3 15h18M9 3v18"})]})}function O(){return e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-text-secondary)",flexShrink:0},children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function q(){const t=k(n=>n.savedCharts),[i,l]=a.useState(!1),x=a.useRef(null);return a.useEffect(()=>{if(!i)return;function n(h){x.current&&!x.current.contains(h.target)&&l(!1)}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[i]),t.length===0?null:e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{onClick:()=>l(n=>!n),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-opacity hover:opacity-80",style:{background:"var(--yc-color-surface)",border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text)"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7"})]}),e.jsxs("span",{children:[t.length," saved ",t.length===1?"chart":"charts"]}),e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full text-xs font-bold text-white",style:{background:"var(--yc-color-primary)"},children:t.length})]}),i&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 rounded-lg shadow-lg z-50 py-1",style:{background:"var(--yc-color-bg)",border:"1px solid var(--yc-color-border)"},children:[e.jsx("p",{className:"px-3 py-1.5 text-xs font-semibold uppercase tracking-wide",style:{color:"var(--yc-color-text-secondary)"},children:"Saved charts"}),t.map(n=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--yc-color-primary)",flexShrink:0},children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),e.jsx("span",{className:"text-sm truncate",style:{color:"var(--yc-color-text)"},children:n})]},n))]})]})}function V(){const t=E(),{messages:i,isStreaming:l,savedCharts:x,openPanel:n,setPanelMode:h,snapshotExploreHistory:v,clearConversation:f}=k(),[y,u]=a.useState(!0),[s,o]=a.useState(void 0),c=a.useRef(null);a.useEffect(()=>(h("explore"),n({type:"explore"}),()=>{h("panel")}),[h,n]),a.useEffect(()=>{var r;(r=c.current)==null||r.scrollIntoView({behavior:"smooth"})},[i]);const m=a.useCallback((r,p,S)=>{v(p),h("panel");const L=r==="chart"?"charts":"dashboards";window.location.hash=`/${L}/${encodeURIComponent(p)}${S?"?edit=true":""}`,n({type:r==="chart"?"chart":"dashboard",name:p})},[v,h,n]),{sendMessage:d}=B(m),{data:j}=M({queryKey:["catalog-summary"],queryFn:()=>D.getCatalogSummary(),staleTime:6e4,retry:!1}),b=a.useCallback(r=>{o(`Tell me about the ${r} table`)},[]),w=a.useCallback(r=>{d(r)},[d]),N=a.useCallback(r=>{d(r),o(void 0)},[d]),C=a.useCallback(()=>{const r=x.join(", ");d(`Build a dashboard using these charts: ${r}. Arrange them in a logical layout.`)},[x,d]);return t==="sm"?e.jsx("div",{className:"flex items-center justify-center h-screen px-6",style:{background:"var(--yc-color-bg)"},children:e.jsxs("div",{className:"text-center max-w-xs",children:[e.jsx("p",{className:"text-lg font-semibold mb-2",style:{color:"var(--yc-color-text)"},children:"Desktop required"}),e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Data Explorer is designed for larger screens. Please open it on a desktop or laptop."})]})}):e.jsxs("div",{className:"flex h-screen overflow-hidden",style:{background:"var(--yc-color-bg)"},children:[y&&e.jsx(R,{summary:j??null,onTableClick:b}),e.jsxs("div",{className:"flex-1 flex flex-col h-full min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 flex-shrink-0",style:{borderBottom:"1px solid var(--yc-color-border)"},children:[e.jsxs("a",{href:"#/",className:"flex items-center gap-1.5 text-sm hover:opacity-80",style:{color:"var(--yc-color-text-secondary)"},onClick:r=>{r.preventDefault(),window.location.hash="/"},children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Dashboards"]}),e.jsx("div",{className:"w-px h-4 mx-1",style:{background:"var(--yc-color-border)"}}),e.jsx("button",{className:"p-1.5 rounded hover:opacity-80",style:{color:"var(--yc-color-text-secondary)"},onClick:()=>u(r=>!r),title:y?"Hide catalog":"Show catalog",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"})]})}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--yc-color-text)"},children:"Data Explorer"}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsx(q,{}),e.jsxs("button",{disabled:x.length===0||l,onClick:C,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-opacity disabled:opacity-40",style:{background:"var(--yc-color-primary)",color:"#fff"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7"})]}),"Build Dashboard"]}),i.length>0&&e.jsx("button",{className:"p-1.5 rounded hover:opacity-80",style:{color:"var(--yc-color-text-secondary)"},onClick:f,title:"New conversation",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4 flex flex-col gap-3 min-h-0",children:i.length===0?e.jsx(P,{summary:j??null,onPromptClick:w}):e.jsxs(e.Fragment,{children:[i.map((r,p)=>e.jsx(W,{message:r,isStreaming:l&&p===i.length-1&&r.role==="assistant",onSendMessage:d},p)),e.jsx("div",{ref:c})]})}),e.jsx("div",{className:"px-6 py-3 flex-shrink-0",style:{borderTop:"1px solid var(--yc-color-border)"},children:e.jsx($,{onSend:N,placeholder:"Ask about your data...",disabled:l,initialValue:s})})]})]})}export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u,j as e,A as p}from"./index-
|
|
1
|
+
import{u,j as e,A as p}from"./index-jlfTO7f5.js";import{a as r}from"./echarts-DtOYsfLX.js";const f="",g={google:"Google",microsoft:"Microsoft",oidc:"SSO"};function j(){const m=u(o=>o.login),l=u(o=>o.providers),[a,x]=r.useState(""),[t,b]=r.useState(""),[c,s]=r.useState(""),[n,d]=r.useState(!1);r.useEffect(()=>{window.location.hash.includes("error=account_conflict")&&(s("An account with this email already exists. Please sign in with your password."),window.location.hash="#/")},[]);const y=async o=>{o.preventDefault(),s(""),d(!0);try{await m(a,t)}catch(i){i instanceof p?s(i.message):s("An unexpected error occurred")}finally{d(!1)}},h=o=>{window.location.href=`${f}/api/auth/sso/${o}`};return e.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{backgroundColor:"var(--yc-color-background)"},children:e.jsxs("div",{className:"rounded-lg shadow-sm p-8 w-full max-w-md",style:{backgroundColor:"var(--yc-color-surface)",border:"1px solid var(--yc-color-border)"},children:[e.jsx("h1",{className:"text-2xl font-semibold mb-2",style:{color:"var(--yc-color-text)"},children:"Sign in to Yamchart"}),e.jsx("p",{className:"text-sm mb-6",style:{color:"var(--yc-color-text-secondary)"},children:"Enter your credentials to access dashboards."}),c&&e.jsx("div",{className:"text-sm rounded-md px-4 py-3 mb-4",style:{backgroundColor:"color-mix(in srgb, var(--yc-color-danger) 10%, transparent)",border:"1px solid color-mix(in srgb, var(--yc-color-danger) 30%, transparent)",color:"var(--yc-color-danger)"},children:c}),l.length>0&&e.jsxs("div",{className:"space-y-2 mb-6",children:[l.map(o=>e.jsxs("button",{onClick:()=>h(o),className:"w-full py-2 px-4 text-sm font-medium rounded-md hover:bg-black/5",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text-secondary)"},children:["Sign in with ",g[o]??o]},o)),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",style:{borderColor:"var(--yc-color-border)"}})}),e.jsx("div",{className:"relative flex justify-center text-xs",style:{color:"var(--yc-color-text-muted)"},children:e.jsx("span",{className:"px-2",style:{backgroundColor:"var(--yc-color-surface)"},children:"or"})})]})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium mb-1",style:{color:"var(--yc-color-text-secondary)"},children:"Email"}),e.jsx("input",{id:"email",type:"email",value:a,onChange:o=>x(o.target.value),required:!0,className:"w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",style:{backgroundColor:"var(--yc-color-input-bg)",color:"var(--yc-color-text)",borderColor:"var(--yc-color-border)"},placeholder:"you@example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium mb-1",style:{color:"var(--yc-color-text-secondary)"},children:"Password"}),e.jsx("input",{id:"password",type:"password",value:t,onChange:o=>b(o.target.value),required:!0,className:"w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",style:{backgroundColor:"var(--yc-color-input-bg)",color:"var(--yc-color-text)",borderColor:"var(--yc-color-border)"},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{j as LoginPage};
|