@friggframework/devtools 2.0.0-next.61 → 2.0.0-next.62

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 (305) hide show
  1. package/package.json +14 -7
  2. package/.eslintrc.json +0 -3
  3. package/CHANGELOG.md +0 -132
  4. package/infrastructure/ARCHITECTURE.md +0 -487
  5. package/infrastructure/CLAUDE.md +0 -481
  6. package/infrastructure/HEALTH.md +0 -468
  7. package/infrastructure/README.md +0 -522
  8. package/infrastructure/__tests__/fixtures/mock-aws-resources.js +0 -391
  9. package/infrastructure/__tests__/helpers/test-utils.js +0 -277
  10. package/infrastructure/__tests__/postgres-config.test.js +0 -914
  11. package/infrastructure/__tests__/template-generation.test.js +0 -687
  12. package/infrastructure/create-frigg-infrastructure.js +0 -147
  13. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +0 -630
  14. package/infrastructure/docs/PRE-DEPLOYMENT-HEALTH-CHECK-SPEC.md +0 -1317
  15. package/infrastructure/docs/WEBSOCKET-CONFIGURATION.md +0 -105
  16. package/infrastructure/docs/deployment-instructions.md +0 -268
  17. package/infrastructure/docs/generate-iam-command.md +0 -278
  18. package/infrastructure/docs/iam-policy-templates.md +0 -193
  19. package/infrastructure/domains/database/aurora-builder.js +0 -809
  20. package/infrastructure/domains/database/aurora-builder.test.js +0 -950
  21. package/infrastructure/domains/database/aurora-discovery.js +0 -87
  22. package/infrastructure/domains/database/aurora-discovery.test.js +0 -188
  23. package/infrastructure/domains/database/aurora-resolver.js +0 -210
  24. package/infrastructure/domains/database/aurora-resolver.test.js +0 -347
  25. package/infrastructure/domains/database/migration-builder.js +0 -701
  26. package/infrastructure/domains/database/migration-builder.test.js +0 -321
  27. package/infrastructure/domains/database/migration-resolver.js +0 -163
  28. package/infrastructure/domains/database/migration-resolver.test.js +0 -337
  29. package/infrastructure/domains/health/application/ports/IPropertyReconciler.js +0 -164
  30. package/infrastructure/domains/health/application/ports/IResourceDetector.js +0 -129
  31. package/infrastructure/domains/health/application/ports/IResourceImporter.js +0 -142
  32. package/infrastructure/domains/health/application/ports/IStackRepository.js +0 -131
  33. package/infrastructure/domains/health/application/ports/index.js +0 -26
  34. package/infrastructure/domains/health/application/use-cases/__tests__/execute-resource-import-use-case.test.js +0 -679
  35. package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +0 -167
  36. package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +0 -1130
  37. package/infrastructure/domains/health/application/use-cases/execute-resource-import-use-case.js +0 -221
  38. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.js +0 -152
  39. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.test.js +0 -343
  40. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.js +0 -535
  41. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.test.js +0 -376
  42. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.js +0 -213
  43. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +0 -441
  44. package/infrastructure/domains/health/docs/ACME-DEV-DRIFT-ANALYSIS.md +0 -267
  45. package/infrastructure/domains/health/docs/BUILD-VS-DEPLOYED-TEMPLATE-ANALYSIS.md +0 -324
  46. package/infrastructure/domains/health/docs/ORPHAN-DETECTION-ANALYSIS.md +0 -386
  47. package/infrastructure/domains/health/docs/SPEC-CLEANUP-COMMAND.md +0 -1419
  48. package/infrastructure/domains/health/docs/TDD-IMPLEMENTATION-SUMMARY.md +0 -391
  49. package/infrastructure/domains/health/docs/TEMPLATE-COMPARISON-IMPLEMENTATION.md +0 -551
  50. package/infrastructure/domains/health/domain/entities/issue.js +0 -299
  51. package/infrastructure/domains/health/domain/entities/issue.test.js +0 -528
  52. package/infrastructure/domains/health/domain/entities/property-mismatch.js +0 -108
  53. package/infrastructure/domains/health/domain/entities/property-mismatch.test.js +0 -275
  54. package/infrastructure/domains/health/domain/entities/resource.js +0 -159
  55. package/infrastructure/domains/health/domain/entities/resource.test.js +0 -432
  56. package/infrastructure/domains/health/domain/entities/stack-health-report.js +0 -306
  57. package/infrastructure/domains/health/domain/entities/stack-health-report.test.js +0 -601
  58. package/infrastructure/domains/health/domain/services/__tests__/health-score-percentage-based.test.js +0 -380
  59. package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +0 -971
  60. package/infrastructure/domains/health/domain/services/__tests__/import-template-generator.test.js +0 -1150
  61. package/infrastructure/domains/health/domain/services/__tests__/logical-id-mapper.test.js +0 -672
  62. package/infrastructure/domains/health/domain/services/__tests__/template-parser.test.js +0 -496
  63. package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +0 -419
  64. package/infrastructure/domains/health/domain/services/health-score-calculator.js +0 -248
  65. package/infrastructure/domains/health/domain/services/health-score-calculator.test.js +0 -504
  66. package/infrastructure/domains/health/domain/services/import-progress-monitor.js +0 -195
  67. package/infrastructure/domains/health/domain/services/import-template-generator.js +0 -435
  68. package/infrastructure/domains/health/domain/services/logical-id-mapper.js +0 -345
  69. package/infrastructure/domains/health/domain/services/mismatch-analyzer.js +0 -234
  70. package/infrastructure/domains/health/domain/services/mismatch-analyzer.test.js +0 -431
  71. package/infrastructure/domains/health/domain/services/property-mutability-config.js +0 -382
  72. package/infrastructure/domains/health/domain/services/template-parser.js +0 -245
  73. package/infrastructure/domains/health/domain/services/update-progress-monitor.js +0 -192
  74. package/infrastructure/domains/health/domain/value-objects/health-score.js +0 -138
  75. package/infrastructure/domains/health/domain/value-objects/health-score.test.js +0 -267
  76. package/infrastructure/domains/health/domain/value-objects/property-mutability.js +0 -161
  77. package/infrastructure/domains/health/domain/value-objects/property-mutability.test.js +0 -198
  78. package/infrastructure/domains/health/domain/value-objects/resource-state.js +0 -167
  79. package/infrastructure/domains/health/domain/value-objects/resource-state.test.js +0 -196
  80. package/infrastructure/domains/health/domain/value-objects/stack-identifier.js +0 -192
  81. package/infrastructure/domains/health/domain/value-objects/stack-identifier.test.js +0 -262
  82. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-cfn-tagged.test.js +0 -312
  83. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-multi-stack.test.js +0 -367
  84. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +0 -432
  85. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.js +0 -784
  86. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +0 -1133
  87. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.js +0 -565
  88. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +0 -554
  89. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.js +0 -318
  90. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.test.js +0 -398
  91. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.js +0 -777
  92. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.test.js +0 -580
  93. package/infrastructure/domains/integration/integration-builder.js +0 -404
  94. package/infrastructure/domains/integration/integration-builder.test.js +0 -690
  95. package/infrastructure/domains/integration/integration-resolver.js +0 -170
  96. package/infrastructure/domains/integration/integration-resolver.test.js +0 -369
  97. package/infrastructure/domains/integration/websocket-builder.js +0 -69
  98. package/infrastructure/domains/integration/websocket-builder.test.js +0 -195
  99. package/infrastructure/domains/networking/vpc-builder.js +0 -2051
  100. package/infrastructure/domains/networking/vpc-builder.test.js +0 -1960
  101. package/infrastructure/domains/networking/vpc-discovery.js +0 -177
  102. package/infrastructure/domains/networking/vpc-discovery.test.js +0 -350
  103. package/infrastructure/domains/networking/vpc-resolver.js +0 -505
  104. package/infrastructure/domains/networking/vpc-resolver.test.js +0 -801
  105. package/infrastructure/domains/parameters/ssm-builder.js +0 -79
  106. package/infrastructure/domains/parameters/ssm-builder.test.js +0 -189
  107. package/infrastructure/domains/parameters/ssm-discovery.js +0 -84
  108. package/infrastructure/domains/parameters/ssm-discovery.test.js +0 -210
  109. package/infrastructure/domains/security/iam-generator.js +0 -816
  110. package/infrastructure/domains/security/iam-generator.test.js +0 -204
  111. package/infrastructure/domains/security/kms-builder.js +0 -415
  112. package/infrastructure/domains/security/kms-builder.test.js +0 -392
  113. package/infrastructure/domains/security/kms-discovery.js +0 -80
  114. package/infrastructure/domains/security/kms-discovery.test.js +0 -177
  115. package/infrastructure/domains/security/kms-resolver.js +0 -96
  116. package/infrastructure/domains/security/kms-resolver.test.js +0 -216
  117. package/infrastructure/domains/security/templates/frigg-deployment-iam-stack.yaml +0 -401
  118. package/infrastructure/domains/security/templates/iam-policy-basic.json +0 -218
  119. package/infrastructure/domains/security/templates/iam-policy-full.json +0 -288
  120. package/infrastructure/domains/shared/base-builder.js +0 -112
  121. package/infrastructure/domains/shared/base-resolver.js +0 -186
  122. package/infrastructure/domains/shared/base-resolver.test.js +0 -305
  123. package/infrastructure/domains/shared/builder-orchestrator.js +0 -212
  124. package/infrastructure/domains/shared/builder-orchestrator.test.js +0 -213
  125. package/infrastructure/domains/shared/cloudformation-discovery-v2.js +0 -334
  126. package/infrastructure/domains/shared/cloudformation-discovery.js +0 -672
  127. package/infrastructure/domains/shared/cloudformation-discovery.test.js +0 -985
  128. package/infrastructure/domains/shared/environment-builder.js +0 -119
  129. package/infrastructure/domains/shared/environment-builder.test.js +0 -247
  130. package/infrastructure/domains/shared/providers/aws-provider-adapter.js +0 -579
  131. package/infrastructure/domains/shared/providers/aws-provider-adapter.test.js +0 -416
  132. package/infrastructure/domains/shared/providers/azure-provider-adapter.stub.js +0 -93
  133. package/infrastructure/domains/shared/providers/cloud-provider-adapter.js +0 -136
  134. package/infrastructure/domains/shared/providers/gcp-provider-adapter.stub.js +0 -82
  135. package/infrastructure/domains/shared/providers/provider-factory.js +0 -108
  136. package/infrastructure/domains/shared/providers/provider-factory.test.js +0 -170
  137. package/infrastructure/domains/shared/resource-discovery.enhanced.test.js +0 -306
  138. package/infrastructure/domains/shared/resource-discovery.js +0 -233
  139. package/infrastructure/domains/shared/resource-discovery.test.js +0 -588
  140. package/infrastructure/domains/shared/types/app-definition.js +0 -205
  141. package/infrastructure/domains/shared/types/discovery-result.js +0 -106
  142. package/infrastructure/domains/shared/types/discovery-result.test.js +0 -258
  143. package/infrastructure/domains/shared/types/index.js +0 -46
  144. package/infrastructure/domains/shared/types/resource-ownership.js +0 -108
  145. package/infrastructure/domains/shared/types/resource-ownership.test.js +0 -101
  146. package/infrastructure/domains/shared/utilities/base-definition-factory.js +0 -394
  147. package/infrastructure/domains/shared/utilities/base-definition-factory.js.bak +0 -338
  148. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +0 -291
  149. package/infrastructure/domains/shared/utilities/handler-path-resolver.js +0 -134
  150. package/infrastructure/domains/shared/utilities/handler-path-resolver.test.js +0 -268
  151. package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +0 -159
  152. package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +0 -444
  153. package/infrastructure/domains/shared/validation/env-validator.js +0 -78
  154. package/infrastructure/domains/shared/validation/env-validator.test.js +0 -173
  155. package/infrastructure/domains/shared/validation/plugin-validator.js +0 -187
  156. package/infrastructure/domains/shared/validation/plugin-validator.test.js +0 -323
  157. package/infrastructure/esbuild.config.js +0 -53
  158. package/infrastructure/index.js +0 -4
  159. package/infrastructure/infrastructure-composer.js +0 -117
  160. package/infrastructure/infrastructure-composer.test.js +0 -1895
  161. package/infrastructure/integration.test.js +0 -383
  162. package/infrastructure/scripts/build-prisma-layer.js +0 -701
  163. package/infrastructure/scripts/build-prisma-layer.test.js +0 -170
  164. package/infrastructure/scripts/build-time-discovery.js +0 -238
  165. package/infrastructure/scripts/build-time-discovery.test.js +0 -379
  166. package/infrastructure/scripts/run-discovery.js +0 -110
  167. package/infrastructure/scripts/verify-prisma-layer.js +0 -72
  168. package/layers/prisma/.build-complete +0 -3
  169. package/layers/prisma/nodejs/package.json +0 -8
  170. package/management-ui/.eslintrc.js +0 -22
  171. package/management-ui/components.json +0 -21
  172. package/management-ui/docs/phase2-integration-guide.md +0 -320
  173. package/management-ui/index.html +0 -13
  174. package/management-ui/package.json +0 -76
  175. package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +0 -302
  176. package/management-ui/postcss.config.js +0 -6
  177. package/management-ui/server/api/backend.js +0 -256
  178. package/management-ui/server/api/cli.js +0 -315
  179. package/management-ui/server/api/codegen.js +0 -663
  180. package/management-ui/server/api/connections.js +0 -857
  181. package/management-ui/server/api/discovery.js +0 -185
  182. package/management-ui/server/api/environment/index.js +0 -1
  183. package/management-ui/server/api/environment/router.js +0 -378
  184. package/management-ui/server/api/environment.js +0 -328
  185. package/management-ui/server/api/integrations.js +0 -876
  186. package/management-ui/server/api/logs.js +0 -248
  187. package/management-ui/server/api/monitoring.js +0 -282
  188. package/management-ui/server/api/open-ide.js +0 -31
  189. package/management-ui/server/api/project.js +0 -1029
  190. package/management-ui/server/api/users/sessions.js +0 -371
  191. package/management-ui/server/api/users/simulation.js +0 -254
  192. package/management-ui/server/api/users.js +0 -362
  193. package/management-ui/server/api-contract.md +0 -275
  194. package/management-ui/server/index.js +0 -873
  195. package/management-ui/server/middleware/errorHandler.js +0 -93
  196. package/management-ui/server/middleware/security.js +0 -32
  197. package/management-ui/server/processManager.js +0 -296
  198. package/management-ui/server/server.js +0 -346
  199. package/management-ui/server/services/aws-monitor.js +0 -413
  200. package/management-ui/server/services/npm-registry.js +0 -347
  201. package/management-ui/server/services/template-engine.js +0 -538
  202. package/management-ui/server/utils/cliIntegration.js +0 -220
  203. package/management-ui/server/utils/environment/auditLogger.js +0 -471
  204. package/management-ui/server/utils/environment/awsParameterStore.js +0 -275
  205. package/management-ui/server/utils/environment/encryption.js +0 -278
  206. package/management-ui/server/utils/environment/envFileManager.js +0 -286
  207. package/management-ui/server/utils/import-commonjs.js +0 -28
  208. package/management-ui/server/utils/response.js +0 -83
  209. package/management-ui/server/websocket/handler.js +0 -325
  210. package/management-ui/src/App.jsx +0 -25
  211. package/management-ui/src/assets/FriggLogo.svg +0 -1
  212. package/management-ui/src/components/AppRouter.jsx +0 -65
  213. package/management-ui/src/components/Button.jsx +0 -70
  214. package/management-ui/src/components/Card.jsx +0 -97
  215. package/management-ui/src/components/EnvironmentCompare.jsx +0 -400
  216. package/management-ui/src/components/EnvironmentEditor.jsx +0 -372
  217. package/management-ui/src/components/EnvironmentImportExport.jsx +0 -469
  218. package/management-ui/src/components/EnvironmentSchema.jsx +0 -491
  219. package/management-ui/src/components/EnvironmentSecurity.jsx +0 -463
  220. package/management-ui/src/components/ErrorBoundary.jsx +0 -73
  221. package/management-ui/src/components/IntegrationCard.jsx +0 -481
  222. package/management-ui/src/components/IntegrationCardEnhanced.jsx +0 -770
  223. package/management-ui/src/components/IntegrationExplorer.jsx +0 -379
  224. package/management-ui/src/components/IntegrationStatus.jsx +0 -336
  225. package/management-ui/src/components/Layout.jsx +0 -716
  226. package/management-ui/src/components/LoadingSpinner.jsx +0 -113
  227. package/management-ui/src/components/RepositoryPicker.jsx +0 -248
  228. package/management-ui/src/components/SessionMonitor.jsx +0 -350
  229. package/management-ui/src/components/StatusBadge.jsx +0 -208
  230. package/management-ui/src/components/UserContextSwitcher.jsx +0 -212
  231. package/management-ui/src/components/UserSimulation.jsx +0 -327
  232. package/management-ui/src/components/Welcome.jsx +0 -434
  233. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +0 -637
  234. package/management-ui/src/components/codegen/APIModuleSelector.jsx +0 -227
  235. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +0 -247
  236. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +0 -316
  237. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +0 -271
  238. package/management-ui/src/components/codegen/FormBuilder.jsx +0 -737
  239. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +0 -855
  240. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +0 -797
  241. package/management-ui/src/components/codegen/SchemaBuilder.jsx +0 -303
  242. package/management-ui/src/components/codegen/TemplateSelector.jsx +0 -586
  243. package/management-ui/src/components/codegen/index.js +0 -10
  244. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +0 -362
  245. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +0 -182
  246. package/management-ui/src/components/connections/ConnectionTester.jsx +0 -200
  247. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +0 -292
  248. package/management-ui/src/components/connections/OAuthFlow.jsx +0 -204
  249. package/management-ui/src/components/connections/index.js +0 -5
  250. package/management-ui/src/components/index.js +0 -21
  251. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +0 -222
  252. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +0 -169
  253. package/management-ui/src/components/monitoring/MetricsChart.jsx +0 -197
  254. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +0 -393
  255. package/management-ui/src/components/monitoring/SQSMetrics.jsx +0 -246
  256. package/management-ui/src/components/monitoring/index.js +0 -6
  257. package/management-ui/src/components/monitoring/monitoring.css +0 -218
  258. package/management-ui/src/components/theme-provider.jsx +0 -52
  259. package/management-ui/src/components/theme-toggle.jsx +0 -39
  260. package/management-ui/src/components/ui/badge.tsx +0 -36
  261. package/management-ui/src/components/ui/button.test.jsx +0 -56
  262. package/management-ui/src/components/ui/button.tsx +0 -57
  263. package/management-ui/src/components/ui/card.tsx +0 -76
  264. package/management-ui/src/components/ui/dropdown-menu.tsx +0 -199
  265. package/management-ui/src/components/ui/select.tsx +0 -157
  266. package/management-ui/src/components/ui/skeleton.jsx +0 -15
  267. package/management-ui/src/hooks/useFrigg.jsx +0 -387
  268. package/management-ui/src/hooks/useSocket.jsx +0 -58
  269. package/management-ui/src/index.css +0 -193
  270. package/management-ui/src/lib/utils.ts +0 -6
  271. package/management-ui/src/main.jsx +0 -10
  272. package/management-ui/src/pages/CodeGeneration.jsx +0 -14
  273. package/management-ui/src/pages/Connections.jsx +0 -252
  274. package/management-ui/src/pages/ConnectionsEnhanced.jsx +0 -633
  275. package/management-ui/src/pages/Dashboard.jsx +0 -311
  276. package/management-ui/src/pages/Environment.jsx +0 -314
  277. package/management-ui/src/pages/IntegrationConfigure.jsx +0 -669
  278. package/management-ui/src/pages/IntegrationDiscovery.jsx +0 -567
  279. package/management-ui/src/pages/IntegrationTest.jsx +0 -742
  280. package/management-ui/src/pages/Integrations.jsx +0 -253
  281. package/management-ui/src/pages/Monitoring.jsx +0 -17
  282. package/management-ui/src/pages/Simulation.jsx +0 -155
  283. package/management-ui/src/pages/Users.jsx +0 -492
  284. package/management-ui/src/services/api.js +0 -41
  285. package/management-ui/src/services/apiModuleService.js +0 -193
  286. package/management-ui/src/services/websocket-handlers.js +0 -120
  287. package/management-ui/src/test/api/project.test.js +0 -273
  288. package/management-ui/src/test/components/Welcome.test.jsx +0 -378
  289. package/management-ui/src/test/mocks/server.js +0 -178
  290. package/management-ui/src/test/setup.js +0 -61
  291. package/management-ui/src/test/utils/test-utils.jsx +0 -134
  292. package/management-ui/src/utils/repository.js +0 -98
  293. package/management-ui/src/utils/repository.test.js +0 -118
  294. package/management-ui/src/workflows/phase2-integration-workflows.js +0 -884
  295. package/management-ui/tailwind.config.js +0 -63
  296. package/management-ui/tsconfig.json +0 -37
  297. package/management-ui/tsconfig.node.json +0 -10
  298. package/management-ui/vite.config.js +0 -26
  299. package/management-ui/vitest.config.js +0 -38
  300. package/test/auther-definition-method-tester.js +0 -45
  301. package/test/index.js +0 -9
  302. package/test/integration-validator.js +0 -2
  303. package/test/mock-api-readme.md +0 -102
  304. package/test/mock-api.js +0 -284
  305. package/test/mock-integration.js +0 -78
@@ -1,855 +0,0 @@
1
- import React, { useState, useCallback, useEffect } from 'react';
2
- import { Card } from '../Card';
3
- import { Button } from '../Button';
4
- import FormBuilder from './FormBuilder';
5
- import SchemaBuilder from './SchemaBuilder';
6
- import APIModuleSelector from './APIModuleSelector';
7
- import apiModuleService from '../../services/apiModuleService';
8
-
9
- const API_MODULE_TYPES = {
10
- API: 'api',
11
- OAUTH1: 'oauth1',
12
- OAUTH2: 'oauth2',
13
- BASIC_AUTH: 'basic-auth',
14
- CUSTOM: 'custom'
15
- };
16
-
17
- const AUTHENTICATION_FIELDS = {
18
- [API_MODULE_TYPES.API]: [
19
- { name: 'apiKey', label: 'API Key', type: 'string', required: true, encrypted: false }
20
- ],
21
- [API_MODULE_TYPES.OAUTH2]: [
22
- { name: 'access_token', label: 'Access Token', type: 'string', required: true, encrypted: false },
23
- { name: 'refresh_token', label: 'Refresh Token', type: 'string', required: false, encrypted: false },
24
- { name: 'expires_at', label: 'Expires At', type: 'date', required: false, encrypted: false },
25
- { name: 'scope', label: 'Scope', type: 'string', required: false, encrypted: false }
26
- ],
27
- [API_MODULE_TYPES.BASIC_AUTH]: [
28
- { name: 'username', label: 'Username', type: 'string', required: true, encrypted: false },
29
- { name: 'password', label: 'Password', type: 'string', required: true, encrypted: true }
30
- ],
31
- [API_MODULE_TYPES.OAUTH1]: [
32
- { name: 'oauth_token', label: 'OAuth Token', type: 'string', required: true, encrypted: false },
33
- { name: 'oauth_token_secret', label: 'OAuth Token Secret', type: 'string', required: true, encrypted: true }
34
- ]
35
- };
36
-
37
- const IntegrationGenerator = ({ onGenerate }) => {
38
- const [formData, setFormData] = useState({
39
- name: '',
40
- displayName: '',
41
- description: '',
42
- category: 'API Module',
43
- type: API_MODULE_TYPES.API,
44
- baseURL: '',
45
- authorizationURL: '',
46
- tokenURL: '',
47
- scope: '',
48
- apiEndpoints: [],
49
- entitySchema: [],
50
- useExistingModule: false,
51
- selectedModule: null,
52
- moduleDetails: null
53
- });
54
-
55
- const [currentTab, setCurrentTab] = useState('basic');
56
- const [moduleDetailsLoading, setModuleDetailsLoading] = useState(false);
57
-
58
- const handleInputChange = useCallback((field, value) => {
59
- setFormData(prev => ({
60
- ...prev,
61
- [field]: value
62
- }));
63
- }, []);
64
-
65
- const handleModuleSelect = useCallback(async (moduleName) => {
66
- setFormData(prev => ({
67
- ...prev,
68
- selectedModule: moduleName
69
- }));
70
-
71
- if (moduleName) {
72
- setModuleDetailsLoading(true);
73
- try {
74
- const details = await apiModuleService.getModuleDetails(moduleName);
75
- setFormData(prev => ({
76
- ...prev,
77
- moduleDetails: details,
78
- // Auto-fill form fields based on module
79
- name: details.name.replace('@friggframework/api-module-', ''),
80
- displayName: details.displayName,
81
- description: details.description || prev.description,
82
- type: details.authType === 'oauth2' ? INTEGRATION_TYPES.OAUTH2 :
83
- details.authType === 'api-key' ? INTEGRATION_TYPES.API :
84
- details.authType === 'basic-auth' ? INTEGRATION_TYPES.BASIC_AUTH :
85
- INTEGRATION_TYPES.CUSTOM
86
- }));
87
- } catch (error) {
88
- console.error('Error loading module details:', error);
89
- } finally {
90
- setModuleDetailsLoading(false);
91
- }
92
- }
93
- }, []);
94
-
95
- const handleEndpointAdd = useCallback(() => {
96
- setFormData(prev => ({
97
- ...prev,
98
- apiEndpoints: [
99
- ...prev.apiEndpoints,
100
- {
101
- id: Date.now(),
102
- name: '',
103
- method: 'GET',
104
- path: '',
105
- description: '',
106
- parameters: [],
107
- responseSchema: {}
108
- }
109
- ]
110
- }));
111
- }, []);
112
-
113
- const handleEndpointUpdate = useCallback((id, updates) => {
114
- setFormData(prev => ({
115
- ...prev,
116
- apiEndpoints: prev.apiEndpoints.map(endpoint =>
117
- endpoint.id === id ? { ...endpoint, ...updates } : endpoint
118
- )
119
- }));
120
- }, []);
121
-
122
- const handleEndpointRemove = useCallback((id) => {
123
- setFormData(prev => ({
124
- ...prev,
125
- apiEndpoints: prev.apiEndpoints.filter(endpoint => endpoint.id !== id)
126
- }));
127
- }, []);
128
-
129
- const generateIntegrationCode = useCallback(() => {
130
- const className = formData.name.replace(/-/g, '_').replace(/(?:^|_)(\w)/g, (_, c) => c.toUpperCase());
131
-
132
- // If using existing module, generate wrapper code
133
- if (formData.useExistingModule && formData.selectedModule) {
134
- return generateModuleWrapperCode();
135
- }
136
-
137
- // Otherwise generate full custom integration
138
- const authFields = AUTHENTICATION_FIELDS[formData.type] || [];
139
- const allEntityFields = [...authFields, ...formData.entitySchema, { name: 'user_id', label: 'User ID', type: 'string', required: true }];
140
-
141
- // Generate Entity class
142
- const entityCode = `class ${className}Entity extends Entity {
143
- static tableName = '${formData.name}';
144
-
145
- static getSchema() {
146
- return {
147
- ${allEntityFields.map(field =>
148
- ` ${field.name}: { type: '${field.type}', required: ${field.required}${field.encrypted ? ', encrypted: true' : ''}${field.default ? `, default: '${field.default}'` : ''} }`
149
- ).join(',\n')}
150
- };
151
- }
152
- }`;
153
-
154
- // Generate API class
155
- const apiMethods = formData.apiEndpoints.map(endpoint => {
156
- const methodName = endpoint.name || `${endpoint.method.toLowerCase()}${endpoint.path.replace(/[^a-zA-Z0-9]/g, '')}`;
157
- const hasParams = endpoint.parameters && endpoint.parameters.length > 0;
158
-
159
- return ` async ${methodName}(${hasParams ? 'params = {}' : ''}) {
160
- const response = await this.${endpoint.method.toLowerCase()}('${endpoint.path}'${hasParams ? ', params' : ''});
161
- return response.data;
162
- }`;
163
- }).join('\n\n');
164
-
165
- const apiCode = `class ${className}Api extends Api {
166
- constructor(config) {
167
- super(config);
168
- this.baseURL = '${formData.baseURL || 'https://api.example.com'}';
169
- this.headers = {
170
- 'Content-Type': 'application/json'
171
- };
172
- }
173
-
174
- ${formData.type === INTEGRATION_TYPES.API ? ` setApiKey(apiKey) {
175
- this.headers['Authorization'] = \`Bearer \${apiKey}\`;
176
- }` : ''}
177
-
178
- ${formData.type === INTEGRATION_TYPES.BASIC_AUTH ? ` setCredentials(username, password) {
179
- const credentials = Buffer.from(\`\${username}:\${password}\`).toString('base64');
180
- this.headers['Authorization'] = \`Basic \${credentials}\`;
181
- }` : ''}
182
-
183
- ${formData.type === INTEGRATION_TYPES.OAUTH2 ? ` setAccessToken(token) {
184
- this.headers['Authorization'] = \`Bearer \${token}\`;
185
- }` : ''}
186
-
187
- async testConnection() {
188
- const response = await this.get('/ping');
189
- return response.data;
190
- }
191
-
192
- ${apiMethods || ' // Add your API methods here'}
193
- }`;
194
-
195
- // Generate Integration class
196
- const integrationCode = `class ${className}Integration extends IntegrationBase {
197
- static Entity = ${className}Entity;
198
- static Api = ${className}Api;
199
- static type = '${formData.name}';
200
-
201
- static Config = {
202
- name: '${formData.name}',
203
- displayName: '${formData.displayName}',
204
- description: '${formData.description}',
205
- category: '${formData.category}',
206
- version: '1.0.0',
207
- supportedVersions: ['1.0.0']
208
- };
209
-
210
- async connect(params) {
211
- const api = new ${className}Api();
212
-
213
- // Set authentication
214
- ${formData.type === INTEGRATION_TYPES.API ? ` api.setApiKey(params.apiKey);` : ''}
215
- ${formData.type === INTEGRATION_TYPES.BASIC_AUTH ? ` api.setCredentials(params.username, params.password);` : ''}
216
- ${formData.type === INTEGRATION_TYPES.OAUTH2 ? ` api.setAccessToken(params.access_token);` : ''}
217
-
218
- try {
219
- await api.testConnection();
220
- } catch (error) {
221
- throw new Error('Connection failed: ' + error.message);
222
- }
223
-
224
- const entity = await ${className}Entity.create({
225
- ${authFields.map(field => ` ${field.name}: params.${field.name}`).join(',\n')},
226
- user_id: params.userId
227
- });
228
-
229
- return entity;
230
- }
231
-
232
- static async checkConnection(entity) {
233
- const api = new ${className}Api();
234
-
235
- ${formData.type === INTEGRATION_TYPES.API ? ` api.setApiKey(entity.apiKey);` : ''}
236
- ${formData.type === INTEGRATION_TYPES.BASIC_AUTH ? ` api.setCredentials(entity.username, entity.password);` : ''}
237
- ${formData.type === INTEGRATION_TYPES.OAUTH2 ? ` api.setAccessToken(entity.access_token);` : ''}
238
-
239
- try {
240
- await api.testConnection();
241
- return true;
242
- } catch (error) {
243
- return false;
244
- }
245
- }
246
- }`;
247
-
248
- const fullCode = `const { Api, Entity, IntegrationBase } = require('@friggframework/core');
249
- ${formData.type === INTEGRATION_TYPES.OAUTH2 ? "const { OAuth2AuthorizationCode } = require('@friggframework/oauth2');" : ''}
250
-
251
- ${entityCode}
252
-
253
- ${apiCode}
254
-
255
- ${integrationCode}
256
-
257
- module.exports = ${className}Integration;`;
258
-
259
- const metadata = {
260
- name: formData.name,
261
- className,
262
- type: formData.type,
263
- files: [
264
- { name: 'index.js', content: fullCode },
265
- { name: 'package.json', content: generatePackageJson() },
266
- { name: 'README.md', content: generateReadme() },
267
- { name: '__tests__/index.test.js', content: generateTestFile() }
268
- ]
269
- };
270
-
271
- onGenerate(formData, fullCode, metadata);
272
- }, [formData, onGenerate]);
273
-
274
- const generateModuleWrapperCode = () => {
275
- const className = formData.name.replace(/-/g, '_').replace(/(?:^|_)(\w)/g, (_, c) => c.toUpperCase());
276
- const moduleName = formData.selectedModule;
277
- const moduleDetails = formData.moduleDetails || {};
278
-
279
- // Generate wrapper code that extends the npm module
280
- const wrapperCode = `const ${className}Module = require('${moduleName}');
281
- const { IntegrationBase } = require('@friggframework/core');
282
-
283
- // Wrapper class that extends the npm module with custom functionality
284
- class ${className}Integration extends IntegrationBase {
285
- static Api = ${className}Module.Api;
286
- static Entity = ${className}Module.Entity;
287
- static Config = {
288
- ...${className}Module.Config,
289
- // Override or extend configuration
290
- displayName: '${formData.displayName || moduleDetails.displayName}',
291
- description: '${formData.description || moduleDetails.description}'
292
- };
293
-
294
- constructor(config) {
295
- super(config);
296
- // Initialize the base module
297
- this.module = new ${className}Module(config);
298
- }
299
-
300
- async connect(params) {
301
- // Delegate to the module's connect method
302
- return this.module.connect(params);
303
- }
304
-
305
- static async checkConnection(entity) {
306
- // Delegate to the module's checkConnection method
307
- return ${className}Module.checkConnection(entity);
308
- }
309
-
310
- // Add custom methods here
311
- ${formData.apiEndpoints.map(endpoint => {
312
- const methodName = endpoint.name || `${endpoint.method.toLowerCase()}${endpoint.path.replace(/[^a-zA-Z0-9]/g, '')}`;
313
- return ` async ${methodName}(params = {}) {
314
- const api = new ${className}Module.Api(this.entity);
315
- return api.${endpoint.method.toLowerCase()}('${endpoint.path}', params);
316
- }`;
317
- }).join('\n\n')}
318
- }
319
-
320
- module.exports = ${className}Integration;`;
321
-
322
- const packageJson = {
323
- name: `@your-org/${formData.name}-integration`,
324
- version: '0.1.0',
325
- description: formData.description || `Integration wrapper for ${moduleName}`,
326
- main: 'index.js',
327
- scripts: {
328
- test: 'jest',
329
- 'test:watch': 'jest --watch'
330
- },
331
- keywords: ['frigg', 'integration', formData.name],
332
- dependencies: {
333
- '@friggframework/core': '^1.0.0',
334
- [moduleName]: `^${moduleDetails.version || 'latest'}`
335
- },
336
- devDependencies: {
337
- '@jest/globals': '^29.0.0',
338
- 'jest': '^29.0.0'
339
- }
340
- };
341
-
342
- const readme = `# ${formData.displayName || moduleDetails.displayName} Integration
343
-
344
- ${formData.description || moduleDetails.description}
345
-
346
- This integration extends the [${moduleName}](https://www.npmjs.com/package/${moduleName}) module.
347
-
348
- ## Installation
349
-
350
- \`\`\`bash
351
- npm install ${moduleName}
352
- \`\`\`
353
-
354
- ## Configuration
355
-
356
- ${moduleDetails.requiredFields?.map(field => `- **${field.label}**: ${field.type}${field.required ? ' (required)' : ''}`).join('\n') || 'See module documentation for required configuration.'}
357
-
358
- ## Usage
359
-
360
- \`\`\`javascript
361
- const ${className}Integration = require('./index');
362
-
363
- const integration = new ${className}Integration(config);
364
-
365
- // Connect
366
- const entity = await integration.connect({
367
- ${moduleDetails.requiredFields?.map(field => ` ${field.name}: 'your-${field.name}'`).join(',\n') || ' // Add required parameters'}
368
- });
369
- \`\`\`
370
-
371
- ## API Methods
372
-
373
- ${formData.apiEndpoints.map(endpoint => `- \`${endpoint.name || 'endpoint'}\`: ${endpoint.description || 'No description'}`).join('\n') || 'See module documentation for available methods.'}
374
- `;
375
-
376
- const metadata = {
377
- name: formData.name,
378
- className,
379
- type: 'module-wrapper',
380
- baseModule: moduleName,
381
- files: [
382
- { name: 'index.js', content: wrapperCode },
383
- { name: 'package.json', content: JSON.stringify(packageJson, null, 2) },
384
- { name: 'README.md', content: readme }
385
- ]
386
- };
387
-
388
- onGenerate(formData, wrapperCode, metadata);
389
- };
390
-
391
- const generatePackageJson = () => {
392
- const className = formData.name.replace(/-/g, '_').replace(/(?:^|_)(\w)/g, (_, c) => c.toUpperCase());
393
- return JSON.stringify({
394
- name: `@friggframework/${formData.name}`,
395
- version: '0.1.0',
396
- description: formData.description,
397
- main: 'index.js',
398
- scripts: {
399
- test: 'jest',
400
- 'test:watch': 'jest --watch'
401
- },
402
- keywords: ['frigg', 'integration', formData.name],
403
- dependencies: {
404
- '@friggframework/core': '^1.0.0',
405
- ...(formData.type === INTEGRATION_TYPES.OAUTH2 ? { '@friggframework/oauth2': '^1.0.0' } : {})
406
- },
407
- devDependencies: {
408
- '@jest/globals': '^29.0.0',
409
- 'jest': '^29.0.0'
410
- }
411
- }, null, 2);
412
- };
413
-
414
- const generateReadme = () => {
415
- const className = formData.name.replace(/-/g, '_').replace(/(?:^|_)(\w)/g, (_, c) => c.toUpperCase());
416
- return `# ${formData.displayName} Integration
417
-
418
- ${formData.description}
419
-
420
- ## Installation
421
-
422
- \`\`\`bash
423
- npm install @friggframework/${formData.name}
424
- \`\`\`
425
-
426
- ## Usage
427
-
428
- \`\`\`javascript
429
- const ${className}Integration = require('@friggframework/${formData.name}');
430
-
431
- const integration = new ${className}Integration();
432
-
433
- // Connect
434
- const entity = await integration.connect({
435
- ${AUTHENTICATION_FIELDS[formData.type]?.map(field => ` ${field.name}: 'your-${field.name.replace(/_/g, '-')}'`).join(',\n') || ' // Add your authentication parameters'}
436
- userId: 'user-123'
437
- });
438
-
439
- // Check connection
440
- const isConnected = await ${className}Integration.checkConnection(entity);
441
- \`\`\`
442
-
443
- ## API Methods
444
-
445
- ${formData.apiEndpoints.map(endpoint => `- \`${endpoint.name || 'endpoint'}\`: ${endpoint.description || 'No description'}`).join('\n') || '- Add your API methods here'}
446
-
447
- ## License
448
-
449
- MIT`;
450
- };
451
-
452
- const generateTestFile = () => {
453
- const className = formData.name.replace(/-/g, '_').replace(/(?:^|_)(\w)/g, (_, c) => c.toUpperCase());
454
- return `const { describe, it, expect } = require('@jest/globals');
455
- const ${className}Integration = require('../index');
456
-
457
- describe('${className}Integration', () => {
458
- it('should have correct configuration', () => {
459
- expect(${className}Integration.Config.name).toBe('${formData.name}');
460
- expect(${className}Integration.type).toBe('${formData.name}');
461
- });
462
-
463
- it('should have Entity and Api classes', () => {
464
- expect(${className}Integration.Entity).toBeDefined();
465
- expect(${className}Integration.Api).toBeDefined();
466
- });
467
-
468
- describe('Entity', () => {
469
- it('should have correct table name', () => {
470
- expect(${className}Integration.Entity.tableName).toBe('${formData.name}');
471
- });
472
-
473
- it('should have valid schema', () => {
474
- const schema = ${className}Integration.Entity.getSchema();
475
- expect(schema).toBeDefined();
476
- expect(schema.user_id).toBeDefined();
477
- });
478
- });
479
-
480
- describe('Api', () => {
481
- it('should initialize with correct baseURL', () => {
482
- const api = new ${className}Integration.Api();
483
- expect(api.baseURL).toBe('${formData.baseURL || 'https://api.example.com'}');
484
- });
485
- });
486
- });`;
487
- };
488
-
489
- const tabs = [
490
- { id: 'module', label: 'Module Selection', icon: '📦' },
491
- { id: 'basic', label: 'Basic Info', icon: '📝' },
492
- { id: 'auth', label: 'Authentication', icon: '🔐' },
493
- { id: 'endpoints', label: 'API Endpoints', icon: '🔗' },
494
- { id: 'schema', label: 'Entity Schema', icon: '📊' }
495
- ];
496
-
497
- return (
498
- <div className="space-y-6">
499
- <h2 className="text-2xl font-bold">Integration Generator</h2>
500
-
501
- {/* Tab Navigation */}
502
- <div className="border-b border-gray-200">
503
- <nav className="-mb-px flex space-x-8">
504
- {tabs.map((tab) => (
505
- <button
506
- key={tab.id}
507
- onClick={() => setCurrentTab(tab.id)}
508
- className={`py-2 px-1 border-b-2 font-medium text-sm ${
509
- currentTab === tab.id
510
- ? 'border-blue-500 text-blue-600'
511
- : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'
512
- }`}
513
- >
514
- <span className="mr-2">{tab.icon}</span>
515
- {tab.label}
516
- </button>
517
- ))}
518
- </nav>
519
- </div>
520
-
521
- {/* Tab Content */}
522
- <Card className="p-6">
523
- {currentTab === 'module' && (
524
- <div className="space-y-4">
525
- <div className="mb-6">
526
- <label className="flex items-center space-x-3">
527
- <input
528
- type="checkbox"
529
- checked={formData.useExistingModule}
530
- onChange={(e) => handleInputChange('useExistingModule', e.target.checked)}
531
- className="h-4 w-4 text-blue-600 rounded focus:ring-blue-500"
532
- />
533
- <span className="text-sm font-medium text-gray-700">
534
- Use existing Frigg API module from npm
535
- </span>
536
- </label>
537
- <p className="text-sm text-gray-500 mt-1 ml-7">
538
- Select from pre-built API modules or create a custom integration from scratch
539
- </p>
540
- </div>
541
-
542
- {formData.useExistingModule && (
543
- <APIModuleSelector
544
- selectedModule={formData.selectedModule}
545
- onSelect={handleModuleSelect}
546
- />
547
- )}
548
-
549
- {!formData.useExistingModule && (
550
- <div className="bg-gray-50 rounded-lg p-6 text-center">
551
- <svg className="w-12 h-12 text-gray-400 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
552
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" />
553
- </svg>
554
- <h3 className="text-lg font-medium text-gray-900 mb-2">Custom Integration</h3>
555
- <p className="text-sm text-gray-600">
556
- Build a custom integration from scratch with full control over the implementation
557
- </p>
558
- </div>
559
- )}
560
- </div>
561
- )}
562
-
563
- {currentTab === 'basic' && (
564
- <div className="space-y-4">
565
- {formData.useExistingModule && formData.selectedModule && (
566
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4">
567
- <div className="flex items-start">
568
- <svg className="w-5 h-5 text-blue-600 mt-0.5 mr-2" fill="currentColor" viewBox="0 0 20 20">
569
- <path fillRule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clipRule="evenodd" />
570
- </svg>
571
- <div>
572
- <p className="text-sm text-blue-800">
573
- Using <strong>{formData.moduleDetails?.displayName || formData.selectedModule}</strong> as base module.
574
- Some fields have been auto-filled from the module configuration.
575
- </p>
576
- </div>
577
- </div>
578
- </div>
579
- )}
580
-
581
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
582
- <div>
583
- <label className="block text-sm font-medium text-gray-700 mb-2">
584
- Integration Name *
585
- </label>
586
- <input
587
- type="text"
588
- value={formData.name}
589
- onChange={(e) => handleInputChange('name', e.target.value)}
590
- placeholder="e.g., salesforce, hubspot"
591
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
592
- disabled={formData.useExistingModule && moduleDetailsLoading}
593
- />
594
- </div>
595
- <div>
596
- <label className="block text-sm font-medium text-gray-700 mb-2">
597
- Display Name
598
- </label>
599
- <input
600
- type="text"
601
- value={formData.displayName}
602
- onChange={(e) => handleInputChange('displayName', e.target.value)}
603
- placeholder="e.g., Salesforce, HubSpot"
604
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
605
- />
606
- </div>
607
- </div>
608
-
609
- <div>
610
- <label className="block text-sm font-medium text-gray-700 mb-2">
611
- Description
612
- </label>
613
- <textarea
614
- value={formData.description}
615
- onChange={(e) => handleInputChange('description', e.target.value)}
616
- placeholder="Brief description of the integration"
617
- rows={3}
618
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
619
- />
620
- </div>
621
-
622
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
623
- <div>
624
- <label className="block text-sm font-medium text-gray-700 mb-2">
625
- Category
626
- </label>
627
- <select
628
- value={formData.category}
629
- onChange={(e) => handleInputChange('category', e.target.value)}
630
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
631
- >
632
- <option value="API Integration">API Integration</option>
633
- <option value="CRM">CRM</option>
634
- <option value="Marketing">Marketing</option>
635
- <option value="Sales">Sales</option>
636
- <option value="Support">Support</option>
637
- <option value="Analytics">Analytics</option>
638
- <option value="Communication">Communication</option>
639
- <option value="Other">Other</option>
640
- </select>
641
- </div>
642
- <div>
643
- <label className="block text-sm font-medium text-gray-700 mb-2">
644
- Base URL *
645
- </label>
646
- <input
647
- type="url"
648
- value={formData.baseURL}
649
- onChange={(e) => handleInputChange('baseURL', e.target.value)}
650
- placeholder="https://api.example.com"
651
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
652
- />
653
- </div>
654
- </div>
655
- </div>
656
- )}
657
-
658
- {currentTab === 'auth' && (
659
- <div className="space-y-4">
660
- <div>
661
- <label className="block text-sm font-medium text-gray-700 mb-2">
662
- Authentication Type
663
- </label>
664
- <select
665
- value={formData.type}
666
- onChange={(e) => handleInputChange('type', e.target.value)}
667
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
668
- >
669
- <option value={INTEGRATION_TYPES.API}>API Key</option>
670
- <option value={INTEGRATION_TYPES.OAUTH2}>OAuth 2.0</option>
671
- <option value={INTEGRATION_TYPES.BASIC_AUTH}>Basic Auth</option>
672
- <option value={INTEGRATION_TYPES.OAUTH1}>OAuth 1.0</option>
673
- <option value={INTEGRATION_TYPES.CUSTOM}>Custom</option>
674
- </select>
675
- </div>
676
-
677
- {formData.type === INTEGRATION_TYPES.OAUTH2 && (
678
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
679
- <div>
680
- <label className="block text-sm font-medium text-gray-700 mb-2">
681
- Authorization URL
682
- </label>
683
- <input
684
- type="url"
685
- value={formData.authorizationURL}
686
- onChange={(e) => handleInputChange('authorizationURL', e.target.value)}
687
- placeholder="https://example.com/oauth/authorize"
688
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
689
- />
690
- </div>
691
- <div>
692
- <label className="block text-sm font-medium text-gray-700 mb-2">
693
- Token URL
694
- </label>
695
- <input
696
- type="url"
697
- value={formData.tokenURL}
698
- onChange={(e) => handleInputChange('tokenURL', e.target.value)}
699
- placeholder="https://example.com/oauth/token"
700
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
701
- />
702
- </div>
703
- <div className="md:col-span-2">
704
- <label className="block text-sm font-medium text-gray-700 mb-2">
705
- OAuth Scope
706
- </label>
707
- <input
708
- type="text"
709
- value={formData.scope}
710
- onChange={(e) => handleInputChange('scope', e.target.value)}
711
- placeholder="read write"
712
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
713
- />
714
- </div>
715
- </div>
716
- )}
717
-
718
- <div className="bg-gray-50 p-4 rounded-md">
719
- <h4 className="font-medium text-gray-900 mb-2">Authentication Fields</h4>
720
- <p className="text-sm text-gray-600 mb-3">
721
- The following fields will be included in the Entity schema based on your authentication type:
722
- </p>
723
- <div className="space-y-2">
724
- {AUTHENTICATION_FIELDS[formData.type]?.map((field, index) => (
725
- <div key={index} className="flex items-center justify-between text-sm">
726
- <span className="font-medium">{field.label}</span>
727
- <div className="flex items-center space-x-2">
728
- <span className="text-gray-500">{field.type}</span>
729
- {field.required && <span className="text-red-500">Required</span>}
730
- {field.encrypted && <span className="text-blue-500">Encrypted</span>}
731
- </div>
732
- </div>
733
- )) || <span className="text-gray-500">No standard fields for custom authentication</span>}
734
- </div>
735
- </div>
736
- </div>
737
- )}
738
-
739
- {currentTab === 'endpoints' && (
740
- <div className="space-y-4">
741
- <div className="flex justify-between items-center">
742
- <h3 className="text-lg font-medium">API Endpoints</h3>
743
- <Button onClick={handleEndpointAdd}>Add Endpoint</Button>
744
- </div>
745
-
746
- {formData.apiEndpoints.length === 0 && (
747
- <div className="text-center py-8 text-gray-500">
748
- No endpoints defined. Click "Add Endpoint" to get started.
749
- </div>
750
- )}
751
-
752
- {formData.apiEndpoints.map((endpoint) => (
753
- <Card key={endpoint.id} className="p-4">
754
- <div className="flex justify-between items-start mb-4">
755
- <h4 className="font-medium">Endpoint {endpoint.id}</h4>
756
- <Button
757
- variant="outline"
758
- size="sm"
759
- onClick={() => handleEndpointRemove(endpoint.id)}
760
- className="text-red-600 hover:text-red-700"
761
- >
762
- Remove
763
- </Button>
764
- </div>
765
-
766
- <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
767
- <div>
768
- <label className="block text-sm font-medium text-gray-700 mb-2">
769
- Method
770
- </label>
771
- <select
772
- value={endpoint.method}
773
- onChange={(e) => handleEndpointUpdate(endpoint.id, { method: e.target.value })}
774
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
775
- >
776
- <option value="GET">GET</option>
777
- <option value="POST">POST</option>
778
- <option value="PUT">PUT</option>
779
- <option value="DELETE">DELETE</option>
780
- <option value="PATCH">PATCH</option>
781
- </select>
782
- </div>
783
- <div>
784
- <label className="block text-sm font-medium text-gray-700 mb-2">
785
- Path
786
- </label>
787
- <input
788
- type="text"
789
- value={endpoint.path}
790
- onChange={(e) => handleEndpointUpdate(endpoint.id, { path: e.target.value })}
791
- placeholder="/users"
792
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
793
- />
794
- </div>
795
- <div>
796
- <label className="block text-sm font-medium text-gray-700 mb-2">
797
- Method Name
798
- </label>
799
- <input
800
- type="text"
801
- value={endpoint.name}
802
- onChange={(e) => handleEndpointUpdate(endpoint.id, { name: e.target.value })}
803
- placeholder="getUsers"
804
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
805
- />
806
- </div>
807
- </div>
808
-
809
- <div className="mt-4">
810
- <label className="block text-sm font-medium text-gray-700 mb-2">
811
- Description
812
- </label>
813
- <input
814
- type="text"
815
- value={endpoint.description}
816
- onChange={(e) => handleEndpointUpdate(endpoint.id, { description: e.target.value })}
817
- placeholder="Retrieves a list of users"
818
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
819
- />
820
- </div>
821
- </Card>
822
- ))}
823
- </div>
824
- )}
825
-
826
- {currentTab === 'schema' && (
827
- <div className="space-y-4">
828
- <h3 className="text-lg font-medium">Custom Entity Fields</h3>
829
- <p className="text-sm text-gray-600">
830
- Add custom fields to store additional data in your integration entity.
831
- Authentication fields are automatically included.
832
- </p>
833
-
834
- <SchemaBuilder
835
- schema={formData.entitySchema}
836
- onChange={(schema) => handleInputChange('entitySchema', schema)}
837
- />
838
- </div>
839
- )}
840
- </Card>
841
-
842
- <div className="flex justify-end">
843
- <Button
844
- onClick={generateIntegrationCode}
845
- disabled={!formData.name || (!formData.baseURL && !formData.useExistingModule) || (formData.useExistingModule && !formData.selectedModule)}
846
- className="bg-blue-600 hover:bg-blue-700"
847
- >
848
- Generate Integration Code
849
- </Button>
850
- </div>
851
- </div>
852
- );
853
- };
854
-
855
- export default IntegrationGenerator;