Skip to content

Commit

Permalink
style: format the whole codebase using newest prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalLytek committed Jan 26, 2019
1 parent 3c5a01a commit 90d55a8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ declare namespace Reflect {

declare namespace NodeJS {
interface Global {
TypeGraphQLMetadataStorage: import ("../src/metadata/metadata-storage").MetadataStorage;
TypeGraphQLMetadataStorage: import("../src/metadata/metadata-storage").MetadataStorage;
}
}
70 changes: 36 additions & 34 deletions src/resolvers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,42 @@ export async function getParams(
pubSub: PubSubEngine,
): Promise<any[]> {
return Promise.all(
params.sort((a, b) => a.index - b.index).map(async paramInfo => {
switch (paramInfo.kind) {
case "args":
return await validateArg(
convertToType(paramInfo.getType(), args),
globalValidate,
paramInfo.validate,
);
case "arg":
return await validateArg(
convertToType(paramInfo.getType(), args[paramInfo.name]),
globalValidate,
paramInfo.validate,
);
case "context":
if (paramInfo.propertyName) {
return context[paramInfo.propertyName];
}
return context;
case "root":
const rootValue = paramInfo.propertyName ? root[paramInfo.propertyName] : root;
if (!paramInfo.getType) {
return rootValue;
}
return convertToType(paramInfo.getType(), rootValue);
case "info":
return info;
case "pubSub":
if (paramInfo.triggerKey) {
return (payload: any) => pubSub.publish(paramInfo.triggerKey!, payload);
}
return pubSub;
}
}),
params
.sort((a, b) => a.index - b.index)
.map(async paramInfo => {
switch (paramInfo.kind) {
case "args":
return await validateArg(
convertToType(paramInfo.getType(), args),
globalValidate,
paramInfo.validate,
);
case "arg":
return await validateArg(
convertToType(paramInfo.getType(), args[paramInfo.name]),
globalValidate,
paramInfo.validate,
);
case "context":
if (paramInfo.propertyName) {
return context[paramInfo.propertyName];
}
return context;
case "root":
const rootValue = paramInfo.propertyName ? root[paramInfo.propertyName] : root;
if (!paramInfo.getType) {
return rootValue;
}
return convertToType(paramInfo.getType(), rootValue);
case "info":
return info;
case "pubSub":
if (paramInfo.triggerKey) {
return (payload: any) => pubSub.publish(paramInfo.triggerKey!, payload);
}
return pubSub;
}
}),
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/buildSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ function getEmitSchemaDefinitionFileOptions(
typeof buildSchemaOptions.emitSchemaFile === "string"
? buildSchemaOptions.emitSchemaFile
: typeof buildSchemaOptions.emitSchemaFile === "object"
? buildSchemaOptions.emitSchemaFile.path || defaultSchemaFilePath
: defaultSchemaFilePath,
? buildSchemaOptions.emitSchemaFile.path || defaultSchemaFilePath
: defaultSchemaFilePath,
printSchemaOptions:
typeof buildSchemaOptions.emitSchemaFile === "object"
? buildSchemaOptions.emitSchemaFile
Expand Down

0 comments on commit 90d55a8

Please sign in to comment.