Skip to content

Commit

Permalink
fix(amplify-graphql-auth-transformer, amplify-graphql-relational-tran…
Browse files Browse the repository at this point in the history
…sformer, amplify-graphql-transformer-core): support custom primary key with relational directives (aws-amplify#462)

* fix(amplify-graphql-auth-transformer, amplify-graphql-relational-transformer, amplify-graphql-transformer-core): support custom primary key with relational directives

* fix: fixed refactor incorrect hanlding for filter vs connection input names

* fix: merge build errors

* fix: merge caused unit test failures

* fix: merge caused e2e failures

* fix: merge caused e2e failures

* addressing PR feedback

* fix: corrected allowed fields for relational fields with custom PK and restricted auth

* fix: fixed imports and e2e feature flag initialization
  • Loading branch information
marcvberg committed Aug 12, 2022
1 parent 4c107d2 commit 5e5f66e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FeatureFlagProvider } from '@aws-amplify/graphql-transformer-interfaces';
import {getBaseType} from "graphql-transformer-common";
import {DirectiveNode, DocumentNode} from "graphql";
import { getBaseType } from 'graphql-transformer-common';
import { DirectiveNode, DocumentNode } from 'graphql';

/**
* Merges passed in feature flags with default feature flags for tests
Expand All @@ -15,7 +15,7 @@ export const featureFlags: FeatureFlagProvider = {
}
return defaultValue;
},


getNumber: jest.fn(),
getObject: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ export class HasOneTransformer extends TransformerPluginBase {
[connectionAttributeName, ...sortKeyFields.map(skf => skf.name.value)],
)) as WritableDraft<ArgumentNode>];
addFieldsToDefinition(def, [connField, ...sortKeyFields]);
def?.fields?.push(
makeField(
connectionAttributeName, [], isNonNullType(field.type)
? makeNonNullType(makeNamedType('ID')) : makeNamedType('ID'), [],
) as WritableDraft<FieldDefinitionNode>,
);
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const featureFlags: FeatureFlagProvider = {
}
return false;
},


getNumber: jest.fn(),
getObject: jest.fn(),
Expand Down Expand Up @@ -90,7 +90,7 @@ function createV2Transformer(options: Partial<Writeable<GraphQLTransformOptions>
}
return defaultValue;
},


getNumber: jest.fn(),
getObject: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('@belongsTo transformer', () => {
}
return defaultValue;
},


getNumber: jest.fn(),
getObject: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ describe('@mapsTo transformer', () => {
}
return defaultValue;
},


getNumber: jest.fn(),
getObject: jest.fn(),
},
Expand Down

0 comments on commit 5e5f66e

Please sign in to comment.