@pothos/plugin-with-input
Advanced tools
Comparing version 3.10.1 to 3.10.2
# @pothos/plugin-with-input | ||
## 3.10.2 | ||
### Patch Changes | ||
- 1ecea46: revert accidental pinning of graphql peer dependency | ||
## 3.10.1 | ||
@@ -19,3 +25,3 @@ | ||
```ts | ||
import WithInputPlugin from '@pothos/plugin-with-input'; | ||
import WithInputPlugin from "@pothos/plugin-with-input"; | ||
const builder = new SchemaBuilder({ | ||
@@ -28,3 +34,3 @@ plugins: [WithInputPlugin], | ||
// This will remove the default Query/Mutation prefix from the input type name | ||
if (parentTypeName === 'Query' || parentTypeName === 'Mutation') { | ||
if (parentTypeName === "Query" || parentTypeName === "Mutation") { | ||
return `${capitalizedFieldName}Input`; | ||
@@ -31,0 +37,0 @@ } |
@@ -5,3 +5,3 @@ import './global-types'; | ||
export * from './types'; | ||
declare const pluginName: "withInput"; | ||
declare const pluginName = "withInput"; | ||
export default pluginName; | ||
@@ -8,0 +8,0 @@ export declare class PothosWithInputPlugin<Types extends SchemaTypes> extends BasePlugin<Types> { |
import { FieldKind, FieldNullability, FieldOptionsFromKind, InputFieldMap, InputFieldRef, InputRef, InputShapeFromFields, SchemaTypes, TypeParam } from '@pothos/core'; | ||
export interface WithInputBuilderOptions<Types extends SchemaTypes> { | ||
argOptions?: Omit<PothosSchemaTypes.ArgFieldOptions<Types, InputRef<{}>, true>, 'type' | 'required'> & { | ||
argOptions?: Omit<PothosSchemaTypes.ArgFieldOptions<Types, InputRef<{}>, true>, 'required' | 'type'> & { | ||
required?: Types['WithInputArgRequired']; | ||
@@ -24,5 +24,5 @@ }; | ||
}; | ||
export type FieldWithInputOptions<Types extends SchemaTypes, ParentShape, Kind extends FieldKind, Args extends Record<string, InputFieldRef<unknown, 'Arg'>>, Fields extends Record<string, InputFieldRef<unknown, 'InputObject'>>, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, InputName extends string, ResolveShape, ResolveReturnShape, ArgRequired extends boolean> = Omit<FieldOptionsFromKind<Types, ParentShape, Type, Nullable, { | ||
export type FieldWithInputOptions<Types extends SchemaTypes, ParentShape, Kind extends FieldKind, Args extends Record<string, InputFieldRef<unknown, 'Arg'>>, Fields extends Record<string, InputFieldRef<unknown, 'InputObject'>>, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, InputName extends string, ResolveShape, ResolveReturnShape, ArgRequired extends boolean> = Omit<FieldOptionsFromKind<Types, ParentShape, Type, Nullable, Args & { | ||
[K in InputName]: InputFieldRef<InputShapeFromFields<Fields> | (true extends ArgRequired ? never : null | undefined)>; | ||
} & Args, Kind, ResolveShape, ResolveReturnShape>, 'args'> & { | ||
}, Kind, ResolveShape, ResolveReturnShape>, 'args'> & { | ||
typeOptions?: WithInputTypeOptions<Types, Fields>; | ||
@@ -29,0 +29,0 @@ argOptions?: WithInputArgOptions<Types, Fields, InputName, ArgRequired>; |
@@ -5,3 +5,3 @@ import './global-types.js'; | ||
export * from './types.js'; | ||
declare const pluginName: "withInput"; | ||
declare const pluginName = "withInput"; | ||
export default pluginName; | ||
@@ -8,0 +8,0 @@ export declare class PothosWithInputPlugin<Types extends SchemaTypes> extends BasePlugin<Types> { |
import { FieldKind, FieldNullability, FieldOptionsFromKind, InputFieldMap, InputFieldRef, InputRef, InputShapeFromFields, SchemaTypes, TypeParam } from '@pothos/core'; | ||
export interface WithInputBuilderOptions<Types extends SchemaTypes> { | ||
argOptions?: Omit<PothosSchemaTypes.ArgFieldOptions<Types, InputRef<{}>, true>, "type" | "required"> & { | ||
argOptions?: Omit<PothosSchemaTypes.ArgFieldOptions<Types, InputRef<{}>, true>, "required" | "type"> & { | ||
required?: Types["WithInputArgRequired"]; | ||
@@ -24,5 +24,5 @@ }; | ||
}; | ||
export type FieldWithInputOptions<Types extends SchemaTypes, ParentShape, Kind extends FieldKind, Args extends Record<string, InputFieldRef<unknown, "Arg">>, Fields extends Record<string, InputFieldRef<unknown, "InputObject">>, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, InputName extends string, ResolveShape, ResolveReturnShape, ArgRequired extends boolean> = Omit<FieldOptionsFromKind<Types, ParentShape, Type, Nullable, { | ||
export type FieldWithInputOptions<Types extends SchemaTypes, ParentShape, Kind extends FieldKind, Args extends Record<string, InputFieldRef<unknown, "Arg">>, Fields extends Record<string, InputFieldRef<unknown, "InputObject">>, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, InputName extends string, ResolveShape, ResolveReturnShape, ArgRequired extends boolean> = Omit<FieldOptionsFromKind<Types, ParentShape, Type, Nullable, Args & { | ||
[K in InputName]: InputFieldRef<InputShapeFromFields<Fields> | (true extends ArgRequired ? never : null | undefined)>; | ||
} & Args, Kind, ResolveShape, ResolveReturnShape>, "args"> & { | ||
}, Kind, ResolveShape, ResolveReturnShape>, "args"> & { | ||
typeOptions?: WithInputTypeOptions<Types, Fields>; | ||
@@ -29,0 +29,0 @@ argOptions?: WithInputArgOptions<Types, Fields, InputName, ArgRequired>; |
@@ -12,17 +12,23 @@ "use strict"; | ||
_export(exports, { | ||
default: ()=>_default, | ||
PothosWithInputPlugin: ()=>PothosWithInputPlugin | ||
PothosWithInputPlugin: function() { | ||
return PothosWithInputPlugin; | ||
}, | ||
default: function() { | ||
return _default; | ||
} | ||
}); | ||
require("./global-types"); | ||
require("./schema-builder"); | ||
const _core = /*#__PURE__*/ _interopRequireWildcard(require("@pothos/core")); | ||
_exportStar(require("./types"), exports); | ||
function _exportStar(from, to) { | ||
const _core = /*#__PURE__*/ _interop_require_wildcard(require("@pothos/core")); | ||
_export_star(require("./types"), exports); | ||
function _export_star(from, to) { | ||
Object.keys(from).forEach(function(k) { | ||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, { | ||
enumerable: true, | ||
get: function() { | ||
return from[k]; | ||
} | ||
}); | ||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) { | ||
Object.defineProperty(to, k, { | ||
enumerable: true, | ||
get: function() { | ||
return from[k]; | ||
} | ||
}); | ||
} | ||
}); | ||
@@ -39,3 +45,3 @@ return from; | ||
} | ||
function _interopRequireWildcard(obj, nodeInterop) { | ||
function _interop_require_wildcard(obj, nodeInterop) { | ||
if (!nodeInterop && obj && obj.__esModule) { | ||
@@ -53,3 +59,5 @@ return obj; | ||
} | ||
var newObj = {}; | ||
var newObj = { | ||
__proto__: null | ||
}; | ||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; | ||
@@ -56,0 +64,0 @@ for(var key in obj){ |
@@ -10,10 +10,10 @@ "use strict"; | ||
} | ||
function defaultGetName({ parentTypeName , fieldName }) { | ||
function defaultGetName({ parentTypeName, fieldName }) { | ||
return `${parentTypeName}${capitalize(fieldName)}Input`; | ||
} | ||
rootBuilderProto.fieldWithInput = function fieldWithInput({ typeOptions: { name: typeName , ...typeOptions } = {} , argOptions: { name: argName = 'input' , ...argOptions } = {} , args , input , ...fieldOptions }) { | ||
rootBuilderProto.fieldWithInput = function fieldWithInput({ typeOptions: { name: typeName, ...typeOptions } = {}, argOptions: { name: argName = 'input', ...argOptions } = {}, args, input, ...fieldOptions }) { | ||
var _this_builder_options_withInput, _this_builder_options_withInput1; | ||
const inputRef = this.builder.inputRef(typeName !== null && typeName !== void 0 ? typeName : `UnnamedWithInputOn${this.typename}`); | ||
var _this_builder_options_withInput_typeOptions; | ||
const { name: getTypeName = defaultGetName , ...defaultTypeOptions } = (_this_builder_options_withInput_typeOptions = (_this_builder_options_withInput = this.builder.options.withInput) === null || _this_builder_options_withInput === void 0 ? void 0 : _this_builder_options_withInput.typeOptions) !== null && _this_builder_options_withInput_typeOptions !== void 0 ? _this_builder_options_withInput_typeOptions : {}; | ||
const { name: getTypeName = defaultGetName, ...defaultTypeOptions } = (_this_builder_options_withInput_typeOptions = (_this_builder_options_withInput = this.builder.options.withInput) === null || _this_builder_options_withInput === void 0 ? void 0 : _this_builder_options_withInput.typeOptions) !== null && _this_builder_options_withInput_typeOptions !== void 0 ? _this_builder_options_withInput_typeOptions : {}; | ||
const fieldRef = this.field({ | ||
@@ -20,0 +20,0 @@ args: { |
{ | ||
"name": "@pothos/plugin-with-input", | ||
"version": "3.10.1", | ||
"version": "3.10.2", | ||
"description": "A Pothos plugin for defining fields with input objects", | ||
@@ -41,10 +41,10 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@prisma/client": "^4.11.0", | ||
"graphql": "16.6.0", | ||
"@prisma/client": "^5.13.0", | ||
"graphql": "^16.8.1", | ||
"graphql-tag": "^2.12.6", | ||
"prisma": "^4.11.0", | ||
"@pothos/core": "3.30.0", | ||
"@pothos/plugin-prisma": "3.47.3", | ||
"@pothos/plugin-validation": "3.9.1", | ||
"@pothos/test-utils": "1.4.8" | ||
"prisma": "^5.13.0", | ||
"@pothos/core": "3.41.2", | ||
"@pothos/plugin-prisma": "3.65.3", | ||
"@pothos/plugin-validation": "3.10.2", | ||
"@pothos/test-utils": "1.4.9" | ||
}, | ||
@@ -55,9 +55,9 @@ "scripts": { | ||
"build:clean": "git clean -dfX esm lib", | ||
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs", | ||
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 && pnpm esm:extensions", | ||
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs --strip-leading-paths", | ||
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 --strip-leading-paths && pnpm esm:extensions", | ||
"build:dts": "tsc", | ||
"esm:extensions": "TS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../scripts/esm-transformer.ts", | ||
"generate": "prisma generate", | ||
"test": "pnpm jest" | ||
"test": "pnpm vitest --run --segfault-retry=3" | ||
} | ||
} |
@@ -114,3 +114,3 @@ # With-Input Plugin | ||
type: 'Boolean', | ||
nulllable: true, | ||
nullable: true, | ||
argOptions: { | ||
@@ -117,0 +117,0 @@ required: false, |
@@ -7,3 +7,3 @@ import './global-types'; | ||
const pluginName = 'withInput' as const; | ||
const pluginName = 'withInput'; | ||
@@ -10,0 +10,0 @@ export default pluginName; |
@@ -16,3 +16,3 @@ import { | ||
PothosSchemaTypes.ArgFieldOptions<Types, InputRef<{}>, true>, | ||
'type' | 'required' | ||
'required' | 'type' | ||
> & { | ||
@@ -73,7 +73,7 @@ required?: Types['WithInputArgRequired']; | ||
Nullable, | ||
{ | ||
Args & { | ||
[K in InputName]: InputFieldRef< | ||
InputShapeFromFields<Fields> | (true extends ArgRequired ? never : null | undefined) | ||
>; | ||
} & Args, | ||
}, | ||
Kind, | ||
@@ -80,0 +80,0 @@ ResolveShape, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
167595
612