New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wundergraph/composition

Package Overview
Dependencies
Maintainers
0
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wundergraph/composition - npm Package Compare versions

Comparing version 0.36.1 to 0.37.0

dist/federation/federation.d.ts

2

dist/ast/utils.d.ts

@@ -5,4 +5,2 @@ import { ArgumentNode, DocumentNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, FieldNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, Kind, NamedTypeNode, NameNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, OperationTypeNode, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, SchemaDefinitionNode, SchemaExtensionNode, SelectionSetNode, StringValueNode, UnionTypeDefinitionNode, UnionTypeExtensionNode } from 'graphql';

export declare function isNodeInterfaceObject(node: ObjectTypeDefinitionNode): boolean;
export declare function isNodeExtension(node: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode): boolean;
export declare function areBaseAndExtensionKindsCompatible(baseKind: Kind, extensionKind: Kind, typeName: string): boolean;
export declare function stringToNameNode(value: string): NameNode;

@@ -9,0 +7,0 @@ export declare function stringArrayToNameNodeArray(values: string[]): NameNode[];

@@ -6,4 +6,2 @@ "use strict";

exports.isNodeInterfaceObject = isNodeInterfaceObject;
exports.isNodeExtension = isNodeExtension;
exports.areBaseAndExtensionKindsCompatible = areBaseAndExtensionKindsCompatible;
exports.stringToNameNode = stringToNameNode;

@@ -47,31 +45,2 @@ exports.stringArrayToNameNodeArray = stringArrayToNameNodeArray;

}
function isNodeExtension(node) {
if (!node.directives?.length) {
return false;
}
for (const directive of node.directives) {
if (directive.name.value === string_constants_1.EXTENDS) {
return true;
}
}
return false;
}
function areBaseAndExtensionKindsCompatible(baseKind, extensionKind, typeName) {
switch (baseKind) {
case graphql_1.Kind.ENUM_TYPE_DEFINITION:
return extensionKind === graphql_1.Kind.ENUM_TYPE_EXTENSION;
case graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION:
return extensionKind === graphql_1.Kind.INPUT_OBJECT_TYPE_EXTENSION;
case graphql_1.Kind.INTERFACE_TYPE_DEFINITION:
return extensionKind === graphql_1.Kind.INTERFACE_TYPE_EXTENSION;
case graphql_1.Kind.OBJECT_TYPE_DEFINITION:
return extensionKind === graphql_1.Kind.OBJECT_TYPE_EXTENSION;
case graphql_1.Kind.SCALAR_TYPE_DEFINITION:
return extensionKind === graphql_1.Kind.SCALAR_TYPE_EXTENSION;
case graphql_1.Kind.UNION_TYPE_DEFINITION:
return extensionKind === graphql_1.Kind.UNION_TYPE_EXTENSION;
default:
return false;
}
}
function stringToNameNode(value) {

@@ -78,0 +47,0 @@ return {

import { Kind, OperationTypeNode } from 'graphql';
import { EntityInterfaceFederationData, ImplementationErrors, InvalidArgument, InvalidEntityInterface, InvalidRequiredInputValueData } from '../utils/utils';
import { ObjectDefinitionData } from '../schema-building/type-definition-data';
import { ObjectDefinitionData } from '../schema-building/types';
import { InvalidRootTypeFieldEventsDirectiveData } from './utils';
import { UnresolvableFieldData } from '../resolvability-graph/utils';
import { FieldSetDirective } from '../schema-building/utils';
import { EntityInterfaceFederationData, ImplementationErrors, InvalidArgument, InvalidEntityInterface, InvalidRequiredInputValueData } from '../utils/utils';
export declare const minimumSubgraphRequirementError: Error;

@@ -63,3 +63,3 @@ export declare function multipleNamedTypeDefinitionError(typeName: string, firstTypeString: string, secondTypeString: string): Error;

export declare function invalidArgumentsError(fieldPath: string, invalidArguments: InvalidArgument[]): Error;
export declare const noQueryRootTypeError: Error;
export declare function noQueryRootTypeError(isRouterSchema?: boolean): Error;
export declare const inaccessibleQueryRootTypeError: Error;

@@ -66,0 +66,0 @@ export declare function expectedEntityError(typeName: string): Error;

@@ -5,22 +5,30 @@ export * from './ast/utils';

export * from './errors/utils';
export * from './federation/federation-factory';
export * from './federation/utils';
export * from './federation/walkers';
export * from './normalization/directive-definition-data';
export * from './normalization/normalization-factory';
export * from './normalization/utils';
export * from './normalization/walkers';
export * from './router-configuration/router-configuration';
export * from './federation/federation';
export * from './federation/types';
export * from './normalization/normalization';
export * from './normalization/types';
export * from './resolvability-graph/graph';
export * from './resolvability-graph/graph-nodes';
export * from './resolvability-graph/utils';
export * from './router-compatibility-version/router-compatibility-version';
export * from './router-configuration/router-configuration';
export * from './schema-building/ast';
export * from './schema-building/type-definition-data';
export * from './schema-building/type-merging';
export * from './schema-building/types';
export * from './schema-building/utils';
export * from './subgraph/subgraph';
export * from './subgraph/types';
export * from './utils/composition-version';
export * from './utils/constants';
export * from './utils/string-constants';
export * from './utils/types';
export * from './utils/utils';
export * from './utils/string-constants';
export * from './warnings/warnings';
export * from './v1/federation/utils';
export * from './v1/federation/walkers';
export * from './v1/normalization/directive-definition-data';
export * from './v1/normalization/utils';
export * from './v1/normalization/walkers';
export * from './v1/schema-building/type-merging';
export * from './v1/subgraph/subgraph';
export * from './v1/utils/constants';
export * from './v1/utils/utils';
export * from './v1/utils/string-constants';
export * from './v1/warnings/warnings';

@@ -21,23 +21,32 @@ "use strict";

__exportStar(require("./errors/utils"), exports);
__exportStar(require("./federation/federation-factory"), exports);
__exportStar(require("./federation/utils"), exports);
__exportStar(require("./federation/walkers"), exports);
__exportStar(require("./normalization/directive-definition-data"), exports);
__exportStar(require("./normalization/normalization-factory"), exports);
__exportStar(require("./normalization/utils"), exports);
__exportStar(require("./normalization/walkers"), exports);
__exportStar(require("./router-configuration/router-configuration"), exports);
__exportStar(require("./federation/federation"), exports);
__exportStar(require("./federation/types"), exports);
__exportStar(require("./normalization/normalization"), exports);
__exportStar(require("./normalization/types"), exports);
__exportStar(require("./resolvability-graph/graph"), exports);
__exportStar(require("./resolvability-graph/graph-nodes"), exports);
__exportStar(require("./resolvability-graph/utils"), exports);
__exportStar(require("./router-compatibility-version/router-compatibility-version"), exports);
__exportStar(require("./router-configuration/router-configuration"), exports);
__exportStar(require("./schema-building/ast"), exports);
__exportStar(require("./schema-building/type-definition-data"), exports);
__exportStar(require("./schema-building/type-merging"), exports);
__exportStar(require("./schema-building/types"), exports);
__exportStar(require("./schema-building/utils"), exports);
__exportStar(require("./subgraph/subgraph"), exports);
__exportStar(require("./subgraph/types"), exports);
__exportStar(require("./utils/composition-version"), exports);
__exportStar(require("./utils/constants"), exports);
__exportStar(require("./utils/string-constants"), exports);
__exportStar(require("./utils/types"), exports);
__exportStar(require("./utils/utils"), exports);
__exportStar(require("./utils/string-constants"), exports);
__exportStar(require("./warnings/warnings"), exports);
// v1
__exportStar(require("./v1/federation/utils"), exports);
__exportStar(require("./v1/federation/walkers"), exports);
__exportStar(require("./v1/normalization/directive-definition-data"), exports);
__exportStar(require("./v1/normalization/utils"), exports);
__exportStar(require("./v1/normalization/walkers"), exports);
__exportStar(require("./v1/schema-building/type-merging"), exports);
__exportStar(require("./v1/subgraph/subgraph"), exports);
__exportStar(require("./v1/utils/constants"), exports);
__exportStar(require("./v1/utils/utils"), exports);
__exportStar(require("./v1/utils/string-constants"), exports);
__exportStar(require("./v1/warnings/warnings"), exports);
//# sourceMappingURL=index.js.map

@@ -1,5 +0,5 @@

import { GraphFieldData } from '../utils/utils';
import { RootTypeName } from '../utils/string-constants';
import { Edge, EntityDataNode, GraphNode, GraphNodeOptions, RootNode } from './graph-nodes';
import { EntityResolvabilityFailure, EntityResolvabilityResult, NodeResolutionData, RootFieldData } from './utils';
import { RootTypeName } from '../utils/types';
import { GraphFieldData } from '../utils/utils';
export declare class Graph {

@@ -6,0 +6,0 @@ edgeId: number;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Graph = void 0;
const utils_1 = require("../utils/utils");
const graph_nodes_1 = require("./graph-nodes");
const utils_1 = require("./utils");
const string_constants_1 = require("../utils/string-constants");
const graph_nodes_1 = require("./graph-nodes");
const utils_2 = require("./utils");
const utils_2 = require("../utils/utils");
class Graph {

@@ -23,3 +23,3 @@ edgeId = -1;

getRootNode(typeName) {
return (0, utils_1.getValueOrDefault)(this.rootNodeByRootTypeName, typeName, () => new graph_nodes_1.RootNode(typeName));
return (0, utils_2.getValueOrDefault)(this.rootNodeByRootTypeName, typeName, () => new graph_nodes_1.RootNode(typeName));
}

@@ -38,3 +38,3 @@ addOrUpdateNode(typeName, options) {

this.nodeByNodeName.set(nodeName, newNode);
(0, utils_1.getValueOrDefault)(this.nodesByTypeName, typeName, () => []).push(newNode);
(0, utils_2.getValueOrDefault)(this.nodesByTypeName, typeName, () => []).push(newNode);
return newNode;

@@ -45,3 +45,3 @@ }

const edge = new graph_nodes_1.Edge(this.getNextEdgeId(), tailNode, fieldName);
(0, utils_1.getValueOrDefault)(headNode.headToShareableTailEdges, fieldName, () => []).push(edge);
(0, utils_2.getValueOrDefault)(headNode.headToShareableTailEdges, fieldName, () => []).push(edge);
return edge;

@@ -156,3 +156,3 @@ }

const interSubgraphNodes = this.nodesByTypeName.get(entityNode.typeName) || [];
const nestedEntityNodeNamesBySharedFieldPath = (0, utils_1.getValueOrDefault)(nestedEntityNodeNamesBySharedFieldPathByParentNodeName, entityNodeName, () => (isFieldShared ? sharedNestedEntityNodeNamesBySharedFieldPath : new Map()));
const nestedEntityNodeNamesBySharedFieldPath = (0, utils_2.getValueOrDefault)(nestedEntityNodeNamesBySharedFieldPathByParentNodeName, entityNodeName, () => (isFieldShared ? sharedNestedEntityNodeNamesBySharedFieldPath : new Map()));
const walker = new Walker({

@@ -175,3 +175,3 @@ interSubgraphNodes,

entityAncestorData: {
fieldSetsByTargetSubgraphName: (0, utils_1.getOrThrowError)(this.entityDataNodes, entityNode.typeName, 'entityDataNodes').fieldSetsByTargetSubgraphName,
fieldSetsByTargetSubgraphName: (0, utils_2.getOrThrowError)(this.entityDataNodes, entityNode.typeName, 'entityDataNodes').fieldSetsByTargetSubgraphName,
subgraphName: entityNode.subgraphName,

@@ -229,6 +229,6 @@ typeName: entityNode.typeName,

}
const fieldData = (0, utils_1.getOrThrowError)(rootNode.fieldDataByFieldName, rootFieldName, 'fieldDataByFieldName');
const rootFieldData = (0, utils_2.newRootFieldData)(rootNode.typeName, rootFieldName, fieldData.subgraphNames);
const fieldData = (0, utils_2.getOrThrowError)(rootNode.fieldDataByFieldName, rootFieldName, 'fieldDataByFieldName');
const rootFieldData = (0, utils_1.newRootFieldData)(rootNode.typeName, rootFieldName, fieldData.subgraphNames);
if (this.unresolvableFieldPaths.size > 0) {
(0, utils_2.generateResolvabilityErrors)({
(0, utils_1.generateResolvabilityErrors)({
unresolvableFieldPaths: this.unresolvableFieldPaths,

@@ -259,3 +259,3 @@ nodeResolutionDataByFieldPath: this.nodeResolutionDataByFieldPath,

}
if (!(0, utils_1.add)(edge.visitedIndices, this.walkerIndex) || edge.node.isLeaf) {
if (!(0, utils_2.add)(edge.visitedIndices, this.walkerIndex) || edge.node.isLeaf) {
return true;

@@ -276,6 +276,6 @@ }

if (node.hasEntitySiblings) {
(0, utils_1.getValueOrDefault)(this.entityNodeNamesBySharedFieldPath, fieldPath, () => new Set()).add(node.nodeName);
(0, utils_2.getValueOrDefault)(this.entityNodeNamesBySharedFieldPath, fieldPath, () => new Set()).add(node.nodeName);
return;
}
const resolvedFieldNames = (0, utils_1.getValueOrDefault)(this.nodeResolutionDataByFieldPath, fieldPath, () => new utils_2.NodeResolutionData(node.typeName, node.fieldDataByFieldName));
const resolvedFieldNames = (0, utils_2.getValueOrDefault)(this.nodeResolutionDataByFieldPath, fieldPath, () => new utils_1.NodeResolutionData(node.typeName, node.fieldDataByFieldName));
for (const [fieldName, edge] of node.headToTailEdges) {

@@ -303,3 +303,3 @@ // Returns true if the edge was visited

generateEntityResolvabilityErrors(result, rootFieldData, errors) {
const nodeResolutionDataByFieldPath = (0, utils_1.getOrThrowError)(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName, result.nodeName, 'resolvableFieldNamesByRelativeFieldPathByEntityNodeName');
const nodeResolutionDataByFieldPath = (0, utils_2.getOrThrowError)(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName, result.nodeName, 'resolvableFieldNamesByRelativeFieldPathByEntityNodeName');
let pathFromRoot = '';

@@ -310,3 +310,3 @@ // Reconstruct the path

}
(0, utils_2.generateResolvabilityErrors)({
(0, utils_1.generateResolvabilityErrors)({
unresolvableFieldPaths: result.unresolvableFieldPaths,

@@ -338,3 +338,3 @@ nodeResolutionDataByFieldPath,

resolvableFieldNamesByRelativeFieldPathByEntityNodeName;
this.resolvableFieldNamesByRelativeFieldPath = (0, utils_1.getValueOrDefault)(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName, originNode.nodeName, () => new Map());
this.resolvableFieldNamesByRelativeFieldPath = (0, utils_2.getValueOrDefault)(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName, originNode.nodeName, () => new Map());
this.unresolvableSharedFieldPaths = unresolvableSharedFieldPaths;

@@ -362,7 +362,7 @@ this.walkerIndex = walkerIndex;

}
if (!(0, utils_1.add)(edge.visitedIndices, this.walkerIndex) || edge.node.isLeaf) {
if (!(0, utils_2.add)(edge.visitedIndices, this.walkerIndex) || edge.node.isLeaf) {
return true;
}
if (edge.node.hasEntitySiblings) {
(0, utils_1.getValueOrDefault)(this.entityNodeNamesBySharedFieldPath, `${fieldPath}.${edge.edgeName}`, () => new Set()).add(edge.node.nodeName);
(0, utils_2.getValueOrDefault)(this.entityNodeNamesBySharedFieldPath, `${fieldPath}.${edge.edgeName}`, () => new Set()).add(edge.node.nodeName);
return true;

@@ -382,5 +382,5 @@ }

}
const originResolvedFieldNames = (0, utils_1.getValueOrDefault)(this.resolvableFieldNamesByRelativeFieldPath, fieldPath, () => new utils_2.NodeResolutionData(node.typeName, node.fieldDataByFieldName));
const originResolvedFieldNames = (0, utils_2.getValueOrDefault)(this.resolvableFieldNamesByRelativeFieldPath, fieldPath, () => new utils_1.NodeResolutionData(node.typeName, node.fieldDataByFieldName));
const sharedResolvedFieldNames = this.sharedResolvableFieldNamesByRelativeFieldPath
? (0, utils_1.getValueOrDefault)(this.sharedResolvableFieldNamesByRelativeFieldPath, fieldPath, () => new utils_2.NodeResolutionData(node.typeName, node.fieldDataByFieldName))
? (0, utils_2.getValueOrDefault)(this.sharedResolvableFieldNamesByRelativeFieldPath, fieldPath, () => new utils_1.NodeResolutionData(node.typeName, node.fieldDataByFieldName))
: undefined;

@@ -387,0 +387,0 @@ for (const [fieldName, edge] of node.headToTailEdges) {

@@ -9,5 +9,5 @@ "use strict";

exports.generateResolvabilityErrors = generateResolvabilityErrors;
const errors_1 = require("../errors/errors");
const string_constants_1 = require("../utils/string-constants");
const utils_1 = require("../utils/utils");
const string_constants_1 = require("../utils/string-constants");
const errors_1 = require("../errors/errors");
class NodeResolutionData {

@@ -14,0 +14,0 @@ fieldDataByFieldName;

import { BooleanValueNode, ConstDirectiveNode, ConstValueNode, DirectiveDefinitionNode, EnumValueDefinitionNode, EnumValueNode, FieldDefinitionNode, FloatValueNode, InputValueDefinitionNode, IntValueNode, Kind, NullValueNode, OperationTypeNode, StringValueNode, TypeNode } from 'graphql';
import { ChildData, CompositeOutputData, DefinitionData, EnumDefinitionData, EnumValueData, FieldData, InputValueData, NodeData, ParentDefinitionData, PersistedDirectiveDefinitionData, PersistedDirectivesData, ScalarDefinitionData } from './type-definition-data';
import { AuthorizationData, ChildData, CompositeOutputData, ConditionalFieldData, DefinitionData, EnumDefinitionData, EnumValueData, FieldData, InputValueData, NodeData, ParentDefinitionData, PersistedDirectiveDefinitionData, PersistedDirectivesData, ScalarDefinitionData } from './types';
import { MutableFieldNode, MutableInputValueNode, MutableTypeDefinitionNode } from './ast';
import { ObjectTypeNode } from '../ast/utils';
import { AuthorizationData } from '../utils/utils';
import { FieldConfiguration, FieldSetCondition, SubscriptionFilterValue } from '../router-configuration/router-configuration';
import { FieldConfiguration, SubscriptionFilterValue } from '../router-configuration/router-configuration';
export declare function newPersistedDirectivesData(): PersistedDirectivesData;

@@ -59,8 +58,4 @@ type IsNodeExternalOrShareableResult = {

}
export type ConditionalFieldData = {
providedBy: Array<FieldSetCondition>;
requiredBy: Array<FieldSetCondition>;
};
export declare function newConditionalFieldData(): ConditionalFieldData;
export declare function getDefinitionDataCoords(data: NodeData, useRenamedPath: boolean): string;
export {};

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

const graphql_1 = require("graphql");
const type_definition_data_1 = require("./type-definition-data");
const types_1 = require("./types");
const utils_1 = require("../ast/utils");

@@ -44,3 +44,2 @@ const errors_1 = require("../errors/errors");

const utils_2 = require("../utils/utils");
const constants_1 = require("../utils/constants");
function newPersistedDirectivesData() {

@@ -194,3 +193,3 @@ return {

}
for (const directiveName of constants_1.INHERITABLE_DIRECTIVE_NAMES) {
for (const directiveName of string_constants_1.INHERITABLE_DIRECTIVE_NAMES) {
parentData.directivesByDirectiveName.delete(directiveName);

@@ -230,10 +229,10 @@ }

function setParentDataExtensionType(existingData, incomingData) {
if (existingData.extensionType === incomingData.extensionType || existingData.extensionType === type_definition_data_1.ExtensionType.NONE) {
if (existingData.extensionType === incomingData.extensionType || existingData.extensionType === types_1.ExtensionType.NONE) {
return;
}
if (incomingData.extensionType !== type_definition_data_1.ExtensionType.NONE && !isParentDataRootType(incomingData)) {
if (incomingData.extensionType !== types_1.ExtensionType.NONE && !isParentDataRootType(incomingData)) {
return;
}
// Root types do not create errors even if all are instances are extensions.
existingData.extensionType = type_definition_data_1.ExtensionType.NONE;
existingData.extensionType = types_1.ExtensionType.NONE;
}

@@ -240,0 +239,0 @@ function upsertDeprecatedDirective(persistedDirectivesData, incomingDirectiveNode) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.COMPOSITION_VERSION = void 0;
exports.COMPOSITION_VERSION = '0.36.1';
exports.COMPOSITION_VERSION = '0.37.0';
//# sourceMappingURL=composition-version.js.map
export declare const MAXIMUM_TYPE_NESTING = 30;
export declare const MAX_SUBSCRIPTION_FILTER_DEPTH = 5;
export declare const MAX_INT32: number;
export declare const DEFAULT_CONSUMER_INACTIVE_THRESHOLD = 30;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_CONSUMER_INACTIVE_THRESHOLD = exports.MAX_INT32 = exports.MAX_SUBSCRIPTION_FILTER_DEPTH = exports.MAXIMUM_TYPE_NESTING = void 0;
exports.MAX_INT32 = exports.MAX_SUBSCRIPTION_FILTER_DEPTH = exports.MAXIMUM_TYPE_NESTING = void 0;
exports.MAXIMUM_TYPE_NESTING = 30;
exports.MAX_SUBSCRIPTION_FILTER_DEPTH = 5;
exports.MAX_INT32 = 2 ** 31 - 1;
exports.DEFAULT_CONSUMER_INACTIVE_THRESHOLD = 30;
//# sourceMappingURL=integer-constants.js.map

@@ -145,11 +145,6 @@ export declare const AS = "as";

export declare const VARIABLE_DEFINITION_UPPER = "VARIABLE_DEFINITION";
export declare const TYPE_SYSTEM_DIRECTIVE_LOCATIONS: Set<string>;
export declare const EXECUTABLE_DIRECTIVE_LOCATIONS: Set<string>;
export declare const ROOT_TYPE_NAMES: Set<string>;
export declare const IGNORED_PARENT_DIRECTIVES: Set<string>;
export declare const ROOT_TYPE_NAMES: Set<string>;
export declare const EVENT_DIRECTIVE_NAMES: Set<string>;
export declare const STREAM_CONFIGURATION_FIELD_NAMES: Set<string>;
export declare const PERSISTED_CLIENT_DIRECTIVES: Set<string>;
export declare const SUBSCRIPTION_FILTER_INPUT_NAMES: Set<string>;
export declare const SUBSCRIPTION_FILTER_LIST_INPUT_NAMES: Set<string>;
export type RootTypeName = 'Mutation' | 'Query' | 'Subscription';
export declare const INHERITABLE_DIRECTIVE_NAMES: string[];

@@ -5,4 +5,3 @@ "use strict";

exports.PROVIDES = exports.PROVIDER_ID = exports.PERIOD = exports.PARENT_EXTENSION_DATA_MAP = exports.PARENT_DEFINITION_DATA_MAP = exports.PARENT_DEFINITION_DATA = exports.OVERRIDE = exports.OR_UPPER = exports.OBJECT_UPPER = exports.OBJECT = exports.OPERATION_TO_DEFAULT = exports.NULL = exports.NOT_UPPER = exports.NON_NULLABLE_STRING = exports.NON_NULLABLE_INT = exports.NON_NULLABLE_BOOLEAN = exports.NON_NULLABLE_EDFS_PUBLISH_EVENT_RESULT = exports.NAME = exports.NOT_APPLICABLE = exports.PROVIDER_TYPE_NATS = exports.PROVIDER_TYPE_KAFKA = exports.PROPAGATE = exports.MUTATION_UPPER = exports.MUTATION = exports.NUMBER = exports.LITERAL_NEW_LINE = exports.LITERAL_SPACE = exports.LIST = exports.LINK_PURPOSE = exports.LINK_IMPORT = exports.LINK = exports.LEFT_PARENTHESIS = exports.KEY = exports.INTERFACE_OBJECT = exports.INTERFACE_UPPER = exports.INTERFACE = exports.INT_SCALAR = exports.INPUT_VALUE = exports.INPUT_OBJECT_UPPER = exports.INPUT_OBJECT = exports.INPUT_FIELD_DEFINITION_UPPER = exports.INPUT_FIELD = exports.INLINE_FRAGMENT_UPPER = exports.INLINE_FRAGMENT = exports.INACCESSIBLE = exports.IN_UPPER = exports.IMPORT = exports.ID_SCALAR = exports.FROM = exports.FRAGMENT_SPREAD_UPPER = void 0;
exports.STREAM_CONFIGURATION_FIELD_NAMES = exports.EVENT_DIRECTIVE_NAMES = exports.ROOT_TYPE_NAMES = exports.IGNORED_PARENT_DIRECTIVES = exports.EXECUTABLE_DIRECTIVE_LOCATIONS = exports.TYPE_SYSTEM_DIRECTIVE_LOCATIONS = exports.VARIABLE_DEFINITION_UPPER = exports.VALUES = exports.URL_LOWER = exports.UNION_UPPER = exports.UNION = exports.TOPICS = exports.TOPIC = exports.TAG = exports.SUCCESS = exports.SUBSCRIPTION_UPPER = exports.SUBSCRIBE = exports.SUBSCRIPTION_FILTER_VALUE = exports.SUBSCRIPTION_FILTER_CONDITION = exports.SUBSCRIPTION_FILTER = exports.SUBSCRIPTION_FIELD_CONDITION = exports.SUBSCRIPTION = exports.SUBJECTS = exports.SUBJECT = exports.STRING_SCALAR = exports.STRING = exports.STREAM_NAME = exports.CONSUMER_INACTIVE_THRESHOLD = exports.STREAM_CONFIGURATION = exports.SPECIFIED_BY = exports.SHAREABLE = exports.SERVICE_FIELD = exports.SERVICE_OBJECT = exports.SELECTION_REPRESENTATION = exports.SECURITY = exports.SCOPE_SCALAR = exports.SCOPES = exports.SCHEMA_UPPER = exports.SCHEMA = exports.SCALAR_UPPER = exports.SCALAR = exports.RESOLVABLE = exports.REQUIRES_SCOPES = exports.REQUIRES = exports.REQUEST = exports.REASON = exports.QUOTATION_JOIN = exports.QUERY_UPPER = exports.QUERY = exports.PUBLISH = void 0;
exports.SUBSCRIPTION_FILTER_LIST_INPUT_NAMES = exports.SUBSCRIPTION_FILTER_INPUT_NAMES = exports.PERSISTED_CLIENT_DIRECTIVES = void 0;
exports.INHERITABLE_DIRECTIVE_NAMES = exports.PERSISTED_CLIENT_DIRECTIVES = exports.IGNORED_PARENT_DIRECTIVES = exports.ROOT_TYPE_NAMES = exports.EXECUTABLE_DIRECTIVE_LOCATIONS = exports.VARIABLE_DEFINITION_UPPER = exports.VALUES = exports.URL_LOWER = exports.UNION_UPPER = exports.UNION = exports.TOPICS = exports.TOPIC = exports.TAG = exports.SUCCESS = exports.SUBSCRIPTION_UPPER = exports.SUBSCRIBE = exports.SUBSCRIPTION_FILTER_VALUE = exports.SUBSCRIPTION_FILTER_CONDITION = exports.SUBSCRIPTION_FILTER = exports.SUBSCRIPTION_FIELD_CONDITION = exports.SUBSCRIPTION = exports.SUBJECTS = exports.SUBJECT = exports.STRING_SCALAR = exports.STRING = exports.STREAM_NAME = exports.CONSUMER_INACTIVE_THRESHOLD = exports.STREAM_CONFIGURATION = exports.SPECIFIED_BY = exports.SHAREABLE = exports.SERVICE_FIELD = exports.SERVICE_OBJECT = exports.SELECTION_REPRESENTATION = exports.SECURITY = exports.SCOPE_SCALAR = exports.SCOPES = exports.SCHEMA_UPPER = exports.SCHEMA = exports.SCALAR_UPPER = exports.SCALAR = exports.RESOLVABLE = exports.REQUIRES_SCOPES = exports.REQUIRES = exports.REQUEST = exports.REASON = exports.QUOTATION_JOIN = exports.QUERY_UPPER = exports.QUERY = exports.PUBLISH = void 0;
exports.AS = 'as';

@@ -152,15 +151,2 @@ exports.AND_UPPER = 'AND';

exports.VARIABLE_DEFINITION_UPPER = 'VARIABLE_DEFINITION';
exports.TYPE_SYSTEM_DIRECTIVE_LOCATIONS = new Set([
exports.ARGUMENT_DEFINITION_UPPER,
exports.ENUM_UPPER,
exports.ENUM_VALUE_UPPER,
exports.FIELD_DEFINITION_UPPER,
exports.INPUT_FIELD_DEFINITION_UPPER,
exports.INPUT_OBJECT_UPPER,
exports.INTERFACE_UPPER,
exports.OBJECT_UPPER,
exports.SCALAR_UPPER,
exports.SCHEMA_UPPER,
exports.UNION_UPPER,
]);
exports.EXECUTABLE_DIRECTIVE_LOCATIONS = new Set([

@@ -175,19 +161,6 @@ exports.FIELD_UPPER,

]);
exports.ROOT_TYPE_NAMES = new Set([exports.MUTATION, exports.QUERY, exports.SUBSCRIPTION]);
exports.IGNORED_PARENT_DIRECTIVES = new Set([exports.AUTHENTICATED, exports.REQUIRES_SCOPES]);
exports.ROOT_TYPE_NAMES = new Set([exports.MUTATION, exports.QUERY, exports.SUBSCRIPTION]);
exports.EVENT_DIRECTIVE_NAMES = new Set([
exports.EDFS_KAFKA_PUBLISH,
exports.EDFS_KAFKA_SUBSCRIBE,
exports.EDFS_NATS_PUBLISH,
exports.EDFS_NATS_REQUEST,
exports.EDFS_NATS_SUBSCRIBE,
]);
exports.STREAM_CONFIGURATION_FIELD_NAMES = new Set([
exports.CONSUMER_INACTIVE_THRESHOLD,
exports.CONSUMER_NAME,
exports.STREAM_NAME,
]);
exports.PERSISTED_CLIENT_DIRECTIVES = new Set([exports.AUTHENTICATED, exports.DEPRECATED, exports.REQUIRES_SCOPES]);
exports.SUBSCRIPTION_FILTER_INPUT_NAMES = new Set([exports.AND_UPPER, exports.IN_UPPER, exports.NOT_UPPER, exports.OR_UPPER]);
exports.SUBSCRIPTION_FILTER_LIST_INPUT_NAMES = new Set([exports.AND_UPPER, exports.OR_UPPER]);
exports.INHERITABLE_DIRECTIVE_NAMES = [exports.EXTERNAL, exports.SHAREABLE];
//# sourceMappingURL=string-constants.js.map

@@ -1,5 +0,3 @@

import { ConstDirectiveNode, FieldDefinitionNode, Kind } from 'graphql';
import { EnumTypeNode, InterfaceTypeNode, ObjectTypeNode, ScalarTypeNode } from '../ast/utils';
import { FieldConfiguration } from '../router-configuration/router-configuration';
import { FieldData } from '../schema-building/type-definition-data';
import { ConstDirectiveNode, Kind } from 'graphql/index';
import { SimpleFieldData } from '../schema-building/types';
export declare function areSetsEqual<T>(set: Set<T>, other: Set<T>): boolean;

@@ -10,10 +8,5 @@ export declare function getAllMutualEntries<T>(set: Set<T>, other: Set<T>): Set<T>;

export declare function getEntriesNotInHashSet<T>(iterable: Iterable<T>, comparison: Set<T> | Map<T, any>): T[];
export declare function doSetsIntersect<T>(set: Set<T>, other: Set<T>): boolean;
export declare function subtractSourceSetFromTargetSet<T>(source: Set<T>, target: Set<T>): void;
export declare function mapToArrayOfValues<K, V>(map: Map<K, V>): V[];
export declare function numberToOrdinal(num: number): string;
export declare function addIterableValuesToSet<T>(source: T[] | Iterable<T>, target: Set<T>): void;
export declare function addSetsAndReturnMutationBoolean<T>(source: Set<T>, target: Set<T>): boolean;
export declare function kindToTypeString(kind: Kind): string;
export declare function kindToConvertedTypeString(kind: Kind): string;
export type InvalidArgumentImplementation = {

@@ -36,2 +29,10 @@ actualType: string;

};
export declare function getValueOrDefault<K, V>(map: Map<K, V>, key: K, constructor: () => V): V;
export type GraphFieldData = {
name: string;
namedTypeName: string;
isLeaf: boolean;
subgraphNames: Set<string>;
};
export declare function add<T>(set: Set<T>, key: T): boolean;
export type InvalidRequiredInputValueData = {

@@ -48,22 +49,2 @@ inputValueName: string;

};
export type SimpleFieldData = {
name: string;
namedTypeName: string;
};
export declare function fieldDatasToSimpleFieldDatas(fieldDatas: IterableIterator<FieldData>): Array<SimpleFieldData>;
export declare function isNodeLeaf(kind?: Kind): boolean;
export type GraphFieldData = {
name: string;
namedTypeName: string;
isLeaf: boolean;
subgraphNames: Set<string>;
};
export type EntityInterfaceSubgraphData = {
fieldDatas: Array<SimpleFieldData>;
interfaceFieldNames: Set<string>;
interfaceObjectFieldNames: Set<string>;
isInterfaceObject: boolean;
typeName: string;
concreteTypeNames?: Set<string>;
};
export type EntityInterfaceFederationData = {

@@ -77,4 +58,2 @@ fieldDatasBySubgraphName: Map<string, Array<SimpleFieldData>>;

};
export declare function newEntityInterfaceFederationData(entityInterfaceData: EntityInterfaceSubgraphData, subgraphName: string): EntityInterfaceFederationData;
export declare function upsertEntityInterfaceFederationData(federationData: EntityInterfaceFederationData, subgraphData: EntityInterfaceSubgraphData, subgraphName: string): boolean;
export type InvalidEntityInterface = {

@@ -84,46 +63,3 @@ subgraphName: string;

};
export declare function getValueOrDefault<K, V>(map: Map<K, V>, key: K, constructor: () => V): V;
export type EntityData = {
fieldNames: Set<string>;
keyFieldSets: Set<string>;
subgraphNames: Set<string>;
typeName: string;
};
export type EntityDataParams = {
typeName: string;
fieldNames?: Iterable<string>;
keyFieldSets?: Iterable<string>;
subgraphNames?: Iterable<string>;
};
export declare function newEntityData(params: EntityDataParams): EntityData;
export declare function upsertEntityDataProperties(entityDataByTypeName: Map<string, EntityData>, params: EntityDataParams): void;
export declare function upsertEntityData(entityDataByTypeName: Map<string, EntityData>, incomingData: EntityData): void;
export type FieldAuthorizationData = {
fieldName: string;
requiresAuthentication: boolean;
requiredScopes: Set<string>[];
};
export declare function newFieldAuthorizationData(fieldName: string): FieldAuthorizationData;
export type AuthorizationData = {
fieldAuthorizationDataByFieldName: Map<string, FieldAuthorizationData>;
hasParentLevelAuthorization: boolean;
requiresAuthentication: boolean;
requiredScopes: Set<string>[];
typeName: string;
};
export declare function resetAuthorizationData(authorizationData?: AuthorizationData): void;
export declare function getAuthorizationDataToUpdate(authorizationContainer: AuthorizationData, node: EnumTypeNode | FieldDefinitionNode | InterfaceTypeNode | ObjectTypeNode | ScalarTypeNode): AuthorizationData | FieldAuthorizationData;
export declare function newAuthorizationData(typeName: string): AuthorizationData;
export declare const maxOrScopes = 16;
export declare function mergeAuthorizationDataByAND(source: AuthorizationData | FieldAuthorizationData, target: AuthorizationData | FieldAuthorizationData): boolean;
export declare function upsertFieldAuthorizationData(fieldAuthorizationDataByFieldName: Map<string, FieldAuthorizationData>, incomingFieldAuthorizationData: FieldAuthorizationData): boolean;
export declare function upsertAuthorizationData(authorizationDataByParentTypeName: Map<string, AuthorizationData>, incomingAuthorizationData: AuthorizationData, invalidOrScopesFieldPaths: Set<string>): void;
export declare function upsertAuthorizationConfiguration(fieldConfigurationByFieldPath: Map<string, FieldConfiguration>, authorizationData: AuthorizationData): void;
export declare function setAndGetValue<K, V>(map: Map<K, V>, key: K, value: V): V;
export declare function generateSimpleDirective(name: string): ConstDirectiveNode;
export declare function generateRequiresScopesDirective(orScopes: Set<string>[]): ConstDirectiveNode;
export declare function isNodeKindInterface(kind: Kind): kind is Kind.INTERFACE_TYPE_DEFINITION | Kind.INTERFACE_TYPE_EXTENSION;
export declare function isNodeKindObject(kind: Kind): kind is Kind.OBJECT_TYPE_DEFINITION | Kind.OBJECT_TYPE_EXTENSION;
export declare function addMapEntries<K, V>(source: Map<K, V>, target: Map<K, V>): void;
export declare function getSingleSetEntry<T>(set: Set<T>): T | undefined;
export declare function add<T>(set: Set<T>, key: T): boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.maxOrScopes = void 0;
exports.areSetsEqual = areSetsEqual;

@@ -9,35 +8,10 @@ exports.getAllMutualEntries = getAllMutualEntries;

exports.getEntriesNotInHashSet = getEntriesNotInHashSet;
exports.doSetsIntersect = doSetsIntersect;
exports.subtractSourceSetFromTargetSet = subtractSourceSetFromTargetSet;
exports.mapToArrayOfValues = mapToArrayOfValues;
exports.numberToOrdinal = numberToOrdinal;
exports.addIterableValuesToSet = addIterableValuesToSet;
exports.addSetsAndReturnMutationBoolean = addSetsAndReturnMutationBoolean;
exports.kindToTypeString = kindToTypeString;
exports.kindToConvertedTypeString = kindToConvertedTypeString;
exports.fieldDatasToSimpleFieldDatas = fieldDatasToSimpleFieldDatas;
exports.isNodeLeaf = isNodeLeaf;
exports.newEntityInterfaceFederationData = newEntityInterfaceFederationData;
exports.upsertEntityInterfaceFederationData = upsertEntityInterfaceFederationData;
exports.getValueOrDefault = getValueOrDefault;
exports.newEntityData = newEntityData;
exports.upsertEntityDataProperties = upsertEntityDataProperties;
exports.upsertEntityData = upsertEntityData;
exports.newFieldAuthorizationData = newFieldAuthorizationData;
exports.resetAuthorizationData = resetAuthorizationData;
exports.getAuthorizationDataToUpdate = getAuthorizationDataToUpdate;
exports.newAuthorizationData = newAuthorizationData;
exports.mergeAuthorizationDataByAND = mergeAuthorizationDataByAND;
exports.upsertFieldAuthorizationData = upsertFieldAuthorizationData;
exports.upsertAuthorizationData = upsertAuthorizationData;
exports.upsertAuthorizationConfiguration = upsertAuthorizationConfiguration;
exports.setAndGetValue = setAndGetValue;
exports.add = add;
exports.generateSimpleDirective = generateSimpleDirective;
exports.generateRequiresScopesDirective = generateRequiresScopesDirective;
exports.isNodeKindInterface = isNodeKindInterface;
exports.isNodeKindObject = isNodeKindObject;
exports.addMapEntries = addMapEntries;
exports.getSingleSetEntry = getSingleSetEntry;
exports.add = add;
const graphql_1 = require("graphql");
const index_1 = require("graphql/index");
const string_constants_1 = require("./string-constants");

@@ -95,22 +69,2 @@ const errors_1 = require("../errors/errors");

}
function doSetsIntersect(set, other) {
for (const entry of set) {
if (other.has(entry)) {
return true;
}
}
return false;
}
function subtractSourceSetFromTargetSet(source, target) {
for (const entry of source) {
target.delete(entry);
}
}
function mapToArrayOfValues(map) {
const output = [];
for (const value of map.values()) {
output.push(value);
}
return output;
}
function numberToOrdinal(num) {

@@ -135,77 +89,66 @@ const numString = num.toString();

}
function addSetsAndReturnMutationBoolean(source, target) {
let wasMutated = false;
for (const entry of source) {
if (target.has(entry)) {
continue;
}
wasMutated = true;
target.add(entry);
}
return wasMutated;
}
function kindToTypeString(kind) {
switch (kind) {
case graphql_1.Kind.BOOLEAN: {
case index_1.Kind.BOOLEAN: {
return string_constants_1.BOOLEAN_SCALAR;
}
case graphql_1.Kind.ENUM:
case index_1.Kind.ENUM:
// intentional fallthrough
case graphql_1.Kind.ENUM_TYPE_DEFINITION: {
case index_1.Kind.ENUM_TYPE_DEFINITION: {
return string_constants_1.ENUM;
}
case graphql_1.Kind.ENUM_TYPE_EXTENSION: {
case index_1.Kind.ENUM_TYPE_EXTENSION: {
return 'Enum extension';
}
case graphql_1.Kind.ENUM_VALUE_DEFINITION: {
case index_1.Kind.ENUM_VALUE_DEFINITION: {
return string_constants_1.ENUM_VALUE;
}
case graphql_1.Kind.FIELD_DEFINITION: {
case index_1.Kind.FIELD_DEFINITION: {
return string_constants_1.FIELD;
}
case graphql_1.Kind.FLOAT: {
case index_1.Kind.FLOAT: {
return string_constants_1.FLOAT_SCALAR;
}
case graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION: {
case index_1.Kind.INPUT_OBJECT_TYPE_DEFINITION: {
return string_constants_1.INPUT_OBJECT;
}
case graphql_1.Kind.INPUT_OBJECT_TYPE_EXTENSION: {
case index_1.Kind.INPUT_OBJECT_TYPE_EXTENSION: {
return 'Input Object extension';
}
case graphql_1.Kind.INPUT_VALUE_DEFINITION: {
case index_1.Kind.INPUT_VALUE_DEFINITION: {
return string_constants_1.INPUT_VALUE;
}
case graphql_1.Kind.INT: {
case index_1.Kind.INT: {
return string_constants_1.INT_SCALAR;
}
case graphql_1.Kind.INTERFACE_TYPE_DEFINITION: {
case index_1.Kind.INTERFACE_TYPE_DEFINITION: {
return string_constants_1.INTERFACE;
}
case graphql_1.Kind.INTERFACE_TYPE_EXTENSION: {
case index_1.Kind.INTERFACE_TYPE_EXTENSION: {
return 'Interface extension';
}
case graphql_1.Kind.NULL: {
case index_1.Kind.NULL: {
return string_constants_1.NULL;
}
case graphql_1.Kind.OBJECT:
case index_1.Kind.OBJECT:
// intentional fallthrough
case graphql_1.Kind.OBJECT_TYPE_DEFINITION: {
case index_1.Kind.OBJECT_TYPE_DEFINITION: {
return string_constants_1.OBJECT;
}
case graphql_1.Kind.OBJECT_TYPE_EXTENSION: {
case index_1.Kind.OBJECT_TYPE_EXTENSION: {
return 'Object extension';
}
case graphql_1.Kind.STRING: {
case index_1.Kind.STRING: {
return string_constants_1.STRING_SCALAR;
}
case graphql_1.Kind.SCALAR_TYPE_DEFINITION: {
case index_1.Kind.SCALAR_TYPE_DEFINITION: {
return string_constants_1.SCALAR;
}
case graphql_1.Kind.SCALAR_TYPE_EXTENSION: {
case index_1.Kind.SCALAR_TYPE_EXTENSION: {
return 'Scalar extension';
}
case graphql_1.Kind.UNION_TYPE_DEFINITION: {
case index_1.Kind.UNION_TYPE_DEFINITION: {
return string_constants_1.UNION;
}
case graphql_1.Kind.UNION_TYPE_EXTENSION: {
case index_1.Kind.UNION_TYPE_EXTENSION: {
return 'Union extension';

@@ -217,138 +160,2 @@ }

}
function kindToConvertedTypeString(kind) {
switch (kind) {
case graphql_1.Kind.BOOLEAN: {
return string_constants_1.BOOLEAN_SCALAR;
}
case graphql_1.Kind.ENUM:
// intentional fallthrough
case graphql_1.Kind.ENUM_TYPE_DEFINITION:
// intentional fallthrough
case graphql_1.Kind.ENUM_TYPE_EXTENSION: {
return string_constants_1.ENUM;
}
case graphql_1.Kind.ENUM_VALUE_DEFINITION: {
return string_constants_1.ENUM_VALUE;
}
case graphql_1.Kind.FIELD_DEFINITION: {
return string_constants_1.FIELD;
}
case graphql_1.Kind.FLOAT: {
return string_constants_1.FLOAT_SCALAR;
}
case graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION:
// intentional fallthrough
case graphql_1.Kind.INPUT_OBJECT_TYPE_EXTENSION: {
return string_constants_1.INPUT_OBJECT;
}
case graphql_1.Kind.INPUT_VALUE_DEFINITION: {
return string_constants_1.INPUT_VALUE;
}
case graphql_1.Kind.INT: {
return string_constants_1.INT_SCALAR;
}
case graphql_1.Kind.INTERFACE_TYPE_DEFINITION:
// intentional fallthrough
case graphql_1.Kind.INTERFACE_TYPE_EXTENSION: {
return string_constants_1.INTERFACE;
}
case graphql_1.Kind.NULL: {
return string_constants_1.NULL;
}
case graphql_1.Kind.OBJECT:
// intentional fallthrough
case graphql_1.Kind.OBJECT_TYPE_DEFINITION:
// intentional fallthrough
case graphql_1.Kind.OBJECT_TYPE_EXTENSION: {
return string_constants_1.OBJECT;
}
case graphql_1.Kind.STRING: {
return string_constants_1.STRING_SCALAR;
}
case graphql_1.Kind.SCALAR_TYPE_DEFINITION:
// intentional fallthrough
case graphql_1.Kind.SCALAR_TYPE_EXTENSION: {
return string_constants_1.SCALAR;
}
case graphql_1.Kind.UNION_TYPE_DEFINITION:
// intentional fallthrough
case graphql_1.Kind.UNION_TYPE_EXTENSION: {
return string_constants_1.UNION;
}
default:
return kind;
}
}
function fieldDatasToSimpleFieldDatas(fieldDatas) {
const simpleFieldDatas = [];
for (const { name, namedTypeName } of fieldDatas) {
simpleFieldDatas.push({ name, namedTypeName });
}
return simpleFieldDatas;
}
// Only used to assess the output type of field definitions for graph selection set rendering
function isNodeLeaf(kind) {
// Base scalars are not added to parent definition data
if (!kind) {
return true;
}
switch (kind) {
case graphql_1.Kind.OBJECT_TYPE_DEFINITION:
case graphql_1.Kind.INTERFACE_TYPE_DEFINITION:
case graphql_1.Kind.UNION_TYPE_DEFINITION:
return false;
default:
return true;
}
}
function newEntityInterfaceFederationData(entityInterfaceData, subgraphName) {
return {
fieldDatasBySubgraphName: new Map().set(subgraphName, entityInterfaceData.fieldDatas),
interfaceFieldNames: new Set(entityInterfaceData.interfaceFieldNames),
interfaceObjectFieldNames: new Set(entityInterfaceData.interfaceObjectFieldNames),
interfaceObjectSubgraphs: new Set(entityInterfaceData.isInterfaceObject ? [subgraphName] : []),
typeName: entityInterfaceData.typeName,
...(entityInterfaceData.isInterfaceObject
? {}
: { concreteTypeNames: new Set(entityInterfaceData.concreteTypeNames) }),
};
}
// Returns true if the federation data concrete types set was mutated and false otherwise
function upsertEntityInterfaceFederationData(federationData, subgraphData, subgraphName) {
federationData.fieldDatasBySubgraphName.set(subgraphName, subgraphData.fieldDatas);
addIterableValuesToSet(subgraphData.interfaceFieldNames, federationData.interfaceFieldNames);
addIterableValuesToSet(subgraphData.interfaceObjectFieldNames, federationData.interfaceObjectFieldNames);
// interface objects should not define any concrete types
if (subgraphData.isInterfaceObject) {
federationData.interfaceObjectSubgraphs.add(subgraphName);
return false;
}
// the concreteTypeNames set is null if only interfaceObjects have been encountered
if (!federationData.concreteTypeNames) {
federationData.concreteTypeNames = new Set(subgraphData.concreteTypeNames);
return false;
}
// entity interface concrete types should be consistent
return addSetsAndReturnMutationBoolean(subgraphData.concreteTypeNames || new Set(), federationData.concreteTypeNames);
}
class StackSet {
set = new Set();
stack = [];
constructor(value) {
this.push(value);
}
has(value) {
return this.set.has(value);
}
push(value) {
this.stack.push(value);
this.set.add(value);
}
pop() {
const value = this.stack.pop();
if (value) {
this.set.delete(value);
}
}
}
function getValueOrDefault(map, key, constructor) {

@@ -363,149 +170,12 @@ const existingValue = map.get(key);

}
function newEntityData(params) {
return {
fieldNames: new Set(params.fieldNames),
keyFieldSets: new Set(params.keyFieldSets),
subgraphNames: new Set(params.subgraphNames),
typeName: params.typeName,
};
}
function addEntityDataProperties(source, target) {
addIterableValuesToSet(source.fieldNames || [], target.fieldNames);
addIterableValuesToSet(source.keyFieldSets || [], target.keyFieldSets);
addIterableValuesToSet(source.subgraphNames || [], target.subgraphNames);
}
function upsertEntityDataProperties(entityDataByTypeName, params) {
const existingData = entityDataByTypeName.get(params.typeName);
existingData
? addEntityDataProperties(params, existingData)
: entityDataByTypeName.set(params.typeName, newEntityData(params));
}
function upsertEntityData(entityDataByTypeName, incomingData) {
const existingData = entityDataByTypeName.get(incomingData.typeName);
existingData
? addEntityDataProperties(incomingData, existingData)
: entityDataByTypeName.set(incomingData.typeName, incomingData);
}
function newFieldAuthorizationData(fieldName) {
return {
fieldName,
requiresAuthentication: false,
requiredScopes: [],
};
}
function resetAuthorizationData(authorizationData) {
if (!authorizationData) {
return;
}
authorizationData.requiresAuthentication = false;
authorizationData.requiredScopes = [];
authorizationData.hasParentLevelAuthorization = false;
}
function getAuthorizationDataToUpdate(authorizationContainer, node) {
if (node.kind === graphql_1.Kind.FIELD_DEFINITION) {
const name = node.name.value;
return getValueOrDefault(authorizationContainer.fieldAuthorizationDataByFieldName, name, () => newFieldAuthorizationData(name));
}
authorizationContainer.hasParentLevelAuthorization = true;
return authorizationContainer;
}
function newAuthorizationData(typeName) {
return {
fieldAuthorizationDataByFieldName: new Map(),
hasParentLevelAuthorization: false,
requiresAuthentication: false,
requiredScopes: [],
typeName,
};
}
exports.maxOrScopes = 16;
function mergeAuthorizationDataByAND(source, target) {
target.requiresAuthentication ||= source.requiresAuthentication;
const sourceScopesLength = source.requiredScopes.length;
if (sourceScopesLength < 1) {
return true;
}
const targetScopesLength = target.requiredScopes.length;
if (targetScopesLength < 1) {
if (sourceScopesLength > exports.maxOrScopes) {
return false;
}
for (const andScopes of source.requiredScopes) {
target.requiredScopes.push(new Set(andScopes));
}
return true;
}
if (sourceScopesLength * targetScopesLength > exports.maxOrScopes) {
function add(set, key) {
if (set.has(key)) {
return false;
}
const mergedOrScopes = [];
for (const existingAndScopes of target.requiredScopes) {
for (const incomingAndScopes of source.requiredScopes) {
const newAndScopes = new Set(existingAndScopes);
addIterableValuesToSet(incomingAndScopes, newAndScopes);
mergedOrScopes.push(newAndScopes);
}
}
target.requiredScopes = mergedOrScopes;
set.add(key);
return true;
}
function upsertFieldAuthorizationData(fieldAuthorizationDataByFieldName, incomingFieldAuthorizationData) {
const fieldName = incomingFieldAuthorizationData.fieldName;
const existingFieldAuthorizationData = fieldAuthorizationDataByFieldName.get(fieldName);
if (!existingFieldAuthorizationData) {
if (incomingFieldAuthorizationData.requiredScopes.length > exports.maxOrScopes) {
return false;
}
const fieldAuthorizationData = newFieldAuthorizationData(fieldName);
fieldAuthorizationData.requiresAuthentication ||= incomingFieldAuthorizationData.requiresAuthentication;
for (const andScopes of incomingFieldAuthorizationData.requiredScopes) {
fieldAuthorizationData.requiredScopes.push(new Set(andScopes));
}
fieldAuthorizationDataByFieldName.set(fieldName, fieldAuthorizationData);
return true;
}
existingFieldAuthorizationData.requiresAuthentication ||= incomingFieldAuthorizationData.requiresAuthentication;
return mergeAuthorizationDataByAND(incomingFieldAuthorizationData, existingFieldAuthorizationData);
}
function upsertAuthorizationData(authorizationDataByParentTypeName, incomingAuthorizationData, invalidOrScopesFieldPaths) {
const existingAuthorizationData = authorizationDataByParentTypeName.get(incomingAuthorizationData.typeName);
if (!existingAuthorizationData) {
authorizationDataByParentTypeName.set(incomingAuthorizationData.typeName, incomingAuthorizationData);
return;
}
for (const [fieldName, fieldAuthorizationData] of incomingAuthorizationData.fieldAuthorizationDataByFieldName) {
if (!upsertFieldAuthorizationData(existingAuthorizationData.fieldAuthorizationDataByFieldName, fieldAuthorizationData)) {
invalidOrScopesFieldPaths.add(`${incomingAuthorizationData.typeName}.${fieldName}`);
}
}
}
function upsertAuthorizationConfiguration(fieldConfigurationByFieldPath, authorizationData) {
const typeName = authorizationData.typeName;
for (const [fieldName, fieldAuthorizationData] of authorizationData.fieldAuthorizationDataByFieldName) {
const fieldPath = `${typeName}.${fieldName}`;
const existingFieldConfiguration = fieldConfigurationByFieldPath.get(fieldPath);
if (existingFieldConfiguration) {
existingFieldConfiguration.requiresAuthentication = fieldAuthorizationData.requiresAuthentication;
existingFieldConfiguration.requiredScopes = fieldAuthorizationData.requiredScopes.map((orScopes) => [
...orScopes,
]);
}
else {
fieldConfigurationByFieldPath.set(fieldPath, {
argumentNames: [],
typeName,
fieldName,
requiresAuthentication: fieldAuthorizationData.requiresAuthentication,
requiredScopes: fieldAuthorizationData.requiredScopes.map((orScopes) => [...orScopes]),
});
}
}
}
function setAndGetValue(map, key, value) {
map.set(key, value);
return value;
}
function generateSimpleDirective(name) {
return {
kind: graphql_1.Kind.DIRECTIVE,
kind: index_1.Kind.DIRECTIVE,
name: (0, utils_1.stringToNameNode)(name),

@@ -520,17 +190,17 @@ };

scopes.push({
kind: graphql_1.Kind.STRING,
kind: index_1.Kind.STRING,
value: scope,
});
}
values.push({ kind: graphql_1.Kind.LIST, values: scopes });
values.push({ kind: index_1.Kind.LIST, values: scopes });
}
return {
kind: graphql_1.Kind.DIRECTIVE,
kind: index_1.Kind.DIRECTIVE,
name: (0, utils_1.stringToNameNode)(string_constants_1.REQUIRES_SCOPES),
arguments: [
{
kind: graphql_1.Kind.ARGUMENT,
kind: index_1.Kind.ARGUMENT,
name: (0, utils_1.stringToNameNode)(string_constants_1.SCOPES),
value: {
kind: graphql_1.Kind.LIST,
kind: index_1.Kind.LIST,
values,

@@ -542,25 +212,2 @@ },

}
function isNodeKindInterface(kind) {
return kind === graphql_1.Kind.INTERFACE_TYPE_DEFINITION || kind === graphql_1.Kind.INTERFACE_TYPE_EXTENSION;
}
function isNodeKindObject(kind) {
return kind === graphql_1.Kind.OBJECT_TYPE_DEFINITION || kind === graphql_1.Kind.OBJECT_TYPE_EXTENSION;
}
function addMapEntries(source, target) {
for (const [key, value] of source) {
target.set(key, value);
}
}
function getSingleSetEntry(set) {
for (const entry of set) {
return entry;
}
}
function add(set, key) {
if (set.has(key)) {
return false;
}
set.add(key);
return true;
}
//# sourceMappingURL=utils.js.map

@@ -1,2 +0,1 @@

import { FieldSetDirective } from '../schema-building/utils';
export type WarningSubgraphData = {

@@ -13,8 +12,1 @@ name: string;

}
export declare function invalidOverrideTargetSubgraphNameWarning(targetSubgraphName: string, parentTypeName: string, fieldNames: string[], originSubgraphName: string): Warning;
export declare function externalInterfaceFieldsWarning(subgraphName: string, typeName: string, fieldNames: Array<string>): Warning;
export declare function nonExternalConditionalFieldWarning(originCoords: string, subgraphName: string, targetCoords: string, fieldSet: string, fieldSetDirective: FieldSetDirective): Warning;
export declare function unimplementedInterfaceOutputTypeWarning(subgraphName: string, interfaceTypeName: string): Warning;
export declare function invalidExternalFieldWarning(fieldCoords: string, subgraphName: string): Warning;
export declare function requiresDefinedOnNonEntityFieldWarning(fieldCoords: string, subgraphName: string): Warning;
export declare function consumerInactiveThresholdInvalidValueWarning(subgraphName: string, additionalMsg?: string): Warning;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Warning = void 0;
exports.invalidOverrideTargetSubgraphNameWarning = invalidOverrideTargetSubgraphNameWarning;
exports.externalInterfaceFieldsWarning = externalInterfaceFieldsWarning;
exports.nonExternalConditionalFieldWarning = nonExternalConditionalFieldWarning;
exports.unimplementedInterfaceOutputTypeWarning = unimplementedInterfaceOutputTypeWarning;
exports.invalidExternalFieldWarning = invalidExternalFieldWarning;
exports.requiresDefinedOnNonEntityFieldWarning = requiresDefinedOnNonEntityFieldWarning;
exports.consumerInactiveThresholdInvalidValueWarning = consumerInactiveThresholdInvalidValueWarning;
const string_constants_1 = require("../utils/string-constants");
class Warning extends Error {

@@ -21,94 +13,2 @@ subgraph;

exports.Warning = Warning;
function invalidOverrideTargetSubgraphNameWarning(targetSubgraphName, parentTypeName, fieldNames, originSubgraphName) {
return new Warning({
message: `The Object type "${parentTypeName}" defines the directive "@override(from: "${targetSubgraphName}")" on the following field` +
(fieldNames.length > 1 ? 's' : '') +
`: "` +
fieldNames.join(string_constants_1.QUOTATION_JOIN) +
`".\n` +
`The required "from" argument of type "String!" should be provided with an existing subgraph name.\n` +
`However, a subgraph by the name of "${targetSubgraphName}" does not exist.\n` +
`If this subgraph has been recently deleted, remember to clean up unused "@override" directives that reference this subgraph.`,
subgraph: {
name: originSubgraphName,
},
});
}
function versionOneWarningPropagationMessage(subgraphName) {
return (`The subgraph "${subgraphName}" is currently a "version one" subgraph, but if it were updated to "version two"` +
` in its current state, composition would be unsuccessful due to the following warning that would instead` +
` propagate as an error:\n`);
}
function externalInterfaceFieldsWarning(subgraphName, typeName, fieldNames) {
return new Warning({
message: versionOneWarningPropagationMessage(subgraphName) +
`The Interface "${typeName}" is invalid because the following Field definition` +
(fieldNames.length > 1 ? 's are' : ' is') +
` declared "@external":\n "` +
fieldNames.join(string_constants_1.QUOTATION_JOIN) +
`"\n` +
`Interface Fields should not be declared "@external". This is because Interface Fields do not resolve directly,` +
` but the "@external" directive relates to whether a Field instance can be resolved` +
` by the subgraph in which it is defined.`,
subgraph: {
name: subgraphName,
},
});
}
function nonExternalConditionalFieldWarning(originCoords, subgraphName, targetCoords, fieldSet, fieldSetDirective) {
return new Warning({
message: versionOneWarningPropagationMessage(subgraphName) +
`The Field "${originCoords}" in subgraph "${subgraphName}" defines a "@${fieldSetDirective}" directive with the following` +
` field set:\n "${fieldSet}".` +
`\nHowever, neither the Field "${targetCoords}" nor any of its field set ancestors are declared @external.` +
`\nConsequently, "${targetCoords}" is already provided by subgraph "${subgraphName}" and should not form part of` +
` a "@${fieldSetDirective}" directive field set.`,
subgraph: {
name: subgraphName,
},
});
}
// TODO Temporarily only used as a warning
function unimplementedInterfaceOutputTypeWarning(subgraphName, interfaceTypeName) {
return new Warning({
message: `Subgraph "${subgraphName}": The Interface "${interfaceTypeName}" is used as an output type` +
` without at least one Object type implementation defined in the schema.`,
subgraph: {
name: subgraphName,
},
});
}
function invalidExternalFieldWarning(fieldCoords, subgraphName) {
return new Warning({
message: versionOneWarningPropagationMessage(subgraphName) +
` The Object Field "${fieldCoords}" is invalidly declared "@external". An Object Field should only` +
` be declared "@external" if it is part of a "@key", "@provides", or "@requires" FieldSet, or the Field is` +
` necessary to satisfy an Interface implementation. In the case that none of these conditions is true, the` +
` "@external" directive should be removed.`,
subgraph: {
name: subgraphName,
},
});
}
function requiresDefinedOnNonEntityFieldWarning(fieldCoords, subgraphName) {
return new Warning({
message: ` The Object Field "${fieldCoords}" defines a "@requires" directive, but the Object is not an entity.` +
' Consequently, the "@requires" FieldSet cannot be satisfied because there is no entity resolver with which to' +
' provide the required Fields.',
subgraph: {
name: subgraphName,
},
});
}
function consumerInactiveThresholdInvalidValueWarning(subgraphName, additionalMsg = '') {
return new Warning({
message: `The "consumerInactiveThreshold" argument of type "Int" should be positive and smaller than 2,147,483,648.` +
+additionalMsg
? `\n${additionalMsg}`
: '',
subgraph: {
name: subgraphName,
},
});
}
//# sourceMappingURL=warnings.js.map
{
"name": "@wundergraph/composition",
"version": "0.36.1",
"version": "0.37.0",
"author": {

@@ -44,3 +44,3 @@ "name": "WunderGraph Maintainers",

},
"gitHead": "1a9ec1459419816b4718464b5fa4605e4f6b9950"
"gitHead": "a1aeeda3beddf27075bcfc7038a012f23d638f47"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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