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 node-fetch from 1.7.3 to 2.6.7 in /example #472

Open
wants to merge 15 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
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
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ custom:
logConfig:
loggingRoleArn: { Fn::GetAtt: [AppSyncLoggingServiceRole, Arn] } # Where AppSyncLoggingServiceRole is a role with CloudWatch Logs write access
level: ERROR # Logging Level: NONE | ERROR | ALL
excludeVerboseContent: false
excludeVerboseContent: false # Bool, Optional. Enable ExcludeVerboseContent. disabled by default(= Include verbose content in logs is default).
defaultMappingTemplates: # default templates. Useful for Lambda templates that are often repetitive. Will be used if the template is not specified in a resolver
request: my.request.template.tpl # or, e.g: false for Direct lambdas
response: my.response.template.tpl # or e.g.: false for Direct lambdas
Expand All @@ -125,6 +125,7 @@ custom:
- # function name
request: # request mapping template name | defaults to `defaultMappingTemplates.request` or {type}.{field}.request.vtl
response: # response mapping template name | defaults to `defaultMappingTemplates.response` or {type}.{field}.response.vtl
maxBatchSize: # maximum number of requests for BatchInvoke operations
# When caching is enaled with `PER_RESOLVER_CACHING`,
# the caching options of the resolver.
# Disabled by default.
Expand Down Expand Up @@ -162,6 +163,7 @@ custom:
dataSource: # data source name
request: # request mapping template name | defaults to {name}.request.vtl
response: # reponse mapping template name | defaults to {name}.response.vtl
maxBatchSize: # maximum number of requests for BatchInvoke operations
dataSources:
- type: NONE
name: none
Expand Down Expand Up @@ -759,9 +761,9 @@ You are also very welcome to open a PR and we will gladely review it.

- *Part 1:* [Running a scalable & reliable GraphQL endpoint with Serverless](https://serverless.com/blog/running-scalable-reliable-graphql-endpoint-with-serverless/)

- *Part 2:* [AppSync Backend: AWS Managed GraphQL Service](https://medium.com/@sid88in/running-a-scalable-reliable-graphql-endpoint-with-serverless-24c3bb5acb43)
- *Part 2:* [AppSync Backend: AWS Managed GraphQL Service](https://medium.com/@sid88in/running-a-scalable-reliable-graphql-endpoint-with-serverless-24c3bb5acb43)

- *Part 3:* [AppSync Frontend: AWS Managed GraphQL Service](https://hackernoon.com/running-a-scalable-reliable-graphql-endpoint-with-serverless-db16e42dc266)
- *Part 3:* [AppSync Frontend: AWS Managed GraphQL Service](https://hackernoon.com/running-a-scalable-reliable-graphql-endpoint-with-serverless-db16e42dc266)

- *Part 4:* [Serverless AppSync Plugin: Top 10 New Features](https://medium.com/hackernoon/serverless-appsync-plugin-top-10-new-features-3faaf6789480)

Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"babel-polyfill": "^6.26.0",
"bluebird": "^3.5.1",
"node-fetch": "^1.7.3",
"node-fetch": "^2.6.7",
"oauth": "^0.9.15",
"twitter": "^1.7.1"
},
Expand Down
30 changes: 15 additions & 15 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1593,13 +1593,6 @@ emojis-list@^2.0.0:
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k=

encoding@^0.1.11:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=
dependencies:
iconv-lite "~0.4.13"

end-of-stream@^1.0.0:
version "1.4.4"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
Expand Down Expand Up @@ -2289,7 +2282,7 @@ https-browserify@^1.0.0:
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=

[email protected], iconv-lite@^0.4.4, iconv-lite@~0.4.13:
[email protected], iconv-lite@^0.4.4:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
Expand Down Expand Up @@ -2553,7 +2546,7 @@ is-primitive@^2.0.0:
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU=

is-stream@^1.0.1, is-stream@^1.1.0:
is-stream@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
Expand Down Expand Up @@ -3416,13 +3409,12 @@ next-tick@~1.0.0:
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
integrity sha1-yobR/ogoFpsBICCOPchCS524NCw=

node-fetch@^1.7.3:
version "1.7.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef"
integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==
node-fetch@^2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
encoding "^0.1.11"
is-stream "^1.0.1"
whatwg-url "^5.0.0"

node-int64@^0.4.0:
version "0.4.0"
Expand Down Expand Up @@ -5036,6 +5028,14 @@ whatwg-url@^4.3.0:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"

which-module@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
Expand Down
59 changes: 57 additions & 2 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,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 +1490,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 +1511,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 +2065,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.12.1",
"description": "AWS AppSync support for the Serverless Framework",
"main": "src/index.js",
"repository": "https://github.com/sid88in/serverless-appsync-plugin",
Expand Down
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,10 @@ class ServerlessAppsyncPlugin {
FunctionVersion: '2018-05-29',
};

if (tpl.maxBatchSize) {
Properties.MaxBatchSize = tpl.maxBatchSize;
}

const requestTemplate = has('request')(tpl)
? tpl.request
: config.defaultMappingTemplates.request;
Expand Down Expand Up @@ -1193,6 +1197,10 @@ class ServerlessAppsyncPlugin {
FieldName: tpl.field,
};

if (tpl.maxBatchSize) {
Properties.MaxBatchSize = tpl.maxBatchSize;
}

const requestTemplate = has('request')(tpl)
? tpl.request
: config.defaultMappingTemplates.request;
Expand Down Expand Up @@ -1337,7 +1345,7 @@ class ServerlessAppsyncPlugin {
wafConfig.visibilityConfig,
Name,
),
Tags: apiConfig.tags,
Tags: !apiConfig.tags ? undefined : this.getTagsConfig(apiConfig),
},
},
[wafAssocLogicalId]: {
Expand Down
Loading