Socket
Socket
Sign inDemoInstall

apollo-cache-control

Package Overview
Dependencies
Maintainers
1
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.300.0-alpha.3 to 0.300.0-alpha.4

src/__tests__/tsconfig.tsbuildinfo

3

dist/index.js

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

})(CacheScope = exports.CacheScope || (exports.CacheScope = {}));
exports.plugin = (options = Object.create(null)) => ({
const plugin = (options = Object.create(null)) => ({
requestDidStart(requestContext) {

@@ -87,2 +87,3 @@ const defaultMaxAge = options.defaultMaxAge || 0;

});
exports.plugin = plugin;
function cacheHintFromDirectives(directives) {

@@ -89,0 +90,0 @@ if (!directives)

{
"name": "apollo-cache-control",
"version": "0.300.0-alpha.3",
"version": "0.300.0-alpha.4",
"description": "A GraphQL extension for cache control",

@@ -11,7 +11,7 @@ "main": "./dist/index.js",

"engines": {
"node": ">=12.0 <15.0"
"node": ">=12.0"
},
"dependencies": {
"apollo-server-env": "^3.0.0-alpha.3",
"apollo-server-plugin-base": "^0.300.0-alpha.3"
"apollo-server-env": "^3.1.0-alpha.4",
"apollo-server-plugin-base": "^0.300.0-alpha.4"
},

@@ -21,3 +21,3 @@ "peerDependencies": {

},
"gitHead": "15b90eec22523e32e00d97a51b28cbfba3f39c78"
"gitHead": "97073f33d30f2d682655eb0e4dce1d7d43721807"
}

@@ -7,4 +7,8 @@ # Apollo Cache Control (for Node.js)

This data can be consumed by [Apollo Engine](https://www.apollographql.com/engine/) or any other tool to inform caching and visualize the cache policies that are in effect for a particular request.
This data can be consumed by any tool to inform caching and visualize the cache policies that are in effect for a particular request.
Uses for this data include apollo-server-plugin-response-cache (which implements a full response cache) and setting cache-control HTTP headers.
See https://www.apollographql.com/docs/apollo-server/performance/caching/ for more details.
## Usage

@@ -31,3 +35,3 @@

Cache hints can be added to your schema using directives on your types and fields. When executing your query, these hints will be added to the response and interpreted by Engine to compute a cache policy for the response. Hints on fields override hints specified on the target type.
Cache hints can be added to your schema using directives on your types and fields. When executing your query, these hints will be used to compute an overall cache policy for the response. Hints on fields override hints specified on the target type. With Apollo Server 3, you need to include the definition for the `@cacheControl` directive in your schema.

@@ -42,2 +46,12 @@ ```graphql

}
enum CacheControlScope {
PUBLIC
PRIVATE
}
directive @cacheControl(
maxAge: Int
scope: CacheControlScope
) on FIELD_DEFINITION | OBJECT | INTERFACE
```

@@ -44,0 +58,0 @@

@@ -33,3 +33,4 @@ import { ResponsePath, GraphQLError } from 'graphql';

overallCachePolicy,
graphqlRequest: { query: 'does not matter' },
// This query needs to pass graphql validation
graphqlRequest: { query: 'query { hello }' },
executor: () => {

@@ -116,2 +117,3 @@ const response: GraphQLResponse = {

prev: undefined,
typename: undefined,
};

@@ -121,2 +123,3 @@ const responseSubPath: ResponsePath = {

prev: responsePath,
typename: undefined,
};

@@ -126,2 +129,3 @@ const responseSubSubPath: ResponsePath = {

prev: responseSubPath,
typename: undefined,
};

@@ -128,0 +132,0 @@

import { buildSchema } from 'graphql';
import { makeExecutableSchema } from 'graphql-tools';
import {
makeExecutableSchema,
IExecutableSchemaDefinition,
} from '@graphql-tools/schema';
type FirstArg<F> = F extends (arg: infer A) => any ? A : never;
export function augmentTypeDefsWithCacheControlSupport(typeDefs: string) {

@@ -27,3 +28,3 @@ return (

export function makeExecutableSchemaWithCacheControlSupport(
options: FirstArg<typeof makeExecutableSchema> & { typeDefs: string },
options: IExecutableSchemaDefinition & { typeDefs: string },
) {

@@ -30,0 +31,0 @@ return makeExecutableSchema({

@@ -28,3 +28,3 @@ import {

defaultMaxAge?: number;
// FIXME: We should replace these with
// TODO: We should replace these with
// more appropriately named options.

@@ -169,3 +169,3 @@ calculateHttpHeaders?: boolean;

// apollo-server-core/ApolloServer), in order to include the
// engineproxy-aimed extensions. Specifically, we want users of
// old engineproxy-aimed extensions. Specifically, we want users of
// apollo-server-plugin-response-cache to be able to specify

@@ -172,0 +172,0 @@ // `cacheControl: {defaultMaxAge: 600}` without accidentally turning on

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