@contractspec/example.integration-hub 3.8.8 → 3.8.10

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 (89) hide show
  1. package/dist/connection/connection.enum.js +1 -29
  2. package/dist/connection/connection.operation.js +1 -124
  3. package/dist/connection/connection.presentation.js +1 -125
  4. package/dist/connection/connection.schema.js +1 -71
  5. package/dist/connection/index.js +1 -127
  6. package/dist/docs/index.js +5 -49
  7. package/dist/docs/integration-hub.docblock.js +5 -49
  8. package/dist/events.js +1 -211
  9. package/dist/example.js +1 -42
  10. package/dist/handlers/index.js +5 -292
  11. package/dist/handlers/integration.handlers.js +5 -292
  12. package/dist/index.js +8 -2355
  13. package/dist/integration/index.js +1 -92
  14. package/dist/integration/integration.enum.js +1 -12
  15. package/dist/integration/integration.operations.js +1 -89
  16. package/dist/integration/integration.presentation.js +1 -120
  17. package/dist/integration/integration.schema.js +1 -42
  18. package/dist/integration-hub.capability.js +1 -43
  19. package/dist/integration-hub.feature.js +1 -330
  20. package/dist/mcp-example.js +1 -154
  21. package/dist/node/connection/connection.enum.js +1 -29
  22. package/dist/node/connection/connection.operation.js +1 -124
  23. package/dist/node/connection/connection.presentation.js +1 -125
  24. package/dist/node/connection/connection.schema.js +1 -71
  25. package/dist/node/connection/index.js +1 -127
  26. package/dist/node/docs/index.js +5 -49
  27. package/dist/node/docs/integration-hub.docblock.js +5 -49
  28. package/dist/node/events.js +1 -211
  29. package/dist/node/example.js +1 -42
  30. package/dist/node/handlers/index.js +5 -292
  31. package/dist/node/handlers/integration.handlers.js +5 -292
  32. package/dist/node/index.js +8 -2355
  33. package/dist/node/integration/index.js +1 -92
  34. package/dist/node/integration/integration.enum.js +1 -12
  35. package/dist/node/integration/integration.operations.js +1 -89
  36. package/dist/node/integration/integration.presentation.js +1 -120
  37. package/dist/node/integration/integration.schema.js +1 -42
  38. package/dist/node/integration-hub.capability.js +1 -43
  39. package/dist/node/integration-hub.feature.js +1 -330
  40. package/dist/node/mcp-example.js +1 -154
  41. package/dist/node/run-mcp.js +1 -159
  42. package/dist/node/seeders/index.js +6 -60
  43. package/dist/node/sync/index.js +1 -332
  44. package/dist/node/sync/sync.enum.js +1 -26
  45. package/dist/node/sync/sync.operations.js +1 -321
  46. package/dist/node/sync/sync.presentation.js +1 -301
  47. package/dist/node/sync/sync.schema.js +1 -154
  48. package/dist/node/sync-engine/index.js +1 -186
  49. package/dist/node/tests/operations.test-spec.js +1 -85
  50. package/dist/node/ui/IntegrationDashboard.js +1 -886
  51. package/dist/node/ui/IntegrationDashboard.visualizations.js +1 -250
  52. package/dist/node/ui/IntegrationHubChat.js +1 -34
  53. package/dist/node/ui/hooks/index.js +1 -57
  54. package/dist/node/ui/hooks/useIntegrationData.js +1 -54
  55. package/dist/node/ui/index.js +4 -1173
  56. package/dist/node/ui/renderers/index.js +4 -484
  57. package/dist/node/ui/renderers/integration.markdown.js +4 -484
  58. package/dist/node/ui/tables/ConnectionsTable.js +1 -211
  59. package/dist/node/ui/tables/IntegrationTables.js +1 -361
  60. package/dist/node/ui/tables/SyncConfigsTable.js +1 -230
  61. package/dist/node/ui/tables/integration-table.shared.js +1 -84
  62. package/dist/node/visualizations/catalog.js +1 -137
  63. package/dist/node/visualizations/index.js +1 -211
  64. package/dist/node/visualizations/selectors.js +1 -204
  65. package/dist/run-mcp.js +1 -159
  66. package/dist/seeders/index.js +6 -60
  67. package/dist/sync/index.js +1 -332
  68. package/dist/sync/sync.enum.js +1 -26
  69. package/dist/sync/sync.operations.js +1 -321
  70. package/dist/sync/sync.presentation.js +1 -301
  71. package/dist/sync/sync.schema.js +1 -154
  72. package/dist/sync-engine/index.js +1 -186
  73. package/dist/tests/operations.test-spec.js +1 -85
  74. package/dist/ui/IntegrationDashboard.js +1 -886
  75. package/dist/ui/IntegrationDashboard.visualizations.js +1 -250
  76. package/dist/ui/IntegrationHubChat.js +1 -34
  77. package/dist/ui/hooks/index.js +1 -57
  78. package/dist/ui/hooks/useIntegrationData.js +1 -54
  79. package/dist/ui/index.js +4 -1173
  80. package/dist/ui/renderers/index.js +4 -484
  81. package/dist/ui/renderers/integration.markdown.js +4 -484
  82. package/dist/ui/tables/ConnectionsTable.js +1 -211
  83. package/dist/ui/tables/IntegrationTables.js +1 -361
  84. package/dist/ui/tables/SyncConfigsTable.js +1 -230
  85. package/dist/ui/tables/integration-table.shared.js +1 -84
  86. package/dist/visualizations/catalog.js +1 -137
  87. package/dist/visualizations/index.js +1 -211
  88. package/dist/visualizations/selectors.js +1 -204
  89. package/package.json +14 -14
@@ -1,485 +1,5 @@
1
1
  // @bun
2
- // src/visualizations/catalog.ts
3
- import {
4
- defineVisualization,
5
- VisualizationRegistry
6
- } from "@contractspec/lib.contracts-spec/visualizations";
7
- var INTEGRATION_LIST_REF = {
8
- key: "integration.list",
9
- version: "1.0.0"
10
- };
11
- var CONNECTION_LIST_REF = {
12
- key: "integration.connection.list",
13
- version: "1.0.0"
14
- };
15
- var SYNC_CONFIG_REF = {
16
- key: "integration.syncConfig.list",
17
- version: "1.0.0"
18
- };
19
- var META = {
20
- version: "1.0.0",
21
- domain: "integration",
22
- stability: "experimental",
23
- owners: ["@example.integration-hub"],
24
- tags: ["integration", "visualization", "sync"]
25
- };
26
- var IntegrationTypeVisualization = defineVisualization({
27
- meta: {
28
- ...META,
29
- key: "integration-hub.visualization.integration-types",
30
- title: "Integration Types",
31
- description: "Distribution of configured integration categories.",
32
- goal: "Show where integration coverage is concentrated.",
33
- context: "Integration overview."
34
- },
35
- source: { primary: INTEGRATION_LIST_REF, resultPath: "data" },
36
- visualization: {
37
- kind: "pie",
38
- nameDimension: "type",
39
- valueMeasure: "count",
40
- dimensions: [
41
- { key: "type", label: "Type", dataPath: "type", type: "category" }
42
- ],
43
- measures: [
44
- { key: "count", label: "Count", dataPath: "count", format: "number" }
45
- ],
46
- table: { caption: "Integration counts by type." }
47
- }
48
- });
49
- var ConnectionStatusVisualization = defineVisualization({
50
- meta: {
51
- ...META,
52
- key: "integration-hub.visualization.connection-status",
53
- title: "Connection Status",
54
- description: "Status distribution across configured connections.",
55
- goal: "Highlight connection health and instability.",
56
- context: "Connection monitoring."
57
- },
58
- source: { primary: CONNECTION_LIST_REF, resultPath: "data" },
59
- visualization: {
60
- kind: "cartesian",
61
- variant: "bar",
62
- xDimension: "status",
63
- yMeasures: ["count"],
64
- dimensions: [
65
- { key: "status", label: "Status", dataPath: "status", type: "category" }
66
- ],
67
- measures: [
68
- {
69
- key: "count",
70
- label: "Connections",
71
- dataPath: "count",
72
- format: "number",
73
- color: "#1d4ed8"
74
- }
75
- ],
76
- table: { caption: "Connection counts by status." }
77
- }
78
- });
79
- var HealthySyncMetricVisualization = defineVisualization({
80
- meta: {
81
- ...META,
82
- key: "integration-hub.visualization.sync-healthy",
83
- title: "Healthy Syncs",
84
- description: "Sync configurations currently healthy or recently successful.",
85
- goal: "Summarize healthy synchronization capacity.",
86
- context: "Sync-state comparison."
87
- },
88
- source: { primary: SYNC_CONFIG_REF, resultPath: "data" },
89
- visualization: {
90
- kind: "metric",
91
- measure: "value",
92
- measures: [
93
- { key: "value", label: "Syncs", dataPath: "value", format: "number" }
94
- ],
95
- table: { caption: "Healthy sync count." }
96
- }
97
- });
98
- var AttentionSyncMetricVisualization = defineVisualization({
99
- meta: {
100
- ...META,
101
- key: "integration-hub.visualization.sync-attention",
102
- title: "Attention Needed",
103
- description: "Sync configurations paused, failing, or otherwise needing review.",
104
- goal: "Summarize syncs needing action.",
105
- context: "Sync-state comparison."
106
- },
107
- source: { primary: SYNC_CONFIG_REF, resultPath: "data" },
108
- visualization: {
109
- kind: "metric",
110
- measure: "value",
111
- measures: [
112
- { key: "value", label: "Syncs", dataPath: "value", format: "number" }
113
- ],
114
- table: { caption: "Syncs requiring attention." }
115
- }
116
- });
117
- var IntegrationVisualizationSpecs = [
118
- IntegrationTypeVisualization,
119
- ConnectionStatusVisualization,
120
- HealthySyncMetricVisualization,
121
- AttentionSyncMetricVisualization
122
- ];
123
- var IntegrationVisualizationRegistry = new VisualizationRegistry([
124
- ...IntegrationVisualizationSpecs
125
- ]);
126
- var IntegrationVisualizationRefs = IntegrationVisualizationSpecs.map((spec) => ({
127
- key: spec.meta.key,
128
- version: spec.meta.version
129
- }));
130
-
131
- // src/visualizations/selectors.ts
132
- function isHealthySync(status) {
133
- return status === "ACTIVE" || status === "SUCCESS";
134
- }
135
- function createIntegrationVisualizationSections(integrations, connections, syncConfigs) {
136
- const integrationTypes = new Map;
137
- const connectionStatuses = new Map;
138
- let healthySyncs = 0;
139
- let attentionSyncs = 0;
140
- for (const integration of integrations) {
141
- integrationTypes.set(integration.type, (integrationTypes.get(integration.type) ?? 0) + 1);
142
- }
143
- for (const connection of connections) {
144
- connectionStatuses.set(connection.status, (connectionStatuses.get(connection.status) ?? 0) + 1);
145
- }
146
- for (const syncConfig of syncConfigs) {
147
- if (isHealthySync(syncConfig.status)) {
148
- healthySyncs += 1;
149
- } else {
150
- attentionSyncs += 1;
151
- }
152
- }
153
- const primaryItems = [
154
- {
155
- key: "integration-types",
156
- spec: IntegrationTypeVisualization,
157
- data: {
158
- data: Array.from(integrationTypes.entries()).map(([type, count]) => ({
159
- type,
160
- count
161
- }))
162
- },
163
- title: "Integration Types",
164
- description: "Configured integrations grouped by category.",
165
- height: 260
166
- },
167
- {
168
- key: "connection-status",
169
- spec: ConnectionStatusVisualization,
170
- data: {
171
- data: Array.from(connectionStatuses.entries()).map(([status, count]) => ({
172
- status,
173
- count
174
- }))
175
- },
176
- title: "Connection Status",
177
- description: "Operational health across current connections."
178
- }
179
- ];
180
- const comparisonItems = [
181
- {
182
- key: "healthy-syncs",
183
- spec: HealthySyncMetricVisualization,
184
- data: { data: [{ value: healthySyncs }] },
185
- title: "Healthy Syncs",
186
- description: "Active or recently successful sync configurations.",
187
- height: 200
188
- },
189
- {
190
- key: "attention-syncs",
191
- spec: AttentionSyncMetricVisualization,
192
- data: { data: [{ value: attentionSyncs }] },
193
- title: "Attention Needed",
194
- description: "Paused, failed, or degraded sync configurations.",
195
- height: 200
196
- }
197
- ];
198
- return {
199
- primaryItems,
200
- comparisonItems
201
- };
202
- }
203
- // src/ui/renderers/integration.markdown.ts
204
- var mockIntegrations = [
205
- {
206
- id: "int-1",
207
- name: "Salesforce",
208
- type: "CRM",
209
- status: "ACTIVE",
210
- connectionCount: 3
211
- },
212
- {
213
- id: "int-2",
214
- name: "HubSpot",
215
- type: "MARKETING",
216
- status: "ACTIVE",
217
- connectionCount: 2
218
- },
219
- {
220
- id: "int-3",
221
- name: "Stripe",
222
- type: "PAYMENT",
223
- status: "ACTIVE",
224
- connectionCount: 1
225
- },
226
- {
227
- id: "int-4",
228
- name: "Slack",
229
- type: "COMMUNICATION",
230
- status: "INACTIVE",
231
- connectionCount: 0
232
- },
233
- {
234
- id: "int-5",
235
- name: "Google Sheets",
236
- type: "DATA",
237
- status: "ACTIVE",
238
- connectionCount: 5
239
- },
240
- {
241
- id: "int-6",
242
- name: "PostHog",
243
- type: "ANALYTICS",
244
- status: "ACTIVE",
245
- connectionCount: 1
246
- }
247
- ];
248
- var mockConnections = [
249
- {
250
- id: "conn-1",
251
- integrationId: "int-1",
252
- name: "Production Salesforce",
253
- status: "CONNECTED",
254
- lastSyncAt: "2024-01-16T10:00:00Z"
255
- },
256
- {
257
- id: "conn-2",
258
- integrationId: "int-1",
259
- name: "Sandbox Salesforce",
260
- status: "CONNECTED",
261
- lastSyncAt: "2024-01-15T14:00:00Z"
262
- },
263
- {
264
- id: "conn-3",
265
- integrationId: "int-2",
266
- name: "Marketing HubSpot",
267
- status: "CONNECTED",
268
- lastSyncAt: "2024-01-16T08:00:00Z"
269
- },
270
- {
271
- id: "conn-4",
272
- integrationId: "int-3",
273
- name: "Stripe Live",
274
- status: "CONNECTED",
275
- lastSyncAt: "2024-01-16T12:00:00Z"
276
- },
277
- {
278
- id: "conn-5",
279
- integrationId: "int-5",
280
- name: "Analytics Sheet",
281
- status: "ERROR",
282
- lastSyncAt: "2024-01-14T09:00:00Z",
283
- error: "Authentication expired"
284
- },
285
- {
286
- id: "conn-6",
287
- integrationId: "int-6",
288
- name: "PostHog Workspace",
289
- status: "CONNECTED",
290
- lastSyncAt: "2024-01-16T11:45:00Z"
291
- }
292
- ];
293
- var mockSyncConfigs = [
294
- {
295
- id: "sync-1",
296
- connectionId: "conn-1",
297
- name: "Contacts Sync",
298
- frequency: "HOURLY",
299
- lastRunAt: "2024-01-16T10:00:00Z",
300
- status: "SUCCESS",
301
- recordsSynced: 1250
302
- },
303
- {
304
- id: "sync-2",
305
- connectionId: "conn-1",
306
- name: "Opportunities Sync",
307
- frequency: "DAILY",
308
- lastRunAt: "2024-01-16T00:00:00Z",
309
- status: "SUCCESS",
310
- recordsSynced: 340
311
- },
312
- {
313
- id: "sync-3",
314
- connectionId: "conn-3",
315
- name: "Orders Sync",
316
- frequency: "REALTIME",
317
- lastRunAt: "2024-01-16T12:30:00Z",
318
- status: "SUCCESS",
319
- recordsSynced: 89
320
- },
321
- {
322
- id: "sync-4",
323
- connectionId: "conn-5",
324
- name: "Metrics Export",
325
- frequency: "DAILY",
326
- lastRunAt: "2024-01-14T09:00:00Z",
327
- status: "FAILED",
328
- recordsSynced: 0
329
- }
330
- ];
331
- var integrationDashboardMarkdownRenderer = {
332
- target: "markdown",
333
- render: async (desc) => {
334
- if (desc.source.type !== "component" || desc.source.componentKey !== "IntegrationDashboard") {
335
- throw new Error("integrationDashboardMarkdownRenderer: not IntegrationDashboard");
336
- }
337
- const integrations = mockIntegrations;
338
- const connections = mockConnections;
339
- const syncs = mockSyncConfigs;
340
- const visualizations = createIntegrationVisualizationSections(integrations, connections, syncs);
341
- const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
342
- const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
343
- const errorConnections = connections.filter((c) => c.status === "ERROR");
344
- const successfulSyncs = syncs.filter((s) => s.status === "SUCCESS");
345
- const totalRecordsSynced = successfulSyncs.reduce((sum, s) => sum + s.recordsSynced, 0);
346
- const lines = [
347
- "# Integration Hub",
348
- "",
349
- "> Connect and sync data with external services",
350
- "",
351
- "## Overview",
352
- "",
353
- "| Metric | Value |",
354
- "|--------|-------|",
355
- `| Active Integrations | ${activeIntegrations.length} |`,
356
- `| Connected Services | ${connectedConnections.length} |`,
357
- `| Error Connections | ${errorConnections.length} |`,
358
- `| Sync Configs | ${syncs.length} |`,
359
- `| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
360
- ""
361
- ];
362
- lines.push("## Visualization Overview");
363
- lines.push("");
364
- for (const item of [
365
- ...visualizations.primaryItems,
366
- ...visualizations.comparisonItems
367
- ]) {
368
- lines.push(`- **${item.title}** via \`${item.spec.meta.key}\``);
369
- }
370
- lines.push("");
371
- lines.push("## Integrations");
372
- lines.push("");
373
- lines.push("| Name | Type | Connections | Status |");
374
- lines.push("|------|------|-------------|--------|");
375
- for (const integration of integrations) {
376
- const statusIcon = integration.status === "ACTIVE" ? "\uD83D\uDFE2" : "\u26AB";
377
- lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
378
- }
379
- lines.push("");
380
- lines.push("## Recent Sync Activity");
381
- lines.push("");
382
- lines.push("| Sync | Frequency | Last Run | Records | Status |");
383
- lines.push("|------|-----------|----------|---------|--------|");
384
- for (const sync of syncs) {
385
- const lastRun = new Date(sync.lastRunAt).toLocaleString();
386
- const statusIcon = sync.status === "SUCCESS" ? "\u2705" : "\u274C";
387
- lines.push(`| ${sync.name} | ${sync.frequency} | ${lastRun} | ${sync.recordsSynced} | ${statusIcon} ${sync.status} |`);
388
- }
389
- if (errorConnections.length > 0) {
390
- lines.push("");
391
- lines.push("## \u26A0\uFE0F Connections with Errors");
392
- lines.push("");
393
- for (const conn of errorConnections) {
394
- const integration = integrations.find((i) => i.id === conn.integrationId);
395
- lines.push(`- **${conn.name}** (${integration?.name ?? "Unknown"}): ${conn.error ?? "Unknown error"}`);
396
- }
397
- }
398
- return {
399
- mimeType: "text/markdown",
400
- body: lines.join(`
401
- `)
402
- };
403
- }
404
- };
405
- var connectionListMarkdownRenderer = {
406
- target: "markdown",
407
- render: async (desc) => {
408
- if (desc.source.type !== "component" || desc.source.componentKey !== "ConnectionList") {
409
- throw new Error("connectionListMarkdownRenderer: not ConnectionList");
410
- }
411
- const connections = mockConnections;
412
- const integrations = mockIntegrations;
413
- const lines = [
414
- "# Connections",
415
- "",
416
- "> Manage connections to external services",
417
- ""
418
- ];
419
- for (const integration of integrations) {
420
- const intConnections = connections.filter((c) => c.integrationId === integration.id);
421
- if (intConnections.length === 0)
422
- continue;
423
- lines.push(`## ${integration.name}`);
424
- lines.push("");
425
- lines.push("| Connection | Status | Last Sync |");
426
- lines.push("|------------|--------|-----------|");
427
- for (const conn of intConnections) {
428
- const lastSync = new Date(conn.lastSyncAt).toLocaleString();
429
- const statusIcon = conn.status === "CONNECTED" ? "\uD83D\uDFE2" : conn.status === "ERROR" ? "\uD83D\uDD34" : "\u26AB";
430
- lines.push(`| ${conn.name} | ${statusIcon} ${conn.status} | ${lastSync} |`);
431
- }
432
- lines.push("");
433
- }
434
- return {
435
- mimeType: "text/markdown",
436
- body: lines.join(`
437
- `)
438
- };
439
- }
440
- };
441
- var syncConfigMarkdownRenderer = {
442
- target: "markdown",
443
- render: async (desc) => {
444
- if (desc.source.type !== "component" || desc.source.componentKey !== "SyncConfigEditor") {
445
- throw new Error("syncConfigMarkdownRenderer: not SyncConfigEditor");
446
- }
447
- const syncs = mockSyncConfigs;
448
- const connections = mockConnections;
449
- const lines = [
450
- "# Sync Configurations",
451
- "",
452
- "> Configure automated data synchronization",
453
- ""
454
- ];
455
- for (const sync of syncs) {
456
- const connection = connections.find((c) => c.id === sync.connectionId);
457
- const statusIcon = sync.status === "SUCCESS" ? "\u2705" : "\u274C";
458
- lines.push(`## ${sync.name}`);
459
- lines.push("");
460
- lines.push(`**Connection:** ${connection?.name ?? "Unknown"}`);
461
- lines.push(`**Frequency:** ${sync.frequency}`);
462
- lines.push(`**Status:** ${statusIcon} ${sync.status}`);
463
- lines.push(`**Last Run:** ${new Date(sync.lastRunAt).toLocaleString()}`);
464
- lines.push(`**Records Synced:** ${sync.recordsSynced.toLocaleString()}`);
465
- lines.push("");
466
- }
467
- lines.push("## Frequency Options");
468
- lines.push("");
469
- lines.push("- **REALTIME**: Sync on every change");
470
- lines.push("- **HOURLY**: Sync every hour");
471
- lines.push("- **DAILY**: Sync once per day");
472
- lines.push("- **WEEKLY**: Sync once per week");
473
- lines.push("- **MANUAL**: Sync only when triggered");
474
- return {
475
- mimeType: "text/markdown",
476
- body: lines.join(`
477
- `)
478
- };
479
- }
480
- };
481
- export {
482
- syncConfigMarkdownRenderer,
483
- integrationDashboardMarkdownRenderer,
484
- connectionListMarkdownRenderer
485
- };
2
+ import{defineVisualization as W,VisualizationRegistry as A}from"@contractspec/lib.contracts-spec/visualizations";var R={key:"integration.list",version:"1.0.0"},M={key:"integration.connection.list",version:"1.0.0"},O={key:"integration.syncConfig.list",version:"1.0.0"},X={version:"1.0.0",domain:"integration",stability:"experimental",owners:["@example.integration-hub"],tags:["integration","visualization","sync"]},L=W({meta:{...X,key:"integration-hub.visualization.integration-types",title:"Integration Types",description:"Distribution of configured integration categories.",goal:"Show where integration coverage is concentrated.",context:"Integration overview."},source:{primary:R,resultPath:"data"},visualization:{kind:"pie",nameDimension:"type",valueMeasure:"count",dimensions:[{key:"type",label:"Type",dataPath:"type",type:"category"}],measures:[{key:"count",label:"Count",dataPath:"count",format:"number"}],table:{caption:"Integration counts by type."}}}),Y=W({meta:{...X,key:"integration-hub.visualization.connection-status",title:"Connection Status",description:"Status distribution across configured connections.",goal:"Highlight connection health and instability.",context:"Connection monitoring."},source:{primary:M,resultPath:"data"},visualization:{kind:"cartesian",variant:"bar",xDimension:"status",yMeasures:["count"],dimensions:[{key:"status",label:"Status",dataPath:"status",type:"category"}],measures:[{key:"count",label:"Connections",dataPath:"count",format:"number",color:"#1d4ed8"}],table:{caption:"Connection counts by status."}}}),v=W({meta:{...X,key:"integration-hub.visualization.sync-healthy",title:"Healthy Syncs",description:"Sync configurations currently healthy or recently successful.",goal:"Summarize healthy synchronization capacity.",context:"Sync-state comparison."},source:{primary:O,resultPath:"data"},visualization:{kind:"metric",measure:"value",measures:[{key:"value",label:"Syncs",dataPath:"value",format:"number"}],table:{caption:"Healthy sync count."}}}),G=W({meta:{...X,key:"integration-hub.visualization.sync-attention",title:"Attention Needed",description:"Sync configurations paused, failing, or otherwise needing review.",goal:"Summarize syncs needing action.",context:"Sync-state comparison."},source:{primary:O,resultPath:"data"},visualization:{kind:"metric",measure:"value",measures:[{key:"value",label:"Syncs",dataPath:"value",format:"number"}],table:{caption:"Syncs requiring attention."}}}),F=[L,Y,v,G],N=new A([...F]),p=F.map((w)=>({key:w.meta.key,version:w.meta.version}));function _(w){return w==="ACTIVE"||w==="SUCCESS"}function f(w,J,K){let x=new Map,q=new Map,P=0,B=0;for(let D of w)x.set(D.type,(x.get(D.type)??0)+1);for(let D of J)q.set(D.status,(q.get(D.status)??0)+1);for(let D of K)if(_(D.status))P+=1;else B+=1;return{primaryItems:[{key:"integration-types",spec:L,data:{data:Array.from(x.entries()).map(([D,j])=>({type:D,count:j}))},title:"Integration Types",description:"Configured integrations grouped by category.",height:260},{key:"connection-status",spec:Y,data:{data:Array.from(q.entries()).map(([D,j])=>({status:D,count:j}))},title:"Connection Status",description:"Operational health across current connections."}],comparisonItems:[{key:"healthy-syncs",spec:v,data:{data:[{value:P}]},title:"Healthy Syncs",description:"Active or recently successful sync configurations.",height:200},{key:"attention-syncs",spec:G,data:{data:[{value:B}]},title:"Attention Needed",description:"Paused, failed, or degraded sync configurations.",height:200}]}}var h=[{id:"int-1",name:"Salesforce",type:"CRM",status:"ACTIVE",connectionCount:3},{id:"int-2",name:"HubSpot",type:"MARKETING",status:"ACTIVE",connectionCount:2},{id:"int-3",name:"Stripe",type:"PAYMENT",status:"ACTIVE",connectionCount:1},{id:"int-4",name:"Slack",type:"COMMUNICATION",status:"INACTIVE",connectionCount:0},{id:"int-5",name:"Google Sheets",type:"DATA",status:"ACTIVE",connectionCount:5},{id:"int-6",name:"PostHog",type:"ANALYTICS",status:"ACTIVE",connectionCount:1}],H=[{id:"conn-1",integrationId:"int-1",name:"Production Salesforce",status:"CONNECTED",lastSyncAt:"2024-01-16T10:00:00Z"},{id:"conn-2",integrationId:"int-1",name:"Sandbox Salesforce",status:"CONNECTED",lastSyncAt:"2024-01-15T14:00:00Z"},{id:"conn-3",integrationId:"int-2",name:"Marketing HubSpot",status:"CONNECTED",lastSyncAt:"2024-01-16T08:00:00Z"},{id:"conn-4",integrationId:"int-3",name:"Stripe Live",status:"CONNECTED",lastSyncAt:"2024-01-16T12:00:00Z"},{id:"conn-5",integrationId:"int-5",name:"Analytics Sheet",status:"ERROR",lastSyncAt:"2024-01-14T09:00:00Z",error:"Authentication expired"},{id:"conn-6",integrationId:"int-6",name:"PostHog Workspace",status:"CONNECTED",lastSyncAt:"2024-01-16T11:45:00Z"}],k=[{id:"sync-1",connectionId:"conn-1",name:"Contacts Sync",frequency:"HOURLY",lastRunAt:"2024-01-16T10:00:00Z",status:"SUCCESS",recordsSynced:1250},{id:"sync-2",connectionId:"conn-1",name:"Opportunities Sync",frequency:"DAILY",lastRunAt:"2024-01-16T00:00:00Z",status:"SUCCESS",recordsSynced:340},{id:"sync-3",connectionId:"conn-3",name:"Orders Sync",frequency:"REALTIME",lastRunAt:"2024-01-16T12:30:00Z",status:"SUCCESS",recordsSynced:89},{id:"sync-4",connectionId:"conn-5",name:"Metrics Export",frequency:"DAILY",lastRunAt:"2024-01-14T09:00:00Z",status:"FAILED",recordsSynced:0}],S={target:"markdown",render:async(w)=>{if(w.source.type!=="component"||w.source.componentKey!=="IntegrationDashboard")throw Error("integrationDashboardMarkdownRenderer: not IntegrationDashboard");let J=h,K=H,x=k,q=f(J,K,x),P=J.filter((b)=>b.status==="ACTIVE"),B=K.filter((b)=>b.status==="CONNECTED"),Q=K.filter((b)=>b.status==="ERROR"),D=x.filter((b)=>b.status==="SUCCESS").reduce((b,U)=>b+U.recordsSynced,0),j=["# Integration Hub","","> Connect and sync data with external services","","## Overview","","| Metric | Value |","|--------|-------|",`| Active Integrations | ${P.length} |`,`| Connected Services | ${B.length} |`,`| Error Connections | ${Q.length} |`,`| Sync Configs | ${x.length} |`,`| Records Synced (24h) | ${D.toLocaleString()} |`,""];j.push("## Visualization Overview"),j.push("");for(let b of[...q.primaryItems,...q.comparisonItems])j.push(`- **${b.title}** via \`${b.spec.meta.key}\``);j.push(""),j.push("## Integrations"),j.push(""),j.push("| Name | Type | Connections | Status |"),j.push("|------|------|-------------|--------|");for(let b of J){let U=b.status==="ACTIVE"?"\uD83D\uDFE2":"\u26AB";j.push(`| ${b.name} | ${b.type} | ${b.connectionCount} | ${U} ${b.status} |`)}j.push(""),j.push("## Recent Sync Activity"),j.push(""),j.push("| Sync | Frequency | Last Run | Records | Status |"),j.push("|------|-----------|----------|---------|--------|");for(let b of x){let U=new Date(b.lastRunAt).toLocaleString(),$=b.status==="SUCCESS"?"\u2705":"\u274C";j.push(`| ${b.name} | ${b.frequency} | ${U} | ${b.recordsSynced} | ${$} ${b.status} |`)}if(Q.length>0){j.push(""),j.push("## \u26A0\uFE0F Connections with Errors"),j.push("");for(let b of Q){let U=J.find(($)=>$.id===b.integrationId);j.push(`- **${b.name}** (${U?.name??"Unknown"}): ${b.error??"Unknown error"}`)}}return{mimeType:"text/markdown",body:j.join(`
3
+ `)}}},g={target:"markdown",render:async(w)=>{if(w.source.type!=="component"||w.source.componentKey!=="ConnectionList")throw Error("connectionListMarkdownRenderer: not ConnectionList");let J=H,K=h,x=["# Connections","","> Manage connections to external services",""];for(let q of K){let P=J.filter((B)=>B.integrationId===q.id);if(P.length===0)continue;x.push(`## ${q.name}`),x.push(""),x.push("| Connection | Status | Last Sync |"),x.push("|------------|--------|-----------|");for(let B of P){let Q=new Date(B.lastSyncAt).toLocaleString(),Z=B.status==="CONNECTED"?"\uD83D\uDFE2":B.status==="ERROR"?"\uD83D\uDD34":"\u26AB";x.push(`| ${B.name} | ${Z} ${B.status} | ${Q} |`)}x.push("")}return{mimeType:"text/markdown",body:x.join(`
4
+ `)}}},u={target:"markdown",render:async(w)=>{if(w.source.type!=="component"||w.source.componentKey!=="SyncConfigEditor")throw Error("syncConfigMarkdownRenderer: not SyncConfigEditor");let J=k,K=H,x=["# Sync Configurations","","> Configure automated data synchronization",""];for(let q of J){let P=K.find((Q)=>Q.id===q.connectionId),B=q.status==="SUCCESS"?"\u2705":"\u274C";x.push(`## ${q.name}`),x.push(""),x.push(`**Connection:** ${P?.name??"Unknown"}`),x.push(`**Frequency:** ${q.frequency}`),x.push(`**Status:** ${B} ${q.status}`),x.push(`**Last Run:** ${new Date(q.lastRunAt).toLocaleString()}`),x.push(`**Records Synced:** ${q.recordsSynced.toLocaleString()}`),x.push("")}return x.push("## Frequency Options"),x.push(""),x.push("- **REALTIME**: Sync on every change"),x.push("- **HOURLY**: Sync every hour"),x.push("- **DAILY**: Sync once per day"),x.push("- **WEEKLY**: Sync once per week"),x.push("- **MANUAL**: Sync only when triggered"),{mimeType:"text/markdown",body:x.join(`
5
+ `)}}};export{u as syncConfigMarkdownRenderer,S as integrationDashboardMarkdownRenderer,g as connectionListMarkdownRenderer};