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.38.0 to 3.39.0

6

CHANGELOG.md
# Change Log
## 3.39.0
### Minor Changes
- 1878d5d9: Allow readonly arrays in more places
## 3.38.0

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

2

dts/schema-builder.d.ts
import { ObjectRef, SchemaTypes } from '@pothos/core';
import { ConnectionShape } from './types';
export declare const connectionRefs: WeakMap<PothosSchemaTypes.SchemaBuilder<SchemaTypes>, ObjectRef<ConnectionShape<SchemaTypes, unknown, boolean, import("@pothos/core").FieldNullability<[unknown]>, boolean, import("./types").ConnectionResultShape<SchemaTypes, unknown, import("@pothos/core").FieldNullability<[unknown]>, boolean>>, ConnectionShape<SchemaTypes, unknown, boolean, import("@pothos/core").FieldNullability<[unknown]>, boolean, import("./types").ConnectionResultShape<SchemaTypes, unknown, import("@pothos/core").FieldNullability<[unknown]>, boolean>>>[]>;
export declare const connectionRefs: WeakMap<PothosSchemaTypes.SchemaBuilder<SchemaTypes>, ObjectRef<ConnectionShape<SchemaTypes, unknown, boolean>>[]>;
export declare const globalConnectionFieldsMap: WeakMap<PothosSchemaTypes.SchemaBuilder<SchemaTypes>, ((ref: ObjectRef<ConnectionShape<SchemaTypes, unknown, boolean>>) => void)[]>;
//# sourceMappingURL=schema-builder.d.ts.map

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

typename: string;
}[]) => Promise<unknown[]>) => MaybePromise<MaybePromise<unknown>[]>;
}[]) => Promise<unknown[]>) => MaybePromise<readonly MaybePromise<unknown>[]>;
});

@@ -120,5 +120,5 @@ mutationInputArgOptions: Omit<PothosSchemaTypes.ArgFieldOptions<Types, InputRef<{}>, boolean>, 'fields' | 'type'>;

loadOne?: (id: IDShape, context: Types['Context']) => MaybePromise<OutputShape<Types, Param> | null | undefined>;
loadMany?: (ids: IDShape[], context: Types['Context']) => MaybePromise<MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
loadMany?: (ids: IDShape[], context: Types['Context']) => MaybePromise<readonly MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
loadWithoutCache?: (id: IDShape, context: Types['Context'], info: GraphQLResolveInfo) => MaybePromise<OutputShape<Types, Param> | null | undefined>;
loadManyWithoutCache?: (ids: IDShape[], context: Types['Context']) => MaybePromise<MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
loadManyWithoutCache?: (ids: IDShape[], context: Types['Context']) => MaybePromise<readonly MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
};

@@ -125,0 +125,0 @@ export type GlobalIDFieldOptions<Types extends SchemaTypes, ParentShape, Args extends InputFieldMap, Nullable extends boolean, ResolveReturnShape, Kind extends FieldKind = FieldKind> = Omit<FieldOptionsFromKind<Types, ParentShape, 'ID', Nullable, Args, Kind, ParentShape, ResolveReturnShape>, 'resolve' | 'type'> & {

@@ -28,6 +28,13 @@ import { MaybePromise, SchemaTypes } from '@pothos/core';

}
export declare function resolveOffsetConnection<T, U extends Promise<T[] | null> | T[] | null>(options: ResolveOffsetConnectionOptions, resolve: (params: {
export declare function offsetForArgs(options: ResolveOffsetConnectionOptions): {
offset: number;
limit: number;
}) => U & (MaybePromise<T[] | null> | null)): Promise<RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NonNullable<T>, U extends NonNullable<U> ? (Promise<null> extends U ? true : false) : true, T extends NonNullable<T> ? false : {
hasPreviousPage: boolean;
expectedSize: number;
hasNextPage: (resultSize: number) => boolean;
};
export declare function resolveOffsetConnection<T, U extends Promise<readonly T[] | null> | readonly T[] | null>(options: ResolveOffsetConnectionOptions, resolve: (params: {
offset: number;
limit: number;
}) => U & (MaybePromise<readonly T[] | null> | null)): Promise<RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NonNullable<T>, U extends NonNullable<U> ? (Promise<null> extends U ? true : false) : true, T extends NonNullable<T> ? false : {
list: false;

@@ -38,3 +45,3 @@ items: true;

export declare function offsetToCursor(offset: number): string;
export declare function resolveArrayConnection<T>(options: ResolveArrayConnectionOptions, array: T[]): RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NonNullable<T>, false, T extends NonNullable<T> ? false : {
export declare function resolveArrayConnection<T>(options: ResolveArrayConnectionOptions, array: readonly T[]): RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NonNullable<T>, false, T extends NonNullable<T> ? false : {
list: false;

@@ -44,4 +51,4 @@ items: true;

type NodeType<T> = T extends Promise<(infer N)[] | null> | (infer N)[] | null ? N : never;
export declare function resolveCursorConnection<U extends Promise<unknown[] | null> | unknown[] | null>(options: ResolveCursorConnectionOptions<NodeType<U>>, resolve: (params: ResolveCursorConnectionArgs) => U): Promise<RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NodeType<U>, false, false, false>>>;
export declare function resolveCursorConnection<U extends Promise<readonly unknown[] | null> | readonly unknown[] | null>(options: ResolveCursorConnectionOptions<NodeType<U>>, resolve: (params: ResolveCursorConnectionArgs) => U): Promise<RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NodeType<U>, false, false, false>>>;
export {};
//# sourceMappingURL=connections.d.ts.map

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

} | null | undefined)[]): Promise<MaybePromise<unknown>[]>;
export declare function resolveUncachedNodesForType<Types extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<Types>, context: object, info: GraphQLResolveInfo, ids: unknown[], type: OutputType<Types> | string): Promise<unknown[]>;
export declare function resolveUncachedNodesForType<Types extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<Types>, context: object, info: GraphQLResolveInfo, ids: readonly unknown[], type: OutputType<Types> | string): Promise<unknown[]>;
//# sourceMappingURL=resolve-nodes.d.ts.map

@@ -0,6 +1,23 @@

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
}
else {
obj[key] = value;
}
return obj;
}
import { ObjectRef } from '@pothos/core';
export const relayIDShapeKey = Symbol.for("Pothos.relayIDShapeKey");
let _relayIDShapeKey = relayIDShapeKey;
export class NodeRef extends ObjectRef {
constructor(name, options) {
super(name);
_defineProperty(this, _relayIDShapeKey, void 0);
_defineProperty(this, "parseId", void 0);
this.parseId = options.parseId;

@@ -7,0 +24,0 @@ }

import { ObjectRef, SchemaTypes } from '@pothos/core';
import { ConnectionShape } from './types.js';
export declare const connectionRefs: WeakMap<PothosSchemaTypes.SchemaBuilder<SchemaTypes>, ObjectRef<ConnectionShape<SchemaTypes, unknown, boolean, import("@pothos/core").FieldNullability<[
unknown
]>, boolean, import("./types.js").ConnectionResultShape<SchemaTypes, unknown, import("@pothos/core").FieldNullability<[
unknown
]>, boolean>>, ConnectionShape<SchemaTypes, unknown, boolean, import("@pothos/core").FieldNullability<[
unknown
]>, boolean, import("./types.js").ConnectionResultShape<SchemaTypes, unknown, import("@pothos/core").FieldNullability<[
unknown
]>, boolean>>>[]>;
export declare const connectionRefs: WeakMap<PothosSchemaTypes.SchemaBuilder<SchemaTypes>, ObjectRef<ConnectionShape<SchemaTypes, unknown, boolean>>[]>;
export declare const globalConnectionFieldsMap: WeakMap<PothosSchemaTypes.SchemaBuilder<SchemaTypes>, ((ref: ObjectRef<ConnectionShape<SchemaTypes, unknown, boolean>>) => void)[]>;
//# sourceMappingURL=schema-builder.d.ts.map

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

typename: string;
}[]) => Promise<unknown[]>) => MaybePromise<MaybePromise<unknown>[]>;
}[]) => Promise<unknown[]>) => MaybePromise<readonly MaybePromise<unknown>[]>;
});

@@ -132,5 +132,5 @@ mutationInputArgOptions: Omit<PothosSchemaTypes.ArgFieldOptions<Types, InputRef<{}>, boolean>, "fields" | "type">;

loadOne?: (id: IDShape, context: Types["Context"]) => MaybePromise<OutputShape<Types, Param> | null | undefined>;
loadMany?: (ids: IDShape[], context: Types["Context"]) => MaybePromise<MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
loadMany?: (ids: IDShape[], context: Types["Context"]) => MaybePromise<readonly MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
loadWithoutCache?: (id: IDShape, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<OutputShape<Types, Param> | null | undefined>;
loadManyWithoutCache?: (ids: IDShape[], context: Types["Context"]) => MaybePromise<MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
loadManyWithoutCache?: (ids: IDShape[], context: Types["Context"]) => MaybePromise<readonly MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
};

@@ -137,0 +137,0 @@ export type GlobalIDFieldOptions<Types extends SchemaTypes, ParentShape, Args extends InputFieldMap, Nullable extends boolean, ResolveReturnShape, Kind extends FieldKind = FieldKind> = Omit<FieldOptionsFromKind<Types, ParentShape, "ID", Nullable, Args, Kind, ParentShape, ResolveReturnShape>, "resolve" | "type"> & {

@@ -28,6 +28,13 @@ import { MaybePromise, SchemaTypes } from '@pothos/core';

}
export declare function resolveOffsetConnection<T, U extends Promise<T[] | null> | T[] | null>(options: ResolveOffsetConnectionOptions, resolve: (params: {
export declare function offsetForArgs(options: ResolveOffsetConnectionOptions): {
offset: number;
limit: number;
}) => U & (MaybePromise<T[] | null> | null)): Promise<RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NonNullable<T>, U extends NonNullable<U> ? (Promise<null> extends U ? true : false) : true, T extends NonNullable<T> ? false : {
hasPreviousPage: boolean;
expectedSize: number;
hasNextPage: (resultSize: number) => boolean;
};
export declare function resolveOffsetConnection<T, U extends Promise<readonly T[] | null> | readonly T[] | null>(options: ResolveOffsetConnectionOptions, resolve: (params: {
offset: number;
limit: number;
}) => U & (MaybePromise<readonly T[] | null> | null)): Promise<RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NonNullable<T>, U extends NonNullable<U> ? (Promise<null> extends U ? true : false) : true, T extends NonNullable<T> ? false : {
list: false;

@@ -38,3 +45,3 @@ items: true;

export declare function offsetToCursor(offset: number): string;
export declare function resolveArrayConnection<T>(options: ResolveArrayConnectionOptions, array: T[]): RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NonNullable<T>, false, T extends NonNullable<T> ? false : {
export declare function resolveArrayConnection<T>(options: ResolveArrayConnectionOptions, array: readonly T[]): RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NonNullable<T>, false, T extends NonNullable<T> ? false : {
list: false;

@@ -44,4 +51,4 @@ items: true;

type NodeType<T> = T extends Promise<(infer N)[] | null> | (infer N)[] | null ? N : never;
export declare function resolveCursorConnection<U extends Promise<unknown[] | null> | unknown[] | null>(options: ResolveCursorConnectionOptions<NodeType<U>>, resolve: (params: ResolveCursorConnectionArgs) => U): Promise<RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NodeType<U>, false, false, false>>>;
export declare function resolveCursorConnection<U extends Promise<readonly unknown[] | null> | readonly unknown[] | null>(options: ResolveCursorConnectionOptions<NodeType<U>>, resolve: (params: ResolveCursorConnectionArgs) => U): Promise<RemoveMaybePromiseProps<ConnectionShape<SchemaTypes, NodeType<U>, false, false, false>>>;
export {};
//# sourceMappingURL=connections.d.ts.map

@@ -5,3 +5,3 @@ import { decodeBase64, encodeBase64, PothosValidationError } from '@pothos/core';

const DEFAULT_SIZE = 20;
function offsetForArgs(options) {
export function offsetForArgs(options) {
const { before, after, first, last } = options.args;

@@ -8,0 +8,0 @@ var _options_defaultSize;

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

} | null | undefined)[]): Promise<MaybePromise<unknown>[]>;
export declare function resolveUncachedNodesForType<Types extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<Types>, context: object, info: GraphQLResolveInfo, ids: unknown[], type: OutputType<Types> | string): Promise<unknown[]>;
export declare function resolveUncachedNodesForType<Types extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<Types>, context: object, info: GraphQLResolveInfo, ids: readonly unknown[], type: OutputType<Types> | string): Promise<unknown[]>;
//# sourceMappingURL=resolve-nodes.d.ts.map

@@ -16,6 +16,22 @@ "use strict";

const _core = require("@pothos/core");
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
const relayIDShapeKey = Symbol.for('Pothos.relayIDShapeKey');
let _relayIDShapeKey = relayIDShapeKey;
class NodeRef extends _core.ObjectRef {
constructor(name, options){
super(name);
_defineProperty(this, _relayIDShapeKey, void 0);
_defineProperty(this, "parseId", void 0);
this.parseId = options.parseId;

@@ -22,0 +38,0 @@ }

@@ -12,2 +12,3 @@ "use strict";

_export(exports, {
offsetForArgs: ()=>offsetForArgs,
resolveOffsetConnection: ()=>resolveOffsetConnection,

@@ -14,0 +15,0 @@ cursorToOffset: ()=>cursorToOffset,

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

@@ -43,8 +43,8 @@ "main": "./lib/index.js",

"devDependencies": {
"@pothos/core": "3.28.0",
"@pothos/plugin-complexity": "3.12.0",
"@pothos/test-utils": "1.4.7",
"graphql": "16.6.0",
"graphql-subscriptions": "^2.0.0",
"graphql-tag": "^2.12.6",
"@pothos/core": "3.28.0",
"@pothos/plugin-complexity": "3.12.0",
"@pothos/test-utils": "1.4.7"
"graphql-tag": "^2.12.6"
},

@@ -51,0 +51,0 @@ "gitHead": "9dfe52f1975f41a111e01bf96a20033a914e2acc",

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

resolveNodes: (ids: { id: string; typename: string }[]) => Promise<unknown[]>,
) => MaybePromise<MaybePromise<unknown>[]>;
) => MaybePromise<readonly MaybePromise<unknown>[]>;
});

@@ -439,3 +439,3 @@ mutationInputArgOptions: Omit<

context: Types['Context'],
) => MaybePromise<MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
) => MaybePromise<readonly MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
loadWithoutCache?: (

@@ -449,3 +449,3 @@ id: IDShape,

context: Types['Context'],
) => MaybePromise<MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
) => MaybePromise<readonly MaybePromise<OutputShape<Types, Param> | null | undefined>[]>;
};

@@ -452,0 +452,0 @@

@@ -46,3 +46,3 @@ import {

function offsetForArgs(options: ResolveOffsetConnectionOptions) {
export function offsetForArgs(options: ResolveOffsetConnectionOptions) {
const { before, after, first, last } = options.args;

@@ -93,5 +93,11 @@

export async function resolveOffsetConnection<T, U extends Promise<T[] | null> | T[] | null>(
export async function resolveOffsetConnection<
T,
U extends Promise<readonly T[] | null> | readonly T[] | null,
>(
options: ResolveOffsetConnectionOptions,
resolve: (params: { offset: number; limit: number }) => U & (MaybePromise<T[] | null> | null),
resolve: (params: {
offset: number;
limit: number;
}) => U & (MaybePromise<readonly T[] | null> | null),
): Promise<

@@ -154,3 +160,3 @@ RemoveMaybePromiseProps<

options: ResolveArrayConnectionOptions,
array: T[],
array: readonly T[],
): RemoveMaybePromiseProps<

@@ -222,3 +228,3 @@ ConnectionShape<

export async function resolveCursorConnection<
U extends Promise<unknown[] | null> | unknown[] | null,
U extends Promise<readonly unknown[] | null> | readonly unknown[] | null,
>(

@@ -225,0 +231,0 @@ options: ResolveCursorConnectionOptions<NodeType<U>>,

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

info: GraphQLResolveInfo,
ids: unknown[],
ids: readonly unknown[],
type: OutputType<Types> | string,

@@ -87,3 +87,3 @@ ): Promise<unknown[]> {

if (options.loadMany) {
const loadManyPromise = Promise.resolve(options.loadMany(ids, context));
const loadManyPromise = Promise.resolve(options.loadMany(ids as unknown[], context));

@@ -93,3 +93,3 @@ return Promise.all(

const entryPromise = loadManyPromise
.then((results: unknown[]) => results[i])
.then((results: readonly unknown[]) => results[i])
.then((result: unknown) => {

@@ -127,3 +127,3 @@ requestCache.set(`${config.name}:${id}`, result);

if (options.loadManyWithoutCache) {
return options.loadManyWithoutCache(ids, context);
return options.loadManyWithoutCache(ids as unknown[], context) as unknown[];
}

@@ -130,0 +130,0 @@

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

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