New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@pothos/plugin-relay

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pothos/plugin-relay - npm Package Compare versions

Comparing version 3.14.0 to 3.15.0

12

CHANGELOG.md
# Change Log
## 3.15.0
### Minor Changes
- 7311904e: Add ability to accept an inputTypeRef for builder.mutationField
### Patch Changes
- 7311904e: Update dev deps
- 7311904e: Fix nodeType option, which was incorrectly acceptiong options for an object type rather
than an interface
## 3.14.0

@@ -4,0 +16,0 @@

2

dts/global-types.d.ts

@@ -30,3 +30,3 @@ import { FieldKind, FieldNullability, FieldOptionsFromKind, FieldRef, FieldRequiredness, InputFieldMap, InputFieldRef, InputFieldsFromShape, InputShapeFromFields, InputShapeFromTypeParam, inputShapeKey, InterfaceParam, NormalizeArgs, ObjectFieldsShape, ObjectFieldThunk, ObjectParam, OutputShape, OutputType, ParentShape, Resolver, SchemaTypes, ShapeFromTypeParam } from '@pothos/core';

globalConnectionField: (name: string, field: ObjectFieldThunk<Types, ConnectionShape<Types, {}, false>>) => void;
relayMutationField: <Fields extends InputFieldMap, Nullable extends boolean, ResolveShape, ResolveReturnShape, Interfaces extends InterfaceParam<Types>[], InputName extends string = 'input'>(name: string, inputOptions: RelayMutationInputOptions<Types, Fields, InputName>, fieldOptions: RelayMutationFieldOptions<Types, Fields, Nullable, InputName, ResolveShape, ResolveReturnShape>, payloadOptions: RelayMutationPayloadOptions<Types, ResolveShape, Interfaces>) => {
relayMutationField: <Fields extends InputFieldMap, Nullable extends boolean, ResolveShape, ResolveReturnShape, Interfaces extends InterfaceParam<Types>[], InputName extends string = 'input'>(name: string, inputOptions: InputObjectRef<unknown> | RelayMutationInputOptions<Types, Fields, InputName>, fieldOptions: RelayMutationFieldOptions<Types, Fields, Nullable, InputName, ResolveShape, ResolveReturnShape>, payloadOptions: RelayMutationPayloadOptions<Types, ResolveShape, Interfaces>) => {
inputType: InputObjectRef<InputShapeWithClientMutationId<Types, Fields>>;

@@ -33,0 +33,0 @@ payloadType: ObjectRef<ResolveShape>;

@@ -7,3 +7,3 @@ import { GraphQLResolveInfo } from 'graphql';

brandLoadedObjects?: boolean;
nodeTypeOptions: Omit<PothosSchemaTypes.ObjectTypeOptions<Types, unknown>, 'fields'>;
nodeTypeOptions: Omit<PothosSchemaTypes.InterfaceTypeOptions<Types, unknown>, 'fields'>;
pageInfoTypeOptions: Omit<PothosSchemaTypes.ObjectTypeOptions<Types, PageInfoShape>, 'fields'>;

@@ -10,0 +10,0 @@ nodeQueryOptions: Omit<PothosSchemaTypes.QueryFieldOptions<Types, OutputRefShape<GlobalIDShape<Types> | string>, boolean, {

@@ -1,2 +0,2 @@

import SchemaBuilder, { createContextCache, getTypeBrand, ObjectRef, verifyRef } from '@pothos/core';
import SchemaBuilder, { createContextCache, getTypeBrand, InputObjectRef, ObjectRef, verifyRef } from '@pothos/core';
import { capitalize, resolveNodes } from './utils/index.js';

@@ -177,17 +177,26 @@ const schemaBuilderProto = SchemaBuilder.prototype;

const mutationIdCache = createContextCache(() => new Map());
schemaBuilderProto.relayMutationField = function relayMutationField(fieldName, { name: inputName = `${capitalize(fieldName)}Input`, argName = "input", inputFields, ...inputOptions }, { resolve, ...fieldOptions }, { name: payloadName = `${capitalize(fieldName)}Payload`, outputFields, interfaces, ...paylaodOptions }) {
schemaBuilderProto.relayMutationField = function relayMutationField(fieldName, inputOptionsOrRef, { resolve, ...fieldOptions }, { name: payloadName = `${capitalize(fieldName)}Payload`, outputFields, interfaces, ...paylaodOptions }) {
const { relayOptions: { clientMutationIdInputOptions = {}, clientMutationIdFieldOptions = {}, mutationInputArgOptions = {}, }, } = this.options;
const includeClientMutationId = this.options.relayOptions.clientMutationId !== "omit";
const inputRef = this.inputType(inputName, {
...inputOptions,
fields: (t) => ({
...inputFields(t),
...includeClientMutationId ? {
clientMutationId: t.id({
...clientMutationIdInputOptions,
required: this.options.relayOptions.clientMutationId !== "optional"
})
} : {}
})
});
let inputRef;
let argName = "input";
if (inputOptionsOrRef instanceof InputObjectRef) {
inputRef = inputOptionsOrRef;
}
else {
const { name: inputName = `${capitalize(fieldName)}Input`, argName: argNameFromOptions = "input", inputFields, ...inputOptions } = inputOptionsOrRef;
argName = argNameFromOptions;
inputRef = this.inputType(inputName, {
...inputOptions,
fields: (t) => ({
...inputFields(t),
...includeClientMutationId ? {
clientMutationId: t.id({
...clientMutationIdInputOptions,
required: this.options.relayOptions.clientMutationId !== "optional"
})
} : {}
})
});
}
const payloadRef = this.objectRef(payloadName).implement({

@@ -194,0 +203,0 @@ ...paylaodOptions,

"use strict";
var _core = require("@pothos/core");
var _utils = require("./utils");
var _internal = require("./utils/internal");
Object.defineProperty(exports, "__esModule", {
value: true
});
const _core = require("@pothos/core");
const _utils = require("./utils");
const _internal = require("./utils/internal");
const fieldBuilderProto = _core.RootFieldBuilder.prototype;

@@ -12,5 +15,5 @@ fieldBuilderProto.globalIDList = function globalIDList({ resolve , ...options }) {

}
(0, _core).assertArray(result);
(0, _core.assertArray)(result);
if (Array.isArray(result)) {
return (await Promise.all(result)).map((item)=>item == null || typeof item === 'string' ? item : (0, _internal).internalEncodeGlobalID(this.builder, this.builder.configStore.getTypeConfig(item.type).name, String(item.id)));
return (await Promise.all(result)).map((item)=>item == null || typeof item === 'string' ? item : (0, _internal.internalEncodeGlobalID)(this.builder, this.builder.configStore.getTypeConfig(item.type).name, String(item.id)));
}

@@ -34,3 +37,3 @@ return null;

const item = result;
return (0, _internal).internalEncodeGlobalID(this.builder, this.builder.configStore.getTypeConfig(item.type).name, String(item.id));
return (0, _internal.internalEncodeGlobalID)(this.builder, this.builder.configStore.getTypeConfig(item.type).name, String(item.id));
};

@@ -53,4 +56,4 @@ return this.field({

}
const globalID = typeof rawID === 'string' ? rawID : (0, _internal).internalEncodeGlobalID(this.builder, this.builder.configStore.getTypeConfig(rawID.type).name, String(rawID.id));
return (await (0, _utils).resolveNodes(this.builder, context, info, [
const globalID = typeof rawID === 'string' ? rawID : (0, _internal.internalEncodeGlobalID)(this.builder, this.builder.configStore.getTypeConfig(rawID.type).name, String(rawID.id));
return (await (0, _utils.resolveNodes)(this.builder, context, info, [
globalID

@@ -73,3 +76,3 @@ ]))[0];

const rawIDList = await ids(parent, args, context, info);
(0, _core).assertArray(rawIDList);
(0, _core.assertArray)(rawIDList);
if (!Array.isArray(rawIDList)) {

@@ -79,4 +82,4 @@ return [];

const rawIds = await Promise.all(rawIDList);
const globalIds = rawIds.map((id)=>!id || typeof id === 'string' ? id : (0, _internal).internalEncodeGlobalID(this.builder, this.builder.configStore.getTypeConfig(id.type).name, String(id.id)));
return (0, _utils).resolveNodes(this.builder, context, info, globalIds);
const globalIds = rawIds.map((id)=>!id || typeof id === 'string' ? id : (0, _internal.internalEncodeGlobalID)(this.builder, this.builder.configStore.getTypeConfig(id.type).name, String(id.id)));
return (0, _utils.resolveNodes)(this.builder, context, info, globalIds);
}

@@ -99,3 +102,3 @@ });

var _name;
const connectionName = (_name = connectionOptionsOrRef.name) !== null && _name !== void 0 ? _name : `${this.typename}${(0, _utils).capitalize(fieldConfig.name)}${fieldConfig.name.toLowerCase().endsWith('connection') ? '' : 'Connection'}`;
const connectionName = (_name = connectionOptionsOrRef.name) !== null && _name !== void 0 ? _name : `${this.typename}${(0, _utils.capitalize)(fieldConfig.name)}${fieldConfig.name.toLowerCase().endsWith('connection') ? '' : 'Connection'}`;
this.builder.connectionObject({

@@ -102,0 +105,0 @@ type,

@@ -5,6 +5,12 @@ "use strict";

});
var _exportNames = {
PothosRelayPlugin: true
};
exports.default = void 0;
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
PothosRelayPlugin: ()=>PothosRelayPlugin,
default: ()=>_default
});
require("./global-types");

@@ -14,28 +20,17 @@ require("./field-builder");

require("./schema-builder");
var _core = _interopRequireWildcard(require("@pothos/core"));
var _internal = require("./utils/internal");
var _types = _interopRequireWildcard(require("./types"));
Object.keys(_types).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _types[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _types[key];
}
const _core = _interopRequireWildcard(require("@pothos/core"));
const _internal = require("./utils/internal");
_exportStar(require("./types"), exports);
_exportStar(require("./utils"), exports);
function _exportStar(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];
}
});
});
});
var _utils = _interopRequireWildcard(require("./utils"));
Object.keys(_utils).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _utils[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _utils[key];
}
});
});
return from;
}
function _getRequireWildcardCache() {

@@ -82,6 +77,5 @@ if (typeof WeakMap !== "function") return null;

var _default = pluginName;
exports.default = _default;
class PothosRelayPlugin extends _core.BasePlugin {
wrapResolve(resolver, fieldConfig) {
const argMappings = (0, _core).mapInputFields(fieldConfig.args, this.buildCache, (inputField)=>{
const argMappings = (0, _core.mapInputFields)(fieldConfig.args, this.buildCache, (inputField)=>{
var ref;

@@ -96,7 +90,7 @@ if ((ref = inputField.extensions) === null || ref === void 0 ? void 0 : ref.isRelayGlobalID) {

}
const argMapper = (0, _core).createInputValueMapper(argMappings, (globalID)=>(0, _internal).internalDecodeGlobalID(this.builder, String(globalID)));
const argMapper = (0, _core.createInputValueMapper)(argMappings, (globalID)=>(0, _internal.internalDecodeGlobalID)(this.builder, String(globalID)));
return (parent, args, context, info)=>resolver(parent, argMapper(args), context, info);
}
wrapSubscribe(subscribe, fieldConfig) {
const argMappings = (0, _core).mapInputFields(fieldConfig.args, this.buildCache, (inputField)=>{
const argMappings = (0, _core.mapInputFields)(fieldConfig.args, this.buildCache, (inputField)=>{
var ref;

@@ -111,9 +105,8 @@ if ((ref = inputField.extensions) === null || ref === void 0 ? void 0 : ref.isRelayGlobalID) {

}
const argMapper = (0, _core).createInputValueMapper(argMappings, (globalID)=>(0, _internal).internalDecodeGlobalID(this.builder, String(globalID)));
const argMapper = (0, _core.createInputValueMapper)(argMappings, (globalID)=>(0, _internal.internalDecodeGlobalID)(this.builder, String(globalID)));
return (parent, args, context, info)=>subscribe(parent, argMapper(args), context, info);
}
}
exports.PothosRelayPlugin = PothosRelayPlugin;
_core.default.registerPlugin(pluginName, PothosRelayPlugin);
//# sourceMappingURL=index.js.map
"use strict";
var _core = require("@pothos/core");
Object.defineProperty(exports, "__esModule", {
value: true
});
const _core = require("@pothos/core");
const inputFieldBuilder = _core.InputFieldBuilder.prototype;

@@ -4,0 +7,0 @@ inputFieldBuilder.globalIDList = function globalIDList(options = {}) {

@@ -5,5 +5,14 @@ "use strict";

});
exports.globalConnectionFieldsMap = exports.connectionRefs = void 0;
var _core = _interopRequireWildcard(require("@pothos/core"));
var _utils = require("./utils");
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
connectionRefs: ()=>connectionRefs,
globalConnectionFieldsMap: ()=>globalConnectionFieldsMap
});
const _core = _interopRequireWildcard(require("@pothos/core"));
const _utils = require("./utils");
function _getRequireWildcardCache() {

@@ -52,5 +61,3 @@ if (typeof WeakMap !== "function") return null;

const connectionRefs = new WeakMap();
exports.connectionRefs = connectionRefs;
const globalConnectionFieldsMap = new WeakMap();
exports.globalConnectionFieldsMap = globalConnectionFieldsMap;
schemaBuilderProto.pageInfoRef = function pageInfoRef() {

@@ -114,3 +121,3 @@ if (pageInfoRefMap.has(this)) {

},
resolve: async (root, args, context, info)=>(await (0, _utils).resolveNodes(this, context, info, [
resolve: async (root, args, context, info)=>(await (0, _utils.resolveNodes)(this, context, info, [
String(args.id)

@@ -133,3 +140,3 @@ ]))[0]

},
resolve: async (root, args, context, info)=>await (0, _utils).resolveNodes(this, context, info, args.ids)
resolve: async (root, args, context, info)=>await (0, _utils.resolveNodes)(this, context, info, args.ids)
}));

@@ -139,3 +146,3 @@ return ref;

schemaBuilderProto.node = function node(param, { interfaces , ...options }, fields) {
(0, _core).verifyRef(param);
(0, _core.verifyRef)(param);
const interfacesWithNode = [

@@ -155,3 +162,3 @@ this.nodeInterfaceRef(),

}
const typeBrand = (0, _core).getTypeBrand(maybeNode);
const typeBrand = (0, _core.getTypeBrand)(maybeNode);
if (typeBrand && this.configStore.getTypeConfig(typeBrand).name === nodeName) {

@@ -227,18 +234,26 @@ return true;

};
const mutationIdCache = (0, _core).createContextCache(()=>new Map());
schemaBuilderProto.relayMutationField = function relayMutationField(fieldName, { name: inputName = `${(0, _utils).capitalize(fieldName)}Input` , argName ='input' , inputFields , ...inputOptions }, { resolve , ...fieldOptions }, { name: payloadName = `${(0, _utils).capitalize(fieldName)}Payload` , outputFields , interfaces , ...paylaodOptions }) {
const mutationIdCache = (0, _core.createContextCache)(()=>new Map());
schemaBuilderProto.relayMutationField = function relayMutationField(fieldName, inputOptionsOrRef, { resolve , ...fieldOptions }, { name: payloadName = `${(0, _utils.capitalize)(fieldName)}Payload` , outputFields , interfaces , ...paylaodOptions }) {
const { relayOptions: { clientMutationIdInputOptions ={} , clientMutationIdFieldOptions ={} , mutationInputArgOptions ={} , } , } = this.options;
const includeClientMutationId = this.options.relayOptions.clientMutationId !== 'omit';
const inputRef = this.inputType(inputName, {
...inputOptions,
fields: (t)=>({
...inputFields(t),
...includeClientMutationId ? {
clientMutationId: t.id({
...clientMutationIdInputOptions,
required: this.options.relayOptions.clientMutationId !== 'optional'
})
} : {}
})
});
let inputRef;
let argName = 'input';
if (inputOptionsOrRef instanceof _core.InputObjectRef) {
inputRef = inputOptionsOrRef;
} else {
const { name: inputName = `${(0, _utils.capitalize)(fieldName)}Input` , argName: argNameFromOptions = 'input' , inputFields , ...inputOptions } = inputOptionsOrRef;
argName = argNameFromOptions;
inputRef = this.inputType(inputName, {
...inputOptions,
fields: (t)=>({
...inputFields(t),
...includeClientMutationId ? {
clientMutationId: t.id({
...clientMutationIdInputOptions,
required: this.options.relayOptions.clientMutationId !== 'optional'
})
} : {}
})
});
}
const payloadRef = this.objectRef(payloadName).implement({

@@ -281,3 +296,3 @@ ...paylaodOptions,

var ref;
(0, _core).verifyRef(type);
(0, _core.verifyRef)(type);
const { edgesFieldOptions: { nullable: edgesNullable = {

@@ -325,3 +340,3 @@ items: true,

schemaBuilderProto.edgeObject = function edgeObject({ type , name: edgeName , nodeNullable: nodeFieldNullable , ...edgeOptions }) {
(0, _core).verifyRef(type);
(0, _core.verifyRef)(type);
const { cursorType ='String' , cursorFieldOptions ={} , nodeFieldOptions: { nullable: nodeNullable = false , ...nodeFieldOptions } = {} , } = this.options.relayOptions;

@@ -328,0 +343,0 @@ const edgeRef = this.objectRef(edgeName);

@@ -5,7 +5,15 @@ "use strict";

});
exports.resolveOffsetConnection = resolveOffsetConnection;
exports.cursorToOffset = cursorToOffset;
exports.offsetToCursor = offsetToCursor;
exports.resolveArrayConnection = resolveArrayConnection;
exports.resolveCursorConnection = resolveCursorConnection;
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
cursorToOffset: ()=>cursorToOffset,
offsetToCursor: ()=>offsetToCursor,
resolveArrayConnection: ()=>resolveArrayConnection,
resolveCursorConnection: ()=>resolveCursorConnection,
resolveOffsetConnection: ()=>resolveOffsetConnection
});
const OFFSET_CURSOR_PREFIX = 'OffsetConnection:';

@@ -12,0 +20,0 @@ const DEFAULT_MAX_SIZE = 100;

@@ -5,73 +5,26 @@ "use strict";

});
var _exportNames = {
encodeGlobalID: true,
decodeGlobalID: true,
capitalize: true
};
exports.encodeGlobalID = encodeGlobalID;
exports.decodeGlobalID = decodeGlobalID;
exports.capitalize = capitalize;
var _connections = _interopRequireWildcard(require("./connections"));
Object.keys(_connections).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _connections[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _connections[key];
}
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
capitalize: ()=>capitalize,
decodeGlobalID: ()=>decodeGlobalID,
encodeGlobalID: ()=>encodeGlobalID
});
var _resolveNodes = _interopRequireWildcard(require("./resolve-nodes"));
Object.keys(_resolveNodes).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _resolveNodes[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _resolveNodes[key];
}
_exportStar(require("./connections"), exports);
_exportStar(require("./resolve-nodes"), exports);
function _exportStar(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];
}
});
});
});
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
return from;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function encodeGlobalID(typename, id) {

@@ -78,0 +31,0 @@ return Buffer.from(`${typename}:${id}`).toString('base64');

@@ -5,5 +5,13 @@ "use strict";

});
exports.internalEncodeGlobalID = internalEncodeGlobalID;
exports.internalDecodeGlobalID = internalDecodeGlobalID;
var _ = require(".");
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
internalDecodeGlobalID: ()=>internalDecodeGlobalID,
internalEncodeGlobalID: ()=>internalEncodeGlobalID
});
const _ = require(".");
function internalEncodeGlobalID(builder, typename, id) {

@@ -13,3 +21,3 @@ if (builder.options.relayOptions.encodeGlobalID) {

}
return (0, _).encodeGlobalID(typename, id);
return (0, _.encodeGlobalID)(typename, id);
}

@@ -20,5 +28,5 @@ function internalDecodeGlobalID(builder, globalID) {

}
return (0, _).decodeGlobalID(globalID);
return (0, _.decodeGlobalID)(globalID);
}
//# sourceMappingURL=internal.js.map

@@ -5,7 +5,15 @@ "use strict";

});
exports.resolveNodes = resolveNodes;
exports.resolveUncachedNodesForType = resolveUncachedNodesForType;
var _core = require("@pothos/core");
var _internal = require("./internal");
const getRequestCache = (0, _core).createContextCache(()=>new Map());
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
resolveNodes: ()=>resolveNodes,
resolveUncachedNodesForType: ()=>resolveUncachedNodesForType
});
const _core = require("@pothos/core");
const _internal = require("./internal");
const getRequestCache = (0, _core.createContextCache)(()=>new Map());
async function resolveNodes(builder, context, info, globalIDs) {

@@ -23,3 +31,3 @@ const requestCache = getRequestCache(context);

}
const { id , typename } = (0, _internal).internalDecodeGlobalID(builder, globalID);
const { id , typename } = (0, _internal.internalDecodeGlobalID)(builder, globalID);
idsByType[typename] = idsByType[typename] || new Map();

@@ -42,3 +50,3 @@ idsByType[typename].set(id, globalID);

if (shouldBrandObjects) {
(0, _core).brandWithType(val, typename);
(0, _core.brandWithType)(val, typename);
}

@@ -58,3 +66,3 @@ results[globalIds[i]] = val;

return Promise.all(ids.map((id, i)=>{
const globalID = (0, _internal).internalEncodeGlobalID(builder, config.name, id);
const globalID = (0, _internal.internalEncodeGlobalID)(builder, config.name, id);
const entryPromise = loadManyPromise.then((results)=>results[i]).then((result)=>{

@@ -70,3 +78,3 @@ requestCache.set(globalID, result);

return Promise.all(ids.map((id)=>{
const globalID = (0, _internal).internalEncodeGlobalID(builder, config.name, id);
const globalID = (0, _internal.internalEncodeGlobalID)(builder, config.name, id);
const entryPromise = Promise.resolve(options.loadOne(id, context)).then((result)=>{

@@ -73,0 +81,0 @@ requestCache.set(globalID, result);

{
"name": "@pothos/plugin-relay",
"version": "3.14.0",
"version": "3.15.0",
"description": "A Pothos plugin for adding relay style connections, nodes, and cursor based pagination to your GraphQL schema",

@@ -40,3 +40,3 @@ "main": "./lib/index.js",

"devDependencies": {
"@pothos/core": "3.12.0",
"@pothos/core": "3.12.1",
"@pothos/test-utils": "1.2.3",

@@ -43,0 +43,0 @@ "graphql": "16.5.0",

@@ -357,3 +357,3 @@ # Relay Plugin

- `name`: Name of the mutation field
- `inputOptions`: Options for the `input` object
- `inputOptions`: Options for the `input` object or a ref to an existing input object
- `fieldOptions`: Options for the mutation field

@@ -360,0 +360,0 @@ - `payloadOptions`: Options for the Payload object

@@ -102,3 +102,3 @@ import {

name: string,
inputOptions: RelayMutationInputOptions<Types, Fields, InputName>,
inputOptions: InputObjectRef<unknown> | RelayMutationInputOptions<Types, Fields, InputName>,
fieldOptions: RelayMutationFieldOptions<

@@ -105,0 +105,0 @@ Types,

@@ -8,2 +8,3 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */

getTypeBrand,
InputObjectRef,
InterfaceParam,

@@ -275,8 +276,3 @@ InterfaceRef,

fieldName,
{
name: inputName = `${capitalize(fieldName)}Input`,
argName = 'input',
inputFields,
...inputOptions
},
inputOptionsOrRef,
{ resolve, ...fieldOptions },

@@ -300,17 +296,32 @@ {

const inputRef = this.inputType(inputName, {
...inputOptions,
fields: (t) => ({
...inputFields(t),
...(includeClientMutationId
? {
clientMutationId: t.id({
...clientMutationIdInputOptions,
required: this.options.relayOptions.clientMutationId !== 'optional',
}),
}
: {}),
}),
});
let inputRef: InputObjectRef<unknown>;
let argName = 'input';
if (inputOptionsOrRef instanceof InputObjectRef) {
inputRef = inputOptionsOrRef;
} else {
const {
name: inputName = `${capitalize(fieldName)}Input`,
argName: argNameFromOptions = 'input',
inputFields,
...inputOptions
} = inputOptionsOrRef;
argName = argNameFromOptions;
inputRef = this.inputType(inputName, {
...inputOptions,
fields: (t) => ({
...inputFields(t),
...(includeClientMutationId
? {
clientMutationId: t.id({
...clientMutationIdInputOptions,
required: this.options.relayOptions.clientMutationId !== 'optional',
}),
}
: {}),
}),
});
}
const payloadRef = this.objectRef<unknown>(payloadName).implement({

@@ -317,0 +328,0 @@ ...paylaodOptions,

@@ -36,3 +36,3 @@ import { GraphQLResolveInfo } from 'graphql';

brandLoadedObjects?: boolean;
nodeTypeOptions: Omit<PothosSchemaTypes.ObjectTypeOptions<Types, unknown>, 'fields'>;
nodeTypeOptions: Omit<PothosSchemaTypes.InterfaceTypeOptions<Types, unknown>, 'fields'>;
pageInfoTypeOptions: Omit<PothosSchemaTypes.ObjectTypeOptions<Types, PageInfoShape>, 'fields'>;

@@ -39,0 +39,0 @@ nodeQueryOptions: Omit<

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc