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

grats

Package Overview
Dependencies
Maintainers
1
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grats - npm Package Compare versions

Comparing version 0.0.0-main-33a41869 to 0.0.0-main-3e9a18d4

dist/package.json

9

package.json
{
"name": "grats",
"version": "0.0.0-main-33a41869",
"main": "dist/index.js",
"bin": "dist/cli.js",
"types": "dist/index.d.ts",
"version": "0.0.0-main-3e9a18d4",
"main": "dist/src/index.js",
"bin": "dist/src/cli.js",
"types": "dist/src/index.d.ts",
"license": "MIT",

@@ -31,2 +31,3 @@ "files": [

},
"packageManager": "pnpm@8.1.1",
"scripts": {

@@ -33,0 +34,0 @@ "test": "ts-node --esm src/tests/test.ts",

@@ -22,4 +22,9 @@ # -=[ EXPERIMENTAL PRE ALPHA ]=-

## Example
## Examples
Grats is flexible enough to work with both class-based and functional
approaches to authoring GraphQL types and resolvers.
### Class-Based
```ts

@@ -29,4 +34,4 @@ /** @gqlType */

/** @gqlField */
me(): UserResolver {
return new UserResolver();
me(): User {
return new User();
}

@@ -37,4 +42,4 @@ /**

*/
viewer(): UserResolver {
return new UserResolver();
viewer(): User {
return new User();
}

@@ -45,5 +50,5 @@ }

* A user in our kick-ass system!
* @gqlType User
* @gqlType
*/
class UserResolver {
class User {
/** @gqlField */

@@ -59,4 +64,39 @@ name: string = 'Alice';

Extracts the following GraphQL schema:
### Functional
```ts
/** @gqlType */
export type Query {};
/** @gqlField */
export function me(_: Query): User {
return { name: "Alice" };
}
/**
* @gqlField
* @deprecated Please use `me` instead.
*/
export function viewer(_: Query): User {
return { name: "Alice" };
}
/**
* A user in our kick-ass system!
* @gqlType
*/
type User = {
/** @gqlField */
name: string;
}
/** @gqlField */
export function greeting(user: User, args: { salutation: string }): string {
return `${args.salutation}, ${user.name}`;
}
```
Both of the above examples extract the following GraphQL schema:
```graphql

@@ -84,3 +124,3 @@ type Query {

```sh
```bash
npm install express express-graphql grats

@@ -431,5 +471,5 @@ ```

enum MyEnum {
/** A description of my variant */
/** A description of my value */
OK = "OK",
/** A description of my other variant */
/** A description of my other value */
ERROR = "ERROR"

@@ -436,0 +476,0 @@ }

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