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

@homebound/graphql-typescript-simple-resolvers

Package Overview
Dependencies
Maintainers
9
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@homebound/graphql-typescript-simple-resolvers - npm Package Compare versions

Comparing version 1.13.0 to 1.15.0

README.markdown

10

build/index.js

@@ -11,11 +11,3 @@ "use strict";

/**
* Generates Resolver type definitions.
*
* In theory the output is generally the same as the `typescript-resolvers` plugin, except ours
* is:
*
* a) generally much simpler (i.e. it is a dedicted-to-resolvers plugin and so doesn't have to
* monkey-patch the out-of-the-box `tyepscript` plugin types with `Omit`s for every mpped type , and
*
* b) has better support for avoidOptionals, we only require resolvers for non-mapped types.
* Generates Resolver/server-side type definitions for an Apollo-based GraphQL implementation.
*/

@@ -22,0 +14,0 @@ exports.plugin = async (schema, documents, config) => {

@@ -16,3 +16,10 @@ "use strict";

if (type instanceof graphql_1.GraphQLList) {
return ts_poet_1.code `${mapType(config, type.ofType)}[]`;
const elementType = mapType(config, type.ofType);
// Union types will be an array and need `Array<...>`.
if (elementType instanceof Array) {
return ts_poet_1.code `Array<${elementType}>`;
}
else {
return ts_poet_1.code `${elementType}[]`;
}
}

@@ -31,2 +38,5 @@ else if (type instanceof graphql_1.GraphQLObjectType) {

}
else if (type instanceof graphql_1.GraphQLUnionType) {
return joinCodes(type.getTypes().map(t => mapObjectType(config, t)), " | ");
}
else {

@@ -110,1 +120,12 @@ throw new Error(`Unsupported type ${type}`);

exports.isMappedType = isMappedType;
/** A `.join(...)` that doesn't `toString()` elements so that they can stay codes. */
function joinCodes(elements, delimiter) {
const result = [];
for (let i = 0; i < elements.length; i++) {
result.push(elements[i]);
if (i !== elements.length - 1) {
result.push(delimiter);
}
}
return result;
}

@@ -9,2 +9,3 @@ import { Context, AuthorId, Popularity } from "./entities";

AuthorSummary?: AuthorSummaryResolvers;
Book?: BookResolvers;
SaveAuthorResult?: SaveAuthorResultResolvers;

@@ -17,2 +18,3 @@ Date: GraphQLScalarType;

authorSummaries: Resolver<{}, {}, AuthorSummary[]>;
search: Resolver<{}, QuerySearchArgs, Array<AuthorId | Book>>;
}

@@ -37,2 +39,6 @@

export interface BookResolvers {
name: Resolver<Book, {}, string>;
}
export interface SaveAuthorResultResolvers {

@@ -47,2 +53,5 @@ author: Resolver<SaveAuthorResult, {}, AuthorId>;

}
export interface QuerySearchArgs {
query: string;
}
export interface MutationSaveAuthorArgs {

@@ -56,2 +65,6 @@ input: AuthorInput;

export interface Book {
name: string;
}
export interface SaveAuthorResult {

@@ -58,0 +71,0 @@ author: AuthorId;

{
"name": "@homebound/graphql-typescript-simple-resolvers",
"version": "1.13.0",
"version": "1.15.0",
"main": "./build/index.js",

@@ -5,0 +5,0 @@ "types": "./build/",

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