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

edgeql

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edgeql - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

67

dist/app.test.js

@@ -65,2 +65,38 @@ import { GraphQLObjectType, GraphQLString, GraphQLSchema } from 'graphql';

});
it('should work when schema registered with async resolve function', async () => {
const app = new EdgeQL();
const queryType = new GraphQLObjectType({
name: 'Query',
fields: {
hello: {
type: GraphQLString,
resolve: async () => {
return new Promise((res) => {
res('world');
});
},
},
},
});
app.register(new GraphQLSchema({ query: queryType }));
const req = new Request('http://localhost', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: 'query H { hello }',
variables: {},
operationName: 'H',
extensions: {},
}),
});
const res = await app.fetch(req);
expect(res.status).toBe(200);
expect(await res.json()).toEqual({
data: {
hello: 'world',
},
});
});
it('should work when schema string registered', async () => {

@@ -193,2 +229,33 @@ const app = new EdgeQL();

});
it('should be able to get the environment variable inside handler', async () => {
const app = new EdgeQL();
const schema = `
type Query {
hello: String
}
`;
app.register(schema, (parent, args, ctx) => {
return `${ctx.env.db} world`;
});
const req = new Request('http://localhost', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: 'query H { hello }',
variables: {},
operationName: 'H',
extensions: {},
}),
});
const db = 'hello-db';
const res = await app.fetch(req, { db });
expect(res.status).toBe(200);
expect(await res.json()).toEqual({
data: {
hello: `${db} world`,
},
});
});
});

7

dist/types.d.ts

@@ -17,7 +17,2 @@ import type { Context } from './context';

}
export type Bindings = Record<string, any>;
export type Variables = Record<string, any>;
export type Environment = {
Bindings: Bindings;
Variables: Variables;
};
export type Environment = Record<string, any>;
{
"name": "edgeql",
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "dist/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