Comparing version 0.1.0 to 0.1.1
import type { GraphQLSchema } from 'graphql'; | ||
import { Context } from './context/context'; | ||
import type { ExecutionContext, Environment, Middleware, Handler } from './types'; | ||
@@ -9,3 +8,3 @@ export declare class EdgeQL { | ||
fetch: (request: Request, env?: Environment, exeContext?: ExecutionContext) => Promise<Response>; | ||
execute(ctx: Context): Promise<void>; | ||
private execute; | ||
use(fn: Middleware): void; | ||
@@ -12,0 +11,0 @@ handle(schema: GraphQLSchema): void; |
@@ -9,4 +9,7 @@ import type { ExecutionContext, Environment } from '../types'; | ||
readonly graphql: GraphQLContext; | ||
private _map; | ||
constructor(request: Request, env?: Environment, exeContext?: ExecutionContext); | ||
json(): Response; | ||
set(key: string, value: unknown): void; | ||
get(key: string): any; | ||
} |
@@ -13,2 +13,12 @@ import { GraphQLContext } from './graphql'; | ||
} | ||
set(key, value) { | ||
this._map ||= {}; | ||
this._map[key] = value; | ||
} | ||
get(key) { | ||
if (!this._map) { | ||
return undefined; | ||
} | ||
return this._map[key]; | ||
} | ||
} |
@@ -8,2 +8,8 @@ import { describe, expect, it } from 'vitest'; | ||
}); | ||
it('set and get', () => { | ||
const ctx = new Context(new Request('http://localhost'), { Bindings: {}, Variables: {} }, { waitUntil: () => { }, passThroughOnException: () => { } }); | ||
ctx.set('k', 'v'); | ||
expect(ctx).not.toBe(null); | ||
expect(ctx.get('k')).toBe('v'); | ||
}); | ||
}); |
{ | ||
"name": "edgeql", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -61,3 +61,3 @@ # EdgeQL | ||
For example if you wanted to track how long it takes for a request to propagate through Koa by adding an `X-Response-Time` header field the middleware would look like the following: | ||
For example if you wanted to track how long it takes for a request to propagate through EdgeQL by adding an `X-Response-Time` header field the middleware would look like the following: | ||
@@ -64,0 +64,0 @@ ```typescript |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57931
1634