@aws-amplify/cli-internal-gen2-migration-experimental-alpha 0.6.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 +21 -12
- package/aws-amplify-cli-internal-gen2-migration-experimental-alpha-0.6.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,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.S3Generator = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
10
|
+
const ts_1 = require("../../_infra/ts");
|
|
11
|
+
const s3_renderer_1 = require("./s3.renderer");
|
|
12
|
+
const factory = typescript_1.default.factory;
|
|
13
|
+
const PERMISSION_MAP = {
|
|
14
|
+
READ: ['read'],
|
|
15
|
+
DELETE: ['delete'],
|
|
16
|
+
CREATE_AND_UPDATE: ['write'],
|
|
17
|
+
};
|
|
18
|
+
class S3Generator {
|
|
19
|
+
constructor(gen1App, backendGenerator, outputDir, resource) {
|
|
20
|
+
this.functionStorageAccess = [];
|
|
21
|
+
this.triggers = {};
|
|
22
|
+
this.gen1App = gen1App;
|
|
23
|
+
this.backendGenerator = backendGenerator;
|
|
24
|
+
this.outputDir = outputDir;
|
|
25
|
+
this.resource = resource;
|
|
26
|
+
this.defineStorage = new s3_renderer_1.S3Renderer(gen1App.envName);
|
|
27
|
+
}
|
|
28
|
+
addFunctionStorageAccess(functionName, category, permissions) {
|
|
29
|
+
this.functionStorageAccess.push({ functionName, category, permissions });
|
|
30
|
+
}
|
|
31
|
+
addTrigger(event, functionName) {
|
|
32
|
+
this.triggers[event] = functionName;
|
|
33
|
+
}
|
|
34
|
+
async plan() {
|
|
35
|
+
var _a;
|
|
36
|
+
const storageName = this.gen1App.singleResourceName('storage', 'S3');
|
|
37
|
+
const storageMeta = ((_a = this.gen1App.meta('storage')) !== null && _a !== void 0 ? _a : {})[storageName];
|
|
38
|
+
return [await this.planS3(storageName, storageMeta)];
|
|
39
|
+
}
|
|
40
|
+
async planS3(storageName, storageMeta) {
|
|
41
|
+
const output = storageMeta.output;
|
|
42
|
+
const bucketName = output === null || output === void 0 ? void 0 : output.BucketName;
|
|
43
|
+
if (!bucketName) {
|
|
44
|
+
throw new Error(`Could not find bucket name for storage resource '${storageName}'`);
|
|
45
|
+
}
|
|
46
|
+
const cliInputs = this.gen1App.cliInputs('storage', storageName);
|
|
47
|
+
const [accelerateStatus, versioningStatus, encryption] = await Promise.all([
|
|
48
|
+
this.gen1App.aws.fetchBucketAccelerate(bucketName),
|
|
49
|
+
this.gen1App.aws.fetchBucketVersioning(bucketName),
|
|
50
|
+
this.gen1App.aws.fetchBucketEncryption(bucketName),
|
|
51
|
+
]);
|
|
52
|
+
const storageDir = node_path_1.default.join(this.outputDir, 'amplify', 'storage');
|
|
53
|
+
const storageIdentifier = bucketName;
|
|
54
|
+
return {
|
|
55
|
+
resource: this.resource,
|
|
56
|
+
validate: () => undefined,
|
|
57
|
+
describe: async () => ['Generate amplify/storage/resource.ts'],
|
|
58
|
+
execute: async () => {
|
|
59
|
+
const accessPatterns = this.buildAccessPatterns(cliInputs);
|
|
60
|
+
const triggerFunctionCategories = new Map(Object.values(this.triggers).map((name) => [name, 'storage']));
|
|
61
|
+
const nodes = this.defineStorage.render({
|
|
62
|
+
storageIdentifier,
|
|
63
|
+
accessPatterns,
|
|
64
|
+
triggers: this.triggers,
|
|
65
|
+
triggerFunctionCategories,
|
|
66
|
+
});
|
|
67
|
+
const content = ts_1.TS.printNodes(nodes);
|
|
68
|
+
await promises_1.default.mkdir(storageDir, { recursive: true });
|
|
69
|
+
await promises_1.default.writeFile(node_path_1.default.join(storageDir, 'resource.ts'), content, 'utf-8');
|
|
70
|
+
this.backendGenerator.addImport('./storage/resource', ['storage']);
|
|
71
|
+
this.backendGenerator.addDefineBackendProperty(factory.createShorthandPropertyAssignment(factory.createIdentifier('storage')));
|
|
72
|
+
this.contributeOverrides(bucketName, accelerateStatus, versioningStatus, encryption);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
contributeOverrides(bucketName, accelerateStatus, versioningStatus, encryption) {
|
|
77
|
+
var _a;
|
|
78
|
+
const cfnBucketDecl = factory.createVariableStatement([], factory.createVariableDeclarationList([
|
|
79
|
+
factory.createVariableDeclaration('s3Bucket', undefined, undefined, factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createIdentifier('backend'), factory.createIdentifier('storage')), factory.createIdentifier('resources')), factory.createIdentifier('cfnResources')), factory.createIdentifier('cfnBucket'))),
|
|
80
|
+
], typescript_1.default.NodeFlags.Const));
|
|
81
|
+
this.backendGenerator.addStatement(cfnBucketDecl);
|
|
82
|
+
const bucketNameComment1 = factory.createNotEmittedStatement(factory.createStringLiteral(''));
|
|
83
|
+
typescript_1.default.addSyntheticLeadingComment(bucketNameComment1, typescript_1.default.SyntaxKind.SingleLineCommentTrivia, ' Use this bucket name post refactor', true);
|
|
84
|
+
const bucketNameComment2 = factory.createNotEmittedStatement(factory.createStringLiteral(''));
|
|
85
|
+
typescript_1.default.addSyntheticLeadingComment(bucketNameComment2, typescript_1.default.SyntaxKind.SingleLineCommentTrivia, ` s3Bucket.bucketName = '${bucketName}';`, true);
|
|
86
|
+
this.backendGenerator.addStatement(bucketNameComment1);
|
|
87
|
+
this.backendGenerator.addStatement(bucketNameComment2);
|
|
88
|
+
if (accelerateStatus) {
|
|
89
|
+
this.backendGenerator.addStatement(factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier('s3Bucket'), factory.createIdentifier('accelerateConfiguration')), factory.createObjectLiteralExpression([factory.createPropertyAssignment('accelerationStatus', factory.createStringLiteral(accelerateStatus))], false))));
|
|
90
|
+
}
|
|
91
|
+
if (versioningStatus) {
|
|
92
|
+
this.backendGenerator.addStatement(factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier('s3Bucket'), factory.createIdentifier('versioningConfiguration')), factory.createObjectLiteralExpression([factory.createPropertyAssignment('status', factory.createStringLiteral(versioningStatus))], false))));
|
|
93
|
+
}
|
|
94
|
+
if ((_a = encryption === null || encryption === void 0 ? void 0 : encryption.Rules) === null || _a === void 0 ? void 0 : _a[0]) {
|
|
95
|
+
const rule = encryption.Rules[0];
|
|
96
|
+
const sseProps = [];
|
|
97
|
+
if (rule.ApplyServerSideEncryptionByDefault) {
|
|
98
|
+
const sseDefaultProps = [];
|
|
99
|
+
if (rule.ApplyServerSideEncryptionByDefault.SSEAlgorithm) {
|
|
100
|
+
sseDefaultProps.push(factory.createPropertyAssignment('sseAlgorithm', factory.createStringLiteral(rule.ApplyServerSideEncryptionByDefault.SSEAlgorithm)));
|
|
101
|
+
}
|
|
102
|
+
if (rule.ApplyServerSideEncryptionByDefault.KMSMasterKeyID) {
|
|
103
|
+
sseDefaultProps.push(factory.createPropertyAssignment('kmsMasterKeyId', factory.createStringLiteral(rule.ApplyServerSideEncryptionByDefault.KMSMasterKeyID)));
|
|
104
|
+
}
|
|
105
|
+
sseProps.push(factory.createPropertyAssignment('serverSideEncryptionByDefault', factory.createObjectLiteralExpression(sseDefaultProps, true)));
|
|
106
|
+
}
|
|
107
|
+
if (rule.BucketKeyEnabled !== undefined) {
|
|
108
|
+
sseProps.push(factory.createPropertyAssignment('bucketKeyEnabled', rule.BucketKeyEnabled ? factory.createTrue() : factory.createFalse()));
|
|
109
|
+
}
|
|
110
|
+
this.backendGenerator.addStatement(factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier('s3Bucket'), factory.createIdentifier('bucketEncryption')), factory.createObjectLiteralExpression([
|
|
111
|
+
factory.createPropertyAssignment('serverSideEncryptionConfiguration', factory.createArrayLiteralExpression([factory.createObjectLiteralExpression(sseProps, true)], true)),
|
|
112
|
+
], true))));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
buildAccessPatterns(cliInputs) {
|
|
116
|
+
let groups;
|
|
117
|
+
if (cliInputs.groupAccess && Object.keys(cliInputs.groupAccess).length > 0) {
|
|
118
|
+
groups = Object.entries(cliInputs.groupAccess).reduce((acc, [key, value]) => {
|
|
119
|
+
acc[key] = value.flatMap((p) => PERMISSION_MAP[p]);
|
|
120
|
+
return acc;
|
|
121
|
+
}, {});
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
guest: cliInputs.guestAccess.flatMap((p) => PERMISSION_MAP[p]),
|
|
125
|
+
auth: cliInputs.authAccess.flatMap((p) => PERMISSION_MAP[p]),
|
|
126
|
+
groups,
|
|
127
|
+
functions: this.functionStorageAccess.length > 0 ? this.functionStorageAccess : undefined,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.S3Generator = S3Generator;
|
|
132
|
+
//# sourceMappingURL=s3.generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3.generator.js","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/amplify/storage/s3.generator.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,gEAAkC;AAClC,4DAA4B;AAM5B,wCAAqC;AACrC,+CAA4F;AAE5F,MAAM,OAAO,GAAG,oBAAE,CAAC,OAAO,CAAC;AAoB3B,MAAM,cAAc,GAA6D;IAC/E,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,MAAM,EAAE,CAAC,QAA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AAC,CAAC;gBACnD,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAAkC,CAAC,CAAC;QACzC,CAAC;QAED,OAAO;YACL,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAC9D,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAC5D,MAAM;YACN,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS;SAC1F,CAAC;IACJ,CAAC;CACF;AAzOD,kCAyOC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
export type Permission = 'read' | 'write' | 'create' | 'delete';
|
|
3
|
+
export type StorageTriggerEvent = 'onDelete' | 'onUpload';
|
|
4
|
+
export interface AccessPatterns {
|
|
5
|
+
readonly auth?: readonly Permission[];
|
|
6
|
+
readonly guest?: readonly Permission[];
|
|
7
|
+
readonly groups?: Readonly<Record<string, readonly Permission[]>>;
|
|
8
|
+
readonly functions?: ReadonlyArray<{
|
|
9
|
+
readonly functionName: string;
|
|
10
|
+
readonly category: string;
|
|
11
|
+
readonly permissions: readonly Permission[];
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export interface RenderDefineStorageOptions {
|
|
15
|
+
readonly storageIdentifier: string;
|
|
16
|
+
readonly accessPatterns?: AccessPatterns;
|
|
17
|
+
readonly triggers?: Partial<Record<StorageTriggerEvent, string>>;
|
|
18
|
+
readonly triggerFunctionCategories: ReadonlyMap<string, string>;
|
|
19
|
+
}
|
|
20
|
+
export declare class S3Renderer {
|
|
21
|
+
private readonly envName;
|
|
22
|
+
constructor(envName: string);
|
|
23
|
+
render(opts: RenderDefineStorageOptions): ts.NodeArray<ts.Node>;
|
|
24
|
+
private renderName;
|
|
25
|
+
private renderAccessPatterns;
|
|
26
|
+
private renderTriggers;
|
|
27
|
+
private buildAccessProperty;
|
|
28
|
+
private createAllowPattern;
|
|
29
|
+
private createResourcePattern;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=s3.renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3.renderer.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/amplify/storage/s3.renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,YAAY,CAAC;AAQhD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAKhE,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,UAAU,CAAC;AAK1D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,CAAC,CAAC;IAClE,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;QACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;KAC7C,CAAC,CAAC;CACJ;AAKD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,yBAAyB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjE;AAMD,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAEd,OAAO,EAAE,MAAM;IAO3B,MAAM,CAAC,IAAI,EAAE,0BAA0B,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC;IAqBtE,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,oBAAoB;IAoC5B,OAAO,CAAC,cAAc;IAuBtB,OAAO,CAAC,mBAAmB;IA2E3B,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,qBAAqB;CAc9B"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.S3Renderer = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const ts_1 = require("../../_infra/ts");
|
|
9
|
+
const factory = typescript_1.default.factory;
|
|
10
|
+
class S3Renderer {
|
|
11
|
+
constructor(envName) {
|
|
12
|
+
this.envName = envName;
|
|
13
|
+
}
|
|
14
|
+
render(opts) {
|
|
15
|
+
const propertyAssignments = [];
|
|
16
|
+
const namedImports = { '@aws-amplify/backend': new Set(['defineStorage']) };
|
|
17
|
+
const postImportStatements = [];
|
|
18
|
+
const branchNameStatement = ts_1.TS.createBranchNameDeclaration();
|
|
19
|
+
postImportStatements.push(branchNameStatement);
|
|
20
|
+
this.renderName(propertyAssignments, opts.storageIdentifier);
|
|
21
|
+
this.renderAccessPatterns(propertyAssignments, namedImports, postImportStatements, opts);
|
|
22
|
+
this.renderTriggers(propertyAssignments, namedImports, opts);
|
|
23
|
+
return ts_1.TS.renderResourceTsFile({
|
|
24
|
+
backendFunctionConstruct: 'defineStorage',
|
|
25
|
+
exportedVariableName: factory.createIdentifier('storage'),
|
|
26
|
+
functionCallParameter: factory.createObjectLiteralExpression(propertyAssignments),
|
|
27
|
+
postImportStatements,
|
|
28
|
+
additionalImportedBackendIdentifiers: namedImports,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
renderName(target, storageIdentifier) {
|
|
32
|
+
const parts = storageIdentifier.split('-');
|
|
33
|
+
const nameWithoutEnv = parts.slice(0, -1).join('-');
|
|
34
|
+
const nameExpression = factory.createTemplateExpression(factory.createTemplateHead(`${nameWithoutEnv}-`), [
|
|
35
|
+
factory.createTemplateSpan(factory.createIdentifier('branchName'), factory.createTemplateTail('')),
|
|
36
|
+
]);
|
|
37
|
+
target.push(factory.createPropertyAssignment(factory.createIdentifier('name'), nameExpression));
|
|
38
|
+
}
|
|
39
|
+
renderAccessPatterns(target, namedImports, postImportStatements, opts) {
|
|
40
|
+
if (!opts.accessPatterns)
|
|
41
|
+
return;
|
|
42
|
+
target.push(this.buildAccessProperty(opts.accessPatterns));
|
|
43
|
+
if (opts.accessPatterns.functions && opts.accessPatterns.functions.length > 0) {
|
|
44
|
+
for (const functionAccess of opts.accessPatterns.functions) {
|
|
45
|
+
const functionImportPath = `../${functionAccess.category}/${functionAccess.functionName}/resource`;
|
|
46
|
+
if (!namedImports[functionImportPath]) {
|
|
47
|
+
namedImports[functionImportPath] = new Set();
|
|
48
|
+
}
|
|
49
|
+
namedImports[functionImportPath].add(functionAccess.functionName);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (opts.accessPatterns.groups) {
|
|
53
|
+
postImportStatements.push(factory.createJSDocComment(factory.createNodeArray([
|
|
54
|
+
factory.createJSDocText('TODO: Your project uses group permissions. Group permissions have changed in Gen 2. '),
|
|
55
|
+
factory.createJSDocText('In order to grant permissions to groups in Gen 2, please refer to https://docs.amplify.aws/react/build-a-backend/storage/authorization/#for-gen-1-public-protected-and-private-access-pattern.'),
|
|
56
|
+
])));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
renderTriggers(target, namedImports, opts) {
|
|
60
|
+
const triggers = opts.triggers;
|
|
61
|
+
if (!triggers || Object.keys(triggers).length === 0)
|
|
62
|
+
return;
|
|
63
|
+
const triggerProps = Object.entries(triggers).map(([key, functionName]) => {
|
|
64
|
+
return factory.createPropertyAssignment(factory.createIdentifier(key), factory.createIdentifier(functionName));
|
|
65
|
+
});
|
|
66
|
+
target.push(factory.createPropertyAssignment('triggers', factory.createObjectLiteralExpression(triggerProps, true)));
|
|
67
|
+
for (const functionName of Object.values(triggers)) {
|
|
68
|
+
const category = opts.triggerFunctionCategories.get(functionName) || 'function';
|
|
69
|
+
const functionImportPath = category === 'storage' ? `./${functionName}/resource` : `../${category}/${functionName}/resource`;
|
|
70
|
+
if (!namedImports[functionImportPath]) {
|
|
71
|
+
namedImports[functionImportPath] = new Set();
|
|
72
|
+
}
|
|
73
|
+
namedImports[functionImportPath].add(functionName);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
buildAccessProperty(accessPatterns) {
|
|
77
|
+
const allowIdentifier = factory.createIdentifier('allow');
|
|
78
|
+
const publicPathAccess = [];
|
|
79
|
+
const privatePathAccess = [];
|
|
80
|
+
const protectedPathAccess = [];
|
|
81
|
+
if (accessPatterns.guest && accessPatterns.guest.length > 0) {
|
|
82
|
+
publicPathAccess.push(this.createAllowPattern(allowIdentifier, 'guest', accessPatterns.guest));
|
|
83
|
+
}
|
|
84
|
+
if (accessPatterns.auth && accessPatterns.auth.length > 0) {
|
|
85
|
+
const pattern = this.createAllowPattern(allowIdentifier, 'authenticated', accessPatterns.auth);
|
|
86
|
+
publicPathAccess.push(pattern);
|
|
87
|
+
protectedPathAccess.push(pattern);
|
|
88
|
+
privatePathAccess.push(pattern);
|
|
89
|
+
}
|
|
90
|
+
if (accessPatterns.groups) {
|
|
91
|
+
for (const [groupName, permissions] of Object.entries(accessPatterns.groups)) {
|
|
92
|
+
const pattern = this.createAllowPattern(allowIdentifier, `groups(['${groupName}'])`, permissions);
|
|
93
|
+
publicPathAccess.push(pattern);
|
|
94
|
+
privatePathAccess.push(pattern);
|
|
95
|
+
protectedPathAccess.push(pattern);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (accessPatterns.functions && accessPatterns.functions.length > 0) {
|
|
99
|
+
const consolidated = {};
|
|
100
|
+
for (const { functionName, permissions } of accessPatterns.functions) {
|
|
101
|
+
if (!consolidated[functionName]) {
|
|
102
|
+
consolidated[functionName] = new Set(permissions);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
for (const p of permissions)
|
|
106
|
+
consolidated[functionName].add(p);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const [functionName, permissions] of Object.entries(consolidated)) {
|
|
110
|
+
const pattern = this.createResourcePattern(allowIdentifier, functionName, Array.from(permissions));
|
|
111
|
+
publicPathAccess.push(pattern);
|
|
112
|
+
privatePathAccess.push(pattern);
|
|
113
|
+
protectedPathAccess.push(pattern);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const allowAssignments = [];
|
|
117
|
+
if (publicPathAccess.length > 0) {
|
|
118
|
+
allowAssignments.push(factory.createPropertyAssignment(factory.createStringLiteral('public/*'), factory.createArrayLiteralExpression(publicPathAccess)));
|
|
119
|
+
}
|
|
120
|
+
if (protectedPathAccess.length > 0) {
|
|
121
|
+
allowAssignments.push(factory.createPropertyAssignment(factory.createStringLiteral('protected/{entity_id}/*'), factory.createArrayLiteralExpression(protectedPathAccess)));
|
|
122
|
+
}
|
|
123
|
+
if (privatePathAccess.length > 0) {
|
|
124
|
+
allowAssignments.push(factory.createPropertyAssignment(factory.createStringLiteral('private/{entity_id}/*'), factory.createArrayLiteralExpression(privatePathAccess)));
|
|
125
|
+
}
|
|
126
|
+
const accessFunction = factory.createArrowFunction(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, allowIdentifier)], undefined, undefined, factory.createParenthesizedExpression(factory.createObjectLiteralExpression(allowAssignments, true)));
|
|
127
|
+
return factory.createPropertyAssignment(factory.createIdentifier('access'), accessFunction);
|
|
128
|
+
}
|
|
129
|
+
createAllowPattern(allowIdentifier, userLevel, permissions) {
|
|
130
|
+
return factory.createCallExpression(factory.createPropertyAccessExpression(allowIdentifier, factory.createIdentifier(`${userLevel}.to`)), undefined, [factory.createArrayLiteralExpression(permissions.map((p) => factory.createStringLiteral(p)))]);
|
|
131
|
+
}
|
|
132
|
+
createResourcePattern(allowIdentifier, functionName, permissions) {
|
|
133
|
+
return factory.createCallExpression(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createPropertyAccessExpression(allowIdentifier, factory.createIdentifier('resource')), undefined, [factory.createIdentifier(functionName)]), factory.createIdentifier('to')), undefined, [factory.createArrayLiteralExpression(permissions.map((p) => factory.createStringLiteral(p)))]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.S3Renderer = S3Renderer;
|
|
137
|
+
//# sourceMappingURL=s3.renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3.renderer.js","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/amplify/storage/s3.renderer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAgD;AAChD,wCAAqC;AAErC,MAAM,OAAO,GAAG,oBAAE,CAAC,OAAO,CAAC;AAwC3B,MAAa,UAAU;IAGrB,YAAmB,OAAe;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAKM,MAAM,CAAC,IAAgC;QAC5C,MAAM,mBAAmB,GAA4B,EAAE,CAAC;QACxD,MAAM,YAAY,GAAgC,EAAE,sBAAsB,EAAE,IAAI,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC;QACzG,MAAM,oBAAoB,GAAc,EAAE,CAAC;QAE3C,MAAM,mBAAmB,GAAG,OAAE,CAAC,2BAA2B,EAA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CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/F,CAAC;IACJ,CAAC;CACF;AApMD,gCAoMC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Planner } from '../../_infra/planner';
|
|
2
|
+
import { AmplifyMigrationOperation } from '../../_infra/operation';
|
|
3
|
+
export declare class TsConfigGenerator implements Planner {
|
|
4
|
+
private readonly outputDir;
|
|
5
|
+
constructor(outputDir: string);
|
|
6
|
+
plan(): Promise<AmplifyMigrationOperation[]>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=tsconfig.generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.generator.d.ts","sourceRoot":"","sources":["../../../../../src/commands/gen2-migration/generate/amplify/tsconfig.generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAKnE,qBAAa,iBAAkB,YAAW,OAAO;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM;IAKxC,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAC;CA+B1D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TsConfigGenerator = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
|
+
class TsConfigGenerator {
|
|
10
|
+
constructor(outputDir) {
|
|
11
|
+
this.outputDir = outputDir;
|
|
12
|
+
}
|
|
13
|
+
async plan() {
|
|
14
|
+
const filePath = node_path_1.default.join(this.outputDir, 'amplify', 'tsconfig.json');
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
validate: () => undefined,
|
|
18
|
+
describe: async () => ['Generate amplify/tsconfig.json'],
|
|
19
|
+
execute: async () => {
|
|
20
|
+
const tsconfig = {
|
|
21
|
+
compilerOptions: {
|
|
22
|
+
target: 'es2022',
|
|
23
|
+
module: 'es2022',
|
|
24
|
+
moduleResolution: 'bundler',
|
|
25
|
+
resolveJsonModule: true,
|
|
26
|
+
esModuleInterop: true,
|
|
27
|
+
forceConsistentCasingInFileNames: true,
|
|
28
|
+
strict: true,
|
|
29
|
+
skipLibCheck: true,
|
|
30
|
+
paths: {
|
|
31
|
+
'$amplify/*': ['../.amplify/generated/*'],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
await promises_1.default.mkdir(node_path_1.default.dirname(filePath), { recursive: true });
|
|
36
|
+
const json = JSON.stringify(tsconfig, null, 2);
|
|
37
|
+
const collapsed = json.replace(/\[\s*\n\s*"([^"]+)"\s*\n\s*\]/g, '["$1"]');
|
|
38
|
+
await promises_1.default.writeFile(filePath, collapsed + '\n', 'utf-8');
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.TsConfigGenerator = TsConfigGenerator;
|
|
45
|
+
//# sourceMappingURL=tsconfig.generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.generator.js","sourceRoot":"","sources":["../../../../../src/commands/gen2-migration/generate/amplify/tsconfig.generator.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,gEAAkC;AAOlC,MAAa,iBAAiB;IAC5B,YAAoC,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;IAAG,CAAC;IAKlD,KAAK,CAAC,IAAI;QACf,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;QACvE,OAAO;YACL;gBACE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;gBACzB,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,gCAAgC,CAAC;gBACxD,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,MAAM,QAAQ,GAAG;wBACf,eAAe,EAAE;4BACf,MAAM,EAAE,QAAQ;4BAChB,MAAM,EAAE,QAAQ;4BAChB,gBAAgB,EAAE,SAAS;4BAC3B,iBAAiB,EAAE,IAAI;4BACvB,eAAe,EAAE,IAAI;4BACrB,gCAAgC,EAAE,IAAI;4BACtC,MAAM,EAAE,IAAI;4BACZ,YAAY,EAAE,IAAI;4BAClB,KAAK,EAAE;gCACL,YAAY,EAAE,CAAC,yBAAyB,CAAC;6BAC1C;yBACF;qBACF,CAAC;oBACF,MAAM,kBAAE,CAAC,KAAK,CAAC,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;oBAE/C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,QAAQ,CAAC,CAAC;oBAC3E,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC1D,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CACF;AArCD,8CAqCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Planner } from '../_infra/planner';
|
|
2
|
+
import { AmplifyMigrationOperation } from '../_infra/operation';
|
|
3
|
+
import { Gen1App } from './_infra/gen1-app';
|
|
4
|
+
export declare class AmplifyYmlGenerator implements Planner {
|
|
5
|
+
private readonly gen1App;
|
|
6
|
+
constructor(gen1App: Gen1App);
|
|
7
|
+
plan(): Promise<AmplifyMigrationOperation[]>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=amplify.yml.generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amplify.yml.generator.d.ts","sourceRoot":"","sources":["../../../../src/commands/gen2-migration/generate/amplify.yml.generator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAe5C,qBAAa,mBAAoB,YAAW,OAAO;IACjD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEf,OAAO,EAAE,OAAO;IAOtB,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAgE1D"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.AmplifyYmlGenerator = void 0;
|
|
40
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
41
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
42
|
+
const yaml = __importStar(require("yaml"));
|
|
43
|
+
const files_1 = require("./_infra/files");
|
|
44
|
+
const GEN1_COMMAND = '- amplifyPush\\b.*';
|
|
45
|
+
const GEN2_INSTALL_COMMAND = '- npm ci --cache .npm --prefer-offline';
|
|
46
|
+
const GEN2_COMMAND = '- npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID';
|
|
47
|
+
const GEN2_REPLACE_STRING = `${GEN2_INSTALL_COMMAND}\n${' '.repeat(8)}${GEN2_COMMAND}`;
|
|
48
|
+
class AmplifyYmlGenerator {
|
|
49
|
+
constructor(gen1App) {
|
|
50
|
+
this.gen1App = gen1App;
|
|
51
|
+
}
|
|
52
|
+
async plan() {
|
|
53
|
+
const amplifyYmlPath = node_path_1.default.join(process.cwd(), 'amplify.yml');
|
|
54
|
+
const localFileExists = await (0, files_1.fileOrDirectoryExists)(amplifyYmlPath);
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
validate: () => undefined,
|
|
58
|
+
describe: async () => [localFileExists ? 'Update amplify.yml with Gen2 build commands' : 'Generate amplify.yml'],
|
|
59
|
+
execute: async () => {
|
|
60
|
+
let parsed;
|
|
61
|
+
let fromExistingSource = false;
|
|
62
|
+
if (localFileExists) {
|
|
63
|
+
const existing = await promises_1.default.readFile(amplifyYmlPath, 'utf-8');
|
|
64
|
+
parsed = yaml.parse(existing);
|
|
65
|
+
fromExistingSource = true;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const buildSpec = await this.gen1App.aws.fetchAppBuildSpec(this.gen1App.appId);
|
|
69
|
+
if (buildSpec) {
|
|
70
|
+
parsed = yaml.parse(buildSpec);
|
|
71
|
+
fromExistingSource = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!parsed) {
|
|
75
|
+
parsed = {
|
|
76
|
+
version: 1,
|
|
77
|
+
backend: {
|
|
78
|
+
phases: {
|
|
79
|
+
build: {
|
|
80
|
+
commands: [
|
|
81
|
+
'# Execute Amplify CLI with the helper script',
|
|
82
|
+
'npm ci --cache .npm --prefer-offline',
|
|
83
|
+
'npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID',
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
frontend: {
|
|
89
|
+
phases: {
|
|
90
|
+
build: {
|
|
91
|
+
commands: ['mkdir dist', 'touch dist/index.html'],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
artifacts: {
|
|
95
|
+
baseDirectory: 'dist',
|
|
96
|
+
files: ['**/*'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
let content = yaml.stringify(parsed);
|
|
102
|
+
if (fromExistingSource) {
|
|
103
|
+
content = content.replace(new RegExp(GEN1_COMMAND, 'g'), GEN2_REPLACE_STRING);
|
|
104
|
+
}
|
|
105
|
+
await promises_1.default.writeFile(amplifyYmlPath, content, 'utf-8');
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.AmplifyYmlGenerator = AmplifyYmlGenerator;
|
|
112
|
+
//# sourceMappingURL=amplify.yml.generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amplify.yml.generator.js","sourceRoot":"","sources":["../../../../src/commands/gen2-migration/generate/amplify.yml.generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA6B;AAC7B,gEAAkC;AAClC,2CAA6B;AAI7B,0CAAuD;AAEvD,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAC1C,MAAM,oBAAoB,GAAG,wCAAwC,CAAC;AACtE,MAAM,YAAY,GAAG,sEAAsE,CAAC;AAC5F,MAAM,mBAAmB,GAAG,GAAG,oBAAoB,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,YAAY,EAAE,CAAC;AASvF,MAAa,mBAAmB;IAG9B,YAAmB,OAAgB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAKM,KAAK,CAAC,IAAI;QACf,MAAM,cAAc,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;QAC/D,MAAM,eAAe,GAAG,MAAM,IAAA,6BAAqB,EAAC,cAAc,CAAC,CAAC;QAEpE,OAAO;YACL;gBACE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;gBACzB,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,6CAA6C,CAA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O,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC,EAAE,mBAAmB,CAAC,CAAC;oBAChF,CAAC;oBACD,MAAM,kBAAE,CAAC,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;gBACvD,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CACF;AA1ED,kDA0EC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Planner } from '../_infra/planner';
|
|
2
|
+
import { AmplifyMigrationOperation } from '../_infra/operation';
|
|
3
|
+
export declare class GitIgnoreGenerator implements Planner {
|
|
4
|
+
plan(): Promise<AmplifyMigrationOperation[]>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=gitignore.generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.generator.d.ts","sourceRoot":"","sources":["../../../../src/commands/gen2-migration/generate/gitignore.generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAOhE,qBAAa,kBAAmB,YAAW,OAAO;IAInC,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAsC1D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GitIgnoreGenerator = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
|
+
const GEN2_GITIGNORE_ENTRIES = ['.amplify', 'amplify_outputs*', 'amplifyconfiguration*', 'aws-exports*', 'node_modules', 'build', 'dist'];
|
|
10
|
+
class GitIgnoreGenerator {
|
|
11
|
+
async plan() {
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
validate: () => undefined,
|
|
15
|
+
describe: async () => ['Update .gitignore with Gen2 entries'],
|
|
16
|
+
execute: async () => {
|
|
17
|
+
const gitignorePath = node_path_1.default.join(process.cwd(), '.gitignore');
|
|
18
|
+
let content = '';
|
|
19
|
+
try {
|
|
20
|
+
content = await promises_1.default.readFile(gitignorePath, 'utf-8');
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
if (!(e.code === 'ENOENT')) {
|
|
24
|
+
throw e;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const gen1BlockRegex = /#amplify-do-not-edit-begin[\s\S]*#amplify-do-not-edit-end/g;
|
|
28
|
+
content = content.replace(gen1BlockRegex, '');
|
|
29
|
+
if (!content.includes('.amplify')) {
|
|
30
|
+
content = `${content}\n# amplify\n.amplify`;
|
|
31
|
+
}
|
|
32
|
+
for (const entry of GEN2_GITIGNORE_ENTRIES.slice(1)) {
|
|
33
|
+
if (!content.includes(entry)) {
|
|
34
|
+
content = `${content}\n${entry}`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
content = content.replace(/^\s*[\r\n]/gm, '');
|
|
38
|
+
await promises_1.default.writeFile(gitignorePath, `${content}\n`, 'utf-8');
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.GitIgnoreGenerator = GitIgnoreGenerator;
|
|
45
|
+
//# sourceMappingURL=gitignore.generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.generator.js","sourceRoot":"","sources":["../../../../src/commands/gen2-migration/generate/gitignore.generator.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,gEAAkC;AAIlC,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,kBAAkB,EA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AC;oBAC9C,MAAM,kBAAE,CAAC,SAAS,CAAC,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC7D,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CACF;AA1CD,gDA0CC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Planner } from '../_infra/planner';
|
|
2
|
+
import { AmplifyMigrationOperation } from '../_infra/operation';
|
|
3
|
+
export declare class RootPackageJsonGenerator implements Planner {
|
|
4
|
+
private readonly dependencies;
|
|
5
|
+
private readonly devDependencies;
|
|
6
|
+
private readonly outputDir;
|
|
7
|
+
constructor(outputDir: string);
|
|
8
|
+
addDependency(name: string, version: string): void;
|
|
9
|
+
addDevDependency(name: string, version: string): void;
|
|
10
|
+
plan(): Promise<AmplifyMigrationOperation[]>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=package.json.generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.json.generator.d.ts","sourceRoot":"","sources":["../../../../src/commands/gen2-migration/generate/package.json.generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAuChE,qBAAa,wBAAyB,YAAW,OAAO;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8B;IAC3D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA8B;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEhB,SAAS,EAAE,MAAM;IAO7B,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAOlD,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAO/C,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAC;CA2C1D"}
|