@objectstack/plugin-hono-server 0.1.0 → 0.1.1
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 +11 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -0
- package/package.json +9 -5
- package/src/index.ts +5 -3
package/CHANGELOG.md
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RuntimePlugin, IKernel } from '@objectstack/types';
|
|
2
2
|
export interface HonoServerOptions {
|
|
3
3
|
port?: number;
|
|
4
4
|
staticRoot?: string;
|
|
@@ -16,6 +16,6 @@ export declare class HonoServerPlugin implements RuntimePlugin {
|
|
|
16
16
|
private options;
|
|
17
17
|
constructor(options?: HonoServerOptions);
|
|
18
18
|
onStart(ctx: {
|
|
19
|
-
engine:
|
|
19
|
+
engine: IKernel;
|
|
20
20
|
}): Promise<void>;
|
|
21
21
|
}
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ class HonoServerPlugin {
|
|
|
26
26
|
}
|
|
27
27
|
async onStart(ctx) {
|
|
28
28
|
const app = new hono_1.Hono();
|
|
29
|
+
// TODO: Protocol needs access to actual Kernel instance or we make Protocol an interface too
|
|
29
30
|
const protocol = new runtime_1.ObjectStackRuntimeProtocol(ctx.engine);
|
|
30
31
|
// 1. Middlewares
|
|
31
32
|
if (this.options.logger)
|
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/plugin-hono-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Standard Hono Server Adapter for ObjectStack Runtime",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"hono": "^4.0.0",
|
|
9
8
|
"@hono/node-server": "^1.2.0",
|
|
10
|
-
"
|
|
11
|
-
"@objectstack/
|
|
9
|
+
"hono": "^4.0.0",
|
|
10
|
+
"@objectstack/types": "0.1.1",
|
|
11
|
+
"@objectstack/spec": "0.1.2"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/node": "^20.0.0",
|
|
15
|
-
"typescript": "^5.0.0"
|
|
15
|
+
"typescript": "^5.0.0",
|
|
16
|
+
"@objectstack/runtime": "0.1.1"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@objectstack/runtime": "^0.1.1"
|
|
16
20
|
},
|
|
17
21
|
"scripts": {
|
|
18
22
|
"build": "tsc"
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { serveStatic } from '@hono/node-server/serve-static';
|
|
|
3
3
|
import { Hono } from 'hono';
|
|
4
4
|
import { cors } from 'hono/cors';
|
|
5
5
|
import { logger } from 'hono/logger';
|
|
6
|
-
import {
|
|
6
|
+
import { ObjectStackRuntimeProtocol } from '@objectstack/runtime';
|
|
7
|
+
import { RuntimePlugin, IKernel } from '@objectstack/types';
|
|
7
8
|
|
|
8
9
|
export interface HonoServerOptions {
|
|
9
10
|
port?: number;
|
|
@@ -32,9 +33,10 @@ export class HonoServerPlugin implements RuntimePlugin {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
async onStart(ctx: { engine:
|
|
36
|
+
async onStart(ctx: { engine: IKernel }) {
|
|
36
37
|
const app = new Hono();
|
|
37
|
-
|
|
38
|
+
// TODO: Protocol needs access to actual Kernel instance or we make Protocol an interface too
|
|
39
|
+
const protocol = new ObjectStackRuntimeProtocol(ctx.engine as any);
|
|
38
40
|
|
|
39
41
|
// 1. Middlewares
|
|
40
42
|
if (this.options.logger) app.use('*', logger());
|