@camstack/system 1.0.4 → 1.0.6

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/dist/index.js CHANGED
@@ -19,7 +19,8 @@ const require_builtins_local_auth_local_auth_addon = require("./builtins/local-a
19
19
  require("./builtins/local-auth/index.js");
20
20
  const require_builtins_device_manager_device_manager_addon = require("./builtins/device-manager/device-manager.addon.js");
21
21
  require("./builtins/device-manager/index.js");
22
- const require_manifest_python_deps = require("./manifest-python-deps-D1DbAQEv.js");
22
+ const require_manifest_python_deps = require("./manifest-python-deps-B4BmMoGT.js");
23
+ const require_graceful_fs$1 = require("./graceful-fs-lg19SZNz.js");
23
24
  let _camstack_types_node = require("@camstack/types/node");
24
25
  let node_http = require("node:http");
25
26
  let node_fs = require("node:fs");
@@ -29,7 +30,6 @@ let node_path = require("node:path");
29
30
  node_path = require_chunk.__toESM(node_path, 1);
30
31
  let _camstack_types = require("@camstack/types");
31
32
  let node_crypto = require("node:crypto");
32
- node_crypto = require_chunk.__toESM(node_crypto);
33
33
  let node_child_process = require("node:child_process");
34
34
  let node_util = require("node:util");
35
35
  node_util = require_chunk.__toESM(node_util);
@@ -841,7 +841,7 @@ var ModelDownloadService = class {
841
841
  };
842
842
  //#endregion
843
843
  //#region src/python/python-env-manager.ts
844
- var execFileAsync$3 = (0, node_util.promisify)(node_child_process.execFile);
844
+ var execFileAsync$2 = (0, node_util.promisify)(node_child_process.execFile);
845
845
  var PythonEnvManager = class {
846
846
  venvPath;
847
847
  cachedProbe = null;
@@ -851,12 +851,12 @@ var PythonEnvManager = class {
851
851
  async probe() {
852
852
  if (this.cachedProbe) return this.cachedProbe;
853
853
  for (const cmd of ["python3", "python"]) try {
854
- const { stdout } = await execFileAsync$3(cmd, ["--version"]);
854
+ const { stdout } = await execFileAsync$2(cmd, ["--version"]);
855
855
  const version = stdout.trim().replace("Python ", "");
856
856
  const major = parseInt(version.split(".")[0] ?? "0", 10);
857
857
  const minor = parseInt(version.split(".")[1] ?? "0", 10);
858
858
  if (major < 3 || major === 3 && minor < 10) continue;
859
- const { stdout: pathOut } = await execFileAsync$3(cmd, ["-c", "import sys; print(sys.executable)"]);
859
+ const { stdout: pathOut } = await execFileAsync$2(cmd, ["-c", "import sys; print(sys.executable)"]);
860
860
  this.cachedProbe = {
861
861
  available: true,
862
862
  version,
@@ -872,13 +872,13 @@ var PythonEnvManager = class {
872
872
  async ensure(options) {
873
873
  const probe = await this.probe();
874
874
  if (!probe.available || !probe.path) throw new Error("Python 3.10+ is required but not found on this system");
875
- if (!node_fs.existsSync(node_path.join(this.venvPath, "bin", "python"))) await execFileAsync$3(probe.path, [
875
+ if (!node_fs.existsSync(node_path.join(this.venvPath, "bin", "python"))) await execFileAsync$2(probe.path, [
876
876
  "-m",
877
877
  "venv",
878
878
  this.venvPath
879
879
  ]);
880
880
  const venvPython = node_path.join(this.venvPath, "bin", "python");
881
- if (options.packages.length > 0) await execFileAsync$3(venvPython, [
881
+ if (options.packages.length > 0) await execFileAsync$2(venvPython, [
882
882
  "-m",
883
883
  "pip",
884
884
  "install",
@@ -2358,7 +2358,7 @@ function matchPath(pattern, path) {
2358
2358
  }
2359
2359
  //#endregion
2360
2360
  //#region src/tls/cert-manager.ts
2361
- var execFileAsync$2 = (0, node_util.promisify)(node_child_process.execFile);
2361
+ var execFileAsync$1 = (0, node_util.promisify)(node_child_process.execFile);
2362
2362
  /**
2363
2363
  * Ensure a self-signed TLS certificate exists in the given directory.
2364
2364
  * Generates one if missing. Returns paths to cert and key files.
@@ -2395,7 +2395,7 @@ async function ensureTlsCert(dataDir, options) {
2395
2395
  for (const dns of sanDns) sanParts.push(`DNS:${dns}`);
2396
2396
  for (const ip of sanIps) sanParts.push(`IP:${ip}`);
2397
2397
  const sanString = sanParts.join(",");
2398
- await execFileAsync$2("openssl", [
2398
+ await execFileAsync$1("openssl", [
2399
2399
  "req",
2400
2400
  "-x509",
2401
2401
  "-newkey",
@@ -3588,175 +3588,6 @@ var AddonManifest = class {
3588
3588
  }
3589
3589
  };
3590
3590
  //#endregion
3591
- //#region src/kernel/deps/manifest-native-deps.ts
3592
- var execFileAsync$1 = (0, node_util.promisify)(node_child_process.execFile);
3593
- /**
3594
- * Native node modules an addon needs at runtime but cannot be bundled
3595
- * (`.node` binary files require ABI-matched compilation). Mirror of the
3596
- * Python `requirements.txt` pattern in `manifest-python-deps.ts` —
3597
- * declared in the addon's `package.json` under `camstack.nativeDependencies`,
3598
- * installed per-addon at install time so the host's regular `npm install`
3599
- * doesn't pull in the union of every camera driver's native deps.
3600
- *
3601
- * Phase E of the bundles + builder modernization spec
3602
- * (`docs/superpowers/specs/2026-05-09-bundles-and-builder-modernization-design.md`).
3603
- *
3604
- * Idempotent: hashes the `nativeDependencies` map and writes a marker
3605
- * to `<addonDir>/.camstack-native-deps-installed`. Re-installing only
3606
- * happens when the declared set changes.
3607
- *
3608
- * Failure modes:
3609
- * - manifest doesn't declare `nativeDependencies` (or declares empty) → no-op
3610
- * - `npm install` fails → throws (caller decides whether to abort install)
3611
- * - rebuild step fails → logs warning + continues (install may still
3612
- * work if prebuilt binaries shipped in the package cover the host
3613
- * ABI; surface a clear error at first `import` of the native module
3614
- * otherwise).
3615
- */
3616
- async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry) {
3617
- const native = readNativeDeps(pkgRaw);
3618
- if (native == null || Object.keys(native).length === 0) return;
3619
- const markerFile = node_path.join(addonDir, ".camstack-native-deps-installed");
3620
- const markerHash = hashDeclaration(native);
3621
- if (markerMatches(markerFile, markerHash)) {
3622
- logger.debug("Native deps already installed (marker matches)", { meta: {
3623
- addonDir,
3624
- count: Object.keys(native).length
3625
- } });
3626
- return;
3627
- }
3628
- const specs = Object.entries(native).map(([name, range]) => `${name}@${range}`);
3629
- logger.info("Installing native dependencies", { meta: {
3630
- addonDir,
3631
- specs
3632
- } });
3633
- const args = [
3634
- "install",
3635
- "--no-save",
3636
- "--no-package-lock",
3637
- "--no-audit",
3638
- "--no-fund",
3639
- "--omit=dev",
3640
- "--omit=peer",
3641
- ...registry ? ["--registry", registry] : [],
3642
- ...specs
3643
- ];
3644
- try {
3645
- await execFileAsync$1("npm", args, {
3646
- cwd: addonDir,
3647
- timeout: 3e5
3648
- });
3649
- } catch (err) {
3650
- throw new Error(`npm install of native deps failed for ${addonDir}: ${(0, _camstack_types.errMsg)(err)}`, { cause: err });
3651
- }
3652
- await rebuildNativeDeps(addonDir, Object.keys(native), logger);
3653
- try {
3654
- node_fs.writeFileSync(markerFile, markerHash);
3655
- } catch (err) {
3656
- logger.warn("Failed to write native deps marker", { meta: {
3657
- markerFile,
3658
- error: (0, _camstack_types.errMsg)(err)
3659
- } });
3660
- }
3661
- }
3662
- /** Read & validate `camstack.nativeDependencies`. Returns null when absent. */
3663
- function readNativeDeps(pkgRaw) {
3664
- const camstack = (0, _camstack_types.asJsonObject)(pkgRaw["camstack"]);
3665
- if (!camstack) return null;
3666
- const native = (0, _camstack_types.asJsonObject)(camstack["nativeDependencies"]);
3667
- if (!native) return null;
3668
- const out = {};
3669
- for (const [k, v] of Object.entries(native)) {
3670
- const range = (0, _camstack_types.asString)(v);
3671
- if (range) out[k] = range;
3672
- }
3673
- return Object.keys(out).length > 0 ? out : null;
3674
- }
3675
- /** SHA-256 of the canonical-keyed declaration — drives marker idempotency. */
3676
- function hashDeclaration(deps) {
3677
- const canonical = Object.keys(deps).toSorted().map((k) => `${k}@${deps[k]}`).join("\n");
3678
- return node_crypto.createHash("sha256").update(canonical).digest("hex");
3679
- }
3680
- function markerMatches(markerFile, expected) {
3681
- try {
3682
- return node_fs.readFileSync(markerFile, "utf-8").trim() === expected;
3683
- } catch {
3684
- return false;
3685
- }
3686
- }
3687
- /**
3688
- * Rebuild native modules against the host's runtime ABI.
3689
- *
3690
- * Detection: `process.versions.electron` is set when running inside
3691
- * Electron's main/renderer process (set even when `ELECTRON_RUN_AS_NODE`
3692
- * isn't), giving us a reliable signal. Plain Node leaves it undefined.
3693
- *
3694
- * Electron path: tries `@electron/rebuild` programmatically, falling
3695
- * back to `npx electron-rebuild` if the package isn't directly available.
3696
- * Node path: `npm rebuild --prefix <addonDir>` re-runs the install
3697
- * scripts of every package under that directory.
3698
- *
3699
- * Failures here are non-fatal: many native packages ship prebuilt
3700
- * binaries that cover both ABIs, so the rebuild may be unnecessary.
3701
- * The first `import` of an actually-mismatched binary throws a clear
3702
- * error that points the operator at this rebuild step.
3703
- */
3704
- async function rebuildNativeDeps(addonDir, packageNames, logger) {
3705
- if (typeof process.versions.electron === "string") {
3706
- const electronVersion = process.versions.electron;
3707
- logger.info("Rebuilding native deps for Electron", { meta: {
3708
- addonDir,
3709
- electronVersion,
3710
- packages: packageNames
3711
- } });
3712
- try {
3713
- const rebuildModule = await Promise.resolve().then(() => /* @__PURE__ */ require_chunk.__toESM(require("./main-DNnMW7Z2.js").default)).catch(() => null);
3714
- if (rebuildModule?.rebuild) {
3715
- await rebuildModule.rebuild({
3716
- buildPath: addonDir,
3717
- electronVersion,
3718
- onlyModules: packageNames
3719
- });
3720
- return;
3721
- }
3722
- logger.warn("@electron/rebuild not available — falling back to npx", { meta: { addonDir } });
3723
- await execFileAsync$1("npx", [
3724
- "--yes",
3725
- "electron-rebuild",
3726
- "-m",
3727
- addonDir,
3728
- "-v",
3729
- electronVersion
3730
- ], {
3731
- cwd: addonDir,
3732
- timeout: 6e5
3733
- });
3734
- } catch (err) {
3735
- logger.warn("Electron rebuild failed (continuing — prebuilt binary may be present)", { meta: {
3736
- addonDir,
3737
- error: (0, _camstack_types.errMsg)(err)
3738
- } });
3739
- }
3740
- return;
3741
- }
3742
- logger.info("Rebuilding native deps for Node", { meta: {
3743
- addonDir,
3744
- nodeAbi: process.versions.modules,
3745
- packages: packageNames
3746
- } });
3747
- try {
3748
- await execFileAsync$1("npm", ["rebuild", ...packageNames], {
3749
- cwd: addonDir,
3750
- timeout: 6e5
3751
- });
3752
- } catch (err) {
3753
- logger.warn("npm rebuild failed (continuing — prebuilt binary may be present)", { meta: {
3754
- addonDir,
3755
- error: (0, _camstack_types.errMsg)(err)
3756
- } });
3757
- }
3758
- }
3759
- //#endregion
3760
3591
  //#region src/kernel/addon-installer.ts
3761
3592
  var execFileAsync = (0, node_util.promisify)(node_child_process.execFile);
3762
3593
  function parseInstallSource(value) {
@@ -4019,7 +3850,7 @@ var AddonInstaller = class AddonInstaller {
4019
3850
  });
4020
3851
  } catch {}
4021
3852
  try {
4022
- await installManifestNativeDeps(targetDir, pkgData, this.logger, this.registry);
3853
+ await require_manifest_python_deps.installManifestNativeDeps(targetDir, pkgData, this.logger, this.registry);
4023
3854
  } catch (err) {
4024
3855
  this.logger.warn(`${packageName} — native deps install failed (continuing)`, { meta: { error: (0, _camstack_types.errMsg)(err) } });
4025
3856
  }
@@ -4153,7 +3984,7 @@ var AddonInstaller = class AddonInstaller {
4153
3984
  }
4154
3985
  }
4155
3986
  try {
4156
- await installManifestNativeDeps(targetDir, pkgView.raw, this.logger, this.registry);
3987
+ await require_manifest_python_deps.installManifestNativeDeps(targetDir, pkgView.raw, this.logger, this.registry);
4157
3988
  } catch (nativeErr) {
4158
3989
  node_fs.rmSync(targetDir, {
4159
3990
  recursive: true,
@@ -4247,6 +4078,76 @@ var AddonInstaller = class AddonInstaller {
4247
4078
  };
4248
4079
  }
4249
4080
  /**
4081
+ * Apply an update from a pre-validated staged directory — the fast
4082
+ * swap-from-staged path that skips npm entirely.
4083
+ *
4084
+ * Mirrors `applyUpdate` exactly for backup/restore/manifest, but
4085
+ * replaces step 2 ("install new version") with an atomic directory
4086
+ * move of `stagedPath` into `addonDir`.
4087
+ *
4088
+ * On cross-device move (EXDEV) falls back to a recursive copy followed
4089
+ * by removal of the staged directory. On any swap failure the backup is
4090
+ * restored and the error is rethrown — identical recovery to `applyUpdate`.
4091
+ *
4092
+ * Throws if the package is not tracked in the manifest or if `addonDir`
4093
+ * is missing (same preconditions as `applyUpdate`).
4094
+ */
4095
+ async applyUpdateFromStaged(packageName, version, stagedPath) {
4096
+ const current = this.manifest.get(packageName);
4097
+ if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
4098
+ const addonDir = node_path.join(this.addonsDir, packageName);
4099
+ if (!node_fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
4100
+ const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
4101
+ const backupRoot = node_path.join(this.addonsDir, ".backups", packageName);
4102
+ ensureDir(backupRoot);
4103
+ const backupDir = node_path.join(backupRoot, ts);
4104
+ this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
4105
+ node_fs.renameSync(addonDir, backupDir);
4106
+ try {
4107
+ try {
4108
+ node_fs.renameSync(stagedPath, addonDir);
4109
+ } catch (renameErr) {
4110
+ if (renameErr.code === "EXDEV") {
4111
+ node_fs.cpSync(stagedPath, addonDir, { recursive: true });
4112
+ node_fs.rmSync(stagedPath, {
4113
+ recursive: true,
4114
+ force: true
4115
+ });
4116
+ } else throw renameErr;
4117
+ }
4118
+ } catch (swapErr) {
4119
+ this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: (0, _camstack_types.errMsg)(swapErr) } });
4120
+ try {
4121
+ if (node_fs.existsSync(addonDir)) node_fs.rmSync(addonDir, {
4122
+ recursive: true,
4123
+ force: true
4124
+ });
4125
+ node_fs.renameSync(backupDir, addonDir);
4126
+ this.manifest.upsert(packageName, {
4127
+ version: current.version,
4128
+ source: current.source,
4129
+ lastBackupDir: void 0
4130
+ });
4131
+ } catch (restoreErr) {
4132
+ this.logger.error(`${packageName} — backup restore ALSO failed; manual recovery needed`, { meta: {
4133
+ backupDir,
4134
+ error: (0, _camstack_types.errMsg)(restoreErr)
4135
+ } });
4136
+ }
4137
+ throw swapErr;
4138
+ }
4139
+ this.manifest.upsert(packageName, {
4140
+ version,
4141
+ source: this.manifest.get(packageName)?.source ?? "npm",
4142
+ lastBackupDir: backupDir
4143
+ });
4144
+ return {
4145
+ name: packageName,
4146
+ version,
4147
+ backupDir
4148
+ };
4149
+ }
4150
+ /**
4250
4151
  * Roll back an addon to its most recent backup. Used after an update
4251
4152
  * passes installation but fails its post-restart health check.
4252
4153
  *
@@ -4442,12 +4343,12 @@ function detectWorkspacePackagesDir(startDir) {
4442
4343
  //#endregion
4443
4344
  //#region ../../node_modules/electron/index.js
4444
4345
  var require_electron = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
4445
- var fs$19 = require("fs");
4346
+ var fs$18 = require("fs");
4446
4347
  var path$40 = require("path");
4447
4348
  var pathFile = path$40.join(__dirname, "path.txt");
4448
4349
  function getElectronPath() {
4449
4350
  let executablePath;
4450
- if (fs$19.existsSync(pathFile)) executablePath = fs$19.readFileSync(pathFile, "utf-8");
4351
+ if (fs$18.existsSync(pathFile)) executablePath = fs$18.readFileSync(pathFile, "utf-8");
4451
4352
  if (process.env.ELECTRON_OVERRIDE_DIST_PATH) return path$40.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
4452
4353
  if (executablePath) return path$40.join(__dirname, "dist", executablePath);
4453
4354
  else throw new Error("Electron failed to install correctly, please delete node_modules/electron and try installing again");
@@ -5679,7 +5580,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
5679
5580
  value: mod,
5680
5581
  enumerable: true
5681
5582
  }) : target, mod));
5682
- var require_common$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5583
+ var require_common$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5683
5584
  function isNothing(subject) {
5684
5585
  return typeof subject === "undefined" || subject === null;
5685
5586
  }
@@ -5743,7 +5644,7 @@ var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5743
5644
  module.exports = YAMLException;
5744
5645
  }));
5745
5646
  var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5746
- var common = require_common$2();
5647
+ var common = require_common$1();
5747
5648
  function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
5748
5649
  let head = "";
5749
5650
  let tail = "";
@@ -6023,7 +5924,7 @@ var require_bool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6023
5924
  });
6024
5925
  }));
6025
5926
  var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6026
- var common = require_common$2();
5927
+ var common = require_common$1();
6027
5928
  var Type = require_type();
6028
5929
  function isHexCode(c) {
6029
5930
  return c >= 48 && c <= 57 || c >= 65 && c <= 70 || c >= 97 && c <= 102;
@@ -6130,7 +6031,7 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6130
6031
  });
6131
6032
  }));
6132
6033
  var require_float = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6133
- var common = require_common$2();
6034
+ var common = require_common$1();
6134
6035
  var Type = require_type();
6135
6036
  var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
6136
6037
  var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
@@ -6431,7 +6332,7 @@ var require_default$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6431
6332
  });
6432
6333
  }));
6433
6334
  var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6434
- var common = require_common$2();
6335
+ var common = require_common$1();
6435
6336
  var YAMLException = require_exception();
6436
6337
  var makeSnippet = require_snippet();
6437
6338
  var DEFAULT_SCHEMA = require_default$1();
@@ -7454,7 +7355,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7454
7355
  module.exports.load = load;
7455
7356
  }));
7456
7357
  var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7457
- var common = require_common$2();
7358
+ var common = require_common$1();
7458
7359
  var YAMLException = require_exception();
7459
7360
  var DEFAULT_SCHEMA = require_default$1();
7460
7361
  var _toString = Object.prototype.toString;
@@ -28592,9 +28493,9 @@ var require_kleur = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
28592
28493
  //#region ../../node_modules/moleculer/src/utils.js
28593
28494
  var require_utils$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
28594
28495
  var kleur = require_kleur();
28595
- var os$19 = require("os");
28496
+ var os$18 = require("os");
28596
28497
  var path$39 = require("path");
28597
- var fs$18 = require("fs");
28498
+ var fs$17 = require("fs");
28598
28499
  var { TimeoutError } = require_errors$2();
28599
28500
  var lut = [];
28600
28501
  for (let i = 0; i < 256; i++) lut[i] = (i < 16 ? "0" : "") + i.toString(16);
@@ -28691,7 +28592,7 @@ var require_utils$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
28691
28592
  * @returns
28692
28593
  */
28693
28594
  getNodeID() {
28694
- return os$19.hostname().toLowerCase() + "-" + process.pid;
28595
+ return os$18.hostname().toLowerCase() + "-" + process.pid;
28695
28596
  },
28696
28597
  /**
28697
28598
  * Get list of local IPs
@@ -28701,7 +28602,7 @@ var require_utils$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
28701
28602
  getIpList() {
28702
28603
  const list = [];
28703
28604
  const ilist = [];
28704
- const interfaces = os$19.networkInterfaces();
28605
+ const interfaces = os$18.networkInterfaces();
28705
28606
  for (let iface in interfaces) for (let i in interfaces[iface]) {
28706
28607
  const f = interfaces[iface]?.[i];
28707
28608
  if (f.family === "IPv4") if (f.internal) {
@@ -28887,7 +28788,7 @@ var require_utils$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
28887
28788
  makeDirs(p) {
28888
28789
  p.split(path$39.sep).reduce((prevPath, folder) => {
28889
28790
  const currentPath = path$39.join(prevPath, folder, path$39.sep);
28890
- if (!fs$18.existsSync(currentPath)) fs$18.mkdirSync(currentPath);
28791
+ if (!fs$17.existsSync(currentPath)) fs$17.mkdirSync(currentPath);
28891
28792
  return currentPath;
28892
28793
  }, "");
28893
28794
  },
@@ -30113,7 +30014,7 @@ var require_csv = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module)
30113
30014
  var { makeDirs } = require_utils$3();
30114
30015
  var _ = require_lodash();
30115
30016
  var path$38 = require("path");
30116
- var fs$17 = require("fs");
30017
+ var fs$16 = require("fs");
30117
30018
  var METRIC = require_constants$6();
30118
30019
  var MODE_METRIC = "metric";
30119
30020
  var MODE_LABEL = "label";
@@ -30272,8 +30173,8 @@ var require_csv = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module)
30272
30173
  */
30273
30174
  writeRow(filename, headers, fields) {
30274
30175
  try {
30275
- if (!fs$17.existsSync(filename)) fs$17.writeFileSync(filename, headers.join(this.opts.delimiter) + this.opts.rowDelimiter);
30276
- fs$17.appendFileSync(filename, fields.join(this.opts.delimiter) + this.opts.rowDelimiter);
30176
+ if (!fs$16.existsSync(filename)) fs$16.writeFileSync(filename, headers.join(this.opts.delimiter) + this.opts.rowDelimiter);
30177
+ fs$16.appendFileSync(filename, fields.join(this.opts.delimiter) + this.opts.rowDelimiter);
30277
30178
  } catch (err) {
30278
30179
  /* istanbul ignore next */
30279
30180
  this.logger.error(`Unable to write metrics values to the '${filename}' file. Error: ${err.message}`, fields, err);
@@ -30387,7 +30288,7 @@ var require_event$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
30387
30288
  var require_datadog$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
30388
30289
  var BaseReporter = require_base$8();
30389
30290
  var _ = require_lodash();
30390
- var os$18 = require("os");
30291
+ var os$17 = require("os");
30391
30292
  var { MoleculerError } = require_errors$2();
30392
30293
  var METRIC = require_constants$6();
30393
30294
  var { isFunction } = require_utils$3();
@@ -30420,7 +30321,7 @@ var require_datadog$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
30420
30321
  super(opts);
30421
30322
  /** @type {DatadogReporterOptions} */
30422
30323
  this.opts = _.defaultsDeep(this.opts, {
30423
- host: os$18.hostname(),
30324
+ host: os$17.hostname(),
30424
30325
  baseUrl: BASE_URL,
30425
30326
  apiVersion: "v1",
30426
30327
  path: "/series",
@@ -31096,18 +30997,18 @@ var require_cpu_usage$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
31096
30997
  *
31097
30998
  * Based on: https://github.com/icebob/cpu
31098
30999
  */
31099
- var os$17 = require("os");
31000
+ var os$16 = require("os");
31100
31001
  /* istanbul ignore next */
31101
31002
  module.exports = function getCpuUsage(sampleTime = 100) {
31102
31003
  return new Promise((resolve, reject) => {
31103
31004
  try {
31104
- const first = os$17.cpus().map((cpu) => cpu.times);
31005
+ const first = os$16.cpus().map((cpu) => cpu.times);
31105
31006
  setTimeout(() => {
31106
31007
  try {
31107
- const second = os$17.cpus().map((cpu) => cpu.times);
31008
+ const second = os$16.cpus().map((cpu) => cpu.times);
31108
31009
  setTimeout(() => {
31109
31010
  try {
31110
- const third = os$17.cpus().map((cpu) => cpu.times);
31011
+ const third = os$16.cpus().map((cpu) => cpu.times);
31111
31012
  const usages = [];
31112
31013
  for (let i = 0; i < first.length; i++) {
31113
31014
  const first_idle = first[i].idle;
@@ -31140,7 +31041,7 @@ var require_cpu_usage$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
31140
31041
  //#endregion
31141
31042
  //#region ../../node_modules/moleculer/src/metrics/commons.js
31142
31043
  var require_commons = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
31143
- var os$16 = require("os");
31044
+ var os$15 = require("os");
31144
31045
  var METRIC = require_constants$6();
31145
31046
  var cpuUsage = require_cpu_usage$1();
31146
31047
  var v8;
@@ -31319,27 +31220,27 @@ var require_commons = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
31319
31220
  name: METRIC.OS_TYPE,
31320
31221
  type: METRIC.TYPE_INFO,
31321
31222
  description: "OS type"
31322
- }).set(os$16.type());
31223
+ }).set(os$15.type());
31323
31224
  this.register({
31324
31225
  name: METRIC.OS_RELEASE,
31325
31226
  type: METRIC.TYPE_INFO,
31326
31227
  description: "OS release"
31327
- }).set(os$16.release());
31228
+ }).set(os$15.release());
31328
31229
  this.register({
31329
31230
  name: METRIC.OS_HOSTNAME,
31330
31231
  type: METRIC.TYPE_INFO,
31331
31232
  description: "Hostname"
31332
- }).set(os$16.hostname());
31233
+ }).set(os$15.hostname());
31333
31234
  this.register({
31334
31235
  name: METRIC.OS_ARCH,
31335
31236
  type: METRIC.TYPE_INFO,
31336
31237
  description: "OS architecture"
31337
- }).set(os$16.arch());
31238
+ }).set(os$15.arch());
31338
31239
  this.register({
31339
31240
  name: METRIC.OS_PLATFORM,
31340
31241
  type: METRIC.TYPE_INFO,
31341
31242
  description: "OS platform"
31342
- }).set(os$16.platform());
31243
+ }).set(os$15.platform());
31343
31244
  const userInfo = getUserInfo();
31344
31245
  this.register({
31345
31246
  name: METRIC.OS_USER_UID,
@@ -31490,22 +31391,22 @@ var require_commons = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
31490
31391
  }
31491
31392
  this.set(METRIC.PROCESS_UPTIME, process.uptime());
31492
31393
  this.set(METRIC.PROCESS_INTERNAL_ACTIVE_HANDLES, process.getActiveResourcesInfo().length);
31493
- const freeMem = os$16.freemem();
31494
- const totalMem = os$16.totalmem();
31394
+ const freeMem = os$15.freemem();
31395
+ const totalMem = os$15.totalmem();
31495
31396
  const usedMem = totalMem - freeMem;
31496
31397
  this.set(METRIC.OS_MEMORY_FREE, freeMem);
31497
31398
  this.set(METRIC.OS_MEMORY_USED, usedMem);
31498
31399
  this.set(METRIC.OS_MEMORY_TOTAL, totalMem);
31499
- this.set(METRIC.OS_UPTIME, os$16.uptime());
31500
- this.set(METRIC.OS_TYPE, os$16.type());
31501
- this.set(METRIC.OS_RELEASE, os$16.release());
31502
- this.set(METRIC.OS_HOSTNAME, os$16.hostname());
31503
- this.set(METRIC.OS_ARCH, os$16.arch());
31504
- this.set(METRIC.OS_PLATFORM, os$16.platform());
31400
+ this.set(METRIC.OS_UPTIME, os$15.uptime());
31401
+ this.set(METRIC.OS_TYPE, os$15.type());
31402
+ this.set(METRIC.OS_RELEASE, os$15.release());
31403
+ this.set(METRIC.OS_HOSTNAME, os$15.hostname());
31404
+ this.set(METRIC.OS_ARCH, os$15.arch());
31405
+ this.set(METRIC.OS_PLATFORM, os$15.platform());
31505
31406
  const getNetworkInterfaces = () => {
31506
31407
  const list = [];
31507
31408
  const ilist = [];
31508
- const interfaces = os$16.networkInterfaces();
31409
+ const interfaces = os$15.networkInterfaces();
31509
31410
  for (let iface in interfaces) for (let i in interfaces[iface]) {
31510
31411
  const f = interfaces[iface][i];
31511
31412
  if (f.internal) ilist.push({
@@ -31535,7 +31436,7 @@ var require_commons = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
31535
31436
  this.set(METRIC.OS_DATETIME_ISO, d.toISOString());
31536
31437
  this.set(METRIC.OS_DATETIME_UTC, d.toUTCString());
31537
31438
  this.set(METRIC.OS_DATETIME_TZ_OFFSET, d.getTimezoneOffset());
31538
- const load = os$16.loadavg();
31439
+ const load = os$15.loadavg();
31539
31440
  this.set(METRIC.OS_CPU_LOAD_1, load[0]);
31540
31441
  this.set(METRIC.OS_CPU_LOAD_5, load[1]);
31541
31442
  this.set(METRIC.OS_CPU_LOAD_15, load[2]);
@@ -31543,7 +31444,7 @@ var require_commons = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
31543
31444
  return this.broker.Promise.resolve().then(() => cpuUsage().then((res) => {
31544
31445
  this.set(METRIC.OS_CPU_UTILIZATION, res.avg);
31545
31446
  try {
31546
- const cpus = os$16.cpus();
31447
+ const cpus = os$15.cpus();
31547
31448
  this.set(METRIC.OS_CPU_TOTAL, cpus.length);
31548
31449
  this.set(METRIC.OS_CPU_USER, cpus.reduce((a, b) => a + b.times.user, 0));
31549
31450
  this.set(METRIC.OS_CPU_SYSTEM, cpus.reduce((a, b) => a + b.times.sys, 0));
@@ -31565,7 +31466,7 @@ var require_commons = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
31565
31466
  */
31566
31467
  function getUserInfo() {
31567
31468
  try {
31568
- return os$16.userInfo();
31469
+ return os$15.userInfo();
31569
31470
  } catch {
31570
31471
  /* istanbul ignore next */
31571
31472
  return {};
@@ -35264,10 +35165,10 @@ var require_inherits_browser = /* @__PURE__ */ require_chunk.__commonJSMin(((exp
35264
35165
  //#region ../../node_modules/inherits/inherits.js
35265
35166
  var require_inherits = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
35266
35167
  try {
35267
- var util$10 = require("util");
35168
+ var util$8 = require("util");
35268
35169
  /* istanbul ignore next */
35269
- if (typeof util$10.inherits !== "function") throw "";
35270
- module.exports = util$10.inherits;
35170
+ if (typeof util$8.inherits !== "function") throw "";
35171
+ module.exports = util$8.inherits;
35271
35172
  } catch (e) {
35272
35173
  /* istanbul ignore next */
35273
35174
  module.exports = require_inherits_browser();
@@ -35275,7 +35176,7 @@ var require_inherits = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
35275
35176
  }));
35276
35177
  //#endregion
35277
35178
  //#region ../../node_modules/util-deprecate/node.js
35278
- var require_node$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
35179
+ var require_node$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
35279
35180
  /**
35280
35181
  * For Node.js, simply re-export the core `util.deprecate` function.
35281
35182
  */
@@ -35295,7 +35196,7 @@ var require__stream_writable = /* @__PURE__ */ require_chunk.__commonJSMin(((exp
35295
35196
  }
35296
35197
  var Duplex;
35297
35198
  Writable.WritableState = WritableState;
35298
- var internalUtil = { deprecate: require_node$2() };
35199
+ var internalUtil = { deprecate: require_node$1() };
35299
35200
  var Stream = require_stream$1();
35300
35201
  var Buffer$13 = require("buffer").Buffer;
35301
35202
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {};
@@ -37176,14 +37077,14 @@ var require_pipeline$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
37176
37077
  //#endregion
37177
37078
  //#region ../../node_modules/msgpack5/node_modules/readable-stream/readable.js
37178
37079
  var require_readable$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
37179
- var Stream$3 = require("stream");
37180
- if (process.env.READABLE_STREAM === "disable" && Stream$3) {
37181
- module.exports = Stream$3.Readable;
37182
- Object.assign(module.exports, Stream$3);
37183
- module.exports.Stream = Stream$3;
37080
+ var Stream$2 = require("stream");
37081
+ if (process.env.READABLE_STREAM === "disable" && Stream$2) {
37082
+ module.exports = Stream$2.Readable;
37083
+ Object.assign(module.exports, Stream$2);
37084
+ module.exports.Stream = Stream$2;
37184
37085
  } else {
37185
37086
  exports = module.exports = require__stream_readable();
37186
- exports.Stream = Stream$3 || exports;
37087
+ exports.Stream = Stream$2 || exports;
37187
37088
  exports.Readable = exports;
37188
37089
  exports.Writable = require__stream_writable();
37189
37090
  exports.Duplex = require__stream_duplex();
@@ -37529,7 +37430,7 @@ var require_streams = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
37529
37430
  //#endregion
37530
37431
  //#region ../../node_modules/msgpack5/lib/helpers.js
37531
37432
  var require_helpers$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
37532
- var util$9 = require("util");
37433
+ var util$7 = require("util");
37533
37434
  exports.IncompleteBufferError = IncompleteBufferError;
37534
37435
  function IncompleteBufferError(message) {
37535
37436
  Error.call(this);
@@ -37537,7 +37438,7 @@ var require_helpers$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =
37537
37438
  this.name = this.constructor.name;
37538
37439
  this.message = message || "unable to decode";
37539
37440
  }
37540
- util$9.inherits(IncompleteBufferError, Error);
37441
+ util$7.inherits(IncompleteBufferError, Error);
37541
37442
  exports.isFloat = function isFloat(n) {
37542
37443
  return n % 1 !== 0;
37543
37444
  };
@@ -39075,7 +38976,7 @@ var require_discoverers = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
39075
38976
  }));
39076
38977
  //#endregion
39077
38978
  //#region ../../node_modules/moleculer/src/registry/node.js
39078
- var require_node$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
38979
+ var require_node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
39079
38980
  /**
39080
38981
  * Import types
39081
38982
  *
@@ -39190,8 +39091,8 @@ var require_node$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
39190
39091
  //#region ../../node_modules/moleculer/src/registry/node-catalog.js
39191
39092
  var require_node_catalog = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
39192
39093
  var _ = require_lodash();
39193
- var os$15 = require("os");
39194
- var Node = require_node$1();
39094
+ var os$14 = require("os");
39095
+ var Node = require_node();
39195
39096
  var { getIpList } = require_utils$3();
39196
39097
  /**
39197
39098
  * Import types
@@ -39236,7 +39137,7 @@ var require_node_catalog = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
39236
39137
  node.local = true;
39237
39138
  node.ipList = getIpList();
39238
39139
  node.instanceID = this.broker.instanceID;
39239
- node.hostname = os$15.hostname();
39140
+ node.hostname = os$14.hostname();
39240
39141
  node.client = {
39241
39142
  type: "nodejs",
39242
39143
  version: this.broker.MOLECULER_VERSION,
@@ -40994,7 +40895,7 @@ var require_formatted = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
40994
40895
  var BaseLogger = require_base$4();
40995
40896
  var _ = require_lodash();
40996
40897
  var kleur = require_kleur();
40997
- var util$8 = require("util");
40898
+ var util$6 = require("util");
40998
40899
  var { isObject, isFunction } = require_utils$3();
40999
40900
  /**
41000
40901
  * Import types
@@ -41042,7 +40943,7 @@ var require_formatted = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
41042
40943
  init(loggerFactory) {
41043
40944
  super.init(loggerFactory);
41044
40945
  if (!this.opts.colors) kleur.enabled = false;
41045
- this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$8.inspect(o, {
40946
+ this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$6.inspect(o, {
41046
40947
  showHidden: false,
41047
40948
  depth: 2,
41048
40949
  colors: kleur.enabled,
@@ -41310,9 +41211,9 @@ var require_console$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
41310
41211
  var require_datadog$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
41311
41212
  var BaseLogger = require_base$4();
41312
41213
  var _ = require_lodash();
41313
- var os$14 = require("os");
41214
+ var os$13 = require("os");
41314
41215
  var { MoleculerError } = require_errors$2();
41315
- var util$7 = require("util");
41216
+ var util$5 = require("util");
41316
41217
  var { isObject } = require_utils$3();
41317
41218
  /**
41318
41219
  * Import types
@@ -41343,7 +41244,7 @@ var require_datadog$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
41343
41244
  apiKey: process.env.DATADOG_API_KEY,
41344
41245
  ddSource: "moleculer",
41345
41246
  env: void 0,
41346
- hostname: os$14.hostname(),
41247
+ hostname: os$13.hostname(),
41347
41248
  objectPrinter: null,
41348
41249
  interval: 10 * 1e3
41349
41250
  });
@@ -41358,7 +41259,7 @@ var require_datadog$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
41358
41259
  */
41359
41260
  init(loggerFactory) {
41360
41261
  super.init(loggerFactory);
41361
- this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$7.inspect(o, {
41262
+ this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$5.inspect(o, {
41362
41263
  showHidden: false,
41363
41264
  depth: 2,
41364
41265
  colors: false,
@@ -41467,712 +41368,6 @@ var require_datadog$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
41467
41368
  module.exports = DatadogLogger;
41468
41369
  }));
41469
41370
  //#endregion
41470
- //#region ../../node_modules/debug/src/common.js
41471
- var require_common$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
41472
- /**
41473
- * This is the common logic for both the Node.js and web browser
41474
- * implementations of `debug()`.
41475
- */
41476
- function setup(env) {
41477
- createDebug.debug = createDebug;
41478
- createDebug.default = createDebug;
41479
- createDebug.coerce = coerce;
41480
- createDebug.disable = disable;
41481
- createDebug.enable = enable;
41482
- createDebug.enabled = enabled;
41483
- createDebug.humanize = require_builtins_local_auth_local_auth_addon.require_ms();
41484
- createDebug.destroy = destroy;
41485
- Object.keys(env).forEach((key) => {
41486
- createDebug[key] = env[key];
41487
- });
41488
- /**
41489
- * The currently active debug mode names, and names to skip.
41490
- */
41491
- createDebug.names = [];
41492
- createDebug.skips = [];
41493
- /**
41494
- * Map of special "%n" handling functions, for the debug "format" argument.
41495
- *
41496
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
41497
- */
41498
- createDebug.formatters = {};
41499
- /**
41500
- * Selects a color for a debug namespace
41501
- * @param {String} namespace The namespace string for the debug instance to be colored
41502
- * @return {Number|String} An ANSI color code for the given namespace
41503
- * @api private
41504
- */
41505
- function selectColor(namespace) {
41506
- let hash = 0;
41507
- for (let i = 0; i < namespace.length; i++) {
41508
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
41509
- hash |= 0;
41510
- }
41511
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
41512
- }
41513
- createDebug.selectColor = selectColor;
41514
- /**
41515
- * Create a debugger with the given `namespace`.
41516
- *
41517
- * @param {String} namespace
41518
- * @return {Function}
41519
- * @api public
41520
- */
41521
- function createDebug(namespace) {
41522
- let prevTime;
41523
- let enableOverride = null;
41524
- let namespacesCache;
41525
- let enabledCache;
41526
- function debug(...args) {
41527
- if (!debug.enabled) return;
41528
- const self = debug;
41529
- const curr = Number(/* @__PURE__ */ new Date());
41530
- self.diff = curr - (prevTime || curr);
41531
- self.prev = prevTime;
41532
- self.curr = curr;
41533
- prevTime = curr;
41534
- args[0] = createDebug.coerce(args[0]);
41535
- if (typeof args[0] !== "string") args.unshift("%O");
41536
- let index = 0;
41537
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
41538
- if (match === "%%") return "%";
41539
- index++;
41540
- const formatter = createDebug.formatters[format];
41541
- if (typeof formatter === "function") {
41542
- const val = args[index];
41543
- match = formatter.call(self, val);
41544
- args.splice(index, 1);
41545
- index--;
41546
- }
41547
- return match;
41548
- });
41549
- createDebug.formatArgs.call(self, args);
41550
- (self.log || createDebug.log).apply(self, args);
41551
- }
41552
- debug.namespace = namespace;
41553
- debug.useColors = createDebug.useColors();
41554
- debug.color = createDebug.selectColor(namespace);
41555
- debug.extend = extend;
41556
- debug.destroy = createDebug.destroy;
41557
- Object.defineProperty(debug, "enabled", {
41558
- enumerable: true,
41559
- configurable: false,
41560
- get: () => {
41561
- if (enableOverride !== null) return enableOverride;
41562
- if (namespacesCache !== createDebug.namespaces) {
41563
- namespacesCache = createDebug.namespaces;
41564
- enabledCache = createDebug.enabled(namespace);
41565
- }
41566
- return enabledCache;
41567
- },
41568
- set: (v) => {
41569
- enableOverride = v;
41570
- }
41571
- });
41572
- if (typeof createDebug.init === "function") createDebug.init(debug);
41573
- return debug;
41574
- }
41575
- function extend(namespace, delimiter) {
41576
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
41577
- newDebug.log = this.log;
41578
- return newDebug;
41579
- }
41580
- /**
41581
- * Enables a debug mode by namespaces. This can include modes
41582
- * separated by a colon and wildcards.
41583
- *
41584
- * @param {String} namespaces
41585
- * @api public
41586
- */
41587
- function enable(namespaces) {
41588
- createDebug.save(namespaces);
41589
- createDebug.namespaces = namespaces;
41590
- createDebug.names = [];
41591
- createDebug.skips = [];
41592
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
41593
- for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
41594
- else createDebug.names.push(ns);
41595
- }
41596
- /**
41597
- * Checks if the given string matches a namespace template, honoring
41598
- * asterisks as wildcards.
41599
- *
41600
- * @param {String} search
41601
- * @param {String} template
41602
- * @return {Boolean}
41603
- */
41604
- function matchesTemplate(search, template) {
41605
- let searchIndex = 0;
41606
- let templateIndex = 0;
41607
- let starIndex = -1;
41608
- let matchIndex = 0;
41609
- while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
41610
- starIndex = templateIndex;
41611
- matchIndex = searchIndex;
41612
- templateIndex++;
41613
- } else {
41614
- searchIndex++;
41615
- templateIndex++;
41616
- }
41617
- else if (starIndex !== -1) {
41618
- templateIndex = starIndex + 1;
41619
- matchIndex++;
41620
- searchIndex = matchIndex;
41621
- } else return false;
41622
- while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
41623
- return templateIndex === template.length;
41624
- }
41625
- /**
41626
- * Disable debug output.
41627
- *
41628
- * @return {String} namespaces
41629
- * @api public
41630
- */
41631
- function disable() {
41632
- const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
41633
- createDebug.enable("");
41634
- return namespaces;
41635
- }
41636
- /**
41637
- * Returns true if the given mode name is enabled, false otherwise.
41638
- *
41639
- * @param {String} name
41640
- * @return {Boolean}
41641
- * @api public
41642
- */
41643
- function enabled(name) {
41644
- for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
41645
- for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
41646
- return false;
41647
- }
41648
- /**
41649
- * Coerce `val`.
41650
- *
41651
- * @param {Mixed} val
41652
- * @return {Mixed}
41653
- * @api private
41654
- */
41655
- function coerce(val) {
41656
- if (val instanceof Error) return val.stack || val.message;
41657
- return val;
41658
- }
41659
- /**
41660
- * XXX DO NOT USE. This is a temporary stub function.
41661
- * XXX It WILL be removed in the next major release.
41662
- */
41663
- function destroy() {
41664
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
41665
- }
41666
- createDebug.enable(createDebug.load());
41667
- return createDebug;
41668
- }
41669
- module.exports = setup;
41670
- }));
41671
- //#endregion
41672
- //#region ../../node_modules/debug/src/browser.js
41673
- var require_browser = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
41674
- /**
41675
- * This is the web browser implementation of `debug()`.
41676
- */
41677
- exports.formatArgs = formatArgs;
41678
- exports.save = save;
41679
- exports.load = load;
41680
- exports.useColors = useColors;
41681
- exports.storage = localstorage();
41682
- exports.destroy = (() => {
41683
- let warned = false;
41684
- return () => {
41685
- if (!warned) {
41686
- warned = true;
41687
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
41688
- }
41689
- };
41690
- })();
41691
- /**
41692
- * Colors.
41693
- */
41694
- exports.colors = [
41695
- "#0000CC",
41696
- "#0000FF",
41697
- "#0033CC",
41698
- "#0033FF",
41699
- "#0066CC",
41700
- "#0066FF",
41701
- "#0099CC",
41702
- "#0099FF",
41703
- "#00CC00",
41704
- "#00CC33",
41705
- "#00CC66",
41706
- "#00CC99",
41707
- "#00CCCC",
41708
- "#00CCFF",
41709
- "#3300CC",
41710
- "#3300FF",
41711
- "#3333CC",
41712
- "#3333FF",
41713
- "#3366CC",
41714
- "#3366FF",
41715
- "#3399CC",
41716
- "#3399FF",
41717
- "#33CC00",
41718
- "#33CC33",
41719
- "#33CC66",
41720
- "#33CC99",
41721
- "#33CCCC",
41722
- "#33CCFF",
41723
- "#6600CC",
41724
- "#6600FF",
41725
- "#6633CC",
41726
- "#6633FF",
41727
- "#66CC00",
41728
- "#66CC33",
41729
- "#9900CC",
41730
- "#9900FF",
41731
- "#9933CC",
41732
- "#9933FF",
41733
- "#99CC00",
41734
- "#99CC33",
41735
- "#CC0000",
41736
- "#CC0033",
41737
- "#CC0066",
41738
- "#CC0099",
41739
- "#CC00CC",
41740
- "#CC00FF",
41741
- "#CC3300",
41742
- "#CC3333",
41743
- "#CC3366",
41744
- "#CC3399",
41745
- "#CC33CC",
41746
- "#CC33FF",
41747
- "#CC6600",
41748
- "#CC6633",
41749
- "#CC9900",
41750
- "#CC9933",
41751
- "#CCCC00",
41752
- "#CCCC33",
41753
- "#FF0000",
41754
- "#FF0033",
41755
- "#FF0066",
41756
- "#FF0099",
41757
- "#FF00CC",
41758
- "#FF00FF",
41759
- "#FF3300",
41760
- "#FF3333",
41761
- "#FF3366",
41762
- "#FF3399",
41763
- "#FF33CC",
41764
- "#FF33FF",
41765
- "#FF6600",
41766
- "#FF6633",
41767
- "#FF9900",
41768
- "#FF9933",
41769
- "#FFCC00",
41770
- "#FFCC33"
41771
- ];
41772
- /**
41773
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
41774
- * and the Firebug extension (any Firefox version) are known
41775
- * to support "%c" CSS customizations.
41776
- *
41777
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
41778
- */
41779
- function useColors() {
41780
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
41781
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
41782
- let m;
41783
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
41784
- }
41785
- /**
41786
- * Colorize log arguments if enabled.
41787
- *
41788
- * @api public
41789
- */
41790
- function formatArgs(args) {
41791
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
41792
- if (!this.useColors) return;
41793
- const c = "color: " + this.color;
41794
- args.splice(1, 0, c, "color: inherit");
41795
- let index = 0;
41796
- let lastC = 0;
41797
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
41798
- if (match === "%%") return;
41799
- index++;
41800
- if (match === "%c") lastC = index;
41801
- });
41802
- args.splice(lastC, 0, c);
41803
- }
41804
- /**
41805
- * Invokes `console.debug()` when available.
41806
- * No-op when `console.debug` is not a "function".
41807
- * If `console.debug` is not available, falls back
41808
- * to `console.log`.
41809
- *
41810
- * @api public
41811
- */
41812
- exports.log = console.debug || console.log || (() => {});
41813
- /**
41814
- * Save `namespaces`.
41815
- *
41816
- * @param {String} namespaces
41817
- * @api private
41818
- */
41819
- function save(namespaces) {
41820
- try {
41821
- if (namespaces) exports.storage.setItem("debug", namespaces);
41822
- else exports.storage.removeItem("debug");
41823
- } catch (error) {}
41824
- }
41825
- /**
41826
- * Load `namespaces`.
41827
- *
41828
- * @return {String} returns the previously persisted debug modes
41829
- * @api private
41830
- */
41831
- function load() {
41832
- let r;
41833
- try {
41834
- r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
41835
- } catch (error) {}
41836
- if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
41837
- return r;
41838
- }
41839
- /**
41840
- * Localstorage attempts to return the localstorage.
41841
- *
41842
- * This is necessary because safari throws
41843
- * when a user disables cookies/localstorage
41844
- * and you attempt to access it.
41845
- *
41846
- * @return {LocalStorage}
41847
- * @api private
41848
- */
41849
- function localstorage() {
41850
- try {
41851
- return localStorage;
41852
- } catch (error) {}
41853
- }
41854
- module.exports = require_common$1()(exports);
41855
- var { formatters } = module.exports;
41856
- /**
41857
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
41858
- */
41859
- formatters.j = function(v) {
41860
- try {
41861
- return JSON.stringify(v);
41862
- } catch (error) {
41863
- return "[UnexpectedJSONParseError]: " + error.message;
41864
- }
41865
- };
41866
- }));
41867
- //#endregion
41868
- //#region ../../node_modules/has-flag/index.js
41869
- var require_has_flag$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
41870
- module.exports = (flag, argv = process.argv) => {
41871
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
41872
- const position = argv.indexOf(prefix + flag);
41873
- const terminatorPosition = argv.indexOf("--");
41874
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
41875
- };
41876
- }));
41877
- //#endregion
41878
- //#region ../../node_modules/supports-color/index.js
41879
- var require_supports_color$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
41880
- var os$13 = require("os");
41881
- var tty$1 = require("tty");
41882
- var hasFlag = require_has_flag$1();
41883
- var { env } = process;
41884
- var flagForceColor;
41885
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
41886
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
41887
- function envForceColor() {
41888
- if ("FORCE_COLOR" in env) {
41889
- if (env.FORCE_COLOR === "true") return 1;
41890
- if (env.FORCE_COLOR === "false") return 0;
41891
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
41892
- }
41893
- }
41894
- function translateLevel(level) {
41895
- if (level === 0) return false;
41896
- return {
41897
- level,
41898
- hasBasic: true,
41899
- has256: level >= 2,
41900
- has16m: level >= 3
41901
- };
41902
- }
41903
- function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
41904
- const noFlagForceColor = envForceColor();
41905
- if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
41906
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
41907
- if (forceColor === 0) return 0;
41908
- if (sniffFlags) {
41909
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
41910
- if (hasFlag("color=256")) return 2;
41911
- }
41912
- if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
41913
- const min = forceColor || 0;
41914
- if (env.TERM === "dumb") return min;
41915
- if (process.platform === "win32") {
41916
- const osRelease = os$13.release().split(".");
41917
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
41918
- return 1;
41919
- }
41920
- if ("CI" in env) {
41921
- if ([
41922
- "TRAVIS",
41923
- "CIRCLECI",
41924
- "APPVEYOR",
41925
- "GITLAB_CI",
41926
- "GITHUB_ACTIONS",
41927
- "BUILDKITE",
41928
- "DRONE"
41929
- ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
41930
- return min;
41931
- }
41932
- if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
41933
- if (env.COLORTERM === "truecolor") return 3;
41934
- if ("TERM_PROGRAM" in env) {
41935
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
41936
- switch (env.TERM_PROGRAM) {
41937
- case "iTerm.app": return version >= 3 ? 3 : 2;
41938
- case "Apple_Terminal": return 2;
41939
- }
41940
- }
41941
- if (/-256(color)?$/i.test(env.TERM)) return 2;
41942
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
41943
- if ("COLORTERM" in env) return 1;
41944
- return min;
41945
- }
41946
- function getSupportLevel(stream, options = {}) {
41947
- return translateLevel(supportsColor(stream, {
41948
- streamIsTTY: stream && stream.isTTY,
41949
- ...options
41950
- }));
41951
- }
41952
- module.exports = {
41953
- supportsColor: getSupportLevel,
41954
- stdout: getSupportLevel({ isTTY: tty$1.isatty(1) }),
41955
- stderr: getSupportLevel({ isTTY: tty$1.isatty(2) })
41956
- };
41957
- }));
41958
- //#endregion
41959
- //#region ../../node_modules/debug/src/node.js
41960
- var require_node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
41961
- /**
41962
- * Module dependencies.
41963
- */
41964
- var tty = require("tty");
41965
- var util$6 = require("util");
41966
- /**
41967
- * This is the Node.js implementation of `debug()`.
41968
- */
41969
- exports.init = init;
41970
- exports.log = log;
41971
- exports.formatArgs = formatArgs;
41972
- exports.save = save;
41973
- exports.load = load;
41974
- exports.useColors = useColors;
41975
- exports.destroy = util$6.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
41976
- /**
41977
- * Colors.
41978
- */
41979
- exports.colors = [
41980
- 6,
41981
- 2,
41982
- 3,
41983
- 4,
41984
- 5,
41985
- 1
41986
- ];
41987
- try {
41988
- const supportsColor = require_supports_color$1();
41989
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
41990
- 20,
41991
- 21,
41992
- 26,
41993
- 27,
41994
- 32,
41995
- 33,
41996
- 38,
41997
- 39,
41998
- 40,
41999
- 41,
42000
- 42,
42001
- 43,
42002
- 44,
42003
- 45,
42004
- 56,
42005
- 57,
42006
- 62,
42007
- 63,
42008
- 68,
42009
- 69,
42010
- 74,
42011
- 75,
42012
- 76,
42013
- 77,
42014
- 78,
42015
- 79,
42016
- 80,
42017
- 81,
42018
- 92,
42019
- 93,
42020
- 98,
42021
- 99,
42022
- 112,
42023
- 113,
42024
- 128,
42025
- 129,
42026
- 134,
42027
- 135,
42028
- 148,
42029
- 149,
42030
- 160,
42031
- 161,
42032
- 162,
42033
- 163,
42034
- 164,
42035
- 165,
42036
- 166,
42037
- 167,
42038
- 168,
42039
- 169,
42040
- 170,
42041
- 171,
42042
- 172,
42043
- 173,
42044
- 178,
42045
- 179,
42046
- 184,
42047
- 185,
42048
- 196,
42049
- 197,
42050
- 198,
42051
- 199,
42052
- 200,
42053
- 201,
42054
- 202,
42055
- 203,
42056
- 204,
42057
- 205,
42058
- 206,
42059
- 207,
42060
- 208,
42061
- 209,
42062
- 214,
42063
- 215,
42064
- 220,
42065
- 221
42066
- ];
42067
- } catch (error) {}
42068
- /**
42069
- * Build up the default `inspectOpts` object from the environment variables.
42070
- *
42071
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
42072
- */
42073
- exports.inspectOpts = Object.keys(process.env).filter((key) => {
42074
- return /^debug_/i.test(key);
42075
- }).reduce((obj, key) => {
42076
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
42077
- return k.toUpperCase();
42078
- });
42079
- let val = process.env[key];
42080
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
42081
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
42082
- else if (val === "null") val = null;
42083
- else val = Number(val);
42084
- obj[prop] = val;
42085
- return obj;
42086
- }, {});
42087
- /**
42088
- * Is stdout a TTY? Colored output is enabled when `true`.
42089
- */
42090
- function useColors() {
42091
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
42092
- }
42093
- /**
42094
- * Adds ANSI color escape codes if enabled.
42095
- *
42096
- * @api public
42097
- */
42098
- function formatArgs(args) {
42099
- const { namespace: name, useColors } = this;
42100
- if (useColors) {
42101
- const c = this.color;
42102
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
42103
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
42104
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
42105
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
42106
- } else args[0] = getDate() + name + " " + args[0];
42107
- }
42108
- function getDate() {
42109
- if (exports.inspectOpts.hideDate) return "";
42110
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
42111
- }
42112
- /**
42113
- * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
42114
- */
42115
- function log(...args) {
42116
- return process.stderr.write(util$6.formatWithOptions(exports.inspectOpts, ...args) + "\n");
42117
- }
42118
- /**
42119
- * Save `namespaces`.
42120
- *
42121
- * @param {String} namespaces
42122
- * @api private
42123
- */
42124
- function save(namespaces) {
42125
- if (namespaces) process.env.DEBUG = namespaces;
42126
- else delete process.env.DEBUG;
42127
- }
42128
- /**
42129
- * Load `namespaces`.
42130
- *
42131
- * @return {String} returns the previously persisted debug modes
42132
- * @api private
42133
- */
42134
- function load() {
42135
- return process.env.DEBUG;
42136
- }
42137
- /**
42138
- * Init logic for `debug` instances.
42139
- *
42140
- * Create a new `inspectOpts` object in case `useColors` is set
42141
- * differently for a particular `debug` instance.
42142
- */
42143
- function init(debug) {
42144
- debug.inspectOpts = {};
42145
- const keys = Object.keys(exports.inspectOpts);
42146
- for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
42147
- }
42148
- module.exports = require_common$1()(exports);
42149
- var { formatters } = module.exports;
42150
- /**
42151
- * Map %o to `util.inspect()`, all on a single line.
42152
- */
42153
- formatters.o = function(v) {
42154
- this.inspectOpts.colors = this.useColors;
42155
- return util$6.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
42156
- };
42157
- /**
42158
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
42159
- */
42160
- formatters.O = function(v) {
42161
- this.inspectOpts.colors = this.useColors;
42162
- return util$6.inspect(v, this.inspectOpts);
42163
- };
42164
- }));
42165
- //#endregion
42166
- //#region ../../node_modules/debug/src/index.js
42167
- var require_src = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
42168
- /**
42169
- * Detect Electron renderer / nwjs process, which is node, but we should
42170
- * treat as a browser.
42171
- */
42172
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
42173
- else module.exports = require_node();
42174
- }));
42175
- //#endregion
42176
41371
  //#region ../../node_modules/moleculer/src/loggers/debug.js
42177
41372
  var require_debug = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
42178
41373
  var BaseLogger = require_base$4();
@@ -42214,7 +41409,7 @@ var require_debug = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
42214
41409
  init(loggerFactory) {
42215
41410
  super.init(loggerFactory);
42216
41411
  try {
42217
- this.debug = require_src()("moleculer");
41412
+ this.debug = require_graceful_fs$1.require_src()("moleculer");
42218
41413
  } catch (err) {
42219
41414
  /* istanbul ignore next */
42220
41415
  this.broker.fatal("The 'debug' package is missing! Please install it with 'npm install debug --save' command!", err, true);
@@ -42243,7 +41438,7 @@ var require_debug = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
42243
41438
  var require_file$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
42244
41439
  var FormattedLogger = require_formatted();
42245
41440
  var _ = require_lodash();
42246
- var fs$16 = require("fs/promises");
41441
+ var fs$15 = require("fs/promises");
42247
41442
  var path$37 = require("path");
42248
41443
  var os$12 = require("os");
42249
41444
  var { makeDirs } = require_utils$3();
@@ -42347,7 +41542,7 @@ var require_file$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
42347
41542
  const rows = Array.from(this.queue);
42348
41543
  this.queue.length = 0;
42349
41544
  const buf = rows.join(this.opts.eol) + this.opts.eol;
42350
- return fs$16.appendFile(filename, buf).catch((err) => {
41545
+ return fs$15.appendFile(filename, buf).catch((err) => {
42351
41546
  /* istanbul ignore next */
42352
41547
  console.debug("Unable to write log file:", filename, err);
42353
41548
  });
@@ -42495,8 +41690,8 @@ var require_rfdc = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
42495
41690
  //#endregion
42496
41691
  //#region ../../node_modules/log4js/lib/configuration.js
42497
41692
  var require_configuration = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
42498
- var util$5 = require("util");
42499
- var debug = require_src()("log4js:configuration");
41693
+ var util$4 = require("util");
41694
+ var debug = require_graceful_fs$1.require_src()("log4js:configuration");
42500
41695
  var preProcessingListeners = [];
42501
41696
  var listeners = [];
42502
41697
  var not = (thing) => !thing;
@@ -42513,7 +41708,7 @@ var require_configuration = /* @__PURE__ */ require_chunk.__commonJSMin(((export
42513
41708
  };
42514
41709
  var throwExceptionIf = (config, checks, message) => {
42515
41710
  (Array.isArray(checks) ? checks : [checks]).forEach((test) => {
42516
- if (test) throw new Error(`Problem with log4js configuration: (${util$5.inspect(config, { depth: 5 })}) - ${message}`);
41711
+ if (test) throw new Error(`Problem with log4js configuration: (${util$4.inspect(config, { depth: 5 })}) - ${message}`);
42517
41712
  });
42518
41713
  };
42519
41714
  var configure = (candidate) => {
@@ -42695,7 +41890,7 @@ var require_lib$5 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
42695
41890
  var require_layouts = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
42696
41891
  var dateFormat = require_lib$5();
42697
41892
  var os$11 = require("os");
42698
- var util$4 = require("util");
41893
+ var util$3 = require("util");
42699
41894
  var path$36 = require("path");
42700
41895
  var styles = {
42701
41896
  bold: [1, 22],
@@ -42725,7 +41920,7 @@ var require_layouts = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
42725
41920
  return colorizeStart(style) + str + colorizeEnd(style);
42726
41921
  }
42727
41922
  function timestampLevelAndCategory(loggingEvent, colour) {
42728
- return colorize(util$4.format("[%s] [%s] %s - ", dateFormat.asString(loggingEvent.startTime), loggingEvent.level.toString(), loggingEvent.categoryName), colour);
41923
+ return colorize(util$3.format("[%s] [%s] %s - ", dateFormat.asString(loggingEvent.startTime), loggingEvent.level.toString(), loggingEvent.categoryName), colour);
42729
41924
  }
42730
41925
  /**
42731
41926
  * BasicLayout is a simple layout for storing the logs. The logs are stored
@@ -42737,17 +41932,17 @@ var require_layouts = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
42737
41932
  * @author Stephan Strittmatter
42738
41933
  */
42739
41934
  function basicLayout(loggingEvent) {
42740
- return timestampLevelAndCategory(loggingEvent) + util$4.format(...loggingEvent.data);
41935
+ return timestampLevelAndCategory(loggingEvent) + util$3.format(...loggingEvent.data);
42741
41936
  }
42742
41937
  /**
42743
41938
  * colouredLayout - taken from masylum's fork.
42744
41939
  * same as basicLayout, but with colours.
42745
41940
  */
42746
41941
  function colouredLayout(loggingEvent) {
42747
- return timestampLevelAndCategory(loggingEvent, loggingEvent.level.colour) + util$4.format(...loggingEvent.data);
41942
+ return timestampLevelAndCategory(loggingEvent, loggingEvent.level.colour) + util$3.format(...loggingEvent.data);
42748
41943
  }
42749
41944
  function messagePassThroughLayout(loggingEvent) {
42750
- return util$4.format(...loggingEvent.data);
41945
+ return util$3.format(...loggingEvent.data);
42751
41946
  }
42752
41947
  function dummyLayout(loggingEvent) {
42753
41948
  return loggingEvent.data[0];
@@ -42823,7 +42018,7 @@ var require_layouts = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
42823
42018
  return os$11.hostname().toString();
42824
42019
  }
42825
42020
  function formatMessage(loggingEvent) {
42826
- return util$4.format(...loggingEvent.data);
42021
+ return util$3.format(...loggingEvent.data);
42827
42022
  }
42828
42023
  function endOfLine() {
42829
42024
  return os$11.EOL;
@@ -43258,7 +42453,7 @@ var require_LoggingEvent = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
43258
42453
  //#endregion
43259
42454
  //#region ../../node_modules/log4js/lib/clustering.js
43260
42455
  var require_clustering = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
43261
- var debug = require_src()("log4js:clustering");
42456
+ var debug = require_graceful_fs$1.require_src()("log4js:clustering");
43262
42457
  var LoggingEvent = require_LoggingEvent();
43263
42458
  var configuration = require_configuration();
43264
42459
  var disabled = false;
@@ -43426,7 +42621,7 @@ var require_logLevelFilter = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
43426
42621
  //#endregion
43427
42622
  //#region ../../node_modules/log4js/lib/appenders/categoryFilter.js
43428
42623
  var require_categoryFilter = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
43429
- var debug = require_src()("log4js:categoryFilter");
42624
+ var debug = require_graceful_fs$1.require_src()("log4js:categoryFilter");
43430
42625
  function categoryFilter(excludes, appender) {
43431
42626
  if (typeof excludes === "string") excludes = [excludes];
43432
42627
  return (logEvent) => {
@@ -43446,7 +42641,7 @@ var require_categoryFilter = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
43446
42641
  //#endregion
43447
42642
  //#region ../../node_modules/log4js/lib/appenders/noLogFilter.js
43448
42643
  var require_noLogFilter = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
43449
- var debug = require_src()("log4js:noLogFilter");
42644
+ var debug = require_graceful_fs$1.require_src()("log4js:noLogFilter");
43450
42645
  /**
43451
42646
  * The function removes empty or null regexp from the array
43452
42647
  * @param {string[]} regexp
@@ -43505,724 +42700,10 @@ var require_universalify = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
43505
42700
  };
43506
42701
  }));
43507
42702
  //#endregion
43508
- //#region ../../node_modules/graceful-fs/polyfills.js
43509
- var require_polyfills = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
43510
- var constants = require("constants");
43511
- var origCwd = process.cwd;
43512
- var cwd = null;
43513
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
43514
- process.cwd = function() {
43515
- if (!cwd) cwd = origCwd.call(process);
43516
- return cwd;
43517
- };
43518
- try {
43519
- process.cwd();
43520
- } catch (er) {}
43521
- if (typeof process.chdir === "function") {
43522
- var chdir = process.chdir;
43523
- process.chdir = function(d) {
43524
- cwd = null;
43525
- chdir.call(process, d);
43526
- };
43527
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
43528
- }
43529
- module.exports = patch;
43530
- function patch(fs) {
43531
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
43532
- if (!fs.lutimes) patchLutimes(fs);
43533
- fs.chown = chownFix(fs.chown);
43534
- fs.fchown = chownFix(fs.fchown);
43535
- fs.lchown = chownFix(fs.lchown);
43536
- fs.chmod = chmodFix(fs.chmod);
43537
- fs.fchmod = chmodFix(fs.fchmod);
43538
- fs.lchmod = chmodFix(fs.lchmod);
43539
- fs.chownSync = chownFixSync(fs.chownSync);
43540
- fs.fchownSync = chownFixSync(fs.fchownSync);
43541
- fs.lchownSync = chownFixSync(fs.lchownSync);
43542
- fs.chmodSync = chmodFixSync(fs.chmodSync);
43543
- fs.fchmodSync = chmodFixSync(fs.fchmodSync);
43544
- fs.lchmodSync = chmodFixSync(fs.lchmodSync);
43545
- fs.stat = statFix(fs.stat);
43546
- fs.fstat = statFix(fs.fstat);
43547
- fs.lstat = statFix(fs.lstat);
43548
- fs.statSync = statFixSync(fs.statSync);
43549
- fs.fstatSync = statFixSync(fs.fstatSync);
43550
- fs.lstatSync = statFixSync(fs.lstatSync);
43551
- if (fs.chmod && !fs.lchmod) {
43552
- fs.lchmod = function(path, mode, cb) {
43553
- if (cb) process.nextTick(cb);
43554
- };
43555
- fs.lchmodSync = function() {};
43556
- }
43557
- if (fs.chown && !fs.lchown) {
43558
- fs.lchown = function(path, uid, gid, cb) {
43559
- if (cb) process.nextTick(cb);
43560
- };
43561
- fs.lchownSync = function() {};
43562
- }
43563
- if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
43564
- function rename(from, to, cb) {
43565
- var start = Date.now();
43566
- var backoff = 0;
43567
- fs$rename(from, to, function CB(er) {
43568
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
43569
- setTimeout(function() {
43570
- fs.stat(to, function(stater, st) {
43571
- if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
43572
- else cb(er);
43573
- });
43574
- }, backoff);
43575
- if (backoff < 100) backoff += 10;
43576
- return;
43577
- }
43578
- if (cb) cb(er);
43579
- });
43580
- }
43581
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
43582
- return rename;
43583
- })(fs.rename);
43584
- fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
43585
- function read(fd, buffer, offset, length, position, callback_) {
43586
- var callback;
43587
- if (callback_ && typeof callback_ === "function") {
43588
- var eagCounter = 0;
43589
- callback = function(er, _, __) {
43590
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
43591
- eagCounter++;
43592
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
43593
- }
43594
- callback_.apply(this, arguments);
43595
- };
43596
- }
43597
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
43598
- }
43599
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
43600
- return read;
43601
- })(fs.read);
43602
- fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
43603
- return function(fd, buffer, offset, length, position) {
43604
- var eagCounter = 0;
43605
- while (true) try {
43606
- return fs$readSync.call(fs, fd, buffer, offset, length, position);
43607
- } catch (er) {
43608
- if (er.code === "EAGAIN" && eagCounter < 10) {
43609
- eagCounter++;
43610
- continue;
43611
- }
43612
- throw er;
43613
- }
43614
- };
43615
- })(fs.readSync);
43616
- function patchLchmod(fs) {
43617
- fs.lchmod = function(path, mode, callback) {
43618
- fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
43619
- if (err) {
43620
- if (callback) callback(err);
43621
- return;
43622
- }
43623
- fs.fchmod(fd, mode, function(err) {
43624
- fs.close(fd, function(err2) {
43625
- if (callback) callback(err || err2);
43626
- });
43627
- });
43628
- });
43629
- };
43630
- fs.lchmodSync = function(path, mode) {
43631
- var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
43632
- var threw = true;
43633
- var ret;
43634
- try {
43635
- ret = fs.fchmodSync(fd, mode);
43636
- threw = false;
43637
- } finally {
43638
- if (threw) try {
43639
- fs.closeSync(fd);
43640
- } catch (er) {}
43641
- else fs.closeSync(fd);
43642
- }
43643
- return ret;
43644
- };
43645
- }
43646
- function patchLutimes(fs) {
43647
- if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
43648
- fs.lutimes = function(path, at, mt, cb) {
43649
- fs.open(path, constants.O_SYMLINK, function(er, fd) {
43650
- if (er) {
43651
- if (cb) cb(er);
43652
- return;
43653
- }
43654
- fs.futimes(fd, at, mt, function(er) {
43655
- fs.close(fd, function(er2) {
43656
- if (cb) cb(er || er2);
43657
- });
43658
- });
43659
- });
43660
- };
43661
- fs.lutimesSync = function(path, at, mt) {
43662
- var fd = fs.openSync(path, constants.O_SYMLINK);
43663
- var ret;
43664
- var threw = true;
43665
- try {
43666
- ret = fs.futimesSync(fd, at, mt);
43667
- threw = false;
43668
- } finally {
43669
- if (threw) try {
43670
- fs.closeSync(fd);
43671
- } catch (er) {}
43672
- else fs.closeSync(fd);
43673
- }
43674
- return ret;
43675
- };
43676
- } else if (fs.futimes) {
43677
- fs.lutimes = function(_a, _b, _c, cb) {
43678
- if (cb) process.nextTick(cb);
43679
- };
43680
- fs.lutimesSync = function() {};
43681
- }
43682
- }
43683
- function chmodFix(orig) {
43684
- if (!orig) return orig;
43685
- return function(target, mode, cb) {
43686
- return orig.call(fs, target, mode, function(er) {
43687
- if (chownErOk(er)) er = null;
43688
- if (cb) cb.apply(this, arguments);
43689
- });
43690
- };
43691
- }
43692
- function chmodFixSync(orig) {
43693
- if (!orig) return orig;
43694
- return function(target, mode) {
43695
- try {
43696
- return orig.call(fs, target, mode);
43697
- } catch (er) {
43698
- if (!chownErOk(er)) throw er;
43699
- }
43700
- };
43701
- }
43702
- function chownFix(orig) {
43703
- if (!orig) return orig;
43704
- return function(target, uid, gid, cb) {
43705
- return orig.call(fs, target, uid, gid, function(er) {
43706
- if (chownErOk(er)) er = null;
43707
- if (cb) cb.apply(this, arguments);
43708
- });
43709
- };
43710
- }
43711
- function chownFixSync(orig) {
43712
- if (!orig) return orig;
43713
- return function(target, uid, gid) {
43714
- try {
43715
- return orig.call(fs, target, uid, gid);
43716
- } catch (er) {
43717
- if (!chownErOk(er)) throw er;
43718
- }
43719
- };
43720
- }
43721
- function statFix(orig) {
43722
- if (!orig) return orig;
43723
- return function(target, options, cb) {
43724
- if (typeof options === "function") {
43725
- cb = options;
43726
- options = null;
43727
- }
43728
- function callback(er, stats) {
43729
- if (stats) {
43730
- if (stats.uid < 0) stats.uid += 4294967296;
43731
- if (stats.gid < 0) stats.gid += 4294967296;
43732
- }
43733
- if (cb) cb.apply(this, arguments);
43734
- }
43735
- return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
43736
- };
43737
- }
43738
- function statFixSync(orig) {
43739
- if (!orig) return orig;
43740
- return function(target, options) {
43741
- var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
43742
- if (stats) {
43743
- if (stats.uid < 0) stats.uid += 4294967296;
43744
- if (stats.gid < 0) stats.gid += 4294967296;
43745
- }
43746
- return stats;
43747
- };
43748
- }
43749
- function chownErOk(er) {
43750
- if (!er) return true;
43751
- if (er.code === "ENOSYS") return true;
43752
- if (!process.getuid || process.getuid() !== 0) {
43753
- if (er.code === "EINVAL" || er.code === "EPERM") return true;
43754
- }
43755
- return false;
43756
- }
43757
- }
43758
- }));
43759
- //#endregion
43760
- //#region ../../node_modules/graceful-fs/legacy-streams.js
43761
- var require_legacy_streams = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
43762
- var Stream$2 = require("stream").Stream;
43763
- module.exports = legacy;
43764
- function legacy(fs) {
43765
- return {
43766
- ReadStream,
43767
- WriteStream
43768
- };
43769
- function ReadStream(path, options) {
43770
- if (!(this instanceof ReadStream)) return new ReadStream(path, options);
43771
- Stream$2.call(this);
43772
- var self = this;
43773
- this.path = path;
43774
- this.fd = null;
43775
- this.readable = true;
43776
- this.paused = false;
43777
- this.flags = "r";
43778
- this.mode = 438;
43779
- this.bufferSize = 64 * 1024;
43780
- options = options || {};
43781
- var keys = Object.keys(options);
43782
- for (var index = 0, length = keys.length; index < length; index++) {
43783
- var key = keys[index];
43784
- this[key] = options[key];
43785
- }
43786
- if (this.encoding) this.setEncoding(this.encoding);
43787
- if (this.start !== void 0) {
43788
- if ("number" !== typeof this.start) throw TypeError("start must be a Number");
43789
- if (this.end === void 0) this.end = Infinity;
43790
- else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
43791
- if (this.start > this.end) throw new Error("start must be <= end");
43792
- this.pos = this.start;
43793
- }
43794
- if (this.fd !== null) {
43795
- process.nextTick(function() {
43796
- self._read();
43797
- });
43798
- return;
43799
- }
43800
- fs.open(this.path, this.flags, this.mode, function(err, fd) {
43801
- if (err) {
43802
- self.emit("error", err);
43803
- self.readable = false;
43804
- return;
43805
- }
43806
- self.fd = fd;
43807
- self.emit("open", fd);
43808
- self._read();
43809
- });
43810
- }
43811
- function WriteStream(path, options) {
43812
- if (!(this instanceof WriteStream)) return new WriteStream(path, options);
43813
- Stream$2.call(this);
43814
- this.path = path;
43815
- this.fd = null;
43816
- this.writable = true;
43817
- this.flags = "w";
43818
- this.encoding = "binary";
43819
- this.mode = 438;
43820
- this.bytesWritten = 0;
43821
- options = options || {};
43822
- var keys = Object.keys(options);
43823
- for (var index = 0, length = keys.length; index < length; index++) {
43824
- var key = keys[index];
43825
- this[key] = options[key];
43826
- }
43827
- if (this.start !== void 0) {
43828
- if ("number" !== typeof this.start) throw TypeError("start must be a Number");
43829
- if (this.start < 0) throw new Error("start must be >= zero");
43830
- this.pos = this.start;
43831
- }
43832
- this.busy = false;
43833
- this._queue = [];
43834
- if (this.fd === null) {
43835
- this._open = fs.open;
43836
- this._queue.push([
43837
- this._open,
43838
- this.path,
43839
- this.flags,
43840
- this.mode,
43841
- void 0
43842
- ]);
43843
- this.flush();
43844
- }
43845
- }
43846
- }
43847
- }));
43848
- //#endregion
43849
- //#region ../../node_modules/graceful-fs/clone.js
43850
- var require_clone = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
43851
- module.exports = clone;
43852
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
43853
- return obj.__proto__;
43854
- };
43855
- function clone(obj) {
43856
- if (obj === null || typeof obj !== "object") return obj;
43857
- if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
43858
- else var copy = Object.create(null);
43859
- Object.getOwnPropertyNames(obj).forEach(function(key) {
43860
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
43861
- });
43862
- return copy;
43863
- }
43864
- }));
43865
- //#endregion
43866
- //#region ../../node_modules/graceful-fs/graceful-fs.js
43867
- var require_graceful_fs = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
43868
- var fs$15 = require("fs");
43869
- var polyfills = require_polyfills();
43870
- var legacy = require_legacy_streams();
43871
- var clone = require_clone();
43872
- var util$3 = require("util");
43873
- /* istanbul ignore next - node 0.x polyfill */
43874
- var gracefulQueue;
43875
- var previousSymbol;
43876
- /* istanbul ignore else - node 0.x polyfill */
43877
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
43878
- gracefulQueue = Symbol.for("graceful-fs.queue");
43879
- previousSymbol = Symbol.for("graceful-fs.previous");
43880
- } else {
43881
- gracefulQueue = "___graceful-fs.queue";
43882
- previousSymbol = "___graceful-fs.previous";
43883
- }
43884
- function noop() {}
43885
- function publishQueue(context, queue) {
43886
- Object.defineProperty(context, gracefulQueue, { get: function() {
43887
- return queue;
43888
- } });
43889
- }
43890
- var debug = noop;
43891
- if (util$3.debuglog) debug = util$3.debuglog("gfs4");
43892
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
43893
- var m = util$3.format.apply(util$3, arguments);
43894
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
43895
- console.error(m);
43896
- };
43897
- if (!fs$15[gracefulQueue]) {
43898
- publishQueue(fs$15, global[gracefulQueue] || []);
43899
- fs$15.close = (function(fs$close) {
43900
- function close(fd, cb) {
43901
- return fs$close.call(fs$15, fd, function(err) {
43902
- if (!err) resetQueue();
43903
- if (typeof cb === "function") cb.apply(this, arguments);
43904
- });
43905
- }
43906
- Object.defineProperty(close, previousSymbol, { value: fs$close });
43907
- return close;
43908
- })(fs$15.close);
43909
- fs$15.closeSync = (function(fs$closeSync) {
43910
- function closeSync(fd) {
43911
- fs$closeSync.apply(fs$15, arguments);
43912
- resetQueue();
43913
- }
43914
- Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
43915
- return closeSync;
43916
- })(fs$15.closeSync);
43917
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
43918
- debug(fs$15[gracefulQueue]);
43919
- require("assert").equal(fs$15[gracefulQueue].length, 0);
43920
- });
43921
- }
43922
- if (!global[gracefulQueue]) publishQueue(global, fs$15[gracefulQueue]);
43923
- module.exports = patch(clone(fs$15));
43924
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$15.__patched) {
43925
- module.exports = patch(fs$15);
43926
- fs$15.__patched = true;
43927
- }
43928
- function patch(fs$26) {
43929
- polyfills(fs$26);
43930
- fs$26.gracefulify = patch;
43931
- fs$26.createReadStream = createReadStream;
43932
- fs$26.createWriteStream = createWriteStream;
43933
- var fs$readFile = fs$26.readFile;
43934
- fs$26.readFile = readFile;
43935
- function readFile(path, options, cb) {
43936
- if (typeof options === "function") cb = options, options = null;
43937
- return go$readFile(path, options, cb);
43938
- function go$readFile(path, options, cb, startTime) {
43939
- return fs$readFile(path, options, function(err) {
43940
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43941
- go$readFile,
43942
- [
43943
- path,
43944
- options,
43945
- cb
43946
- ],
43947
- err,
43948
- startTime || Date.now(),
43949
- Date.now()
43950
- ]);
43951
- else if (typeof cb === "function") cb.apply(this, arguments);
43952
- });
43953
- }
43954
- }
43955
- var fs$writeFile = fs$26.writeFile;
43956
- fs$26.writeFile = writeFile;
43957
- function writeFile(path, data, options, cb) {
43958
- if (typeof options === "function") cb = options, options = null;
43959
- return go$writeFile(path, data, options, cb);
43960
- function go$writeFile(path, data, options, cb, startTime) {
43961
- return fs$writeFile(path, data, options, function(err) {
43962
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43963
- go$writeFile,
43964
- [
43965
- path,
43966
- data,
43967
- options,
43968
- cb
43969
- ],
43970
- err,
43971
- startTime || Date.now(),
43972
- Date.now()
43973
- ]);
43974
- else if (typeof cb === "function") cb.apply(this, arguments);
43975
- });
43976
- }
43977
- }
43978
- var fs$appendFile = fs$26.appendFile;
43979
- if (fs$appendFile) fs$26.appendFile = appendFile;
43980
- function appendFile(path, data, options, cb) {
43981
- if (typeof options === "function") cb = options, options = null;
43982
- return go$appendFile(path, data, options, cb);
43983
- function go$appendFile(path, data, options, cb, startTime) {
43984
- return fs$appendFile(path, data, options, function(err) {
43985
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43986
- go$appendFile,
43987
- [
43988
- path,
43989
- data,
43990
- options,
43991
- cb
43992
- ],
43993
- err,
43994
- startTime || Date.now(),
43995
- Date.now()
43996
- ]);
43997
- else if (typeof cb === "function") cb.apply(this, arguments);
43998
- });
43999
- }
44000
- }
44001
- var fs$copyFile = fs$26.copyFile;
44002
- if (fs$copyFile) fs$26.copyFile = copyFile;
44003
- function copyFile(src, dest, flags, cb) {
44004
- if (typeof flags === "function") {
44005
- cb = flags;
44006
- flags = 0;
44007
- }
44008
- return go$copyFile(src, dest, flags, cb);
44009
- function go$copyFile(src, dest, flags, cb, startTime) {
44010
- return fs$copyFile(src, dest, flags, function(err) {
44011
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
44012
- go$copyFile,
44013
- [
44014
- src,
44015
- dest,
44016
- flags,
44017
- cb
44018
- ],
44019
- err,
44020
- startTime || Date.now(),
44021
- Date.now()
44022
- ]);
44023
- else if (typeof cb === "function") cb.apply(this, arguments);
44024
- });
44025
- }
44026
- }
44027
- var fs$readdir = fs$26.readdir;
44028
- fs$26.readdir = readdir;
44029
- var noReaddirOptionVersions = /^v[0-5]\./;
44030
- function readdir(path, options, cb) {
44031
- if (typeof options === "function") cb = options, options = null;
44032
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
44033
- return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
44034
- } : function go$readdir(path, options, cb, startTime) {
44035
- return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
44036
- };
44037
- return go$readdir(path, options, cb);
44038
- function fs$readdirCallback(path, options, cb, startTime) {
44039
- return function(err, files) {
44040
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
44041
- go$readdir,
44042
- [
44043
- path,
44044
- options,
44045
- cb
44046
- ],
44047
- err,
44048
- startTime || Date.now(),
44049
- Date.now()
44050
- ]);
44051
- else {
44052
- if (files && files.sort) files.sort();
44053
- if (typeof cb === "function") cb.call(this, err, files);
44054
- }
44055
- };
44056
- }
44057
- }
44058
- if (process.version.substr(0, 4) === "v0.8") {
44059
- var legStreams = legacy(fs$26);
44060
- ReadStream = legStreams.ReadStream;
44061
- WriteStream = legStreams.WriteStream;
44062
- }
44063
- var fs$ReadStream = fs$26.ReadStream;
44064
- if (fs$ReadStream) {
44065
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
44066
- ReadStream.prototype.open = ReadStream$open;
44067
- }
44068
- var fs$WriteStream = fs$26.WriteStream;
44069
- if (fs$WriteStream) {
44070
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
44071
- WriteStream.prototype.open = WriteStream$open;
44072
- }
44073
- Object.defineProperty(fs$26, "ReadStream", {
44074
- get: function() {
44075
- return ReadStream;
44076
- },
44077
- set: function(val) {
44078
- ReadStream = val;
44079
- },
44080
- enumerable: true,
44081
- configurable: true
44082
- });
44083
- Object.defineProperty(fs$26, "WriteStream", {
44084
- get: function() {
44085
- return WriteStream;
44086
- },
44087
- set: function(val) {
44088
- WriteStream = val;
44089
- },
44090
- enumerable: true,
44091
- configurable: true
44092
- });
44093
- var FileReadStream = ReadStream;
44094
- Object.defineProperty(fs$26, "FileReadStream", {
44095
- get: function() {
44096
- return FileReadStream;
44097
- },
44098
- set: function(val) {
44099
- FileReadStream = val;
44100
- },
44101
- enumerable: true,
44102
- configurable: true
44103
- });
44104
- var FileWriteStream = WriteStream;
44105
- Object.defineProperty(fs$26, "FileWriteStream", {
44106
- get: function() {
44107
- return FileWriteStream;
44108
- },
44109
- set: function(val) {
44110
- FileWriteStream = val;
44111
- },
44112
- enumerable: true,
44113
- configurable: true
44114
- });
44115
- function ReadStream(path, options) {
44116
- if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
44117
- else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
44118
- }
44119
- function ReadStream$open() {
44120
- var that = this;
44121
- open(that.path, that.flags, that.mode, function(err, fd) {
44122
- if (err) {
44123
- if (that.autoClose) that.destroy();
44124
- that.emit("error", err);
44125
- } else {
44126
- that.fd = fd;
44127
- that.emit("open", fd);
44128
- that.read();
44129
- }
44130
- });
44131
- }
44132
- function WriteStream(path, options) {
44133
- if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
44134
- else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
44135
- }
44136
- function WriteStream$open() {
44137
- var that = this;
44138
- open(that.path, that.flags, that.mode, function(err, fd) {
44139
- if (err) {
44140
- that.destroy();
44141
- that.emit("error", err);
44142
- } else {
44143
- that.fd = fd;
44144
- that.emit("open", fd);
44145
- }
44146
- });
44147
- }
44148
- function createReadStream(path, options) {
44149
- return new fs$26.ReadStream(path, options);
44150
- }
44151
- function createWriteStream(path, options) {
44152
- return new fs$26.WriteStream(path, options);
44153
- }
44154
- var fs$open = fs$26.open;
44155
- fs$26.open = open;
44156
- function open(path, flags, mode, cb) {
44157
- if (typeof mode === "function") cb = mode, mode = null;
44158
- return go$open(path, flags, mode, cb);
44159
- function go$open(path, flags, mode, cb, startTime) {
44160
- return fs$open(path, flags, mode, function(err, fd) {
44161
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
44162
- go$open,
44163
- [
44164
- path,
44165
- flags,
44166
- mode,
44167
- cb
44168
- ],
44169
- err,
44170
- startTime || Date.now(),
44171
- Date.now()
44172
- ]);
44173
- else if (typeof cb === "function") cb.apply(this, arguments);
44174
- });
44175
- }
44176
- }
44177
- return fs$26;
44178
- }
44179
- function enqueue(elem) {
44180
- debug("ENQUEUE", elem[0].name, elem[1]);
44181
- fs$15[gracefulQueue].push(elem);
44182
- retry();
44183
- }
44184
- var retryTimer;
44185
- function resetQueue() {
44186
- var now = Date.now();
44187
- for (var i = 0; i < fs$15[gracefulQueue].length; ++i) if (fs$15[gracefulQueue][i].length > 2) {
44188
- fs$15[gracefulQueue][i][3] = now;
44189
- fs$15[gracefulQueue][i][4] = now;
44190
- }
44191
- retry();
44192
- }
44193
- function retry() {
44194
- clearTimeout(retryTimer);
44195
- retryTimer = void 0;
44196
- if (fs$15[gracefulQueue].length === 0) return;
44197
- var elem = fs$15[gracefulQueue].shift();
44198
- var fn = elem[0];
44199
- var args = elem[1];
44200
- var err = elem[2];
44201
- var startTime = elem[3];
44202
- var lastTime = elem[4];
44203
- if (startTime === void 0) {
44204
- debug("RETRY", fn.name, args);
44205
- fn.apply(null, args);
44206
- } else if (Date.now() - startTime >= 6e4) {
44207
- debug("TIMEOUT", fn.name, args);
44208
- var cb = args.pop();
44209
- if (typeof cb === "function") cb.call(null, err);
44210
- } else {
44211
- var sinceAttempt = Date.now() - lastTime;
44212
- var sinceStart = Math.max(lastTime - startTime, 1);
44213
- if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
44214
- debug("RETRY", fn.name, args);
44215
- fn.apply(null, args.concat([startTime]));
44216
- } else fs$15[gracefulQueue].push(elem);
44217
- }
44218
- if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
44219
- }
44220
- }));
44221
- //#endregion
44222
42703
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/fs/index.js
44223
42704
  var require_fs = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
44224
42705
  var u = require_universalify().fromCallback;
44225
- var fs = require_graceful_fs();
42706
+ var fs = require_graceful_fs$1.require_graceful_fs();
44226
42707
  var api = [
44227
42708
  "access",
44228
42709
  "appendFile",
@@ -44321,7 +42802,7 @@ var require_win32 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
44321
42802
  //#endregion
44322
42803
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/mkdirs/mkdirs.js
44323
42804
  var require_mkdirs$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
44324
- var fs = require_graceful_fs();
42805
+ var fs = require_graceful_fs$1.require_graceful_fs();
44325
42806
  var path$34 = require("path");
44326
42807
  var invalidWin32Path = require_win32().invalidWin32Path;
44327
42808
  var o777 = parseInt("0777", 8);
@@ -44368,7 +42849,7 @@ var require_mkdirs$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
44368
42849
  //#endregion
44369
42850
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js
44370
42851
  var require_mkdirs_sync = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
44371
- var fs = require_graceful_fs();
42852
+ var fs = require_graceful_fs$1.require_graceful_fs();
44372
42853
  var path$33 = require("path");
44373
42854
  var invalidWin32Path = require_win32().invalidWin32Path;
44374
42855
  var o777 = parseInt("0777", 8);
@@ -44424,7 +42905,7 @@ var require_mkdirs = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
44424
42905
  //#endregion
44425
42906
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/util/utimes.js
44426
42907
  var require_utimes = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
44427
- var fs = require_graceful_fs();
42908
+ var fs = require_graceful_fs$1.require_graceful_fs();
44428
42909
  var os$10 = require("os");
44429
42910
  var path$32 = require("path");
44430
42911
  function hasMillisResSync() {
@@ -44489,7 +42970,7 @@ var require_utimes = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
44489
42970
  //#endregion
44490
42971
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/util/stat.js
44491
42972
  var require_stat = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
44492
- var fs = require_graceful_fs();
42973
+ var fs = require_graceful_fs$1.require_graceful_fs();
44493
42974
  var path$31 = require("path");
44494
42975
  var NODE_VERSION_MAJOR_WITH_BIGINT = 10;
44495
42976
  var NODE_VERSION_MINOR_WITH_BIGINT = 5;
@@ -44649,7 +43130,7 @@ var require_buffer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
44649
43130
  //#endregion
44650
43131
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/copy-sync/copy-sync.js
44651
43132
  var require_copy_sync$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
44652
- var fs = require_graceful_fs();
43133
+ var fs = require_graceful_fs$1.require_graceful_fs();
44653
43134
  var path$30 = require("path");
44654
43135
  var mkdirpSync = require_mkdirs().mkdirsSync;
44655
43136
  var utimesSync = require_utimes().utimesMillisSync;
@@ -44779,7 +43260,7 @@ var require_path_exists = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
44779
43260
  //#endregion
44780
43261
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/copy/copy.js
44781
43262
  var require_copy$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
44782
- var fs = require_graceful_fs();
43263
+ var fs = require_graceful_fs$1.require_graceful_fs();
44783
43264
  var path$29 = require("path");
44784
43265
  var mkdirp = require_mkdirs().mkdirs;
44785
43266
  var pathExists = require_path_exists().pathExists;
@@ -44939,7 +43420,7 @@ var require_copy = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
44939
43420
  //#endregion
44940
43421
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/remove/rimraf.js
44941
43422
  var require_rimraf = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
44942
- var fs = require_graceful_fs();
43423
+ var fs = require_graceful_fs$1.require_graceful_fs();
44943
43424
  var path$28 = require("path");
44944
43425
  var assert$2 = require("assert");
44945
43426
  var isWindows = process.platform === "win32";
@@ -45129,7 +43610,7 @@ var require_remove = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
45129
43610
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/empty/index.js
45130
43611
  var require_empty = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45131
43612
  var u = require_universalify().fromCallback;
45132
- var fs = require_graceful_fs();
43613
+ var fs = require_graceful_fs$1.require_graceful_fs();
45133
43614
  var path$27 = require("path");
45134
43615
  var mkdir = require_mkdirs();
45135
43616
  var remove = require_remove();
@@ -45173,7 +43654,7 @@ var require_empty = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
45173
43654
  var require_file$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45174
43655
  var u = require_universalify().fromCallback;
45175
43656
  var path$26 = require("path");
45176
- var fs = require_graceful_fs();
43657
+ var fs = require_graceful_fs$1.require_graceful_fs();
45177
43658
  var mkdir = require_mkdirs();
45178
43659
  var pathExists = require_path_exists().pathExists;
45179
43660
  function createFile(file, callback) {
@@ -45216,7 +43697,7 @@ var require_file$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
45216
43697
  var require_link = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45217
43698
  var u = require_universalify().fromCallback;
45218
43699
  var path$25 = require("path");
45219
- var fs = require_graceful_fs();
43700
+ var fs = require_graceful_fs$1.require_graceful_fs();
45220
43701
  var mkdir = require_mkdirs();
45221
43702
  var pathExists = require_path_exists().pathExists;
45222
43703
  function createLink(srcpath, dstpath, callback) {
@@ -45268,7 +43749,7 @@ var require_link = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
45268
43749
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/ensure/symlink-paths.js
45269
43750
  var require_symlink_paths = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45270
43751
  var path$24 = require("path");
45271
- var fs = require_graceful_fs();
43752
+ var fs = require_graceful_fs$1.require_graceful_fs();
45272
43753
  var pathExists = require_path_exists().pathExists;
45273
43754
  /**
45274
43755
  * Function that returns two types of paths, one relative to symlink, and one
@@ -45359,7 +43840,7 @@ var require_symlink_paths = /* @__PURE__ */ require_chunk.__commonJSMin(((export
45359
43840
  //#endregion
45360
43841
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/ensure/symlink-type.js
45361
43842
  var require_symlink_type = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45362
- var fs = require_graceful_fs();
43843
+ var fs = require_graceful_fs$1.require_graceful_fs();
45363
43844
  function symlinkType(srcpath, type, callback) {
45364
43845
  callback = typeof type === "function" ? type : callback;
45365
43846
  type = typeof type === "function" ? false : type;
@@ -45390,7 +43871,7 @@ var require_symlink_type = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
45390
43871
  var require_symlink = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45391
43872
  var u = require_universalify().fromCallback;
45392
43873
  var path$23 = require("path");
45393
- var fs = require_graceful_fs();
43874
+ var fs = require_graceful_fs$1.require_graceful_fs();
45394
43875
  var _mkdirs = require_mkdirs();
45395
43876
  var mkdirs = _mkdirs.mkdirs;
45396
43877
  var mkdirsSync = _mkdirs.mkdirsSync;
@@ -45466,7 +43947,7 @@ var require_ensure = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
45466
43947
  var require_jsonfile$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45467
43948
  var _fs;
45468
43949
  try {
45469
- _fs = require_graceful_fs();
43950
+ _fs = require_graceful_fs$1.require_graceful_fs();
45470
43951
  } catch (_) {
45471
43952
  _fs = require("fs");
45472
43953
  }
@@ -45477,10 +43958,10 @@ var require_jsonfile$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
45477
43958
  }
45478
43959
  if (typeof options === "string") options = { encoding: options };
45479
43960
  options = options || {};
45480
- var fs$22 = options.fs || _fs;
43961
+ var fs$21 = options.fs || _fs;
45481
43962
  var shouldThrow = true;
45482
43963
  if ("throws" in options) shouldThrow = options.throws;
45483
- fs$22.readFile(file, options, function(err, data) {
43964
+ fs$21.readFile(file, options, function(err, data) {
45484
43965
  if (err) return callback(err);
45485
43966
  data = stripBom(data);
45486
43967
  var obj;
@@ -45498,11 +43979,11 @@ var require_jsonfile$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
45498
43979
  function readFileSync(file, options) {
45499
43980
  options = options || {};
45500
43981
  if (typeof options === "string") options = { encoding: options };
45501
- var fs$23 = options.fs || _fs;
43982
+ var fs$22 = options.fs || _fs;
45502
43983
  var shouldThrow = true;
45503
43984
  if ("throws" in options) shouldThrow = options.throws;
45504
43985
  try {
45505
- var content = fs$23.readFileSync(file, options);
43986
+ var content = fs$22.readFileSync(file, options);
45506
43987
  content = stripBom(content);
45507
43988
  return JSON.parse(content, options.reviver);
45508
43989
  } catch (err) {
@@ -45527,7 +44008,7 @@ var require_jsonfile$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
45527
44008
  options = {};
45528
44009
  }
45529
44010
  options = options || {};
45530
- var fs$24 = options.fs || _fs;
44011
+ var fs$23 = options.fs || _fs;
45531
44012
  var str = "";
45532
44013
  try {
45533
44014
  str = stringify(obj, options);
@@ -45535,13 +44016,13 @@ var require_jsonfile$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
45535
44016
  if (callback) callback(err, null);
45536
44017
  return;
45537
44018
  }
45538
- fs$24.writeFile(file, str, options, callback);
44019
+ fs$23.writeFile(file, str, options, callback);
45539
44020
  }
45540
44021
  function writeFileSync(file, obj, options) {
45541
44022
  options = options || {};
45542
- var fs$25 = options.fs || _fs;
44023
+ var fs$24 = options.fs || _fs;
45543
44024
  var str = stringify(obj, options);
45544
- return fs$25.writeFileSync(file, str, options);
44025
+ return fs$24.writeFileSync(file, str, options);
45545
44026
  }
45546
44027
  function stripBom(content) {
45547
44028
  if (Buffer.isBuffer(content)) content = content.toString("utf8");
@@ -45594,7 +44075,7 @@ var require_output_json = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
45594
44075
  //#endregion
45595
44076
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/json/output-json-sync.js
45596
44077
  var require_output_json_sync = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45597
- var fs = require_graceful_fs();
44078
+ var fs = require_graceful_fs$1.require_graceful_fs();
45598
44079
  var path$21 = require("path");
45599
44080
  var mkdir = require_mkdirs();
45600
44081
  var jsonFile = require_jsonfile();
@@ -45623,7 +44104,7 @@ var require_json = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
45623
44104
  //#endregion
45624
44105
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/move-sync/move-sync.js
45625
44106
  var require_move_sync$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45626
- var fs = require_graceful_fs();
44107
+ var fs = require_graceful_fs$1.require_graceful_fs();
45627
44108
  var path$20 = require("path");
45628
44109
  var copySync = require_copy_sync().copySync;
45629
44110
  var removeSync = require_remove().removeSync;
@@ -45670,7 +44151,7 @@ var require_move_sync = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
45670
44151
  //#endregion
45671
44152
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/move/move.js
45672
44153
  var require_move$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45673
- var fs = require_graceful_fs();
44154
+ var fs = require_graceful_fs$1.require_graceful_fs();
45674
44155
  var path$19 = require("path");
45675
44156
  var copy = require_copy().copy;
45676
44157
  var remove = require_remove().remove;
@@ -45734,7 +44215,7 @@ var require_move = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
45734
44215
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/output/index.js
45735
44216
  var require_output = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45736
44217
  var u = require_universalify().fromCallback;
45737
- var fs = require_graceful_fs();
44218
+ var fs = require_graceful_fs$1.require_graceful_fs();
45738
44219
  var path$18 = require("path");
45739
44220
  var mkdir = require_mkdirs();
45740
44221
  var pathExists = require_path_exists().pathExists;
@@ -45934,7 +44415,7 @@ var require_lib$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
45934
44415
  //#endregion
45935
44416
  //#region ../../node_modules/streamroller/lib/fileNameFormatter.js
45936
44417
  var require_fileNameFormatter = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45937
- var debug = require_src()("streamroller:fileNameFormatter");
44418
+ var debug = require_graceful_fs$1.require_src()("streamroller:fileNameFormatter");
45938
44419
  var path$17 = require("path");
45939
44420
  var FILENAME_SEP = ".";
45940
44421
  var ZIP_EXT = ".gz";
@@ -45966,7 +44447,7 @@ var require_fileNameFormatter = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
45966
44447
  //#endregion
45967
44448
  //#region ../../node_modules/streamroller/lib/fileNameParser.js
45968
44449
  var require_fileNameParser = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
45969
- var debug = require_src()("streamroller:fileNameParser");
44450
+ var debug = require_graceful_fs$1.require_src()("streamroller:fileNameParser");
45970
44451
  var FILENAME_SEP = ".";
45971
44452
  var ZIP_EXT = ".gz";
45972
44453
  var format = require_lib$3();
@@ -46045,7 +44526,7 @@ var require_fileNameParser = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
46045
44526
  //#endregion
46046
44527
  //#region ../../node_modules/streamroller/lib/moveAndMaybeCompressFile.js
46047
44528
  var require_moveAndMaybeCompressFile = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
46048
- var debug = require_src()("streamroller:moveAndMaybeCompressFile");
44529
+ var debug = require_graceful_fs$1.require_src()("streamroller:moveAndMaybeCompressFile");
46049
44530
  var fs = require_lib$4();
46050
44531
  var zlib$1 = require("zlib");
46051
44532
  var moveAndMaybeCompressFile = async (sourceFilePath, targetFilePath, needCompress) => {
@@ -46082,7 +44563,7 @@ var require_moveAndMaybeCompressFile = /* @__PURE__ */ require_chunk.__commonJSM
46082
44563
  //#endregion
46083
44564
  //#region ../../node_modules/streamroller/lib/RollingFileWriteStream.js
46084
44565
  var require_RollingFileWriteStream = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
46085
- var debug = require_src()("streamroller:RollingFileWriteStream");
44566
+ var debug = require_graceful_fs$1.require_src()("streamroller:RollingFileWriteStream");
46086
44567
  var fs = require_lib$4();
46087
44568
  var path$16 = require("path");
46088
44569
  var newNow = require_now();
@@ -46326,7 +44807,7 @@ var require_lib$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
46326
44807
  //#endregion
46327
44808
  //#region ../../node_modules/log4js/lib/appenders/file.js
46328
44809
  var require_file = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
46329
- var debug = require_src()("log4js:file");
44810
+ var debug = require_graceful_fs$1.require_src()("log4js:file");
46330
44811
  var path$15 = require("path");
46331
44812
  var streams = require_lib$2();
46332
44813
  var eol$2 = require("os").EOL;
@@ -46432,7 +44913,7 @@ var require_dateFile = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
46432
44913
  //#endregion
46433
44914
  //#region ../../node_modules/log4js/lib/appenders/fileSync.js
46434
44915
  var require_fileSync = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
46435
- var debug = require_src()("log4js:fileSync");
44916
+ var debug = require_graceful_fs$1.require_src()("log4js:fileSync");
46436
44917
  var path$14 = require("path");
46437
44918
  var fs$13 = require("fs");
46438
44919
  var eol = require("os").EOL || "\n";
@@ -46566,7 +45047,7 @@ var require_fileSync = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
46566
45047
  //#region ../../node_modules/log4js/lib/appenders/index.js
46567
45048
  var require_appenders = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
46568
45049
  var path$13 = require("path");
46569
- var debug = require_src()("log4js:appenders");
45050
+ var debug = require_graceful_fs$1.require_src()("log4js:appenders");
46570
45051
  var configuration = require_configuration();
46571
45052
  var clustering = require_clustering();
46572
45053
  var levels = require_levels$1();
@@ -46650,7 +45131,7 @@ var require_appenders = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
46650
45131
  //#endregion
46651
45132
  //#region ../../node_modules/log4js/lib/categories.js
46652
45133
  var require_categories = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
46653
- var debug = require_src()("log4js:categories");
45134
+ var debug = require_graceful_fs$1.require_src()("log4js:categories");
46654
45135
  var configuration = require_configuration();
46655
45136
  var levels = require_levels$1();
46656
45137
  var appenders = require_appenders();
@@ -46777,7 +45258,7 @@ var require_categories = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
46777
45258
  //#endregion
46778
45259
  //#region ../../node_modules/log4js/lib/logger.js
46779
45260
  var require_logger = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
46780
- var debug = require_src()("log4js:logger");
45261
+ var debug = require_graceful_fs$1.require_src()("log4js:logger");
46781
45262
  var LoggingEvent = require_LoggingEvent();
46782
45263
  var levels = require_levels$1();
46783
45264
  var clustering = require_clustering();
@@ -47138,7 +45619,7 @@ var require_log4js$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
47138
45619
  * @since 2005-05-20
47139
45620
  * Website: http://log4js.berlios.de
47140
45621
  */
47141
- var debug = require_src()("log4js:main");
45622
+ var debug = require_graceful_fs$1.require_src()("log4js:main");
47142
45623
  var fs$12 = require("fs");
47143
45624
  var deepClone = require_rfdc()({ proto: true });
47144
45625
  var configuration = require_configuration();
@@ -61122,7 +59603,7 @@ var require_parser$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
61122
59603
  var { EventEmitter: EventEmitter$4 } = require("events");
61123
59604
  var Packet = require_packet();
61124
59605
  var constants = require_constants$4();
61125
- var debug = require_src()("mqtt-packet:parser");
59606
+ var debug = require_graceful_fs$1.require_src()("mqtt-packet:parser");
61126
59607
  module.exports = class Parser extends EventEmitter$4 {
61127
59608
  constructor() {
61128
59609
  super();
@@ -61734,7 +60215,7 @@ var require_writeToStream = /* @__PURE__ */ require_chunk.__commonJSMin(((export
61734
60215
  var zeroBuf = Buffer$2.from([0]);
61735
60216
  var numbers = require_numbers();
61736
60217
  var nextTick = require_process_nextick_args().nextTick;
61737
- var debug = require_src()("mqtt-packet:writeToStream");
60218
+ var debug = require_graceful_fs$1.require_src()("mqtt-packet:writeToStream");
61738
60219
  var numCache = numbers.cache;
61739
60220
  var generateNumber = numbers.generateNumber;
61740
60221
  var generateCache = numbers.generateCache;
@@ -67641,8 +66122,8 @@ var init_esm = require_chunk.__esmMin((() => {
67641
66122
  //#region ../../node_modules/number-allocator/lib/number-allocator.js
67642
66123
  var require_number_allocator$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
67643
66124
  var SortedSet = (init_esm(), require_chunk.__toCommonJS(esm_exports)).OrderedSet;
67644
- var debugTrace = require_src()("number-allocator:trace");
67645
- var debugError = require_src()("number-allocator:error");
66125
+ var debugTrace = require_graceful_fs$1.require_src()("number-allocator:trace");
66126
+ var debugError = require_graceful_fs$1.require_src()("number-allocator:error");
67646
66127
  /**
67647
66128
  * Interval constructor
67648
66129
  * @constructor
@@ -68638,7 +67119,7 @@ var require_client = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
68638
67119
  var mqtt_packet_1 = __importDefault(require_mqtt$2());
68639
67120
  var readable_stream_1 = require_ours();
68640
67121
  var default_1 = __importDefault(require_default());
68641
- var debug_1 = __importDefault(require_src());
67122
+ var debug_1 = __importDefault(require_graceful_fs$1.require_src());
68642
67123
  var validations = __importStar(require_validations());
68643
67124
  var store_1 = __importDefault(require_store());
68644
67125
  var handlers_1 = __importDefault(require_handlers());
@@ -69773,7 +68254,7 @@ var require_ws = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
69773
68254
  exports.streamBuilder = exports.browserStreamBuilder = void 0;
69774
68255
  var buffer_1$3 = require("buffer");
69775
68256
  var ws_1 = __importDefault(require("ws"));
69776
- var debug_1 = __importDefault(require_src());
68257
+ var debug_1 = __importDefault(require_graceful_fs$1.require_src());
69777
68258
  var readable_stream_1 = require_ours();
69778
68259
  var is_browser_1 = __importDefault(require_is_browser());
69779
68260
  var BufferedDuplex_1 = require_BufferedDuplex();
@@ -73807,7 +72288,7 @@ var require_socks = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
73807
72288
  };
73808
72289
  Object.defineProperty(exports, "__esModule", { value: true });
73809
72290
  exports.default = openSocks;
73810
- var debug_1 = __importDefault(require_src());
72291
+ var debug_1 = __importDefault(require_graceful_fs$1.require_src());
73811
72292
  var stream_1 = require("stream");
73812
72293
  var socks_1 = require_build$1();
73813
72294
  var dns = __importStar(require("dns"));
@@ -73939,7 +72420,7 @@ var require_tcp$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
73939
72420
  };
73940
72421
  Object.defineProperty(exports, "__esModule", { value: true });
73941
72422
  var net_1$1 = __importDefault(require("net"));
73942
- var debug_1 = __importDefault(require_src());
72423
+ var debug_1 = __importDefault(require_graceful_fs$1.require_src());
73943
72424
  var socks_1 = __importDefault(require_socks());
73944
72425
  var debug = (0, debug_1.default)("mqttjs:tcp");
73945
72426
  var buildStream = (client, opts) => {
@@ -73966,7 +72447,7 @@ var require_tls = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
73966
72447
  Object.defineProperty(exports, "__esModule", { value: true });
73967
72448
  var tls_1 = require("tls");
73968
72449
  var net_1 = __importDefault(require("net"));
73969
- var debug_1 = __importDefault(require_src());
72450
+ var debug_1 = __importDefault(require_graceful_fs$1.require_src());
73970
72451
  var socks_1 = __importDefault(require_socks());
73971
72452
  var debug = (0, debug_1.default)("mqttjs:tls");
73972
72453
  function connect(opts) {
@@ -74194,7 +72675,7 @@ var require_connect = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
74194
72675
  };
74195
72676
  Object.defineProperty(exports, "__esModule", { value: true });
74196
72677
  exports.connectAsync = connectAsync;
74197
- var debug_1 = __importDefault(require_src());
72678
+ var debug_1 = __importDefault(require_graceful_fs$1.require_src());
74198
72679
  var url_1 = __importDefault(require("url"));
74199
72680
  var client_1 = __importDefault(require_client());
74200
72681
  var is_browser_1 = __importDefault(require_is_browser());
@@ -77450,7 +75931,7 @@ var require_tcp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module)
77450
75931
  var { isObject, isString } = require_utils$3();
77451
75932
  var fs$10 = require("fs");
77452
75933
  var kleur = require_kleur();
77453
- var Node = require_node$1();
75934
+ var Node = require_node();
77454
75935
  var P = require_packets();
77455
75936
  var { resolvePacketID } = require_constants();
77456
75937
  var { MoleculerServerError } = require_errors$2();
@@ -91980,6 +90461,9 @@ function resolveUseHostname() {
91980
90461
  function createBroker(config) {
91981
90462
  const { nodeID, mode, hubAddress, logLevel = "warn", secret, tcpPort = DEFAULT_HUB_TCP_PORT, udpPort = DEFAULT_UDP_PORT } = config;
91982
90463
  const useHostname = resolveUseHostname();
90464
+ const moleculerDebug = process.env["CAMSTACK_MOLECULER_DEBUG"] === "1" || process.env["CAMSTACK_MOLECULER_DEBUG"] === "true";
90465
+ const infraLevel = moleculerDebug ? "debug" : "error";
90466
+ const wildcardLevel = moleculerDebug ? "debug" : logLevel;
91983
90467
  if (mode === "test") return new ServiceBroker({
91984
90468
  nodeID,
91985
90469
  transporter: "Fake",
@@ -92008,17 +90492,19 @@ function createBroker(config) {
92008
90492
  useHostname,
92009
90493
  udpDiscovery: true,
92010
90494
  udpPort,
92011
- udpPeriod: 5
90495
+ udpPeriod: 5,
90496
+ debug: moleculerDebug
92012
90497
  }
92013
90498
  },
92014
90499
  logger: {
92015
90500
  type: "Console",
92016
90501
  options: { level: {
92017
- BROKER: "error",
92018
- TRANSPORTER: "error",
92019
- REGISTRY: "error",
92020
- DISCOVERER: "error",
92021
- "**": logLevel
90502
+ BROKER: infraLevel,
90503
+ TRANSPORTER: infraLevel,
90504
+ TRANSIT: infraLevel,
90505
+ REGISTRY: infraLevel,
90506
+ DISCOVERER: infraLevel,
90507
+ "**": wildcardLevel
92022
90508
  } }
92023
90509
  },
92024
90510
  metrics: metricsConfig
@@ -92026,7 +90512,8 @@ function createBroker(config) {
92026
90512
  const tcpOptions = {
92027
90513
  maxPacketSize: 10 * 1024 * 1024,
92028
90514
  port: config.agentListenPort ?? deriveAgentListenPort(nodeID),
92029
- useHostname
90515
+ useHostname,
90516
+ debug: moleculerDebug
92030
90517
  };
92031
90518
  if (hubAddress) {
92032
90519
  tcpOptions.urls = normalizeHubUrl(hubAddress, tcpPort);
@@ -92047,11 +90534,12 @@ function createBroker(config) {
92047
90534
  logger: {
92048
90535
  type: "Console",
92049
90536
  options: { level: {
92050
- BROKER: "error",
92051
- TRANSPORTER: "error",
92052
- REGISTRY: "error",
92053
- DISCOVERER: "error",
92054
- "**": logLevel
90537
+ BROKER: infraLevel,
90538
+ TRANSPORTER: infraLevel,
90539
+ TRANSIT: infraLevel,
90540
+ REGISTRY: infraLevel,
90541
+ DISCOVERER: infraLevel,
90542
+ "**": wildcardLevel
92055
90543
  } }
92056
90544
  },
92057
90545
  metrics: metricsConfig
@@ -93257,6 +91745,409 @@ var RingBuffer = class {
93257
91745
  }
93258
91746
  };
93259
91747
  //#endregion
91748
+ //#region src/kernel/lifecycle/job-journal.ts
91749
+ var JobJournal = class {
91750
+ jobsDir;
91751
+ indexPath;
91752
+ constructor(jobsDir) {
91753
+ this.jobsDir = jobsDir;
91754
+ this.indexPath = node_path.join(jobsDir, "index.json");
91755
+ }
91756
+ jobPath(id) {
91757
+ return node_path.join(this.jobsDir, `${id}.json`);
91758
+ }
91759
+ writeAtomic(filePath, data) {
91760
+ node_fs.mkdirSync(node_path.dirname(filePath), { recursive: true });
91761
+ const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
91762
+ node_fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
91763
+ encoding: "utf-8",
91764
+ mode: 384
91765
+ });
91766
+ node_fs.renameSync(tmp, filePath);
91767
+ }
91768
+ readIndex() {
91769
+ try {
91770
+ const raw = JSON.parse(node_fs.readFileSync(this.indexPath, "utf-8"));
91771
+ if (raw && Array.isArray(raw.jobIds)) return {
91772
+ version: 1,
91773
+ jobIds: raw.jobIds
91774
+ };
91775
+ } catch {}
91776
+ return {
91777
+ version: 1,
91778
+ jobIds: []
91779
+ };
91780
+ }
91781
+ addToIndex(id) {
91782
+ const idx = this.readIndex();
91783
+ if (idx.jobIds.includes(id)) return;
91784
+ this.writeAtomic(this.indexPath, {
91785
+ version: 1,
91786
+ jobIds: [...idx.jobIds, id]
91787
+ });
91788
+ }
91789
+ createJob(job) {
91790
+ this.writeAtomic(this.jobPath(job.jobId), job);
91791
+ this.addToIndex(job.jobId);
91792
+ }
91793
+ getJob(id) {
91794
+ try {
91795
+ const parsed = _camstack_types.lifecycleJobSchema.safeParse(JSON.parse(node_fs.readFileSync(this.jobPath(id), "utf-8")));
91796
+ return parsed.success ? parsed.data : null;
91797
+ } catch {
91798
+ return null;
91799
+ }
91800
+ }
91801
+ listJobs(opts) {
91802
+ const out = [];
91803
+ for (const id of this.readIndex().jobIds) {
91804
+ const j = this.getJob(id);
91805
+ if (j && (!opts?.activeOnly || j.state === "running")) out.push(j);
91806
+ }
91807
+ return out;
91808
+ }
91809
+ mutate(id, fn) {
91810
+ const job = this.getJob(id);
91811
+ if (!job) throw new Error(`JobJournal: job '${id}' not found`);
91812
+ const next = fn(job);
91813
+ this.writeAtomic(this.jobPath(id), next);
91814
+ return next;
91815
+ }
91816
+ patchTask(jobId, taskId, patch) {
91817
+ return this.mutate(jobId, (j) => ({
91818
+ ...j,
91819
+ tasks: j.tasks.map((t) => t.taskId === taskId ? {
91820
+ ...t,
91821
+ ...patch
91822
+ } : t)
91823
+ }));
91824
+ }
91825
+ appendLog(jobId, taskId, entry) {
91826
+ return this.mutate(jobId, (j) => ({
91827
+ ...j,
91828
+ tasks: j.tasks.map((t) => t.taskId === taskId ? {
91829
+ ...t,
91830
+ steps: [...t.steps, entry]
91831
+ } : t)
91832
+ }));
91833
+ }
91834
+ setJobState(jobId, state) {
91835
+ return this.mutate(jobId, (j) => ({
91836
+ ...j,
91837
+ state
91838
+ }));
91839
+ }
91840
+ };
91841
+ //#endregion
91842
+ //#region src/kernel/lifecycle/staging-area.ts
91843
+ function safeSegment$1(name) {
91844
+ return name.replace(/[^a-zA-Z0-9._-]/g, "_");
91845
+ }
91846
+ var StagingArea = class {
91847
+ stagingDir;
91848
+ deps;
91849
+ constructor(stagingDir, deps) {
91850
+ this.stagingDir = stagingDir;
91851
+ this.deps = deps;
91852
+ }
91853
+ async fetchAndStage(input) {
91854
+ const destDir = node_path.join(this.stagingDir, input.jobId, safeSegment$1(input.name));
91855
+ node_fs.rmSync(destDir, {
91856
+ recursive: true,
91857
+ force: true
91858
+ });
91859
+ const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
91860
+ if (input.signal.aborted) throw new Error("staging aborted after fetch");
91861
+ await this.deps.extract(tgz, destDir);
91862
+ const raw = JSON.parse(node_fs.readFileSync(node_path.join(destDir, "package.json"), "utf-8"));
91863
+ if (raw.version !== input.version) throw new Error(`staging validation failed: ${input.name} expected version ${input.version}, got ${String(raw.version)}`);
91864
+ return { stagedPath: destDir };
91865
+ }
91866
+ cleanup(jobId) {
91867
+ node_fs.rmSync(node_path.join(this.stagingDir, jobId), {
91868
+ recursive: true,
91869
+ force: true
91870
+ });
91871
+ }
91872
+ };
91873
+ //#endregion
91874
+ //#region src/kernel/lifecycle/lifecycle-job-engine.ts
91875
+ var DEFAULT_FETCH_TIMEOUT_MS = 6e4;
91876
+ var DEFAULT_FETCH_CONCURRENCY = 3;
91877
+ var LifecycleJobEngine = class {
91878
+ deps;
91879
+ constructor(deps) {
91880
+ this.deps = deps;
91881
+ }
91882
+ advance(jobId, task, phase, patch = {}) {
91883
+ this.deps.journal.patchTask(jobId, task.taskId, {
91884
+ phase,
91885
+ ...patch
91886
+ });
91887
+ const entry = {
91888
+ tsMs: this.deps.now(),
91889
+ nodeId: task.nodeId,
91890
+ packageName: task.packageName,
91891
+ phase,
91892
+ message: `${task.packageName} → ${phase}`
91893
+ };
91894
+ const job = this.deps.journal.appendLog(jobId, task.taskId, entry);
91895
+ this.deps.emit("progress", job);
91896
+ this.deps.emit("log", job, entry);
91897
+ return job;
91898
+ }
91899
+ /**
91900
+ * Fetch + stage a single addon task (advancing it to `staged`), wrapped in a
91901
+ * per-task abort timeout. On success the resolved `stagedPath` is returned; on
91902
+ * failure the task is marked `failed` and `null` is returned (so the apply
91903
+ * phase skips it). Other tasks are unaffected.
91904
+ */
91905
+ async fetchAddonTask(job, task) {
91906
+ try {
91907
+ this.advance(job.jobId, task, "fetching", {
91908
+ startedAtMs: this.deps.now(),
91909
+ attempts: task.attempts + 1
91910
+ });
91911
+ const ac = new AbortController();
91912
+ const timer = setTimeout(() => ac.abort(), this.deps.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
91913
+ let stagedPath;
91914
+ try {
91915
+ stagedPath = (await this.deps.staging.fetchAndStage({
91916
+ jobId: job.jobId,
91917
+ name: task.packageName,
91918
+ version: task.toVersion,
91919
+ signal: ac.signal
91920
+ })).stagedPath;
91921
+ } finally {
91922
+ clearTimeout(timer);
91923
+ }
91924
+ this.advance(job.jobId, task, "staged", { stagedPath });
91925
+ return {
91926
+ task,
91927
+ stagedPath
91928
+ };
91929
+ } catch (err) {
91930
+ this.advance(job.jobId, task, "failed", {
91931
+ error: err instanceof Error ? err.message : String(err),
91932
+ finishedAtMs: this.deps.now()
91933
+ });
91934
+ return {
91935
+ task,
91936
+ stagedPath: null
91937
+ };
91938
+ }
91939
+ }
91940
+ /**
91941
+ * Apply a single already-staged addon task serially:
91942
+ * `validating` → `applying` → applyAddonUpdate → `restarting` → `done`.
91943
+ * Returns true on success, false if the apply throws (task marked `failed`).
91944
+ */
91945
+ async applyAddonTask(job, task, stagedPath) {
91946
+ try {
91947
+ this.advance(job.jobId, task, "validating");
91948
+ this.advance(job.jobId, task, "applying");
91949
+ await this.deps.applyAddonUpdate({
91950
+ name: task.packageName,
91951
+ version: task.toVersion,
91952
+ stagedPath
91953
+ });
91954
+ this.advance(job.jobId, task, "restarting");
91955
+ this.advance(job.jobId, task, "done", { finishedAtMs: this.deps.now() });
91956
+ return true;
91957
+ } catch (err) {
91958
+ this.advance(job.jobId, task, "failed", {
91959
+ error: err instanceof Error ? err.message : String(err),
91960
+ finishedAtMs: this.deps.now()
91961
+ });
91962
+ return false;
91963
+ }
91964
+ }
91965
+ /**
91966
+ * Run the framework task: stage lockstep → `staged` → requestFrameworkSwap.
91967
+ * In production the process exits after requestFrameworkSwap and the reboot
91968
+ * finalizes the job, so this returns the current durable job WITHOUT
91969
+ * finalization. Returns null only if the framework deps are not wired (the
91970
+ * task is marked `failed` and the caller finalizes the job).
91971
+ */
91972
+ async runFrameworkTask(job, task) {
91973
+ const { stageFramework, requestFrameworkSwap } = this.deps;
91974
+ if (stageFramework === void 0 || requestFrameworkSwap === void 0) {
91975
+ this.advance(job.jobId, task, "failed", {
91976
+ error: "framework swap deps not wired",
91977
+ finishedAtMs: this.deps.now()
91978
+ });
91979
+ return null;
91980
+ }
91981
+ try {
91982
+ this.advance(job.jobId, task, "fetching", {
91983
+ startedAtMs: this.deps.now(),
91984
+ attempts: task.attempts + 1
91985
+ });
91986
+ const ac = new AbortController();
91987
+ const timer = setTimeout(() => ac.abort(), this.deps.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
91988
+ let packages;
91989
+ try {
91990
+ packages = await stageFramework(task, ac.signal);
91991
+ } finally {
91992
+ clearTimeout(timer);
91993
+ }
91994
+ if (packages.length === 0) throw new Error("stageFramework returned no packages");
91995
+ const [firstPackage] = packages;
91996
+ this.advance(job.jobId, task, "staged", { stagedPath: firstPackage.stagedPath });
91997
+ requestFrameworkSwap({
91998
+ jobId: job.jobId,
91999
+ taskId: task.taskId,
92000
+ packages
92001
+ });
92002
+ return this.deps.journal.getJob(job.jobId) ?? job;
92003
+ } catch (err) {
92004
+ this.advance(job.jobId, task, "failed", {
92005
+ error: err instanceof Error ? err.message : String(err),
92006
+ finishedAtMs: this.deps.now()
92007
+ });
92008
+ return null;
92009
+ }
92010
+ }
92011
+ /**
92012
+ * Run the addon fetch phase with a bounded-concurrency worker pool. At most
92013
+ * `fetchConcurrency` fetches are in flight at once; completion order may vary
92014
+ * but the returned outcomes preserve the input task order.
92015
+ */
92016
+ async fetchAddonsBounded(job, addonTasks) {
92017
+ const limit = Math.max(1, this.deps.fetchConcurrency ?? DEFAULT_FETCH_CONCURRENCY);
92018
+ const outcomes = new Array(addonTasks.length);
92019
+ let nextIndex = 0;
92020
+ const worker = async () => {
92021
+ for (;;) {
92022
+ const index = nextIndex;
92023
+ nextIndex += 1;
92024
+ if (index >= addonTasks.length) return;
92025
+ outcomes[index] = await this.fetchAddonTask(job, addonTasks[index]);
92026
+ }
92027
+ };
92028
+ const workerCount = Math.min(limit, addonTasks.length);
92029
+ await Promise.all(Array.from({ length: workerCount }, () => worker()));
92030
+ return outcomes.filter((o) => o !== void 0);
92031
+ }
92032
+ /**
92033
+ * §10 boot reconcile: re-drive every NON-TERMINAL addon task of a job that
92034
+ * was interrupted mid-flight (e.g. a crash) from its on-disk checkpoint.
92035
+ *
92036
+ * Framework tasks are LEFT UNTOUCHED — they are owned by the F2
92037
+ * `resumeFrameworkSwapJob` path (which marks `applied`→`done` on a healthy
92038
+ * reboot). Terminal addon tasks (`done`/`failed`/`skipped`) are skipped.
92039
+ *
92040
+ * Apply is idempotent (`applyAddonUpdate` backs up the live dir + restores on
92041
+ * failure), so every non-terminal addon phase collapses to:
92042
+ * ensure staged (reuse a still-valid `stagedPath` or re-fetch) → apply → done;
92043
+ * on failure → `failed`.
92044
+ *
92045
+ * The job is finalized (`completed`/`partially-failed`/`failed` + staging
92046
+ * cleanup) ONLY when ALL tasks — including any framework task — are terminal.
92047
+ * If a framework task is still non-terminal the job is LEFT `running` (the
92048
+ * reboot/F2 path finalizes it).
92049
+ */
92050
+ async reconcileJob(job) {
92051
+ const exists = this.deps.stagedPathExists ?? ((p) => node_fs.existsSync(p));
92052
+ for (const task of job.tasks) {
92053
+ if (task.target === "framework") continue;
92054
+ if (this.isTerminal(task.phase)) continue;
92055
+ await this.reconcileAddonTask(job, task, exists);
92056
+ }
92057
+ return this.finalizeReconciledJob(job.jobId);
92058
+ }
92059
+ isTerminal(phase) {
92060
+ return phase === "done" || phase === "failed" || phase === "skipped";
92061
+ }
92062
+ /**
92063
+ * Re-drive a single non-terminal addon task: reuse a still-valid `stagedPath`
92064
+ * when present (idempotent re-apply), otherwise re-fetch + stage, then apply.
92065
+ */
92066
+ async reconcileAddonTask(job, task, exists) {
92067
+ let stagedPath = null;
92068
+ if (task.stagedPath !== null && exists(task.stagedPath)) stagedPath = task.stagedPath;
92069
+ else stagedPath = (await this.fetchAddonTask(job, task)).stagedPath;
92070
+ if (stagedPath === null) return;
92071
+ await this.applyAddonTask(job, task, stagedPath);
92072
+ }
92073
+ /**
92074
+ * Finalize a reconciled job: `completed` if all addon tasks succeeded,
92075
+ * `failed` if all failed, `partially-failed` if mixed — but ONLY when every
92076
+ * task (including framework) is terminal. If any task is still non-terminal
92077
+ * (a framework task pending its reboot resume), leave the job `running`.
92078
+ */
92079
+ finalizeReconciledJob(jobId) {
92080
+ const current = this.deps.journal.getJob(jobId);
92081
+ if (current === null) throw new Error(`LifecycleJobEngine: job '${jobId}' vanished during reconcile`);
92082
+ if (!current.tasks.every((t) => this.isTerminal(t.phase))) return current;
92083
+ const anyFailed = current.tasks.some((t) => t.phase === "failed");
92084
+ const allFailed = current.tasks.every((t) => t.phase === "failed");
92085
+ const state = !anyFailed ? "completed" : allFailed ? "failed" : "partially-failed";
92086
+ const finalJob = this.deps.journal.setJobState(jobId, state);
92087
+ this.deps.staging.cleanup(jobId);
92088
+ return finalJob;
92089
+ }
92090
+ async runJob(job) {
92091
+ const addonTasks = job.tasks.filter((t) => t.target !== "framework");
92092
+ const frameworkTasks = job.tasks.filter((t) => t.target === "framework");
92093
+ let failures = 0;
92094
+ let successes = 0;
92095
+ const fetchOutcomes = await this.fetchAddonsBounded(job, addonTasks);
92096
+ for (const outcome of fetchOutcomes) if (outcome.stagedPath === null) failures += 1;
92097
+ for (const outcome of fetchOutcomes) {
92098
+ if (outcome.stagedPath === null) continue;
92099
+ if (await this.applyAddonTask(job, outcome.task, outcome.stagedPath)) successes += 1;
92100
+ else failures += 1;
92101
+ }
92102
+ for (const task of frameworkTasks) {
92103
+ const result = await this.runFrameworkTask(job, task);
92104
+ if (result !== null) return result;
92105
+ failures += 1;
92106
+ }
92107
+ const state = failures === 0 ? "completed" : successes === 0 ? "failed" : "partially-failed";
92108
+ const finalJob = this.deps.journal.setJobState(job.jobId, state);
92109
+ this.deps.staging.cleanup(job.jobId);
92110
+ return finalJob;
92111
+ }
92112
+ };
92113
+ //#endregion
92114
+ //#region src/kernel/lifecycle/framework-staging.ts
92115
+ var FRAMEWORK_LOCKSTEP = [
92116
+ "@camstack/system",
92117
+ "@camstack/types",
92118
+ "@camstack/sdk",
92119
+ "@camstack/shm-ring"
92120
+ ];
92121
+ function safeSegment(name) {
92122
+ return name.replace(/[^a-zA-Z0-9._-]/g, "_");
92123
+ }
92124
+ async function stageFrameworkLockstep(input) {
92125
+ const stagingArea = new StagingArea(input.stagingDir, {
92126
+ fetchTarball: input.fetchTarball,
92127
+ extract: input.extract
92128
+ });
92129
+ const results = [];
92130
+ for (const pkg of FRAMEWORK_LOCKSTEP) {
92131
+ const version = await input.resolveVersion(pkg);
92132
+ const { stagedPath } = await stagingArea.fetchAndStage({
92133
+ jobId: input.jobId,
92134
+ name: pkg,
92135
+ version,
92136
+ signal: input.signal
92137
+ });
92138
+ const backupPath = node_path.join(input.stagingDir, input.jobId, ".bak-fw", safeSegment(pkg));
92139
+ const fromVersion = input.currentVersionOf(pkg);
92140
+ results.push({
92141
+ name: pkg,
92142
+ stagedPath,
92143
+ backupPath,
92144
+ toVersion: version,
92145
+ fromVersion
92146
+ });
92147
+ }
92148
+ return results;
92149
+ }
92150
+ //#endregion
93260
92151
  exports.AGENT_CAP_FWD_ACTION = require_manifest_python_deps.AGENT_CAP_FWD_ACTION;
93261
92152
  exports.AGENT_CAP_FWD_SERVICE = require_manifest_python_deps.AGENT_CAP_FWD_SERVICE;
93262
92153
  exports.AddonApiFactory = AddonApiFactory;
@@ -93292,6 +92183,7 @@ exports.DeviceStore = require_builtins_sqlite_storage_index.DeviceStore$1;
93292
92183
  exports.EVENT_TOPIC_PREFIX = require_manifest_python_deps.EVENT_TOPIC_PREFIX;
93293
92184
  exports.EngineManagerResolver = EngineManagerResolver;
93294
92185
  exports.EventBus = EventBus;
92186
+ exports.FRAMEWORK_LOCKSTEP = FRAMEWORK_LOCKSTEP;
93295
92187
  exports.FeatureManager = FeatureManager;
93296
92188
  exports.FilesystemStorageAddon = require_builtins_sqlite_storage_filesystem_storage_addon.FilesystemStorageAddon;
93297
92189
  exports.FilesystemStorageProvider = require_builtins_sqlite_storage_filesystem_storage_addon.FilesystemStorageProvider;
@@ -93306,6 +92198,8 @@ exports.HubLogForwarder = HubLogForwarder;
93306
92198
  exports.HubNodeRegistry = HubNodeRegistry;
93307
92199
  exports.INFRA_CAPABILITIES = INFRA_CAPABILITIES;
93308
92200
  exports.IntegrationRegistry = IntegrationRegistry;
92201
+ exports.JobJournal = JobJournal;
92202
+ exports.LifecycleJobEngine = LifecycleJobEngine;
93309
92203
  exports.LifecycleStateMachine = LifecycleStateMachine;
93310
92204
  exports.LocalAuthAddon = require_builtins_local_auth_local_auth_addon.LocalAuthAddon;
93311
92205
  exports.LocalChildClient = require_manifest_python_deps.LocalChildClient;
@@ -93353,6 +92247,7 @@ exports.ScopedTokenManager = require_builtins_local_auth_local_auth_addon.Scoped
93353
92247
  exports.SocketChannel = require_manifest_python_deps.SocketChannel;
93354
92248
  exports.SqliteSettingsAddon = require_builtins_sqlite_storage_sqlite_settings_addon.SqliteSettingsAddon;
93355
92249
  exports.SqliteSettingsBackend = require_builtins_sqlite_storage_sqlite_settings_addon.SqliteSettingsBackend;
92250
+ exports.StagingArea = StagingArea;
93356
92251
  exports.StorageLocationManager = StorageLocationManager;
93357
92252
  exports.StorageManager = StorageManager;
93358
92253
  exports.StorageOrchestratorAddon = require_builtins_storage_orchestrator_storage_orchestrator_addon.StorageOrchestratorAddon;
@@ -93493,7 +92388,7 @@ exports.getRestartMarkerPath = getRestartMarkerPath;
93493
92388
  exports.getSinglePidStats = require_resource_monitor.getSinglePidStats;
93494
92389
  exports.getWorkerDeviceRegistry = require_manifest_python_deps.getWorkerDeviceRegistry;
93495
92390
  exports.hashClusterSecret = hashClusterSecret;
93496
- exports.installManifestNativeDeps = installManifestNativeDeps;
92391
+ exports.installManifestNativeDeps = require_manifest_python_deps.installManifestNativeDeps;
93497
92392
  exports.installManifestPythonDeps = require_manifest_python_deps.installManifestPythonDeps;
93498
92393
  exports.installPackageFromNpmSync = installPackageFromNpmSync;
93499
92394
  Object.defineProperty(exports, "installPythonPackages", {
@@ -93530,18 +92425,6 @@ Object.defineProperty(exports, "readinessKey", {
93530
92425
  }
93531
92426
  });
93532
92427
  exports.registerEventBusService = require_manifest_python_deps.registerEventBusService;
93533
- Object.defineProperty(exports, "require_graceful_fs", {
93534
- enumerable: true,
93535
- get: function() {
93536
- return require_graceful_fs;
93537
- }
93538
- });
93539
- Object.defineProperty(exports, "require_src", {
93540
- enumerable: true,
93541
- get: function() {
93542
- return require_src;
93543
- }
93544
- });
93545
92428
  exports.resolveFilePath = resolveFilePath;
93546
92429
  exports.resolveHwAccel = require_manifest_python_deps.resolveHwAccel;
93547
92430
  exports.scheduleSelfRestart = scheduleSelfRestart;
@@ -93554,6 +92437,7 @@ Object.defineProperty(exports, "scopeKey", {
93554
92437
  exports.scopesAllowDeviceCap = scopesAllowDeviceCap;
93555
92438
  exports.serializeTypedArrays = require_manifest_python_deps.serializeTypedArrays;
93556
92439
  exports.setHubConnected = require_manifest_python_deps.setHubConnected;
92440
+ exports.stageFrameworkLockstep = stageFrameworkLockstep;
93557
92441
  exports.stripCamstackDeps = stripCamstackDeps;
93558
92442
  exports.udsChildLogToWorkerEntry = require_manifest_python_deps.udsChildLogToWorkerEntry;
93559
92443
  exports.validateProviderRegistrations = require_manifest_python_deps.validateProviderRegistrations;