@friggframework/devtools 2.0.0--canary.398.7664c46.0 → 2.0.0--canary.400.bed3308.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 (167) hide show
  1. package/frigg-cli/.eslintrc.js +141 -0
  2. package/frigg-cli/__tests__/jest.config.js +102 -0
  3. package/frigg-cli/__tests__/unit/commands/build.test.js +483 -0
  4. package/frigg-cli/__tests__/unit/commands/install.test.js +418 -0
  5. package/frigg-cli/__tests__/unit/commands/ui.test.js +592 -0
  6. package/frigg-cli/__tests__/utils/command-tester.js +170 -0
  7. package/frigg-cli/__tests__/utils/mock-factory.js +270 -0
  8. package/frigg-cli/__tests__/utils/test-fixtures.js +463 -0
  9. package/frigg-cli/__tests__/utils/test-setup.js +286 -0
  10. package/frigg-cli/build-command/index.js +15 -2
  11. package/frigg-cli/deploy-command/index.js +15 -2
  12. package/frigg-cli/generate-command/__tests__/generate-command.test.js +312 -0
  13. package/frigg-cli/generate-command/azure-generator.js +43 -0
  14. package/frigg-cli/generate-command/gcp-generator.js +47 -0
  15. package/frigg-cli/generate-command/index.js +350 -0
  16. package/frigg-cli/generate-command/terraform-generator.js +555 -0
  17. package/frigg-cli/index.js +66 -4
  18. package/frigg-cli/install-command/index.js +15 -2
  19. package/frigg-cli/package.json +75 -0
  20. package/frigg-cli/start-command/index.js +17 -2
  21. package/frigg-cli/ui-command/index.js +167 -0
  22. package/frigg-cli/utils/app-resolver.js +319 -0
  23. package/frigg-cli/utils/backend-path.js +38 -0
  24. package/frigg-cli/utils/process-manager.js +199 -0
  25. package/frigg-cli/utils/repo-detection.js +405 -0
  26. package/infrastructure/AWS-IAM-CREDENTIAL-NEEDS.md +43 -19
  27. package/infrastructure/IAM-POLICY-TEMPLATES.md +1 -1
  28. package/infrastructure/frigg-deployment-iam-stack.yaml +16 -2
  29. package/infrastructure/iam-generator.js +129 -6
  30. package/infrastructure/iam-policy-basic.json +29 -5
  31. package/infrastructure/iam-policy-full.json +28 -5
  32. package/infrastructure/serverless-template.js +209 -3
  33. package/infrastructure/serverless-template.test.js +12 -0
  34. package/management-ui/.eslintrc.js +22 -0
  35. package/management-ui/README.md +203 -0
  36. package/management-ui/components.json +21 -0
  37. package/management-ui/{dist/index.html → index.html} +1 -2
  38. package/management-ui/merge-conflict-cleaner.py +371 -0
  39. package/management-ui/package-lock.json +10997 -0
  40. package/management-ui/package.json +76 -0
  41. package/management-ui/postcss.config.js +6 -0
  42. package/management-ui/server/api/backend.js +256 -0
  43. package/management-ui/server/api/cli.js +315 -0
  44. package/management-ui/server/api/codegen.js +663 -0
  45. package/management-ui/server/api/connections.js +857 -0
  46. package/management-ui/server/api/discovery.js +185 -0
  47. package/management-ui/server/api/environment/index.js +1 -0
  48. package/management-ui/server/api/environment/router.js +378 -0
  49. package/management-ui/server/api/environment.js +328 -0
  50. package/management-ui/server/api/integrations.js +479 -0
  51. package/management-ui/server/api/logs.js +248 -0
  52. package/management-ui/server/api/monitoring.js +282 -0
  53. package/management-ui/server/api/open-ide.js +31 -0
  54. package/management-ui/server/api/project.js +553 -0
  55. package/management-ui/server/api/users/sessions.js +371 -0
  56. package/management-ui/server/api/users/simulation.js +254 -0
  57. package/management-ui/server/api/users.js +362 -0
  58. package/management-ui/server/api-contract.md +275 -0
  59. package/management-ui/server/index.js +428 -0
  60. package/management-ui/server/middleware/errorHandler.js +70 -0
  61. package/management-ui/server/middleware/security.js +32 -0
  62. package/management-ui/server/processManager.js +296 -0
  63. package/management-ui/server/server.js +188 -0
  64. package/management-ui/server/services/aws-monitor.js +413 -0
  65. package/management-ui/server/services/npm-registry.js +347 -0
  66. package/management-ui/server/services/template-engine.js +538 -0
  67. package/management-ui/server/utils/cliIntegration.js +220 -0
  68. package/management-ui/server/utils/environment/auditLogger.js +471 -0
  69. package/management-ui/server/utils/environment/awsParameterStore.js +264 -0
  70. package/management-ui/server/utils/environment/encryption.js +278 -0
  71. package/management-ui/server/utils/environment/envFileManager.js +286 -0
  72. package/management-ui/server/utils/import-commonjs.js +28 -0
  73. package/management-ui/server/utils/response.js +83 -0
  74. package/management-ui/server/websocket/handler.js +325 -0
  75. package/management-ui/src/App.jsx +51 -0
  76. package/management-ui/src/components/AppRouter.jsx +65 -0
  77. package/management-ui/src/components/Button.jsx +2 -0
  78. package/management-ui/src/components/Card.jsx +9 -0
  79. package/management-ui/src/components/EnvironmentCompare.jsx +400 -0
  80. package/management-ui/src/components/EnvironmentEditor.jsx +372 -0
  81. package/management-ui/src/components/EnvironmentImportExport.jsx +469 -0
  82. package/management-ui/src/components/EnvironmentSchema.jsx +491 -0
  83. package/management-ui/src/components/EnvironmentSecurity.jsx +463 -0
  84. package/management-ui/src/components/ErrorBoundary.jsx +73 -0
  85. package/management-ui/src/components/IntegrationCard.jsx +199 -0
  86. package/management-ui/src/components/IntegrationCardEnhanced.jsx +490 -0
  87. package/management-ui/src/components/IntegrationExplorer.jsx +379 -0
  88. package/management-ui/src/components/IntegrationStatus.jsx +235 -0
  89. package/management-ui/src/components/Layout.jsx +250 -0
  90. package/management-ui/src/components/LoadingSpinner.jsx +45 -0
  91. package/management-ui/src/components/RepositoryPicker.jsx +248 -0
  92. package/management-ui/src/components/SessionMonitor.jsx +255 -0
  93. package/management-ui/src/components/StatusBadge.jsx +70 -0
  94. package/management-ui/src/components/UserContextSwitcher.jsx +154 -0
  95. package/management-ui/src/components/UserSimulation.jsx +299 -0
  96. package/management-ui/src/components/Welcome.jsx +434 -0
  97. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +637 -0
  98. package/management-ui/src/components/codegen/APIModuleSelector.jsx +227 -0
  99. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +247 -0
  100. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +316 -0
  101. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +271 -0
  102. package/management-ui/src/components/codegen/FormBuilder.jsx +737 -0
  103. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +855 -0
  104. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +797 -0
  105. package/management-ui/src/components/codegen/SchemaBuilder.jsx +303 -0
  106. package/management-ui/src/components/codegen/TemplateSelector.jsx +586 -0
  107. package/management-ui/src/components/codegen/index.js +10 -0
  108. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +362 -0
  109. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +182 -0
  110. package/management-ui/src/components/connections/ConnectionTester.jsx +200 -0
  111. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +292 -0
  112. package/management-ui/src/components/connections/OAuthFlow.jsx +204 -0
  113. package/management-ui/src/components/connections/index.js +5 -0
  114. package/management-ui/src/components/index.js +21 -0
  115. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +222 -0
  116. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +169 -0
  117. package/management-ui/src/components/monitoring/MetricsChart.jsx +197 -0
  118. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +393 -0
  119. package/management-ui/src/components/monitoring/SQSMetrics.jsx +246 -0
  120. package/management-ui/src/components/monitoring/index.js +6 -0
  121. package/management-ui/src/components/monitoring/monitoring.css +218 -0
  122. package/management-ui/src/components/theme-provider.jsx +52 -0
  123. package/management-ui/src/components/theme-toggle.jsx +39 -0
  124. package/management-ui/src/components/ui/badge.tsx +36 -0
  125. package/management-ui/src/components/ui/button.test.jsx +56 -0
  126. package/management-ui/src/components/ui/button.tsx +57 -0
  127. package/management-ui/src/components/ui/card.tsx +76 -0
  128. package/management-ui/src/components/ui/dropdown-menu.tsx +199 -0
  129. package/management-ui/src/components/ui/select.tsx +157 -0
  130. package/management-ui/src/components/ui/skeleton.jsx +15 -0
  131. package/management-ui/src/hooks/useFrigg.jsx +387 -0
  132. package/management-ui/src/hooks/useSocket.jsx +58 -0
  133. package/management-ui/src/index.css +194 -0
  134. package/management-ui/src/lib/utils.ts +6 -0
  135. package/management-ui/src/main.jsx +10 -0
  136. package/management-ui/src/pages/CodeGeneration.jsx +14 -0
  137. package/management-ui/src/pages/Connections.jsx +252 -0
  138. package/management-ui/src/pages/ConnectionsEnhanced.jsx +427 -0
  139. package/management-ui/src/pages/Dashboard.jsx +311 -0
  140. package/management-ui/src/pages/Environment.jsx +314 -0
  141. package/management-ui/src/pages/IntegrationConfigure.jsx +544 -0
  142. package/management-ui/src/pages/IntegrationDiscovery.jsx +479 -0
  143. package/management-ui/src/pages/IntegrationTest.jsx +494 -0
  144. package/management-ui/src/pages/Integrations.jsx +254 -0
  145. package/management-ui/src/pages/Monitoring.jsx +17 -0
  146. package/management-ui/src/pages/Simulation.jsx +155 -0
  147. package/management-ui/src/pages/Users.jsx +492 -0
  148. package/management-ui/src/services/api.js +41 -0
  149. package/management-ui/src/services/apiModuleService.js +193 -0
  150. package/management-ui/src/services/websocket-handlers.js +120 -0
  151. package/management-ui/src/test/api/project.test.js +273 -0
  152. package/management-ui/src/test/components/Welcome.test.jsx +378 -0
  153. package/management-ui/src/test/mocks/server.js +178 -0
  154. package/management-ui/src/test/setup.js +61 -0
  155. package/management-ui/src/test/utils/test-utils.jsx +134 -0
  156. package/management-ui/src/utils/repository.js +98 -0
  157. package/management-ui/src/utils/repository.test.js +118 -0
  158. package/management-ui/src/workflows/phase2-integration-workflows.js +884 -0
  159. package/management-ui/tailwind.config.js +63 -0
  160. package/management-ui/tsconfig.json +37 -0
  161. package/management-ui/tsconfig.node.json +10 -0
  162. package/management-ui/vite.config.js +26 -0
  163. package/management-ui/vitest.config.js +38 -0
  164. package/package.json +5 -5
  165. package/management-ui/dist/assets/index-CbM64Oba.js +0 -1221
  166. package/management-ui/dist/assets/index-CkvseXTC.css +0 -1
  167. /package/management-ui/{dist/assets/FriggLogo-B7Xx8ZW1.svg → src/assets/FriggLogo.svg} +0 -0
@@ -0,0 +1,299 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { Play, Square, AlertCircle, CheckCircle, Clock, Zap } from 'lucide-react'
3
+ import { useFrigg } from '../hooks/useFrigg'
4
+ import { useSocket } from '../hooks/useSocket'
5
+ import api from '../services/api'
6
+ import { cn } from '../lib/utils'
7
+
8
+ const UserSimulation = ({ user, integration }) => {
9
+ const { currentUser } = useFrigg()
10
+ const { on } = useSocket()
11
+ const [isSimulating, setIsSimulating] = useState(false)
12
+ const [session, setSession] = useState(null)
13
+ const [logs, setLogs] = useState([])
14
+ const [selectedAction, setSelectedAction] = useState('list')
15
+ const [actionPayload, setActionPayload] = useState('')
16
+
17
+ const simulationUser = user || currentUser
18
+
19
+ useEffect(() => {
20
+ // Listen for simulation events
21
+ const unsubscribeAuth = on('simulation:auth', (data) => {
22
+ addLog('Authentication', data.session)
23
+ })
24
+
25
+ const unsubscribeAction = on('simulation:action', (data) => {
26
+ addLog('Action Performed', data.actionResult)
27
+ })
28
+
29
+ const unsubscribeWebhook = on('simulation:webhook', (data) => {
30
+ addLog('Webhook Event', data.webhookEvent)
31
+ })
32
+
33
+ return () => {
34
+ unsubscribeAuth && unsubscribeAuth()
35
+ unsubscribeAction && unsubscribeAction()
36
+ unsubscribeWebhook && unsubscribeWebhook()
37
+ }
38
+ }, [on])
39
+
40
+ const addLog = (type, data) => {
41
+ setLogs(prev => [{
42
+ id: Date.now(),
43
+ type,
44
+ data,
45
+ timestamp: new Date().toISOString()
46
+ }, ...prev].slice(0, 50)) // Keep last 50 logs
47
+ }
48
+
49
+ const startSimulation = async () => {
50
+ if (!simulationUser || !integration) {
51
+ alert('Please select a user and integration')
52
+ return
53
+ }
54
+
55
+ try {
56
+ setIsSimulating(true)
57
+ const response = await api.post('/api/users/simulation/authenticate', {
58
+ userId: simulationUser.id,
59
+ integrationId: integration.id
60
+ })
61
+
62
+ setSession(response.data.session)
63
+ addLog('Session Started', response.data.session)
64
+ } catch (error) {
65
+ console.error('Failed to start simulation:', error)
66
+ alert('Failed to start simulation')
67
+ setIsSimulating(false)
68
+ }
69
+ }
70
+
71
+ const stopSimulation = async () => {
72
+ if (!session) return
73
+
74
+ try {
75
+ await api.delete(`/api/users/simulation/sessions/${session.sessionId}`)
76
+ setSession(null)
77
+ setIsSimulating(false)
78
+ addLog('Session Ended', { sessionId: session.sessionId })
79
+ } catch (error) {
80
+ console.error('Failed to stop simulation:', error)
81
+ }
82
+ }
83
+
84
+ const performAction = async () => {
85
+ if (!session) return
86
+
87
+ try {
88
+ let payload = {}
89
+ if (actionPayload) {
90
+ try {
91
+ payload = JSON.parse(actionPayload)
92
+ } catch {
93
+ payload = { data: actionPayload }
94
+ }
95
+ }
96
+
97
+ const response = await api.post('/api/users/simulation/action', {
98
+ sessionId: session.sessionId,
99
+ action: selectedAction,
100
+ payload
101
+ })
102
+
103
+ addLog('Action Result', response.data.actionResult)
104
+ } catch (error) {
105
+ console.error('Failed to perform action:', error)
106
+ alert('Failed to perform action')
107
+ }
108
+ }
109
+
110
+ const simulateWebhook = async () => {
111
+ if (!simulationUser || !integration) return
112
+
113
+ try {
114
+ const response = await api.post('/api/users/simulation/webhook', {
115
+ userId: simulationUser.id,
116
+ integrationId: integration.id,
117
+ event: 'data.updated',
118
+ data: {
119
+ id: 'webhook_item_' + Date.now(),
120
+ changes: ['field1', 'field2'],
121
+ timestamp: new Date().toISOString()
122
+ }
123
+ })
124
+
125
+ addLog('Webhook Simulated', response.data.webhookEvent)
126
+ } catch (error) {
127
+ console.error('Failed to simulate webhook:', error)
128
+ alert('Failed to simulate webhook')
129
+ }
130
+ }
131
+
132
+ const commonActions = [
133
+ { value: 'list', label: 'List Items' },
134
+ { value: 'create', label: 'Create Item' },
135
+ { value: 'update', label: 'Update Item' },
136
+ { value: 'delete', label: 'Delete Item' },
137
+ { value: 'sync', label: 'Sync Data' }
138
+ ]
139
+
140
+ return (
141
+ <div className="bg-white rounded-lg shadow p-6">
142
+ <div className="mb-6">
143
+ <h3 className="text-lg font-semibold text-gray-900 mb-2">User Simulation</h3>
144
+ <p className="text-sm text-gray-600">
145
+ Simulate user interactions with integrations for testing
146
+ </p>
147
+ </div>
148
+
149
+ {/* Simulation Controls */}
150
+ <div className="space-y-4 mb-6">
151
+ <div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
152
+ <div>
153
+ <p className="text-sm font-medium text-gray-900">
154
+ {simulationUser ? `${simulationUser.firstName} ${simulationUser.lastName}` : 'No user selected'}
155
+ </p>
156
+ <p className="text-xs text-gray-500">
157
+ {integration ? integration.name : 'No integration selected'}
158
+ </p>
159
+ </div>
160
+ <div className="flex items-center space-x-2">
161
+ {!isSimulating ? (
162
+ <button
163
+ onClick={startSimulation}
164
+ disabled={!simulationUser || !integration}
165
+ className={cn(
166
+ "flex items-center space-x-2 px-4 py-2 rounded-md transition-colors",
167
+ simulationUser && integration
168
+ ? "bg-green-600 text-white hover:bg-green-700"
169
+ : "bg-gray-300 text-gray-500 cursor-not-allowed"
170
+ )}
171
+ >
172
+ <Play size={16} />
173
+ <span>Start Simulation</span>
174
+ </button>
175
+ ) : (
176
+ <button
177
+ onClick={stopSimulation}
178
+ className="flex items-center space-x-2 px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700"
179
+ >
180
+ <Square size={16} />
181
+ <span>Stop Simulation</span>
182
+ </button>
183
+ )}
184
+ </div>
185
+ </div>
186
+
187
+ {session && (
188
+ <div className="p-4 bg-blue-50 border border-blue-200 rounded-lg">
189
+ <div className="flex items-start space-x-3">
190
+ <CheckCircle className="text-blue-600 mt-0.5" size={20} />
191
+ <div className="flex-1">
192
+ <p className="text-sm font-medium text-blue-900">Session Active</p>
193
+ <p className="text-xs text-blue-700 mt-1">
194
+ Session ID: {session.sessionId}
195
+ </p>
196
+ <p className="text-xs text-blue-700">
197
+ Expires: {new Date(session.expiresAt).toLocaleTimeString()}
198
+ </p>
199
+ </div>
200
+ </div>
201
+ </div>
202
+ )}
203
+ </div>
204
+
205
+ {/* Action Simulator */}
206
+ {isSimulating && session && (
207
+ <div className="space-y-4 mb-6">
208
+ <div className="p-4 border border-gray-200 rounded-lg">
209
+ <h4 className="text-sm font-medium text-gray-900 mb-3">Simulate Action</h4>
210
+ <div className="space-y-3">
211
+ <div>
212
+ <label className="block text-xs font-medium text-gray-700 mb-1">
213
+ Action Type
214
+ </label>
215
+ <select
216
+ value={selectedAction}
217
+ onChange={(e) => setSelectedAction(e.target.value)}
218
+ className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500"
219
+ >
220
+ {commonActions.map(action => (
221
+ <option key={action.value} value={action.value}>
222
+ {action.label}
223
+ </option>
224
+ ))}
225
+ </select>
226
+ </div>
227
+ <div>
228
+ <label className="block text-xs font-medium text-gray-700 mb-1">
229
+ Payload (JSON)
230
+ </label>
231
+ <textarea
232
+ value={actionPayload}
233
+ onChange={(e) => setActionPayload(e.target.value)}
234
+ placeholder='{"name": "Test Item"}'
235
+ className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500 font-mono text-xs"
236
+ rows={3}
237
+ />
238
+ </div>
239
+ <div className="flex space-x-2">
240
+ <button
241
+ onClick={performAction}
242
+ className="flex items-center space-x-2 px-3 py-1.5 bg-blue-600 text-white text-sm rounded-md hover:bg-blue-700"
243
+ >
244
+ <Zap size={14} />
245
+ <span>Execute Action</span>
246
+ </button>
247
+ <button
248
+ onClick={simulateWebhook}
249
+ className="flex items-center space-x-2 px-3 py-1.5 bg-purple-600 text-white text-sm rounded-md hover:bg-purple-700"
250
+ >
251
+ <AlertCircle size={14} />
252
+ <span>Trigger Webhook</span>
253
+ </button>
254
+ </div>
255
+ </div>
256
+ </div>
257
+ </div>
258
+ )}
259
+
260
+ {/* Activity Logs */}
261
+ <div>
262
+ <h4 className="text-sm font-medium text-gray-900 mb-3">Activity Log</h4>
263
+ <div className="space-y-2 max-h-64 overflow-y-auto">
264
+ {logs.length === 0 ? (
265
+ <p className="text-sm text-gray-500 text-center py-4">
266
+ No activity yet. Start a simulation to see logs.
267
+ </p>
268
+ ) : (
269
+ logs.map(log => (
270
+ <div
271
+ key={log.id}
272
+ className="p-3 bg-gray-50 rounded-md border border-gray-200"
273
+ >
274
+ <div className="flex items-start justify-between">
275
+ <div className="flex items-center space-x-2">
276
+ <Clock size={14} className="text-gray-500" />
277
+ <span className="text-xs font-medium text-gray-900">
278
+ {log.type}
279
+ </span>
280
+ </div>
281
+ <span className="text-xs text-gray-500">
282
+ {new Date(log.timestamp).toLocaleTimeString()}
283
+ </span>
284
+ </div>
285
+ <div className="mt-1">
286
+ <pre className="text-xs text-gray-600 font-mono overflow-x-auto">
287
+ {JSON.stringify(log.data, null, 2)}
288
+ </pre>
289
+ </div>
290
+ </div>
291
+ ))
292
+ )}
293
+ </div>
294
+ </div>
295
+ </div>
296
+ )
297
+ }
298
+
299
+ export default UserSimulation