@contractspec/example.integration-hub 3.7.7 → 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.
- package/README.md +4 -1
- package/dist/docs/index.js +2 -1
- package/dist/docs/integration-hub.docblock.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +669 -177
- package/dist/integration-hub.feature.js +202 -0
- package/dist/node/docs/index.js +2 -1
- package/dist/node/docs/integration-hub.docblock.js +2 -1
- package/dist/node/index.js +669 -177
- package/dist/node/integration-hub.feature.js +202 -0
- package/dist/node/ui/IntegrationDashboard.js +646 -172
- package/dist/node/ui/IntegrationDashboard.visualizations.js +250 -0
- package/dist/node/ui/index.js +661 -177
- package/dist/node/ui/renderers/index.js +216 -5
- package/dist/node/ui/renderers/integration.markdown.js +216 -5
- package/dist/node/ui/tables/ConnectionsTable.js +211 -0
- package/dist/node/ui/tables/IntegrationTables.js +361 -0
- package/dist/node/ui/tables/SyncConfigsTable.js +230 -0
- package/dist/node/ui/tables/integration-table.shared.js +84 -0
- package/dist/node/visualizations/catalog.js +137 -0
- package/dist/node/visualizations/index.js +211 -0
- package/dist/node/visualizations/selectors.js +204 -0
- package/dist/ui/IntegrationDashboard.js +646 -172
- package/dist/ui/IntegrationDashboard.visualizations.d.ts +6 -0
- package/dist/ui/IntegrationDashboard.visualizations.js +251 -0
- package/dist/ui/index.js +661 -177
- package/dist/ui/renderers/index.js +216 -5
- package/dist/ui/renderers/integration.markdown.js +216 -5
- package/dist/ui/tables/ConnectionsTable.d.ts +4 -0
- package/dist/ui/tables/ConnectionsTable.js +212 -0
- package/dist/ui/tables/IntegrationTables.d.ts +2 -0
- package/dist/ui/tables/IntegrationTables.js +362 -0
- package/dist/ui/tables/IntegrationTables.smoke.test.d.ts +1 -0
- package/dist/ui/tables/SyncConfigsTable.d.ts +4 -0
- package/dist/ui/tables/SyncConfigsTable.js +231 -0
- package/dist/ui/tables/integration-table.shared.d.ts +18 -0
- package/dist/ui/tables/integration-table.shared.js +85 -0
- package/dist/visualizations/catalog.d.ts +11 -0
- package/dist/visualizations/catalog.js +138 -0
- package/dist/visualizations/index.d.ts +2 -0
- package/dist/visualizations/index.js +212 -0
- package/dist/visualizations/selectors.d.ts +10 -0
- package/dist/visualizations/selectors.js +205 -0
- package/dist/visualizations/selectors.test.d.ts +1 -0
- package/package.json +108 -10
|
@@ -1,3 +1,204 @@
|
|
|
1
|
+
// src/visualizations/catalog.ts
|
|
2
|
+
import {
|
|
3
|
+
defineVisualization,
|
|
4
|
+
VisualizationRegistry
|
|
5
|
+
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
6
|
+
var INTEGRATION_LIST_REF = {
|
|
7
|
+
key: "integration.list",
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
};
|
|
10
|
+
var CONNECTION_LIST_REF = {
|
|
11
|
+
key: "integration.connection.list",
|
|
12
|
+
version: "1.0.0"
|
|
13
|
+
};
|
|
14
|
+
var SYNC_CONFIG_REF = {
|
|
15
|
+
key: "integration.syncConfig.list",
|
|
16
|
+
version: "1.0.0"
|
|
17
|
+
};
|
|
18
|
+
var META = {
|
|
19
|
+
version: "1.0.0",
|
|
20
|
+
domain: "integration",
|
|
21
|
+
stability: "experimental",
|
|
22
|
+
owners: ["@example.integration-hub"],
|
|
23
|
+
tags: ["integration", "visualization", "sync"]
|
|
24
|
+
};
|
|
25
|
+
var IntegrationTypeVisualization = defineVisualization({
|
|
26
|
+
meta: {
|
|
27
|
+
...META,
|
|
28
|
+
key: "integration-hub.visualization.integration-types",
|
|
29
|
+
title: "Integration Types",
|
|
30
|
+
description: "Distribution of configured integration categories.",
|
|
31
|
+
goal: "Show where integration coverage is concentrated.",
|
|
32
|
+
context: "Integration overview."
|
|
33
|
+
},
|
|
34
|
+
source: { primary: INTEGRATION_LIST_REF, resultPath: "data" },
|
|
35
|
+
visualization: {
|
|
36
|
+
kind: "pie",
|
|
37
|
+
nameDimension: "type",
|
|
38
|
+
valueMeasure: "count",
|
|
39
|
+
dimensions: [
|
|
40
|
+
{ key: "type", label: "Type", dataPath: "type", type: "category" }
|
|
41
|
+
],
|
|
42
|
+
measures: [
|
|
43
|
+
{ key: "count", label: "Count", dataPath: "count", format: "number" }
|
|
44
|
+
],
|
|
45
|
+
table: { caption: "Integration counts by type." }
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var ConnectionStatusVisualization = defineVisualization({
|
|
49
|
+
meta: {
|
|
50
|
+
...META,
|
|
51
|
+
key: "integration-hub.visualization.connection-status",
|
|
52
|
+
title: "Connection Status",
|
|
53
|
+
description: "Status distribution across configured connections.",
|
|
54
|
+
goal: "Highlight connection health and instability.",
|
|
55
|
+
context: "Connection monitoring."
|
|
56
|
+
},
|
|
57
|
+
source: { primary: CONNECTION_LIST_REF, resultPath: "data" },
|
|
58
|
+
visualization: {
|
|
59
|
+
kind: "cartesian",
|
|
60
|
+
variant: "bar",
|
|
61
|
+
xDimension: "status",
|
|
62
|
+
yMeasures: ["count"],
|
|
63
|
+
dimensions: [
|
|
64
|
+
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
65
|
+
],
|
|
66
|
+
measures: [
|
|
67
|
+
{
|
|
68
|
+
key: "count",
|
|
69
|
+
label: "Connections",
|
|
70
|
+
dataPath: "count",
|
|
71
|
+
format: "number",
|
|
72
|
+
color: "#1d4ed8"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
table: { caption: "Connection counts by status." }
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
var HealthySyncMetricVisualization = defineVisualization({
|
|
79
|
+
meta: {
|
|
80
|
+
...META,
|
|
81
|
+
key: "integration-hub.visualization.sync-healthy",
|
|
82
|
+
title: "Healthy Syncs",
|
|
83
|
+
description: "Sync configurations currently healthy or recently successful.",
|
|
84
|
+
goal: "Summarize healthy synchronization capacity.",
|
|
85
|
+
context: "Sync-state comparison."
|
|
86
|
+
},
|
|
87
|
+
source: { primary: SYNC_CONFIG_REF, resultPath: "data" },
|
|
88
|
+
visualization: {
|
|
89
|
+
kind: "metric",
|
|
90
|
+
measure: "value",
|
|
91
|
+
measures: [
|
|
92
|
+
{ key: "value", label: "Syncs", dataPath: "value", format: "number" }
|
|
93
|
+
],
|
|
94
|
+
table: { caption: "Healthy sync count." }
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
var AttentionSyncMetricVisualization = defineVisualization({
|
|
98
|
+
meta: {
|
|
99
|
+
...META,
|
|
100
|
+
key: "integration-hub.visualization.sync-attention",
|
|
101
|
+
title: "Attention Needed",
|
|
102
|
+
description: "Sync configurations paused, failing, or otherwise needing review.",
|
|
103
|
+
goal: "Summarize syncs needing action.",
|
|
104
|
+
context: "Sync-state comparison."
|
|
105
|
+
},
|
|
106
|
+
source: { primary: SYNC_CONFIG_REF, resultPath: "data" },
|
|
107
|
+
visualization: {
|
|
108
|
+
kind: "metric",
|
|
109
|
+
measure: "value",
|
|
110
|
+
measures: [
|
|
111
|
+
{ key: "value", label: "Syncs", dataPath: "value", format: "number" }
|
|
112
|
+
],
|
|
113
|
+
table: { caption: "Syncs requiring attention." }
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
var IntegrationVisualizationSpecs = [
|
|
117
|
+
IntegrationTypeVisualization,
|
|
118
|
+
ConnectionStatusVisualization,
|
|
119
|
+
HealthySyncMetricVisualization,
|
|
120
|
+
AttentionSyncMetricVisualization
|
|
121
|
+
];
|
|
122
|
+
var IntegrationVisualizationRegistry = new VisualizationRegistry([
|
|
123
|
+
...IntegrationVisualizationSpecs
|
|
124
|
+
]);
|
|
125
|
+
var IntegrationVisualizationRefs = IntegrationVisualizationSpecs.map((spec) => ({
|
|
126
|
+
key: spec.meta.key,
|
|
127
|
+
version: spec.meta.version
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
// src/visualizations/selectors.ts
|
|
131
|
+
function isHealthySync(status) {
|
|
132
|
+
return status === "ACTIVE" || status === "SUCCESS";
|
|
133
|
+
}
|
|
134
|
+
function createIntegrationVisualizationSections(integrations, connections, syncConfigs) {
|
|
135
|
+
const integrationTypes = new Map;
|
|
136
|
+
const connectionStatuses = new Map;
|
|
137
|
+
let healthySyncs = 0;
|
|
138
|
+
let attentionSyncs = 0;
|
|
139
|
+
for (const integration of integrations) {
|
|
140
|
+
integrationTypes.set(integration.type, (integrationTypes.get(integration.type) ?? 0) + 1);
|
|
141
|
+
}
|
|
142
|
+
for (const connection of connections) {
|
|
143
|
+
connectionStatuses.set(connection.status, (connectionStatuses.get(connection.status) ?? 0) + 1);
|
|
144
|
+
}
|
|
145
|
+
for (const syncConfig of syncConfigs) {
|
|
146
|
+
if (isHealthySync(syncConfig.status)) {
|
|
147
|
+
healthySyncs += 1;
|
|
148
|
+
} else {
|
|
149
|
+
attentionSyncs += 1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const primaryItems = [
|
|
153
|
+
{
|
|
154
|
+
key: "integration-types",
|
|
155
|
+
spec: IntegrationTypeVisualization,
|
|
156
|
+
data: {
|
|
157
|
+
data: Array.from(integrationTypes.entries()).map(([type, count]) => ({
|
|
158
|
+
type,
|
|
159
|
+
count
|
|
160
|
+
}))
|
|
161
|
+
},
|
|
162
|
+
title: "Integration Types",
|
|
163
|
+
description: "Configured integrations grouped by category.",
|
|
164
|
+
height: 260
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
key: "connection-status",
|
|
168
|
+
spec: ConnectionStatusVisualization,
|
|
169
|
+
data: {
|
|
170
|
+
data: Array.from(connectionStatuses.entries()).map(([status, count]) => ({
|
|
171
|
+
status,
|
|
172
|
+
count
|
|
173
|
+
}))
|
|
174
|
+
},
|
|
175
|
+
title: "Connection Status",
|
|
176
|
+
description: "Operational health across current connections."
|
|
177
|
+
}
|
|
178
|
+
];
|
|
179
|
+
const comparisonItems = [
|
|
180
|
+
{
|
|
181
|
+
key: "healthy-syncs",
|
|
182
|
+
spec: HealthySyncMetricVisualization,
|
|
183
|
+
data: { data: [{ value: healthySyncs }] },
|
|
184
|
+
title: "Healthy Syncs",
|
|
185
|
+
description: "Active or recently successful sync configurations.",
|
|
186
|
+
height: 200
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
key: "attention-syncs",
|
|
190
|
+
spec: AttentionSyncMetricVisualization,
|
|
191
|
+
data: { data: [{ value: attentionSyncs }] },
|
|
192
|
+
title: "Attention Needed",
|
|
193
|
+
description: "Paused, failed, or degraded sync configurations.",
|
|
194
|
+
height: 200
|
|
195
|
+
}
|
|
196
|
+
];
|
|
197
|
+
return {
|
|
198
|
+
primaryItems,
|
|
199
|
+
comparisonItems
|
|
200
|
+
};
|
|
201
|
+
}
|
|
1
202
|
// src/ui/renderers/integration.markdown.ts
|
|
2
203
|
var mockIntegrations = [
|
|
3
204
|
{
|
|
@@ -135,6 +336,7 @@ var integrationDashboardMarkdownRenderer = {
|
|
|
135
336
|
const integrations = mockIntegrations;
|
|
136
337
|
const connections = mockConnections;
|
|
137
338
|
const syncs = mockSyncConfigs;
|
|
339
|
+
const visualizations = createIntegrationVisualizationSections(integrations, connections, syncs);
|
|
138
340
|
const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
|
|
139
341
|
const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
|
|
140
342
|
const errorConnections = connections.filter((c) => c.status === "ERROR");
|
|
@@ -154,12 +356,21 @@ var integrationDashboardMarkdownRenderer = {
|
|
|
154
356
|
`| Error Connections | ${errorConnections.length} |`,
|
|
155
357
|
`| Sync Configs | ${syncs.length} |`,
|
|
156
358
|
`| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
|
|
157
|
-
""
|
|
158
|
-
"## Integrations",
|
|
159
|
-
"",
|
|
160
|
-
"| Name | Type | Connections | Status |",
|
|
161
|
-
"|------|------|-------------|--------|"
|
|
359
|
+
""
|
|
162
360
|
];
|
|
361
|
+
lines.push("## Visualization Overview");
|
|
362
|
+
lines.push("");
|
|
363
|
+
for (const item of [
|
|
364
|
+
...visualizations.primaryItems,
|
|
365
|
+
...visualizations.comparisonItems
|
|
366
|
+
]) {
|
|
367
|
+
lines.push(`- **${item.title}** via \`${item.spec.meta.key}\``);
|
|
368
|
+
}
|
|
369
|
+
lines.push("");
|
|
370
|
+
lines.push("## Integrations");
|
|
371
|
+
lines.push("");
|
|
372
|
+
lines.push("| Name | Type | Connections | Status |");
|
|
373
|
+
lines.push("|------|------|-------------|--------|");
|
|
163
374
|
for (const integration of integrations) {
|
|
164
375
|
const statusIcon = integration.status === "ACTIVE" ? "\uD83D\uDFE2" : "⚫";
|
|
165
376
|
lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
|
|
@@ -1,3 +1,204 @@
|
|
|
1
|
+
// src/visualizations/catalog.ts
|
|
2
|
+
import {
|
|
3
|
+
defineVisualization,
|
|
4
|
+
VisualizationRegistry
|
|
5
|
+
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
6
|
+
var INTEGRATION_LIST_REF = {
|
|
7
|
+
key: "integration.list",
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
};
|
|
10
|
+
var CONNECTION_LIST_REF = {
|
|
11
|
+
key: "integration.connection.list",
|
|
12
|
+
version: "1.0.0"
|
|
13
|
+
};
|
|
14
|
+
var SYNC_CONFIG_REF = {
|
|
15
|
+
key: "integration.syncConfig.list",
|
|
16
|
+
version: "1.0.0"
|
|
17
|
+
};
|
|
18
|
+
var META = {
|
|
19
|
+
version: "1.0.0",
|
|
20
|
+
domain: "integration",
|
|
21
|
+
stability: "experimental",
|
|
22
|
+
owners: ["@example.integration-hub"],
|
|
23
|
+
tags: ["integration", "visualization", "sync"]
|
|
24
|
+
};
|
|
25
|
+
var IntegrationTypeVisualization = defineVisualization({
|
|
26
|
+
meta: {
|
|
27
|
+
...META,
|
|
28
|
+
key: "integration-hub.visualization.integration-types",
|
|
29
|
+
title: "Integration Types",
|
|
30
|
+
description: "Distribution of configured integration categories.",
|
|
31
|
+
goal: "Show where integration coverage is concentrated.",
|
|
32
|
+
context: "Integration overview."
|
|
33
|
+
},
|
|
34
|
+
source: { primary: INTEGRATION_LIST_REF, resultPath: "data" },
|
|
35
|
+
visualization: {
|
|
36
|
+
kind: "pie",
|
|
37
|
+
nameDimension: "type",
|
|
38
|
+
valueMeasure: "count",
|
|
39
|
+
dimensions: [
|
|
40
|
+
{ key: "type", label: "Type", dataPath: "type", type: "category" }
|
|
41
|
+
],
|
|
42
|
+
measures: [
|
|
43
|
+
{ key: "count", label: "Count", dataPath: "count", format: "number" }
|
|
44
|
+
],
|
|
45
|
+
table: { caption: "Integration counts by type." }
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var ConnectionStatusVisualization = defineVisualization({
|
|
49
|
+
meta: {
|
|
50
|
+
...META,
|
|
51
|
+
key: "integration-hub.visualization.connection-status",
|
|
52
|
+
title: "Connection Status",
|
|
53
|
+
description: "Status distribution across configured connections.",
|
|
54
|
+
goal: "Highlight connection health and instability.",
|
|
55
|
+
context: "Connection monitoring."
|
|
56
|
+
},
|
|
57
|
+
source: { primary: CONNECTION_LIST_REF, resultPath: "data" },
|
|
58
|
+
visualization: {
|
|
59
|
+
kind: "cartesian",
|
|
60
|
+
variant: "bar",
|
|
61
|
+
xDimension: "status",
|
|
62
|
+
yMeasures: ["count"],
|
|
63
|
+
dimensions: [
|
|
64
|
+
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
65
|
+
],
|
|
66
|
+
measures: [
|
|
67
|
+
{
|
|
68
|
+
key: "count",
|
|
69
|
+
label: "Connections",
|
|
70
|
+
dataPath: "count",
|
|
71
|
+
format: "number",
|
|
72
|
+
color: "#1d4ed8"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
table: { caption: "Connection counts by status." }
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
var HealthySyncMetricVisualization = defineVisualization({
|
|
79
|
+
meta: {
|
|
80
|
+
...META,
|
|
81
|
+
key: "integration-hub.visualization.sync-healthy",
|
|
82
|
+
title: "Healthy Syncs",
|
|
83
|
+
description: "Sync configurations currently healthy or recently successful.",
|
|
84
|
+
goal: "Summarize healthy synchronization capacity.",
|
|
85
|
+
context: "Sync-state comparison."
|
|
86
|
+
},
|
|
87
|
+
source: { primary: SYNC_CONFIG_REF, resultPath: "data" },
|
|
88
|
+
visualization: {
|
|
89
|
+
kind: "metric",
|
|
90
|
+
measure: "value",
|
|
91
|
+
measures: [
|
|
92
|
+
{ key: "value", label: "Syncs", dataPath: "value", format: "number" }
|
|
93
|
+
],
|
|
94
|
+
table: { caption: "Healthy sync count." }
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
var AttentionSyncMetricVisualization = defineVisualization({
|
|
98
|
+
meta: {
|
|
99
|
+
...META,
|
|
100
|
+
key: "integration-hub.visualization.sync-attention",
|
|
101
|
+
title: "Attention Needed",
|
|
102
|
+
description: "Sync configurations paused, failing, or otherwise needing review.",
|
|
103
|
+
goal: "Summarize syncs needing action.",
|
|
104
|
+
context: "Sync-state comparison."
|
|
105
|
+
},
|
|
106
|
+
source: { primary: SYNC_CONFIG_REF, resultPath: "data" },
|
|
107
|
+
visualization: {
|
|
108
|
+
kind: "metric",
|
|
109
|
+
measure: "value",
|
|
110
|
+
measures: [
|
|
111
|
+
{ key: "value", label: "Syncs", dataPath: "value", format: "number" }
|
|
112
|
+
],
|
|
113
|
+
table: { caption: "Syncs requiring attention." }
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
var IntegrationVisualizationSpecs = [
|
|
117
|
+
IntegrationTypeVisualization,
|
|
118
|
+
ConnectionStatusVisualization,
|
|
119
|
+
HealthySyncMetricVisualization,
|
|
120
|
+
AttentionSyncMetricVisualization
|
|
121
|
+
];
|
|
122
|
+
var IntegrationVisualizationRegistry = new VisualizationRegistry([
|
|
123
|
+
...IntegrationVisualizationSpecs
|
|
124
|
+
]);
|
|
125
|
+
var IntegrationVisualizationRefs = IntegrationVisualizationSpecs.map((spec) => ({
|
|
126
|
+
key: spec.meta.key,
|
|
127
|
+
version: spec.meta.version
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
// src/visualizations/selectors.ts
|
|
131
|
+
function isHealthySync(status) {
|
|
132
|
+
return status === "ACTIVE" || status === "SUCCESS";
|
|
133
|
+
}
|
|
134
|
+
function createIntegrationVisualizationSections(integrations, connections, syncConfigs) {
|
|
135
|
+
const integrationTypes = new Map;
|
|
136
|
+
const connectionStatuses = new Map;
|
|
137
|
+
let healthySyncs = 0;
|
|
138
|
+
let attentionSyncs = 0;
|
|
139
|
+
for (const integration of integrations) {
|
|
140
|
+
integrationTypes.set(integration.type, (integrationTypes.get(integration.type) ?? 0) + 1);
|
|
141
|
+
}
|
|
142
|
+
for (const connection of connections) {
|
|
143
|
+
connectionStatuses.set(connection.status, (connectionStatuses.get(connection.status) ?? 0) + 1);
|
|
144
|
+
}
|
|
145
|
+
for (const syncConfig of syncConfigs) {
|
|
146
|
+
if (isHealthySync(syncConfig.status)) {
|
|
147
|
+
healthySyncs += 1;
|
|
148
|
+
} else {
|
|
149
|
+
attentionSyncs += 1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const primaryItems = [
|
|
153
|
+
{
|
|
154
|
+
key: "integration-types",
|
|
155
|
+
spec: IntegrationTypeVisualization,
|
|
156
|
+
data: {
|
|
157
|
+
data: Array.from(integrationTypes.entries()).map(([type, count]) => ({
|
|
158
|
+
type,
|
|
159
|
+
count
|
|
160
|
+
}))
|
|
161
|
+
},
|
|
162
|
+
title: "Integration Types",
|
|
163
|
+
description: "Configured integrations grouped by category.",
|
|
164
|
+
height: 260
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
key: "connection-status",
|
|
168
|
+
spec: ConnectionStatusVisualization,
|
|
169
|
+
data: {
|
|
170
|
+
data: Array.from(connectionStatuses.entries()).map(([status, count]) => ({
|
|
171
|
+
status,
|
|
172
|
+
count
|
|
173
|
+
}))
|
|
174
|
+
},
|
|
175
|
+
title: "Connection Status",
|
|
176
|
+
description: "Operational health across current connections."
|
|
177
|
+
}
|
|
178
|
+
];
|
|
179
|
+
const comparisonItems = [
|
|
180
|
+
{
|
|
181
|
+
key: "healthy-syncs",
|
|
182
|
+
spec: HealthySyncMetricVisualization,
|
|
183
|
+
data: { data: [{ value: healthySyncs }] },
|
|
184
|
+
title: "Healthy Syncs",
|
|
185
|
+
description: "Active or recently successful sync configurations.",
|
|
186
|
+
height: 200
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
key: "attention-syncs",
|
|
190
|
+
spec: AttentionSyncMetricVisualization,
|
|
191
|
+
data: { data: [{ value: attentionSyncs }] },
|
|
192
|
+
title: "Attention Needed",
|
|
193
|
+
description: "Paused, failed, or degraded sync configurations.",
|
|
194
|
+
height: 200
|
|
195
|
+
}
|
|
196
|
+
];
|
|
197
|
+
return {
|
|
198
|
+
primaryItems,
|
|
199
|
+
comparisonItems
|
|
200
|
+
};
|
|
201
|
+
}
|
|
1
202
|
// src/ui/renderers/integration.markdown.ts
|
|
2
203
|
var mockIntegrations = [
|
|
3
204
|
{
|
|
@@ -135,6 +336,7 @@ var integrationDashboardMarkdownRenderer = {
|
|
|
135
336
|
const integrations = mockIntegrations;
|
|
136
337
|
const connections = mockConnections;
|
|
137
338
|
const syncs = mockSyncConfigs;
|
|
339
|
+
const visualizations = createIntegrationVisualizationSections(integrations, connections, syncs);
|
|
138
340
|
const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
|
|
139
341
|
const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
|
|
140
342
|
const errorConnections = connections.filter((c) => c.status === "ERROR");
|
|
@@ -154,12 +356,21 @@ var integrationDashboardMarkdownRenderer = {
|
|
|
154
356
|
`| Error Connections | ${errorConnections.length} |`,
|
|
155
357
|
`| Sync Configs | ${syncs.length} |`,
|
|
156
358
|
`| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
|
|
157
|
-
""
|
|
158
|
-
"## Integrations",
|
|
159
|
-
"",
|
|
160
|
-
"| Name | Type | Connections | Status |",
|
|
161
|
-
"|------|------|-------------|--------|"
|
|
359
|
+
""
|
|
162
360
|
];
|
|
361
|
+
lines.push("## Visualization Overview");
|
|
362
|
+
lines.push("");
|
|
363
|
+
for (const item of [
|
|
364
|
+
...visualizations.primaryItems,
|
|
365
|
+
...visualizations.comparisonItems
|
|
366
|
+
]) {
|
|
367
|
+
lines.push(`- **${item.title}** via \`${item.spec.meta.key}\``);
|
|
368
|
+
}
|
|
369
|
+
lines.push("");
|
|
370
|
+
lines.push("## Integrations");
|
|
371
|
+
lines.push("");
|
|
372
|
+
lines.push("| Name | Type | Connections | Status |");
|
|
373
|
+
lines.push("|------|------|-------------|--------|");
|
|
163
374
|
for (const integration of integrations) {
|
|
164
375
|
const statusIcon = integration.status === "ACTIVE" ? "\uD83D\uDFE2" : "⚫";
|
|
165
376
|
lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// src/ui/tables/integration-table.shared.tsx
|
|
2
|
+
import { Button } from "@contractspec/lib.design-system";
|
|
3
|
+
import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
|
|
4
|
+
import { HStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
5
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
6
|
+
"use client";
|
|
7
|
+
var STATUS_VARIANTS = {
|
|
8
|
+
ACTIVE: "default",
|
|
9
|
+
CONNECTED: "default",
|
|
10
|
+
SUCCESS: "default",
|
|
11
|
+
PENDING: "secondary",
|
|
12
|
+
PAUSED: "secondary",
|
|
13
|
+
ERROR: "destructive",
|
|
14
|
+
DISCONNECTED: "outline"
|
|
15
|
+
};
|
|
16
|
+
function formatDateTime(value) {
|
|
17
|
+
return value ? value.toLocaleString() : "Never";
|
|
18
|
+
}
|
|
19
|
+
function formatJson(value) {
|
|
20
|
+
return value ? JSON.stringify(value, null, 2) : "No configuration";
|
|
21
|
+
}
|
|
22
|
+
function StatusBadge({ status }) {
|
|
23
|
+
return /* @__PURE__ */ jsxDEV(Badge, {
|
|
24
|
+
variant: STATUS_VARIANTS[status] ?? "outline",
|
|
25
|
+
children: status
|
|
26
|
+
}, undefined, false, undefined, this);
|
|
27
|
+
}
|
|
28
|
+
function IntegrationTableToolbar({
|
|
29
|
+
controller,
|
|
30
|
+
label,
|
|
31
|
+
toggleColumnId,
|
|
32
|
+
toggleVisibleLabel,
|
|
33
|
+
toggleHiddenLabel,
|
|
34
|
+
pinColumnId,
|
|
35
|
+
pinLabel,
|
|
36
|
+
resizeColumnId,
|
|
37
|
+
resizeLabel
|
|
38
|
+
}) {
|
|
39
|
+
const firstRow = controller.rows[0];
|
|
40
|
+
const toggleColumn = controller.columns.find((column) => column.id === toggleColumnId);
|
|
41
|
+
const pinColumn = controller.columns.find((column) => column.id === pinColumnId);
|
|
42
|
+
const resizeColumn = controller.columns.find((column) => column.id === resizeColumnId);
|
|
43
|
+
const pinTarget = pinColumn?.pinState === "left" ? false : "left";
|
|
44
|
+
return /* @__PURE__ */ jsxDEV(HStack, {
|
|
45
|
+
gap: "sm",
|
|
46
|
+
className: "flex-wrap",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsxDEV(Badge, {
|
|
49
|
+
variant: "outline",
|
|
50
|
+
children: label
|
|
51
|
+
}, undefined, false, undefined, this),
|
|
52
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
53
|
+
variant: "outline",
|
|
54
|
+
size: "sm",
|
|
55
|
+
onPress: () => firstRow?.toggleExpanded?.(!firstRow?.isExpanded),
|
|
56
|
+
children: "Expand First Row"
|
|
57
|
+
}, undefined, false, undefined, this),
|
|
58
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
59
|
+
variant: "outline",
|
|
60
|
+
size: "sm",
|
|
61
|
+
onPress: () => toggleColumn?.toggleVisibility?.(!toggleColumn?.visible),
|
|
62
|
+
children: toggleColumn?.visible ? toggleVisibleLabel : toggleHiddenLabel
|
|
63
|
+
}, undefined, false, undefined, this),
|
|
64
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
65
|
+
variant: "outline",
|
|
66
|
+
size: "sm",
|
|
67
|
+
onPress: () => pinColumn?.pin?.(pinTarget),
|
|
68
|
+
children: pinColumn?.pinState === "left" ? `Unpin ${pinLabel}` : `Pin ${pinLabel}`
|
|
69
|
+
}, undefined, false, undefined, this),
|
|
70
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
71
|
+
variant: "outline",
|
|
72
|
+
size: "sm",
|
|
73
|
+
onPress: () => resizeColumn?.resizeBy?.(40),
|
|
74
|
+
children: resizeLabel
|
|
75
|
+
}, undefined, false, undefined, this)
|
|
76
|
+
]
|
|
77
|
+
}, undefined, true, undefined, this);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/ui/tables/ConnectionsTable.tsx
|
|
81
|
+
import { DataTable } from "@contractspec/lib.design-system";
|
|
82
|
+
import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
|
|
83
|
+
import { VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
84
|
+
import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
|
|
85
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
86
|
+
"use client";
|
|
87
|
+
function ConnectionsTable({
|
|
88
|
+
connections
|
|
89
|
+
}) {
|
|
90
|
+
const controller = useContractTable({
|
|
91
|
+
data: connections,
|
|
92
|
+
columns: [
|
|
93
|
+
{
|
|
94
|
+
id: "connection",
|
|
95
|
+
header: "Connection",
|
|
96
|
+
label: "Connection",
|
|
97
|
+
accessor: (connection) => connection.name,
|
|
98
|
+
cell: ({ item }) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
99
|
+
gap: "xs",
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
102
|
+
className: "font-medium text-sm",
|
|
103
|
+
children: item.name
|
|
104
|
+
}, undefined, false, undefined, this),
|
|
105
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
106
|
+
className: "text-muted-foreground text-xs",
|
|
107
|
+
children: [
|
|
108
|
+
"Created ",
|
|
109
|
+
item.createdAt.toLocaleDateString()
|
|
110
|
+
]
|
|
111
|
+
}, undefined, true, undefined, this)
|
|
112
|
+
]
|
|
113
|
+
}, undefined, true, undefined, this),
|
|
114
|
+
size: 240,
|
|
115
|
+
minSize: 180,
|
|
116
|
+
canSort: true,
|
|
117
|
+
canPin: true,
|
|
118
|
+
canResize: true
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "status",
|
|
122
|
+
header: "Status",
|
|
123
|
+
label: "Status",
|
|
124
|
+
accessorKey: "status",
|
|
125
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(StatusBadge, {
|
|
126
|
+
status: String(value)
|
|
127
|
+
}, undefined, false, undefined, this),
|
|
128
|
+
size: 150,
|
|
129
|
+
canSort: true,
|
|
130
|
+
canPin: true,
|
|
131
|
+
canResize: true
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: "lastSyncAt",
|
|
135
|
+
header: "Last Sync",
|
|
136
|
+
label: "Last Sync",
|
|
137
|
+
accessor: (connection) => connection.lastSyncAt?.getTime() ?? 0,
|
|
138
|
+
cell: ({ item }) => formatDateTime(item.lastSyncAt),
|
|
139
|
+
size: 200,
|
|
140
|
+
canSort: true,
|
|
141
|
+
canHide: true,
|
|
142
|
+
canResize: true
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: "errorMessage",
|
|
146
|
+
header: "Errors",
|
|
147
|
+
label: "Errors",
|
|
148
|
+
accessor: (connection) => connection.errorMessage ?? "",
|
|
149
|
+
cell: ({ value }) => String(value || "No errors"),
|
|
150
|
+
size: 240,
|
|
151
|
+
canHide: true,
|
|
152
|
+
canResize: true
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
initialState: {
|
|
156
|
+
pagination: { pageIndex: 0, pageSize: 3 },
|
|
157
|
+
columnVisibility: { errorMessage: false },
|
|
158
|
+
columnPinning: { left: ["connection"], right: [] }
|
|
159
|
+
},
|
|
160
|
+
renderExpandedContent: (connection) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
161
|
+
gap: "sm",
|
|
162
|
+
className: "py-2",
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
165
|
+
className: "font-medium text-sm",
|
|
166
|
+
children: "Credentials"
|
|
167
|
+
}, undefined, false, undefined, this),
|
|
168
|
+
/* @__PURE__ */ jsxDEV2("pre", {
|
|
169
|
+
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
170
|
+
children: formatJson(connection.credentials)
|
|
171
|
+
}, undefined, false, undefined, this),
|
|
172
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
173
|
+
className: "font-medium text-sm",
|
|
174
|
+
children: "Config"
|
|
175
|
+
}, undefined, false, undefined, this),
|
|
176
|
+
/* @__PURE__ */ jsxDEV2("pre", {
|
|
177
|
+
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
178
|
+
children: formatJson(connection.config)
|
|
179
|
+
}, undefined, false, undefined, this),
|
|
180
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
181
|
+
className: "text-muted-foreground text-sm",
|
|
182
|
+
children: connection.errorMessage ?? "No sync errors recorded."
|
|
183
|
+
}, undefined, false, undefined, this)
|
|
184
|
+
]
|
|
185
|
+
}, undefined, true, undefined, this),
|
|
186
|
+
getCanExpand: () => true
|
|
187
|
+
});
|
|
188
|
+
return /* @__PURE__ */ jsxDEV2(DataTable, {
|
|
189
|
+
controller,
|
|
190
|
+
title: "Connections",
|
|
191
|
+
description: "Client-mode ContractSpec table with visibility, pinning, resizing, and expanded diagnostics.",
|
|
192
|
+
toolbar: /* @__PURE__ */ jsxDEV2(IntegrationTableToolbar, {
|
|
193
|
+
controller,
|
|
194
|
+
label: `${connections.length} total connections`,
|
|
195
|
+
toggleColumnId: "errorMessage",
|
|
196
|
+
toggleVisibleLabel: "Hide Error Column",
|
|
197
|
+
toggleHiddenLabel: "Show Error Column",
|
|
198
|
+
pinColumnId: "status",
|
|
199
|
+
pinLabel: "Status",
|
|
200
|
+
resizeColumnId: "connection",
|
|
201
|
+
resizeLabel: "Widen Connection"
|
|
202
|
+
}, undefined, false, undefined, this),
|
|
203
|
+
emptyState: /* @__PURE__ */ jsxDEV2("div", {
|
|
204
|
+
className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
|
|
205
|
+
children: "No connections found"
|
|
206
|
+
}, undefined, false, undefined, this)
|
|
207
|
+
}, undefined, false, undefined, this);
|
|
208
|
+
}
|
|
209
|
+
export {
|
|
210
|
+
ConnectionsTable
|
|
211
|
+
};
|