Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump async from 2.6.3 to 2.6.4 in /example #487

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,15 @@
"contributions": [
"code"
]
},
{
"login": "nvanlo",
"name": "Nik Van Looy",
"avatar_url": "https://avatars.githubusercontent.com/u/68108702?v=4",
"profile": "https://github.com/nvanlo",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
node_modules
npm-debug.log
yarn-error.json
yarn-error.log
users.json

# serverless zip
Expand Down
259 changes: 170 additions & 89 deletions README.md

Large diffs are not rendered by default.

119 changes: 119 additions & 0 deletions __snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2448,6 +2448,125 @@ Object {
},
"Type": "AWS::IAM::Role",
},
"GraphQlDsOpenSearchSource2Role": Object {
"Properties": Object {
"AssumeRolePolicyDocument": Object {
"Statement": Array [
Object {
"Action": Array [
"sts:AssumeRole",
],
"Effect": "Allow",
"Principal": Object {
"Service": Array [
"appsync.amazonaws.com",
],
},
},
],
"Version": "2012-10-17",
},
"Policies": Array [
Object {
"PolicyDocument": Object {
"Statement": Array [
Object {
"Action": Array [
"es:ESHttpDelete",
"es:ESHttpGet",
"es:ESHttpHead",
"es:ESHttpPost",
"es:ESHttpPut",
"es:ESHttpPatch",
],
"Effect": "Allow",
"Resource": Array [
Object {
"Fn::Join": Array [
"/",
Array [
Object {
"Fn::GetAtt": Array [
Object {
"Ref": "OSDomain",
},
"Arn",
],
},
"*",
],
],
},
],
},
],
"Version": "2012-10-17",
},
"PolicyName": "GraphQlDsOpenSearchSource2Policy",
},
],
},
"Type": "AWS::IAM::Role",
},
"GraphQlDsOpenSearchSourceRole": Object {
"Properties": Object {
"AssumeRolePolicyDocument": Object {
"Statement": Array [
Object {
"Action": Array [
"sts:AssumeRole",
],
"Effect": "Allow",
"Principal": Object {
"Service": Array [
"appsync.amazonaws.com",
],
},
},
],
"Version": "2012-10-17",
},
"Policies": Array [
Object {
"PolicyDocument": Object {
"Statement": Array [
Object {
"Action": Array [
"es:ESHttpDelete",
"es:ESHttpGet",
"es:ESHttpHead",
"es:ESHttpPost",
"es:ESHttpPut",
"es:ESHttpPatch",
],
"Effect": "Allow",
"Resource": Array [
Object {
"Fn::Join": Array [
":",
Array [
"arn",
"aws",
"es",
"us-east-1",
Object {
"Ref": "AWS::AccountId",
},
"domain/search-my-os-domain-abcdefghijklmnop.us-east-1.es.amazonaws.com/*",
],
],
},
],
},
],
"Version": "2012-10-17",
},
"PolicyName": "GraphQlDsOpenSearchSourcePolicy",
},
],
},
"Type": "AWS::IAM::Role",
},
"GraphQlDsRelationalDbSourceRole": Object {
"Properties": Object {
"AssumeRolePolicyDocument": Object {
Expand Down
12 changes: 6 additions & 6 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ async-each@^1.0.1:
integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==

async@^2.0.0, async@^2.1.2, async@^2.1.4:
version "2.6.3"
resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff"
integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==
version "2.6.4"
resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221"
integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==
dependencies:
lodash "^4.17.14"

Expand Down Expand Up @@ -3141,9 +3141,9 @@ locate-path@^2.0.0:
path-exists "^3.0.0"

lodash@^4.17.14, lodash@^4.17.4, lodash@^4.8.0:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

longest@^1.0.1:
version "1.0.1"
Expand Down
92 changes: 90 additions & 2 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,27 @@ describe('iamRoleStatements', () => {
},
},
},
{
type: 'AMAZON_OPENSEARCH_SERVICE',
name: 'OpenSearchSource',
description: 'My OpenSearch Source',
config: {
region: 'us-east-1',
endpoint:
'https://search-my-os-domain-abcdefghijklmnop.us-east-1.es.amazonaws.com',
},
},
{
type: 'AMAZON_OPENSEARCH_SERVICE',
name: 'OpenSearchSource2',
description: 'other OS Source',
config: {
region: 'us-east-1',
domain: {
Ref: 'OSDomain',
},
},
},
],
});

Expand Down Expand Up @@ -1009,6 +1030,18 @@ describe('iamRoleStatements', () => {
'https://search-my-domain-abcdefghijklmnop.us-east-1.es.amazonaws.com',
},
},
{
type: 'AMAZON_OPENSEARCH',
name: 'OpenSearchSource',
description: 'My OpenSearch Source',
config: {
serviceRoleArn:
'arn:aws:iam::123456789012:role/service-role/myOsRole',
region: 'us-east-1',
endpoint:
'https://search-my-os-domain-abcdefghijklmnop.us-east-1.es.amazonaws.com',
},
},
{
type: 'HTTP',
name: 'HTTPSource',
Expand Down Expand Up @@ -1447,7 +1480,27 @@ describe('Templates', () => {
).not.toHaveProperty('ResponseMappingTemplate');
});

test('Pileline Resolver with template', () => {
test('Batch resolvers', () => {
const apiConfig = {
...config,
mappingTemplates: [
{
dataSource: 'ds',
type: 'Query',
field: 'field',
maxBatchSize: 5,
},
],
};

const apiResources = plugin.getResolverResources(apiConfig);
expect(apiResources.GraphQlResolverQueryfield.Properties).toHaveProperty(
'MaxBatchSize',
5,
);
});

test('Pipeline Resolver with template', () => {
const apiConfig = {
...config,
functionConfigurationsLocation: 'mapping-templates',
Expand All @@ -1470,7 +1523,7 @@ describe('Templates', () => {
).toHaveProperty('ResponseMappingTemplate');
});

test('Pileline Resolver without template', () => {
test('Pipeline Resolver without template', () => {
const apiConfig = {
...config,
functionConfigurationsLocation: 'mapping-templates',
Expand All @@ -1491,6 +1544,25 @@ describe('Templates', () => {
apiResources.GraphQlFunctionConfigurationpipeline.Properties,
).not.toHaveProperty('ResponseMappingTemplate');
});

test('Pipeline Resolver with batching', () => {
const apiConfig = {
...config,
functionConfigurationsLocation: 'mapping-templates',
functionConfigurations: [
{
dataSource: 'ds',
name: 'pipeline',
maxBatchSize: 5,
},
],
};

const apiResources = plugin.getFunctionConfigurationResources(apiConfig);
expect(
apiResources.GraphQlFunctionConfigurationpipeline.Properties,
).toHaveProperty('MaxBatchSize', 5);
});
});

describe('SyncConfig', () => {
Expand Down Expand Up @@ -2026,4 +2098,20 @@ describe('WAF', () => {
};
expect(plugin.getWafResources(apiConfig)).toMatchSnapshot();
});

it('should generate API key WAF with tags', () => {
const apiConfig = {
...config,
wafConfig: { enabled: true },
tags: {
testKey: 'testValue',
},
};

const waf = plugin.getWafResources(apiConfig);
const tags = waf.GraphQlWaf.Properties.Tags;

expect(tags[0].Key).toBe('testKey');
expect(tags[0].Value).toBe('testValue');
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-appsync-plugin",
"version": "1.12.0",
"version": "1.13.0",
"description": "AWS AppSync support for the Serverless Framework",
"main": "src/index.js",
"repository": "https://github.com/sid88in/serverless-appsync-plugin",
Expand Down
Loading