@arkstack/driver-h3 0.12.33 → 0.12.35
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/index--GiaEPJz.d.ts +91 -0
- package/dist/{index-DIJtwwZP.d.ts → index-E-098om7.d.ts} +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -5
- package/dist/middlewares/index.d.ts +1 -1
- package/dist/types-DPGHB4nY.d.ts +18 -0
- package/dist/types.d.ts +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { n as MiddlewareConfig, t as Middleware$2 } from "./types-DPGHB4nY.js";
|
|
2
|
+
import { ArkstackKitDriver, ArkstackRouteListOptions, PromiseOrValue } from "@arkstack/contract";
|
|
3
|
+
import { H3, H3Event, HTTPError, HTTPResponse } from "h3";
|
|
4
|
+
import { Route } from "clear-router";
|
|
5
|
+
import { Router } from "clear-router/h3";
|
|
6
|
+
import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "clear-router/types/h3";
|
|
7
|
+
|
|
8
|
+
//#region src/error-handler.d.ts
|
|
9
|
+
declare const defaultErrorHandler: (err: HTTPError | Error | string, event: H3Event) => Promise<HTTPResponse | {
|
|
10
|
+
error: boolean;
|
|
11
|
+
message: string;
|
|
12
|
+
status: "error";
|
|
13
|
+
code: number;
|
|
14
|
+
errors?: unknown;
|
|
15
|
+
stack?: string;
|
|
16
|
+
}>;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/Router.d.ts
|
|
19
|
+
declare class Router$1 extends Router {
|
|
20
|
+
static bind(app: H3): Promise<H3App>;
|
|
21
|
+
static list(_options: ArkstackRouteListOptions | undefined, app: H3): Promise<Route<HttpContext, Middleware$1, Handler>[]>;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/index.d.ts
|
|
25
|
+
type H3Middleware = Middleware$1 | [Middleware$1, Record<string, any>];
|
|
26
|
+
interface H3DriverOptions {
|
|
27
|
+
bindRouter: (app: H3) => PromiseOrValue<void>;
|
|
28
|
+
mountPublicAssets?: (app: H3, publicPath: string) => PromiseOrValue<void>;
|
|
29
|
+
createApp?: () => H3;
|
|
30
|
+
onError?: (err: Error | string, event: H3Event) => unknown;
|
|
31
|
+
}
|
|
32
|
+
declare class H3EventResponse {
|
|
33
|
+
response: Response;
|
|
34
|
+
status: number;
|
|
35
|
+
statusText?: string;
|
|
36
|
+
constructor(response: Response);
|
|
37
|
+
get headers(): Headers;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The H3Driver class implements the ArkstackKitDriver contract for the H3 framework.
|
|
41
|
+
*/
|
|
42
|
+
declare class H3Driver extends ArkstackKitDriver<H3, H3Middleware> {
|
|
43
|
+
readonly name = "h3";
|
|
44
|
+
private readonly options;
|
|
45
|
+
/**
|
|
46
|
+
* Creates an instance of H3Driver.
|
|
47
|
+
*
|
|
48
|
+
* @param options
|
|
49
|
+
*/
|
|
50
|
+
constructor(options: H3DriverOptions);
|
|
51
|
+
/**
|
|
52
|
+
* Creates an H3 application instance.
|
|
53
|
+
*
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
createApp(): H3;
|
|
57
|
+
/**
|
|
58
|
+
* Mounts static assets from the specified public path to the H3 application.
|
|
59
|
+
*
|
|
60
|
+
* @param app
|
|
61
|
+
* @param publicPath
|
|
62
|
+
*/
|
|
63
|
+
mountPublicAssets(app: H3, publicPath: string): PromiseOrValue<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Binds the router to the H3 application using the provided bindRouter function.
|
|
66
|
+
*
|
|
67
|
+
* @param app
|
|
68
|
+
*/
|
|
69
|
+
bindRouter(app: H3): PromiseOrValue<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Applies middleware to the H3 application.
|
|
72
|
+
*
|
|
73
|
+
* @param app
|
|
74
|
+
* @param middleware
|
|
75
|
+
*/
|
|
76
|
+
applyMiddleware(app: H3, middleware: H3Middleware | Middleware$2 | MiddlewareConfig): void;
|
|
77
|
+
/**
|
|
78
|
+
* Starts the H3 server on the specified port.
|
|
79
|
+
*
|
|
80
|
+
* The bind host can be overridden with the `APP_HOST` (or `HOST`) env
|
|
81
|
+
* variable. It defaults to `0.0.0.0` so the server is reachable on all
|
|
82
|
+
* network interfaces, which platforms like Railway require for their
|
|
83
|
+
* healthcheck proxy to reach the app.
|
|
84
|
+
*
|
|
85
|
+
* @param app
|
|
86
|
+
* @param port
|
|
87
|
+
*/
|
|
88
|
+
start(app: H3, port: number): void;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { Router$1 as a, H3Middleware as i, H3DriverOptions as n, defaultErrorHandler as o, H3EventResponse as r, H3Driver as t };
|
|
@@ -77,6 +77,11 @@ declare class H3Driver extends ArkstackKitDriver<H3, H3Middleware> {
|
|
|
77
77
|
/**
|
|
78
78
|
* Starts the H3 server on the specified port.
|
|
79
79
|
*
|
|
80
|
+
* The bind host can be overridden with the `APP_HOST` (or `HOST`) env
|
|
81
|
+
* variable. It defaults to `0.0.0.0` so the server is reachable on all
|
|
82
|
+
* network interfaces, which platforms like Railway require for their
|
|
83
|
+
* healthcheck proxy to reach the app.
|
|
84
|
+
*
|
|
80
85
|
* @param app
|
|
81
86
|
* @param port
|
|
82
87
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference path="./app.d.ts" />
|
|
2
|
-
import { a as Router, i as H3Middleware, n as H3DriverOptions, o as defaultErrorHandler, r as H3EventResponse, t as H3Driver } from "./index
|
|
2
|
+
import { a as Router, i as H3Middleware, n as H3DriverOptions, o as defaultErrorHandler, r as H3EventResponse, t as H3Driver } from "./index--GiaEPJz.js";
|
|
3
3
|
export { H3Driver, H3DriverOptions, H3EventResponse, H3Middleware, Router, defaultErrorHandler };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as staticAssetHandler } from "./middlewares-CGBJHsH7.js";
|
|
2
2
|
import { Arkstack, ArkstackKitDriver } from "@arkstack/contract";
|
|
3
3
|
import { H3, HTTPResponse, serve, toResponse } from "h3";
|
|
4
|
-
import { ErrorHandler, Logger, isClass, renderError } from "@arkstack/common";
|
|
4
|
+
import { ErrorHandler, Logger, env, isClass, renderError } from "@arkstack/common";
|
|
5
5
|
import { Request } from "clear-router";
|
|
6
6
|
import { definePlugin } from "clear-router/core";
|
|
7
7
|
import { definePlugin as definePlugin$1 } from "kanun";
|
|
@@ -1377,16 +1377,23 @@ var H3Driver = class extends ArkstackKitDriver {
|
|
|
1377
1377
|
}
|
|
1378
1378
|
/**
|
|
1379
1379
|
* Starts the H3 server on the specified port.
|
|
1380
|
-
*
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1380
|
+
*
|
|
1381
|
+
* The bind host can be overridden with the `APP_HOST` (or `HOST`) env
|
|
1382
|
+
* variable. It defaults to `0.0.0.0` so the server is reachable on all
|
|
1383
|
+
* network interfaces, which platforms like Railway require for their
|
|
1384
|
+
* healthcheck proxy to reach the app.
|
|
1385
|
+
*
|
|
1386
|
+
* @param app
|
|
1387
|
+
* @param port
|
|
1383
1388
|
*/
|
|
1384
1389
|
start(app, port) {
|
|
1390
|
+
const host = env("APP_HOST", env("HOST", "0.0.0.0"));
|
|
1385
1391
|
serve(app, {
|
|
1386
1392
|
port,
|
|
1393
|
+
hostname: host,
|
|
1387
1394
|
silent: true
|
|
1388
1395
|
}).ready().then(() => {
|
|
1389
|
-
Logger.log([["Server is running on", "white"], [`http
|
|
1396
|
+
Logger.log([["Server is running on", "white"], [`http://${host}:${port}`, "cyan"]], " ");
|
|
1390
1397
|
});
|
|
1391
1398
|
}
|
|
1392
1399
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference path="./app.d.ts" />
|
|
2
|
+
import { ArkstackKitDriver, ArkstackMiddlewareConfig, ArkstackRouteListOptions, PromiseOrValue } from "@arkstack/contract";
|
|
3
|
+
import { H3, H3Event, HTTPError, HTTPResponse, Middleware } from "h3";
|
|
4
|
+
import { Route } from "clear-router";
|
|
5
|
+
import { Router } from "clear-router/h3";
|
|
6
|
+
import { ClassMiddleware } from "clear-router/types/basic";
|
|
7
|
+
import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "clear-router/types/h3";
|
|
8
|
+
|
|
9
|
+
//#region dist/index-E-098om7.d.ts
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/index.d.ts
|
|
12
|
+
type H3Middleware = Middleware$1 | [Middleware$1, Record<string, any>];
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/types.d.ts
|
|
15
|
+
type Middleware$2 = Middleware | ClassMiddleware<Middleware>;
|
|
16
|
+
type MiddlewareConfig = ArkstackMiddlewareConfig<Middleware$2> | ArkstackMiddlewareConfig<H3Middleware>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { MiddlewareConfig as n, Middleware$2 as t };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MiddlewareConfig, t as Middleware } from "./types-
|
|
1
|
+
import { n as MiddlewareConfig, t as Middleware } from "./types-DPGHB4nY.js";
|
|
2
2
|
export { Middleware, MiddlewareConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/driver-h3",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "H3 driver for Arkstack, providing H3-based runtime integration for the framework.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"clear-router": "^2.8.8",
|
|
41
|
-
"@resora/plugin-clear-router": "^1.0.
|
|
42
|
-
"resora": "^1.3.
|
|
43
|
-
"@arkstack/contract": "^0.12.
|
|
41
|
+
"@resora/plugin-clear-router": "^1.0.62",
|
|
42
|
+
"resora": "^1.3.25",
|
|
43
|
+
"@arkstack/contract": "^0.12.35"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"h3": "2.0.1-rc.22",
|
|
47
|
-
"@arkstack/
|
|
48
|
-
"@arkstack/
|
|
49
|
-
"@arkstack/common": "^0.12.
|
|
47
|
+
"@arkstack/foundry": "^0.12.35",
|
|
48
|
+
"@arkstack/auth": "^0.12.35",
|
|
49
|
+
"@arkstack/common": "^0.12.35"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"@arkstack/auth": {
|