@contractspec/example.integration-hub 2.5.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +40 -0
  2. package/dist/docs/index.js +2 -0
  3. package/dist/docs/integration-hub.docblock.js +2 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +149 -0
  6. package/dist/mcp-example.d.ts +16 -0
  7. package/dist/mcp-example.js +151 -0
  8. package/dist/node/docs/index.js +2 -0
  9. package/dist/node/docs/integration-hub.docblock.js +2 -0
  10. package/dist/node/index.js +149 -0
  11. package/dist/node/mcp-example.js +150 -0
  12. package/dist/node/run-mcp.js +155 -0
  13. package/dist/run-mcp.d.ts +1 -0
  14. package/dist/run-mcp.js +156 -0
  15. package/package.json +34 -94
  16. package/dist/browser/connection/connection.enum.js +0 -12
  17. package/dist/browser/connection/connection.operation.js +0 -101
  18. package/dist/browser/connection/connection.presentation.js +0 -102
  19. package/dist/browser/connection/connection.schema.js +0 -48
  20. package/dist/browser/connection/index.js +0 -104
  21. package/dist/browser/docs/index.js +0 -104
  22. package/dist/browser/docs/integration-hub.docblock.js +0 -104
  23. package/dist/browser/events.js +0 -211
  24. package/dist/browser/example.js +0 -42
  25. package/dist/browser/handlers/index.js +0 -246
  26. package/dist/browser/handlers/integration.handlers.js +0 -246
  27. package/dist/browser/index.js +0 -1595
  28. package/dist/browser/integration/index.js +0 -92
  29. package/dist/browser/integration/integration.enum.js +0 -12
  30. package/dist/browser/integration/integration.operations.js +0 -89
  31. package/dist/browser/integration/integration.presentation.js +0 -120
  32. package/dist/browser/integration/integration.schema.js +0 -42
  33. package/dist/browser/integration-hub.capability.js +0 -43
  34. package/dist/browser/integration-hub.feature.js +0 -114
  35. package/dist/browser/seeders/index.js +0 -60
  36. package/dist/browser/sync/index.js +0 -332
  37. package/dist/browser/sync/sync.enum.js +0 -26
  38. package/dist/browser/sync/sync.operations.js +0 -321
  39. package/dist/browser/sync/sync.presentation.js +0 -301
  40. package/dist/browser/sync/sync.schema.js +0 -154
  41. package/dist/browser/sync-engine/index.js +0 -186
  42. package/dist/browser/tests/operations.test-spec.js +0 -85
  43. package/dist/browser/ui/IntegrationDashboard.js +0 -369
  44. package/dist/browser/ui/hooks/index.js +0 -57
  45. package/dist/browser/ui/hooks/useIntegrationData.js +0 -54
  46. package/dist/browser/ui/index.js +0 -644
  47. package/dist/browser/ui/renderers/index.js +0 -273
  48. package/dist/browser/ui/renderers/integration.markdown.js +0 -273
@@ -1,273 +0,0 @@
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
- };
@@ -1,273 +0,0 @@
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
- };