@aws-amplify/graphql-searchable-transformer
Advanced tools
Comparing version 0.5.1 to 0.6.0-auth-dir-v-next.0
@@ -6,2 +6,16 @@ # Change Log | ||
# [0.6.0-auth-dir-v-next.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-searchable-transformer@0.5.1...@aws-amplify/graphql-searchable-transformer@0.6.0-auth-dir-v-next.0) (2021-09-14) | ||
### Features | ||
* [@model](https://github.com/model) conflict resolution ([3f93ab1](https://github.com/aws-amplify/amplify-cli/commit/3f93ab1fb349605d57aa976ce9831488db2403a5)) | ||
* graphql auth v2 add auth on mutation and subscription resolvers ([acaff15](https://github.com/aws-amplify/amplify-cli/commit/acaff150efa7da285330e718aaf3fc36cae465d8)) | ||
* graphql auth v2 add schemaChanges, iam policy generation, and query/read resolvers ([7ac761b](https://github.com/aws-amplify/amplify-cli/commit/7ac761b422c23f09eea2602f147ebfd6052e5c80)) | ||
* **graphql-model-transformer:** set up transformer for sandbox mode directive ([#8138](https://github.com/aws-amplify/amplify-cli/issues/8138)) ([e805311](https://github.com/aws-amplify/amplify-cli/commit/e805311d80393afef7e0bc7ad757b51706e7a3bf)) | ||
## [0.5.1](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-searchable-transformer@0.5.0...@aws-amplify/graphql-searchable-transformer@0.5.1) (2021-09-02) | ||
@@ -8,0 +22,0 @@ |
@@ -6,2 +6,3 @@ "use strict"; | ||
const graphql_transformer_common_1 = require("graphql-transformer-common"); | ||
const authFilter = graphql_mapping_template_1.ref('ctx.stash.authFilter'); | ||
function requestTemplate(primaryKey, nonKeywordFields, includeVersion = false, type) { | ||
@@ -26,2 +27,11 @@ return graphql_mapping_template_1.print(graphql_mapping_template_1.compoundExpression([ | ||
]), | ||
graphql_mapping_template_1.ifElse(graphql_mapping_template_1.not(graphql_mapping_template_1.isNullOrEmpty(authFilter)), graphql_mapping_template_1.compoundExpression([ | ||
graphql_mapping_template_1.set(graphql_mapping_template_1.ref('filter'), authFilter), | ||
graphql_mapping_template_1.iff(graphql_mapping_template_1.not(graphql_mapping_template_1.isNullOrEmpty(graphql_mapping_template_1.ref('ctx.args.filter'))), graphql_mapping_template_1.set(graphql_mapping_template_1.ref('filter'), graphql_mapping_template_1.list([ | ||
graphql_mapping_template_1.obj({ | ||
bool: graphql_mapping_template_1.obj({ must: graphql_mapping_template_1.list([graphql_mapping_template_1.ref('ctx.stash.authFilter'), graphql_mapping_template_1.ref('util.transform.toElasticsearchQueryDSL($ctx.args.filter)')]) }), | ||
}), | ||
]))), | ||
]), graphql_mapping_template_1.iff(graphql_mapping_template_1.not(graphql_mapping_template_1.isNullOrEmpty(graphql_mapping_template_1.ref('ctx.args.filter'))), graphql_mapping_template_1.set(graphql_mapping_template_1.ref('filter'), graphql_mapping_template_1.ref('ctx.args.filter')))), | ||
graphql_mapping_template_1.iff(graphql_mapping_template_1.isNullOrEmpty(graphql_mapping_template_1.ref('filter')), graphql_mapping_template_1.set(graphql_mapping_template_1.ref('filter'), graphql_mapping_template_1.obj({ match_all: graphql_mapping_template_1.obj({}) }))), | ||
graphql_mapping_template_1.SearchableMappingTemplate.searchTemplate({ | ||
@@ -33,5 +43,3 @@ path: graphql_mapping_template_1.str('$indexPath'), | ||
version: graphql_mapping_template_1.bool(includeVersion), | ||
query: graphql_mapping_template_1.ifElse(graphql_mapping_template_1.ref('context.args.filter'), graphql_mapping_template_1.ref('util.transform.toElasticsearchQueryDSL($ctx.args.filter)'), graphql_mapping_template_1.obj({ | ||
match_all: graphql_mapping_template_1.obj({}), | ||
})), | ||
query: graphql_mapping_template_1.methodCall(graphql_mapping_template_1.ref('util.toJson'), graphql_mapping_template_1.ref('filter')), | ||
sort: graphql_mapping_template_1.ref('sortValues'), | ||
@@ -38,0 +46,0 @@ aggs: graphql_mapping_template_1.ref('util.toJson($aggregateValues)'), |
@@ -39,3 +39,3 @@ "use strict"; | ||
}); | ||
const isProjectUsingDataStore = false; | ||
const isProjectUsingDataStore = context.isProjectUsingDataStore(); | ||
stack.templateOptions.description = 'An auto-generated nested stack for searchable.'; | ||
@@ -63,3 +63,3 @@ stack.templateOptions.templateFormatVersion = '2010-09-09'; | ||
resolver.mapToStack(stack); | ||
context.resolvers.addResolver(type, def.fieldName, resolver); | ||
context.resolvers.addResolver(typeName, def.fieldName, resolver); | ||
} | ||
@@ -66,0 +66,0 @@ create_cfnOutput_1.createStackOutputs(stack, domain.domainEndpoint, context.api.apiId, domain.domainArn); |
{ | ||
"name": "@aws-amplify/graphql-searchable-transformer", | ||
"version": "0.5.1", | ||
"version": "0.6.0-auth-dir-v-next.0", | ||
"description": "Amplfy GraphQL @searchable transformer", | ||
@@ -30,4 +30,4 @@ "repository": { | ||
"dependencies": { | ||
"@aws-amplify/graphql-transformer-core": "0.9.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.9.0", | ||
"@aws-amplify/graphql-transformer-core": "0.10.0-auth-dir-v-next.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.10.0-auth-dir-v-next.0", | ||
"@aws-cdk/aws-appsync": "~1.119.0", | ||
@@ -41,4 +41,4 @@ "@aws-cdk/aws-dynamodb": "~1.119.0", | ||
"graphql": "^14.5.8", | ||
"graphql-mapping-template": "4.18.3", | ||
"graphql-transformer-common": "4.19.9" | ||
"graphql-mapping-template": "4.19.0-auth-dir-v-next.0", | ||
"graphql-transformer-common": "4.19.10-auth-dir-v-next.0" | ||
}, | ||
@@ -66,3 +66,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "8738095619ba2bc2f01d381d816fc0f65bb3f88f" | ||
"gitHead": "31371e987e129894a3bdc0c2cc66c3980b2bde81" | ||
} |
@@ -20,5 +20,9 @@ import { | ||
methodCall, | ||
isNullOrEmpty, | ||
not, | ||
} from 'graphql-mapping-template'; | ||
import { ResourceConstants } from 'graphql-transformer-common'; | ||
const authFilter = ref('ctx.stash.authFilter'); | ||
export function requestTemplate(primaryKey: string, nonKeywordFields: Expression[], includeVersion: boolean = false, type: string): string { | ||
@@ -68,2 +72,21 @@ return print( | ||
]), | ||
ifElse( | ||
not(isNullOrEmpty(authFilter)), | ||
compoundExpression([ | ||
set(ref('filter'), authFilter), | ||
iff( | ||
not(isNullOrEmpty(ref('ctx.args.filter'))), | ||
set( | ||
ref('filter'), | ||
list([ | ||
obj({ | ||
bool: obj({ must: list([ref('ctx.stash.authFilter'), ref('util.transform.toElasticsearchQueryDSL($ctx.args.filter)')]) }), | ||
}), | ||
]), | ||
), | ||
), | ||
]), | ||
iff(not(isNullOrEmpty(ref('ctx.args.filter'))), set(ref('filter'), ref('ctx.args.filter'))), | ||
), | ||
iff(isNullOrEmpty(ref('filter')), set(ref('filter'), obj({ match_all: obj({}) }))), | ||
SearchableMappingTemplate.searchTemplate({ | ||
@@ -75,9 +98,3 @@ path: str('$indexPath'), | ||
version: bool(includeVersion), | ||
query: ifElse( | ||
ref('context.args.filter'), | ||
ref('util.transform.toElasticsearchQueryDSL($ctx.args.filter)'), | ||
obj({ | ||
match_all: obj({}), | ||
}), | ||
), | ||
query: methodCall(ref('util.toJson'), ref('filter')), | ||
sort: ref('sortValues'), | ||
@@ -84,0 +101,0 @@ aggs: ref('util.toJson($aggregateValues)'), |
@@ -80,3 +80,3 @@ import { TransformerPluginBase, InvalidDirectiveError, MappingTemplate, DirectiveWrapper } from '@aws-amplify/graphql-transformer-core'; | ||
const isProjectUsingDataStore = false; | ||
const isProjectUsingDataStore = context.isProjectUsingDataStore(); | ||
@@ -142,3 +142,3 @@ stack.templateOptions.description = 'An auto-generated nested stack for searchable.'; | ||
resolver.mapToStack(stack); | ||
context.resolvers.addResolver(type, def.fieldName, resolver); | ||
context.resolvers.addResolver(typeName, def.fieldName, resolver); | ||
} | ||
@@ -145,0 +145,0 @@ |
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
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
381552
2527
+ Added@aws-amplify/graphql-transformer-core@0.10.0-auth-dir-v-next.0(transitive)
+ Added@aws-amplify/graphql-transformer-interfaces@1.10.0-auth-dir-v-next.0(transitive)
+ Addedgraphql-mapping-template@4.19.0-auth-dir-v-next.0(transitive)
+ Addedgraphql-transformer-common@4.19.10-auth-dir-v-next.0(transitive)
- Removed@aws-amplify/graphql-transformer-core@0.9.0(transitive)
- Removed@aws-amplify/graphql-transformer-interfaces@1.9.0(transitive)
- Removedgraphql-mapping-template@4.18.3(transitive)
- Removedgraphql-transformer-common@4.19.9(transitive)
Updated@aws-amplify/graphql-transformer-core@0.10.0-auth-dir-v-next.0
Updated@aws-amplify/graphql-transformer-interfaces@1.10.0-auth-dir-v-next.0