@aws-amplify/graphql-api-construct 1.3.0 → 1.4.0-construct-publish-test.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/.jsii +903 -176
- package/API.md +80 -1
- package/CHANGELOG.md +11 -0
- package/README.md +623 -10
- package/lib/amplify-dynamodb-table-wrapper.d.ts +128 -0
- package/lib/amplify-dynamodb-table-wrapper.js +102 -0
- package/lib/amplify-graphql-api.d.ts +4 -0
- package/lib/amplify-graphql-api.js +10 -3
- package/lib/amplify-graphql-definition.d.ts +19 -2
- package/lib/amplify-graphql-definition.js +57 -5
- package/lib/index.d.ts +2 -1
- package/lib/index.js +5 -2
- package/lib/internal/construct-exports.js +8 -1
- package/lib/internal/data-source-config.d.ts +7 -0
- package/lib/internal/data-source-config.js +37 -0
- package/lib/internal/index.d.ts +1 -1
- package/lib/internal/index.js +2 -2
- package/lib/internal/model-type-name.d.ts +8 -0
- package/lib/internal/model-type-name.js +27 -0
- package/lib/types.d.ts +47 -7
- package/lib/types.js +1 -1
- package/node_modules/@aws-amplify/backend-output-schemas/lib/auth/index.js +7 -9
- package/node_modules/@aws-amplify/backend-output-schemas/lib/auth/v1.js +15 -18
- package/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.js +10 -16
- package/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.js +22 -20
- package/node_modules/@aws-amplify/backend-output-schemas/lib/index.d.ts +12 -1
- package/node_modules/@aws-amplify/backend-output-schemas/lib/index.js +37 -63
- package/node_modules/@aws-amplify/backend-output-schemas/lib/platform/index.js +16 -14
- package/node_modules/@aws-amplify/backend-output-schemas/lib/platform/stack_metadata_schemas.js +7 -11
- package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.d.ts +5 -0
- package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.js +7 -9
- package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.d.ts +5 -0
- package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.js +9 -11
- package/node_modules/@aws-amplify/backend-output-schemas/lib/storage/index.js +7 -9
- package/node_modules/@aws-amplify/backend-output-schemas/lib/storage/v1.js +9 -12
- package/node_modules/@aws-amplify/backend-output-schemas/package.json +4 -23
- package/node_modules/@aws-amplify/backend-output-storage/lib/index.d.ts +1 -0
- package/node_modules/@aws-amplify/backend-output-storage/lib/index.js +17 -14
- package/node_modules/@aws-amplify/backend-output-storage/lib/stack_metadata_output_storage_strategy.js +28 -32
- package/node_modules/@aws-amplify/backend-output-storage/lib/store_attribution_metadata.d.ts +50 -0
- package/node_modules/@aws-amplify/backend-output-storage/lib/store_attribution_metadata.js +104 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/backend_deployment_type.d.ts +5 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/backend_deployment_type.js +9 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.d.ts +9 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.js +13 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/index.d.ts +4 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/index.js +22 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/unique_backend_identifier.d.ts +53 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/unique_backend_identifier.js +74 -0
- package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/package.json +23 -0
- package/node_modules/@aws-amplify/backend-output-storage/package.json +6 -4
- package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +11 -10
- package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-default-value-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +8 -7
- package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-function-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-function-transformer/package.json +7 -6
- package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-http-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-http-transformer/package.json +7 -6
- package/node_modules/@aws-amplify/graphql-index-transformer/API.md +3 -0
- package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-index-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-index-transformer.js +4 -0
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-index-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-primary-key-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-primary-key-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/index.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/index.js +2 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.d.ts +5 -5
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js +34 -8
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/package.json +8 -7
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +11 -10
- package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts +2 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js +52 -47
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts +15 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js +169 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts +40 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js +242 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts +12 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js +663 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.d.ts +5 -2
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.js +47 -60
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/package.json +9 -6
- package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +7 -6
- package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-relational-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js +3 -10
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +9 -8
- package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +8 -7
- package/node_modules/@aws-amplify/graphql-transformer/API.md +2 -2
- package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts +3 -3
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer/package.json +15 -14
- package/node_modules/@aws-amplify/graphql-transformer/src/graphql-transformer.ts +3 -8
- package/node_modules/@aws-amplify/graphql-transformer-core/API.md +9 -11
- package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/index.d.ts +0 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts +3 -3
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js +3 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.d.ts +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.js +3 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/types.d.ts +2 -3
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/types.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.d.ts +2 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.js +12 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.d.ts +3 -4
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js +3 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.js +15 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/package.json +5 -4
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +25 -3
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.js +2 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts +2 -2
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.d.ts +7 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.js +6 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +3 -2
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/index.ts +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-provider.ts +2 -2
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-datasource-provider.ts +16 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@aws-amplify/platform-core/lib/backend_deployment_type.d.ts +5 -0
- package/node_modules/@aws-amplify/platform-core/lib/backend_deployment_type.js +9 -0
- package/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.d.ts +9 -0
- package/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.js +13 -0
- package/node_modules/@aws-amplify/platform-core/lib/index.d.ts +4 -0
- package/node_modules/@aws-amplify/platform-core/lib/index.js +22 -0
- package/node_modules/@aws-amplify/platform-core/lib/unique_backend_identifier.d.ts +53 -0
- package/node_modules/@aws-amplify/platform-core/lib/unique_backend_identifier.js +74 -0
- package/node_modules/@aws-amplify/platform-core/package.json +24 -0
- package/node_modules/@aws-amplify/plugin-types/lib/amplify_function.d.ts +4 -0
- package/node_modules/@aws-amplify/plugin-types/lib/amplify_function.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/amplify_output_writer.d.ts +9 -0
- package/node_modules/@aws-amplify/plugin-types/lib/amplify_output_writer.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/auth_resources.d.ts +42 -0
- package/node_modules/@aws-amplify/plugin-types/lib/auth_resources.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/backend_output.d.ts +6 -0
- package/node_modules/@aws-amplify/plugin-types/lib/backend_output.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/backend_secret_resolver.d.ts +13 -0
- package/node_modules/@aws-amplify/plugin-types/lib/backend_secret_resolver.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/backend_stack_creator.d.ts +8 -0
- package/node_modules/@aws-amplify/plugin-types/lib/backend_stack_creator.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/backend_stack_resolver.d.ts +7 -0
- package/node_modules/@aws-amplify/plugin-types/lib/backend_stack_resolver.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/construct_container.d.ts +26 -0
- package/node_modules/@aws-amplify/plugin-types/lib/construct_container.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/construct_factory.d.ts +21 -0
- package/node_modules/@aws-amplify/plugin-types/lib/construct_factory.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/function_resources.d.ts +5 -0
- package/node_modules/@aws-amplify/plugin-types/lib/function_resources.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/import_path_verifier.d.ts +14 -0
- package/node_modules/@aws-amplify/plugin-types/lib/import_path_verifier.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/index.d.ts +16 -0
- package/node_modules/@aws-amplify/plugin-types/lib/index.js +32 -0
- package/node_modules/@aws-amplify/plugin-types/lib/output_retrieval_strategy.d.ts +11 -0
- package/node_modules/@aws-amplify/plugin-types/lib/output_retrieval_strategy.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/output_storage_strategy.d.ts +8 -0
- package/node_modules/@aws-amplify/plugin-types/lib/output_storage_strategy.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/resource_provider.d.ts +7 -0
- package/node_modules/@aws-amplify/plugin-types/lib/resource_provider.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/lib/unique_backend_identifier.d.ts +25 -0
- package/node_modules/@aws-amplify/plugin-types/lib/unique_backend_identifier.js +3 -0
- package/node_modules/@aws-amplify/plugin-types/package.json +20 -0
- package/node_modules/graphql-transformer-common/API.md +3 -0
- package/node_modules/graphql-transformer-common/CHANGELOG.md +6 -0
- package/node_modules/graphql-transformer-common/LICENSE +201 -0
- package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts +3 -0
- package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts.map +1 -1
- package/node_modules/graphql-transformer-common/lib/ResourceConstants.js +3 -0
- package/node_modules/graphql-transformer-common/lib/ResourceConstants.js.map +1 -1
- package/node_modules/graphql-transformer-common/package.json +3 -2
- package/package.json +24 -24
- package/src/amplify-dynamodb-table-wrapper.ts +177 -0
- package/src/amplify-graphql-api.ts +10 -3
- package/src/amplify-graphql-definition.ts +63 -3
- package/src/index.ts +13 -0
- package/src/internal/construct-exports.ts +7 -0
- package/src/internal/data-source-config.ts +39 -0
- package/src/internal/index.ts +1 -1
- package/src/internal/model-type-name.ts +30 -0
- package/src/types.ts +54 -7
- package/babel.config.js +0 -13
- package/lib/internal/amplify-metadata.d.ts +0 -6
- package/lib/internal/amplify-metadata.js +0 -58
- package/node_modules/@aws-amplify/backend-output-schemas/lib/index.internal.d.ts +0 -3
- package/node_modules/@aws-amplify/backend-output-schemas/lib/index.internal.js +0 -27
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.d.ts +0 -6
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.d.ts.map +0 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.js +0 -3
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.js.map +0 -1
- package/remove-module-type-from-package-json.ts +0 -19
- package/src/internal/amplify-metadata.ts +0 -58
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import * as os from 'os';
|
|
2
2
|
import { SchemaFile } from 'aws-cdk-lib/aws-appsync';
|
|
3
|
-
import { IAmplifyGraphqlDefinition } from './types';
|
|
3
|
+
import { IAmplifyGraphqlDefinition, ModelDataSourceDefinition } from './types';
|
|
4
|
+
import { constructDataSourceDefinitionMap } from './internal';
|
|
4
5
|
|
|
6
|
+
export const DEFAULT_MODEL_DATA_SOURCE_DEFINITION: ModelDataSourceDefinition = {
|
|
7
|
+
name: 'DefaultDynamoDB',
|
|
8
|
+
strategy: {
|
|
9
|
+
dbType: 'DYNAMODB',
|
|
10
|
+
provisionStrategy: 'DEFAULT',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
5
13
|
/**
|
|
6
14
|
* Class exposing utilities to produce IAmplifyGraphqlDefinition objects given various inputs.
|
|
7
15
|
*/
|
|
@@ -9,12 +17,18 @@ export class AmplifyGraphqlDefinition {
|
|
|
9
17
|
/**
|
|
10
18
|
* Produce a schema definition from a string input
|
|
11
19
|
* @param schema the graphql input as a string
|
|
20
|
+
* @param modelDataSourceDefinition the provision definition for `@model` datasource. The DynamoDB from CloudFormation will be used by default.
|
|
21
|
+
* @experimental modelDataSourceDefinition
|
|
12
22
|
* @returns a fully formed amplify graphql definition
|
|
13
23
|
*/
|
|
14
|
-
static fromString(
|
|
24
|
+
static fromString(
|
|
25
|
+
schema: string,
|
|
26
|
+
modelDataSourceDefinition: ModelDataSourceDefinition = DEFAULT_MODEL_DATA_SOURCE_DEFINITION,
|
|
27
|
+
): IAmplifyGraphqlDefinition {
|
|
15
28
|
return {
|
|
16
29
|
schema,
|
|
17
30
|
functionSlots: [],
|
|
31
|
+
dataSourceDefinition: constructDataSourceDefinitionMap(schema, modelDataSourceDefinition),
|
|
18
32
|
};
|
|
19
33
|
}
|
|
20
34
|
|
|
@@ -24,9 +38,55 @@ export class AmplifyGraphqlDefinition {
|
|
|
24
38
|
* @returns a fully formed amplify graphql definition
|
|
25
39
|
*/
|
|
26
40
|
static fromFiles(...filePaths: string[]): IAmplifyGraphqlDefinition {
|
|
41
|
+
if (!Array.isArray(filePaths)) {
|
|
42
|
+
filePaths = [filePaths];
|
|
43
|
+
}
|
|
44
|
+
const schema = filePaths.map((filePath) => new SchemaFile({ filePath }).definition).join(os.EOL);
|
|
27
45
|
return {
|
|
28
|
-
schema
|
|
46
|
+
schema,
|
|
47
|
+
functionSlots: [],
|
|
48
|
+
dataSourceDefinition: constructDataSourceDefinitionMap(schema, DEFAULT_MODEL_DATA_SOURCE_DEFINITION),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Convert one or more appsync SchemaFile objects into an Amplify Graphql Schema
|
|
54
|
+
* @experimental
|
|
55
|
+
* @param filePaths one or more paths to the graphql files to process
|
|
56
|
+
* @param modelDataSourceDefinition the provision definition for `@model` datasource. The DynamoDB from CloudFormation will be used by default.
|
|
57
|
+
* @returns a fully formed amplify graphql definition
|
|
58
|
+
*/
|
|
59
|
+
static fromFilesAndDefinition(
|
|
60
|
+
filePaths: string | string[],
|
|
61
|
+
modelDataSourceDefinition: ModelDataSourceDefinition = DEFAULT_MODEL_DATA_SOURCE_DEFINITION,
|
|
62
|
+
): IAmplifyGraphqlDefinition {
|
|
63
|
+
if (!Array.isArray(filePaths)) {
|
|
64
|
+
filePaths = [filePaths];
|
|
65
|
+
}
|
|
66
|
+
const schema = filePaths.map((filePath) => new SchemaFile({ filePath }).definition).join(os.EOL);
|
|
67
|
+
return {
|
|
68
|
+
schema,
|
|
69
|
+
functionSlots: [],
|
|
70
|
+
dataSourceDefinition: constructDataSourceDefinitionMap(schema, modelDataSourceDefinition),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Combines multiple IAmplifyGraphqlDefinitions into a single definition.
|
|
76
|
+
* @experimental
|
|
77
|
+
* @param definitions the definitions to combine
|
|
78
|
+
*/
|
|
79
|
+
static combine(definitions: IAmplifyGraphqlDefinition[]): IAmplifyGraphqlDefinition {
|
|
80
|
+
if (definitions.length === 0) {
|
|
81
|
+
throw new Error('The definitions of amplify GraphQL cannot be empty.');
|
|
82
|
+
}
|
|
83
|
+
if (definitions.length === 1) {
|
|
84
|
+
return definitions[0];
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
schema: definitions.map((def) => def.schema).join(os.EOL),
|
|
29
88
|
functionSlots: [],
|
|
89
|
+
dataSourceDefinition: definitions.reduce((acc, cur) => ({ ...acc, ...cur.dataSourceDefinition }), {}),
|
|
30
90
|
};
|
|
31
91
|
}
|
|
32
92
|
}
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,19 @@ export type {
|
|
|
27
27
|
IBackendOutputStorageStrategy,
|
|
28
28
|
IBackendOutputEntry,
|
|
29
29
|
AddFunctionProps,
|
|
30
|
+
ModelDataSourceDefinition,
|
|
31
|
+
ModelDataSourceDefinitionStrategy,
|
|
32
|
+
DefaultDynamoDbModelDataSourceDefinitionStrategy,
|
|
33
|
+
AmplifyDynamoDbModelDataSourceDefinitionStrategy,
|
|
34
|
+
ModelDataSourceDefinitionDbType,
|
|
30
35
|
} from './types';
|
|
31
36
|
export { AmplifyGraphqlApi } from './amplify-graphql-api';
|
|
32
37
|
export { AmplifyGraphqlDefinition } from './amplify-graphql-definition';
|
|
38
|
+
export {
|
|
39
|
+
AmplifyDynamoDbTableWrapper,
|
|
40
|
+
TimeToLiveSpecification,
|
|
41
|
+
ProvisionedThroughput,
|
|
42
|
+
SSESpecification,
|
|
43
|
+
SSEType,
|
|
44
|
+
StreamSpecification,
|
|
45
|
+
} from './amplify-dynamodb-table-wrapper';
|
|
@@ -14,6 +14,7 @@ import { CfnResource, NestedStack } from 'aws-cdk-lib';
|
|
|
14
14
|
import { getResourceName } from '@aws-amplify/graphql-transformer-core';
|
|
15
15
|
import { CfnFunction, Function as LambdaFunction } from 'aws-cdk-lib/aws-lambda';
|
|
16
16
|
import { AmplifyGraphqlApiResources, FunctionSlot } from '../types';
|
|
17
|
+
import { AmplifyDynamoDbTableWrapper } from '../amplify-dynamodb-table-wrapper';
|
|
17
18
|
import { walkAndProcessNodes } from './construct-tree';
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -34,6 +35,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
|
34
35
|
const cfnDataSources: Record<string, CfnDataSource> = {};
|
|
35
36
|
const tables: Record<string, Table> = {};
|
|
36
37
|
const cfnTables: Record<string, CfnTable> = {};
|
|
38
|
+
const amplifyDynamoDbTables: Record<string, AmplifyDynamoDbTableWrapper> = {};
|
|
37
39
|
const roles: Record<string, Role> = {};
|
|
38
40
|
const cfnRoles: Record<string, CfnRole> = {};
|
|
39
41
|
const functions: Record<string, LambdaFunction> = {};
|
|
@@ -78,6 +80,10 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
|
78
80
|
cfnTables[resourceName] = currentScope;
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
83
|
+
if (AmplifyDynamoDbTableWrapper.isAmplifyDynamoDbTableResource(currentScope)) {
|
|
84
|
+
amplifyDynamoDbTables[resourceName] = new AmplifyDynamoDbTableWrapper(currentScope);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
81
87
|
if (currentScope instanceof Role) {
|
|
82
88
|
roles[resourceName] = currentScope;
|
|
83
89
|
return;
|
|
@@ -117,6 +123,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
|
117
123
|
return {
|
|
118
124
|
graphqlApi: GraphqlApi.fromGraphqlApiAttributes(scope, 'L2GraphqlApi', { graphqlApiId: cfnGraphqlApi.attrApiId }),
|
|
119
125
|
tables,
|
|
126
|
+
amplifyDynamoDbTables,
|
|
120
127
|
roles,
|
|
121
128
|
functions,
|
|
122
129
|
nestedStacks,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ModelDataSourceDefinition } from '../types';
|
|
2
|
+
import { DataSourceType, DynamoDBProvisionStrategy } from '@aws-amplify/graphql-transformer-interfaces';
|
|
3
|
+
|
|
4
|
+
type DataSourceConfig = {
|
|
5
|
+
modelToDatasourceMap: Map<string, DataSourceType>;
|
|
6
|
+
};
|
|
7
|
+
const convertToDataSourceType = (modelDataSourceDefinition: ModelDataSourceDefinition): DataSourceType => {
|
|
8
|
+
const { strategy } = modelDataSourceDefinition;
|
|
9
|
+
if (strategy.dbType === 'DYNAMODB') {
|
|
10
|
+
switch (strategy.provisionStrategy) {
|
|
11
|
+
case 'DEFAULT':
|
|
12
|
+
return {
|
|
13
|
+
dbType: 'DDB',
|
|
14
|
+
provisionDB: true,
|
|
15
|
+
provisionStrategy: DynamoDBProvisionStrategy.DEFAULT,
|
|
16
|
+
};
|
|
17
|
+
case 'AMPLIFY_TABLE':
|
|
18
|
+
return {
|
|
19
|
+
dbType: 'DDB',
|
|
20
|
+
provisionDB: true,
|
|
21
|
+
provisionStrategy: DynamoDBProvisionStrategy.AMPLIFY_TABLE,
|
|
22
|
+
};
|
|
23
|
+
default:
|
|
24
|
+
throw new Error(`Encountered unexpected provision strategy: ${(strategy as any).provisionStrategy}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
throw new Error(`Encountered unexpected database type ${strategy.dbType}`);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const parseDataSourceConfig = (dataSourceDefinitionMap: Record<string, ModelDataSourceDefinition>): DataSourceConfig => {
|
|
31
|
+
const modelToDatasourceMap = new Map<string, DataSourceType>();
|
|
32
|
+
for (const [key, value] of Object.entries(dataSourceDefinitionMap)) {
|
|
33
|
+
const dataSourceType = convertToDataSourceType(value);
|
|
34
|
+
modelToDatasourceMap.set(key, dataSourceType);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
modelToDatasourceMap,
|
|
38
|
+
};
|
|
39
|
+
};
|
package/src/internal/index.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Kind, ObjectTypeDefinitionNode, parse } from 'graphql';
|
|
2
|
+
import { ModelDataSourceDefinition } from '../types';
|
|
3
|
+
|
|
4
|
+
const MODEL_DIRECTIVE_NAME = 'model';
|
|
5
|
+
/**
|
|
6
|
+
* Get the type names with model directives in the GraphQL schema in SDL
|
|
7
|
+
* @param schema graphql schema in SDL
|
|
8
|
+
* @returns type names which model diretives are attached
|
|
9
|
+
*/
|
|
10
|
+
export function getModelTypeNames(schema: string): string[] {
|
|
11
|
+
const parsedDocument = parse(schema);
|
|
12
|
+
const nodesWithModelDirective = parsedDocument.definitions.filter(
|
|
13
|
+
(def) =>
|
|
14
|
+
def.kind === Kind.OBJECT_TYPE_DEFINITION &&
|
|
15
|
+
def.directives &&
|
|
16
|
+
def.directives.find((dir) => dir.name.value === MODEL_DIRECTIVE_NAME) != undefined,
|
|
17
|
+
) as ObjectTypeDefinitionNode[];
|
|
18
|
+
return nodesWithModelDirective.map((node) => node.name.value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function constructDataSourceDefinitionMap(
|
|
22
|
+
schema: string,
|
|
23
|
+
dataSourceDefinition: ModelDataSourceDefinition,
|
|
24
|
+
): Record<string, ModelDataSourceDefinition> {
|
|
25
|
+
const parsedSchema = parse(schema);
|
|
26
|
+
return parsedSchema.definitions
|
|
27
|
+
.filter((obj) => obj.kind === Kind.OBJECT_TYPE_DEFINITION && obj.directives?.some((dir) => dir.name.value === MODEL_DIRECTIVE_NAME))
|
|
28
|
+
.map((type) => (type as ObjectTypeDefinitionNode).name.value)
|
|
29
|
+
.reduce((acc, cur) => ({ ...acc, [cur]: dataSourceDefinition }), {});
|
|
30
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { IRole, CfnRole } from 'aws-cdk-lib/aws-iam';
|
|
|
17
17
|
import { IUserPool } from 'aws-cdk-lib/aws-cognito';
|
|
18
18
|
import { IFunction, CfnFunction } from 'aws-cdk-lib/aws-lambda';
|
|
19
19
|
import { IBucket } from 'aws-cdk-lib/aws-s3';
|
|
20
|
+
import { AmplifyDynamoDbTableWrapper } from './amplify-dynamodb-table-wrapper';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Configuration for IAM Authorization on the Graphql Api.
|
|
@@ -400,13 +401,6 @@ export interface TranslationBehavior {
|
|
|
400
401
|
*/
|
|
401
402
|
readonly respectPrimaryKeyAttributesOnConnectionField: boolean;
|
|
402
403
|
|
|
403
|
-
/**
|
|
404
|
-
* If enabled, set nodeToNodeEncryption on the searchable domain (if one exists). Not recommended for use, prefer
|
|
405
|
-
* to use `Object.values(resources.additionalResources['AWS::Elasticsearch::Domain']).forEach((domain: CfnDomain) => {
|
|
406
|
-
* domain.NodeToNodeEncryptionOptions = { Enabled: True };
|
|
407
|
-
* });
|
|
408
|
-
* @default false
|
|
409
|
-
*/
|
|
410
404
|
readonly enableSearchNodeToNodeEncryption: boolean;
|
|
411
405
|
|
|
412
406
|
/**
|
|
@@ -509,6 +503,12 @@ export interface IAmplifyGraphqlDefinition {
|
|
|
509
503
|
* @returns generated function slots
|
|
510
504
|
*/
|
|
511
505
|
readonly functionSlots: FunctionSlot[];
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Retrieve the datasource definition mapping. The default strategy is to use DynamoDB from CloudFormation.
|
|
509
|
+
* @returns datasource definition mapping
|
|
510
|
+
*/
|
|
511
|
+
readonly dataSourceDefinition: Record<string, ModelDataSourceDefinition>;
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
/**
|
|
@@ -539,6 +539,48 @@ export interface IBackendOutputStorageStrategy {
|
|
|
539
539
|
addBackendOutputEntry(keyName: string, backendOutputEntry: IBackendOutputEntry): void;
|
|
540
540
|
}
|
|
541
541
|
|
|
542
|
+
/**
|
|
543
|
+
* Defines a datasource for resolving GraphQL operations against `@model` types in a GraphQL schema.
|
|
544
|
+
* @experimental
|
|
545
|
+
*/
|
|
546
|
+
export interface ModelDataSourceDefinition {
|
|
547
|
+
/**
|
|
548
|
+
* The name of the ModelDataSource. This will be used to name the AppSynce DataSource itself, plus any associated resources like resolver
|
|
549
|
+
* Lambdas, custom CDK resources. This name must be unique across all schema definitions in a GraphQL API.
|
|
550
|
+
*/
|
|
551
|
+
readonly name: string;
|
|
552
|
+
/**
|
|
553
|
+
* The ModelDataSourceDefinitionStrategy.
|
|
554
|
+
*/
|
|
555
|
+
readonly strategy: ModelDataSourceDefinitionStrategy;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* All known ModelDataSourceDefinitionStrategies. Concrete strategies vary widely in their requirements and implementations.
|
|
559
|
+
* @experimental
|
|
560
|
+
*/
|
|
561
|
+
export type ModelDataSourceDefinitionStrategy =
|
|
562
|
+
| DefaultDynamoDbModelDataSourceDefinitionStrategy
|
|
563
|
+
| AmplifyDynamoDbModelDataSourceDefinitionStrategy;
|
|
564
|
+
|
|
565
|
+
export type ModelDataSourceDefinitionDbType = 'DYNAMODB';
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Use default CloudFormation type 'AWS::DynamoDB::Table' to provision table.
|
|
569
|
+
* @experimental
|
|
570
|
+
*/
|
|
571
|
+
export interface DefaultDynamoDbModelDataSourceDefinitionStrategy {
|
|
572
|
+
readonly dbType: 'DYNAMODB';
|
|
573
|
+
readonly provisionStrategy: 'DEFAULT';
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Use custom resource type 'Custom::AmplifyDynamoDBTable' to provision table.
|
|
577
|
+
* @experimental
|
|
578
|
+
*/
|
|
579
|
+
export interface AmplifyDynamoDbModelDataSourceDefinitionStrategy {
|
|
580
|
+
readonly dbType: 'DYNAMODB';
|
|
581
|
+
readonly provisionStrategy: 'AMPLIFY_TABLE';
|
|
582
|
+
}
|
|
583
|
+
|
|
542
584
|
/**
|
|
543
585
|
* Input props for the AmplifyGraphqlApi construct. Specifies what the input to transform into an Api, and configurations for
|
|
544
586
|
* the transformation process.
|
|
@@ -686,6 +728,11 @@ export interface AmplifyGraphqlApiResources {
|
|
|
686
728
|
*/
|
|
687
729
|
readonly tables: Record<string, ITable>;
|
|
688
730
|
|
|
731
|
+
/**
|
|
732
|
+
* The Generated Amplify DynamoDb Table wrapped if produced, keyed by name.
|
|
733
|
+
*/
|
|
734
|
+
readonly amplifyDynamoDbTables: Record<string, AmplifyDynamoDbTableWrapper>;
|
|
735
|
+
|
|
689
736
|
/**
|
|
690
737
|
* The Generated IAM Role L2 Resources, keyed by logicalId.
|
|
691
738
|
*/
|
package/babel.config.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* During the build of this package we are transforming a couple node_modules in place.
|
|
3
|
-
* This config is used for that transformation
|
|
4
|
-
* See the transform-deps script in package.json for specifics on which packages are being transformed
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = (api) => {
|
|
8
|
-
api.cache(true);
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
plugins: ['@babel/plugin-transform-modules-commonjs'],
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addAmplifyMetadataToStackDescription = void 0;
|
|
4
|
-
const os = require("os");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const construct_tree_1 = require("./construct-tree");
|
|
8
|
-
/**
|
|
9
|
-
* Compute the platform string, based on
|
|
10
|
-
* https://github.com/aws-amplify/amplify-cli/blob/88da2c9fca04d6ce734b078868d02c110db7d6a3/packages/amplify-provider-awscloudformation/src/template-description-utils.ts#L60-L70
|
|
11
|
-
* @returns the platform string
|
|
12
|
-
*/
|
|
13
|
-
const getPlatform = () => {
|
|
14
|
-
switch (os.platform()) {
|
|
15
|
-
case 'darwin':
|
|
16
|
-
return 'Mac';
|
|
17
|
-
case 'win32':
|
|
18
|
-
return 'Windows';
|
|
19
|
-
case 'linux':
|
|
20
|
-
return 'Linux';
|
|
21
|
-
default:
|
|
22
|
-
return 'Other';
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const getLibraryVersion = () => {
|
|
26
|
-
const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
|
|
27
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
28
|
-
throw new Error('Could not load determine library version for metadata generation.');
|
|
29
|
-
}
|
|
30
|
-
const packageJsonContents = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
31
|
-
const libraryVersion = packageJsonContents.version;
|
|
32
|
-
if (!libraryVersion) {
|
|
33
|
-
throw new Error('Library version could not be read from package json for metadata generation.');
|
|
34
|
-
}
|
|
35
|
-
return libraryVersion;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Compute the bi-metadata string to embed somewhere in the stack
|
|
39
|
-
* @returns the metadata string to compute amplify attribution
|
|
40
|
-
*/
|
|
41
|
-
const getAttributionMetadata = () => ({
|
|
42
|
-
createdOn: getPlatform(),
|
|
43
|
-
createdBy: 'AmplifyCDK',
|
|
44
|
-
createdWith: getLibraryVersion(),
|
|
45
|
-
stackType: 'api-AppSync',
|
|
46
|
-
});
|
|
47
|
-
/**
|
|
48
|
-
* If possible, attach the stack description to the parent stack.
|
|
49
|
-
* @param scope the scope we will use to append metadata
|
|
50
|
-
*/
|
|
51
|
-
const addAmplifyMetadataToStackDescription = (scope) => {
|
|
52
|
-
const stack = (0, construct_tree_1.getStackForScope)(scope);
|
|
53
|
-
if (!stack.templateOptions.description || stack.templateOptions.description === '') {
|
|
54
|
-
stack.templateOptions.description = JSON.stringify(getAttributionMetadata());
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
exports.addAmplifyMetadataToStackDescription = addAmplifyMetadataToStackDescription;
|
|
58
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW1wbGlmeS1tZXRhZGF0YS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbnRlcm5hbC9hbXBsaWZ5LW1ldGFkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHlCQUF5QjtBQUN6Qix5QkFBeUI7QUFDekIsNkJBQTZCO0FBRTdCLHFEQUFvRDtBQUVwRDs7OztHQUlHO0FBQ0gsTUFBTSxXQUFXLEdBQUcsR0FBVyxFQUFFO0lBQy9CLFFBQVEsRUFBRSxDQUFDLFFBQVEsRUFBRSxFQUFFO1FBQ3JCLEtBQUssUUFBUTtZQUNYLE9BQU8sS0FBSyxDQUFDO1FBQ2YsS0FBSyxPQUFPO1lBQ1YsT0FBTyxTQUFTLENBQUM7UUFDbkIsS0FBSyxPQUFPO1lBQ1YsT0FBTyxPQUFPLENBQUM7UUFDakI7WUFDRSxPQUFPLE9BQU8sQ0FBQztLQUNsQjtBQUNILENBQUMsQ0FBQztBQUVGLE1BQU0saUJBQWlCLEdBQUcsR0FBVyxFQUFFO0lBQ3JDLE1BQU0sZUFBZSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLElBQUksRUFBRSxJQUFJLEVBQUUsY0FBYyxDQUFDLENBQUM7SUFDekUsSUFBSSxDQUFDLEVBQUUsQ0FBQyxV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U3luYycsXG59KTtcblxuLyoqXG4gKiBJZiBwb3NzaWJsZSwgYXR0YWNoIHRoZSBzdGFjayBkZXNjcmlwdGlvbiB0byB0aGUgcGFyZW50IHN0YWNrLlxuICogQHBhcmFtIHNjb3BlIHRoZSBzY29wZSB3ZSB3aWxsIHVzZSB0byBhcHBlbmQgbWV0YWRhdGFcbiAqL1xuZXhwb3J0IGNvbnN0IGFkZEFtcGxpZnlNZXRhZGF0YVRvU3RhY2tEZXNjcmlwdGlvbiA9IChzY29wZTogQ29uc3RydWN0KTogdm9pZCA9PiB7XG4gIGNvbnN0IHN0YWNrID0gZ2V0U3RhY2tGb3JTY29wZShzY29wZSk7XG4gIGlmICghc3RhY2sudGVtcGxhdGVPcHRpb25zLmRlc2NyaXB0aW9uIHx8IHN0YWNrLnRlbXBsYXRlT3B0aW9ucy5kZXNjcmlwdGlvbiA9PT0gJycpIHtcbiAgICBzdGFjay50ZW1wbGF0ZU9wdGlvbnMuZGVzY3JpcHRpb24gPSBKU09OLnN0cmluZ2lmeShnZXRBdHRyaWJ1dGlvbk1ldGFkYXRhKCkpO1xuICB9XG59O1xuIl19
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _index = require("./index.js");
|
|
7
|
-
Object.keys(_index).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _index[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _index2 = require("./platform/index.js");
|
|
18
|
-
Object.keys(_index2).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _index2[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _index2[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../../src/config/project-config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAErC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-config.js","sourceRoot":"","sources":["../../src/config/project-config.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This script is used as part of the build process for the package when transforming some esm dependencies to cjs compatible packages
|
|
6
|
-
* It removes the "type" field from a package.json file so that node will use the cjs module loader rather than esm
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const packagePath = process.argv[2];
|
|
10
|
-
if (!packagePath) {
|
|
11
|
-
throw new Error('A path must be specified as the first and only arg to the script');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const packageJsonPath = path.join(packagePath, 'package.json');
|
|
15
|
-
|
|
16
|
-
const packageJsonObj = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
17
|
-
delete packageJsonObj.type;
|
|
18
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonObj, null, 2));
|
|
19
|
-
console.log(`removed "type" field from ${packageJsonPath}`);
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as os from 'os';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { Construct } from 'constructs';
|
|
5
|
-
import { getStackForScope } from './construct-tree';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Compute the platform string, based on
|
|
9
|
-
* https://github.com/aws-amplify/amplify-cli/blob/88da2c9fca04d6ce734b078868d02c110db7d6a3/packages/amplify-provider-awscloudformation/src/template-description-utils.ts#L60-L70
|
|
10
|
-
* @returns the platform string
|
|
11
|
-
*/
|
|
12
|
-
const getPlatform = (): string => {
|
|
13
|
-
switch (os.platform()) {
|
|
14
|
-
case 'darwin':
|
|
15
|
-
return 'Mac';
|
|
16
|
-
case 'win32':
|
|
17
|
-
return 'Windows';
|
|
18
|
-
case 'linux':
|
|
19
|
-
return 'Linux';
|
|
20
|
-
default:
|
|
21
|
-
return 'Other';
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const getLibraryVersion = (): string => {
|
|
26
|
-
const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
|
|
27
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
28
|
-
throw new Error('Could not load determine library version for metadata generation.');
|
|
29
|
-
}
|
|
30
|
-
const packageJsonContents = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
31
|
-
const libraryVersion = packageJsonContents.version;
|
|
32
|
-
if (!libraryVersion) {
|
|
33
|
-
throw new Error('Library version could not be read from package json for metadata generation.');
|
|
34
|
-
}
|
|
35
|
-
return libraryVersion;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Compute the bi-metadata string to embed somewhere in the stack
|
|
40
|
-
* @returns the metadata string to compute amplify attribution
|
|
41
|
-
*/
|
|
42
|
-
const getAttributionMetadata = (): Record<string, string> => ({
|
|
43
|
-
createdOn: getPlatform(),
|
|
44
|
-
createdBy: 'AmplifyCDK',
|
|
45
|
-
createdWith: getLibraryVersion(),
|
|
46
|
-
stackType: 'api-AppSync',
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* If possible, attach the stack description to the parent stack.
|
|
51
|
-
* @param scope the scope we will use to append metadata
|
|
52
|
-
*/
|
|
53
|
-
export const addAmplifyMetadataToStackDescription = (scope: Construct): void => {
|
|
54
|
-
const stack = getStackForScope(scope);
|
|
55
|
-
if (!stack.templateOptions.description || stack.templateOptions.description === '') {
|
|
56
|
-
stack.templateOptions.description = JSON.stringify(getAttributionMetadata());
|
|
57
|
-
}
|
|
58
|
-
};
|