Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-cache-control

Package Overview
Dependencies
Maintainers
2
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-cache-control - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

4

CHANGELOG.md
# Changelog
### v0.1.1
* Fix `defaultMaxAge` feature (introduced in 0.1.0) so that `maxAge: 0` overrides the default, as previously documented.
### v0.1.0

@@ -4,0 +8,0 @@

@@ -99,2 +99,16 @@ "use strict";

}); });
it('should overwrite the default maxAge when maxAge=0 is specified on the type', function () { return __awaiter(_this, void 0, void 0, function () {
var schema, hints;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
schema = graphql_1.buildSchema("\n type Query {\n droid(id: ID!): Droid\n }\n\n type Droid @cacheControl(maxAge: 0) {\n id: ID!\n name: String!\n }\n ");
return [4 /*yield*/, helpers_1.collectCacheControlHints(schema, "\n query {\n droid(id: 2001) {\n name\n }\n }\n ", { defaultMaxAge: 10 })];
case 1:
hints = _a.sent();
expect(hints).toContainEqual({ path: ['droid'], maxAge: 0 });
return [2 /*return*/];
}
});
}); });
it('should override the maxAge from the target type with that specified on a field', function () { return __awaiter(_this, void 0, void 0, function () {

@@ -101,0 +115,0 @@ var schema, hints;

2

lib/index.js

@@ -109,3 +109,3 @@ "use strict";

return {
maxAge: otherHint.maxAge || hint.maxAge,
maxAge: otherHint.maxAge !== undefined ? otherHint.maxAge : hint.maxAge,
scope: otherHint.scope || hint.scope

@@ -112,0 +112,0 @@ };

{
"name": "apollo-cache-control",
"version": "0.1.0",
"version": "0.1.1",
"description": "A GraphQL extension for cache control",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -116,2 +116,29 @@ import {

it('should overwrite the default maxAge when maxAge=0 is specified on the type', async () => {
const schema = buildSchema(`
type Query {
droid(id: ID!): Droid
}
type Droid @cacheControl(maxAge: 0) {
id: ID!
name: String!
}
`);
const hints = await collectCacheControlHints(
schema,
`
query {
droid(id: 2001) {
name
}
}
`,
{ defaultMaxAge: 10 },
);
expect(hints).toContainEqual({ path: ['droid'], maxAge: 0 });
});
it('should override the maxAge from the target type with that specified on a field', async () => {

@@ -118,0 +145,0 @@ const schema = buildSchema(`

@@ -149,5 +149,5 @@ import {

return {
maxAge: otherHint.maxAge || hint.maxAge,
maxAge: otherHint.maxAge !== undefined ? otherHint.maxAge : hint.maxAge,
scope: otherHint.scope || hint.scope
};
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc