@aws-amplify/graphql-api-construct 1.6.0-secrets-manager.0 → 1.7.0-iam-auth.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.jsii +484 -421
- package/API.md +30 -21
- package/CHANGELOG.md +17 -2
- package/README.md +17 -75
- package/lib/amplify-dynamodb-table-wrapper.d.ts +6 -1
- package/lib/amplify-dynamodb-table-wrapper.js +9 -2
- package/lib/amplify-graphql-api.d.ts +2 -2
- package/lib/amplify-graphql-api.js +11 -7
- package/lib/amplify-graphql-definition.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/internal/authorization-modes.d.ts +2 -1
- package/lib/internal/authorization-modes.js +37 -7
- package/lib/internal/construct-exports.js +13 -3
- package/lib/internal/data-source-config.js +4 -37
- package/lib/model-datasource-strategy-types.d.ts +1 -25
- package/lib/model-datasource-strategy-types.js +1 -1
- package/lib/sql-model-datasource-strategy.d.ts +1 -13
- package/lib/sql-model-datasource-strategy.js +4 -26
- package/lib/types.d.ts +68 -10
- package/lib/types.js +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/API.md +2 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +17 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js +36 -3
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.d.ts +1 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.js +2 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js +0 -3
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.js +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.js +14 -7
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.d.ts +2 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.js +14 -3
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.create.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.create.js +3 -3
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.create.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.delete.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.delete.js +3 -3
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.delete.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.update.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.update.js +3 -3
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.update.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.js +2 -2
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/search.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/search.js +3 -3
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/search.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.js +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.js +2 -2
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.d.ts +3 -2
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.js +29 -9
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.js +5 -5
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js +6 -5
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/subscription.js +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/subscription.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/vtl-generator.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/vtl-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +20 -14
- package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +15 -1
- package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +15 -9
- package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +9 -1
- package/node_modules/@aws-amplify/graphql-function-transformer/package.json +14 -8
- package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +9 -1
- package/node_modules/@aws-amplify/graphql-http-transformer/package.json +14 -8
- package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +13 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/package.json +15 -9
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +13 -1
- 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 +16 -14
- package/node_modules/@aws-amplify/graphql-model-transformer/API.md +3 -3
- package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +16 -3
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/definitions.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/definitions.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/definitions.js +9 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/definitions.js.map +1 -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 +51 -25
- 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/graphql-types/common.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.js +11 -7
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.js +9 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.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/resolvers/common.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/common.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/common.js +15 -7
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/common.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts +1 -5
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js +26 -71
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js +3 -3
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js +7 -21
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/package.json +17 -11
- package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +9 -1
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +14 -8
- package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +15 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.js +13 -3
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +17 -11
- package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +15 -1
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +15 -9
- package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +13 -1
- package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +16 -10
- package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +13 -3
- package/node_modules/@aws-amplify/graphql-transformer/package.json +23 -17
- package/node_modules/@aws-amplify/graphql-transformer-core/API.md +12 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +11 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts +1 -1
- 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 +6 -2
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.js +14 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts +1 -1
- 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 +5 -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/model-util.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.js +18 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/package.json +14 -8
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +6 -27
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +6 -2
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts +1 -12
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js +0 -22
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-output-provider.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-output-provider.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +8 -2
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/model-datasource/types.ts +1 -76
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/synth-parameters.ts +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-output-provider.ts +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
- package/node_modules/graphql-mapping-template/CHANGELOG.md +8 -0
- package/node_modules/graphql-mapping-template/LICENSE +201 -0
- package/node_modules/graphql-mapping-template/package.json +12 -5
- package/node_modules/graphql-transformer-common/API.md +14 -0
- package/node_modules/graphql-transformer-common/CHANGELOG.md +14 -0
- package/node_modules/graphql-transformer-common/LICENSE +201 -0
- package/node_modules/graphql-transformer-common/lib/TypescriptSchemaConstants.d.ts +13 -0
- package/node_modules/graphql-transformer-common/lib/TypescriptSchemaConstants.d.ts.map +1 -0
- package/node_modules/graphql-transformer-common/lib/TypescriptSchemaConstants.js +16 -0
- package/node_modules/graphql-transformer-common/lib/TypescriptSchemaConstants.js.map +1 -0
- package/node_modules/graphql-transformer-common/lib/index.d.ts +1 -0
- package/node_modules/graphql-transformer-common/lib/index.d.ts.map +1 -1
- package/node_modules/graphql-transformer-common/lib/index.js +1 -0
- package/node_modules/graphql-transformer-common/lib/index.js.map +1 -1
- package/node_modules/graphql-transformer-common/package.json +13 -6
- package/package.json +27 -21
- package/src/amplify-dynamodb-table-wrapper.ts +9 -1
- package/src/amplify-graphql-api.ts +17 -7
- package/src/index.ts +2 -0
- package/src/internal/authorization-modes.ts +47 -8
- package/src/internal/construct-exports.ts +14 -4
- package/src/internal/data-source-config.ts +9 -42
- package/src/model-datasource-strategy-types.ts +1 -33
- package/src/sql-model-datasource-strategy.ts +1 -32
- package/src/types.ts +75 -11
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aws-amplify/graphql-api-construct",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.7.0-iam-auth.0",
|
4
4
|
"description": "AppSync GraphQL Api Construct using Amplify GraphQL Transformer.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -75,20 +75,20 @@
|
|
75
75
|
"dependencies": {
|
76
76
|
"@aws-amplify/backend-output-schemas": "^0.4.0",
|
77
77
|
"@aws-amplify/backend-output-storage": "^0.2.2",
|
78
|
-
"@aws-amplify/graphql-auth-transformer": "3.
|
79
|
-
"@aws-amplify/graphql-default-value-transformer": "2.2
|
80
|
-
"@aws-amplify/graphql-function-transformer": "2.1.
|
81
|
-
"@aws-amplify/graphql-http-transformer": "2.1.
|
82
|
-
"@aws-amplify/graphql-index-transformer": "2.3.
|
83
|
-
"@aws-amplify/graphql-maps-to-transformer": "3.4.
|
84
|
-
"@aws-amplify/graphql-model-transformer": "2.
|
85
|
-
"@aws-amplify/graphql-predictions-transformer": "2.1.
|
86
|
-
"@aws-amplify/graphql-relational-transformer": "2.
|
87
|
-
"@aws-amplify/graphql-searchable-transformer": "2.
|
88
|
-
"@aws-amplify/graphql-sql-transformer": "0.2.
|
89
|
-
"@aws-amplify/graphql-transformer": "1.
|
90
|
-
"@aws-amplify/graphql-transformer-core": "2.
|
91
|
-
"@aws-amplify/graphql-transformer-interfaces": "3.4.
|
78
|
+
"@aws-amplify/graphql-auth-transformer": "3.4.2-iam-auth.0",
|
79
|
+
"@aws-amplify/graphql-default-value-transformer": "2.3.2-iam-auth.0",
|
80
|
+
"@aws-amplify/graphql-function-transformer": "2.1.19-iam-auth.0",
|
81
|
+
"@aws-amplify/graphql-http-transformer": "2.1.19-iam-auth.0",
|
82
|
+
"@aws-amplify/graphql-index-transformer": "2.3.8-iam-auth.0",
|
83
|
+
"@aws-amplify/graphql-maps-to-transformer": "3.4.9-iam-auth.0",
|
84
|
+
"@aws-amplify/graphql-model-transformer": "2.6.1-iam-auth.0",
|
85
|
+
"@aws-amplify/graphql-predictions-transformer": "2.1.19-iam-auth.0",
|
86
|
+
"@aws-amplify/graphql-relational-transformer": "2.4.2-iam-auth.0",
|
87
|
+
"@aws-amplify/graphql-searchable-transformer": "2.6.2-iam-auth.0",
|
88
|
+
"@aws-amplify/graphql-sql-transformer": "0.2.8-iam-auth.0",
|
89
|
+
"@aws-amplify/graphql-transformer": "1.3.13-iam-auth.0",
|
90
|
+
"@aws-amplify/graphql-transformer-core": "2.5.1-iam-auth.0",
|
91
|
+
"@aws-amplify/graphql-transformer-interfaces": "3.4.1-iam-auth.0",
|
92
92
|
"@aws-amplify/platform-core": "^0.2.0",
|
93
93
|
"@aws-amplify/plugin-types": "^0.4.1",
|
94
94
|
"charenc": "^0.0.2",
|
@@ -96,8 +96,8 @@
|
|
96
96
|
"fs-extra": "^8.1.0",
|
97
97
|
"graceful-fs": "^4.2.11",
|
98
98
|
"graphql": "^15.5.0",
|
99
|
-
"graphql-mapping-template": "4.20.
|
100
|
-
"graphql-transformer-common": "4.
|
99
|
+
"graphql-mapping-template": "4.20.16-iam-auth.0",
|
100
|
+
"graphql-transformer-common": "4.28.2-iam-auth.0",
|
101
101
|
"hjson": "^3.2.2",
|
102
102
|
"immer": "^9.0.12",
|
103
103
|
"is-buffer": "^2.0.5",
|
@@ -112,7 +112,7 @@
|
|
112
112
|
"zod": "^3.22.3"
|
113
113
|
},
|
114
114
|
"devDependencies": {
|
115
|
-
"@aws-amplify/graphql-transformer-test-utils": "0.4.
|
115
|
+
"@aws-amplify/graphql-transformer-test-utils": "0.4.7-iam-auth.0",
|
116
116
|
"@types/fs-extra": "^8.0.1",
|
117
117
|
"@types/node": "^12.12.6",
|
118
118
|
"aws-cdk-lib": "2.80.0",
|
@@ -162,14 +162,20 @@
|
|
162
162
|
"global": {
|
163
163
|
"branches": 90,
|
164
164
|
"functions": 90,
|
165
|
-
"lines":
|
165
|
+
"lines": 60
|
166
166
|
}
|
167
167
|
},
|
168
168
|
"coverageReporters": [
|
169
169
|
"clover",
|
170
170
|
"text"
|
171
171
|
],
|
172
|
-
"testEnvironment": "../../FixJestEnvironment.js"
|
172
|
+
"testEnvironment": "../../FixJestEnvironment.js",
|
173
|
+
"collectCoverageFrom": [
|
174
|
+
"src/**/*.ts"
|
175
|
+
],
|
176
|
+
"coveragePathIgnorePatterns": [
|
177
|
+
"/__tests__/"
|
178
|
+
]
|
173
179
|
},
|
174
|
-
"gitHead": "
|
180
|
+
"gitHead": "cb69f1ad3fae324674f3cc6db63495b4344c3fb5"
|
175
181
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CfnResource } from 'aws-cdk-lib';
|
1
|
+
import { CfnResource, RemovalPolicy } from 'aws-cdk-lib';
|
2
2
|
import { BillingMode, StreamViewType } from 'aws-cdk-lib/aws-dynamodb';
|
3
3
|
|
4
4
|
const AMPLIFY_DYNAMODB_TABLE_RESOURCE_TYPE = 'Custom::AmplifyDynamoDBTable';
|
@@ -110,6 +110,14 @@ export class AmplifyDynamoDbTableWrapper {
|
|
110
110
|
}
|
111
111
|
}
|
112
112
|
|
113
|
+
/**
|
114
|
+
* Set the deletion policy of the resource based on the removal policy specified.
|
115
|
+
* @param policy removal policy to set
|
116
|
+
*/
|
117
|
+
applyRemovalPolicy(policy: RemovalPolicy): void {
|
118
|
+
this.resource.applyRemovalPolicy(policy);
|
119
|
+
}
|
120
|
+
|
113
121
|
/**
|
114
122
|
* Specify how you are charged for read and write throughput and how you manage capacity.
|
115
123
|
*/
|
@@ -36,7 +36,7 @@ import type {
|
|
36
36
|
FunctionSlot,
|
37
37
|
IBackendOutputStorageStrategy,
|
38
38
|
AddFunctionProps,
|
39
|
-
|
39
|
+
DataStoreConfiguration,
|
40
40
|
IAmplifyGraphqlDefinition,
|
41
41
|
} from './types';
|
42
42
|
import {
|
@@ -48,6 +48,7 @@ import {
|
|
48
48
|
getGeneratedFunctionSlots,
|
49
49
|
CodegenAssets,
|
50
50
|
getAdditionalAuthenticationTypes,
|
51
|
+
validateAuthorizationModes,
|
51
52
|
} from './internal';
|
52
53
|
import { getStackForScope, walkAndProcessNodes } from './internal/construct-tree';
|
53
54
|
import { getDataSourceStrategiesProvider } from './internal/data-source-config';
|
@@ -120,9 +121,9 @@ export class AmplifyGraphqlApi extends Construct {
|
|
120
121
|
public readonly apiId: string;
|
121
122
|
|
122
123
|
/**
|
123
|
-
*
|
124
|
+
* DataStore conflict resolution setting
|
124
125
|
*/
|
125
|
-
private readonly
|
126
|
+
private readonly dataStoreConfiguration: DataStoreConfiguration | undefined;
|
126
127
|
|
127
128
|
/**
|
128
129
|
* Be very careful editing this value. This is the string that is used to identify graphql stacks in BI metrics
|
@@ -152,14 +153,24 @@ export class AmplifyGraphqlApi extends Construct {
|
|
152
153
|
translationBehavior,
|
153
154
|
functionNameMap,
|
154
155
|
outputStorageStrategy,
|
156
|
+
dataStoreConfiguration,
|
155
157
|
} = props;
|
156
158
|
|
159
|
+
if (conflictResolution && dataStoreConfiguration) {
|
160
|
+
throw new Error(
|
161
|
+
`conflictResolution is deprecated. conflictResolution and dataStoreConfiguration cannot be used together. Please use dataStoreConfiguration.`,
|
162
|
+
);
|
163
|
+
}
|
164
|
+
|
165
|
+
this.dataStoreConfiguration = dataStoreConfiguration || conflictResolution;
|
166
|
+
|
157
167
|
const dataSources = getMetadataDataSources(definition);
|
158
168
|
|
159
169
|
new AttributionMetadataStorage().storeAttributionMetadata(Stack.of(scope), this.stackType, path.join(__dirname, '..', 'package.json'), {
|
160
170
|
dataSources,
|
161
171
|
});
|
162
172
|
|
173
|
+
validateAuthorizationModes(authorizationModes);
|
163
174
|
const { authConfig, authSynthParameters } = convertAuthorizationModesToTransformerAuthConfig(authorizationModes);
|
164
175
|
|
165
176
|
validateFunctionSlots(functionSlots ?? []);
|
@@ -201,7 +212,7 @@ export class AmplifyGraphqlApi extends Construct {
|
|
201
212
|
},
|
202
213
|
authConfig,
|
203
214
|
stackMapping: stackMappings ?? {},
|
204
|
-
resolverConfig:
|
215
|
+
resolverConfig: this.dataStoreConfiguration ? convertToResolverConfig(this.dataStoreConfiguration) : undefined,
|
205
216
|
transformParameters: {
|
206
217
|
...defaultTranslationBehavior,
|
207
218
|
...(translationBehavior ?? {}),
|
@@ -217,7 +228,6 @@ export class AmplifyGraphqlApi extends Construct {
|
|
217
228
|
this.codegenAssets = new CodegenAssets(this, 'AmplifyCodegenAssets', { modelSchema: definition.schema });
|
218
229
|
|
219
230
|
this.resources = getGeneratedResources(this);
|
220
|
-
this.conflictResolution = conflictResolution;
|
221
231
|
this.generatedFunctionSlots = getGeneratedFunctionSlots(assetManager.resolverAssets);
|
222
232
|
this.storeOutput(outputStorageStrategy);
|
223
233
|
|
@@ -255,8 +265,8 @@ export class AmplifyGraphqlApi extends Construct {
|
|
255
265
|
output.payload.awsAppsyncAdditionalAuthenticationTypes = additionalAuthTypes;
|
256
266
|
}
|
257
267
|
|
258
|
-
if (this.
|
259
|
-
output.payload.awsAppsyncConflictResolutionMode = this.
|
268
|
+
if (this.dataStoreConfiguration?.project?.handlerType) {
|
269
|
+
output.payload.awsAppsyncConflictResolutionMode = this.dataStoreConfiguration?.project?.handlerType;
|
260
270
|
}
|
261
271
|
|
262
272
|
outputStorageStrategy.addBackendOutputEntry(graphqlOutputKey, output);
|
package/src/index.ts
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
*/
|
5
5
|
export type {
|
6
6
|
IAMAuthorizationConfig,
|
7
|
+
IdentityPoolAuthorizationConfig,
|
7
8
|
UserPoolAuthorizationConfig,
|
8
9
|
OIDCAuthorizationConfig,
|
9
10
|
ApiKeyAuthorizationConfig,
|
@@ -20,6 +21,7 @@ export type {
|
|
20
21
|
FunctionSlot,
|
21
22
|
FunctionSlotOverride,
|
22
23
|
ConflictResolution,
|
24
|
+
DataStoreConfiguration,
|
23
25
|
ConflictDetectionType,
|
24
26
|
OptimisticConflictResolutionStrategy,
|
25
27
|
CustomConflictResolutionStrategy,
|
@@ -5,19 +5,51 @@ import { IRole, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
|
|
5
5
|
import {
|
6
6
|
AuthorizationModes,
|
7
7
|
ApiKeyAuthorizationConfig,
|
8
|
-
IAMAuthorizationConfig,
|
9
8
|
LambdaAuthorizationConfig,
|
10
9
|
OIDCAuthorizationConfig,
|
11
10
|
UserPoolAuthorizationConfig,
|
12
11
|
} from '../types';
|
13
12
|
|
14
13
|
type AuthorizationConfigMode =
|
15
|
-
|
|
14
|
+
| { type: 'AWS_IAM' }
|
16
15
|
| (UserPoolAuthorizationConfig & { type: 'AMAZON_COGNITO_USER_POOLS' })
|
17
16
|
| (OIDCAuthorizationConfig & { type: 'OPENID_CONNECT' })
|
18
17
|
| (ApiKeyAuthorizationConfig & { type: 'API_KEY' })
|
19
18
|
| (LambdaAuthorizationConfig & { type: 'AWS_LAMBDA' });
|
20
19
|
|
20
|
+
export const validateAuthorizationModes = (authorizationModes: AuthorizationModes) => {
|
21
|
+
const hasDeprecatedIdentityPoolSettings =
|
22
|
+
authorizationModes.iamConfig?.authenticatedUserRole ||
|
23
|
+
authorizationModes.iamConfig?.unauthenticatedUserRole ||
|
24
|
+
authorizationModes.iamConfig?.identityPoolId;
|
25
|
+
const hasAllDeprecatedIdentityPoolSettings =
|
26
|
+
authorizationModes.iamConfig?.authenticatedUserRole &&
|
27
|
+
authorizationModes.iamConfig?.unauthenticatedUserRole &&
|
28
|
+
authorizationModes.iamConfig?.identityPoolId;
|
29
|
+
const hasDeprecatedSettings =
|
30
|
+
authorizationModes.iamConfig?.authenticatedUserRole ||
|
31
|
+
authorizationModes.iamConfig?.unauthenticatedUserRole ||
|
32
|
+
authorizationModes.iamConfig?.identityPoolId ||
|
33
|
+
authorizationModes.iamConfig?.allowListedRoles ||
|
34
|
+
authorizationModes.adminRoles;
|
35
|
+
const hasUnDeprecatedSettings =
|
36
|
+
typeof authorizationModes.iamConfig?.enableIamAuthorizationMode !== 'undefined' || authorizationModes.identityPoolConfig;
|
37
|
+
|
38
|
+
if (hasDeprecatedSettings && hasUnDeprecatedSettings) {
|
39
|
+
throw new Error(
|
40
|
+
"Cannot use deprecated 'authorizationModes.iamConfig' options with 'authorizationModes.identityPoolConfig'" +
|
41
|
+
" or 'authorizationModes.iamConfig.enableIamAuthorizationMode'",
|
42
|
+
);
|
43
|
+
}
|
44
|
+
|
45
|
+
if (hasDeprecatedIdentityPoolSettings && !hasAllDeprecatedIdentityPoolSettings) {
|
46
|
+
throw new Error(
|
47
|
+
"'authorizationModes.iamConfig.authenticatedUserRole', 'authorizationModes.iamConfig.unauthenticatedUserRole' and" +
|
48
|
+
" 'authorizationModes.iamConfig.identityPoolId' must be provided.",
|
49
|
+
);
|
50
|
+
}
|
51
|
+
};
|
52
|
+
|
21
53
|
/**
|
22
54
|
* Converts a single auth mode config into the amplify-internal representation.
|
23
55
|
* @param authMode the auth mode to convert into the Appsync CDK representation.
|
@@ -79,7 +111,7 @@ const convertAuthConfigToAppSyncAuth = (authModes: AuthorizationModes): AppSyncA
|
|
79
111
|
authModes.lambdaConfig ? { type: 'AWS_LAMBDA', ...authModes.lambdaConfig } : null,
|
80
112
|
authModes.oidcConfig ? { type: 'OPENID_CONNECT', ...authModes.oidcConfig } : null,
|
81
113
|
authModes.userPoolConfig ? { type: 'AMAZON_COGNITO_USER_POOLS', ...authModes.userPoolConfig } : null,
|
82
|
-
authModes.iamConfig ? { type: 'AWS_IAM'
|
114
|
+
authModes.iamConfig || authModes.identityPoolConfig ? { type: 'AWS_IAM' } : null,
|
83
115
|
].filter((mode) => mode) as AuthorizationConfigMode[];
|
84
116
|
const authProviders = authConfig.map(convertAuthModeToAuthProvider);
|
85
117
|
|
@@ -116,7 +148,7 @@ const convertAuthConfigToAppSyncAuth = (authModes: AuthorizationModes): AppSyncA
|
|
116
148
|
|
117
149
|
type AuthSynthParameters = Pick<
|
118
150
|
SynthParameters,
|
119
|
-
'userPoolId' | 'authenticatedUserRoleName' | 'unauthenticatedUserRoleName' | 'identityPoolId' | 'adminRoles'
|
151
|
+
'userPoolId' | 'authenticatedUserRoleName' | 'unauthenticatedUserRoleName' | 'identityPoolId' | 'adminRoles' | 'enableIamAccess'
|
120
152
|
>;
|
121
153
|
|
122
154
|
interface AuthConfig {
|
@@ -177,12 +209,19 @@ const getAllowListedRoles = (authModes: AuthorizationModes): string[] =>
|
|
177
209
|
*/
|
178
210
|
const getSynthParameters = (authModes: AuthorizationModes): AuthSynthParameters => ({
|
179
211
|
adminRoles: getAllowListedRoles(authModes),
|
180
|
-
identityPoolId: authModes.iamConfig?.identityPoolId,
|
212
|
+
identityPoolId: authModes.identityPoolConfig?.identityPoolId ?? authModes.iamConfig?.identityPoolId,
|
213
|
+
enableIamAccess: authModes.iamConfig?.enableIamAuthorizationMode,
|
181
214
|
...(authModes.userPoolConfig ? { userPoolId: authModes.userPoolConfig.userPool.userPoolId } : {}),
|
182
|
-
...(authModes?.
|
215
|
+
...(authModes?.identityPoolConfig
|
216
|
+
? {
|
217
|
+
authenticatedUserRoleName: authModes.identityPoolConfig.authenticatedUserRole.roleName,
|
218
|
+
unauthenticatedUserRoleName: authModes.identityPoolConfig.unauthenticatedUserRole.roleName,
|
219
|
+
}
|
220
|
+
: {}),
|
221
|
+
...(authModes?.iamConfig && authModes?.iamConfig.authenticatedUserRole && authModes?.iamConfig.unauthenticatedUserRole
|
183
222
|
? {
|
184
|
-
authenticatedUserRoleName: authModes.iamConfig.authenticatedUserRole
|
185
|
-
unauthenticatedUserRoleName: authModes.iamConfig.unauthenticatedUserRole
|
223
|
+
authenticatedUserRoleName: authModes.iamConfig.authenticatedUserRole?.roleName,
|
224
|
+
unauthenticatedUserRoleName: authModes.iamConfig.unauthenticatedUserRole?.roleName,
|
186
225
|
}
|
187
226
|
: {}),
|
188
227
|
});
|
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
CfnDataSource,
|
9
9
|
GraphqlApi,
|
10
10
|
} from 'aws-cdk-lib/aws-appsync';
|
11
|
-
import { CfnTable, Table } from 'aws-cdk-lib/aws-dynamodb';
|
11
|
+
import { CfnTable, Table, ITable } from 'aws-cdk-lib/aws-dynamodb';
|
12
12
|
import { CfnRole, Role } from 'aws-cdk-lib/aws-iam';
|
13
13
|
import { CfnResource, NestedStack } from 'aws-cdk-lib';
|
14
14
|
import { getResourceName } from '@aws-amplify/graphql-transformer-core';
|
@@ -17,6 +17,16 @@ import { AmplifyGraphqlApiResources, FunctionSlot } from '../types';
|
|
17
17
|
import { AmplifyDynamoDbTableWrapper } from '../amplify-dynamodb-table-wrapper';
|
18
18
|
import { walkAndProcessNodes } from './construct-tree';
|
19
19
|
|
20
|
+
/**
|
21
|
+
* Check if a resource is implementing table interface
|
22
|
+
* The required properties need to be present in the input
|
23
|
+
* https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.ITable.html#properties
|
24
|
+
* @param table table resource
|
25
|
+
* @returns whether the resource is a ITable or not
|
26
|
+
*/
|
27
|
+
function isITable(table: any): table is ITable {
|
28
|
+
return 'env' in table && 'node' in table && 'stack' in table && 'tableArn' in table && 'tableName' in table;
|
29
|
+
}
|
20
30
|
/**
|
21
31
|
* Everything below here is intended to help us gather the
|
22
32
|
* output values and render out the L1 resources for access.
|
@@ -33,7 +43,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
33
43
|
const cfnResolvers: Record<string, CfnResolver> = {};
|
34
44
|
const cfnFunctionConfigurations: Record<string, CfnFunctionConfiguration> = {};
|
35
45
|
const cfnDataSources: Record<string, CfnDataSource> = {};
|
36
|
-
const tables: Record<string,
|
46
|
+
const tables: Record<string, ITable> = {};
|
37
47
|
const cfnTables: Record<string, CfnTable> = {};
|
38
48
|
const amplifyDynamoDbTables: Record<string, AmplifyDynamoDbTableWrapper> = {};
|
39
49
|
const roles: Record<string, Role> = {};
|
@@ -72,7 +82,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
72
82
|
cfnFunctionConfigurations[resourceName] = currentScope;
|
73
83
|
return;
|
74
84
|
}
|
75
|
-
if (currentScope instanceof Table) {
|
85
|
+
if (currentScope instanceof Table || isITable(currentScope)) {
|
76
86
|
tables[resourceName] = currentScope;
|
77
87
|
return;
|
78
88
|
}
|
@@ -123,7 +133,6 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
123
133
|
return {
|
124
134
|
graphqlApi: GraphqlApi.fromGraphqlApiAttributes(scope, 'L2GraphqlApi', { graphqlApiId: cfnGraphqlApi.attrApiId }),
|
125
135
|
tables,
|
126
|
-
amplifyDynamoDbTables,
|
127
136
|
roles,
|
128
137
|
functions,
|
129
138
|
nestedStacks,
|
@@ -135,6 +144,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
135
144
|
cfnFunctionConfigurations,
|
136
145
|
cfnDataSources,
|
137
146
|
cfnTables,
|
147
|
+
amplifyDynamoDbTables,
|
138
148
|
cfnRoles,
|
139
149
|
cfnFunctions,
|
140
150
|
additionalCfnResources,
|
@@ -6,12 +6,7 @@ import {
|
|
6
6
|
isMutationNode,
|
7
7
|
fieldsWithSqlDirective,
|
8
8
|
} from '@aws-amplify/graphql-transformer-core';
|
9
|
-
import {
|
10
|
-
DataSourceStrategiesProvider,
|
11
|
-
isSqlModelDataSourceSsmDbConnectionConfig,
|
12
|
-
isSqlModelDataSourceSecretsManagerDbConnectionConfig,
|
13
|
-
} from '@aws-amplify/graphql-transformer-interfaces';
|
14
|
-
import { Token, Arn, ArnFormat } from 'aws-cdk-lib';
|
9
|
+
import { DataSourceStrategiesProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
15
10
|
import {
|
16
11
|
CustomSqlDataSourceStrategy as ConstructCustomSqlDataSourceStrategy,
|
17
12
|
ModelDataSourceStrategy as ConstructModelDataSourceStrategy,
|
@@ -189,47 +184,19 @@ export const schemaByMergingDefinitions = (definitions: IAmplifyGraphqlDefinitio
|
|
189
184
|
* @param strategy user provided model data source strategy
|
190
185
|
* @returns validates and throws an error if the strategy is invalid
|
191
186
|
*/
|
192
|
-
export const validateDataSourceStrategy = (strategy: ConstructModelDataSourceStrategy)
|
187
|
+
export const validateDataSourceStrategy = (strategy: ConstructModelDataSourceStrategy) => {
|
193
188
|
if (!isSqlStrategy(strategy)) {
|
194
189
|
return;
|
195
190
|
}
|
196
191
|
|
197
192
|
const dbConnectionConfig = strategy.dbConnectionConfig;
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
);
|
206
|
-
}
|
207
|
-
} else if (isSqlModelDataSourceSecretsManagerDbConnectionConfig(dbConnectionConfig)) {
|
208
|
-
if (!Token.isUnresolved(dbConnectionConfig.secretArn)) {
|
209
|
-
try {
|
210
|
-
const arnComponents = Arn.split(dbConnectionConfig.secretArn, ArnFormat.COLON_RESOURCE_NAME);
|
211
|
-
if (arnComponents.service !== 'secretsmanager' || arnComponents.resource !== 'secret') {
|
212
|
-
// error message does not matter because it inside try/catch
|
213
|
-
throw new Error();
|
214
|
-
}
|
215
|
-
} catch {
|
216
|
-
throw new Error(`Invalid data source strategy "${strategy.name}". The value of secretArn is not a valid Secrets Manager ARN.`);
|
217
|
-
}
|
218
|
-
}
|
219
|
-
|
220
|
-
if (dbConnectionConfig.keyArn && !Token.isUnresolved(dbConnectionConfig.keyArn)) {
|
221
|
-
try {
|
222
|
-
const arnComponents = Arn.split(dbConnectionConfig.keyArn, ArnFormat.SLASH_RESOURCE_NAME);
|
223
|
-
if (arnComponents.service !== 'kms' || arnComponents.resource !== 'key') {
|
224
|
-
// error message does not matter because it inside try/catch
|
225
|
-
throw new Error();
|
226
|
-
}
|
227
|
-
} catch {
|
228
|
-
throw new Error(`Invalid data source strategy "${strategy.name}". The value of keyArn is not a valid KMS ARN.`);
|
229
|
-
}
|
230
|
-
}
|
231
|
-
} else {
|
232
|
-
throw new Error(`Invalid data source strategy "${strategy.name}". dbConnectionConfig does not include SSM paths or Secret ARN.`);
|
193
|
+
const invalidSSMPaths = Object.values(dbConnectionConfig).filter((value) => typeof value === 'string' && !isValidSSMPath(value));
|
194
|
+
if (invalidSSMPaths.length > 0) {
|
195
|
+
throw new Error(
|
196
|
+
`Invalid data source strategy "${
|
197
|
+
strategy.name
|
198
|
+
}". Following SSM paths must start with '/' in dbConnectionConfig: ${invalidSSMPaths.join(', ')}.`,
|
199
|
+
);
|
233
200
|
}
|
234
201
|
};
|
235
202
|
|
@@ -116,44 +116,12 @@ export interface SubnetAvailabilityZone {
|
|
116
116
|
readonly availabilityZone: string;
|
117
117
|
}
|
118
118
|
|
119
|
-
/**
|
120
|
-
* The credentials the lambda data source will use to connect to the database.
|
121
|
-
*
|
122
|
-
* @experimental
|
123
|
-
*/
|
124
|
-
export type SqlModelDataSourceDbConnectionConfig =
|
125
|
-
| SqlModelDataSourceSecretsManagerDbConnectionConfig
|
126
|
-
| SqlModelDataSourceSsmDbConnectionConfig;
|
127
|
-
|
128
|
-
/**
|
129
|
-
* The credentials stored in Secrets Manager that the lambda data source will use to connect to the database.
|
130
|
-
*
|
131
|
-
* The managed secret should be in the same region as the lambda.
|
132
|
-
* @experimental
|
133
|
-
*/
|
134
|
-
export interface SqlModelDataSourceSecretsManagerDbConnectionConfig {
|
135
|
-
/** The ARN of the managed secret with username, password, and hostname to use when connecting to the database. **/
|
136
|
-
readonly secretArn: string;
|
137
|
-
|
138
|
-
/** The ARN of the customer managed encryption key for the secret. If not supplied, the secret is expected to be encrypted with the default AWS-managed key. **/
|
139
|
-
readonly keyArn?: string;
|
140
|
-
|
141
|
-
/** The port number of the database proxy, cluster, or instance. */
|
142
|
-
readonly port: number;
|
143
|
-
|
144
|
-
/** The database name. */
|
145
|
-
readonly databaseName: string;
|
146
|
-
|
147
|
-
/** The hostame of the database. */
|
148
|
-
readonly hostname: string;
|
149
|
-
}
|
150
|
-
|
151
119
|
/**
|
152
120
|
* The Secure Systems Manager parameter paths the Lambda data source will use to connect to the database.
|
153
121
|
*
|
154
122
|
* These parameters are retrieved from Secure Systems Manager in the same region as the Lambda.
|
155
123
|
*/
|
156
|
-
export interface
|
124
|
+
export interface SqlModelDataSourceDbConnectionConfig {
|
157
125
|
/** The Secure Systems Manager parameter containing the hostname of the database. For RDS-based SQL data sources, this can be the hostname
|
158
126
|
* of a database proxy, cluster, or instance.
|
159
127
|
*/
|
@@ -1,12 +1,7 @@
|
|
1
1
|
import * as fs from 'fs';
|
2
2
|
import * as path from 'path';
|
3
3
|
import { isSqlDbType } from '@aws-amplify/graphql-transformer-core';
|
4
|
-
import {
|
5
|
-
SQLLambdaModelDataSourceStrategy,
|
6
|
-
SqlModelDataSourceDbConnectionConfig,
|
7
|
-
SqlModelDataSourceSsmDbConnectionConfig,
|
8
|
-
SqlModelDataSourceSecretsManagerDbConnectionConfig,
|
9
|
-
} from './model-datasource-strategy-types';
|
4
|
+
import { SQLLambdaModelDataSourceStrategy, SqlModelDataSourceDbConnectionConfig } from './model-datasource-strategy-types';
|
10
5
|
|
11
6
|
/**
|
12
7
|
* Type predicate that returns true if the object is a SQLLambdaModelDataSourceStrategy.
|
@@ -29,15 +24,6 @@ export const isSQLLambdaModelDataSourceStrategy = (obj: any): obj is SQLLambdaMo
|
|
29
24
|
* @returns true if the object is shaped like a SqlModelDataSourceDbConnectionConfig
|
30
25
|
*/
|
31
26
|
export const isSqlModelDataSourceDbConnectionConfig = (obj: any): obj is SqlModelDataSourceDbConnectionConfig => {
|
32
|
-
return isSqlModelDataSourceSsmDbConnectionConfig(obj) || isSqlModelDataSourceSecretsManagerDbConnectionConfig(obj);
|
33
|
-
};
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Type predicate that returns true if the object is a SqlModelDataSourceSsmDbConnectionConfig.
|
37
|
-
* @param obj the object to inspect
|
38
|
-
* @returns true if the object is shaped like a SqlModelDataSourceSsmDbConnectionConfig
|
39
|
-
*/
|
40
|
-
export const isSqlModelDataSourceSsmDbConnectionConfig = (obj: any): obj is SqlModelDataSourceSsmDbConnectionConfig => {
|
41
27
|
return (
|
42
28
|
(typeof obj === 'object' || typeof obj === 'function') &&
|
43
29
|
typeof obj.hostnameSsmPath === 'string' &&
|
@@ -48,23 +34,6 @@ export const isSqlModelDataSourceSsmDbConnectionConfig = (obj: any): obj is SqlM
|
|
48
34
|
);
|
49
35
|
};
|
50
36
|
|
51
|
-
/**
|
52
|
-
* Type predicate that returns true if the object is a SqlModelDataSourceSecretsManagerDbConnectionConfig.
|
53
|
-
* @param obj the object to inspect
|
54
|
-
* @returns true if the object is shaped like a SqlModelDataSourceSecretsManagerDbConnectionConfig
|
55
|
-
*/
|
56
|
-
export const isSqlModelDataSourceSecretsManagerDbConnectionConfig = (
|
57
|
-
obj: any,
|
58
|
-
): obj is SqlModelDataSourceSecretsManagerDbConnectionConfig => {
|
59
|
-
return (
|
60
|
-
(typeof obj === 'object' || typeof obj === 'function') &&
|
61
|
-
typeof obj.secretArn === 'string' &&
|
62
|
-
typeof obj.port === 'number' &&
|
63
|
-
typeof obj.databaseName === 'string' &&
|
64
|
-
typeof obj.hostname == 'string'
|
65
|
-
);
|
66
|
-
};
|
67
|
-
|
68
37
|
/**
|
69
38
|
* Class exposing utilities to produce SQLLambdaModelDataSourceStrategy objects given various inputs.
|
70
39
|
*/
|