@ossy/platform 1.38.0 → 1.38.1

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": "@ossy/platform",
3
- "version": "1.38.0",
3
+ "version": "1.38.1",
4
4
  "description": "Ossy application server runtime",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,13 +38,13 @@
38
38
  "@aws-sdk/s3-request-presigner": "^3.1057.0",
39
39
  "@aws-sdk/util-create-request": "^3.972.26",
40
40
  "@aws-sdk/util-format-url": "^3.972.17",
41
- "@ossy/event-store": "^1.7.0",
42
- "@ossy/observability": "^1.7.0",
43
- "@ossy/policies": "^1.12.0",
44
- "@ossy/router": "^1.39.0",
45
- "@ossy/sdk": "^1.39.0",
46
- "@ossy/tokens": "^1.12.0",
47
- "@ossy/users": "^1.12.0",
41
+ "@ossy/event-store": "^1.7.1",
42
+ "@ossy/observability": "^1.7.1",
43
+ "@ossy/policies": "^1.12.1",
44
+ "@ossy/router": "^1.39.1",
45
+ "@ossy/sdk": "^1.39.1",
46
+ "@ossy/tokens": "^1.12.1",
47
+ "@ossy/users": "^1.12.1",
48
48
  "cookie-parser": "^1.4.7",
49
49
  "dotenv": ">=16.0.0 <18.0.0",
50
50
  "express": ">=5.0.0 <6.0.0",
@@ -62,5 +62,5 @@
62
62
  "src",
63
63
  "Dockerfile"
64
64
  ],
65
- "gitHead": "150285065e45f9be2ee19794e493abc50cd85e44"
65
+ "gitHead": "b9708c9c3f368bb642fc3bb76912a68107db24b9"
66
66
  }
@@ -1,4 +1,4 @@
1
- import { createLogger } from '@ossy/observability'
1
+ import { createLogger, registerBackend, clearBackends } from '@ossy/observability'
2
2
 
3
3
  const log = createLogger('platform')
4
4
 
@@ -22,6 +22,9 @@ export const IntegrationService = {
22
22
  * @param {NodeJS.ProcessEnv} env Usually `process.env`.
23
23
  */
24
24
  async load (modules, env) {
25
+ /** @type {Array<unknown>} */
26
+ const loggerBackends = []
27
+
25
28
  for (const mod of modules) {
26
29
  const { id, credentials = [], connect } = mod
27
30
 
@@ -30,7 +33,9 @@ export const IntegrationService = {
30
33
  continue
31
34
  }
32
35
 
33
- const missing = credentials.filter((key) => !env[key])
36
+ // An env var set to an empty string is treated as "present" — only
37
+ // vars that are completely absent from the environment are considered missing.
38
+ const missing = credentials.filter((key) => !(key in env))
34
39
  if (missing.length > 0) {
35
40
  log.warn(
36
41
  `[IntegrationService] Skipping integration "${id}" — missing env var(s): ${missing.join(', ')}`,
@@ -39,14 +44,31 @@ export const IntegrationService = {
39
44
  }
40
45
 
41
46
  try {
42
- _clients[id] = await connect({ env })
47
+ const client = await connect({ env })
48
+ _clients[id] = client
43
49
  log.info(`[IntegrationService] Connected integration "${id}"`)
50
+
51
+ // Logger integrations (id prefix "logger-") return a Backend object with
52
+ // info/warn/error/debug methods. Collect them so we can replace the
53
+ // default console backend with the full set of connected backends below.
54
+ if (id.startsWith('logger-') && client && typeof client.info === 'function') {
55
+ loggerBackends.push(client)
56
+ }
44
57
  } catch (err) {
45
58
  log.warn(
46
59
  `[IntegrationService] Integration "${id}" connect() failed — skipping: ${err && err.message ? err.message : err}`,
47
60
  )
48
61
  }
49
62
  }
63
+
64
+ // Replace the built-in default backend with the connected logger backends.
65
+ // If no logger integrations connected, the default backend stays in place.
66
+ if (loggerBackends.length > 0) {
67
+ clearBackends()
68
+ for (const backend of loggerBackends) {
69
+ registerBackend(backend)
70
+ }
71
+ }
50
72
  },
51
73
 
52
74
  /**