@objectstack/plugin-hono-server 1.0.1 → 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 CHANGED
@@ -1,5 +1,59 @@
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
+
35
+ ## 1.0.2
36
+
37
+ ### Patch Changes
38
+
39
+ - a0a6c85: Infrastructure and development tooling improvements
40
+
41
+ - Add changeset configuration for automated version management
42
+ - Add comprehensive GitHub Actions workflows (CI, CodeQL, linting, releases)
43
+ - Add development configuration files (.cursorrules, .github/prompts)
44
+ - Add documentation files (ARCHITECTURE.md, CONTRIBUTING.md, workflows docs)
45
+ - Update test script configuration in package.json
46
+ - Add @objectstack/cli to devDependencies for better development experience
47
+
48
+ - 109fc5b: Unified patch release to align all package versions.
49
+ - Updated dependencies [a0a6c85]
50
+ - Updated dependencies [109fc5b]
51
+ - @objectstack/spec@1.0.2
52
+ - @objectstack/core@1.0.2
53
+ - @objectstack/types@1.0.2
54
+ - @objectstack/runtime@1.0.2
55
+ - @objectstack/hono@1.0.2
56
+
3
57
  ## 1.0.1
4
58
 
5
59
  ### Patch Changes
package/README.md CHANGED
@@ -4,16 +4,33 @@ HTTP Server adapter for ObjectStack using Hono.
4
4
 
5
5
  ## Features
6
6
 
7
+ - **Standard Runtime**: Uses the unified `HttpDispatcher` and standard Hono adapter via `@objectstack/hono`.
7
8
  - **Fast**: Built on Hono, a high-performance web framework.
8
- - **Protocol Compliant**: Implements the `IHttpServer` interface required by `@objectstack/runtime`.
9
- - **Middleware**: Supports standard ObjectStack middleware.
9
+ - **Full Protocol Support**: Automatically provides all ObjectStack Runtime endpoints (Auth, Data, Metadata, etc.).
10
+ - **Middleware**: Supports standard Hono middleware.
10
11
 
11
12
  ## Usage
12
13
 
13
14
  ```typescript
14
- import { ObjectKernel } from '@objectstack/core';
15
+ import { ObjectKernel } from '@objectstack/runtime';
15
16
  import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
16
17
 
17
18
  const kernel = new ObjectKernel();
18
- kernel.use(new HonoServerPlugin({ port: 3000 }));
19
+
20
+ // Register the server plugin
21
+ kernel.use(new HonoServerPlugin({
22
+ port: 3000,
23
+ restConfig: {
24
+ api: {
25
+ apiPath: '/api/v1' // Customize API prefix
26
+ }
27
+ }
28
+ }));
29
+
30
+ await kernel.start();
19
31
  ```
32
+
33
+ ## Architecture
34
+
35
+ This plugin wraps `@objectstack/hono` to provide a turnkey HTTP server solution for the Runtime. It binds the standard `HttpDispatcher` to a Hono application and starts listening on the configured port.
36
+
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;
@@ -17,7 +18,12 @@ export declare class HonoHttpServer implements IHttpServer {
17
18
  delete(path: string, handler: RouteHandler): void;
18
19
  patch(path: string, handler: RouteHandler): void;
19
20
  use(pathOrHandler: string | Middleware, handler?: Middleware): void;
21
+ /**
22
+ * Mount a sub-application or router
23
+ */
24
+ mount(path: string, subApp: Hono): void;
20
25
  listen(port: number): Promise<void>;
26
+ getPort(): number;
21
27
  getRawApp(): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
22
28
  close(): Promise<void>;
23
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;
@@ -107,19 +108,30 @@ class HonoHttpServer {
107
108
  });
108
109
  }
109
110
  }
111
+ /**
112
+ * Mount a sub-application or router
113
+ */
114
+ mount(path, subApp) {
115
+ this.app.route(path, subApp);
116
+ }
110
117
  async listen(port) {
111
118
  return new Promise((resolve) => {
112
119
  if (this.staticRoot) {
113
120
  this.app.get('/*', (0, serve_static_1.serveStatic)({ root: this.staticRoot }));
114
121
  }
122
+ const targetPort = port || this.port;
115
123
  this.server = (0, node_server_1.serve)({
116
124
  fetch: this.app.fetch,
117
- port: port || this.port
125
+ port: targetPort
118
126
  }, (info) => {
127
+ this.listeningPort = info.port;
119
128
  resolve();
120
129
  });
121
130
  });
122
131
  }
132
+ getPort() {
133
+ return this.listeningPort || this.port;
134
+ }
123
135
  // Expose raw app for scenarios where standard interface is not enough
124
136
  getRawApp() {
125
137
  return this.app;
@@ -38,34 +38,10 @@ export declare class HonoServerPlugin implements Plugin {
38
38
  * Init phase - Setup HTTP server and register as service
39
39
  */
40
40
  init: (ctx: PluginContext) => Promise<void>;
41
- /**
42
- * Helper to create cache request object from HTTP headers
43
- */
44
- private createCacheRequest;
45
41
  /**
46
42
  * Start phase - Bind routes and start listening
47
43
  */
48
44
  start: (ctx: PluginContext) => Promise<void>;
49
- /**
50
- * Register standard ObjectStack API endpoints to the API Registry
51
- */
52
- private registerStandardEndpointsToRegistry;
53
- /**
54
- * Bind HTTP routes from API Registry
55
- */
56
- private bindRoutesFromRegistry;
57
- /**
58
- * Bind a single endpoint to the HTTP server
59
- */
60
- private bindEndpoint;
61
- /**
62
- * Create a route handler for an endpoint
63
- */
64
- private createHandlerForEndpoint;
65
- /**
66
- * Legacy route registration (fallback when API Registry is not available)
67
- */
68
- private bindLegacyRoutes;
69
45
  /**
70
46
  * Destroy phase - Stop server
71
47
  */