@camstack/system 1.0.3 → 1.0.5
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/addon-runner.js +27 -1
- package/dist/addon-runner.mjs +27 -1
- package/dist/builtins/local-auth/local-auth.addon.js +5 -1518
- package/dist/builtins/local-auth/local-auth.addon.mjs +2 -1503
- package/dist/framework-resolver-hook.mjs +48 -0
- package/dist/graceful-fs-BoR9GuPS.mjs +1423 -0
- package/dist/graceful-fs-lg19SZNz.js +1434 -0
- package/dist/index.js +710 -1751
- package/dist/index.mjs +815 -1849
- package/dist/kernel/addon-installer.d.ts +31 -0
- package/dist/kernel/addon-manifest.d.ts +21 -0
- package/dist/kernel/host-externals.d.ts +12 -0
- package/dist/kernel/index.d.ts +7 -0
- package/dist/kernel/lifecycle/framework-staging.d.ts +15 -0
- package/dist/kernel/lifecycle/job-journal.d.ts +19 -0
- package/dist/kernel/lifecycle/lifecycle-job-engine.d.ts +98 -0
- package/dist/kernel/lifecycle/staging-area.d.ts +22 -0
- package/dist/kernel/moleculer/addon-context-factory.d.ts +13 -1
- package/dist/kernel/moleculer/register-framework-resolver.d.ts +8 -0
- package/dist/{main-rtjOwPBR.mjs → main-BOG1xxwD.mjs} +2 -2
- package/dist/{main-DNnMW7Z2.js → main-B_G1JH3Q.js} +31 -31
- package/dist/{manifest-python-deps-D1DbAQEv.js → manifest-python-deps-B4BmMoGT.js} +259 -0
- package/dist/{manifest-python-deps-DZsKTbs1.mjs → manifest-python-deps-CXbKrOdk.mjs} +256 -2
- package/dist/semver-BQBSy1FJ.mjs +1504 -0
- package/dist/semver-D3n3E_fi.js +1515 -0
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -14,25 +14,25 @@ import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
|
|
|
14
14
|
import "./builtins/alerts/index.mjs";
|
|
15
15
|
import { SystemConfigAddon } from "./builtins/system-config/system-config.addon.mjs";
|
|
16
16
|
import "./builtins/system-config/index.mjs";
|
|
17
|
-
import { LocalAuthAddon,
|
|
17
|
+
import { LocalAuthAddon, a as require_safe_buffer, i as AuthManager, n as ApiKeyManager, r as UserManager, t as ScopedTokenManager } from "./builtins/local-auth/local-auth.addon.mjs";
|
|
18
18
|
import "./builtins/local-auth/index.mjs";
|
|
19
19
|
import { DeviceManagerAddon } from "./builtins/device-manager/device-manager.addon.mjs";
|
|
20
20
|
import "./builtins/device-manager/index.mjs";
|
|
21
|
-
import { A as createUdsLoggerWithControl, B as createLocalTransport, C as ipcParentLink, D as createUdsEventBus, E as createUdsEventBridge, F as CapRouteError, G as FrameDecoder, H as UdsLocalTransportServer, I as classifyCapRoute, J as buildUdsNativeCapProxy, K as encodeFrame, L as LocalChildClient, M as AGENT_CAP_FWD_SERVICE, N as CapRouteResolver, O as udsChildLogToWorkerEntry, P as callWithServiceDiscovery, Q as mountNativeCapService, R as LocalChildRegistry, S as ipcChildLink, T as createParentUnownedCallHandler, U as SocketChannel, V as UdsLocalTransportClient, W as localEndpointPath, Y as createBrokerDeviceManagerApi, _ as __resetCapUsageRegistryForTests, a as getWorkerDeviceRegistry, at as capBareAction, b as brokerTransportLink, c as setHubConnected, ct as deserializeTypedArrays, d as registerEventBusService, dt as CustomActionRegistry, et as createAddonService, f as AddonDepsManager, ft as CapabilityHandle, g as CapUsageRegistry, h as createHwAccelService, i as createUdsAddonContext, it as capActionSuffix, j as AGENT_CAP_FWD_ACTION, k as createUdsLogger, l as EVENT_TOPIC_PREFIX, lt as serializeTypedArrays, m as resolveHwAccel, mt as
|
|
21
|
+
import { A as createUdsLoggerWithControl, B as createLocalTransport, C as ipcParentLink, D as createUdsEventBus, E as createUdsEventBridge, F as CapRouteError, G as FrameDecoder, H as UdsLocalTransportServer, I as classifyCapRoute, J as buildUdsNativeCapProxy, K as encodeFrame, L as LocalChildClient, M as AGENT_CAP_FWD_SERVICE, N as CapRouteResolver, O as udsChildLogToWorkerEntry, P as callWithServiceDiscovery, Q as mountNativeCapService, R as LocalChildRegistry, S as ipcChildLink, T as createParentUnownedCallHandler, U as SocketChannel, V as UdsLocalTransportClient, W as localEndpointPath, Y as createBrokerDeviceManagerApi, _ as __resetCapUsageRegistryForTests, a as getWorkerDeviceRegistry, at as capBareAction, b as brokerTransportLink, c as setHubConnected, ct as deserializeTypedArrays, d as registerEventBusService, dt as CustomActionRegistry, et as createAddonService, f as AddonDepsManager, ft as CapabilityHandle, g as CapUsageRegistry, h as createHwAccelService, ht as resolveAddonClass, i as createUdsAddonContext, it as capActionSuffix, j as AGENT_CAP_FWD_ACTION, k as createUdsLogger, l as EVENT_TOPIC_PREFIX, lt as serializeTypedArrays, m as resolveHwAccel, mt as installManifestNativeDeps, n as adaptBrokerToCluster, nt as NATIVE_PROVIDER_SERVICE_INFIX, o as getOrInitReadinessRegistry, ot as capServiceName, p as createKernelHwAccel, pt as CapabilityUnavailableError, q as buildNativeCapProxy, r as createAddonContext, rt as capActionName, s as getOrInitReadinessRegistryForClient, st as parseCapAction, t as installManifestPythonDeps, tt as validateProviderRegistrations, u as getBrokerEventBus, ut as DeviceRegistry, v as getCapUsageRegistry, w as localProviderLink, x as buildLinkChain, y as brokerCallForCap, z as UDS_NO_ROUTE_PREFIX } from "./manifest-python-deps-CXbKrOdk.mjs";
|
|
22
|
+
import { n as require_src, t as require_graceful_fs } from "./graceful-fs-BoR9GuPS.mjs";
|
|
22
23
|
import { PYTHON_VERSION, buildBinaryPath, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
|
|
23
24
|
import { createServer, request } from "node:http";
|
|
24
|
-
import * as fs$
|
|
25
|
+
import * as fs$17 from "node:fs";
|
|
25
26
|
import { accessSync, constants, createReadStream, existsSync, mkdirSync, promises, readFileSync } from "node:fs";
|
|
26
27
|
import * as path$40 from "node:path";
|
|
27
28
|
import path, { dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
28
|
-
import { DATAPLANE_SECRET_HEADER, EventCategory, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, asJsonObject, asNumber, asString, createEvent, emitDownForOwnedCaps, errMsg, parseJsonObject, parseJsonUnknown, readinessKey, scopeKey } from "@camstack/types";
|
|
29
|
-
import * as crypto$4 from "node:crypto";
|
|
29
|
+
import { DATAPLANE_SECRET_HEADER, EventCategory, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, asJsonObject, asNumber, asString, createEvent, emitDownForOwnedCaps, errMsg, lifecycleJobSchema, parseJsonObject, parseJsonUnknown, readinessKey, scopeKey } from "@camstack/types";
|
|
30
30
|
import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
31
31
|
import { execFile, execFileSync, spawn } from "node:child_process";
|
|
32
|
-
import * as util$
|
|
32
|
+
import * as util$8 from "node:util";
|
|
33
33
|
import { promisify } from "node:util";
|
|
34
34
|
import * as vm from "node:vm";
|
|
35
|
-
import * as os$
|
|
35
|
+
import * as os$17 from "node:os";
|
|
36
36
|
import { lstat, readdir, readlink, realpath } from "node:fs/promises";
|
|
37
37
|
import { z } from "zod";
|
|
38
38
|
import { lstatSync, readdir as readdir$1, readdirSync, readlinkSync, realpathSync } from "fs";
|
|
@@ -483,8 +483,8 @@ function buildHeaders(url) {
|
|
|
483
483
|
* Returns the destination path. Skips download if file already exists.
|
|
484
484
|
*/
|
|
485
485
|
async function downloadFile(url, destPath, onProgress) {
|
|
486
|
-
if (fs$
|
|
487
|
-
fs$
|
|
486
|
+
if (fs$17.existsSync(destPath)) return destPath;
|
|
487
|
+
fs$17.mkdirSync(path$40.dirname(destPath), { recursive: true });
|
|
488
488
|
const tmpPath = destPath + ".downloading";
|
|
489
489
|
try {
|
|
490
490
|
const response = await fetch(url, {
|
|
@@ -495,7 +495,7 @@ async function downloadFile(url, destPath, onProgress) {
|
|
|
495
495
|
if (!response.body) throw new Error(`No response body from ${url}`);
|
|
496
496
|
const total = parseInt(response.headers.get("content-length") ?? "0", 10);
|
|
497
497
|
let downloaded = 0;
|
|
498
|
-
const fileStream = fs$
|
|
498
|
+
const fileStream = fs$17.createWriteStream(tmpPath);
|
|
499
499
|
const reader = response.body.getReader();
|
|
500
500
|
try {
|
|
501
501
|
for (;;) {
|
|
@@ -512,11 +512,11 @@ async function downloadFile(url, destPath, onProgress) {
|
|
|
512
512
|
fileStream.on("error", reject);
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
|
-
fs$
|
|
515
|
+
fs$17.renameSync(tmpPath, destPath);
|
|
516
516
|
return destPath;
|
|
517
517
|
} catch (err) {
|
|
518
518
|
try {
|
|
519
|
-
fs$
|
|
519
|
+
fs$17.unlinkSync(tmpPath);
|
|
520
520
|
} catch {}
|
|
521
521
|
throw err;
|
|
522
522
|
}
|
|
@@ -540,12 +540,12 @@ async function downloadModel(options) {
|
|
|
540
540
|
const { url, fallbackUrls = [], destDir, filename, expectedSha256, onProgress } = options;
|
|
541
541
|
const fname = filename ?? url.split("/").pop() ?? "model.bin";
|
|
542
542
|
const destPath = path$40.join(destDir, fname);
|
|
543
|
-
if (fs$
|
|
543
|
+
if (fs$17.existsSync(destPath)) return {
|
|
544
544
|
filePath: destPath,
|
|
545
545
|
downloadedBytes: 0,
|
|
546
546
|
fromCache: true
|
|
547
547
|
};
|
|
548
|
-
fs$
|
|
548
|
+
fs$17.mkdirSync(destDir, { recursive: true });
|
|
549
549
|
const urls = [url, ...fallbackUrls];
|
|
550
550
|
let lastError = null;
|
|
551
551
|
for (const tryUrl of urls) try {
|
|
@@ -553,25 +553,25 @@ async function downloadModel(options) {
|
|
|
553
553
|
if (expectedSha256) {
|
|
554
554
|
const hash = await computeSha256(destPath);
|
|
555
555
|
if (hash !== expectedSha256) {
|
|
556
|
-
fs$
|
|
556
|
+
fs$17.unlinkSync(destPath);
|
|
557
557
|
throw new Error(`SHA256 mismatch: expected ${expectedSha256}, got ${hash}`);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
return {
|
|
561
561
|
filePath: destPath,
|
|
562
|
-
downloadedBytes: fs$
|
|
562
|
+
downloadedBytes: fs$17.statSync(destPath).size,
|
|
563
563
|
fromCache: false
|
|
564
564
|
};
|
|
565
565
|
} catch (e) {
|
|
566
566
|
lastError = e;
|
|
567
|
-
if (fs$
|
|
567
|
+
if (fs$17.existsSync(destPath)) fs$17.unlinkSync(destPath);
|
|
568
568
|
}
|
|
569
569
|
throw lastError ?? /* @__PURE__ */ new Error(`Failed to download model from ${url}`);
|
|
570
570
|
}
|
|
571
571
|
async function computeSha256(filePath) {
|
|
572
572
|
return new Promise((resolve, reject) => {
|
|
573
573
|
const hash = createHash("sha256");
|
|
574
|
-
const stream = fs$
|
|
574
|
+
const stream = fs$17.createReadStream(filePath);
|
|
575
575
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
576
576
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
577
577
|
stream.on("error", reject);
|
|
@@ -595,28 +595,28 @@ async function downloadDirectory(url, destDir, knownFiles, onProgress) {
|
|
|
595
595
|
}));
|
|
596
596
|
if (files.length === 0) throw new Error(`Directory bundle requires explicit \`files\` list (got none for ${url})`);
|
|
597
597
|
const tmpDir = destDir + ".downloading";
|
|
598
|
-
fs$
|
|
598
|
+
fs$17.rmSync(tmpDir, {
|
|
599
599
|
recursive: true,
|
|
600
600
|
force: true
|
|
601
601
|
});
|
|
602
|
-
fs$
|
|
602
|
+
fs$17.mkdirSync(tmpDir, { recursive: true });
|
|
603
603
|
let totalDownloaded = 0;
|
|
604
604
|
try {
|
|
605
605
|
for (const file of files) {
|
|
606
606
|
const destPath = path$40.join(tmpDir, file.relativePath);
|
|
607
|
-
fs$
|
|
607
|
+
fs$17.mkdirSync(path$40.dirname(destPath), { recursive: true });
|
|
608
608
|
await downloadFile(file.fileUrl, destPath, (downloaded, _total) => {
|
|
609
609
|
onProgress?.(totalDownloaded + downloaded, void 0);
|
|
610
610
|
});
|
|
611
|
-
totalDownloaded += fs$
|
|
611
|
+
totalDownloaded += fs$17.statSync(destPath).size;
|
|
612
612
|
}
|
|
613
|
-
fs$
|
|
613
|
+
fs$17.rmSync(destDir, {
|
|
614
614
|
recursive: true,
|
|
615
615
|
force: true
|
|
616
616
|
});
|
|
617
|
-
fs$
|
|
617
|
+
fs$17.renameSync(tmpDir, destDir);
|
|
618
618
|
} catch (err) {
|
|
619
|
-
fs$
|
|
619
|
+
fs$17.rmSync(tmpDir, {
|
|
620
620
|
recursive: true,
|
|
621
621
|
force: true
|
|
622
622
|
});
|
|
@@ -634,12 +634,12 @@ async function ensureModel(modelsDir, entry, format, onProgress) {
|
|
|
634
634
|
if (entry.extraFiles) for (const extra of entry.extraFiles) await downloadFile(extra.url, path$40.join(modelsDir, extra.filename));
|
|
635
635
|
const filename = formatEntry.url.split("/").pop() ?? `${entry.id}.${format}`;
|
|
636
636
|
const modelPath = path$40.join(modelsDir, filename);
|
|
637
|
-
if (fs$
|
|
637
|
+
if (fs$17.existsSync(modelPath)) if (formatEntry.isDirectory && !fs$17.existsSync(path$40.join(modelPath, "Manifest.json"))) fs$17.rmSync(modelPath, {
|
|
638
638
|
recursive: true,
|
|
639
639
|
force: true
|
|
640
640
|
});
|
|
641
641
|
else return modelPath;
|
|
642
|
-
fs$
|
|
642
|
+
fs$17.mkdirSync(modelsDir, { recursive: true });
|
|
643
643
|
if (formatEntry.isDirectory) await downloadDirectory(formatEntry.url, modelPath, formatEntry.files, onProgress);
|
|
644
644
|
else await downloadFile(formatEntry.url, modelPath, (downloaded, total) => onProgress?.(downloaded, total === 0 ? void 0 : total));
|
|
645
645
|
return modelPath;
|
|
@@ -656,19 +656,19 @@ function isModelDownloaded(modelsDir, entry, format) {
|
|
|
656
656
|
const formatEntry = entry.formats[format];
|
|
657
657
|
if (!formatEntry) return false;
|
|
658
658
|
const modelPath = getModelFilePath(modelsDir, entry, format);
|
|
659
|
-
if (!modelPath || !fs$
|
|
660
|
-
if (formatEntry.isDirectory) return fs$
|
|
661
|
-
return fs$
|
|
659
|
+
if (!modelPath || !fs$17.existsSync(modelPath)) return false;
|
|
660
|
+
if (formatEntry.isDirectory) return fs$17.existsSync(path$40.join(modelPath, "Manifest.json"));
|
|
661
|
+
return fs$17.statSync(modelPath).size > 0;
|
|
662
662
|
}
|
|
663
663
|
/** Remove the on-disk model file/directory. Returns true if something was deleted. */
|
|
664
664
|
function deleteModelFromDisk(modelsDir, entry, format) {
|
|
665
665
|
const modelPath = getModelFilePath(modelsDir, entry, format);
|
|
666
|
-
if (!modelPath || !fs$
|
|
667
|
-
if (entry.formats[format]?.isDirectory) fs$
|
|
666
|
+
if (!modelPath || !fs$17.existsSync(modelPath)) return false;
|
|
667
|
+
if (entry.formats[format]?.isDirectory) fs$17.rmSync(modelPath, {
|
|
668
668
|
recursive: true,
|
|
669
669
|
force: true
|
|
670
670
|
});
|
|
671
|
-
else fs$
|
|
671
|
+
else fs$17.unlinkSync(modelPath);
|
|
672
672
|
return true;
|
|
673
673
|
}
|
|
674
674
|
//#endregion
|
|
@@ -705,13 +705,13 @@ var ModelDownloadService = class {
|
|
|
705
705
|
if (!formatEntry) throw new Error(`ModelDownloadService: model "${modelId}" has no ${selectedFormat} format`);
|
|
706
706
|
await this.ensureExtraFiles(modelId);
|
|
707
707
|
const modelPath = this.modelFilePath(entry, selectedFormat);
|
|
708
|
-
if (fs$
|
|
708
|
+
if (fs$17.existsSync(modelPath)) if (formatEntry.isDirectory) if (!fs$17.existsSync(path$40.join(modelPath, "Manifest.json"))) fs$17.rmSync(modelPath, {
|
|
709
709
|
recursive: true,
|
|
710
710
|
force: true
|
|
711
711
|
});
|
|
712
712
|
else return modelPath;
|
|
713
713
|
else return modelPath;
|
|
714
|
-
fs$
|
|
714
|
+
fs$17.mkdirSync(this.modelsDir, { recursive: true });
|
|
715
715
|
if (formatEntry.isDirectory) await this.downloadDirectory(formatEntry.url, modelPath, formatEntry.files, modelId);
|
|
716
716
|
else await downloadFile(formatEntry.url, modelPath, this.onProgress ? (downloaded, total) => this.onProgress(modelId, downloaded, total) : void 0);
|
|
717
717
|
return modelPath;
|
|
@@ -745,9 +745,9 @@ var ModelDownloadService = class {
|
|
|
745
745
|
const formatEntry = entry.formats[selectedFormat];
|
|
746
746
|
if (!formatEntry) return false;
|
|
747
747
|
const modelPath = this.modelFilePath(entry, selectedFormat);
|
|
748
|
-
if (!fs$
|
|
749
|
-
if (formatEntry.isDirectory) return fs$
|
|
750
|
-
return fs$
|
|
748
|
+
if (!fs$17.existsSync(modelPath)) return false;
|
|
749
|
+
if (formatEntry.isDirectory) return fs$17.existsSync(path$40.join(modelPath, "Manifest.json"));
|
|
750
|
+
return fs$17.statSync(modelPath).size > 0;
|
|
751
751
|
}
|
|
752
752
|
/** Get the catalog entry for a model by ID. */
|
|
753
753
|
getEntry(modelId) {
|
|
@@ -794,24 +794,24 @@ var ModelDownloadService = class {
|
|
|
794
794
|
}));
|
|
795
795
|
}
|
|
796
796
|
const tmpDir = destDir + ".downloading";
|
|
797
|
-
fs$
|
|
797
|
+
fs$17.rmSync(tmpDir, {
|
|
798
798
|
recursive: true,
|
|
799
799
|
force: true
|
|
800
800
|
});
|
|
801
|
-
fs$
|
|
801
|
+
fs$17.mkdirSync(tmpDir, { recursive: true });
|
|
802
802
|
try {
|
|
803
803
|
for (const file of filesToDownload) {
|
|
804
804
|
const destPath = path$40.join(tmpDir, file.relativePath);
|
|
805
|
-
fs$
|
|
805
|
+
fs$17.mkdirSync(path$40.dirname(destPath), { recursive: true });
|
|
806
806
|
await downloadFile(file.fileUrl, destPath);
|
|
807
807
|
}
|
|
808
|
-
fs$
|
|
808
|
+
fs$17.rmSync(destDir, {
|
|
809
809
|
recursive: true,
|
|
810
810
|
force: true
|
|
811
811
|
});
|
|
812
|
-
fs$
|
|
812
|
+
fs$17.renameSync(tmpDir, destDir);
|
|
813
813
|
} catch (err) {
|
|
814
|
-
fs$
|
|
814
|
+
fs$17.rmSync(tmpDir, {
|
|
815
815
|
recursive: true,
|
|
816
816
|
force: true
|
|
817
817
|
});
|
|
@@ -835,7 +835,7 @@ var ModelDownloadService = class {
|
|
|
835
835
|
};
|
|
836
836
|
//#endregion
|
|
837
837
|
//#region src/python/python-env-manager.ts
|
|
838
|
-
var execFileAsync$
|
|
838
|
+
var execFileAsync$2 = promisify(execFile);
|
|
839
839
|
var PythonEnvManager = class {
|
|
840
840
|
venvPath;
|
|
841
841
|
cachedProbe = null;
|
|
@@ -845,12 +845,12 @@ var PythonEnvManager = class {
|
|
|
845
845
|
async probe() {
|
|
846
846
|
if (this.cachedProbe) return this.cachedProbe;
|
|
847
847
|
for (const cmd of ["python3", "python"]) try {
|
|
848
|
-
const { stdout } = await execFileAsync$
|
|
848
|
+
const { stdout } = await execFileAsync$2(cmd, ["--version"]);
|
|
849
849
|
const version = stdout.trim().replace("Python ", "");
|
|
850
850
|
const major = parseInt(version.split(".")[0] ?? "0", 10);
|
|
851
851
|
const minor = parseInt(version.split(".")[1] ?? "0", 10);
|
|
852
852
|
if (major < 3 || major === 3 && minor < 10) continue;
|
|
853
|
-
const { stdout: pathOut } = await execFileAsync$
|
|
853
|
+
const { stdout: pathOut } = await execFileAsync$2(cmd, ["-c", "import sys; print(sys.executable)"]);
|
|
854
854
|
this.cachedProbe = {
|
|
855
855
|
available: true,
|
|
856
856
|
version,
|
|
@@ -866,13 +866,13 @@ var PythonEnvManager = class {
|
|
|
866
866
|
async ensure(options) {
|
|
867
867
|
const probe = await this.probe();
|
|
868
868
|
if (!probe.available || !probe.path) throw new Error("Python 3.10+ is required but not found on this system");
|
|
869
|
-
if (!fs$
|
|
869
|
+
if (!fs$17.existsSync(path$40.join(this.venvPath, "bin", "python"))) await execFileAsync$2(probe.path, [
|
|
870
870
|
"-m",
|
|
871
871
|
"venv",
|
|
872
872
|
this.venvPath
|
|
873
873
|
]);
|
|
874
874
|
const venvPython = path$40.join(this.venvPath, "bin", "python");
|
|
875
|
-
if (options.packages.length > 0) await execFileAsync$
|
|
875
|
+
if (options.packages.length > 0) await execFileAsync$2(venvPython, [
|
|
876
876
|
"-m",
|
|
877
877
|
"pip",
|
|
878
878
|
"install",
|
|
@@ -889,7 +889,7 @@ var PythonEnvManager = class {
|
|
|
889
889
|
}
|
|
890
890
|
spawn(script, args) {
|
|
891
891
|
const venvPython = path$40.join(this.venvPath, "bin", "python");
|
|
892
|
-
if (!fs$
|
|
892
|
+
if (!fs$17.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
893
893
|
return spawn(venvPython, [script, ...args]);
|
|
894
894
|
}
|
|
895
895
|
};
|
|
@@ -1137,7 +1137,7 @@ var ReplEngine = class {
|
|
|
1137
1137
|
duration
|
|
1138
1138
|
};
|
|
1139
1139
|
return {
|
|
1140
|
-
output: util$
|
|
1140
|
+
output: util$8.inspect(result, {
|
|
1141
1141
|
depth: 4,
|
|
1142
1142
|
colors: false,
|
|
1143
1143
|
maxArrayLength: 50,
|
|
@@ -1176,8 +1176,8 @@ var ReplEngine = class {
|
|
|
1176
1176
|
async buildSandbox(context) {
|
|
1177
1177
|
const base = {
|
|
1178
1178
|
console: {
|
|
1179
|
-
log: (...args) => util$
|
|
1180
|
-
warn: (...args) => util$
|
|
1179
|
+
log: (...args) => util$8.inspect(args),
|
|
1180
|
+
warn: (...args) => util$8.inspect(args)
|
|
1181
1181
|
},
|
|
1182
1182
|
JSON,
|
|
1183
1183
|
Math,
|
|
@@ -2036,20 +2036,20 @@ var StorageManager = class {
|
|
|
2036
2036
|
const basePath = this.locationManager.getBackend(mappedName).basePath;
|
|
2037
2037
|
location.files = {
|
|
2038
2038
|
async readFile(p) {
|
|
2039
|
-
return fs$
|
|
2039
|
+
return fs$17.promises.readFile(path$40.join(basePath, p));
|
|
2040
2040
|
},
|
|
2041
2041
|
async writeFile(p, data) {
|
|
2042
2042
|
const full = path$40.join(basePath, p);
|
|
2043
|
-
await fs$
|
|
2044
|
-
await fs$
|
|
2043
|
+
await fs$17.promises.mkdir(path$40.dirname(full), { recursive: true });
|
|
2044
|
+
await fs$17.promises.writeFile(full, data);
|
|
2045
2045
|
},
|
|
2046
2046
|
async deleteFile(p) {
|
|
2047
|
-
await fs$
|
|
2047
|
+
await fs$17.promises.rm(path$40.join(basePath, p), { force: true });
|
|
2048
2048
|
},
|
|
2049
2049
|
async listFiles(prefix) {
|
|
2050
2050
|
const dir = prefix ? path$40.join(basePath, prefix) : basePath;
|
|
2051
2051
|
try {
|
|
2052
|
-
return (await fs$
|
|
2052
|
+
return (await fs$17.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
2053
2053
|
} catch {
|
|
2054
2054
|
return [];
|
|
2055
2055
|
}
|
|
@@ -2059,7 +2059,7 @@ var StorageManager = class {
|
|
|
2059
2059
|
},
|
|
2060
2060
|
async exists(p) {
|
|
2061
2061
|
try {
|
|
2062
|
-
await fs$
|
|
2062
|
+
await fs$17.promises.access(path$40.join(basePath, p));
|
|
2063
2063
|
return true;
|
|
2064
2064
|
} catch {
|
|
2065
2065
|
return false;
|
|
@@ -2352,7 +2352,7 @@ function matchPath(pattern, path) {
|
|
|
2352
2352
|
}
|
|
2353
2353
|
//#endregion
|
|
2354
2354
|
//#region src/tls/cert-manager.ts
|
|
2355
|
-
var execFileAsync$
|
|
2355
|
+
var execFileAsync$1 = promisify(execFile);
|
|
2356
2356
|
/**
|
|
2357
2357
|
* Ensure a self-signed TLS certificate exists in the given directory.
|
|
2358
2358
|
* Generates one if missing. Returns paths to cert and key files.
|
|
@@ -2375,10 +2375,10 @@ async function ensureTlsCert(dataDir, options) {
|
|
|
2375
2375
|
const sanDns = new Set([
|
|
2376
2376
|
"localhost",
|
|
2377
2377
|
cn,
|
|
2378
|
-
os$
|
|
2378
|
+
os$17.hostname()
|
|
2379
2379
|
]);
|
|
2380
2380
|
const sanIps = new Set(["127.0.0.1", "::1"]);
|
|
2381
|
-
const interfaces = os$
|
|
2381
|
+
const interfaces = os$17.networkInterfaces();
|
|
2382
2382
|
for (const addrs of Object.values(interfaces)) {
|
|
2383
2383
|
if (!addrs) continue;
|
|
2384
2384
|
for (const addr of addrs) if (!addr.internal) sanIps.add(addr.address);
|
|
@@ -2389,7 +2389,7 @@ async function ensureTlsCert(dataDir, options) {
|
|
|
2389
2389
|
for (const dns of sanDns) sanParts.push(`DNS:${dns}`);
|
|
2390
2390
|
for (const ip of sanIps) sanParts.push(`IP:${ip}`);
|
|
2391
2391
|
const sanString = sanParts.join(",");
|
|
2392
|
-
await execFileAsync$
|
|
2392
|
+
await execFileAsync$1("openssl", [
|
|
2393
2393
|
"req",
|
|
2394
2394
|
"-x509",
|
|
2395
2395
|
"-newkey",
|
|
@@ -2970,13 +2970,13 @@ var AddonLoader = class {
|
|
|
2970
2970
|
/** Scan addons directory and load all addon packages.
|
|
2971
2971
|
* Supports scoped layout: addons/@scope/package-name/ */
|
|
2972
2972
|
async loadFromDirectory(addonsDir) {
|
|
2973
|
-
if (!fs$
|
|
2974
|
-
const entries = fs$
|
|
2973
|
+
if (!fs$17.existsSync(addonsDir)) return;
|
|
2974
|
+
const entries = fs$17.readdirSync(addonsDir, { withFileTypes: true });
|
|
2975
2975
|
for (const entry of entries) {
|
|
2976
2976
|
if (!isDirectoryEntry(entry, addonsDir)) continue;
|
|
2977
2977
|
if (entry.name.startsWith("@")) {
|
|
2978
2978
|
const scopeDir = path$40.join(addonsDir, entry.name);
|
|
2979
|
-
const scopeEntries = fs$
|
|
2979
|
+
const scopeEntries = fs$17.readdirSync(scopeDir, { withFileTypes: true });
|
|
2980
2980
|
for (const scopeEntry of scopeEntries) {
|
|
2981
2981
|
if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
|
|
2982
2982
|
await this.tryLoadAddon(path$40.join(scopeDir, scopeEntry.name));
|
|
@@ -2988,7 +2988,7 @@ var AddonLoader = class {
|
|
|
2988
2988
|
}
|
|
2989
2989
|
async tryLoadAddon(addonDir) {
|
|
2990
2990
|
const pkgJsonPath = path$40.join(addonDir, "package.json");
|
|
2991
|
-
if (!fs$
|
|
2991
|
+
if (!fs$17.existsSync(pkgJsonPath)) return;
|
|
2992
2992
|
try {
|
|
2993
2993
|
await this.loadFromAddonDir(addonDir);
|
|
2994
2994
|
} catch (err) {
|
|
@@ -3006,7 +3006,7 @@ var AddonLoader = class {
|
|
|
3006
3006
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
3007
3007
|
async loadFromAddonDir(addonDir) {
|
|
3008
3008
|
const pkgJsonPath = path$40.join(addonDir, "package.json");
|
|
3009
|
-
const pkgJson = asJsonObject(parseJsonUnknown(fs$
|
|
3009
|
+
const pkgJson = asJsonObject(parseJsonUnknown(fs$17.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
3010
3010
|
const packageNameRaw = pkgJson["name"];
|
|
3011
3011
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
3012
3012
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -3039,7 +3039,7 @@ var AddonLoader = class {
|
|
|
3039
3039
|
if (!declaration.entry) throw new Error(`Addon "${declaration.id}" has no entry point in package.json`);
|
|
3040
3040
|
const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
|
|
3041
3041
|
let entryPath = path$40.resolve(addonDir, entryFile);
|
|
3042
|
-
if (!fs$
|
|
3042
|
+
if (!fs$17.existsSync(entryPath)) {
|
|
3043
3043
|
const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
|
|
3044
3044
|
entryPath = [
|
|
3045
3045
|
`${base}.cjs`,
|
|
@@ -3048,9 +3048,9 @@ var AddonLoader = class {
|
|
|
3048
3048
|
path$40.resolve(addonDir, "dist", "index.cjs"),
|
|
3049
3049
|
path$40.resolve(addonDir, "dist", "index.mjs"),
|
|
3050
3050
|
path$40.resolve(addonDir, declaration.entry)
|
|
3051
|
-
].find((p) => fs$
|
|
3051
|
+
].find((p) => fs$17.existsSync(p)) ?? entryPath;
|
|
3052
3052
|
}
|
|
3053
|
-
if (!fs$
|
|
3053
|
+
if (!fs$17.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
3054
3054
|
const modUnknown = await import(entryPath);
|
|
3055
3055
|
const mod = isRecord$1(modUnknown) ? modUnknown : {};
|
|
3056
3056
|
const AddonClass = resolveAddonClass(mod);
|
|
@@ -3134,7 +3134,7 @@ var AddonLoader = class {
|
|
|
3134
3134
|
function isDirectoryEntry(entry, parentDir) {
|
|
3135
3135
|
if (entry.isDirectory()) return true;
|
|
3136
3136
|
if (entry.isSymbolicLink()) try {
|
|
3137
|
-
return fs$
|
|
3137
|
+
return fs$17.statSync(path$40.join(parentDir, entry.name)).isDirectory();
|
|
3138
3138
|
} catch {
|
|
3139
3139
|
return false;
|
|
3140
3140
|
}
|
|
@@ -3227,7 +3227,7 @@ var AddonEngineManager = class {
|
|
|
3227
3227
|
* Single source of truth — replaces scattered mkdirSync calls.
|
|
3228
3228
|
*/
|
|
3229
3229
|
function ensureDir(dirPath) {
|
|
3230
|
-
fs$
|
|
3230
|
+
fs$17.mkdirSync(dirPath, { recursive: true });
|
|
3231
3231
|
}
|
|
3232
3232
|
/**
|
|
3233
3233
|
* Copy a directory recursively.
|
|
@@ -3235,12 +3235,12 @@ function ensureDir(dirPath) {
|
|
|
3235
3235
|
*/
|
|
3236
3236
|
function copyDirRecursive(src, dest) {
|
|
3237
3237
|
ensureDir(dest);
|
|
3238
|
-
const entries = fs$
|
|
3238
|
+
const entries = fs$17.readdirSync(src, { withFileTypes: true });
|
|
3239
3239
|
for (const entry of entries) {
|
|
3240
3240
|
const srcPath = path$40.join(src, entry.name);
|
|
3241
3241
|
const destPath = path$40.join(dest, entry.name);
|
|
3242
3242
|
if (entry.isDirectory()) copyDirRecursive(srcPath, destPath);
|
|
3243
|
-
else fs$
|
|
3243
|
+
else fs$17.copyFileSync(srcPath, destPath);
|
|
3244
3244
|
}
|
|
3245
3245
|
}
|
|
3246
3246
|
/**
|
|
@@ -3278,13 +3278,13 @@ function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
3278
3278
|
if (typeof fileEntry !== "string") continue;
|
|
3279
3279
|
if (fileEntry === "dist" || fileEntry.includes("*")) continue;
|
|
3280
3280
|
const srcPath = path$40.join(sourceDir, fileEntry);
|
|
3281
|
-
if (!fs$
|
|
3281
|
+
if (!fs$17.existsSync(srcPath)) continue;
|
|
3282
3282
|
const destPath = path$40.join(destDir, fileEntry);
|
|
3283
|
-
const stat = fs$
|
|
3283
|
+
const stat = fs$17.statSync(srcPath);
|
|
3284
3284
|
if (stat.isDirectory()) copyDirRecursive(srcPath, destPath);
|
|
3285
3285
|
else if (stat.isFile()) {
|
|
3286
3286
|
ensureDir(path$40.dirname(destPath));
|
|
3287
|
-
fs$
|
|
3287
|
+
fs$17.copyFileSync(srcPath, destPath);
|
|
3288
3288
|
}
|
|
3289
3289
|
}
|
|
3290
3290
|
}
|
|
@@ -3295,10 +3295,10 @@ function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
3295
3295
|
function isSourceNewer(packageDir) {
|
|
3296
3296
|
const srcDir = path$40.join(packageDir, "src");
|
|
3297
3297
|
const distDir = path$40.join(packageDir, "dist");
|
|
3298
|
-
if (!fs$
|
|
3298
|
+
if (!fs$17.existsSync(srcDir) || !fs$17.existsSync(distDir)) return true;
|
|
3299
3299
|
try {
|
|
3300
|
-
const distMtime = fs$
|
|
3301
|
-
const entries = fs$
|
|
3300
|
+
const distMtime = fs$17.statSync(distDir).mtimeMs;
|
|
3301
|
+
const entries = fs$17.readdirSync(srcDir, {
|
|
3302
3302
|
withFileTypes: true,
|
|
3303
3303
|
recursive: true
|
|
3304
3304
|
});
|
|
@@ -3306,7 +3306,7 @@ function isSourceNewer(packageDir) {
|
|
|
3306
3306
|
if (!entry.isFile()) continue;
|
|
3307
3307
|
const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
|
|
3308
3308
|
const filePath = path$40.join(parentDir, entry.name);
|
|
3309
|
-
if (fs$
|
|
3309
|
+
if (fs$17.statSync(filePath).mtimeMs > distMtime) return true;
|
|
3310
3310
|
}
|
|
3311
3311
|
return false;
|
|
3312
3312
|
} catch {
|
|
@@ -3321,9 +3321,9 @@ function isSourceNewer(packageDir) {
|
|
|
3321
3321
|
function ensureLibraryBuilt(packageName, packagesDir) {
|
|
3322
3322
|
const dirName = packageName.replace("@camstack/", "");
|
|
3323
3323
|
const sourceDir = path$40.join(packagesDir, dirName);
|
|
3324
|
-
if (!fs$
|
|
3324
|
+
if (!fs$17.existsSync(sourceDir)) return;
|
|
3325
3325
|
const distDir = path$40.join(sourceDir, "dist");
|
|
3326
|
-
if (fs$
|
|
3326
|
+
if (fs$17.existsSync(path$40.join(distDir, "index.js")) || fs$17.existsSync(path$40.join(distDir, "index.mjs"))) return;
|
|
3327
3327
|
console.warn(`[ensureLibraryBuilt] ${packageName} has no dist/ — run 'npm run build' first`);
|
|
3328
3328
|
}
|
|
3329
3329
|
/**
|
|
@@ -3332,7 +3332,7 @@ function ensureLibraryBuilt(packageName, packagesDir) {
|
|
|
3332
3332
|
* Uses synchronous child_process calls (suitable for first-boot and update paths).
|
|
3333
3333
|
*/
|
|
3334
3334
|
function installPackageFromNpmSync(packageName, targetDir) {
|
|
3335
|
-
const tmpDir = fs$
|
|
3335
|
+
const tmpDir = fs$17.mkdtempSync(path$40.join(os$17.tmpdir(), "camstack-install-"));
|
|
3336
3336
|
try {
|
|
3337
3337
|
const tgzFilename = execFileSync("npm", [
|
|
3338
3338
|
"pack",
|
|
@@ -3354,21 +3354,21 @@ function installPackageFromNpmSync(packageName, targetDir) {
|
|
|
3354
3354
|
extractDir
|
|
3355
3355
|
], { timeout: 3e4 });
|
|
3356
3356
|
const packageSubDir = path$40.join(extractDir, "package");
|
|
3357
|
-
const srcPkgJsonDir = fs$
|
|
3358
|
-
fs$
|
|
3357
|
+
const srcPkgJsonDir = fs$17.existsSync(path$40.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
3358
|
+
fs$17.rmSync(targetDir, {
|
|
3359
3359
|
recursive: true,
|
|
3360
3360
|
force: true
|
|
3361
3361
|
});
|
|
3362
3362
|
ensureDir(targetDir);
|
|
3363
|
-
fs$
|
|
3363
|
+
fs$17.copyFileSync(path$40.join(srcPkgJsonDir, "package.json"), path$40.join(targetDir, "package.json"));
|
|
3364
3364
|
const distSrc = path$40.join(srcPkgJsonDir, "dist");
|
|
3365
|
-
if (fs$
|
|
3365
|
+
if (fs$17.existsSync(distSrc)) copyDirRecursive(distSrc, path$40.join(targetDir, "dist"));
|
|
3366
3366
|
try {
|
|
3367
|
-
const npmPkg = asJsonObject(parseJsonUnknown(fs$
|
|
3367
|
+
const npmPkg = asJsonObject(parseJsonUnknown(fs$17.readFileSync(path$40.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
3368
3368
|
if (npmPkg) copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
3369
3369
|
} catch {}
|
|
3370
3370
|
} finally {
|
|
3371
|
-
fs$
|
|
3371
|
+
fs$17.rmSync(tmpDir, {
|
|
3372
3372
|
recursive: true,
|
|
3373
3373
|
force: true
|
|
3374
3374
|
});
|
|
@@ -3391,12 +3391,12 @@ var AddonManifest = class {
|
|
|
3391
3391
|
*/
|
|
3392
3392
|
read() {
|
|
3393
3393
|
if (this.cache != null) return this.cache;
|
|
3394
|
-
if (!fs$
|
|
3394
|
+
if (!fs$17.existsSync(this.manifestPath)) {
|
|
3395
3395
|
this.cache = this.empty();
|
|
3396
3396
|
return this.cache;
|
|
3397
3397
|
}
|
|
3398
3398
|
try {
|
|
3399
|
-
const raw = fs$
|
|
3399
|
+
const raw = fs$17.readFileSync(this.manifestPath, "utf-8");
|
|
3400
3400
|
const parsed = JSON.parse(raw);
|
|
3401
3401
|
if (parsed.version !== MANIFEST_VERSION) {
|
|
3402
3402
|
process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
|
|
@@ -3417,13 +3417,13 @@ var AddonManifest = class {
|
|
|
3417
3417
|
* a half-written file.
|
|
3418
3418
|
*/
|
|
3419
3419
|
write(manifest) {
|
|
3420
|
-
fs$
|
|
3420
|
+
fs$17.mkdirSync(path$40.dirname(this.manifestPath), { recursive: true });
|
|
3421
3421
|
const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
|
|
3422
|
-
fs$
|
|
3422
|
+
fs$17.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
3423
3423
|
encoding: "utf-8",
|
|
3424
3424
|
mode: 384
|
|
3425
3425
|
});
|
|
3426
|
-
fs$
|
|
3426
|
+
fs$17.renameSync(tmp, this.manifestPath);
|
|
3427
3427
|
this.cache = manifest;
|
|
3428
3428
|
}
|
|
3429
3429
|
/** Lookup a single addon's manifest entry, or `null` if not tracked. */
|
|
@@ -3467,6 +3467,66 @@ var AddonManifest = class {
|
|
|
3467
3467
|
this.cache = null;
|
|
3468
3468
|
}
|
|
3469
3469
|
/**
|
|
3470
|
+
* Reconcile the manifest with what is actually present on disk.
|
|
3471
|
+
*
|
|
3472
|
+
* For every `@scope/<pkg>` directory under `addonsDir` that has a
|
|
3473
|
+
* readable `package.json` but NO manifest entry yet, add one with
|
|
3474
|
+
* source `'seed'`. Existing entries are left untouched (their source,
|
|
3475
|
+
* version and timestamps are authoritative — a later install/update
|
|
3476
|
+
* overwrites them through `upsert`).
|
|
3477
|
+
*
|
|
3478
|
+
* Why this exists: addons baked into the Docker/Electron image are
|
|
3479
|
+
* copied straight into `addonsDir` by the container entrypoint (the
|
|
3480
|
+
* launcher's `ensureRequiredPackages` then sees `package.json` already
|
|
3481
|
+
* present and skips, never calling `upsert`). Without this reconcile
|
|
3482
|
+
* those seeded addons stay absent from the manifest, so `applyUpdate`
|
|
3483
|
+
* rejects them with "not currently tracked in manifest" — which is
|
|
3484
|
+
* exactly what broke "Update all" on a fresh image. Idempotent and
|
|
3485
|
+
* safe to run on every boot.
|
|
3486
|
+
*
|
|
3487
|
+
* Returns the number of entries added.
|
|
3488
|
+
*/
|
|
3489
|
+
reconcileFromDisk(addonsDir) {
|
|
3490
|
+
if (!fs$17.existsSync(addonsDir)) return 0;
|
|
3491
|
+
const m = this.read();
|
|
3492
|
+
let added = 0;
|
|
3493
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3494
|
+
for (const scope of fs$17.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
3495
|
+
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
3496
|
+
const scopeDir = path$40.join(addonsDir, scope.name);
|
|
3497
|
+
for (const pkg of fs$17.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
3498
|
+
if (!pkg.isDirectory()) continue;
|
|
3499
|
+
const pkgJsonPath = path$40.join(scopeDir, pkg.name, "package.json");
|
|
3500
|
+
if (!fs$17.existsSync(pkgJsonPath)) continue;
|
|
3501
|
+
let pkgJson;
|
|
3502
|
+
try {
|
|
3503
|
+
const parsed = JSON.parse(fs$17.readFileSync(pkgJsonPath, "utf-8"));
|
|
3504
|
+
if (typeof parsed !== "object" || parsed == null) continue;
|
|
3505
|
+
pkgJson = parsed;
|
|
3506
|
+
} catch {
|
|
3507
|
+
continue;
|
|
3508
|
+
}
|
|
3509
|
+
if (!pkgJson.name || !pkgJson.version) continue;
|
|
3510
|
+
const addons = pkgJson.camstack?.addons;
|
|
3511
|
+
if (!Array.isArray(addons) || addons.length === 0) continue;
|
|
3512
|
+
if (m.addons[pkgJson.name] != null) continue;
|
|
3513
|
+
m.addons[pkgJson.name] = {
|
|
3514
|
+
name: pkgJson.name,
|
|
3515
|
+
version: pkgJson.version,
|
|
3516
|
+
source: "seed",
|
|
3517
|
+
installedAt: now,
|
|
3518
|
+
updatedAt: now
|
|
3519
|
+
};
|
|
3520
|
+
added++;
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
if (added > 0) {
|
|
3524
|
+
m.updatedAt = now;
|
|
3525
|
+
this.write(m);
|
|
3526
|
+
}
|
|
3527
|
+
return added;
|
|
3528
|
+
}
|
|
3529
|
+
/**
|
|
3470
3530
|
* Migration helper: if the manifest is empty but the addons directory
|
|
3471
3531
|
* has packages with `.install-source` markers (the legacy per-addon
|
|
3472
3532
|
* tracking), seed the manifest from those markers. Runs once at boot.
|
|
@@ -3475,28 +3535,28 @@ var AddonManifest = class {
|
|
|
3475
3535
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
3476
3536
|
const m = this.read();
|
|
3477
3537
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
3478
|
-
if (!fs$
|
|
3538
|
+
if (!fs$17.existsSync(addonsDir)) return 0;
|
|
3479
3539
|
let migrated = 0;
|
|
3480
3540
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3481
|
-
for (const scope of fs$
|
|
3541
|
+
for (const scope of fs$17.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
3482
3542
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
3483
3543
|
const scopeDir = path$40.join(addonsDir, scope.name);
|
|
3484
|
-
for (const pkg of fs$
|
|
3544
|
+
for (const pkg of fs$17.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
3485
3545
|
if (!pkg.isDirectory()) continue;
|
|
3486
3546
|
const pkgDir = path$40.join(scopeDir, pkg.name);
|
|
3487
3547
|
const markerPath = path$40.join(pkgDir, ".install-source");
|
|
3488
3548
|
const pkgJsonPath = path$40.join(pkgDir, "package.json");
|
|
3489
|
-
if (!fs$
|
|
3549
|
+
if (!fs$17.existsSync(pkgJsonPath)) continue;
|
|
3490
3550
|
let pkgJson;
|
|
3491
3551
|
try {
|
|
3492
|
-
const parsed = JSON.parse(fs$
|
|
3552
|
+
const parsed = JSON.parse(fs$17.readFileSync(pkgJsonPath, "utf-8"));
|
|
3493
3553
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
3494
3554
|
pkgJson = parsed;
|
|
3495
3555
|
} catch {
|
|
3496
3556
|
continue;
|
|
3497
3557
|
}
|
|
3498
3558
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
3499
|
-
const source = fs$
|
|
3559
|
+
const source = fs$17.existsSync(markerPath) ? fs$17.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
3500
3560
|
m.addons[pkgJson.name] = {
|
|
3501
3561
|
name: pkgJson.name,
|
|
3502
3562
|
version: pkgJson.version,
|
|
@@ -3522,175 +3582,6 @@ var AddonManifest = class {
|
|
|
3522
3582
|
}
|
|
3523
3583
|
};
|
|
3524
3584
|
//#endregion
|
|
3525
|
-
//#region src/kernel/deps/manifest-native-deps.ts
|
|
3526
|
-
var execFileAsync$1 = promisify(execFile);
|
|
3527
|
-
/**
|
|
3528
|
-
* Native node modules an addon needs at runtime but cannot be bundled
|
|
3529
|
-
* (`.node` binary files require ABI-matched compilation). Mirror of the
|
|
3530
|
-
* Python `requirements.txt` pattern in `manifest-python-deps.ts` —
|
|
3531
|
-
* declared in the addon's `package.json` under `camstack.nativeDependencies`,
|
|
3532
|
-
* installed per-addon at install time so the host's regular `npm install`
|
|
3533
|
-
* doesn't pull in the union of every camera driver's native deps.
|
|
3534
|
-
*
|
|
3535
|
-
* Phase E of the bundles + builder modernization spec
|
|
3536
|
-
* (`docs/superpowers/specs/2026-05-09-bundles-and-builder-modernization-design.md`).
|
|
3537
|
-
*
|
|
3538
|
-
* Idempotent: hashes the `nativeDependencies` map and writes a marker
|
|
3539
|
-
* to `<addonDir>/.camstack-native-deps-installed`. Re-installing only
|
|
3540
|
-
* happens when the declared set changes.
|
|
3541
|
-
*
|
|
3542
|
-
* Failure modes:
|
|
3543
|
-
* - manifest doesn't declare `nativeDependencies` (or declares empty) → no-op
|
|
3544
|
-
* - `npm install` fails → throws (caller decides whether to abort install)
|
|
3545
|
-
* - rebuild step fails → logs warning + continues (install may still
|
|
3546
|
-
* work if prebuilt binaries shipped in the package cover the host
|
|
3547
|
-
* ABI; surface a clear error at first `import` of the native module
|
|
3548
|
-
* otherwise).
|
|
3549
|
-
*/
|
|
3550
|
-
async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry) {
|
|
3551
|
-
const native = readNativeDeps(pkgRaw);
|
|
3552
|
-
if (native == null || Object.keys(native).length === 0) return;
|
|
3553
|
-
const markerFile = path$40.join(addonDir, ".camstack-native-deps-installed");
|
|
3554
|
-
const markerHash = hashDeclaration(native);
|
|
3555
|
-
if (markerMatches(markerFile, markerHash)) {
|
|
3556
|
-
logger.debug("Native deps already installed (marker matches)", { meta: {
|
|
3557
|
-
addonDir,
|
|
3558
|
-
count: Object.keys(native).length
|
|
3559
|
-
} });
|
|
3560
|
-
return;
|
|
3561
|
-
}
|
|
3562
|
-
const specs = Object.entries(native).map(([name, range]) => `${name}@${range}`);
|
|
3563
|
-
logger.info("Installing native dependencies", { meta: {
|
|
3564
|
-
addonDir,
|
|
3565
|
-
specs
|
|
3566
|
-
} });
|
|
3567
|
-
const args = [
|
|
3568
|
-
"install",
|
|
3569
|
-
"--no-save",
|
|
3570
|
-
"--no-package-lock",
|
|
3571
|
-
"--no-audit",
|
|
3572
|
-
"--no-fund",
|
|
3573
|
-
"--omit=dev",
|
|
3574
|
-
"--omit=peer",
|
|
3575
|
-
...registry ? ["--registry", registry] : [],
|
|
3576
|
-
...specs
|
|
3577
|
-
];
|
|
3578
|
-
try {
|
|
3579
|
-
await execFileAsync$1("npm", args, {
|
|
3580
|
-
cwd: addonDir,
|
|
3581
|
-
timeout: 3e5
|
|
3582
|
-
});
|
|
3583
|
-
} catch (err) {
|
|
3584
|
-
throw new Error(`npm install of native deps failed for ${addonDir}: ${errMsg(err)}`, { cause: err });
|
|
3585
|
-
}
|
|
3586
|
-
await rebuildNativeDeps(addonDir, Object.keys(native), logger);
|
|
3587
|
-
try {
|
|
3588
|
-
fs$18.writeFileSync(markerFile, markerHash);
|
|
3589
|
-
} catch (err) {
|
|
3590
|
-
logger.warn("Failed to write native deps marker", { meta: {
|
|
3591
|
-
markerFile,
|
|
3592
|
-
error: errMsg(err)
|
|
3593
|
-
} });
|
|
3594
|
-
}
|
|
3595
|
-
}
|
|
3596
|
-
/** Read & validate `camstack.nativeDependencies`. Returns null when absent. */
|
|
3597
|
-
function readNativeDeps(pkgRaw) {
|
|
3598
|
-
const camstack = asJsonObject(pkgRaw["camstack"]);
|
|
3599
|
-
if (!camstack) return null;
|
|
3600
|
-
const native = asJsonObject(camstack["nativeDependencies"]);
|
|
3601
|
-
if (!native) return null;
|
|
3602
|
-
const out = {};
|
|
3603
|
-
for (const [k, v] of Object.entries(native)) {
|
|
3604
|
-
const range = asString(v);
|
|
3605
|
-
if (range) out[k] = range;
|
|
3606
|
-
}
|
|
3607
|
-
return Object.keys(out).length > 0 ? out : null;
|
|
3608
|
-
}
|
|
3609
|
-
/** SHA-256 of the canonical-keyed declaration — drives marker idempotency. */
|
|
3610
|
-
function hashDeclaration(deps) {
|
|
3611
|
-
const canonical = Object.keys(deps).toSorted().map((k) => `${k}@${deps[k]}`).join("\n");
|
|
3612
|
-
return crypto$4.createHash("sha256").update(canonical).digest("hex");
|
|
3613
|
-
}
|
|
3614
|
-
function markerMatches(markerFile, expected) {
|
|
3615
|
-
try {
|
|
3616
|
-
return fs$18.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
3617
|
-
} catch {
|
|
3618
|
-
return false;
|
|
3619
|
-
}
|
|
3620
|
-
}
|
|
3621
|
-
/**
|
|
3622
|
-
* Rebuild native modules against the host's runtime ABI.
|
|
3623
|
-
*
|
|
3624
|
-
* Detection: `process.versions.electron` is set when running inside
|
|
3625
|
-
* Electron's main/renderer process (set even when `ELECTRON_RUN_AS_NODE`
|
|
3626
|
-
* isn't), giving us a reliable signal. Plain Node leaves it undefined.
|
|
3627
|
-
*
|
|
3628
|
-
* Electron path: tries `@electron/rebuild` programmatically, falling
|
|
3629
|
-
* back to `npx electron-rebuild` if the package isn't directly available.
|
|
3630
|
-
* Node path: `npm rebuild --prefix <addonDir>` re-runs the install
|
|
3631
|
-
* scripts of every package under that directory.
|
|
3632
|
-
*
|
|
3633
|
-
* Failures here are non-fatal: many native packages ship prebuilt
|
|
3634
|
-
* binaries that cover both ABIs, so the rebuild may be unnecessary.
|
|
3635
|
-
* The first `import` of an actually-mismatched binary throws a clear
|
|
3636
|
-
* error that points the operator at this rebuild step.
|
|
3637
|
-
*/
|
|
3638
|
-
async function rebuildNativeDeps(addonDir, packageNames, logger) {
|
|
3639
|
-
if (typeof process.versions.electron === "string") {
|
|
3640
|
-
const electronVersion = process.versions.electron;
|
|
3641
|
-
logger.info("Rebuilding native deps for Electron", { meta: {
|
|
3642
|
-
addonDir,
|
|
3643
|
-
electronVersion,
|
|
3644
|
-
packages: packageNames
|
|
3645
|
-
} });
|
|
3646
|
-
try {
|
|
3647
|
-
const rebuildModule = await import("./main-rtjOwPBR.mjs").then((m) => /* @__PURE__ */ __toESM$1(m.default)).catch(() => null);
|
|
3648
|
-
if (rebuildModule?.rebuild) {
|
|
3649
|
-
await rebuildModule.rebuild({
|
|
3650
|
-
buildPath: addonDir,
|
|
3651
|
-
electronVersion,
|
|
3652
|
-
onlyModules: packageNames
|
|
3653
|
-
});
|
|
3654
|
-
return;
|
|
3655
|
-
}
|
|
3656
|
-
logger.warn("@electron/rebuild not available — falling back to npx", { meta: { addonDir } });
|
|
3657
|
-
await execFileAsync$1("npx", [
|
|
3658
|
-
"--yes",
|
|
3659
|
-
"electron-rebuild",
|
|
3660
|
-
"-m",
|
|
3661
|
-
addonDir,
|
|
3662
|
-
"-v",
|
|
3663
|
-
electronVersion
|
|
3664
|
-
], {
|
|
3665
|
-
cwd: addonDir,
|
|
3666
|
-
timeout: 6e5
|
|
3667
|
-
});
|
|
3668
|
-
} catch (err) {
|
|
3669
|
-
logger.warn("Electron rebuild failed (continuing — prebuilt binary may be present)", { meta: {
|
|
3670
|
-
addonDir,
|
|
3671
|
-
error: errMsg(err)
|
|
3672
|
-
} });
|
|
3673
|
-
}
|
|
3674
|
-
return;
|
|
3675
|
-
}
|
|
3676
|
-
logger.info("Rebuilding native deps for Node", { meta: {
|
|
3677
|
-
addonDir,
|
|
3678
|
-
nodeAbi: process.versions.modules,
|
|
3679
|
-
packages: packageNames
|
|
3680
|
-
} });
|
|
3681
|
-
try {
|
|
3682
|
-
await execFileAsync$1("npm", ["rebuild", ...packageNames], {
|
|
3683
|
-
cwd: addonDir,
|
|
3684
|
-
timeout: 6e5
|
|
3685
|
-
});
|
|
3686
|
-
} catch (err) {
|
|
3687
|
-
logger.warn("npm rebuild failed (continuing — prebuilt binary may be present)", { meta: {
|
|
3688
|
-
addonDir,
|
|
3689
|
-
error: errMsg(err)
|
|
3690
|
-
} });
|
|
3691
|
-
}
|
|
3692
|
-
}
|
|
3693
|
-
//#endregion
|
|
3694
3585
|
//#region src/kernel/addon-installer.ts
|
|
3695
3586
|
var execFileAsync = promisify(execFile);
|
|
3696
3587
|
function parseInstallSource(value) {
|
|
@@ -3705,7 +3596,7 @@ function parseInstallSource(value) {
|
|
|
3705
3596
|
function readPackageJson(pkgJsonPath) {
|
|
3706
3597
|
let raw;
|
|
3707
3598
|
try {
|
|
3708
|
-
raw = asJsonObject(parseJsonUnknown(fs$
|
|
3599
|
+
raw = asJsonObject(parseJsonUnknown(fs$17.readFileSync(pkgJsonPath, "utf-8")));
|
|
3709
3600
|
} catch {
|
|
3710
3601
|
return null;
|
|
3711
3602
|
}
|
|
@@ -3774,7 +3665,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3774
3665
|
} catch {
|
|
3775
3666
|
return Object.freeze([]);
|
|
3776
3667
|
}
|
|
3777
|
-
const raw = fs$
|
|
3668
|
+
const raw = fs$17.readFileSync(pkgPath, "utf-8");
|
|
3778
3669
|
const parsed = JSON.parse(raw);
|
|
3779
3670
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
3780
3671
|
return Object.freeze(deps.filter((name) => name.startsWith("@camstack/addon-") || name === "@camstack/system"));
|
|
@@ -3818,7 +3709,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3818
3709
|
}
|
|
3819
3710
|
for (const packageName of pkgList) {
|
|
3820
3711
|
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
3821
|
-
if (fs$
|
|
3712
|
+
if (fs$17.existsSync(path$40.join(addonDir, "package.json"))) {
|
|
3822
3713
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
3823
3714
|
continue;
|
|
3824
3715
|
}
|
|
@@ -3840,6 +3731,21 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3840
3731
|
}
|
|
3841
3732
|
}
|
|
3842
3733
|
/**
|
|
3734
|
+
* Reconcile the install manifest with the addons actually present on
|
|
3735
|
+
* disk. Seeded addons (baked into the image and copied verbatim by the
|
|
3736
|
+
* container entrypoint) never pass through an `install*` codepath, so
|
|
3737
|
+
* they are missing from `manifest.json` and `applyUpdate` would reject
|
|
3738
|
+
* them with "not currently tracked in manifest". Call this once after
|
|
3739
|
+
* `ensureRequiredPackages` so every on-disk addon is updatable.
|
|
3740
|
+
*
|
|
3741
|
+
* Returns the number of manifest entries added.
|
|
3742
|
+
*/
|
|
3743
|
+
reconcileManifest() {
|
|
3744
|
+
const added = this.manifest.reconcileFromDisk(this.addonsDir);
|
|
3745
|
+
if (added > 0) this.logger.info(`Manifest reconciled — ${added} seeded addon(s) registered`);
|
|
3746
|
+
return added;
|
|
3747
|
+
}
|
|
3748
|
+
/**
|
|
3843
3749
|
* Install a single addon — on-demand installer used by AddonPackageService
|
|
3844
3750
|
* (admin UI "Install addon" / "Reinstall" buttons).
|
|
3845
3751
|
*
|
|
@@ -3892,12 +3798,12 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3892
3798
|
*/
|
|
3893
3799
|
async installSymlink(packageName, sourceDir, pkgData, targetDir) {
|
|
3894
3800
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
3895
|
-
fs$
|
|
3801
|
+
fs$17.rmSync(targetDir, {
|
|
3896
3802
|
recursive: true,
|
|
3897
3803
|
force: true
|
|
3898
3804
|
});
|
|
3899
3805
|
ensureDir(path$40.dirname(targetDir));
|
|
3900
|
-
fs$
|
|
3806
|
+
fs$17.symlinkSync(sourceDir, targetDir, "dir");
|
|
3901
3807
|
this.manifest.upsert(packageName, {
|
|
3902
3808
|
version: asString(pkgData.version, "0.0.0"),
|
|
3903
3809
|
source: "local"
|
|
@@ -3911,16 +3817,16 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3911
3817
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
3912
3818
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
3913
3819
|
const distDir = path$40.join(sourceDir, "dist");
|
|
3914
|
-
if (!fs$
|
|
3915
|
-
fs$
|
|
3820
|
+
if (!fs$17.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
3821
|
+
fs$17.rmSync(targetDir, {
|
|
3916
3822
|
recursive: true,
|
|
3917
3823
|
force: true
|
|
3918
3824
|
});
|
|
3919
3825
|
ensureDir(targetDir);
|
|
3920
|
-
fs$
|
|
3826
|
+
fs$17.writeFileSync(path$40.join(targetDir, "package.json"), JSON.stringify(stripCamstackDeps(pkgData), null, 2));
|
|
3921
3827
|
copyDirRecursive(distDir, path$40.join(targetDir, "dist"));
|
|
3922
3828
|
copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
3923
|
-
fs$
|
|
3829
|
+
fs$17.writeFileSync(path$40.join(targetDir, ".install-source"), "local");
|
|
3924
3830
|
const localPkgVersion = asString(pkgData.version, "0.0.0");
|
|
3925
3831
|
this.manifest.upsert(packageName, {
|
|
3926
3832
|
version: localPkgVersion,
|
|
@@ -3956,7 +3862,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3956
3862
|
* unusual auth, offline mode, etc).
|
|
3957
3863
|
*/
|
|
3958
3864
|
async installFromNpm(packageName, version) {
|
|
3959
|
-
const tmpDir = fs$
|
|
3865
|
+
const tmpDir = fs$17.mkdtempSync(path$40.join(os$17.tmpdir(), "camstack-addon-npm-"));
|
|
3960
3866
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
3961
3867
|
this.logger.info(`${packageName} — installing from npm`);
|
|
3962
3868
|
try {
|
|
@@ -3970,19 +3876,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3970
3876
|
];
|
|
3971
3877
|
if (this.registry) args.push("--registry", this.registry);
|
|
3972
3878
|
const { stdout } = await execFileAsync("npm", args, { timeout: 12e4 });
|
|
3973
|
-
const tgzFiles = fs$
|
|
3879
|
+
const tgzFiles = fs$17.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
3974
3880
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
3975
3881
|
return path$40.join(tmpDir, tgzFiles[0]);
|
|
3976
3882
|
});
|
|
3977
3883
|
const result = await this.installFromTgz(tgzPath);
|
|
3978
|
-
fs$
|
|
3884
|
+
fs$17.writeFileSync(path$40.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
3979
3885
|
this.manifest.upsert(result.name, {
|
|
3980
3886
|
version: result.version,
|
|
3981
3887
|
source: "npm"
|
|
3982
3888
|
});
|
|
3983
3889
|
return result;
|
|
3984
3890
|
} finally {
|
|
3985
|
-
fs$
|
|
3891
|
+
fs$17.rmSync(tmpDir, {
|
|
3986
3892
|
recursive: true,
|
|
3987
3893
|
force: true
|
|
3988
3894
|
});
|
|
@@ -4020,12 +3926,12 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4020
3926
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
4021
3927
|
const tgzPath = path$40.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
4022
3928
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
4023
|
-
fs$
|
|
3929
|
+
fs$17.writeFileSync(tgzPath, buf);
|
|
4024
3930
|
return tgzPath;
|
|
4025
3931
|
}
|
|
4026
3932
|
/** Install addon from a tgz file (uploaded or downloaded) */
|
|
4027
3933
|
async installFromTgz(tgzPath) {
|
|
4028
|
-
const tmpDir = fs$
|
|
3934
|
+
const tmpDir = fs$17.mkdtempSync(path$40.join(os$17.tmpdir(), "camstack-addon-install-"));
|
|
4029
3935
|
try {
|
|
4030
3936
|
await execFileAsync("tar", [
|
|
4031
3937
|
"-xzf",
|
|
@@ -4034,22 +3940,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4034
3940
|
tmpDir
|
|
4035
3941
|
], { timeout: 3e4 });
|
|
4036
3942
|
const extractedDir = path$40.join(tmpDir, "package");
|
|
4037
|
-
const pkgJsonPath = fs$
|
|
4038
|
-
if (!fs$
|
|
3943
|
+
const pkgJsonPath = fs$17.existsSync(path$40.join(extractedDir, "package.json")) ? path$40.join(extractedDir, "package.json") : path$40.join(tmpDir, "package.json");
|
|
3944
|
+
if (!fs$17.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
4039
3945
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
4040
3946
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
4041
3947
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
4042
3948
|
const targetDir = path$40.join(this.addonsDir, pkgView.name);
|
|
4043
|
-
fs$
|
|
3949
|
+
fs$17.rmSync(targetDir, {
|
|
4044
3950
|
recursive: true,
|
|
4045
3951
|
force: true
|
|
4046
3952
|
});
|
|
4047
3953
|
ensureDir(targetDir);
|
|
4048
3954
|
const sourceDir = path$40.dirname(pkgJsonPath);
|
|
4049
3955
|
const strippedManifest = stripCamstackDeps(pkgView.raw);
|
|
4050
|
-
fs$
|
|
3956
|
+
fs$17.writeFileSync(path$40.join(targetDir, "package.json"), JSON.stringify(strippedManifest, null, 2));
|
|
4051
3957
|
const sourceDist = path$40.join(sourceDir, "dist");
|
|
4052
|
-
if (fs$
|
|
3958
|
+
if (fs$17.existsSync(sourceDist)) copyDirRecursive(sourceDist, path$40.join(targetDir, "dist"));
|
|
4053
3959
|
copyExtraFileDirs(pkgView.raw, sourceDir, targetDir);
|
|
4054
3960
|
const strippedRuntimeDeps = strippedManifest["dependencies"];
|
|
4055
3961
|
if (strippedRuntimeDeps != null && typeof strippedRuntimeDeps === "object" && Object.keys(strippedRuntimeDeps).length > 0) {
|
|
@@ -4074,7 +3980,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4074
3980
|
try {
|
|
4075
3981
|
await installManifestNativeDeps(targetDir, pkgView.raw, this.logger, this.registry);
|
|
4076
3982
|
} catch (nativeErr) {
|
|
4077
|
-
fs$
|
|
3983
|
+
fs$17.rmSync(targetDir, {
|
|
4078
3984
|
recursive: true,
|
|
4079
3985
|
force: true
|
|
4080
3986
|
});
|
|
@@ -4089,7 +3995,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4089
3995
|
version: pkgView.version
|
|
4090
3996
|
};
|
|
4091
3997
|
} finally {
|
|
4092
|
-
fs$
|
|
3998
|
+
fs$17.rmSync(tmpDir, {
|
|
4093
3999
|
recursive: true,
|
|
4094
4000
|
force: true
|
|
4095
4001
|
});
|
|
@@ -4115,13 +4021,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4115
4021
|
const current = this.manifest.get(packageName);
|
|
4116
4022
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
4117
4023
|
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
4118
|
-
if (!fs$
|
|
4024
|
+
if (!fs$17.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
4119
4025
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
4120
4026
|
const backupRoot = path$40.join(this.addonsDir, ".backups", packageName);
|
|
4121
4027
|
ensureDir(backupRoot);
|
|
4122
4028
|
const backupDir = path$40.join(backupRoot, ts);
|
|
4123
4029
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
4124
|
-
fs$
|
|
4030
|
+
fs$17.renameSync(addonDir, backupDir);
|
|
4125
4031
|
let result;
|
|
4126
4032
|
try {
|
|
4127
4033
|
if (this.installSource === "local" || this.installSource === "symlink") {
|
|
@@ -4136,11 +4042,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4136
4042
|
} catch (installErr) {
|
|
4137
4043
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg(installErr) } });
|
|
4138
4044
|
try {
|
|
4139
|
-
if (fs$
|
|
4045
|
+
if (fs$17.existsSync(addonDir)) fs$17.rmSync(addonDir, {
|
|
4140
4046
|
recursive: true,
|
|
4141
4047
|
force: true
|
|
4142
4048
|
});
|
|
4143
|
-
fs$
|
|
4049
|
+
fs$17.renameSync(backupDir, addonDir);
|
|
4144
4050
|
this.manifest.upsert(packageName, {
|
|
4145
4051
|
version: current.version,
|
|
4146
4052
|
source: current.source,
|
|
@@ -4166,6 +4072,76 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4166
4072
|
};
|
|
4167
4073
|
}
|
|
4168
4074
|
/**
|
|
4075
|
+
* Apply an update from a pre-validated staged directory — the fast
|
|
4076
|
+
* swap-from-staged path that skips npm entirely.
|
|
4077
|
+
*
|
|
4078
|
+
* Mirrors `applyUpdate` exactly for backup/restore/manifest, but
|
|
4079
|
+
* replaces step 2 ("install new version") with an atomic directory
|
|
4080
|
+
* move of `stagedPath` into `addonDir`.
|
|
4081
|
+
*
|
|
4082
|
+
* On cross-device move (EXDEV) falls back to a recursive copy followed
|
|
4083
|
+
* by removal of the staged directory. On any swap failure the backup is
|
|
4084
|
+
* restored and the error is rethrown — identical recovery to `applyUpdate`.
|
|
4085
|
+
*
|
|
4086
|
+
* Throws if the package is not tracked in the manifest or if `addonDir`
|
|
4087
|
+
* is missing (same preconditions as `applyUpdate`).
|
|
4088
|
+
*/
|
|
4089
|
+
async applyUpdateFromStaged(packageName, version, stagedPath) {
|
|
4090
|
+
const current = this.manifest.get(packageName);
|
|
4091
|
+
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
4092
|
+
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
4093
|
+
if (!fs$17.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
4094
|
+
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
4095
|
+
const backupRoot = path$40.join(this.addonsDir, ".backups", packageName);
|
|
4096
|
+
ensureDir(backupRoot);
|
|
4097
|
+
const backupDir = path$40.join(backupRoot, ts);
|
|
4098
|
+
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
4099
|
+
fs$17.renameSync(addonDir, backupDir);
|
|
4100
|
+
try {
|
|
4101
|
+
try {
|
|
4102
|
+
fs$17.renameSync(stagedPath, addonDir);
|
|
4103
|
+
} catch (renameErr) {
|
|
4104
|
+
if (renameErr.code === "EXDEV") {
|
|
4105
|
+
fs$17.cpSync(stagedPath, addonDir, { recursive: true });
|
|
4106
|
+
fs$17.rmSync(stagedPath, {
|
|
4107
|
+
recursive: true,
|
|
4108
|
+
force: true
|
|
4109
|
+
});
|
|
4110
|
+
} else throw renameErr;
|
|
4111
|
+
}
|
|
4112
|
+
} catch (swapErr) {
|
|
4113
|
+
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg(swapErr) } });
|
|
4114
|
+
try {
|
|
4115
|
+
if (fs$17.existsSync(addonDir)) fs$17.rmSync(addonDir, {
|
|
4116
|
+
recursive: true,
|
|
4117
|
+
force: true
|
|
4118
|
+
});
|
|
4119
|
+
fs$17.renameSync(backupDir, addonDir);
|
|
4120
|
+
this.manifest.upsert(packageName, {
|
|
4121
|
+
version: current.version,
|
|
4122
|
+
source: current.source,
|
|
4123
|
+
lastBackupDir: void 0
|
|
4124
|
+
});
|
|
4125
|
+
} catch (restoreErr) {
|
|
4126
|
+
this.logger.error(`${packageName} — backup restore ALSO failed; manual recovery needed`, { meta: {
|
|
4127
|
+
backupDir,
|
|
4128
|
+
error: errMsg(restoreErr)
|
|
4129
|
+
} });
|
|
4130
|
+
}
|
|
4131
|
+
throw swapErr;
|
|
4132
|
+
}
|
|
4133
|
+
this.manifest.upsert(packageName, {
|
|
4134
|
+
version,
|
|
4135
|
+
source: this.manifest.get(packageName)?.source ?? "npm",
|
|
4136
|
+
lastBackupDir: backupDir
|
|
4137
|
+
});
|
|
4138
|
+
return {
|
|
4139
|
+
name: packageName,
|
|
4140
|
+
version,
|
|
4141
|
+
backupDir
|
|
4142
|
+
};
|
|
4143
|
+
}
|
|
4144
|
+
/**
|
|
4169
4145
|
* Roll back an addon to its most recent backup. Used after an update
|
|
4170
4146
|
* passes installation but fails its post-restart health check.
|
|
4171
4147
|
*
|
|
@@ -4178,20 +4154,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4178
4154
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
4179
4155
|
return null;
|
|
4180
4156
|
}
|
|
4181
|
-
if (!fs$
|
|
4157
|
+
if (!fs$17.existsSync(entry.lastBackupDir)) {
|
|
4182
4158
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
4183
4159
|
return null;
|
|
4184
4160
|
}
|
|
4185
4161
|
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
4186
|
-
if (fs$
|
|
4162
|
+
if (fs$17.existsSync(addonDir)) fs$17.rmSync(addonDir, {
|
|
4187
4163
|
recursive: true,
|
|
4188
4164
|
force: true
|
|
4189
4165
|
});
|
|
4190
|
-
fs$
|
|
4166
|
+
fs$17.renameSync(entry.lastBackupDir, addonDir);
|
|
4191
4167
|
const pkgJsonPath = path$40.join(addonDir, "package.json");
|
|
4192
4168
|
let restoredVersion = entry.version;
|
|
4193
|
-
if (fs$
|
|
4194
|
-
const parsed = JSON.parse(fs$
|
|
4169
|
+
if (fs$17.existsSync(pkgJsonPath)) try {
|
|
4170
|
+
const parsed = JSON.parse(fs$17.readFileSync(pkgJsonPath, "utf-8"));
|
|
4195
4171
|
if (typeof parsed === "object" && parsed != null) {
|
|
4196
4172
|
const v = parsed.version;
|
|
4197
4173
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -4213,7 +4189,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4213
4189
|
clearBackup(packageName) {
|
|
4214
4190
|
const entry = this.manifest.get(packageName);
|
|
4215
4191
|
if (entry?.lastBackupDir == null) return;
|
|
4216
|
-
if (fs$
|
|
4192
|
+
if (fs$17.existsSync(entry.lastBackupDir)) fs$17.rmSync(entry.lastBackupDir, {
|
|
4217
4193
|
recursive: true,
|
|
4218
4194
|
force: true
|
|
4219
4195
|
});
|
|
@@ -4225,8 +4201,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4225
4201
|
}
|
|
4226
4202
|
async uninstall(packageName) {
|
|
4227
4203
|
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
4228
|
-
if (fs$
|
|
4229
|
-
fs$
|
|
4204
|
+
if (fs$17.existsSync(addonDir)) {
|
|
4205
|
+
fs$17.rmSync(addonDir, {
|
|
4230
4206
|
recursive: true,
|
|
4231
4207
|
force: true
|
|
4232
4208
|
});
|
|
@@ -4234,8 +4210,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4234
4210
|
return;
|
|
4235
4211
|
}
|
|
4236
4212
|
const legacyDir = path$40.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
4237
|
-
if (fs$
|
|
4238
|
-
fs$
|
|
4213
|
+
if (fs$17.existsSync(legacyDir)) {
|
|
4214
|
+
fs$17.rmSync(legacyDir, {
|
|
4239
4215
|
recursive: true,
|
|
4240
4216
|
force: true
|
|
4241
4217
|
});
|
|
@@ -4243,22 +4219,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4243
4219
|
}
|
|
4244
4220
|
}
|
|
4245
4221
|
listInstalled() {
|
|
4246
|
-
if (!fs$
|
|
4222
|
+
if (!fs$17.existsSync(this.addonsDir)) return [];
|
|
4247
4223
|
const packageDirs = [];
|
|
4248
|
-
for (const entry of fs$
|
|
4224
|
+
for (const entry of fs$17.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
4249
4225
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
4250
4226
|
if (entry.name.startsWith("@")) {
|
|
4251
4227
|
const scopeDir = path$40.join(this.addonsDir, entry.name);
|
|
4252
|
-
for (const inner of fs$
|
|
4228
|
+
for (const inner of fs$17.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$40.join(scopeDir, inner.name));
|
|
4253
4229
|
} else packageDirs.push(path$40.join(this.addonsDir, entry.name));
|
|
4254
4230
|
}
|
|
4255
4231
|
return packageDirs.map((dir) => {
|
|
4256
4232
|
const pkgPath = path$40.join(dir, "package.json");
|
|
4257
|
-
if (!fs$
|
|
4233
|
+
if (!fs$17.existsSync(pkgPath)) return null;
|
|
4258
4234
|
const pkg = readPackageJson(pkgPath);
|
|
4259
4235
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
4260
4236
|
const sourceFile = path$40.join(dir, ".install-source");
|
|
4261
|
-
const installSource = fs$
|
|
4237
|
+
const installSource = fs$17.existsSync(sourceFile) ? parseInstallSource(fs$17.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
4262
4238
|
return {
|
|
4263
4239
|
name: pkg.name,
|
|
4264
4240
|
version: pkg.version,
|
|
@@ -4268,13 +4244,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4268
4244
|
}).filter((item) => item !== null);
|
|
4269
4245
|
}
|
|
4270
4246
|
isInstalled(packageName) {
|
|
4271
|
-
if (fs$
|
|
4272
|
-
return fs$
|
|
4247
|
+
if (fs$17.existsSync(path$40.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
4248
|
+
return fs$17.existsSync(path$40.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
4273
4249
|
}
|
|
4274
4250
|
getInstalledPackage(packageName) {
|
|
4275
4251
|
let pkgPath = path$40.join(this.addonsDir, packageName, "package.json");
|
|
4276
|
-
if (!fs$
|
|
4277
|
-
if (!fs$
|
|
4252
|
+
if (!fs$17.existsSync(pkgPath)) pkgPath = path$40.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
4253
|
+
if (!fs$17.existsSync(pkgPath)) return null;
|
|
4278
4254
|
const pkg = readPackageJson(pkgPath);
|
|
4279
4255
|
if (!pkg) return null;
|
|
4280
4256
|
return {
|
|
@@ -4293,7 +4269,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4293
4269
|
]) {
|
|
4294
4270
|
const candidate = path$40.join(this.workspaceDir, dirName);
|
|
4295
4271
|
try {
|
|
4296
|
-
const pkg = asJsonObject(parseJsonUnknown(fs$
|
|
4272
|
+
const pkg = asJsonObject(parseJsonUnknown(fs$17.readFileSync(path$40.join(candidate, "package.json"), "utf-8")));
|
|
4297
4273
|
if (pkg && asString(pkg["name"]) === packageName) return candidate;
|
|
4298
4274
|
} catch {}
|
|
4299
4275
|
}
|
|
@@ -4302,7 +4278,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4302
4278
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
4303
4279
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
4304
4280
|
const distDir = path$40.join(sourceDir, "dist");
|
|
4305
|
-
if (!(!fs$
|
|
4281
|
+
if (!(!fs$17.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
4306
4282
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
4307
4283
|
try {
|
|
4308
4284
|
await execFileAsync("npm", ["run", "build"], {
|
|
@@ -4320,7 +4296,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4320
4296
|
if (!camstack?.addons) return false;
|
|
4321
4297
|
for (const addon of camstack.addons) {
|
|
4322
4298
|
if (!addon.pages) continue;
|
|
4323
|
-
for (const page of addon.pages) if (page.bundle && !fs$
|
|
4299
|
+
for (const page of addon.pages) if (page.bundle && !fs$17.existsSync(path$40.join(sourceDir, "dist", page.bundle))) return true;
|
|
4324
4300
|
}
|
|
4325
4301
|
return false;
|
|
4326
4302
|
}
|
|
@@ -4329,7 +4305,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4329
4305
|
function isDirEntry(entry, parentDir) {
|
|
4330
4306
|
if (entry.isDirectory()) return true;
|
|
4331
4307
|
if (entry.isSymbolicLink()) try {
|
|
4332
|
-
return fs$
|
|
4308
|
+
return fs$17.statSync(path$40.join(parentDir, entry.name)).isDirectory();
|
|
4333
4309
|
} catch {
|
|
4334
4310
|
return false;
|
|
4335
4311
|
}
|
|
@@ -4351,8 +4327,8 @@ function detectWorkspacePackagesDir(startDir) {
|
|
|
4351
4327
|
current = path$40.dirname(current);
|
|
4352
4328
|
const packagesDir = path$40.join(current, "packages");
|
|
4353
4329
|
const rootPkgJson = path$40.join(current, "package.json");
|
|
4354
|
-
if (fs$
|
|
4355
|
-
const rootPkg = JSON.parse(fs$
|
|
4330
|
+
if (fs$17.existsSync(packagesDir) && fs$17.existsSync(rootPkgJson)) try {
|
|
4331
|
+
const rootPkg = JSON.parse(fs$17.readFileSync(rootPkgJson, "utf-8"));
|
|
4356
4332
|
if (rootPkg.workspaces || rootPkg.name === "camstack-server" || rootPkg.name === "camstack") return packagesDir;
|
|
4357
4333
|
} catch {}
|
|
4358
4334
|
}
|
|
@@ -4361,12 +4337,12 @@ function detectWorkspacePackagesDir(startDir) {
|
|
|
4361
4337
|
//#endregion
|
|
4362
4338
|
//#region ../../node_modules/electron/index.js
|
|
4363
4339
|
var require_electron = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
4364
|
-
var fs$
|
|
4340
|
+
var fs$16 = __require("fs");
|
|
4365
4341
|
var path$39 = __require("path");
|
|
4366
4342
|
var pathFile = path$39.join(__dirname, "path.txt");
|
|
4367
4343
|
function getElectronPath() {
|
|
4368
4344
|
let executablePath;
|
|
4369
|
-
if (fs$
|
|
4345
|
+
if (fs$16.existsSync(pathFile)) executablePath = fs$16.readFileSync(pathFile, "utf-8");
|
|
4370
4346
|
if (process.env.ELECTRON_OVERRIDE_DIST_PATH) return path$39.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
|
|
4371
4347
|
if (executablePath) return path$39.join(__dirname, "dist", executablePath);
|
|
4372
4348
|
else throw new Error("Electron failed to install correctly, please delete node_modules/electron and try installing again");
|
|
@@ -4406,11 +4382,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
4406
4382
|
* intact or no marker at all (never a half-written file).
|
|
4407
4383
|
*/
|
|
4408
4384
|
function writePendingRestart(dataDir, marker) {
|
|
4409
|
-
fs$
|
|
4385
|
+
fs$17.mkdirSync(dataDir, { recursive: true });
|
|
4410
4386
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
4411
4387
|
const tmpPath = `${markerPath}.tmp`;
|
|
4412
|
-
fs$
|
|
4413
|
-
fs$
|
|
4388
|
+
fs$17.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
4389
|
+
fs$17.renameSync(tmpPath, markerPath);
|
|
4414
4390
|
}
|
|
4415
4391
|
/**
|
|
4416
4392
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -4435,10 +4411,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
4435
4411
|
*/
|
|
4436
4412
|
function readPendingRestart(dataDir) {
|
|
4437
4413
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
4438
|
-
if (!fs$
|
|
4414
|
+
if (!fs$17.existsSync(markerPath)) return null;
|
|
4439
4415
|
let raw;
|
|
4440
4416
|
try {
|
|
4441
|
-
raw = fs$
|
|
4417
|
+
raw = fs$17.readFileSync(markerPath, "utf-8");
|
|
4442
4418
|
} catch (err) {
|
|
4443
4419
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
4444
4420
|
return null;
|
|
@@ -4477,7 +4453,7 @@ function readPendingRestart(dataDir) {
|
|
|
4477
4453
|
/** Remove the marker if present. No-op if missing. */
|
|
4478
4454
|
function clearPendingRestart(dataDir) {
|
|
4479
4455
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
4480
|
-
fs$
|
|
4456
|
+
fs$17.rmSync(markerPath, { force: true });
|
|
4481
4457
|
}
|
|
4482
4458
|
function isRestartKind(value) {
|
|
4483
4459
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -4489,7 +4465,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
4489
4465
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
4490
4466
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
4491
4467
|
const now = /* @__PURE__ */ new Date();
|
|
4492
|
-
fs$
|
|
4468
|
+
fs$17.utimesSync(touchTarget, now, now);
|
|
4493
4469
|
return;
|
|
4494
4470
|
} catch (err) {
|
|
4495
4471
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -5598,7 +5574,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
5598
5574
|
value: mod,
|
|
5599
5575
|
enumerable: true
|
|
5600
5576
|
}) : target, mod));
|
|
5601
|
-
var require_common$
|
|
5577
|
+
var require_common$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5602
5578
|
function isNothing(subject) {
|
|
5603
5579
|
return typeof subject === "undefined" || subject === null;
|
|
5604
5580
|
}
|
|
@@ -5662,7 +5638,7 @@ var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5662
5638
|
module.exports = YAMLException;
|
|
5663
5639
|
}));
|
|
5664
5640
|
var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5665
|
-
var common = require_common$
|
|
5641
|
+
var common = require_common$1();
|
|
5666
5642
|
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
5667
5643
|
let head = "";
|
|
5668
5644
|
let tail = "";
|
|
@@ -5942,7 +5918,7 @@ var require_bool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5942
5918
|
});
|
|
5943
5919
|
}));
|
|
5944
5920
|
var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5945
|
-
var common = require_common$
|
|
5921
|
+
var common = require_common$1();
|
|
5946
5922
|
var Type = require_type();
|
|
5947
5923
|
function isHexCode(c) {
|
|
5948
5924
|
return c >= 48 && c <= 57 || c >= 65 && c <= 70 || c >= 97 && c <= 102;
|
|
@@ -6049,7 +6025,7 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6049
6025
|
});
|
|
6050
6026
|
}));
|
|
6051
6027
|
var require_float = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6052
|
-
var common = require_common$
|
|
6028
|
+
var common = require_common$1();
|
|
6053
6029
|
var Type = require_type();
|
|
6054
6030
|
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))$");
|
|
6055
6031
|
var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
@@ -6350,7 +6326,7 @@ var require_default$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6350
6326
|
});
|
|
6351
6327
|
}));
|
|
6352
6328
|
var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6353
|
-
var common = require_common$
|
|
6329
|
+
var common = require_common$1();
|
|
6354
6330
|
var YAMLException = require_exception();
|
|
6355
6331
|
var makeSnippet = require_snippet();
|
|
6356
6332
|
var DEFAULT_SCHEMA = require_default$1();
|
|
@@ -7373,7 +7349,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7373
7349
|
module.exports.load = load;
|
|
7374
7350
|
}));
|
|
7375
7351
|
var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7376
|
-
var common = require_common$
|
|
7352
|
+
var common = require_common$1();
|
|
7377
7353
|
var YAMLException = require_exception();
|
|
7378
7354
|
var DEFAULT_SCHEMA = require_default$1();
|
|
7379
7355
|
var _toString = Object.prototype.toString;
|
|
@@ -8363,7 +8339,7 @@ var ConfigManager = class ConfigManager {
|
|
|
8363
8339
|
update(section, data) {
|
|
8364
8340
|
if (!ConfigManager.BOOTSTRAP_SECTIONS.has(section)) throw new Error(`[ConfigManager] Section "${section}" is a runtime setting — use setSection() to persist via the settings-store, not update() which writes to config.yaml`);
|
|
8365
8341
|
let raw = {};
|
|
8366
|
-
if (fs$
|
|
8342
|
+
if (fs$17.existsSync(this.configPath)) raw = asJsonObject(load$1(fs$17.readFileSync(this.configPath, "utf-8"))) ?? {};
|
|
8367
8343
|
const existing = asJsonObject(raw[section]) ?? {};
|
|
8368
8344
|
raw[section] = {
|
|
8369
8345
|
...existing,
|
|
@@ -8372,12 +8348,12 @@ var ConfigManager = class ConfigManager {
|
|
|
8372
8348
|
const validation = bootstrapSchema.safeParse(raw);
|
|
8373
8349
|
if (!validation.success) throw new Error(`[ConfigManager] Invalid config update for section "${section}": ${validation.error.message}`);
|
|
8374
8350
|
const tmpPath = `${this.configPath}.tmp`;
|
|
8375
|
-
fs$
|
|
8351
|
+
fs$17.writeFileSync(tmpPath, dump(raw, {
|
|
8376
8352
|
lineWidth: 120,
|
|
8377
8353
|
indent: 2,
|
|
8378
8354
|
quotingType: "\""
|
|
8379
8355
|
}), "utf-8");
|
|
8380
|
-
fs$
|
|
8356
|
+
fs$17.renameSync(tmpPath, this.configPath);
|
|
8381
8357
|
this.bootstrapConfig = validation.data;
|
|
8382
8358
|
}
|
|
8383
8359
|
/**
|
|
@@ -8414,11 +8390,11 @@ var ConfigManager = class ConfigManager {
|
|
|
8414
8390
|
return result;
|
|
8415
8391
|
}
|
|
8416
8392
|
loadYaml() {
|
|
8417
|
-
if (!fs$
|
|
8393
|
+
if (!fs$17.existsSync(this.configPath)) {
|
|
8418
8394
|
console.warn(`[ConfigManager] Config file not found at: ${this.configPath}\n → Using built-in defaults. Set CONFIG_PATH env var or create the file.\n → Example path from project root: ./server/backend/data/config.yaml`);
|
|
8419
8395
|
return {};
|
|
8420
8396
|
}
|
|
8421
|
-
const parsed = load$1(fs$
|
|
8397
|
+
const parsed = load$1(fs$17.readFileSync(this.configPath, "utf-8")) ?? {};
|
|
8422
8398
|
console.log(`[ConfigManager] Loaded config from: ${this.configPath}`);
|
|
8423
8399
|
return parsed;
|
|
8424
8400
|
}
|
|
@@ -8463,9 +8439,9 @@ var ConfigManager = class ConfigManager {
|
|
|
8463
8439
|
return found ? result : null;
|
|
8464
8440
|
}
|
|
8465
8441
|
loadRuntimeState() {
|
|
8466
|
-
if (!fs$
|
|
8442
|
+
if (!fs$17.existsSync(this.runtimeStatePath)) return EMPTY_RUNTIME_STATE;
|
|
8467
8443
|
try {
|
|
8468
|
-
const parsed = asJsonObject(parseJsonUnknown(fs$
|
|
8444
|
+
const parsed = asJsonObject(parseJsonUnknown(fs$17.readFileSync(this.runtimeStatePath, "utf-8")));
|
|
8469
8445
|
if (parsed === null) return EMPTY_RUNTIME_STATE;
|
|
8470
8446
|
const systemActivation = asJsonObject(parsed.systemActivation) ?? {};
|
|
8471
8447
|
const deviceActivationRaw = asJsonObject(parsed.deviceActivation) ?? {};
|
|
@@ -8490,10 +8466,10 @@ var ConfigManager = class ConfigManager {
|
|
|
8490
8466
|
}
|
|
8491
8467
|
saveRuntimeState() {
|
|
8492
8468
|
const dir = path$40.dirname(this.runtimeStatePath);
|
|
8493
|
-
if (!fs$
|
|
8469
|
+
if (!fs$17.existsSync(dir)) fs$17.mkdirSync(dir, { recursive: true });
|
|
8494
8470
|
const tmpPath = `${this.runtimeStatePath}.tmp`;
|
|
8495
|
-
fs$
|
|
8496
|
-
fs$
|
|
8471
|
+
fs$17.writeFileSync(tmpPath, JSON.stringify(this.runtimeState, null, 2), "utf-8");
|
|
8472
|
+
fs$17.renameSync(tmpPath, this.runtimeStatePath);
|
|
8497
8473
|
}
|
|
8498
8474
|
};
|
|
8499
8475
|
//#endregion
|
|
@@ -28511,9 +28487,9 @@ var require_kleur = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
28511
28487
|
//#region ../../node_modules/moleculer/src/utils.js
|
|
28512
28488
|
var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
28513
28489
|
var kleur = require_kleur();
|
|
28514
|
-
var os$
|
|
28490
|
+
var os$16 = __require("os");
|
|
28515
28491
|
var path$38 = __require("path");
|
|
28516
|
-
var fs$
|
|
28492
|
+
var fs$15 = __require("fs");
|
|
28517
28493
|
var { TimeoutError } = require_errors$2();
|
|
28518
28494
|
var lut = [];
|
|
28519
28495
|
for (let i = 0; i < 256; i++) lut[i] = (i < 16 ? "0" : "") + i.toString(16);
|
|
@@ -28610,7 +28586,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
28610
28586
|
* @returns
|
|
28611
28587
|
*/
|
|
28612
28588
|
getNodeID() {
|
|
28613
|
-
return os$
|
|
28589
|
+
return os$16.hostname().toLowerCase() + "-" + process.pid;
|
|
28614
28590
|
},
|
|
28615
28591
|
/**
|
|
28616
28592
|
* Get list of local IPs
|
|
@@ -28620,7 +28596,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
28620
28596
|
getIpList() {
|
|
28621
28597
|
const list = [];
|
|
28622
28598
|
const ilist = [];
|
|
28623
|
-
const interfaces = os$
|
|
28599
|
+
const interfaces = os$16.networkInterfaces();
|
|
28624
28600
|
for (let iface in interfaces) for (let i in interfaces[iface]) {
|
|
28625
28601
|
const f = interfaces[iface]?.[i];
|
|
28626
28602
|
if (f.family === "IPv4") if (f.internal) {
|
|
@@ -28806,7 +28782,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
28806
28782
|
makeDirs(p) {
|
|
28807
28783
|
p.split(path$38.sep).reduce((prevPath, folder) => {
|
|
28808
28784
|
const currentPath = path$38.join(prevPath, folder, path$38.sep);
|
|
28809
|
-
if (!fs$
|
|
28785
|
+
if (!fs$15.existsSync(currentPath)) fs$15.mkdirSync(currentPath);
|
|
28810
28786
|
return currentPath;
|
|
28811
28787
|
}, "");
|
|
28812
28788
|
},
|
|
@@ -30032,7 +30008,7 @@ var require_csv = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
30032
30008
|
var { makeDirs } = require_utils$3();
|
|
30033
30009
|
var _ = require_lodash();
|
|
30034
30010
|
var path$37 = __require("path");
|
|
30035
|
-
var fs$
|
|
30011
|
+
var fs$14 = __require("fs");
|
|
30036
30012
|
var METRIC = require_constants$6();
|
|
30037
30013
|
var MODE_METRIC = "metric";
|
|
30038
30014
|
var MODE_LABEL = "label";
|
|
@@ -30191,8 +30167,8 @@ var require_csv = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
30191
30167
|
*/
|
|
30192
30168
|
writeRow(filename, headers, fields) {
|
|
30193
30169
|
try {
|
|
30194
|
-
if (!fs$
|
|
30195
|
-
fs$
|
|
30170
|
+
if (!fs$14.existsSync(filename)) fs$14.writeFileSync(filename, headers.join(this.opts.delimiter) + this.opts.rowDelimiter);
|
|
30171
|
+
fs$14.appendFileSync(filename, fields.join(this.opts.delimiter) + this.opts.rowDelimiter);
|
|
30196
30172
|
} catch (err) {
|
|
30197
30173
|
/* istanbul ignore next */
|
|
30198
30174
|
this.logger.error(`Unable to write metrics values to the '${filename}' file. Error: ${err.message}`, fields, err);
|
|
@@ -30306,7 +30282,7 @@ var require_event$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
30306
30282
|
var require_datadog$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
30307
30283
|
var BaseReporter = require_base$8();
|
|
30308
30284
|
var _ = require_lodash();
|
|
30309
|
-
var os$
|
|
30285
|
+
var os$15 = __require("os");
|
|
30310
30286
|
var { MoleculerError } = require_errors$2();
|
|
30311
30287
|
var METRIC = require_constants$6();
|
|
30312
30288
|
var { isFunction } = require_utils$3();
|
|
@@ -30339,7 +30315,7 @@ var require_datadog$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
30339
30315
|
super(opts);
|
|
30340
30316
|
/** @type {DatadogReporterOptions} */
|
|
30341
30317
|
this.opts = _.defaultsDeep(this.opts, {
|
|
30342
|
-
host: os$
|
|
30318
|
+
host: os$15.hostname(),
|
|
30343
30319
|
baseUrl: BASE_URL,
|
|
30344
30320
|
apiVersion: "v1",
|
|
30345
30321
|
path: "/series",
|
|
@@ -31015,18 +30991,18 @@ var require_cpu_usage$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
31015
30991
|
*
|
|
31016
30992
|
* Based on: https://github.com/icebob/cpu
|
|
31017
30993
|
*/
|
|
31018
|
-
var os$
|
|
30994
|
+
var os$14 = __require("os");
|
|
31019
30995
|
/* istanbul ignore next */
|
|
31020
30996
|
module.exports = function getCpuUsage(sampleTime = 100) {
|
|
31021
30997
|
return new Promise((resolve, reject) => {
|
|
31022
30998
|
try {
|
|
31023
|
-
const first = os$
|
|
30999
|
+
const first = os$14.cpus().map((cpu) => cpu.times);
|
|
31024
31000
|
setTimeout(() => {
|
|
31025
31001
|
try {
|
|
31026
|
-
const second = os$
|
|
31002
|
+
const second = os$14.cpus().map((cpu) => cpu.times);
|
|
31027
31003
|
setTimeout(() => {
|
|
31028
31004
|
try {
|
|
31029
|
-
const third = os$
|
|
31005
|
+
const third = os$14.cpus().map((cpu) => cpu.times);
|
|
31030
31006
|
const usages = [];
|
|
31031
31007
|
for (let i = 0; i < first.length; i++) {
|
|
31032
31008
|
const first_idle = first[i].idle;
|
|
@@ -31059,7 +31035,7 @@ var require_cpu_usage$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
31059
31035
|
//#endregion
|
|
31060
31036
|
//#region ../../node_modules/moleculer/src/metrics/commons.js
|
|
31061
31037
|
var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
31062
|
-
var os$
|
|
31038
|
+
var os$13 = __require("os");
|
|
31063
31039
|
var METRIC = require_constants$6();
|
|
31064
31040
|
var cpuUsage = require_cpu_usage$1();
|
|
31065
31041
|
var v8;
|
|
@@ -31238,27 +31214,27 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31238
31214
|
name: METRIC.OS_TYPE,
|
|
31239
31215
|
type: METRIC.TYPE_INFO,
|
|
31240
31216
|
description: "OS type"
|
|
31241
|
-
}).set(os$
|
|
31217
|
+
}).set(os$13.type());
|
|
31242
31218
|
this.register({
|
|
31243
31219
|
name: METRIC.OS_RELEASE,
|
|
31244
31220
|
type: METRIC.TYPE_INFO,
|
|
31245
31221
|
description: "OS release"
|
|
31246
|
-
}).set(os$
|
|
31222
|
+
}).set(os$13.release());
|
|
31247
31223
|
this.register({
|
|
31248
31224
|
name: METRIC.OS_HOSTNAME,
|
|
31249
31225
|
type: METRIC.TYPE_INFO,
|
|
31250
31226
|
description: "Hostname"
|
|
31251
|
-
}).set(os$
|
|
31227
|
+
}).set(os$13.hostname());
|
|
31252
31228
|
this.register({
|
|
31253
31229
|
name: METRIC.OS_ARCH,
|
|
31254
31230
|
type: METRIC.TYPE_INFO,
|
|
31255
31231
|
description: "OS architecture"
|
|
31256
|
-
}).set(os$
|
|
31232
|
+
}).set(os$13.arch());
|
|
31257
31233
|
this.register({
|
|
31258
31234
|
name: METRIC.OS_PLATFORM,
|
|
31259
31235
|
type: METRIC.TYPE_INFO,
|
|
31260
31236
|
description: "OS platform"
|
|
31261
|
-
}).set(os$
|
|
31237
|
+
}).set(os$13.platform());
|
|
31262
31238
|
const userInfo = getUserInfo();
|
|
31263
31239
|
this.register({
|
|
31264
31240
|
name: METRIC.OS_USER_UID,
|
|
@@ -31409,22 +31385,22 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31409
31385
|
}
|
|
31410
31386
|
this.set(METRIC.PROCESS_UPTIME, process.uptime());
|
|
31411
31387
|
this.set(METRIC.PROCESS_INTERNAL_ACTIVE_HANDLES, process.getActiveResourcesInfo().length);
|
|
31412
|
-
const freeMem = os$
|
|
31413
|
-
const totalMem = os$
|
|
31388
|
+
const freeMem = os$13.freemem();
|
|
31389
|
+
const totalMem = os$13.totalmem();
|
|
31414
31390
|
const usedMem = totalMem - freeMem;
|
|
31415
31391
|
this.set(METRIC.OS_MEMORY_FREE, freeMem);
|
|
31416
31392
|
this.set(METRIC.OS_MEMORY_USED, usedMem);
|
|
31417
31393
|
this.set(METRIC.OS_MEMORY_TOTAL, totalMem);
|
|
31418
|
-
this.set(METRIC.OS_UPTIME, os$
|
|
31419
|
-
this.set(METRIC.OS_TYPE, os$
|
|
31420
|
-
this.set(METRIC.OS_RELEASE, os$
|
|
31421
|
-
this.set(METRIC.OS_HOSTNAME, os$
|
|
31422
|
-
this.set(METRIC.OS_ARCH, os$
|
|
31423
|
-
this.set(METRIC.OS_PLATFORM, os$
|
|
31394
|
+
this.set(METRIC.OS_UPTIME, os$13.uptime());
|
|
31395
|
+
this.set(METRIC.OS_TYPE, os$13.type());
|
|
31396
|
+
this.set(METRIC.OS_RELEASE, os$13.release());
|
|
31397
|
+
this.set(METRIC.OS_HOSTNAME, os$13.hostname());
|
|
31398
|
+
this.set(METRIC.OS_ARCH, os$13.arch());
|
|
31399
|
+
this.set(METRIC.OS_PLATFORM, os$13.platform());
|
|
31424
31400
|
const getNetworkInterfaces = () => {
|
|
31425
31401
|
const list = [];
|
|
31426
31402
|
const ilist = [];
|
|
31427
|
-
const interfaces = os$
|
|
31403
|
+
const interfaces = os$13.networkInterfaces();
|
|
31428
31404
|
for (let iface in interfaces) for (let i in interfaces[iface]) {
|
|
31429
31405
|
const f = interfaces[iface][i];
|
|
31430
31406
|
if (f.internal) ilist.push({
|
|
@@ -31454,7 +31430,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31454
31430
|
this.set(METRIC.OS_DATETIME_ISO, d.toISOString());
|
|
31455
31431
|
this.set(METRIC.OS_DATETIME_UTC, d.toUTCString());
|
|
31456
31432
|
this.set(METRIC.OS_DATETIME_TZ_OFFSET, d.getTimezoneOffset());
|
|
31457
|
-
const load = os$
|
|
31433
|
+
const load = os$13.loadavg();
|
|
31458
31434
|
this.set(METRIC.OS_CPU_LOAD_1, load[0]);
|
|
31459
31435
|
this.set(METRIC.OS_CPU_LOAD_5, load[1]);
|
|
31460
31436
|
this.set(METRIC.OS_CPU_LOAD_15, load[2]);
|
|
@@ -31462,7 +31438,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31462
31438
|
return this.broker.Promise.resolve().then(() => cpuUsage().then((res) => {
|
|
31463
31439
|
this.set(METRIC.OS_CPU_UTILIZATION, res.avg);
|
|
31464
31440
|
try {
|
|
31465
|
-
const cpus = os$
|
|
31441
|
+
const cpus = os$13.cpus();
|
|
31466
31442
|
this.set(METRIC.OS_CPU_TOTAL, cpus.length);
|
|
31467
31443
|
this.set(METRIC.OS_CPU_USER, cpus.reduce((a, b) => a + b.times.user, 0));
|
|
31468
31444
|
this.set(METRIC.OS_CPU_SYSTEM, cpus.reduce((a, b) => a + b.times.sys, 0));
|
|
@@ -31484,7 +31460,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31484
31460
|
*/
|
|
31485
31461
|
function getUserInfo() {
|
|
31486
31462
|
try {
|
|
31487
|
-
return os$
|
|
31463
|
+
return os$13.userInfo();
|
|
31488
31464
|
} catch {
|
|
31489
31465
|
/* istanbul ignore next */
|
|
31490
31466
|
return {};
|
|
@@ -35183,10 +35159,10 @@ var require_inherits_browser = /* @__PURE__ */ __commonJSMin$1(((exports, module
|
|
|
35183
35159
|
//#region ../../node_modules/inherits/inherits.js
|
|
35184
35160
|
var require_inherits = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
35185
35161
|
try {
|
|
35186
|
-
var util$
|
|
35162
|
+
var util$7 = __require("util");
|
|
35187
35163
|
/* istanbul ignore next */
|
|
35188
|
-
if (typeof util$
|
|
35189
|
-
module.exports = util$
|
|
35164
|
+
if (typeof util$7.inherits !== "function") throw "";
|
|
35165
|
+
module.exports = util$7.inherits;
|
|
35190
35166
|
} catch (e) {
|
|
35191
35167
|
/* istanbul ignore next */
|
|
35192
35168
|
module.exports = require_inherits_browser();
|
|
@@ -35194,7 +35170,7 @@ var require_inherits = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
35194
35170
|
}));
|
|
35195
35171
|
//#endregion
|
|
35196
35172
|
//#region ../../node_modules/util-deprecate/node.js
|
|
35197
|
-
var require_node$
|
|
35173
|
+
var require_node$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
35198
35174
|
/**
|
|
35199
35175
|
* For Node.js, simply re-export the core `util.deprecate` function.
|
|
35200
35176
|
*/
|
|
@@ -35214,7 +35190,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin$1(((exports, module
|
|
|
35214
35190
|
}
|
|
35215
35191
|
var Duplex;
|
|
35216
35192
|
Writable.WritableState = WritableState;
|
|
35217
|
-
var internalUtil = { deprecate: require_node$
|
|
35193
|
+
var internalUtil = { deprecate: require_node$1() };
|
|
35218
35194
|
var Stream = require_stream$1();
|
|
35219
35195
|
var Buffer$13 = __require("buffer").Buffer;
|
|
35220
35196
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {};
|
|
@@ -37095,14 +37071,14 @@ var require_pipeline$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
37095
37071
|
//#endregion
|
|
37096
37072
|
//#region ../../node_modules/msgpack5/node_modules/readable-stream/readable.js
|
|
37097
37073
|
var require_readable$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
37098
|
-
var Stream$
|
|
37099
|
-
if (process.env.READABLE_STREAM === "disable" && Stream$
|
|
37100
|
-
module.exports = Stream$
|
|
37101
|
-
Object.assign(module.exports, Stream$
|
|
37102
|
-
module.exports.Stream = Stream$
|
|
37074
|
+
var Stream$2 = __require("stream");
|
|
37075
|
+
if (process.env.READABLE_STREAM === "disable" && Stream$2) {
|
|
37076
|
+
module.exports = Stream$2.Readable;
|
|
37077
|
+
Object.assign(module.exports, Stream$2);
|
|
37078
|
+
module.exports.Stream = Stream$2;
|
|
37103
37079
|
} else {
|
|
37104
37080
|
exports = module.exports = require__stream_readable();
|
|
37105
|
-
exports.Stream = Stream$
|
|
37081
|
+
exports.Stream = Stream$2 || exports;
|
|
37106
37082
|
exports.Readable = exports;
|
|
37107
37083
|
exports.Writable = require__stream_writable();
|
|
37108
37084
|
exports.Duplex = require__stream_duplex();
|
|
@@ -37448,7 +37424,7 @@ var require_streams = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
37448
37424
|
//#endregion
|
|
37449
37425
|
//#region ../../node_modules/msgpack5/lib/helpers.js
|
|
37450
37426
|
var require_helpers$2 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
37451
|
-
var util$
|
|
37427
|
+
var util$6 = __require("util");
|
|
37452
37428
|
exports.IncompleteBufferError = IncompleteBufferError;
|
|
37453
37429
|
function IncompleteBufferError(message) {
|
|
37454
37430
|
Error.call(this);
|
|
@@ -37456,7 +37432,7 @@ var require_helpers$2 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
37456
37432
|
this.name = this.constructor.name;
|
|
37457
37433
|
this.message = message || "unable to decode";
|
|
37458
37434
|
}
|
|
37459
|
-
util$
|
|
37435
|
+
util$6.inherits(IncompleteBufferError, Error);
|
|
37460
37436
|
exports.isFloat = function isFloat(n) {
|
|
37461
37437
|
return n % 1 !== 0;
|
|
37462
37438
|
};
|
|
@@ -38994,7 +38970,7 @@ var require_discoverers = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
38994
38970
|
}));
|
|
38995
38971
|
//#endregion
|
|
38996
38972
|
//#region ../../node_modules/moleculer/src/registry/node.js
|
|
38997
|
-
var require_node
|
|
38973
|
+
var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
38998
38974
|
/**
|
|
38999
38975
|
* Import types
|
|
39000
38976
|
*
|
|
@@ -39109,8 +39085,8 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
39109
39085
|
//#region ../../node_modules/moleculer/src/registry/node-catalog.js
|
|
39110
39086
|
var require_node_catalog = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
39111
39087
|
var _ = require_lodash();
|
|
39112
|
-
var os$
|
|
39113
|
-
var Node = require_node
|
|
39088
|
+
var os$12 = __require("os");
|
|
39089
|
+
var Node = require_node();
|
|
39114
39090
|
var { getIpList } = require_utils$3();
|
|
39115
39091
|
/**
|
|
39116
39092
|
* Import types
|
|
@@ -39155,7 +39131,7 @@ var require_node_catalog = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
39155
39131
|
node.local = true;
|
|
39156
39132
|
node.ipList = getIpList();
|
|
39157
39133
|
node.instanceID = this.broker.instanceID;
|
|
39158
|
-
node.hostname = os$
|
|
39134
|
+
node.hostname = os$12.hostname();
|
|
39159
39135
|
node.client = {
|
|
39160
39136
|
type: "nodejs",
|
|
39161
39137
|
version: this.broker.MOLECULER_VERSION,
|
|
@@ -40913,7 +40889,7 @@ var require_formatted = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
40913
40889
|
var BaseLogger = require_base$4();
|
|
40914
40890
|
var _ = require_lodash();
|
|
40915
40891
|
var kleur = require_kleur();
|
|
40916
|
-
var util$
|
|
40892
|
+
var util$5 = __require("util");
|
|
40917
40893
|
var { isObject, isFunction } = require_utils$3();
|
|
40918
40894
|
/**
|
|
40919
40895
|
* Import types
|
|
@@ -40961,7 +40937,7 @@ var require_formatted = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
40961
40937
|
init(loggerFactory) {
|
|
40962
40938
|
super.init(loggerFactory);
|
|
40963
40939
|
if (!this.opts.colors) kleur.enabled = false;
|
|
40964
|
-
this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$
|
|
40940
|
+
this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$5.inspect(o, {
|
|
40965
40941
|
showHidden: false,
|
|
40966
40942
|
depth: 2,
|
|
40967
40943
|
colors: kleur.enabled,
|
|
@@ -41229,9 +41205,9 @@ var require_console$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41229
41205
|
var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41230
41206
|
var BaseLogger = require_base$4();
|
|
41231
41207
|
var _ = require_lodash();
|
|
41232
|
-
var os$
|
|
41208
|
+
var os$11 = __require("os");
|
|
41233
41209
|
var { MoleculerError } = require_errors$2();
|
|
41234
|
-
var util$
|
|
41210
|
+
var util$4 = __require("util");
|
|
41235
41211
|
var { isObject } = require_utils$3();
|
|
41236
41212
|
/**
|
|
41237
41213
|
* Import types
|
|
@@ -41262,7 +41238,7 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41262
41238
|
apiKey: process.env.DATADOG_API_KEY,
|
|
41263
41239
|
ddSource: "moleculer",
|
|
41264
41240
|
env: void 0,
|
|
41265
|
-
hostname: os$
|
|
41241
|
+
hostname: os$11.hostname(),
|
|
41266
41242
|
objectPrinter: null,
|
|
41267
41243
|
interval: 10 * 1e3
|
|
41268
41244
|
});
|
|
@@ -41277,7 +41253,7 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41277
41253
|
*/
|
|
41278
41254
|
init(loggerFactory) {
|
|
41279
41255
|
super.init(loggerFactory);
|
|
41280
|
-
this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$
|
|
41256
|
+
this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$4.inspect(o, {
|
|
41281
41257
|
showHidden: false,
|
|
41282
41258
|
depth: 2,
|
|
41283
41259
|
colors: false,
|
|
@@ -41386,712 +41362,6 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41386
41362
|
module.exports = DatadogLogger;
|
|
41387
41363
|
}));
|
|
41388
41364
|
//#endregion
|
|
41389
|
-
//#region ../../node_modules/debug/src/common.js
|
|
41390
|
-
var require_common$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41391
|
-
/**
|
|
41392
|
-
* This is the common logic for both the Node.js and web browser
|
|
41393
|
-
* implementations of `debug()`.
|
|
41394
|
-
*/
|
|
41395
|
-
function setup(env) {
|
|
41396
|
-
createDebug.debug = createDebug;
|
|
41397
|
-
createDebug.default = createDebug;
|
|
41398
|
-
createDebug.coerce = coerce;
|
|
41399
|
-
createDebug.disable = disable;
|
|
41400
|
-
createDebug.enable = enable;
|
|
41401
|
-
createDebug.enabled = enabled;
|
|
41402
|
-
createDebug.humanize = require_ms();
|
|
41403
|
-
createDebug.destroy = destroy;
|
|
41404
|
-
Object.keys(env).forEach((key) => {
|
|
41405
|
-
createDebug[key] = env[key];
|
|
41406
|
-
});
|
|
41407
|
-
/**
|
|
41408
|
-
* The currently active debug mode names, and names to skip.
|
|
41409
|
-
*/
|
|
41410
|
-
createDebug.names = [];
|
|
41411
|
-
createDebug.skips = [];
|
|
41412
|
-
/**
|
|
41413
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
41414
|
-
*
|
|
41415
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
41416
|
-
*/
|
|
41417
|
-
createDebug.formatters = {};
|
|
41418
|
-
/**
|
|
41419
|
-
* Selects a color for a debug namespace
|
|
41420
|
-
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
41421
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
|
41422
|
-
* @api private
|
|
41423
|
-
*/
|
|
41424
|
-
function selectColor(namespace) {
|
|
41425
|
-
let hash = 0;
|
|
41426
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
41427
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
41428
|
-
hash |= 0;
|
|
41429
|
-
}
|
|
41430
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
41431
|
-
}
|
|
41432
|
-
createDebug.selectColor = selectColor;
|
|
41433
|
-
/**
|
|
41434
|
-
* Create a debugger with the given `namespace`.
|
|
41435
|
-
*
|
|
41436
|
-
* @param {String} namespace
|
|
41437
|
-
* @return {Function}
|
|
41438
|
-
* @api public
|
|
41439
|
-
*/
|
|
41440
|
-
function createDebug(namespace) {
|
|
41441
|
-
let prevTime;
|
|
41442
|
-
let enableOverride = null;
|
|
41443
|
-
let namespacesCache;
|
|
41444
|
-
let enabledCache;
|
|
41445
|
-
function debug(...args) {
|
|
41446
|
-
if (!debug.enabled) return;
|
|
41447
|
-
const self = debug;
|
|
41448
|
-
const curr = Number(/* @__PURE__ */ new Date());
|
|
41449
|
-
self.diff = curr - (prevTime || curr);
|
|
41450
|
-
self.prev = prevTime;
|
|
41451
|
-
self.curr = curr;
|
|
41452
|
-
prevTime = curr;
|
|
41453
|
-
args[0] = createDebug.coerce(args[0]);
|
|
41454
|
-
if (typeof args[0] !== "string") args.unshift("%O");
|
|
41455
|
-
let index = 0;
|
|
41456
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
41457
|
-
if (match === "%%") return "%";
|
|
41458
|
-
index++;
|
|
41459
|
-
const formatter = createDebug.formatters[format];
|
|
41460
|
-
if (typeof formatter === "function") {
|
|
41461
|
-
const val = args[index];
|
|
41462
|
-
match = formatter.call(self, val);
|
|
41463
|
-
args.splice(index, 1);
|
|
41464
|
-
index--;
|
|
41465
|
-
}
|
|
41466
|
-
return match;
|
|
41467
|
-
});
|
|
41468
|
-
createDebug.formatArgs.call(self, args);
|
|
41469
|
-
(self.log || createDebug.log).apply(self, args);
|
|
41470
|
-
}
|
|
41471
|
-
debug.namespace = namespace;
|
|
41472
|
-
debug.useColors = createDebug.useColors();
|
|
41473
|
-
debug.color = createDebug.selectColor(namespace);
|
|
41474
|
-
debug.extend = extend;
|
|
41475
|
-
debug.destroy = createDebug.destroy;
|
|
41476
|
-
Object.defineProperty(debug, "enabled", {
|
|
41477
|
-
enumerable: true,
|
|
41478
|
-
configurable: false,
|
|
41479
|
-
get: () => {
|
|
41480
|
-
if (enableOverride !== null) return enableOverride;
|
|
41481
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
41482
|
-
namespacesCache = createDebug.namespaces;
|
|
41483
|
-
enabledCache = createDebug.enabled(namespace);
|
|
41484
|
-
}
|
|
41485
|
-
return enabledCache;
|
|
41486
|
-
},
|
|
41487
|
-
set: (v) => {
|
|
41488
|
-
enableOverride = v;
|
|
41489
|
-
}
|
|
41490
|
-
});
|
|
41491
|
-
if (typeof createDebug.init === "function") createDebug.init(debug);
|
|
41492
|
-
return debug;
|
|
41493
|
-
}
|
|
41494
|
-
function extend(namespace, delimiter) {
|
|
41495
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
41496
|
-
newDebug.log = this.log;
|
|
41497
|
-
return newDebug;
|
|
41498
|
-
}
|
|
41499
|
-
/**
|
|
41500
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
41501
|
-
* separated by a colon and wildcards.
|
|
41502
|
-
*
|
|
41503
|
-
* @param {String} namespaces
|
|
41504
|
-
* @api public
|
|
41505
|
-
*/
|
|
41506
|
-
function enable(namespaces) {
|
|
41507
|
-
createDebug.save(namespaces);
|
|
41508
|
-
createDebug.namespaces = namespaces;
|
|
41509
|
-
createDebug.names = [];
|
|
41510
|
-
createDebug.skips = [];
|
|
41511
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
41512
|
-
for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
|
|
41513
|
-
else createDebug.names.push(ns);
|
|
41514
|
-
}
|
|
41515
|
-
/**
|
|
41516
|
-
* Checks if the given string matches a namespace template, honoring
|
|
41517
|
-
* asterisks as wildcards.
|
|
41518
|
-
*
|
|
41519
|
-
* @param {String} search
|
|
41520
|
-
* @param {String} template
|
|
41521
|
-
* @return {Boolean}
|
|
41522
|
-
*/
|
|
41523
|
-
function matchesTemplate(search, template) {
|
|
41524
|
-
let searchIndex = 0;
|
|
41525
|
-
let templateIndex = 0;
|
|
41526
|
-
let starIndex = -1;
|
|
41527
|
-
let matchIndex = 0;
|
|
41528
|
-
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
|
|
41529
|
-
starIndex = templateIndex;
|
|
41530
|
-
matchIndex = searchIndex;
|
|
41531
|
-
templateIndex++;
|
|
41532
|
-
} else {
|
|
41533
|
-
searchIndex++;
|
|
41534
|
-
templateIndex++;
|
|
41535
|
-
}
|
|
41536
|
-
else if (starIndex !== -1) {
|
|
41537
|
-
templateIndex = starIndex + 1;
|
|
41538
|
-
matchIndex++;
|
|
41539
|
-
searchIndex = matchIndex;
|
|
41540
|
-
} else return false;
|
|
41541
|
-
while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
|
|
41542
|
-
return templateIndex === template.length;
|
|
41543
|
-
}
|
|
41544
|
-
/**
|
|
41545
|
-
* Disable debug output.
|
|
41546
|
-
*
|
|
41547
|
-
* @return {String} namespaces
|
|
41548
|
-
* @api public
|
|
41549
|
-
*/
|
|
41550
|
-
function disable() {
|
|
41551
|
-
const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
|
|
41552
|
-
createDebug.enable("");
|
|
41553
|
-
return namespaces;
|
|
41554
|
-
}
|
|
41555
|
-
/**
|
|
41556
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
41557
|
-
*
|
|
41558
|
-
* @param {String} name
|
|
41559
|
-
* @return {Boolean}
|
|
41560
|
-
* @api public
|
|
41561
|
-
*/
|
|
41562
|
-
function enabled(name) {
|
|
41563
|
-
for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
|
|
41564
|
-
for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
|
|
41565
|
-
return false;
|
|
41566
|
-
}
|
|
41567
|
-
/**
|
|
41568
|
-
* Coerce `val`.
|
|
41569
|
-
*
|
|
41570
|
-
* @param {Mixed} val
|
|
41571
|
-
* @return {Mixed}
|
|
41572
|
-
* @api private
|
|
41573
|
-
*/
|
|
41574
|
-
function coerce(val) {
|
|
41575
|
-
if (val instanceof Error) return val.stack || val.message;
|
|
41576
|
-
return val;
|
|
41577
|
-
}
|
|
41578
|
-
/**
|
|
41579
|
-
* XXX DO NOT USE. This is a temporary stub function.
|
|
41580
|
-
* XXX It WILL be removed in the next major release.
|
|
41581
|
-
*/
|
|
41582
|
-
function destroy() {
|
|
41583
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
41584
|
-
}
|
|
41585
|
-
createDebug.enable(createDebug.load());
|
|
41586
|
-
return createDebug;
|
|
41587
|
-
}
|
|
41588
|
-
module.exports = setup;
|
|
41589
|
-
}));
|
|
41590
|
-
//#endregion
|
|
41591
|
-
//#region ../../node_modules/debug/src/browser.js
|
|
41592
|
-
var require_browser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41593
|
-
/**
|
|
41594
|
-
* This is the web browser implementation of `debug()`.
|
|
41595
|
-
*/
|
|
41596
|
-
exports.formatArgs = formatArgs;
|
|
41597
|
-
exports.save = save;
|
|
41598
|
-
exports.load = load;
|
|
41599
|
-
exports.useColors = useColors;
|
|
41600
|
-
exports.storage = localstorage();
|
|
41601
|
-
exports.destroy = (() => {
|
|
41602
|
-
let warned = false;
|
|
41603
|
-
return () => {
|
|
41604
|
-
if (!warned) {
|
|
41605
|
-
warned = true;
|
|
41606
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
41607
|
-
}
|
|
41608
|
-
};
|
|
41609
|
-
})();
|
|
41610
|
-
/**
|
|
41611
|
-
* Colors.
|
|
41612
|
-
*/
|
|
41613
|
-
exports.colors = [
|
|
41614
|
-
"#0000CC",
|
|
41615
|
-
"#0000FF",
|
|
41616
|
-
"#0033CC",
|
|
41617
|
-
"#0033FF",
|
|
41618
|
-
"#0066CC",
|
|
41619
|
-
"#0066FF",
|
|
41620
|
-
"#0099CC",
|
|
41621
|
-
"#0099FF",
|
|
41622
|
-
"#00CC00",
|
|
41623
|
-
"#00CC33",
|
|
41624
|
-
"#00CC66",
|
|
41625
|
-
"#00CC99",
|
|
41626
|
-
"#00CCCC",
|
|
41627
|
-
"#00CCFF",
|
|
41628
|
-
"#3300CC",
|
|
41629
|
-
"#3300FF",
|
|
41630
|
-
"#3333CC",
|
|
41631
|
-
"#3333FF",
|
|
41632
|
-
"#3366CC",
|
|
41633
|
-
"#3366FF",
|
|
41634
|
-
"#3399CC",
|
|
41635
|
-
"#3399FF",
|
|
41636
|
-
"#33CC00",
|
|
41637
|
-
"#33CC33",
|
|
41638
|
-
"#33CC66",
|
|
41639
|
-
"#33CC99",
|
|
41640
|
-
"#33CCCC",
|
|
41641
|
-
"#33CCFF",
|
|
41642
|
-
"#6600CC",
|
|
41643
|
-
"#6600FF",
|
|
41644
|
-
"#6633CC",
|
|
41645
|
-
"#6633FF",
|
|
41646
|
-
"#66CC00",
|
|
41647
|
-
"#66CC33",
|
|
41648
|
-
"#9900CC",
|
|
41649
|
-
"#9900FF",
|
|
41650
|
-
"#9933CC",
|
|
41651
|
-
"#9933FF",
|
|
41652
|
-
"#99CC00",
|
|
41653
|
-
"#99CC33",
|
|
41654
|
-
"#CC0000",
|
|
41655
|
-
"#CC0033",
|
|
41656
|
-
"#CC0066",
|
|
41657
|
-
"#CC0099",
|
|
41658
|
-
"#CC00CC",
|
|
41659
|
-
"#CC00FF",
|
|
41660
|
-
"#CC3300",
|
|
41661
|
-
"#CC3333",
|
|
41662
|
-
"#CC3366",
|
|
41663
|
-
"#CC3399",
|
|
41664
|
-
"#CC33CC",
|
|
41665
|
-
"#CC33FF",
|
|
41666
|
-
"#CC6600",
|
|
41667
|
-
"#CC6633",
|
|
41668
|
-
"#CC9900",
|
|
41669
|
-
"#CC9933",
|
|
41670
|
-
"#CCCC00",
|
|
41671
|
-
"#CCCC33",
|
|
41672
|
-
"#FF0000",
|
|
41673
|
-
"#FF0033",
|
|
41674
|
-
"#FF0066",
|
|
41675
|
-
"#FF0099",
|
|
41676
|
-
"#FF00CC",
|
|
41677
|
-
"#FF00FF",
|
|
41678
|
-
"#FF3300",
|
|
41679
|
-
"#FF3333",
|
|
41680
|
-
"#FF3366",
|
|
41681
|
-
"#FF3399",
|
|
41682
|
-
"#FF33CC",
|
|
41683
|
-
"#FF33FF",
|
|
41684
|
-
"#FF6600",
|
|
41685
|
-
"#FF6633",
|
|
41686
|
-
"#FF9900",
|
|
41687
|
-
"#FF9933",
|
|
41688
|
-
"#FFCC00",
|
|
41689
|
-
"#FFCC33"
|
|
41690
|
-
];
|
|
41691
|
-
/**
|
|
41692
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
41693
|
-
* and the Firebug extension (any Firefox version) are known
|
|
41694
|
-
* to support "%c" CSS customizations.
|
|
41695
|
-
*
|
|
41696
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
41697
|
-
*/
|
|
41698
|
-
function useColors() {
|
|
41699
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
|
|
41700
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
|
|
41701
|
-
let m;
|
|
41702
|
-
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+)/);
|
|
41703
|
-
}
|
|
41704
|
-
/**
|
|
41705
|
-
* Colorize log arguments if enabled.
|
|
41706
|
-
*
|
|
41707
|
-
* @api public
|
|
41708
|
-
*/
|
|
41709
|
-
function formatArgs(args) {
|
|
41710
|
-
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
41711
|
-
if (!this.useColors) return;
|
|
41712
|
-
const c = "color: " + this.color;
|
|
41713
|
-
args.splice(1, 0, c, "color: inherit");
|
|
41714
|
-
let index = 0;
|
|
41715
|
-
let lastC = 0;
|
|
41716
|
-
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
41717
|
-
if (match === "%%") return;
|
|
41718
|
-
index++;
|
|
41719
|
-
if (match === "%c") lastC = index;
|
|
41720
|
-
});
|
|
41721
|
-
args.splice(lastC, 0, c);
|
|
41722
|
-
}
|
|
41723
|
-
/**
|
|
41724
|
-
* Invokes `console.debug()` when available.
|
|
41725
|
-
* No-op when `console.debug` is not a "function".
|
|
41726
|
-
* If `console.debug` is not available, falls back
|
|
41727
|
-
* to `console.log`.
|
|
41728
|
-
*
|
|
41729
|
-
* @api public
|
|
41730
|
-
*/
|
|
41731
|
-
exports.log = console.debug || console.log || (() => {});
|
|
41732
|
-
/**
|
|
41733
|
-
* Save `namespaces`.
|
|
41734
|
-
*
|
|
41735
|
-
* @param {String} namespaces
|
|
41736
|
-
* @api private
|
|
41737
|
-
*/
|
|
41738
|
-
function save(namespaces) {
|
|
41739
|
-
try {
|
|
41740
|
-
if (namespaces) exports.storage.setItem("debug", namespaces);
|
|
41741
|
-
else exports.storage.removeItem("debug");
|
|
41742
|
-
} catch (error) {}
|
|
41743
|
-
}
|
|
41744
|
-
/**
|
|
41745
|
-
* Load `namespaces`.
|
|
41746
|
-
*
|
|
41747
|
-
* @return {String} returns the previously persisted debug modes
|
|
41748
|
-
* @api private
|
|
41749
|
-
*/
|
|
41750
|
-
function load() {
|
|
41751
|
-
let r;
|
|
41752
|
-
try {
|
|
41753
|
-
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
41754
|
-
} catch (error) {}
|
|
41755
|
-
if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
|
|
41756
|
-
return r;
|
|
41757
|
-
}
|
|
41758
|
-
/**
|
|
41759
|
-
* Localstorage attempts to return the localstorage.
|
|
41760
|
-
*
|
|
41761
|
-
* This is necessary because safari throws
|
|
41762
|
-
* when a user disables cookies/localstorage
|
|
41763
|
-
* and you attempt to access it.
|
|
41764
|
-
*
|
|
41765
|
-
* @return {LocalStorage}
|
|
41766
|
-
* @api private
|
|
41767
|
-
*/
|
|
41768
|
-
function localstorage() {
|
|
41769
|
-
try {
|
|
41770
|
-
return localStorage;
|
|
41771
|
-
} catch (error) {}
|
|
41772
|
-
}
|
|
41773
|
-
module.exports = require_common$1()(exports);
|
|
41774
|
-
var { formatters } = module.exports;
|
|
41775
|
-
/**
|
|
41776
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
41777
|
-
*/
|
|
41778
|
-
formatters.j = function(v) {
|
|
41779
|
-
try {
|
|
41780
|
-
return JSON.stringify(v);
|
|
41781
|
-
} catch (error) {
|
|
41782
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
41783
|
-
}
|
|
41784
|
-
};
|
|
41785
|
-
}));
|
|
41786
|
-
//#endregion
|
|
41787
|
-
//#region ../../node_modules/has-flag/index.js
|
|
41788
|
-
var require_has_flag$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41789
|
-
module.exports = (flag, argv = process.argv) => {
|
|
41790
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
41791
|
-
const position = argv.indexOf(prefix + flag);
|
|
41792
|
-
const terminatorPosition = argv.indexOf("--");
|
|
41793
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
41794
|
-
};
|
|
41795
|
-
}));
|
|
41796
|
-
//#endregion
|
|
41797
|
-
//#region ../../node_modules/supports-color/index.js
|
|
41798
|
-
var require_supports_color$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41799
|
-
var os$11 = __require("os");
|
|
41800
|
-
var tty$1 = __require("tty");
|
|
41801
|
-
var hasFlag = require_has_flag$1();
|
|
41802
|
-
var { env } = process;
|
|
41803
|
-
var flagForceColor;
|
|
41804
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
41805
|
-
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
41806
|
-
function envForceColor() {
|
|
41807
|
-
if ("FORCE_COLOR" in env) {
|
|
41808
|
-
if (env.FORCE_COLOR === "true") return 1;
|
|
41809
|
-
if (env.FORCE_COLOR === "false") return 0;
|
|
41810
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
41811
|
-
}
|
|
41812
|
-
}
|
|
41813
|
-
function translateLevel(level) {
|
|
41814
|
-
if (level === 0) return false;
|
|
41815
|
-
return {
|
|
41816
|
-
level,
|
|
41817
|
-
hasBasic: true,
|
|
41818
|
-
has256: level >= 2,
|
|
41819
|
-
has16m: level >= 3
|
|
41820
|
-
};
|
|
41821
|
-
}
|
|
41822
|
-
function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
41823
|
-
const noFlagForceColor = envForceColor();
|
|
41824
|
-
if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
|
|
41825
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
41826
|
-
if (forceColor === 0) return 0;
|
|
41827
|
-
if (sniffFlags) {
|
|
41828
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
41829
|
-
if (hasFlag("color=256")) return 2;
|
|
41830
|
-
}
|
|
41831
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
41832
|
-
const min = forceColor || 0;
|
|
41833
|
-
if (env.TERM === "dumb") return min;
|
|
41834
|
-
if (process.platform === "win32") {
|
|
41835
|
-
const osRelease = os$11.release().split(".");
|
|
41836
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
41837
|
-
return 1;
|
|
41838
|
-
}
|
|
41839
|
-
if ("CI" in env) {
|
|
41840
|
-
if ([
|
|
41841
|
-
"TRAVIS",
|
|
41842
|
-
"CIRCLECI",
|
|
41843
|
-
"APPVEYOR",
|
|
41844
|
-
"GITLAB_CI",
|
|
41845
|
-
"GITHUB_ACTIONS",
|
|
41846
|
-
"BUILDKITE",
|
|
41847
|
-
"DRONE"
|
|
41848
|
-
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
41849
|
-
return min;
|
|
41850
|
-
}
|
|
41851
|
-
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
41852
|
-
if (env.COLORTERM === "truecolor") return 3;
|
|
41853
|
-
if ("TERM_PROGRAM" in env) {
|
|
41854
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
41855
|
-
switch (env.TERM_PROGRAM) {
|
|
41856
|
-
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
41857
|
-
case "Apple_Terminal": return 2;
|
|
41858
|
-
}
|
|
41859
|
-
}
|
|
41860
|
-
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
41861
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
41862
|
-
if ("COLORTERM" in env) return 1;
|
|
41863
|
-
return min;
|
|
41864
|
-
}
|
|
41865
|
-
function getSupportLevel(stream, options = {}) {
|
|
41866
|
-
return translateLevel(supportsColor(stream, {
|
|
41867
|
-
streamIsTTY: stream && stream.isTTY,
|
|
41868
|
-
...options
|
|
41869
|
-
}));
|
|
41870
|
-
}
|
|
41871
|
-
module.exports = {
|
|
41872
|
-
supportsColor: getSupportLevel,
|
|
41873
|
-
stdout: getSupportLevel({ isTTY: tty$1.isatty(1) }),
|
|
41874
|
-
stderr: getSupportLevel({ isTTY: tty$1.isatty(2) })
|
|
41875
|
-
};
|
|
41876
|
-
}));
|
|
41877
|
-
//#endregion
|
|
41878
|
-
//#region ../../node_modules/debug/src/node.js
|
|
41879
|
-
var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41880
|
-
/**
|
|
41881
|
-
* Module dependencies.
|
|
41882
|
-
*/
|
|
41883
|
-
var tty = __require("tty");
|
|
41884
|
-
var util$5 = __require("util");
|
|
41885
|
-
/**
|
|
41886
|
-
* This is the Node.js implementation of `debug()`.
|
|
41887
|
-
*/
|
|
41888
|
-
exports.init = init;
|
|
41889
|
-
exports.log = log;
|
|
41890
|
-
exports.formatArgs = formatArgs;
|
|
41891
|
-
exports.save = save;
|
|
41892
|
-
exports.load = load;
|
|
41893
|
-
exports.useColors = useColors;
|
|
41894
|
-
exports.destroy = util$5.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
41895
|
-
/**
|
|
41896
|
-
* Colors.
|
|
41897
|
-
*/
|
|
41898
|
-
exports.colors = [
|
|
41899
|
-
6,
|
|
41900
|
-
2,
|
|
41901
|
-
3,
|
|
41902
|
-
4,
|
|
41903
|
-
5,
|
|
41904
|
-
1
|
|
41905
|
-
];
|
|
41906
|
-
try {
|
|
41907
|
-
const supportsColor = require_supports_color$1();
|
|
41908
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
|
|
41909
|
-
20,
|
|
41910
|
-
21,
|
|
41911
|
-
26,
|
|
41912
|
-
27,
|
|
41913
|
-
32,
|
|
41914
|
-
33,
|
|
41915
|
-
38,
|
|
41916
|
-
39,
|
|
41917
|
-
40,
|
|
41918
|
-
41,
|
|
41919
|
-
42,
|
|
41920
|
-
43,
|
|
41921
|
-
44,
|
|
41922
|
-
45,
|
|
41923
|
-
56,
|
|
41924
|
-
57,
|
|
41925
|
-
62,
|
|
41926
|
-
63,
|
|
41927
|
-
68,
|
|
41928
|
-
69,
|
|
41929
|
-
74,
|
|
41930
|
-
75,
|
|
41931
|
-
76,
|
|
41932
|
-
77,
|
|
41933
|
-
78,
|
|
41934
|
-
79,
|
|
41935
|
-
80,
|
|
41936
|
-
81,
|
|
41937
|
-
92,
|
|
41938
|
-
93,
|
|
41939
|
-
98,
|
|
41940
|
-
99,
|
|
41941
|
-
112,
|
|
41942
|
-
113,
|
|
41943
|
-
128,
|
|
41944
|
-
129,
|
|
41945
|
-
134,
|
|
41946
|
-
135,
|
|
41947
|
-
148,
|
|
41948
|
-
149,
|
|
41949
|
-
160,
|
|
41950
|
-
161,
|
|
41951
|
-
162,
|
|
41952
|
-
163,
|
|
41953
|
-
164,
|
|
41954
|
-
165,
|
|
41955
|
-
166,
|
|
41956
|
-
167,
|
|
41957
|
-
168,
|
|
41958
|
-
169,
|
|
41959
|
-
170,
|
|
41960
|
-
171,
|
|
41961
|
-
172,
|
|
41962
|
-
173,
|
|
41963
|
-
178,
|
|
41964
|
-
179,
|
|
41965
|
-
184,
|
|
41966
|
-
185,
|
|
41967
|
-
196,
|
|
41968
|
-
197,
|
|
41969
|
-
198,
|
|
41970
|
-
199,
|
|
41971
|
-
200,
|
|
41972
|
-
201,
|
|
41973
|
-
202,
|
|
41974
|
-
203,
|
|
41975
|
-
204,
|
|
41976
|
-
205,
|
|
41977
|
-
206,
|
|
41978
|
-
207,
|
|
41979
|
-
208,
|
|
41980
|
-
209,
|
|
41981
|
-
214,
|
|
41982
|
-
215,
|
|
41983
|
-
220,
|
|
41984
|
-
221
|
|
41985
|
-
];
|
|
41986
|
-
} catch (error) {}
|
|
41987
|
-
/**
|
|
41988
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
|
41989
|
-
*
|
|
41990
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
41991
|
-
*/
|
|
41992
|
-
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
41993
|
-
return /^debug_/i.test(key);
|
|
41994
|
-
}).reduce((obj, key) => {
|
|
41995
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
41996
|
-
return k.toUpperCase();
|
|
41997
|
-
});
|
|
41998
|
-
let val = process.env[key];
|
|
41999
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
|
42000
|
-
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
|
42001
|
-
else if (val === "null") val = null;
|
|
42002
|
-
else val = Number(val);
|
|
42003
|
-
obj[prop] = val;
|
|
42004
|
-
return obj;
|
|
42005
|
-
}, {});
|
|
42006
|
-
/**
|
|
42007
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
42008
|
-
*/
|
|
42009
|
-
function useColors() {
|
|
42010
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
42011
|
-
}
|
|
42012
|
-
/**
|
|
42013
|
-
* Adds ANSI color escape codes if enabled.
|
|
42014
|
-
*
|
|
42015
|
-
* @api public
|
|
42016
|
-
*/
|
|
42017
|
-
function formatArgs(args) {
|
|
42018
|
-
const { namespace: name, useColors } = this;
|
|
42019
|
-
if (useColors) {
|
|
42020
|
-
const c = this.color;
|
|
42021
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
42022
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
42023
|
-
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
42024
|
-
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
42025
|
-
} else args[0] = getDate() + name + " " + args[0];
|
|
42026
|
-
}
|
|
42027
|
-
function getDate() {
|
|
42028
|
-
if (exports.inspectOpts.hideDate) return "";
|
|
42029
|
-
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
42030
|
-
}
|
|
42031
|
-
/**
|
|
42032
|
-
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
|
42033
|
-
*/
|
|
42034
|
-
function log(...args) {
|
|
42035
|
-
return process.stderr.write(util$5.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
42036
|
-
}
|
|
42037
|
-
/**
|
|
42038
|
-
* Save `namespaces`.
|
|
42039
|
-
*
|
|
42040
|
-
* @param {String} namespaces
|
|
42041
|
-
* @api private
|
|
42042
|
-
*/
|
|
42043
|
-
function save(namespaces) {
|
|
42044
|
-
if (namespaces) process.env.DEBUG = namespaces;
|
|
42045
|
-
else delete process.env.DEBUG;
|
|
42046
|
-
}
|
|
42047
|
-
/**
|
|
42048
|
-
* Load `namespaces`.
|
|
42049
|
-
*
|
|
42050
|
-
* @return {String} returns the previously persisted debug modes
|
|
42051
|
-
* @api private
|
|
42052
|
-
*/
|
|
42053
|
-
function load() {
|
|
42054
|
-
return process.env.DEBUG;
|
|
42055
|
-
}
|
|
42056
|
-
/**
|
|
42057
|
-
* Init logic for `debug` instances.
|
|
42058
|
-
*
|
|
42059
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
|
42060
|
-
* differently for a particular `debug` instance.
|
|
42061
|
-
*/
|
|
42062
|
-
function init(debug) {
|
|
42063
|
-
debug.inspectOpts = {};
|
|
42064
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
42065
|
-
for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
42066
|
-
}
|
|
42067
|
-
module.exports = require_common$1()(exports);
|
|
42068
|
-
var { formatters } = module.exports;
|
|
42069
|
-
/**
|
|
42070
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
42071
|
-
*/
|
|
42072
|
-
formatters.o = function(v) {
|
|
42073
|
-
this.inspectOpts.colors = this.useColors;
|
|
42074
|
-
return util$5.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
42075
|
-
};
|
|
42076
|
-
/**
|
|
42077
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
42078
|
-
*/
|
|
42079
|
-
formatters.O = function(v) {
|
|
42080
|
-
this.inspectOpts.colors = this.useColors;
|
|
42081
|
-
return util$5.inspect(v, this.inspectOpts);
|
|
42082
|
-
};
|
|
42083
|
-
}));
|
|
42084
|
-
//#endregion
|
|
42085
|
-
//#region ../../node_modules/debug/src/index.js
|
|
42086
|
-
var require_src = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42087
|
-
/**
|
|
42088
|
-
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
42089
|
-
* treat as a browser.
|
|
42090
|
-
*/
|
|
42091
|
-
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
|
|
42092
|
-
else module.exports = require_node();
|
|
42093
|
-
}));
|
|
42094
|
-
//#endregion
|
|
42095
41365
|
//#region ../../node_modules/moleculer/src/loggers/debug.js
|
|
42096
41366
|
var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42097
41367
|
var BaseLogger = require_base$4();
|
|
@@ -42162,7 +41432,7 @@ var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42162
41432
|
var require_file$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42163
41433
|
var FormattedLogger = require_formatted();
|
|
42164
41434
|
var _ = require_lodash();
|
|
42165
|
-
var fs$
|
|
41435
|
+
var fs$13 = __require("fs/promises");
|
|
42166
41436
|
var path$36 = __require("path");
|
|
42167
41437
|
var os$10 = __require("os");
|
|
42168
41438
|
var { makeDirs } = require_utils$3();
|
|
@@ -42266,7 +41536,7 @@ var require_file$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42266
41536
|
const rows = Array.from(this.queue);
|
|
42267
41537
|
this.queue.length = 0;
|
|
42268
41538
|
const buf = rows.join(this.opts.eol) + this.opts.eol;
|
|
42269
|
-
return fs$
|
|
41539
|
+
return fs$13.appendFile(filename, buf).catch((err) => {
|
|
42270
41540
|
/* istanbul ignore next */
|
|
42271
41541
|
console.debug("Unable to write log file:", filename, err);
|
|
42272
41542
|
});
|
|
@@ -42414,7 +41684,7 @@ var require_rfdc = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42414
41684
|
//#endregion
|
|
42415
41685
|
//#region ../../node_modules/log4js/lib/configuration.js
|
|
42416
41686
|
var require_configuration = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42417
|
-
var util$
|
|
41687
|
+
var util$3 = __require("util");
|
|
42418
41688
|
var debug = require_src()("log4js:configuration");
|
|
42419
41689
|
var preProcessingListeners = [];
|
|
42420
41690
|
var listeners = [];
|
|
@@ -42432,7 +41702,7 @@ var require_configuration = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
|
|
|
42432
41702
|
};
|
|
42433
41703
|
var throwExceptionIf = (config, checks, message) => {
|
|
42434
41704
|
(Array.isArray(checks) ? checks : [checks]).forEach((test) => {
|
|
42435
|
-
if (test) throw new Error(`Problem with log4js configuration: (${util$
|
|
41705
|
+
if (test) throw new Error(`Problem with log4js configuration: (${util$3.inspect(config, { depth: 5 })}) - ${message}`);
|
|
42436
41706
|
});
|
|
42437
41707
|
};
|
|
42438
41708
|
var configure = (candidate) => {
|
|
@@ -42614,7 +41884,7 @@ var require_lib$5 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42614
41884
|
var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42615
41885
|
var dateFormat = require_lib$5();
|
|
42616
41886
|
var os$9 = __require("os");
|
|
42617
|
-
var util$
|
|
41887
|
+
var util$2 = __require("util");
|
|
42618
41888
|
var path$35 = __require("path");
|
|
42619
41889
|
var styles = {
|
|
42620
41890
|
bold: [1, 22],
|
|
@@ -42644,7 +41914,7 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42644
41914
|
return colorizeStart(style) + str + colorizeEnd(style);
|
|
42645
41915
|
}
|
|
42646
41916
|
function timestampLevelAndCategory(loggingEvent, colour) {
|
|
42647
|
-
return colorize(util$
|
|
41917
|
+
return colorize(util$2.format("[%s] [%s] %s - ", dateFormat.asString(loggingEvent.startTime), loggingEvent.level.toString(), loggingEvent.categoryName), colour);
|
|
42648
41918
|
}
|
|
42649
41919
|
/**
|
|
42650
41920
|
* BasicLayout is a simple layout for storing the logs. The logs are stored
|
|
@@ -42656,17 +41926,17 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42656
41926
|
* @author Stephan Strittmatter
|
|
42657
41927
|
*/
|
|
42658
41928
|
function basicLayout(loggingEvent) {
|
|
42659
|
-
return timestampLevelAndCategory(loggingEvent) + util$
|
|
41929
|
+
return timestampLevelAndCategory(loggingEvent) + util$2.format(...loggingEvent.data);
|
|
42660
41930
|
}
|
|
42661
41931
|
/**
|
|
42662
41932
|
* colouredLayout - taken from masylum's fork.
|
|
42663
41933
|
* same as basicLayout, but with colours.
|
|
42664
41934
|
*/
|
|
42665
41935
|
function colouredLayout(loggingEvent) {
|
|
42666
|
-
return timestampLevelAndCategory(loggingEvent, loggingEvent.level.colour) + util$
|
|
41936
|
+
return timestampLevelAndCategory(loggingEvent, loggingEvent.level.colour) + util$2.format(...loggingEvent.data);
|
|
42667
41937
|
}
|
|
42668
41938
|
function messagePassThroughLayout(loggingEvent) {
|
|
42669
|
-
return util$
|
|
41939
|
+
return util$2.format(...loggingEvent.data);
|
|
42670
41940
|
}
|
|
42671
41941
|
function dummyLayout(loggingEvent) {
|
|
42672
41942
|
return loggingEvent.data[0];
|
|
@@ -42742,7 +42012,7 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42742
42012
|
return os$9.hostname().toString();
|
|
42743
42013
|
}
|
|
42744
42014
|
function formatMessage(loggingEvent) {
|
|
42745
|
-
return util$
|
|
42015
|
+
return util$2.format(...loggingEvent.data);
|
|
42746
42016
|
}
|
|
42747
42017
|
function endOfLine() {
|
|
42748
42018
|
return os$9.EOL;
|
|
@@ -43424,720 +42694,6 @@ var require_universalify = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
43424
42694
|
};
|
|
43425
42695
|
}));
|
|
43426
42696
|
//#endregion
|
|
43427
|
-
//#region ../../node_modules/graceful-fs/polyfills.js
|
|
43428
|
-
var require_polyfills = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
43429
|
-
var constants$1 = __require("constants");
|
|
43430
|
-
var origCwd = process.cwd;
|
|
43431
|
-
var cwd = null;
|
|
43432
|
-
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
43433
|
-
process.cwd = function() {
|
|
43434
|
-
if (!cwd) cwd = origCwd.call(process);
|
|
43435
|
-
return cwd;
|
|
43436
|
-
};
|
|
43437
|
-
try {
|
|
43438
|
-
process.cwd();
|
|
43439
|
-
} catch (er) {}
|
|
43440
|
-
if (typeof process.chdir === "function") {
|
|
43441
|
-
var chdir = process.chdir;
|
|
43442
|
-
process.chdir = function(d) {
|
|
43443
|
-
cwd = null;
|
|
43444
|
-
chdir.call(process, d);
|
|
43445
|
-
};
|
|
43446
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
43447
|
-
}
|
|
43448
|
-
module.exports = patch;
|
|
43449
|
-
function patch(fs) {
|
|
43450
|
-
if (constants$1.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
|
|
43451
|
-
if (!fs.lutimes) patchLutimes(fs);
|
|
43452
|
-
fs.chown = chownFix(fs.chown);
|
|
43453
|
-
fs.fchown = chownFix(fs.fchown);
|
|
43454
|
-
fs.lchown = chownFix(fs.lchown);
|
|
43455
|
-
fs.chmod = chmodFix(fs.chmod);
|
|
43456
|
-
fs.fchmod = chmodFix(fs.fchmod);
|
|
43457
|
-
fs.lchmod = chmodFix(fs.lchmod);
|
|
43458
|
-
fs.chownSync = chownFixSync(fs.chownSync);
|
|
43459
|
-
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
43460
|
-
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
43461
|
-
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
43462
|
-
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
43463
|
-
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
43464
|
-
fs.stat = statFix(fs.stat);
|
|
43465
|
-
fs.fstat = statFix(fs.fstat);
|
|
43466
|
-
fs.lstat = statFix(fs.lstat);
|
|
43467
|
-
fs.statSync = statFixSync(fs.statSync);
|
|
43468
|
-
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
43469
|
-
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
43470
|
-
if (fs.chmod && !fs.lchmod) {
|
|
43471
|
-
fs.lchmod = function(path, mode, cb) {
|
|
43472
|
-
if (cb) process.nextTick(cb);
|
|
43473
|
-
};
|
|
43474
|
-
fs.lchmodSync = function() {};
|
|
43475
|
-
}
|
|
43476
|
-
if (fs.chown && !fs.lchown) {
|
|
43477
|
-
fs.lchown = function(path, uid, gid, cb) {
|
|
43478
|
-
if (cb) process.nextTick(cb);
|
|
43479
|
-
};
|
|
43480
|
-
fs.lchownSync = function() {};
|
|
43481
|
-
}
|
|
43482
|
-
if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
|
|
43483
|
-
function rename(from, to, cb) {
|
|
43484
|
-
var start = Date.now();
|
|
43485
|
-
var backoff = 0;
|
|
43486
|
-
fs$rename(from, to, function CB(er) {
|
|
43487
|
-
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
43488
|
-
setTimeout(function() {
|
|
43489
|
-
fs.stat(to, function(stater, st) {
|
|
43490
|
-
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
|
|
43491
|
-
else cb(er);
|
|
43492
|
-
});
|
|
43493
|
-
}, backoff);
|
|
43494
|
-
if (backoff < 100) backoff += 10;
|
|
43495
|
-
return;
|
|
43496
|
-
}
|
|
43497
|
-
if (cb) cb(er);
|
|
43498
|
-
});
|
|
43499
|
-
}
|
|
43500
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
43501
|
-
return rename;
|
|
43502
|
-
})(fs.rename);
|
|
43503
|
-
fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
|
|
43504
|
-
function read(fd, buffer, offset, length, position, callback_) {
|
|
43505
|
-
var callback;
|
|
43506
|
-
if (callback_ && typeof callback_ === "function") {
|
|
43507
|
-
var eagCounter = 0;
|
|
43508
|
-
callback = function(er, _, __) {
|
|
43509
|
-
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
43510
|
-
eagCounter++;
|
|
43511
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
43512
|
-
}
|
|
43513
|
-
callback_.apply(this, arguments);
|
|
43514
|
-
};
|
|
43515
|
-
}
|
|
43516
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
43517
|
-
}
|
|
43518
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
43519
|
-
return read;
|
|
43520
|
-
})(fs.read);
|
|
43521
|
-
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
|
|
43522
|
-
return function(fd, buffer, offset, length, position) {
|
|
43523
|
-
var eagCounter = 0;
|
|
43524
|
-
while (true) try {
|
|
43525
|
-
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
43526
|
-
} catch (er) {
|
|
43527
|
-
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
43528
|
-
eagCounter++;
|
|
43529
|
-
continue;
|
|
43530
|
-
}
|
|
43531
|
-
throw er;
|
|
43532
|
-
}
|
|
43533
|
-
};
|
|
43534
|
-
})(fs.readSync);
|
|
43535
|
-
function patchLchmod(fs) {
|
|
43536
|
-
fs.lchmod = function(path, mode, callback) {
|
|
43537
|
-
fs.open(path, constants$1.O_WRONLY | constants$1.O_SYMLINK, mode, function(err, fd) {
|
|
43538
|
-
if (err) {
|
|
43539
|
-
if (callback) callback(err);
|
|
43540
|
-
return;
|
|
43541
|
-
}
|
|
43542
|
-
fs.fchmod(fd, mode, function(err) {
|
|
43543
|
-
fs.close(fd, function(err2) {
|
|
43544
|
-
if (callback) callback(err || err2);
|
|
43545
|
-
});
|
|
43546
|
-
});
|
|
43547
|
-
});
|
|
43548
|
-
};
|
|
43549
|
-
fs.lchmodSync = function(path, mode) {
|
|
43550
|
-
var fd = fs.openSync(path, constants$1.O_WRONLY | constants$1.O_SYMLINK, mode);
|
|
43551
|
-
var threw = true;
|
|
43552
|
-
var ret;
|
|
43553
|
-
try {
|
|
43554
|
-
ret = fs.fchmodSync(fd, mode);
|
|
43555
|
-
threw = false;
|
|
43556
|
-
} finally {
|
|
43557
|
-
if (threw) try {
|
|
43558
|
-
fs.closeSync(fd);
|
|
43559
|
-
} catch (er) {}
|
|
43560
|
-
else fs.closeSync(fd);
|
|
43561
|
-
}
|
|
43562
|
-
return ret;
|
|
43563
|
-
};
|
|
43564
|
-
}
|
|
43565
|
-
function patchLutimes(fs) {
|
|
43566
|
-
if (constants$1.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
43567
|
-
fs.lutimes = function(path, at, mt, cb) {
|
|
43568
|
-
fs.open(path, constants$1.O_SYMLINK, function(er, fd) {
|
|
43569
|
-
if (er) {
|
|
43570
|
-
if (cb) cb(er);
|
|
43571
|
-
return;
|
|
43572
|
-
}
|
|
43573
|
-
fs.futimes(fd, at, mt, function(er) {
|
|
43574
|
-
fs.close(fd, function(er2) {
|
|
43575
|
-
if (cb) cb(er || er2);
|
|
43576
|
-
});
|
|
43577
|
-
});
|
|
43578
|
-
});
|
|
43579
|
-
};
|
|
43580
|
-
fs.lutimesSync = function(path, at, mt) {
|
|
43581
|
-
var fd = fs.openSync(path, constants$1.O_SYMLINK);
|
|
43582
|
-
var ret;
|
|
43583
|
-
var threw = true;
|
|
43584
|
-
try {
|
|
43585
|
-
ret = fs.futimesSync(fd, at, mt);
|
|
43586
|
-
threw = false;
|
|
43587
|
-
} finally {
|
|
43588
|
-
if (threw) try {
|
|
43589
|
-
fs.closeSync(fd);
|
|
43590
|
-
} catch (er) {}
|
|
43591
|
-
else fs.closeSync(fd);
|
|
43592
|
-
}
|
|
43593
|
-
return ret;
|
|
43594
|
-
};
|
|
43595
|
-
} else if (fs.futimes) {
|
|
43596
|
-
fs.lutimes = function(_a, _b, _c, cb) {
|
|
43597
|
-
if (cb) process.nextTick(cb);
|
|
43598
|
-
};
|
|
43599
|
-
fs.lutimesSync = function() {};
|
|
43600
|
-
}
|
|
43601
|
-
}
|
|
43602
|
-
function chmodFix(orig) {
|
|
43603
|
-
if (!orig) return orig;
|
|
43604
|
-
return function(target, mode, cb) {
|
|
43605
|
-
return orig.call(fs, target, mode, function(er) {
|
|
43606
|
-
if (chownErOk(er)) er = null;
|
|
43607
|
-
if (cb) cb.apply(this, arguments);
|
|
43608
|
-
});
|
|
43609
|
-
};
|
|
43610
|
-
}
|
|
43611
|
-
function chmodFixSync(orig) {
|
|
43612
|
-
if (!orig) return orig;
|
|
43613
|
-
return function(target, mode) {
|
|
43614
|
-
try {
|
|
43615
|
-
return orig.call(fs, target, mode);
|
|
43616
|
-
} catch (er) {
|
|
43617
|
-
if (!chownErOk(er)) throw er;
|
|
43618
|
-
}
|
|
43619
|
-
};
|
|
43620
|
-
}
|
|
43621
|
-
function chownFix(orig) {
|
|
43622
|
-
if (!orig) return orig;
|
|
43623
|
-
return function(target, uid, gid, cb) {
|
|
43624
|
-
return orig.call(fs, target, uid, gid, function(er) {
|
|
43625
|
-
if (chownErOk(er)) er = null;
|
|
43626
|
-
if (cb) cb.apply(this, arguments);
|
|
43627
|
-
});
|
|
43628
|
-
};
|
|
43629
|
-
}
|
|
43630
|
-
function chownFixSync(orig) {
|
|
43631
|
-
if (!orig) return orig;
|
|
43632
|
-
return function(target, uid, gid) {
|
|
43633
|
-
try {
|
|
43634
|
-
return orig.call(fs, target, uid, gid);
|
|
43635
|
-
} catch (er) {
|
|
43636
|
-
if (!chownErOk(er)) throw er;
|
|
43637
|
-
}
|
|
43638
|
-
};
|
|
43639
|
-
}
|
|
43640
|
-
function statFix(orig) {
|
|
43641
|
-
if (!orig) return orig;
|
|
43642
|
-
return function(target, options, cb) {
|
|
43643
|
-
if (typeof options === "function") {
|
|
43644
|
-
cb = options;
|
|
43645
|
-
options = null;
|
|
43646
|
-
}
|
|
43647
|
-
function callback(er, stats) {
|
|
43648
|
-
if (stats) {
|
|
43649
|
-
if (stats.uid < 0) stats.uid += 4294967296;
|
|
43650
|
-
if (stats.gid < 0) stats.gid += 4294967296;
|
|
43651
|
-
}
|
|
43652
|
-
if (cb) cb.apply(this, arguments);
|
|
43653
|
-
}
|
|
43654
|
-
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
43655
|
-
};
|
|
43656
|
-
}
|
|
43657
|
-
function statFixSync(orig) {
|
|
43658
|
-
if (!orig) return orig;
|
|
43659
|
-
return function(target, options) {
|
|
43660
|
-
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
43661
|
-
if (stats) {
|
|
43662
|
-
if (stats.uid < 0) stats.uid += 4294967296;
|
|
43663
|
-
if (stats.gid < 0) stats.gid += 4294967296;
|
|
43664
|
-
}
|
|
43665
|
-
return stats;
|
|
43666
|
-
};
|
|
43667
|
-
}
|
|
43668
|
-
function chownErOk(er) {
|
|
43669
|
-
if (!er) return true;
|
|
43670
|
-
if (er.code === "ENOSYS") return true;
|
|
43671
|
-
if (!process.getuid || process.getuid() !== 0) {
|
|
43672
|
-
if (er.code === "EINVAL" || er.code === "EPERM") return true;
|
|
43673
|
-
}
|
|
43674
|
-
return false;
|
|
43675
|
-
}
|
|
43676
|
-
}
|
|
43677
|
-
}));
|
|
43678
|
-
//#endregion
|
|
43679
|
-
//#region ../../node_modules/graceful-fs/legacy-streams.js
|
|
43680
|
-
var require_legacy_streams = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
43681
|
-
var Stream$2 = __require("stream").Stream;
|
|
43682
|
-
module.exports = legacy;
|
|
43683
|
-
function legacy(fs) {
|
|
43684
|
-
return {
|
|
43685
|
-
ReadStream,
|
|
43686
|
-
WriteStream
|
|
43687
|
-
};
|
|
43688
|
-
function ReadStream(path, options) {
|
|
43689
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
43690
|
-
Stream$2.call(this);
|
|
43691
|
-
var self = this;
|
|
43692
|
-
this.path = path;
|
|
43693
|
-
this.fd = null;
|
|
43694
|
-
this.readable = true;
|
|
43695
|
-
this.paused = false;
|
|
43696
|
-
this.flags = "r";
|
|
43697
|
-
this.mode = 438;
|
|
43698
|
-
this.bufferSize = 64 * 1024;
|
|
43699
|
-
options = options || {};
|
|
43700
|
-
var keys = Object.keys(options);
|
|
43701
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
43702
|
-
var key = keys[index];
|
|
43703
|
-
this[key] = options[key];
|
|
43704
|
-
}
|
|
43705
|
-
if (this.encoding) this.setEncoding(this.encoding);
|
|
43706
|
-
if (this.start !== void 0) {
|
|
43707
|
-
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
43708
|
-
if (this.end === void 0) this.end = Infinity;
|
|
43709
|
-
else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
|
|
43710
|
-
if (this.start > this.end) throw new Error("start must be <= end");
|
|
43711
|
-
this.pos = this.start;
|
|
43712
|
-
}
|
|
43713
|
-
if (this.fd !== null) {
|
|
43714
|
-
process.nextTick(function() {
|
|
43715
|
-
self._read();
|
|
43716
|
-
});
|
|
43717
|
-
return;
|
|
43718
|
-
}
|
|
43719
|
-
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
43720
|
-
if (err) {
|
|
43721
|
-
self.emit("error", err);
|
|
43722
|
-
self.readable = false;
|
|
43723
|
-
return;
|
|
43724
|
-
}
|
|
43725
|
-
self.fd = fd;
|
|
43726
|
-
self.emit("open", fd);
|
|
43727
|
-
self._read();
|
|
43728
|
-
});
|
|
43729
|
-
}
|
|
43730
|
-
function WriteStream(path, options) {
|
|
43731
|
-
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
43732
|
-
Stream$2.call(this);
|
|
43733
|
-
this.path = path;
|
|
43734
|
-
this.fd = null;
|
|
43735
|
-
this.writable = true;
|
|
43736
|
-
this.flags = "w";
|
|
43737
|
-
this.encoding = "binary";
|
|
43738
|
-
this.mode = 438;
|
|
43739
|
-
this.bytesWritten = 0;
|
|
43740
|
-
options = options || {};
|
|
43741
|
-
var keys = Object.keys(options);
|
|
43742
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
43743
|
-
var key = keys[index];
|
|
43744
|
-
this[key] = options[key];
|
|
43745
|
-
}
|
|
43746
|
-
if (this.start !== void 0) {
|
|
43747
|
-
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
43748
|
-
if (this.start < 0) throw new Error("start must be >= zero");
|
|
43749
|
-
this.pos = this.start;
|
|
43750
|
-
}
|
|
43751
|
-
this.busy = false;
|
|
43752
|
-
this._queue = [];
|
|
43753
|
-
if (this.fd === null) {
|
|
43754
|
-
this._open = fs.open;
|
|
43755
|
-
this._queue.push([
|
|
43756
|
-
this._open,
|
|
43757
|
-
this.path,
|
|
43758
|
-
this.flags,
|
|
43759
|
-
this.mode,
|
|
43760
|
-
void 0
|
|
43761
|
-
]);
|
|
43762
|
-
this.flush();
|
|
43763
|
-
}
|
|
43764
|
-
}
|
|
43765
|
-
}
|
|
43766
|
-
}));
|
|
43767
|
-
//#endregion
|
|
43768
|
-
//#region ../../node_modules/graceful-fs/clone.js
|
|
43769
|
-
var require_clone = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
43770
|
-
module.exports = clone;
|
|
43771
|
-
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
43772
|
-
return obj.__proto__;
|
|
43773
|
-
};
|
|
43774
|
-
function clone(obj) {
|
|
43775
|
-
if (obj === null || typeof obj !== "object") return obj;
|
|
43776
|
-
if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
|
|
43777
|
-
else var copy = Object.create(null);
|
|
43778
|
-
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
43779
|
-
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
43780
|
-
});
|
|
43781
|
-
return copy;
|
|
43782
|
-
}
|
|
43783
|
-
}));
|
|
43784
|
-
//#endregion
|
|
43785
|
-
//#region ../../node_modules/graceful-fs/graceful-fs.js
|
|
43786
|
-
var require_graceful_fs = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
43787
|
-
var fs$13 = __require("fs");
|
|
43788
|
-
var polyfills = require_polyfills();
|
|
43789
|
-
var legacy = require_legacy_streams();
|
|
43790
|
-
var clone = require_clone();
|
|
43791
|
-
var util$2 = __require("util");
|
|
43792
|
-
/* istanbul ignore next - node 0.x polyfill */
|
|
43793
|
-
var gracefulQueue;
|
|
43794
|
-
var previousSymbol;
|
|
43795
|
-
/* istanbul ignore else - node 0.x polyfill */
|
|
43796
|
-
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
43797
|
-
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
43798
|
-
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
43799
|
-
} else {
|
|
43800
|
-
gracefulQueue = "___graceful-fs.queue";
|
|
43801
|
-
previousSymbol = "___graceful-fs.previous";
|
|
43802
|
-
}
|
|
43803
|
-
function noop() {}
|
|
43804
|
-
function publishQueue(context, queue) {
|
|
43805
|
-
Object.defineProperty(context, gracefulQueue, { get: function() {
|
|
43806
|
-
return queue;
|
|
43807
|
-
} });
|
|
43808
|
-
}
|
|
43809
|
-
var debug = noop;
|
|
43810
|
-
if (util$2.debuglog) debug = util$2.debuglog("gfs4");
|
|
43811
|
-
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
|
|
43812
|
-
var m = util$2.format.apply(util$2, arguments);
|
|
43813
|
-
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
43814
|
-
console.error(m);
|
|
43815
|
-
};
|
|
43816
|
-
if (!fs$13[gracefulQueue]) {
|
|
43817
|
-
publishQueue(fs$13, global[gracefulQueue] || []);
|
|
43818
|
-
fs$13.close = (function(fs$close) {
|
|
43819
|
-
function close(fd, cb) {
|
|
43820
|
-
return fs$close.call(fs$13, fd, function(err) {
|
|
43821
|
-
if (!err) resetQueue();
|
|
43822
|
-
if (typeof cb === "function") cb.apply(this, arguments);
|
|
43823
|
-
});
|
|
43824
|
-
}
|
|
43825
|
-
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
43826
|
-
return close;
|
|
43827
|
-
})(fs$13.close);
|
|
43828
|
-
fs$13.closeSync = (function(fs$closeSync) {
|
|
43829
|
-
function closeSync(fd) {
|
|
43830
|
-
fs$closeSync.apply(fs$13, arguments);
|
|
43831
|
-
resetQueue();
|
|
43832
|
-
}
|
|
43833
|
-
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
43834
|
-
return closeSync;
|
|
43835
|
-
})(fs$13.closeSync);
|
|
43836
|
-
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
43837
|
-
debug(fs$13[gracefulQueue]);
|
|
43838
|
-
__require("assert").equal(fs$13[gracefulQueue].length, 0);
|
|
43839
|
-
});
|
|
43840
|
-
}
|
|
43841
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$13[gracefulQueue]);
|
|
43842
|
-
module.exports = patch(clone(fs$13));
|
|
43843
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$13.__patched) {
|
|
43844
|
-
module.exports = patch(fs$13);
|
|
43845
|
-
fs$13.__patched = true;
|
|
43846
|
-
}
|
|
43847
|
-
function patch(fs) {
|
|
43848
|
-
polyfills(fs);
|
|
43849
|
-
fs.gracefulify = patch;
|
|
43850
|
-
fs.createReadStream = createReadStream;
|
|
43851
|
-
fs.createWriteStream = createWriteStream;
|
|
43852
|
-
var fs$readFile = fs.readFile;
|
|
43853
|
-
fs.readFile = readFile;
|
|
43854
|
-
function readFile(path, options, cb) {
|
|
43855
|
-
if (typeof options === "function") cb = options, options = null;
|
|
43856
|
-
return go$readFile(path, options, cb);
|
|
43857
|
-
function go$readFile(path, options, cb, startTime) {
|
|
43858
|
-
return fs$readFile(path, options, function(err) {
|
|
43859
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
43860
|
-
go$readFile,
|
|
43861
|
-
[
|
|
43862
|
-
path,
|
|
43863
|
-
options,
|
|
43864
|
-
cb
|
|
43865
|
-
],
|
|
43866
|
-
err,
|
|
43867
|
-
startTime || Date.now(),
|
|
43868
|
-
Date.now()
|
|
43869
|
-
]);
|
|
43870
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
43871
|
-
});
|
|
43872
|
-
}
|
|
43873
|
-
}
|
|
43874
|
-
var fs$writeFile = fs.writeFile;
|
|
43875
|
-
fs.writeFile = writeFile;
|
|
43876
|
-
function writeFile(path, data, options, cb) {
|
|
43877
|
-
if (typeof options === "function") cb = options, options = null;
|
|
43878
|
-
return go$writeFile(path, data, options, cb);
|
|
43879
|
-
function go$writeFile(path, data, options, cb, startTime) {
|
|
43880
|
-
return fs$writeFile(path, data, options, function(err) {
|
|
43881
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
43882
|
-
go$writeFile,
|
|
43883
|
-
[
|
|
43884
|
-
path,
|
|
43885
|
-
data,
|
|
43886
|
-
options,
|
|
43887
|
-
cb
|
|
43888
|
-
],
|
|
43889
|
-
err,
|
|
43890
|
-
startTime || Date.now(),
|
|
43891
|
-
Date.now()
|
|
43892
|
-
]);
|
|
43893
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
43894
|
-
});
|
|
43895
|
-
}
|
|
43896
|
-
}
|
|
43897
|
-
var fs$appendFile = fs.appendFile;
|
|
43898
|
-
if (fs$appendFile) fs.appendFile = appendFile;
|
|
43899
|
-
function appendFile(path, data, options, cb) {
|
|
43900
|
-
if (typeof options === "function") cb = options, options = null;
|
|
43901
|
-
return go$appendFile(path, data, options, cb);
|
|
43902
|
-
function go$appendFile(path, data, options, cb, startTime) {
|
|
43903
|
-
return fs$appendFile(path, data, options, function(err) {
|
|
43904
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
43905
|
-
go$appendFile,
|
|
43906
|
-
[
|
|
43907
|
-
path,
|
|
43908
|
-
data,
|
|
43909
|
-
options,
|
|
43910
|
-
cb
|
|
43911
|
-
],
|
|
43912
|
-
err,
|
|
43913
|
-
startTime || Date.now(),
|
|
43914
|
-
Date.now()
|
|
43915
|
-
]);
|
|
43916
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
43917
|
-
});
|
|
43918
|
-
}
|
|
43919
|
-
}
|
|
43920
|
-
var fs$copyFile = fs.copyFile;
|
|
43921
|
-
if (fs$copyFile) fs.copyFile = copyFile;
|
|
43922
|
-
function copyFile(src, dest, flags, cb) {
|
|
43923
|
-
if (typeof flags === "function") {
|
|
43924
|
-
cb = flags;
|
|
43925
|
-
flags = 0;
|
|
43926
|
-
}
|
|
43927
|
-
return go$copyFile(src, dest, flags, cb);
|
|
43928
|
-
function go$copyFile(src, dest, flags, cb, startTime) {
|
|
43929
|
-
return fs$copyFile(src, dest, flags, function(err) {
|
|
43930
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
43931
|
-
go$copyFile,
|
|
43932
|
-
[
|
|
43933
|
-
src,
|
|
43934
|
-
dest,
|
|
43935
|
-
flags,
|
|
43936
|
-
cb
|
|
43937
|
-
],
|
|
43938
|
-
err,
|
|
43939
|
-
startTime || Date.now(),
|
|
43940
|
-
Date.now()
|
|
43941
|
-
]);
|
|
43942
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
43943
|
-
});
|
|
43944
|
-
}
|
|
43945
|
-
}
|
|
43946
|
-
var fs$readdir = fs.readdir;
|
|
43947
|
-
fs.readdir = readdir;
|
|
43948
|
-
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
43949
|
-
function readdir(path, options, cb) {
|
|
43950
|
-
if (typeof options === "function") cb = options, options = null;
|
|
43951
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
|
|
43952
|
-
return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
|
|
43953
|
-
} : function go$readdir(path, options, cb, startTime) {
|
|
43954
|
-
return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
|
|
43955
|
-
};
|
|
43956
|
-
return go$readdir(path, options, cb);
|
|
43957
|
-
function fs$readdirCallback(path, options, cb, startTime) {
|
|
43958
|
-
return function(err, files) {
|
|
43959
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
43960
|
-
go$readdir,
|
|
43961
|
-
[
|
|
43962
|
-
path,
|
|
43963
|
-
options,
|
|
43964
|
-
cb
|
|
43965
|
-
],
|
|
43966
|
-
err,
|
|
43967
|
-
startTime || Date.now(),
|
|
43968
|
-
Date.now()
|
|
43969
|
-
]);
|
|
43970
|
-
else {
|
|
43971
|
-
if (files && files.sort) files.sort();
|
|
43972
|
-
if (typeof cb === "function") cb.call(this, err, files);
|
|
43973
|
-
}
|
|
43974
|
-
};
|
|
43975
|
-
}
|
|
43976
|
-
}
|
|
43977
|
-
if (process.version.substr(0, 4) === "v0.8") {
|
|
43978
|
-
var legStreams = legacy(fs);
|
|
43979
|
-
ReadStream = legStreams.ReadStream;
|
|
43980
|
-
WriteStream = legStreams.WriteStream;
|
|
43981
|
-
}
|
|
43982
|
-
var fs$ReadStream = fs.ReadStream;
|
|
43983
|
-
if (fs$ReadStream) {
|
|
43984
|
-
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
43985
|
-
ReadStream.prototype.open = ReadStream$open;
|
|
43986
|
-
}
|
|
43987
|
-
var fs$WriteStream = fs.WriteStream;
|
|
43988
|
-
if (fs$WriteStream) {
|
|
43989
|
-
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
43990
|
-
WriteStream.prototype.open = WriteStream$open;
|
|
43991
|
-
}
|
|
43992
|
-
Object.defineProperty(fs, "ReadStream", {
|
|
43993
|
-
get: function() {
|
|
43994
|
-
return ReadStream;
|
|
43995
|
-
},
|
|
43996
|
-
set: function(val) {
|
|
43997
|
-
ReadStream = val;
|
|
43998
|
-
},
|
|
43999
|
-
enumerable: true,
|
|
44000
|
-
configurable: true
|
|
44001
|
-
});
|
|
44002
|
-
Object.defineProperty(fs, "WriteStream", {
|
|
44003
|
-
get: function() {
|
|
44004
|
-
return WriteStream;
|
|
44005
|
-
},
|
|
44006
|
-
set: function(val) {
|
|
44007
|
-
WriteStream = val;
|
|
44008
|
-
},
|
|
44009
|
-
enumerable: true,
|
|
44010
|
-
configurable: true
|
|
44011
|
-
});
|
|
44012
|
-
var FileReadStream = ReadStream;
|
|
44013
|
-
Object.defineProperty(fs, "FileReadStream", {
|
|
44014
|
-
get: function() {
|
|
44015
|
-
return FileReadStream;
|
|
44016
|
-
},
|
|
44017
|
-
set: function(val) {
|
|
44018
|
-
FileReadStream = val;
|
|
44019
|
-
},
|
|
44020
|
-
enumerable: true,
|
|
44021
|
-
configurable: true
|
|
44022
|
-
});
|
|
44023
|
-
var FileWriteStream = WriteStream;
|
|
44024
|
-
Object.defineProperty(fs, "FileWriteStream", {
|
|
44025
|
-
get: function() {
|
|
44026
|
-
return FileWriteStream;
|
|
44027
|
-
},
|
|
44028
|
-
set: function(val) {
|
|
44029
|
-
FileWriteStream = val;
|
|
44030
|
-
},
|
|
44031
|
-
enumerable: true,
|
|
44032
|
-
configurable: true
|
|
44033
|
-
});
|
|
44034
|
-
function ReadStream(path, options) {
|
|
44035
|
-
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
44036
|
-
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
44037
|
-
}
|
|
44038
|
-
function ReadStream$open() {
|
|
44039
|
-
var that = this;
|
|
44040
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
44041
|
-
if (err) {
|
|
44042
|
-
if (that.autoClose) that.destroy();
|
|
44043
|
-
that.emit("error", err);
|
|
44044
|
-
} else {
|
|
44045
|
-
that.fd = fd;
|
|
44046
|
-
that.emit("open", fd);
|
|
44047
|
-
that.read();
|
|
44048
|
-
}
|
|
44049
|
-
});
|
|
44050
|
-
}
|
|
44051
|
-
function WriteStream(path, options) {
|
|
44052
|
-
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
44053
|
-
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
44054
|
-
}
|
|
44055
|
-
function WriteStream$open() {
|
|
44056
|
-
var that = this;
|
|
44057
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
44058
|
-
if (err) {
|
|
44059
|
-
that.destroy();
|
|
44060
|
-
that.emit("error", err);
|
|
44061
|
-
} else {
|
|
44062
|
-
that.fd = fd;
|
|
44063
|
-
that.emit("open", fd);
|
|
44064
|
-
}
|
|
44065
|
-
});
|
|
44066
|
-
}
|
|
44067
|
-
function createReadStream(path, options) {
|
|
44068
|
-
return new fs.ReadStream(path, options);
|
|
44069
|
-
}
|
|
44070
|
-
function createWriteStream(path, options) {
|
|
44071
|
-
return new fs.WriteStream(path, options);
|
|
44072
|
-
}
|
|
44073
|
-
var fs$open = fs.open;
|
|
44074
|
-
fs.open = open;
|
|
44075
|
-
function open(path, flags, mode, cb) {
|
|
44076
|
-
if (typeof mode === "function") cb = mode, mode = null;
|
|
44077
|
-
return go$open(path, flags, mode, cb);
|
|
44078
|
-
function go$open(path, flags, mode, cb, startTime) {
|
|
44079
|
-
return fs$open(path, flags, mode, function(err, fd) {
|
|
44080
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
44081
|
-
go$open,
|
|
44082
|
-
[
|
|
44083
|
-
path,
|
|
44084
|
-
flags,
|
|
44085
|
-
mode,
|
|
44086
|
-
cb
|
|
44087
|
-
],
|
|
44088
|
-
err,
|
|
44089
|
-
startTime || Date.now(),
|
|
44090
|
-
Date.now()
|
|
44091
|
-
]);
|
|
44092
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
44093
|
-
});
|
|
44094
|
-
}
|
|
44095
|
-
}
|
|
44096
|
-
return fs;
|
|
44097
|
-
}
|
|
44098
|
-
function enqueue(elem) {
|
|
44099
|
-
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
44100
|
-
fs$13[gracefulQueue].push(elem);
|
|
44101
|
-
retry();
|
|
44102
|
-
}
|
|
44103
|
-
var retryTimer;
|
|
44104
|
-
function resetQueue() {
|
|
44105
|
-
var now = Date.now();
|
|
44106
|
-
for (var i = 0; i < fs$13[gracefulQueue].length; ++i) if (fs$13[gracefulQueue][i].length > 2) {
|
|
44107
|
-
fs$13[gracefulQueue][i][3] = now;
|
|
44108
|
-
fs$13[gracefulQueue][i][4] = now;
|
|
44109
|
-
}
|
|
44110
|
-
retry();
|
|
44111
|
-
}
|
|
44112
|
-
function retry() {
|
|
44113
|
-
clearTimeout(retryTimer);
|
|
44114
|
-
retryTimer = void 0;
|
|
44115
|
-
if (fs$13[gracefulQueue].length === 0) return;
|
|
44116
|
-
var elem = fs$13[gracefulQueue].shift();
|
|
44117
|
-
var fn = elem[0];
|
|
44118
|
-
var args = elem[1];
|
|
44119
|
-
var err = elem[2];
|
|
44120
|
-
var startTime = elem[3];
|
|
44121
|
-
var lastTime = elem[4];
|
|
44122
|
-
if (startTime === void 0) {
|
|
44123
|
-
debug("RETRY", fn.name, args);
|
|
44124
|
-
fn.apply(null, args);
|
|
44125
|
-
} else if (Date.now() - startTime >= 6e4) {
|
|
44126
|
-
debug("TIMEOUT", fn.name, args);
|
|
44127
|
-
var cb = args.pop();
|
|
44128
|
-
if (typeof cb === "function") cb.call(null, err);
|
|
44129
|
-
} else {
|
|
44130
|
-
var sinceAttempt = Date.now() - lastTime;
|
|
44131
|
-
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
44132
|
-
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
44133
|
-
debug("RETRY", fn.name, args);
|
|
44134
|
-
fn.apply(null, args.concat([startTime]));
|
|
44135
|
-
} else fs$13[gracefulQueue].push(elem);
|
|
44136
|
-
}
|
|
44137
|
-
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
44138
|
-
}
|
|
44139
|
-
}));
|
|
44140
|
-
//#endregion
|
|
44141
42697
|
//#region ../../node_modules/streamroller/node_modules/fs-extra/lib/fs/index.js
|
|
44142
42698
|
var require_fs = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
44143
42699
|
var u = require_universalify().fromCallback;
|
|
@@ -48855,7 +47411,7 @@ var require_thread_stream = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
|
|
|
48855
47411
|
var { EventEmitter: EventEmitter$7 } = __require("events");
|
|
48856
47412
|
var { Worker: Worker$1 } = __require("worker_threads");
|
|
48857
47413
|
var { join: join$2 } = __require("path");
|
|
48858
|
-
var { pathToFileURL } = __require("url");
|
|
47414
|
+
var { pathToFileURL: pathToFileURL$1 } = __require("url");
|
|
48859
47415
|
var { wait } = require_wait();
|
|
48860
47416
|
var { WRITE_INDEX, READ_INDEX, SEQ_INDEX } = require_indexes();
|
|
48861
47417
|
var buffer = __require("buffer");
|
|
@@ -48900,7 +47456,7 @@ var require_thread_stream = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
|
|
|
48900
47456
|
name: opts.workerOpts?.name || "thread-stream",
|
|
48901
47457
|
trackUnmanagedFds: false,
|
|
48902
47458
|
workerData: {
|
|
48903
|
-
filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href,
|
|
47459
|
+
filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL$1(filename).href,
|
|
48904
47460
|
dataBuf: stream[kImpl].dataBuf,
|
|
48905
47461
|
stateBuf: stream[kImpl].stateBuf,
|
|
48906
47462
|
workerData: {
|
|
@@ -77369,7 +75925,7 @@ var require_tcp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
77369
75925
|
var { isObject, isString } = require_utils$3();
|
|
77370
75926
|
var fs$8 = __require("fs");
|
|
77371
75927
|
var kleur = require_kleur();
|
|
77372
|
-
var Node = require_node
|
|
75928
|
+
var Node = require_node();
|
|
77373
75929
|
var P = require_packets();
|
|
77374
75930
|
var { resolvePacketID } = require_constants();
|
|
77375
75931
|
var { MoleculerServerError } = require_errors$2();
|
|
@@ -90322,7 +88878,7 @@ while (this[Le](this[Ft]()) && this[C].length);
|
|
|
90322
88878
|
readlink,
|
|
90323
88879
|
realpath
|
|
90324
88880
|
}
|
|
90325
|
-
}, Ue = (n) => !n || n === wt || n === fs$
|
|
88881
|
+
}, Ue = (n) => !n || n === wt || n === fs$17 ? wt : {
|
|
90326
88882
|
...wt,
|
|
90327
88883
|
...n,
|
|
90328
88884
|
promises: {
|
|
@@ -91899,6 +90455,9 @@ function resolveUseHostname() {
|
|
|
91899
90455
|
function createBroker(config) {
|
|
91900
90456
|
const { nodeID, mode, hubAddress, logLevel = "warn", secret, tcpPort = DEFAULT_HUB_TCP_PORT, udpPort = DEFAULT_UDP_PORT } = config;
|
|
91901
90457
|
const useHostname = resolveUseHostname();
|
|
90458
|
+
const moleculerDebug = process.env["CAMSTACK_MOLECULER_DEBUG"] === "1" || process.env["CAMSTACK_MOLECULER_DEBUG"] === "true";
|
|
90459
|
+
const infraLevel = moleculerDebug ? "debug" : "error";
|
|
90460
|
+
const wildcardLevel = moleculerDebug ? "debug" : logLevel;
|
|
91902
90461
|
if (mode === "test") return new ServiceBroker({
|
|
91903
90462
|
nodeID,
|
|
91904
90463
|
transporter: "Fake",
|
|
@@ -91927,17 +90486,19 @@ function createBroker(config) {
|
|
|
91927
90486
|
useHostname,
|
|
91928
90487
|
udpDiscovery: true,
|
|
91929
90488
|
udpPort,
|
|
91930
|
-
udpPeriod: 5
|
|
90489
|
+
udpPeriod: 5,
|
|
90490
|
+
debug: moleculerDebug
|
|
91931
90491
|
}
|
|
91932
90492
|
},
|
|
91933
90493
|
logger: {
|
|
91934
90494
|
type: "Console",
|
|
91935
90495
|
options: { level: {
|
|
91936
|
-
BROKER:
|
|
91937
|
-
TRANSPORTER:
|
|
91938
|
-
|
|
91939
|
-
|
|
91940
|
-
|
|
90496
|
+
BROKER: infraLevel,
|
|
90497
|
+
TRANSPORTER: infraLevel,
|
|
90498
|
+
TRANSIT: infraLevel,
|
|
90499
|
+
REGISTRY: infraLevel,
|
|
90500
|
+
DISCOVERER: infraLevel,
|
|
90501
|
+
"**": wildcardLevel
|
|
91941
90502
|
} }
|
|
91942
90503
|
},
|
|
91943
90504
|
metrics: metricsConfig
|
|
@@ -91945,7 +90506,8 @@ function createBroker(config) {
|
|
|
91945
90506
|
const tcpOptions = {
|
|
91946
90507
|
maxPacketSize: 10 * 1024 * 1024,
|
|
91947
90508
|
port: config.agentListenPort ?? deriveAgentListenPort(nodeID),
|
|
91948
|
-
useHostname
|
|
90509
|
+
useHostname,
|
|
90510
|
+
debug: moleculerDebug
|
|
91949
90511
|
};
|
|
91950
90512
|
if (hubAddress) {
|
|
91951
90513
|
tcpOptions.urls = normalizeHubUrl(hubAddress, tcpPort);
|
|
@@ -91966,11 +90528,12 @@ function createBroker(config) {
|
|
|
91966
90528
|
logger: {
|
|
91967
90529
|
type: "Console",
|
|
91968
90530
|
options: { level: {
|
|
91969
|
-
BROKER:
|
|
91970
|
-
TRANSPORTER:
|
|
91971
|
-
|
|
91972
|
-
|
|
91973
|
-
|
|
90531
|
+
BROKER: infraLevel,
|
|
90532
|
+
TRANSPORTER: infraLevel,
|
|
90533
|
+
TRANSIT: infraLevel,
|
|
90534
|
+
REGISTRY: infraLevel,
|
|
90535
|
+
DISCOVERER: infraLevel,
|
|
90536
|
+
"**": wildcardLevel
|
|
91974
90537
|
} }
|
|
91975
90538
|
},
|
|
91976
90539
|
metrics: metricsConfig
|
|
@@ -93176,4 +91739,407 @@ var RingBuffer = class {
|
|
|
93176
91739
|
}
|
|
93177
91740
|
};
|
|
93178
91741
|
//#endregion
|
|
93179
|
-
|
|
91742
|
+
//#region src/kernel/lifecycle/job-journal.ts
|
|
91743
|
+
var JobJournal = class {
|
|
91744
|
+
jobsDir;
|
|
91745
|
+
indexPath;
|
|
91746
|
+
constructor(jobsDir) {
|
|
91747
|
+
this.jobsDir = jobsDir;
|
|
91748
|
+
this.indexPath = path$40.join(jobsDir, "index.json");
|
|
91749
|
+
}
|
|
91750
|
+
jobPath(id) {
|
|
91751
|
+
return path$40.join(this.jobsDir, `${id}.json`);
|
|
91752
|
+
}
|
|
91753
|
+
writeAtomic(filePath, data) {
|
|
91754
|
+
fs$17.mkdirSync(path$40.dirname(filePath), { recursive: true });
|
|
91755
|
+
const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
91756
|
+
fs$17.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
91757
|
+
encoding: "utf-8",
|
|
91758
|
+
mode: 384
|
|
91759
|
+
});
|
|
91760
|
+
fs$17.renameSync(tmp, filePath);
|
|
91761
|
+
}
|
|
91762
|
+
readIndex() {
|
|
91763
|
+
try {
|
|
91764
|
+
const raw = JSON.parse(fs$17.readFileSync(this.indexPath, "utf-8"));
|
|
91765
|
+
if (raw && Array.isArray(raw.jobIds)) return {
|
|
91766
|
+
version: 1,
|
|
91767
|
+
jobIds: raw.jobIds
|
|
91768
|
+
};
|
|
91769
|
+
} catch {}
|
|
91770
|
+
return {
|
|
91771
|
+
version: 1,
|
|
91772
|
+
jobIds: []
|
|
91773
|
+
};
|
|
91774
|
+
}
|
|
91775
|
+
addToIndex(id) {
|
|
91776
|
+
const idx = this.readIndex();
|
|
91777
|
+
if (idx.jobIds.includes(id)) return;
|
|
91778
|
+
this.writeAtomic(this.indexPath, {
|
|
91779
|
+
version: 1,
|
|
91780
|
+
jobIds: [...idx.jobIds, id]
|
|
91781
|
+
});
|
|
91782
|
+
}
|
|
91783
|
+
createJob(job) {
|
|
91784
|
+
this.writeAtomic(this.jobPath(job.jobId), job);
|
|
91785
|
+
this.addToIndex(job.jobId);
|
|
91786
|
+
}
|
|
91787
|
+
getJob(id) {
|
|
91788
|
+
try {
|
|
91789
|
+
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs$17.readFileSync(this.jobPath(id), "utf-8")));
|
|
91790
|
+
return parsed.success ? parsed.data : null;
|
|
91791
|
+
} catch {
|
|
91792
|
+
return null;
|
|
91793
|
+
}
|
|
91794
|
+
}
|
|
91795
|
+
listJobs(opts) {
|
|
91796
|
+
const out = [];
|
|
91797
|
+
for (const id of this.readIndex().jobIds) {
|
|
91798
|
+
const j = this.getJob(id);
|
|
91799
|
+
if (j && (!opts?.activeOnly || j.state === "running")) out.push(j);
|
|
91800
|
+
}
|
|
91801
|
+
return out;
|
|
91802
|
+
}
|
|
91803
|
+
mutate(id, fn) {
|
|
91804
|
+
const job = this.getJob(id);
|
|
91805
|
+
if (!job) throw new Error(`JobJournal: job '${id}' not found`);
|
|
91806
|
+
const next = fn(job);
|
|
91807
|
+
this.writeAtomic(this.jobPath(id), next);
|
|
91808
|
+
return next;
|
|
91809
|
+
}
|
|
91810
|
+
patchTask(jobId, taskId, patch) {
|
|
91811
|
+
return this.mutate(jobId, (j) => ({
|
|
91812
|
+
...j,
|
|
91813
|
+
tasks: j.tasks.map((t) => t.taskId === taskId ? {
|
|
91814
|
+
...t,
|
|
91815
|
+
...patch
|
|
91816
|
+
} : t)
|
|
91817
|
+
}));
|
|
91818
|
+
}
|
|
91819
|
+
appendLog(jobId, taskId, entry) {
|
|
91820
|
+
return this.mutate(jobId, (j) => ({
|
|
91821
|
+
...j,
|
|
91822
|
+
tasks: j.tasks.map((t) => t.taskId === taskId ? {
|
|
91823
|
+
...t,
|
|
91824
|
+
steps: [...t.steps, entry]
|
|
91825
|
+
} : t)
|
|
91826
|
+
}));
|
|
91827
|
+
}
|
|
91828
|
+
setJobState(jobId, state) {
|
|
91829
|
+
return this.mutate(jobId, (j) => ({
|
|
91830
|
+
...j,
|
|
91831
|
+
state
|
|
91832
|
+
}));
|
|
91833
|
+
}
|
|
91834
|
+
};
|
|
91835
|
+
//#endregion
|
|
91836
|
+
//#region src/kernel/lifecycle/staging-area.ts
|
|
91837
|
+
function safeSegment$1(name) {
|
|
91838
|
+
return name.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
91839
|
+
}
|
|
91840
|
+
var StagingArea = class {
|
|
91841
|
+
stagingDir;
|
|
91842
|
+
deps;
|
|
91843
|
+
constructor(stagingDir, deps) {
|
|
91844
|
+
this.stagingDir = stagingDir;
|
|
91845
|
+
this.deps = deps;
|
|
91846
|
+
}
|
|
91847
|
+
async fetchAndStage(input) {
|
|
91848
|
+
const destDir = path$40.join(this.stagingDir, input.jobId, safeSegment$1(input.name));
|
|
91849
|
+
fs$17.rmSync(destDir, {
|
|
91850
|
+
recursive: true,
|
|
91851
|
+
force: true
|
|
91852
|
+
});
|
|
91853
|
+
const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
|
|
91854
|
+
if (input.signal.aborted) throw new Error("staging aborted after fetch");
|
|
91855
|
+
await this.deps.extract(tgz, destDir);
|
|
91856
|
+
const raw = JSON.parse(fs$17.readFileSync(path$40.join(destDir, "package.json"), "utf-8"));
|
|
91857
|
+
if (raw.version !== input.version) throw new Error(`staging validation failed: ${input.name} expected version ${input.version}, got ${String(raw.version)}`);
|
|
91858
|
+
return { stagedPath: destDir };
|
|
91859
|
+
}
|
|
91860
|
+
cleanup(jobId) {
|
|
91861
|
+
fs$17.rmSync(path$40.join(this.stagingDir, jobId), {
|
|
91862
|
+
recursive: true,
|
|
91863
|
+
force: true
|
|
91864
|
+
});
|
|
91865
|
+
}
|
|
91866
|
+
};
|
|
91867
|
+
//#endregion
|
|
91868
|
+
//#region src/kernel/lifecycle/lifecycle-job-engine.ts
|
|
91869
|
+
var DEFAULT_FETCH_TIMEOUT_MS = 6e4;
|
|
91870
|
+
var DEFAULT_FETCH_CONCURRENCY = 3;
|
|
91871
|
+
var LifecycleJobEngine = class {
|
|
91872
|
+
deps;
|
|
91873
|
+
constructor(deps) {
|
|
91874
|
+
this.deps = deps;
|
|
91875
|
+
}
|
|
91876
|
+
advance(jobId, task, phase, patch = {}) {
|
|
91877
|
+
this.deps.journal.patchTask(jobId, task.taskId, {
|
|
91878
|
+
phase,
|
|
91879
|
+
...patch
|
|
91880
|
+
});
|
|
91881
|
+
const entry = {
|
|
91882
|
+
tsMs: this.deps.now(),
|
|
91883
|
+
nodeId: task.nodeId,
|
|
91884
|
+
packageName: task.packageName,
|
|
91885
|
+
phase,
|
|
91886
|
+
message: `${task.packageName} → ${phase}`
|
|
91887
|
+
};
|
|
91888
|
+
const job = this.deps.journal.appendLog(jobId, task.taskId, entry);
|
|
91889
|
+
this.deps.emit("progress", job);
|
|
91890
|
+
this.deps.emit("log", job, entry);
|
|
91891
|
+
return job;
|
|
91892
|
+
}
|
|
91893
|
+
/**
|
|
91894
|
+
* Fetch + stage a single addon task (advancing it to `staged`), wrapped in a
|
|
91895
|
+
* per-task abort timeout. On success the resolved `stagedPath` is returned; on
|
|
91896
|
+
* failure the task is marked `failed` and `null` is returned (so the apply
|
|
91897
|
+
* phase skips it). Other tasks are unaffected.
|
|
91898
|
+
*/
|
|
91899
|
+
async fetchAddonTask(job, task) {
|
|
91900
|
+
try {
|
|
91901
|
+
this.advance(job.jobId, task, "fetching", {
|
|
91902
|
+
startedAtMs: this.deps.now(),
|
|
91903
|
+
attempts: task.attempts + 1
|
|
91904
|
+
});
|
|
91905
|
+
const ac = new AbortController();
|
|
91906
|
+
const timer = setTimeout(() => ac.abort(), this.deps.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
|
|
91907
|
+
let stagedPath;
|
|
91908
|
+
try {
|
|
91909
|
+
stagedPath = (await this.deps.staging.fetchAndStage({
|
|
91910
|
+
jobId: job.jobId,
|
|
91911
|
+
name: task.packageName,
|
|
91912
|
+
version: task.toVersion,
|
|
91913
|
+
signal: ac.signal
|
|
91914
|
+
})).stagedPath;
|
|
91915
|
+
} finally {
|
|
91916
|
+
clearTimeout(timer);
|
|
91917
|
+
}
|
|
91918
|
+
this.advance(job.jobId, task, "staged", { stagedPath });
|
|
91919
|
+
return {
|
|
91920
|
+
task,
|
|
91921
|
+
stagedPath
|
|
91922
|
+
};
|
|
91923
|
+
} catch (err) {
|
|
91924
|
+
this.advance(job.jobId, task, "failed", {
|
|
91925
|
+
error: err instanceof Error ? err.message : String(err),
|
|
91926
|
+
finishedAtMs: this.deps.now()
|
|
91927
|
+
});
|
|
91928
|
+
return {
|
|
91929
|
+
task,
|
|
91930
|
+
stagedPath: null
|
|
91931
|
+
};
|
|
91932
|
+
}
|
|
91933
|
+
}
|
|
91934
|
+
/**
|
|
91935
|
+
* Apply a single already-staged addon task serially:
|
|
91936
|
+
* `validating` → `applying` → applyAddonUpdate → `restarting` → `done`.
|
|
91937
|
+
* Returns true on success, false if the apply throws (task marked `failed`).
|
|
91938
|
+
*/
|
|
91939
|
+
async applyAddonTask(job, task, stagedPath) {
|
|
91940
|
+
try {
|
|
91941
|
+
this.advance(job.jobId, task, "validating");
|
|
91942
|
+
this.advance(job.jobId, task, "applying");
|
|
91943
|
+
await this.deps.applyAddonUpdate({
|
|
91944
|
+
name: task.packageName,
|
|
91945
|
+
version: task.toVersion,
|
|
91946
|
+
stagedPath
|
|
91947
|
+
});
|
|
91948
|
+
this.advance(job.jobId, task, "restarting");
|
|
91949
|
+
this.advance(job.jobId, task, "done", { finishedAtMs: this.deps.now() });
|
|
91950
|
+
return true;
|
|
91951
|
+
} catch (err) {
|
|
91952
|
+
this.advance(job.jobId, task, "failed", {
|
|
91953
|
+
error: err instanceof Error ? err.message : String(err),
|
|
91954
|
+
finishedAtMs: this.deps.now()
|
|
91955
|
+
});
|
|
91956
|
+
return false;
|
|
91957
|
+
}
|
|
91958
|
+
}
|
|
91959
|
+
/**
|
|
91960
|
+
* Run the framework task: stage lockstep → `staged` → requestFrameworkSwap.
|
|
91961
|
+
* In production the process exits after requestFrameworkSwap and the reboot
|
|
91962
|
+
* finalizes the job, so this returns the current durable job WITHOUT
|
|
91963
|
+
* finalization. Returns null only if the framework deps are not wired (the
|
|
91964
|
+
* task is marked `failed` and the caller finalizes the job).
|
|
91965
|
+
*/
|
|
91966
|
+
async runFrameworkTask(job, task) {
|
|
91967
|
+
const { stageFramework, requestFrameworkSwap } = this.deps;
|
|
91968
|
+
if (stageFramework === void 0 || requestFrameworkSwap === void 0) {
|
|
91969
|
+
this.advance(job.jobId, task, "failed", {
|
|
91970
|
+
error: "framework swap deps not wired",
|
|
91971
|
+
finishedAtMs: this.deps.now()
|
|
91972
|
+
});
|
|
91973
|
+
return null;
|
|
91974
|
+
}
|
|
91975
|
+
try {
|
|
91976
|
+
this.advance(job.jobId, task, "fetching", {
|
|
91977
|
+
startedAtMs: this.deps.now(),
|
|
91978
|
+
attempts: task.attempts + 1
|
|
91979
|
+
});
|
|
91980
|
+
const ac = new AbortController();
|
|
91981
|
+
const timer = setTimeout(() => ac.abort(), this.deps.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
|
|
91982
|
+
let packages;
|
|
91983
|
+
try {
|
|
91984
|
+
packages = await stageFramework(task, ac.signal);
|
|
91985
|
+
} finally {
|
|
91986
|
+
clearTimeout(timer);
|
|
91987
|
+
}
|
|
91988
|
+
if (packages.length === 0) throw new Error("stageFramework returned no packages");
|
|
91989
|
+
const [firstPackage] = packages;
|
|
91990
|
+
this.advance(job.jobId, task, "staged", { stagedPath: firstPackage.stagedPath });
|
|
91991
|
+
requestFrameworkSwap({
|
|
91992
|
+
jobId: job.jobId,
|
|
91993
|
+
taskId: task.taskId,
|
|
91994
|
+
packages
|
|
91995
|
+
});
|
|
91996
|
+
return this.deps.journal.getJob(job.jobId) ?? job;
|
|
91997
|
+
} catch (err) {
|
|
91998
|
+
this.advance(job.jobId, task, "failed", {
|
|
91999
|
+
error: err instanceof Error ? err.message : String(err),
|
|
92000
|
+
finishedAtMs: this.deps.now()
|
|
92001
|
+
});
|
|
92002
|
+
return null;
|
|
92003
|
+
}
|
|
92004
|
+
}
|
|
92005
|
+
/**
|
|
92006
|
+
* Run the addon fetch phase with a bounded-concurrency worker pool. At most
|
|
92007
|
+
* `fetchConcurrency` fetches are in flight at once; completion order may vary
|
|
92008
|
+
* but the returned outcomes preserve the input task order.
|
|
92009
|
+
*/
|
|
92010
|
+
async fetchAddonsBounded(job, addonTasks) {
|
|
92011
|
+
const limit = Math.max(1, this.deps.fetchConcurrency ?? DEFAULT_FETCH_CONCURRENCY);
|
|
92012
|
+
const outcomes = new Array(addonTasks.length);
|
|
92013
|
+
let nextIndex = 0;
|
|
92014
|
+
const worker = async () => {
|
|
92015
|
+
for (;;) {
|
|
92016
|
+
const index = nextIndex;
|
|
92017
|
+
nextIndex += 1;
|
|
92018
|
+
if (index >= addonTasks.length) return;
|
|
92019
|
+
outcomes[index] = await this.fetchAddonTask(job, addonTasks[index]);
|
|
92020
|
+
}
|
|
92021
|
+
};
|
|
92022
|
+
const workerCount = Math.min(limit, addonTasks.length);
|
|
92023
|
+
await Promise.all(Array.from({ length: workerCount }, () => worker()));
|
|
92024
|
+
return outcomes.filter((o) => o !== void 0);
|
|
92025
|
+
}
|
|
92026
|
+
/**
|
|
92027
|
+
* §10 boot reconcile: re-drive every NON-TERMINAL addon task of a job that
|
|
92028
|
+
* was interrupted mid-flight (e.g. a crash) from its on-disk checkpoint.
|
|
92029
|
+
*
|
|
92030
|
+
* Framework tasks are LEFT UNTOUCHED — they are owned by the F2
|
|
92031
|
+
* `resumeFrameworkSwapJob` path (which marks `applied`→`done` on a healthy
|
|
92032
|
+
* reboot). Terminal addon tasks (`done`/`failed`/`skipped`) are skipped.
|
|
92033
|
+
*
|
|
92034
|
+
* Apply is idempotent (`applyAddonUpdate` backs up the live dir + restores on
|
|
92035
|
+
* failure), so every non-terminal addon phase collapses to:
|
|
92036
|
+
* ensure staged (reuse a still-valid `stagedPath` or re-fetch) → apply → done;
|
|
92037
|
+
* on failure → `failed`.
|
|
92038
|
+
*
|
|
92039
|
+
* The job is finalized (`completed`/`partially-failed`/`failed` + staging
|
|
92040
|
+
* cleanup) ONLY when ALL tasks — including any framework task — are terminal.
|
|
92041
|
+
* If a framework task is still non-terminal the job is LEFT `running` (the
|
|
92042
|
+
* reboot/F2 path finalizes it).
|
|
92043
|
+
*/
|
|
92044
|
+
async reconcileJob(job) {
|
|
92045
|
+
const exists = this.deps.stagedPathExists ?? ((p) => fs$17.existsSync(p));
|
|
92046
|
+
for (const task of job.tasks) {
|
|
92047
|
+
if (task.target === "framework") continue;
|
|
92048
|
+
if (this.isTerminal(task.phase)) continue;
|
|
92049
|
+
await this.reconcileAddonTask(job, task, exists);
|
|
92050
|
+
}
|
|
92051
|
+
return this.finalizeReconciledJob(job.jobId);
|
|
92052
|
+
}
|
|
92053
|
+
isTerminal(phase) {
|
|
92054
|
+
return phase === "done" || phase === "failed" || phase === "skipped";
|
|
92055
|
+
}
|
|
92056
|
+
/**
|
|
92057
|
+
* Re-drive a single non-terminal addon task: reuse a still-valid `stagedPath`
|
|
92058
|
+
* when present (idempotent re-apply), otherwise re-fetch + stage, then apply.
|
|
92059
|
+
*/
|
|
92060
|
+
async reconcileAddonTask(job, task, exists) {
|
|
92061
|
+
let stagedPath = null;
|
|
92062
|
+
if (task.stagedPath !== null && exists(task.stagedPath)) stagedPath = task.stagedPath;
|
|
92063
|
+
else stagedPath = (await this.fetchAddonTask(job, task)).stagedPath;
|
|
92064
|
+
if (stagedPath === null) return;
|
|
92065
|
+
await this.applyAddonTask(job, task, stagedPath);
|
|
92066
|
+
}
|
|
92067
|
+
/**
|
|
92068
|
+
* Finalize a reconciled job: `completed` if all addon tasks succeeded,
|
|
92069
|
+
* `failed` if all failed, `partially-failed` if mixed — but ONLY when every
|
|
92070
|
+
* task (including framework) is terminal. If any task is still non-terminal
|
|
92071
|
+
* (a framework task pending its reboot resume), leave the job `running`.
|
|
92072
|
+
*/
|
|
92073
|
+
finalizeReconciledJob(jobId) {
|
|
92074
|
+
const current = this.deps.journal.getJob(jobId);
|
|
92075
|
+
if (current === null) throw new Error(`LifecycleJobEngine: job '${jobId}' vanished during reconcile`);
|
|
92076
|
+
if (!current.tasks.every((t) => this.isTerminal(t.phase))) return current;
|
|
92077
|
+
const anyFailed = current.tasks.some((t) => t.phase === "failed");
|
|
92078
|
+
const allFailed = current.tasks.every((t) => t.phase === "failed");
|
|
92079
|
+
const state = !anyFailed ? "completed" : allFailed ? "failed" : "partially-failed";
|
|
92080
|
+
const finalJob = this.deps.journal.setJobState(jobId, state);
|
|
92081
|
+
this.deps.staging.cleanup(jobId);
|
|
92082
|
+
return finalJob;
|
|
92083
|
+
}
|
|
92084
|
+
async runJob(job) {
|
|
92085
|
+
const addonTasks = job.tasks.filter((t) => t.target !== "framework");
|
|
92086
|
+
const frameworkTasks = job.tasks.filter((t) => t.target === "framework");
|
|
92087
|
+
let failures = 0;
|
|
92088
|
+
let successes = 0;
|
|
92089
|
+
const fetchOutcomes = await this.fetchAddonsBounded(job, addonTasks);
|
|
92090
|
+
for (const outcome of fetchOutcomes) if (outcome.stagedPath === null) failures += 1;
|
|
92091
|
+
for (const outcome of fetchOutcomes) {
|
|
92092
|
+
if (outcome.stagedPath === null) continue;
|
|
92093
|
+
if (await this.applyAddonTask(job, outcome.task, outcome.stagedPath)) successes += 1;
|
|
92094
|
+
else failures += 1;
|
|
92095
|
+
}
|
|
92096
|
+
for (const task of frameworkTasks) {
|
|
92097
|
+
const result = await this.runFrameworkTask(job, task);
|
|
92098
|
+
if (result !== null) return result;
|
|
92099
|
+
failures += 1;
|
|
92100
|
+
}
|
|
92101
|
+
const state = failures === 0 ? "completed" : successes === 0 ? "failed" : "partially-failed";
|
|
92102
|
+
const finalJob = this.deps.journal.setJobState(job.jobId, state);
|
|
92103
|
+
this.deps.staging.cleanup(job.jobId);
|
|
92104
|
+
return finalJob;
|
|
92105
|
+
}
|
|
92106
|
+
};
|
|
92107
|
+
//#endregion
|
|
92108
|
+
//#region src/kernel/lifecycle/framework-staging.ts
|
|
92109
|
+
var FRAMEWORK_LOCKSTEP = [
|
|
92110
|
+
"@camstack/system",
|
|
92111
|
+
"@camstack/types",
|
|
92112
|
+
"@camstack/sdk",
|
|
92113
|
+
"@camstack/shm-ring"
|
|
92114
|
+
];
|
|
92115
|
+
function safeSegment(name) {
|
|
92116
|
+
return name.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
92117
|
+
}
|
|
92118
|
+
async function stageFrameworkLockstep(input) {
|
|
92119
|
+
const stagingArea = new StagingArea(input.stagingDir, {
|
|
92120
|
+
fetchTarball: input.fetchTarball,
|
|
92121
|
+
extract: input.extract
|
|
92122
|
+
});
|
|
92123
|
+
const results = [];
|
|
92124
|
+
for (const pkg of FRAMEWORK_LOCKSTEP) {
|
|
92125
|
+
const version = await input.resolveVersion(pkg);
|
|
92126
|
+
const { stagedPath } = await stagingArea.fetchAndStage({
|
|
92127
|
+
jobId: input.jobId,
|
|
92128
|
+
name: pkg,
|
|
92129
|
+
version,
|
|
92130
|
+
signal: input.signal
|
|
92131
|
+
});
|
|
92132
|
+
const backupPath = path$40.join(input.stagingDir, input.jobId, ".bak-fw", safeSegment(pkg));
|
|
92133
|
+
const fromVersion = input.currentVersionOf(pkg);
|
|
92134
|
+
results.push({
|
|
92135
|
+
name: pkg,
|
|
92136
|
+
stagedPath,
|
|
92137
|
+
backupPath,
|
|
92138
|
+
toVersion: version,
|
|
92139
|
+
fromVersion
|
|
92140
|
+
});
|
|
92141
|
+
}
|
|
92142
|
+
return results;
|
|
92143
|
+
}
|
|
92144
|
+
//#endregion
|
|
92145
|
+
export { AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AlertCenterAddon, ApiKeyManager, AuthManager, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, CORE_CAP_SERVICE_NAME, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CustomActionRegistry, DEFAULT_DATA_PATH, DataPlaneRegistry, DeviceManagerAddon, DeviceRegistry, DeviceStore, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FRAMEWORK_LOCKSTEP, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, INFRA_CAPABILITIES, IntegrationRegistry, JobJournal, LifecycleJobEngine, LifecycleStateMachine, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, PYTHON_VERSION, PipelineRunner, PipelineValidator, PythonEnvManager, RESTART_MARKER_FILE, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, ScopedLogger, ScopedTokenManager, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemConfigAddon, SystemEventBus, ToastService, UDS_NO_ROUTE_PREFIX, UdsLocalTransportClient, UdsLocalTransportServer, UserManager, WinstonDestination, WinstonLoggingAddon, __resetCapUsageRegistryForTests, adaptBrokerToCluster, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildBinaryPath, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildStorageLocationRegistry, buildUdsNativeCapProxy, callRegisterNodeWithRetry, callWithServiceDiscovery, capActionName, capActionSuffix, capBareAction, capServiceName, classifyCapRoute, clearPendingRestart, clusterSecretMatches, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonService, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCoreCapService, createFileDataPlaneHandler, createHubService, createHwAccelService, createKernelHwAccel, createLocalTransport, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, deleteModelFromDisk, deriveAgentListenPort, describeProviderKindDrift, detectWorkspacePackagesDir, downloadBinary, downloadFile, downloadModel, emitDownForOwnedCaps, encodeFrame, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensurePython, ensureTlsCert, fetchJson, findInPath, formatLogLine, getBrokerEventBus, getCapUsageRegistry, getFfmpegDownloadUrl, getModelFilePath, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getWorkerDeviceRegistry, hashClusterSecret, installManifestNativeDeps, installManifestPythonDeps, installPackageFromNpmSync, installPythonPackages, installPythonRequirements, ipcChildLink, ipcParentLink, isClusterSecretMismatchError, isInfraCapability, isModelDownloaded, isSourceNewer, loadTlsCert, localEndpointPath, localProviderLink, mountNativeCapService, parseCapAction, parseRangeHeader, parseTokenizedUrl, proxyToUpstream, readPendingRestart, readinessKey, registerEventBusService, resolveFilePath, resolveHwAccel, scheduleSelfRestart, scopeKey, scopesAllowDeviceCap, serializeTypedArrays, setHubConnected, stageFrameworkLockstep, stripCamstackDeps, udsChildLogToWorkerEntry, validateProviderRegistrations, writePendingRestart };
|