@contractspec/example.integration-hub 3.7.6 → 3.8.2

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 (57) hide show
  1. package/README.md +73 -183
  2. package/dist/connection/index.d.ts +1 -1
  3. package/dist/docs/index.js +2 -1
  4. package/dist/docs/integration-hub.docblock.js +2 -1
  5. package/dist/events.js +1 -1
  6. package/dist/index.d.ts +5 -4
  7. package/dist/index.js +1243 -749
  8. package/dist/integration/index.d.ts +1 -1
  9. package/dist/integration-hub.feature.js +202 -0
  10. package/dist/node/docs/index.js +2 -1
  11. package/dist/node/docs/integration-hub.docblock.js +2 -1
  12. package/dist/node/events.js +1 -1
  13. package/dist/node/index.js +1243 -749
  14. package/dist/node/integration-hub.feature.js +202 -0
  15. package/dist/node/ui/IntegrationDashboard.js +654 -180
  16. package/dist/node/ui/IntegrationDashboard.visualizations.js +250 -0
  17. package/dist/node/ui/hooks/index.js +1 -1
  18. package/dist/node/ui/hooks/useIntegrationData.js +1 -1
  19. package/dist/node/ui/index.js +970 -485
  20. package/dist/node/ui/renderers/index.js +216 -5
  21. package/dist/node/ui/renderers/integration.markdown.js +216 -5
  22. package/dist/node/ui/tables/ConnectionsTable.js +211 -0
  23. package/dist/node/ui/tables/IntegrationTables.js +361 -0
  24. package/dist/node/ui/tables/SyncConfigsTable.js +230 -0
  25. package/dist/node/ui/tables/integration-table.shared.js +84 -0
  26. package/dist/node/visualizations/catalog.js +137 -0
  27. package/dist/node/visualizations/index.js +211 -0
  28. package/dist/node/visualizations/selectors.js +204 -0
  29. package/dist/sync/index.d.ts +3 -3
  30. package/dist/ui/IntegrationDashboard.js +654 -180
  31. package/dist/ui/IntegrationDashboard.visualizations.d.ts +6 -0
  32. package/dist/ui/IntegrationDashboard.visualizations.js +251 -0
  33. package/dist/ui/hooks/index.d.ts +1 -1
  34. package/dist/ui/hooks/index.js +1 -1
  35. package/dist/ui/hooks/useIntegrationData.js +1 -1
  36. package/dist/ui/index.d.ts +2 -2
  37. package/dist/ui/index.js +970 -485
  38. package/dist/ui/renderers/index.d.ts +1 -1
  39. package/dist/ui/renderers/index.js +216 -5
  40. package/dist/ui/renderers/integration.markdown.js +216 -5
  41. package/dist/ui/tables/ConnectionsTable.d.ts +4 -0
  42. package/dist/ui/tables/ConnectionsTable.js +212 -0
  43. package/dist/ui/tables/IntegrationTables.d.ts +2 -0
  44. package/dist/ui/tables/IntegrationTables.js +362 -0
  45. package/dist/ui/tables/IntegrationTables.smoke.test.d.ts +1 -0
  46. package/dist/ui/tables/SyncConfigsTable.d.ts +4 -0
  47. package/dist/ui/tables/SyncConfigsTable.js +231 -0
  48. package/dist/ui/tables/integration-table.shared.d.ts +18 -0
  49. package/dist/ui/tables/integration-table.shared.js +85 -0
  50. package/dist/visualizations/catalog.d.ts +11 -0
  51. package/dist/visualizations/catalog.js +138 -0
  52. package/dist/visualizations/index.d.ts +2 -0
  53. package/dist/visualizations/index.js +212 -0
  54. package/dist/visualizations/selectors.d.ts +10 -0
  55. package/dist/visualizations/selectors.js +205 -0
  56. package/dist/visualizations/selectors.test.d.ts +1 -0
  57. package/package.json +110 -12
package/dist/index.js CHANGED
@@ -496,6 +496,158 @@ var CreateIntegrationContract = defineCommand2({
496
496
  ]
497
497
  }
498
498
  });
499
+ // src/mcp-example.ts
500
+ import { randomUUID } from "crypto";
501
+ import {
502
+ createMcpToolsets
503
+ } from "@contractspec/lib.ai-agent/tools/mcp-client";
504
+ var DEFAULT_STDIO_ARGS = [
505
+ "-y",
506
+ "@modelcontextprotocol/server-filesystem",
507
+ "."
508
+ ];
509
+ async function runIntegrationHubMcpExampleFromEnv() {
510
+ const mode = resolveMode();
511
+ const transport = resolveTransport();
512
+ const config = buildMcpConfigFromEnv();
513
+ const toolset = await createMcpToolsets([config], {
514
+ onNameCollision: "error"
515
+ });
516
+ try {
517
+ const toolNames = Object.keys(toolset.tools).sort();
518
+ const output = {
519
+ mode,
520
+ server: {
521
+ name: config.name,
522
+ transport
523
+ },
524
+ authMethod: process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_AUTH_METHOD,
525
+ apiVersion: process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_API_VERSION,
526
+ tools: toolNames
527
+ };
528
+ if (mode === "call") {
529
+ const toolName = requireEnv("CONTRACTSPEC_INTEGRATION_HUB_MCP_TOOL_NAME");
530
+ const toolArgs = parseRecordEnvOrDefault("CONTRACTSPEC_INTEGRATION_HUB_MCP_TOOL_ARGS_JSON", {});
531
+ const tool = toolset.tools[toolName];
532
+ if (!tool?.execute) {
533
+ throw new Error(`Tool "${toolName}" was not found. Available tools: ${toolNames.join(", ")}`);
534
+ }
535
+ const toolOutput = await tool.execute(toolArgs, {
536
+ toolCallId: `integration-hub-${randomUUID()}`,
537
+ messages: []
538
+ });
539
+ output.toolCall = {
540
+ name: toolName,
541
+ args: toolArgs,
542
+ output: toolOutput
543
+ };
544
+ }
545
+ return output;
546
+ } finally {
547
+ await toolset.cleanup().catch(() => {
548
+ return;
549
+ });
550
+ }
551
+ }
552
+ function buildMcpConfigFromEnv() {
553
+ const name = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_NAME ?? "filesystem";
554
+ const transport = resolveTransport();
555
+ const toolPrefix = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_TOOL_PREFIX;
556
+ if (transport === "stdio") {
557
+ return {
558
+ name,
559
+ transport,
560
+ command: process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_COMMAND ?? "npx",
561
+ args: parseStringArrayEnv("CONTRACTSPEC_INTEGRATION_HUB_MCP_ARGS_JSON", DEFAULT_STDIO_ARGS),
562
+ toolPrefix
563
+ };
564
+ }
565
+ const accessToken = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_ACCESS_TOKEN;
566
+ const accessTokenEnvVar = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_ACCESS_TOKEN_ENV;
567
+ const mcpTransport = transport === "webhook" || transport === "http" ? "http" : "sse";
568
+ return {
569
+ name,
570
+ transport: mcpTransport,
571
+ url: requireEnv("CONTRACTSPEC_INTEGRATION_HUB_MCP_URL"),
572
+ headers: parseStringRecordEnv("CONTRACTSPEC_INTEGRATION_HUB_MCP_HEADERS_JSON"),
573
+ accessToken,
574
+ accessTokenEnvVar,
575
+ toolPrefix
576
+ };
577
+ }
578
+ function resolveMode() {
579
+ const rawMode = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_MODE?.toLowerCase() ?? "list";
580
+ if (rawMode === "list" || rawMode === "call") {
581
+ return rawMode;
582
+ }
583
+ throw new Error(`Unsupported CONTRACTSPEC_INTEGRATION_HUB_MCP_MODE: ${rawMode}. Use "list" or "call".`);
584
+ }
585
+ function resolveTransport() {
586
+ const rawTransport = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_TRANSPORT?.toLowerCase() ?? "stdio";
587
+ if (rawTransport === "stdio" || rawTransport === "http" || rawTransport === "sse" || rawTransport === "webhook") {
588
+ return rawTransport;
589
+ }
590
+ throw new Error(`Unsupported CONTRACTSPEC_INTEGRATION_HUB_MCP_TRANSPORT: ${rawTransport}. Use "stdio", "http", "sse", or "webhook".`);
591
+ }
592
+ function parseStringArrayEnv(key, fallback) {
593
+ const raw = process.env[key];
594
+ if (!raw) {
595
+ return fallback;
596
+ }
597
+ const parsed = parseJsonEnv(key);
598
+ if (!Array.isArray(parsed) || parsed.some((value) => typeof value !== "string")) {
599
+ throw new Error(`${key} must be a JSON string array.`);
600
+ }
601
+ return parsed;
602
+ }
603
+ function parseRecordEnv(key) {
604
+ const raw = process.env[key];
605
+ if (!raw) {
606
+ return;
607
+ }
608
+ const parsed = parseJsonEnv(key);
609
+ if (!isRecord(parsed)) {
610
+ throw new Error(`${key} must be a JSON object.`);
611
+ }
612
+ return parsed;
613
+ }
614
+ function parseRecordEnvOrDefault(key, fallback) {
615
+ return parseRecordEnv(key) ?? fallback;
616
+ }
617
+ function parseStringRecordEnv(key) {
618
+ const parsed = parseRecordEnv(key);
619
+ if (!parsed) {
620
+ return;
621
+ }
622
+ const entries = Object.entries(parsed);
623
+ const invalidEntry = entries.find(([, value]) => typeof value !== "string");
624
+ if (invalidEntry) {
625
+ throw new Error(`${key} must contain only string values.`);
626
+ }
627
+ return Object.fromEntries(entries);
628
+ }
629
+ function parseJsonEnv(key) {
630
+ const raw = process.env[key];
631
+ if (!raw) {
632
+ return;
633
+ }
634
+ try {
635
+ return JSON.parse(raw);
636
+ } catch {
637
+ throw new Error(`${key} contains invalid JSON.`);
638
+ }
639
+ }
640
+ function requireEnv(key) {
641
+ const value = process.env[key];
642
+ if (!value) {
643
+ throw new Error(`Missing required env var: ${key}`);
644
+ }
645
+ return value;
646
+ }
647
+ function isRecord(value) {
648
+ return typeof value === "object" && value !== null && !Array.isArray(value);
649
+ }
650
+
499
651
  // src/sync/sync.enum.ts
500
652
  import { defineEnum as defineEnum3 } from "@contractspec/lib.schema";
501
653
  var SyncDirectionEnum = defineEnum3("SyncDirection", [
@@ -811,277 +963,189 @@ var ListSyncRunsContract = defineQuery({
811
963
  ]
812
964
  }
813
965
  });
814
- // src/ui/renderers/integration.markdown.ts
815
- var mockIntegrations = [
816
- {
817
- id: "int-1",
818
- name: "Salesforce",
819
- type: "CRM",
820
- status: "ACTIVE",
821
- connectionCount: 3
822
- },
823
- {
824
- id: "int-2",
825
- name: "HubSpot",
826
- type: "MARKETING",
827
- status: "ACTIVE",
828
- connectionCount: 2
829
- },
830
- {
831
- id: "int-3",
832
- name: "Stripe",
833
- type: "PAYMENT",
834
- status: "ACTIVE",
835
- connectionCount: 1
836
- },
837
- {
838
- id: "int-4",
839
- name: "Slack",
840
- type: "COMMUNICATION",
841
- status: "INACTIVE",
842
- connectionCount: 0
843
- },
844
- {
845
- id: "int-5",
846
- name: "Google Sheets",
847
- type: "DATA",
848
- status: "ACTIVE",
849
- connectionCount: 5
850
- },
851
- {
852
- id: "int-6",
853
- name: "PostHog",
854
- type: "ANALYTICS",
855
- status: "ACTIVE",
856
- connectionCount: 1
966
+ // src/sync-engine/index.ts
967
+ class BasicFieldTransformer {
968
+ transform(value, expression) {
969
+ try {
970
+ if (expression.startsWith("uppercase")) {
971
+ return typeof value === "string" ? value.toUpperCase() : value;
972
+ }
973
+ if (expression.startsWith("lowercase")) {
974
+ return typeof value === "string" ? value.toLowerCase() : value;
975
+ }
976
+ if (expression.startsWith("trim")) {
977
+ return typeof value === "string" ? value.trim() : value;
978
+ }
979
+ if (expression.startsWith("default:")) {
980
+ const defaultVal = expression.replace("default:", "");
981
+ return value ?? JSON.parse(defaultVal);
982
+ }
983
+ if (expression.startsWith("concat:")) {
984
+ const separator = expression.replace("concat:", "") || " ";
985
+ if (Array.isArray(value)) {
986
+ return value.join(separator);
987
+ }
988
+ return value;
989
+ }
990
+ if (expression.startsWith("split:")) {
991
+ const separator = expression.replace("split:", "") || ",";
992
+ if (typeof value === "string") {
993
+ return value.split(separator);
994
+ }
995
+ return value;
996
+ }
997
+ if (expression.startsWith("number")) {
998
+ return Number(value);
999
+ }
1000
+ if (expression.startsWith("boolean")) {
1001
+ return Boolean(value);
1002
+ }
1003
+ if (expression.startsWith("string")) {
1004
+ return String(value);
1005
+ }
1006
+ return value;
1007
+ } catch {
1008
+ return value;
1009
+ }
857
1010
  }
858
- ];
859
- var mockConnections = [
860
- {
861
- id: "conn-1",
862
- integrationId: "int-1",
863
- name: "Production Salesforce",
864
- status: "CONNECTED",
865
- lastSyncAt: "2024-01-16T10:00:00Z"
866
- },
867
- {
868
- id: "conn-2",
869
- integrationId: "int-1",
870
- name: "Sandbox Salesforce",
871
- status: "CONNECTED",
872
- lastSyncAt: "2024-01-15T14:00:00Z"
873
- },
874
- {
875
- id: "conn-3",
876
- integrationId: "int-2",
877
- name: "Marketing HubSpot",
878
- status: "CONNECTED",
879
- lastSyncAt: "2024-01-16T08:00:00Z"
880
- },
881
- {
882
- id: "conn-4",
883
- integrationId: "int-3",
884
- name: "Stripe Live",
885
- status: "CONNECTED",
886
- lastSyncAt: "2024-01-16T12:00:00Z"
887
- },
888
- {
889
- id: "conn-5",
890
- integrationId: "int-5",
891
- name: "Analytics Sheet",
892
- status: "ERROR",
893
- lastSyncAt: "2024-01-14T09:00:00Z",
894
- error: "Authentication expired"
895
- },
896
- {
897
- id: "conn-6",
898
- integrationId: "int-6",
899
- name: "PostHog Workspace",
900
- status: "CONNECTED",
901
- lastSyncAt: "2024-01-16T11:45:00Z"
1011
+ }
1012
+
1013
+ class BasicSyncEngine {
1014
+ transformer;
1015
+ constructor(transformer) {
1016
+ this.transformer = transformer ?? new BasicFieldTransformer;
902
1017
  }
903
- ];
904
- var mockSyncConfigs = [
905
- {
906
- id: "sync-1",
907
- connectionId: "conn-1",
908
- name: "Contacts Sync",
909
- frequency: "HOURLY",
910
- lastRunAt: "2024-01-16T10:00:00Z",
911
- status: "SUCCESS",
912
- recordsSynced: 1250
913
- },
914
- {
915
- id: "sync-2",
916
- connectionId: "conn-1",
917
- name: "Opportunities Sync",
918
- frequency: "DAILY",
919
- lastRunAt: "2024-01-16T00:00:00Z",
920
- status: "SUCCESS",
921
- recordsSynced: 340
922
- },
923
- {
924
- id: "sync-3",
925
- connectionId: "conn-3",
926
- name: "Orders Sync",
927
- frequency: "REALTIME",
928
- lastRunAt: "2024-01-16T12:30:00Z",
929
- status: "SUCCESS",
930
- recordsSynced: 89
931
- },
932
- {
933
- id: "sync-4",
934
- connectionId: "conn-5",
935
- name: "Metrics Export",
936
- frequency: "DAILY",
937
- lastRunAt: "2024-01-14T09:00:00Z",
938
- status: "FAILED",
939
- recordsSynced: 0
1018
+ async sync(_context) {
1019
+ const result = {
1020
+ success: true,
1021
+ recordsProcessed: 0,
1022
+ recordsCreated: 0,
1023
+ recordsUpdated: 0,
1024
+ recordsDeleted: 0,
1025
+ recordsFailed: 0,
1026
+ recordsSkipped: 0,
1027
+ errors: []
1028
+ };
1029
+ return result;
940
1030
  }
941
- ];
942
- var integrationDashboardMarkdownRenderer = {
943
- target: "markdown",
944
- render: async (desc) => {
945
- if (desc.source.type !== "component" || desc.source.componentKey !== "IntegrationDashboard") {
946
- throw new Error("integrationDashboardMarkdownRenderer: not IntegrationDashboard");
947
- }
948
- const integrations = mockIntegrations;
949
- const connections = mockConnections;
950
- const syncs = mockSyncConfigs;
951
- const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
952
- const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
953
- const errorConnections = connections.filter((c) => c.status === "ERROR");
954
- const successfulSyncs = syncs.filter((s) => s.status === "SUCCESS");
955
- const totalRecordsSynced = successfulSyncs.reduce((sum, s) => sum + s.recordsSynced, 0);
956
- const lines = [
957
- "# Integration Hub",
958
- "",
959
- "> Connect and sync data with external services",
960
- "",
961
- "## Overview",
962
- "",
963
- "| Metric | Value |",
964
- "|--------|-------|",
965
- `| Active Integrations | ${activeIntegrations.length} |`,
966
- `| Connected Services | ${connectedConnections.length} |`,
967
- `| Error Connections | ${errorConnections.length} |`,
968
- `| Sync Configs | ${syncs.length} |`,
969
- `| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
970
- "",
971
- "## Integrations",
972
- "",
973
- "| Name | Type | Connections | Status |",
974
- "|------|------|-------------|--------|"
975
- ];
976
- for (const integration of integrations) {
977
- const statusIcon = integration.status === "ACTIVE" ? "\uD83D\uDFE2" : "\u26AB";
978
- lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
979
- }
980
- lines.push("");
981
- lines.push("## Recent Sync Activity");
982
- lines.push("");
983
- lines.push("| Sync | Frequency | Last Run | Records | Status |");
984
- lines.push("|------|-----------|----------|---------|--------|");
985
- for (const sync of syncs) {
986
- const lastRun = new Date(sync.lastRunAt).toLocaleString();
987
- const statusIcon = sync.status === "SUCCESS" ? "\u2705" : "\u274C";
988
- lines.push(`| ${sync.name} | ${sync.frequency} | ${lastRun} | ${sync.recordsSynced} | ${statusIcon} ${sync.status} |`);
1031
+ transformRecord(sourceRecord, mappings, _context) {
1032
+ const targetData = {};
1033
+ for (const mapping of mappings) {
1034
+ let value;
1035
+ let sourceValue;
1036
+ switch (mapping.mappingType) {
1037
+ case "DIRECT":
1038
+ value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
1039
+ break;
1040
+ case "TRANSFORM":
1041
+ sourceValue = this.getNestedValue(sourceRecord.data, mapping.sourceField);
1042
+ value = mapping.transformExpression ? this.transformer.transform(sourceValue, mapping.transformExpression) : sourceValue;
1043
+ break;
1044
+ case "CONSTANT":
1045
+ value = mapping.constantValue;
1046
+ break;
1047
+ case "LOOKUP":
1048
+ value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
1049
+ break;
1050
+ case "COMPUTED":
1051
+ value = mapping.transformExpression ? this.evaluateComputed(sourceRecord.data, mapping.transformExpression) : null;
1052
+ break;
1053
+ default:
1054
+ value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
1055
+ }
1056
+ if (value === undefined || value === null) {
1057
+ value = mapping.defaultValue;
1058
+ }
1059
+ this.setNestedValue(targetData, mapping.targetField, value);
989
1060
  }
990
- if (errorConnections.length > 0) {
991
- lines.push("");
992
- lines.push("## \u26A0\uFE0F Connections with Errors");
993
- lines.push("");
994
- for (const conn of errorConnections) {
995
- const integration = integrations.find((i) => i.id === conn.integrationId);
996
- lines.push(`- **${conn.name}** (${integration?.name ?? "Unknown"}): ${conn.error ?? "Unknown error"}`);
1061
+ return {
1062
+ id: sourceRecord.id,
1063
+ data: targetData
1064
+ };
1065
+ }
1066
+ validateRecord(record, mappings) {
1067
+ const errors = [];
1068
+ for (const mapping of mappings) {
1069
+ if (mapping.isRequired) {
1070
+ const value = this.getNestedValue(record.data, mapping.targetField);
1071
+ if (value === undefined || value === null) {
1072
+ errors.push({
1073
+ recordId: record.id,
1074
+ field: mapping.targetField,
1075
+ message: `Required field ${mapping.targetField} is missing`,
1076
+ code: "REQUIRED_FIELD_MISSING"
1077
+ });
1078
+ }
997
1079
  }
998
1080
  }
999
1081
  return {
1000
- mimeType: "text/markdown",
1001
- body: lines.join(`
1002
- `)
1082
+ valid: errors.length === 0,
1083
+ errors
1003
1084
  };
1004
1085
  }
1005
- };
1006
- var connectionListMarkdownRenderer = {
1007
- target: "markdown",
1008
- render: async (desc) => {
1009
- if (desc.source.type !== "component" || desc.source.componentKey !== "ConnectionList") {
1010
- throw new Error("connectionListMarkdownRenderer: not ConnectionList");
1086
+ getNestedValue(obj, path) {
1087
+ const parts = path.split(".");
1088
+ let current = obj;
1089
+ for (const part of parts) {
1090
+ if (current === null || current === undefined) {
1091
+ return;
1092
+ }
1093
+ current = current[part];
1011
1094
  }
1012
- const connections = mockConnections;
1013
- const integrations = mockIntegrations;
1014
- const lines = [
1015
- "# Connections",
1016
- "",
1017
- "> Manage connections to external services",
1018
- ""
1019
- ];
1020
- for (const integration of integrations) {
1021
- const intConnections = connections.filter((c) => c.integrationId === integration.id);
1022
- if (intConnections.length === 0)
1095
+ return current;
1096
+ }
1097
+ setNestedValue(obj, path, value) {
1098
+ const parts = path.split(".");
1099
+ let current = obj;
1100
+ for (let i = 0;i < parts.length - 1; i++) {
1101
+ const part = parts[i];
1102
+ if (part === undefined)
1023
1103
  continue;
1024
- lines.push(`## ${integration.name}`);
1025
- lines.push("");
1026
- lines.push("| Connection | Status | Last Sync |");
1027
- lines.push("|------------|--------|-----------|");
1028
- for (const conn of intConnections) {
1029
- const lastSync = new Date(conn.lastSyncAt).toLocaleString();
1030
- const statusIcon = conn.status === "CONNECTED" ? "\uD83D\uDFE2" : conn.status === "ERROR" ? "\uD83D\uDD34" : "\u26AB";
1031
- lines.push(`| ${conn.name} | ${statusIcon} ${conn.status} | ${lastSync} |`);
1104
+ if (!(part in current)) {
1105
+ current[part] = {};
1032
1106
  }
1033
- lines.push("");
1107
+ current = current[part];
1108
+ }
1109
+ const lastPart = parts[parts.length - 1];
1110
+ if (lastPart !== undefined) {
1111
+ current[lastPart] = value;
1034
1112
  }
1035
- return {
1036
- mimeType: "text/markdown",
1037
- body: lines.join(`
1038
- `)
1039
- };
1040
1113
  }
1041
- };
1042
- var syncConfigMarkdownRenderer = {
1043
- target: "markdown",
1044
- render: async (desc) => {
1045
- if (desc.source.type !== "component" || desc.source.componentKey !== "SyncConfigEditor") {
1046
- throw new Error("syncConfigMarkdownRenderer: not SyncConfigEditor");
1114
+ evaluateComputed(data, expression) {
1115
+ try {
1116
+ const result = expression.replace(/\$\{([^}]+)\}/g, (_, path) => {
1117
+ const value = this.getNestedValue(data, path);
1118
+ return String(value ?? "");
1119
+ });
1120
+ return result;
1121
+ } catch {
1122
+ return null;
1047
1123
  }
1048
- const syncs = mockSyncConfigs;
1049
- const connections = mockConnections;
1050
- const lines = [
1051
- "# Sync Configurations",
1052
- "",
1053
- "> Configure automated data synchronization",
1054
- ""
1055
- ];
1056
- for (const sync of syncs) {
1057
- const connection = connections.find((c) => c.id === sync.connectionId);
1058
- const statusIcon = sync.status === "SUCCESS" ? "\u2705" : "\u274C";
1059
- lines.push(`## ${sync.name}`);
1060
- lines.push("");
1061
- lines.push(`**Connection:** ${connection?.name ?? "Unknown"}`);
1062
- lines.push(`**Frequency:** ${sync.frequency}`);
1063
- lines.push(`**Status:** ${statusIcon} ${sync.status}`);
1064
- lines.push(`**Last Run:** ${new Date(sync.lastRunAt).toLocaleString()}`);
1065
- lines.push(`**Records Synced:** ${sync.recordsSynced.toLocaleString()}`);
1066
- lines.push("");
1067
- }
1068
- lines.push("## Frequency Options");
1069
- lines.push("");
1070
- lines.push("- **REALTIME**: Sync on every change");
1071
- lines.push("- **HOURLY**: Sync every hour");
1072
- lines.push("- **DAILY**: Sync once per day");
1073
- lines.push("- **WEEKLY**: Sync once per week");
1074
- lines.push("- **MANUAL**: Sync only when triggered");
1075
- return {
1076
- mimeType: "text/markdown",
1077
- body: lines.join(`
1078
- `)
1079
- };
1080
1124
  }
1081
- };
1125
+ }
1126
+ function createSyncEngine(transformer) {
1127
+ return new BasicSyncEngine(transformer);
1128
+ }
1129
+ function computeChecksum(data) {
1130
+ const str = JSON.stringify(data, Object.keys(data).sort());
1131
+ let hash = 0;
1132
+ for (let i = 0;i < str.length; i++) {
1133
+ const char = str.charCodeAt(i);
1134
+ hash = (hash << 5) - hash + char;
1135
+ hash = hash & hash;
1136
+ }
1137
+ return hash.toString(16);
1138
+ }
1139
+ function hasChanges(sourceChecksum, targetChecksum) {
1140
+ if (!sourceChecksum || !targetChecksum) {
1141
+ return true;
1142
+ }
1143
+ return sourceChecksum !== targetChecksum;
1144
+ }
1145
+
1082
1146
  // src/ui/hooks/useIntegrationData.ts
1083
- import { useCallback, useEffect, useState } from "react";
1084
1147
  import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
1148
+ import { useCallback, useEffect, useState } from "react";
1085
1149
  "use client";
1086
1150
  function useIntegrationData(projectId = "local-project") {
1087
1151
  const { handlers } = useTemplateRuntime();
@@ -1131,9 +1195,260 @@ function useIntegrationData(projectId = "local-project") {
1131
1195
  };
1132
1196
  }
1133
1197
 
1198
+ // src/ui/hooks/index.ts
1199
+ "use client";
1200
+
1201
+ // src/visualizations/catalog.ts
1202
+ import {
1203
+ defineVisualization,
1204
+ VisualizationRegistry
1205
+ } from "@contractspec/lib.contracts-spec/visualizations";
1206
+ var INTEGRATION_LIST_REF = {
1207
+ key: "integration.list",
1208
+ version: "1.0.0"
1209
+ };
1210
+ var CONNECTION_LIST_REF = {
1211
+ key: "integration.connection.list",
1212
+ version: "1.0.0"
1213
+ };
1214
+ var SYNC_CONFIG_REF = {
1215
+ key: "integration.syncConfig.list",
1216
+ version: "1.0.0"
1217
+ };
1218
+ var META = {
1219
+ version: "1.0.0",
1220
+ domain: "integration",
1221
+ stability: "experimental",
1222
+ owners: ["@example.integration-hub"],
1223
+ tags: ["integration", "visualization", "sync"]
1224
+ };
1225
+ var IntegrationTypeVisualization = defineVisualization({
1226
+ meta: {
1227
+ ...META,
1228
+ key: "integration-hub.visualization.integration-types",
1229
+ title: "Integration Types",
1230
+ description: "Distribution of configured integration categories.",
1231
+ goal: "Show where integration coverage is concentrated.",
1232
+ context: "Integration overview."
1233
+ },
1234
+ source: { primary: INTEGRATION_LIST_REF, resultPath: "data" },
1235
+ visualization: {
1236
+ kind: "pie",
1237
+ nameDimension: "type",
1238
+ valueMeasure: "count",
1239
+ dimensions: [
1240
+ { key: "type", label: "Type", dataPath: "type", type: "category" }
1241
+ ],
1242
+ measures: [
1243
+ { key: "count", label: "Count", dataPath: "count", format: "number" }
1244
+ ],
1245
+ table: { caption: "Integration counts by type." }
1246
+ }
1247
+ });
1248
+ var ConnectionStatusVisualization = defineVisualization({
1249
+ meta: {
1250
+ ...META,
1251
+ key: "integration-hub.visualization.connection-status",
1252
+ title: "Connection Status",
1253
+ description: "Status distribution across configured connections.",
1254
+ goal: "Highlight connection health and instability.",
1255
+ context: "Connection monitoring."
1256
+ },
1257
+ source: { primary: CONNECTION_LIST_REF, resultPath: "data" },
1258
+ visualization: {
1259
+ kind: "cartesian",
1260
+ variant: "bar",
1261
+ xDimension: "status",
1262
+ yMeasures: ["count"],
1263
+ dimensions: [
1264
+ { key: "status", label: "Status", dataPath: "status", type: "category" }
1265
+ ],
1266
+ measures: [
1267
+ {
1268
+ key: "count",
1269
+ label: "Connections",
1270
+ dataPath: "count",
1271
+ format: "number",
1272
+ color: "#1d4ed8"
1273
+ }
1274
+ ],
1275
+ table: { caption: "Connection counts by status." }
1276
+ }
1277
+ });
1278
+ var HealthySyncMetricVisualization = defineVisualization({
1279
+ meta: {
1280
+ ...META,
1281
+ key: "integration-hub.visualization.sync-healthy",
1282
+ title: "Healthy Syncs",
1283
+ description: "Sync configurations currently healthy or recently successful.",
1284
+ goal: "Summarize healthy synchronization capacity.",
1285
+ context: "Sync-state comparison."
1286
+ },
1287
+ source: { primary: SYNC_CONFIG_REF, resultPath: "data" },
1288
+ visualization: {
1289
+ kind: "metric",
1290
+ measure: "value",
1291
+ measures: [
1292
+ { key: "value", label: "Syncs", dataPath: "value", format: "number" }
1293
+ ],
1294
+ table: { caption: "Healthy sync count." }
1295
+ }
1296
+ });
1297
+ var AttentionSyncMetricVisualization = defineVisualization({
1298
+ meta: {
1299
+ ...META,
1300
+ key: "integration-hub.visualization.sync-attention",
1301
+ title: "Attention Needed",
1302
+ description: "Sync configurations paused, failing, or otherwise needing review.",
1303
+ goal: "Summarize syncs needing action.",
1304
+ context: "Sync-state comparison."
1305
+ },
1306
+ source: { primary: SYNC_CONFIG_REF, resultPath: "data" },
1307
+ visualization: {
1308
+ kind: "metric",
1309
+ measure: "value",
1310
+ measures: [
1311
+ { key: "value", label: "Syncs", dataPath: "value", format: "number" }
1312
+ ],
1313
+ table: { caption: "Syncs requiring attention." }
1314
+ }
1315
+ });
1316
+ var IntegrationVisualizationSpecs = [
1317
+ IntegrationTypeVisualization,
1318
+ ConnectionStatusVisualization,
1319
+ HealthySyncMetricVisualization,
1320
+ AttentionSyncMetricVisualization
1321
+ ];
1322
+ var IntegrationVisualizationRegistry = new VisualizationRegistry([
1323
+ ...IntegrationVisualizationSpecs
1324
+ ]);
1325
+ var IntegrationVisualizationRefs = IntegrationVisualizationSpecs.map((spec) => ({
1326
+ key: spec.meta.key,
1327
+ version: spec.meta.version
1328
+ }));
1329
+
1330
+ // src/visualizations/selectors.ts
1331
+ function isHealthySync(status) {
1332
+ return status === "ACTIVE" || status === "SUCCESS";
1333
+ }
1334
+ function createIntegrationVisualizationSections(integrations, connections, syncConfigs) {
1335
+ const integrationTypes = new Map;
1336
+ const connectionStatuses = new Map;
1337
+ let healthySyncs = 0;
1338
+ let attentionSyncs = 0;
1339
+ for (const integration of integrations) {
1340
+ integrationTypes.set(integration.type, (integrationTypes.get(integration.type) ?? 0) + 1);
1341
+ }
1342
+ for (const connection of connections) {
1343
+ connectionStatuses.set(connection.status, (connectionStatuses.get(connection.status) ?? 0) + 1);
1344
+ }
1345
+ for (const syncConfig of syncConfigs) {
1346
+ if (isHealthySync(syncConfig.status)) {
1347
+ healthySyncs += 1;
1348
+ } else {
1349
+ attentionSyncs += 1;
1350
+ }
1351
+ }
1352
+ const primaryItems = [
1353
+ {
1354
+ key: "integration-types",
1355
+ spec: IntegrationTypeVisualization,
1356
+ data: {
1357
+ data: Array.from(integrationTypes.entries()).map(([type, count]) => ({
1358
+ type,
1359
+ count
1360
+ }))
1361
+ },
1362
+ title: "Integration Types",
1363
+ description: "Configured integrations grouped by category.",
1364
+ height: 260
1365
+ },
1366
+ {
1367
+ key: "connection-status",
1368
+ spec: ConnectionStatusVisualization,
1369
+ data: {
1370
+ data: Array.from(connectionStatuses.entries()).map(([status, count]) => ({
1371
+ status,
1372
+ count
1373
+ }))
1374
+ },
1375
+ title: "Connection Status",
1376
+ description: "Operational health across current connections."
1377
+ }
1378
+ ];
1379
+ const comparisonItems = [
1380
+ {
1381
+ key: "healthy-syncs",
1382
+ spec: HealthySyncMetricVisualization,
1383
+ data: { data: [{ value: healthySyncs }] },
1384
+ title: "Healthy Syncs",
1385
+ description: "Active or recently successful sync configurations.",
1386
+ height: 200
1387
+ },
1388
+ {
1389
+ key: "attention-syncs",
1390
+ spec: AttentionSyncMetricVisualization,
1391
+ data: { data: [{ value: attentionSyncs }] },
1392
+ title: "Attention Needed",
1393
+ description: "Paused, failed, or degraded sync configurations.",
1394
+ height: 200
1395
+ }
1396
+ ];
1397
+ return {
1398
+ primaryItems,
1399
+ comparisonItems
1400
+ };
1401
+ }
1402
+ // src/ui/IntegrationDashboard.visualizations.tsx
1403
+ import {
1404
+ ComparisonView,
1405
+ VisualizationCard,
1406
+ VisualizationGrid
1407
+ } from "@contractspec/lib.design-system";
1408
+ import { jsxDEV } from "react/jsx-dev-runtime";
1409
+ "use client";
1410
+ function IntegrationVisualizationOverview({
1411
+ integrations,
1412
+ connections,
1413
+ syncConfigs
1414
+ }) {
1415
+ const { primaryItems, comparisonItems } = createIntegrationVisualizationSections(integrations, connections, syncConfigs);
1416
+ return /* @__PURE__ */ jsxDEV("section", {
1417
+ className: "space-y-4",
1418
+ children: [
1419
+ /* @__PURE__ */ jsxDEV("div", {
1420
+ children: [
1421
+ /* @__PURE__ */ jsxDEV("h3", {
1422
+ className: "font-semibold text-lg",
1423
+ children: "Integration Visualizations"
1424
+ }, undefined, false, undefined, this),
1425
+ /* @__PURE__ */ jsxDEV("p", {
1426
+ className: "text-muted-foreground text-sm",
1427
+ children: "Contract-backed charts for integration coverage and sync health."
1428
+ }, undefined, false, undefined, this)
1429
+ ]
1430
+ }, undefined, true, undefined, this),
1431
+ /* @__PURE__ */ jsxDEV(VisualizationGrid, {
1432
+ children: primaryItems.map((item) => /* @__PURE__ */ jsxDEV(VisualizationCard, {
1433
+ data: item.data,
1434
+ description: item.description,
1435
+ height: item.height,
1436
+ spec: item.spec,
1437
+ title: item.title
1438
+ }, item.key, false, undefined, this))
1439
+ }, undefined, false, undefined, this),
1440
+ /* @__PURE__ */ jsxDEV(ComparisonView, {
1441
+ description: "Comparison surface for healthy versus attention-needed syncs.",
1442
+ items: comparisonItems,
1443
+ title: "Sync-State Comparison"
1444
+ }, undefined, false, undefined, this)
1445
+ ]
1446
+ }, undefined, true, undefined, this);
1447
+ }
1448
+
1134
1449
  // src/ui/IntegrationHubChat.tsx
1135
1450
  import { ChatWithSidebar } from "@contractspec/module.ai-chat";
1136
- import { jsxDEV } from "react/jsx-dev-runtime";
1451
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
1137
1452
  "use client";
1138
1453
  var DEFAULT_SUGGESTIONS = [
1139
1454
  "List my integrations",
@@ -1149,9 +1464,9 @@ function IntegrationHubChat({
1149
1464
  systemPrompt = DEFAULT_SYSTEM_PROMPT,
1150
1465
  className
1151
1466
  }) {
1152
- return /* @__PURE__ */ jsxDEV("div", {
1467
+ return /* @__PURE__ */ jsxDEV2("div", {
1153
1468
  className: className ?? "flex h-[500px] flex-col",
1154
- children: /* @__PURE__ */ jsxDEV(ChatWithSidebar, {
1469
+ children: /* @__PURE__ */ jsxDEV2(ChatWithSidebar, {
1155
1470
  className: "flex-1",
1156
1471
  systemPrompt,
1157
1472
  proxyUrl,
@@ -1163,16 +1478,373 @@ function IntegrationHubChat({
1163
1478
  }, undefined, false, undefined, this);
1164
1479
  }
1165
1480
 
1481
+ // src/ui/tables/integration-table.shared.tsx
1482
+ import { Button } from "@contractspec/lib.design-system";
1483
+ import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
1484
+ import { HStack } from "@contractspec/lib.ui-kit-web/ui/stack";
1485
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
1486
+ "use client";
1487
+ var STATUS_VARIANTS = {
1488
+ ACTIVE: "default",
1489
+ CONNECTED: "default",
1490
+ SUCCESS: "default",
1491
+ PENDING: "secondary",
1492
+ PAUSED: "secondary",
1493
+ ERROR: "destructive",
1494
+ DISCONNECTED: "outline"
1495
+ };
1496
+ function formatDateTime(value) {
1497
+ return value ? value.toLocaleString() : "Never";
1498
+ }
1499
+ function formatJson(value) {
1500
+ return value ? JSON.stringify(value, null, 2) : "No configuration";
1501
+ }
1502
+ function StatusBadge({ status }) {
1503
+ return /* @__PURE__ */ jsxDEV3(Badge, {
1504
+ variant: STATUS_VARIANTS[status] ?? "outline",
1505
+ children: status
1506
+ }, undefined, false, undefined, this);
1507
+ }
1508
+ function IntegrationTableToolbar({
1509
+ controller,
1510
+ label,
1511
+ toggleColumnId,
1512
+ toggleVisibleLabel,
1513
+ toggleHiddenLabel,
1514
+ pinColumnId,
1515
+ pinLabel,
1516
+ resizeColumnId,
1517
+ resizeLabel
1518
+ }) {
1519
+ const firstRow = controller.rows[0];
1520
+ const toggleColumn = controller.columns.find((column) => column.id === toggleColumnId);
1521
+ const pinColumn = controller.columns.find((column) => column.id === pinColumnId);
1522
+ const resizeColumn = controller.columns.find((column) => column.id === resizeColumnId);
1523
+ const pinTarget = pinColumn?.pinState === "left" ? false : "left";
1524
+ return /* @__PURE__ */ jsxDEV3(HStack, {
1525
+ gap: "sm",
1526
+ className: "flex-wrap",
1527
+ children: [
1528
+ /* @__PURE__ */ jsxDEV3(Badge, {
1529
+ variant: "outline",
1530
+ children: label
1531
+ }, undefined, false, undefined, this),
1532
+ /* @__PURE__ */ jsxDEV3(Button, {
1533
+ variant: "outline",
1534
+ size: "sm",
1535
+ onPress: () => firstRow?.toggleExpanded?.(!firstRow?.isExpanded),
1536
+ children: "Expand First Row"
1537
+ }, undefined, false, undefined, this),
1538
+ /* @__PURE__ */ jsxDEV3(Button, {
1539
+ variant: "outline",
1540
+ size: "sm",
1541
+ onPress: () => toggleColumn?.toggleVisibility?.(!toggleColumn?.visible),
1542
+ children: toggleColumn?.visible ? toggleVisibleLabel : toggleHiddenLabel
1543
+ }, undefined, false, undefined, this),
1544
+ /* @__PURE__ */ jsxDEV3(Button, {
1545
+ variant: "outline",
1546
+ size: "sm",
1547
+ onPress: () => pinColumn?.pin?.(pinTarget),
1548
+ children: pinColumn?.pinState === "left" ? `Unpin ${pinLabel}` : `Pin ${pinLabel}`
1549
+ }, undefined, false, undefined, this),
1550
+ /* @__PURE__ */ jsxDEV3(Button, {
1551
+ variant: "outline",
1552
+ size: "sm",
1553
+ onPress: () => resizeColumn?.resizeBy?.(40),
1554
+ children: resizeLabel
1555
+ }, undefined, false, undefined, this)
1556
+ ]
1557
+ }, undefined, true, undefined, this);
1558
+ }
1559
+
1560
+ // src/ui/tables/ConnectionsTable.tsx
1561
+ import { DataTable } from "@contractspec/lib.design-system";
1562
+ import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
1563
+ import { VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
1564
+ import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
1565
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
1566
+ "use client";
1567
+ function ConnectionsTable({
1568
+ connections
1569
+ }) {
1570
+ const controller = useContractTable({
1571
+ data: connections,
1572
+ columns: [
1573
+ {
1574
+ id: "connection",
1575
+ header: "Connection",
1576
+ label: "Connection",
1577
+ accessor: (connection) => connection.name,
1578
+ cell: ({ item }) => /* @__PURE__ */ jsxDEV4(VStack, {
1579
+ gap: "xs",
1580
+ children: [
1581
+ /* @__PURE__ */ jsxDEV4(Text, {
1582
+ className: "font-medium text-sm",
1583
+ children: item.name
1584
+ }, undefined, false, undefined, this),
1585
+ /* @__PURE__ */ jsxDEV4(Text, {
1586
+ className: "text-muted-foreground text-xs",
1587
+ children: [
1588
+ "Created ",
1589
+ item.createdAt.toLocaleDateString()
1590
+ ]
1591
+ }, undefined, true, undefined, this)
1592
+ ]
1593
+ }, undefined, true, undefined, this),
1594
+ size: 240,
1595
+ minSize: 180,
1596
+ canSort: true,
1597
+ canPin: true,
1598
+ canResize: true
1599
+ },
1600
+ {
1601
+ id: "status",
1602
+ header: "Status",
1603
+ label: "Status",
1604
+ accessorKey: "status",
1605
+ cell: ({ value }) => /* @__PURE__ */ jsxDEV4(StatusBadge, {
1606
+ status: String(value)
1607
+ }, undefined, false, undefined, this),
1608
+ size: 150,
1609
+ canSort: true,
1610
+ canPin: true,
1611
+ canResize: true
1612
+ },
1613
+ {
1614
+ id: "lastSyncAt",
1615
+ header: "Last Sync",
1616
+ label: "Last Sync",
1617
+ accessor: (connection) => connection.lastSyncAt?.getTime() ?? 0,
1618
+ cell: ({ item }) => formatDateTime(item.lastSyncAt),
1619
+ size: 200,
1620
+ canSort: true,
1621
+ canHide: true,
1622
+ canResize: true
1623
+ },
1624
+ {
1625
+ id: "errorMessage",
1626
+ header: "Errors",
1627
+ label: "Errors",
1628
+ accessor: (connection) => connection.errorMessage ?? "",
1629
+ cell: ({ value }) => String(value || "No errors"),
1630
+ size: 240,
1631
+ canHide: true,
1632
+ canResize: true
1633
+ }
1634
+ ],
1635
+ initialState: {
1636
+ pagination: { pageIndex: 0, pageSize: 3 },
1637
+ columnVisibility: { errorMessage: false },
1638
+ columnPinning: { left: ["connection"], right: [] }
1639
+ },
1640
+ renderExpandedContent: (connection) => /* @__PURE__ */ jsxDEV4(VStack, {
1641
+ gap: "sm",
1642
+ className: "py-2",
1643
+ children: [
1644
+ /* @__PURE__ */ jsxDEV4(Text, {
1645
+ className: "font-medium text-sm",
1646
+ children: "Credentials"
1647
+ }, undefined, false, undefined, this),
1648
+ /* @__PURE__ */ jsxDEV4("pre", {
1649
+ className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
1650
+ children: formatJson(connection.credentials)
1651
+ }, undefined, false, undefined, this),
1652
+ /* @__PURE__ */ jsxDEV4(Text, {
1653
+ className: "font-medium text-sm",
1654
+ children: "Config"
1655
+ }, undefined, false, undefined, this),
1656
+ /* @__PURE__ */ jsxDEV4("pre", {
1657
+ className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
1658
+ children: formatJson(connection.config)
1659
+ }, undefined, false, undefined, this),
1660
+ /* @__PURE__ */ jsxDEV4(Text, {
1661
+ className: "text-muted-foreground text-sm",
1662
+ children: connection.errorMessage ?? "No sync errors recorded."
1663
+ }, undefined, false, undefined, this)
1664
+ ]
1665
+ }, undefined, true, undefined, this),
1666
+ getCanExpand: () => true
1667
+ });
1668
+ return /* @__PURE__ */ jsxDEV4(DataTable, {
1669
+ controller,
1670
+ title: "Connections",
1671
+ description: "Client-mode ContractSpec table with visibility, pinning, resizing, and expanded diagnostics.",
1672
+ toolbar: /* @__PURE__ */ jsxDEV4(IntegrationTableToolbar, {
1673
+ controller,
1674
+ label: `${connections.length} total connections`,
1675
+ toggleColumnId: "errorMessage",
1676
+ toggleVisibleLabel: "Hide Error Column",
1677
+ toggleHiddenLabel: "Show Error Column",
1678
+ pinColumnId: "status",
1679
+ pinLabel: "Status",
1680
+ resizeColumnId: "connection",
1681
+ resizeLabel: "Widen Connection"
1682
+ }, undefined, false, undefined, this),
1683
+ emptyState: /* @__PURE__ */ jsxDEV4("div", {
1684
+ className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
1685
+ children: "No connections found"
1686
+ }, undefined, false, undefined, this)
1687
+ }, undefined, false, undefined, this);
1688
+ }
1689
+
1690
+ // src/ui/tables/SyncConfigsTable.tsx
1691
+ import { DataTable as DataTable2 } from "@contractspec/lib.design-system";
1692
+ import { useContractTable as useContractTable2 } from "@contractspec/lib.presentation-runtime-react";
1693
+ import { VStack as VStack2 } from "@contractspec/lib.ui-kit-web/ui/stack";
1694
+ import { Text as Text2 } from "@contractspec/lib.ui-kit-web/ui/text";
1695
+ import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
1696
+ "use client";
1697
+ function SyncConfigsTable({
1698
+ syncConfigs
1699
+ }) {
1700
+ const controller = useContractTable2({
1701
+ data: syncConfigs,
1702
+ columns: [
1703
+ {
1704
+ id: "sync",
1705
+ header: "Sync Config",
1706
+ label: "Sync Config",
1707
+ accessor: (sync) => sync.name,
1708
+ cell: ({ item }) => /* @__PURE__ */ jsxDEV5(VStack2, {
1709
+ gap: "xs",
1710
+ children: [
1711
+ /* @__PURE__ */ jsxDEV5(Text2, {
1712
+ className: "font-medium text-sm",
1713
+ children: item.name
1714
+ }, undefined, false, undefined, this),
1715
+ /* @__PURE__ */ jsxDEV5(Text2, {
1716
+ className: "text-muted-foreground text-xs",
1717
+ children: [
1718
+ item.sourceEntity,
1719
+ " \u2192 ",
1720
+ item.targetEntity
1721
+ ]
1722
+ }, undefined, true, undefined, this)
1723
+ ]
1724
+ }, undefined, true, undefined, this),
1725
+ size: 260,
1726
+ minSize: 200,
1727
+ canSort: true,
1728
+ canPin: true,
1729
+ canResize: true
1730
+ },
1731
+ {
1732
+ id: "frequency",
1733
+ header: "Frequency",
1734
+ label: "Frequency",
1735
+ accessorKey: "frequency",
1736
+ size: 160,
1737
+ canSort: true,
1738
+ canHide: true,
1739
+ canResize: true
1740
+ },
1741
+ {
1742
+ id: "status",
1743
+ header: "Status",
1744
+ label: "Status",
1745
+ accessorKey: "status",
1746
+ cell: ({ value }) => /* @__PURE__ */ jsxDEV5(StatusBadge, {
1747
+ status: String(value)
1748
+ }, undefined, false, undefined, this),
1749
+ size: 150,
1750
+ canSort: true,
1751
+ canPin: true,
1752
+ canResize: true
1753
+ },
1754
+ {
1755
+ id: "recordsSynced",
1756
+ header: "Records",
1757
+ label: "Records",
1758
+ accessorKey: "recordsSynced",
1759
+ align: "right",
1760
+ size: 140,
1761
+ canSort: true,
1762
+ canResize: true
1763
+ },
1764
+ {
1765
+ id: "lastRunAt",
1766
+ header: "Last Run",
1767
+ label: "Last Run",
1768
+ accessor: (sync) => sync.lastRunAt?.getTime() ?? 0,
1769
+ cell: ({ item }) => formatDateTime(item.lastRunAt),
1770
+ size: 200,
1771
+ canSort: true,
1772
+ canHide: true,
1773
+ canResize: true
1774
+ }
1775
+ ],
1776
+ initialState: {
1777
+ pagination: { pageIndex: 0, pageSize: 3 },
1778
+ columnVisibility: { lastRunAt: false },
1779
+ columnPinning: { left: ["sync"], right: [] }
1780
+ },
1781
+ renderExpandedContent: (sync) => /* @__PURE__ */ jsxDEV5(VStack2, {
1782
+ gap: "sm",
1783
+ className: "py-2",
1784
+ children: [
1785
+ /* @__PURE__ */ jsxDEV5(Text2, {
1786
+ className: "text-muted-foreground text-sm",
1787
+ children: [
1788
+ "Connection ",
1789
+ sync.connectionId
1790
+ ]
1791
+ }, undefined, true, undefined, this),
1792
+ /* @__PURE__ */ jsxDEV5(Text2, {
1793
+ className: "text-muted-foreground text-sm",
1794
+ children: [
1795
+ "Last run: ",
1796
+ formatDateTime(sync.lastRunAt)
1797
+ ]
1798
+ }, undefined, true, undefined, this),
1799
+ /* @__PURE__ */ jsxDEV5(Text2, {
1800
+ className: "text-muted-foreground text-sm",
1801
+ children: [
1802
+ "Last status: ",
1803
+ sync.lastRunStatus ?? "No runs recorded"
1804
+ ]
1805
+ }, undefined, true, undefined, this),
1806
+ /* @__PURE__ */ jsxDEV5(Text2, {
1807
+ className: "text-muted-foreground text-sm",
1808
+ children: [
1809
+ "Updated ",
1810
+ sync.updatedAt.toLocaleString()
1811
+ ]
1812
+ }, undefined, true, undefined, this)
1813
+ ]
1814
+ }, undefined, true, undefined, this),
1815
+ getCanExpand: () => true
1816
+ });
1817
+ return /* @__PURE__ */ jsxDEV5(DataTable2, {
1818
+ controller,
1819
+ title: "Sync Configs",
1820
+ description: "Shared table primitives applied to sync monitoring without changing the surrounding dashboard layout.",
1821
+ toolbar: /* @__PURE__ */ jsxDEV5(IntegrationTableToolbar, {
1822
+ controller,
1823
+ label: `${syncConfigs.length} syncs`,
1824
+ toggleColumnId: "lastRunAt",
1825
+ toggleVisibleLabel: "Hide Last Run",
1826
+ toggleHiddenLabel: "Show Last Run",
1827
+ pinColumnId: "status",
1828
+ pinLabel: "Status",
1829
+ resizeColumnId: "sync",
1830
+ resizeLabel: "Widen Sync"
1831
+ }, undefined, false, undefined, this),
1832
+ emptyState: /* @__PURE__ */ jsxDEV5("div", {
1833
+ className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
1834
+ children: "No sync configurations found"
1835
+ }, undefined, false, undefined, this)
1836
+ }, undefined, false, undefined, this);
1837
+ }
1166
1838
  // src/ui/IntegrationDashboard.tsx
1167
- import { useState as useState2 } from "react";
1168
1839
  import {
1169
- Button,
1840
+ Button as Button2,
1170
1841
  ErrorState,
1171
1842
  LoaderBlock,
1172
1843
  StatCard,
1173
1844
  StatCardGroup
1174
1845
  } from "@contractspec/lib.design-system";
1175
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
1846
+ import { useState as useState2 } from "react";
1847
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
1176
1848
  "use client";
1177
1849
  var STATUS_COLORS = {
1178
1850
  ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
@@ -1209,32 +1881,32 @@ function IntegrationDashboard() {
1209
1881
  { id: "chat", label: "Chat", icon: "\uD83D\uDCAC" }
1210
1882
  ];
1211
1883
  if (loading) {
1212
- return /* @__PURE__ */ jsxDEV2(LoaderBlock, {
1884
+ return /* @__PURE__ */ jsxDEV6(LoaderBlock, {
1213
1885
  label: "Loading Integrations..."
1214
1886
  }, undefined, false, undefined, this);
1215
1887
  }
1216
1888
  if (error) {
1217
- return /* @__PURE__ */ jsxDEV2(ErrorState, {
1889
+ return /* @__PURE__ */ jsxDEV6(ErrorState, {
1218
1890
  title: "Failed to load Integrations",
1219
1891
  description: error.message,
1220
1892
  onRetry: refetch,
1221
1893
  retryLabel: "Retry"
1222
1894
  }, undefined, false, undefined, this);
1223
1895
  }
1224
- return /* @__PURE__ */ jsxDEV2("div", {
1896
+ return /* @__PURE__ */ jsxDEV6("div", {
1225
1897
  className: "space-y-6",
1226
1898
  children: [
1227
- /* @__PURE__ */ jsxDEV2("div", {
1899
+ /* @__PURE__ */ jsxDEV6("div", {
1228
1900
  className: "flex items-center justify-between",
1229
1901
  children: [
1230
- /* @__PURE__ */ jsxDEV2("h2", {
1231
- className: "text-2xl font-bold",
1902
+ /* @__PURE__ */ jsxDEV6("h2", {
1903
+ className: "font-bold text-2xl",
1232
1904
  children: "Integration Hub"
1233
1905
  }, undefined, false, undefined, this),
1234
- /* @__PURE__ */ jsxDEV2(Button, {
1906
+ /* @__PURE__ */ jsxDEV6(Button2, {
1235
1907
  onClick: () => alert("Add integration modal"),
1236
1908
  children: [
1237
- /* @__PURE__ */ jsxDEV2("span", {
1909
+ /* @__PURE__ */ jsxDEV6("span", {
1238
1910
  className: "mr-2",
1239
1911
  children: "+"
1240
1912
  }, undefined, false, undefined, this),
@@ -1243,66 +1915,71 @@ function IntegrationDashboard() {
1243
1915
  }, undefined, true, undefined, this)
1244
1916
  ]
1245
1917
  }, undefined, true, undefined, this),
1246
- /* @__PURE__ */ jsxDEV2(StatCardGroup, {
1918
+ /* @__PURE__ */ jsxDEV6(StatCardGroup, {
1247
1919
  children: [
1248
- /* @__PURE__ */ jsxDEV2(StatCard, {
1920
+ /* @__PURE__ */ jsxDEV6(StatCard, {
1249
1921
  label: "Integrations",
1250
1922
  value: stats.totalIntegrations,
1251
1923
  hint: `${stats.activeIntegrations} active`
1252
1924
  }, undefined, false, undefined, this),
1253
- /* @__PURE__ */ jsxDEV2(StatCard, {
1925
+ /* @__PURE__ */ jsxDEV6(StatCard, {
1254
1926
  label: "Connections",
1255
1927
  value: stats.totalConnections,
1256
1928
  hint: `${stats.connectedCount} connected`
1257
1929
  }, undefined, false, undefined, this),
1258
- /* @__PURE__ */ jsxDEV2(StatCard, {
1930
+ /* @__PURE__ */ jsxDEV6(StatCard, {
1259
1931
  label: "Syncs",
1260
1932
  value: stats.totalSyncs,
1261
1933
  hint: `${stats.activeSyncs} active`
1262
1934
  }, undefined, false, undefined, this)
1263
1935
  ]
1264
1936
  }, undefined, true, undefined, this),
1265
- /* @__PURE__ */ jsxDEV2("nav", {
1266
- className: "bg-muted flex gap-1 rounded-lg p-1",
1937
+ /* @__PURE__ */ jsxDEV6(IntegrationVisualizationOverview, {
1938
+ connections,
1939
+ integrations,
1940
+ syncConfigs
1941
+ }, undefined, false, undefined, this),
1942
+ /* @__PURE__ */ jsxDEV6("nav", {
1943
+ className: "flex gap-1 rounded-lg bg-muted p-1",
1267
1944
  role: "tablist",
1268
- children: tabs.map((tab) => /* @__PURE__ */ jsxDEV2(Button, {
1945
+ children: tabs.map((tab) => /* @__PURE__ */ jsxDEV6(Button2, {
1269
1946
  type: "button",
1270
1947
  role: "tab",
1271
1948
  "aria-selected": activeTab === tab.id,
1272
1949
  onClick: () => setActiveTab(tab.id),
1273
- className: `flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors ${activeTab === tab.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
1950
+ className: `flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 font-medium text-sm transition-colors ${activeTab === tab.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
1274
1951
  children: [
1275
- /* @__PURE__ */ jsxDEV2("span", {
1952
+ /* @__PURE__ */ jsxDEV6("span", {
1276
1953
  children: tab.icon
1277
1954
  }, undefined, false, undefined, this),
1278
1955
  tab.label
1279
1956
  ]
1280
1957
  }, tab.id, true, undefined, this))
1281
1958
  }, undefined, false, undefined, this),
1282
- /* @__PURE__ */ jsxDEV2("div", {
1959
+ /* @__PURE__ */ jsxDEV6("div", {
1283
1960
  className: "min-h-[400px]",
1284
1961
  role: "tabpanel",
1285
1962
  children: [
1286
- activeTab === "integrations" && /* @__PURE__ */ jsxDEV2("div", {
1963
+ activeTab === "integrations" && /* @__PURE__ */ jsxDEV6("div", {
1287
1964
  className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
1288
1965
  children: [
1289
- integrations.map((integration) => /* @__PURE__ */ jsxDEV2("div", {
1290
- className: "border-border bg-card hover:bg-muted/50 cursor-pointer rounded-lg border p-4 transition-colors",
1966
+ integrations.map((integration) => /* @__PURE__ */ jsxDEV6("div", {
1967
+ className: "cursor-pointer rounded-lg border border-border bg-card p-4 transition-colors hover:bg-muted/50",
1291
1968
  children: [
1292
- /* @__PURE__ */ jsxDEV2("div", {
1969
+ /* @__PURE__ */ jsxDEV6("div", {
1293
1970
  className: "mb-3 flex items-center gap-3",
1294
1971
  children: [
1295
- /* @__PURE__ */ jsxDEV2("span", {
1972
+ /* @__PURE__ */ jsxDEV6("span", {
1296
1973
  className: "text-2xl",
1297
1974
  children: TYPE_ICONS[integration.type] ?? "\u2699\uFE0F"
1298
1975
  }, undefined, false, undefined, this),
1299
- /* @__PURE__ */ jsxDEV2("div", {
1976
+ /* @__PURE__ */ jsxDEV6("div", {
1300
1977
  children: [
1301
- /* @__PURE__ */ jsxDEV2("h3", {
1978
+ /* @__PURE__ */ jsxDEV6("h3", {
1302
1979
  className: "font-medium",
1303
1980
  children: integration.name
1304
1981
  }, undefined, false, undefined, this),
1305
- /* @__PURE__ */ jsxDEV2("p", {
1982
+ /* @__PURE__ */ jsxDEV6("p", {
1306
1983
  className: "text-muted-foreground text-sm",
1307
1984
  children: integration.type
1308
1985
  }, undefined, false, undefined, this)
@@ -1310,14 +1987,14 @@ function IntegrationDashboard() {
1310
1987
  }, undefined, true, undefined, this)
1311
1988
  ]
1312
1989
  }, undefined, true, undefined, this),
1313
- /* @__PURE__ */ jsxDEV2("div", {
1990
+ /* @__PURE__ */ jsxDEV6("div", {
1314
1991
  className: "flex items-center justify-between",
1315
1992
  children: [
1316
- /* @__PURE__ */ jsxDEV2("span", {
1317
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[integration.status] ?? ""}`,
1993
+ /* @__PURE__ */ jsxDEV6("span", {
1994
+ className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[integration.status] ?? ""}`,
1318
1995
  children: integration.status
1319
1996
  }, undefined, false, undefined, this),
1320
- /* @__PURE__ */ jsxDEV2("span", {
1997
+ /* @__PURE__ */ jsxDEV6("span", {
1321
1998
  className: "text-muted-foreground text-xs",
1322
1999
  children: integration.createdAt.toLocaleDateString()
1323
2000
  }, undefined, false, undefined, this)
@@ -1325,75 +2002,16 @@ function IntegrationDashboard() {
1325
2002
  }, undefined, true, undefined, this)
1326
2003
  ]
1327
2004
  }, integration.id, true, undefined, this)),
1328
- integrations.length === 0 && /* @__PURE__ */ jsxDEV2("div", {
1329
- className: "text-muted-foreground col-span-full flex h-64 items-center justify-center",
2005
+ integrations.length === 0 && /* @__PURE__ */ jsxDEV6("div", {
2006
+ className: "col-span-full flex h-64 items-center justify-center text-muted-foreground",
1330
2007
  children: "No integrations configured"
1331
2008
  }, undefined, false, undefined, this)
1332
2009
  ]
1333
2010
  }, undefined, true, undefined, this),
1334
- activeTab === "connections" && /* @__PURE__ */ jsxDEV2("div", {
1335
- className: "border-border rounded-lg border",
1336
- children: /* @__PURE__ */ jsxDEV2("table", {
1337
- className: "w-full",
1338
- children: [
1339
- /* @__PURE__ */ jsxDEV2("thead", {
1340
- className: "border-border bg-muted/30 border-b",
1341
- children: /* @__PURE__ */ jsxDEV2("tr", {
1342
- children: [
1343
- /* @__PURE__ */ jsxDEV2("th", {
1344
- className: "px-4 py-3 text-left text-sm font-medium",
1345
- children: "Connection"
1346
- }, undefined, false, undefined, this),
1347
- /* @__PURE__ */ jsxDEV2("th", {
1348
- className: "px-4 py-3 text-left text-sm font-medium",
1349
- children: "Status"
1350
- }, undefined, false, undefined, this),
1351
- /* @__PURE__ */ jsxDEV2("th", {
1352
- className: "px-4 py-3 text-left text-sm font-medium",
1353
- children: "Last Sync"
1354
- }, undefined, false, undefined, this)
1355
- ]
1356
- }, undefined, true, undefined, this)
1357
- }, undefined, false, undefined, this),
1358
- /* @__PURE__ */ jsxDEV2("tbody", {
1359
- className: "divide-border divide-y",
1360
- children: [
1361
- connections.map((conn) => /* @__PURE__ */ jsxDEV2("tr", {
1362
- className: "hover:bg-muted/50",
1363
- children: [
1364
- /* @__PURE__ */ jsxDEV2("td", {
1365
- className: "px-4 py-3",
1366
- children: /* @__PURE__ */ jsxDEV2("div", {
1367
- className: "font-medium",
1368
- children: conn.name
1369
- }, undefined, false, undefined, this)
1370
- }, undefined, false, undefined, this),
1371
- /* @__PURE__ */ jsxDEV2("td", {
1372
- className: "px-4 py-3",
1373
- children: /* @__PURE__ */ jsxDEV2("span", {
1374
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[conn.status] ?? ""}`,
1375
- children: conn.status
1376
- }, undefined, false, undefined, this)
1377
- }, undefined, false, undefined, this),
1378
- /* @__PURE__ */ jsxDEV2("td", {
1379
- className: "text-muted-foreground px-4 py-3 text-sm",
1380
- children: conn.lastSyncAt?.toLocaleString() ?? "Never"
1381
- }, undefined, false, undefined, this)
1382
- ]
1383
- }, conn.id, true, undefined, this)),
1384
- connections.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
1385
- children: /* @__PURE__ */ jsxDEV2("td", {
1386
- colSpan: 3,
1387
- className: "text-muted-foreground px-4 py-8 text-center",
1388
- children: "No connections found"
1389
- }, undefined, false, undefined, this)
1390
- }, undefined, false, undefined, this)
1391
- ]
1392
- }, undefined, true, undefined, this)
1393
- ]
1394
- }, undefined, true, undefined, this)
2011
+ activeTab === "connections" && /* @__PURE__ */ jsxDEV6(ConnectionsTable, {
2012
+ connections
1395
2013
  }, undefined, false, undefined, this),
1396
- activeTab === "chat" && /* @__PURE__ */ jsxDEV2(IntegrationHubChat, {
2014
+ activeTab === "chat" && /* @__PURE__ */ jsxDEV6(IntegrationHubChat, {
1397
2015
  proxyUrl: "/api/chat",
1398
2016
  thinkingLevel: "thinking",
1399
2017
  suggestions: [
@@ -1403,85 +2021,8 @@ function IntegrationDashboard() {
1403
2021
  ],
1404
2022
  className: "min-h-[400px]"
1405
2023
  }, undefined, false, undefined, this),
1406
- activeTab === "syncs" && /* @__PURE__ */ jsxDEV2("div", {
1407
- className: "border-border rounded-lg border",
1408
- children: /* @__PURE__ */ jsxDEV2("table", {
1409
- className: "w-full",
1410
- children: [
1411
- /* @__PURE__ */ jsxDEV2("thead", {
1412
- className: "border-border bg-muted/30 border-b",
1413
- children: /* @__PURE__ */ jsxDEV2("tr", {
1414
- children: [
1415
- /* @__PURE__ */ jsxDEV2("th", {
1416
- className: "px-4 py-3 text-left text-sm font-medium",
1417
- children: "Sync Config"
1418
- }, undefined, false, undefined, this),
1419
- /* @__PURE__ */ jsxDEV2("th", {
1420
- className: "px-4 py-3 text-left text-sm font-medium",
1421
- children: "Frequency"
1422
- }, undefined, false, undefined, this),
1423
- /* @__PURE__ */ jsxDEV2("th", {
1424
- className: "px-4 py-3 text-left text-sm font-medium",
1425
- children: "Status"
1426
- }, undefined, false, undefined, this),
1427
- /* @__PURE__ */ jsxDEV2("th", {
1428
- className: "px-4 py-3 text-left text-sm font-medium",
1429
- children: "Records"
1430
- }, undefined, false, undefined, this)
1431
- ]
1432
- }, undefined, true, undefined, this)
1433
- }, undefined, false, undefined, this),
1434
- /* @__PURE__ */ jsxDEV2("tbody", {
1435
- className: "divide-border divide-y",
1436
- children: [
1437
- syncConfigs.map((sync) => /* @__PURE__ */ jsxDEV2("tr", {
1438
- className: "hover:bg-muted/50",
1439
- children: [
1440
- /* @__PURE__ */ jsxDEV2("td", {
1441
- className: "px-4 py-3",
1442
- children: [
1443
- /* @__PURE__ */ jsxDEV2("div", {
1444
- className: "font-medium",
1445
- children: sync.name
1446
- }, undefined, false, undefined, this),
1447
- /* @__PURE__ */ jsxDEV2("div", {
1448
- className: "text-muted-foreground text-sm",
1449
- children: [
1450
- sync.sourceEntity,
1451
- " \u2192 ",
1452
- sync.targetEntity
1453
- ]
1454
- }, undefined, true, undefined, this)
1455
- ]
1456
- }, undefined, true, undefined, this),
1457
- /* @__PURE__ */ jsxDEV2("td", {
1458
- className: "px-4 py-3 text-sm",
1459
- children: sync.frequency
1460
- }, undefined, false, undefined, this),
1461
- /* @__PURE__ */ jsxDEV2("td", {
1462
- className: "px-4 py-3",
1463
- children: /* @__PURE__ */ jsxDEV2("span", {
1464
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[sync.status] ?? ""}`,
1465
- children: sync.status
1466
- }, undefined, false, undefined, this)
1467
- }, undefined, false, undefined, this),
1468
- /* @__PURE__ */ jsxDEV2("td", {
1469
- className: "text-muted-foreground px-4 py-3 text-sm",
1470
- children: sync.recordsSynced.toLocaleString()
1471
- }, undefined, false, undefined, this)
1472
- ]
1473
- }, sync.id, true, undefined, this)),
1474
- syncConfigs.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
1475
- children: /* @__PURE__ */ jsxDEV2("td", {
1476
- colSpan: 4,
1477
- className: "text-muted-foreground px-4 py-8 text-center",
1478
- children: "No sync configurations found"
1479
- }, undefined, false, undefined, this)
1480
- }, undefined, false, undefined, this)
1481
- ]
1482
- }, undefined, true, undefined, this)
1483
- ]
1484
- }, undefined, true, undefined, this)
2024
+ activeTab === "syncs" && /* @__PURE__ */ jsxDEV6(SyncConfigsTable, {
2025
+ syncConfigs
1485
2026
  }, undefined, false, undefined, this)
1486
2027
  ]
1487
2028
  }, undefined, true, undefined, this)
@@ -1489,339 +2030,284 @@ function IntegrationDashboard() {
1489
2030
  }, undefined, true, undefined, this);
1490
2031
  }
1491
2032
 
1492
- // src/ui/hooks/index.ts
1493
- "use client";
1494
- // src/sync-engine/index.ts
1495
- class BasicFieldTransformer {
1496
- transform(value, expression) {
1497
- try {
1498
- if (expression.startsWith("uppercase")) {
1499
- return typeof value === "string" ? value.toUpperCase() : value;
1500
- }
1501
- if (expression.startsWith("lowercase")) {
1502
- return typeof value === "string" ? value.toLowerCase() : value;
1503
- }
1504
- if (expression.startsWith("trim")) {
1505
- return typeof value === "string" ? value.trim() : value;
1506
- }
1507
- if (expression.startsWith("default:")) {
1508
- const defaultVal = expression.replace("default:", "");
1509
- return value ?? JSON.parse(defaultVal);
1510
- }
1511
- if (expression.startsWith("concat:")) {
1512
- const separator = expression.replace("concat:", "") || " ";
1513
- if (Array.isArray(value)) {
1514
- return value.join(separator);
1515
- }
1516
- return value;
1517
- }
1518
- if (expression.startsWith("split:")) {
1519
- const separator = expression.replace("split:", "") || ",";
1520
- if (typeof value === "string") {
1521
- return value.split(separator);
1522
- }
1523
- return value;
1524
- }
1525
- if (expression.startsWith("number")) {
1526
- return Number(value);
1527
- }
1528
- if (expression.startsWith("boolean")) {
1529
- return Boolean(value);
1530
- }
1531
- if (expression.startsWith("string")) {
1532
- return String(value);
1533
- }
1534
- return value;
1535
- } catch {
1536
- return value;
1537
- }
2033
+ // src/ui/renderers/integration.markdown.ts
2034
+ var mockIntegrations = [
2035
+ {
2036
+ id: "int-1",
2037
+ name: "Salesforce",
2038
+ type: "CRM",
2039
+ status: "ACTIVE",
2040
+ connectionCount: 3
2041
+ },
2042
+ {
2043
+ id: "int-2",
2044
+ name: "HubSpot",
2045
+ type: "MARKETING",
2046
+ status: "ACTIVE",
2047
+ connectionCount: 2
2048
+ },
2049
+ {
2050
+ id: "int-3",
2051
+ name: "Stripe",
2052
+ type: "PAYMENT",
2053
+ status: "ACTIVE",
2054
+ connectionCount: 1
2055
+ },
2056
+ {
2057
+ id: "int-4",
2058
+ name: "Slack",
2059
+ type: "COMMUNICATION",
2060
+ status: "INACTIVE",
2061
+ connectionCount: 0
2062
+ },
2063
+ {
2064
+ id: "int-5",
2065
+ name: "Google Sheets",
2066
+ type: "DATA",
2067
+ status: "ACTIVE",
2068
+ connectionCount: 5
2069
+ },
2070
+ {
2071
+ id: "int-6",
2072
+ name: "PostHog",
2073
+ type: "ANALYTICS",
2074
+ status: "ACTIVE",
2075
+ connectionCount: 1
1538
2076
  }
1539
- }
1540
-
1541
- class BasicSyncEngine {
1542
- transformer;
1543
- constructor(transformer) {
1544
- this.transformer = transformer ?? new BasicFieldTransformer;
2077
+ ];
2078
+ var mockConnections = [
2079
+ {
2080
+ id: "conn-1",
2081
+ integrationId: "int-1",
2082
+ name: "Production Salesforce",
2083
+ status: "CONNECTED",
2084
+ lastSyncAt: "2024-01-16T10:00:00Z"
2085
+ },
2086
+ {
2087
+ id: "conn-2",
2088
+ integrationId: "int-1",
2089
+ name: "Sandbox Salesforce",
2090
+ status: "CONNECTED",
2091
+ lastSyncAt: "2024-01-15T14:00:00Z"
2092
+ },
2093
+ {
2094
+ id: "conn-3",
2095
+ integrationId: "int-2",
2096
+ name: "Marketing HubSpot",
2097
+ status: "CONNECTED",
2098
+ lastSyncAt: "2024-01-16T08:00:00Z"
2099
+ },
2100
+ {
2101
+ id: "conn-4",
2102
+ integrationId: "int-3",
2103
+ name: "Stripe Live",
2104
+ status: "CONNECTED",
2105
+ lastSyncAt: "2024-01-16T12:00:00Z"
2106
+ },
2107
+ {
2108
+ id: "conn-5",
2109
+ integrationId: "int-5",
2110
+ name: "Analytics Sheet",
2111
+ status: "ERROR",
2112
+ lastSyncAt: "2024-01-14T09:00:00Z",
2113
+ error: "Authentication expired"
2114
+ },
2115
+ {
2116
+ id: "conn-6",
2117
+ integrationId: "int-6",
2118
+ name: "PostHog Workspace",
2119
+ status: "CONNECTED",
2120
+ lastSyncAt: "2024-01-16T11:45:00Z"
1545
2121
  }
1546
- async sync(_context) {
1547
- const result = {
1548
- success: true,
1549
- recordsProcessed: 0,
1550
- recordsCreated: 0,
1551
- recordsUpdated: 0,
1552
- recordsDeleted: 0,
1553
- recordsFailed: 0,
1554
- recordsSkipped: 0,
1555
- errors: []
1556
- };
1557
- return result;
2122
+ ];
2123
+ var mockSyncConfigs = [
2124
+ {
2125
+ id: "sync-1",
2126
+ connectionId: "conn-1",
2127
+ name: "Contacts Sync",
2128
+ frequency: "HOURLY",
2129
+ lastRunAt: "2024-01-16T10:00:00Z",
2130
+ status: "SUCCESS",
2131
+ recordsSynced: 1250
2132
+ },
2133
+ {
2134
+ id: "sync-2",
2135
+ connectionId: "conn-1",
2136
+ name: "Opportunities Sync",
2137
+ frequency: "DAILY",
2138
+ lastRunAt: "2024-01-16T00:00:00Z",
2139
+ status: "SUCCESS",
2140
+ recordsSynced: 340
2141
+ },
2142
+ {
2143
+ id: "sync-3",
2144
+ connectionId: "conn-3",
2145
+ name: "Orders Sync",
2146
+ frequency: "REALTIME",
2147
+ lastRunAt: "2024-01-16T12:30:00Z",
2148
+ status: "SUCCESS",
2149
+ recordsSynced: 89
2150
+ },
2151
+ {
2152
+ id: "sync-4",
2153
+ connectionId: "conn-5",
2154
+ name: "Metrics Export",
2155
+ frequency: "DAILY",
2156
+ lastRunAt: "2024-01-14T09:00:00Z",
2157
+ status: "FAILED",
2158
+ recordsSynced: 0
1558
2159
  }
1559
- transformRecord(sourceRecord, mappings, _context) {
1560
- const targetData = {};
1561
- for (const mapping of mappings) {
1562
- let value;
1563
- let sourceValue;
1564
- switch (mapping.mappingType) {
1565
- case "DIRECT":
1566
- value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
1567
- break;
1568
- case "TRANSFORM":
1569
- sourceValue = this.getNestedValue(sourceRecord.data, mapping.sourceField);
1570
- value = mapping.transformExpression ? this.transformer.transform(sourceValue, mapping.transformExpression) : sourceValue;
1571
- break;
1572
- case "CONSTANT":
1573
- value = mapping.constantValue;
1574
- break;
1575
- case "LOOKUP":
1576
- value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
1577
- break;
1578
- case "COMPUTED":
1579
- value = mapping.transformExpression ? this.evaluateComputed(sourceRecord.data, mapping.transformExpression) : null;
1580
- break;
1581
- default:
1582
- value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
1583
- }
1584
- if (value === undefined || value === null) {
1585
- value = mapping.defaultValue;
1586
- }
1587
- this.setNestedValue(targetData, mapping.targetField, value);
2160
+ ];
2161
+ var integrationDashboardMarkdownRenderer = {
2162
+ target: "markdown",
2163
+ render: async (desc) => {
2164
+ if (desc.source.type !== "component" || desc.source.componentKey !== "IntegrationDashboard") {
2165
+ throw new Error("integrationDashboardMarkdownRenderer: not IntegrationDashboard");
1588
2166
  }
1589
- return {
1590
- id: sourceRecord.id,
1591
- data: targetData
1592
- };
1593
- }
1594
- validateRecord(record, mappings) {
1595
- const errors = [];
1596
- for (const mapping of mappings) {
1597
- if (mapping.isRequired) {
1598
- const value = this.getNestedValue(record.data, mapping.targetField);
1599
- if (value === undefined || value === null) {
1600
- errors.push({
1601
- recordId: record.id,
1602
- field: mapping.targetField,
1603
- message: `Required field ${mapping.targetField} is missing`,
1604
- code: "REQUIRED_FIELD_MISSING"
1605
- });
1606
- }
1607
- }
2167
+ const integrations = mockIntegrations;
2168
+ const connections = mockConnections;
2169
+ const syncs = mockSyncConfigs;
2170
+ const visualizations = createIntegrationVisualizationSections(integrations, connections, syncs);
2171
+ const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
2172
+ const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
2173
+ const errorConnections = connections.filter((c) => c.status === "ERROR");
2174
+ const successfulSyncs = syncs.filter((s) => s.status === "SUCCESS");
2175
+ const totalRecordsSynced = successfulSyncs.reduce((sum, s) => sum + s.recordsSynced, 0);
2176
+ const lines = [
2177
+ "# Integration Hub",
2178
+ "",
2179
+ "> Connect and sync data with external services",
2180
+ "",
2181
+ "## Overview",
2182
+ "",
2183
+ "| Metric | Value |",
2184
+ "|--------|-------|",
2185
+ `| Active Integrations | ${activeIntegrations.length} |`,
2186
+ `| Connected Services | ${connectedConnections.length} |`,
2187
+ `| Error Connections | ${errorConnections.length} |`,
2188
+ `| Sync Configs | ${syncs.length} |`,
2189
+ `| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
2190
+ ""
2191
+ ];
2192
+ lines.push("## Visualization Overview");
2193
+ lines.push("");
2194
+ for (const item of [
2195
+ ...visualizations.primaryItems,
2196
+ ...visualizations.comparisonItems
2197
+ ]) {
2198
+ lines.push(`- **${item.title}** via \`${item.spec.meta.key}\``);
1608
2199
  }
1609
- return {
1610
- valid: errors.length === 0,
1611
- errors
1612
- };
1613
- }
1614
- getNestedValue(obj, path) {
1615
- const parts = path.split(".");
1616
- let current = obj;
1617
- for (const part of parts) {
1618
- if (current === null || current === undefined) {
1619
- return;
1620
- }
1621
- current = current[part];
2200
+ lines.push("");
2201
+ lines.push("## Integrations");
2202
+ lines.push("");
2203
+ lines.push("| Name | Type | Connections | Status |");
2204
+ lines.push("|------|------|-------------|--------|");
2205
+ for (const integration of integrations) {
2206
+ const statusIcon = integration.status === "ACTIVE" ? "\uD83D\uDFE2" : "\u26AB";
2207
+ lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
1622
2208
  }
1623
- return current;
1624
- }
1625
- setNestedValue(obj, path, value) {
1626
- const parts = path.split(".");
1627
- let current = obj;
1628
- for (let i = 0;i < parts.length - 1; i++) {
1629
- const part = parts[i];
1630
- if (part === undefined)
1631
- continue;
1632
- if (!(part in current)) {
1633
- current[part] = {};
2209
+ lines.push("");
2210
+ lines.push("## Recent Sync Activity");
2211
+ lines.push("");
2212
+ lines.push("| Sync | Frequency | Last Run | Records | Status |");
2213
+ lines.push("|------|-----------|----------|---------|--------|");
2214
+ for (const sync of syncs) {
2215
+ const lastRun = new Date(sync.lastRunAt).toLocaleString();
2216
+ const statusIcon = sync.status === "SUCCESS" ? "\u2705" : "\u274C";
2217
+ lines.push(`| ${sync.name} | ${sync.frequency} | ${lastRun} | ${sync.recordsSynced} | ${statusIcon} ${sync.status} |`);
2218
+ }
2219
+ if (errorConnections.length > 0) {
2220
+ lines.push("");
2221
+ lines.push("## \u26A0\uFE0F Connections with Errors");
2222
+ lines.push("");
2223
+ for (const conn of errorConnections) {
2224
+ const integration = integrations.find((i) => i.id === conn.integrationId);
2225
+ lines.push(`- **${conn.name}** (${integration?.name ?? "Unknown"}): ${conn.error ?? "Unknown error"}`);
1634
2226
  }
1635
- current = current[part];
1636
- }
1637
- const lastPart = parts[parts.length - 1];
1638
- if (lastPart !== undefined) {
1639
- current[lastPart] = value;
1640
2227
  }
2228
+ return {
2229
+ mimeType: "text/markdown",
2230
+ body: lines.join(`
2231
+ `)
2232
+ };
1641
2233
  }
1642
- evaluateComputed(data, expression) {
1643
- try {
1644
- const result = expression.replace(/\$\{([^}]+)\}/g, (_, path) => {
1645
- const value = this.getNestedValue(data, path);
1646
- return String(value ?? "");
1647
- });
1648
- return result;
1649
- } catch {
1650
- return null;
2234
+ };
2235
+ var connectionListMarkdownRenderer = {
2236
+ target: "markdown",
2237
+ render: async (desc) => {
2238
+ if (desc.source.type !== "component" || desc.source.componentKey !== "ConnectionList") {
2239
+ throw new Error("connectionListMarkdownRenderer: not ConnectionList");
1651
2240
  }
1652
- }
1653
- }
1654
- function createSyncEngine(transformer) {
1655
- return new BasicSyncEngine(transformer);
1656
- }
1657
- function computeChecksum(data) {
1658
- const str = JSON.stringify(data, Object.keys(data).sort());
1659
- let hash = 0;
1660
- for (let i = 0;i < str.length; i++) {
1661
- const char = str.charCodeAt(i);
1662
- hash = (hash << 5) - hash + char;
1663
- hash = hash & hash;
1664
- }
1665
- return hash.toString(16);
1666
- }
1667
- function hasChanges(sourceChecksum, targetChecksum) {
1668
- if (!sourceChecksum || !targetChecksum) {
1669
- return true;
1670
- }
1671
- return sourceChecksum !== targetChecksum;
1672
- }
1673
-
1674
- // src/mcp-example.ts
1675
- import { randomUUID } from "crypto";
1676
- import {
1677
- createMcpToolsets
1678
- } from "@contractspec/lib.ai-agent/tools/mcp-client";
1679
- var DEFAULT_STDIO_ARGS = [
1680
- "-y",
1681
- "@modelcontextprotocol/server-filesystem",
1682
- "."
1683
- ];
1684
- async function runIntegrationHubMcpExampleFromEnv() {
1685
- const mode = resolveMode();
1686
- const transport = resolveTransport();
1687
- const config = buildMcpConfigFromEnv();
1688
- const toolset = await createMcpToolsets([config], {
1689
- onNameCollision: "error"
1690
- });
1691
- try {
1692
- const toolNames = Object.keys(toolset.tools).sort();
1693
- const output = {
1694
- mode,
1695
- server: {
1696
- name: config.name,
1697
- transport
1698
- },
1699
- authMethod: process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_AUTH_METHOD,
1700
- apiVersion: process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_API_VERSION,
1701
- tools: toolNames
1702
- };
1703
- if (mode === "call") {
1704
- const toolName = requireEnv("CONTRACTSPEC_INTEGRATION_HUB_MCP_TOOL_NAME");
1705
- const toolArgs = parseRecordEnvOrDefault("CONTRACTSPEC_INTEGRATION_HUB_MCP_TOOL_ARGS_JSON", {});
1706
- const tool = toolset.tools[toolName];
1707
- if (!tool?.execute) {
1708
- throw new Error(`Tool "${toolName}" was not found. Available tools: ${toolNames.join(", ")}`);
2241
+ const connections = mockConnections;
2242
+ const integrations = mockIntegrations;
2243
+ const lines = [
2244
+ "# Connections",
2245
+ "",
2246
+ "> Manage connections to external services",
2247
+ ""
2248
+ ];
2249
+ for (const integration of integrations) {
2250
+ const intConnections = connections.filter((c) => c.integrationId === integration.id);
2251
+ if (intConnections.length === 0)
2252
+ continue;
2253
+ lines.push(`## ${integration.name}`);
2254
+ lines.push("");
2255
+ lines.push("| Connection | Status | Last Sync |");
2256
+ lines.push("|------------|--------|-----------|");
2257
+ for (const conn of intConnections) {
2258
+ const lastSync = new Date(conn.lastSyncAt).toLocaleString();
2259
+ const statusIcon = conn.status === "CONNECTED" ? "\uD83D\uDFE2" : conn.status === "ERROR" ? "\uD83D\uDD34" : "\u26AB";
2260
+ lines.push(`| ${conn.name} | ${statusIcon} ${conn.status} | ${lastSync} |`);
1709
2261
  }
1710
- const toolOutput = await tool.execute(toolArgs, {
1711
- toolCallId: `integration-hub-${randomUUID()}`,
1712
- messages: []
1713
- });
1714
- output.toolCall = {
1715
- name: toolName,
1716
- args: toolArgs,
1717
- output: toolOutput
1718
- };
2262
+ lines.push("");
1719
2263
  }
1720
- return output;
1721
- } finally {
1722
- await toolset.cleanup().catch(() => {
1723
- return;
1724
- });
1725
- }
1726
- }
1727
- function buildMcpConfigFromEnv() {
1728
- const name = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_NAME ?? "filesystem";
1729
- const transport = resolveTransport();
1730
- const toolPrefix = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_TOOL_PREFIX;
1731
- if (transport === "stdio") {
1732
2264
  return {
1733
- name,
1734
- transport,
1735
- command: process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_COMMAND ?? "npx",
1736
- args: parseStringArrayEnv("CONTRACTSPEC_INTEGRATION_HUB_MCP_ARGS_JSON", DEFAULT_STDIO_ARGS),
1737
- toolPrefix
2265
+ mimeType: "text/markdown",
2266
+ body: lines.join(`
2267
+ `)
1738
2268
  };
1739
2269
  }
1740
- const accessToken = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_ACCESS_TOKEN;
1741
- const accessTokenEnvVar = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_ACCESS_TOKEN_ENV;
1742
- const mcpTransport = transport === "webhook" || transport === "http" ? "http" : "sse";
1743
- return {
1744
- name,
1745
- transport: mcpTransport,
1746
- url: requireEnv("CONTRACTSPEC_INTEGRATION_HUB_MCP_URL"),
1747
- headers: parseStringRecordEnv("CONTRACTSPEC_INTEGRATION_HUB_MCP_HEADERS_JSON"),
1748
- accessToken,
1749
- accessTokenEnvVar,
1750
- toolPrefix
1751
- };
1752
- }
1753
- function resolveMode() {
1754
- const rawMode = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_MODE?.toLowerCase() ?? "list";
1755
- if (rawMode === "list" || rawMode === "call") {
1756
- return rawMode;
1757
- }
1758
- throw new Error(`Unsupported CONTRACTSPEC_INTEGRATION_HUB_MCP_MODE: ${rawMode}. Use "list" or "call".`);
1759
- }
1760
- function resolveTransport() {
1761
- const rawTransport = process.env.CONTRACTSPEC_INTEGRATION_HUB_MCP_TRANSPORT?.toLowerCase() ?? "stdio";
1762
- if (rawTransport === "stdio" || rawTransport === "http" || rawTransport === "sse" || rawTransport === "webhook") {
1763
- return rawTransport;
1764
- }
1765
- throw new Error(`Unsupported CONTRACTSPEC_INTEGRATION_HUB_MCP_TRANSPORT: ${rawTransport}. Use "stdio", "http", "sse", or "webhook".`);
1766
- }
1767
- function parseStringArrayEnv(key, fallback) {
1768
- const raw = process.env[key];
1769
- if (!raw) {
1770
- return fallback;
1771
- }
1772
- const parsed = parseJsonEnv(key);
1773
- if (!Array.isArray(parsed) || parsed.some((value) => typeof value !== "string")) {
1774
- throw new Error(`${key} must be a JSON string array.`);
1775
- }
1776
- return parsed;
1777
- }
1778
- function parseRecordEnv(key) {
1779
- const raw = process.env[key];
1780
- if (!raw) {
1781
- return;
1782
- }
1783
- const parsed = parseJsonEnv(key);
1784
- if (!isRecord(parsed)) {
1785
- throw new Error(`${key} must be a JSON object.`);
1786
- }
1787
- return parsed;
1788
- }
1789
- function parseRecordEnvOrDefault(key, fallback) {
1790
- return parseRecordEnv(key) ?? fallback;
1791
- }
1792
- function parseStringRecordEnv(key) {
1793
- const parsed = parseRecordEnv(key);
1794
- if (!parsed) {
1795
- return;
1796
- }
1797
- const entries = Object.entries(parsed);
1798
- const invalidEntry = entries.find(([, value]) => typeof value !== "string");
1799
- if (invalidEntry) {
1800
- throw new Error(`${key} must contain only string values.`);
1801
- }
1802
- return Object.fromEntries(entries);
1803
- }
1804
- function parseJsonEnv(key) {
1805
- const raw = process.env[key];
1806
- if (!raw) {
1807
- return;
1808
- }
1809
- try {
1810
- return JSON.parse(raw);
1811
- } catch {
1812
- throw new Error(`${key} contains invalid JSON.`);
1813
- }
1814
- }
1815
- function requireEnv(key) {
1816
- const value = process.env[key];
1817
- if (!value) {
1818
- throw new Error(`Missing required env var: ${key}`);
2270
+ };
2271
+ var syncConfigMarkdownRenderer = {
2272
+ target: "markdown",
2273
+ render: async (desc) => {
2274
+ if (desc.source.type !== "component" || desc.source.componentKey !== "SyncConfigEditor") {
2275
+ throw new Error("syncConfigMarkdownRenderer: not SyncConfigEditor");
2276
+ }
2277
+ const syncs = mockSyncConfigs;
2278
+ const connections = mockConnections;
2279
+ const lines = [
2280
+ "# Sync Configurations",
2281
+ "",
2282
+ "> Configure automated data synchronization",
2283
+ ""
2284
+ ];
2285
+ for (const sync of syncs) {
2286
+ const connection = connections.find((c) => c.id === sync.connectionId);
2287
+ const statusIcon = sync.status === "SUCCESS" ? "\u2705" : "\u274C";
2288
+ lines.push(`## ${sync.name}`);
2289
+ lines.push("");
2290
+ lines.push(`**Connection:** ${connection?.name ?? "Unknown"}`);
2291
+ lines.push(`**Frequency:** ${sync.frequency}`);
2292
+ lines.push(`**Status:** ${statusIcon} ${sync.status}`);
2293
+ lines.push(`**Last Run:** ${new Date(sync.lastRunAt).toLocaleString()}`);
2294
+ lines.push(`**Records Synced:** ${sync.recordsSynced.toLocaleString()}`);
2295
+ lines.push("");
2296
+ }
2297
+ lines.push("## Frequency Options");
2298
+ lines.push("");
2299
+ lines.push("- **REALTIME**: Sync on every change");
2300
+ lines.push("- **HOURLY**: Sync every hour");
2301
+ lines.push("- **DAILY**: Sync once per day");
2302
+ lines.push("- **WEEKLY**: Sync once per week");
2303
+ lines.push("- **MANUAL**: Sync only when triggered");
2304
+ return {
2305
+ mimeType: "text/markdown",
2306
+ body: lines.join(`
2307
+ `)
2308
+ };
1819
2309
  }
1820
- return value;
1821
- }
1822
- function isRecord(value) {
1823
- return typeof value === "object" && value !== null && !Array.isArray(value);
1824
- }
2310
+ };
1825
2311
  export {
1826
2312
  useIntegrationData,
1827
2313
  syncConfigMarkdownRenderer,
@@ -1829,6 +2315,7 @@ export {
1829
2315
  integrationDashboardMarkdownRenderer,
1830
2316
  hasChanges,
1831
2317
  createSyncEngine,
2318
+ createIntegrationVisualizationSections,
1832
2319
  createIntegrationHandlers,
1833
2320
  connectionListMarkdownRenderer,
1834
2321
  computeChecksum,
@@ -1842,10 +2329,15 @@ export {
1842
2329
  ListSyncRunsOutputModel,
1843
2330
  ListSyncRunsInputModel,
1844
2331
  ListSyncRunsContract,
2332
+ IntegrationVisualizationSpecs,
2333
+ IntegrationVisualizationRegistry,
2334
+ IntegrationVisualizationRefs,
2335
+ IntegrationTypeVisualization,
1845
2336
  IntegrationStatusEnum,
1846
2337
  IntegrationModel,
1847
2338
  IntegrationHubChat,
1848
2339
  IntegrationDashboard,
2340
+ HealthySyncMetricVisualization,
1849
2341
  FieldMappingModel,
1850
2342
  CreateSyncConfigInputModel,
1851
2343
  CreateSyncConfigContract,
@@ -1853,10 +2345,12 @@ export {
1853
2345
  CreateIntegrationContract,
1854
2346
  CreateConnectionInputModel,
1855
2347
  CreateConnectionContract,
2348
+ ConnectionStatusVisualization,
1856
2349
  ConnectionStatusEnum,
1857
2350
  ConnectionModel,
1858
2351
  BasicSyncEngine,
1859
2352
  BasicFieldTransformer,
2353
+ AttentionSyncMetricVisualization,
1860
2354
  AddFieldMappingInputModel,
1861
2355
  AddFieldMappingContract
1862
2356
  };