@objectstack/plugin-hono-server 1.0.1 → 1.0.2
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 +22 -0
- package/README.md +21 -4
- package/dist/adapter.d.ts +4 -0
- package/dist/adapter.js +6 -0
- package/dist/hono-plugin.d.ts +0 -24
- package/dist/hono-plugin.js +16 -1010
- package/package.json +6 -4
- package/src/adapter.ts +8 -0
- package/src/hono-plugin.test.ts +50 -133
- package/src/hono-plugin.ts +19 -1059
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @objectstack/plugin-hono-server
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a0a6c85: Infrastructure and development tooling improvements
|
|
8
|
+
|
|
9
|
+
- Add changeset configuration for automated version management
|
|
10
|
+
- Add comprehensive GitHub Actions workflows (CI, CodeQL, linting, releases)
|
|
11
|
+
- Add development configuration files (.cursorrules, .github/prompts)
|
|
12
|
+
- Add documentation files (ARCHITECTURE.md, CONTRIBUTING.md, workflows docs)
|
|
13
|
+
- Update test script configuration in package.json
|
|
14
|
+
- Add @objectstack/cli to devDependencies for better development experience
|
|
15
|
+
|
|
16
|
+
- 109fc5b: Unified patch release to align all package versions.
|
|
17
|
+
- Updated dependencies [a0a6c85]
|
|
18
|
+
- Updated dependencies [109fc5b]
|
|
19
|
+
- @objectstack/spec@1.0.2
|
|
20
|
+
- @objectstack/core@1.0.2
|
|
21
|
+
- @objectstack/types@1.0.2
|
|
22
|
+
- @objectstack/runtime@1.0.2
|
|
23
|
+
- @objectstack/hono@1.0.2
|
|
24
|
+
|
|
3
25
|
## 1.0.1
|
|
4
26
|
|
|
5
27
|
### 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
|
|
9
|
-
- **Middleware**: Supports standard
|
|
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/
|
|
15
|
+
import { ObjectKernel } from '@objectstack/runtime';
|
|
15
16
|
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
|
|
16
17
|
|
|
17
18
|
const kernel = new ObjectKernel();
|
|
18
|
-
|
|
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
|
@@ -17,6 +17,10 @@ export declare class HonoHttpServer implements IHttpServer {
|
|
|
17
17
|
delete(path: string, handler: RouteHandler): void;
|
|
18
18
|
patch(path: string, handler: RouteHandler): void;
|
|
19
19
|
use(pathOrHandler: string | Middleware, handler?: Middleware): void;
|
|
20
|
+
/**
|
|
21
|
+
* Mount a sub-application or router
|
|
22
|
+
*/
|
|
23
|
+
mount(path: string, subApp: Hono): void;
|
|
20
24
|
listen(port: number): Promise<void>;
|
|
21
25
|
getRawApp(): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
22
26
|
close(): Promise<void>;
|
package/dist/adapter.js
CHANGED
|
@@ -107,6 +107,12 @@ class HonoHttpServer {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Mount a sub-application or router
|
|
112
|
+
*/
|
|
113
|
+
mount(path, subApp) {
|
|
114
|
+
this.app.route(path, subApp);
|
|
115
|
+
}
|
|
110
116
|
async listen(port) {
|
|
111
117
|
return new Promise((resolve) => {
|
|
112
118
|
if (this.staticRoot) {
|
package/dist/hono-plugin.d.ts
CHANGED
|
@@ -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
|
*/
|