@runeya/runeya 2.0.49 → 2.0.51

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.
@@ -0,0 +1,7 @@
1
+ import {
2
+ agentManager
3
+ } from "./chunk-NVKGIBJN.js";
4
+ export {
5
+ agentManager
6
+ };
7
+ //# sourceMappingURL=agent-manager-KX5MSTAK.js.map
@@ -96,11 +96,8 @@ function vaultFor(target) {
96
96
  var ORG_CLOUD_FILE = "cloud.json";
97
97
  async function stampOrgCloud(orgId, cloudUrl) {
98
98
  const root = orgVaultRoot(orgId);
99
- try {
100
- await mkdir(root, { recursive: true });
101
- await writeFile(join(root, ORG_CLOUD_FILE), JSON.stringify({ cloudUrl }, null, 2), "utf-8");
102
- } catch {
103
- }
99
+ await mkdir(root, { recursive: true });
100
+ await writeFile(join(root, ORG_CLOUD_FILE), JSON.stringify({ cloudUrl }, null, 2), "utf-8");
104
101
  }
105
102
  async function readOrgClouds() {
106
103
  const orgsDir = join(machineRoot(), "orgs");
@@ -442,7 +439,7 @@ var agentStore = new AgentStore();
442
439
 
443
440
  // ../server/src/services/service-store.ts
444
441
  import { randomUUID as randomUUID3 } from "crypto";
445
- import { readFile as readFile4, writeFile as writeFile4, rename as rename3, mkdir as mkdir4, chmod as chmod3 } from "fs/promises";
442
+ import { readFile as readFile4, writeFile as writeFile4, rename as rename3, mkdir as mkdir4, chmod as chmod3, rm as rm2 } from "fs/promises";
446
443
  import { join as join3 } from "path";
447
444
 
448
445
  // ../server/src/services/project-key.ts
@@ -555,7 +552,7 @@ function isVaultConflicted(root) {
555
552
 
556
553
  // ../server/src/services/environment-store.ts
557
554
  import { randomUUID as randomUUID2 } from "crypto";
558
- import { readFile as readFile3, writeFile as writeFile3, rename as rename2, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
555
+ import { readFile as readFile3, writeFile as writeFile3, rename as rename2, mkdir as mkdir3, chmod as chmod2, rm } from "fs/promises";
559
556
  import { join as join2 } from "path";
560
557
 
561
558
  // ../server/src/services/crypto-helpers.ts
@@ -2091,8 +2088,9 @@ var EnvironmentStore = class {
2091
2088
  /**
2092
2089
  * Write each vault that holds — or held — an environment.
2093
2090
  *
2094
- * Vaults emptied by this save are still written, as an empty list: an
2095
- * environment that moved to another vault must not survive in the old one.
2091
+ * A vault emptied by this save loses its file: an environment that moved to
2092
+ * another vault must not survive in the old one, and a `[]` left behind would
2093
+ * keep (or recreate) a `.runeya` in a directory that holds nothing.
2096
2094
  */
2097
2095
  async save() {
2098
2096
  const byRoot = /* @__PURE__ */ new Map();
@@ -2111,8 +2109,13 @@ var EnvironmentStore = class {
2111
2109
  else byRoot.set(root, [prepared]);
2112
2110
  }
2113
2111
  for (const [root, environments] of byRoot) {
2114
- await mkdir3(root, { recursive: true });
2115
2112
  const filePath = this.getFilePath(root);
2113
+ if (environments.length === 0) {
2114
+ await rm(filePath, { force: true }).catch(() => {
2115
+ });
2116
+ continue;
2117
+ }
2118
+ await mkdir3(root, { recursive: true });
2116
2119
  const tmpPath = filePath + ".tmp";
2117
2120
  await writeFile3(tmpPath, JSON.stringify(environments, null, 2), "utf-8");
2118
2121
  await rename2(tmpPath, filePath);
@@ -2514,8 +2517,9 @@ var ServiceStore = class {
2514
2517
  /**
2515
2518
  * Write each vault that holds — or held — a service.
2516
2519
  *
2517
- * A vault emptied by this save is still written, as an empty list: a service
2518
- * that moved to another vault must not survive in the one it left.
2520
+ * A vault emptied by this save loses its file: a service that moved to
2521
+ * another vault must not survive in the one it left, and a `[]` left behind
2522
+ * would keep (or recreate) a `.runeya` in a directory that holds nothing.
2519
2523
  */
2520
2524
  async save() {
2521
2525
  const byRoot = /* @__PURE__ */ new Map();
@@ -2534,8 +2538,13 @@ var ServiceStore = class {
2534
2538
  else byRoot.set(root, [prepared]);
2535
2539
  }
2536
2540
  for (const [root, services] of byRoot) {
2537
- await mkdir4(root, { recursive: true });
2538
2541
  const filePath = this.getFilePath(root);
2542
+ if (services.length === 0) {
2543
+ await rm2(filePath, { force: true }).catch(() => {
2544
+ });
2545
+ continue;
2546
+ }
2547
+ await mkdir4(root, { recursive: true });
2539
2548
  const tmpPath = filePath + ".tmp";
2540
2549
  await writeFile4(tmpPath, JSON.stringify(services, null, 2), "utf-8");
2541
2550
  await rename3(tmpPath, filePath);
@@ -3737,4 +3746,4 @@ export {
3737
3746
  traefikManager,
3738
3747
  agentManager
3739
3748
  };
3740
- //# sourceMappingURL=chunk-4AGTVGSH.js.map
3749
+ //# sourceMappingURL=chunk-NVKGIBJN.js.map