UNPKG

@nestjs/graphql

Version:

GraphQL for NestJS: code-first and schema-first APIs, resolvers as providers, subscriptions, federation and generated SDL, on Apollo or Mercurius.

41 lines • 1.7 kB
/** * What a single `@Args()` parameter declared, recorded at decoration time. */ export interface ArgsTypeMetadata { index: number; /** * Name of the single argument the parameter binds to, or `undefined` when the * parameter receives the whole arguments object. */ property?: string; /** * Explicit `type` option passed to `@Args()`, if any. */ typeFn?: () => any; } /** * Rewrites `value` so that every field renamed through `@Field({ name: '...' })` * is keyed by the property name its class declares instead of its schema name. * * The result is always a fresh object: reading the renamed fields from the * original `value` keeps chained renames (a property whose schema name is * another property's class name) from overwriting each other. */ export declare function mapArgsToProps(value: any, classRef: Function, keepSchemaNames?: boolean): any; /** * Builds the function that maps the raw GraphQL arguments of a single resolver * method onto the property names its `@Args()` classes declare, or `null` when * the method takes no arguments at all. * * The classes involved are resolved lazily, on the first call, because the * metadata this relies on is only complete once the schema has been built. */ export declare function createArgsMapper(target: Function, methodName: string, options?: { /** * Keep the schema-named keys next to the property names (e.g., for * subscription "filter" and "resolve" callbacks written against the * schema names before they received mapped arguments). */ keepSchemaNames?: boolean; }): ((args: any) => any) | null; //# sourceMappingURL=map-args-to-props.util.d.ts.map