@runeya/runeya 2.0.49 → 2.0.50

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-JBR3MGS7.js";
4
+ export {
5
+ agentManager
6
+ };
7
+ //# sourceMappingURL=agent-manager-ABEKUAWR.js.map
@@ -442,7 +442,7 @@ var agentStore = new AgentStore();
442
442
 
443
443
  // ../server/src/services/service-store.ts
444
444
  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";
445
+ import { readFile as readFile4, writeFile as writeFile4, rename as rename3, mkdir as mkdir4, chmod as chmod3, rm as rm2 } from "fs/promises";
446
446
  import { join as join3 } from "path";
447
447
 
448
448
  // ../server/src/services/project-key.ts
@@ -555,7 +555,7 @@ function isVaultConflicted(root) {
555
555
 
556
556
  // ../server/src/services/environment-store.ts
557
557
  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";
558
+ import { readFile as readFile3, writeFile as writeFile3, rename as rename2, mkdir as mkdir3, chmod as chmod2, rm } from "fs/promises";
559
559
  import { join as join2 } from "path";
560
560
 
561
561
  // ../server/src/services/crypto-helpers.ts
@@ -2091,8 +2091,9 @@ var EnvironmentStore = class {
2091
2091
  /**
2092
2092
  * Write each vault that holds — or held — an environment.
2093
2093
  *
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.
2094
+ * A vault emptied by this save loses its file: an environment that moved to
2095
+ * another vault must not survive in the old one, and a `[]` left behind would
2096
+ * keep (or recreate) a `.runeya` in a directory that holds nothing.
2096
2097
  */
2097
2098
  async save() {
2098
2099
  const byRoot = /* @__PURE__ */ new Map();
@@ -2111,8 +2112,13 @@ var EnvironmentStore = class {
2111
2112
  else byRoot.set(root, [prepared]);
2112
2113
  }
2113
2114
  for (const [root, environments] of byRoot) {
2114
- await mkdir3(root, { recursive: true });
2115
2115
  const filePath = this.getFilePath(root);
2116
+ if (environments.length === 0) {
2117
+ await rm(filePath, { force: true }).catch(() => {
2118
+ });
2119
+ continue;
2120
+ }
2121
+ await mkdir3(root, { recursive: true });
2116
2122
  const tmpPath = filePath + ".tmp";
2117
2123
  await writeFile3(tmpPath, JSON.stringify(environments, null, 2), "utf-8");
2118
2124
  await rename2(tmpPath, filePath);
@@ -2514,8 +2520,9 @@ var ServiceStore = class {
2514
2520
  /**
2515
2521
  * Write each vault that holds — or held — a service.
2516
2522
  *
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.
2523
+ * A vault emptied by this save loses its file: a service that moved to
2524
+ * another vault must not survive in the one it left, and a `[]` left behind
2525
+ * would keep (or recreate) a `.runeya` in a directory that holds nothing.
2519
2526
  */
2520
2527
  async save() {
2521
2528
  const byRoot = /* @__PURE__ */ new Map();
@@ -2534,8 +2541,13 @@ var ServiceStore = class {
2534
2541
  else byRoot.set(root, [prepared]);
2535
2542
  }
2536
2543
  for (const [root, services] of byRoot) {
2537
- await mkdir4(root, { recursive: true });
2538
2544
  const filePath = this.getFilePath(root);
2545
+ if (services.length === 0) {
2546
+ await rm2(filePath, { force: true }).catch(() => {
2547
+ });
2548
+ continue;
2549
+ }
2550
+ await mkdir4(root, { recursive: true });
2539
2551
  const tmpPath = filePath + ".tmp";
2540
2552
  await writeFile4(tmpPath, JSON.stringify(services, null, 2), "utf-8");
2541
2553
  await rename3(tmpPath, filePath);
@@ -3737,4 +3749,4 @@ export {
3737
3749
  traefikManager,
3738
3750
  agentManager
3739
3751
  };
3740
- //# sourceMappingURL=chunk-4AGTVGSH.js.map
3752
+ //# sourceMappingURL=chunk-JBR3MGS7.js.map