Skip to content

Commit

Permalink
Revert DirectiveArgument
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed May 12, 2021
1 parent a44b1cf commit 452e3e0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 42 deletions.
2 changes: 0 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ export {
GraphQLSchemaExtensions,
GraphQLDirectiveConfig,
GraphQLDirectiveExtensions,
GraphQLDirectiveArgument,
GraphQLDirectiveArgumentConfig,
GraphQLArgument,
GraphQLArgumentConfig,
GraphQLArgumentExtensions,
Expand Down
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ export type {
GraphQLDirectiveConfig,
GraphQLArgument,
GraphQLArgumentConfig,
GraphQLDirectiveArgument,
GraphQLDirectiveArgumentConfig,
GraphQLInputValue,
GraphQLInputValueConfig,
GraphQLEnumTypeConfig,
Expand Down
25 changes: 4 additions & 21 deletions src/type/directives.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ObjMap } from '../jsutils/ObjMap';
import { DirectiveDefinitionNode } from '../language/ast';
import { DirectiveLocationEnum } from '../language/directiveLocation';

import { GraphQLInputValue, GraphQLInputValueConfig } from './definition';
import { GraphQLArgument, GraphQLArgumentConfig } from './definition';

/**
* Test if the given value is a GraphQL directive.
Expand Down Expand Up @@ -37,14 +37,14 @@ export class GraphQLDirective {
description: Maybe<string>;
locations: Array<DirectiveLocationEnum>;
isRepeatable: boolean;
args: Array<GraphQLDirectiveArgument>;
args: Array<GraphQLArgument>;
extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
astNode: Maybe<DirectiveDefinitionNode>;

constructor(config: Readonly<GraphQLDirectiveConfig>);

toConfig(): GraphQLDirectiveConfig & {
args: ObjMap<GraphQLDirectiveArgumentConfig>;
args: ObjMap<GraphQLArgumentConfig>;
isRepeatable: boolean;
extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
};
Expand All @@ -59,29 +59,12 @@ export interface GraphQLDirectiveConfig {
name: string;
description?: Maybe<string>;
locations: Array<DirectiveLocationEnum>;
args?: Maybe<ObjMap<GraphQLDirectiveArgumentConfig>>;
args?: Maybe<ObjMap<GraphQLArgumentConfig>>;
isRepeatable?: Maybe<boolean>;
extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;
astNode?: Maybe<DirectiveDefinitionNode>;
}

/**
* Custom extensions
*
* @remarks
* Use a unique identifier name for your extension, for example the name of
* your library or project. Do not use a shortened identifier as this increases
* the risk of conflicts. We recommend you add at most one extension field,
* an object which can contain all the values you need.
*/
export interface GraphQLDirectiveArgumentExtensions {
[attributeName: string]: unknown;
}

export type GraphQLDirectiveArgument = GraphQLInputValue<GraphQLDirectiveArgumentExtensions>;

export type GraphQLDirectiveArgumentConfig = GraphQLInputValueConfig<GraphQLDirectiveArgumentExtensions>;

/**
* Used to conditionally include fields or fragments.
*/
Expand Down
14 changes: 4 additions & 10 deletions src/type/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { DirectiveDefinitionNode } from '../language/ast';
import type { DirectiveLocationEnum } from '../language/directiveLocation';
import { DirectiveLocation } from '../language/directiveLocation';

import type { GraphQLInputValue, GraphQLInputValueConfig } from './definition';
import type { GraphQLArgument, GraphQLArgumentConfig } from './definition';
import { GraphQLString, GraphQLBoolean } from './scalars';
import {
defineInputValue,
Expand Down Expand Up @@ -50,7 +50,7 @@ export class GraphQLDirective {
name: string;
description: ?string;
locations: Array<DirectiveLocationEnum>;
args: $ReadOnlyArray<GraphQLDirectiveArgument>;
args: $ReadOnlyArray<GraphQLArgument>;
isRepeatable: boolean;
extensions: ?ReadOnlyObjMap<mixed>;
astNode: ?DirectiveDefinitionNode;
Expand Down Expand Up @@ -106,29 +106,23 @@ export class GraphQLDirective {
}
}

export type GraphQLDirectiveArgument = GraphQLInputValue;

export type GraphQLDirectiveConfig = {|
name: string,
description?: ?string,
locations: Array<DirectiveLocationEnum>,
args?: ?GraphQLDirectiveConfigArgumentMap,
args?: ?ObjMap<GraphQLArgumentConfig>,
isRepeatable?: ?boolean,
extensions?: ?ReadOnlyObjMapLike<mixed>,
astNode?: ?DirectiveDefinitionNode,
|};

type GraphQLDirectiveNormalizedConfig = {|
...GraphQLDirectiveConfig,
args: GraphQLDirectiveConfigArgumentMap,
args: ObjMap<GraphQLArgumentConfig>,
isRepeatable: boolean,
extensions: ?ReadOnlyObjMap<mixed>,
|};

type GraphQLDirectiveConfigArgumentMap = ObjMap<GraphQLDirectiveArgumentConfig>;

export type GraphQLDirectiveArgumentConfig = GraphQLInputValueConfig;

/**
* Used to conditionally include fields or fragments.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/type/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export {
assertDirective,
// Directives Definition
GraphQLDirective,
GraphQLDirectiveArgument,
// Built-in Directives defined by the Spec
isSpecifiedDirective,
specifiedDirectives,
Expand All @@ -138,7 +137,6 @@ export {
DEFAULT_DEPRECATION_REASON,
// type
GraphQLDirectiveConfig,
GraphQLDirectiveArgumentConfig,
GraphQLDirectiveExtensions,
} from './directives';

Expand Down
6 changes: 1 addition & 5 deletions src/type/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export {
assertDirective,
// Directives Definition
GraphQLDirective,
GraphQLDirectiveArgument,
// Built-in Directives defined by the Spec
isSpecifiedDirective,
specifiedDirectives,
Expand All @@ -84,10 +83,7 @@ export {
DEFAULT_DEPRECATION_REASON,
} from './directives';

export type {
GraphQLDirectiveConfig,
GraphQLDirectiveArgumentConfig,
} from './directives';
export type { GraphQLDirectiveConfig } from './directives';

// Common built-in scalar instances.
export {
Expand Down

0 comments on commit 452e3e0

Please sign in to comment.