@social-mail/social-mail-web-server 1.4.779 → 1.4.780

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.4.779",
3
+ "version": "1.4.780",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@aws-sdk/client-s3": "^3.609.0",
23
23
  "@azure/storage-blob": "^12.23.0",
24
- "@entity-access/entity-access": "^1.0.339",
24
+ "@entity-access/entity-access": "^1.0.341",
25
25
  "@entity-access/server-pages": "^1.1.220",
26
26
  "@otplib/preset-v11": "^12.0.1",
27
27
  "@social-mail/noto-emoji-svg": "^2.0.42",
package/src/WebServer.ts CHANGED
@@ -182,7 +182,7 @@ export default class WebServer {
182
182
 
183
183
  async seed() {
184
184
  await seed();
185
- await globalServices.resolve(WorkflowContext).storage.seed();
185
+ await globalServices.resolve(WorkflowContext).storage.seed(globalEnv.version);
186
186
  }
187
187
 
188
188
  registerRoutes(server: ServerPages) {
@@ -1,5 +1,13 @@
1
+ import { readFileSync } from "node:fs";
1
2
  import { availableParallelism } from "node:os";
3
+ import { join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
2
5
 
6
+ const packageJsonPath = join(fileURLToPath(import.meta.url), "../../../package.json");
7
+
8
+ const packageJson = JSON.parse(readFileSync(packageJsonPath , "utf8"));
9
+
10
+ const { version } = packageJson;
3
11
 
4
12
  const isTestMode = (process.env.LOGGER_SERVER_TEST_MODE ?? "false") === "true";
5
13
 
@@ -10,6 +18,7 @@ if (Number.isNaN(port)) {
10
18
 
11
19
  export const globalEnv = {
12
20
  protocol: void 0,
21
+ version,
13
22
  host: process.env.SOCIAL_MAIL_HOST,
14
23
  cdn: process.env.SOCIAL_MAIL_CDN,
15
24
  path: process.env.SOCIAL_MAIL_PATH || "/",
@@ -17,13 +17,15 @@ export default async function seed() {
17
17
  // making sure multiple workers don't interfere
18
18
  using fl = await LockFile.lock(`seed-lock-${globalEnv.serverID}.lock`);
19
19
 
20
+ const migrationConfig = { version: globalEnv.version };
21
+
20
22
  const lc = scope.resolve(DbLockContext);
21
23
  await lc.connection.ensureDatabase();
22
- await lc.connection.automaticMigrations().migrate(lc);
24
+ await lc.connection.automaticMigrations().migrate(lc, migrationConfig);
23
25
 
24
26
  const context = scope.resolve(SocialMailContext);
25
27
  await context.connection.ensureDatabase();
26
- await context.connection.automaticMigrations().migrate(context);
28
+ await context.connection.automaticMigrations().migrate(context, migrationConfig);
27
29
 
28
30
 
29
31
  context.verifyFilters = false;