@arkstack/driver-h3 0.17.23 → 0.17.25
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.d.ts +90 -2
- package/dist/index.js +37 -32
- package/dist/middlewares/index.d.ts +1 -1
- package/dist/types-CcefBdiX.d.ts +16 -0
- package/dist/types.d.ts +2 -2
- package/package.json +7 -7
- package/dist/index-DybiVNM6.d.ts +0 -97
- package/dist/types-Bk8w0EpY.d.ts +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,91 @@
|
|
|
1
1
|
/// <reference path="./app.d.ts" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { i as MiddlewareConfig, n as H3Middleware, r as Middleware$2, t as H3DriverOptions } from "./types-CcefBdiX.js";
|
|
3
|
+
import { ArkstackKitDriver, ArkstackRouteListOptions, PromiseOrValue } from "@arkstack/contract";
|
|
4
|
+
import { H3, H3Event, HTTPError, HTTPResponse } from "h3";
|
|
5
|
+
import { Router as Router$1 } from "clear-router/h3";
|
|
6
|
+
import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "clear-router/types/h3";
|
|
7
|
+
import { Route } from "clear-router";
|
|
8
|
+
//#region src/H3Driver.d.ts
|
|
9
|
+
declare class H3EventResponse {
|
|
10
|
+
response: Response;
|
|
11
|
+
status: number;
|
|
12
|
+
statusText?: string;
|
|
13
|
+
constructor(response: Response);
|
|
14
|
+
get headers(): Headers;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The H3Driver class implements the ArkstackKitDriver contract for the H3 framework.
|
|
18
|
+
*/
|
|
19
|
+
declare class H3Driver extends ArkstackKitDriver<H3, H3Middleware> {
|
|
20
|
+
readonly name = "h3";
|
|
21
|
+
private tunnel_url?;
|
|
22
|
+
private readonly options;
|
|
23
|
+
/**
|
|
24
|
+
* Creates an instance of H3Driver.
|
|
25
|
+
*
|
|
26
|
+
* @param options
|
|
27
|
+
*/
|
|
28
|
+
constructor(options: H3DriverOptions);
|
|
29
|
+
/**
|
|
30
|
+
* Creates an H3 application instance.
|
|
31
|
+
*
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
createApp(): H3;
|
|
35
|
+
/**
|
|
36
|
+
* Mounts static assets from the specified public path to the H3 application.
|
|
37
|
+
*
|
|
38
|
+
* @param app
|
|
39
|
+
* @param publicPath
|
|
40
|
+
*/
|
|
41
|
+
mountPublicAssets(app: H3, publicPath: string): PromiseOrValue<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Binds the router to the H3 application using the provided bindRouter function.
|
|
44
|
+
*
|
|
45
|
+
* @param app
|
|
46
|
+
*/
|
|
47
|
+
bindRouter(app: H3): PromiseOrValue<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Applies middleware to the H3 application.
|
|
50
|
+
*
|
|
51
|
+
* @param app
|
|
52
|
+
* @param middleware
|
|
53
|
+
*/
|
|
54
|
+
applyMiddleware(app: H3, middleware: H3Middleware | Middleware$2 | MiddlewareConfig): void;
|
|
55
|
+
/**
|
|
56
|
+
* If trafic has been proxied via ngrok, this will return the tunnel URL.
|
|
57
|
+
*
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
geTunnelUrl(): string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Starts the H3 server on the specified port.
|
|
63
|
+
*
|
|
64
|
+
* The bind host can be overridden with the `APP_HOST` (or `HOST`) env
|
|
65
|
+
* variable. It defaults to `0.0.0.0` so the server is reachable on all
|
|
66
|
+
* network interfaces, which platforms like Railway require for their
|
|
67
|
+
* healthcheck proxy to reach the app.
|
|
68
|
+
*
|
|
69
|
+
* @param app
|
|
70
|
+
* @param port
|
|
71
|
+
*/
|
|
72
|
+
start(app: H3, port: number): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/error-handler.d.ts
|
|
76
|
+
declare const defaultErrorHandler: (err: HTTPError | Error | string, event: H3Event) => Promise<HTTPResponse | {
|
|
77
|
+
error: boolean;
|
|
78
|
+
message: string;
|
|
79
|
+
status: "error";
|
|
80
|
+
code: number;
|
|
81
|
+
errors?: unknown;
|
|
82
|
+
stack?: string;
|
|
83
|
+
}>;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/Router.d.ts
|
|
86
|
+
declare class Router extends Router$1 {
|
|
87
|
+
static bind(app: H3): Promise<H3App>;
|
|
88
|
+
static list(_options: ArkstackRouteListOptions | undefined, app: H3): Promise<Route<HttpContext, Middleware$1, Handler>[]>;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { H3Driver, H3EventResponse, Router, defaultErrorHandler };
|
package/dist/index.js
CHANGED
|
@@ -60,27 +60,27 @@ const defaultErrorHandler = async (err, event) => {
|
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
|
63
|
-
//#region src/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
//#region src/H3Driver.ts
|
|
64
|
+
/**
|
|
65
|
+
* Build the "Server is running" startup lines, adding a local-network URL when
|
|
66
|
+
* the server is bound to all interfaces (`0.0.0.0`/`::`) so it is reachable from
|
|
67
|
+
* other devices.
|
|
68
|
+
*
|
|
69
|
+
* @param scheme
|
|
70
|
+
* @param host
|
|
71
|
+
* @param port
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
const startupLogLines = (scheme, host, port) => {
|
|
75
|
+
const bindsAll = host === "0.0.0.0" || host === "::";
|
|
76
|
+
const localHost = bindsAll ? "localhost" : host;
|
|
77
|
+
const lines = [Logger.log([["Server is running on", "white"], [`${scheme}://${localHost}:${port}`, "cyan"]], " ", false)];
|
|
78
|
+
if (bindsAll) {
|
|
79
|
+
const address = localNetworkAddress();
|
|
80
|
+
if (address) lines.push(Logger.log([["Network access via", "white"], [`${scheme}://${address}:${port}`, "cyan"]], " ", false));
|
|
80
81
|
}
|
|
82
|
+
return lines;
|
|
81
83
|
};
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/index.ts
|
|
84
84
|
var H3EventResponse = class {
|
|
85
85
|
response;
|
|
86
86
|
status = 200;
|
|
@@ -221,20 +221,25 @@ var H3Driver = class extends ArkstackKitDriver {
|
|
|
221
221
|
console.log(log.join("\n"));
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/Router.ts
|
|
226
|
+
registerPlugin(clearRouterH3Plugin);
|
|
227
|
+
Router$1.use(arkstackHttpPlugin);
|
|
228
|
+
Router$1.configure({ inferParamName: true });
|
|
229
|
+
var Router = class extends Router$1 {
|
|
230
|
+
static async bind(app) {
|
|
231
|
+
try {
|
|
232
|
+
await Router$1.group("/api", resolveRuntimeModule("src/routes/api.ts"));
|
|
233
|
+
} catch {}
|
|
234
|
+
try {
|
|
235
|
+
await Router$1.group("/", resolveRuntimeModule("src/routes/web.ts"));
|
|
236
|
+
} catch {}
|
|
237
|
+
return Router$1.apply(app);
|
|
238
|
+
}
|
|
239
|
+
static async list(_options = {}, app) {
|
|
240
|
+
await this.bind(app);
|
|
241
|
+
return this.allRoutes();
|
|
236
242
|
}
|
|
237
|
-
return lines;
|
|
238
243
|
};
|
|
239
244
|
//#endregion
|
|
240
245
|
export { H3Driver, H3EventResponse, Router, defaultErrorHandler };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ArkstackMiddlewareConfig, PromiseOrValue } from "@arkstack/contract";
|
|
2
|
+
import { H3, H3Event, Middleware } from "h3";
|
|
3
|
+
import { ClassMiddleware } from "clear-router/types/basic";
|
|
4
|
+
import { Middleware as Middleware$1 } from "clear-router/types/h3";
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
type Middleware$2 = Middleware | ClassMiddleware<Middleware>;
|
|
7
|
+
type MiddlewareConfig = ArkstackMiddlewareConfig<Middleware$2> | ArkstackMiddlewareConfig<H3Middleware>;
|
|
8
|
+
type H3Middleware = Middleware$1 | [Middleware$1, Record<string, any>];
|
|
9
|
+
interface H3DriverOptions {
|
|
10
|
+
bindRouter: (app: H3) => PromiseOrValue<void>;
|
|
11
|
+
mountPublicAssets?: (app: H3, publicPath: string) => PromiseOrValue<void>;
|
|
12
|
+
createApp?: () => H3;
|
|
13
|
+
onError?: (err: Error | string, event: H3Event) => unknown;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { MiddlewareConfig as i, H3Middleware as n, Middleware$2 as r, H3DriverOptions as t };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { Middleware, MiddlewareConfig };
|
|
1
|
+
import { i as MiddlewareConfig, n as H3Middleware, r as Middleware, t as H3DriverOptions } from "./types-CcefBdiX.js";
|
|
2
|
+
export { H3DriverOptions, H3Middleware, Middleware, MiddlewareConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/driver-h3",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.25",
|
|
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",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"@resora/plugin-clear-router": "^1.0.72",
|
|
42
42
|
"clear-router": "^2.9.3",
|
|
43
43
|
"resora": "^1.3.34",
|
|
44
|
-
"@arkstack/contract": "^0.17.
|
|
45
|
-
"@arkstack/http": "^0.17.
|
|
44
|
+
"@arkstack/contract": "^0.17.25",
|
|
45
|
+
"@arkstack/http": "^0.17.25"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"h3": "^2.0.1-rc.22",
|
|
49
|
-
"@arkstack/
|
|
50
|
-
"@arkstack/
|
|
51
|
-
"@arkstack/inertia": "^0.17.
|
|
52
|
-
"@arkstack/
|
|
49
|
+
"@arkstack/foundry": "^0.17.25",
|
|
50
|
+
"@arkstack/auth": "^0.17.25",
|
|
51
|
+
"@arkstack/inertia": "^0.17.25",
|
|
52
|
+
"@arkstack/common": "^0.17.25"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@arkstack/auth": {
|
package/dist/index-DybiVNM6.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { n as MiddlewareConfig, t as Middleware$2 } from "./types-Bk8w0EpY.js";
|
|
2
|
-
import { ArkstackKitDriver, ArkstackRouteListOptions, PromiseOrValue } from "@arkstack/contract";
|
|
3
|
-
import { H3, H3Event, HTTPError, HTTPResponse } from "h3";
|
|
4
|
-
import { Router } from "clear-router/h3";
|
|
5
|
-
import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "clear-router/types/h3";
|
|
6
|
-
import { Route } from "clear-router";
|
|
7
|
-
//#region src/error-handler.d.ts
|
|
8
|
-
declare const defaultErrorHandler: (err: HTTPError | Error | string, event: H3Event) => Promise<HTTPResponse | {
|
|
9
|
-
error: boolean;
|
|
10
|
-
message: string;
|
|
11
|
-
status: "error";
|
|
12
|
-
code: number;
|
|
13
|
-
errors?: unknown;
|
|
14
|
-
stack?: string;
|
|
15
|
-
}>;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/Router.d.ts
|
|
18
|
-
declare class Router$1 extends Router {
|
|
19
|
-
static bind(app: H3): Promise<H3App>;
|
|
20
|
-
static list(_options: ArkstackRouteListOptions | undefined, app: H3): Promise<Route<HttpContext, Middleware$1, Handler>[]>;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/index.d.ts
|
|
24
|
-
type H3Middleware = Middleware$1 | [Middleware$1, Record<string, any>];
|
|
25
|
-
interface H3DriverOptions {
|
|
26
|
-
bindRouter: (app: H3) => PromiseOrValue<void>;
|
|
27
|
-
mountPublicAssets?: (app: H3, publicPath: string) => PromiseOrValue<void>;
|
|
28
|
-
createApp?: () => H3;
|
|
29
|
-
onError?: (err: Error | string, event: H3Event) => unknown;
|
|
30
|
-
}
|
|
31
|
-
declare class H3EventResponse {
|
|
32
|
-
response: Response;
|
|
33
|
-
status: number;
|
|
34
|
-
statusText?: string;
|
|
35
|
-
constructor(response: Response);
|
|
36
|
-
get headers(): Headers;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The H3Driver class implements the ArkstackKitDriver contract for the H3 framework.
|
|
40
|
-
*/
|
|
41
|
-
declare class H3Driver extends ArkstackKitDriver<H3, H3Middleware> {
|
|
42
|
-
readonly name = "h3";
|
|
43
|
-
private tunnel_url?;
|
|
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
|
-
* If trafic has been proxied via ngrok, this will return the tunnel URL.
|
|
79
|
-
*
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
|
-
geTunnelUrl(): string | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* Starts the H3 server on the specified port.
|
|
85
|
-
*
|
|
86
|
-
* The bind host can be overridden with the `APP_HOST` (or `HOST`) env
|
|
87
|
-
* variable. It defaults to `0.0.0.0` so the server is reachable on all
|
|
88
|
-
* network interfaces, which platforms like Railway require for their
|
|
89
|
-
* healthcheck proxy to reach the app.
|
|
90
|
-
*
|
|
91
|
-
* @param app
|
|
92
|
-
* @param port
|
|
93
|
-
*/
|
|
94
|
-
start(app: H3, port: number): Promise<void>;
|
|
95
|
-
}
|
|
96
|
-
//#endregion
|
|
97
|
-
export { Router$1 as a, H3Middleware as i, H3DriverOptions as n, defaultErrorHandler as o, H3EventResponse as r, H3Driver as t };
|
package/dist/types-Bk8w0EpY.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArkstackMiddlewareConfig } from "@arkstack/contract";
|
|
2
|
-
import { Middleware } from "h3";
|
|
3
|
-
import { ClassMiddleware } from "clear-router/types/basic";
|
|
4
|
-
import { H3Middleware } from "@arkstack/driver-h3";
|
|
5
|
-
//#region src/types.d.ts
|
|
6
|
-
type Middleware$1 = Middleware | ClassMiddleware<Middleware>;
|
|
7
|
-
type MiddlewareConfig = ArkstackMiddlewareConfig<Middleware$1> | ArkstackMiddlewareConfig<H3Middleware>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { MiddlewareConfig as n, Middleware$1 as t };
|