@objectstack/plugin-hono-server 1.0.2 → 1.0.4
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 +32 -0
- package/dist/adapter.d.ts +2 -0
- package/dist/adapter.js +7 -1
- package/dist/hono-plugin.js +9 -5
- package/package.json +6 -6
- package/src/adapter.ts +8 -1
- package/src/hono-plugin.ts +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @objectstack/plugin-hono-server
|
|
2
2
|
|
|
3
|
+
## 1.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5d13533: refactor: fix service registration compatibility and improve logging
|
|
8
|
+
- plugin-hono-server: register 'http.server' service alias to match core requirements
|
|
9
|
+
- plugin-hono-server: fix console log to show the actual bound port instead of configured port
|
|
10
|
+
- plugin-hono-server: reduce log verbosity (moved non-essential logs to debug level)
|
|
11
|
+
- objectql: automatically register 'metadata', 'data', 'and 'auth' services during initialization to satisfy kernel contracts
|
|
12
|
+
- cli: fix race condition in `serve` command by awaiting plugin registration calls (`kernel.use`)
|
|
13
|
+
- @objectstack/spec@1.0.4
|
|
14
|
+
- @objectstack/core@1.0.4
|
|
15
|
+
- @objectstack/types@1.0.4
|
|
16
|
+
- @objectstack/runtime@1.0.4
|
|
17
|
+
- @objectstack/hono@1.0.4
|
|
18
|
+
|
|
19
|
+
## 1.0.3
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 22a48f0: refactor: fix service registration compatibility and improve logging
|
|
24
|
+
- plugin-hono-server: register 'http.server' service alias to match core requirements
|
|
25
|
+
- plugin-hono-server: fix console log to show the actual bound port instead of configured port
|
|
26
|
+
- plugin-hono-server: reduce log verbosity (moved non-essential logs to debug level)
|
|
27
|
+
- objectql: automatically register 'metadata', 'data', 'and 'auth' services during initialization to satisfy kernel contracts
|
|
28
|
+
- Updated dependencies [fb2eabd]
|
|
29
|
+
- @objectstack/core@1.0.3
|
|
30
|
+
- @objectstack/runtime@1.0.3
|
|
31
|
+
- @objectstack/hono@1.0.3
|
|
32
|
+
- @objectstack/spec@1.0.3
|
|
33
|
+
- @objectstack/types@1.0.3
|
|
34
|
+
|
|
3
35
|
## 1.0.2
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/dist/adapter.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare class HonoHttpServer implements IHttpServer {
|
|
|
9
9
|
private staticRoot?;
|
|
10
10
|
private app;
|
|
11
11
|
private server;
|
|
12
|
+
private listeningPort;
|
|
12
13
|
constructor(port?: number, staticRoot?: string | undefined);
|
|
13
14
|
private wrap;
|
|
14
15
|
get(path: string, handler: RouteHandler): void;
|
|
@@ -22,6 +23,7 @@ export declare class HonoHttpServer implements IHttpServer {
|
|
|
22
23
|
*/
|
|
23
24
|
mount(path: string, subApp: Hono): void;
|
|
24
25
|
listen(port: number): Promise<void>;
|
|
26
|
+
getPort(): number;
|
|
25
27
|
getRawApp(): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
26
28
|
close(): Promise<void>;
|
|
27
29
|
}
|
package/dist/adapter.js
CHANGED
|
@@ -28,6 +28,7 @@ class HonoHttpServer {
|
|
|
28
28
|
staticRoot;
|
|
29
29
|
app;
|
|
30
30
|
server;
|
|
31
|
+
listeningPort;
|
|
31
32
|
constructor(port = 3000, staticRoot) {
|
|
32
33
|
this.port = port;
|
|
33
34
|
this.staticRoot = staticRoot;
|
|
@@ -118,14 +119,19 @@ class HonoHttpServer {
|
|
|
118
119
|
if (this.staticRoot) {
|
|
119
120
|
this.app.get('/*', (0, serve_static_1.serveStatic)({ root: this.staticRoot }));
|
|
120
121
|
}
|
|
122
|
+
const targetPort = port || this.port;
|
|
121
123
|
this.server = (0, node_server_1.serve)({
|
|
122
124
|
fetch: this.app.fetch,
|
|
123
|
-
port:
|
|
125
|
+
port: targetPort
|
|
124
126
|
}, (info) => {
|
|
127
|
+
this.listeningPort = info.port;
|
|
125
128
|
resolve();
|
|
126
129
|
});
|
|
127
130
|
});
|
|
128
131
|
}
|
|
132
|
+
getPort() {
|
|
133
|
+
return this.listeningPort || this.port;
|
|
134
|
+
}
|
|
129
135
|
// Expose raw app for scenarios where standard interface is not enough
|
|
130
136
|
getRawApp() {
|
|
131
137
|
return this.app;
|
package/dist/hono-plugin.js
CHANGED
|
@@ -36,8 +36,11 @@ class HonoServerPlugin {
|
|
|
36
36
|
staticRoot: this.options.staticRoot
|
|
37
37
|
});
|
|
38
38
|
// Register HTTP server service as IHttpServer
|
|
39
|
+
// Register as 'http.server' to match core requirements
|
|
40
|
+
ctx.registerService('http.server', this.server);
|
|
41
|
+
// Alias 'http-server' for backward compatibility
|
|
39
42
|
ctx.registerService('http-server', this.server);
|
|
40
|
-
ctx.logger.
|
|
43
|
+
ctx.logger.debug('HTTP server service registered', { serviceName: 'http.server' });
|
|
41
44
|
};
|
|
42
45
|
/**
|
|
43
46
|
* Start phase - Bind routes and start listening
|
|
@@ -56,7 +59,7 @@ class HonoServerPlugin {
|
|
|
56
59
|
kernel,
|
|
57
60
|
prefix: apiPath // Use the calculated path
|
|
58
61
|
});
|
|
59
|
-
ctx.logger.
|
|
62
|
+
ctx.logger.debug('Mounting ObjectStack Runtime App', { prefix: apiPath });
|
|
60
63
|
// Use the mount method we added to HonoHttpServer
|
|
61
64
|
this.server.mount('/', app);
|
|
62
65
|
}
|
|
@@ -66,11 +69,12 @@ class HonoServerPlugin {
|
|
|
66
69
|
// Start server on kernel:ready hook
|
|
67
70
|
ctx.hook('kernel:ready', async () => {
|
|
68
71
|
const port = this.options.port || 3000;
|
|
69
|
-
ctx.logger.
|
|
72
|
+
ctx.logger.debug('Starting HTTP server', { port });
|
|
70
73
|
await this.server.listen(port);
|
|
74
|
+
const actualPort = this.server.getPort();
|
|
71
75
|
ctx.logger.info('HTTP server started successfully', {
|
|
72
|
-
port,
|
|
73
|
-
url: `http://localhost:${
|
|
76
|
+
port: actualPort,
|
|
77
|
+
url: `http://localhost:${actualPort}`
|
|
74
78
|
});
|
|
75
79
|
});
|
|
76
80
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/plugin-hono-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Standard Hono Server Adapter for ObjectStack Runtime",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@hono/node-server": "^1.2.0",
|
|
10
10
|
"hono": "^4.0.0",
|
|
11
|
-
"@objectstack/core": "1.0.
|
|
12
|
-
"@objectstack/hono": "1.0.
|
|
13
|
-
"@objectstack/runtime": "1.0.
|
|
14
|
-
"@objectstack/spec": "1.0.
|
|
15
|
-
"@objectstack/types": "1.0.
|
|
11
|
+
"@objectstack/core": "1.0.4",
|
|
12
|
+
"@objectstack/hono": "1.0.4",
|
|
13
|
+
"@objectstack/runtime": "1.0.4",
|
|
14
|
+
"@objectstack/spec": "1.0.4",
|
|
15
|
+
"@objectstack/types": "1.0.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^25.1.0",
|
package/src/adapter.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { serveStatic } from '@hono/node-server/serve-static';
|
|
|
16
16
|
export class HonoHttpServer implements IHttpServer {
|
|
17
17
|
private app: Hono;
|
|
18
18
|
private server: any;
|
|
19
|
+
private listeningPort: number | undefined;
|
|
19
20
|
|
|
20
21
|
constructor(
|
|
21
22
|
private port: number = 3000,
|
|
@@ -115,15 +116,21 @@ export class HonoHttpServer implements IHttpServer {
|
|
|
115
116
|
this.app.get('/*', serveStatic({ root: this.staticRoot }));
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
const targetPort = port || this.port;
|
|
118
120
|
this.server = serve({
|
|
119
121
|
fetch: this.app.fetch,
|
|
120
|
-
port:
|
|
122
|
+
port: targetPort
|
|
121
123
|
}, (info) => {
|
|
124
|
+
this.listeningPort = info.port;
|
|
122
125
|
resolve();
|
|
123
126
|
});
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
129
|
|
|
130
|
+
getPort() {
|
|
131
|
+
return this.listeningPort || this.port;
|
|
132
|
+
}
|
|
133
|
+
|
|
127
134
|
// Expose raw app for scenarios where standard interface is not enough
|
|
128
135
|
getRawApp() {
|
|
129
136
|
return this.app;
|
package/src/hono-plugin.ts
CHANGED
|
@@ -66,8 +66,11 @@ export class HonoServerPlugin implements Plugin {
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
// Register HTTP server service as IHttpServer
|
|
69
|
+
// Register as 'http.server' to match core requirements
|
|
70
|
+
ctx.registerService('http.server', this.server);
|
|
71
|
+
// Alias 'http-server' for backward compatibility
|
|
69
72
|
ctx.registerService('http-server', this.server);
|
|
70
|
-
ctx.logger.
|
|
73
|
+
ctx.logger.debug('HTTP server service registered', { serviceName: 'http.server' });
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
/**
|
|
@@ -90,7 +93,7 @@ export class HonoServerPlugin implements Plugin {
|
|
|
90
93
|
prefix: apiPath // Use the calculated path
|
|
91
94
|
});
|
|
92
95
|
|
|
93
|
-
ctx.logger.
|
|
96
|
+
ctx.logger.debug('Mounting ObjectStack Runtime App', { prefix: apiPath });
|
|
94
97
|
// Use the mount method we added to HonoHttpServer
|
|
95
98
|
this.server.mount('/', app as any);
|
|
96
99
|
|
|
@@ -101,12 +104,14 @@ export class HonoServerPlugin implements Plugin {
|
|
|
101
104
|
// Start server on kernel:ready hook
|
|
102
105
|
ctx.hook('kernel:ready', async () => {
|
|
103
106
|
const port = this.options.port || 3000;
|
|
104
|
-
ctx.logger.
|
|
107
|
+
ctx.logger.debug('Starting HTTP server', { port });
|
|
105
108
|
|
|
106
109
|
await this.server.listen(port);
|
|
110
|
+
|
|
111
|
+
const actualPort = this.server.getPort();
|
|
107
112
|
ctx.logger.info('HTTP server started successfully', {
|
|
108
|
-
port,
|
|
109
|
-
url: `http://localhost:${
|
|
113
|
+
port: actualPort,
|
|
114
|
+
url: `http://localhost:${actualPort}`
|
|
110
115
|
});
|
|
111
116
|
});
|
|
112
117
|
}
|