@kitledger/server 0.0.7 → 0.0.8
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/dist/main.d.ts +61 -7
- package/dist/main.js +61 -7
- package/package.json +2 -2
package/dist/main.d.ts
CHANGED
|
@@ -24,19 +24,73 @@ export declare function defineServerConfig(options: ServerOptions): ServerConfig
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function printAsciiLogo(): void;
|
|
26
26
|
/**
|
|
27
|
-
* Factory function
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* Factory function that initializes the Kitledger server engine based on Hono.
|
|
28
|
+
*
|
|
29
|
+
* This function injects the provided {@link ServerConfig} (business logic, UI definitions,
|
|
30
|
+
* and database connections) into the application context and returns a fully configured
|
|
31
|
+
* Hono instance.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* **Universal Web Standards**
|
|
35
|
+
* The returned application relies on native Web Standard `Request` and `Response` objects.
|
|
36
|
+
* This makes the server runtime-agnostic and allows it to be mounted within existing
|
|
37
|
+
* full-stack frameworks (like Next.js Route Handlers, Astro, or React Router 7) simply
|
|
38
|
+
* by exporting the `fetch` handler.
|
|
39
|
+
*
|
|
40
|
+
* @param config - The {@link ServerConfig} object containing system settings, static paths, and UI definitions.
|
|
31
41
|
* @returns A Promise that resolves to the configured Hono application instance.
|
|
32
|
-
*
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
33
44
|
* ```ts
|
|
34
|
-
* //
|
|
45
|
+
* // 1. Standalone Usage (Bun)
|
|
35
46
|
* const server = await createServer({
|
|
36
47
|
* systemConfig: myConfig,
|
|
37
48
|
* staticPaths: ['/public']
|
|
38
49
|
* });
|
|
39
|
-
*
|
|
50
|
+
*
|
|
51
|
+
* export default {
|
|
52
|
+
* fetch: server.fetch,
|
|
53
|
+
* port: 3000
|
|
54
|
+
* };
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* // 2. Standalone Usage (Deno)
|
|
60
|
+
* const server = await createServer({
|
|
61
|
+
* systemConfig: myConfig,
|
|
62
|
+
* staticPaths: ['/public']
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* Deno.serve({ port: 8000 }, server.fetch);
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* // 3. Standalone Usage (Node.js)
|
|
71
|
+
* import { serve } from '@hono/node-server';
|
|
72
|
+
*
|
|
73
|
+
* const server = await createServer({
|
|
74
|
+
* systemConfig: myConfig,
|
|
75
|
+
* staticPaths: ['/public']
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* serve({
|
|
79
|
+
* fetch: server.fetch,
|
|
80
|
+
* port: 3000
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* // 4. Framework Integration (Next.js / Astro / React Router 7)
|
|
87
|
+
* // Because 'server' follows standard Web APIs, you can use it in route handlers.
|
|
88
|
+
*
|
|
89
|
+
* const server = await createServer({ ... });
|
|
90
|
+
*
|
|
91
|
+
* // Next.js App Router (route.ts)
|
|
92
|
+
* export const GET = server.fetch;
|
|
93
|
+
* export const POST = server.fetch;
|
|
40
94
|
* ```
|
|
41
95
|
*/
|
|
42
96
|
export declare function createServer(config: ServerConfig): Promise<Hono<KitledgerContext, import("hono/types").BlankSchema, "/">>;
|
package/dist/main.js
CHANGED
|
@@ -24,19 +24,73 @@ export function printAsciiLogo() {
|
|
|
24
24
|
console.log(getAsciiLogo());
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Factory function
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* Factory function that initializes the Kitledger server engine based on Hono.
|
|
28
|
+
*
|
|
29
|
+
* This function injects the provided {@link ServerConfig} (business logic, UI definitions,
|
|
30
|
+
* and database connections) into the application context and returns a fully configured
|
|
31
|
+
* Hono instance.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* **Universal Web Standards**
|
|
35
|
+
* The returned application relies on native Web Standard `Request` and `Response` objects.
|
|
36
|
+
* This makes the server runtime-agnostic and allows it to be mounted within existing
|
|
37
|
+
* full-stack frameworks (like Next.js Route Handlers, Astro, or React Router 7) simply
|
|
38
|
+
* by exporting the `fetch` handler.
|
|
39
|
+
*
|
|
40
|
+
* @param config - The {@link ServerConfig} object containing system settings, static paths, and UI definitions.
|
|
31
41
|
* @returns A Promise that resolves to the configured Hono application instance.
|
|
32
|
-
*
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
33
44
|
* ```ts
|
|
34
|
-
* //
|
|
45
|
+
* // 1. Standalone Usage (Bun)
|
|
35
46
|
* const server = await createServer({
|
|
36
47
|
* systemConfig: myConfig,
|
|
37
48
|
* staticPaths: ['/public']
|
|
38
49
|
* });
|
|
39
|
-
*
|
|
50
|
+
*
|
|
51
|
+
* export default {
|
|
52
|
+
* fetch: server.fetch,
|
|
53
|
+
* port: 3000
|
|
54
|
+
* };
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* // 2. Standalone Usage (Deno)
|
|
60
|
+
* const server = await createServer({
|
|
61
|
+
* systemConfig: myConfig,
|
|
62
|
+
* staticPaths: ['/public']
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* Deno.serve({ port: 8000 }, server.fetch);
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* // 3. Standalone Usage (Node.js)
|
|
71
|
+
* import { serve } from '@hono/node-server';
|
|
72
|
+
*
|
|
73
|
+
* const server = await createServer({
|
|
74
|
+
* systemConfig: myConfig,
|
|
75
|
+
* staticPaths: ['/public']
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* serve({
|
|
79
|
+
* fetch: server.fetch,
|
|
80
|
+
* port: 3000
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* // 4. Framework Integration (Next.js / Astro / React Router 7)
|
|
87
|
+
* // Because 'server' follows standard Web APIs, you can use it in route handlers.
|
|
88
|
+
*
|
|
89
|
+
* const server = await createServer({ ... });
|
|
90
|
+
*
|
|
91
|
+
* // Next.js App Router (route.ts)
|
|
92
|
+
* export const GET = server.fetch;
|
|
93
|
+
* export const POST = server.fetch;
|
|
40
94
|
* ```
|
|
41
95
|
*/
|
|
42
96
|
export async function createServer(config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitledger/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@hono/node-server": "^1.19.6",
|
|
19
19
|
"hono": "^4.10.7",
|
|
20
20
|
"valibot": "^1.1.0",
|
|
21
|
-
"@kitledger/core": "0.0.
|
|
21
|
+
"@kitledger/core": "0.0.9"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@kitledger/admin": "0.0.5"
|