@getvision/server 0.3.1-9c3a582-develop → 0.3.2-90d1d3a-develop
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/service.ts +18 -2
- package/src/vision-app.ts +0 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/service.ts
CHANGED
|
@@ -38,15 +38,31 @@ function getClientKey(c: Context, method: string, path: string): string {
|
|
|
38
38
|
*/
|
|
39
39
|
function createEventContext<E extends Env = any, I extends Input = {}>(): Context<E, any, I> {
|
|
40
40
|
const store: Record<string, any> = {}
|
|
41
|
+
const mockRequest = new Request('http://localhost/event-trigger')
|
|
42
|
+
const resHeaders = new Headers()
|
|
43
|
+
|
|
41
44
|
const fake: Partial<Context<E, any, I>> = {
|
|
42
45
|
get: (key: string) => store[key],
|
|
43
46
|
set: (key: string, value: any) => { store[key] = value },
|
|
47
|
+
header: (key: string, value: string | undefined) => {
|
|
48
|
+
if (value === undefined) {
|
|
49
|
+
resHeaders.delete(key)
|
|
50
|
+
} else {
|
|
51
|
+
resHeaders.set(key, value)
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
status: (code: number) => {},
|
|
44
55
|
req: {
|
|
45
|
-
header: () => undefined,
|
|
56
|
+
header: ((name?: string) => name ? undefined : {}) as any,
|
|
46
57
|
param: () => ({}),
|
|
47
58
|
query: () => ({}),
|
|
48
59
|
json: async () => ({}),
|
|
49
|
-
raw:
|
|
60
|
+
raw: mockRequest,
|
|
61
|
+
url: 'http://localhost/event-trigger',
|
|
62
|
+
method: 'POST',
|
|
63
|
+
} as any,
|
|
64
|
+
res: {
|
|
65
|
+
headers: resHeaders,
|
|
50
66
|
} as any,
|
|
51
67
|
}
|
|
52
68
|
return fake as Context<E, any, I>
|
package/src/vision-app.ts
CHANGED
|
@@ -57,7 +57,6 @@ async function cleanupVisionInstance(instance: Vision<any, any, any>): Promise<v
|
|
|
57
57
|
|
|
58
58
|
try { stopDrizzleStudio({ log: false }) } catch {}
|
|
59
59
|
try { await (instance as any).eventBus?.close() } catch {}
|
|
60
|
-
try { eventRegistry.clear() } catch {}
|
|
61
60
|
})()
|
|
62
61
|
|
|
63
62
|
return (instance as any)._cleanupPromise
|