Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add preProcessor / postProcessor args types
  • Loading branch information
getlarge committed May 13, 2020
1 parent 944906b commit 4bbdf66
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 6 deletions.
20 changes: 18 additions & 2 deletions src/engine/action/Action.ts
Expand Up @@ -23,8 +23,24 @@ export type ActionSetup = {
resolve?: Function;
type?: string;
permissions?: Function | Permission | Permission[];
preProcessor?: Function;
postProcessor?: Function;
// preProcessor?: Function;
// postProcessor?: Function;
preProcessor?: (
action?: Action,
source?: any,
payload?: any,
context?: any,
info?: any,
) => Promise<void> | void;
postProcessor?: (
error?: any,
result?: any,
action?: Action,
source?: any,
payload?: any,
context?: any,
info?: any,
) => Promise<void> | void;
};

export class Action {
Expand Down
18 changes: 16 additions & 2 deletions src/engine/entity/Entity.ts
Expand Up @@ -74,8 +74,22 @@ export type EntitySetup = {
permissions?: any;
subscriptions?: any;
states?: any;
preProcessor?: Function;
postProcessor?: Function;
// preProcessor?: Function;
// postProcessor?: Function;
preProcessor?: (
entity?: Entity,
args?: any,
context?: any,
info?: any,
) => Promise<any> | any;
postProcessor?: (
translatedRow?: any,
entity?: Entity,
source?: any,
args?: any,
context?: any,
info?: any,
) => Promise<any> | any;
preFilters?: PreFilterType;
preFiltersGenerator?: PreFilterGeneratorType;
meta?: any;
Expand Down
26 changes: 24 additions & 2 deletions src/engine/mutation/Mutation.ts
Expand Up @@ -40,8 +40,30 @@ export type MutationSetup = {
type?: string;
description?: string;
attributes?: string[];
preProcessor?: Function;
postProcessor?: Function;
// preProcessor?: Function;
// postProcessor?: Function;
preProcessor?: (
entity?: Entity,
id?: string | number,
source?: any,
input?: any,
typeName?: string,
entityMutation?: Mutation,
context?: any,
info?: any,
) => Promise<any> | any;
postProcessor?: (
error?: any,
result?: any,
entity?: Entity,
id?: string | number,
source?: any,
input?: any,
typeName?: string,
entityMutation?: Mutation,
context?: any,
info?: any,
) => Promise<void> | void;
fromState?: string | string[];
toState?: string | string[];
};
Expand Down

0 comments on commit 4bbdf66

Please sign in to comment.