@aws-amplify/cli-internal-gen2-migration-experimental-alpha 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/adr/001-refactor-gen2-migration-generate.md +413 -0
- package/adr/002-refactor-gen2-migration-refactor.md +593 -0
- package/adr/003-gen2-migration-assess.md +414 -0
- package/adr/004-gen2-migration-validation-modeling.md +336 -0
- package/aws-amplify-cli-internal-gen2-migration-experimental-alpha-0.7.0.tgz +0 -0
- package/bin/amplify +1 -1
- package/lib/commands/drift-detection/detect-local-drift.d.ts +1 -2
- package/lib/commands/drift-detection/detect-local-drift.d.ts.map +1 -1
- package/lib/commands/drift-detection/detect-local-drift.js +19 -6
- package/lib/commands/drift-detection/detect-local-drift.js.map +1 -1
- package/lib/commands/drift-detection/detect-stack-drift.d.ts +20 -9
- package/lib/commands/drift-detection/detect-stack-drift.d.ts.map +1 -1
- package/lib/commands/drift-detection/detect-stack-drift.js +121 -151
- package/lib/commands/drift-detection/detect-stack-drift.js.map +1 -1
- package/lib/commands/drift-detection/detect-template-drift.d.ts +8 -21
- package/lib/commands/drift-detection/detect-template-drift.d.ts.map +1 -1
- package/lib/commands/drift-detection/detect-template-drift.js +81 -89
- package/lib/commands/drift-detection/detect-template-drift.js.map +1 -1
- package/lib/commands/drift-detection/index.d.ts +2 -3
- package/lib/commands/drift-detection/index.d.ts.map +1 -1
- package/lib/commands/drift-detection/index.js +1 -3
- package/lib/commands/drift-detection/index.js.map +1 -1
- package/lib/commands/drift-detection/services/amplify-config-service.d.ts +0 -1
- package/lib/commands/drift-detection/services/amplify-config-service.d.ts.map +1 -1
- package/lib/commands/drift-detection/services/amplify-config-service.js +0 -16
- package/lib/commands/drift-detection/services/amplify-config-service.js.map +1 -1
- package/lib/commands/drift-detection/services/cloudformation-service.d.ts +2 -4
- package/lib/commands/drift-detection/services/cloudformation-service.d.ts.map +1 -1
- package/lib/commands/drift-detection/services/cloudformation-service.js +7 -11
- package/lib/commands/drift-detection/services/cloudformation-service.js.map +1 -1
- package/lib/commands/drift-detection/services/drift-formatter.d.ts +3 -70
- package/lib/commands/drift-detection/services/drift-formatter.d.ts.map +1 -1
- package/lib/commands/drift-detection/services/drift-formatter.js +148 -603
- package/lib/commands/drift-detection/services/drift-formatter.js.map +1 -1
- package/lib/commands/drift-detection/services/index.d.ts +1 -2
- package/lib/commands/drift-detection/services/index.d.ts.map +1 -1
- package/lib/commands/drift-detection/services/index.js +2 -4
- package/lib/commands/drift-detection/services/index.js.map +1 -1
- package/lib/commands/drift.d.ts +7 -18
- package/lib/commands/drift.d.ts.map +1 -1
- package/lib/commands/drift.js +71 -172
- package/lib/commands/drift.js.map +1 -1
- package/lib/commands/gen2-migration/_infra/aws-clients.d.ts +31 -0
- package/lib/commands/gen2-migration/_infra/aws-clients.d.ts.map +1 -0
- package/lib/commands/gen2-migration/_infra/aws-clients.js +64 -0
- package/lib/commands/gen2-migration/_infra/aws-clients.js.map +1 -0
- package/lib/commands/gen2-migration/_infra/categories.d.ts +2 -0
- package/lib/commands/gen2-migration/_infra/categories.d.ts.map +1 -0
- package/lib/commands/gen2-migration/_infra/categories.js +32 -0
- package/lib/commands/gen2-migration/_infra/categories.js.map +1 -0
- package/lib/commands/gen2-migration/_infra/cfn-template.d.ts +52 -0
- package/lib/commands/gen2-migration/_infra/cfn-template.d.ts.map +1 -0
- package/lib/commands/gen2-migration/_infra/cfn-template.js +21 -0
- package/lib/commands/gen2-migration/_infra/cfn-template.js.map +1 -0
- package/lib/commands/gen2-migration/_infra/operation.d.ts +16 -0
- package/lib/commands/gen2-migration/_infra/operation.d.ts.map +1 -0
- package/lib/commands/gen2-migration/_infra/operation.js +3 -0
- package/lib/commands/gen2-migration/_infra/operation.js.map +1 -0
- package/lib/commands/gen2-migration/_infra/plan.d.ts +21 -0
- package/lib/commands/gen2-migration/_infra/plan.d.ts.map +1 -0
- package/lib/commands/gen2-migration/_infra/plan.js +111 -0
- package/lib/commands/gen2-migration/_infra/plan.js.map +1 -0
- package/lib/commands/gen2-migration/_infra/planner.d.ts +5 -0
- package/lib/commands/gen2-migration/_infra/planner.d.ts.map +1 -0
- package/lib/commands/gen2-migration/{generate/custom-resources/types.js → _infra/planner.js} +1 -1
- package/lib/commands/gen2-migration/_infra/planner.js.map +1 -0
- package/lib/commands/gen2-migration/_infra/spinning-logger.d.ts +25 -0
- package/lib/commands/gen2-migration/_infra/spinning-logger.d.ts.map +1 -0
- package/lib/commands/gen2-migration/_infra/spinning-logger.js +115 -0
- package/lib/commands/gen2-migration/_infra/spinning-logger.js.map +1 -0
- package/lib/commands/gen2-migration/_infra/stateful-resources.d.ts.map +1 -0
- package/lib/commands/gen2-migration/_infra/stateful-resources.js.map +1 -0
- package/lib/commands/gen2-migration/_infra/step.d.ts +15 -0
- package/lib/commands/gen2-migration/_infra/step.d.ts.map +1 -0
- package/lib/commands/gen2-migration/_infra/step.js +13 -0
- package/lib/commands/gen2-migration/_infra/step.js.map +1 -0
- package/lib/commands/gen2-migration/{_validations.d.ts → _infra/validations.d.ts} +6 -7
- package/lib/commands/gen2-migration/_infra/validations.d.ts.map +1 -0
- package/lib/commands/gen2-migration/{_validations.js → _infra/validations.js} +24 -60
- package/lib/commands/gen2-migration/_infra/validations.js.map +1 -0
- package/lib/commands/gen2-migration/assess/analytics/kinesis.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/analytics/kinesis.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/analytics/kinesis.assessor.js +15 -0
- package/lib/commands/gen2-migration/assess/analytics/kinesis.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/api/data.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/api/data.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/api/data.assessor.js +25 -0
- package/lib/commands/gen2-migration/assess/api/data.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/api/rest-api.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/api/rest-api.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/api/rest-api.assessor.js +25 -0
- package/lib/commands/gen2-migration/assess/api/rest-api.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/assessment.d.ts +42 -0
- package/lib/commands/gen2-migration/assess/assessment.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/assessment.js +118 -0
- package/lib/commands/gen2-migration/assess/assessment.js.map +1 -0
- package/lib/commands/gen2-migration/assess/assessor.d.ts +5 -0
- package/lib/commands/gen2-migration/assess/assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/{generate/types.js → assess/assessor.js} +1 -1
- package/lib/commands/gen2-migration/assess/assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/auth/auth-cognito.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/auth/auth-cognito.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/auth/auth-cognito.assessor.js +30 -0
- package/lib/commands/gen2-migration/assess/auth/auth-cognito.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/auth/auth-user-pool-groups.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/auth/auth-user-pool-groups.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/auth/auth-user-pool-groups.assessor.js +24 -0
- package/lib/commands/gen2-migration/assess/auth/auth-user-pool-groups.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/function/function.assessor.d.ts +12 -0
- package/lib/commands/gen2-migration/assess/function/function.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/function/function.assessor.js +40 -0
- package/lib/commands/gen2-migration/assess/function/function.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/geo/geo-geofence-collection.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/geo/geo-geofence-collection.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/geo/geo-geofence-collection.assessor.js +19 -0
- package/lib/commands/gen2-migration/assess/geo/geo-geofence-collection.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/geo/geo-map.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/geo/geo-map.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/geo/geo-map.assessor.js +15 -0
- package/lib/commands/gen2-migration/assess/geo/geo-map.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/geo/geo-place-index.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/geo/geo-place-index.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/geo/geo-place-index.assessor.js +15 -0
- package/lib/commands/gen2-migration/assess/geo/geo-place-index.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/storage/dynamodb.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/storage/dynamodb.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/storage/dynamodb.assessor.js +25 -0
- package/lib/commands/gen2-migration/assess/storage/dynamodb.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess/storage/s3.assessor.d.ts +10 -0
- package/lib/commands/gen2-migration/assess/storage/s3.assessor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess/storage/s3.assessor.js +25 -0
- package/lib/commands/gen2-migration/assess/storage/s3.assessor.js.map +1 -0
- package/lib/commands/gen2-migration/assess.d.ts +9 -0
- package/lib/commands/gen2-migration/assess.d.ts.map +1 -0
- package/lib/commands/gen2-migration/assess.js +80 -0
- package/lib/commands/gen2-migration/assess.js.map +1 -0
- package/lib/commands/gen2-migration/decommission.d.ts +6 -5
- package/lib/commands/gen2-migration/decommission.d.ts.map +1 -1
- package/lib/commands/gen2-migration/decommission.js +82 -25
- package/lib/commands/gen2-migration/decommission.js.map +1 -1
- package/lib/commands/gen2-migration/generate/_infra/aws-fetcher.d.ts +32 -0
- package/lib/commands/gen2-migration/generate/_infra/aws-fetcher.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/_infra/aws-fetcher.js +136 -0
- package/lib/commands/gen2-migration/generate/_infra/aws-fetcher.js.map +1 -0
- package/lib/commands/gen2-migration/generate/_infra/files.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/_infra/files.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/{codegen-head/directory_exists.js → _infra/files.js} +4 -5
- package/lib/commands/gen2-migration/generate/_infra/files.js.map +1 -0
- package/lib/commands/gen2-migration/generate/_infra/gen1-app.d.ts +40 -0
- package/lib/commands/gen2-migration/generate/_infra/gen1-app.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/_infra/gen1-app.js +198 -0
- package/lib/commands/gen2-migration/generate/_infra/gen1-app.js.map +1 -0
- package/lib/commands/gen2-migration/generate/_infra/ts.d.ts +24 -0
- package/lib/commands/gen2-migration/generate/_infra/ts.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/_infra/ts.js +128 -0
- package/lib/commands/gen2-migration/generate/_infra/ts.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/cfn-condition-resolver.d.ts +18 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/cfn-condition-resolver.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/cfn-condition-resolver.js +126 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/cfn-condition-resolver.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis-cfn-converter.d.ts +33 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis-cfn-converter.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/{unsupported/cdk-from-cfn.js → amplify/analytics/kinesis-cfn-converter.js} +94 -52
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis-cfn-converter.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis.generator.d.ts +14 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis.generator.js +69 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis.renderer.d.ts +18 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis.renderer.js +68 -0
- package/lib/commands/gen2-migration/generate/amplify/analytics/kinesis.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/auth.generator.d.ts +24 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/auth.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/auth.generator.js +233 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/auth.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/auth.renderer.d.ts +78 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/auth.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/auth.renderer.js +491 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/auth.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/reference-auth.generator.d.ts +15 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/reference-auth.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/reference-auth.generator.js +75 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/reference-auth.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/reference-auth.renderer.d.ts +13 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/reference-auth.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/reference-auth.renderer.js +33 -0
- package/lib/commands/gen2-migration/generate/amplify/auth/reference-auth.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/backend.generator.d.ts +22 -0
- package/lib/commands/gen2-migration/generate/amplify/backend.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/backend.generator.js +150 -0
- package/lib/commands/gen2-migration/generate/amplify/backend.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/{custom-resources/transformer → amplify/custom-resources}/amplify-helper-transformer.d.ts +4 -0
- package/lib/commands/gen2-migration/generate/amplify/custom-resources/amplify-helper-transformer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/custom-resources/amplify-helper-transformer.js +333 -0
- package/lib/commands/gen2-migration/generate/amplify/custom-resources/amplify-helper-transformer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/custom-resources/custom.generator.d.ts +17 -0
- package/lib/commands/gen2-migration/generate/amplify/custom-resources/custom.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/custom-resources/custom.generator.js +190 -0
- package/lib/commands/gen2-migration/generate/amplify/custom-resources/custom.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/data/data.generator.d.ts +15 -0
- package/lib/commands/gen2-migration/generate/amplify/data/data.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/data/data.generator.js +112 -0
- package/lib/commands/gen2-migration/generate/amplify/data/data.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/data/data.renderer.d.ts +22 -0
- package/lib/commands/gen2-migration/generate/amplify/data/data.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/data/data.renderer.js +167 -0
- package/lib/commands/gen2-migration/generate/amplify/data/data.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/function/function.generator.d.ts +49 -0
- package/lib/commands/gen2-migration/generate/amplify/function/function.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/function/function.generator.js +626 -0
- package/lib/commands/gen2-migration/generate/amplify/function/function.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/function/function.renderer.d.ts +21 -0
- package/lib/commands/gen2-migration/generate/amplify/function/function.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/function/function.renderer.js +105 -0
- package/lib/commands/gen2-migration/generate/amplify/function/function.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo-cfn-converter.d.ts +49 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo-cfn-converter.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo-cfn-converter.js +239 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo-cfn-converter.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo.generator.d.ts +14 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo.generator.js +70 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo.renderer.d.ts +13 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo.renderer.js +161 -0
- package/lib/commands/gen2-migration/generate/amplify/geo/geo.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/package.json.generator.d.ts +8 -0
- package/lib/commands/gen2-migration/generate/amplify/package.json.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/package.json.generator.js +28 -0
- package/lib/commands/gen2-migration/generate/amplify/package.json.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/rest-api/rest-api.generator.d.ts +15 -0
- package/lib/commands/gen2-migration/generate/amplify/rest-api/rest-api.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/rest-api/rest-api.generator.js +162 -0
- package/lib/commands/gen2-migration/generate/amplify/rest-api/rest-api.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/rest-api/rest-api.renderer.d.ts +51 -0
- package/lib/commands/gen2-migration/generate/amplify/rest-api/rest-api.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/rest-api/rest-api.renderer.js +269 -0
- package/lib/commands/gen2-migration/generate/amplify/rest-api/rest-api.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/dynamodb.generator.d.ts +14 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/dynamodb.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/dynamodb.generator.js +96 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/dynamodb.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/dynamodb.renderer.d.ts +30 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/dynamodb.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/dynamodb.renderer.js +90 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/dynamodb.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/s3.generator.d.ts +22 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/s3.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/s3.generator.js +132 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/s3.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/s3.renderer.d.ts +31 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/s3.renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/s3.renderer.js +137 -0
- package/lib/commands/gen2-migration/generate/amplify/storage/s3.renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/tsconfig.generator.d.ts +8 -0
- package/lib/commands/gen2-migration/generate/amplify/tsconfig.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify/tsconfig.generator.js +45 -0
- package/lib/commands/gen2-migration/generate/amplify/tsconfig.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify.yml.generator.d.ts +9 -0
- package/lib/commands/gen2-migration/generate/amplify.yml.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/amplify.yml.generator.js +112 -0
- package/lib/commands/gen2-migration/generate/amplify.yml.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/gitignore.generator.d.ts +6 -0
- package/lib/commands/gen2-migration/generate/gitignore.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/gitignore.generator.js +45 -0
- package/lib/commands/gen2-migration/generate/gitignore.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/package.json.generator.d.ts +12 -0
- package/lib/commands/gen2-migration/generate/package.json.generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/package.json.generator.js +83 -0
- package/lib/commands/gen2-migration/generate/package.json.generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate.d.ts +6 -5
- package/lib/commands/gen2-migration/generate.d.ts.map +1 -1
- package/lib/commands/gen2-migration/generate.js +232 -17
- package/lib/commands/gen2-migration/generate.js.map +1 -1
- package/lib/commands/gen2-migration/lock.d.ts +10 -6
- package/lib/commands/gen2-migration/lock.d.ts.map +1 -1
- package/lib/commands/gen2-migration/lock.js +182 -64
- package/lib/commands/gen2-migration/lock.js.map +1 -1
- package/lib/commands/gen2-migration/refactor/analytics/analytics-forward.d.ts +9 -0
- package/lib/commands/gen2-migration/refactor/analytics/analytics-forward.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/analytics/analytics-forward.js +19 -0
- package/lib/commands/gen2-migration/refactor/analytics/analytics-forward.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/analytics/analytics-rollback.d.ts +9 -0
- package/lib/commands/gen2-migration/refactor/analytics/analytics-rollback.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/analytics/analytics-rollback.js +26 -0
- package/lib/commands/gen2-migration/refactor/analytics/analytics-rollback.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-cognito-forward.d.ts +21 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-cognito-forward.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-cognito-forward.js +87 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-cognito-forward.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-cognito-rollback.d.ts +9 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-cognito-rollback.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-cognito-rollback.js +44 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-cognito-rollback.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-user-pool-groups-forward.d.ts +11 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-user-pool-groups-forward.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-user-pool-groups-forward.js +33 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-user-pool-groups-forward.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-user-pool-groups-rollback.d.ts +9 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-user-pool-groups-rollback.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-user-pool-groups-rollback.js +26 -0
- package/lib/commands/gen2-migration/refactor/auth/auth-user-pool-groups-rollback.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/cfn.d.ts +41 -0
- package/lib/commands/gen2-migration/refactor/cfn.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/cfn.js +337 -0
- package/lib/commands/gen2-migration/refactor/cfn.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/index.d.ts +1 -1
- package/lib/commands/gen2-migration/refactor/index.d.ts.map +1 -1
- package/lib/commands/gen2-migration/refactor/index.js +1 -1
- package/lib/commands/gen2-migration/refactor/index.js.map +1 -1
- package/lib/commands/gen2-migration/refactor/oauth-values-retriever.d.ts +23 -11
- package/lib/commands/gen2-migration/refactor/oauth-values-retriever.d.ts.map +1 -1
- package/lib/commands/gen2-migration/refactor/oauth-values-retriever.js +53 -45
- package/lib/commands/gen2-migration/refactor/oauth-values-retriever.js.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-condition-resolver.d.ts +2 -11
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-condition-resolver.d.ts.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-condition-resolver.js +89 -123
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-condition-resolver.js.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-dependency-resolver.d.ts +2 -7
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-dependency-resolver.d.ts.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-dependency-resolver.js +6 -22
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-dependency-resolver.js.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-output-resolver.d.ts +8 -12
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-output-resolver.d.ts.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-output-resolver.js +105 -127
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-output-resolver.js.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-parameter-resolver.d.ts +2 -8
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-parameter-resolver.d.ts.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-parameter-resolver.js +36 -41
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-parameter-resolver.js.map +1 -1
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-tree-walker.d.ts +3 -0
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-tree-walker.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-tree-walker.js +18 -0
- package/lib/commands/gen2-migration/refactor/resolvers/cfn-tree-walker.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/stack-facade.d.ts +13 -0
- package/lib/commands/gen2-migration/refactor/stack-facade.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/stack-facade.js +39 -0
- package/lib/commands/gen2-migration/refactor/stack-facade.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-dynamo-forward.d.ts +8 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-dynamo-forward.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-dynamo-forward.js +18 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-dynamo-forward.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-dynamo-rollback.d.ts +9 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-dynamo-rollback.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-dynamo-rollback.js +26 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-dynamo-rollback.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-forward.d.ts +10 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-forward.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-forward.js +36 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-forward.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-rollback.d.ts +9 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-rollback.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-rollback.js +26 -0
- package/lib/commands/gen2-migration/refactor/storage/storage-rollback.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/utils.d.ts +1 -1
- package/lib/commands/gen2-migration/refactor/utils.d.ts.map +1 -1
- package/lib/commands/gen2-migration/refactor/utils.js +2 -2
- package/lib/commands/gen2-migration/refactor/utils.js.map +1 -1
- package/lib/commands/gen2-migration/refactor/workflow/category-refactorer.d.ts +52 -0
- package/lib/commands/gen2-migration/refactor/workflow/category-refactorer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/workflow/category-refactorer.js +212 -0
- package/lib/commands/gen2-migration/refactor/workflow/category-refactorer.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/workflow/forward-category-refactorer.d.ts +15 -0
- package/lib/commands/gen2-migration/refactor/workflow/forward-category-refactorer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/workflow/forward-category-refactorer.js +148 -0
- package/lib/commands/gen2-migration/refactor/workflow/forward-category-refactorer.js.map +1 -0
- package/lib/commands/gen2-migration/refactor/workflow/rollback-category-refactorer.d.ts +13 -0
- package/lib/commands/gen2-migration/refactor/workflow/rollback-category-refactorer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor/workflow/rollback-category-refactorer.js +123 -0
- package/lib/commands/gen2-migration/refactor/workflow/rollback-category-refactorer.js.map +1 -0
- package/lib/commands/gen2-migration/refactor.d.ts +11 -0
- package/lib/commands/gen2-migration/refactor.d.ts.map +1 -0
- package/lib/commands/gen2-migration/refactor.js +189 -0
- package/lib/commands/gen2-migration/refactor.js.map +1 -0
- package/lib/commands/gen2-migration.d.ts +0 -12
- package/lib/commands/gen2-migration.d.ts.map +1 -1
- package/lib/commands/gen2-migration.js +82 -111
- package/lib/commands/gen2-migration.js.map +1 -1
- package/package.json +22 -12
- package/aws-amplify-cli-internal-gen2-migration-experimental-alpha-0.5.0.tgz +0 -0
- package/lib/commands/drift-detection/services/file-service.d.ts +0 -7
- package/lib/commands/drift-detection/services/file-service.d.ts.map +0 -1
- package/lib/commands/drift-detection/services/file-service.js +0 -53
- package/lib/commands/drift-detection/services/file-service.js.map +0 -1
- package/lib/commands/gen2-migration/_step.d.ts +0 -17
- package/lib/commands/gen2-migration/_step.d.ts.map +0 -1
- package/lib/commands/gen2-migration/_step.js +0 -16
- package/lib/commands/gen2-migration/_step.js.map +0 -1
- package/lib/commands/gen2-migration/_validations.d.ts.map +0 -1
- package/lib/commands/gen2-migration/_validations.js.map +0 -1
- package/lib/commands/gen2-migration/cleanup.d.ts +0 -8
- package/lib/commands/gen2-migration/cleanup.d.ts.map +0 -1
- package/lib/commands/gen2-migration/cleanup.js +0 -21
- package/lib/commands/gen2-migration/cleanup.js.map +0 -1
- package/lib/commands/gen2-migration/clone.d.ts +0 -8
- package/lib/commands/gen2-migration/clone.d.ts.map +0 -1
- package/lib/commands/gen2-migration/clone.js +0 -21
- package/lib/commands/gen2-migration/clone.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/auth/index.d.ts +0 -24
- package/lib/commands/gen2-migration/generate/adapters/auth/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/auth/index.js +0 -297
- package/lib/commands/gen2-migration/generate/adapters/auth/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/auth/index.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/adapters/auth/index.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/auth/index.test.js +0 -140
- package/lib/commands/gen2-migration/generate/adapters/auth/index.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/data/index.d.ts +0 -5
- package/lib/commands/gen2-migration/generate/adapters/data/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/data/index.js +0 -17
- package/lib/commands/gen2-migration/generate/adapters/data/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/functions/api-trigger-detector.d.ts +0 -10
- package/lib/commands/gen2-migration/generate/adapters/functions/api-trigger-detector.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/functions/api-trigger-detector.js +0 -43
- package/lib/commands/gen2-migration/generate/adapters/functions/api-trigger-detector.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/functions/api-trigger-detector.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/adapters/functions/api-trigger-detector.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/functions/api-trigger-detector.test.js +0 -34
- package/lib/commands/gen2-migration/generate/adapters/functions/api-trigger-detector.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/functions/index.d.ts +0 -18
- package/lib/commands/gen2-migration/generate/adapters/functions/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/functions/index.js +0 -85
- package/lib/commands/gen2-migration/generate/adapters/functions/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/project/index.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/adapters/project/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/project/index.js +0 -7
- package/lib/commands/gen2-migration/generate/adapters/project/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.d.ts +0 -31
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.js +0 -34
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.test.js +0 -181
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/index.d.ts +0 -3
- package/lib/commands/gen2-migration/generate/adapters/storage/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/index.js +0 -10
- package/lib/commands/gen2-migration/generate/adapters/storage/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.d.ts +0 -25
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.js +0 -76
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.js.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.test.js +0 -125
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/backend/synthesizer.d.ts +0 -91
- package/lib/commands/gen2-migration/generate/backend/synthesizer.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/backend/synthesizer.js +0 -1014
- package/lib/commands/gen2-migration/generate/backend/synthesizer.js.map +0 -1
- package/lib/commands/gen2-migration/generate/backend/synthesizer.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/backend/synthesizer.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/backend/synthesizer.test.js +0 -777
- package/lib/commands/gen2-migration/generate/backend/synthesizer.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/amplify_stack_parser.d.ts +0 -14
- package/lib/commands/gen2-migration/generate/codegen-head/amplify_stack_parser.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/amplify_stack_parser.js +0 -82
- package/lib/commands/gen2-migration/generate/codegen-head/amplify_stack_parser.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/analytics.d.ts +0 -10
- package/lib/commands/gen2-migration/generate/codegen-head/analytics.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/analytics.js +0 -11
- package/lib/commands/gen2-migration/generate/codegen-head/analytics.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/api-cfn-access.d.ts +0 -7
- package/lib/commands/gen2-migration/generate/codegen-head/api-cfn-access.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/api-cfn-access.js +0 -80
- package/lib/commands/gen2-migration/generate/codegen-head/api-cfn-access.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/app_analytics_definition_fetcher.d.ts +0 -13
- package/lib/commands/gen2-migration/generate/codegen-head/app_analytics_definition_fetcher.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/app_analytics_definition_fetcher.js +0 -59
- package/lib/commands/gen2-migration/generate/codegen-head/app_analytics_definition_fetcher.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/app_auth_definition_fetcher.d.ts +0 -24
- package/lib/commands/gen2-migration/generate/codegen-head/app_auth_definition_fetcher.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/app_auth_definition_fetcher.js +0 -167
- package/lib/commands/gen2-migration/generate/codegen-head/app_auth_definition_fetcher.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/app_functions_definition_fetcher.d.ts +0 -21
- package/lib/commands/gen2-migration/generate/codegen-head/app_functions_definition_fetcher.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/app_functions_definition_fetcher.js +0 -135
- package/lib/commands/gen2-migration/generate/codegen-head/app_functions_definition_fetcher.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/app_storage_definition_fetcher.d.ts +0 -23
- package/lib/commands/gen2-migration/generate/codegen-head/app_storage_definition_fetcher.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/app_storage_definition_fetcher.js +0 -181
- package/lib/commands/gen2-migration/generate/codegen-head/app_storage_definition_fetcher.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/auth_access_analyzer.d.ts +0 -12
- package/lib/commands/gen2-migration/generate/codegen-head/auth_access_analyzer.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/auth_access_analyzer.js +0 -157
- package/lib/commands/gen2-migration/generate/codegen-head/auth_access_analyzer.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/backend_downloader.d.ts +0 -10
- package/lib/commands/gen2-migration/generate/codegen-head/backend_downloader.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/backend_downloader.js +0 -48
- package/lib/commands/gen2-migration/generate/codegen-head/backend_downloader.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/backend_environment_selector.d.ts +0 -11
- package/lib/commands/gen2-migration/generate/codegen-head/backend_environment_selector.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/backend_environment_selector.js +0 -38
- package/lib/commands/gen2-migration/generate/codegen-head/backend_environment_selector.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/command-handlers.d.ts +0 -13
- package/lib/commands/gen2-migration/generate/codegen-head/command-handlers.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/command-handlers.js +0 -498
- package/lib/commands/gen2-migration/generate/codegen-head/command-handlers.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/data_definition_fetcher.d.ts +0 -47
- package/lib/commands/gen2-migration/generate/codegen-head/data_definition_fetcher.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/data_definition_fetcher.js +0 -222
- package/lib/commands/gen2-migration/generate/codegen-head/data_definition_fetcher.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/data_model_access_parser.d.ts +0 -10
- package/lib/commands/gen2-migration/generate/codegen-head/data_model_access_parser.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/data_model_access_parser.js +0 -59
- package/lib/commands/gen2-migration/generate/codegen-head/data_model_access_parser.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/data_model_access_parser.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/codegen-head/data_model_access_parser.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/data_model_access_parser.test.js +0 -90
- package/lib/commands/gen2-migration/generate/codegen-head/data_model_access_parser.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/directory_exists.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/codegen-head/directory_exists.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/directory_exists.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/dynamodb_cfn_access_parser.d.ts +0 -14
- package/lib/commands/gen2-migration/generate/codegen-head/dynamodb_cfn_access_parser.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/dynamodb_cfn_access_parser.js +0 -100
- package/lib/commands/gen2-migration/generate/codegen-head/dynamodb_cfn_access_parser.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/dynamodb_cfn_access_parser.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/codegen-head/dynamodb_cfn_access_parser.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/dynamodb_cfn_access_parser.test.js +0 -69
- package/lib/commands/gen2-migration/generate/codegen-head/dynamodb_cfn_access_parser.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/format.d.ts +0 -8
- package/lib/commands/gen2-migration/generate/codegen-head/format.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/format.js +0 -66
- package/lib/commands/gen2-migration/generate/codegen-head/format.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/logger.d.ts +0 -15
- package/lib/commands/gen2-migration/generate/codegen-head/logger.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/logger.js +0 -14
- package/lib/commands/gen2-migration/generate/codegen-head/logger.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/printer.d.ts +0 -26
- package/lib/commands/gen2-migration/generate/codegen-head/printer.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/printer.js +0 -103
- package/lib/commands/gen2-migration/generate/codegen-head/printer.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/s3_cfn_access_parser.d.ts +0 -13
- package/lib/commands/gen2-migration/generate/codegen-head/s3_cfn_access_parser.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/s3_cfn_access_parser.js +0 -66
- package/lib/commands/gen2-migration/generate/codegen-head/s3_cfn_access_parser.js.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/s3_cfn_access_parser.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/codegen-head/s3_cfn_access_parser.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/codegen-head/s3_cfn_access_parser.test.js +0 -97
- package/lib/commands/gen2-migration/generate/codegen-head/s3_cfn_access_parser.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/core/migration-pipeline.d.ts +0 -26
- package/lib/commands/gen2-migration/generate/core/migration-pipeline.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/core/migration-pipeline.js +0 -269
- package/lib/commands/gen2-migration/generate/core/migration-pipeline.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/generator/backend-updater.d.ts +0 -7
- package/lib/commands/gen2-migration/generate/custom-resources/generator/backend-updater.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/generator/backend-updater.js +0 -84
- package/lib/commands/gen2-migration/generate/custom-resources/generator/backend-updater.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/generator/dependency-merger.d.ts +0 -8
- package/lib/commands/gen2-migration/generate/custom-resources/generator/dependency-merger.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/generator/dependency-merger.js +0 -105
- package/lib/commands/gen2-migration/generate/custom-resources/generator/dependency-merger.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/generator/file-converter.d.ts +0 -5
- package/lib/commands/gen2-migration/generate/custom-resources/generator/file-converter.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/generator/file-converter.js +0 -88
- package/lib/commands/gen2-migration/generate/custom-resources/generator/file-converter.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/generator/gen2-file-generator.d.ts +0 -8
- package/lib/commands/gen2-migration/generate/custom-resources/generator/gen2-file-generator.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/generator/gen2-file-generator.js +0 -36
- package/lib/commands/gen2-migration/generate/custom-resources/generator/gen2-file-generator.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/parser/cdk-stack-parser.d.ts +0 -5
- package/lib/commands/gen2-migration/generate/custom-resources/parser/cdk-stack-parser.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/parser/cdk-stack-parser.js +0 -81
- package/lib/commands/gen2-migration/generate/custom-resources/parser/cdk-stack-parser.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/parser/pattern-detector.d.ts +0 -15
- package/lib/commands/gen2-migration/generate/custom-resources/parser/pattern-detector.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/parser/pattern-detector.js +0 -35
- package/lib/commands/gen2-migration/generate/custom-resources/parser/pattern-detector.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/scanner/custom-resource-scanner.d.ts +0 -5
- package/lib/commands/gen2-migration/generate/custom-resources/scanner/custom-resource-scanner.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/scanner/custom-resource-scanner.js +0 -66
- package/lib/commands/gen2-migration/generate/custom-resources/scanner/custom-resource-scanner.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/transformer/amplify-helper-transformer.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/transformer/amplify-helper-transformer.js +0 -178
- package/lib/commands/gen2-migration/generate/custom-resources/transformer/amplify-helper-transformer.js.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/types.d.ts +0 -38
- package/lib/commands/gen2-migration/generate/custom-resources/types.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/custom-resources/types.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/analytics/index.d.ts +0 -9
- package/lib/commands/gen2-migration/generate/generators/analytics/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/analytics/index.js +0 -40
- package/lib/commands/gen2-migration/generate/generators/analytics/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/auth/index.d.ts +0 -107
- package/lib/commands/gen2-migration/generate/generators/auth/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/auth/index.js +0 -313
- package/lib/commands/gen2-migration/generate/generators/auth/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/auth/index.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/generators/auth/index.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/auth/index.test.js +0 -566
- package/lib/commands/gen2-migration/generate/generators/auth/index.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/data/index.d.ts +0 -35
- package/lib/commands/gen2-migration/generate/generators/data/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/data/index.js +0 -185
- package/lib/commands/gen2-migration/generate/generators/data/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/data/index.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/generators/data/index.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/data/index.test.js +0 -47
- package/lib/commands/gen2-migration/generate/generators/data/index.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/functions/index.d.ts +0 -53
- package/lib/commands/gen2-migration/generate/generators/functions/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/functions/index.js +0 -125
- package/lib/commands/gen2-migration/generate/generators/functions/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/functions/lambda.d.ts +0 -6
- package/lib/commands/gen2-migration/generate/generators/functions/lambda.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/functions/lambda.js +0 -16
- package/lib/commands/gen2-migration/generate/generators/functions/lambda.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.d.ts +0 -3
- package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.js +0 -106
- package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.test.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.test.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.test.js +0 -120
- package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.test.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/storage/access.d.ts +0 -4
- package/lib/commands/gen2-migration/generate/generators/storage/access.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/storage/access.js +0 -73
- package/lib/commands/gen2-migration/generate/generators/storage/access.js.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/storage/index.d.ts +0 -37
- package/lib/commands/gen2-migration/generate/generators/storage/index.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/generators/storage/index.js +0 -78
- package/lib/commands/gen2-migration/generate/generators/storage/index.js.map +0 -1
- package/lib/commands/gen2-migration/generate/npm_package/renderer.d.ts +0 -27
- package/lib/commands/gen2-migration/generate/npm_package/renderer.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/npm_package/renderer.js +0 -28
- package/lib/commands/gen2-migration/generate/npm_package/renderer.js.map +0 -1
- package/lib/commands/gen2-migration/generate/render_pipeline.d.ts +0 -9
- package/lib/commands/gen2-migration/generate/render_pipeline.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/render_pipeline.js +0 -15
- package/lib/commands/gen2-migration/generate/render_pipeline.js.map +0 -1
- package/lib/commands/gen2-migration/generate/renderers/ensure_directory.d.ts +0 -7
- package/lib/commands/gen2-migration/generate/renderers/ensure_directory.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/renderers/ensure_directory.js +0 -17
- package/lib/commands/gen2-migration/generate/renderers/ensure_directory.js.map +0 -1
- package/lib/commands/gen2-migration/generate/renderers/package_json.d.ts +0 -8
- package/lib/commands/gen2-migration/generate/renderers/package_json.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/renderers/package_json.js +0 -15
- package/lib/commands/gen2-migration/generate/renderers/package_json.js.map +0 -1
- package/lib/commands/gen2-migration/generate/renderers/typescript_block_node.d.ts +0 -11
- package/lib/commands/gen2-migration/generate/renderers/typescript_block_node.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/renderers/typescript_block_node.js +0 -22
- package/lib/commands/gen2-migration/generate/renderers/typescript_block_node.js.map +0 -1
- package/lib/commands/gen2-migration/generate/resource/resource.d.ts +0 -20
- package/lib/commands/gen2-migration/generate/resource/resource.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/resource/resource.js +0 -60
- package/lib/commands/gen2-migration/generate/resource/resource.js.map +0 -1
- package/lib/commands/gen2-migration/generate/test_utils/import_regex.d.ts +0 -2
- package/lib/commands/gen2-migration/generate/test_utils/import_regex.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/test_utils/import_regex.js +0 -6
- package/lib/commands/gen2-migration/generate/test_utils/import_regex.js.map +0 -1
- package/lib/commands/gen2-migration/generate/test_utils/ts_node_printer.d.ts +0 -4
- package/lib/commands/gen2-migration/generate/test_utils/ts_node_printer.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/test_utils/ts_node_printer.js +0 -22
- package/lib/commands/gen2-migration/generate/test_utils/ts_node_printer.js.map +0 -1
- package/lib/commands/gen2-migration/generate/todo_error.d.ts +0 -3
- package/lib/commands/gen2-migration/generate/todo_error.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/todo_error.js +0 -11
- package/lib/commands/gen2-migration/generate/todo_error.js.map +0 -1
- package/lib/commands/gen2-migration/generate/ts_factory_utils.d.ts +0 -3
- package/lib/commands/gen2-migration/generate/ts_factory_utils.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/ts_factory_utils.js +0 -10
- package/lib/commands/gen2-migration/generate/ts_factory_utils.js.map +0 -1
- package/lib/commands/gen2-migration/generate/types.d.ts +0 -4
- package/lib/commands/gen2-migration/generate/types.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/types.js.map +0 -1
- package/lib/commands/gen2-migration/generate/unsupported/cdk-from-cfn.d.ts +0 -26
- package/lib/commands/gen2-migration/generate/unsupported/cdk-from-cfn.d.ts.map +0 -1
- package/lib/commands/gen2-migration/generate/unsupported/cdk-from-cfn.js.map +0 -1
- package/lib/commands/gen2-migration/refactor/cfn-stack-refactor-updater.d.ts +0 -5
- package/lib/commands/gen2-migration/refactor/cfn-stack-refactor-updater.d.ts.map +0 -1
- package/lib/commands/gen2-migration/refactor/cfn-stack-refactor-updater.js +0 -76
- package/lib/commands/gen2-migration/refactor/cfn-stack-refactor-updater.js.map +0 -1
- package/lib/commands/gen2-migration/refactor/cfn-stack-updater.d.ts +0 -6
- package/lib/commands/gen2-migration/refactor/cfn-stack-updater.d.ts.map +0 -1
- package/lib/commands/gen2-migration/refactor/cfn-stack-updater.js +0 -52
- package/lib/commands/gen2-migration/refactor/cfn-stack-updater.js.map +0 -1
- package/lib/commands/gen2-migration/refactor/generators/category-template-generator.d.ts +0 -40
- package/lib/commands/gen2-migration/refactor/generators/category-template-generator.d.ts.map +0 -1
- package/lib/commands/gen2-migration/refactor/generators/category-template-generator.js +0 -321
- package/lib/commands/gen2-migration/refactor/generators/category-template-generator.js.map +0 -1
- package/lib/commands/gen2-migration/refactor/generators/template-generator.d.ts +0 -48
- package/lib/commands/gen2-migration/refactor/generators/template-generator.d.ts.map +0 -1
- package/lib/commands/gen2-migration/refactor/generators/template-generator.js +0 -513
- package/lib/commands/gen2-migration/refactor/generators/template-generator.js.map +0 -1
- package/lib/commands/gen2-migration/refactor/refactor.d.ts +0 -19
- package/lib/commands/gen2-migration/refactor/refactor.d.ts.map +0 -1
- package/lib/commands/gen2-migration/refactor/refactor.js +0 -241
- package/lib/commands/gen2-migration/refactor/refactor.js.map +0 -1
- package/lib/commands/gen2-migration/refactor/types.d.ts +0 -128
- package/lib/commands/gen2-migration/refactor/types.d.ts.map +0 -1
- package/lib/commands/gen2-migration/refactor/types.js +0 -59
- package/lib/commands/gen2-migration/refactor/types.js.map +0 -1
- package/lib/commands/gen2-migration/shift.d.ts +0 -8
- package/lib/commands/gen2-migration/shift.d.ts.map +0 -1
- package/lib/commands/gen2-migration/shift.js +0 -21
- package/lib/commands/gen2-migration/shift.js.map +0 -1
- package/lib/commands/gen2-migration/stateful-resources.d.ts.map +0 -1
- package/lib/commands/gen2-migration/stateful-resources.js.map +0 -1
- /package/lib/commands/gen2-migration/{stateful-resources.d.ts → _infra/stateful-resources.d.ts} +0 -0
- /package/lib/commands/gen2-migration/{stateful-resources.js → _infra/stateful-resources.js} +0 -0
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
# Refactor Command — Guideline Violations
|
|
2
|
+
|
|
3
|
+
This document maps issues in `packages/amplify-cli/src/commands/gen2-migration/refactor`
|
|
4
|
+
to the guidelines in `CODING_GUIDELINES.md`.
|
|
5
|
+
|
|
6
|
+
## Architecture & Structure
|
|
7
|
+
|
|
8
|
+
### Point 1 — God modules
|
|
9
|
+
|
|
10
|
+
`TemplateGenerator` (~760 lines) is the primary offender. It discovers and maps category stacks between Gen1 and Gen2 (`parseCategoryStacks`), initializes category generators, orchestrates Gen1 and Gen2 stack pre-processing, manages the holding-stack lifecycle, executes CloudFormation stack refactors, generates rollback templates, builds rollback logical-ID mappings, and handles interactive assessment display. These are unrelated concerns in a single class.
|
|
11
|
+
|
|
12
|
+
`CategoryTemplateGenerator` (~530 lines) is the second offender. It reads and describes stacks, resolves Gen1 parameters/outputs/dependencies/conditions, resolves Gen2 outputs/dependencies, manages the holding-stack move-and-restore lifecycle, retrieves OAuth credentials from Cognito and SSM, builds Gen1-to-Gen2 logical-ID mappings, and generates the final refactor templates. Each of these is a distinct responsibility.
|
|
13
|
+
|
|
14
|
+
`AmplifyMigrationRefactorStep` in `refactor.ts` (~370 lines) mixes CLI parameter extraction, resource mapping file I/O and validation, interactive category assessment and selection UI, AWS client instantiation, template generator initialization (duplicated for forward and rollback), and usage analytics emission.
|
|
15
|
+
|
|
16
|
+
### Point 2 — Unjustified layer boundaries
|
|
17
|
+
|
|
18
|
+
`AmplifyMigrationRefactorStep` creates a `TemplateGenerator`, which creates `CategoryTemplateGenerator` instances, which in turn create resolver instances (`CfnParameterResolver`, `CfnOutputResolver`, `CfnDependencyResolver`, `CFNConditionResolver`). Each layer reads the same stack templates and stack descriptions independently. `TemplateGenerator.assessCategoryResources()` reads stack templates to count resources, then `generateCategoryTemplates()` reads the same templates again through `CategoryTemplateGenerator`. The `refactor.ts` file also independently calls `DescribeStacksCommand` in `assessCategoryResources` to check for OAuth, duplicating work that `CategoryTemplateGenerator.generateGen1PreProcessTemplate()` already does.
|
|
19
|
+
|
|
20
|
+
### Point 3 — File size and focus
|
|
21
|
+
|
|
22
|
+
`template-generator.ts` (759 lines) and `category-template-generator.ts` (~530 lines) are both large files mixing multiple concerns. `refactor.ts` (370 lines) mixes CLI concerns (parameter parsing, interactive prompts, file I/O) with orchestration logic. The resolver files are reasonably sized and focused.
|
|
23
|
+
|
|
24
|
+
### Point 4 — Naming
|
|
25
|
+
|
|
26
|
+
The `generators/` folder name is misleading. `TemplateGenerator` doesn't just generate templates — it orchestrates the entire multi-step CloudFormation refactor workflow including stack discovery, pre-processing, holding-stack management, refactoring, and rollback. `CategoryTemplateGenerator` similarly does far more than generate templates — it reads stacks, resolves references, manages holding stacks, retrieves OAuth secrets, and builds resource mappings. Neither class name reflects its actual scope.
|
|
27
|
+
|
|
28
|
+
The `resolvers/` folder is accurately named — each resolver has a clear, single responsibility.
|
|
29
|
+
|
|
30
|
+
### Point 5 — Scattered API calls
|
|
31
|
+
|
|
32
|
+
AWS SDK clients are instantiated in `initializeTemplateGenerator()` and `initializeTemplateGeneratorForRollback()` inside `refactor.ts`, then passed to `TemplateGenerator`, which passes them to `CategoryTemplateGenerator`. However, `refactor.ts` also makes its own direct `DescribeStacksCommand` call in `assessCategoryResources()` using `templateGenerator.cfnClient` — bypassing the generator's own methods. `CategoryTemplateGenerator` makes direct `cfnClient` calls in `readTemplate()`, `describeStack()`, `describeStackResources()`, and `moveGen2ResourcesToHoldingStack()`. `TemplateGenerator` also makes direct `cfnClient` calls in `getStackTemplate()`, `parseCate
|
|
33
|
+
alResourceId]` in `CategoryTemplateGenerator`, `resources[gen2ResourceLogicalId] = ...` in `addGen1ResourcesToGen2Stack`, and `resource.DependsOn = ...` in multiple places.
|
|
34
|
+
|
|
35
|
+
`TemplateGenerator` has mutable instance state: `_categoryStackMap` is reassigned via a setter in `generateSelectedCategories()` (swapped to a filtered version and then restored), and `categoryTemplateGenerators` is populated imperatively in `initializeCategoryGenerators()`.
|
|
36
|
+
|
|
37
|
+
`CategoryTemplateGenerator` has mutable public fields: `gen1ResourcesToMove`, `gen2ResourcesToRemove`, `gen2Template`, and `gen2StackParameters` are all assigned during method execution and read by the caller later. `gen1DescribeStacksResponse` and `gen2DescribeStacksResponse` are private mutable fields set as side effects of `generateGen1PreProcessTemplate()` and `generateGen2PreProcessTemplate()`.
|
|
38
|
+
|
|
39
|
+
`AmplifyMigrationRefactorStep` stores `toStack`, `resourceMappings`, and `parsedResourceMappings` as mutable optional instance fields that are populated by `extractParameters()` and `processResourceMappings()`, then read later by `executeStackRefactor()`.
|
|
40
|
+
|
|
41
|
+
### Point 7 — `let` over `const`
|
|
42
|
+
|
|
43
|
+
`generateCategoryTemplates()` in `template-generator.ts` declares six `let` variables as `undefined` at the top of the loop body (`newSourceTemplate`, `newDestinationTemplate`, `sourceStackParameters`, `sourceTemplateForRefactor`, `destinationTemplateForRefactor`, `logicalIdMappingForRefactor`), then assigns them inside three different branches (`customResourceMap`, `!isRollback`, `isRollback`). The reader must trace all three branches to know what state these variables hold after the branching. `hasOAuthEnabled` is declared as `let` but is only ever set to `true` inside one branch and never read afterward — it's both a `let` violation and dead code.
|
|
44
|
+
|
|
45
|
+
`parseCategoryStacks()` uses `let destinationPhysicalResourceId`, `let userPoolGroupDestinationPhysicalResourceId`, and `let isUserPoolGroupStack` assigned across multiple branches.
|
|
46
|
+
|
|
47
|
+
`resolveCondition()` in `cfn-condition-resolver.ts` declares `let resolvedLeftStatement` and `let resolvedRightStatement` as `undefined`, then assigns them across five separate conditional blocks.
|
|
48
|
+
|
|
49
|
+
## Interface Design
|
|
50
|
+
|
|
51
|
+
### Point 8 — Properties that don't belong
|
|
52
|
+
|
|
53
|
+
`CFNTemplate` includes `Description` and `AWSTemplateFormatVersion` as required properties, but several places construct `CFNTemplate` objects (e.g., the holding stack template in `moveGen2ResourcesToHoldingStack`) without a `Description` that matches the concept. More importantly, `CFNChangeTemplateWithParams` bundles `parameters` (stack parameters from `DescribeStacks`) with `oldTemplate`/`newTemplate` — the parameters are a property of the stack, not of the template change.
|
|
54
|
+
|
|
55
|
+
### Point 9 — Excessive optionality
|
|
56
|
+
|
|
57
|
+
`CFNTemplate` has `Conditions`, `Parameters`, and `Outputs` as optional, but downstream code universally asserts their existence (e.g., `assert(Parameters)`, `assert(Outputs)`) rather than handling the optionality at the boundary. The optionality propagates through the entire pipeline — every consumer must re-check.
|
|
58
|
+
|
|
59
|
+
`AmplifyMigrationRefactorStep` has `toStack?`, `resourceMappings?`, and `parsedResourceMappings?` as optional instance fields. `toStack` is validated in `extractParameters()` but remains typed as optional, forcing a non-null assertion (`this.toStack!`) at every subsequent use site.
|
|
60
|
+
|
|
61
|
+
### Point 10 — Same information twice
|
|
62
|
+
|
|
63
|
+
`TemplateGenerator` stores `_cfnClient` as a private field and exposes it via a public getter `cfnClient`. `refactor.ts` then uses `templateGenerator.cfnClient` directly to make its own `DescribeStacksCommand` calls in `assessCategoryResources()`, duplicating the stack-reading capability that `TemplateGenerator.getStackTemplate()` already provides.
|
|
64
|
+
|
|
65
|
+
The `ResourceMapping` interface is defined identically in both `types.ts` and as a local interface in `refactor.ts` (lines 18-27). The same shape exists in two places.
|
|
66
|
+
|
|
67
|
+
### Point 11 — Dead inputs
|
|
68
|
+
|
|
69
|
+
`hasOAuthEnabled` in `generateCategoryTemplates()` is set to `true` when OAuth is detected but is never read or returned — it's a dead variable. The `generate()` method on `TemplateGenerator` has a TODO comment saying "this function never gets used" — it's dead code that should be removed.
|
|
70
|
+
|
|
71
|
+
`AmplifyMigrationRefactorStep.assessAndSelectCategories()` contains dead code: `selectionChoice` is hardcoded to `'Migrate all categories'` and the `if` check always passes, making the entire individual-category-selection loop below it unreachable.
|
|
72
|
+
|
|
73
|
+
### Point 13 — Catch-all types file
|
|
74
|
+
|
|
75
|
+
`types.ts` contains 17 interfaces, enums, and type aliases covering CFN templates, resource types, OAuth clients, stack refactor status, pseudo parameters, and resource mappings. These represent at least four unrelated domains (CFN template structure, resource type enums, OAuth types, refactor status types) bundled into a single file. Every file in the module imports from it, creating artificial coupling.
|
|
76
|
+
|
|
77
|
+
### Point 14 — `type X = SomeEnum | string`
|
|
78
|
+
|
|
79
|
+
`CATEGORY` is defined as `NON_CUSTOM_RESOURCE_CATEGORY.AUTH | NON_CUSTOM_RESOURCE_CATEGORY.STORAGE | ... | string`. The `| string` escape hatch defeats the purpose of the enum — any string is valid, and the named members add no type safety. Similarly, `CFN_CATEGORY_TYPE` is `CFN_AUTH_TYPE | CFN_S3_TYPE | CFN_ANALYTICS_TYPE | CFN_IAM_TYPE | string`.
|
|
80
|
+
|
|
81
|
+
## Error Handling
|
|
82
|
+
|
|
83
|
+
### Point 16 — Fallbacks for invalid states
|
|
84
|
+
|
|
85
|
+
`getStackTemplate()` in `TemplateGenerator` catches all errors and returns `undefined` silently. If a stack template can't be fetched due to permissions, network issues, or corrupted state, the caller gets `undefined` and may silently skip the category rather than surfacing the real problem.
|
|
86
|
+
|
|
87
|
+
`getGen1AuthTypeStack()` catches JSON parse errors on the stack description and returns `null` silently. If the description is corrupted or in an unexpected format, the auth stack type detection silently fails, potentially causing incorrect category mapping.
|
|
88
|
+
|
|
89
|
+
`emitUsageAnalytics()` catches all errors silently — while acceptable for analytics, the empty catch body with no logging makes debugging impossible.
|
|
90
|
+
|
|
91
|
+
### Point 17 — `assert()` in production code
|
|
92
|
+
|
|
93
|
+
`assert` from `node:assert` is used extensively across the entire module:
|
|
94
|
+
|
|
95
|
+
- `template-generator.ts`: ~22 assert calls for stack resources, physical resource IDs, stack descriptions, parameters, outputs, regions, and stack update statuses.
|
|
96
|
+
- `category-template-generator.ts`: ~18 assert calls for stack descriptions, parameters, outputs, template bodies, resources, OAuth values, and refactor success.
|
|
97
|
+
- `cfn-stack-refactor-updater.ts`: ~8 assert calls for refactor IDs, statuses, stack names, and update results.
|
|
98
|
+
- `cfn-stack-updater.ts`: ~2 assert calls for stack existence and status.
|
|
99
|
+
- `oauth-values-retriever.ts`: ~8 assert calls for OAuth parameter values, provider details, client IDs, secrets, keys, and private keys.
|
|
100
|
+
- `cfn-condition-resolver.ts`: ~2 assert calls for condition existence and parameter values.
|
|
101
|
+
- `cfn-parameter-resolver.ts`: ~1 assert call for parameter keys.
|
|
102
|
+
- `cfn-output-resolver.ts`: ~6 assert calls for resources, outputs, and physical resource IDs.
|
|
103
|
+
|
|
104
|
+
All of these throw generic `AssertionError` with no user-facing context. For example, `assert(sourcePhysicalResourceId)` gives no indication of which stack or category failed, while `assert(destinationLogicalId)` during rollback gives no hint about which resource type couldn't be mapped.
|
|
105
|
+
|
|
106
|
+
## Control Flow & Logic
|
|
107
|
+
|
|
108
|
+
### Point 18 — Repeated branching
|
|
109
|
+
|
|
110
|
+
`generateCategoryTemplates()` branches on `customResourceMap && this.isCustomResource(category)` vs `!isRollback` vs `isRollback` in a long if/else-if/else block. Each branch follows a similar pattern (process Gen1 stack, process Gen2 stack, generate refactor templates) but with slight variations. The three branches share significant structure but aren't consolidated.
|
|
111
|
+
|
|
112
|
+
`parseCategoryStacks()` branches on `!isRollback && category === 'auth'` vs `isRollback && category === 'auth'` with complex nested logic in each branch. The auth-specific handling is interleaved with the general category-mapping logic rather than being extracted.
|
|
113
|
+
|
|
114
|
+
`buildGen1ToGen2ResourceLogicalIdMapping()` branches on resource type (`UserPoolClient`, `UserPoolGroup`, `Role`) with special-case matching logic for each. Adding a new resource type with multiple instances requires modifying this method.
|
|
115
|
+
|
|
116
|
+
### Point 19 — Repeated derived values
|
|
117
|
+
|
|
118
|
+
Stack templates are read multiple times for the same stack. `assessCategoryResources()` in `refactor.ts` calls `templateGenerator.getStackTemplate(sourceCategoryStackId)` for assessment, then `generateCategoryTemplates()` reads the same template again via `CategoryTemplateGenerator.readTemplate()` during execution. `DescribeStacksCommand` is called independently in `refactor.ts` (for OAuth detection), in `TemplateGenerator.parseCategoryStacks()` (for auth type detection via `getGen1AuthTypeStack`), and in `CategoryTemplateGenerator.generateGen1PreProcessTemplate()` / `generateGen2PreProcessTemplate()` (for parameters and outputs).
|
|
119
|
+
|
|
120
|
+
`DescribeStackResourcesCommand` is called independently in `TemplateGenerator.parseCategoryStacks()` and again in `CategoryTemplateGenerator.describeStackResources()` for the same stacks.
|
|
121
|
+
|
|
122
|
+
### Point 20 — Optional predicates
|
|
123
|
+
|
|
124
|
+
`CategoryTemplateGenerator` accepts an optional `resourcesToMovePredicate` callback that customizes which resources are selected for migration. When absent, it falls back to a default type-matching strategy. This creates two hidden modes: the standard category-based filtering and the custom-resource-map-based filtering. The predicate is constructed inline in `TemplateGenerator.createCategoryTemplateGenerator()` as a closure over `customResourceMap`, mixing the strategy (the predicate) with the data (the resource map) across two classes.
|
|
125
|
+
|
|
126
|
+
## Function Design
|
|
127
|
+
|
|
128
|
+
### Point 21 — Positional arguments
|
|
129
|
+
|
|
130
|
+
`TemplateGenerator` constructor takes 10 positional arguments: `fromStack`, `toStack`, `accountId`, `cfnClient`, `ssmClient`, `cognitoIdpClient`, `appId`, `environmentName`, `logger`, `region`.
|
|
131
|
+
|
|
132
|
+
`CategoryTemplateGenerator` constructor takes 12 positional arguments: `logger`, `gen1StackId`, `gen2StackId`, `region`, `accountId`, `cfnClient`, `ssmClient`, `cognitoIdpClient`, `appId`, `environmentName`, `resourcesToMove`, `resourcesToMovePredicate`.
|
|
133
|
+
|
|
134
|
+
`refactorResources()` in `TemplateGenerator` takes 7 positional arguments: `logicalIdMappingForRefactor`, `sourceCategoryStackId`, `destinationCategoryStackId`, `category`, `isRollback`, `sourceTemplateForRefactor`, `destinationTemplateForRefactor`.
|
|
135
|
+
|
|
136
|
+
### Point 22 — High argument count
|
|
137
|
+
|
|
138
|
+
Both constructors mentioned above exceed reasonable argument counts. The AWS clients (`cfnClient`, `ssmClient`, `cognitoIdpClient`) always travel together and could be a single context object. `appId`, `environmentName`, `region`, and `accountId` are environment context that could be grouped. `fromStack`/`toStack` are migration-specific parameters that could be a pair.
|
|
139
|
+
|
|
140
|
+
## Code Hygiene
|
|
141
|
+
|
|
142
|
+
### Point 24 — Code duplication
|
|
143
|
+
|
|
144
|
+
`initializeTemplateGenerator()` and `initializeTemplateGeneratorForRollback()` in `refactor.ts` are nearly identical — both call `GetCallerIdentityCommand`, check `accountId`, create the same three AWS clients, and construct a `TemplateGenerator`. The only difference is the order of `fromStack`/`toStack` arguments. ~30 lines of duplicated code.
|
|
145
|
+
|
|
146
|
+
The resource-filtering logic `Object.entries(template.Resources).filter(([logicalId, value]) => this.resourcesToMove.some(...))` appears in both `generateGen1PreProcessTemplate()` and `generateGen2PreProcessTemplate()` in `CategoryTemplateGenerator` — identical filtering with different variable names.
|
|
147
|
+
|
|
148
|
+
The resolver invocation chain (parameter resolution → output resolution → dependency resolution) is repeated in `generateGen1PreProcessTemplate()`, `generateGen2PreProcessTemplate()`, and `generateRefactorTemplatesForRollback()` with slight variations in which resolvers are called and in what order.
|
|
149
|
+
|
|
150
|
+
### Point 25 — Duplicate constants
|
|
151
|
+
|
|
152
|
+
`ResourceMapping` is defined as an interface in `types.ts` and again as a local interface in `refactor.ts` (lines 18-27) with the same structure. `GEN2_NATIVE_APP_CLIENT` is defined as a constant in both `template-generator.ts` (line 73) and `category-template-generator.ts` (line 18) with the same value `'UserPoolNativeAppClient'`.
|
|
153
|
+
|
|
154
|
+
`UPDATE_COMPLETE` is exported from both `cfn-stack-refactor-updater.ts` and `cfn-stack-updater.ts` with the same value `'UPDATE_COMPLETE'`, while `CFNStackStatus.UPDATE_COMPLETE` in `types.ts` represents the same concept as an enum member.
|
|
155
|
+
|
|
156
|
+
### Point 26 — String replacement on JSON
|
|
157
|
+
|
|
158
|
+
`CfnOutputResolver.resolve()` converts the template resources to a JSON string, runs regex replacements on it (`replaceAll` with patterns like `{"Ref":"${logicalResourceId}"}`), and parses it back. This is the exact anti-pattern described in the guideline — a value that happens to match the regex pattern as a literal string would be incorrectly replaced.
|
|
159
|
+
|
|
160
|
+
`CfnParameterResolver.resolve()` does the same: serializes the template to a string, runs `replaceAll` with `{"Ref":"${ParameterKey}"}` patterns, and parses back. Both resolvers should walk the parsed object tree directly instead.
|
|
161
|
+
|
|
162
|
+
### Point 27 — Dead code
|
|
163
|
+
|
|
164
|
+
`TemplateGenerator.generate()` has a TODO comment: "this function never gets used... I think its best to remove it." — confirmed dead code.
|
|
165
|
+
|
|
166
|
+
`hasOAuthEnabled` in `generateCategoryTemplates()` is assigned but never read.
|
|
167
|
+
|
|
168
|
+
The individual category selection loop in `assessAndSelectCategories()` (lines 283-296 of `refactor.ts`) is unreachable because `selectionChoice` is hardcoded to `'Migrate all categories'` and the `if` always passes.
|
|
169
|
+
|
|
170
|
+
The `eslint-disable @typescript-eslint/no-explicit-any` directive at the top of `refactor.ts` suggests `any` types were used at some point — the directive should be removed if no `any` types remain, or the `any` types should be eliminated.
|
|
171
|
+
|
|
172
|
+
### Point 28 — Unnecessary indirection
|
|
173
|
+
|
|
174
|
+
`TemplateGenerator` exposes `categoryStackMap` via a getter/setter pair, but the setter is private and the getter simply returns the private field. The `generateSelectedCategories()` method temporarily swaps `_categoryStackMap` with a filtered version and restores it in a `finally` block — this indirection exists only because the method mutates shared state instead of passing the filtered map as an argument to `generateCategoryTemplates()`.
|
|
175
|
+
|
|
176
|
+
`getStackCategoryName()` is a one-liner that returns `category` or `'custom'` — called 8 times but only for log messages. The indirection adds no value.
|
|
177
|
+
|
|
178
|
+
### Point 29 — Repeated null checks
|
|
179
|
+
|
|
180
|
+
`this.region` is a `readonly` constructor parameter in `TemplateGenerator`, yet `initializeCategoryGenerators()` asserts it (`assert(this.region)`) and `generateRefactorTemplatesForRollback()` asserts it again (`assert(this.region)`). Since it's set in the constructor and never reassigned, these checks are redundant noise.
|
|
181
|
+
|
|
182
|
+
`this.gen2DescribeStacksResponse?.Outputs` is checked via `assert(Outputs)` in `generateGen2PreProcessTemplate()`, then `this.gen2DescribeStacksResponse?.Outputs` is checked again via `assert(stackOutputs)` a few lines later in the same method — the same value validated twice.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Refactoring Requirements
|
|
187
|
+
|
|
188
|
+
### R1. The refactor step must produce a granular, per-category operation plan
|
|
189
|
+
|
|
190
|
+
`AmplifyMigrationRefactorStep.execute()` must return one `AmplifyMigrationOperation` per meaningful unit of work — not a single monolithic operation that does everything. The `gen2-migration.ts` dispatcher already iterates the returned operations, calls `describe()` on each to display a summary, prompts the user for confirmation, and only then calls `execute()` sequentially. This is the built-in dry-run mechanism: the user sees exactly what will happen before anything changes.
|
|
191
|
+
|
|
192
|
+
Currently, the refactor step returns one operation with a hardcoded description string and an `execute()` that runs the entire multi-step workflow. The refactored code must break this down so each category's refactor work (pre-processing, holding-stack management, resource movement) is represented as separate operations with accurate descriptions derived from the actual plan — not static text.
|
|
193
|
+
|
|
194
|
+
### R2. Adding a new category or service must not require modifying existing ones
|
|
195
|
+
|
|
196
|
+
Adding refactor support for a new category, or a new service within an existing category (e.g., DynamoDB within storage, which requires different refactor logic than S3), must not require changes to existing category or service logic. Each unit of refactor logic must own its resource-type mapping independently.
|
|
197
|
+
|
|
198
|
+
### R3. Common refactor workflow must be shared, with well-defined extension points for category-specific logic
|
|
199
|
+
|
|
200
|
+
The core CloudFormation refactor workflow — resolving dynamic references, pre-processing source and destination stacks, managing holding stacks, executing the stack refactor, and handling failure recovery — is the same across all categories. This shared workflow must not be duplicated per category. Category- or service-specific logic (which resource types to move, how to map logical IDs between stacks, retrieving secrets like OAuth credentials) must plug into the shared workflow at well-defined points without affecting other categories.
|
|
201
|
+
|
|
202
|
+
### R4. Rollback must use the same workflow and extension points as forward execution
|
|
203
|
+
|
|
204
|
+
Rollback and forward execution differ in their inputs — which stack is source vs destination, how logical IDs map between them, and what pre-processing each stack needs — but they share the same phases (pre-process, refactor, clean up). Rollback must flow through the same shared workflow (R3) with direction-specific behavior provided through the same extension points. This ensures rollback automatically produces the same granular operation plan as forward execution, and that adding rollback support for a new category or service doesn't require a separate code path.
|
|
205
|
+
|
|
206
|
+
### R5. Operations must be naturally idempotent
|
|
207
|
+
|
|
208
|
+
If the refactor fails partway through and the user re-runs the command, already-completed operations must no-op without a separate "resume" code path. This must not be achieved by adding pre-flight state checks to each operation. Instead, the operations themselves must be designed so that applying them to an already-transformed state produces no change by construction — e.g., resolving already-resolved references yields the same template, updating a stack with an unchanged template is a no-op, and refactoring resources that are already in the destination stack has nothing to move.
|
|
209
|
+
|
|
210
|
+
### R6. Pre-processing stack updates must be validated against resource removal
|
|
211
|
+
|
|
212
|
+
Before the actual stack refactor, the workflow updates source and destination stacks to resolve dynamic references (parameters, outputs, conditions, dependencies). These pre-processing updates must not cause any resource removal. The existing `validateStatefulResources` infrastructure must be usable at this validation point. The workflow must be structured so that this validation is a natural part of the operation sequence, not an afterthought bolted on externally.
|
|
213
|
+
|
|
214
|
+
### R7. All validations must complete before any mutating operation begins
|
|
215
|
+
|
|
216
|
+
The refactor plan for all categories must be computed and validated before any mutating CloudFormation call is made. If any category's pre-processing would cause resource removal, the command must fail before any mutations occur. The workflow must not interleave validation and mutation across categories — a successful refactor of category 1 followed by a validation failure on category 2 is not acceptable.
|
|
217
|
+
|
|
218
|
+
### R8. Individual operations must not handle their own failure recovery
|
|
219
|
+
|
|
220
|
+
If an operation fails, it must propagate the failure. The dispatcher already handles transactionality: on failure, it calls `rollback()` to obtain and execute rollback operations. Individual operations must not contain try/catch-and-revert logic. This keeps each operation simple and ensures rollback behavior is testable as a first-class flow, not as hidden error-handling paths buried inside forward operations.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Refactoring Plan
|
|
225
|
+
|
|
226
|
+
### Target Directory Structure
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
refactor-new/
|
|
230
|
+
refactorer.ts # Refactorer interface: plan() → RefactorOperation[]
|
|
231
|
+
aws-clients.ts # Single instantiation point for all AWS SDK clients
|
|
232
|
+
stack-facade.ts # Lazy-loading, caching facade over CFN API calls (replaces gen1-env + gen2-branch)
|
|
233
|
+
cfn-template.ts # CFNTemplate type and related interfaces
|
|
234
|
+
utils.ts # extractStackNameFromId utility
|
|
235
|
+
|
|
236
|
+
workflow/
|
|
237
|
+
category-refactorer.ts # Abstract base: shared workflow phases, ResourceMapping type
|
|
238
|
+
forward-category-refactorer.ts # Forward direction: Gen1→Gen2, holding stack management
|
|
239
|
+
rollback-category-refactorer.ts # Rollback direction: Gen2→Gen1, holding stack restore
|
|
240
|
+
|
|
241
|
+
auth/
|
|
242
|
+
auth-forward.ts # Auth forward: resource types, ID mapping, OAuth, UserPoolGroup handling
|
|
243
|
+
auth-rollback.ts # Auth rollback (includes UserPoolGroup)
|
|
244
|
+
auth-utils.ts # Shared auth helpers (stack type detection from description)
|
|
245
|
+
|
|
246
|
+
storage/
|
|
247
|
+
storage-forward.ts # Storage forward: S3 + DynamoDB (shared workflow, no service-specific logic)
|
|
248
|
+
storage-rollback.ts # Storage rollback: S3 + DynamoDB
|
|
249
|
+
|
|
250
|
+
analytics/
|
|
251
|
+
analytics-forward.ts # Analytics forward: Kinesis
|
|
252
|
+
analytics-rollback.ts # Analytics rollback: Kinesis
|
|
253
|
+
|
|
254
|
+
resolvers/
|
|
255
|
+
cfn-condition-resolver.ts # Stateless, tree-walking
|
|
256
|
+
cfn-dependency-resolver.ts # Stateless
|
|
257
|
+
cfn-output-resolver.ts # Stateless, tree-walking (no JSON string replacement)
|
|
258
|
+
cfn-parameter-resolver.ts # Stateless, tree-walking (no JSON string replacement)
|
|
259
|
+
cfn-tree-walker.ts # Shared tree-walking utility used by parameter and output resolvers
|
|
260
|
+
|
|
261
|
+
holding-stack.ts # Holding stack utilities
|
|
262
|
+
cfn-stack-updater.ts # Stack update + polling
|
|
263
|
+
cfn-stack-refactor-updater.ts # Stack refactor + polling
|
|
264
|
+
oauth-values-retriever.ts # OAuth credential retrieval from Cognito + SSM
|
|
265
|
+
snap.ts # Template/mapping snapshot utilities for debugging
|
|
266
|
+
|
|
267
|
+
refactor/
|
|
268
|
+
refactor.ts # AmplifyMigrationRefactorStep — imports from refactor-new/
|
|
269
|
+
legacy-custom-resource.ts # ⚠️ ACTIVE: Legacy code path for --resourceMappings flag (custom resources)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Deviations from original plan:**
|
|
273
|
+
- `gen1-env.ts` / `gen2-branch.ts` → unified into `stack-facade.ts` (two instances, one class)
|
|
274
|
+
- `auth-user-pool-group-forward/rollback.ts` → folded into `auth-forward.ts` / `auth-rollback.ts`
|
|
275
|
+
- `s3-forward/rollback.ts` + `dynamodb-forward/rollback.ts` → consolidated into `storage-forward/rollback.ts` (S3 and DynamoDB share the same workflow)
|
|
276
|
+
- `kinesis-forward/rollback.ts` → renamed to `analytics-forward/rollback.ts`
|
|
277
|
+
- `custom/` directory → descoped; custom resources use `legacy-custom-resource.ts` until a proper refactorer is built
|
|
278
|
+
- Added: `cfn-tree-walker.ts`, `cfn-template.ts`, `oauth-values-retriever.ts`, `auth-utils.ts`, `snap.ts`, `utils.ts`
|
|
279
|
+
|
|
280
|
+
### Key Abstractions
|
|
281
|
+
|
|
282
|
+
**AmplifyMigrationOperation** — Extended with `validate()`. Every operation carries validation, description, and execution logic together. `executeValidate()` runs `validate()` on all operations upfront (R7). The dispatcher runs `describe()` for user confirmation, then `execute()` sequentially.
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
interface AmplifyMigrationOperation {
|
|
286
|
+
public validate(): Promise<void>;
|
|
287
|
+
public describe(): Promise<string[]>;
|
|
288
|
+
public execute(): Promise<void>;
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Refactorer interface** — Same pattern as the generate command's `Generator`. Returns operations from `plan()`.
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
interface Refactorer {
|
|
296
|
+
public plan(): Promise<AmplifyMigrationOperation[]>;
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Gen1Env / Gen2Branch** — Lazy-loading facades for the two conceptual inputs to the refactor command. Both share an `AwsClients` instance for actual SDK calls. Each provides typed accessors for its stack state (templates, parameters, outputs, nested stacks). Caches results on first fetch. Easy to mock independently.
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
class Gen1Env {
|
|
304
|
+
constructor(private readonly clients: AwsClients, private readonly rootStackName: string) {}
|
|
305
|
+
|
|
306
|
+
public async fetchNestedStacks(): Promise<StackResource[]>;
|
|
307
|
+
public async fetchTemplate(stackId: string): Promise<CFNTemplate>;
|
|
308
|
+
public async fetchStackDescription(stackId: string): Promise<Stack>;
|
|
309
|
+
public async fetchStackResources(stackId: string): Promise<StackResource[]>;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
class Gen2Branch {
|
|
313
|
+
constructor(private readonly clients: AwsClients, private readonly rootStackName: string) {}
|
|
314
|
+
|
|
315
|
+
public async fetchNestedStacks(): Promise<StackResource[]>;
|
|
316
|
+
public async fetchTemplate(stackId: string): Promise<CFNTemplate>;
|
|
317
|
+
public async fetchStackDescription(stackId: string): Promise<Stack>;
|
|
318
|
+
public async fetchStackResources(stackId: string): Promise<StackResource[]>;
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**CategoryRefactorer (abstract base)** — Implements `Refactorer`. Enforces a rigid phase sequence via a concrete `plan()`. Shared phases are concrete on the base; direction- and stack-specific phases are abstract.
|
|
323
|
+
|
|
324
|
+
**ForwardCategoryRefactorer** — Extends `CategoryRefactorer`. Provides Gen1 source and Gen2 target resolution. `beforeMove()` moves Gen2's existing resources to a holding stack. `afterMove()` is empty — the holding stack survives for potential rollback.
|
|
325
|
+
|
|
326
|
+
**RollbackCategoryRefactorer** — Extends `CategoryRefactorer`. Provides Gen2 source and Gen1 target resolution. `beforeMove()` is empty. `afterMove()` restores holding stack resources into Gen2 and deletes the holding stack.
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
abstract class CategoryRefactorer implements Refactorer {
|
|
330
|
+
constructor(protected readonly gen1Env: Gen1Env, protected readonly gen2Branch: Gen2Branch) {}
|
|
331
|
+
|
|
332
|
+
public async plan(): Promise<AmplifyMigrationOperation[]> {
|
|
333
|
+
const sourceStackId = await this.fetchSourceStackId();
|
|
334
|
+
const destStackId = await this.fetchDestStackId();
|
|
335
|
+
// If both are undefined, this category doesn't exist — return empty.
|
|
336
|
+
// If only one is undefined, that's an error — handle during implementation.
|
|
337
|
+
const resolvedSource = await this.resolveSource(sourceStackId);
|
|
338
|
+
const resolvedTarget = await this.resolveTarget(destStackId);
|
|
339
|
+
const resourceMappings = this.buildResourceMappings(resolvedSource, resolvedTarget);
|
|
340
|
+
return [
|
|
341
|
+
...this.updateSource(sourceStackId, resolvedSource),
|
|
342
|
+
...this.updateTarget(destStackId, resolvedTarget),
|
|
343
|
+
...this.beforeMove(sourceStackId, destStackId),
|
|
344
|
+
...this.move(sourceStackId, destStackId, resourceMappings, resolvedSource, resolvedTarget),
|
|
345
|
+
...this.afterMove(sourceStackId, destStackId),
|
|
346
|
+
];
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Category/service-specific — abstract
|
|
350
|
+
protected abstract fetchSourceStackId(): Promise<string | undefined>;
|
|
351
|
+
protected abstract fetchDestStackId(): Promise<string | undefined>;
|
|
352
|
+
protected abstract buildResourceMappings(sourceTemplate: CFNTemplate, destTemplate: CFNTemplate): ResourceMapping[];
|
|
353
|
+
|
|
354
|
+
// Direction/stack-specific — abstract
|
|
355
|
+
protected abstract resolveSource(sourceStackId: string): Promise<CFNTemplate>;
|
|
356
|
+
protected abstract resolveTarget(destStackId: string): Promise<CFNTemplate>;
|
|
357
|
+
protected abstract beforeMove(sourceStackId: string, destStackId: string): AmplifyMigrationOperation[];
|
|
358
|
+
protected abstract afterMove(sourceStackId: string, destStackId: string): AmplifyMigrationOperation[];
|
|
359
|
+
|
|
360
|
+
// Shared — concrete on base class
|
|
361
|
+
protected updateSource(sourceStackId: string, resolvedTemplate: CFNTemplate): AmplifyMigrationOperation[] {
|
|
362
|
+
return [
|
|
363
|
+
{
|
|
364
|
+
validate: async () => {
|
|
365
|
+
/* check resolvedTemplate for resource removal (R6) */
|
|
366
|
+
},
|
|
367
|
+
describe: async () => [`Update source stack '${sourceStackId}' with resolved template`],
|
|
368
|
+
execute: async () => {
|
|
369
|
+
await tryUpdateStack(sourceStackId, resolvedTemplate);
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
];
|
|
373
|
+
}
|
|
374
|
+
protected updateTarget(destStackId: string, resolvedTemplate: CFNTemplate): AmplifyMigrationOperation[] {
|
|
375
|
+
return [
|
|
376
|
+
{
|
|
377
|
+
validate: async () => {
|
|
378
|
+
/* check resolvedTemplate for resource removal (R6) */
|
|
379
|
+
},
|
|
380
|
+
describe: async () => [`Update target stack '${destStackId}' with resolved template`],
|
|
381
|
+
execute: async () => {
|
|
382
|
+
await tryUpdateStack(destStackId, resolvedTemplate);
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
];
|
|
386
|
+
}
|
|
387
|
+
protected move(
|
|
388
|
+
sourceStackId: string,
|
|
389
|
+
destStackId: string,
|
|
390
|
+
resourceMappings: ResourceMapping[],
|
|
391
|
+
sourceTemplate: CFNTemplate,
|
|
392
|
+
destTemplate: CFNTemplate,
|
|
393
|
+
): AmplifyMigrationOperation[] {
|
|
394
|
+
return [
|
|
395
|
+
{
|
|
396
|
+
validate: async () => {},
|
|
397
|
+
describe: async () => [`Move ${resourceMappings.length} resource(s) from '${sourceStackId}' to '${destStackId}'`],
|
|
398
|
+
execute: async () => {
|
|
399
|
+
await tryRefactorStack(this.gen1Env.clients, {
|
|
400
|
+
StackDefinitions: [
|
|
401
|
+
{ StackName: sourceStackId, TemplateBody: JSON.stringify(sourceTemplate) },
|
|
402
|
+
{ StackName: destStackId, TemplateBody: JSON.stringify(destTemplate) },
|
|
403
|
+
],
|
|
404
|
+
ResourceMappings: resourceMappings,
|
|
405
|
+
});
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
abstract class ForwardCategoryRefactorer extends CategoryRefactorer {
|
|
413
|
+
protected async resolveSource(sourceStackId: string): Promise<CFNTemplate> {
|
|
414
|
+
/* Gen1: params → outputs → deps → conditions */
|
|
415
|
+
}
|
|
416
|
+
protected async resolveTarget(destStackId: string): Promise<CFNTemplate> {
|
|
417
|
+
/* Gen2: deps → outputs */
|
|
418
|
+
}
|
|
419
|
+
protected beforeMove(sourceStackId: string, destStackId: string): AmplifyMigrationOperation[] {
|
|
420
|
+
/* Move Gen2 resources to holding stack */
|
|
421
|
+
}
|
|
422
|
+
protected afterMove(sourceStackId: string, destStackId: string): AmplifyMigrationOperation[] {
|
|
423
|
+
return [];
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
abstract class RollbackCategoryRefactorer extends CategoryRefactorer {
|
|
428
|
+
protected async resolveSource(sourceStackId: string): Promise<CFNTemplate> {
|
|
429
|
+
/* Gen2 resolution */
|
|
430
|
+
}
|
|
431
|
+
protected async resolveTarget(destStackId: string): Promise<CFNTemplate> {
|
|
432
|
+
/* Gen1 resolution */
|
|
433
|
+
}
|
|
434
|
+
protected beforeMove(sourceStackId: string, destStackId: string): AmplifyMigrationOperation[] {
|
|
435
|
+
return [];
|
|
436
|
+
}
|
|
437
|
+
protected afterMove(sourceStackId: string, destStackId: string): AmplifyMigrationOperation[] {
|
|
438
|
+
/* Restore from holding stack + delete holding stack */
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Concrete example — S3 storage:**
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
class S3ForwardRefactorer extends ForwardCategoryRefactorer {
|
|
447
|
+
protected async fetchSourceStackId(): Promise<string | undefined> {
|
|
448
|
+
/* Find Gen1 storage nested stack */
|
|
449
|
+
}
|
|
450
|
+
protected async fetchDestStackId(): Promise<string | undefined> {
|
|
451
|
+
/* Find Gen2 storage nested stack */
|
|
452
|
+
}
|
|
453
|
+
protected buildResourceMappings(sourceTemplate: CFNTemplate, destTemplate: CFNTemplate): ResourceMapping[] {
|
|
454
|
+
// Filter by AWS::S3::Bucket, single bucket — match by type
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
class S3RollbackRefactorer extends RollbackCategoryRefactorer {
|
|
459
|
+
protected async fetchSourceStackId(): Promise<string | undefined> {
|
|
460
|
+
/* Find Gen2 storage nested stack */
|
|
461
|
+
}
|
|
462
|
+
protected async fetchDestStackId(): Promise<string | undefined> {
|
|
463
|
+
/* Find Gen1 storage nested stack */
|
|
464
|
+
}
|
|
465
|
+
protected buildResourceMappings(sourceTemplate: CFNTemplate, destTemplate: CFNTemplate): ResourceMapping[] {
|
|
466
|
+
// Filter by AWS::S3::Bucket, reverse: Gen2 logical ID → Gen1 logical ID ('S3Bucket')
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
**AmplifyMigrationRefactorStep** — Orchestration only. Creates one refactorer per category/service, collects all operations, returns them to the dispatcher.
|
|
472
|
+
|
|
473
|
+
```typescript
|
|
474
|
+
// Inside AmplifyMigrationRefactorStep
|
|
475
|
+
public async execute(): Promise<AmplifyMigrationOperation[]> {
|
|
476
|
+
const clients = new AwsClients(/* region */);
|
|
477
|
+
const gen1Env = new Gen1Env(clients, this.rootStackName);
|
|
478
|
+
const gen2Branch = new Gen2Branch(clients, this.toStack);
|
|
479
|
+
|
|
480
|
+
const refactorers: Refactorer[] = [
|
|
481
|
+
new S3ForwardRefactorer(gen1Env, gen2Branch),
|
|
482
|
+
new AuthForwardRefactorer(gen1Env, gen2Branch),
|
|
483
|
+
// ... other categories
|
|
484
|
+
];
|
|
485
|
+
|
|
486
|
+
const operations: AmplifyMigrationOperation[] = [];
|
|
487
|
+
for (const refactorer of refactorers) {
|
|
488
|
+
operations.push(...(await refactorer.plan()));
|
|
489
|
+
}
|
|
490
|
+
return operations;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
public async rollback(): Promise<AmplifyMigrationOperation[]> {
|
|
494
|
+
// Same structure, uses rollback refactorers
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### Execution Flow (Forward)
|
|
499
|
+
|
|
500
|
+
```mermaid
|
|
501
|
+
flowchart TD
|
|
502
|
+
STEP["AmplifyMigrationRefactorStep.execute()"] -->|Create| G1[Gen1Env]
|
|
503
|
+
STEP -->|Create| G2[Gen2Branch]
|
|
504
|
+
STEP -->|Instantiate| CR["All forward refactorers<br/>(S3ForwardRefactorer, AuthForwardRefactorer, ...)"]
|
|
505
|
+
|
|
506
|
+
CR -->|"plan() per refactorer:<br/>fetchSourceStackId, fetchDestStackId,<br/>resolveSource, resolveTarget,<br/>buildResourceMappings"| OPS["AmplifyMigrationOperation[]<br/>(empty if category not present)"]
|
|
507
|
+
|
|
508
|
+
OPS --> VAL["executeValidate()<br/>validate() on ALL operations"]
|
|
509
|
+
VAL -->|all pass| DESC["describe() on all operations<br/>+ user confirmation"]
|
|
510
|
+
DESC --> EXEC["execute() sequentially"]
|
|
511
|
+
|
|
512
|
+
subgraph "Per-category operations"
|
|
513
|
+
OP1["Update source stack with resolved template"]
|
|
514
|
+
OP2["Update target stack with resolved template"]
|
|
515
|
+
OP3["Move target resources to holding stack"]
|
|
516
|
+
OP4["Execute stack move"]
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
CR --> OP1
|
|
520
|
+
OP1 --> OP2
|
|
521
|
+
OP2 --> OP3
|
|
522
|
+
OP3 --> OP4
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### Execution Flow (Rollback)
|
|
526
|
+
|
|
527
|
+
```mermaid
|
|
528
|
+
flowchart TD
|
|
529
|
+
STEP["AmplifyMigrationRefactorStep.rollback()"] -->|Create| G1[Gen1Env]
|
|
530
|
+
STEP -->|Create| G2[Gen2Branch]
|
|
531
|
+
STEP -->|Instantiate| CR["All rollback refactorers<br/>(S3RollbackRefactorer, AuthRollbackRefactorer, ...)"]
|
|
532
|
+
|
|
533
|
+
CR -->|"plan() per refactorer:<br/>fetchSourceStackId, fetchDestStackId,<br/>resolveSource, resolveTarget,<br/>buildResourceMappings"| OPS["AmplifyMigrationOperation[]<br/>(empty if category not present)"]
|
|
534
|
+
|
|
535
|
+
OPS --> VAL["executeValidate()<br/>validate() on ALL operations"]
|
|
536
|
+
VAL -->|all pass| DESC["describe() on all operations<br/>+ user confirmation"]
|
|
537
|
+
DESC --> EXEC["execute() sequentially"]
|
|
538
|
+
|
|
539
|
+
subgraph "Per-category operations"
|
|
540
|
+
OP1["Update source stack with resolved template"]
|
|
541
|
+
OP2["Update target stack with resolved template"]
|
|
542
|
+
OP3["Execute stack move"]
|
|
543
|
+
OP4["Restore holding stack resources into Gen2"]
|
|
544
|
+
OP5["Delete holding stack"]
|
|
545
|
+
end
|
|
546
|
+
|
|
547
|
+
CR --> OP1
|
|
548
|
+
OP1 --> OP2
|
|
549
|
+
OP2 --> OP3
|
|
550
|
+
OP3 --> OP4
|
|
551
|
+
OP4 --> OP5
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### Phased Execution
|
|
555
|
+
|
|
556
|
+
**Execution notes:** Each phase should be delegated to a `general-task-execution` sub-agent with a prompt that references this document (`REFACTORING_REFACTOR.md`) and the specific phase. The sub-agent has access to all tools and can read this document for full context. Wait for each phase to complete and review its output before starting the next. Use `context-gatherer` at the start of each phase to re-orient on the current state of the codebase.
|
|
557
|
+
|
|
558
|
+
**Work style:** Prefer large, cohesive refactoring changes over small incremental ones — don't waste time validating intermediate states you may end up discarding. Do not run `yarn test`, `jest`, or any test command for incremental validation during a phase. Commit freely as you work — no need to check in with the user before committing. Use your judgment on commit granularity.
|
|
559
|
+
|
|
560
|
+
**No imports from old code:** Code in `refactor-new/` must NOT import from the old `refactor/` directory. If you need a utility or class that exists in the old code, duplicate it into `refactor-new/`. This ensures `refactor-new/` is fully self-contained and the old `refactor/` directory can be cleanly deleted later without breaking anything.
|
|
561
|
+
|
|
562
|
+
**Exit criteria (all phases):** `yarn build && yarn test` in the `amplify-cli` package must pass before moving on to the next phase.
|
|
563
|
+
|
|
564
|
+
**Phase 1 — Foundation**
|
|
565
|
+
Create a new `refactor-new/` directory alongside the existing `refactor/` directory. Build the foundation: `AmplifyMigrationOperation` (with `validate()`), `Refactorer` interface, `AwsClients`, `Gen1Env`, `Gen2Branch`, abstract `CategoryRefactorer`, `ForwardCategoryRefactorer`, and `RollbackCategoryRefactorer`. Port the four resolvers, converting JSON string replacement to tree-walking and replacing `assert()` with `AmplifyError`. The old `refactor/` directory remains intact as reference throughout. Stop for review.
|
|
566
|
+
|
|
567
|
+
The old code and its unit tests remain intact and must continue to pass. No new tests are needed for this phase since the new code has no entry point yet.
|
|
568
|
+
|
|
569
|
+
**Phase 2 — Migrate category/service refactorers**
|
|
570
|
+
One category at a time, create the forward and rollback refactorer classes (e.g., `S3ForwardRefactorer`, `S3RollbackRefactorer`). Copy over and restructure the relevant logic from the old code — resource type lists, logical ID mapping, category-specific concerns like OAuth. The old code stays untouched as reference. Stop for review after each category. Code does not need to compile at this stage.
|
|
571
|
+
|
|
572
|
+
Same as Phase 1 — the old tests must still pass. No new tests yet since the new code is not wired in.
|
|
573
|
+
|
|
574
|
+
**Phase 3 — Switch over**
|
|
575
|
+
Once all refactorers are complete in `refactor-new/`, update `refactor.ts` (the `AmplifyMigrationRefactorStep` entry point) to use the new infrastructure. All existing tests must pass against the new code paths, including the e2e snapshot tests. Iterate until green.
|
|
576
|
+
|
|
577
|
+
**Phase 4 — Review & simplify**
|
|
578
|
+
All tests pass. Phase 3 was implementation-driven. This phase steps back and reviews the result against the coding guidelines, the design in this document, and the refactoring requirements (R1–R8). Audit for: coding guideline violations, design deviations, requirement compliance, unnecessary complexity, dead code, missing JSDoc. Simplify where constraints from the old code no longer apply.
|
|
579
|
+
|
|
580
|
+
Exit criteria: all tests still pass, the code is clean against coding guidelines, and the design matches the intent of this document. Stop for review.
|
|
581
|
+
|
|
582
|
+
**Phase 5 — Unit tests**
|
|
583
|
+
Write unit tests for the new classes in `refactor-new/`. Test individual components (refactorers, resolvers, Gen1Env, Gen2Branch) in isolation. Don't port old tests mechanically — write tests that cover the same ground with the new architecture. The old `refactor/` directory and its tests remain intact. The old code stays as reference for future refactoring passes.
|
|
584
|
+
|
|
585
|
+
Exit criteria: all existing tests still pass, new unit tests pass, old tests still pass.
|
|
586
|
+
|
|
587
|
+
**Phase 6 — Merge**
|
|
588
|
+
Merge the branch. The old `refactor/` directory stays in the codebase but is no longer wired (`refactor.ts` imports from `refactor-new/`). This keeps the PR focused on the new code.
|
|
589
|
+
|
|
590
|
+
**Phase 7 — Delete old code**
|
|
591
|
+
In a separate PR: delete the old `refactor/` directory and its tests. Rename `refactor-new/` to `refactor/`. Update all import paths. This is a clean deletion PR with no logic changes.
|
|
592
|
+
|
|
593
|
+
**⚠️ Phase 7 exception:** `refactor/legacy-custom-resource.ts` is still actively called by `refactor.ts` when the `--resourceMappings` flag is provided (custom resource migration). During Phase 7, this file must be relocated into `refactor-new/` (or its renamed successor) before the old `refactor/` directory is deleted. The import in `refactor.ts` (`from './legacy-custom-resource'`) must be updated accordingly.
|