@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
|
@@ -1,185 +0,0 @@
|
|
|
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.generateDataSource = void 0;
|
|
7
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
const resource_1 = require("../../resource/resource");
|
|
9
|
-
const client_appsync_1 = require("@aws-sdk/client-appsync");
|
|
10
|
-
const factory = typescript_1.default.factory;
|
|
11
|
-
const createDataSourceMapping = (schema, apiId, envName) => {
|
|
12
|
-
const models = extractModelsFromSchema(schema);
|
|
13
|
-
const mapping = {};
|
|
14
|
-
models.forEach((modelName) => {
|
|
15
|
-
mapping[modelName] = [modelName, apiId, envName].join('-');
|
|
16
|
-
});
|
|
17
|
-
return mapping;
|
|
18
|
-
};
|
|
19
|
-
const extractModelsFromSchema = (schema) => {
|
|
20
|
-
const modelRegex = /type\s+(\w+)\s+@model/g;
|
|
21
|
-
const models = [];
|
|
22
|
-
let match;
|
|
23
|
-
while ((match = modelRegex.exec(schema)) !== null) {
|
|
24
|
-
models.push(match[1]);
|
|
25
|
-
}
|
|
26
|
-
return models;
|
|
27
|
-
};
|
|
28
|
-
const getProjectName = () => {
|
|
29
|
-
try {
|
|
30
|
-
const fs = require('fs');
|
|
31
|
-
const path = require('path');
|
|
32
|
-
const { pathManager } = require('@aws-amplify/amplify-cli-core');
|
|
33
|
-
const projectRoot = pathManager.findProjectRoot();
|
|
34
|
-
if (!projectRoot)
|
|
35
|
-
return undefined;
|
|
36
|
-
const projectConfigPath = path.join(projectRoot, 'amplify', '.config', 'project-config.json');
|
|
37
|
-
if (fs.existsSync(projectConfigPath)) {
|
|
38
|
-
const projectConfig = JSON.parse(fs.readFileSync(projectConfigPath, 'utf8'));
|
|
39
|
-
return projectConfig.projectName;
|
|
40
|
-
}
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
catch (_a) {
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const getApiId = async (envName) => {
|
|
48
|
-
var _a, _b, _c;
|
|
49
|
-
const client = new client_appsync_1.AppSyncClient({});
|
|
50
|
-
const projectName = getProjectName();
|
|
51
|
-
for await (const page of (0, client_appsync_1.paginateListGraphqlApis)({ client }, {})) {
|
|
52
|
-
for (const api of (_a = page.graphqlApis) !== null && _a !== void 0 ? _a : []) {
|
|
53
|
-
const matchesEnv = ((_b = api.tags) === null || _b === void 0 ? void 0 : _b['user:Stack']) === envName;
|
|
54
|
-
const matchesProject = projectName ? ((_c = api.tags) === null || _c === void 0 ? void 0 : _c['user:Application']) === projectName : true;
|
|
55
|
-
if (matchesEnv && matchesProject) {
|
|
56
|
-
return api.apiId;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return undefined;
|
|
61
|
-
};
|
|
62
|
-
const migratedAmplifyGen1DynamoDbTableMappingsKeyName = 'migratedAmplifyGen1DynamoDbTableMappings';
|
|
63
|
-
const generateDataSource = async (gen1Env, dataDefinition) => {
|
|
64
|
-
var _a, _b, _c;
|
|
65
|
-
if (!dataDefinition) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
if (!dataDefinition.schema && (!dataDefinition.restApis || dataDefinition.restApis.length === 0)) {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
const dataRenderProperties = [];
|
|
72
|
-
const namedImports = { '@aws-amplify/backend': new Set() };
|
|
73
|
-
namedImports['@aws-amplify/backend'].add('defineData');
|
|
74
|
-
const schemaStatements = [];
|
|
75
|
-
if (dataDefinition && dataDefinition.schema) {
|
|
76
|
-
if (dataDefinition.schema.includes('${env}')) {
|
|
77
|
-
const branchNameStatement = factory.createVariableStatement([], factory.createVariableDeclarationList([
|
|
78
|
-
factory.createVariableDeclaration('branchName', undefined, undefined, factory.createIdentifier('process.env.AWS_BRANCH ?? "sandbox"')),
|
|
79
|
-
], typescript_1.default.NodeFlags.Const));
|
|
80
|
-
schemaStatements.push(branchNameStatement);
|
|
81
|
-
dataDefinition.schema = dataDefinition.schema.replaceAll('${env}', '${branchName}');
|
|
82
|
-
}
|
|
83
|
-
const schemaVariableDeclaration = factory.createVariableDeclaration('schema', undefined, undefined, factory.createIdentifier('`' + dataDefinition.schema + '`'));
|
|
84
|
-
const schemaStatementAssignment = factory.createVariableStatement([], factory.createVariableDeclarationList([schemaVariableDeclaration], typescript_1.default.NodeFlags.Const));
|
|
85
|
-
schemaStatements.push(schemaStatementAssignment);
|
|
86
|
-
}
|
|
87
|
-
let tableMappings = dataDefinition === null || dataDefinition === void 0 ? void 0 : dataDefinition.tableMappings;
|
|
88
|
-
if (!tableMappings && (dataDefinition === null || dataDefinition === void 0 ? void 0 : dataDefinition.schema)) {
|
|
89
|
-
const apiId = await getApiId(gen1Env);
|
|
90
|
-
if (apiId) {
|
|
91
|
-
tableMappings = createDataSourceMapping(dataDefinition.schema, apiId, gen1Env);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (tableMappings) {
|
|
95
|
-
const tableMappingProperties = [];
|
|
96
|
-
for (const [tableName, tableId] of Object.entries(tableMappings)) {
|
|
97
|
-
tableMappingProperties.push(factory.createPropertyAssignment(factory.createIdentifier(tableName), factory.createStringLiteral(tableId)));
|
|
98
|
-
}
|
|
99
|
-
const branchNameExpression = typescript_1.default.addSyntheticLeadingComment(factory.createPropertyAssignment('branchName', factory.createStringLiteral(gen1Env)), typescript_1.default.SyntaxKind.SingleLineCommentTrivia, 'The "branchname" variable needs to be the same as your deployment branch if you want to reuse your Gen1 app tables', true);
|
|
100
|
-
const tableMappingExpression = factory.createPropertyAssignment('modelNameToTableNameMapping', factory.createObjectLiteralExpression(tableMappingProperties));
|
|
101
|
-
const tableMappingForEnvironment = factory.createObjectLiteralExpression([branchNameExpression, tableMappingExpression], true);
|
|
102
|
-
dataRenderProperties.push(factory.createPropertyAssignment(migratedAmplifyGen1DynamoDbTableMappingsKeyName, factory.createArrayLiteralExpression([tableMappingForEnvironment])));
|
|
103
|
-
}
|
|
104
|
-
if (dataDefinition === null || dataDefinition === void 0 ? void 0 : dataDefinition.authorizationModes) {
|
|
105
|
-
const gen1AuthModes = dataDefinition.authorizationModes;
|
|
106
|
-
const authModeProperties = [];
|
|
107
|
-
const authModeMap = {
|
|
108
|
-
AWS_IAM: 'iam',
|
|
109
|
-
AMAZON_COGNITO_USER_POOLS: 'userPool',
|
|
110
|
-
API_KEY: 'apiKey',
|
|
111
|
-
AWS_LAMBDA: 'lambda',
|
|
112
|
-
OPENID_CONNECT: 'oidc',
|
|
113
|
-
};
|
|
114
|
-
if ((_a = gen1AuthModes.defaultAuthentication) === null || _a === void 0 ? void 0 : _a.authenticationType) {
|
|
115
|
-
const gen2AuthMode = authModeMap[gen1AuthModes.defaultAuthentication.authenticationType] || 'userPool';
|
|
116
|
-
authModeProperties.push(factory.createPropertyAssignment('defaultAuthorizationMode', factory.createStringLiteral(gen2AuthMode)));
|
|
117
|
-
switch (gen1AuthModes.defaultAuthentication.authenticationType) {
|
|
118
|
-
case 'API_KEY':
|
|
119
|
-
if ((_b = gen1AuthModes.defaultAuthentication.apiKeyConfig) === null || _b === void 0 ? void 0 : _b.apiKeyExpirationDays) {
|
|
120
|
-
authModeProperties.push(factory.createPropertyAssignment('apiKeyAuthorizationMode', factory.createObjectLiteralExpression([
|
|
121
|
-
factory.createPropertyAssignment('expiresInDays', factory.createNumericLiteral(gen1AuthModes.defaultAuthentication.apiKeyConfig.apiKeyExpirationDays.toString())),
|
|
122
|
-
])));
|
|
123
|
-
}
|
|
124
|
-
break;
|
|
125
|
-
case 'AWS_LAMBDA':
|
|
126
|
-
if ((_c = gen1AuthModes.defaultAuthentication.lambdaAuthorizerConfig) === null || _c === void 0 ? void 0 : _c.ttlSeconds) {
|
|
127
|
-
authModeProperties.push(factory.createPropertyAssignment('lambdaAuthorizationMode', factory.createObjectLiteralExpression([
|
|
128
|
-
factory.createPropertyAssignment('timeToLiveInSeconds', factory.createNumericLiteral(gen1AuthModes.defaultAuthentication.lambdaAuthorizerConfig.ttlSeconds.toString())),
|
|
129
|
-
])));
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
case 'OPENID_CONNECT':
|
|
133
|
-
if (gen1AuthModes.defaultAuthentication.openIDConnectConfig) {
|
|
134
|
-
const oidcProps = [];
|
|
135
|
-
if (gen1AuthModes.defaultAuthentication.openIDConnectConfig.issuer) {
|
|
136
|
-
oidcProps.push(factory.createPropertyAssignment('oidcIssuerUrl', factory.createStringLiteral(gen1AuthModes.defaultAuthentication.openIDConnectConfig.issuer)));
|
|
137
|
-
}
|
|
138
|
-
if (gen1AuthModes.defaultAuthentication.openIDConnectConfig.clientId) {
|
|
139
|
-
oidcProps.push(factory.createPropertyAssignment('clientId', factory.createStringLiteral(gen1AuthModes.defaultAuthentication.openIDConnectConfig.clientId)));
|
|
140
|
-
}
|
|
141
|
-
if (oidcProps.length > 0) {
|
|
142
|
-
authModeProperties.push(factory.createPropertyAssignment('oidcAuthorizationMode', factory.createObjectLiteralExpression(oidcProps)));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (authModeProperties.length > 0) {
|
|
149
|
-
dataRenderProperties.push(factory.createPropertyAssignment('authorizationModes', factory.createObjectLiteralExpression(authModeProperties, true)));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (dataDefinition === null || dataDefinition === void 0 ? void 0 : dataDefinition.logging) {
|
|
153
|
-
if (dataDefinition.logging === true) {
|
|
154
|
-
dataRenderProperties.push(factory.createPropertyAssignment('logging', factory.createTrue()));
|
|
155
|
-
}
|
|
156
|
-
else if (typeof dataDefinition.logging === 'object') {
|
|
157
|
-
const loggingConfig = dataDefinition.logging;
|
|
158
|
-
const loggingProperties = [];
|
|
159
|
-
if (loggingConfig.fieldLogLevel !== undefined) {
|
|
160
|
-
loggingProperties.push(factory.createPropertyAssignment('fieldLogLevel', factory.createStringLiteral(loggingConfig.fieldLogLevel)));
|
|
161
|
-
}
|
|
162
|
-
if (loggingConfig.excludeVerboseContent !== undefined) {
|
|
163
|
-
loggingProperties.push(factory.createPropertyAssignment('excludeVerboseContent', loggingConfig.excludeVerboseContent ? factory.createTrue() : factory.createFalse()));
|
|
164
|
-
}
|
|
165
|
-
if (loggingConfig.retention !== undefined) {
|
|
166
|
-
loggingProperties.push(factory.createPropertyAssignment('retention', factory.createStringLiteral(loggingConfig.retention)));
|
|
167
|
-
}
|
|
168
|
-
if (loggingProperties.length > 0) {
|
|
169
|
-
dataRenderProperties.push(factory.createPropertyAssignment('logging', factory.createObjectLiteralExpression(loggingProperties)));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (dataDefinition === null || dataDefinition === void 0 ? void 0 : dataDefinition.schema) {
|
|
174
|
-
dataRenderProperties.push(factory.createShorthandPropertyAssignment(factory.createIdentifier('schema')));
|
|
175
|
-
}
|
|
176
|
-
return (0, resource_1.renderResourceTsFile)({
|
|
177
|
-
exportedVariableName: factory.createIdentifier('data'),
|
|
178
|
-
functionCallParameter: factory.createObjectLiteralExpression(dataRenderProperties, true),
|
|
179
|
-
backendFunctionConstruct: 'defineData',
|
|
180
|
-
postImportStatements: schemaStatements,
|
|
181
|
-
additionalImportedBackendIdentifiers: namedImports,
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
exports.generateDataSource = generateDataSource;
|
|
185
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/generators/data/index.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA0D;AAC1D,sDAA+D;AAC/D,4DAAiF;AAwBjF,MAAM,OAAO,GAAG,oBAAE,CAAC,OAAO,CAAC;AAW3B,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,OAAe,EAA0B,EAAE;IACzG,MAAM,MAAM,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,OAAO,GAA2B,EAAE,CAAC;IAE3C,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAE3B,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAY,EAAE;IAC3D,MAAM,UAAU,GAAG,wBAAwB,CAAC;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,CAAC;IAEV,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,GAAuB,EAAE;IAC9C,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC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C;AACL,CAAC,CAAC;AArOW,QAAA,kBAAkB,sBAqO7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/generators/data/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
-
const ts_node_printer_1 = require("../../test_utils/ts_node_printer");
|
|
8
|
-
const index_1 = require("./index");
|
|
9
|
-
describe('Data Category code generation', () => {
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
jest.spyOn(console, 'warn').mockImplementation(() => { });
|
|
12
|
-
});
|
|
13
|
-
afterEach(() => {
|
|
14
|
-
jest.restoreAllMocks();
|
|
15
|
-
});
|
|
16
|
-
it('generates the correct import', async () => {
|
|
17
|
-
const tableMappings = { Todo: 'my-todo-mapping' };
|
|
18
|
-
const source = (0, ts_node_printer_1.printNodeArray)(await (0, index_1.generateDataSource)('main', { tableMappings, schema: 'type Test { id: ID! }' }));
|
|
19
|
-
node_assert_1.default.match(source, /import\s?\{\s?defineData\s?\}\s?from\s?"\@aws-amplify\/backend"/);
|
|
20
|
-
});
|
|
21
|
-
it('returns undefined when no data definition provided', async () => {
|
|
22
|
-
const result = await (0, index_1.generateDataSource)('main');
|
|
23
|
-
node_assert_1.default.strictEqual(result, undefined);
|
|
24
|
-
});
|
|
25
|
-
it('returns undefined when no schema and no REST APIs', async () => {
|
|
26
|
-
const result = await (0, index_1.generateDataSource)('main', {});
|
|
27
|
-
node_assert_1.default.strictEqual(result, undefined);
|
|
28
|
-
});
|
|
29
|
-
describe('import map', () => {
|
|
30
|
-
it('is rendered', async () => {
|
|
31
|
-
const tableMappings = { Todo: 'my-todo-mapping' };
|
|
32
|
-
const source = (0, ts_node_printer_1.printNodeArray)(await (0, index_1.generateDataSource)('main', { tableMappings, schema: 'schema' }));
|
|
33
|
-
node_assert_1.default.match(source, /migratedAmplifyGen1DynamoDbTableMappings: \[\{\n\s+\/\/.*\n\s+branchName: ['"]\w+['"],\n\s+modelNameToTableNameMapping: { Todo: ['"]my-todo-mapping['"] }\n\s+}]/);
|
|
34
|
-
});
|
|
35
|
-
it('includes multiple models in table mappings', async () => {
|
|
36
|
-
const tableMappings = { Todo: 'Todo-abc123-dev', User: 'User-abc123-dev', Post: 'Post-abc123-dev' };
|
|
37
|
-
const source = (0, ts_node_printer_1.printNodeArray)(await (0, index_1.generateDataSource)('main', { tableMappings, schema: 'schema' }));
|
|
38
|
-
node_assert_1.default.match(source, /modelNameToTableNameMapping: { Todo: ['"]Todo-abc123-dev['"], User: ['"]User-abc123-dev['"], Post: ['"]Post-abc123-dev['"] }/);
|
|
39
|
-
});
|
|
40
|
-
it('has each each key in defineData', async () => {
|
|
41
|
-
const tableMappings = { Todo: 'my-todo-mapping' };
|
|
42
|
-
const source = (0, ts_node_printer_1.printNodeArray)(await (0, index_1.generateDataSource)('main', { tableMappings, schema: 'schema' }));
|
|
43
|
-
node_assert_1.default.match(source, /const schema = `schema`;\n\nexport const data = defineData\(\{\n\s+migratedAmplifyGen1DynamoDbTableMappings: \[\{\n\s+\/\/.*\n\s+branchName: ['"]\w+['"],\n\s+modelNameToTableNameMapping: { Todo: ['"]my-todo-mapping['"] }\n\s+}],\n\s+schema\n\}\)/);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/generators/data/index.test.ts"],"names":[],"mappings":";;;;;AAAA,8DAAiC;AACjC,sEAAkE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E,CAAC;YAClD,MAAM,MAAM,GAAG,IAAA,gCAAc,EAAC,MAAM,IAAA,0BAAkB,EAAC,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;YACrG,qBAAM,CAAC,KAAK,CACV,MAAM,EACN,kKAAkK,CACnK,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;YAC1D,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;YACpG,MAAM,MAAM,GAAG,IAAA,gCAAc,EAAC,MAAM,IAAA,0BAAkB,EAAC,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;YACrG,qBAAM,CAAC,KAAK,CACV,MAAM,EACN,8HAA8H,CAC/H,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;YAC/C,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;YAClD,MAAM,MAAM,GAAG,IAAA,gCAAc,EAAC,MAAM,IAAA,0BAAkB,EAAC,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;YACrG,qBAAM,CAAC,KAAK,CACV,MAAM,EACN,uPAAuP,CACxP,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
|
-
import type { EnvironmentResponse } from '@aws-sdk/client-lambda';
|
|
3
|
-
import { Runtime } from '@aws-sdk/client-lambda';
|
|
4
|
-
import { DataModelTableAccess } from '../../codegen-head/data_model_access_parser';
|
|
5
|
-
export interface AuthAccess {
|
|
6
|
-
manageUsers?: boolean;
|
|
7
|
-
manageGroups?: boolean;
|
|
8
|
-
manageGroupMembership?: boolean;
|
|
9
|
-
manageUserDevices?: boolean;
|
|
10
|
-
managePasswordRecovery?: boolean;
|
|
11
|
-
addUserToGroup?: boolean;
|
|
12
|
-
createUser?: boolean;
|
|
13
|
-
deleteUser?: boolean;
|
|
14
|
-
deleteUserAttributes?: boolean;
|
|
15
|
-
disableUser?: boolean;
|
|
16
|
-
enableUser?: boolean;
|
|
17
|
-
forgetDevice?: boolean;
|
|
18
|
-
getDevice?: boolean;
|
|
19
|
-
getUser?: boolean;
|
|
20
|
-
listUsers?: boolean;
|
|
21
|
-
listDevices?: boolean;
|
|
22
|
-
listGroupsForUser?: boolean;
|
|
23
|
-
listUsersInGroup?: boolean;
|
|
24
|
-
removeUserFromGroup?: boolean;
|
|
25
|
-
resetUserPassword?: boolean;
|
|
26
|
-
setUserMfaPreference?: boolean;
|
|
27
|
-
setUserPassword?: boolean;
|
|
28
|
-
setUserSettings?: boolean;
|
|
29
|
-
updateDeviceStatus?: boolean;
|
|
30
|
-
updateUserAttributes?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface FunctionDefinition {
|
|
33
|
-
category?: string;
|
|
34
|
-
entry?: string;
|
|
35
|
-
name?: string;
|
|
36
|
-
timeoutSeconds?: number;
|
|
37
|
-
memoryMB?: number;
|
|
38
|
-
environment?: EnvironmentResponse;
|
|
39
|
-
filteredEnvironmentVariables?: Record<string, string>;
|
|
40
|
-
runtime?: Runtime | string;
|
|
41
|
-
resourceName?: string;
|
|
42
|
-
schedule?: string;
|
|
43
|
-
authAccess?: AuthAccess;
|
|
44
|
-
apiPermissions?: {
|
|
45
|
-
hasQuery: boolean;
|
|
46
|
-
hasMutation: boolean;
|
|
47
|
-
hasSubscription: boolean;
|
|
48
|
-
};
|
|
49
|
-
dataModelAccess?: DataModelTableAccess[];
|
|
50
|
-
}
|
|
51
|
-
export declare function renderFunctions(definition: FunctionDefinition, appId?: string, backendEnvironmentName?: string | undefined): ts.NodeArray<ts.Node>;
|
|
52
|
-
export declare function createFunctionDefinition(definition?: FunctionDefinition, postImportStatements?: (ts.CallExpression | ts.JSDoc | ts.ExpressionStatement)[], namedImports?: Record<string, Set<string>>, appId?: string, backendEnvironmentName?: string): ts.ObjectLiteralElementLike[];
|
|
53
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/generators/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAQnF,MAAM,WAAW,UAAU;IAEzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAGjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;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C,KAAK,GAAG,EAAE,CAAC,mBAAmB,CAAC,EAAE,EAChF,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EAC1C,KAAK,CAAC,EAAE,MAAM,EACd,sBAAsB,CAAC,EAAE,MAAM,iCAuIhC"}
|
|
@@ -1,125 +0,0 @@
|
|
|
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.renderFunctions = renderFunctions;
|
|
7
|
-
exports.createFunctionDefinition = createFunctionDefinition;
|
|
8
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
10
|
-
const resource_1 = require("../../resource/resource");
|
|
11
|
-
const node_assert_1 = __importDefault(require("node:assert"));
|
|
12
|
-
const factory = typescript_1.default.factory;
|
|
13
|
-
const gen2BranchNameVariableName = 'branchName';
|
|
14
|
-
const createParameter = (name, value) => factory.createPropertyAssignment(factory.createIdentifier(name), value);
|
|
15
|
-
const createVariableStatement = (variableDeclaration) => {
|
|
16
|
-
return factory.createVariableStatement([], factory.createVariableDeclarationList([variableDeclaration], typescript_1.default.NodeFlags.Const));
|
|
17
|
-
};
|
|
18
|
-
const createTemplateLiteral = (templateHead, templateSpan, templateTail) => {
|
|
19
|
-
return factory.createTemplateExpression(factory.createTemplateHead(templateHead), [
|
|
20
|
-
factory.createTemplateSpan(factory.createIdentifier(templateSpan), factory.createTemplateTail(templateTail)),
|
|
21
|
-
]);
|
|
22
|
-
};
|
|
23
|
-
function renderFunctions(definition, appId, backendEnvironmentName) {
|
|
24
|
-
const postImportStatements = [];
|
|
25
|
-
const namedImports = { '@aws-amplify/backend': new Set() };
|
|
26
|
-
namedImports['@aws-amplify/backend'].add('defineFunction');
|
|
27
|
-
const defineFunctionProperty = createFunctionDefinition(definition, postImportStatements, namedImports, appId, backendEnvironmentName);
|
|
28
|
-
const amplifyGen1EnvStatement = createVariableStatement(factory.createVariableDeclaration(gen2BranchNameVariableName, undefined, undefined, factory.createIdentifier('process.env.AWS_BRANCH ?? "sandbox"')));
|
|
29
|
-
postImportStatements.push(amplifyGen1EnvStatement);
|
|
30
|
-
return (0, resource_1.renderResourceTsFile)({
|
|
31
|
-
exportedVariableName: factory.createIdentifier((definition === null || definition === void 0 ? void 0 : definition.resourceName) || 'sayHello'),
|
|
32
|
-
functionCallParameter: factory.createObjectLiteralExpression(defineFunctionProperty, true),
|
|
33
|
-
backendFunctionConstruct: 'defineFunction',
|
|
34
|
-
additionalImportedBackendIdentifiers: namedImports,
|
|
35
|
-
postImportStatements,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function createFunctionDefinition(definition, postImportStatements, namedImports, appId, backendEnvironmentName) {
|
|
39
|
-
var _a;
|
|
40
|
-
const defineFunctionProperties = [];
|
|
41
|
-
const entryPoint = (definition === null || definition === void 0 ? void 0 : definition.entry) || './index.js';
|
|
42
|
-
defineFunctionProperties.push(createParameter('entry', factory.createStringLiteral(entryPoint)));
|
|
43
|
-
if (definition === null || definition === void 0 ? void 0 : definition.name) {
|
|
44
|
-
const funcNameAssignment = createTemplateLiteral(`${definition.resourceName}-`, gen2BranchNameVariableName, '');
|
|
45
|
-
defineFunctionProperties.push(createParameter('name', funcNameAssignment));
|
|
46
|
-
}
|
|
47
|
-
if (definition === null || definition === void 0 ? void 0 : definition.timeoutSeconds) {
|
|
48
|
-
defineFunctionProperties.push(createParameter('timeoutSeconds', factory.createNumericLiteral(definition.timeoutSeconds)));
|
|
49
|
-
}
|
|
50
|
-
if (definition === null || definition === void 0 ? void 0 : definition.memoryMB) {
|
|
51
|
-
defineFunctionProperties.push(createParameter('memoryMB', factory.createNumericLiteral(definition.memoryMB)));
|
|
52
|
-
}
|
|
53
|
-
if ((_a = definition === null || definition === void 0 ? void 0 : definition.environment) === null || _a === void 0 ? void 0 : _a.Variables) {
|
|
54
|
-
defineFunctionProperties.push(createParameter('environment', factory.createObjectLiteralExpression(Object.entries(definition.environment.Variables).map(([key, value]) => {
|
|
55
|
-
if (key == 'API_KEY' && value.startsWith(`/amplify/${appId}/${backendEnvironmentName}`)) {
|
|
56
|
-
if (namedImports && namedImports['@aws-amplify/backend']) {
|
|
57
|
-
namedImports['@aws-amplify/backend'].add('secret');
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
const namedImports = { '@aws-amplify/backend': new Set() };
|
|
61
|
-
namedImports['@aws-amplify/backend'].add('secret');
|
|
62
|
-
}
|
|
63
|
-
return factory.createPropertyAssignment(key, factory.createCallExpression(factory.createIdentifier('secret'), undefined, [factory.createStringLiteral('API_KEY')]));
|
|
64
|
-
}
|
|
65
|
-
else if (key == 'ENV') {
|
|
66
|
-
const envNameAssignment = createTemplateLiteral('', gen2BranchNameVariableName, '');
|
|
67
|
-
return createParameter(key, envNameAssignment);
|
|
68
|
-
}
|
|
69
|
-
return createParameter(key, factory.createStringLiteral(value));
|
|
70
|
-
}))));
|
|
71
|
-
}
|
|
72
|
-
const runtime = definition === null || definition === void 0 ? void 0 : definition.runtime;
|
|
73
|
-
if (runtime && runtime.includes('nodejs')) {
|
|
74
|
-
let nodeRuntime;
|
|
75
|
-
switch (runtime) {
|
|
76
|
-
case client_lambda_1.Runtime.nodejs16x:
|
|
77
|
-
nodeRuntime = 16;
|
|
78
|
-
break;
|
|
79
|
-
case client_lambda_1.Runtime.nodejs18x:
|
|
80
|
-
nodeRuntime = 18;
|
|
81
|
-
break;
|
|
82
|
-
case client_lambda_1.Runtime.nodejs20x:
|
|
83
|
-
nodeRuntime = 20;
|
|
84
|
-
break;
|
|
85
|
-
case 'nodejs22x':
|
|
86
|
-
case client_lambda_1.Runtime.nodejs22x:
|
|
87
|
-
nodeRuntime = 22;
|
|
88
|
-
break;
|
|
89
|
-
default:
|
|
90
|
-
throw new Error(`Unsupported nodejs runtime for function: ${runtime}`);
|
|
91
|
-
}
|
|
92
|
-
(0, node_assert_1.default)(nodeRuntime, 'Expected nodejs version to be set');
|
|
93
|
-
defineFunctionProperties.push(createParameter('runtime', factory.createNumericLiteral(nodeRuntime)));
|
|
94
|
-
}
|
|
95
|
-
if (definition === null || definition === void 0 ? void 0 : definition.schedule) {
|
|
96
|
-
const rawScheduleExpression = definition.schedule;
|
|
97
|
-
let scheduleExpression;
|
|
98
|
-
const startIndex = rawScheduleExpression.indexOf('(') + 1;
|
|
99
|
-
const endIndex = rawScheduleExpression.lastIndexOf(')');
|
|
100
|
-
const scheduleValue = startIndex > 0 && endIndex > startIndex ? rawScheduleExpression.slice(startIndex, endIndex) : undefined;
|
|
101
|
-
if (rawScheduleExpression === null || rawScheduleExpression === void 0 ? void 0 : rawScheduleExpression.startsWith('rate(')) {
|
|
102
|
-
const rateValue = scheduleValue;
|
|
103
|
-
if (rateValue) {
|
|
104
|
-
const [value, unit] = rateValue.split(' ');
|
|
105
|
-
const unitMap = {
|
|
106
|
-
minute: 'm',
|
|
107
|
-
minutes: 'm',
|
|
108
|
-
hour: 'h',
|
|
109
|
-
hours: 'h',
|
|
110
|
-
day: 'd',
|
|
111
|
-
days: 'd',
|
|
112
|
-
};
|
|
113
|
-
scheduleExpression = `every ${value}${unitMap[unit]}`;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else if (rawScheduleExpression === null || rawScheduleExpression === void 0 ? void 0 : rawScheduleExpression.startsWith('cron(')) {
|
|
117
|
-
scheduleExpression = scheduleValue;
|
|
118
|
-
}
|
|
119
|
-
if (scheduleExpression) {
|
|
120
|
-
defineFunctionProperties.push(createParameter('schedule', factory.createStringLiteral(scheduleExpression)));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return defineFunctionProperties;
|
|
124
|
-
}
|
|
125
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":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B,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;QAC9G,CAAC;IACH,CAAC;IAGD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/generators/functions/lambda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAIF,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,0BAWtE,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
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.createTriggersProperty = void 0;
|
|
7
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
const factory = typescript_1.default.factory;
|
|
9
|
-
const createTriggersProperty = (triggers) => {
|
|
10
|
-
return factory.createPropertyAssignment(factory.createIdentifier('triggers'), factory.createObjectLiteralExpression(Object.entries(triggers).map(([key, value]) => {
|
|
11
|
-
const functionName = value.source.split('/')[3];
|
|
12
|
-
return factory.createPropertyAssignment(factory.createIdentifier(key), factory.createIdentifier(functionName));
|
|
13
|
-
}), true));
|
|
14
|
-
};
|
|
15
|
-
exports.createTriggersProperty = createTriggersProperty;
|
|
16
|
-
//# sourceMappingURL=lambda.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.js","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/generators/functions/lambda.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAK5B,MAAM,OAAO,GAAG,oBAAE,CAAC,OAAO,CAAC;AAEpB,MAAM,sBAAsB,GAAG,CAAC,QAAgC,EAAE,EAAE;IACzE,OAAO,OAAO,CAAC,wBAAwB,CACrC,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,EACpC,OAAO,CAAC,6BAA6B,CACnC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC5C,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;IACjH,CAAC,CAAC,EACF,IAAI,CACL,CACF,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC"}
|
package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lambda_env_generator.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/generators/functions/lambda_env_generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AA8B5B,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,mBAAmB,EAAE,CAiHrH"}
|
|
@@ -1,106 +0,0 @@
|
|
|
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.generateLambdaEnvVars = generateLambdaEnvVars;
|
|
7
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
const factory = typescript_1.default.factory;
|
|
9
|
-
const ENV_VAR_PATTERNS = {
|
|
10
|
-
'API_.*_GRAPHQLAPIENDPOINTOUTPUT': 'data.graphqlUrl',
|
|
11
|
-
'API_.*_GRAPHQLAPIIDOUTPUT': 'data.apiId',
|
|
12
|
-
'API_.*_GRAPHQLAPIKEYOUTPUT': 'data.apiKey!',
|
|
13
|
-
'API_.*TABLE_ARN': 'data.resources.tables[{table}].tableArn',
|
|
14
|
-
'API_.*TABLE_NAME': 'data.resources.tables[{table}].tableName',
|
|
15
|
-
'AUTH_.*_USERPOOLID': 'auth.resources.userPool.userPoolId',
|
|
16
|
-
'STORAGE_.*_ARN': '{table}.tableArn',
|
|
17
|
-
'STORAGE_.*_NAME': '{table}.tableName',
|
|
18
|
-
'STORAGE_.*_STREAMARN': '{table}.tableStreamArn!',
|
|
19
|
-
'STORAGE_.*_BUCKETNAME': 'storage.resources.bucket.bucketName',
|
|
20
|
-
'FUNCTION_.*_NAME': '{function}.resources.lambda.functionName',
|
|
21
|
-
};
|
|
22
|
-
function generateLambdaEnvVars(functionName, envVars) {
|
|
23
|
-
const statements = [];
|
|
24
|
-
for (const [envVar] of Object.entries(envVars)) {
|
|
25
|
-
for (const [pattern, backendPath] of Object.entries(ENV_VAR_PATTERNS)) {
|
|
26
|
-
if (new RegExp(`^${pattern}$`).test(envVar)) {
|
|
27
|
-
let path = backendPath;
|
|
28
|
-
let isDirect = false;
|
|
29
|
-
if (path.includes('{table}')) {
|
|
30
|
-
let tableName;
|
|
31
|
-
if (envVar.startsWith('API_') && envVar.includes('TABLE_')) {
|
|
32
|
-
const apiMatch = envVar.match(/API_.*_(.+?)TABLE_/);
|
|
33
|
-
if (apiMatch) {
|
|
34
|
-
const rawName = apiMatch[1];
|
|
35
|
-
tableName = rawName.charAt(0).toUpperCase() + rawName.slice(1).toLowerCase();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else if (envVar.startsWith('STORAGE_')) {
|
|
39
|
-
const storageMatch = envVar.match(/STORAGE_(.+?)TABLE_/);
|
|
40
|
-
if (storageMatch) {
|
|
41
|
-
tableName = storageMatch[1].toLowerCase();
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const fallbackMatch = envVar.match(/STORAGE_(.+?)_/);
|
|
45
|
-
if (fallbackMatch) {
|
|
46
|
-
tableName = fallbackMatch[1].toLowerCase();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (tableName) {
|
|
51
|
-
path = path.replace('{table}', tableName);
|
|
52
|
-
isDirect = envVar.startsWith('STORAGE_');
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (path.includes('{function}')) {
|
|
56
|
-
const functionMatch = envVar.match(/FUNCTION_(.+?)_NAME/);
|
|
57
|
-
if (functionMatch) {
|
|
58
|
-
path = path.replace('{function}', functionMatch[1].toLowerCase());
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
let expression;
|
|
62
|
-
if (isDirect) {
|
|
63
|
-
const pathParts = path.split('.');
|
|
64
|
-
expression = factory.createIdentifier(pathParts[0]);
|
|
65
|
-
for (let i = 1; i < pathParts.length; i++) {
|
|
66
|
-
const part = pathParts[i];
|
|
67
|
-
if (part.endsWith('!')) {
|
|
68
|
-
expression = factory.createNonNullExpression(factory.createPropertyAccessExpression(expression, factory.createIdentifier(part.slice(0, -1))));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
expression = factory.createPropertyAccessExpression(expression, factory.createIdentifier(part));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
const pathParts = ['backend', ...path.split('.')];
|
|
77
|
-
expression = factory.createIdentifier(pathParts[0]);
|
|
78
|
-
for (let i = 1; i < pathParts.length; i++) {
|
|
79
|
-
const part = pathParts[i];
|
|
80
|
-
if (part.endsWith('!')) {
|
|
81
|
-
expression = factory.createNonNullExpression(factory.createPropertyAccessExpression(expression, factory.createIdentifier(part.slice(0, -1))));
|
|
82
|
-
}
|
|
83
|
-
else if (part.includes('[') && part.includes(']')) {
|
|
84
|
-
const bracketMatch = part.match(/(.+?)\[(.+?)\](.*)/);
|
|
85
|
-
if (bracketMatch) {
|
|
86
|
-
const [, beforeBracket, insideBracket, afterBracket] = bracketMatch;
|
|
87
|
-
expression = factory.createPropertyAccessExpression(expression, factory.createIdentifier(beforeBracket));
|
|
88
|
-
expression = factory.createElementAccessExpression(expression, factory.createStringLiteral(insideBracket));
|
|
89
|
-
if (afterBracket) {
|
|
90
|
-
expression = factory.createPropertyAccessExpression(expression, factory.createIdentifier(afterBracket));
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
expression = factory.createPropertyAccessExpression(expression, factory.createIdentifier(part));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
statements.push(factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createIdentifier('backend'), factory.createIdentifier(functionName)), factory.createIdentifier('addEnvironment')), undefined, [factory.createStringLiteral(envVar), expression])));
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return statements;
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=lambda_env_generator.js.map
|
package/lib/commands/gen2-migration/generate/generators/functions/lambda_env_generator.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lambda_env_generator.js","sourceRoot":"","sources":["../../../../../../src/commands/gen2-migration/generate/generators/functions/lambda_env_generator.ts"],"names":[],"mappings":";;;;;AA8BA,sDAiHC;AA/ID,4DAA4B;AAE5B,MAAM,OAAO,GAAG,oBAAE,CAAC,OAAO,CAAC;AAI3B,MAAM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