@aws-amplify/cli-internal-gen2-migration-experimental-alpha 0.1.0 → 0.2.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/aws-amplify-cli-internal-gen2-migration-experimental-alpha-0.2.0.tgz +0 -0
- package/lib/commands/drift-detection/detect-local-drift.d.ts +3 -6
- package/lib/commands/drift-detection/detect-local-drift.d.ts.map +1 -1
- package/lib/commands/drift-detection/detect-local-drift.js +4 -8
- package/lib/commands/drift-detection/detect-local-drift.js.map +1 -1
- package/lib/commands/drift-detection/detect-stack-drift.d.ts +3 -2
- package/lib/commands/drift-detection/detect-stack-drift.d.ts.map +1 -1
- package/lib/commands/drift-detection/detect-stack-drift.js +12 -0
- package/lib/commands/drift-detection/detect-stack-drift.js.map +1 -1
- package/lib/commands/drift-detection/detect-template-drift.d.ts +4 -5
- package/lib/commands/drift-detection/detect-template-drift.d.ts.map +1 -1
- package/lib/commands/drift-detection/detect-template-drift.js +122 -94
- package/lib/commands/drift-detection/detect-template-drift.js.map +1 -1
- package/lib/commands/drift-detection/index.d.ts +3 -2
- package/lib/commands/drift-detection/index.d.ts.map +1 -1
- package/lib/commands/drift-detection/index.js +3 -1
- package/lib/commands/drift-detection/index.js.map +1 -1
- package/lib/commands/drift-detection/services/cloudformation-service.d.ts.map +1 -1
- package/lib/commands/drift-detection/services/cloudformation-service.js +3 -5
- package/lib/commands/drift-detection/services/cloudformation-service.js.map +1 -1
- package/lib/commands/drift-detection/services/drift-formatter.d.ts +4 -5
- package/lib/commands/drift-detection/services/drift-formatter.d.ts.map +1 -1
- package/lib/commands/drift-detection/services/drift-formatter.js +15 -38
- package/lib/commands/drift-detection/services/drift-formatter.js.map +1 -1
- package/lib/commands/drift.d.ts +0 -2
- package/lib/commands/drift.d.ts.map +1 -1
- package/lib/commands/drift.js +47 -57
- package/lib/commands/drift.js.map +1 -1
- package/lib/commands/gen2-migration/_step.d.ts +2 -1
- package/lib/commands/gen2-migration/_step.d.ts.map +1 -1
- package/lib/commands/gen2-migration/_step.js +2 -1
- package/lib/commands/gen2-migration/_step.js.map +1 -1
- package/lib/commands/gen2-migration/generate/adapters/auth/index.d.ts +24 -0
- package/lib/commands/gen2-migration/generate/adapters/auth/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/auth/index.js +297 -0
- package/lib/commands/gen2-migration/generate/adapters/auth/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/auth/index.test.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/adapters/auth/index.test.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/auth/index.test.js +140 -0
- package/lib/commands/gen2-migration/generate/adapters/auth/index.test.js.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/data/index.d.ts +5 -0
- package/lib/commands/gen2-migration/generate/adapters/data/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/data/index.js +17 -0
- package/lib/commands/gen2-migration/generate/adapters/data/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/functions/index.d.ts +17 -0
- package/lib/commands/gen2-migration/generate/adapters/functions/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/functions/index.js +46 -0
- package/lib/commands/gen2-migration/generate/adapters/functions/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/project/index.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/adapters/project/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/project/index.js +7 -0
- package/lib/commands/gen2-migration/generate/adapters/project/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.d.ts +30 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.js +18 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.js.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.test.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.test.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.test.js +181 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/gen1_storage_codegen_adapter.test.js.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/index.d.ts +3 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/index.js +6 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.d.ts +14 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.js +27 -0
- package/lib/commands/gen2-migration/generate/adapters/storage/storage_access.js.map +1 -0
- package/lib/commands/gen2-migration/generate/backend/synthesizer.d.ts +80 -0
- package/lib/commands/gen2-migration/generate/backend/synthesizer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/backend/synthesizer.js +901 -0
- package/lib/commands/gen2-migration/generate/backend/synthesizer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/backend/synthesizer.test.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/backend/synthesizer.test.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/backend/synthesizer.test.js +700 -0
- package/lib/commands/gen2-migration/generate/backend/synthesizer.test.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/amplify_stack_parser.d.ts +14 -0
- package/lib/commands/gen2-migration/generate/codegen-head/amplify_stack_parser.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/amplify_stack_parser.js +82 -0
- package/lib/commands/gen2-migration/generate/codegen-head/amplify_stack_parser.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/analytics.d.ts +10 -0
- package/lib/commands/gen2-migration/generate/codegen-head/analytics.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/analytics.js +11 -0
- package/lib/commands/gen2-migration/generate/codegen-head/analytics.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_analytics_definition_fetcher.d.ts +13 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_analytics_definition_fetcher.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_analytics_definition_fetcher.js +22 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_analytics_definition_fetcher.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_auth_definition_fetcher.d.ts +24 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_auth_definition_fetcher.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_auth_definition_fetcher.js +167 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_auth_definition_fetcher.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_functions_definition_fetcher.d.ts +19 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_functions_definition_fetcher.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_functions_definition_fetcher.js +133 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_functions_definition_fetcher.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_storage_definition_fetcher.d.ts +23 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_storage_definition_fetcher.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_storage_definition_fetcher.js +172 -0
- package/lib/commands/gen2-migration/generate/codegen-head/app_storage_definition_fetcher.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/backend_downloader.d.ts +10 -0
- package/lib/commands/gen2-migration/generate/codegen-head/backend_downloader.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/backend_downloader.js +48 -0
- package/lib/commands/gen2-migration/generate/codegen-head/backend_downloader.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/backend_environment_selector.d.ts +11 -0
- package/lib/commands/gen2-migration/generate/codegen-head/backend_environment_selector.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/backend_environment_selector.js +38 -0
- package/lib/commands/gen2-migration/generate/codegen-head/backend_environment_selector.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/command-handlers.d.ts +13 -0
- package/lib/commands/gen2-migration/generate/codegen-head/command-handlers.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/command-handlers.js +462 -0
- package/lib/commands/gen2-migration/generate/codegen-head/command-handlers.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/data_definition_fetcher.d.ts +47 -0
- package/lib/commands/gen2-migration/generate/codegen-head/data_definition_fetcher.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/data_definition_fetcher.js +222 -0
- package/lib/commands/gen2-migration/generate/codegen-head/data_definition_fetcher.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/directory_exists.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/codegen-head/directory_exists.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/directory_exists.js +15 -0
- package/lib/commands/gen2-migration/generate/codegen-head/directory_exists.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/format.d.ts +8 -0
- package/lib/commands/gen2-migration/generate/codegen-head/format.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/format.js +66 -0
- package/lib/commands/gen2-migration/generate/codegen-head/format.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/logger.d.ts +15 -0
- package/lib/commands/gen2-migration/generate/codegen-head/logger.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/logger.js +14 -0
- package/lib/commands/gen2-migration/generate/codegen-head/logger.js.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/printer.d.ts +26 -0
- package/lib/commands/gen2-migration/generate/codegen-head/printer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/codegen-head/printer.js +103 -0
- package/lib/commands/gen2-migration/generate/codegen-head/printer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/core/migration-pipeline.d.ts +26 -0
- package/lib/commands/gen2-migration/generate/core/migration-pipeline.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/core/migration-pipeline.js +233 -0
- package/lib/commands/gen2-migration/generate/core/migration-pipeline.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/generator/backend-updater.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/generator/backend-updater.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/generator/dependency-merger.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/generator/dependency-merger.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/generator/file-converter.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/generator/file-converter.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/generator/gen2-file-generator.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/generator/gen2-file-generator.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/parser/cdk-stack-parser.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/parser/cdk-stack-parser.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/parser/pattern-detector.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/parser/pattern-detector.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/scanner/custom-resource-scanner.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/scanner/custom-resource-scanner.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/transformer/amplify-helper-transformer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/transformer/amplify-helper-transformer.js +25 -3
- package/lib/commands/gen2-migration/generate/custom-resources/transformer/amplify-helper-transformer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/types.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/custom-resources/types.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/analytics/index.d.ts +9 -0
- package/lib/commands/gen2-migration/generate/generators/analytics/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/analytics/index.js +40 -0
- package/lib/commands/gen2-migration/generate/generators/analytics/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/auth/index.d.ts +106 -0
- package/lib/commands/gen2-migration/generate/generators/auth/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/auth/index.js +286 -0
- package/lib/commands/gen2-migration/generate/generators/auth/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/auth/index.test.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/generators/auth/index.test.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/auth/index.test.js +437 -0
- package/lib/commands/gen2-migration/generate/generators/auth/index.test.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/data/index.d.ts +35 -0
- package/lib/commands/gen2-migration/generate/generators/data/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/data/index.js +199 -0
- package/lib/commands/gen2-migration/generate/generators/data/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/data/index.test.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/generators/data/index.test.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/data/index.test.js +50 -0
- package/lib/commands/gen2-migration/generate/generators/data/index.test.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/functions/index.d.ts +17 -0
- package/lib/commands/gen2-migration/generate/generators/functions/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/functions/index.js +125 -0
- package/lib/commands/gen2-migration/generate/generators/functions/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/functions/lambda.d.ts +6 -0
- package/lib/commands/gen2-migration/generate/generators/functions/lambda.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/functions/lambda.js +16 -0
- package/lib/commands/gen2-migration/generate/generators/functions/lambda.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/storage/access.d.ts +4 -0
- package/lib/commands/gen2-migration/generate/generators/storage/access.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/storage/access.js +53 -0
- package/lib/commands/gen2-migration/generate/generators/storage/access.js.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/storage/index.d.ts +31 -0
- package/lib/commands/gen2-migration/generate/generators/storage/index.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/generators/storage/index.js +66 -0
- package/lib/commands/gen2-migration/generate/generators/storage/index.js.map +1 -0
- package/lib/commands/gen2-migration/generate/npm_package/renderer.d.ts +27 -0
- package/lib/commands/gen2-migration/generate/npm_package/renderer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/npm_package/renderer.js +28 -0
- package/lib/commands/gen2-migration/generate/npm_package/renderer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/render_pipeline.d.ts +9 -0
- package/lib/commands/gen2-migration/generate/render_pipeline.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/render_pipeline.js +15 -0
- package/lib/commands/gen2-migration/generate/render_pipeline.js.map +1 -0
- package/lib/commands/gen2-migration/generate/renderers/ensure_directory.d.ts +7 -0
- package/lib/commands/gen2-migration/generate/renderers/ensure_directory.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/renderers/ensure_directory.js +17 -0
- package/lib/commands/gen2-migration/generate/renderers/ensure_directory.js.map +1 -0
- package/lib/commands/gen2-migration/generate/renderers/package_json.d.ts +8 -0
- package/lib/commands/gen2-migration/generate/renderers/package_json.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/renderers/package_json.js +15 -0
- package/lib/commands/gen2-migration/generate/renderers/package_json.js.map +1 -0
- package/lib/commands/gen2-migration/generate/renderers/typescript_block_node.d.ts +11 -0
- package/lib/commands/gen2-migration/generate/renderers/typescript_block_node.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/renderers/typescript_block_node.js +22 -0
- package/lib/commands/gen2-migration/generate/renderers/typescript_block_node.js.map +1 -0
- package/lib/commands/gen2-migration/generate/resource/resource.d.ts +20 -0
- package/lib/commands/gen2-migration/generate/resource/resource.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/resource/resource.js +60 -0
- package/lib/commands/gen2-migration/generate/resource/resource.js.map +1 -0
- package/lib/commands/gen2-migration/generate/test_utils/import_regex.d.ts +2 -0
- package/lib/commands/gen2-migration/generate/test_utils/import_regex.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/test_utils/import_regex.js +6 -0
- package/lib/commands/gen2-migration/generate/test_utils/import_regex.js.map +1 -0
- package/lib/commands/gen2-migration/generate/test_utils/ts_node_printer.d.ts +4 -0
- package/lib/commands/gen2-migration/generate/test_utils/ts_node_printer.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/test_utils/ts_node_printer.js +22 -0
- package/lib/commands/gen2-migration/generate/test_utils/ts_node_printer.js.map +1 -0
- package/lib/commands/gen2-migration/generate/todo_error.d.ts +3 -0
- package/lib/commands/gen2-migration/generate/todo_error.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/todo_error.js +11 -0
- package/lib/commands/gen2-migration/generate/todo_error.js.map +1 -0
- package/lib/commands/gen2-migration/generate/ts_factory_utils.d.ts +3 -0
- package/lib/commands/gen2-migration/generate/ts_factory_utils.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/ts_factory_utils.js +10 -0
- package/lib/commands/gen2-migration/generate/ts_factory_utils.js.map +1 -0
- package/lib/commands/gen2-migration/generate/types.d.ts +4 -0
- package/lib/commands/gen2-migration/generate/types.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/types.js +3 -0
- package/lib/commands/gen2-migration/generate/types.js.map +1 -0
- package/lib/commands/gen2-migration/generate/unsupported/cdk-from-cfn.d.ts +26 -0
- package/lib/commands/gen2-migration/generate/unsupported/cdk-from-cfn.d.ts.map +1 -0
- package/lib/commands/gen2-migration/generate/unsupported/cdk-from-cfn.js +152 -0
- package/lib/commands/gen2-migration/generate/unsupported/cdk-from-cfn.js.map +1 -0
- package/lib/commands/gen2-migration/generate.js +2 -2
- package/lib/commands/gen2-migration/generate.js.map +1 -1
- package/lib/commands/gen2-migration.d.ts.map +1 -1
- package/lib/commands/gen2-migration.js +2 -1
- package/lib/commands/gen2-migration.js.map +1 -1
- package/package.json +2 -1
- package/aws-amplify-cli-internal-gen2-migration-experimental-alpha-0.1.0.tgz +0 -0
- package/lib/commands/gen2-migration/codegen-custom-resources/generator/backend-updater.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/generator/backend-updater.js.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/generator/dependency-merger.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/generator/dependency-merger.js.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/generator/file-converter.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/generator/file-converter.js.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/generator/gen2-file-generator.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/generator/gen2-file-generator.js.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/parser/cdk-stack-parser.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/parser/cdk-stack-parser.js.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/parser/pattern-detector.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/parser/pattern-detector.js.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/scanner/custom-resource-scanner.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/scanner/custom-resource-scanner.js.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/transformer/amplify-helper-transformer.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/transformer/amplify-helper-transformer.js.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/types.d.ts.map +0 -1
- package/lib/commands/gen2-migration/codegen-custom-resources/types.js.map +0 -1
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/generator/backend-updater.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/generator/backend-updater.js +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/generator/dependency-merger.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/generator/dependency-merger.js +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/generator/file-converter.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/generator/file-converter.js +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/generator/gen2-file-generator.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/generator/gen2-file-generator.js +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/parser/cdk-stack-parser.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/parser/cdk-stack-parser.js +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/parser/pattern-detector.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/parser/pattern-detector.js +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/scanner/custom-resource-scanner.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/scanner/custom-resource-scanner.js +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/transformer/amplify-helper-transformer.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/types.d.ts +0 -0
- /package/lib/commands/gen2-migration/{codegen-custom-resources → generate/custom-resources}/types.js +0 -0
|
@@ -0,0 +1,700 @@
|
|
|
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 globals_1 = require("@jest/globals");
|
|
7
|
+
const synthesizer_1 = require("./synthesizer");
|
|
8
|
+
const ts_node_printer_1 = require("../test_utils/ts_node_printer");
|
|
9
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
10
|
+
(0, globals_1.describe)('BackendSynthesizer', () => {
|
|
11
|
+
let synthesizer;
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
synthesizer = new synthesizer_1.BackendSynthesizer();
|
|
14
|
+
});
|
|
15
|
+
(0, globals_1.describe)('AppSync API Generation', () => {
|
|
16
|
+
(0, globals_1.it)('should set awsRegion to a dynamic value from backend', () => {
|
|
17
|
+
const renderArgs = {
|
|
18
|
+
data: {
|
|
19
|
+
importFrom: './data/resource',
|
|
20
|
+
additionalAuthProviders: [
|
|
21
|
+
{
|
|
22
|
+
authenticationType: 'AMAZON_COGNITO_USER_POOLS',
|
|
23
|
+
userPoolConfig: {
|
|
24
|
+
awsRegion: 'us-east-1',
|
|
25
|
+
userPoolId: 'userpool_1234',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
auth: {
|
|
31
|
+
importFrom: './auth/resource',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const result = synthesizer.render(renderArgs);
|
|
35
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
36
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
37
|
+
"import { auth } from "./auth/resource";
|
|
38
|
+
import { data } from "./data/resource";
|
|
39
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const backend = defineBackend({
|
|
43
|
+
auth,
|
|
44
|
+
data
|
|
45
|
+
});
|
|
46
|
+
const cfnGraphqlApi = backend.data.resources.cfnResources.cfnGraphqlApi;
|
|
47
|
+
cfnGraphqlApi.additionalAuthenticationProviders = [
|
|
48
|
+
{
|
|
49
|
+
authenticationType: "AMAZON_COGNITO_USER_POOLS",
|
|
50
|
+
userPoolConfig: {
|
|
51
|
+
awsRegion: backend.auth.resources.userPool.stack.region,
|
|
52
|
+
userPoolId: backend.auth.resources.userPool.userPoolId
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
"
|
|
57
|
+
`);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
(0, globals_1.describe)('REST API Generation', () => {
|
|
61
|
+
(0, globals_1.it)('should generate HttpApi with CORS configuration', () => {
|
|
62
|
+
const renderArgs = {
|
|
63
|
+
data: {
|
|
64
|
+
importFrom: './data/resource',
|
|
65
|
+
restApis: [
|
|
66
|
+
{
|
|
67
|
+
apiName: 'testapi',
|
|
68
|
+
functionName: 'testFunction',
|
|
69
|
+
paths: [
|
|
70
|
+
{
|
|
71
|
+
path: '/items',
|
|
72
|
+
methods: ['GET', 'POST'],
|
|
73
|
+
authType: 'private',
|
|
74
|
+
lambdaFunction: 'testFunction',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
function: {
|
|
81
|
+
importFrom: './function/resource',
|
|
82
|
+
functionNamesAndCategories: new Map([['testFunction', 'function']]),
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
const result = synthesizer.render(renderArgs);
|
|
86
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
87
|
+
const printer = typescript_1.default.createPrinter();
|
|
88
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
89
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod');
|
|
90
|
+
(0, globals_1.expect)(output).toContain('aws-cdk-lib/aws-apigatewayv2');
|
|
91
|
+
(0, globals_1.expect)(output).toContain('corsPreflight');
|
|
92
|
+
(0, globals_1.expect)(output).toContain('allowMethods');
|
|
93
|
+
(0, globals_1.expect)(output).toContain('allowOrigins');
|
|
94
|
+
(0, globals_1.expect)(output).toContain('allowHeaders');
|
|
95
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.GET');
|
|
96
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.POST');
|
|
97
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.PUT');
|
|
98
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.DELETE');
|
|
99
|
+
});
|
|
100
|
+
(0, globals_1.it)('should map auth types to correct authorizers', () => {
|
|
101
|
+
const renderArgs = {
|
|
102
|
+
data: {
|
|
103
|
+
importFrom: './data/resource',
|
|
104
|
+
restApis: [
|
|
105
|
+
{
|
|
106
|
+
apiName: 'testapi',
|
|
107
|
+
functionName: 'testFunction',
|
|
108
|
+
paths: [
|
|
109
|
+
{
|
|
110
|
+
path: '/private',
|
|
111
|
+
methods: ['GET'],
|
|
112
|
+
authType: 'private',
|
|
113
|
+
lambdaFunction: 'testFunction',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
path: '/protected',
|
|
117
|
+
methods: ['POST'],
|
|
118
|
+
authType: 'protected',
|
|
119
|
+
lambdaFunction: 'testFunction',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
path: '/open',
|
|
123
|
+
methods: ['GET'],
|
|
124
|
+
authType: 'open',
|
|
125
|
+
lambdaFunction: 'testFunction',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
function: {
|
|
132
|
+
importFrom: './function/resource',
|
|
133
|
+
functionNamesAndCategories: new Map([['testFunction', 'function']]),
|
|
134
|
+
},
|
|
135
|
+
auth: {
|
|
136
|
+
importFrom: './auth/resource',
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
const result = synthesizer.render(renderArgs);
|
|
140
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
141
|
+
const printer = typescript_1.default.createPrinter();
|
|
142
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
143
|
+
(0, globals_1.expect)(output).toContain('HttpIamAuthorizer');
|
|
144
|
+
(0, globals_1.expect)(output).toContain('HttpUserPoolAuthorizer');
|
|
145
|
+
(0, globals_1.expect)(output).toContain('authorizer: iamAuthorizer');
|
|
146
|
+
(0, globals_1.expect)(output).toContain('authorizer: userPoolAuthorizer');
|
|
147
|
+
});
|
|
148
|
+
(0, globals_1.it)('should generate unique integration names per function', () => {
|
|
149
|
+
const renderArgs = {
|
|
150
|
+
data: {
|
|
151
|
+
importFrom: './data/resource',
|
|
152
|
+
restApis: [
|
|
153
|
+
{
|
|
154
|
+
apiName: 'testapi',
|
|
155
|
+
functionName: 'function1',
|
|
156
|
+
paths: [
|
|
157
|
+
{
|
|
158
|
+
path: '/items',
|
|
159
|
+
methods: ['GET'],
|
|
160
|
+
authType: 'open',
|
|
161
|
+
lambdaFunction: 'function1',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
path: '/books',
|
|
165
|
+
methods: ['POST'],
|
|
166
|
+
authType: 'open',
|
|
167
|
+
lambdaFunction: 'function2',
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
function: {
|
|
174
|
+
importFrom: './function/resource',
|
|
175
|
+
functionNamesAndCategories: new Map([
|
|
176
|
+
['function1', 'function'],
|
|
177
|
+
['function2', 'function'],
|
|
178
|
+
]),
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
const result = synthesizer.render(renderArgs);
|
|
182
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
183
|
+
const printer = typescript_1.default.createPrinter();
|
|
184
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
185
|
+
(0, globals_1.expect)(output).toContain('function1Integration');
|
|
186
|
+
(0, globals_1.expect)(output).toContain('function2Integration');
|
|
187
|
+
(0, globals_1.expect)(output).toContain('backend.function1.resources');
|
|
188
|
+
(0, globals_1.expect)(output).toContain('backend.function2.resources');
|
|
189
|
+
});
|
|
190
|
+
(0, globals_1.it)('should respect HTTP methods from path configuration', () => {
|
|
191
|
+
const renderArgs = {
|
|
192
|
+
data: {
|
|
193
|
+
importFrom: './data/resource',
|
|
194
|
+
restApis: [
|
|
195
|
+
{
|
|
196
|
+
apiName: 'testapi',
|
|
197
|
+
functionName: 'testFunction',
|
|
198
|
+
paths: [
|
|
199
|
+
{
|
|
200
|
+
path: '/items',
|
|
201
|
+
methods: ['GET', 'POST'],
|
|
202
|
+
authType: 'open',
|
|
203
|
+
lambdaFunction: 'testFunction',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
path: '/books',
|
|
207
|
+
methods: ['PUT', 'DELETE'],
|
|
208
|
+
authType: 'open',
|
|
209
|
+
lambdaFunction: 'testFunction',
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
function: {
|
|
216
|
+
importFrom: './function/resource',
|
|
217
|
+
functionNamesAndCategories: new Map([['testFunction', 'function']]),
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
const result = synthesizer.render(renderArgs);
|
|
221
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
222
|
+
const printer = typescript_1.default.createPrinter();
|
|
223
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
224
|
+
(0, globals_1.expect)(output).toContain('HttpMethod.GET');
|
|
225
|
+
(0, globals_1.expect)(output).toContain('HttpMethod.POST');
|
|
226
|
+
(0, globals_1.expect)(output).toContain('HttpMethod.PUT');
|
|
227
|
+
(0, globals_1.expect)(output).toContain('HttpMethod.DELETE');
|
|
228
|
+
(0, globals_1.expect)(output).not.toContain('HttpMethod.PATCH');
|
|
229
|
+
(0, globals_1.expect)(output).not.toContain('HttpMethod.OPTIONS');
|
|
230
|
+
});
|
|
231
|
+
(0, globals_1.it)('should generate IAM policy for all HttpApis', () => {
|
|
232
|
+
const renderArgs = {
|
|
233
|
+
data: {
|
|
234
|
+
importFrom: './data/resource',
|
|
235
|
+
restApis: [
|
|
236
|
+
{
|
|
237
|
+
apiName: 'testapi',
|
|
238
|
+
functionName: 'testFunction',
|
|
239
|
+
paths: [
|
|
240
|
+
{
|
|
241
|
+
path: '/items',
|
|
242
|
+
methods: ['GET'],
|
|
243
|
+
authType: 'open',
|
|
244
|
+
lambdaFunction: 'testFunction',
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
},
|
|
250
|
+
function: {
|
|
251
|
+
importFrom: './function/resource',
|
|
252
|
+
functionNamesAndCategories: new Map([['testFunction', 'function']]),
|
|
253
|
+
},
|
|
254
|
+
auth: {
|
|
255
|
+
importFrom: './auth/resource',
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
const result = synthesizer.render(renderArgs);
|
|
259
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
260
|
+
const printer = typescript_1.default.createPrinter();
|
|
261
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
262
|
+
(0, globals_1.expect)(output).toContain('Policy');
|
|
263
|
+
(0, globals_1.expect)(output).toContain('PolicyStatement');
|
|
264
|
+
(0, globals_1.expect)(output).toContain('execute-api:Invoke');
|
|
265
|
+
(0, globals_1.expect)(output).toContain('arnForExecuteApi');
|
|
266
|
+
(0, globals_1.expect)(output).toContain('authenticatedUserIamRole');
|
|
267
|
+
(0, globals_1.expect)(output).toContain('unauthenticatedUserIamRole');
|
|
268
|
+
(0, globals_1.expect)(output).toContain('attachInlinePolicy');
|
|
269
|
+
});
|
|
270
|
+
(0, globals_1.it)('should generate backend output for client configuration', () => {
|
|
271
|
+
const renderArgs = {
|
|
272
|
+
data: {
|
|
273
|
+
importFrom: './data/resource',
|
|
274
|
+
restApis: [
|
|
275
|
+
{
|
|
276
|
+
apiName: 'testapi',
|
|
277
|
+
functionName: 'testFunction',
|
|
278
|
+
paths: [
|
|
279
|
+
{
|
|
280
|
+
path: '/items',
|
|
281
|
+
methods: ['GET'],
|
|
282
|
+
authType: 'open',
|
|
283
|
+
lambdaFunction: 'testFunction',
|
|
284
|
+
},
|
|
285
|
+
],
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
function: {
|
|
290
|
+
importFrom: './function/resource',
|
|
291
|
+
functionNamesAndCategories: new Map([['testFunction', 'function']]),
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
const result = synthesizer.render(renderArgs);
|
|
295
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
296
|
+
const printer = typescript_1.default.createPrinter();
|
|
297
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
298
|
+
(0, globals_1.expect)(output).toContain('backend.addOutput');
|
|
299
|
+
(0, globals_1.expect)(output).toContain('api');
|
|
300
|
+
(0, globals_1.expect)(output).toContain('REST');
|
|
301
|
+
(0, globals_1.expect)(output).toContain('endpoint');
|
|
302
|
+
(0, globals_1.expect)(output).toContain('region');
|
|
303
|
+
});
|
|
304
|
+
(0, globals_1.it)('should skip routes for non-existent functions', () => {
|
|
305
|
+
const renderArgs = {
|
|
306
|
+
data: {
|
|
307
|
+
importFrom: './data/resource',
|
|
308
|
+
restApis: [
|
|
309
|
+
{
|
|
310
|
+
apiName: 'testapi',
|
|
311
|
+
functionName: 'existingFunction',
|
|
312
|
+
paths: [
|
|
313
|
+
{
|
|
314
|
+
path: '/items',
|
|
315
|
+
methods: ['GET'],
|
|
316
|
+
authType: 'open',
|
|
317
|
+
lambdaFunction: 'existingFunction',
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
path: '/missing',
|
|
321
|
+
methods: ['GET'],
|
|
322
|
+
authType: 'open',
|
|
323
|
+
lambdaFunction: 'nonExistentFunction',
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
},
|
|
329
|
+
function: {
|
|
330
|
+
importFrom: './function/resource',
|
|
331
|
+
functionNamesAndCategories: new Map([['existingFunction', 'function']]),
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
const result = synthesizer.render(renderArgs);
|
|
335
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
336
|
+
const printer = typescript_1.default.createPrinter();
|
|
337
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
338
|
+
(0, globals_1.expect)(output).toContain('/items');
|
|
339
|
+
(0, globals_1.expect)(output).toContain('existingFunction');
|
|
340
|
+
(0, globals_1.expect)(output).not.toContain('/missing');
|
|
341
|
+
(0, globals_1.expect)(output).not.toContain('nonExistentFunction');
|
|
342
|
+
});
|
|
343
|
+
(0, globals_1.it)('should respect CORS configuration from Gen1 project', () => {
|
|
344
|
+
const renderArgs = {
|
|
345
|
+
data: {
|
|
346
|
+
importFrom: './data/resource',
|
|
347
|
+
restApis: [
|
|
348
|
+
{
|
|
349
|
+
apiName: 'testapi',
|
|
350
|
+
functionName: 'testFunction',
|
|
351
|
+
paths: [
|
|
352
|
+
{
|
|
353
|
+
path: '/items',
|
|
354
|
+
methods: ['GET'],
|
|
355
|
+
authType: 'open',
|
|
356
|
+
lambdaFunction: 'testFunction',
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
corsConfiguration: {
|
|
360
|
+
allowOrigins: ['https://example.com'],
|
|
361
|
+
allowMethods: ['GET', 'POST'],
|
|
362
|
+
allowHeaders: ['content-type', 'authorization'],
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
},
|
|
367
|
+
function: {
|
|
368
|
+
importFrom: './function/resource',
|
|
369
|
+
functionNamesAndCategories: new Map([['testFunction', 'function']]),
|
|
370
|
+
},
|
|
371
|
+
};
|
|
372
|
+
const result = synthesizer.render(renderArgs);
|
|
373
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
374
|
+
const printer = typescript_1.default.createPrinter();
|
|
375
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
376
|
+
(0, globals_1.expect)(output).toContain('https://example.com');
|
|
377
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.GET');
|
|
378
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.POST');
|
|
379
|
+
(0, globals_1.expect)(output).toContain('content-type');
|
|
380
|
+
(0, globals_1.expect)(output).toContain('authorization');
|
|
381
|
+
(0, globals_1.expect)(output).not.toContain('CorsHttpMethod.ANY');
|
|
382
|
+
});
|
|
383
|
+
(0, globals_1.it)('should use default CORS configuration when not specified in Gen1', () => {
|
|
384
|
+
const renderArgs = {
|
|
385
|
+
data: {
|
|
386
|
+
importFrom: './data/resource',
|
|
387
|
+
restApis: [
|
|
388
|
+
{
|
|
389
|
+
apiName: 'testapi',
|
|
390
|
+
functionName: 'testFunction',
|
|
391
|
+
paths: [
|
|
392
|
+
{
|
|
393
|
+
path: '/items',
|
|
394
|
+
methods: ['GET'],
|
|
395
|
+
authType: 'open',
|
|
396
|
+
lambdaFunction: 'testFunction',
|
|
397
|
+
},
|
|
398
|
+
],
|
|
399
|
+
},
|
|
400
|
+
],
|
|
401
|
+
},
|
|
402
|
+
function: {
|
|
403
|
+
importFrom: './function/resource',
|
|
404
|
+
functionNamesAndCategories: new Map([['testFunction', 'function']]),
|
|
405
|
+
},
|
|
406
|
+
};
|
|
407
|
+
const result = synthesizer.render(renderArgs);
|
|
408
|
+
const sourceFile = typescript_1.default.createSourceFile('test.ts', '', typescript_1.default.ScriptTarget.Latest);
|
|
409
|
+
const printer = typescript_1.default.createPrinter();
|
|
410
|
+
const output = printer.printList(typescript_1.default.ListFormat.SourceFileStatements, result, sourceFile);
|
|
411
|
+
(0, globals_1.expect)(output).toContain('corsPreflight');
|
|
412
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.GET');
|
|
413
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.POST');
|
|
414
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.PUT');
|
|
415
|
+
(0, globals_1.expect)(output).toContain('CorsHttpMethod.DELETE');
|
|
416
|
+
(0, globals_1.expect)(output).toContain('content-type');
|
|
417
|
+
(0, globals_1.expect)(output).toContain('authorization');
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
(0, globals_1.describe)('DynamoDB table generation', () => {
|
|
421
|
+
(0, globals_1.it)('should generate table with underscores in name', () => {
|
|
422
|
+
const tableDefinition = {
|
|
423
|
+
tableName: 'countsTable-dev',
|
|
424
|
+
partitionKey: { name: 'postId', type: 'STRING' },
|
|
425
|
+
sortKey: { name: 'metricType', type: 'STRING' },
|
|
426
|
+
billingMode: 'PROVISIONED',
|
|
427
|
+
readCapacity: 5,
|
|
428
|
+
writeCapacity: 5,
|
|
429
|
+
};
|
|
430
|
+
const result = synthesizer.render({
|
|
431
|
+
storage: {
|
|
432
|
+
importFrom: './storage/resource',
|
|
433
|
+
dynamoTables: [tableDefinition],
|
|
434
|
+
},
|
|
435
|
+
});
|
|
436
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
437
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
438
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
439
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
const backend = defineBackend({});
|
|
443
|
+
const storageStack = backend.createStack("storage");
|
|
444
|
+
new Table(storageStack, "countsTable", { partitionKey: { name: "postId", type: AttributeType.STRING }, billingMode: BillingMode.PROVISIONED, readCapacity: 5, writeCapacity: 5, sortKey: { name: "metricType", type: AttributeType.STRING } });
|
|
445
|
+
"
|
|
446
|
+
`);
|
|
447
|
+
});
|
|
448
|
+
(0, globals_1.it)('should generate table with partition key and sort key', () => {
|
|
449
|
+
const tableDefinition = {
|
|
450
|
+
tableName: 'testTable',
|
|
451
|
+
partitionKey: { name: 'id', type: 'STRING' },
|
|
452
|
+
sortKey: { name: 'timestamp', type: 'NUMBER' },
|
|
453
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
454
|
+
};
|
|
455
|
+
const result = synthesizer.render({
|
|
456
|
+
storage: {
|
|
457
|
+
importFrom: './storage/resource',
|
|
458
|
+
dynamoTables: [tableDefinition],
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
462
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
463
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
464
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
const backend = defineBackend({});
|
|
468
|
+
const storageStack = backend.createStack("storage");
|
|
469
|
+
new Table(storageStack, "testTable", { partitionKey: { name: "id", type: AttributeType.STRING }, billingMode: BillingMode.PAY_PER_REQUEST, sortKey: { name: "timestamp", type: AttributeType.NUMBER } });
|
|
470
|
+
"
|
|
471
|
+
`);
|
|
472
|
+
});
|
|
473
|
+
(0, globals_1.it)('should generate table with GSI', () => {
|
|
474
|
+
const tableDefinition = {
|
|
475
|
+
tableName: 'testTable',
|
|
476
|
+
partitionKey: { name: 'id', type: 'STRING' },
|
|
477
|
+
billingMode: 'PROVISIONED',
|
|
478
|
+
readCapacity: 5,
|
|
479
|
+
writeCapacity: 5,
|
|
480
|
+
gsis: [
|
|
481
|
+
{
|
|
482
|
+
indexName: 'testIndex',
|
|
483
|
+
partitionKey: { name: 'gsiPK', type: 'STRING' },
|
|
484
|
+
sortKey: { name: 'gsiSK', type: 'NUMBER' },
|
|
485
|
+
},
|
|
486
|
+
],
|
|
487
|
+
};
|
|
488
|
+
const result = synthesizer.render({
|
|
489
|
+
storage: {
|
|
490
|
+
importFrom: './storage/resource',
|
|
491
|
+
dynamoTables: [tableDefinition],
|
|
492
|
+
},
|
|
493
|
+
});
|
|
494
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
495
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
496
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
497
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
const backend = defineBackend({});
|
|
501
|
+
const storageStack = backend.createStack("storage");
|
|
502
|
+
const testTable = new Table(storageStack, "testTable", { partitionKey: { name: "id", type: AttributeType.STRING }, billingMode: BillingMode.PROVISIONED, readCapacity: 5, writeCapacity: 5 });
|
|
503
|
+
testTable.addGlobalSecondaryIndex({ indexName: "testIndex", partitionKey: { name: "gsiPK", type: AttributeType.STRING }, sortKey: { name: "gsiSK", type: AttributeType.NUMBER }, readCapacity: 5, writeCapacity: 5 });
|
|
504
|
+
"
|
|
505
|
+
`);
|
|
506
|
+
});
|
|
507
|
+
(0, globals_1.it)('should generate table with stream configuration', () => {
|
|
508
|
+
const tableDefinition = {
|
|
509
|
+
tableName: 'streamTable',
|
|
510
|
+
partitionKey: { name: 'id', type: 'STRING' },
|
|
511
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
512
|
+
streamEnabled: true,
|
|
513
|
+
streamViewType: 'NEW_AND_OLD_IMAGES',
|
|
514
|
+
};
|
|
515
|
+
const result = synthesizer.render({
|
|
516
|
+
storage: {
|
|
517
|
+
importFrom: './storage/resource',
|
|
518
|
+
dynamoTables: [tableDefinition],
|
|
519
|
+
},
|
|
520
|
+
});
|
|
521
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
522
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
523
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
524
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
const backend = defineBackend({});
|
|
528
|
+
const storageStack = backend.createStack("storage");
|
|
529
|
+
new Table(storageStack, "streamTable", { partitionKey: { name: "id", type: AttributeType.STRING }, billingMode: BillingMode.PAY_PER_REQUEST, stream: StreamViewType.NEW_AND_OLD_IMAGES });
|
|
530
|
+
"
|
|
531
|
+
`);
|
|
532
|
+
});
|
|
533
|
+
(0, globals_1.it)('should handle multiple tables with different configurations', () => {
|
|
534
|
+
const tables = [
|
|
535
|
+
{
|
|
536
|
+
tableName: 'table-one',
|
|
537
|
+
partitionKey: { name: 'pk1', type: 'STRING' },
|
|
538
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
tableName: 'table-two',
|
|
542
|
+
partitionKey: { name: 'pk2', type: 'NUMBER' },
|
|
543
|
+
sortKey: { name: 'sk2', type: 'STRING' },
|
|
544
|
+
billingMode: 'PROVISIONED',
|
|
545
|
+
readCapacity: 10,
|
|
546
|
+
writeCapacity: 10,
|
|
547
|
+
},
|
|
548
|
+
];
|
|
549
|
+
const result = synthesizer.render({
|
|
550
|
+
storage: {
|
|
551
|
+
importFrom: './storage/resource',
|
|
552
|
+
dynamoTables: tables,
|
|
553
|
+
},
|
|
554
|
+
});
|
|
555
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
556
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
557
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
558
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
const backend = defineBackend({});
|
|
562
|
+
const storageStack = backend.createStack("storage");
|
|
563
|
+
new Table(storageStack, "table", { partitionKey: { name: "pk1", type: AttributeType.STRING }, billingMode: BillingMode.PAY_PER_REQUEST });
|
|
564
|
+
new Table(storageStack, "table", { partitionKey: { name: "pk2", type: AttributeType.NUMBER }, billingMode: BillingMode.PROVISIONED, readCapacity: 10, writeCapacity: 10, sortKey: { name: "sk2", type: AttributeType.STRING } });
|
|
565
|
+
"
|
|
566
|
+
`);
|
|
567
|
+
});
|
|
568
|
+
(0, globals_1.it)('should include required CDK imports for DynamoDB', () => {
|
|
569
|
+
const tableDefinition = {
|
|
570
|
+
tableName: 'importTest',
|
|
571
|
+
partitionKey: { name: 'id', type: 'STRING' },
|
|
572
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
573
|
+
};
|
|
574
|
+
const result = synthesizer.render({
|
|
575
|
+
storage: {
|
|
576
|
+
importFrom: './storage/resource',
|
|
577
|
+
dynamoTables: [tableDefinition],
|
|
578
|
+
},
|
|
579
|
+
});
|
|
580
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
581
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
582
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
583
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
const backend = defineBackend({});
|
|
587
|
+
const storageStack = backend.createStack("storage");
|
|
588
|
+
new Table(storageStack, "importTest", { partitionKey: { name: "id", type: AttributeType.STRING }, billingMode: BillingMode.PAY_PER_REQUEST });
|
|
589
|
+
"
|
|
590
|
+
`);
|
|
591
|
+
});
|
|
592
|
+
(0, globals_1.it)('should create storage stack when no S3 bucket exists', () => {
|
|
593
|
+
const tableDefinition = {
|
|
594
|
+
tableName: 'stackTest',
|
|
595
|
+
partitionKey: { name: 'id', type: 'STRING' },
|
|
596
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
597
|
+
};
|
|
598
|
+
const result = synthesizer.render({
|
|
599
|
+
storage: {
|
|
600
|
+
importFrom: './storage/resource',
|
|
601
|
+
dynamoTables: [tableDefinition],
|
|
602
|
+
},
|
|
603
|
+
});
|
|
604
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
605
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
606
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
607
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
const backend = defineBackend({});
|
|
611
|
+
const storageStack = backend.createStack("storage");
|
|
612
|
+
new Table(storageStack, "stackTest", { partitionKey: { name: "id", type: AttributeType.STRING }, billingMode: BillingMode.PAY_PER_REQUEST });
|
|
613
|
+
"
|
|
614
|
+
`);
|
|
615
|
+
});
|
|
616
|
+
(0, globals_1.it)('should use existing storage stack when S3 bucket exists', () => {
|
|
617
|
+
const tableDefinition = {
|
|
618
|
+
tableName: 'stackTest',
|
|
619
|
+
partitionKey: { name: 'id', type: 'STRING' },
|
|
620
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
621
|
+
};
|
|
622
|
+
const result = synthesizer.render({
|
|
623
|
+
storage: {
|
|
624
|
+
importFrom: './storage/resource',
|
|
625
|
+
dynamoTables: [tableDefinition],
|
|
626
|
+
hasS3Bucket: 'testBucket',
|
|
627
|
+
bucketName: 'testBucket',
|
|
628
|
+
},
|
|
629
|
+
});
|
|
630
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
631
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
632
|
+
"import { storage } from "./storage/resource";
|
|
633
|
+
import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
634
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
const backend = defineBackend({
|
|
638
|
+
storage
|
|
639
|
+
});
|
|
640
|
+
const storageStack = backend.storage.stack;
|
|
641
|
+
new Table(storageStack, "stackTest", { partitionKey: { name: "id", type: AttributeType.STRING }, billingMode: BillingMode.PAY_PER_REQUEST });
|
|
642
|
+
const s3Bucket = backend.storage.resources.cfnResources.cfnBucket;
|
|
643
|
+
// Use this bucket name post refactor
|
|
644
|
+
// s3Bucket.bucketName = 'testBucket';
|
|
645
|
+
"
|
|
646
|
+
`);
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
(0, globals_1.describe)('Table name transformation', () => {
|
|
650
|
+
(0, globals_1.it)('should replace multiple hyphens with underscores', () => {
|
|
651
|
+
const tableDefinition = {
|
|
652
|
+
tableName: 'my-complex-table-name-dev',
|
|
653
|
+
partitionKey: { name: 'id', type: 'STRING' },
|
|
654
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
655
|
+
};
|
|
656
|
+
const result = synthesizer.render({
|
|
657
|
+
storage: {
|
|
658
|
+
importFrom: './storage/resource',
|
|
659
|
+
dynamoTables: [tableDefinition],
|
|
660
|
+
},
|
|
661
|
+
});
|
|
662
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
663
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
664
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
665
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
const backend = defineBackend({});
|
|
669
|
+
const storageStack = backend.createStack("storage");
|
|
670
|
+
new Table(storageStack, "my_complex_table_name", { partitionKey: { name: "id", type: AttributeType.STRING }, billingMode: BillingMode.PAY_PER_REQUEST });
|
|
671
|
+
"
|
|
672
|
+
`);
|
|
673
|
+
});
|
|
674
|
+
(0, globals_1.it)('should handle table names without hyphens', () => {
|
|
675
|
+
const tableDefinition = {
|
|
676
|
+
tableName: 'simpleTableName',
|
|
677
|
+
partitionKey: { name: 'id', type: 'STRING' },
|
|
678
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
679
|
+
};
|
|
680
|
+
const result = synthesizer.render({
|
|
681
|
+
storage: {
|
|
682
|
+
importFrom: './storage/resource',
|
|
683
|
+
dynamoTables: [tableDefinition],
|
|
684
|
+
},
|
|
685
|
+
});
|
|
686
|
+
const source = (0, ts_node_printer_1.printNodeArray)(result);
|
|
687
|
+
(0, globals_1.expect)(source).toMatchInlineSnapshot(`
|
|
688
|
+
"import { Table, AttributeType, BillingMode, StreamViewType } from "aws-cdk-lib/aws-dynamodb";
|
|
689
|
+
import { defineBackend } from "@aws-amplify/backend";
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
const backend = defineBackend({});
|
|
693
|
+
const storageStack = backend.createStack("storage");
|
|
694
|
+
new Table(storageStack, "simpleTableName", { partitionKey: { name: "id", type: AttributeType.STRING }, billingMode: BillingMode.PAY_PER_REQUEST });
|
|
695
|
+
"
|
|
696
|
+
`);
|
|
697
|
+
});
|
|
698
|
+
});
|
|
699
|
+
});
|
|
700
|
+
//# sourceMappingURL=synthesizer.test.js.map
|