@aws-amplify/graphql-predictions-transformer
Advanced tools
Comparing version 0.2.2 to 0.3.0-beta.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [0.3.0-beta.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-predictions-transformer@0.2.2...@aws-amplify/graphql-predictions-transformer@0.3.0-beta.0) (2021-07-29) | ||
### Bug Fixes | ||
* move storage check in [@predictions](https://github.com/predictions) v2 ([#7816](https://github.com/aws-amplify/amplify-cli/issues/7816)) ([d060a41](https://github.com/aws-amplify/amplify-cli/commit/d060a41a4e24722735477f7a0b6b54b09e105f8f)) | ||
### Features | ||
* capability injection for the vNext GraphQL Transformer ([#7735](https://github.com/aws-amplify/amplify-cli/issues/7735)) ([f3eae13](https://github.com/aws-amplify/amplify-cli/commit/f3eae13ab2848df398e26429abf985b756abcff2)) | ||
## [0.2.2](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-predictions-transformer@0.2.1...@aws-amplify/graphql-predictions-transformer@0.2.2) (2021-07-27) | ||
@@ -8,0 +24,0 @@ |
import { TransformerPluginBase } from '@aws-amplify/graphql-transformer-core'; | ||
import { TransformerBeforeStepContextProvider, TransformerContextProvider, TransformerSchemaVisitStepContextProvider, TransformerTransformSchemaStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { TransformerContextProvider, TransformerSchemaVisitStepContextProvider, TransformerTransformSchemaStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { DirectiveNode, FieldDefinitionNode, InterfaceTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql'; | ||
@@ -11,3 +11,2 @@ export declare type PredictionsConfig = { | ||
constructor(predictionsConfig?: PredictionsConfig); | ||
before: (context: TransformerBeforeStepContextProvider) => void; | ||
field: (parent: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, definition: FieldDefinitionNode, directive: DirectiveNode, context: TransformerSchemaVisitStepContextProvider) => void; | ||
@@ -14,0 +13,0 @@ transformSchema: (context: TransformerTransformSchemaStepContextProvider) => void; |
@@ -38,8 +38,6 @@ "use strict"; | ||
this.directiveList = []; | ||
this.before = (context) => { | ||
this.field = (parent, definition, directive, context) => { | ||
if (!this.bucketName) { | ||
throw new graphql_transformer_core_1.InvalidDirectiveError('Please configure storage in your project in order to use the @predictions directive'); | ||
} | ||
}; | ||
this.field = (parent, definition, directive, context) => { | ||
if (parent.name.value !== context.output.getQueryTypeName()) { | ||
@@ -122,3 +120,3 @@ throw new graphql_transformer_core_1.InvalidDirectiveError('@predictions directive only works under Query operations.'); | ||
const roleAction = action_maps_1.actionToRoleAction.get(action); | ||
let datasource = context.api.getDataSource(datasourceName); | ||
let datasource = context.api.host.getDataSource(datasourceName); | ||
if (roleAction && !seenActions.has(action)) { | ||
@@ -185,3 +183,3 @@ role.attachInlinePolicy(new iam.Policy(stack, `${action}Access`, { | ||
case constants_1.identifyLabels: | ||
datasource = context.api.addHttpDataSource('RekognitionDataSource', cdk.Fn.sub('https://rekognition.${AWS::Region}.amazonaws.com'), { | ||
datasource = context.api.host.addHttpDataSource('RekognitionDataSource', cdk.Fn.sub('https://rekognition.${AWS::Region}.amazonaws.com'), { | ||
authorizationConfig: { | ||
@@ -194,3 +192,3 @@ signingRegion: cdk.Fn.sub('${AWS::Region}'), | ||
case constants_1.translateText: | ||
datasource = context.api.addHttpDataSource('TranslateDataSource', cdk.Fn.sub('https://translate.${AWS::Region}.amazonaws.com'), { | ||
datasource = context.api.host.addHttpDataSource('TranslateDataSource', cdk.Fn.sub('https://translate.${AWS::Region}.amazonaws.com'), { | ||
authorizationConfig: { | ||
@@ -204,3 +202,3 @@ signingRegion: cdk.Fn.sub('${AWS::Region}'), | ||
default: | ||
datasource = context.api.addLambdaDataSource('LambdaDataSource', lambda.Function.fromFunctionAttributes(stack, 'LambdaDataSourceFunction', { | ||
datasource = context.api.host.addLambdaDataSource('LambdaDataSource', lambda.Function.fromFunctionAttributes(stack, 'LambdaDataSourceFunction', { | ||
functionArn: (_a = lambdaFn) === null || _a === void 0 ? void 0 : _a.functionArn, | ||
@@ -221,3 +219,3 @@ }), {}, stack); | ||
} | ||
return context.api.addResolver(config.resolverTypeName, config.resolverFieldName, graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString(cdk.Fn.join('\n', [ | ||
return context.api.host.addResolver(config.resolverTypeName, config.resolverFieldName, graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString(cdk.Fn.join('\n', [ | ||
cdk.Fn.conditionIf(graphql_transformer_common_1.ResourceConstants.CONDITIONS.HasEnvironmentParameter, cdk.Fn.sub(`$util.qr($ctx.stash.put("s3Bucket", "${bucketName}"))`, substitutions), cdk.Fn.sub(`$util.qr($ctx.stash.put("s3Bucket", "${removeEnvReference(bucketName)}"))`, { | ||
@@ -249,3 +247,3 @@ hash: cdk.Fn.select(3, cdk.Fn.split('-', cdk.Fn.ref('AWS::StackName'))), | ||
}); | ||
return context.api.addLambdaFunction(graphql_transformer_common_1.PredictionsResourceIDs.lambdaHandlerName, `functions/${functionId}.zip`, graphql_transformer_common_1.PredictionsResourceIDs.lambdaHandlerName, path.join(__dirname, '..', 'lib', 'predictionsLambdaFunction.zip'), lambda.Runtime.NODEJS_12_X, [], role, {}, cdk.Duration.seconds(graphql_transformer_common_1.PredictionsResourceIDs.lambdaTimeout), stack); | ||
return context.api.host.addLambdaFunction(graphql_transformer_common_1.PredictionsResourceIDs.lambdaHandlerName, `functions/${functionId}.zip`, graphql_transformer_common_1.PredictionsResourceIDs.lambdaHandlerName, path.join(__dirname, '..', 'lib', 'predictionsLambdaFunction.zip'), lambda.Runtime.NODEJS_12_X, [], role, {}, cdk.Duration.seconds(graphql_transformer_common_1.PredictionsResourceIDs.lambdaTimeout), stack); | ||
} | ||
@@ -481,4 +479,4 @@ function referencesEnv(value) { | ||
} | ||
return context.api.addAppSyncFunction(`${action}Function`, graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString(graphql_mapping_template_1.print(actionFunctionResolver.request)), graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString(graphql_mapping_template_1.print(actionFunctionResolver.response)), datasourceName, stack); | ||
return context.api.host.addAppSyncFunction(`${action}Function`, graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString(graphql_mapping_template_1.print(actionFunctionResolver.request)), graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString(graphql_mapping_template_1.print(actionFunctionResolver.response)), datasourceName, stack); | ||
} | ||
//# sourceMappingURL=graphql-predictions-transformer.js.map |
{ | ||
"name": "@aws-amplify/graphql-predictions-transformer", | ||
"version": "0.2.2", | ||
"version": "0.3.0-beta.0", | ||
"description": "Amplify GraphQL @predictions tranformer", | ||
@@ -30,4 +30,4 @@ "repository": { | ||
"dependencies": { | ||
"@aws-amplify/graphql-transformer-core": "0.7.2", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.7.0", | ||
"@aws-amplify/graphql-transformer-core": "0.8.0-beta.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.8.0-beta.0", | ||
"@aws-cdk/aws-appsync": "~1.72.0", | ||
@@ -60,3 +60,3 @@ "@aws-cdk/aws-iam": "~1.72.0", | ||
}, | ||
"gitHead": "5423bebc1112e58c404e54b43e50382e7268b19e" | ||
"gitHead": "9020153805bffae7cc7470bfc946b872d37a6470" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72741
591
+ Added@aws-amplify/graphql-transformer-core@0.8.0-beta.0(transitive)
+ Added@aws-amplify/graphql-transformer-interfaces@1.8.0-beta.0(transitive)
- Removed@aws-amplify/graphql-transformer-core@0.7.2(transitive)
- Removed@aws-amplify/graphql-transformer-interfaces@1.7.0(transitive)
Updated@aws-amplify/graphql-transformer-interfaces@1.8.0-beta.0