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

@beamf/graphql-schema-typescript

Package Overview
Dependencies
Maintainers
6
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@beamf/graphql-schema-typescript - npm Package Compare versions

Comparing version 1.2.5 to 1.3.0

23

lib/models-generator.js

@@ -60,3 +60,13 @@ "use strict";

// 'export type Value<T> = T | Promise<T>',
''
'',
'/**',
' * Technically a property can be a function also. We DO NOT support this use case',
' * because it does not feel like a good coding pattern to put resolver-like functions',
' * on to of the object itself. If needed, property with getter can be used',
' * which takes the property of the source object of the same name as the field',
" * and returns it as the Value, or if it's a function, returns the Value",
' * of calling that function while passing along args, context and info.',
' * NOTE how the function signature does not have parent',
' */',
'export type GQLProperty<T, Args, Ctx> = T | Promise<T> | ((args: Args, context: Ctx, info: GraphQLResolveInfo) => T | Promise<T>)',
];

@@ -249,8 +259,11 @@ return [2 /*return*/, gqlTypes.reduce(function (prevTypescriptDefs, gqlType) {

var uppercaseFisrtFieldName = utils_1.toUppercaseFirst(field.name);
// If there is argument, require an explicit resolver for it
var typeName = utils_1.getModifiedTsTypeName(utils_1.getTypeRef(field), this.options.typePrefix);
var argsType = '{}';
if (field.args.length > 0) {
return;
// Generated in resolver-generator.ts. (TODO: Merge)
argsType = objectType.name + "_" + uppercaseFisrtFieldName + "_Args";
}
var typeName = utils_1.getModifiedTsTypeName(utils_1.getTypeRef(field), this.options.typePrefix);
return [field.name + "?: " + typeName];
// Generated in resolver-generator.ts
var contextType = this.options.resolver && this.options.resolver.contextType || 'Context';
return [field.name + "?: GQLProperty<" + typeName + ", " + argsType + ", " + contextType + ">"];
};

@@ -257,0 +270,0 @@ return ModelsGenerator;

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

'',
'/**',
' * Technically a property can be a function also. We DO NOT support this use case',
' * because it does not feel like a good coding pattern to put resolver-like functions',
' * on to of the object itself. If needed, property with getter can be used',
' * which takes the property of the source object of the same name as the field',
" * and returns it as the Value, or if it's a function, returns the Value",
' * of calling that function while passing along args, context and info.',
' * NOTE how the function signature does not have parent',
' */',
'export type GQLProperty<T, Args, Ctx> = T | Promise<T> // | ((args: Args, context: Ctx, info: GraphQLResolveInfo) => T | Promise<T>)',
'',
'export type GQLResolver<T, P, Args, Ctx> = (parent: P, args: Args, context: Ctx, info: GraphQLResolveInfo) => T | Promise<T>',
'/**',
' * When used as properties of the return value of an existing resolver, this really should be',
' * Value<T> instead -> So resolvers should not be returning other resolver-like objects',
' * In practice the implementation "sort of" allows it (see above)',
' * TODO: Finish correct type def for model separate from resolver',
' */',
'export type GQLPropertyOrResolver<T, P, Args, Ctx> = GQLProperty<T, Args, Ctx> | GQLResolver<T, P, Args, Ctx>',
'',

@@ -100,0 +82,0 @@ 'export type GQLTypeResolver<P, Ctx, T> = ',

{
"name": "@beamf/graphql-schema-typescript",
"version": "1.2.5",
"version": "1.3.0",
"description": "Generate TypeScript from GraphQL's schema type definitions",

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

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