@naisys/erp 3.0.0-beta.15 → 3.0.0-beta.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.
@@ -33,8 +33,11 @@
33
33
  <meta name="format-detection" content="telephone=no" />
34
34
 
35
35
  <title>NAISYS ERP</title>
36
- <script type="module" crossorigin src="/erp/assets/index-C9uuPHLH.js"></script>
37
- <link rel="stylesheet" crossorigin href="/erp/assets/index-45dVo30p.css">
36
+ <script type="module" crossorigin src="/erp/assets/index-CZhFlAkg.js"></script>
37
+ <link rel="modulepreload" crossorigin href="/erp/assets/rolldown-runtime-CvHMtSRF.js">
38
+ <link rel="modulepreload" crossorigin href="/erp/assets/vendor-DdMxejie.js">
39
+ <link rel="stylesheet" crossorigin href="/erp/assets/vendor-CLUPjUnv.css">
40
+ <link rel="stylesheet" crossorigin href="/erp/assets/index-CSiMTJfw.css">
38
41
  </head>
39
42
  <body>
40
43
  <div id="root"></div>
package/dist/erpServer.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "dotenv/config";
2
2
  import "./schema-registry.js";
3
- import { expandNaisysFolder } from "@naisys/common-node";
3
+ import { ensureDotEnv, expandNaisysFolder } from "@naisys/common-node";
4
4
  expandNaisysFolder();
5
5
  // Important to load dotenv before any other imports, to ensure environment variables are available
6
6
  import cookie from "@fastify/cookie";
@@ -315,6 +315,7 @@ if (process.argv[1] === fileURLToPath(import.meta.url)) {
315
315
  }
316
316
  }
317
317
  else {
318
+ await ensureDotEnv(new URL("../.env.example", import.meta.url));
318
319
  void startServer();
319
320
  }
320
321
  }
@@ -1,13 +1,15 @@
1
1
  import { createReadStream, existsSync, statSync } from "node:fs";
2
2
  import fs from "node:fs/promises";
3
3
  import { AdminAttachmentListRequestSchema, AdminAttachmentListResponseSchema, AdminInfoResponseSchema, ErrorResponseSchema, ServerLogRequestSchema, ServerLogResponseSchema, } from "@naisys/erp-shared";
4
+ import { getHubVariable } from "@naisys/hub-database";
4
5
  import { z } from "zod/v4";
5
6
  import { hasPermission, requirePermission } from "../auth-middleware.js";
6
- import { erpDbPath } from "../dbConfig.js";
7
+ import { ERP_DB_VERSION, erpDbPath } from "../dbConfig.js";
7
8
  import erpDb from "../erpDb.js";
8
9
  import { notFound } from "../error-handler.js";
9
10
  import { paginationLinks } from "../hateoas.js";
10
11
  import { getErpLogPath, tailLogFile } from "../services/log-file-service.js";
12
+ import { getPackageVersion } from "../version.js";
11
13
  const API_PREFIX = "/erp/api";
12
14
  function adminActions(hasAdminPermission) {
13
15
  const actions = [];
@@ -44,13 +46,19 @@ export default function adminRoutes(fastify, _options) {
44
46
  const hasAdminPerm = hasPermission(request.erpUser, "erp_admin");
45
47
  const actions = adminActions(hasAdminPerm);
46
48
  const dbPath = erpDbPath();
47
- const erpDbSize = await fs
48
- .stat(dbPath)
49
- .then((s) => s.size)
50
- .catch(() => undefined);
49
+ const [erpDbSize, targetVersion] = await Promise.all([
50
+ fs
51
+ .stat(dbPath)
52
+ .then((s) => s.size)
53
+ .catch(() => undefined),
54
+ getHubVariable("TARGET_VERSION"),
55
+ ]);
51
56
  return {
57
+ erpVersion: getPackageVersion(),
52
58
  erpDbPath: dbPath,
53
59
  erpDbSize,
60
+ erpDbVersion: ERP_DB_VERSION,
61
+ targetVersion: targetVersion || undefined,
54
62
  _actions: actions.length > 0 ? actions : undefined,
55
63
  };
56
64
  });
@@ -0,0 +1,12 @@
1
+ import { getGitCommitHash } from "@naisys/common-node";
2
+ import { readFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ // Read the server's own package.json (one level up from dist/)
7
+ const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
8
+ const commitHash = getGitCommitHash(__dirname);
9
+ export function getPackageVersion() {
10
+ return commitHash ? `${pkg.version}/${commitHash}` : pkg.version;
11
+ }
12
+ //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naisys/erp",
3
- "version": "3.0.0-beta.15",
3
+ "version": "3.0.0-beta.17",
4
4
  "description": "NAISYS ERP - Web UI for AI-driven order and work management",
5
5
  "type": "module",
6
6
  "main": "dist/erpServer.js",
@@ -11,7 +11,7 @@
11
11
  ".": "./dist/erpServer.js"
12
12
  },
13
13
  "scripts": {
14
- "clean": "rimraf dist client-dist .test-naisys",
14
+ "clean": "npx rimraf dist client-dist .test-naisys",
15
15
  "dev": "tsx watch src/erpServer.ts",
16
16
  "build": "prisma generate && tsc",
17
17
  "bundle": "npx shx rm -rf client-dist && npx shx cp -r ../client/dist client-dist",
@@ -29,6 +29,7 @@
29
29
  "dist",
30
30
  "client-dist",
31
31
  "bin",
32
+ ".env.example",
32
33
  "prisma.config.ts",
33
34
  "prisma/schema.prisma",
34
35
  "prisma/migrations",
@@ -45,11 +46,11 @@
45
46
  "@fastify/rate-limit": "^10.3.0",
46
47
  "@fastify/static": "^9.0.0",
47
48
  "@fastify/swagger": "^9.7.0",
48
- "@naisys/erp-shared": "3.0.0-beta.15",
49
- "@naisys/common": "3.0.0-beta.15",
50
- "@naisys/common-node": "3.0.0-beta.15",
51
- "@naisys/hub-database": "3.0.0-beta.15",
52
- "@naisys/supervisor-database": "3.0.0-beta.15",
49
+ "@naisys/erp-shared": "3.0.0-beta.17",
50
+ "@naisys/common": "3.0.0-beta.17",
51
+ "@naisys/common-node": "3.0.0-beta.17",
52
+ "@naisys/hub-database": "3.0.0-beta.17",
53
+ "@naisys/supervisor-database": "3.0.0-beta.17",
53
54
  "@prisma/adapter-better-sqlite3": "^7.5.0",
54
55
  "@prisma/client": "^7.5.0",
55
56
  "@scalar/fastify-api-reference": "^1.48.7",