@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.
Files changed (190) hide show
  1. package/dist/browser/connection/connection.enum.js +12 -0
  2. package/dist/browser/connection/connection.operation.js +101 -0
  3. package/dist/browser/connection/connection.presentation.js +99 -0
  4. package/dist/browser/connection/connection.schema.js +48 -0
  5. package/dist/browser/connection/index.js +104 -0
  6. package/dist/browser/docs/index.js +104 -0
  7. package/dist/browser/docs/integration-hub.docblock.js +104 -0
  8. package/dist/browser/events.js +211 -0
  9. package/dist/browser/example.js +42 -0
  10. package/dist/browser/handlers/index.js +246 -0
  11. package/dist/browser/handlers/integration.handlers.js +246 -0
  12. package/dist/browser/index.js +1595 -0
  13. package/dist/browser/integration/index.js +92 -0
  14. package/dist/browser/integration/integration.enum.js +12 -0
  15. package/dist/browser/integration/integration.operations.js +89 -0
  16. package/dist/browser/integration/integration.presentation.js +117 -0
  17. package/dist/browser/integration/integration.schema.js +42 -0
  18. package/dist/browser/integration-hub.capability.js +40 -0
  19. package/dist/browser/integration-hub.feature.js +114 -0
  20. package/dist/browser/seeders/index.js +60 -0
  21. package/dist/browser/sync/index.js +332 -0
  22. package/dist/browser/sync/sync.enum.js +26 -0
  23. package/dist/browser/sync/sync.operations.js +321 -0
  24. package/dist/browser/sync/sync.presentation.js +298 -0
  25. package/dist/browser/sync/sync.schema.js +154 -0
  26. package/dist/browser/sync-engine/index.js +186 -0
  27. package/dist/browser/tests/operations.test-spec.js +85 -0
  28. package/dist/browser/ui/IntegrationDashboard.js +369 -0
  29. package/dist/browser/ui/hooks/index.js +57 -0
  30. package/dist/browser/ui/hooks/useIntegrationData.js +54 -0
  31. package/dist/browser/ui/index.js +644 -0
  32. package/dist/browser/ui/renderers/index.js +273 -0
  33. package/dist/browser/ui/renderers/integration.markdown.js +273 -0
  34. package/dist/connection/connection.enum.d.ts +1 -6
  35. package/dist/connection/connection.enum.d.ts.map +1 -1
  36. package/dist/connection/connection.enum.js +11 -15
  37. package/dist/connection/connection.operation.d.ts +78 -84
  38. package/dist/connection/connection.operation.d.ts.map +1 -1
  39. package/dist/connection/connection.operation.js +99 -60
  40. package/dist/connection/connection.presentation.d.ts +2 -7
  41. package/dist/connection/connection.presentation.d.ts.map +1 -1
  42. package/dist/connection/connection.presentation.js +96 -56
  43. package/dist/connection/connection.schema.d.ts +54 -59
  44. package/dist/connection/connection.schema.d.ts.map +1 -1
  45. package/dist/connection/connection.schema.js +46 -73
  46. package/dist/connection/index.d.ts +7 -4
  47. package/dist/connection/index.d.ts.map +1 -0
  48. package/dist/connection/index.js +104 -4
  49. package/dist/docs/index.d.ts +2 -1
  50. package/dist/docs/index.d.ts.map +1 -0
  51. package/dist/docs/index.js +105 -1
  52. package/dist/docs/integration-hub.docblock.d.ts +2 -1
  53. package/dist/docs/integration-hub.docblock.d.ts.map +1 -0
  54. package/dist/docs/integration-hub.docblock.js +45 -56
  55. package/dist/events.d.ts +137 -143
  56. package/dist/events.d.ts.map +1 -1
  57. package/dist/events.js +210 -287
  58. package/dist/example.d.ts +2 -6
  59. package/dist/example.d.ts.map +1 -1
  60. package/dist/example.js +41 -55
  61. package/dist/handlers/index.d.ts +2 -2
  62. package/dist/handlers/index.d.ts.map +1 -0
  63. package/dist/handlers/index.js +247 -3
  64. package/dist/handlers/integration.handlers.d.ts +114 -113
  65. package/dist/handlers/integration.handlers.d.ts.map +1 -1
  66. package/dist/handlers/integration.handlers.js +232 -267
  67. package/dist/index.d.ts +12 -19
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +1596 -20
  70. package/dist/integration/index.d.ts +7 -4
  71. package/dist/integration/index.d.ts.map +1 -0
  72. package/dist/integration/index.js +92 -4
  73. package/dist/integration/integration.enum.d.ts +1 -6
  74. package/dist/integration/integration.enum.d.ts.map +1 -1
  75. package/dist/integration/integration.enum.js +11 -15
  76. package/dist/integration/integration.operations.d.ts +74 -80
  77. package/dist/integration/integration.operations.d.ts.map +1 -1
  78. package/dist/integration/integration.operations.js +87 -54
  79. package/dist/integration/integration.presentation.d.ts +3 -8
  80. package/dist/integration/integration.presentation.d.ts.map +1 -1
  81. package/dist/integration/integration.presentation.js +114 -73
  82. package/dist/integration/integration.schema.d.ts +54 -59
  83. package/dist/integration/integration.schema.d.ts.map +1 -1
  84. package/dist/integration/integration.schema.js +40 -73
  85. package/dist/integration-hub.capability.d.ts +3 -8
  86. package/dist/integration-hub.capability.d.ts.map +1 -1
  87. package/dist/integration-hub.capability.js +41 -38
  88. package/dist/integration-hub.feature.d.ts +1 -6
  89. package/dist/integration-hub.feature.d.ts.map +1 -1
  90. package/dist/integration-hub.feature.js +113 -242
  91. package/dist/node/connection/connection.enum.js +12 -0
  92. package/dist/node/connection/connection.operation.js +101 -0
  93. package/dist/node/connection/connection.presentation.js +99 -0
  94. package/dist/node/connection/connection.schema.js +48 -0
  95. package/dist/node/connection/index.js +104 -0
  96. package/dist/node/docs/index.js +104 -0
  97. package/dist/node/docs/integration-hub.docblock.js +104 -0
  98. package/dist/node/events.js +211 -0
  99. package/dist/node/example.js +42 -0
  100. package/dist/node/handlers/index.js +246 -0
  101. package/dist/node/handlers/integration.handlers.js +246 -0
  102. package/dist/node/index.js +1595 -0
  103. package/dist/node/integration/index.js +92 -0
  104. package/dist/node/integration/integration.enum.js +12 -0
  105. package/dist/node/integration/integration.operations.js +89 -0
  106. package/dist/node/integration/integration.presentation.js +117 -0
  107. package/dist/node/integration/integration.schema.js +42 -0
  108. package/dist/node/integration-hub.capability.js +40 -0
  109. package/dist/node/integration-hub.feature.js +114 -0
  110. package/dist/node/seeders/index.js +60 -0
  111. package/dist/node/sync/index.js +332 -0
  112. package/dist/node/sync/sync.enum.js +26 -0
  113. package/dist/node/sync/sync.operations.js +321 -0
  114. package/dist/node/sync/sync.presentation.js +298 -0
  115. package/dist/node/sync/sync.schema.js +154 -0
  116. package/dist/node/sync-engine/index.js +186 -0
  117. package/dist/node/tests/operations.test-spec.js +85 -0
  118. package/dist/node/ui/IntegrationDashboard.js +369 -0
  119. package/dist/node/ui/hooks/index.js +57 -0
  120. package/dist/node/ui/hooks/useIntegrationData.js +54 -0
  121. package/dist/node/ui/index.js +644 -0
  122. package/dist/node/ui/renderers/index.js +273 -0
  123. package/dist/node/ui/renderers/integration.markdown.js +273 -0
  124. package/dist/seeders/index.d.ts +4 -8
  125. package/dist/seeders/index.d.ts.map +1 -1
  126. package/dist/seeders/index.js +54 -52
  127. package/dist/sync/index.d.ts +7 -4
  128. package/dist/sync/index.d.ts.map +1 -0
  129. package/dist/sync/index.js +332 -4
  130. package/dist/sync/sync.enum.d.ts +3 -8
  131. package/dist/sync/sync.enum.d.ts.map +1 -1
  132. package/dist/sync/sync.enum.js +23 -31
  133. package/dist/sync/sync.operations.d.ts +413 -419
  134. package/dist/sync/sync.operations.d.ts.map +1 -1
  135. package/dist/sync/sync.operations.js +316 -197
  136. package/dist/sync/sync.presentation.d.ts +6 -11
  137. package/dist/sync/sync.presentation.d.ts.map +1 -1
  138. package/dist/sync/sync.presentation.js +291 -160
  139. package/dist/sync/sync.schema.d.ts +317 -322
  140. package/dist/sync/sync.schema.d.ts.map +1 -1
  141. package/dist/sync/sync.schema.js +146 -295
  142. package/dist/sync-engine/index.d.ts +88 -91
  143. package/dist/sync-engine/index.d.ts.map +1 -1
  144. package/dist/sync-engine/index.js +181 -142
  145. package/dist/tests/operations.test-spec.d.ts +3 -8
  146. package/dist/tests/operations.test-spec.d.ts.map +1 -1
  147. package/dist/tests/operations.test-spec.js +82 -90
  148. package/dist/ui/IntegrationDashboard.d.ts +1 -6
  149. package/dist/ui/IntegrationDashboard.d.ts.map +1 -1
  150. package/dist/ui/IntegrationDashboard.js +365 -261
  151. package/dist/ui/hooks/index.d.ts +2 -2
  152. package/dist/ui/hooks/index.d.ts.map +1 -0
  153. package/dist/ui/hooks/index.js +57 -4
  154. package/dist/ui/hooks/useIntegrationData.d.ts +16 -20
  155. package/dist/ui/hooks/useIntegrationData.d.ts.map +1 -1
  156. package/dist/ui/hooks/useIntegrationData.js +51 -55
  157. package/dist/ui/index.d.ts +7 -6
  158. package/dist/ui/index.d.ts.map +1 -0
  159. package/dist/ui/index.js +644 -5
  160. package/dist/ui/renderers/index.d.ts +2 -2
  161. package/dist/ui/renderers/index.d.ts.map +1 -0
  162. package/dist/ui/renderers/index.js +274 -3
  163. package/dist/ui/renderers/integration.markdown.d.ts +13 -14
  164. package/dist/ui/renderers/integration.markdown.d.ts.map +1 -1
  165. package/dist/ui/renderers/integration.markdown.js +268 -264
  166. package/package.json +360 -71
  167. package/dist/connection/connection.enum.js.map +0 -1
  168. package/dist/connection/connection.operation.js.map +0 -1
  169. package/dist/connection/connection.presentation.js.map +0 -1
  170. package/dist/connection/connection.schema.js.map +0 -1
  171. package/dist/docs/integration-hub.docblock.js.map +0 -1
  172. package/dist/events.js.map +0 -1
  173. package/dist/example.js.map +0 -1
  174. package/dist/handlers/integration.handlers.js.map +0 -1
  175. package/dist/integration/integration.enum.js.map +0 -1
  176. package/dist/integration/integration.operations.js.map +0 -1
  177. package/dist/integration/integration.presentation.js.map +0 -1
  178. package/dist/integration/integration.schema.js.map +0 -1
  179. package/dist/integration-hub.capability.js.map +0 -1
  180. package/dist/integration-hub.feature.js.map +0 -1
  181. package/dist/seeders/index.js.map +0 -1
  182. package/dist/sync/sync.enum.js.map +0 -1
  183. package/dist/sync/sync.operations.js.map +0 -1
  184. package/dist/sync/sync.presentation.js.map +0 -1
  185. package/dist/sync/sync.schema.js.map +0 -1
  186. package/dist/sync-engine/index.js.map +0 -1
  187. package/dist/tests/operations.test-spec.js.map +0 -1
  188. package/dist/ui/IntegrationDashboard.js.map +0 -1
  189. package/dist/ui/hooks/useIntegrationData.js.map +0 -1
  190. 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
+ };
@@ -1,10 +1,6 @@
1
- import { DatabasePort } from "@contractspec/lib.runtime-sandbox";
2
-
3
- //#region src/seeders/index.d.ts
4
- declare function seedIntegrationHub(params: {
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","names":[],"sources":["../../src/seeders/index.ts"],"mappings":";;;iBAEsB,kBAAA,CAAmB,MAAA;EACvC,SAAA;EACA,EAAA,EAAI,YAAA;AAAA,IACL,OAAA"}
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"}
@@ -1,59 +1,61 @@
1
- //#region src/seeders/index.ts
1
+ // @bun
2
+ // src/seeders/index.ts
2
3
  async function seedIntegrationHub(params) {
3
- const { projectId, db } = params;
4
- if ((await db.query(`SELECT COUNT(*) as count FROM integration WHERE "projectId" = $1`, [projectId])).rows[0]?.count > 0) return;
5
- await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
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
- "int_1",
8
- projectId,
9
- "org_demo",
10
- "Salesforce",
11
- "Salesforce CRM integration",
12
- "CRM",
13
- "ACTIVE"
14
- ]);
15
- await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
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
- "int_2",
18
- projectId,
19
- "org_demo",
20
- "Meeting Recorder",
21
- "Meeting recorder transcripts and metadata",
22
- "DATA",
23
- "ACTIVE"
24
- ]);
25
- await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
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
- "int_3",
28
- projectId,
29
- "org_demo",
30
- "Gradium Voice",
31
- "Gradium low-latency text-to-speech integration",
32
- "COMMUNICATION",
33
- "ACTIVE"
34
- ]);
35
- await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
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
- "int_4",
38
- projectId,
39
- "org_demo",
40
- "Fal Chatterbox Voice",
41
- "Fal Chatterbox text-to-speech integration",
42
- "COMMUNICATION",
43
- "ACTIVE"
44
- ]);
45
- await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
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
- "int_5",
48
- projectId,
49
- "org_demo",
50
- "PostHog Analytics",
51
- "Product analytics and event capture",
52
- "ANALYTICS",
53
- "ACTIVE"
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
- //#endregion
58
- export { seedIntegrationHub };
59
- //# sourceMappingURL=index.js.map
59
+ export {
60
+ seedIntegrationHub
61
+ };