graphql-connection-transformer
Advanced tools
Comparing version 1.0.12 to 1.0.13-unstable.1
@@ -6,2 +6,18 @@ # Change Log | ||
<a name="1.0.13-unstable.1"></a> | ||
## [1.0.13-unstable.1](https://github.com/aws-amplify/amplify-cli/compare/graphql-connection-transformer@1.0.13-unstable.0...graphql-connection-transformer@1.0.13-unstable.1) (2018-08-28) | ||
**Note:** Version bump only for package graphql-connection-transformer | ||
<a name="1.0.13-unstable.0"></a> | ||
## [1.0.13-unstable.0](https://github.com/aws-amplify/amplify-cli/compare/graphql-connection-transformer@1.0.12...graphql-connection-transformer@1.0.13-unstable.0) (2018-08-28) | ||
**Note:** Version bump only for package graphql-connection-transformer | ||
<a name="1.0.12"></a> | ||
@@ -8,0 +24,0 @@ ## [1.0.12](https://github.com/aws-amplify/amplify-cli/compare/graphql-connection-transformer@1.0.11...graphql-connection-transformer@1.0.12) (2018-08-23) |
@@ -173,2 +173,24 @@ "use strict"; | ||
}); | ||
test('Test ModelConnectionTransformer many to many should fail due to missing other "name"', function () { | ||
var validSchema = "\n type Post @model {\n id: ID!\n things: [Thing!] @connection\n }\n\n type Thing @model(queries: null, mutations: null) {\n id: ID!\n }\n "; | ||
var transformer = new graphql_transformer_core_1.default({ | ||
transformers: [ | ||
new graphql_appsync_transformer_1.default(), | ||
new graphql_dynamodb_transformer_1.default(), | ||
new ModelConnectionTransformer_1.ModelConnectionTransformer() | ||
] | ||
}); | ||
var out = transformer.transform(validSchema); | ||
expect(out).toBeDefined(); | ||
expect(out.Resources[graphql_transformer_common_1.ResolverResourceIDs.ResolverResourceID('Post', 'things')]).toBeTruthy(); | ||
var schemaDoc = graphql_1.parse(out.Resources[graphql_transformer_common_1.ResourceConstants.RESOURCES.GraphQLSchemaLogicalID].Properties.Definition); | ||
var postType = getObjectType(schemaDoc, 'Post'); | ||
var postConnection = getObjectType(schemaDoc, 'ModelPostConnection'); | ||
var thingConnection = getObjectType(schemaDoc, 'ModelThingConnection'); | ||
var thingFilterInput = getInputType(schemaDoc, 'ModelThingFilterInput'); | ||
expect(thingFilterInput).toBeDefined(); | ||
expect(postType).toBeDefined(); | ||
expect(thingConnection).toBeDefined(); | ||
expect(postConnection).toBeDefined(); | ||
}); | ||
function expectFields(type, fields) { | ||
@@ -175,0 +197,0 @@ var _loop_1 = function (fieldName) { |
@@ -15,3 +15,3 @@ "use strict"; | ||
var updatedFields = input.fields.concat([ | ||
graphql_transformer_common_1.makeArg(connectionFieldName, nonNull ? graphql_transformer_common_1.makeNonNullType(graphql_transformer_common_1.makeNamedType('ID')) : graphql_transformer_common_1.makeNamedType('ID')) | ||
graphql_transformer_common_1.makeInputValueDefinition(connectionFieldName, nonNull ? graphql_transformer_common_1.makeNonNullType(graphql_transformer_common_1.makeNamedType('ID')) : graphql_transformer_common_1.makeNamedType('ID')) | ||
]); | ||
@@ -23,3 +23,3 @@ return __assign({}, input, { fields: updatedFields }); | ||
var updatedFields = input.fields.concat([ | ||
graphql_transformer_common_1.makeArg(connectionFieldName, graphql_transformer_common_1.makeNamedType('ID')) | ||
graphql_transformer_common_1.makeInputValueDefinition(connectionFieldName, graphql_transformer_common_1.makeNamedType('ID')) | ||
]); | ||
@@ -26,0 +26,0 @@ return __assign({}, input, { fields: updatedFields }); |
@@ -223,3 +223,3 @@ "use strict"; | ||
} | ||
this.generateFilterInputs(ctx, parent); | ||
this.generateFilterInputs(ctx, returnType); | ||
} | ||
@@ -226,0 +226,0 @@ else { |
{ | ||
"name": "graphql-connection-transformer", | ||
"version": "1.0.12", | ||
"version": "1.0.13-unstable.1", | ||
"description": "An AppSync model transform for connecting objects.", | ||
@@ -9,4 +9,3 @@ "main": "lib/index.js", | ||
"build": "tsc", | ||
"clean": "rm -rf ./lib", | ||
"lint": "tslint -p ./tslint.json" | ||
"clean": "rm -rf ./lib" | ||
}, | ||
@@ -23,6 +22,6 @@ "keywords": [ | ||
"graphql": "^0.13.2", | ||
"graphql-dynamodb-transformer": "^1.0.12", | ||
"graphql-mapping-template": "^1.0.12", | ||
"graphql-transformer-common": "^1.0.12", | ||
"graphql-transformer-core": "^1.0.12" | ||
"graphql-dynamodb-transformer": "^1.0.13-unstable.1", | ||
"graphql-mapping-template": "^1.0.13-unstable.1", | ||
"graphql-transformer-common": "^1.0.13-unstable.1", | ||
"graphql-transformer-core": "^1.0.13-unstable.1" | ||
}, | ||
@@ -34,3 +33,3 @@ "devDependencies": { | ||
"aws-sdk": "^2.259.1", | ||
"graphql-appsync-transformer": "^1.0.12", | ||
"graphql-appsync-transformer": "^1.0.13-unstable.1", | ||
"jest": "^23.1.0", | ||
@@ -37,0 +36,0 @@ "ts-jest": "^22.4.6", |
@@ -261,2 +261,34 @@ import { | ||
test('Test ModelConnectionTransformer many to many should fail due to missing other "name"', () => { | ||
const validSchema = ` | ||
type Post @model { | ||
id: ID! | ||
things: [Thing!] @connection | ||
} | ||
type Thing @model(queries: null, mutations: null) { | ||
id: ID! | ||
} | ||
` | ||
const transformer = new GraphQLTransform({ | ||
transformers: [ | ||
new AppSyncTransformer(), | ||
new DynamoDBModelTransformer(), | ||
new ModelConnectionTransformer() | ||
] | ||
}) | ||
const out = transformer.transform(validSchema); | ||
expect(out).toBeDefined() | ||
expect(out.Resources[ResolverResourceIDs.ResolverResourceID('Post', 'things')]).toBeTruthy() | ||
const schemaDoc = parse(out.Resources[ResourceConstants.RESOURCES.GraphQLSchemaLogicalID].Properties.Definition) | ||
const postType = getObjectType(schemaDoc, 'Post') | ||
const postConnection = getObjectType(schemaDoc, 'ModelPostConnection') | ||
const thingConnection = getObjectType(schemaDoc, 'ModelThingConnection') | ||
const thingFilterInput = getInputType(schemaDoc, 'ModelThingFilterInput') | ||
expect(thingFilterInput).toBeDefined() | ||
expect(postType).toBeDefined() | ||
expect(thingConnection).toBeDefined() | ||
expect(postConnection).toBeDefined() | ||
}); | ||
function expectFields(type: ObjectTypeDefinitionNode, fields: string[]) { | ||
@@ -263,0 +295,0 @@ for (const fieldName of fields) { |
import { InputObjectTypeDefinitionNode } from 'graphql' | ||
import { makeArg, makeNonNullType, makeNamedType } from 'graphql-transformer-common'; | ||
import { makeInputValueDefinition, makeNonNullType, makeNamedType } from 'graphql-transformer-common'; | ||
@@ -11,3 +11,3 @@ export function updateCreateInputWithConnectionField( | ||
...input.fields, | ||
makeArg(connectionFieldName, nonNull ? makeNonNullType(makeNamedType('ID')) : makeNamedType('ID')) | ||
makeInputValueDefinition(connectionFieldName, nonNull ? makeNonNullType(makeNamedType('ID')) : makeNamedType('ID')) | ||
] | ||
@@ -26,3 +26,3 @@ return { | ||
...input.fields, | ||
makeArg(connectionFieldName, makeNamedType('ID')) | ||
makeInputValueDefinition(connectionFieldName, makeNamedType('ID')) | ||
] | ||
@@ -29,0 +29,0 @@ return { |
@@ -307,3 +307,3 @@ import { Transformer, TransformerContext, InvalidDirectiveError } from 'graphql-transformer-core' | ||
this.generateFilterInputs(ctx, parent) | ||
this.generateFilterInputs(ctx, returnType) | ||
} else { | ||
@@ -310,0 +310,0 @@ throw new InvalidDirectiveError(`Could not find a object or interface type named ${parent.name.value}.`) |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
108867
1504
2