@arkstack/driver-h3 0.19.2 → 0.19.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/README.md CHANGED
@@ -7,17 +7,17 @@ H3 driver for Arkstack, providing H3-based runtime integration for the framework
7
7
  ## Auth Middleware
8
8
 
9
9
  ```ts
10
- import { H3 } from 'h3';
11
- import { auth } from '@arkstack/driver-h3/middlewares';
10
+ import { H3 } from 'h3'
11
+ import { auth } from '@arkstack/driver-h3/middlewares'
12
12
 
13
- const app = new H3();
13
+ const app = new H3()
14
14
 
15
- app.use(auth);
15
+ app.use(auth)
16
16
  app.use('/account', ({ req }) => {
17
17
  return {
18
18
  user: req.authUser,
19
- };
20
- });
19
+ }
20
+ })
21
21
  ```
22
22
 
23
23
  The middleware expects `Authorization: Bearer <token>` and attaches `user`, `authUser`, and `authToken` to `event.context` and `event.req`.
package/dist/app.d.ts CHANGED
@@ -1,25 +1,25 @@
1
1
  import type { H3Event } from 'h3'
2
2
 
3
3
  declare module '@arkstack/common' {
4
- interface HookRegistry {
5
- 'middleware:auth': {
6
- before: (event: H3Event) => void
7
- after: (event: H3Event) => void
8
- error: (error: unknown, event: H3Event) => void
9
- }
4
+ interface HookRegistry {
5
+ 'middleware:auth': {
6
+ before: (event: H3Event) => void
7
+ after: (event: H3Event) => void
8
+ error: (error: unknown, event: H3Event) => void
10
9
  }
10
+ }
11
11
  }
12
12
 
13
13
  declare module '@arkstack/foundry' {
14
- interface HookRegistry {
15
- 'middleware:auth': {
16
- before: (event: H3Event) => void
17
- after: (event: H3Event) => void
18
- error: (error: unknown, event: H3Event) => void
19
- }
14
+ interface HookRegistry {
15
+ 'middleware:auth': {
16
+ before: (event: H3Event) => void
17
+ after: (event: H3Event) => void
18
+ error: (error: unknown, event: H3Event) => void
20
19
  }
20
+ }
21
21
  }
22
22
 
23
23
  declare global {
24
- var tunnelUrl: () => string
25
- }
24
+ var tunnelUrl: () => string
25
+ }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as staticAssetHandler } from "./middlewares-Cm8RxZrz.js";
1
+ import { t as staticAssetHandler } from "./middlewares-C_1wOZq0.js";
2
2
  import { ArkstackKitDriver } from "@arkstack/contract";
3
3
  import { H3, HTTPResponse, serve, toResponse } from "h3";
4
4
  import { ErrorHandler, Logger, devTlsCredentials, env, localNetworkAddress, renderError, resolveRuntimeModule } from "@arkstack/common";
@@ -65,11 +65,11 @@ const defaultErrorHandler = async (err, event) => {
65
65
  * Build the "Server is running" startup lines, adding a local-network URL when
66
66
  * the server is bound to all interfaces (`0.0.0.0`/`::`) so it is reachable from
67
67
  * other devices.
68
- *
69
- * @param scheme
70
- * @param host
71
- * @param port
72
- * @returns
68
+ *
69
+ * @param scheme
70
+ * @param host
71
+ * @param port
72
+ * @returns
73
73
  */
74
74
  const startupLogLines = (scheme, host, port) => {
75
75
  const bindsAll = host === "0.0.0.0" || host === "::";
@@ -103,8 +103,8 @@ var H3Driver = class extends ArkstackKitDriver {
103
103
  options;
104
104
  /**
105
105
  * Creates an instance of H3Driver.
106
- *
107
- * @param options
106
+ *
107
+ * @param options
108
108
  */
109
109
  constructor(options) {
110
110
  super();
@@ -112,17 +112,17 @@ var H3Driver = class extends ArkstackKitDriver {
112
112
  }
113
113
  /**
114
114
  * Creates an H3 application instance.
115
- *
116
- * @returns
115
+ *
116
+ * @returns
117
117
  */
118
118
  createApp() {
119
119
  return this.options.createApp?.() ?? new H3({ onError: this.options.onError ?? defaultErrorHandler });
120
120
  }
121
121
  /**
122
122
  * Mounts static assets from the specified public path to the H3 application.
123
- *
124
- * @param app
125
- * @param publicPath
123
+ *
124
+ * @param app
125
+ * @param publicPath
126
126
  */
127
127
  mountPublicAssets(app, publicPath) {
128
128
  if (this.options.mountPublicAssets) return this.options.mountPublicAssets(app, publicPath);
@@ -130,17 +130,17 @@ var H3Driver = class extends ArkstackKitDriver {
130
130
  }
131
131
  /**
132
132
  * Binds the router to the H3 application using the provided bindRouter function.
133
- *
134
- * @param app
133
+ *
134
+ * @param app
135
135
  */
136
136
  bindRouter(app) {
137
137
  return this.options.bindRouter(app);
138
138
  }
139
139
  /**
140
140
  * Applies middleware to the H3 application.
141
- *
142
- * @param app
143
- * @param middleware
141
+ *
142
+ * @param app
143
+ * @param middleware
144
144
  */
145
145
  applyMiddleware(app, middleware) {
146
146
  const mw = Array.isArray(middleware) ? middleware[0] : middleware;
@@ -164,8 +164,8 @@ var H3Driver = class extends ArkstackKitDriver {
164
164
  }
165
165
  /**
166
166
  * If trafic has been proxied via ngrok, this will return the tunnel URL.
167
- *
168
- * @returns
167
+ *
168
+ * @returns
169
169
  */
170
170
  geTunnelUrl() {
171
171
  return this.tunnel_url;
@@ -1,2 +1,2 @@
1
- import { a as InertiaMiddleware, c as cors, i as requestLogger, l as AuthMiddleware, n as resora, o as inertia, r as RequestLoggerMiddleware, s as CorsMiddleware, t as staticAssetHandler, u as auth } from "../middlewares-Cm8RxZrz.js";
1
+ import { a as InertiaMiddleware, c as cors, i as requestLogger, l as AuthMiddleware, n as resora, o as inertia, r as RequestLoggerMiddleware, s as CorsMiddleware, t as staticAssetHandler, u as auth } from "../middlewares-C_1wOZq0.js";
2
2
  export { AuthMiddleware, CorsMiddleware, InertiaMiddleware, RequestLoggerMiddleware, auth, cors, inertia, requestLogger, resora, staticAssetHandler };
@@ -318,9 +318,9 @@ const colors = {
318
318
  };
319
319
  /**
320
320
  * Middleware to log incoming requests and their response times.
321
- *
321
+ *
322
322
  * @param config Configuration options for the request logger middleware.
323
- * @param config.allowInProduction If true, the logger will also log requests in production environment. Default is false.
323
+ * @param config.allowInProduction If true, the logger will also log requests in production environment. Default is false.
324
324
  * @returns H3Middleware function
325
325
  */
326
326
  const requestLogger = ({ allowInProduction = false } = {}) => async (event, next) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/driver-h3",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
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.19.2",
45
- "@arkstack/http": "^0.19.2"
44
+ "@arkstack/contract": "^0.19.4",
45
+ "@arkstack/http": "^0.19.4"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "h3": "^2.0.1-rc.22",
49
- "@arkstack/foundry": "^0.19.2",
50
- "@arkstack/inertia": "^0.19.2",
51
- "@arkstack/auth": "^0.19.2",
52
- "@arkstack/common": "^0.19.2"
49
+ "@arkstack/auth": "^0.19.4",
50
+ "@arkstack/common": "^0.19.4",
51
+ "@arkstack/foundry": "^0.19.4",
52
+ "@arkstack/inertia": "^0.19.4"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@arkstack/auth": {