@friggframework/devtools 2.0.0-next.6 → 2.0.0-next.60
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.
- package/frigg-cli/README.md +1289 -0
- package/frigg-cli/__tests__/unit/commands/build.test.js +279 -0
- package/frigg-cli/__tests__/unit/commands/db-setup.test.js +649 -0
- package/frigg-cli/__tests__/unit/commands/deploy.test.js +320 -0
- package/frigg-cli/__tests__/unit/commands/doctor.test.js +309 -0
- package/frigg-cli/__tests__/unit/commands/install.test.js +400 -0
- package/frigg-cli/__tests__/unit/commands/ui.test.js +346 -0
- package/frigg-cli/__tests__/unit/dependencies.test.js +74 -0
- package/frigg-cli/__tests__/unit/utils/database-validator.test.js +397 -0
- package/frigg-cli/__tests__/unit/utils/error-messages.test.js +345 -0
- package/frigg-cli/__tests__/unit/version-detection.test.js +171 -0
- package/frigg-cli/__tests__/utils/mock-factory.js +270 -0
- package/frigg-cli/__tests__/utils/prisma-mock.js +194 -0
- package/frigg-cli/__tests__/utils/test-fixtures.js +463 -0
- package/frigg-cli/__tests__/utils/test-setup.js +287 -0
- package/frigg-cli/build-command/index.js +53 -14
- package/frigg-cli/db-setup-command/index.js +246 -0
- package/frigg-cli/deploy-command/SPEC-DEPLOY-DRY-RUN.md +981 -0
- package/frigg-cli/deploy-command/index.js +295 -17
- package/frigg-cli/doctor-command/index.js +335 -0
- package/frigg-cli/generate-command/__tests__/generate-command.test.js +301 -0
- package/frigg-cli/generate-command/azure-generator.js +43 -0
- package/frigg-cli/generate-command/gcp-generator.js +47 -0
- package/frigg-cli/generate-command/index.js +332 -0
- package/frigg-cli/generate-command/terraform-generator.js +555 -0
- package/frigg-cli/generate-iam-command.js +118 -0
- package/frigg-cli/index.js +142 -1
- package/frigg-cli/index.test.js +1 -4
- package/frigg-cli/init-command/backend-first-handler.js +756 -0
- package/frigg-cli/init-command/index.js +93 -0
- package/frigg-cli/init-command/template-handler.js +143 -0
- package/frigg-cli/install-command/index.js +1 -4
- package/frigg-cli/jest.config.js +124 -0
- package/frigg-cli/package.json +63 -0
- package/frigg-cli/repair-command/index.js +564 -0
- package/frigg-cli/start-command/index.js +125 -6
- package/frigg-cli/start-command/start-command.test.js +297 -0
- package/frigg-cli/test/init-command.test.js +180 -0
- package/frigg-cli/test/npm-registry.test.js +319 -0
- package/frigg-cli/ui-command/index.js +154 -0
- package/frigg-cli/utils/app-resolver.js +319 -0
- package/frigg-cli/utils/backend-path.js +16 -17
- package/frigg-cli/utils/database-validator.js +167 -0
- package/frigg-cli/utils/error-messages.js +329 -0
- package/frigg-cli/utils/npm-registry.js +167 -0
- package/frigg-cli/utils/process-manager.js +199 -0
- package/frigg-cli/utils/repo-detection.js +405 -0
- package/infrastructure/ARCHITECTURE.md +487 -0
- package/infrastructure/CLAUDE.md +481 -0
- package/infrastructure/HEALTH.md +468 -0
- package/infrastructure/README.md +522 -0
- package/infrastructure/__tests__/fixtures/mock-aws-resources.js +391 -0
- package/infrastructure/__tests__/helpers/test-utils.js +277 -0
- package/infrastructure/__tests__/postgres-config.test.js +914 -0
- package/infrastructure/__tests__/template-generation.test.js +687 -0
- package/infrastructure/create-frigg-infrastructure.js +129 -20
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +630 -0
- package/infrastructure/docs/PRE-DEPLOYMENT-HEALTH-CHECK-SPEC.md +1317 -0
- package/infrastructure/docs/WEBSOCKET-CONFIGURATION.md +105 -0
- package/infrastructure/docs/deployment-instructions.md +268 -0
- package/infrastructure/docs/generate-iam-command.md +278 -0
- package/infrastructure/docs/iam-policy-templates.md +193 -0
- package/infrastructure/domains/database/aurora-builder.js +809 -0
- package/infrastructure/domains/database/aurora-builder.test.js +950 -0
- package/infrastructure/domains/database/aurora-discovery.js +87 -0
- package/infrastructure/domains/database/aurora-discovery.test.js +188 -0
- package/infrastructure/domains/database/aurora-resolver.js +210 -0
- package/infrastructure/domains/database/aurora-resolver.test.js +347 -0
- package/infrastructure/domains/database/migration-builder.js +701 -0
- package/infrastructure/domains/database/migration-builder.test.js +321 -0
- package/infrastructure/domains/database/migration-resolver.js +163 -0
- package/infrastructure/domains/database/migration-resolver.test.js +337 -0
- package/infrastructure/domains/health/application/ports/IPropertyReconciler.js +164 -0
- package/infrastructure/domains/health/application/ports/IResourceDetector.js +129 -0
- package/infrastructure/domains/health/application/ports/IResourceImporter.js +142 -0
- package/infrastructure/domains/health/application/ports/IStackRepository.js +131 -0
- package/infrastructure/domains/health/application/ports/index.js +26 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/execute-resource-import-use-case.test.js +679 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +167 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +1130 -0
- package/infrastructure/domains/health/application/use-cases/execute-resource-import-use-case.js +221 -0
- package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.js +152 -0
- package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.test.js +343 -0
- package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.js +535 -0
- package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.test.js +376 -0
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.js +213 -0
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +441 -0
- package/infrastructure/domains/health/docs/ACME-DEV-DRIFT-ANALYSIS.md +267 -0
- package/infrastructure/domains/health/docs/BUILD-VS-DEPLOYED-TEMPLATE-ANALYSIS.md +324 -0
- package/infrastructure/domains/health/docs/ORPHAN-DETECTION-ANALYSIS.md +386 -0
- package/infrastructure/domains/health/docs/SPEC-CLEANUP-COMMAND.md +1419 -0
- package/infrastructure/domains/health/docs/TDD-IMPLEMENTATION-SUMMARY.md +391 -0
- package/infrastructure/domains/health/docs/TEMPLATE-COMPARISON-IMPLEMENTATION.md +551 -0
- package/infrastructure/domains/health/domain/entities/issue.js +299 -0
- package/infrastructure/domains/health/domain/entities/issue.test.js +528 -0
- package/infrastructure/domains/health/domain/entities/property-mismatch.js +108 -0
- package/infrastructure/domains/health/domain/entities/property-mismatch.test.js +275 -0
- package/infrastructure/domains/health/domain/entities/resource.js +159 -0
- package/infrastructure/domains/health/domain/entities/resource.test.js +432 -0
- package/infrastructure/domains/health/domain/entities/stack-health-report.js +306 -0
- package/infrastructure/domains/health/domain/entities/stack-health-report.test.js +601 -0
- package/infrastructure/domains/health/domain/services/__tests__/health-score-percentage-based.test.js +380 -0
- package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +971 -0
- package/infrastructure/domains/health/domain/services/__tests__/import-template-generator.test.js +1150 -0
- package/infrastructure/domains/health/domain/services/__tests__/logical-id-mapper.test.js +672 -0
- package/infrastructure/domains/health/domain/services/__tests__/template-parser.test.js +496 -0
- package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +419 -0
- package/infrastructure/domains/health/domain/services/health-score-calculator.js +248 -0
- package/infrastructure/domains/health/domain/services/health-score-calculator.test.js +504 -0
- package/infrastructure/domains/health/domain/services/import-progress-monitor.js +195 -0
- package/infrastructure/domains/health/domain/services/import-template-generator.js +435 -0
- package/infrastructure/domains/health/domain/services/logical-id-mapper.js +345 -0
- package/infrastructure/domains/health/domain/services/mismatch-analyzer.js +234 -0
- package/infrastructure/domains/health/domain/services/mismatch-analyzer.test.js +431 -0
- package/infrastructure/domains/health/domain/services/property-mutability-config.js +382 -0
- package/infrastructure/domains/health/domain/services/template-parser.js +245 -0
- package/infrastructure/domains/health/domain/services/update-progress-monitor.js +192 -0
- package/infrastructure/domains/health/domain/value-objects/health-score.js +138 -0
- package/infrastructure/domains/health/domain/value-objects/health-score.test.js +267 -0
- package/infrastructure/domains/health/domain/value-objects/property-mutability.js +161 -0
- package/infrastructure/domains/health/domain/value-objects/property-mutability.test.js +198 -0
- package/infrastructure/domains/health/domain/value-objects/resource-state.js +167 -0
- package/infrastructure/domains/health/domain/value-objects/resource-state.test.js +196 -0
- package/infrastructure/domains/health/domain/value-objects/stack-identifier.js +192 -0
- package/infrastructure/domains/health/domain/value-objects/stack-identifier.test.js +262 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-cfn-tagged.test.js +312 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-multi-stack.test.js +367 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +432 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.js +784 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +1133 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.js +565 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +554 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.js +318 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.test.js +398 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.js +777 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.test.js +580 -0
- package/infrastructure/domains/integration/integration-builder.js +404 -0
- package/infrastructure/domains/integration/integration-builder.test.js +690 -0
- package/infrastructure/domains/integration/integration-resolver.js +170 -0
- package/infrastructure/domains/integration/integration-resolver.test.js +369 -0
- package/infrastructure/domains/integration/websocket-builder.js +69 -0
- package/infrastructure/domains/integration/websocket-builder.test.js +195 -0
- package/infrastructure/domains/networking/vpc-builder.js +2051 -0
- package/infrastructure/domains/networking/vpc-builder.test.js +1960 -0
- package/infrastructure/domains/networking/vpc-discovery.js +177 -0
- package/infrastructure/domains/networking/vpc-discovery.test.js +350 -0
- package/infrastructure/domains/networking/vpc-resolver.js +505 -0
- package/infrastructure/domains/networking/vpc-resolver.test.js +801 -0
- package/infrastructure/domains/parameters/ssm-builder.js +79 -0
- package/infrastructure/domains/parameters/ssm-builder.test.js +189 -0
- package/infrastructure/domains/parameters/ssm-discovery.js +84 -0
- package/infrastructure/domains/parameters/ssm-discovery.test.js +210 -0
- package/infrastructure/domains/security/iam-generator.js +816 -0
- package/infrastructure/domains/security/iam-generator.test.js +204 -0
- package/infrastructure/domains/security/kms-builder.js +415 -0
- package/infrastructure/domains/security/kms-builder.test.js +392 -0
- package/infrastructure/domains/security/kms-discovery.js +80 -0
- package/infrastructure/domains/security/kms-discovery.test.js +177 -0
- package/infrastructure/domains/security/kms-resolver.js +96 -0
- package/infrastructure/domains/security/kms-resolver.test.js +216 -0
- package/infrastructure/domains/security/templates/frigg-deployment-iam-stack.yaml +401 -0
- package/infrastructure/domains/security/templates/iam-policy-basic.json +218 -0
- package/infrastructure/domains/security/templates/iam-policy-full.json +288 -0
- package/infrastructure/domains/shared/base-builder.js +112 -0
- package/infrastructure/domains/shared/base-resolver.js +186 -0
- package/infrastructure/domains/shared/base-resolver.test.js +305 -0
- package/infrastructure/domains/shared/builder-orchestrator.js +212 -0
- package/infrastructure/domains/shared/builder-orchestrator.test.js +213 -0
- package/infrastructure/domains/shared/cloudformation-discovery-v2.js +334 -0
- package/infrastructure/domains/shared/cloudformation-discovery.js +672 -0
- package/infrastructure/domains/shared/cloudformation-discovery.test.js +985 -0
- package/infrastructure/domains/shared/environment-builder.js +119 -0
- package/infrastructure/domains/shared/environment-builder.test.js +247 -0
- package/infrastructure/domains/shared/providers/aws-provider-adapter.js +579 -0
- package/infrastructure/domains/shared/providers/aws-provider-adapter.test.js +416 -0
- package/infrastructure/domains/shared/providers/azure-provider-adapter.stub.js +93 -0
- package/infrastructure/domains/shared/providers/cloud-provider-adapter.js +136 -0
- package/infrastructure/domains/shared/providers/gcp-provider-adapter.stub.js +82 -0
- package/infrastructure/domains/shared/providers/provider-factory.js +108 -0
- package/infrastructure/domains/shared/providers/provider-factory.test.js +170 -0
- package/infrastructure/domains/shared/resource-discovery.enhanced.test.js +306 -0
- package/infrastructure/domains/shared/resource-discovery.js +233 -0
- package/infrastructure/domains/shared/resource-discovery.test.js +588 -0
- package/infrastructure/domains/shared/types/app-definition.js +205 -0
- package/infrastructure/domains/shared/types/discovery-result.js +106 -0
- package/infrastructure/domains/shared/types/discovery-result.test.js +258 -0
- package/infrastructure/domains/shared/types/index.js +46 -0
- package/infrastructure/domains/shared/types/resource-ownership.js +108 -0
- package/infrastructure/domains/shared/types/resource-ownership.test.js +101 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +394 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js.bak +338 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +291 -0
- package/infrastructure/domains/shared/utilities/handler-path-resolver.js +134 -0
- package/infrastructure/domains/shared/utilities/handler-path-resolver.test.js +268 -0
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +159 -0
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +444 -0
- package/infrastructure/domains/shared/validation/env-validator.js +78 -0
- package/infrastructure/domains/shared/validation/env-validator.test.js +173 -0
- package/infrastructure/domains/shared/validation/plugin-validator.js +187 -0
- package/infrastructure/domains/shared/validation/plugin-validator.test.js +323 -0
- package/infrastructure/esbuild.config.js +53 -0
- package/infrastructure/infrastructure-composer.js +117 -0
- package/infrastructure/infrastructure-composer.test.js +1895 -0
- package/infrastructure/integration.test.js +383 -0
- package/infrastructure/scripts/build-prisma-layer.js +701 -0
- package/infrastructure/scripts/build-prisma-layer.test.js +170 -0
- package/infrastructure/scripts/build-time-discovery.js +238 -0
- package/infrastructure/scripts/build-time-discovery.test.js +379 -0
- package/infrastructure/scripts/run-discovery.js +110 -0
- package/infrastructure/scripts/verify-prisma-layer.js +72 -0
- package/layers/prisma/.build-complete +3 -0
- package/layers/prisma/nodejs/package.json +8 -0
- package/management-ui/.eslintrc.js +22 -0
- package/management-ui/README.md +203 -0
- package/management-ui/components.json +21 -0
- package/management-ui/docs/phase2-integration-guide.md +320 -0
- package/management-ui/index.html +13 -0
- package/management-ui/package.json +76 -0
- package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +302 -0
- package/management-ui/postcss.config.js +6 -0
- package/management-ui/server/api/backend.js +256 -0
- package/management-ui/server/api/cli.js +315 -0
- package/management-ui/server/api/codegen.js +663 -0
- package/management-ui/server/api/connections.js +857 -0
- package/management-ui/server/api/discovery.js +185 -0
- package/management-ui/server/api/environment/index.js +1 -0
- package/management-ui/server/api/environment/router.js +378 -0
- package/management-ui/server/api/environment.js +328 -0
- package/management-ui/server/api/integrations.js +876 -0
- package/management-ui/server/api/logs.js +248 -0
- package/management-ui/server/api/monitoring.js +282 -0
- package/management-ui/server/api/open-ide.js +31 -0
- package/management-ui/server/api/project.js +1029 -0
- package/management-ui/server/api/users/sessions.js +371 -0
- package/management-ui/server/api/users/simulation.js +254 -0
- package/management-ui/server/api/users.js +362 -0
- package/management-ui/server/api-contract.md +275 -0
- package/management-ui/server/index.js +873 -0
- package/management-ui/server/middleware/errorHandler.js +93 -0
- package/management-ui/server/middleware/security.js +32 -0
- package/management-ui/server/processManager.js +296 -0
- package/management-ui/server/server.js +346 -0
- package/management-ui/server/services/aws-monitor.js +413 -0
- package/management-ui/server/services/npm-registry.js +347 -0
- package/management-ui/server/services/template-engine.js +538 -0
- package/management-ui/server/utils/cliIntegration.js +220 -0
- package/management-ui/server/utils/environment/auditLogger.js +471 -0
- package/management-ui/server/utils/environment/awsParameterStore.js +275 -0
- package/management-ui/server/utils/environment/encryption.js +278 -0
- package/management-ui/server/utils/environment/envFileManager.js +286 -0
- package/management-ui/server/utils/import-commonjs.js +28 -0
- package/management-ui/server/utils/response.js +83 -0
- package/management-ui/server/websocket/handler.js +325 -0
- package/management-ui/src/App.jsx +25 -0
- package/management-ui/src/assets/FriggLogo.svg +1 -0
- package/management-ui/src/components/AppRouter.jsx +65 -0
- package/management-ui/src/components/Button.jsx +70 -0
- package/management-ui/src/components/Card.jsx +97 -0
- package/management-ui/src/components/EnvironmentCompare.jsx +400 -0
- package/management-ui/src/components/EnvironmentEditor.jsx +372 -0
- package/management-ui/src/components/EnvironmentImportExport.jsx +469 -0
- package/management-ui/src/components/EnvironmentSchema.jsx +491 -0
- package/management-ui/src/components/EnvironmentSecurity.jsx +463 -0
- package/management-ui/src/components/ErrorBoundary.jsx +73 -0
- package/management-ui/src/components/IntegrationCard.jsx +481 -0
- package/management-ui/src/components/IntegrationCardEnhanced.jsx +770 -0
- package/management-ui/src/components/IntegrationExplorer.jsx +379 -0
- package/management-ui/src/components/IntegrationStatus.jsx +336 -0
- package/management-ui/src/components/Layout.jsx +716 -0
- package/management-ui/src/components/LoadingSpinner.jsx +113 -0
- package/management-ui/src/components/RepositoryPicker.jsx +248 -0
- package/management-ui/src/components/SessionMonitor.jsx +350 -0
- package/management-ui/src/components/StatusBadge.jsx +208 -0
- package/management-ui/src/components/UserContextSwitcher.jsx +212 -0
- package/management-ui/src/components/UserSimulation.jsx +327 -0
- package/management-ui/src/components/Welcome.jsx +434 -0
- package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +637 -0
- package/management-ui/src/components/codegen/APIModuleSelector.jsx +227 -0
- package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +247 -0
- package/management-ui/src/components/codegen/CodePreviewEditor.jsx +316 -0
- package/management-ui/src/components/codegen/DynamicModuleForm.jsx +271 -0
- package/management-ui/src/components/codegen/FormBuilder.jsx +737 -0
- package/management-ui/src/components/codegen/IntegrationGenerator.jsx +855 -0
- package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +797 -0
- package/management-ui/src/components/codegen/SchemaBuilder.jsx +303 -0
- package/management-ui/src/components/codegen/TemplateSelector.jsx +586 -0
- package/management-ui/src/components/codegen/index.js +10 -0
- package/management-ui/src/components/connections/ConnectionConfigForm.jsx +362 -0
- package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +182 -0
- package/management-ui/src/components/connections/ConnectionTester.jsx +200 -0
- package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +292 -0
- package/management-ui/src/components/connections/OAuthFlow.jsx +204 -0
- package/management-ui/src/components/connections/index.js +5 -0
- package/management-ui/src/components/index.js +21 -0
- package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +222 -0
- package/management-ui/src/components/monitoring/LambdaMetrics.jsx +169 -0
- package/management-ui/src/components/monitoring/MetricsChart.jsx +197 -0
- package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +393 -0
- package/management-ui/src/components/monitoring/SQSMetrics.jsx +246 -0
- package/management-ui/src/components/monitoring/index.js +6 -0
- package/management-ui/src/components/monitoring/monitoring.css +218 -0
- package/management-ui/src/components/theme-provider.jsx +52 -0
- package/management-ui/src/components/theme-toggle.jsx +39 -0
- package/management-ui/src/components/ui/badge.tsx +36 -0
- package/management-ui/src/components/ui/button.test.jsx +56 -0
- package/management-ui/src/components/ui/button.tsx +57 -0
- package/management-ui/src/components/ui/card.tsx +76 -0
- package/management-ui/src/components/ui/dropdown-menu.tsx +199 -0
- package/management-ui/src/components/ui/select.tsx +157 -0
- package/management-ui/src/components/ui/skeleton.jsx +15 -0
- package/management-ui/src/hooks/useFrigg.jsx +387 -0
- package/management-ui/src/hooks/useSocket.jsx +58 -0
- package/management-ui/src/index.css +193 -0
- package/management-ui/src/lib/utils.ts +6 -0
- package/management-ui/src/main.jsx +10 -0
- package/management-ui/src/pages/CodeGeneration.jsx +14 -0
- package/management-ui/src/pages/Connections.jsx +252 -0
- package/management-ui/src/pages/ConnectionsEnhanced.jsx +633 -0
- package/management-ui/src/pages/Dashboard.jsx +311 -0
- package/management-ui/src/pages/Environment.jsx +314 -0
- package/management-ui/src/pages/IntegrationConfigure.jsx +669 -0
- package/management-ui/src/pages/IntegrationDiscovery.jsx +567 -0
- package/management-ui/src/pages/IntegrationTest.jsx +742 -0
- package/management-ui/src/pages/Integrations.jsx +253 -0
- package/management-ui/src/pages/Monitoring.jsx +17 -0
- package/management-ui/src/pages/Simulation.jsx +155 -0
- package/management-ui/src/pages/Users.jsx +492 -0
- package/management-ui/src/services/api.js +41 -0
- package/management-ui/src/services/apiModuleService.js +193 -0
- package/management-ui/src/services/websocket-handlers.js +120 -0
- package/management-ui/src/test/api/project.test.js +273 -0
- package/management-ui/src/test/components/Welcome.test.jsx +378 -0
- package/management-ui/src/test/mocks/server.js +178 -0
- package/management-ui/src/test/setup.js +61 -0
- package/management-ui/src/test/utils/test-utils.jsx +134 -0
- package/management-ui/src/utils/repository.js +98 -0
- package/management-ui/src/utils/repository.test.js +118 -0
- package/management-ui/src/workflows/phase2-integration-workflows.js +884 -0
- package/management-ui/tailwind.config.js +63 -0
- package/management-ui/tsconfig.json +37 -0
- package/management-ui/tsconfig.node.json +10 -0
- package/management-ui/vite.config.js +26 -0
- package/management-ui/vitest.config.js +38 -0
- package/package.json +35 -14
- package/test/index.js +2 -4
- package/test/mock-integration.js +4 -14
- package/infrastructure/app-handler-helpers.js +0 -57
- package/infrastructure/backend-utils.js +0 -87
- package/infrastructure/routers/auth.js +0 -26
- package/infrastructure/routers/integration-defined-routers.js +0 -42
- package/infrastructure/routers/middleware/loadUser.js +0 -15
- package/infrastructure/routers/middleware/requireLoggedInUser.js +0 -12
- package/infrastructure/routers/user.js +0 -41
- package/infrastructure/routers/websocket.js +0 -55
- package/infrastructure/serverless-template.js +0 -291
- package/infrastructure/workers/integration-defined-workers.js +0 -24
- package/test/auther-definition-tester.js +0 -125
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react'
|
|
2
|
+
import { useSocket } from '../hooks/useSocket'
|
|
3
|
+
|
|
4
|
+
const EnvironmentEditor = ({
|
|
5
|
+
variables = [],
|
|
6
|
+
environment = 'local',
|
|
7
|
+
onSave,
|
|
8
|
+
onVariableUpdate,
|
|
9
|
+
onVariableDelete,
|
|
10
|
+
readOnly = false
|
|
11
|
+
}) => {
|
|
12
|
+
const [editorContent, setEditorContent] = useState('')
|
|
13
|
+
const [isDirty, setIsDirty] = useState(false)
|
|
14
|
+
const [errors, setErrors] = useState([])
|
|
15
|
+
const [showMaskedValues, setShowMaskedValues] = useState(false)
|
|
16
|
+
const [searchTerm, setSearchTerm] = useState('')
|
|
17
|
+
const [selectedLines, setSelectedLines] = useState(new Set())
|
|
18
|
+
const editorRef = useRef(null)
|
|
19
|
+
const { on } = useSocket()
|
|
20
|
+
|
|
21
|
+
// Convert variables to editor content
|
|
22
|
+
const variablesToContent = useCallback((vars) => {
|
|
23
|
+
let content = `# Environment: ${environment}\n`
|
|
24
|
+
content += `# Generated at: ${new Date().toISOString()}\n\n`
|
|
25
|
+
|
|
26
|
+
const sorted = [...vars].sort((a, b) => a.key.localeCompare(b.key))
|
|
27
|
+
|
|
28
|
+
sorted.forEach(variable => {
|
|
29
|
+
if (variable.description) {
|
|
30
|
+
content += `# ${variable.description}\n`
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let value = variable.value
|
|
34
|
+
if (variable.isSecret && !showMaskedValues) {
|
|
35
|
+
value = '***MASKED***'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
content += `${variable.key}=${value}\n\n`
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return content.trim()
|
|
42
|
+
}, [environment, showMaskedValues])
|
|
43
|
+
|
|
44
|
+
// Parse content back to variables
|
|
45
|
+
const contentToVariables = useCallback((content) => {
|
|
46
|
+
const lines = content.split('\n')
|
|
47
|
+
const vars = []
|
|
48
|
+
let currentDescription = ''
|
|
49
|
+
const errors = []
|
|
50
|
+
|
|
51
|
+
lines.forEach((line, index) => {
|
|
52
|
+
const trimmed = line.trim()
|
|
53
|
+
|
|
54
|
+
// Skip empty lines
|
|
55
|
+
if (!trimmed) return
|
|
56
|
+
|
|
57
|
+
// Handle comments
|
|
58
|
+
if (trimmed.startsWith('#')) {
|
|
59
|
+
// Skip generated headers
|
|
60
|
+
if (trimmed.includes('Environment:') || trimmed.includes('Generated at:')) return
|
|
61
|
+
currentDescription = trimmed.substring(1).trim()
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Parse variable
|
|
66
|
+
const equalIndex = trimmed.indexOf('=')
|
|
67
|
+
if (equalIndex > 0) {
|
|
68
|
+
const key = trimmed.substring(0, equalIndex).trim()
|
|
69
|
+
let value = trimmed.substring(equalIndex + 1).trim()
|
|
70
|
+
|
|
71
|
+
// Remove quotes if present
|
|
72
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
73
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
74
|
+
value = value.slice(1, -1)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Validate key format
|
|
78
|
+
if (!/^[A-Z_][A-Z0-9_]*$/i.test(key)) {
|
|
79
|
+
errors.push({
|
|
80
|
+
line: index + 1,
|
|
81
|
+
message: `Invalid variable name format: ${key}`
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Don't update masked values
|
|
86
|
+
if (value === '***MASKED***') {
|
|
87
|
+
const existing = variables.find(v => v.key === key)
|
|
88
|
+
if (existing) {
|
|
89
|
+
value = existing.value
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
vars.push({
|
|
94
|
+
key,
|
|
95
|
+
value,
|
|
96
|
+
description: currentDescription,
|
|
97
|
+
isSecret: isSecretVariable(key),
|
|
98
|
+
line: index + 1
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
currentDescription = ''
|
|
102
|
+
} else if (trimmed) {
|
|
103
|
+
errors.push({
|
|
104
|
+
line: index + 1,
|
|
105
|
+
message: `Invalid line format: ${trimmed}`
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
return { variables: vars, errors }
|
|
111
|
+
}, [variables])
|
|
112
|
+
|
|
113
|
+
// Check if variable name suggests it's sensitive
|
|
114
|
+
const isSecretVariable = (key) => {
|
|
115
|
+
const patterns = ['PASSWORD', 'SECRET', 'KEY', 'TOKEN', 'PRIVATE', 'CREDENTIAL']
|
|
116
|
+
return patterns.some(pattern => key.toUpperCase().includes(pattern))
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Initialize editor content
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
setEditorContent(variablesToContent(variables))
|
|
122
|
+
setIsDirty(false)
|
|
123
|
+
}, [variables, variablesToContent])
|
|
124
|
+
|
|
125
|
+
// Listen for real-time updates
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
const unsubscribe = on('env-update', (data) => {
|
|
128
|
+
if (data.environment === environment) {
|
|
129
|
+
// Refresh content if not dirty
|
|
130
|
+
if (!isDirty) {
|
|
131
|
+
setEditorContent(variablesToContent(variables))
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
return unsubscribe
|
|
137
|
+
}, [on, environment, isDirty, variables, variablesToContent])
|
|
138
|
+
|
|
139
|
+
// Handle content changes
|
|
140
|
+
const handleContentChange = (e) => {
|
|
141
|
+
const newContent = e.target.value
|
|
142
|
+
setEditorContent(newContent)
|
|
143
|
+
setIsDirty(true)
|
|
144
|
+
|
|
145
|
+
// Real-time validation
|
|
146
|
+
const { errors: validationErrors } = contentToVariables(newContent)
|
|
147
|
+
setErrors(validationErrors)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Save changes
|
|
151
|
+
const handleSave = async () => {
|
|
152
|
+
const { variables: parsedVars, errors: validationErrors } = contentToVariables(editorContent)
|
|
153
|
+
|
|
154
|
+
if (validationErrors.length > 0) {
|
|
155
|
+
setErrors(validationErrors)
|
|
156
|
+
return
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
await onSave(parsedVars)
|
|
161
|
+
setIsDirty(false)
|
|
162
|
+
setErrors([])
|
|
163
|
+
} catch (error) {
|
|
164
|
+
setErrors([{ message: error.message }])
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Handle line selection for bulk operations
|
|
169
|
+
const handleLineClick = (lineNumber, event) => {
|
|
170
|
+
if (event.ctrlKey || event.metaKey) {
|
|
171
|
+
const newSelected = new Set(selectedLines)
|
|
172
|
+
if (newSelected.has(lineNumber)) {
|
|
173
|
+
newSelected.delete(lineNumber)
|
|
174
|
+
} else {
|
|
175
|
+
newSelected.add(lineNumber)
|
|
176
|
+
}
|
|
177
|
+
setSelectedLines(newSelected)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Filter content based on search
|
|
182
|
+
const getFilteredContent = () => {
|
|
183
|
+
if (!searchTerm) return editorContent
|
|
184
|
+
|
|
185
|
+
const lines = editorContent.split('\n')
|
|
186
|
+
const filtered = lines.filter(line => {
|
|
187
|
+
const trimmed = line.trim()
|
|
188
|
+
if (!trimmed || trimmed.startsWith('#')) return true
|
|
189
|
+
return trimmed.toLowerCase().includes(searchTerm.toLowerCase())
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
return filtered.join('\n')
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Copy selected variables to clipboard
|
|
196
|
+
const copySelectedVariables = () => {
|
|
197
|
+
const lines = editorContent.split('\n')
|
|
198
|
+
const selected = lines.filter((_, index) => selectedLines.has(index + 1))
|
|
199
|
+
navigator.clipboard.writeText(selected.join('\n'))
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Insert template variables
|
|
203
|
+
const insertTemplate = (template) => {
|
|
204
|
+
const templates = {
|
|
205
|
+
database: `# Database Configuration
|
|
206
|
+
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
|
|
207
|
+
DATABASE_POOL_SIZE=20
|
|
208
|
+
DATABASE_SSL=true`,
|
|
209
|
+
redis: `# Redis Configuration
|
|
210
|
+
REDIS_URL=redis://localhost:6379
|
|
211
|
+
REDIS_PASSWORD=
|
|
212
|
+
REDIS_DB=0`,
|
|
213
|
+
aws: `# AWS Configuration
|
|
214
|
+
AWS_ACCESS_KEY_ID=
|
|
215
|
+
AWS_SECRET_ACCESS_KEY=
|
|
216
|
+
AWS_REGION=us-east-1
|
|
217
|
+
AWS_BUCKET_NAME=`,
|
|
218
|
+
api: `# API Configuration
|
|
219
|
+
API_BASE_URL=https://api.example.com
|
|
220
|
+
API_KEY=
|
|
221
|
+
API_SECRET=
|
|
222
|
+
API_TIMEOUT=30000`
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const templateContent = templates[template]
|
|
226
|
+
if (templateContent) {
|
|
227
|
+
setEditorContent(editorContent + '\n\n' + templateContent)
|
|
228
|
+
setIsDirty(true)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<div className="environment-editor">
|
|
234
|
+
{/* Toolbar */}
|
|
235
|
+
<div className="bg-muted border-b border-border p-2 flex items-center justify-between">
|
|
236
|
+
<div className="flex items-center space-x-2">
|
|
237
|
+
{/* Save Button */}
|
|
238
|
+
<button
|
|
239
|
+
onClick={handleSave}
|
|
240
|
+
disabled={!isDirty || readOnly}
|
|
241
|
+
className={`px-3 py-1 rounded text-sm font-medium ${
|
|
242
|
+
isDirty && !readOnly
|
|
243
|
+
? 'bg-green-600 text-white hover:bg-green-700'
|
|
244
|
+
: 'bg-muted text-muted-foreground cursor-not-allowed'
|
|
245
|
+
}`}
|
|
246
|
+
>
|
|
247
|
+
{isDirty ? 'Save Changes' : 'Saved'}
|
|
248
|
+
</button>
|
|
249
|
+
|
|
250
|
+
{/* Revert Button */}
|
|
251
|
+
{isDirty && (
|
|
252
|
+
<button
|
|
253
|
+
onClick={() => {
|
|
254
|
+
setEditorContent(variablesToContent(variables))
|
|
255
|
+
setIsDirty(false)
|
|
256
|
+
setErrors([])
|
|
257
|
+
}}
|
|
258
|
+
className="px-3 py-1 rounded text-sm font-medium bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
259
|
+
>
|
|
260
|
+
Revert
|
|
261
|
+
</button>
|
|
262
|
+
)}
|
|
263
|
+
|
|
264
|
+
{/* Toggle Secrets */}
|
|
265
|
+
<button
|
|
266
|
+
onClick={() => setShowMaskedValues(!showMaskedValues)}
|
|
267
|
+
className="px-3 py-1 rounded text-sm font-medium bg-gray-200 text-gray-700 hover:bg-gray-300 flex items-center"
|
|
268
|
+
>
|
|
269
|
+
<svg className="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
270
|
+
{showMaskedValues ? (
|
|
271
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
|
272
|
+
) : (
|
|
273
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
|
|
274
|
+
)}
|
|
275
|
+
</svg>
|
|
276
|
+
{showMaskedValues ? 'Hide' : 'Show'} Secrets
|
|
277
|
+
</button>
|
|
278
|
+
|
|
279
|
+
{/* Templates Dropdown */}
|
|
280
|
+
<div className="relative group">
|
|
281
|
+
<button className="px-3 py-1 rounded text-sm font-medium bg-gray-200 text-gray-700 hover:bg-gray-300">
|
|
282
|
+
Insert Template ▼
|
|
283
|
+
</button>
|
|
284
|
+
<div className="absolute left-0 mt-1 w-48 bg-popover border border-border rounded shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-10">
|
|
285
|
+
<button onClick={() => insertTemplate('database')} className="block w-full text-left px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground">Database Config</button>
|
|
286
|
+
<button onClick={() => insertTemplate('redis')} className="block w-full text-left px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground">Redis Config</button>
|
|
287
|
+
<button onClick={() => insertTemplate('aws')} className="block w-full text-left px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground">AWS Config</button>
|
|
288
|
+
<button onClick={() => insertTemplate('api')} className="block w-full text-left px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground">API Config</button>
|
|
289
|
+
</div>
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
{/* Copy Selected */}
|
|
293
|
+
{selectedLines.size > 0 && (
|
|
294
|
+
<button
|
|
295
|
+
onClick={copySelectedVariables}
|
|
296
|
+
className="px-3 py-1 rounded text-sm font-medium bg-blue-600 text-white hover:bg-blue-700"
|
|
297
|
+
>
|
|
298
|
+
Copy {selectedLines.size} Selected
|
|
299
|
+
</button>
|
|
300
|
+
)}
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
{/* Search */}
|
|
304
|
+
<div className="flex items-center">
|
|
305
|
+
<input
|
|
306
|
+
type="text"
|
|
307
|
+
placeholder="Search variables..."
|
|
308
|
+
value={searchTerm}
|
|
309
|
+
onChange={(e) => setSearchTerm(e.target.value)}
|
|
310
|
+
className="px-3 py-1 border border-input bg-background text-foreground rounded text-sm focus:outline-none focus:border-ring focus:ring-1 focus:ring-ring"
|
|
311
|
+
/>
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
{/* Editor */}
|
|
316
|
+
<div className="relative">
|
|
317
|
+
{/* Line Numbers */}
|
|
318
|
+
<div className="absolute left-0 top-0 bottom-0 w-12 bg-muted/50 border-r border-border select-none">
|
|
319
|
+
{editorContent.split('\n').map((_, index) => (
|
|
320
|
+
<div
|
|
321
|
+
key={index}
|
|
322
|
+
onClick={(e) => handleLineClick(index + 1, e)}
|
|
323
|
+
className={`px-2 text-right text-xs text-muted-foreground leading-6 cursor-pointer hover:bg-accent hover:text-accent-foreground ${
|
|
324
|
+
selectedLines.has(index + 1) ? 'bg-primary/20 text-primary' : ''
|
|
325
|
+
}`}
|
|
326
|
+
>
|
|
327
|
+
{index + 1}
|
|
328
|
+
</div>
|
|
329
|
+
))}
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
{/* Text Area */}
|
|
333
|
+
<textarea
|
|
334
|
+
ref={editorRef}
|
|
335
|
+
value={searchTerm ? getFilteredContent() : editorContent}
|
|
336
|
+
onChange={handleContentChange}
|
|
337
|
+
readOnly={readOnly || searchTerm}
|
|
338
|
+
className="w-full h-96 pl-14 pr-4 py-2 font-mono text-sm leading-6 resize-none focus:outline-none bg-background text-foreground"
|
|
339
|
+
spellCheck={false}
|
|
340
|
+
style={{ tabSize: 2 }}
|
|
341
|
+
/>
|
|
342
|
+
|
|
343
|
+
{/* Error Indicators */}
|
|
344
|
+
{errors.length > 0 && (
|
|
345
|
+
<div className="absolute right-2 top-2 bg-destructive/10 border border-destructive/20 rounded p-2 max-w-xs">
|
|
346
|
+
<h4 className="text-sm font-medium text-destructive mb-1">Validation Errors:</h4>
|
|
347
|
+
<ul className="text-xs text-destructive/80 space-y-1">
|
|
348
|
+
{errors.map((error, index) => (
|
|
349
|
+
<li key={index}>
|
|
350
|
+
{error.line && `Line ${error.line}: `}{error.message}
|
|
351
|
+
</li>
|
|
352
|
+
))}
|
|
353
|
+
</ul>
|
|
354
|
+
</div>
|
|
355
|
+
)}
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
{/* Status Bar */}
|
|
359
|
+
<div className="bg-gray-100 border-t border-gray-300 px-3 py-1 flex items-center justify-between text-xs text-gray-600">
|
|
360
|
+
<div>
|
|
361
|
+
{variables.length} variables • {environment} environment
|
|
362
|
+
</div>
|
|
363
|
+
<div className="flex items-center space-x-4">
|
|
364
|
+
{isDirty && <span className="text-orange-600">● Modified</span>}
|
|
365
|
+
{errors.length > 0 && <span className="text-red-600">{errors.length} errors</span>}
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
</div>
|
|
369
|
+
)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export default EnvironmentEditor
|