Skip to content

Commit

Permalink
breaking: you can no-longer define args on 'exposed' fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hayes committed Feb 7, 2021
1 parent fcb1f76 commit 240162b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/fieldUtils/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default class FieldBuilder<
ParentShape,
ResolveReturnShape
>,
'resolve' | 'type'
'resolve' | 'type' | 'args'
>,
) {
return this.exposeField<'Int', Nullable, Name>(name, { ...options, type: 'Int' });
Expand Down
16 changes: 8 additions & 8 deletions packages/plugin-scope-auth/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { MaybePromise, SchemaTypes } from '@giraphql/core';
import { MaybePromise, Merge, SchemaTypes } from '@giraphql/core';
import { GraphQLResolveInfo } from 'graphql';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ScopeAuthPluginOptions {}

export interface BuiltInScopes<Types extends SchemaTypes> {
$all: AuthScopeMap<Types>;
$any: AuthScopeMap<Types>;
$granted: string[];
$all?: true extends true ? AuthScopeMap<Types> : never;
$any?: true extends true ? AuthScopeMap<Types> : never;
$granted?: string[];
}

export type AuthScopeMap<Types extends SchemaTypes> = {
[K in keyof (Types['AuthScopes'] | BuiltInScopes<Types>)]?: Types['AuthScopes'][K];
};
export type AuthScopeMap<Types extends SchemaTypes> = Merge<
Partial<Types['AuthScopes']> & BuiltInScopes<Types>
>;

export type ScopeAuthInitializer<Types extends SchemaTypes> = (
context: Types['Context'],
Expand All @@ -35,7 +35,7 @@ export type FieldAuthScopes<Types extends SchemaTypes, Parent, Args extends {}>
args: Args,
context: Types['Context'],
info: GraphQLResolveInfo,
) => MaybePromise<AuthScopeMap<Types>>);
) => MaybePromise<AuthScopeMap<Types> | boolean>);

export type TypeGrantScopes<Types extends SchemaTypes, Parent> = (
parent: Parent,
Expand Down

0 comments on commit 240162b

Please sign in to comment.