@contractspec/example.integration-hub 1.57.0 → 1.58.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/browser/connection/connection.enum.js +12 -0
- package/dist/browser/connection/connection.operation.js +101 -0
- package/dist/browser/connection/connection.presentation.js +99 -0
- package/dist/browser/connection/connection.schema.js +48 -0
- package/dist/browser/connection/index.js +104 -0
- package/dist/browser/docs/index.js +104 -0
- package/dist/browser/docs/integration-hub.docblock.js +104 -0
- package/dist/browser/events.js +211 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/index.js +246 -0
- package/dist/browser/handlers/integration.handlers.js +246 -0
- package/dist/browser/index.js +1595 -0
- package/dist/browser/integration/index.js +92 -0
- package/dist/browser/integration/integration.enum.js +12 -0
- package/dist/browser/integration/integration.operations.js +89 -0
- package/dist/browser/integration/integration.presentation.js +117 -0
- package/dist/browser/integration/integration.schema.js +42 -0
- package/dist/browser/integration-hub.capability.js +40 -0
- package/dist/browser/integration-hub.feature.js +114 -0
- package/dist/browser/seeders/index.js +60 -0
- package/dist/browser/sync/index.js +332 -0
- package/dist/browser/sync/sync.enum.js +26 -0
- package/dist/browser/sync/sync.operations.js +321 -0
- package/dist/browser/sync/sync.presentation.js +298 -0
- package/dist/browser/sync/sync.schema.js +154 -0
- package/dist/browser/sync-engine/index.js +186 -0
- package/dist/browser/tests/operations.test-spec.js +85 -0
- package/dist/browser/ui/IntegrationDashboard.js +369 -0
- package/dist/browser/ui/hooks/index.js +57 -0
- package/dist/browser/ui/hooks/useIntegrationData.js +54 -0
- package/dist/browser/ui/index.js +644 -0
- package/dist/browser/ui/renderers/index.js +273 -0
- package/dist/browser/ui/renderers/integration.markdown.js +273 -0
- package/dist/connection/connection.enum.d.ts +1 -6
- package/dist/connection/connection.enum.d.ts.map +1 -1
- package/dist/connection/connection.enum.js +11 -15
- package/dist/connection/connection.operation.d.ts +78 -84
- package/dist/connection/connection.operation.d.ts.map +1 -1
- package/dist/connection/connection.operation.js +99 -60
- package/dist/connection/connection.presentation.d.ts +2 -7
- package/dist/connection/connection.presentation.d.ts.map +1 -1
- package/dist/connection/connection.presentation.js +96 -56
- package/dist/connection/connection.schema.d.ts +54 -59
- package/dist/connection/connection.schema.d.ts.map +1 -1
- package/dist/connection/connection.schema.js +46 -73
- package/dist/connection/index.d.ts +7 -4
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +104 -4
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +105 -1
- package/dist/docs/integration-hub.docblock.d.ts +2 -1
- package/dist/docs/integration-hub.docblock.d.ts.map +1 -0
- package/dist/docs/integration-hub.docblock.js +45 -56
- package/dist/events.d.ts +137 -143
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +210 -287
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +41 -55
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +247 -3
- package/dist/handlers/integration.handlers.d.ts +114 -113
- package/dist/handlers/integration.handlers.d.ts.map +1 -1
- package/dist/handlers/integration.handlers.js +232 -267
- package/dist/index.d.ts +12 -19
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1596 -20
- package/dist/integration/index.d.ts +7 -4
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +92 -4
- package/dist/integration/integration.enum.d.ts +1 -6
- package/dist/integration/integration.enum.d.ts.map +1 -1
- package/dist/integration/integration.enum.js +11 -15
- package/dist/integration/integration.operations.d.ts +74 -80
- package/dist/integration/integration.operations.d.ts.map +1 -1
- package/dist/integration/integration.operations.js +87 -54
- package/dist/integration/integration.presentation.d.ts +3 -8
- package/dist/integration/integration.presentation.d.ts.map +1 -1
- package/dist/integration/integration.presentation.js +114 -73
- package/dist/integration/integration.schema.d.ts +54 -59
- package/dist/integration/integration.schema.d.ts.map +1 -1
- package/dist/integration/integration.schema.js +40 -73
- package/dist/integration-hub.capability.d.ts +3 -8
- package/dist/integration-hub.capability.d.ts.map +1 -1
- package/dist/integration-hub.capability.js +41 -38
- package/dist/integration-hub.feature.d.ts +1 -6
- package/dist/integration-hub.feature.d.ts.map +1 -1
- package/dist/integration-hub.feature.js +113 -242
- package/dist/node/connection/connection.enum.js +12 -0
- package/dist/node/connection/connection.operation.js +101 -0
- package/dist/node/connection/connection.presentation.js +99 -0
- package/dist/node/connection/connection.schema.js +48 -0
- package/dist/node/connection/index.js +104 -0
- package/dist/node/docs/index.js +104 -0
- package/dist/node/docs/integration-hub.docblock.js +104 -0
- package/dist/node/events.js +211 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/index.js +246 -0
- package/dist/node/handlers/integration.handlers.js +246 -0
- package/dist/node/index.js +1595 -0
- package/dist/node/integration/index.js +92 -0
- package/dist/node/integration/integration.enum.js +12 -0
- package/dist/node/integration/integration.operations.js +89 -0
- package/dist/node/integration/integration.presentation.js +117 -0
- package/dist/node/integration/integration.schema.js +42 -0
- package/dist/node/integration-hub.capability.js +40 -0
- package/dist/node/integration-hub.feature.js +114 -0
- package/dist/node/seeders/index.js +60 -0
- package/dist/node/sync/index.js +332 -0
- package/dist/node/sync/sync.enum.js +26 -0
- package/dist/node/sync/sync.operations.js +321 -0
- package/dist/node/sync/sync.presentation.js +298 -0
- package/dist/node/sync/sync.schema.js +154 -0
- package/dist/node/sync-engine/index.js +186 -0
- package/dist/node/tests/operations.test-spec.js +85 -0
- package/dist/node/ui/IntegrationDashboard.js +369 -0
- package/dist/node/ui/hooks/index.js +57 -0
- package/dist/node/ui/hooks/useIntegrationData.js +54 -0
- package/dist/node/ui/index.js +644 -0
- package/dist/node/ui/renderers/index.js +273 -0
- package/dist/node/ui/renderers/integration.markdown.js +273 -0
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +54 -52
- package/dist/sync/index.d.ts +7 -4
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +332 -4
- package/dist/sync/sync.enum.d.ts +3 -8
- package/dist/sync/sync.enum.d.ts.map +1 -1
- package/dist/sync/sync.enum.js +23 -31
- package/dist/sync/sync.operations.d.ts +413 -419
- package/dist/sync/sync.operations.d.ts.map +1 -1
- package/dist/sync/sync.operations.js +316 -197
- package/dist/sync/sync.presentation.d.ts +6 -11
- package/dist/sync/sync.presentation.d.ts.map +1 -1
- package/dist/sync/sync.presentation.js +291 -160
- package/dist/sync/sync.schema.d.ts +317 -322
- package/dist/sync/sync.schema.d.ts.map +1 -1
- package/dist/sync/sync.schema.js +146 -295
- package/dist/sync-engine/index.d.ts +88 -91
- package/dist/sync-engine/index.d.ts.map +1 -1
- package/dist/sync-engine/index.js +181 -142
- package/dist/tests/operations.test-spec.d.ts +3 -8
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +82 -90
- package/dist/ui/IntegrationDashboard.d.ts +1 -6
- package/dist/ui/IntegrationDashboard.d.ts.map +1 -1
- package/dist/ui/IntegrationDashboard.js +365 -261
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +57 -4
- package/dist/ui/hooks/useIntegrationData.d.ts +16 -20
- package/dist/ui/hooks/useIntegrationData.d.ts.map +1 -1
- package/dist/ui/hooks/useIntegrationData.js +51 -55
- package/dist/ui/index.d.ts +7 -6
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +644 -5
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +274 -3
- package/dist/ui/renderers/integration.markdown.d.ts +13 -14
- package/dist/ui/renderers/integration.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/integration.markdown.js +268 -264
- package/package.json +360 -71
- package/dist/connection/connection.enum.js.map +0 -1
- package/dist/connection/connection.operation.js.map +0 -1
- package/dist/connection/connection.presentation.js.map +0 -1
- package/dist/connection/connection.schema.js.map +0 -1
- package/dist/docs/integration-hub.docblock.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/integration.handlers.js.map +0 -1
- package/dist/integration/integration.enum.js.map +0 -1
- package/dist/integration/integration.operations.js.map +0 -1
- package/dist/integration/integration.presentation.js.map +0 -1
- package/dist/integration/integration.schema.js.map +0 -1
- package/dist/integration-hub.capability.js.map +0 -1
- package/dist/integration-hub.feature.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/sync/sync.enum.js.map +0 -1
- package/dist/sync/sync.operations.js.map +0 -1
- package/dist/sync/sync.presentation.js.map +0 -1
- package/dist/sync/sync.schema.js.map +0 -1
- package/dist/sync-engine/index.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/ui/IntegrationDashboard.js.map +0 -1
- package/dist/ui/hooks/useIntegrationData.js.map +0 -1
- package/dist/ui/renderers/integration.markdown.js.map +0 -1
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// src/ui/renderers/integration.markdown.ts
|
|
2
|
+
var 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
|
+
id: "int-6",
|
|
40
|
+
name: "PostHog",
|
|
41
|
+
type: "ANALYTICS",
|
|
42
|
+
status: "ACTIVE",
|
|
43
|
+
connectionCount: 1
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
var mockConnections = [
|
|
47
|
+
{
|
|
48
|
+
id: "conn-1",
|
|
49
|
+
integrationId: "int-1",
|
|
50
|
+
name: "Production Salesforce",
|
|
51
|
+
status: "CONNECTED",
|
|
52
|
+
lastSyncAt: "2024-01-16T10:00:00Z"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "conn-2",
|
|
56
|
+
integrationId: "int-1",
|
|
57
|
+
name: "Sandbox Salesforce",
|
|
58
|
+
status: "CONNECTED",
|
|
59
|
+
lastSyncAt: "2024-01-15T14:00:00Z"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "conn-3",
|
|
63
|
+
integrationId: "int-2",
|
|
64
|
+
name: "Marketing HubSpot",
|
|
65
|
+
status: "CONNECTED",
|
|
66
|
+
lastSyncAt: "2024-01-16T08:00:00Z"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "conn-4",
|
|
70
|
+
integrationId: "int-3",
|
|
71
|
+
name: "Stripe Live",
|
|
72
|
+
status: "CONNECTED",
|
|
73
|
+
lastSyncAt: "2024-01-16T12:00:00Z"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "conn-5",
|
|
77
|
+
integrationId: "int-5",
|
|
78
|
+
name: "Analytics Sheet",
|
|
79
|
+
status: "ERROR",
|
|
80
|
+
lastSyncAt: "2024-01-14T09:00:00Z",
|
|
81
|
+
error: "Authentication expired"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "conn-6",
|
|
85
|
+
integrationId: "int-6",
|
|
86
|
+
name: "PostHog Workspace",
|
|
87
|
+
status: "CONNECTED",
|
|
88
|
+
lastSyncAt: "2024-01-16T11:45:00Z"
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
var mockSyncConfigs = [
|
|
92
|
+
{
|
|
93
|
+
id: "sync-1",
|
|
94
|
+
connectionId: "conn-1",
|
|
95
|
+
name: "Contacts Sync",
|
|
96
|
+
frequency: "HOURLY",
|
|
97
|
+
lastRunAt: "2024-01-16T10:00:00Z",
|
|
98
|
+
status: "SUCCESS",
|
|
99
|
+
recordsSynced: 1250
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "sync-2",
|
|
103
|
+
connectionId: "conn-1",
|
|
104
|
+
name: "Opportunities Sync",
|
|
105
|
+
frequency: "DAILY",
|
|
106
|
+
lastRunAt: "2024-01-16T00:00:00Z",
|
|
107
|
+
status: "SUCCESS",
|
|
108
|
+
recordsSynced: 340
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "sync-3",
|
|
112
|
+
connectionId: "conn-3",
|
|
113
|
+
name: "Orders Sync",
|
|
114
|
+
frequency: "REALTIME",
|
|
115
|
+
lastRunAt: "2024-01-16T12:30:00Z",
|
|
116
|
+
status: "SUCCESS",
|
|
117
|
+
recordsSynced: 89
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "sync-4",
|
|
121
|
+
connectionId: "conn-5",
|
|
122
|
+
name: "Metrics Export",
|
|
123
|
+
frequency: "DAILY",
|
|
124
|
+
lastRunAt: "2024-01-14T09:00:00Z",
|
|
125
|
+
status: "FAILED",
|
|
126
|
+
recordsSynced: 0
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
var integrationDashboardMarkdownRenderer = {
|
|
130
|
+
target: "markdown",
|
|
131
|
+
render: async (desc) => {
|
|
132
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "IntegrationDashboard") {
|
|
133
|
+
throw new Error("integrationDashboardMarkdownRenderer: not IntegrationDashboard");
|
|
134
|
+
}
|
|
135
|
+
const integrations = mockIntegrations;
|
|
136
|
+
const connections = mockConnections;
|
|
137
|
+
const syncs = mockSyncConfigs;
|
|
138
|
+
const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
|
|
139
|
+
const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
|
|
140
|
+
const errorConnections = connections.filter((c) => c.status === "ERROR");
|
|
141
|
+
const successfulSyncs = syncs.filter((s) => s.status === "SUCCESS");
|
|
142
|
+
const totalRecordsSynced = successfulSyncs.reduce((sum, s) => sum + s.recordsSynced, 0);
|
|
143
|
+
const lines = [
|
|
144
|
+
"# Integration Hub",
|
|
145
|
+
"",
|
|
146
|
+
"> Connect and sync data with external services",
|
|
147
|
+
"",
|
|
148
|
+
"## Overview",
|
|
149
|
+
"",
|
|
150
|
+
"| Metric | Value |",
|
|
151
|
+
"|--------|-------|",
|
|
152
|
+
`| Active Integrations | ${activeIntegrations.length} |`,
|
|
153
|
+
`| Connected Services | ${connectedConnections.length} |`,
|
|
154
|
+
`| Error Connections | ${errorConnections.length} |`,
|
|
155
|
+
`| Sync Configs | ${syncs.length} |`,
|
|
156
|
+
`| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
|
|
157
|
+
"",
|
|
158
|
+
"## Integrations",
|
|
159
|
+
"",
|
|
160
|
+
"| Name | Type | Connections | Status |",
|
|
161
|
+
"|------|------|-------------|--------|"
|
|
162
|
+
];
|
|
163
|
+
for (const integration of integrations) {
|
|
164
|
+
const statusIcon = integration.status === "ACTIVE" ? "\uD83D\uDFE2" : "⚫";
|
|
165
|
+
lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
|
|
166
|
+
}
|
|
167
|
+
lines.push("");
|
|
168
|
+
lines.push("## Recent Sync Activity");
|
|
169
|
+
lines.push("");
|
|
170
|
+
lines.push("| Sync | Frequency | Last Run | Records | Status |");
|
|
171
|
+
lines.push("|------|-----------|----------|---------|--------|");
|
|
172
|
+
for (const sync of syncs) {
|
|
173
|
+
const lastRun = new Date(sync.lastRunAt).toLocaleString();
|
|
174
|
+
const statusIcon = sync.status === "SUCCESS" ? "✅" : "❌";
|
|
175
|
+
lines.push(`| ${sync.name} | ${sync.frequency} | ${lastRun} | ${sync.recordsSynced} | ${statusIcon} ${sync.status} |`);
|
|
176
|
+
}
|
|
177
|
+
if (errorConnections.length > 0) {
|
|
178
|
+
lines.push("");
|
|
179
|
+
lines.push("## ⚠️ Connections with Errors");
|
|
180
|
+
lines.push("");
|
|
181
|
+
for (const conn of errorConnections) {
|
|
182
|
+
const integration = integrations.find((i) => i.id === conn.integrationId);
|
|
183
|
+
lines.push(`- **${conn.name}** (${integration?.name ?? "Unknown"}): ${conn.error ?? "Unknown error"}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
mimeType: "text/markdown",
|
|
188
|
+
body: lines.join(`
|
|
189
|
+
`)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
var connectionListMarkdownRenderer = {
|
|
194
|
+
target: "markdown",
|
|
195
|
+
render: async (desc) => {
|
|
196
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "ConnectionList") {
|
|
197
|
+
throw new Error("connectionListMarkdownRenderer: not ConnectionList");
|
|
198
|
+
}
|
|
199
|
+
const connections = mockConnections;
|
|
200
|
+
const integrations = mockIntegrations;
|
|
201
|
+
const lines = [
|
|
202
|
+
"# Connections",
|
|
203
|
+
"",
|
|
204
|
+
"> Manage connections to external services",
|
|
205
|
+
""
|
|
206
|
+
];
|
|
207
|
+
for (const integration of integrations) {
|
|
208
|
+
const intConnections = connections.filter((c) => c.integrationId === integration.id);
|
|
209
|
+
if (intConnections.length === 0)
|
|
210
|
+
continue;
|
|
211
|
+
lines.push(`## ${integration.name}`);
|
|
212
|
+
lines.push("");
|
|
213
|
+
lines.push("| Connection | Status | Last Sync |");
|
|
214
|
+
lines.push("|------------|--------|-----------|");
|
|
215
|
+
for (const conn of intConnections) {
|
|
216
|
+
const lastSync = new Date(conn.lastSyncAt).toLocaleString();
|
|
217
|
+
const statusIcon = conn.status === "CONNECTED" ? "\uD83D\uDFE2" : conn.status === "ERROR" ? "\uD83D\uDD34" : "⚫";
|
|
218
|
+
lines.push(`| ${conn.name} | ${statusIcon} ${conn.status} | ${lastSync} |`);
|
|
219
|
+
}
|
|
220
|
+
lines.push("");
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
mimeType: "text/markdown",
|
|
224
|
+
body: lines.join(`
|
|
225
|
+
`)
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var syncConfigMarkdownRenderer = {
|
|
230
|
+
target: "markdown",
|
|
231
|
+
render: async (desc) => {
|
|
232
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "SyncConfigEditor") {
|
|
233
|
+
throw new Error("syncConfigMarkdownRenderer: not SyncConfigEditor");
|
|
234
|
+
}
|
|
235
|
+
const syncs = mockSyncConfigs;
|
|
236
|
+
const connections = mockConnections;
|
|
237
|
+
const lines = [
|
|
238
|
+
"# Sync Configurations",
|
|
239
|
+
"",
|
|
240
|
+
"> Configure automated data synchronization",
|
|
241
|
+
""
|
|
242
|
+
];
|
|
243
|
+
for (const sync of syncs) {
|
|
244
|
+
const connection = connections.find((c) => c.id === sync.connectionId);
|
|
245
|
+
const statusIcon = sync.status === "SUCCESS" ? "✅" : "❌";
|
|
246
|
+
lines.push(`## ${sync.name}`);
|
|
247
|
+
lines.push("");
|
|
248
|
+
lines.push(`**Connection:** ${connection?.name ?? "Unknown"}`);
|
|
249
|
+
lines.push(`**Frequency:** ${sync.frequency}`);
|
|
250
|
+
lines.push(`**Status:** ${statusIcon} ${sync.status}`);
|
|
251
|
+
lines.push(`**Last Run:** ${new Date(sync.lastRunAt).toLocaleString()}`);
|
|
252
|
+
lines.push(`**Records Synced:** ${sync.recordsSynced.toLocaleString()}`);
|
|
253
|
+
lines.push("");
|
|
254
|
+
}
|
|
255
|
+
lines.push("## Frequency Options");
|
|
256
|
+
lines.push("");
|
|
257
|
+
lines.push("- **REALTIME**: Sync on every change");
|
|
258
|
+
lines.push("- **HOURLY**: Sync every hour");
|
|
259
|
+
lines.push("- **DAILY**: Sync once per day");
|
|
260
|
+
lines.push("- **WEEKLY**: Sync once per week");
|
|
261
|
+
lines.push("- **MANUAL**: Sync only when triggered");
|
|
262
|
+
return {
|
|
263
|
+
mimeType: "text/markdown",
|
|
264
|
+
body: lines.join(`
|
|
265
|
+
`)
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
export {
|
|
270
|
+
syncConfigMarkdownRenderer,
|
|
271
|
+
integrationDashboardMarkdownRenderer,
|
|
272
|
+
connectionListMarkdownRenderer
|
|
273
|
+
};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// src/ui/renderers/integration.markdown.ts
|
|
2
|
+
var 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
|
+
id: "int-6",
|
|
40
|
+
name: "PostHog",
|
|
41
|
+
type: "ANALYTICS",
|
|
42
|
+
status: "ACTIVE",
|
|
43
|
+
connectionCount: 1
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
var mockConnections = [
|
|
47
|
+
{
|
|
48
|
+
id: "conn-1",
|
|
49
|
+
integrationId: "int-1",
|
|
50
|
+
name: "Production Salesforce",
|
|
51
|
+
status: "CONNECTED",
|
|
52
|
+
lastSyncAt: "2024-01-16T10:00:00Z"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "conn-2",
|
|
56
|
+
integrationId: "int-1",
|
|
57
|
+
name: "Sandbox Salesforce",
|
|
58
|
+
status: "CONNECTED",
|
|
59
|
+
lastSyncAt: "2024-01-15T14:00:00Z"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "conn-3",
|
|
63
|
+
integrationId: "int-2",
|
|
64
|
+
name: "Marketing HubSpot",
|
|
65
|
+
status: "CONNECTED",
|
|
66
|
+
lastSyncAt: "2024-01-16T08:00:00Z"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "conn-4",
|
|
70
|
+
integrationId: "int-3",
|
|
71
|
+
name: "Stripe Live",
|
|
72
|
+
status: "CONNECTED",
|
|
73
|
+
lastSyncAt: "2024-01-16T12:00:00Z"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "conn-5",
|
|
77
|
+
integrationId: "int-5",
|
|
78
|
+
name: "Analytics Sheet",
|
|
79
|
+
status: "ERROR",
|
|
80
|
+
lastSyncAt: "2024-01-14T09:00:00Z",
|
|
81
|
+
error: "Authentication expired"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "conn-6",
|
|
85
|
+
integrationId: "int-6",
|
|
86
|
+
name: "PostHog Workspace",
|
|
87
|
+
status: "CONNECTED",
|
|
88
|
+
lastSyncAt: "2024-01-16T11:45:00Z"
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
var mockSyncConfigs = [
|
|
92
|
+
{
|
|
93
|
+
id: "sync-1",
|
|
94
|
+
connectionId: "conn-1",
|
|
95
|
+
name: "Contacts Sync",
|
|
96
|
+
frequency: "HOURLY",
|
|
97
|
+
lastRunAt: "2024-01-16T10:00:00Z",
|
|
98
|
+
status: "SUCCESS",
|
|
99
|
+
recordsSynced: 1250
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "sync-2",
|
|
103
|
+
connectionId: "conn-1",
|
|
104
|
+
name: "Opportunities Sync",
|
|
105
|
+
frequency: "DAILY",
|
|
106
|
+
lastRunAt: "2024-01-16T00:00:00Z",
|
|
107
|
+
status: "SUCCESS",
|
|
108
|
+
recordsSynced: 340
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "sync-3",
|
|
112
|
+
connectionId: "conn-3",
|
|
113
|
+
name: "Orders Sync",
|
|
114
|
+
frequency: "REALTIME",
|
|
115
|
+
lastRunAt: "2024-01-16T12:30:00Z",
|
|
116
|
+
status: "SUCCESS",
|
|
117
|
+
recordsSynced: 89
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "sync-4",
|
|
121
|
+
connectionId: "conn-5",
|
|
122
|
+
name: "Metrics Export",
|
|
123
|
+
frequency: "DAILY",
|
|
124
|
+
lastRunAt: "2024-01-14T09:00:00Z",
|
|
125
|
+
status: "FAILED",
|
|
126
|
+
recordsSynced: 0
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
var integrationDashboardMarkdownRenderer = {
|
|
130
|
+
target: "markdown",
|
|
131
|
+
render: async (desc) => {
|
|
132
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "IntegrationDashboard") {
|
|
133
|
+
throw new Error("integrationDashboardMarkdownRenderer: not IntegrationDashboard");
|
|
134
|
+
}
|
|
135
|
+
const integrations = mockIntegrations;
|
|
136
|
+
const connections = mockConnections;
|
|
137
|
+
const syncs = mockSyncConfigs;
|
|
138
|
+
const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
|
|
139
|
+
const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
|
|
140
|
+
const errorConnections = connections.filter((c) => c.status === "ERROR");
|
|
141
|
+
const successfulSyncs = syncs.filter((s) => s.status === "SUCCESS");
|
|
142
|
+
const totalRecordsSynced = successfulSyncs.reduce((sum, s) => sum + s.recordsSynced, 0);
|
|
143
|
+
const lines = [
|
|
144
|
+
"# Integration Hub",
|
|
145
|
+
"",
|
|
146
|
+
"> Connect and sync data with external services",
|
|
147
|
+
"",
|
|
148
|
+
"## Overview",
|
|
149
|
+
"",
|
|
150
|
+
"| Metric | Value |",
|
|
151
|
+
"|--------|-------|",
|
|
152
|
+
`| Active Integrations | ${activeIntegrations.length} |`,
|
|
153
|
+
`| Connected Services | ${connectedConnections.length} |`,
|
|
154
|
+
`| Error Connections | ${errorConnections.length} |`,
|
|
155
|
+
`| Sync Configs | ${syncs.length} |`,
|
|
156
|
+
`| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
|
|
157
|
+
"",
|
|
158
|
+
"## Integrations",
|
|
159
|
+
"",
|
|
160
|
+
"| Name | Type | Connections | Status |",
|
|
161
|
+
"|------|------|-------------|--------|"
|
|
162
|
+
];
|
|
163
|
+
for (const integration of integrations) {
|
|
164
|
+
const statusIcon = integration.status === "ACTIVE" ? "\uD83D\uDFE2" : "⚫";
|
|
165
|
+
lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
|
|
166
|
+
}
|
|
167
|
+
lines.push("");
|
|
168
|
+
lines.push("## Recent Sync Activity");
|
|
169
|
+
lines.push("");
|
|
170
|
+
lines.push("| Sync | Frequency | Last Run | Records | Status |");
|
|
171
|
+
lines.push("|------|-----------|----------|---------|--------|");
|
|
172
|
+
for (const sync of syncs) {
|
|
173
|
+
const lastRun = new Date(sync.lastRunAt).toLocaleString();
|
|
174
|
+
const statusIcon = sync.status === "SUCCESS" ? "✅" : "❌";
|
|
175
|
+
lines.push(`| ${sync.name} | ${sync.frequency} | ${lastRun} | ${sync.recordsSynced} | ${statusIcon} ${sync.status} |`);
|
|
176
|
+
}
|
|
177
|
+
if (errorConnections.length > 0) {
|
|
178
|
+
lines.push("");
|
|
179
|
+
lines.push("## ⚠️ Connections with Errors");
|
|
180
|
+
lines.push("");
|
|
181
|
+
for (const conn of errorConnections) {
|
|
182
|
+
const integration = integrations.find((i) => i.id === conn.integrationId);
|
|
183
|
+
lines.push(`- **${conn.name}** (${integration?.name ?? "Unknown"}): ${conn.error ?? "Unknown error"}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
mimeType: "text/markdown",
|
|
188
|
+
body: lines.join(`
|
|
189
|
+
`)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
var connectionListMarkdownRenderer = {
|
|
194
|
+
target: "markdown",
|
|
195
|
+
render: async (desc) => {
|
|
196
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "ConnectionList") {
|
|
197
|
+
throw new Error("connectionListMarkdownRenderer: not ConnectionList");
|
|
198
|
+
}
|
|
199
|
+
const connections = mockConnections;
|
|
200
|
+
const integrations = mockIntegrations;
|
|
201
|
+
const lines = [
|
|
202
|
+
"# Connections",
|
|
203
|
+
"",
|
|
204
|
+
"> Manage connections to external services",
|
|
205
|
+
""
|
|
206
|
+
];
|
|
207
|
+
for (const integration of integrations) {
|
|
208
|
+
const intConnections = connections.filter((c) => c.integrationId === integration.id);
|
|
209
|
+
if (intConnections.length === 0)
|
|
210
|
+
continue;
|
|
211
|
+
lines.push(`## ${integration.name}`);
|
|
212
|
+
lines.push("");
|
|
213
|
+
lines.push("| Connection | Status | Last Sync |");
|
|
214
|
+
lines.push("|------------|--------|-----------|");
|
|
215
|
+
for (const conn of intConnections) {
|
|
216
|
+
const lastSync = new Date(conn.lastSyncAt).toLocaleString();
|
|
217
|
+
const statusIcon = conn.status === "CONNECTED" ? "\uD83D\uDFE2" : conn.status === "ERROR" ? "\uD83D\uDD34" : "⚫";
|
|
218
|
+
lines.push(`| ${conn.name} | ${statusIcon} ${conn.status} | ${lastSync} |`);
|
|
219
|
+
}
|
|
220
|
+
lines.push("");
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
mimeType: "text/markdown",
|
|
224
|
+
body: lines.join(`
|
|
225
|
+
`)
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var syncConfigMarkdownRenderer = {
|
|
230
|
+
target: "markdown",
|
|
231
|
+
render: async (desc) => {
|
|
232
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "SyncConfigEditor") {
|
|
233
|
+
throw new Error("syncConfigMarkdownRenderer: not SyncConfigEditor");
|
|
234
|
+
}
|
|
235
|
+
const syncs = mockSyncConfigs;
|
|
236
|
+
const connections = mockConnections;
|
|
237
|
+
const lines = [
|
|
238
|
+
"# Sync Configurations",
|
|
239
|
+
"",
|
|
240
|
+
"> Configure automated data synchronization",
|
|
241
|
+
""
|
|
242
|
+
];
|
|
243
|
+
for (const sync of syncs) {
|
|
244
|
+
const connection = connections.find((c) => c.id === sync.connectionId);
|
|
245
|
+
const statusIcon = sync.status === "SUCCESS" ? "✅" : "❌";
|
|
246
|
+
lines.push(`## ${sync.name}`);
|
|
247
|
+
lines.push("");
|
|
248
|
+
lines.push(`**Connection:** ${connection?.name ?? "Unknown"}`);
|
|
249
|
+
lines.push(`**Frequency:** ${sync.frequency}`);
|
|
250
|
+
lines.push(`**Status:** ${statusIcon} ${sync.status}`);
|
|
251
|
+
lines.push(`**Last Run:** ${new Date(sync.lastRunAt).toLocaleString()}`);
|
|
252
|
+
lines.push(`**Records Synced:** ${sync.recordsSynced.toLocaleString()}`);
|
|
253
|
+
lines.push("");
|
|
254
|
+
}
|
|
255
|
+
lines.push("## Frequency Options");
|
|
256
|
+
lines.push("");
|
|
257
|
+
lines.push("- **REALTIME**: Sync on every change");
|
|
258
|
+
lines.push("- **HOURLY**: Sync every hour");
|
|
259
|
+
lines.push("- **DAILY**: Sync once per day");
|
|
260
|
+
lines.push("- **WEEKLY**: Sync once per week");
|
|
261
|
+
lines.push("- **MANUAL**: Sync only when triggered");
|
|
262
|
+
return {
|
|
263
|
+
mimeType: "text/markdown",
|
|
264
|
+
body: lines.join(`
|
|
265
|
+
`)
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
export {
|
|
270
|
+
syncConfigMarkdownRenderer,
|
|
271
|
+
integrationDashboardMarkdownRenderer,
|
|
272
|
+
connectionListMarkdownRenderer
|
|
273
|
+
};
|
package/dist/seeders/index.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { DatabasePort } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
projectId: string;
|
|
6
|
-
db: DatabasePort;
|
|
1
|
+
import type { DatabasePort } from '@contractspec/lib.runtime-sandbox';
|
|
2
|
+
export declare function seedIntegrationHub(params: {
|
|
3
|
+
projectId: string;
|
|
4
|
+
db: DatabasePort;
|
|
7
5
|
}): Promise<void>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { seedIntegrationHub };
|
|
10
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/seeders/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEtE,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,YAAY,CAAC;CAClB,iBA8EA"}
|
package/dist/seeders/index.js
CHANGED
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/seeders/index.ts
|
|
2
3
|
async function seedIntegrationHub(params) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const { projectId, db } = params;
|
|
5
|
+
const existing = await db.query(`SELECT COUNT(*) as count FROM integration WHERE "projectId" = $1`, [projectId]);
|
|
6
|
+
if (existing.rows[0]?.count > 0)
|
|
7
|
+
return;
|
|
8
|
+
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
6
9
|
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
"int_1",
|
|
11
|
+
projectId,
|
|
12
|
+
"org_demo",
|
|
13
|
+
"Salesforce",
|
|
14
|
+
"Salesforce CRM integration",
|
|
15
|
+
"CRM",
|
|
16
|
+
"ACTIVE"
|
|
17
|
+
]);
|
|
18
|
+
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
16
19
|
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
"int_2",
|
|
21
|
+
projectId,
|
|
22
|
+
"org_demo",
|
|
23
|
+
"Meeting Recorder",
|
|
24
|
+
"Meeting recorder transcripts and metadata",
|
|
25
|
+
"DATA",
|
|
26
|
+
"ACTIVE"
|
|
27
|
+
]);
|
|
28
|
+
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
26
29
|
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
"int_3",
|
|
31
|
+
projectId,
|
|
32
|
+
"org_demo",
|
|
33
|
+
"Gradium Voice",
|
|
34
|
+
"Gradium low-latency text-to-speech integration",
|
|
35
|
+
"COMMUNICATION",
|
|
36
|
+
"ACTIVE"
|
|
37
|
+
]);
|
|
38
|
+
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
36
39
|
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
"int_4",
|
|
41
|
+
projectId,
|
|
42
|
+
"org_demo",
|
|
43
|
+
"Fal Chatterbox Voice",
|
|
44
|
+
"Fal Chatterbox text-to-speech integration",
|
|
45
|
+
"COMMUNICATION",
|
|
46
|
+
"ACTIVE"
|
|
47
|
+
]);
|
|
48
|
+
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
46
49
|
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
"int_5",
|
|
51
|
+
projectId,
|
|
52
|
+
"org_demo",
|
|
53
|
+
"PostHog Analytics",
|
|
54
|
+
"Product analytics and event capture",
|
|
55
|
+
"ANALYTICS",
|
|
56
|
+
"ACTIVE"
|
|
57
|
+
]);
|
|
55
58
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=index.js.map
|
|
59
|
+
export {
|
|
60
|
+
seedIntegrationHub
|
|
61
|
+
};
|