-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/nestjs/graphql; branch 'f…
…eat/shim-model' of https://github.com/maayanbar13/graphql into maayanbar13-feat/shim-model
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// this "shim" can be used on the frontend to prevent from errors on undefined | ||
// decorators in the models, when you are sharing same models across backend and frontend. | ||
// to use this shim simply configure your webpack configuration to use this file instead of @nestjs/graphql module. | ||
/* eslint @typescript-eslint/no-empty-function: 0 */ | ||
import { FieldOptions, InputTypeOptions, InterfaceTypeOptions, ObjectTypeOptions, ReturnTypeFunc } from ".." | ||
|
||
// for webpack this is resolved this way: | ||
// resolve: { // see: https://webpack.js.org/configuration/resolve/ | ||
// alias: { | ||
// @nestjs/graphql: path.resolve(__dirname, "../node_modules/@nestjs/graphql/dist/extra/graphql-model-shim") | ||
// } | ||
// } | ||
|
||
export function ArgsType(): ClassDecorator { | ||
return (target: Function) => {} | ||
} | ||
|
||
export function Directive(sdl: string, | ||
): MethodDecorator & PropertyDecorator & ClassDecorator { | ||
return (target: Function | Object, key?: string | symbol) => {} | ||
} | ||
|
||
export function Extensions( | ||
value: Record<string, unknown>, | ||
): MethodDecorator & ClassDecorator & PropertyDecorator { | ||
return (target: Function | object, propertyKey?: string | symbol) => {} | ||
} | ||
|
||
export function Field( | ||
typeOrOptions?: ReturnTypeFunc | FieldOptions, | ||
fieldOptions?: FieldOptions, | ||
): PropertyDecorator & MethodDecorator { | ||
return ( | ||
prototype: Object, | ||
propertyKey?: string, | ||
descriptor?: TypedPropertyDescriptor<any>, | ||
) => {} | ||
} | ||
|
||
export function HideField(): PropertyDecorator { | ||
return (target: Record<string, any>, propertyKey: string | symbol) => {}; | ||
} | ||
|
||
export function InputType( | ||
nameOrOptions?: string | InputTypeOptions, | ||
inputTypeOptions?: InputTypeOptions, | ||
): ClassDecorator { | ||
return (target) => {} | ||
} | ||
|
||
export function InterfaceType( | ||
nameOrOptions?: string | InterfaceTypeOptions, | ||
interfaceOptions?: InterfaceTypeOptions, | ||
): ClassDecorator { | ||
return (target) => {} | ||
} | ||
|
||
export function ObjectType( | ||
nameOrOptions?: string | ObjectTypeOptions, | ||
objectTypeOptions?: ObjectTypeOptions, | ||
): ClassDecorator { | ||
|
||
return (target) => {} | ||
} | ||
|
||
export function Scalar( | ||
name: string, | ||
typeFunc?: ReturnTypeFunc, | ||
): ClassDecorator { | ||
return (target, key?, descriptor?) => {}; | ||
} |