@omen.foundation/node-microservice-runtime 0.1.97 → 0.1.98

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": "@omen.foundation/node-microservice-runtime",
3
- "version": "0.1.97",
3
+ "version": "0.1.98",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -511,13 +511,27 @@ async function resolveGamePid(apiHost, token, cid, pid, explicitGamePid) {
511
511
  return pid;
512
512
  }
513
513
 
514
+ // Match C# CLI FindRoot() logic: walk up parent chain until Parent == null (root)
514
515
  const byPid = new Map(projects.map((project) => [project.pid, project]));
515
516
  let current = byPid.get(pid);
517
+ if (!current) {
518
+ if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
519
+ console.error(`[beamo-node] Realm PID not found in projects, using realm PID: ${pid}`);
520
+ }
521
+ return pid;
522
+ }
523
+
516
524
  const visited = new Set();
517
- while (current && current.parent && !visited.has(current.parent)) {
525
+ // Walk up parent chain until we find root (parent == null or isRoot == true)
526
+ while (current && (current.parent != null && current.parent !== '' && !current.isRoot) && !visited.has(current.parent)) {
518
527
  visited.add(current.pid);
519
528
  current = byPid.get(current.parent);
529
+ if (!current) {
530
+ // Parent not found in projects list, current is as far as we can go
531
+ break;
532
+ }
520
533
  }
534
+ // current is now the root (or the original if no parent chain)
521
535
  const resolved = current?.pid ?? pid;
522
536
 
523
537
  if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {