@arkstack/driver-express 0.14.15 → 0.14.17

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.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import express from "express";
2
- import { Arkstack, ArkstackKitDriver } from "@arkstack/contract";
3
- import { ErrorHandler, Logger, RequestException, env, renderError } from "@arkstack/common";
2
+ import { ArkstackKitDriver } from "@arkstack/contract";
3
+ import { ErrorHandler, Logger, RequestException, env, renderError, resolveRuntimeModule } from "@arkstack/common";
4
4
  import { resolveMiddleware } from "@arkstack/http";
5
5
  import ngrok from "@ngrok/ngrok";
6
6
  import { Router as Router$2 } from "clear-router/express";
7
7
  import { clearRouterExpressPlugin } from "@resora/plugin-clear-router";
8
- import { join } from "node:path";
9
8
  import { registerPlugin } from "resora";
10
9
  //#region src/error-handler.ts
11
10
  const webMiddlewareKey = Symbol.for("arkstack:http:web");
@@ -65,12 +64,12 @@ var Router = class extends Router$2 {
65
64
  static async bind() {
66
65
  const router = express.Router();
67
66
  try {
68
- await Router$2.group("/api", join(Arkstack.rootDir(), "src/routes/api.ts"));
67
+ await Router$2.group("/api", resolveRuntimeModule("src/routes/api.ts"));
69
68
  } catch (e) {
70
69
  Logger.error("ERROR: Unable to load \"api.ts\" routes: " + e.message, false);
71
70
  }
72
71
  try {
73
- await Router$2.group("/", join(Arkstack.rootDir(), "src/routes/web.ts"));
72
+ await Router$2.group("/", resolveRuntimeModule("src/routes/web.ts"));
74
73
  } catch (e) {
75
74
  Logger.error("ERROR: Unable to load \"web.ts\" routes: " + e.message, false);
76
75
  }
@@ -1,4 +1,4 @@
1
- import { Exception, Hook, Logger, config, env, nodeEnv } from "@arkstack/common";
1
+ import { Exception, Hook, Logger, config, env, nodeEnv, resolveRuntimeDir } from "@arkstack/common";
2
2
  import { applyRuntimeConfig, getDefaultConfig, runWithCtx, setCtx } from "resora";
3
3
  import multer from "multer";
4
4
  import { rateLimit } from "express-rate-limit";
@@ -157,12 +157,17 @@ var RequestLoggerMiddleware = class {
157
157
  * async context so downstream handlers resolve the correct context.
158
158
  */
159
159
  const resora = () => {
160
+ let resources;
160
161
  return (req, res, next) => {
161
162
  try {
162
- applyRuntimeConfig({
163
- ...getDefaultConfig(),
164
- ...config("resources", {})
165
- });
163
+ if (!resources) {
164
+ resources = {
165
+ ...getDefaultConfig(),
166
+ ...config("resources", {})
167
+ };
168
+ if (typeof resources.resourcesDir === "string") resources.resourcesDir = resolveRuntimeDir(resources.resourcesDir);
169
+ }
170
+ applyRuntimeConfig(resources);
166
171
  } catch {}
167
172
  setCtx({
168
173
  req,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/driver-express",
3
- "version": "0.14.15",
3
+ "version": "0.14.17",
4
4
  "type": "module",
5
5
  "description": "Express driver for Arkstack, providing Express-based runtime integration for the framework.",
6
6
  "homepage": "https://arkstack.toneflix.net",
@@ -43,13 +43,13 @@
43
43
  "express-rate-limit": "^8.4.1",
44
44
  "multer": "^2.1.1",
45
45
  "resora": "^1.3.26",
46
- "@arkstack/contract": "^0.14.15"
46
+ "@arkstack/contract": "^0.14.17"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "express": "^5.2.1",
50
- "@arkstack/auth": "^0.14.15",
51
- "@arkstack/foundry": "^0.14.15",
52
- "@arkstack/common": "^0.14.15"
50
+ "@arkstack/common": "^0.14.17",
51
+ "@arkstack/foundry": "^0.14.17",
52
+ "@arkstack/auth": "^0.14.17"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@arkstack/auth": {