@graphitation/supermassive 3.11.12 → 3.12.0

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/CHANGELOG.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # Change Log - @graphitation/supermassive
2
2
 
3
- <!-- This log was last generated on Wed, 30 Jul 2025 14:39:20 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Fri, 07 Nov 2025 11:36:01 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 3.12.0
8
+
9
+ Fri, 07 Nov 2025 11:36:01 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - feat: subtract schema definitions (AI-assisted) (vladimir.razuvaev@gmail.com)
14
+
7
15
  ## 3.11.7
8
16
 
9
17
  Wed, 30 Jul 2025 14:39:20 GMT
package/lib/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { encodeASTSchema } from "./utilities/encodeASTSchema";
12
12
  export { extractMinimalViableSchemaForRequestDocument } from "./utilities/extractMinimalViableSchemaForRequestDocument";
13
13
  export { mergeResolvers } from "./utilities/mergeResolvers";
14
14
  export { createSchemaDefinitions, mergeSchemaDefinitions, } from "./utilities/mergeSchemaDefinitions";
15
+ export { subtractSchemaDefinitions } from "./utilities/subtractSchemaDefinitions";
15
16
  export { schemaFragmentFromMinimalViableSchemaDocument } from "./utilities/schemaFragmentFromMinimalViableSchemaDocument";
16
17
  export { pathToArray } from "./jsutils/Path";
17
18
  export { isPromise } from "./jsutils/isPromise";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EAC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AY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,EACxB,YAAY,EACZ,2BAA2B,EAC3B,0BAA0B,EAC1B,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,aAAa,EACb,eAAe,EACf,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,IAAI,2CAA2C,EAAE,MAAM,uCAAuC,CAAC;AACjI,OAAO,EAAE,gCAAgC,IAAI,2DAA2D,EAAE,MAAM,8CAA8C,CAAC"}
package/lib/index.js CHANGED
@@ -53,6 +53,7 @@ __export(src_exports, {
53
53
  specifiedScalarResolvers: () => import_resolvers.specifiedScalarResolvers,
54
54
  subscribeWithSchema: () => import_subscribeWithSchema.subscribeWithSchema,
55
55
  subscribeWithoutSchema: () => import_subscribeWithoutSchema.subscribeWithoutSchema,
56
+ subtractSchemaDefinitions: () => import_subtractSchemaDefinitions.subtractSchemaDefinitions,
56
57
  typeNameFromReference: () => import_reference.typeNameFromReference,
57
58
  typeReferenceFromName: () => import_reference.typeReferenceFromName,
58
59
  typeReferenceFromNode: () => import_reference.typeReferenceFromNode,
@@ -73,6 +74,7 @@ var import_encodeASTSchema = require("./utilities/encodeASTSchema");
73
74
  var import_extractMinimalViableSchemaForRequestDocument = require("./utilities/extractMinimalViableSchemaForRequestDocument");
74
75
  var import_mergeResolvers = require("./utilities/mergeResolvers");
75
76
  var import_mergeSchemaDefinitions = require("./utilities/mergeSchemaDefinitions");
77
+ var import_subtractSchemaDefinitions = require("./utilities/subtractSchemaDefinitions");
76
78
  var import_schemaFragmentFromMinimalViableSchemaDocument = require("./utilities/schemaFragmentFromMinimalViableSchemaDocument");
77
79
  var import_Path = require("./jsutils/Path");
78
80
  var import_isPromise = require("./jsutils/isPromise");
package/lib/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export { executeWithSchema } from \"./executeWithSchema\";\nexport {\n executeWithoutSchema,\n isIncrementalExecutionResult,\n isTotalExecutionResult,\n} from \"./executeWithoutSchema\";\nexport {\n isListType,\n isNonNullType,\n typeNameFromReference,\n typeReferenceFromName,\n typeReferenceFromNode,\n unwrap,\n unwrapAll,\n} from \"./schema/reference\";\nexport type {\n SpecTypeIndex,\n TypeName,\n TypeReference,\n} from \"./schema/reference\";\nexport { specifiedScalarResolvers } from \"./schema/resolvers\";\nexport { subscribeWithSchema } from \"./subscribeWithSchema\";\nexport { subscribeWithoutSchema } from \"./subscribeWithoutSchema\";\nexport {\n addMinimalViableSchemaToExecutableDefinitionNode,\n addMinimalViableSchemaToRequestDocument,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport { annotateDocumentGraphQLTransform } from \"./utilities/annotateDocumentGraphQLTransform\";\nexport { decodeASTSchema } from \"./utilities/decodeASTSchema\";\nexport { encodeASTSchema } from \"./utilities/encodeASTSchema\";\nexport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\nexport { mergeResolvers } from \"./utilities/mergeResolvers\";\nexport {\n createSchemaDefinitions,\n mergeSchemaDefinitions,\n} from \"./utilities/mergeSchemaDefinitions\";\nexport { schemaFragmentFromMinimalViableSchemaDocument } from \"./utilities/schemaFragmentFromMinimalViableSchemaDocument\";\nexport { pathToArray } from \"./jsutils/Path\";\nexport { isPromise } from \"./jsutils/isPromise\";\nexport { printPathArray } from \"./jsutils/printPathArray\";\n\nexport type {\n CompositeTypeTuple,\n DirectiveDefinitionTuple,\n DirectiveName,\n DirectiveTuple,\n EnumTypeDefinitionTuple,\n FieldDefinition,\n FieldDefinitionRecord,\n FieldDefinitionTuple,\n InputObjectTypeDefinitionTuple,\n InputValueDefinition,\n InputValueDefinitionRecord,\n InputValueDefinitionTuple,\n InterfaceImplementationsRecord,\n InterfaceTypeDefinitionTuple,\n ObjectTypeDefinitionTuple,\n OperationTypes,\n ScalarTypeDefinitionTuple,\n SchemaDefinitions,\n TypeDefinitionTuple,\n TypeDefinitionsRecord,\n UnionTypeDefinitionTuple,\n} from \"./schema/definition\";\nexport type {\n AddMinimalViableSchemaToRequestDocumentOptions,\n ExecutableDefinitionNodeWithInlinedSchema,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport type { ExtractMinimalViableSchemaResult } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\n\nexport type {\n EnumTypeResolver,\n ExecutionResult,\n FunctionFieldResolver,\n IncrementalExecutionResult,\n ObjectTypeResolver,\n ResolveInfo,\n Resolvers,\n ScalarTypeResolver,\n SchemaFragment,\n SchemaFragmentForReturnTypeRequest,\n SchemaFragmentForRuntimeTypeRequest,\n SchemaFragmentLoader,\n SchemaFragmentLoaderResult,\n SchemaFragmentRequest,\n SubscriptionExecutionResult,\n TotalExecutionResult,\n UserResolvers,\n DocumentWithMinimalViableSchema,\n DefinitionNodeWithMinimalViableSchema,\n} from \"./types\";\n\nexport type { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nexport type { IterableOrAsyncIterable } from \"./jsutils/IterableOrAsyncIterable\";\nexport type { Path } from \"./jsutils/Path\";\n\nexport type {\n ArgumentNode,\n BooleanValueNode,\n DirectiveDefinitionNode,\n DirectiveNode,\n DocumentNode,\n EnumTypeDefinitionNode,\n EnumTypeExtensionNode,\n EnumValueDefinitionNode,\n EnumValueNode,\n FieldDefinitionNode,\n FieldNode,\n FloatValueNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n InputObjectTypeDefinitionNode,\n InputObjectTypeExtensionNode,\n InputValueDefinitionNode,\n IntValueNode,\n InterfaceTypeDefinitionNode,\n InterfaceTypeExtensionNode,\n ListTypeNode,\n ListValueNode,\n NameNode,\n NamedTypeNode,\n NonNullTypeNode,\n NullValueNode,\n ObjectFieldNode,\n ObjectTypeDefinitionNode,\n ObjectTypeExtensionNode,\n ObjectValueNode,\n OperationDefinitionNode,\n OperationTypeDefinitionNode,\n ScalarTypeDefinitionNode,\n ScalarTypeExtensionNode,\n SchemaDefinitionNode,\n SchemaExtensionNode,\n SelectionSetNode,\n StringValueNode,\n UnionTypeDefinitionNode,\n UnionTypeExtensionNode,\n VariableDefinitionNode,\n VariableNode,\n} from \"graphql\";\n\nexport type {\n AfterFieldCompleteHook,\n AfterFieldCompleteHookArgs,\n AfterFieldResolveHook,\n AfterFieldResolveHookArgs,\n BeforeFieldResolveHook,\n BaseExecuteFieldHookArgs,\n ExecutionHooks,\n} from \"./hooks/types\";\n\nexport * as LegacyTypedAST from \"./legacyAST/TypedAST\";\nexport { addTypesToRequestDocument as addSupermassiveLegacyTypesToRequestDocument } from \"./legacyAST/addTypesToRequestDocument\";\nexport { annotateDocumentGraphQLTransform as annotateDocumentWithSupermassiveLegacyTypesGraphQLTransform } from \"./legacyAST/annotateDocumentGraphQLTransform\";\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAkC;AAClC,kCAIO;AACP,uBAQO;AAMP,uBAAyC;AACzC,iCAAoC;AACpC,oCAAuC;AACvC,qDAGO;AACP,8CAAiD;AACjD,6BAAgC;AAChC,6BAAgC;AAChC,0DAA6D;AAC7D,4BAA+B;AAC/B,oCAGO;AACP,2DAA8D;AAC9D,kBAA4B;AAC5B,uBAA0B;AAC1B,4BAA+B;AAiH/B,qBAAgC;AAChC,uCAAyF;AACzF,IAAAA,2CAAgH;",
4
+ "sourcesContent": ["export { executeWithSchema } from \"./executeWithSchema\";\nexport {\n executeWithoutSchema,\n isIncrementalExecutionResult,\n isTotalExecutionResult,\n} from \"./executeWithoutSchema\";\nexport {\n isListType,\n isNonNullType,\n typeNameFromReference,\n typeReferenceFromName,\n typeReferenceFromNode,\n unwrap,\n unwrapAll,\n} from \"./schema/reference\";\nexport type {\n SpecTypeIndex,\n TypeName,\n TypeReference,\n} from \"./schema/reference\";\nexport { specifiedScalarResolvers } from \"./schema/resolvers\";\nexport { subscribeWithSchema } from \"./subscribeWithSchema\";\nexport { subscribeWithoutSchema } from \"./subscribeWithoutSchema\";\nexport {\n addMinimalViableSchemaToExecutableDefinitionNode,\n addMinimalViableSchemaToRequestDocument,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport { annotateDocumentGraphQLTransform } from \"./utilities/annotateDocumentGraphQLTransform\";\nexport { decodeASTSchema } from \"./utilities/decodeASTSchema\";\nexport { encodeASTSchema } from \"./utilities/encodeASTSchema\";\nexport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\nexport { mergeResolvers } from \"./utilities/mergeResolvers\";\nexport {\n createSchemaDefinitions,\n mergeSchemaDefinitions,\n} from \"./utilities/mergeSchemaDefinitions\";\nexport { subtractSchemaDefinitions } from \"./utilities/subtractSchemaDefinitions\";\nexport { schemaFragmentFromMinimalViableSchemaDocument } from \"./utilities/schemaFragmentFromMinimalViableSchemaDocument\";\nexport { pathToArray } from \"./jsutils/Path\";\nexport { isPromise } from \"./jsutils/isPromise\";\nexport { printPathArray } from \"./jsutils/printPathArray\";\n\nexport type {\n CompositeTypeTuple,\n DirectiveDefinitionTuple,\n DirectiveName,\n DirectiveTuple,\n EnumTypeDefinitionTuple,\n FieldDefinition,\n FieldDefinitionRecord,\n FieldDefinitionTuple,\n InputObjectTypeDefinitionTuple,\n InputValueDefinition,\n InputValueDefinitionRecord,\n InputValueDefinitionTuple,\n InterfaceImplementationsRecord,\n InterfaceTypeDefinitionTuple,\n ObjectTypeDefinitionTuple,\n OperationTypes,\n ScalarTypeDefinitionTuple,\n SchemaDefinitions,\n TypeDefinitionTuple,\n TypeDefinitionsRecord,\n UnionTypeDefinitionTuple,\n} from \"./schema/definition\";\nexport type {\n AddMinimalViableSchemaToRequestDocumentOptions,\n ExecutableDefinitionNodeWithInlinedSchema,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport type { ExtractMinimalViableSchemaResult } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\n\nexport type {\n EnumTypeResolver,\n ExecutionResult,\n FunctionFieldResolver,\n IncrementalExecutionResult,\n ObjectTypeResolver,\n ResolveInfo,\n Resolvers,\n ScalarTypeResolver,\n SchemaFragment,\n SchemaFragmentForReturnTypeRequest,\n SchemaFragmentForRuntimeTypeRequest,\n SchemaFragmentLoader,\n SchemaFragmentLoaderResult,\n SchemaFragmentRequest,\n SubscriptionExecutionResult,\n TotalExecutionResult,\n UserResolvers,\n DocumentWithMinimalViableSchema,\n DefinitionNodeWithMinimalViableSchema,\n} from \"./types\";\n\nexport type { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nexport type { IterableOrAsyncIterable } from \"./jsutils/IterableOrAsyncIterable\";\nexport type { Path } from \"./jsutils/Path\";\n\nexport type {\n ArgumentNode,\n BooleanValueNode,\n DirectiveDefinitionNode,\n DirectiveNode,\n DocumentNode,\n EnumTypeDefinitionNode,\n EnumTypeExtensionNode,\n EnumValueDefinitionNode,\n EnumValueNode,\n FieldDefinitionNode,\n FieldNode,\n FloatValueNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n InputObjectTypeDefinitionNode,\n InputObjectTypeExtensionNode,\n InputValueDefinitionNode,\n IntValueNode,\n InterfaceTypeDefinitionNode,\n InterfaceTypeExtensionNode,\n ListTypeNode,\n ListValueNode,\n NameNode,\n NamedTypeNode,\n NonNullTypeNode,\n NullValueNode,\n ObjectFieldNode,\n ObjectTypeDefinitionNode,\n ObjectTypeExtensionNode,\n ObjectValueNode,\n OperationDefinitionNode,\n OperationTypeDefinitionNode,\n ScalarTypeDefinitionNode,\n ScalarTypeExtensionNode,\n SchemaDefinitionNode,\n SchemaExtensionNode,\n SelectionSetNode,\n StringValueNode,\n UnionTypeDefinitionNode,\n UnionTypeExtensionNode,\n VariableDefinitionNode,\n VariableNode,\n} from \"graphql\";\n\nexport type {\n AfterFieldCompleteHook,\n AfterFieldCompleteHookArgs,\n AfterFieldResolveHook,\n AfterFieldResolveHookArgs,\n BeforeFieldResolveHook,\n BaseExecuteFieldHookArgs,\n ExecutionHooks,\n} from \"./hooks/types\";\n\nexport * as LegacyTypedAST from \"./legacyAST/TypedAST\";\nexport { addTypesToRequestDocument as addSupermassiveLegacyTypesToRequestDocument } from \"./legacyAST/addTypesToRequestDocument\";\nexport { annotateDocumentGraphQLTransform as annotateDocumentWithSupermassiveLegacyTypesGraphQLTransform } from \"./legacyAST/annotateDocumentGraphQLTransform\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAkC;AAClC,kCAIO;AACP,uBAQO;AAMP,uBAAyC;AACzC,iCAAoC;AACpC,oCAAuC;AACvC,qDAGO;AACP,8CAAiD;AACjD,6BAAgC;AAChC,6BAAgC;AAChC,0DAA6D;AAC7D,4BAA+B;AAC/B,oCAGO;AACP,uCAA0C;AAC1C,2DAA8D;AAC9D,kBAA4B;AAC5B,uBAA0B;AAC1B,4BAA+B;AAiH/B,qBAAgC;AAChC,uCAAyF;AACzF,IAAAA,2CAAgH;",
6
6
  "names": ["import_annotateDocumentGraphQLTransform"]
7
7
  }
package/lib/index.mjs CHANGED
@@ -30,6 +30,7 @@ import {
30
30
  createSchemaDefinitions,
31
31
  mergeSchemaDefinitions
32
32
  } from "./utilities/mergeSchemaDefinitions.mjs";
33
+ import { subtractSchemaDefinitions } from "./utilities/subtractSchemaDefinitions.mjs";
33
34
  import { schemaFragmentFromMinimalViableSchemaDocument } from "./utilities/schemaFragmentFromMinimalViableSchemaDocument.mjs";
34
35
  import { pathToArray } from "./jsutils/Path.mjs";
35
36
  import { isPromise } from "./jsutils/isPromise.mjs";
@@ -63,6 +64,7 @@ export {
63
64
  specifiedScalarResolvers,
64
65
  subscribeWithSchema,
65
66
  subscribeWithoutSchema,
67
+ subtractSchemaDefinitions,
66
68
  typeNameFromReference,
67
69
  typeReferenceFromName,
68
70
  typeReferenceFromNode,
package/lib/index.mjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export { executeWithSchema } from \"./executeWithSchema\";\nexport {\n executeWithoutSchema,\n isIncrementalExecutionResult,\n isTotalExecutionResult,\n} from \"./executeWithoutSchema\";\nexport {\n isListType,\n isNonNullType,\n typeNameFromReference,\n typeReferenceFromName,\n typeReferenceFromNode,\n unwrap,\n unwrapAll,\n} from \"./schema/reference\";\nexport type {\n SpecTypeIndex,\n TypeName,\n TypeReference,\n} from \"./schema/reference\";\nexport { specifiedScalarResolvers } from \"./schema/resolvers\";\nexport { subscribeWithSchema } from \"./subscribeWithSchema\";\nexport { subscribeWithoutSchema } from \"./subscribeWithoutSchema\";\nexport {\n addMinimalViableSchemaToExecutableDefinitionNode,\n addMinimalViableSchemaToRequestDocument,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport { annotateDocumentGraphQLTransform } from \"./utilities/annotateDocumentGraphQLTransform\";\nexport { decodeASTSchema } from \"./utilities/decodeASTSchema\";\nexport { encodeASTSchema } from \"./utilities/encodeASTSchema\";\nexport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\nexport { mergeResolvers } from \"./utilities/mergeResolvers\";\nexport {\n createSchemaDefinitions,\n mergeSchemaDefinitions,\n} from \"./utilities/mergeSchemaDefinitions\";\nexport { schemaFragmentFromMinimalViableSchemaDocument } from \"./utilities/schemaFragmentFromMinimalViableSchemaDocument\";\nexport { pathToArray } from \"./jsutils/Path\";\nexport { isPromise } from \"./jsutils/isPromise\";\nexport { printPathArray } from \"./jsutils/printPathArray\";\n\nexport type {\n CompositeTypeTuple,\n DirectiveDefinitionTuple,\n DirectiveName,\n DirectiveTuple,\n EnumTypeDefinitionTuple,\n FieldDefinition,\n FieldDefinitionRecord,\n FieldDefinitionTuple,\n InputObjectTypeDefinitionTuple,\n InputValueDefinition,\n InputValueDefinitionRecord,\n InputValueDefinitionTuple,\n InterfaceImplementationsRecord,\n InterfaceTypeDefinitionTuple,\n ObjectTypeDefinitionTuple,\n OperationTypes,\n ScalarTypeDefinitionTuple,\n SchemaDefinitions,\n TypeDefinitionTuple,\n TypeDefinitionsRecord,\n UnionTypeDefinitionTuple,\n} from \"./schema/definition\";\nexport type {\n AddMinimalViableSchemaToRequestDocumentOptions,\n ExecutableDefinitionNodeWithInlinedSchema,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport type { ExtractMinimalViableSchemaResult } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\n\nexport type {\n EnumTypeResolver,\n ExecutionResult,\n FunctionFieldResolver,\n IncrementalExecutionResult,\n ObjectTypeResolver,\n ResolveInfo,\n Resolvers,\n ScalarTypeResolver,\n SchemaFragment,\n SchemaFragmentForReturnTypeRequest,\n SchemaFragmentForRuntimeTypeRequest,\n SchemaFragmentLoader,\n SchemaFragmentLoaderResult,\n SchemaFragmentRequest,\n SubscriptionExecutionResult,\n TotalExecutionResult,\n UserResolvers,\n DocumentWithMinimalViableSchema,\n DefinitionNodeWithMinimalViableSchema,\n} from \"./types\";\n\nexport type { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nexport type { IterableOrAsyncIterable } from \"./jsutils/IterableOrAsyncIterable\";\nexport type { Path } from \"./jsutils/Path\";\n\nexport type {\n ArgumentNode,\n BooleanValueNode,\n DirectiveDefinitionNode,\n DirectiveNode,\n DocumentNode,\n EnumTypeDefinitionNode,\n EnumTypeExtensionNode,\n EnumValueDefinitionNode,\n EnumValueNode,\n FieldDefinitionNode,\n FieldNode,\n FloatValueNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n InputObjectTypeDefinitionNode,\n InputObjectTypeExtensionNode,\n InputValueDefinitionNode,\n IntValueNode,\n InterfaceTypeDefinitionNode,\n InterfaceTypeExtensionNode,\n ListTypeNode,\n ListValueNode,\n NameNode,\n NamedTypeNode,\n NonNullTypeNode,\n NullValueNode,\n ObjectFieldNode,\n ObjectTypeDefinitionNode,\n ObjectTypeExtensionNode,\n ObjectValueNode,\n OperationDefinitionNode,\n OperationTypeDefinitionNode,\n ScalarTypeDefinitionNode,\n ScalarTypeExtensionNode,\n SchemaDefinitionNode,\n SchemaExtensionNode,\n SelectionSetNode,\n StringValueNode,\n UnionTypeDefinitionNode,\n UnionTypeExtensionNode,\n VariableDefinitionNode,\n VariableNode,\n} from \"graphql\";\n\nexport type {\n AfterFieldCompleteHook,\n AfterFieldCompleteHookArgs,\n AfterFieldResolveHook,\n AfterFieldResolveHookArgs,\n BeforeFieldResolveHook,\n BaseExecuteFieldHookArgs,\n ExecutionHooks,\n} from \"./hooks/types\";\n\nexport * as LegacyTypedAST from \"./legacyAST/TypedAST\";\nexport { addTypesToRequestDocument as addSupermassiveLegacyTypesToRequestDocument } from \"./legacyAST/addTypesToRequestDocument\";\nexport { annotateDocumentGraphQLTransform as annotateDocumentWithSupermassiveLegacyTypesGraphQLTransform } from \"./legacyAST/annotateDocumentGraphQLTransform\";\n"],
5
- "mappings": ";AAAA,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,gCAAgC;AACzC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,wCAAwC;AACjD,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,oDAAoD;AAC7D,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,qDAAqD;AAC9D,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAiH/B,YAAY,oBAAoB;AAChC,SAAsC,iCAAmD;AACzF,SAA6C,oCAApCA,yCAAuG;",
4
+ "sourcesContent": ["export { executeWithSchema } from \"./executeWithSchema\";\nexport {\n executeWithoutSchema,\n isIncrementalExecutionResult,\n isTotalExecutionResult,\n} from \"./executeWithoutSchema\";\nexport {\n isListType,\n isNonNullType,\n typeNameFromReference,\n typeReferenceFromName,\n typeReferenceFromNode,\n unwrap,\n unwrapAll,\n} from \"./schema/reference\";\nexport type {\n SpecTypeIndex,\n TypeName,\n TypeReference,\n} from \"./schema/reference\";\nexport { specifiedScalarResolvers } from \"./schema/resolvers\";\nexport { subscribeWithSchema } from \"./subscribeWithSchema\";\nexport { subscribeWithoutSchema } from \"./subscribeWithoutSchema\";\nexport {\n addMinimalViableSchemaToExecutableDefinitionNode,\n addMinimalViableSchemaToRequestDocument,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport { annotateDocumentGraphQLTransform } from \"./utilities/annotateDocumentGraphQLTransform\";\nexport { decodeASTSchema } from \"./utilities/decodeASTSchema\";\nexport { encodeASTSchema } from \"./utilities/encodeASTSchema\";\nexport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\nexport { mergeResolvers } from \"./utilities/mergeResolvers\";\nexport {\n createSchemaDefinitions,\n mergeSchemaDefinitions,\n} from \"./utilities/mergeSchemaDefinitions\";\nexport { subtractSchemaDefinitions } from \"./utilities/subtractSchemaDefinitions\";\nexport { schemaFragmentFromMinimalViableSchemaDocument } from \"./utilities/schemaFragmentFromMinimalViableSchemaDocument\";\nexport { pathToArray } from \"./jsutils/Path\";\nexport { isPromise } from \"./jsutils/isPromise\";\nexport { printPathArray } from \"./jsutils/printPathArray\";\n\nexport type {\n CompositeTypeTuple,\n DirectiveDefinitionTuple,\n DirectiveName,\n DirectiveTuple,\n EnumTypeDefinitionTuple,\n FieldDefinition,\n FieldDefinitionRecord,\n FieldDefinitionTuple,\n InputObjectTypeDefinitionTuple,\n InputValueDefinition,\n InputValueDefinitionRecord,\n InputValueDefinitionTuple,\n InterfaceImplementationsRecord,\n InterfaceTypeDefinitionTuple,\n ObjectTypeDefinitionTuple,\n OperationTypes,\n ScalarTypeDefinitionTuple,\n SchemaDefinitions,\n TypeDefinitionTuple,\n TypeDefinitionsRecord,\n UnionTypeDefinitionTuple,\n} from \"./schema/definition\";\nexport type {\n AddMinimalViableSchemaToRequestDocumentOptions,\n ExecutableDefinitionNodeWithInlinedSchema,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport type { ExtractMinimalViableSchemaResult } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\n\nexport type {\n EnumTypeResolver,\n ExecutionResult,\n FunctionFieldResolver,\n IncrementalExecutionResult,\n ObjectTypeResolver,\n ResolveInfo,\n Resolvers,\n ScalarTypeResolver,\n SchemaFragment,\n SchemaFragmentForReturnTypeRequest,\n SchemaFragmentForRuntimeTypeRequest,\n SchemaFragmentLoader,\n SchemaFragmentLoaderResult,\n SchemaFragmentRequest,\n SubscriptionExecutionResult,\n TotalExecutionResult,\n UserResolvers,\n DocumentWithMinimalViableSchema,\n DefinitionNodeWithMinimalViableSchema,\n} from \"./types\";\n\nexport type { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nexport type { IterableOrAsyncIterable } from \"./jsutils/IterableOrAsyncIterable\";\nexport type { Path } from \"./jsutils/Path\";\n\nexport type {\n ArgumentNode,\n BooleanValueNode,\n DirectiveDefinitionNode,\n DirectiveNode,\n DocumentNode,\n EnumTypeDefinitionNode,\n EnumTypeExtensionNode,\n EnumValueDefinitionNode,\n EnumValueNode,\n FieldDefinitionNode,\n FieldNode,\n FloatValueNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n InputObjectTypeDefinitionNode,\n InputObjectTypeExtensionNode,\n InputValueDefinitionNode,\n IntValueNode,\n InterfaceTypeDefinitionNode,\n InterfaceTypeExtensionNode,\n ListTypeNode,\n ListValueNode,\n NameNode,\n NamedTypeNode,\n NonNullTypeNode,\n NullValueNode,\n ObjectFieldNode,\n ObjectTypeDefinitionNode,\n ObjectTypeExtensionNode,\n ObjectValueNode,\n OperationDefinitionNode,\n OperationTypeDefinitionNode,\n ScalarTypeDefinitionNode,\n ScalarTypeExtensionNode,\n SchemaDefinitionNode,\n SchemaExtensionNode,\n SelectionSetNode,\n StringValueNode,\n UnionTypeDefinitionNode,\n UnionTypeExtensionNode,\n VariableDefinitionNode,\n VariableNode,\n} from \"graphql\";\n\nexport type {\n AfterFieldCompleteHook,\n AfterFieldCompleteHookArgs,\n AfterFieldResolveHook,\n AfterFieldResolveHookArgs,\n BeforeFieldResolveHook,\n BaseExecuteFieldHookArgs,\n ExecutionHooks,\n} from \"./hooks/types\";\n\nexport * as LegacyTypedAST from \"./legacyAST/TypedAST\";\nexport { addTypesToRequestDocument as addSupermassiveLegacyTypesToRequestDocument } from \"./legacyAST/addTypesToRequestDocument\";\nexport { annotateDocumentGraphQLTransform as annotateDocumentWithSupermassiveLegacyTypesGraphQLTransform } from \"./legacyAST/annotateDocumentGraphQLTransform\";\n"],
5
+ "mappings": ";AAAA,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,gCAAgC;AACzC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,wCAAwC;AACjD,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,oDAAoD;AAC7D,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,iCAAiC;AAC1C,SAAS,qDAAqD;AAC9D,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAiH/B,YAAY,oBAAoB;AAChC,SAAsC,iCAAmD;AACzF,SAA6C,oCAApCA,yCAAuG;",
6
6
  "names": ["annotateDocumentGraphQLTransform"]
7
7
  }
@@ -0,0 +1,12 @@
1
+ import { SchemaDefinitions } from "../schema/definition";
2
+ /**
3
+ * Subtracts schema definitions from minuend that exist in subtrahend.
4
+ * Returns a new SchemaDefinitions object without mutating inputs.
5
+ *
6
+ * @param minuend - The schema definitions to subtract from
7
+ * @param subtrahend - The schema definitions to subtract
8
+ * @param strict - If true, throws errors on items in subtrahend that are not in minuend; if false, ignores them
9
+ * @returns A new SchemaDefinitions with elements from minuend not in subtrahend
10
+ */
11
+ export declare function subtractSchemaDefinitions(minuend: SchemaDefinitions, subtrahend: SchemaDefinitions, strict?: boolean): SchemaDefinitions;
12
+ //# sourceMappingURL=subtractSchemaDefinitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subtractSchemaDefinitions.d.ts","sourceRoot":"","sources":["../../src/utilities/subtractSchemaDefinitions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EA4BlB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,iBAAiB,EAC7B,MAAM,UAAQ,GACb,iBAAiB,CAyBnB"}
@@ -0,0 +1,334 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var subtractSchemaDefinitions_exports = {};
20
+ __export(subtractSchemaDefinitions_exports, {
21
+ subtractSchemaDefinitions: () => subtractSchemaDefinitions
22
+ });
23
+ module.exports = __toCommonJS(subtractSchemaDefinitions_exports);
24
+ var import_definition = require("../schema/definition");
25
+ var import_inspect = require("../jsutils/inspect");
26
+ function subtractSchemaDefinitions(minuend, subtrahend, strict = false) {
27
+ const result = {
28
+ types: {},
29
+ directives: []
30
+ };
31
+ if (minuend.types && subtrahend.types) {
32
+ result.types = subtractTypes(minuend.types, subtrahend.types, strict);
33
+ } else if (minuend.types) {
34
+ result.types = { ...minuend.types };
35
+ }
36
+ if (minuend.directives && subtrahend.directives) {
37
+ result.directives = subtractDirectives(
38
+ minuend.directives,
39
+ subtrahend.directives,
40
+ strict
41
+ );
42
+ } else if (minuend.directives) {
43
+ result.directives = [...minuend.directives];
44
+ }
45
+ return result;
46
+ }
47
+ function subtractTypes(minuend, subtrahend, strict) {
48
+ const result = {};
49
+ for (const [typeName, minuendDef] of Object.entries(minuend)) {
50
+ const subtrahendDef = subtrahend[typeName];
51
+ if (!subtrahendDef) {
52
+ result[typeName] = minuendDef;
53
+ continue;
54
+ }
55
+ if (minuendDef[0] !== subtrahendDef[0]) {
56
+ throw new Error(
57
+ `Type ${typeName} is represented differently in different schema fragments:
58
+ ` + (0, import_inspect.inspect)(minuendDef) + `
59
+ ` + (0, import_inspect.inspect)(subtrahendDef)
60
+ );
61
+ }
62
+ const subtractedType = subtractType(
63
+ typeName,
64
+ minuendDef,
65
+ subtrahendDef,
66
+ strict
67
+ );
68
+ if (subtractedType) {
69
+ result[typeName] = subtractedType;
70
+ }
71
+ }
72
+ for (const typeName of Object.keys(subtrahend)) {
73
+ if (!(typeName in minuend)) {
74
+ if (strict) {
75
+ throw new Error(`Type ${typeName} does not exist in minuend`);
76
+ }
77
+ }
78
+ }
79
+ return result;
80
+ }
81
+ function subtractType(typeName, minuendDef, subtrahendDef, strict) {
82
+ if ((0, import_definition.isObjectTypeDefinition)(minuendDef) && (0, import_definition.isObjectTypeDefinition)(subtrahendDef)) {
83
+ const subtractedFields = subtractFields(
84
+ typeName,
85
+ (0, import_definition.getFields)(minuendDef),
86
+ (0, import_definition.getFields)(subtrahendDef),
87
+ strict
88
+ );
89
+ if (Object.keys(subtractedFields).length === 0) {
90
+ return null;
91
+ }
92
+ const interfaces = (0, import_definition.getObjectTypeInterfaces)(minuendDef);
93
+ return (0, import_definition.createObjectTypeDefinition)(
94
+ subtractedFields,
95
+ interfaces.length > 0 ? interfaces : void 0
96
+ );
97
+ }
98
+ if ((0, import_definition.isInterfaceTypeDefinition)(minuendDef) && (0, import_definition.isInterfaceTypeDefinition)(subtrahendDef)) {
99
+ const subtractedFields = subtractFields(
100
+ typeName,
101
+ (0, import_definition.getFields)(minuendDef),
102
+ (0, import_definition.getFields)(subtrahendDef),
103
+ strict
104
+ );
105
+ if (Object.keys(subtractedFields).length === 0) {
106
+ return null;
107
+ }
108
+ const interfaces = (0, import_definition.getInterfaceTypeInterfaces)(minuendDef);
109
+ return (0, import_definition.createInterfaceTypeDefinition)(
110
+ subtractedFields,
111
+ interfaces.length > 0 ? interfaces : void 0
112
+ );
113
+ }
114
+ if ((0, import_definition.isInputObjectTypeDefinition)(minuendDef) && (0, import_definition.isInputObjectTypeDefinition)(subtrahendDef)) {
115
+ const subtractedFields = subtractInputFields(
116
+ typeName,
117
+ (0, import_definition.getInputObjectFields)(minuendDef),
118
+ (0, import_definition.getInputObjectFields)(subtrahendDef),
119
+ strict
120
+ );
121
+ if (Object.keys(subtractedFields).length === 0) {
122
+ return null;
123
+ }
124
+ return (0, import_definition.createInputObjectTypeDefinition)(subtractedFields);
125
+ }
126
+ if ((0, import_definition.isUnionTypeDefinition)(minuendDef) && (0, import_definition.isUnionTypeDefinition)(subtrahendDef)) {
127
+ const subtractedMembers = subtractUnionMembers(
128
+ typeName,
129
+ (0, import_definition.getUnionTypeMembers)(minuendDef),
130
+ (0, import_definition.getUnionTypeMembers)(subtrahendDef),
131
+ strict
132
+ );
133
+ if (subtractedMembers.length === 0) {
134
+ return null;
135
+ }
136
+ return (0, import_definition.createUnionTypeDefinition)(subtractedMembers);
137
+ }
138
+ if ((0, import_definition.isEnumTypeDefinition)(minuendDef) && (0, import_definition.isEnumTypeDefinition)(subtrahendDef)) {
139
+ const subtractedValues = subtractEnumValues(
140
+ typeName,
141
+ (0, import_definition.getEnumValues)(minuendDef),
142
+ (0, import_definition.getEnumValues)(subtrahendDef),
143
+ strict
144
+ );
145
+ if (subtractedValues.length === 0) {
146
+ return null;
147
+ }
148
+ return (0, import_definition.createEnumTypeDefinition)(subtractedValues);
149
+ }
150
+ if ((0, import_definition.isScalarTypeDefinition)(minuendDef) && (0, import_definition.isScalarTypeDefinition)(subtrahendDef)) {
151
+ return null;
152
+ }
153
+ return null;
154
+ }
155
+ function subtractFields(typeName, minuendFields, subtrahendFields, strict) {
156
+ const result = {};
157
+ for (const [fieldName, minuendField] of Object.entries(minuendFields)) {
158
+ const subtrahendField = subtrahendFields[fieldName];
159
+ if (!subtrahendField) {
160
+ result[fieldName] = minuendField;
161
+ continue;
162
+ }
163
+ const minuendType = (0, import_definition.getFieldTypeReference)(minuendField);
164
+ const subtrahendType = (0, import_definition.getFieldTypeReference)(subtrahendField);
165
+ if (minuendType !== subtrahendType) {
166
+ throw new Error(
167
+ `Field ${typeName}.${fieldName} has different type: ${(0, import_inspect.inspect)(
168
+ minuendType
169
+ )} vs ${(0, import_inspect.inspect)(subtrahendType)}`
170
+ );
171
+ }
172
+ const minuendArgs = (0, import_definition.getFieldArgs)(minuendField);
173
+ const subtrahendArgs = (0, import_definition.getFieldArgs)(subtrahendField);
174
+ if (!minuendArgs && !subtrahendArgs) {
175
+ } else if (!minuendArgs || !subtrahendArgs) {
176
+ throw new Error(
177
+ `Field arguments must match exactly for subtraction. Field ${typeName}.${fieldName} has different argument structures.`
178
+ );
179
+ } else {
180
+ const minuendArgKeys = Object.keys(minuendArgs).sort();
181
+ const subtrahendArgKeys = Object.keys(subtrahendArgs).sort();
182
+ if (minuendArgKeys.length !== subtrahendArgKeys.length || !minuendArgKeys.every((key, index) => key === subtrahendArgKeys[index])) {
183
+ throw new Error(
184
+ `Field arguments must match exactly for subtraction. Field ${typeName}.${fieldName} has different argument keys.`
185
+ );
186
+ }
187
+ for (const argName of minuendArgKeys) {
188
+ const minuendArgType = (0, import_definition.getInputValueTypeReference)(minuendArgs[argName]);
189
+ const subtrahendArgType = (0, import_definition.getInputValueTypeReference)(
190
+ subtrahendArgs[argName]
191
+ );
192
+ if (minuendArgType !== subtrahendArgType) {
193
+ throw new Error(
194
+ `Field arguments must match exactly for subtraction. Field ${typeName}.${fieldName} argument ${argName} has different types.`
195
+ );
196
+ }
197
+ }
198
+ }
199
+ }
200
+ for (const fieldName of Object.keys(subtrahendFields)) {
201
+ if (!(fieldName in minuendFields)) {
202
+ if (strict) {
203
+ throw new Error(
204
+ `Field ${typeName}.${fieldName} does not exist in minuend`
205
+ );
206
+ }
207
+ }
208
+ }
209
+ return result;
210
+ }
211
+ function subtractInputFields(typeName, minuendFields, subtrahendFields, strict) {
212
+ const result = {};
213
+ for (const [fieldName, minuendField] of Object.entries(minuendFields)) {
214
+ const subtrahendField = subtrahendFields[fieldName];
215
+ if (!subtrahendField) {
216
+ result[fieldName] = minuendField;
217
+ continue;
218
+ }
219
+ const minuendType = (0, import_definition.getInputValueTypeReference)(minuendField);
220
+ const subtrahendType = (0, import_definition.getInputValueTypeReference)(subtrahendField);
221
+ if (minuendType !== subtrahendType) {
222
+ throw new Error(
223
+ `Input field ${typeName}.${fieldName} has different type: ${(0, import_inspect.inspect)(
224
+ minuendType
225
+ )} vs ${(0, import_inspect.inspect)(subtrahendType)}`
226
+ );
227
+ }
228
+ }
229
+ for (const fieldName of Object.keys(subtrahendFields)) {
230
+ if (!(fieldName in minuendFields)) {
231
+ if (strict) {
232
+ throw new Error(
233
+ `Input field ${typeName}.${fieldName} does not exist in minuend`
234
+ );
235
+ }
236
+ }
237
+ }
238
+ return result;
239
+ }
240
+ function subtractUnionMembers(typeName, minuendMembers, subtrahendMembers, strict) {
241
+ const minuendSet = new Set(minuendMembers);
242
+ const subtrahendSet = new Set(subtrahendMembers);
243
+ if (minuendMembers.length === subtrahendMembers.length && minuendMembers.every((member) => subtrahendSet.has(member))) {
244
+ return [];
245
+ }
246
+ for (const member of subtrahendMembers) {
247
+ if (!minuendSet.has(member)) {
248
+ if (strict) {
249
+ throw new Error(
250
+ `Union ${typeName}: member ${member} does not exist in minuend`
251
+ );
252
+ }
253
+ return minuendMembers;
254
+ }
255
+ }
256
+ throw new Error(
257
+ `Union types must match exactly for subtraction. Union ${typeName} has different member sets.`
258
+ );
259
+ }
260
+ function subtractEnumValues(typeName, minuendValues, subtrahendValues, strict) {
261
+ const minuendSet = new Set(minuendValues);
262
+ const subtrahendSet = new Set(subtrahendValues);
263
+ if (minuendValues.length === subtrahendValues.length && minuendValues.every((value) => subtrahendSet.has(value))) {
264
+ return [];
265
+ }
266
+ for (const value of subtrahendValues) {
267
+ if (!minuendSet.has(value)) {
268
+ if (strict) {
269
+ throw new Error(
270
+ `Enum ${typeName}: value ${value} does not exist in minuend`
271
+ );
272
+ }
273
+ return minuendValues;
274
+ }
275
+ }
276
+ throw new Error(
277
+ `Enum types must match exactly for subtraction. Enum ${typeName} has different value sets.`
278
+ );
279
+ }
280
+ function subtractDirectives(minuendDirectives, subtrahendDirectives, strict) {
281
+ const result = [];
282
+ for (const minuendDirective of minuendDirectives) {
283
+ const minuendName = (0, import_definition.getDirectiveName)(minuendDirective);
284
+ const subtrahendDirective = subtrahendDirectives.find(
285
+ (d) => (0, import_definition.getDirectiveName)(d) === minuendName
286
+ );
287
+ if (!subtrahendDirective) {
288
+ result.push(minuendDirective);
289
+ continue;
290
+ }
291
+ const minuendArgs = (0, import_definition.getDirectiveDefinitionArgs)(minuendDirective);
292
+ const subtrahendArgs = (0, import_definition.getDirectiveDefinitionArgs)(subtrahendDirective);
293
+ if (!minuendArgs && !subtrahendArgs) {
294
+ continue;
295
+ }
296
+ if (!minuendArgs || !subtrahendArgs) {
297
+ throw new Error(
298
+ `Directive arguments must match exactly for subtraction. Directive ${minuendName} has different argument structures.`
299
+ );
300
+ }
301
+ const minuendArgKeys = Object.keys(minuendArgs).sort();
302
+ const subtrahendArgKeys = Object.keys(subtrahendArgs).sort();
303
+ if (minuendArgKeys.length !== subtrahendArgKeys.length || !minuendArgKeys.every((key, index) => key === subtrahendArgKeys[index])) {
304
+ throw new Error(
305
+ `Directive arguments must match exactly for subtraction. Directive ${minuendName} has different argument keys.`
306
+ );
307
+ }
308
+ for (const argName of minuendArgKeys) {
309
+ const minuendArgType = (0, import_definition.getInputValueTypeReference)(minuendArgs[argName]);
310
+ const subtrahendArgType = (0, import_definition.getInputValueTypeReference)(
311
+ subtrahendArgs[argName]
312
+ );
313
+ if (minuendArgType !== subtrahendArgType) {
314
+ throw new Error(
315
+ `Directive arguments must match exactly for subtraction. Directive ${minuendName} argument ${argName} has different types.`
316
+ );
317
+ }
318
+ }
319
+ }
320
+ for (const subtrahendDirective of subtrahendDirectives) {
321
+ const subtrahendName = (0, import_definition.getDirectiveName)(subtrahendDirective);
322
+ const exists = minuendDirectives.some(
323
+ (d) => (0, import_definition.getDirectiveName)(d) === subtrahendName
324
+ );
325
+ if (!exists) {
326
+ if (strict) {
327
+ throw new Error(
328
+ `Directive ${subtrahendName} does not exist in minuend`
329
+ );
330
+ }
331
+ }
332
+ }
333
+ return result;
334
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utilities/subtractSchemaDefinitions.ts"],
4
+ "sourcesContent": ["// Note: this utility is vibe-coded. Use at your own risk! :)\nimport {\n SchemaDefinitions,\n DirectiveDefinitionTuple,\n FieldDefinitionRecord,\n InputValueDefinitionRecord,\n TypeDefinitionsRecord,\n TypeDefinitionTuple,\n getDirectiveDefinitionArgs,\n getDirectiveName,\n getEnumValues,\n getFieldTypeReference,\n getFieldArgs,\n getFields,\n getInputObjectFields,\n getInputValueTypeReference,\n getUnionTypeMembers,\n isEnumTypeDefinition,\n isInputObjectTypeDefinition,\n isInterfaceTypeDefinition,\n isObjectTypeDefinition,\n isScalarTypeDefinition,\n isUnionTypeDefinition,\n createEnumTypeDefinition,\n createInputObjectTypeDefinition,\n createInterfaceTypeDefinition,\n createObjectTypeDefinition,\n createUnionTypeDefinition,\n getObjectTypeInterfaces,\n getInterfaceTypeInterfaces,\n} from \"../schema/definition\";\nimport { inspect } from \"../jsutils/inspect\";\n\n/**\n * Subtracts schema definitions from minuend that exist in subtrahend.\n * Returns a new SchemaDefinitions object without mutating inputs.\n *\n * @param minuend - The schema definitions to subtract from\n * @param subtrahend - The schema definitions to subtract\n * @param strict - If true, throws errors on items in subtrahend that are not in minuend; if false, ignores them\n * @returns A new SchemaDefinitions with elements from minuend not in subtrahend\n */\nexport function subtractSchemaDefinitions(\n minuend: SchemaDefinitions,\n subtrahend: SchemaDefinitions,\n strict = false,\n): SchemaDefinitions {\n const result: SchemaDefinitions = {\n types: {},\n directives: [],\n };\n\n // Subtract types\n if (minuend.types && subtrahend.types) {\n result.types = subtractTypes(minuend.types, subtrahend.types, strict);\n } else if (minuend.types) {\n result.types = { ...minuend.types };\n }\n\n // Subtract directives\n if (minuend.directives && subtrahend.directives) {\n result.directives = subtractDirectives(\n minuend.directives,\n subtrahend.directives,\n strict,\n );\n } else if (minuend.directives) {\n result.directives = [...minuend.directives];\n }\n\n return result;\n}\n\n/**\n * Subtracts types from minuend that exist in subtrahend.\n */\nfunction subtractTypes(\n minuend: TypeDefinitionsRecord,\n subtrahend: TypeDefinitionsRecord,\n strict: boolean,\n): TypeDefinitionsRecord {\n const result: TypeDefinitionsRecord = {};\n\n for (const [typeName, minuendDef] of Object.entries(minuend)) {\n const subtrahendDef = subtrahend[typeName];\n\n if (!subtrahendDef) {\n // Type doesn't exist in subtrahend, keep it\n result[typeName] = minuendDef;\n continue;\n }\n\n // Validate type kinds match\n if (minuendDef[0] !== subtrahendDef[0]) {\n throw new Error(\n `Type ${typeName} is represented differently in different schema fragments:\\n` +\n inspect(minuendDef) +\n `\\n` +\n inspect(subtrahendDef),\n );\n }\n\n // Handle different type kinds\n const subtractedType = subtractType(\n typeName,\n minuendDef,\n subtrahendDef,\n strict,\n );\n if (subtractedType) {\n result[typeName] = subtractedType;\n }\n }\n\n // Check for types in subtrahend that don't exist in minuend\n for (const typeName of Object.keys(subtrahend)) {\n if (!(typeName in minuend)) {\n if (strict) {\n throw new Error(`Type ${typeName} does not exist in minuend`);\n }\n // In non-strict mode, ignore missing types\n }\n }\n\n return result;\n}\n\n/**\n * Subtracts a single type definition.\n */\nfunction subtractType(\n typeName: string,\n minuendDef: TypeDefinitionTuple,\n subtrahendDef: TypeDefinitionTuple,\n strict: boolean,\n): TypeDefinitionTuple | null {\n if (\n isObjectTypeDefinition(minuendDef) &&\n isObjectTypeDefinition(subtrahendDef)\n ) {\n const subtractedFields = subtractFields(\n typeName,\n getFields(minuendDef),\n getFields(subtrahendDef),\n strict,\n );\n if (Object.keys(subtractedFields).length === 0) {\n return null; // All fields removed\n }\n const interfaces = getObjectTypeInterfaces(minuendDef);\n return createObjectTypeDefinition(\n subtractedFields,\n interfaces.length > 0 ? interfaces : undefined,\n );\n }\n\n if (\n isInterfaceTypeDefinition(minuendDef) &&\n isInterfaceTypeDefinition(subtrahendDef)\n ) {\n const subtractedFields = subtractFields(\n typeName,\n getFields(minuendDef),\n getFields(subtrahendDef),\n strict,\n );\n if (Object.keys(subtractedFields).length === 0) {\n return null; // All fields removed\n }\n const interfaces = getInterfaceTypeInterfaces(minuendDef);\n return createInterfaceTypeDefinition(\n subtractedFields,\n interfaces.length > 0 ? interfaces : undefined,\n );\n }\n\n if (\n isInputObjectTypeDefinition(minuendDef) &&\n isInputObjectTypeDefinition(subtrahendDef)\n ) {\n const subtractedFields = subtractInputFields(\n typeName,\n getInputObjectFields(minuendDef),\n getInputObjectFields(subtrahendDef),\n strict,\n );\n if (Object.keys(subtractedFields).length === 0) {\n return null; // All fields removed\n }\n return createInputObjectTypeDefinition(subtractedFields);\n }\n\n if (\n isUnionTypeDefinition(minuendDef) &&\n isUnionTypeDefinition(subtrahendDef)\n ) {\n const subtractedMembers = subtractUnionMembers(\n typeName,\n getUnionTypeMembers(minuendDef),\n getUnionTypeMembers(subtrahendDef),\n strict,\n );\n if (subtractedMembers.length === 0) {\n return null; // All members removed\n }\n return createUnionTypeDefinition(subtractedMembers);\n }\n\n if (isEnumTypeDefinition(minuendDef) && isEnumTypeDefinition(subtrahendDef)) {\n const subtractedValues = subtractEnumValues(\n typeName,\n getEnumValues(minuendDef),\n getEnumValues(subtrahendDef),\n strict,\n );\n if (subtractedValues.length === 0) {\n return null; // All values removed\n }\n return createEnumTypeDefinition(subtractedValues);\n }\n\n if (\n isScalarTypeDefinition(minuendDef) &&\n isScalarTypeDefinition(subtrahendDef)\n ) {\n // Scalars are atomic - if subtrahend has it, remove entire scalar\n return null;\n }\n\n return null;\n}\n\n/**\n * Subtracts fields from object/interface types.\n */\nfunction subtractFields(\n typeName: string,\n minuendFields: FieldDefinitionRecord,\n subtrahendFields: FieldDefinitionRecord,\n strict: boolean,\n): FieldDefinitionRecord {\n const result: FieldDefinitionRecord = {};\n\n for (const [fieldName, minuendField] of Object.entries(minuendFields)) {\n const subtrahendField = subtrahendFields[fieldName];\n\n if (!subtrahendField) {\n // Field doesn't exist in subtrahend, keep it\n result[fieldName] = minuendField;\n continue;\n }\n\n // Validate field types match\n const minuendType = getFieldTypeReference(minuendField);\n const subtrahendType = getFieldTypeReference(subtrahendField);\n if (minuendType !== subtrahendType) {\n throw new Error(\n `Field ${typeName}.${fieldName} has different type: ${inspect(\n minuendType,\n )} vs ${inspect(subtrahendType)}`,\n );\n }\n\n // Validate field arguments match exactly\n const minuendArgs = getFieldArgs(minuendField);\n const subtrahendArgs = getFieldArgs(subtrahendField);\n\n // Both must have same argument structure\n if (!minuendArgs && !subtrahendArgs) {\n // Both have no arguments, field can be subtracted\n } else if (!minuendArgs || !subtrahendArgs) {\n // One has args, other doesn't - not exact match\n throw new Error(\n `Field arguments must match exactly for subtraction. Field ${typeName}.${fieldName} has different argument structures.`,\n );\n } else {\n // Both have arguments, compare them\n const minuendArgKeys = Object.keys(minuendArgs).sort();\n const subtrahendArgKeys = Object.keys(subtrahendArgs).sort();\n\n if (\n minuendArgKeys.length !== subtrahendArgKeys.length ||\n !minuendArgKeys.every((key, index) => key === subtrahendArgKeys[index])\n ) {\n throw new Error(\n `Field arguments must match exactly for subtraction. Field ${typeName}.${fieldName} has different argument keys.`,\n );\n }\n\n // Check each argument type matches\n for (const argName of minuendArgKeys) {\n const minuendArgType = getInputValueTypeReference(minuendArgs[argName]);\n const subtrahendArgType = getInputValueTypeReference(\n subtrahendArgs[argName],\n );\n if (minuendArgType !== subtrahendArgType) {\n throw new Error(\n `Field arguments must match exactly for subtraction. Field ${typeName}.${fieldName} argument ${argName} has different types.`,\n );\n }\n }\n }\n\n // Field exists in subtrahend and matches exactly, remove it\n }\n\n // Check for fields in subtrahend that don't exist in minuend\n for (const fieldName of Object.keys(subtrahendFields)) {\n if (!(fieldName in minuendFields)) {\n if (strict) {\n throw new Error(\n `Field ${typeName}.${fieldName} does not exist in minuend`,\n );\n }\n // In non-strict mode, ignore missing fields\n }\n }\n\n return result;\n}\n\n/**\n * Subtracts input fields from input object types.\n */\nfunction subtractInputFields(\n typeName: string,\n minuendFields: InputValueDefinitionRecord,\n subtrahendFields: InputValueDefinitionRecord,\n strict: boolean,\n): InputValueDefinitionRecord {\n const result: InputValueDefinitionRecord = {};\n\n for (const [fieldName, minuendField] of Object.entries(minuendFields)) {\n const subtrahendField = subtrahendFields[fieldName];\n\n if (!subtrahendField) {\n // Field doesn't exist in subtrahend, keep it\n result[fieldName] = minuendField;\n continue;\n }\n\n // Validate field types match\n const minuendType = getInputValueTypeReference(minuendField);\n const subtrahendType = getInputValueTypeReference(subtrahendField);\n if (minuendType !== subtrahendType) {\n throw new Error(\n `Input field ${typeName}.${fieldName} has different type: ${inspect(\n minuendType,\n )} vs ${inspect(subtrahendType)}`,\n );\n }\n\n // Field exists in subtrahend, remove it\n }\n\n // Check for fields in subtrahend that don't exist in minuend\n for (const fieldName of Object.keys(subtrahendFields)) {\n if (!(fieldName in minuendFields)) {\n if (strict) {\n throw new Error(\n `Input field ${typeName}.${fieldName} does not exist in minuend`,\n );\n }\n // In non-strict mode, ignore missing fields\n }\n }\n\n return result;\n}\n\n/**\n * Subtracts union members.\n */\nfunction subtractUnionMembers(\n typeName: string,\n minuendMembers: string[],\n subtrahendMembers: string[],\n strict: boolean,\n): string[] {\n // Union types must match exactly for subtraction\n const minuendSet = new Set(minuendMembers);\n const subtrahendSet = new Set(subtrahendMembers);\n\n // Check if they have the same members\n if (\n minuendMembers.length === subtrahendMembers.length &&\n minuendMembers.every((member) => subtrahendSet.has(member))\n ) {\n // Exact match - remove the entire union\n return [];\n }\n\n // Check for members in subtrahend that don't exist in minuend\n for (const member of subtrahendMembers) {\n if (!minuendSet.has(member)) {\n if (strict) {\n throw new Error(\n `Union ${typeName}: member ${member} does not exist in minuend`,\n );\n }\n // In non-strict mode, ignore missing members and keep the original union\n return minuendMembers;\n }\n }\n\n // If we get here, all subtrahend members exist in minuend but they don't match exactly\n throw new Error(\n `Union types must match exactly for subtraction. Union ${typeName} has different member sets.`,\n );\n}\n\n/**\n * Subtracts enum values.\n */\nfunction subtractEnumValues(\n typeName: string,\n minuendValues: string[],\n subtrahendValues: string[],\n strict: boolean,\n): string[] {\n // Enum types must match exactly for subtraction\n const minuendSet = new Set(minuendValues);\n const subtrahendSet = new Set(subtrahendValues);\n\n // Check if they have the same values\n if (\n minuendValues.length === subtrahendValues.length &&\n minuendValues.every((value) => subtrahendSet.has(value))\n ) {\n // Exact match - remove the entire enum\n return [];\n }\n\n // Check for values in subtrahend that don't exist in minuend\n for (const value of subtrahendValues) {\n if (!minuendSet.has(value)) {\n if (strict) {\n throw new Error(\n `Enum ${typeName}: value ${value} does not exist in minuend`,\n );\n }\n // In non-strict mode, ignore missing values and keep the original enum\n return minuendValues;\n }\n }\n\n // If we get here, all subtrahend values exist in minuend but they don't match exactly\n throw new Error(\n `Enum types must match exactly for subtraction. Enum ${typeName} has different value sets.`,\n );\n}\n\n/**\n * Subtracts directives.\n */\nfunction subtractDirectives(\n minuendDirectives: DirectiveDefinitionTuple[],\n subtrahendDirectives: DirectiveDefinitionTuple[],\n strict: boolean,\n): DirectiveDefinitionTuple[] {\n const result: DirectiveDefinitionTuple[] = [];\n\n for (const minuendDirective of minuendDirectives) {\n const minuendName = getDirectiveName(minuendDirective);\n const subtrahendDirective = subtrahendDirectives.find(\n (d) => getDirectiveName(d) === minuendName,\n );\n\n if (!subtrahendDirective) {\n // Directive doesn't exist in subtrahend, keep it\n result.push(minuendDirective);\n continue;\n }\n\n // Directive exists, check arguments\n const minuendArgs = getDirectiveDefinitionArgs(minuendDirective);\n const subtrahendArgs = getDirectiveDefinitionArgs(subtrahendDirective);\n\n if (!minuendArgs && !subtrahendArgs) {\n // Both have no arguments, remove entire directive\n continue;\n }\n\n if (!minuendArgs || !subtrahendArgs) {\n // One has args, other doesn't - arguments don't match exactly\n throw new Error(\n `Directive arguments must match exactly for subtraction. Directive ${minuendName} has different argument structures.`,\n );\n }\n\n // Both have arguments, check if they match exactly\n const minuendArgKeys = Object.keys(minuendArgs).sort();\n const subtrahendArgKeys = Object.keys(subtrahendArgs).sort();\n\n if (\n minuendArgKeys.length !== subtrahendArgKeys.length ||\n !minuendArgKeys.every((key, index) => key === subtrahendArgKeys[index])\n ) {\n throw new Error(\n `Directive arguments must match exactly for subtraction. Directive ${minuendName} has different argument keys.`,\n );\n }\n\n // Check each argument type matches\n for (const argName of minuendArgKeys) {\n const minuendArgType = getInputValueTypeReference(minuendArgs[argName]);\n const subtrahendArgType = getInputValueTypeReference(\n subtrahendArgs[argName],\n );\n if (minuendArgType !== subtrahendArgType) {\n throw new Error(\n `Directive arguments must match exactly for subtraction. Directive ${minuendName} argument ${argName} has different types.`,\n );\n }\n }\n\n // Arguments match exactly, remove entire directive\n }\n\n // Check for directives in subtrahend that don't exist in minuend\n for (const subtrahendDirective of subtrahendDirectives) {\n const subtrahendName = getDirectiveName(subtrahendDirective);\n const exists = minuendDirectives.some(\n (d) => getDirectiveName(d) === subtrahendName,\n );\n if (!exists) {\n if (strict) {\n throw new Error(\n `Directive ${subtrahendName} does not exist in minuend`,\n );\n }\n // In non-strict mode, ignore missing directives\n }\n }\n\n return result;\n}\n"],
5
+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