@contractspec/example.integration-hub 1.46.1 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connection/connection.enum.d.ts +2 -2
- package/dist/connection/connection.operation.d.ts +27 -27
- package/dist/connection/connection.operation.d.ts.map +1 -1
- package/dist/connection/connection.presentation.d.ts +3 -3
- package/dist/connection/connection.presentation.d.ts.map +1 -1
- package/dist/connection/connection.presentation.js +5 -5
- package/dist/connection/connection.presentation.js.map +1 -1
- package/dist/connection/connection.schema.d.ts +16 -16
- package/dist/example.d.ts +2 -2
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +4 -2
- package/dist/example.js.map +1 -1
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.js +3 -0
- package/dist/handlers/integration.handlers.d.ts +130 -0
- package/dist/handlers/integration.handlers.d.ts.map +1 -0
- package/dist/handlers/integration.handlers.js +282 -0
- package/dist/handlers/integration.handlers.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/integration/integration.operations.d.ts +25 -25
- package/dist/integration/integration.operations.d.ts.map +1 -1
- package/dist/integration/integration.presentation.d.ts +4 -4
- package/dist/integration/integration.presentation.d.ts.map +1 -1
- package/dist/integration/integration.presentation.js +7 -7
- package/dist/integration/integration.presentation.js.map +1 -1
- package/dist/integration/integration.schema.d.ts +16 -16
- package/dist/integration/integration.schema.d.ts.map +1 -1
- package/dist/integration-hub.capability.d.ts +9 -0
- package/dist/integration-hub.capability.d.ts.map +1 -0
- package/dist/integration-hub.capability.js +38 -0
- package/dist/integration-hub.capability.js.map +1 -0
- package/dist/integration-hub.feature.d.ts +2 -3
- package/dist/integration-hub.feature.d.ts.map +1 -1
- package/dist/integration-hub.feature.js +7 -2
- package/dist/integration-hub.feature.js.map +1 -1
- package/dist/seeders/index.d.ts +10 -0
- package/dist/seeders/index.d.ts.map +1 -0
- package/dist/seeders/index.js +19 -0
- package/dist/seeders/index.js.map +1 -0
- package/dist/sync/sync.operations.d.ts +5 -5
- package/dist/sync/sync.presentation.d.ts +7 -7
- package/dist/sync/sync.presentation.d.ts.map +1 -1
- package/dist/sync/sync.presentation.js +13 -13
- package/dist/sync/sync.presentation.js.map +1 -1
- package/dist/sync-engine/index.js.map +1 -1
- package/dist/tests/operations.test-spec.d.ts +9 -0
- package/dist/tests/operations.test-spec.d.ts.map +1 -0
- package/dist/tests/operations.test-spec.js +94 -0
- package/dist/tests/operations.test-spec.js.map +1 -0
- package/dist/ui/IntegrationDashboard.d.ts +7 -0
- package/dist/ui/IntegrationDashboard.d.ts.map +1 -0
- package/dist/ui/IntegrationDashboard.js +266 -0
- package/dist/ui/IntegrationDashboard.js.map +1 -0
- package/dist/ui/hooks/index.d.ts +2 -0
- package/dist/ui/hooks/index.js +5 -0
- package/dist/ui/hooks/useIntegrationData.d.ts +23 -0
- package/dist/ui/hooks/useIntegrationData.d.ts.map +1 -0
- package/dist/ui/hooks/useIntegrationData.js +59 -0
- package/dist/ui/hooks/useIntegrationData.js.map +1 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/renderers/index.d.ts +2 -0
- package/dist/ui/renderers/index.js +3 -0
- package/dist/ui/renderers/integration.markdown.d.ts +28 -0
- package/dist/ui/renderers/integration.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/integration.markdown.js +256 -0
- package/dist/ui/renderers/integration.markdown.js.map +1 -0
- package/package.json +24 -8
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
//#region src/ui/renderers/integration.markdown.ts
|
|
2
|
+
const mockIntegrations = [
|
|
3
|
+
{
|
|
4
|
+
id: "int-1",
|
|
5
|
+
name: "Salesforce",
|
|
6
|
+
type: "CRM",
|
|
7
|
+
status: "ACTIVE",
|
|
8
|
+
connectionCount: 3
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: "int-2",
|
|
12
|
+
name: "HubSpot",
|
|
13
|
+
type: "MARKETING",
|
|
14
|
+
status: "ACTIVE",
|
|
15
|
+
connectionCount: 2
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "int-3",
|
|
19
|
+
name: "Stripe",
|
|
20
|
+
type: "PAYMENT",
|
|
21
|
+
status: "ACTIVE",
|
|
22
|
+
connectionCount: 1
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "int-4",
|
|
26
|
+
name: "Slack",
|
|
27
|
+
type: "COMMUNICATION",
|
|
28
|
+
status: "INACTIVE",
|
|
29
|
+
connectionCount: 0
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "int-5",
|
|
33
|
+
name: "Google Sheets",
|
|
34
|
+
type: "DATA",
|
|
35
|
+
status: "ACTIVE",
|
|
36
|
+
connectionCount: 5
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
const mockConnections = [
|
|
40
|
+
{
|
|
41
|
+
id: "conn-1",
|
|
42
|
+
integrationId: "int-1",
|
|
43
|
+
name: "Production Salesforce",
|
|
44
|
+
status: "CONNECTED",
|
|
45
|
+
lastSyncAt: "2024-01-16T10:00:00Z"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "conn-2",
|
|
49
|
+
integrationId: "int-1",
|
|
50
|
+
name: "Sandbox Salesforce",
|
|
51
|
+
status: "CONNECTED",
|
|
52
|
+
lastSyncAt: "2024-01-15T14:00:00Z"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "conn-3",
|
|
56
|
+
integrationId: "int-2",
|
|
57
|
+
name: "Marketing HubSpot",
|
|
58
|
+
status: "CONNECTED",
|
|
59
|
+
lastSyncAt: "2024-01-16T08:00:00Z"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "conn-4",
|
|
63
|
+
integrationId: "int-3",
|
|
64
|
+
name: "Stripe Live",
|
|
65
|
+
status: "CONNECTED",
|
|
66
|
+
lastSyncAt: "2024-01-16T12:00:00Z"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "conn-5",
|
|
70
|
+
integrationId: "int-5",
|
|
71
|
+
name: "Analytics Sheet",
|
|
72
|
+
status: "ERROR",
|
|
73
|
+
lastSyncAt: "2024-01-14T09:00:00Z",
|
|
74
|
+
error: "Authentication expired"
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
const mockSyncConfigs = [
|
|
78
|
+
{
|
|
79
|
+
id: "sync-1",
|
|
80
|
+
connectionId: "conn-1",
|
|
81
|
+
name: "Contacts Sync",
|
|
82
|
+
frequency: "HOURLY",
|
|
83
|
+
lastRunAt: "2024-01-16T10:00:00Z",
|
|
84
|
+
status: "SUCCESS",
|
|
85
|
+
recordsSynced: 1250
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "sync-2",
|
|
89
|
+
connectionId: "conn-1",
|
|
90
|
+
name: "Opportunities Sync",
|
|
91
|
+
frequency: "DAILY",
|
|
92
|
+
lastRunAt: "2024-01-16T00:00:00Z",
|
|
93
|
+
status: "SUCCESS",
|
|
94
|
+
recordsSynced: 340
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "sync-3",
|
|
98
|
+
connectionId: "conn-3",
|
|
99
|
+
name: "Orders Sync",
|
|
100
|
+
frequency: "REALTIME",
|
|
101
|
+
lastRunAt: "2024-01-16T12:30:00Z",
|
|
102
|
+
status: "SUCCESS",
|
|
103
|
+
recordsSynced: 89
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "sync-4",
|
|
107
|
+
connectionId: "conn-5",
|
|
108
|
+
name: "Metrics Export",
|
|
109
|
+
frequency: "DAILY",
|
|
110
|
+
lastRunAt: "2024-01-14T09:00:00Z",
|
|
111
|
+
status: "FAILED",
|
|
112
|
+
recordsSynced: 0
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
/**
|
|
116
|
+
* Markdown renderer for Integration Dashboard
|
|
117
|
+
*/
|
|
118
|
+
const integrationDashboardMarkdownRenderer = {
|
|
119
|
+
target: "markdown",
|
|
120
|
+
render: async (desc) => {
|
|
121
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "IntegrationDashboard") throw new Error("integrationDashboardMarkdownRenderer: not IntegrationDashboard");
|
|
122
|
+
const integrations = mockIntegrations;
|
|
123
|
+
const connections = mockConnections;
|
|
124
|
+
const syncs = mockSyncConfigs;
|
|
125
|
+
const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
|
|
126
|
+
const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
|
|
127
|
+
const errorConnections = connections.filter((c) => c.status === "ERROR");
|
|
128
|
+
const totalRecordsSynced = syncs.filter((s) => s.status === "SUCCESS").reduce((sum, s) => sum + s.recordsSynced, 0);
|
|
129
|
+
const lines = [
|
|
130
|
+
"# Integration Hub",
|
|
131
|
+
"",
|
|
132
|
+
"> Connect and sync data with external services",
|
|
133
|
+
"",
|
|
134
|
+
"## Overview",
|
|
135
|
+
"",
|
|
136
|
+
"| Metric | Value |",
|
|
137
|
+
"|--------|-------|",
|
|
138
|
+
`| Active Integrations | ${activeIntegrations.length} |`,
|
|
139
|
+
`| Connected Services | ${connectedConnections.length} |`,
|
|
140
|
+
`| Error Connections | ${errorConnections.length} |`,
|
|
141
|
+
`| Sync Configs | ${syncs.length} |`,
|
|
142
|
+
`| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
|
|
143
|
+
"",
|
|
144
|
+
"## Integrations",
|
|
145
|
+
"",
|
|
146
|
+
"| Name | Type | Connections | Status |",
|
|
147
|
+
"|------|------|-------------|--------|"
|
|
148
|
+
];
|
|
149
|
+
for (const integration of integrations) {
|
|
150
|
+
const statusIcon = integration.status === "ACTIVE" ? "🟢" : "⚫";
|
|
151
|
+
lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
|
|
152
|
+
}
|
|
153
|
+
lines.push("");
|
|
154
|
+
lines.push("## Recent Sync Activity");
|
|
155
|
+
lines.push("");
|
|
156
|
+
lines.push("| Sync | Frequency | Last Run | Records | Status |");
|
|
157
|
+
lines.push("|------|-----------|----------|---------|--------|");
|
|
158
|
+
for (const sync of syncs) {
|
|
159
|
+
const lastRun = new Date(sync.lastRunAt).toLocaleString();
|
|
160
|
+
const statusIcon = sync.status === "SUCCESS" ? "✅" : "❌";
|
|
161
|
+
lines.push(`| ${sync.name} | ${sync.frequency} | ${lastRun} | ${sync.recordsSynced} | ${statusIcon} ${sync.status} |`);
|
|
162
|
+
}
|
|
163
|
+
if (errorConnections.length > 0) {
|
|
164
|
+
lines.push("");
|
|
165
|
+
lines.push("## ⚠️ Connections with Errors");
|
|
166
|
+
lines.push("");
|
|
167
|
+
for (const conn of errorConnections) {
|
|
168
|
+
const integration = integrations.find((i) => i.id === conn.integrationId);
|
|
169
|
+
lines.push(`- **${conn.name}** (${integration?.name ?? "Unknown"}): ${conn.error ?? "Unknown error"}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
mimeType: "text/markdown",
|
|
174
|
+
body: lines.join("\n")
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Markdown renderer for Connection List
|
|
180
|
+
*/
|
|
181
|
+
const connectionListMarkdownRenderer = {
|
|
182
|
+
target: "markdown",
|
|
183
|
+
render: async (desc) => {
|
|
184
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "ConnectionList") throw new Error("connectionListMarkdownRenderer: not ConnectionList");
|
|
185
|
+
const connections = mockConnections;
|
|
186
|
+
const integrations = mockIntegrations;
|
|
187
|
+
const lines = [
|
|
188
|
+
"# Connections",
|
|
189
|
+
"",
|
|
190
|
+
"> Manage connections to external services",
|
|
191
|
+
""
|
|
192
|
+
];
|
|
193
|
+
for (const integration of integrations) {
|
|
194
|
+
const intConnections = connections.filter((c) => c.integrationId === integration.id);
|
|
195
|
+
if (intConnections.length === 0) continue;
|
|
196
|
+
lines.push(`## ${integration.name}`);
|
|
197
|
+
lines.push("");
|
|
198
|
+
lines.push("| Connection | Status | Last Sync |");
|
|
199
|
+
lines.push("|------------|--------|-----------|");
|
|
200
|
+
for (const conn of intConnections) {
|
|
201
|
+
const lastSync = new Date(conn.lastSyncAt).toLocaleString();
|
|
202
|
+
const statusIcon = conn.status === "CONNECTED" ? "🟢" : conn.status === "ERROR" ? "🔴" : "⚫";
|
|
203
|
+
lines.push(`| ${conn.name} | ${statusIcon} ${conn.status} | ${lastSync} |`);
|
|
204
|
+
}
|
|
205
|
+
lines.push("");
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
mimeType: "text/markdown",
|
|
209
|
+
body: lines.join("\n")
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Markdown renderer for Sync Config
|
|
215
|
+
*/
|
|
216
|
+
const syncConfigMarkdownRenderer = {
|
|
217
|
+
target: "markdown",
|
|
218
|
+
render: async (desc) => {
|
|
219
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "SyncConfigEditor") throw new Error("syncConfigMarkdownRenderer: not SyncConfigEditor");
|
|
220
|
+
const syncs = mockSyncConfigs;
|
|
221
|
+
const connections = mockConnections;
|
|
222
|
+
const lines = [
|
|
223
|
+
"# Sync Configurations",
|
|
224
|
+
"",
|
|
225
|
+
"> Configure automated data synchronization",
|
|
226
|
+
""
|
|
227
|
+
];
|
|
228
|
+
for (const sync of syncs) {
|
|
229
|
+
const connection = connections.find((c) => c.id === sync.connectionId);
|
|
230
|
+
const statusIcon = sync.status === "SUCCESS" ? "✅" : "❌";
|
|
231
|
+
lines.push(`## ${sync.name}`);
|
|
232
|
+
lines.push("");
|
|
233
|
+
lines.push(`**Connection:** ${connection?.name ?? "Unknown"}`);
|
|
234
|
+
lines.push(`**Frequency:** ${sync.frequency}`);
|
|
235
|
+
lines.push(`**Status:** ${statusIcon} ${sync.status}`);
|
|
236
|
+
lines.push(`**Last Run:** ${new Date(sync.lastRunAt).toLocaleString()}`);
|
|
237
|
+
lines.push(`**Records Synced:** ${sync.recordsSynced.toLocaleString()}`);
|
|
238
|
+
lines.push("");
|
|
239
|
+
}
|
|
240
|
+
lines.push("## Frequency Options");
|
|
241
|
+
lines.push("");
|
|
242
|
+
lines.push("- **REALTIME**: Sync on every change");
|
|
243
|
+
lines.push("- **HOURLY**: Sync every hour");
|
|
244
|
+
lines.push("- **DAILY**: Sync once per day");
|
|
245
|
+
lines.push("- **WEEKLY**: Sync once per week");
|
|
246
|
+
lines.push("- **MANUAL**: Sync only when triggered");
|
|
247
|
+
return {
|
|
248
|
+
mimeType: "text/markdown",
|
|
249
|
+
body: lines.join("\n")
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
//#endregion
|
|
255
|
+
export { connectionListMarkdownRenderer, integrationDashboardMarkdownRenderer, syncConfigMarkdownRenderer };
|
|
256
|
+
//# sourceMappingURL=integration.markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.markdown.js","names":[],"sources":["../../../src/ui/renderers/integration.markdown.ts"],"sourcesContent":["/**\n * Markdown renderers for Integration Hub presentations\n */\nimport type { PresentationRenderer } from '@contractspec/lib.contracts';\n\n// Mock data for integration rendering\nconst mockIntegrations = [\n {\n id: 'int-1',\n name: 'Salesforce',\n type: 'CRM',\n status: 'ACTIVE',\n connectionCount: 3,\n },\n {\n id: 'int-2',\n name: 'HubSpot',\n type: 'MARKETING',\n status: 'ACTIVE',\n connectionCount: 2,\n },\n {\n id: 'int-3',\n name: 'Stripe',\n type: 'PAYMENT',\n status: 'ACTIVE',\n connectionCount: 1,\n },\n {\n id: 'int-4',\n name: 'Slack',\n type: 'COMMUNICATION',\n status: 'INACTIVE',\n connectionCount: 0,\n },\n {\n id: 'int-5',\n name: 'Google Sheets',\n type: 'DATA',\n status: 'ACTIVE',\n connectionCount: 5,\n },\n];\n\nconst mockConnections = [\n {\n id: 'conn-1',\n integrationId: 'int-1',\n name: 'Production Salesforce',\n status: 'CONNECTED',\n lastSyncAt: '2024-01-16T10:00:00Z',\n },\n {\n id: 'conn-2',\n integrationId: 'int-1',\n name: 'Sandbox Salesforce',\n status: 'CONNECTED',\n lastSyncAt: '2024-01-15T14:00:00Z',\n },\n {\n id: 'conn-3',\n integrationId: 'int-2',\n name: 'Marketing HubSpot',\n status: 'CONNECTED',\n lastSyncAt: '2024-01-16T08:00:00Z',\n },\n {\n id: 'conn-4',\n integrationId: 'int-3',\n name: 'Stripe Live',\n status: 'CONNECTED',\n lastSyncAt: '2024-01-16T12:00:00Z',\n },\n {\n id: 'conn-5',\n integrationId: 'int-5',\n name: 'Analytics Sheet',\n status: 'ERROR',\n lastSyncAt: '2024-01-14T09:00:00Z',\n error: 'Authentication expired',\n },\n];\n\nconst mockSyncConfigs = [\n {\n id: 'sync-1',\n connectionId: 'conn-1',\n name: 'Contacts Sync',\n frequency: 'HOURLY',\n lastRunAt: '2024-01-16T10:00:00Z',\n status: 'SUCCESS',\n recordsSynced: 1250,\n },\n {\n id: 'sync-2',\n connectionId: 'conn-1',\n name: 'Opportunities Sync',\n frequency: 'DAILY',\n lastRunAt: '2024-01-16T00:00:00Z',\n status: 'SUCCESS',\n recordsSynced: 340,\n },\n {\n id: 'sync-3',\n connectionId: 'conn-3',\n name: 'Orders Sync',\n frequency: 'REALTIME',\n lastRunAt: '2024-01-16T12:30:00Z',\n status: 'SUCCESS',\n recordsSynced: 89,\n },\n {\n id: 'sync-4',\n connectionId: 'conn-5',\n name: 'Metrics Export',\n frequency: 'DAILY',\n lastRunAt: '2024-01-14T09:00:00Z',\n status: 'FAILED',\n recordsSynced: 0,\n },\n];\n\n/**\n * Markdown renderer for Integration Dashboard\n */\nexport const integrationDashboardMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc) => {\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'IntegrationDashboard'\n ) {\n throw new Error(\n 'integrationDashboardMarkdownRenderer: not IntegrationDashboard'\n );\n }\n\n const integrations = mockIntegrations;\n const connections = mockConnections;\n const syncs = mockSyncConfigs;\n\n // Calculate stats\n const activeIntegrations = integrations.filter(\n (i) => i.status === 'ACTIVE'\n );\n const connectedConnections = connections.filter(\n (c) => c.status === 'CONNECTED'\n );\n const errorConnections = connections.filter((c) => c.status === 'ERROR');\n const successfulSyncs = syncs.filter((s) => s.status === 'SUCCESS');\n const totalRecordsSynced = successfulSyncs.reduce(\n (sum, s) => sum + s.recordsSynced,\n 0\n );\n\n const lines: string[] = [\n '# Integration Hub',\n '',\n '> Connect and sync data with external services',\n '',\n '## Overview',\n '',\n '| Metric | Value |',\n '|--------|-------|',\n `| Active Integrations | ${activeIntegrations.length} |`,\n `| Connected Services | ${connectedConnections.length} |`,\n `| Error Connections | ${errorConnections.length} |`,\n `| Sync Configs | ${syncs.length} |`,\n `| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,\n '',\n '## Integrations',\n '',\n '| Name | Type | Connections | Status |',\n '|------|------|-------------|--------|',\n ];\n\n for (const integration of integrations) {\n const statusIcon = integration.status === 'ACTIVE' ? '🟢' : '⚫';\n lines.push(\n `| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`\n );\n }\n\n lines.push('');\n lines.push('## Recent Sync Activity');\n lines.push('');\n lines.push('| Sync | Frequency | Last Run | Records | Status |');\n lines.push('|------|-----------|----------|---------|--------|');\n\n for (const sync of syncs) {\n const lastRun = new Date(sync.lastRunAt).toLocaleString();\n const statusIcon = sync.status === 'SUCCESS' ? '✅' : '❌';\n lines.push(\n `| ${sync.name} | ${sync.frequency} | ${lastRun} | ${sync.recordsSynced} | ${statusIcon} ${sync.status} |`\n );\n }\n\n if (errorConnections.length > 0) {\n lines.push('');\n lines.push('## ⚠️ Connections with Errors');\n lines.push('');\n for (const conn of errorConnections) {\n const integration = integrations.find(\n (i) => i.id === conn.integrationId\n );\n lines.push(\n `- **${conn.name}** (${integration?.name ?? 'Unknown'}): ${(conn as { error?: string }).error ?? 'Unknown error'}`\n );\n }\n }\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n\n/**\n * Markdown renderer for Connection List\n */\nexport const connectionListMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc) => {\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'ConnectionList'\n ) {\n throw new Error('connectionListMarkdownRenderer: not ConnectionList');\n }\n\n const connections = mockConnections;\n const integrations = mockIntegrations;\n\n const lines: string[] = [\n '# Connections',\n '',\n '> Manage connections to external services',\n '',\n ];\n\n // Group by integration\n for (const integration of integrations) {\n const intConnections = connections.filter(\n (c) => c.integrationId === integration.id\n );\n\n if (intConnections.length === 0) continue;\n\n lines.push(`## ${integration.name}`);\n lines.push('');\n lines.push('| Connection | Status | Last Sync |');\n lines.push('|------------|--------|-----------|');\n\n for (const conn of intConnections) {\n const lastSync = new Date(conn.lastSyncAt).toLocaleString();\n const statusIcon =\n conn.status === 'CONNECTED'\n ? '🟢'\n : conn.status === 'ERROR'\n ? '🔴'\n : '⚫';\n lines.push(\n `| ${conn.name} | ${statusIcon} ${conn.status} | ${lastSync} |`\n );\n }\n\n lines.push('');\n }\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n\n/**\n * Markdown renderer for Sync Config\n */\nexport const syncConfigMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc) => {\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'SyncConfigEditor'\n ) {\n throw new Error('syncConfigMarkdownRenderer: not SyncConfigEditor');\n }\n\n const syncs = mockSyncConfigs;\n const connections = mockConnections;\n\n const lines: string[] = [\n '# Sync Configurations',\n '',\n '> Configure automated data synchronization',\n '',\n ];\n\n for (const sync of syncs) {\n const connection = connections.find((c) => c.id === sync.connectionId);\n const statusIcon = sync.status === 'SUCCESS' ? '✅' : '❌';\n\n lines.push(`## ${sync.name}`);\n lines.push('');\n lines.push(`**Connection:** ${connection?.name ?? 'Unknown'}`);\n lines.push(`**Frequency:** ${sync.frequency}`);\n lines.push(`**Status:** ${statusIcon} ${sync.status}`);\n lines.push(`**Last Run:** ${new Date(sync.lastRunAt).toLocaleString()}`);\n lines.push(`**Records Synced:** ${sync.recordsSynced.toLocaleString()}`);\n lines.push('');\n }\n\n lines.push('## Frequency Options');\n lines.push('');\n lines.push('- **REALTIME**: Sync on every change');\n lines.push('- **HOURLY**: Sync every hour');\n lines.push('- **DAILY**: Sync once per day');\n lines.push('- **WEEKLY**: Sync once per week');\n lines.push('- **MANUAL**: Sync only when triggered');\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n"],"mappings":";AAMA,MAAM,mBAAmB;CACvB;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,QAAQ;EACR,iBAAiB;EAClB;CACD;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,QAAQ;EACR,iBAAiB;EAClB;CACD;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,QAAQ;EACR,iBAAiB;EAClB;CACD;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,QAAQ;EACR,iBAAiB;EAClB;CACD;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,QAAQ;EACR,iBAAiB;EAClB;CACF;AAED,MAAM,kBAAkB;CACtB;EACE,IAAI;EACJ,eAAe;EACf,MAAM;EACN,QAAQ;EACR,YAAY;EACb;CACD;EACE,IAAI;EACJ,eAAe;EACf,MAAM;EACN,QAAQ;EACR,YAAY;EACb;CACD;EACE,IAAI;EACJ,eAAe;EACf,MAAM;EACN,QAAQ;EACR,YAAY;EACb;CACD;EACE,IAAI;EACJ,eAAe;EACf,MAAM;EACN,QAAQ;EACR,YAAY;EACb;CACD;EACE,IAAI;EAC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C,QAAM,KAAK,iCAAiC;AAC5C,QAAM,KAAK,mCAAmC;AAC9C,QAAM,KAAK,yCAAyC;AAEpD,SAAO;GACL,UAAU;GACV,MAAM,MAAM,KAAK,KAAK;GACvB;;CAEJ"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.integration-hub",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "Integration Hub example with sync engine and field mappings for ContractSpec",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
5
|
"types": "./dist/index.d.ts",
|
|
7
6
|
"type": "module",
|
|
8
7
|
"scripts": {
|
|
@@ -18,13 +17,20 @@
|
|
|
18
17
|
"lint:check": "eslint src"
|
|
19
18
|
},
|
|
20
19
|
"dependencies": {
|
|
21
|
-
"@contractspec/lib.schema": "1.
|
|
22
|
-
"@contractspec/lib.contracts": "1.
|
|
20
|
+
"@contractspec/lib.schema": "1.48.0",
|
|
21
|
+
"@contractspec/lib.contracts": "1.48.0",
|
|
22
|
+
"@contractspec/lib.example-shared-ui": "1.2.0",
|
|
23
|
+
"@contractspec/lib.design-system": "1.48.0",
|
|
24
|
+
"@contractspec/lib.runtime-sandbox": "0.3.0",
|
|
25
|
+
"react": "19.2.3",
|
|
26
|
+
"react-dom": "19.2.3"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
|
-
"@contractspec/tool.typescript": "1.
|
|
26
|
-
"@contractspec/tool.tsdown": "1.
|
|
27
|
-
"typescript": "^5.9.3"
|
|
29
|
+
"@contractspec/tool.typescript": "1.48.0",
|
|
30
|
+
"@contractspec/tool.tsdown": "1.48.0",
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
|
+
"@types/react": "^19.2.8",
|
|
33
|
+
"@types/react-dom": "^19.2.2"
|
|
28
34
|
},
|
|
29
35
|
"exports": {
|
|
30
36
|
".": "./dist/index.js",
|
|
@@ -37,21 +43,31 @@
|
|
|
37
43
|
"./docs/integration-hub.docblock": "./dist/docs/integration-hub.docblock.js",
|
|
38
44
|
"./events": "./dist/events.js",
|
|
39
45
|
"./example": "./dist/example.js",
|
|
46
|
+
"./handlers": "./dist/handlers/index.js",
|
|
47
|
+
"./handlers/integration.handlers": "./dist/handlers/integration.handlers.js",
|
|
40
48
|
"./integration": "./dist/integration/index.js",
|
|
49
|
+
"./integration-hub.capability": "./dist/integration-hub.capability.js",
|
|
41
50
|
"./integration-hub.feature": "./dist/integration-hub.feature.js",
|
|
42
51
|
"./integration/integration.enum": "./dist/integration/integration.enum.js",
|
|
43
52
|
"./integration/integration.operations": "./dist/integration/integration.operations.js",
|
|
44
53
|
"./integration/integration.presentation": "./dist/integration/integration.presentation.js",
|
|
45
54
|
"./integration/integration.schema": "./dist/integration/integration.schema.js",
|
|
55
|
+
"./seeders": "./dist/seeders/index.js",
|
|
46
56
|
"./sync": "./dist/sync/index.js",
|
|
47
57
|
"./sync-engine": "./dist/sync-engine/index.js",
|
|
48
58
|
"./sync/sync.enum": "./dist/sync/sync.enum.js",
|
|
49
59
|
"./sync/sync.operations": "./dist/sync/sync.operations.js",
|
|
50
60
|
"./sync/sync.presentation": "./dist/sync/sync.presentation.js",
|
|
51
61
|
"./sync/sync.schema": "./dist/sync/sync.schema.js",
|
|
62
|
+
"./tests/operations.test-spec": "./dist/tests/operations.test-spec.js",
|
|
63
|
+
"./ui": "./dist/ui/index.js",
|
|
64
|
+
"./ui/hooks": "./dist/ui/hooks/index.js",
|
|
65
|
+
"./ui/hooks/useIntegrationData": "./dist/ui/hooks/useIntegrationData.js",
|
|
66
|
+
"./ui/IntegrationDashboard": "./dist/ui/IntegrationDashboard.js",
|
|
67
|
+
"./ui/renderers": "./dist/ui/renderers/index.js",
|
|
68
|
+
"./ui/renderers/integration.markdown": "./dist/ui/renderers/integration.markdown.js",
|
|
52
69
|
"./*": "./*"
|
|
53
70
|
},
|
|
54
|
-
"module": "./dist/index.js",
|
|
55
71
|
"files": [
|
|
56
72
|
"dist",
|
|
57
73
|
"README.md"
|