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

@apollo/federation-internals

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/federation-internals - npm Package Compare versions

Comparing version 2.3.0-beta.2 to 2.3.0-beta.3

7

dist/definitions.d.ts

@@ -73,3 +73,2 @@ import { ConstArgumentNode, ASTNode, DirectiveLocation, ConstDirectiveNode, DocumentNode, GraphQLError, GraphQLSchema, Kind, TypeNode, VariableDefinitionNode, VariableNode, DirectiveDefinitionNode, DirectiveNode } from "graphql";

schema(): Schema;
appliedDirectivesOf(name: string): Directive<T>[];
appliedDirectivesOf<TApplicationArgs extends {

@@ -79,3 +78,3 @@ [key: string]: any;

[key: string]: any;
}>(definition: DirectiveDefinition<TApplicationArgs>): Directive<T, TApplicationArgs>[];
}>(nameOrDefinition: string | DirectiveDefinition<TApplicationArgs>): Directive<T, TApplicationArgs>[];
get appliedDirectives(): readonly Directive<T>[];

@@ -319,6 +318,6 @@ hasAppliedDirective(nameOrDefinition: string | DirectiveDefinition): boolean;

includeDirective(): DirectiveDefinition<{
if: boolean;
if: boolean | Variable;
}>;
skipDirective(): DirectiveDefinition<{
if: boolean;
if: boolean | Variable;
}>;

@@ -325,0 +324,0 @@ deprecatedDirective(): DirectiveDefinition<{

@@ -74,2 +74,3 @@ import { DocumentNode, FieldNode, FragmentDefinitionNode, SelectionNode, SelectionSetNode } from "graphql";

export declare class Operation {
readonly schema: Schema;
readonly rootKind: SchemaRootKind;

@@ -79,3 +80,3 @@ readonly selectionSet: SelectionSet;

readonly name?: string | undefined;
constructor(rootKind: SchemaRootKind, selectionSet: SelectionSet, variableDefinitions: VariableDefinitions, name?: string | undefined);
constructor(schema: Schema, rootKind: SchemaRootKind, selectionSet: SelectionSet, variableDefinitions: VariableDefinitions, name?: string | undefined);
optimize(fragments?: NamedFragments, minUsagesToOptimize?: number): Operation;

@@ -82,0 +83,0 @@ expandAllFragments(): Operation;

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

import { ArgumentDefinition, InputFieldDefinition, InputType, VariableDefinitions, Variables } from './definitions';
import { ArgumentDefinition, EnumType, InputFieldDefinition, InputType, ScalarType, Schema, VariableDefinitions, Variables } from './definitions';
import { ArgumentNode, ValueNode, ConstValueNode } from 'graphql';

@@ -16,2 +16,3 @@ export declare function valueToString(v: any, expectedType?: InputType): string;

export declare function valueFromASTUntyped(node: ValueNode): any;
export declare function isValidLeafValue(schema: Schema, value: any, type: ScalarType | EnumType): boolean;
export declare function argumentsFromAST(context: string, args: readonly ArgumentNode[] | undefined, argsDefiner: {

@@ -18,0 +19,0 @@ argument(name: string): ArgumentDefinition<any> | undefined;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.variablesInValue = exports.argumentsFromAST = exports.valueFromASTUntyped = exports.valueFromAST = exports.isValidValue = exports.valueToAST = exports.valueNodeToConstValueNode = exports.withDefaultValues = exports.argumentsEquals = exports.valueEquals = exports.valueToString = void 0;
exports.variablesInValue = exports.argumentsFromAST = exports.isValidLeafValue = exports.valueFromASTUntyped = exports.valueFromAST = exports.isValidValue = exports.valueToAST = exports.valueNodeToConstValueNode = exports.withDefaultValues = exports.argumentsEquals = exports.valueEquals = exports.valueToString = void 0;
const definitions_1 = require("./definitions");

@@ -376,5 +376,2 @@ const graphql_1 = require("graphql");

}
if ((0, definitions_1.isCustomScalarType)(locationType)) {
return true;
}
if ((0, definitions_1.isListType)(locationType)) {

@@ -399,23 +396,3 @@ const itemType = locationType.ofType;

}
const schema = locationType.schema();
if (typeof value === 'boolean') {
return locationType === schema.booleanType();
}
if (typeof value === 'number' && isFinite(value)) {
const stringNum = String(value);
if (locationType === schema.intType() || locationType === schema.idType()) {
return integerStringRegExp.test(stringNum);
}
return locationType === schema.floatType();
}
if (typeof value === 'string') {
if ((0, definitions_1.isEnumType)(locationType)) {
return locationType.value(value) !== undefined;
}
return (0, definitions_1.isScalarType)(locationType)
&& locationType !== schema.booleanType()
&& locationType !== schema.intType()
&& locationType !== schema.floatType();
}
return false;
return isValidLeafValue(locationType.schema(), value, locationType);
}

@@ -539,2 +516,27 @@ function valueFromAST(node, expectedType) {

exports.valueFromASTUntyped = valueFromASTUntyped;
function isValidLeafValue(schema, value, type) {
if ((0, definitions_1.isCustomScalarType)(type)) {
return true;
}
if (typeof value === 'boolean') {
return type === schema.booleanType();
}
if (typeof value === 'number' && isFinite(value)) {
const stringNum = String(value);
if (type === schema.intType() || type === schema.idType()) {
return integerStringRegExp.test(stringNum);
}
return type === schema.floatType();
}
if (typeof value === 'string') {
if ((0, definitions_1.isEnumType)(type)) {
return type.value(value) !== undefined;
}
return type !== schema.booleanType()
&& type !== schema.intType()
&& type !== schema.floatType();
}
return false;
}
exports.isValidLeafValue = isValidLeafValue;
function argumentsFromAST(context, args, argsDefiner) {

@@ -541,0 +543,0 @@ var _a;

{
"name": "@apollo/federation-internals",
"version": "2.3.0-beta.2",
"version": "2.3.0-beta.3",
"description": "Apollo Federation internal utilities",

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

import {
ArgumentDefinition,
EnumType,
InputFieldDefinition,

@@ -18,2 +19,4 @@ InputObjectType,

isVariable,
ScalarType,
Schema,
Variable,

@@ -508,7 +511,2 @@ VariableDefinition,

if (isCustomScalarType(locationType)) {
// There is no imposition on what a custom scalar value can be.
return true;
}
if (isListType(locationType)) {

@@ -538,26 +536,3 @@ const itemType: InputType = locationType.ofType;

// though).
const schema = locationType.schema();
if (typeof value === 'boolean') {
return locationType === schema.booleanType();
}
if (typeof value === 'number' && isFinite(value)) {
const stringNum = String(value);
if (locationType === schema.intType() || locationType === schema.idType()) {
return integerStringRegExp.test(stringNum);
}
return locationType === schema.floatType();
}
if (typeof value === 'string') {
if (isEnumType(locationType)) {
return locationType.value(value) !== undefined;
}
return isScalarType(locationType)
&& locationType !== schema.booleanType()
&& locationType !== schema.intType()
&& locationType !== schema.floatType();
}
return false;
return isValidLeafValue(locationType.schema(), value, locationType);
}

@@ -695,2 +670,31 @@

export function isValidLeafValue(schema: Schema, value: any, type: ScalarType | EnumType): boolean {
if (isCustomScalarType(type)) {
// There is no imposition on what a custom scalar value can be.
return true;
}
if (typeof value === 'boolean') {
return type === schema.booleanType();
}
if (typeof value === 'number' && isFinite(value)) {
const stringNum = String(value);
if (type === schema.intType() || type === schema.idType()) {
return integerStringRegExp.test(stringNum);
}
return type === schema.floatType();
}
if (typeof value === 'string') {
if (isEnumType(type)) {
return type.value(value) !== undefined;
}
return type !== schema.booleanType()
&& type !== schema.intType()
&& type !== schema.floatType();
}
return false;
}
export function argumentsFromAST(

@@ -697,0 +701,0 @@ context: string,

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 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 too big to display

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

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