Huge News!Announcing our $40M Series B led by Abstract Ventures.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.42.0 to 3.43.0

6

CHANGELOG.md
# Change Log
## 3.43.0
### Minor Changes
- 0c042150: Allow globalConnectionFields to be overwritten on specific connections
## 3.42.0

@@ -4,0 +10,0 @@

26

esm/schema-builder.js

@@ -210,11 +210,5 @@ import { defaultTypeResolver } from 'graphql';

schemaBuilderProto.globalConnectionField = function globalConnectionField(name, field) {
var _connectionRefs_get;
const onRef = (ref) => {
this.objectField(ref, name, field);
};
(_connectionRefs_get = connectionRefs.get(this)) === null || _connectionRefs_get === void 0 ? void 0 : _connectionRefs_get.forEach((ref) => void onRef(ref));
if (!globalConnectionFieldsMap.has(this)) {
globalConnectionFieldsMap.set(this, []);
}
globalConnectionFieldsMap.get(this).push(onRef);
this.globalConnectionFields((t) => ({
[name]: field(t)
}));
};

@@ -224,3 +218,15 @@ schemaBuilderProto.globalConnectionFields = function globalConnectionFields(fields) {

const onRef = (ref) => {
this.objectFields(ref, fields);
this.configStore.onPrepare(() => {
const config = this.configStore.getTypeConfig(ref);
this.objectFields(ref, (t) => {
const existingFields = this.configStore.getFields(config.name);
const refs = {};
for (const [name, field] of Object.entries(fields(t))) {
if (!existingFields.has(name)) {
refs[name] = field;
}
}
return refs;
});
});
};

@@ -227,0 +233,0 @@ (_connectionRefs_get = connectionRefs.get(this)) === null || _connectionRefs_get === void 0 ? void 0 : _connectionRefs_get.forEach((ref) => void onRef(ref));

@@ -261,11 +261,5 @@ "use strict";

schemaBuilderProto.globalConnectionField = function globalConnectionField(name, field) {
var _connectionRefs_get;
const onRef = (ref)=>{
this.objectField(ref, name, field);
};
(_connectionRefs_get = connectionRefs.get(this)) === null || _connectionRefs_get === void 0 ? void 0 : _connectionRefs_get.forEach((ref)=>void onRef(ref));
if (!globalConnectionFieldsMap.has(this)) {
globalConnectionFieldsMap.set(this, []);
}
globalConnectionFieldsMap.get(this).push(onRef);
this.globalConnectionFields((t)=>({
[name]: field(t)
}));
};

@@ -275,3 +269,15 @@ schemaBuilderProto.globalConnectionFields = function globalConnectionFields(fields) {

const onRef = (ref)=>{
this.objectFields(ref, fields);
this.configStore.onPrepare(()=>{
const config = this.configStore.getTypeConfig(ref);
this.objectFields(ref, (t)=>{
const existingFields = this.configStore.getFields(config.name);
const refs = {};
for (const [name, field] of Object.entries(fields(t))){
if (!existingFields.has(name)) {
refs[name] = field;
}
}
return refs;
});
});
};

@@ -278,0 +284,0 @@ (_connectionRefs_get = connectionRefs.get(this)) === null || _connectionRefs_get === void 0 ? void 0 : _connectionRefs_get.forEach((ref)=>void onRef(ref));

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

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -5,2 +5,3 @@ import { defaultTypeResolver, GraphQLResolveInfo } from 'graphql';

createContextCache,
FieldMap,
FieldRef,

@@ -13,3 +14,2 @@ getTypeBrand,

ObjectFieldsShape,
ObjectFieldThunk,
ObjectParam,

@@ -324,25 +324,23 @@ ObjectRef,

schemaBuilderProto.globalConnectionField = function globalConnectionField(name, field) {
this.globalConnectionFields((t) => ({ [name]: field(t) }));
};
schemaBuilderProto.globalConnectionFields = function globalConnectionFields(fields) {
const onRef = (ref: ObjectRef<ConnectionShape<SchemaTypes, unknown, boolean>>) => {
this.objectField(
ref,
name,
field as ObjectFieldThunk<SchemaTypes, ConnectionShape<SchemaTypes, unknown, boolean>>,
);
};
this.configStore.onPrepare(() => {
const config = this.configStore.getTypeConfig(ref);
connectionRefs.get(this)?.forEach((ref) => void onRef(ref));
this.objectFields(ref, (t) => {
const existingFields = this.configStore.getFields(config.name);
const refs: FieldMap = {};
if (!globalConnectionFieldsMap.has(this)) {
globalConnectionFieldsMap.set(this, []);
}
for (const [name, field] of Object.entries(fields(t as never))) {
if (!existingFields.has(name)) {
refs[name] = field;
}
}
globalConnectionFieldsMap.get(this)!.push(onRef);
};
schemaBuilderProto.globalConnectionFields = function globalConnectionFields(fields) {
const onRef = (ref: ObjectRef<ConnectionShape<SchemaTypes, unknown, boolean>>) => {
this.objectFields(
ref,
fields as ObjectFieldsShape<SchemaTypes, ConnectionShape<SchemaTypes, unknown, boolean>>,
);
return refs;
});
});
};

@@ -349,0 +347,0 @@

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