Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-amplify/graphql-searchable-transformer

Package Overview
Dependencies
Maintainers
7
Versions
440
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/graphql-searchable-transformer - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0-auth-dir-v-next.0

14

CHANGELOG.md

@@ -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 @@

14

lib/generate-resolver-vtl.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc