@graphql-tools/wrap 9.0.1 → 9.0.2-alpha-20220812030257-76a1a25e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/wrapSchema.js CHANGED
@@ -5,13 +5,12 @@ const graphql_1 = require("graphql");
5
5
  const utils_1 = require("@graphql-tools/utils");
6
6
  const delegate_1 = require("@graphql-tools/delegate");
7
7
  const generateProxyingResolvers_js_1 = require("./generateProxyingResolvers.js");
8
- function wrapSchema(subschemaConfig) {
8
+ exports.wrapSchema = (0, utils_1.memoize1)(function wrapSchema(subschemaConfig) {
9
9
  const targetSchema = subschemaConfig.schema;
10
10
  const proxyingResolvers = (0, generateProxyingResolvers_js_1.generateProxyingResolvers)(subschemaConfig);
11
11
  const schema = createWrappingSchema(targetSchema, proxyingResolvers);
12
12
  return (0, delegate_1.applySchemaTransforms)(schema, subschemaConfig);
13
- }
14
- exports.wrapSchema = wrapSchema;
13
+ });
15
14
  function createWrappingSchema(schema, proxyingResolvers) {
16
15
  return (0, utils_1.mapSchema)(schema, {
17
16
  [utils_1.MapperKind.ROOT_OBJECT]: type => {
package/esm/wrapSchema.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, } from 'graphql';
2
- import { MapperKind, mapSchema } from '@graphql-tools/utils';
2
+ import { MapperKind, mapSchema, memoize1 } from '@graphql-tools/utils';
3
3
  import { defaultMergedResolver, applySchemaTransforms } from '@graphql-tools/delegate';
4
4
  import { generateProxyingResolvers } from './generateProxyingResolvers.js';
5
- export function wrapSchema(subschemaConfig) {
5
+ export const wrapSchema = memoize1(function wrapSchema(subschemaConfig) {
6
6
  const targetSchema = subschemaConfig.schema;
7
7
  const proxyingResolvers = generateProxyingResolvers(subschemaConfig);
8
8
  const schema = createWrappingSchema(targetSchema, proxyingResolvers);
9
9
  return applySchemaTransforms(schema, subschemaConfig);
10
- }
10
+ });
11
11
  function createWrappingSchema(schema, proxyingResolvers) {
12
12
  return mapSchema(schema, {
13
13
  [MapperKind.ROOT_OBJECT]: type => {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@graphql-tools/wrap",
3
- "version": "9.0.1",
3
+ "version": "9.0.2-alpha-20220812030257-76a1a25e",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-tools/delegate": "9.0.1",
10
+ "@graphql-tools/delegate": "9.0.2-alpha-20220812030257-76a1a25e",
11
11
  "@graphql-tools/schema": "9.0.1",
12
12
  "@graphql-tools/utils": "8.10.0",
13
13
  "tslib": "^2.4.0",
@@ -1,3 +1,3 @@
1
1
  import { GraphQLSchema } from 'graphql';
2
- import { SubschemaConfig } from '@graphql-tools/delegate';
3
- export declare function wrapSchema<TConfig extends Record<string, any> = Record<string, any>>(subschemaConfig: SubschemaConfig<any, any, any, TConfig>): GraphQLSchema;
2
+ import { SubschemaConfig, Subschema } from '@graphql-tools/delegate';
3
+ export declare const wrapSchema: <TConfig extends Record<string, any> = Record<string, any>>(subschemaConfig: SubschemaConfig<any, any, any, TConfig> | Subschema<any, any, any, TConfig>) => GraphQLSchema;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLSchema } from 'graphql';
2
- import { SubschemaConfig } from '@graphql-tools/delegate';
3
- export declare function wrapSchema<TConfig extends Record<string, any> = Record<string, any>>(subschemaConfig: SubschemaConfig<any, any, any, TConfig>): GraphQLSchema;
2
+ import { SubschemaConfig, Subschema } from '@graphql-tools/delegate';
3
+ export declare const wrapSchema: <TConfig extends Record<string, any> = Record<string, any>>(subschemaConfig: SubschemaConfig<any, any, any, TConfig> | Subschema<any, any, any, TConfig>) => GraphQLSchema;