@runeya/runeya 1.33.20 → 1.33.22

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.
Files changed (107) hide show
  1. package/node-red-contrib-runeya.tar +0 -0
  2. package/package.json +1 -1
  3. package/public/assets/{App-BVTb2f1U.css → App-BGPtogo-.css} +1 -1
  4. package/public/assets/App-Bj3c8ECd.js +101 -0
  5. package/public/assets/Bugs-B6LM8YSZ.js +1 -0
  6. package/public/assets/Bugs-DZVuTDKA.css +1 -0
  7. package/public/assets/Configs-CRGDsvnb.js +464 -0
  8. package/public/assets/Configs-DdBteQMK.css +1 -0
  9. package/public/assets/CurrentEditor-DI0XEvLu.js +1 -0
  10. package/public/assets/DynamicComponent-CmXZUvVU.js +1 -0
  11. package/public/assets/DynamicComponent-DgxRO4Pl.css +1 -0
  12. package/public/assets/{Editor-Ck3cFVn3.js → Editor-CBZeVePs.js} +7 -7
  13. package/public/assets/{Editor-BC23IeB6.css → Editor-CPPFMOjb.css} +1 -1
  14. package/public/assets/Git-Cf-zgTWr.js +11 -0
  15. package/public/assets/Git-UQIt5ANe.css +1 -0
  16. package/public/assets/ImportCreate-DZSPN5cY.js +1 -0
  17. package/public/assets/Index-BJieQWaU.js +1 -0
  18. package/public/assets/Index-BcFahN3S.css +1 -0
  19. package/public/assets/Index-BrbegLuT.js +1 -0
  20. package/public/assets/Index-C3gFkhHj.js +1 -0
  21. package/public/assets/Index-C66tLKvy.css +1 -0
  22. package/public/assets/Index-Cd-qd5VG.css +1 -0
  23. package/public/assets/Index-Cg-pTjT5.js +1 -0
  24. package/public/assets/Index-CvhWs0kp.css +1 -0
  25. package/public/assets/Index-D67OAIVa.js +314 -0
  26. package/public/assets/Index-DZ8CXixy.js +1 -0
  27. package/public/assets/{Init-Lt-2DFbi.js → Init-BILP6lrr.js} +1 -1
  28. package/public/assets/{LeftLogo-fTp83qX1.js → LeftLogo-BCYb654E.js} +1 -1
  29. package/public/assets/Logs-BfqPcp-L.js +74 -0
  30. package/public/assets/Logs-BhdfGaw5.css +32 -0
  31. package/public/assets/{Markdown-CNWZoHio.js → Markdown-CuewGlVj.js} +19 -103
  32. package/public/assets/Modal-CGUZawhK.css +1 -0
  33. package/public/assets/Modal-DmKdmCtc.js +1 -0
  34. package/public/assets/Modals-BHTrmB19.js +1 -0
  35. package/public/assets/NotUpToDate-CnmuPdX-.js +1 -0
  36. package/public/assets/NotUpToDate-Dh9RbAwK.css +1 -0
  37. package/public/assets/Npm-HBPCi13F.js +1 -0
  38. package/public/assets/Npm-KBzO1DYv.css +1 -0
  39. package/public/assets/Overview-CRtTdDEz.js +1 -0
  40. package/public/assets/Overview-DZIOmzKx.css +1 -0
  41. package/public/assets/{Section-BC6pA1HZ.js → Section-OccJuk7A.js} +1 -1
  42. package/public/assets/{Settings-Dp_ktsgs.js → Settings-CgEyOTsE.js} +6 -6
  43. package/public/assets/{Settings-BBbk67zT.css → Settings-DUCkJDco.css} +1 -1
  44. package/public/assets/Spinner-BMGbc3X9.js +1 -0
  45. package/public/assets/Spinner-BZXOybIg.css +1 -0
  46. package/public/assets/StackChooser-DBof37zx.js +1 -0
  47. package/public/assets/{StackChooser-CsNxPvyi.js → StackChooser-PJ4_aCX-.js} +1 -1
  48. package/public/assets/StackMultiple-CiXqkibR.css +1 -0
  49. package/public/assets/{StackMultiple-BeZmv6DX.js → StackMultiple-D0bM6dXR.js} +17 -17
  50. package/public/assets/{StackSingle-DBZX9nN_.css → StackSingle-BVHxvisP.css} +1 -1
  51. package/public/assets/StackSingle-D1Yk8PXD.js +1 -0
  52. package/public/assets/{Tabs-fu2myJd9.css → Tabs-BGPqRkjE.css} +1 -1
  53. package/public/assets/Tabs-DQDvjS5y.js +1 -0
  54. package/public/assets/Theme-CzHFcMoz.js +1 -0
  55. package/public/assets/Toolbox-B5KXz4eX.css +1 -0
  56. package/public/assets/Toolbox-C5XEPDmg.js +1 -0
  57. package/public/assets/_baseFor-DiPelG4M.js +1 -0
  58. package/public/assets/_commonjsHelpers-D6-XlEtG.js +1 -0
  59. package/public/assets/{cssMode-DptFVzSA.js → cssMode-CccHpseG.js} +1 -1
  60. package/public/assets/currentEditor-DKB6Zox9.js +1 -0
  61. package/public/assets/dayjs.min-CfWDS3UC.js +1 -0
  62. package/public/assets/{freemarker2-Nj-3NhAz.js → freemarker2-DSPhVVzD.js} +1 -1
  63. package/public/assets/fs-CwxHstJI.js +1 -0
  64. package/public/assets/{handlebars-DccXq6O-.js → handlebars-1zANa-F3.js} +1 -1
  65. package/public/assets/{html-BFezHwqy.js → html-fsS26eC3.js} +1 -1
  66. package/public/assets/{htmlMode-8pIWMfce.js → htmlMode-DvnqyT9t.js} +1 -1
  67. package/public/assets/index-0X67tmWL.js +82 -0
  68. package/public/assets/index-B3Vh_zdc.js +1454 -0
  69. package/public/assets/index-B614CRIK.js +201 -0
  70. package/public/assets/index-BO82C_5u.js +720 -0
  71. package/public/assets/index-Brqxsm84.js +308 -0
  72. package/public/assets/index-CILDVkDy.js +310 -0
  73. package/public/assets/{index--FPUu8lq.css → index-D9v3u7Fv.css} +1 -1
  74. package/public/assets/index-DcbuCmxJ.js +84 -0
  75. package/public/assets/{index-DVXSyllr.js → index-G_rNbFve.js} +2 -2
  76. package/public/assets/index-d75RPzOA.js +176 -0
  77. package/public/assets/index-uWoKtv9r.js +2 -0
  78. package/public/assets/{javascript-B0mQdjwH.js → javascript-DRHvp6-v.js} +1 -1
  79. package/public/assets/json-tree-view-vue3.es-DVJTi2Rq.js +1 -0
  80. package/public/assets/{jsonMode-BuKXiIei.js → jsonMode-CJHmEzcn.js} +1 -1
  81. package/public/assets/{liquid-9G58QM1k.js → liquid-V1Od9uns.js} +1 -1
  82. package/public/assets/lodash-D2RHCRSL.js +27 -0
  83. package/public/assets/{mdx-DWeREtqy.js → mdx-DlWa4FFs.js} +1 -1
  84. package/public/assets/{python-BZtttaDe.js → python-DawPqpxL.js} +1 -1
  85. package/public/assets/{razor-CIhED9yj.js → razor-CrbHGO04.js} +1 -1
  86. package/public/assets/router-DPuc_QdV.css +1 -0
  87. package/public/assets/router-Dzu6a_zz.js +103 -0
  88. package/public/assets/sort-BibmqbFD.js +1 -0
  89. package/public/assets/{system-IAlLmFx7.js → system-BqvwX5_3.js} +1 -1
  90. package/public/assets/{tsMode-BMdhWjVC.js → tsMode-Cb1yqXWI.js} +1 -1
  91. package/public/assets/{typescript-DurNSXGF.js → typescript-CnZCKV3a.js} +1 -1
  92. package/public/assets/{xml-Ckok0faQ.js → xml-B90p6BQJ.js} +1 -1
  93. package/public/assets/{yaml-C2OtFevY.js → yaml-Bkk9HYtt.js} +1 -1
  94. package/public/index.html +1 -1
  95. package/www.js +144 -131
  96. package/www.js.map +1 -1
  97. package/public/assets/App-CxWYnNM-.js +0 -101
  98. package/public/assets/CurrentEditor-C38cqf-Z.js +0 -1
  99. package/public/assets/ImportCreate-DFEf3KiI.js +0 -1
  100. package/public/assets/Overview-BaSpvlXu.css +0 -1
  101. package/public/assets/Overview-DR4QmO04.js +0 -1
  102. package/public/assets/StackChooser-vHgodEvA.js +0 -1
  103. package/public/assets/StackMultiple-Dw-7UAYX.css +0 -1
  104. package/public/assets/StackSingle-Bza6Vusw.js +0 -1
  105. package/public/assets/Tabs-DMteuptw.js +0 -1
  106. package/public/assets/router-BIesWMTV.css +0 -32
  107. package/public/assets/router-BaBuIyxA.js +0 -4232
package/www.js CHANGED
@@ -102,13 +102,16 @@ var require_args = __commonJS({
102
102
  var path = require("path");
103
103
  var yargs = require("yargs/yargs");
104
104
  var { hideBin } = require("yargs/helpers");
105
- var { existsSync } = require("fs");
105
+ var { existsSync: existsSync2 } = require("fs");
106
106
  var yarg = yargs(hideBin(process.argv)).usage("Usage: <path-to-your-stack> [options]").alias("pe", "pull-env").describe("pe", "Pull env from a service (need --environment and --service)").default("pe", false).alias("e", "environment").describe("e", "Choose your environment").default("e", void 0).alias("s", "service").describe("s", "Service").default("s", void 0).alias("ss", "services").describe("ss", "Services").default("ss", []).boolean(["pe"]).string(["e", "s"]).array(["ss"]).help("h").alias("h", "help").parse();
107
+ var rootPath = path.resolve(yarg["_"]?.[0] || ".");
107
108
  var args2 = Object.assign({
108
- rootPath: path.resolve(yarg["_"]?.[0] || "."),
109
- initialCwd: ""
109
+ rootPath,
110
+ initialCwd: "",
111
+ runeyaConfigPath: path.resolve(rootPath, ".runeya"),
112
+ runeyaGlobalConfigPath: path.resolve(require("os").homedir(), ".runeya-global")
110
113
  }, yarg);
111
- if (!existsSync(args2.rootPath)) {
114
+ if (!existsSync2(args2.rootPath)) {
112
115
  console.error("Error: Runeya was launched with an invalid root path that does not exist. Please check your launch command. \nPath: ", args2.rootPath);
113
116
  process.exit(1);
114
117
  }
@@ -134,13 +137,13 @@ var require_routes = __commonJS({
134
137
  "use strict";
135
138
  var express = require("express");
136
139
  var router = express.Router();
137
- var pathfs = require("path");
140
+ var pathfs2 = require("path");
138
141
  var { fork } = require("child_process");
139
142
  module2.exports = (runeya) => {
140
143
  router.get("/bugs/:service", async (req, res) => {
141
144
  const service = runeya.findService(req.params.service);
142
145
  if (!service) return res.status(404).send("SERVICE_NOT_FOUND");
143
- const ts = fork(pathfs.resolve(__dirname, "checkJsFork"));
146
+ const ts = fork(pathfs2.resolve(__dirname, "checkJsFork"));
144
147
  ts.on("message", (results) => {
145
148
  res.json(results);
146
149
  ts.kill("SIGKILL");
@@ -157,8 +160,8 @@ var require_routes = __commonJS({
157
160
  var require_backend = __commonJS({
158
161
  "../../modules/bugs/backend/index.js"(exports2, module2) {
159
162
  "use strict";
160
- var { existsSync } = require("fs");
161
- var pathfs = require("path");
163
+ var { existsSync: existsSync2 } = require("fs");
164
+ var pathfs2 = require("path");
162
165
  var plugin = {
163
166
  enabled: true,
164
167
  name: "Bugs",
@@ -262,14 +265,14 @@ var require_reencrypt_nodered = __commonJS({
262
265
  var require_EncryptionKey = __commonJS({
263
266
  "models/EncryptionKey.js"(exports2, module2) {
264
267
  "use strict";
265
- var { existsSync } = require("fs");
268
+ var { existsSync: existsSync2 } = require("fs");
266
269
  var path = require("path");
267
270
  var { writeFile, readFile, appendFile } = require("fs/promises");
268
271
  var { randomUUID: randomUUID2 } = require("crypto");
269
272
  var dbs2 = require_dbs();
270
273
  var { generateKey, encrypt, decrypt } = require_crypto();
271
274
  var reencryptNodered = require_reencrypt_nodered();
272
- var pathfs = require("path");
275
+ var pathfs2 = require("path");
273
276
  var args2 = require_args();
274
277
  var _EncryptionKey_instances, getDb_fn;
275
278
  var EncryptionKey = class {
@@ -281,7 +284,7 @@ var require_EncryptionKey = __commonJS({
281
284
  this.encryptionKey = (await __privateMethod(this, _EncryptionKey_instances, getDb_fn).call(this).read()).encryptionKey;
282
285
  const dirname = path.dirname(await dbs2.getDb("encryption-key", { encrypted: false }).getPath());
283
286
  const gitignorePath = path.resolve(dirname, ".gitignore");
284
- if (!existsSync(gitignorePath)) {
287
+ if (!existsSync2(gitignorePath)) {
285
288
  writeFile(gitignorePath, "encryption-key.json");
286
289
  } else {
287
290
  const gitignoreFile = (await readFile(gitignorePath, "utf-8")).split("\n");
@@ -319,7 +322,7 @@ var require_EncryptionKey = __commonJS({
319
322
  const envSample = (await dbs2.getDbs("envs"))[0];
320
323
  if (envSample) await dbs2.getDb(`envs/${envSample}`).read();
321
324
  if (this.encryptionKey) {
322
- await reencryptNodered(this.encryptionKey, key, pathfs.resolve(require_stack().getRootPath(), "nodered/flow_cred.json"));
325
+ await reencryptNodered(this.encryptionKey, key, pathfs2.resolve(require_stack().getRootPath(), "nodered/flow_cred.json"));
323
326
  await dbs2.reencrypt(this.encryptionKey, key);
324
327
  }
325
328
  ;
@@ -473,16 +476,16 @@ var require_dbs = __commonJS({
473
476
  "helpers/dbs.js"(exports2, module2) {
474
477
  "use strict";
475
478
  var {
476
- existsSync,
479
+ existsSync: existsSync2,
477
480
  mkdirSync,
478
481
  writeFileSync,
479
482
  readFileSync,
480
483
  unlinkSync
481
484
  } = require("fs");
482
- var pathfs = require("path");
485
+ var pathfs2 = require("path");
483
486
  var {
484
487
  readdir,
485
- mkdir,
488
+ mkdir: mkdir2,
486
489
  writeFile,
487
490
  readFile,
488
491
  unlink
@@ -498,14 +501,14 @@ var require_dbs = __commonJS({
498
501
  __publicField(this, "cache", {});
499
502
  }
500
503
  getRootPath() {
501
- const rootPath = pathfs.resolve(args2.rootPath, ".runeya/dbs");
502
- if (!existsSync(rootPath)) mkdirSync(rootPath, { recursive: true });
504
+ const rootPath = pathfs2.resolve(args2.rootPath, ".runeya/dbs");
505
+ if (!existsSync2(rootPath)) mkdirSync(rootPath, { recursive: true });
503
506
  return rootPath;
504
507
  }
505
508
  async getDbs(namespace = "") {
506
- const pathToDbs = pathfs.resolve(this.getRootPath(), namespace);
507
- if (!existsSync(pathToDbs)) await mkdir(pathToDbs, { recursive: true });
508
- return (await readdir(pathToDbs)).map((id) => id.replace(pathfs.extname(id), "").replace(".encrypted", ""));
509
+ const pathToDbs = pathfs2.resolve(this.getRootPath(), namespace);
510
+ if (!existsSync2(pathToDbs)) await mkdir2(pathToDbs, { recursive: true });
511
+ return (await readdir(pathToDbs)).map((id) => id.replace(pathfs2.extname(id), "").replace(".encrypted", ""));
509
512
  }
510
513
  async reencrypt(oldKey, newKey) {
511
514
  const api = new fdir().withFullPaths().filter((path) => path.endsWith("encrypted.json")).crawl(this.getRootPath());
@@ -519,9 +522,9 @@ var require_dbs = __commonJS({
519
522
  }
520
523
  getDb(id, { encrypted, defaultData } = { encrypted: true, defaultData: {} }) {
521
524
  const getPath = async () => {
522
- const persistencePath = pathfs.resolve(`${this.getRootPath()}/${id}${encrypted ? ".encrypted" : ""}.json`);
523
- if (!existsSync(pathfs.dirname(persistencePath))) await mkdirSync(pathfs.dirname(persistencePath), { recursive: true });
524
- if (!existsSync(persistencePath)) {
525
+ const persistencePath = pathfs2.resolve(`${this.getRootPath()}/${id}${encrypted ? ".encrypted" : ""}.json`);
526
+ if (!existsSync2(pathfs2.dirname(persistencePath))) await mkdirSync(pathfs2.dirname(persistencePath), { recursive: true });
527
+ if (!existsSync2(persistencePath)) {
525
528
  let defaultDB = JSON.stringify(defaultData || [], null, 2);
526
529
  if (encrypted) defaultDB = await encrypt(defaultDB, { additionnalNonce: persistencePath.split(".runeya").pop() });
527
530
  await writeFile(persistencePath, defaultDB, "utf-8");
@@ -803,7 +806,7 @@ var require_backend3 = __commonJS({
803
806
  "use strict";
804
807
  var { readFile } = require("fs/promises");
805
808
  var PromiseB2 = require("bluebird");
806
- var pathfs = require("path");
809
+ var pathfs2 = require("path");
807
810
  var Documentation = require_Documentation();
808
811
  var plugin = {
809
812
  enabled: true,
@@ -1001,16 +1004,16 @@ var require_src2 = __commonJS({
1001
1004
  var require_Git = __commonJS({
1002
1005
  "../../modules/git/backend/Git.js"(exports2, module2) {
1003
1006
  "use strict";
1004
- var { existsSync } = require("fs");
1005
- var pathfs = require("path");
1007
+ var { existsSync: existsSync2 } = require("fs");
1008
+ var pathfs2 = require("path");
1006
1009
  var { execAsync, execAsyncWithoutErr } = require_exec();
1007
1010
  var HTTPError = require_src2();
1008
1011
  var Git = (runeya) => {
1009
1012
  const { findService } = runeya;
1010
1013
  const searchGit = (path) => {
1011
- if (existsSync(pathfs.resolve(path, ".git"))) return path;
1012
- const parentPath = pathfs.resolve(path, "..");
1013
- if (parentPath === pathfs.resolve("/")) return null;
1014
+ if (existsSync2(pathfs2.resolve(path, ".git"))) return path;
1015
+ const parentPath = pathfs2.resolve(path, "..");
1016
+ if (parentPath === pathfs2.resolve("/")) return null;
1014
1017
  return searchGit(parentPath);
1015
1018
  };
1016
1019
  const getGitRootPath = (service) => searchGit(service.getRootPath());
@@ -1019,7 +1022,7 @@ var require_Git = __commonJS({
1019
1022
  if (!service.git) throw new Error(`Git Error - ${service?.label}: Git option not set`);
1020
1023
  const path = getGitRootPath(service);
1021
1024
  if (!path) return false;
1022
- if (!existsSync(path)) return false;
1025
+ if (!existsSync2(path)) return false;
1023
1026
  return true;
1024
1027
  }
1025
1028
  return {
@@ -1647,11 +1650,11 @@ var require_stringTransformer_helper = __commonJS({
1647
1650
  var require_Npm = __commonJS({
1648
1651
  "../../modules/npm/backend/Npm.js"(exports2, module2) {
1649
1652
  "use strict";
1650
- var pathfs = require("path");
1653
+ var pathfs2 = require("path");
1651
1654
  var { execAsync } = require_exec();
1652
1655
  var { readFile } = require("fs/promises");
1653
1656
  var { replaceEnvs } = require_stringTransformer_helper();
1654
- var { existsSync } = require("fs");
1657
+ var { existsSync: existsSync2 } = require("fs");
1655
1658
  var Npm = class {
1656
1659
  /** @param {import('@runeya/servers-server/models/Service')} service */
1657
1660
  constructor(service) {
@@ -1659,7 +1662,7 @@ var require_Npm = __commonJS({
1659
1662
  }
1660
1663
  async isNpm(path) {
1661
1664
  if (path) {
1662
- return existsSync(pathfs.resolve(path?.toString(), "package.json"));
1665
+ return existsSync2(pathfs2.resolve(path?.toString(), "package.json"));
1663
1666
  }
1664
1667
  return null;
1665
1668
  }
@@ -1671,13 +1674,13 @@ var require_Npm = __commonJS({
1671
1674
  }
1672
1675
  async packageJSON(path) {
1673
1676
  if (path) {
1674
- return JSON.parse(await readFile(pathfs.resolve(path?.toString(), "package.json"), "utf-8"));
1677
+ return JSON.parse(await readFile(pathfs2.resolve(path?.toString(), "package.json"), "utf-8"));
1675
1678
  }
1676
1679
  return {};
1677
1680
  }
1678
1681
  async packageLock(path) {
1679
1682
  if (path) {
1680
- return JSON.parse(await readFile(pathfs.resolve(path?.toString(), "package-lock.json"), "utf-8")).catch((err) => {
1683
+ return JSON.parse(await readFile(pathfs2.resolve(path?.toString(), "package-lock.json"), "utf-8")).catch((err) => {
1681
1684
  console.error(err);
1682
1685
  return {};
1683
1686
  });
@@ -2106,7 +2109,7 @@ var require_src6 = __commonJS({
2106
2109
  require("express-async-errors");
2107
2110
  var express = require("express");
2108
2111
  var cors = require("cors");
2109
- var pathfs = require("path");
2112
+ var pathfs2 = require("path");
2110
2113
  var fs = require("fs");
2111
2114
  var healthCheck = require_src3();
2112
2115
  var helmet = require("helmet").default;
@@ -2176,7 +2179,7 @@ var require_src6 = __commonJS({
2176
2179
  authApi = (app) => {
2177
2180
  }
2178
2181
  }) {
2179
- const pkgJSONPath = pathfs.resolve(baseUrl, "package.json");
2182
+ const pkgJSONPath = pathfs2.resolve(baseUrl, "package.json");
2180
2183
  const isPkgJSONExists = fs.existsSync(pkgJSONPath);
2181
2184
  const pkgJSON = isPkgJSONExists ? require(pkgJSONPath) : { name: "unknown", version: "unknown" };
2182
2185
  const appVersion = pkgJSON.version;
@@ -2269,9 +2272,9 @@ var require_routes10 = __commonJS({
2269
2272
  var RED = require("node-red");
2270
2273
  var compressing = require("compressing");
2271
2274
  var router = express.Router();
2272
- var pathfs = require("path");
2273
- var { existsSync } = require("fs");
2274
- var { rm, readFile, writeFile, mkdir, readdir } = require("fs/promises");
2275
+ var pathfs2 = require("path");
2276
+ var { existsSync: existsSync2 } = require("fs");
2277
+ var { rm: rm2, readFile, writeFile, mkdir: mkdir2, readdir } = require("fs/promises");
2275
2278
  var ports = require_ports();
2276
2279
  var { execAsync } = require_exec();
2277
2280
  var EncryptionKey = require_EncryptionKey();
@@ -2279,8 +2282,8 @@ var require_routes10 = __commonJS({
2279
2282
  var { v4 } = require("uuid");
2280
2283
  module2.exports = (Stack) => {
2281
2284
  getServer().then(async (server) => {
2282
- const userDir = pathfs.resolve(Stack.getRootPath(), "nodered");
2283
- if (!existsSync(userDir)) await mkdir(userDir, { recursive: true });
2285
+ const userDir = pathfs2.resolve(Stack.getRootPath(), "nodered");
2286
+ if (!existsSync2(userDir)) await mkdir2(userDir, { recursive: true });
2284
2287
  const settings = {
2285
2288
  httpAdminRoot: "/red",
2286
2289
  httpNodeRoot: "/node-red",
@@ -2302,25 +2305,25 @@ var require_routes10 = __commonJS({
2302
2305
  router.use(settings.httpNodeRoot, RED.httpNode);
2303
2306
  const moduleName = "node-red-contrib-runeya";
2304
2307
  const moduleNameLegacy = "node-red-contrib-stack-monitor";
2305
- const modulePath = pathfs.resolve(userDir, "node_modules", moduleName);
2306
- const localNodeModuleTarPath = pathfs.resolve(__dirname, `${moduleName}.tar`);
2307
- const packageJSONPath = pathfs.resolve(userDir, "package.json");
2308
- if (existsSync(pathfs.resolve(userDir, "node_modules", moduleNameLegacy))) {
2309
- await rm(pathfs.resolve(userDir, "node_modules", moduleNameLegacy), { recursive: true, force: true });
2308
+ const modulePath = pathfs2.resolve(userDir, "node_modules", moduleName);
2309
+ const localNodeModuleTarPath = pathfs2.resolve(__dirname, `${moduleName}.tar`);
2310
+ const packageJSONPath = pathfs2.resolve(userDir, "package.json");
2311
+ if (existsSync2(pathfs2.resolve(userDir, "node_modules", moduleNameLegacy))) {
2312
+ await rm2(pathfs2.resolve(userDir, "node_modules", moduleNameLegacy), { recursive: true, force: true });
2310
2313
  await execAsync("npm uninstall node-red-contrib-stack-monitor", { cwd: userDir });
2311
2314
  }
2312
- if (existsSync(modulePath)) {
2315
+ if (existsSync2(modulePath)) {
2313
2316
  console.log(moduleName, "found, delete it before start nodered");
2314
- await rm(modulePath, { recursive: true, force: true });
2317
+ await rm2(modulePath, { recursive: true, force: true });
2315
2318
  await execAsync("npm uninstall node-red-contrib-runeya", { cwd: userDir });
2316
2319
  }
2317
2320
  await PromiseB2.map(await readdir(userDir), async (file) => {
2318
2321
  if (file.startsWith(`node-red-contrib-runeya-`) && file.endsWith(".tgz")) {
2319
- await rm(pathfs.resolve(userDir, file));
2322
+ await rm2(pathfs2.resolve(userDir, file));
2320
2323
  }
2321
2324
  });
2322
2325
  let buffer;
2323
- if (existsSync(localNodeModuleTarPath)) {
2326
+ if (existsSync2(localNodeModuleTarPath)) {
2324
2327
  console.log(`Read ${moduleName} from local tar`);
2325
2328
  buffer = await readFile(localNodeModuleTarPath);
2326
2329
  } else {
@@ -2335,7 +2338,7 @@ var require_routes10 = __commonJS({
2335
2338
  var stream2buffer = stream2buffer2;
2336
2339
  console.log(`Build ${moduleName} from dir`);
2337
2340
  const stream = new compressing.tar.Stream();
2338
- stream.addEntry(pathfs.resolve(__dirname, "./nodes"), { ignoreBase: true, relativePath: "package" });
2341
+ stream.addEntry(pathfs2.resolve(__dirname, "./nodes"), { ignoreBase: true, relativePath: "package" });
2339
2342
  buffer = await stream2buffer2(stream);
2340
2343
  }
2341
2344
  let packageJSON = {
@@ -2345,16 +2348,16 @@ var require_routes10 = __commonJS({
2345
2348
  "private": true,
2346
2349
  "dependencies": {}
2347
2350
  };
2348
- if (existsSync(packageJSONPath)) {
2351
+ if (existsSync2(packageJSONPath)) {
2349
2352
  Object.assign(packageJSON, JSON.parse(await readFile(packageJSONPath, "utf-8")));
2350
2353
  }
2351
2354
  const tgzFileName = `${moduleName}.tgz`;
2352
2355
  packageJSON.dependencies[moduleName] = `file:${tgzFileName}`;
2353
- const pathToTgz = pathfs.resolve(userDir, `${tgzFileName}`);
2356
+ const pathToTgz = pathfs2.resolve(userDir, `${tgzFileName}`);
2354
2357
  await writeFile(pathToTgz, buffer);
2355
2358
  await writeFile(packageJSONPath, JSON.stringify(packageJSON, null, 2), "utf-8");
2356
2359
  await execAsync("npm i", { cwd: userDir });
2357
- await writeFile(pathfs.resolve(userDir, ".gitignore"), `*
2360
+ await writeFile(pathfs2.resolve(userDir, ".gitignore"), `*
2358
2361
  !flow.json
2359
2362
  !flow_cred.json
2360
2363
  !package.json
@@ -2510,7 +2513,7 @@ var require_Environment = __commonJS({
2510
2513
  var PromiseB2 = require("bluebird");
2511
2514
  var { cloneDeep, merge, over } = require("lodash");
2512
2515
  var dbs2 = require_dbs();
2513
- var { existsSync } = require("fs");
2516
+ var { existsSync: existsSync2 } = require("fs");
2514
2517
  var Environment = class _Environment {
2515
2518
  /**
2516
2519
  * @param {import('@runeya/common-typings').NonFunctionProperties<Environment>} environment
@@ -2527,7 +2530,7 @@ var require_Environment = __commonJS({
2527
2530
  static async load(label, Stack) {
2528
2531
  const environmentDB = await dbs2.getDb(`envs/${label}`).read();
2529
2532
  const overridesDB = dbs2.getDb(`overrides/${label}-environment`);
2530
- if (!existsSync(await overridesDB.getPath())) await new _Environment(environmentDB).save();
2533
+ if (!existsSync2(await overridesDB.getPath())) await new _Environment(environmentDB).save();
2531
2534
  const overrides = await dbs2.getDb(`overrides/${label}-environment`).read();
2532
2535
  merge(environmentDB?.envs || {}, overrides?.envs || {});
2533
2536
  return new _Environment(environmentDB, Stack);
@@ -2755,13 +2758,13 @@ var require_Service = __commonJS({
2755
2758
  var PromiseB2 = require("bluebird");
2756
2759
  var dayjs = require("dayjs");
2757
2760
  var { v4 } = require("uuid");
2758
- var { existsSync, readFileSync } = require("fs");
2761
+ var { existsSync: existsSync2, readFileSync } = require("fs");
2759
2762
  var kill = require("tree-kill");
2760
2763
  var axios = require("axios").default;
2761
- var pathfs = require("path");
2764
+ var pathfs2 = require("path");
2762
2765
  var net = require("net");
2763
2766
  var { sockets: sockets2 } = require_src();
2764
- var { mkdir, writeFile } = require("fs/promises");
2767
+ var { mkdir: mkdir2, writeFile } = require("fs/promises");
2765
2768
  var { cloneDeep, over } = require("lodash");
2766
2769
  var CreateInterface = require_readline();
2767
2770
  var { stripAnsi, ansiconvert, unescapeAnsi } = require_ansiconvert();
@@ -2893,8 +2896,8 @@ var require_Service = __commonJS({
2893
2896
  return new Service(await dbs2.getDb(`services/${label}`).read(), Stack);
2894
2897
  };
2895
2898
  Service.prototype.loadCustomEnv = function(path2) {
2896
- const dotEnvPath = pathfs.resolve(path2, ".env");
2897
- if (existsSync(dotEnvPath) && readFileSync(dotEnvPath, { encoding: "utf-8" }).trim()) {
2899
+ const dotEnvPath = pathfs2.resolve(path2, ".env");
2900
+ if (existsSync2(dotEnvPath) && readFileSync(dotEnvPath, { encoding: "utf-8" }).trim()) {
2898
2901
  console.log(`! A .env will override your ${this.label} service !`);
2899
2902
  return require("dotenv").parse(readFileSync(dotEnvPath, "utf-8"));
2900
2903
  }
@@ -3048,7 +3051,7 @@ var require_Service = __commonJS({
3048
3051
  this.crashed = false;
3049
3052
  this.exited = false;
3050
3053
  let { cmd, args: args2, options } = this.container.enabled ? await this.parseIncomingCommandDocker(command) : await this.parseIncomingCommand(command);
3051
- if (!existsSync(options.cwd)) {
3054
+ if (!existsSync2(options.cwd)) {
3052
3055
  this.crashed = true;
3053
3056
  this.exited = true;
3054
3057
  const launchMessage2 = {
@@ -3312,7 +3315,7 @@ var require_Service = __commonJS({
3312
3315
  "sh",
3313
3316
  `-c '${spawnCmd} ${spawnArgs.join(" ")}'`
3314
3317
  ];
3315
- const cwd = pathfs.resolve(replaceEnvs(spawnOptions.cwd || this.getRootPath() || "."));
3318
+ const cwd = pathfs2.resolve(replaceEnvs(spawnOptions.cwd || this.getRootPath() || "."));
3316
3319
  const options = {
3317
3320
  cwd,
3318
3321
  shell: isWindows ? process.env.ComSpec : "/bin/sh"
@@ -3329,7 +3332,7 @@ var require_Service = __commonJS({
3329
3332
  cmd = currentAlias?.cmd || cmd;
3330
3333
  args2 = [...currentAlias?.args || [], ...args2];
3331
3334
  }
3332
- const cwd = pathfs.resolve(replaceEnvs(spawnOptions.cwd || this.getRootPath() || "."));
3335
+ const cwd = pathfs2.resolve(replaceEnvs(spawnOptions.cwd || this.getRootPath() || "."));
3333
3336
  const options = {
3334
3337
  ...spawnOptions,
3335
3338
  cwd,
@@ -3346,19 +3349,19 @@ var require_Service = __commonJS({
3346
3349
  return { cmd, args: args2, options };
3347
3350
  };
3348
3351
  function replaceHome(str) {
3349
- return str.startsWith("~") ? pathfs.resolve(os.homedir(), str.replace("~/", "")) : pathfs.resolve(str);
3352
+ return str.startsWith("~") ? pathfs2.resolve(os.homedir(), str.replace("~/", "")) : pathfs2.resolve(str);
3350
3353
  }
3351
3354
  Service.prototype.getDockerVolumesArgs = async function() {
3352
3355
  const internalVolumeRootPath = replaceHome(this.container.sharedVolume);
3353
3356
  const volumesCmd = this.container.volumes.map((v) => {
3354
3357
  let [external, internal] = v.split(":");
3355
- if (external) external = pathfs.resolve(replaceHome(replaceEnvs(external)));
3356
- if (internal) internal = pathfs.resolve(replaceHome(replaceEnvs(internal)));
3358
+ if (external) external = pathfs2.resolve(replaceHome(replaceEnvs(external)));
3359
+ if (internal) internal = pathfs2.resolve(replaceHome(replaceEnvs(internal)));
3357
3360
  return ["-v", `"${external}:${internal || external}"`];
3358
3361
  });
3359
3362
  volumesCmd.push(...await PromiseB2.map(this.container.ignoreVolumes, async (ignoredVolume) => {
3360
- const volumePath = pathfs.join(internalVolumeRootPath, `ignored-volume-${humanStringToKey(this.label)}`, ignoredVolume);
3361
- if (!existsSync(volumePath)) await mkdir(volumePath, { recursive: true });
3363
+ const volumePath = pathfs2.join(internalVolumeRootPath, `ignored-volume-${humanStringToKey(this.label)}`, ignoredVolume);
3364
+ if (!existsSync2(volumePath)) await mkdir2(volumePath, { recursive: true });
3362
3365
  return ["-v", `"${volumePath}:${ignoredVolume}"`];
3363
3366
  }).filter((f) => !!f?.length));
3364
3367
  return volumesCmd.flat(1);
@@ -3380,8 +3383,8 @@ var require_Service = __commonJS({
3380
3383
  };
3381
3384
  Service.prototype.launchDockerBuild = async function({ isMainProcess }) {
3382
3385
  const internalVolumeRootPath = replaceHome(this.container.sharedVolume);
3383
- const dockerFilePath = pathfs.resolve(internalVolumeRootPath, `Dockerfile.${this.container.name}`);
3384
- const dockerContextPath = pathfs.resolve(internalVolumeRootPath, ".empty-context");
3386
+ const dockerFilePath = pathfs2.resolve(internalVolumeRootPath, `Dockerfile.${this.container.name}`);
3387
+ const dockerContextPath = pathfs2.resolve(internalVolumeRootPath, ".empty-context");
3385
3388
  const command = {
3386
3389
  spwanCmd: "docker",
3387
3390
  spawnArgs: ["build", "-f", dockerFilePath, "-t", this.container?.name || "", dockerContextPath],
@@ -3464,11 +3467,11 @@ var require_Service = __commonJS({
3464
3467
  isMainProcess
3465
3468
  }) {
3466
3469
  const internalVolumeRootPath = replaceHome(this.container.sharedVolume);
3467
- const dockerFilePath = pathfs.resolve(internalVolumeRootPath, `Dockerfile.${this.container.name}`);
3468
- const dockerIgnoreFilePath = pathfs.resolve(internalVolumeRootPath, ".dockerignore");
3469
- const dockerContextPath = pathfs.resolve(internalVolumeRootPath, ".empty-context");
3470
- if (!existsSync(internalVolumeRootPath)) await mkdir(internalVolumeRootPath, { recursive: true });
3471
- if (!existsSync(dockerContextPath)) await mkdir(dockerContextPath, { recursive: true });
3470
+ const dockerFilePath = pathfs2.resolve(internalVolumeRootPath, `Dockerfile.${this.container.name}`);
3471
+ const dockerIgnoreFilePath = pathfs2.resolve(internalVolumeRootPath, ".dockerignore");
3472
+ const dockerContextPath = pathfs2.resolve(internalVolumeRootPath, ".empty-context");
3473
+ if (!existsSync2(internalVolumeRootPath)) await mkdir2(internalVolumeRootPath, { recursive: true });
3474
+ if (!existsSync2(dockerContextPath)) await mkdir2(dockerContextPath, { recursive: true });
3472
3475
  await writeFile(dockerFilePath, `${this.container.build || ""}`);
3473
3476
  await writeFile(dockerIgnoreFilePath, "Dockerfile.*".trim(), "utf-8");
3474
3477
  await this.launchDockerBuild({ isMainProcess });
@@ -3536,16 +3539,16 @@ var require_exportedHelpers = __commonJS({
3536
3539
  var require_version = __commonJS({
3537
3540
  "helpers/version.js"(exports2, module2) {
3538
3541
  "use strict";
3539
- var { existsSync, readFileSync } = require("fs");
3542
+ var { existsSync: existsSync2, readFileSync } = require("fs");
3540
3543
  var path = require("path");
3541
3544
  var file = {
3542
3545
  version: "0.0.0"
3543
3546
  };
3544
- if (existsSync(path.resolve(__dirname, "./package.json"))) {
3547
+ if (existsSync2(path.resolve(__dirname, "./package.json"))) {
3545
3548
  file.version = JSON.parse(readFileSync(path.resolve(__dirname, "./package.json"), { encoding: "utf-8" })).version;
3546
- } else if (existsSync(path.resolve(__dirname, "../package.json"))) {
3549
+ } else if (existsSync2(path.resolve(__dirname, "../package.json"))) {
3547
3550
  file.version = JSON.parse(readFileSync(path.resolve(__dirname, "../package.json"), { encoding: "utf-8" })).version;
3548
- } else if (existsSync(path.resolve(__dirname, "../../../lerna.json"))) {
3551
+ } else if (existsSync2(path.resolve(__dirname, "../../../lerna.json"))) {
3549
3552
  file.version = JSON.parse(readFileSync(path.resolve(__dirname, "../../../lerna.json"), { encoding: "utf-8" })).version;
3550
3553
  }
3551
3554
  module2.exports = {
@@ -3558,19 +3561,19 @@ var require_version = __commonJS({
3558
3561
  var require_saves = __commonJS({
3559
3562
  "models/saves.js"(exports2, module2) {
3560
3563
  "use strict";
3561
- var pathfs = require("path");
3564
+ var pathfs2 = require("path");
3562
3565
  var homedir = require("os").homedir();
3563
3566
  var {
3564
- existsSync,
3567
+ existsSync: existsSync2,
3565
3568
  mkdirSync,
3566
3569
  writeFileSync,
3567
3570
  readFileSync
3568
3571
  } = require("fs");
3569
- var confDir = pathfs.resolve(homedir, ".runeya");
3572
+ var confDir = pathfs2.resolve(homedir, ".runeya");
3570
3573
  function getSave(file, initialData, options = {}) {
3571
- if (!existsSync(confDir)) mkdirSync(confDir);
3572
- const dataConfPath = pathfs.resolve(confDir, file);
3573
- if (!existsSync(dataConfPath)) writeFileSync(dataConfPath, JSON.stringify(initialData), "utf-8");
3574
+ if (!existsSync2(confDir)) mkdirSync(confDir);
3575
+ const dataConfPath = pathfs2.resolve(confDir, file);
3576
+ if (!existsSync2(dataConfPath)) writeFileSync(dataConfPath, JSON.stringify(initialData), "utf-8");
3574
3577
  const data = JSON.parse(readFileSync(dataConfPath, "utf-8"));
3575
3578
  options?.afterGet?.(data);
3576
3579
  return {
@@ -3600,9 +3603,9 @@ var require_stack = __commonJS({
3600
3603
  var EncryptionKey = require_EncryptionKey();
3601
3604
  var CustomObservable = require_CustomObservable();
3602
3605
  var args2 = require_args();
3603
- var { existsSync, mkdirSync } = require("fs");
3604
- var { rename } = require("fs/promises");
3605
- var pathfs = require("path");
3606
+ var { existsSync: existsSync2, mkdirSync } = require("fs");
3607
+ var { rename, cp: cp2, rmdir, rm: rm2 } = require("fs/promises");
3608
+ var pathfs2 = require("path");
3606
3609
  var { default: axios } = require("axios");
3607
3610
  function Stack(stack) {
3608
3611
  this.onServerLauch = new CustomObservable();
@@ -3671,8 +3674,7 @@ var require_stack = __commonJS({
3671
3674
  };
3672
3675
  };
3673
3676
  Stack.getRootPath = () => {
3674
- const rootPath = pathfs.resolve(args2.rootPath, ".runeya");
3675
- if (!existsSync(rootPath)) mkdirSync(rootPath, { recursive: true });
3677
+ const rootPath = pathfs2.resolve(args2.rootPath, ".runeya");
3676
3678
  return rootPath;
3677
3679
  };
3678
3680
  Stack.parse = async function() {
@@ -3735,18 +3737,6 @@ var require_stack = __commonJS({
3735
3737
  return Stack.findService(serviceLabel);
3736
3738
  };
3737
3739
  Stack.selectConf = async function() {
3738
- const localLegacyPath = pathfs.resolve(require_stack().getRootPath(), "../.stackmonitor");
3739
- const localNewPath = pathfs.resolve(require_stack().getRootPath(), ".runeya");
3740
- if (existsSync(localLegacyPath) && !existsSync(localNewPath)) {
3741
- console.log("Legacy path found, move to new path");
3742
- await rename(localLegacyPath, localNewPath);
3743
- }
3744
- const globalLegacyPath = pathfs.resolve(require("os").homedir(), ".stackmonitor");
3745
- const globalNewPath = pathfs.resolve(require("os").homedir(), ".runeya-global");
3746
- if (existsSync(globalLegacyPath) && !existsSync(globalNewPath)) {
3747
- console.log("Legacy path found, move to new path");
3748
- await rename(globalLegacyPath, globalNewPath);
3749
- }
3750
3740
  await EncryptionKey.init();
3751
3741
  if (!EncryptionKey.encryptionKey) {
3752
3742
  await EncryptionKey.saveKey(await EncryptionKey.generateKey());
@@ -3844,8 +3834,8 @@ var require_plugins2 = __commonJS({
3844
3834
  var { default: axios } = require("axios");
3845
3835
  var { tmpdir } = require("os");
3846
3836
  var path = require("path");
3847
- var { existsSync } = require("fs");
3848
- var { writeFile, mkdir, readFile, cp, rm, readdir } = require("fs/promises");
3837
+ var { existsSync: existsSync2 } = require("fs");
3838
+ var { writeFile, mkdir: mkdir2, readFile, cp: cp2, rm: rm2, readdir } = require("fs/promises");
3849
3839
  var { spawn } = require("child_process");
3850
3840
  var dbs2 = require_dbs();
3851
3841
  var HTTPError = require_src2();
@@ -3890,13 +3880,13 @@ var require_plugins2 = __commonJS({
3890
3880
  });
3891
3881
  async function install(remotePath, force = false) {
3892
3882
  const rootPath = args2.rootPath;
3893
- if (!existsSync(rootPath)) await mkdir(rootPath, { recursive: true });
3883
+ if (!existsSync2(rootPath)) await mkdir2(rootPath, { recursive: true });
3894
3884
  const runeyaPath = path.resolve(rootPath, ".runeya");
3895
- if (!existsSync(runeyaPath)) await mkdir(runeyaPath, { recursive: true });
3885
+ if (!existsSync2(runeyaPath)) await mkdir2(runeyaPath, { recursive: true });
3896
3886
  const pluginsPath = path.resolve(runeyaPath, "plugins");
3897
- if (!existsSync(pluginsPath)) await mkdir(pluginsPath, { recursive: true });
3887
+ if (!existsSync2(pluginsPath)) await mkdir2(pluginsPath, { recursive: true });
3898
3888
  const packageTmpPath = path.resolve(tmpdir(), `runeya-plugin-${Date.now()}`);
3899
- if (!existsSync(packageTmpPath)) await mkdir(packageTmpPath, { recursive: true });
3889
+ if (!existsSync2(packageTmpPath)) await mkdir2(packageTmpPath, { recursive: true });
3900
3890
  const packageTmpFilePath = `${packageTmpPath}.tar.gz`;
3901
3891
  const { data } = await axios.get(remotePath, { responseType: "arraybuffer" });
3902
3892
  await writeFile(packageTmpFilePath, data);
@@ -3909,8 +3899,8 @@ var require_plugins2 = __commonJS({
3909
3899
  }
3910
3900
  await dbConfig.alasql.delete(`name='${config.name}'`);
3911
3901
  const diskPath = path.resolve(pluginsPath, config.name);
3912
- if (existsSync(diskPath)) await rm(diskPath, { recursive: true, force: true });
3913
- await cp(path.resolve(packageTmpPath), diskPath, { recursive: true });
3902
+ if (existsSync2(diskPath)) await rm2(diskPath, { recursive: true, force: true });
3903
+ await cp2(path.resolve(packageTmpPath), diskPath, { recursive: true });
3914
3904
  await dbConfig.alasql.insertOne({
3915
3905
  name: config.name,
3916
3906
  version: config.version,
@@ -4001,8 +3991,8 @@ var require_plugins2 = __commonJS({
4001
3991
  if (!plugin) {
4002
3992
  throw new HTTPError("Plugin not found", "404.plugin.not.found");
4003
3993
  }
4004
- if (plugin.diskPath && existsSync(plugin.diskPath)) {
4005
- await rm(plugin.diskPath, { recursive: true, force: true });
3994
+ if (plugin.diskPath && existsSync2(plugin.diskPath)) {
3995
+ await rm2(plugin.diskPath, { recursive: true, force: true });
4006
3996
  }
4007
3997
  await dbConfig.alasql.delete(`name='${name}'`);
4008
3998
  sockets2.emit("plugins:uninstalled", {
@@ -4051,7 +4041,7 @@ var require_plugins2 = __commonJS({
4051
4041
  backendPath = path.resolve(pluginPath, "backend/index.js");
4052
4042
  themePath = path.resolve(pluginPath, "theme/index.js");
4053
4043
  let frontWatcher;
4054
- if (existsSync(frontPath) && existsSync(frontPathDist) && existsSync(backendPath)) {
4044
+ if (existsSync2(frontPath) && existsSync2(frontPathDist) && existsSync2(backendPath)) {
4055
4045
  const debouncedFrontWatcher = debounce(async () => {
4056
4046
  sockets2.emit("plugins:front:building", pluginName);
4057
4047
  console.log("Front changed", pluginName);
@@ -4059,7 +4049,7 @@ var require_plugins2 = __commonJS({
4059
4049
  frontWatcher = chokidar.watch(frontPath, { ignored: frontPathDist, ignoreInitial: true }).on("all", debouncedFrontWatcher);
4060
4050
  }
4061
4051
  let frontDistWatcher;
4062
- if (existsSync(frontPathDist)) {
4052
+ if (existsSync2(frontPathDist)) {
4063
4053
  const debouncedFrontDistWatcher = debounce(async (a, b, c) => {
4064
4054
  sockets2.emit("plugins:front:changed", pluginName);
4065
4055
  console.log("Front dist changed", pluginName);
@@ -4067,7 +4057,7 @@ var require_plugins2 = __commonJS({
4067
4057
  frontDistWatcher = chokidar.watch(frontPathDist, { ignoreInitial: true }).on("all", debouncedFrontDistWatcher);
4068
4058
  }
4069
4059
  let backendWatcher;
4070
- if (existsSync(backendPath)) {
4060
+ if (existsSync2(backendPath)) {
4071
4061
  const debouncedBackendWatcher = debounce(async () => {
4072
4062
  await frontWatcher.close();
4073
4063
  await frontDistWatcher.close();
@@ -4080,7 +4070,7 @@ var require_plugins2 = __commonJS({
4080
4070
  backendPath = null;
4081
4071
  }
4082
4072
  let themeWatcher;
4083
- if (existsSync(themePath)) {
4073
+ if (existsSync2(themePath)) {
4084
4074
  const debouncedThemeWatcher = debounce(async () => {
4085
4075
  if (frontWatcher) await frontWatcher.close();
4086
4076
  if (frontDistWatcher) await frontDistWatcher.close();
@@ -4355,18 +4345,18 @@ var require_system = __commonJS({
4355
4345
  var require_myConfs = __commonJS({
4356
4346
  "models/myConfs.js"(exports2, module2) {
4357
4347
  "use strict";
4358
- var pathfs = require("path");
4348
+ var pathfs2 = require("path");
4359
4349
  var os = require("os");
4360
4350
  var {
4361
- existsSync,
4351
+ existsSync: existsSync2,
4362
4352
  mkdirSync,
4363
4353
  writeFileSync,
4364
4354
  readFileSync
4365
4355
  } = require("fs");
4366
- var persistencePath = pathfs.resolve(os.homedir(), ".runeya");
4367
- if (!existsSync(persistencePath)) mkdirSync(persistencePath, { recursive: true });
4368
- var confsPath = pathfs.resolve(persistencePath, "confs");
4369
- if (!existsSync(confsPath)) writeFileSync(confsPath, JSON.stringify([]), "utf-8");
4356
+ var persistencePath = pathfs2.resolve(os.homedir(), ".runeya");
4357
+ if (!existsSync2(persistencePath)) mkdirSync(persistencePath, { recursive: true });
4358
+ var confsPath = pathfs2.resolve(persistencePath, "confs");
4359
+ if (!existsSync2(confsPath)) writeFileSync(confsPath, JSON.stringify([]), "utf-8");
4370
4360
  var store = JSON.parse(readFileSync(confsPath, "utf-8"));
4371
4361
  module2.exports = {
4372
4362
  /** @type {string[]} */
@@ -4578,7 +4568,7 @@ var require_fs = __commonJS({
4578
4568
  "use strict";
4579
4569
  var { express } = require_src6();
4580
4570
  var router = express.Router();
4581
- var pathfs = require("path");
4571
+ var pathfs2 = require("path");
4582
4572
  var PromiseB2 = require("bluebird");
4583
4573
  var os = require("os");
4584
4574
  var { sort } = require("fast-sort");
@@ -4590,7 +4580,7 @@ var require_fs = __commonJS({
4590
4580
  const path = req.query.path?.toString() || __dirname;
4591
4581
  const dir = await readdir(path);
4592
4582
  const parentDirectory = {
4593
- absolutePath: pathfs.resolve(path, ".."),
4583
+ absolutePath: pathfs2.resolve(path, ".."),
4594
4584
  name: "..",
4595
4585
  isDirectory: true
4596
4586
  };
@@ -4598,7 +4588,7 @@ var require_fs = __commonJS({
4598
4588
  await PromiseB2.map(dir, async (entry) => {
4599
4589
  try {
4600
4590
  if (entry.charAt(0) === ".") return null;
4601
- const absolutePath = pathfs.resolve(path, entry);
4591
+ const absolutePath = pathfs2.resolve(path, entry);
4602
4592
  const entryStat = await stat(absolutePath);
4603
4593
  const entryInfos = {
4604
4594
  absolutePath,
@@ -4609,7 +4599,7 @@ var require_fs = __commonJS({
4609
4599
  };
4610
4600
  if (entryInfos.isDirectory) {
4611
4601
  entryInfos.npmInfos = await getNpmInfos(entryInfos.absolutePath);
4612
- } else if (pathfs.extname(absolutePath) === ".js") {
4602
+ } else if (pathfs2.extname(absolutePath) === ".js") {
4613
4603
  try {
4614
4604
  const stack = require(absolutePath);
4615
4605
  if (Array.isArray(stack) && stack.length && stack[0].label && stack[0].spawnCmd) {
@@ -4632,7 +4622,7 @@ var require_fs = __commonJS({
4632
4622
  async function getNpmInfos(path) {
4633
4623
  const dir = await readdir(path);
4634
4624
  if (dir.includes("package.json")) {
4635
- const packageJSON = JSON.parse(await readFile(pathfs.resolve(path, "package.json"), "utf-8"));
4625
+ const packageJSON = JSON.parse(await readFile(pathfs2.resolve(path, "package.json"), "utf-8"));
4636
4626
  return {
4637
4627
  path,
4638
4628
  packageJSON,
@@ -4960,7 +4950,7 @@ var require_server = __commonJS({
4960
4950
  "bin/server.js"(exports2, module2) {
4961
4951
  "use strict";
4962
4952
  var { launch } = require_src6();
4963
- var pathfs = require("path");
4953
+ var pathfs2 = require("path");
4964
4954
  var ports = require_ports();
4965
4955
  var table = require_console_table();
4966
4956
  var args2 = require_args();
@@ -4973,7 +4963,7 @@ var require_server = __commonJS({
4973
4963
  apiPrefix: "/",
4974
4964
  bodyLimit: "100mb",
4975
4965
  noGreetings: true,
4976
- staticController: process.env.NODE_ENV !== "HFBXdZMJxLyJoua28asEaxRixJ6LriR7FnRzX6pwA7pFjZ" ? pathfs.resolve(__dirname, "public") : void 0,
4966
+ staticController: process.env.NODE_ENV !== "HFBXdZMJxLyJoua28asEaxRixJ6LriR7FnRzX6pwA7pFjZ" ? pathfs2.resolve(__dirname, "public") : void 0,
4977
4967
  helmetConf: process.env.NODE_ENV !== "HFBXdZMJxLyJoua28asEaxRixJ6LriR7FnRzX6pwA7pFjZ" ? {
4978
4968
  crossOriginEmbedderPolicy: false,
4979
4969
  crossOriginResourcePolicy: false,
@@ -5028,10 +5018,33 @@ var require_server = __commonJS({
5028
5018
 
5029
5019
  // bin/www
5030
5020
  var { sockets } = require_src();
5021
+ var pathfs = require("path");
5022
+ var { mkdir, rm, cp } = require("fs/promises");
5023
+ var { existsSync } = require("fs");
5031
5024
  process.title = "runeya";
5032
5025
  var args = require_args();
5033
5026
  require("dotenv").config();
5034
5027
  (async () => {
5028
+ const localLegacyPath = pathfs.resolve(args.runeyaConfigPath, "../.stackmonitor");
5029
+ const localNewPath = args.runeyaConfigPath;
5030
+ if (existsSync(localLegacyPath) && !existsSync(localNewPath)) {
5031
+ console.log("Legacy path found, copy to new path");
5032
+ await cp(localLegacyPath, localNewPath, { recursive: true, force: true });
5033
+ }
5034
+ const globalLegacyPath = pathfs.resolve(args.runeyaGlobalConfigPath, "../.stackmonitor");
5035
+ const globalNewPath = args.runeyaGlobalConfigPath;
5036
+ if (existsSync(globalLegacyPath) && !existsSync(globalNewPath)) {
5037
+ console.log("Legacy path found, copy to new path");
5038
+ await cp(globalLegacyPath, globalNewPath, { recursive: true, force: true });
5039
+ }
5040
+ if (existsSync(localLegacyPath) && !existsSync(pathfs.resolve(args.runeyaConfigPath, "dbs/overrides"))) {
5041
+ console.log("Legacy path found, copy to new path");
5042
+ await cp(pathfs.resolve(localLegacyPath, "dbs/overrides"), pathfs.resolve(args.runeyaConfigPath, "dbs/overrides"), { recursive: true, force: true });
5043
+ }
5044
+ if (existsSync(localLegacyPath) && !existsSync(pathfs.resolve(args.runeyaConfigPath, "dbs/encryption-key.json"))) {
5045
+ console.log("Legacy path found, copy to new path");
5046
+ await cp(pathfs.resolve(localLegacyPath, "dbs/encryption-key.json"), pathfs.resolve(args.runeyaConfigPath, "dbs/encryption-key.json"), { recursive: true, force: true });
5047
+ }
5035
5048
  if (args["pull-env"]) {
5036
5049
  await require_stack().selectConf();
5037
5050
  const service = require_stack().findService(args.s);