@wopr-network/platform-core 1.72.0 → 1.72.2

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.
@@ -206,8 +206,8 @@ export class ProxyManager {
206
206
  await this.reload();
207
207
  }
208
208
  catch (err) {
209
+ logger.warn("Proxy manager failed to connect to Caddy — continuing without proxy management", { err });
209
210
  await this.stop();
210
- throw err;
211
211
  }
212
212
  }
213
213
  async stop() {
@@ -286,9 +286,10 @@ describe("ProxyManager", () => {
286
286
  });
287
287
  });
288
288
  describe("start rollback on failure", () => {
289
- it("calls stop() if reload fails during start()", async () => {
289
+ it("calls stop() and continues if reload fails during start()", async () => {
290
290
  vi.mocked(fetch).mockRejectedValueOnce(new Error("connection refused"));
291
- await expect(manager.start()).rejects.toThrow("connection refused");
291
+ // start() should NOT throw — proxy failure is non-fatal
292
+ await expect(manager.start()).resolves.toBeUndefined();
292
293
  expect(manager.isRunning).toBe(false);
293
294
  });
294
295
  });
@@ -40,7 +40,9 @@ export async function buildContainer(bootConfig) {
40
40
  if (!bootConfig.pool) {
41
41
  const { migrate } = await import("drizzle-orm/node-postgres/migrator");
42
42
  const path = await import("node:path");
43
- const migrationsFolder = path.resolve(path.dirname(new URL(import.meta.url).pathname), "../../drizzle");
43
+ const { fileURLToPath } = await import("node:url");
44
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
45
+ const migrationsFolder = path.resolve(__dirname, "..", "..", "drizzle", "migrations");
44
46
  await migrate(db, { migrationsFolder });
45
47
  }
46
48
  // 4. Bootstrap product config from DB (auto-seeds from presets if needed)
@@ -34,7 +34,7 @@ export function mountRoutes(app, container, config, plugins = []) {
34
34
  app.use("*", cors({
35
35
  origin: origins,
36
36
  allowMethods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
37
- allowHeaders: ["Content-Type", "Authorization", "X-Request-ID"],
37
+ allowHeaders: ["Content-Type", "Authorization", "X-Request-ID", "X-Tenant-ID", "X-Session-ID"],
38
38
  credentials: true,
39
39
  }));
40
40
  // 2. Health endpoint (always available)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wopr-network/platform-core",
3
- "version": "1.72.0",
3
+ "version": "1.72.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -379,10 +379,11 @@ describe("ProxyManager", () => {
379
379
  });
380
380
 
381
381
  describe("start rollback on failure", () => {
382
- it("calls stop() if reload fails during start()", async () => {
382
+ it("calls stop() and continues if reload fails during start()", async () => {
383
383
  vi.mocked(fetch).mockRejectedValueOnce(new Error("connection refused"));
384
384
 
385
- await expect(manager.start()).rejects.toThrow("connection refused");
385
+ // start() should NOT throw — proxy failure is non-fatal
386
+ await expect(manager.start()).resolves.toBeUndefined();
386
387
  expect(manager.isRunning).toBe(false);
387
388
  });
388
389
  });
@@ -230,8 +230,8 @@ export class ProxyManager implements ProxyManagerInterface {
230
230
  try {
231
231
  await this.reload();
232
232
  } catch (err) {
233
+ logger.warn("Proxy manager failed to connect to Caddy — continuing without proxy management", { err });
233
234
  await this.stop();
234
- throw err;
235
235
  }
236
236
  }
237
237
 
@@ -131,7 +131,9 @@ export async function buildContainer(bootConfig: BootConfig): Promise<PlatformCo
131
131
  if (!bootConfig.pool) {
132
132
  const { migrate } = await import("drizzle-orm/node-postgres/migrator");
133
133
  const path = await import("node:path");
134
- const migrationsFolder = path.resolve(path.dirname(new URL(import.meta.url).pathname), "../../drizzle");
134
+ const { fileURLToPath } = await import("node:url");
135
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
136
+ const migrationsFolder = path.resolve(__dirname, "..", "..", "drizzle", "migrations");
135
137
  await migrate(db as never, { migrationsFolder });
136
138
  }
137
139
 
@@ -57,7 +57,7 @@ export function mountRoutes(
57
57
  cors({
58
58
  origin: origins,
59
59
  allowMethods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
60
- allowHeaders: ["Content-Type", "Authorization", "X-Request-ID"],
60
+ allowHeaders: ["Content-Type", "Authorization", "X-Request-ID", "X-Tenant-ID", "X-Session-ID"],
61
61
  credentials: true,
62
62
  }),
63
63
  );