@pothos/plugin-simple-objects
Version:
A Pothos plugin for defining objects and interfaces without ts definitions for those types
26 lines (25 loc) • 869 B
JavaScript
import './global-types.js';
import SchemaBuilder, { BasePlugin, InterfaceRef, ObjectRef } from '@pothos/core';
const pluginName = "simpleObjects";
export default pluginName;
export class PothosSimpleObjectsPlugin extends BasePlugin {
}
SchemaBuilder.registerPlugin(pluginName, PothosSimpleObjectsPlugin);
const proto = SchemaBuilder.prototype;
proto.simpleObject = function simpleObject(name, options, extraFields) {
const ref = new ObjectRef(name);
this.objectType(ref, options);
if (extraFields) {
this.objectFields(ref, extraFields);
}
return ref;
};
proto.simpleInterface = function simpleInterface(name, options, extraFields) {
const ref = new InterfaceRef(name);
this.interfaceType(ref, options);
if (extraFields) {
this.interfaceFields(ref, extraFields);
}
return ref;
};
//# sourceMappingURL=index.js.map