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

graphql-tools-fork

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-tools-fork - npm Package Compare versions

Comparing version 8.9.2 to 8.9.3

8

CHANGELOG.md

@@ -5,2 +5,10 @@ # Changelog

### [8.9.3](https://github.com/yaacovCR/graphql-tools-fork/compare/v8.9.2...v8.9.3) (2020-03-10)
### Bug Fixes
* **MapperKind:** export MapperKind ([03c57dc](https://github.com/yaacovCR/graphql-tools-fork/commit/03c57dca32bd305bfdcdf5957e10b8a644cf23a4))
* **mapSchema:** fix rewiring ([e26da10](https://github.com/yaacovCR/graphql-tools-fork/commit/e26da10e73180e1876f1e2d791ed4b175e7e0ed5))
### [8.9.2](https://github.com/yaacovCR/graphql-tools-fork/compare/v8.9.1...v8.9.2) (2020-03-10)

@@ -7,0 +15,0 @@

22

dist/transforms/filterSchema.js
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_1 = require("graphql");
var Interfaces_1 = require("../Interfaces");
var utils_1 = require("../utils");
var polyfills_1 = require("../polyfills");
var map_1 = require("../utils/map");
function filterSchema(_a) {
var _b;
var schema = _a.schema, _c = _a.rootFieldFilter, rootFieldFilter = _c === void 0 ? function () { return true; } : _c, _d = _a.typeFilter, typeFilter = _d === void 0 ? function () { return true; } : _d, _e = _a.fieldFilter, fieldFilter = _e === void 0 ? function () { return true; } : _e;
var filteredSchema = utils_1.visitSchema(utils_1.cloneSchema(schema), (_b = {},
_b[Interfaces_1.VisitSchemaKind.QUERY] = function (type) {
var filteredSchema = utils_1.mapSchema(schema, (_b = {},
_b[map_1.MapperKind.QUERY] = function (type) {
return filterRootFields(type, 'Query', rootFieldFilter);
},
_b[Interfaces_1.VisitSchemaKind.MUTATION] = function (type) {
_b[map_1.MapperKind.MUTATION] = function (type) {
return filterRootFields(type, 'Mutation', rootFieldFilter);
},
_b[Interfaces_1.VisitSchemaKind.SUBSCRIPTION] = function (type) {
_b[map_1.MapperKind.SUBSCRIPTION] = function (type) {
return filterRootFields(type, 'Subscription', rootFieldFilter);
},
_b[Interfaces_1.VisitSchemaKind.OBJECT_TYPE] = function (type) {
_b[map_1.MapperKind.OBJECT_TYPE] = function (type) {
return typeFilter(type.name, type)

@@ -24,15 +24,15 @@ ? filterObjectFields(type, fieldFilter)

},
_b[Interfaces_1.VisitSchemaKind.INTERFACE_TYPE] = function (type) {
_b[map_1.MapperKind.INTERFACE_TYPE] = function (type) {
return typeFilter(type.name, type) ? undefined : null;
},
_b[Interfaces_1.VisitSchemaKind.UNION_TYPE] = function (type) {
_b[map_1.MapperKind.UNION_TYPE] = function (type) {
return typeFilter(type.name, type) ? undefined : null;
},
_b[Interfaces_1.VisitSchemaKind.INPUT_OBJECT_TYPE] = function (type) {
_b[map_1.MapperKind.INPUT_OBJECT_TYPE] = function (type) {
return typeFilter(type.name, type) ? undefined : null;
},
_b[Interfaces_1.VisitSchemaKind.ENUM_TYPE] = function (type) {
_b[map_1.MapperKind.ENUM_TYPE] = function (type) {
return typeFilter(type.name, type) ? undefined : null;
},
_b[Interfaces_1.VisitSchemaKind.SCALAR_TYPE] = function (type) {
_b[map_1.MapperKind.SCALAR_TYPE] = function (type) {
return typeFilter(type.name, type) ? undefined : null;

@@ -39,0 +39,0 @@ },

import { GraphQLSchema, GraphQLNamedType } from 'graphql';
import { Transform } from '../transforms/transforms';
import { Transform } from '../transforms';
export default class FilterTypes implements Transform {

@@ -4,0 +4,0 @@ private readonly filter;

Object.defineProperty(exports, "__esModule", { value: true });
var visitSchema_1 = require("../utils/visitSchema");
var Interfaces_1 = require("../Interfaces");
var utils_1 = require("../utils");
var FilterTypes = /** @class */ (function () {

@@ -11,4 +10,4 @@ function FilterTypes(filter) {

var _this = this;
return visitSchema_1.visitSchema(schema, (_a = {},
_a[Interfaces_1.VisitSchemaKind.TYPE] = function (type) {
return utils_1.mapSchema(schema, (_a = {},
_a[utils_1.MapperKind.TYPE] = function (type) {
if (_this.filter(type)) {

@@ -15,0 +14,0 @@ return undefined;

@@ -14,4 +14,4 @@ var __assign = (this && this.__assign) || function () {

var graphql_1 = require("graphql");
var Interfaces_1 = require("../Interfaces");
var utils_1 = require("../utils");
var polyfills_1 = require("../polyfills");
var RenameRootTypes = /** @class */ (function () {

@@ -26,4 +26,4 @@ function RenameRootTypes(renamer) {

var _this = this;
return utils_1.visitSchema(originalSchema, (_a = {},
_a[Interfaces_1.VisitSchemaKind.ROOT_OBJECT] = function (type) {
return utils_1.mapSchema(originalSchema, (_a = {},
_a[utils_1.MapperKind.ROOT_OBJECT] = function (type) {
var oldName = type.name;

@@ -34,5 +34,3 @@ var newName = _this.renamer(oldName);

_this.reverseMap[newName] = oldName;
var newType = utils_1.cloneType(type);
newType.name = newName;
return newType;
return new graphql_1.GraphQLObjectType(__assign(__assign({}, polyfills_1.toConfig(type)), { name: newName }));
}

@@ -39,0 +37,0 @@ },

@@ -29,2 +29,5 @@ var __assign = (this && this.__assign) || function () {

var _this = this;
// Modification of specified scalar types is not recommended, but is supported.
// mapSchema does not support modification of specified scalar types,
// so must use visitSchema instead.
return utils_1.visitSchema(originalSchema, (_a = {},

@@ -31,0 +34,0 @@ _a[Interfaces_1.VisitSchemaKind.TYPE] = function (type) {

@@ -18,3 +18,2 @@ var __assign = (this && this.__assign) || function () {

var isEmptyObject_1 = __importDefault(require("../utils/isEmptyObject"));
var Interfaces_1 = require("../Interfaces");
var utils_1 = require("../utils");

@@ -31,4 +30,4 @@ var polyfills_1 = require("../polyfills");

var _this = this;
this.transformedSchema = utils_1.visitSchema(originalSchema, (_a = {},
_a[Interfaces_1.VisitSchemaKind.OBJECT_TYPE] = function (type) {
this.transformedSchema = utils_1.mapSchema(originalSchema, (_a = {},
_a[utils_1.MapperKind.OBJECT_TYPE] = function (type) {
return _this.transformFields(type, _this.objectFieldTransformer);

@@ -35,0 +34,0 @@ },

@@ -17,2 +17,2 @@ export { cloneSchema, cloneDirective, cloneType } from './clone';

export { graphqlVersion } from './graphqlVersion';
export { mapSchema } from './map';
export { mapSchema, MapperKind } from './map';

@@ -48,2 +48,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

exports.mapSchema = map_1.mapSchema;
exports.MapperKind = map_1.MapperKind;
//# sourceMappingURL=index.js.map

@@ -48,6 +48,10 @@ var __assign = (this && this.__assign) || function () {

var typeMapper = getMapper(schemaMapper, specifiers);
newTypeMap[typeName] =
typeMapper != null
? typeMapper(originalTypeMap[typeName], schema)
: originalTypeMap[typeName];
if (typeMapper != null) {
var newType = typeMapper(originalTypeMap[typeName], schema);
newTypeMap[typeName] =
newType !== undefined ? newType : originalTypeMap[typeName];
}
else {
newTypeMap[typeName] = originalTypeMap[typeName];
}
}

@@ -266,3 +270,4 @@ });

else if (graphql_1.isNamedType(type)) {
return newTypeMap[type.name];
var originalType = originalTypeMap[type.name];
return originalType != null ? newTypeMap[originalType.name] : null;
}

@@ -318,2 +323,5 @@ return null;

}
else {
newTypeMap[typeName] = type;
}
}

@@ -320,0 +328,0 @@ // every prune requires another round of healing

{
"name": "graphql-tools-fork",
"version": "8.9.2",
"version": "8.9.3",
"description": "Forked graphql-tools, still more useful tools to create and manipulate GraphQL schemas.",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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