mercurius-auth
Advanced tools
Comparing version 2.0.1 to 2.0.2
'use strict' | ||
const { | ||
wrapSchema, | ||
PruneSchema, | ||
FilterTypes, | ||
TransformObjectFields, | ||
FilterInputObjectFields | ||
} = require('@graphql-tools/wrap') | ||
const { GraphQLObjectType } = require('graphql') | ||
const { pruneSchema } = require('./prune-schema') | ||
@@ -142,26 +135,3 @@ const kDirectiveGrouping = Symbol('mercurius-auth.filtering.group') | ||
return wrapSchema({ | ||
schema: graphQLSchema, | ||
transforms: [ | ||
new FilterTypes(type => { | ||
// should we filter out this whole type? | ||
return filterDirectiveMap[type.name] !== false | ||
}), | ||
new TransformObjectFields(filterField), | ||
new FilterInputObjectFields(filterField), | ||
new PruneSchema({ | ||
skipPruning (type) { | ||
// skip pruning if the type is the Query or Mutation object | ||
return type instanceof GraphQLObjectType && (type.name === 'Query' || type.name === 'Mutation') | ||
} | ||
}) | ||
] | ||
}) | ||
function filterField (typeName, fieldName, fieldConfig) { | ||
if (filterDirectiveMap[typeName] && filterDirectiveMap[typeName][fieldName] === false) { | ||
return null // omit the field | ||
} | ||
return undefined // unchanged | ||
} | ||
return pruneSchema(graphQLSchema, filterDirectiveMap) | ||
} |
{ | ||
"name": "mercurius-auth", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Mercurius Auth Plugin adds configurable Authentication and Authorization support to Mercurius.", | ||
@@ -51,4 +51,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@fastify/error": "^2.0.0", | ||
"@graphql-tools/wrap": "8.4.12", | ||
"@fastify/error": "^3.0.0", | ||
"fastify-plugin": "^3.0.0", | ||
@@ -55,0 +54,0 @@ "graphql": "^16.2.0" |
@@ -237,2 +237,24 @@ # mercurius-auth | ||
### Normal GraphQL Server Mode | With Introspection Filters | ||
Last run: `2022-05-24` | ||
```text | ||
┌─────────┬───────┬───────┬───────┬───────┬──────────┬─────────┬────────┐ | ||
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │ | ||
├─────────┼───────┼───────┼───────┼───────┼──────────┼─────────┼────────┤ | ||
│ Latency │ 10 ms │ 12 ms │ 30 ms │ 47 ms │ 13.59 ms │ 6.54 ms │ 155 ms │ | ||
└─────────┴───────┴───────┴───────┴───────┴──────────┴─────────┴────────┘ | ||
┌───────────┬─────────┬─────────┬────────┬─────────┬─────────┬─────────┬─────────┐ | ||
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │ | ||
├───────────┼─────────┼─────────┼────────┼─────────┼─────────┼─────────┼─────────┤ | ||
│ Req/Sec │ 2559 │ 2559 │ 7607 │ 8335 │ 7101.55 │ 1579.83 │ 2559 │ | ||
├───────────┼─────────┼─────────┼────────┼─────────┼─────────┼─────────┼─────────┤ | ||
│ Bytes/Sec │ 1.04 MB │ 1.04 MB │ 3.1 MB │ 3.39 MB │ 2.89 MB │ 643 kB │ 1.04 MB │ | ||
└───────────┴─────────┴─────────┴────────┴─────────┴─────────┴─────────┴─────────┘ | ||
Req/Bytes counts sampled once per second. | ||
78k requests in 11.05s, 31.8 MB read | ||
``` | ||
### Gateway GraphQL Server Mode | Without Auth | ||
@@ -239,0 +261,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
278145
3
60
8814
306
+ Added@fastify/error@3.4.1(transitive)
- Removed@graphql-tools/wrap@8.4.12
- Removed@fastify/error@2.0.0(transitive)
- Removed@graphql-tools/batch-execute@8.4.3(transitive)
- Removed@graphql-tools/delegate@8.7.3(transitive)
- Removed@graphql-tools/merge@8.2.7(transitive)
- Removed@graphql-tools/schema@8.3.7(transitive)
- Removed@graphql-tools/utils@8.6.6(transitive)
- Removed@graphql-tools/wrap@8.4.12(transitive)
- Removeddataloader@2.1.0(transitive)
- Removedgraphql-executor@0.0.23(transitive)
- Removedtslib@2.3.1(transitive)
- Removedvalue-or-promise@1.0.11(transitive)
Updated@fastify/error@^3.0.0