@yrpri/api 9.0.201 → 9.0.203

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/models/index.cjs CHANGED
@@ -31,12 +31,24 @@ const operatorsAliases = {
31
31
  $contains: Op.contains,
32
32
  $any: Op.any,
33
33
  };
34
+ // Pool configuration from environment variables
35
+ const poolConfig = {
36
+ max: parseInt(process.env.DB_POOL_MAX ?? "5", 10),
37
+ min: parseInt(process.env.DB_POOL_MIN ?? "5", 10),
38
+ acquire: parseInt(process.env.DB_POOL_ACQUIRE_MS ?? "30000", 10),
39
+ idle: parseInt(process.env.DB_POOL_IDLE_MS ?? "10000", 10),
40
+ };
41
+ if (poolConfig.min > poolConfig.max) {
42
+ logger_cjs_1.default.error(`DB_POOL_MIN (${poolConfig.min}) cannot be greater than DB_POOL_MAX (${poolConfig.max})`);
43
+ process.exit(1);
44
+ }
34
45
  if (process.env.NODE_ENV === "production") {
35
46
  if (process.env.DISABLE_PG_SSL) {
36
47
  logger_cjs_1.default.debug("Creating Sequelize instance with DISABLE_PG_SSL");
37
48
  sequelize = new Sequelize(process.env.DATABASE_URL, {
38
49
  dialect: "postgres",
39
50
  minifyAliases: true,
51
+ pool: poolConfig,
40
52
  logging: process.env.YP_LOG_SQL === "true" ? console.log : false,
41
53
  operatorsAliases,
42
54
  });
@@ -47,6 +59,7 @@ if (process.env.NODE_ENV === "production") {
47
59
  dialect: "postgres",
48
60
  dialectOptions: { ssl: { rejectUnauthorized: false } },
49
61
  minifyAliases: true,
62
+ pool: poolConfig,
50
63
  logging: process.env.YP_LOG_SQL === "true" ? console.log : false,
51
64
  operatorsAliases,
52
65
  });
@@ -62,6 +75,7 @@ else {
62
75
  port: process.env.YP_DEV_DATABASE_PORT,
63
76
  minifyAliases: true,
64
77
  dialectOptions: { ssl: false, rejectUnauthorized: false },
78
+ pool: poolConfig,
65
79
  logging: process.env.YP_LOG_SQL === "true" ? console.log : false,
66
80
  operatorsAliases,
67
81
  });
@@ -71,6 +85,7 @@ else {
71
85
  process.exit(1);
72
86
  }
73
87
  }
88
+ logger_cjs_1.default.info(`DB Pool configured: max=${poolConfig.max}, min=${poolConfig.min}, acquire=${poolConfig.acquire}ms, idle=${poolConfig.idle}ms`);
74
89
  // -----------------------------------------------------------------------------
75
90
  // Model loading
76
91
  // -----------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yrpri/api",
3
- "version": "9.0.201",
3
+ "version": "9.0.203",
4
4
  "license": "MIT",
5
5
  "author": "Robert Bjarnason & Citizens Foundation",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "@google-cloud/vertexai": "^1.10.0",
26
26
  "@google-cloud/vision": "^5.1.0",
27
27
  "@node-saml/passport-saml": "^5.0.1",
28
- "@policysynth/agents": "^1.3.160",
28
+ "@policysynth/agents": "^1.3.162",
29
29
  "async": "^3.2.6",
30
30
  "authorized": "^1.0.0",
31
31
  "aws-sdk": "^2.1692.0",
@@ -1,3 +1,3 @@
1
- export function replaceBetterReykjavikCategoryId(id: any): 1 | 2 | 5 | 4 | 7 | 3 | 6 | 10 | 8 | 12 | 9 | 11 | 13 | undefined;
1
+ export function replaceBetterReykjavikCategoryId(id: any): 10 | 1 | 2 | 5 | 4 | 7 | 3 | 6 | 8 | 12 | 9 | 11 | 13 | undefined;
2
2
  export function clean(string: any): any;
3
3
  export function shuffleArray(array: any): any;