@lensmcp/cluster 1.13.0 → 1.15.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../../../libs/cluster/src/executors/gateway/runtime/lifecycle.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAChC,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,2EAA2E;IAC3E,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC;CAChC;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAsIvF"}
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../../../libs/cluster/src/executors/gateway/runtime/lifecycle.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0BrD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAChC,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,2EAA2E;IAC3E,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC;CAChC;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAuIvF"}
@@ -12,6 +12,30 @@ const fs = tslib_1.__importStar(require("node:fs"));
12
12
  const http = tslib_1.__importStar(require("node:http"));
13
13
  const path = tslib_1.__importStar(require("node:path"));
14
14
  const discovery_1 = require("./discovery");
15
+ const service_keys_1 = require("./service-keys");
16
+ /**
17
+ * The east-west env a pod needs to call ANOTHER service's `internal.<host>` route (memberships, settings,
18
+ * plan): (1) its OWN per-service key — presented as `x-api-key`; the gateway maps it back to the caller and
19
+ * stamps `x-api-key-id` (a service can't forge another's identity). (2) `NODE_EXTRA_CA_CERTS` = the dev
20
+ * gateway's self-signed CA, so the pod's OUTBOUND `fetch('https://internal.<host>')` clears TLS. Without
21
+ * these the call fails (connect/TLS or a gateway 401) and tenant-token minting can't resolve the role.
22
+ * NOT `INTERNAL_API_KEY`/`LENSMCP_INTERNAL_TOKEN` (those would flip ON the inbound gateway-trust guard) —
23
+ * a DEDICATED name a service opts into for OUTBOUND only, leaving inbound dev-standalone behavior unchanged.
24
+ */
25
+ function eastWestEnv(rt, project) {
26
+ const env = {};
27
+ const key = rt.serviceKeys[project];
28
+ if (key)
29
+ env.LENSMCP_SERVICE_KEY = key;
30
+ if (rt.https) {
31
+ // eslint-disable-next-line @typescript-eslint/no-require-imports -- lazy like server.ts (cert deps)
32
+ const basicSsl = require('../../../basic-ssl');
33
+ const caPath = basicSsl.caCertPath((0, service_keys_1.gatewayCacheDir)(rt.root));
34
+ if (fs.existsSync(caPath))
35
+ env.NODE_EXTRA_CA_CERTS = caPath;
36
+ }
37
+ return env;
38
+ }
15
39
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
16
40
  function createServiceLayer(rt, obs) {
17
41
  const { emit } = obs;
@@ -35,8 +59,9 @@ function createServiceLayer(rt, obs) {
35
59
  // daemon (a DIFFERENT group), so the later process-group kill reaps only
36
60
  // the `yarn nx` shim and orphans the devserver + pod tree — the classic
37
61
  // "idle-kill leaves live pods" leak. (--childCount as a CLI arg already
38
- // avoids the env-loss the daemon was relied on for.)
39
- env: { ...process.env, NX_DAEMON: 'false' },
62
+ // avoids the env-loss the daemon was relied on for.) NX_DAEMON=false also
63
+ // means env vars DO reach the pod, so the east-west key + CA propagate.
64
+ env: { ...process.env, NX_DAEMON: 'false', ...eastWestEnv(rt, svc.project) },
40
65
  stdio: ['ignore', 'pipe', 'pipe'],
41
66
  });
42
67
  svc.lastErrors = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/cluster",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "Run your Nx workspace as a local production cluster: pods on unix sockets with true HMR, one https gateway with per-project domains, scale-from-zero, autoscale, idle-kill, local-CA TLS — observed by the LensMCP lens.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -65,8 +65,8 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "@lensmcp/node-instrumentation": "1.13.0",
69
- "@lensmcp/nx-plugin": "1.13.0",
68
+ "@lensmcp/node-instrumentation": "1.15.0",
69
+ "@lensmcp/nx-plugin": "1.15.0",
70
70
  "fork-ts-checker-webpack-plugin": "^9.0.0",
71
71
  "glob": "^11.0.0",
72
72
  "http-proxy": "^1.18.0",