Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pothos/core

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pothos/core - npm Package Compare versions

Comparing version 3.27.1 to 3.28.0

8

CHANGELOG.md
# Change Log
## 3.28.0
### Minor Changes
- e8d75349: - allow connection fields (edges / pageInfo) to be promises
- add completeValue helper to core for unwrapping MaybePromise values
- set nodes as null if edges is null and the field permits a null return
## 3.27.1

@@ -4,0 +12,0 @@

7

dts/utils/index.d.ts

@@ -10,3 +10,3 @@ import { InputType, InputTypeParam, OutputType, SchemaTypes, TypeParam } from '../types';

export declare function assertArray(value: unknown): value is unknown[];
export declare function isThenable(value: unknown): value is Promise<unknown>;
export declare function isThenable(value: unknown): value is PromiseLike<unknown>;
export declare function verifyRef(ref: unknown): void;

@@ -19,2 +19,7 @@ export declare function verifyInterfaces(interfaces: unknown): void;

export declare function unwrapInputListParam<Types extends SchemaTypes>(param: InputTypeParam<Types>): InputType<Types>;
/**
* Helper for allowing plugins to fulfill the return of the `next` resolver, without paying the cost of the
* Promise if not required.
*/
export declare function completeValue<T, R>(valOrPromise: PromiseLike<T> | T, onSuccess: (completedVal: T) => R, onError?: (errVal: unknown) => R): R | Promise<R>;
//# sourceMappingURL=index.d.ts.map

@@ -10,3 +10,3 @@ import { InputType, InputTypeParam, OutputType, SchemaTypes, TypeParam } from '../types/index.js';

export declare function assertArray(value: unknown): value is unknown[];
export declare function isThenable(value: unknown): value is Promise<unknown>;
export declare function isThenable(value: unknown): value is PromiseLike<unknown>;
export declare function verifyRef(ref: unknown): void;

@@ -19,2 +19,7 @@ export declare function verifyInterfaces(interfaces: unknown): void;

export declare function unwrapInputListParam<Types extends SchemaTypes>(param: InputTypeParam<Types>): InputType<Types>;
/**
* Helper for allowing plugins to fulfill the return of the `next` resolver, without paying the cost of the
* Promise if not required.
*/
export declare function completeValue<T, R>(valOrPromise: PromiseLike<T> | T, onSuccess: (completedVal: T) => R, onError?: (errVal: unknown) => R): R | Promise<R>;
//# sourceMappingURL=index.d.ts.map

@@ -102,2 +102,18 @@ import { PothosSchemaError, PothosValidationError } from '../errors.js';

}
/**
* Helper for allowing plugins to fulfill the return of the `next` resolver, without paying the cost of the
* Promise if not required.
*/ export function completeValue(valOrPromise, onSuccess, onError) {
if (isThenable(valOrPromise)) {
return Promise.resolve(valOrPromise).then(onSuccess, onError);
}
// No need to handle onError, this should just be a try/catch inside the `onSuccess` block
const result = onSuccess(valOrPromise);
// If the result of the synchronous call is a promise like, convert to a promise
// for consistency
if (isThenable(result)) {
return Promise.resolve(result);
}
return result;
}
//# sourceMappingURL=index.js.map

@@ -21,3 +21,4 @@ "use strict";

unwrapOutputListParam: ()=>unwrapOutputListParam,
unwrapInputListParam: ()=>unwrapInputListParam
unwrapInputListParam: ()=>unwrapInputListParam,
completeValue: ()=>completeValue
});

@@ -141,3 +142,16 @@ const _errors = require("../errors");

}
function completeValue(valOrPromise, onSuccess, onError) {
if (isThenable(valOrPromise)) {
return Promise.resolve(valOrPromise).then(onSuccess, onError);
}
// No need to handle onError, this should just be a try/catch inside the `onSuccess` block
const result = onSuccess(valOrPromise);
// If the result of the synchronous call is a promise like, convert to a promise
// for consistency
if (isThenable(result)) {
return Promise.resolve(result);
}
return result;
}
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@pothos/core",
"version": "3.27.1",
"version": "3.28.0",
"description": "Pothos (formerly GiraphQL) is a plugin based schema builder for creating code-first GraphQL schemas in typescript",

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

@@ -32,3 +32,3 @@ import { PothosSchemaError, PothosValidationError } from '../errors';

export function isThenable(value: unknown): value is Promise<unknown> {
export function isThenable(value: unknown): value is PromiseLike<unknown> {
return !!(

@@ -142,1 +142,24 @@ value &&

}
/**
* Helper for allowing plugins to fulfill the return of the `next` resolver, without paying the cost of the
* Promise if not required.
*/
export function completeValue<T, R>(
valOrPromise: PromiseLike<T> | T,
onSuccess: (completedVal: T) => R,
onError?: (errVal: unknown) => R,
): R | Promise<R> {
if (isThenable(valOrPromise)) {
return Promise.resolve(valOrPromise).then(onSuccess, onError);
}
// No need to handle onError, this should just be a try/catch inside the `onSuccess` block
const result = onSuccess(valOrPromise);
// If the result of the synchronous call is a promise like, convert to a promise
// for consistency
if (isThenable(result)) {
return Promise.resolve(result);
}
return result;
}

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