Skip to content

Commit

Permalink
Merge pull request #156 from sid88in/revert-155-master
Browse files Browse the repository at this point in the history
Revert "Add support for Multiple APIs"
  • Loading branch information
sid88in authored Sep 20, 2018
2 parents 20fe90a + 305b5e8 commit d4e23bc
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 156 deletions.
51 changes: 24 additions & 27 deletions __snapshots__/get-config.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,27 @@ exports[`authenticationType is missing 1`] = `"appSync property \`authentication
exports[`authenticationType is missing 2`] = `"appSync property \`authenticationType\` is missing or invalid."`;

exports[`returns valid config 1`] = `
Array [
Object {
"apiId": undefined,
"apiKey": undefined,
"authenticationType": "AWS_IAM",
"dataSources": Array [
Object {
"name": "users",
"type": "AMAZON_DYNAMODB",
},
Object {
"name": "tweets",
"type": "AMAZON_DYNAMODB",
},
],
"isSingleConfig": true,
"logConfig": undefined,
"mappingTemplates": Array [],
"mappingTemplatesLocation": "mapping-templates",
"name": "api",
"openIdConnectConfig": undefined,
"region": "us-east-1",
"schema": "type Mutation {
Object {
"apiId": undefined,
"apiKey": undefined,
"authenticationType": "AWS_IAM",
"dataSources": Array [
Object {
"name": "users",
"type": "AMAZON_DYNAMODB",
},
Object {
"name": "tweets",
"type": "AMAZON_DYNAMODB",
},
],
"logConfig": undefined,
"mappingTemplates": Array [],
"mappingTemplatesLocation": "mapping-templates",
"name": "api",
"openIdConnectConfig": undefined,
"region": "us-east-1",
"schema": "type Mutation {
# Create a tweet for a user
# consumer keys and tokens are not required for dynamo integration
createTweet(
Expand Down Expand Up @@ -121,8 +119,7 @@ schema {
subscription: Subscription
}
",
"substitutions": Object {},
"userPoolConfig": undefined,
},
]
"substitutions": Object {},
"userPoolConfig": undefined,
}
`;
14 changes: 1 addition & 13 deletions get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const objectToArrayWithNameProp = pipe(
values,
);

const getConfig = (config, provider, servicePath) => {
module.exports = (config, provider, servicePath) => {
if (
!(
config.authenticationType === 'API_KEY' ||
Expand Down Expand Up @@ -65,15 +65,3 @@ const getConfig = (config, provider, servicePath) => {
substitutions: config.substitutions || {},
};
};

module.exports = (config, provider, servicePath) => {
if (!config) {
return [];
} else if (config.constructor === Array) {
return config.map(apiConfig => getConfig(apiConfig, provider, servicePath));
} else {
const singleConfig = getConfig(config, provider, servicePath);
singleConfig.isSingleConfig = true;
return [singleConfig];
}
};
Loading

0 comments on commit d4e23bc

Please sign in to comment.