@camstack/system 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +635 -1751
- package/dist/index.mjs +745 -1854
- package/dist/kernel/addon-installer.d.ts +20 -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. */
|
|
@@ -3487,20 +3487,20 @@ var AddonManifest = class {
|
|
|
3487
3487
|
* Returns the number of entries added.
|
|
3488
3488
|
*/
|
|
3489
3489
|
reconcileFromDisk(addonsDir) {
|
|
3490
|
-
if (!fs$
|
|
3490
|
+
if (!fs$17.existsSync(addonsDir)) return 0;
|
|
3491
3491
|
const m = this.read();
|
|
3492
3492
|
let added = 0;
|
|
3493
3493
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3494
|
-
for (const scope of fs$
|
|
3494
|
+
for (const scope of fs$17.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
3495
3495
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
3496
3496
|
const scopeDir = path$40.join(addonsDir, scope.name);
|
|
3497
|
-
for (const pkg of fs$
|
|
3497
|
+
for (const pkg of fs$17.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
3498
3498
|
if (!pkg.isDirectory()) continue;
|
|
3499
3499
|
const pkgJsonPath = path$40.join(scopeDir, pkg.name, "package.json");
|
|
3500
|
-
if (!fs$
|
|
3500
|
+
if (!fs$17.existsSync(pkgJsonPath)) continue;
|
|
3501
3501
|
let pkgJson;
|
|
3502
3502
|
try {
|
|
3503
|
-
const parsed = JSON.parse(fs$
|
|
3503
|
+
const parsed = JSON.parse(fs$17.readFileSync(pkgJsonPath, "utf-8"));
|
|
3504
3504
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
3505
3505
|
pkgJson = parsed;
|
|
3506
3506
|
} catch {
|
|
@@ -3535,28 +3535,28 @@ var AddonManifest = class {
|
|
|
3535
3535
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
3536
3536
|
const m = this.read();
|
|
3537
3537
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
3538
|
-
if (!fs$
|
|
3538
|
+
if (!fs$17.existsSync(addonsDir)) return 0;
|
|
3539
3539
|
let migrated = 0;
|
|
3540
3540
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3541
|
-
for (const scope of fs$
|
|
3541
|
+
for (const scope of fs$17.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
3542
3542
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
3543
3543
|
const scopeDir = path$40.join(addonsDir, scope.name);
|
|
3544
|
-
for (const pkg of fs$
|
|
3544
|
+
for (const pkg of fs$17.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
3545
3545
|
if (!pkg.isDirectory()) continue;
|
|
3546
3546
|
const pkgDir = path$40.join(scopeDir, pkg.name);
|
|
3547
3547
|
const markerPath = path$40.join(pkgDir, ".install-source");
|
|
3548
3548
|
const pkgJsonPath = path$40.join(pkgDir, "package.json");
|
|
3549
|
-
if (!fs$
|
|
3549
|
+
if (!fs$17.existsSync(pkgJsonPath)) continue;
|
|
3550
3550
|
let pkgJson;
|
|
3551
3551
|
try {
|
|
3552
|
-
const parsed = JSON.parse(fs$
|
|
3552
|
+
const parsed = JSON.parse(fs$17.readFileSync(pkgJsonPath, "utf-8"));
|
|
3553
3553
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
3554
3554
|
pkgJson = parsed;
|
|
3555
3555
|
} catch {
|
|
3556
3556
|
continue;
|
|
3557
3557
|
}
|
|
3558
3558
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
3559
|
-
const source = fs$
|
|
3559
|
+
const source = fs$17.existsSync(markerPath) ? fs$17.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
3560
3560
|
m.addons[pkgJson.name] = {
|
|
3561
3561
|
name: pkgJson.name,
|
|
3562
3562
|
version: pkgJson.version,
|
|
@@ -3582,175 +3582,6 @@ var AddonManifest = class {
|
|
|
3582
3582
|
}
|
|
3583
3583
|
};
|
|
3584
3584
|
//#endregion
|
|
3585
|
-
//#region src/kernel/deps/manifest-native-deps.ts
|
|
3586
|
-
var execFileAsync$1 = promisify(execFile);
|
|
3587
|
-
/**
|
|
3588
|
-
* Native node modules an addon needs at runtime but cannot be bundled
|
|
3589
|
-
* (`.node` binary files require ABI-matched compilation). Mirror of the
|
|
3590
|
-
* Python `requirements.txt` pattern in `manifest-python-deps.ts` —
|
|
3591
|
-
* declared in the addon's `package.json` under `camstack.nativeDependencies`,
|
|
3592
|
-
* installed per-addon at install time so the host's regular `npm install`
|
|
3593
|
-
* doesn't pull in the union of every camera driver's native deps.
|
|
3594
|
-
*
|
|
3595
|
-
* Phase E of the bundles + builder modernization spec
|
|
3596
|
-
* (`docs/superpowers/specs/2026-05-09-bundles-and-builder-modernization-design.md`).
|
|
3597
|
-
*
|
|
3598
|
-
* Idempotent: hashes the `nativeDependencies` map and writes a marker
|
|
3599
|
-
* to `<addonDir>/.camstack-native-deps-installed`. Re-installing only
|
|
3600
|
-
* happens when the declared set changes.
|
|
3601
|
-
*
|
|
3602
|
-
* Failure modes:
|
|
3603
|
-
* - manifest doesn't declare `nativeDependencies` (or declares empty) → no-op
|
|
3604
|
-
* - `npm install` fails → throws (caller decides whether to abort install)
|
|
3605
|
-
* - rebuild step fails → logs warning + continues (install may still
|
|
3606
|
-
* work if prebuilt binaries shipped in the package cover the host
|
|
3607
|
-
* ABI; surface a clear error at first `import` of the native module
|
|
3608
|
-
* otherwise).
|
|
3609
|
-
*/
|
|
3610
|
-
async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry) {
|
|
3611
|
-
const native = readNativeDeps(pkgRaw);
|
|
3612
|
-
if (native == null || Object.keys(native).length === 0) return;
|
|
3613
|
-
const markerFile = path$40.join(addonDir, ".camstack-native-deps-installed");
|
|
3614
|
-
const markerHash = hashDeclaration(native);
|
|
3615
|
-
if (markerMatches(markerFile, markerHash)) {
|
|
3616
|
-
logger.debug("Native deps already installed (marker matches)", { meta: {
|
|
3617
|
-
addonDir,
|
|
3618
|
-
count: Object.keys(native).length
|
|
3619
|
-
} });
|
|
3620
|
-
return;
|
|
3621
|
-
}
|
|
3622
|
-
const specs = Object.entries(native).map(([name, range]) => `${name}@${range}`);
|
|
3623
|
-
logger.info("Installing native dependencies", { meta: {
|
|
3624
|
-
addonDir,
|
|
3625
|
-
specs
|
|
3626
|
-
} });
|
|
3627
|
-
const args = [
|
|
3628
|
-
"install",
|
|
3629
|
-
"--no-save",
|
|
3630
|
-
"--no-package-lock",
|
|
3631
|
-
"--no-audit",
|
|
3632
|
-
"--no-fund",
|
|
3633
|
-
"--omit=dev",
|
|
3634
|
-
"--omit=peer",
|
|
3635
|
-
...registry ? ["--registry", registry] : [],
|
|
3636
|
-
...specs
|
|
3637
|
-
];
|
|
3638
|
-
try {
|
|
3639
|
-
await execFileAsync$1("npm", args, {
|
|
3640
|
-
cwd: addonDir,
|
|
3641
|
-
timeout: 3e5
|
|
3642
|
-
});
|
|
3643
|
-
} catch (err) {
|
|
3644
|
-
throw new Error(`npm install of native deps failed for ${addonDir}: ${errMsg(err)}`, { cause: err });
|
|
3645
|
-
}
|
|
3646
|
-
await rebuildNativeDeps(addonDir, Object.keys(native), logger);
|
|
3647
|
-
try {
|
|
3648
|
-
fs$18.writeFileSync(markerFile, markerHash);
|
|
3649
|
-
} catch (err) {
|
|
3650
|
-
logger.warn("Failed to write native deps marker", { meta: {
|
|
3651
|
-
markerFile,
|
|
3652
|
-
error: errMsg(err)
|
|
3653
|
-
} });
|
|
3654
|
-
}
|
|
3655
|
-
}
|
|
3656
|
-
/** Read & validate `camstack.nativeDependencies`. Returns null when absent. */
|
|
3657
|
-
function readNativeDeps(pkgRaw) {
|
|
3658
|
-
const camstack = asJsonObject(pkgRaw["camstack"]);
|
|
3659
|
-
if (!camstack) return null;
|
|
3660
|
-
const native = asJsonObject(camstack["nativeDependencies"]);
|
|
3661
|
-
if (!native) return null;
|
|
3662
|
-
const out = {};
|
|
3663
|
-
for (const [k, v] of Object.entries(native)) {
|
|
3664
|
-
const range = asString(v);
|
|
3665
|
-
if (range) out[k] = range;
|
|
3666
|
-
}
|
|
3667
|
-
return Object.keys(out).length > 0 ? out : null;
|
|
3668
|
-
}
|
|
3669
|
-
/** SHA-256 of the canonical-keyed declaration — drives marker idempotency. */
|
|
3670
|
-
function hashDeclaration(deps) {
|
|
3671
|
-
const canonical = Object.keys(deps).toSorted().map((k) => `${k}@${deps[k]}`).join("\n");
|
|
3672
|
-
return crypto$4.createHash("sha256").update(canonical).digest("hex");
|
|
3673
|
-
}
|
|
3674
|
-
function markerMatches(markerFile, expected) {
|
|
3675
|
-
try {
|
|
3676
|
-
return fs$18.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
3677
|
-
} catch {
|
|
3678
|
-
return false;
|
|
3679
|
-
}
|
|
3680
|
-
}
|
|
3681
|
-
/**
|
|
3682
|
-
* Rebuild native modules against the host's runtime ABI.
|
|
3683
|
-
*
|
|
3684
|
-
* Detection: `process.versions.electron` is set when running inside
|
|
3685
|
-
* Electron's main/renderer process (set even when `ELECTRON_RUN_AS_NODE`
|
|
3686
|
-
* isn't), giving us a reliable signal. Plain Node leaves it undefined.
|
|
3687
|
-
*
|
|
3688
|
-
* Electron path: tries `@electron/rebuild` programmatically, falling
|
|
3689
|
-
* back to `npx electron-rebuild` if the package isn't directly available.
|
|
3690
|
-
* Node path: `npm rebuild --prefix <addonDir>` re-runs the install
|
|
3691
|
-
* scripts of every package under that directory.
|
|
3692
|
-
*
|
|
3693
|
-
* Failures here are non-fatal: many native packages ship prebuilt
|
|
3694
|
-
* binaries that cover both ABIs, so the rebuild may be unnecessary.
|
|
3695
|
-
* The first `import` of an actually-mismatched binary throws a clear
|
|
3696
|
-
* error that points the operator at this rebuild step.
|
|
3697
|
-
*/
|
|
3698
|
-
async function rebuildNativeDeps(addonDir, packageNames, logger) {
|
|
3699
|
-
if (typeof process.versions.electron === "string") {
|
|
3700
|
-
const electronVersion = process.versions.electron;
|
|
3701
|
-
logger.info("Rebuilding native deps for Electron", { meta: {
|
|
3702
|
-
addonDir,
|
|
3703
|
-
electronVersion,
|
|
3704
|
-
packages: packageNames
|
|
3705
|
-
} });
|
|
3706
|
-
try {
|
|
3707
|
-
const rebuildModule = await import("./main-rtjOwPBR.mjs").then((m) => /* @__PURE__ */ __toESM$1(m.default)).catch(() => null);
|
|
3708
|
-
if (rebuildModule?.rebuild) {
|
|
3709
|
-
await rebuildModule.rebuild({
|
|
3710
|
-
buildPath: addonDir,
|
|
3711
|
-
electronVersion,
|
|
3712
|
-
onlyModules: packageNames
|
|
3713
|
-
});
|
|
3714
|
-
return;
|
|
3715
|
-
}
|
|
3716
|
-
logger.warn("@electron/rebuild not available — falling back to npx", { meta: { addonDir } });
|
|
3717
|
-
await execFileAsync$1("npx", [
|
|
3718
|
-
"--yes",
|
|
3719
|
-
"electron-rebuild",
|
|
3720
|
-
"-m",
|
|
3721
|
-
addonDir,
|
|
3722
|
-
"-v",
|
|
3723
|
-
electronVersion
|
|
3724
|
-
], {
|
|
3725
|
-
cwd: addonDir,
|
|
3726
|
-
timeout: 6e5
|
|
3727
|
-
});
|
|
3728
|
-
} catch (err) {
|
|
3729
|
-
logger.warn("Electron rebuild failed (continuing — prebuilt binary may be present)", { meta: {
|
|
3730
|
-
addonDir,
|
|
3731
|
-
error: errMsg(err)
|
|
3732
|
-
} });
|
|
3733
|
-
}
|
|
3734
|
-
return;
|
|
3735
|
-
}
|
|
3736
|
-
logger.info("Rebuilding native deps for Node", { meta: {
|
|
3737
|
-
addonDir,
|
|
3738
|
-
nodeAbi: process.versions.modules,
|
|
3739
|
-
packages: packageNames
|
|
3740
|
-
} });
|
|
3741
|
-
try {
|
|
3742
|
-
await execFileAsync$1("npm", ["rebuild", ...packageNames], {
|
|
3743
|
-
cwd: addonDir,
|
|
3744
|
-
timeout: 6e5
|
|
3745
|
-
});
|
|
3746
|
-
} catch (err) {
|
|
3747
|
-
logger.warn("npm rebuild failed (continuing — prebuilt binary may be present)", { meta: {
|
|
3748
|
-
addonDir,
|
|
3749
|
-
error: errMsg(err)
|
|
3750
|
-
} });
|
|
3751
|
-
}
|
|
3752
|
-
}
|
|
3753
|
-
//#endregion
|
|
3754
3585
|
//#region src/kernel/addon-installer.ts
|
|
3755
3586
|
var execFileAsync = promisify(execFile);
|
|
3756
3587
|
function parseInstallSource(value) {
|
|
@@ -3765,7 +3596,7 @@ function parseInstallSource(value) {
|
|
|
3765
3596
|
function readPackageJson(pkgJsonPath) {
|
|
3766
3597
|
let raw;
|
|
3767
3598
|
try {
|
|
3768
|
-
raw = asJsonObject(parseJsonUnknown(fs$
|
|
3599
|
+
raw = asJsonObject(parseJsonUnknown(fs$17.readFileSync(pkgJsonPath, "utf-8")));
|
|
3769
3600
|
} catch {
|
|
3770
3601
|
return null;
|
|
3771
3602
|
}
|
|
@@ -3834,7 +3665,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3834
3665
|
} catch {
|
|
3835
3666
|
return Object.freeze([]);
|
|
3836
3667
|
}
|
|
3837
|
-
const raw = fs$
|
|
3668
|
+
const raw = fs$17.readFileSync(pkgPath, "utf-8");
|
|
3838
3669
|
const parsed = JSON.parse(raw);
|
|
3839
3670
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
3840
3671
|
return Object.freeze(deps.filter((name) => name.startsWith("@camstack/addon-") || name === "@camstack/system"));
|
|
@@ -3878,7 +3709,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3878
3709
|
}
|
|
3879
3710
|
for (const packageName of pkgList) {
|
|
3880
3711
|
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
3881
|
-
if (fs$
|
|
3712
|
+
if (fs$17.existsSync(path$40.join(addonDir, "package.json"))) {
|
|
3882
3713
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
3883
3714
|
continue;
|
|
3884
3715
|
}
|
|
@@ -3967,12 +3798,12 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3967
3798
|
*/
|
|
3968
3799
|
async installSymlink(packageName, sourceDir, pkgData, targetDir) {
|
|
3969
3800
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
3970
|
-
fs$
|
|
3801
|
+
fs$17.rmSync(targetDir, {
|
|
3971
3802
|
recursive: true,
|
|
3972
3803
|
force: true
|
|
3973
3804
|
});
|
|
3974
3805
|
ensureDir(path$40.dirname(targetDir));
|
|
3975
|
-
fs$
|
|
3806
|
+
fs$17.symlinkSync(sourceDir, targetDir, "dir");
|
|
3976
3807
|
this.manifest.upsert(packageName, {
|
|
3977
3808
|
version: asString(pkgData.version, "0.0.0"),
|
|
3978
3809
|
source: "local"
|
|
@@ -3986,16 +3817,16 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3986
3817
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
3987
3818
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
3988
3819
|
const distDir = path$40.join(sourceDir, "dist");
|
|
3989
|
-
if (!fs$
|
|
3990
|
-
fs$
|
|
3820
|
+
if (!fs$17.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
3821
|
+
fs$17.rmSync(targetDir, {
|
|
3991
3822
|
recursive: true,
|
|
3992
3823
|
force: true
|
|
3993
3824
|
});
|
|
3994
3825
|
ensureDir(targetDir);
|
|
3995
|
-
fs$
|
|
3826
|
+
fs$17.writeFileSync(path$40.join(targetDir, "package.json"), JSON.stringify(stripCamstackDeps(pkgData), null, 2));
|
|
3996
3827
|
copyDirRecursive(distDir, path$40.join(targetDir, "dist"));
|
|
3997
3828
|
copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
3998
|
-
fs$
|
|
3829
|
+
fs$17.writeFileSync(path$40.join(targetDir, ".install-source"), "local");
|
|
3999
3830
|
const localPkgVersion = asString(pkgData.version, "0.0.0");
|
|
4000
3831
|
this.manifest.upsert(packageName, {
|
|
4001
3832
|
version: localPkgVersion,
|
|
@@ -4031,7 +3862,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4031
3862
|
* unusual auth, offline mode, etc).
|
|
4032
3863
|
*/
|
|
4033
3864
|
async installFromNpm(packageName, version) {
|
|
4034
|
-
const tmpDir = fs$
|
|
3865
|
+
const tmpDir = fs$17.mkdtempSync(path$40.join(os$17.tmpdir(), "camstack-addon-npm-"));
|
|
4035
3866
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
4036
3867
|
this.logger.info(`${packageName} — installing from npm`);
|
|
4037
3868
|
try {
|
|
@@ -4045,19 +3876,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4045
3876
|
];
|
|
4046
3877
|
if (this.registry) args.push("--registry", this.registry);
|
|
4047
3878
|
const { stdout } = await execFileAsync("npm", args, { timeout: 12e4 });
|
|
4048
|
-
const tgzFiles = fs$
|
|
3879
|
+
const tgzFiles = fs$17.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
4049
3880
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
4050
3881
|
return path$40.join(tmpDir, tgzFiles[0]);
|
|
4051
3882
|
});
|
|
4052
3883
|
const result = await this.installFromTgz(tgzPath);
|
|
4053
|
-
fs$
|
|
3884
|
+
fs$17.writeFileSync(path$40.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
4054
3885
|
this.manifest.upsert(result.name, {
|
|
4055
3886
|
version: result.version,
|
|
4056
3887
|
source: "npm"
|
|
4057
3888
|
});
|
|
4058
3889
|
return result;
|
|
4059
3890
|
} finally {
|
|
4060
|
-
fs$
|
|
3891
|
+
fs$17.rmSync(tmpDir, {
|
|
4061
3892
|
recursive: true,
|
|
4062
3893
|
force: true
|
|
4063
3894
|
});
|
|
@@ -4095,12 +3926,12 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4095
3926
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
4096
3927
|
const tgzPath = path$40.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
4097
3928
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
4098
|
-
fs$
|
|
3929
|
+
fs$17.writeFileSync(tgzPath, buf);
|
|
4099
3930
|
return tgzPath;
|
|
4100
3931
|
}
|
|
4101
3932
|
/** Install addon from a tgz file (uploaded or downloaded) */
|
|
4102
3933
|
async installFromTgz(tgzPath) {
|
|
4103
|
-
const tmpDir = fs$
|
|
3934
|
+
const tmpDir = fs$17.mkdtempSync(path$40.join(os$17.tmpdir(), "camstack-addon-install-"));
|
|
4104
3935
|
try {
|
|
4105
3936
|
await execFileAsync("tar", [
|
|
4106
3937
|
"-xzf",
|
|
@@ -4109,22 +3940,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4109
3940
|
tmpDir
|
|
4110
3941
|
], { timeout: 3e4 });
|
|
4111
3942
|
const extractedDir = path$40.join(tmpDir, "package");
|
|
4112
|
-
const pkgJsonPath = fs$
|
|
4113
|
-
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");
|
|
4114
3945
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
4115
3946
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
4116
3947
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
4117
3948
|
const targetDir = path$40.join(this.addonsDir, pkgView.name);
|
|
4118
|
-
fs$
|
|
3949
|
+
fs$17.rmSync(targetDir, {
|
|
4119
3950
|
recursive: true,
|
|
4120
3951
|
force: true
|
|
4121
3952
|
});
|
|
4122
3953
|
ensureDir(targetDir);
|
|
4123
3954
|
const sourceDir = path$40.dirname(pkgJsonPath);
|
|
4124
3955
|
const strippedManifest = stripCamstackDeps(pkgView.raw);
|
|
4125
|
-
fs$
|
|
3956
|
+
fs$17.writeFileSync(path$40.join(targetDir, "package.json"), JSON.stringify(strippedManifest, null, 2));
|
|
4126
3957
|
const sourceDist = path$40.join(sourceDir, "dist");
|
|
4127
|
-
if (fs$
|
|
3958
|
+
if (fs$17.existsSync(sourceDist)) copyDirRecursive(sourceDist, path$40.join(targetDir, "dist"));
|
|
4128
3959
|
copyExtraFileDirs(pkgView.raw, sourceDir, targetDir);
|
|
4129
3960
|
const strippedRuntimeDeps = strippedManifest["dependencies"];
|
|
4130
3961
|
if (strippedRuntimeDeps != null && typeof strippedRuntimeDeps === "object" && Object.keys(strippedRuntimeDeps).length > 0) {
|
|
@@ -4149,7 +3980,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4149
3980
|
try {
|
|
4150
3981
|
await installManifestNativeDeps(targetDir, pkgView.raw, this.logger, this.registry);
|
|
4151
3982
|
} catch (nativeErr) {
|
|
4152
|
-
fs$
|
|
3983
|
+
fs$17.rmSync(targetDir, {
|
|
4153
3984
|
recursive: true,
|
|
4154
3985
|
force: true
|
|
4155
3986
|
});
|
|
@@ -4164,7 +3995,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4164
3995
|
version: pkgView.version
|
|
4165
3996
|
};
|
|
4166
3997
|
} finally {
|
|
4167
|
-
fs$
|
|
3998
|
+
fs$17.rmSync(tmpDir, {
|
|
4168
3999
|
recursive: true,
|
|
4169
4000
|
force: true
|
|
4170
4001
|
});
|
|
@@ -4190,13 +4021,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4190
4021
|
const current = this.manifest.get(packageName);
|
|
4191
4022
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
4192
4023
|
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
4193
|
-
if (!fs$
|
|
4024
|
+
if (!fs$17.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
4194
4025
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
4195
4026
|
const backupRoot = path$40.join(this.addonsDir, ".backups", packageName);
|
|
4196
4027
|
ensureDir(backupRoot);
|
|
4197
4028
|
const backupDir = path$40.join(backupRoot, ts);
|
|
4198
4029
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
4199
|
-
fs$
|
|
4030
|
+
fs$17.renameSync(addonDir, backupDir);
|
|
4200
4031
|
let result;
|
|
4201
4032
|
try {
|
|
4202
4033
|
if (this.installSource === "local" || this.installSource === "symlink") {
|
|
@@ -4211,11 +4042,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4211
4042
|
} catch (installErr) {
|
|
4212
4043
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg(installErr) } });
|
|
4213
4044
|
try {
|
|
4214
|
-
if (fs$
|
|
4045
|
+
if (fs$17.existsSync(addonDir)) fs$17.rmSync(addonDir, {
|
|
4215
4046
|
recursive: true,
|
|
4216
4047
|
force: true
|
|
4217
4048
|
});
|
|
4218
|
-
fs$
|
|
4049
|
+
fs$17.renameSync(backupDir, addonDir);
|
|
4219
4050
|
this.manifest.upsert(packageName, {
|
|
4220
4051
|
version: current.version,
|
|
4221
4052
|
source: current.source,
|
|
@@ -4241,6 +4072,76 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4241
4072
|
};
|
|
4242
4073
|
}
|
|
4243
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
|
+
/**
|
|
4244
4145
|
* Roll back an addon to its most recent backup. Used after an update
|
|
4245
4146
|
* passes installation but fails its post-restart health check.
|
|
4246
4147
|
*
|
|
@@ -4253,20 +4154,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4253
4154
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
4254
4155
|
return null;
|
|
4255
4156
|
}
|
|
4256
|
-
if (!fs$
|
|
4157
|
+
if (!fs$17.existsSync(entry.lastBackupDir)) {
|
|
4257
4158
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
4258
4159
|
return null;
|
|
4259
4160
|
}
|
|
4260
4161
|
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
4261
|
-
if (fs$
|
|
4162
|
+
if (fs$17.existsSync(addonDir)) fs$17.rmSync(addonDir, {
|
|
4262
4163
|
recursive: true,
|
|
4263
4164
|
force: true
|
|
4264
4165
|
});
|
|
4265
|
-
fs$
|
|
4166
|
+
fs$17.renameSync(entry.lastBackupDir, addonDir);
|
|
4266
4167
|
const pkgJsonPath = path$40.join(addonDir, "package.json");
|
|
4267
4168
|
let restoredVersion = entry.version;
|
|
4268
|
-
if (fs$
|
|
4269
|
-
const parsed = JSON.parse(fs$
|
|
4169
|
+
if (fs$17.existsSync(pkgJsonPath)) try {
|
|
4170
|
+
const parsed = JSON.parse(fs$17.readFileSync(pkgJsonPath, "utf-8"));
|
|
4270
4171
|
if (typeof parsed === "object" && parsed != null) {
|
|
4271
4172
|
const v = parsed.version;
|
|
4272
4173
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -4288,7 +4189,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4288
4189
|
clearBackup(packageName) {
|
|
4289
4190
|
const entry = this.manifest.get(packageName);
|
|
4290
4191
|
if (entry?.lastBackupDir == null) return;
|
|
4291
|
-
if (fs$
|
|
4192
|
+
if (fs$17.existsSync(entry.lastBackupDir)) fs$17.rmSync(entry.lastBackupDir, {
|
|
4292
4193
|
recursive: true,
|
|
4293
4194
|
force: true
|
|
4294
4195
|
});
|
|
@@ -4300,8 +4201,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4300
4201
|
}
|
|
4301
4202
|
async uninstall(packageName) {
|
|
4302
4203
|
const addonDir = path$40.join(this.addonsDir, packageName);
|
|
4303
|
-
if (fs$
|
|
4304
|
-
fs$
|
|
4204
|
+
if (fs$17.existsSync(addonDir)) {
|
|
4205
|
+
fs$17.rmSync(addonDir, {
|
|
4305
4206
|
recursive: true,
|
|
4306
4207
|
force: true
|
|
4307
4208
|
});
|
|
@@ -4309,8 +4210,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4309
4210
|
return;
|
|
4310
4211
|
}
|
|
4311
4212
|
const legacyDir = path$40.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
4312
|
-
if (fs$
|
|
4313
|
-
fs$
|
|
4213
|
+
if (fs$17.existsSync(legacyDir)) {
|
|
4214
|
+
fs$17.rmSync(legacyDir, {
|
|
4314
4215
|
recursive: true,
|
|
4315
4216
|
force: true
|
|
4316
4217
|
});
|
|
@@ -4318,22 +4219,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4318
4219
|
}
|
|
4319
4220
|
}
|
|
4320
4221
|
listInstalled() {
|
|
4321
|
-
if (!fs$
|
|
4222
|
+
if (!fs$17.existsSync(this.addonsDir)) return [];
|
|
4322
4223
|
const packageDirs = [];
|
|
4323
|
-
for (const entry of fs$
|
|
4224
|
+
for (const entry of fs$17.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
4324
4225
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
4325
4226
|
if (entry.name.startsWith("@")) {
|
|
4326
4227
|
const scopeDir = path$40.join(this.addonsDir, entry.name);
|
|
4327
|
-
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));
|
|
4328
4229
|
} else packageDirs.push(path$40.join(this.addonsDir, entry.name));
|
|
4329
4230
|
}
|
|
4330
4231
|
return packageDirs.map((dir) => {
|
|
4331
4232
|
const pkgPath = path$40.join(dir, "package.json");
|
|
4332
|
-
if (!fs$
|
|
4233
|
+
if (!fs$17.existsSync(pkgPath)) return null;
|
|
4333
4234
|
const pkg = readPackageJson(pkgPath);
|
|
4334
4235
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
4335
4236
|
const sourceFile = path$40.join(dir, ".install-source");
|
|
4336
|
-
const installSource = fs$
|
|
4237
|
+
const installSource = fs$17.existsSync(sourceFile) ? parseInstallSource(fs$17.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
4337
4238
|
return {
|
|
4338
4239
|
name: pkg.name,
|
|
4339
4240
|
version: pkg.version,
|
|
@@ -4343,13 +4244,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4343
4244
|
}).filter((item) => item !== null);
|
|
4344
4245
|
}
|
|
4345
4246
|
isInstalled(packageName) {
|
|
4346
|
-
if (fs$
|
|
4347
|
-
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"));
|
|
4348
4249
|
}
|
|
4349
4250
|
getInstalledPackage(packageName) {
|
|
4350
4251
|
let pkgPath = path$40.join(this.addonsDir, packageName, "package.json");
|
|
4351
|
-
if (!fs$
|
|
4352
|
-
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;
|
|
4353
4254
|
const pkg = readPackageJson(pkgPath);
|
|
4354
4255
|
if (!pkg) return null;
|
|
4355
4256
|
return {
|
|
@@ -4368,7 +4269,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4368
4269
|
]) {
|
|
4369
4270
|
const candidate = path$40.join(this.workspaceDir, dirName);
|
|
4370
4271
|
try {
|
|
4371
|
-
const pkg = asJsonObject(parseJsonUnknown(fs$
|
|
4272
|
+
const pkg = asJsonObject(parseJsonUnknown(fs$17.readFileSync(path$40.join(candidate, "package.json"), "utf-8")));
|
|
4372
4273
|
if (pkg && asString(pkg["name"]) === packageName) return candidate;
|
|
4373
4274
|
} catch {}
|
|
4374
4275
|
}
|
|
@@ -4377,7 +4278,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4377
4278
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
4378
4279
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
4379
4280
|
const distDir = path$40.join(sourceDir, "dist");
|
|
4380
|
-
if (!(!fs$
|
|
4281
|
+
if (!(!fs$17.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
4381
4282
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
4382
4283
|
try {
|
|
4383
4284
|
await execFileAsync("npm", ["run", "build"], {
|
|
@@ -4395,7 +4296,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4395
4296
|
if (!camstack?.addons) return false;
|
|
4396
4297
|
for (const addon of camstack.addons) {
|
|
4397
4298
|
if (!addon.pages) continue;
|
|
4398
|
-
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;
|
|
4399
4300
|
}
|
|
4400
4301
|
return false;
|
|
4401
4302
|
}
|
|
@@ -4404,7 +4305,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4404
4305
|
function isDirEntry(entry, parentDir) {
|
|
4405
4306
|
if (entry.isDirectory()) return true;
|
|
4406
4307
|
if (entry.isSymbolicLink()) try {
|
|
4407
|
-
return fs$
|
|
4308
|
+
return fs$17.statSync(path$40.join(parentDir, entry.name)).isDirectory();
|
|
4408
4309
|
} catch {
|
|
4409
4310
|
return false;
|
|
4410
4311
|
}
|
|
@@ -4426,8 +4327,8 @@ function detectWorkspacePackagesDir(startDir) {
|
|
|
4426
4327
|
current = path$40.dirname(current);
|
|
4427
4328
|
const packagesDir = path$40.join(current, "packages");
|
|
4428
4329
|
const rootPkgJson = path$40.join(current, "package.json");
|
|
4429
|
-
if (fs$
|
|
4430
|
-
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"));
|
|
4431
4332
|
if (rootPkg.workspaces || rootPkg.name === "camstack-server" || rootPkg.name === "camstack") return packagesDir;
|
|
4432
4333
|
} catch {}
|
|
4433
4334
|
}
|
|
@@ -4436,12 +4337,12 @@ function detectWorkspacePackagesDir(startDir) {
|
|
|
4436
4337
|
//#endregion
|
|
4437
4338
|
//#region ../../node_modules/electron/index.js
|
|
4438
4339
|
var require_electron = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
4439
|
-
var fs$
|
|
4340
|
+
var fs$16 = __require("fs");
|
|
4440
4341
|
var path$39 = __require("path");
|
|
4441
4342
|
var pathFile = path$39.join(__dirname, "path.txt");
|
|
4442
4343
|
function getElectronPath() {
|
|
4443
4344
|
let executablePath;
|
|
4444
|
-
if (fs$
|
|
4345
|
+
if (fs$16.existsSync(pathFile)) executablePath = fs$16.readFileSync(pathFile, "utf-8");
|
|
4445
4346
|
if (process.env.ELECTRON_OVERRIDE_DIST_PATH) return path$39.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
|
|
4446
4347
|
if (executablePath) return path$39.join(__dirname, "dist", executablePath);
|
|
4447
4348
|
else throw new Error("Electron failed to install correctly, please delete node_modules/electron and try installing again");
|
|
@@ -4481,11 +4382,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
4481
4382
|
* intact or no marker at all (never a half-written file).
|
|
4482
4383
|
*/
|
|
4483
4384
|
function writePendingRestart(dataDir, marker) {
|
|
4484
|
-
fs$
|
|
4385
|
+
fs$17.mkdirSync(dataDir, { recursive: true });
|
|
4485
4386
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
4486
4387
|
const tmpPath = `${markerPath}.tmp`;
|
|
4487
|
-
fs$
|
|
4488
|
-
fs$
|
|
4388
|
+
fs$17.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
4389
|
+
fs$17.renameSync(tmpPath, markerPath);
|
|
4489
4390
|
}
|
|
4490
4391
|
/**
|
|
4491
4392
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -4510,10 +4411,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
4510
4411
|
*/
|
|
4511
4412
|
function readPendingRestart(dataDir) {
|
|
4512
4413
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
4513
|
-
if (!fs$
|
|
4414
|
+
if (!fs$17.existsSync(markerPath)) return null;
|
|
4514
4415
|
let raw;
|
|
4515
4416
|
try {
|
|
4516
|
-
raw = fs$
|
|
4417
|
+
raw = fs$17.readFileSync(markerPath, "utf-8");
|
|
4517
4418
|
} catch (err) {
|
|
4518
4419
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
4519
4420
|
return null;
|
|
@@ -4552,7 +4453,7 @@ function readPendingRestart(dataDir) {
|
|
|
4552
4453
|
/** Remove the marker if present. No-op if missing. */
|
|
4553
4454
|
function clearPendingRestart(dataDir) {
|
|
4554
4455
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
4555
|
-
fs$
|
|
4456
|
+
fs$17.rmSync(markerPath, { force: true });
|
|
4556
4457
|
}
|
|
4557
4458
|
function isRestartKind(value) {
|
|
4558
4459
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -4564,7 +4465,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
4564
4465
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
4565
4466
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
4566
4467
|
const now = /* @__PURE__ */ new Date();
|
|
4567
|
-
fs$
|
|
4468
|
+
fs$17.utimesSync(touchTarget, now, now);
|
|
4568
4469
|
return;
|
|
4569
4470
|
} catch (err) {
|
|
4570
4471
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -5673,7 +5574,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
5673
5574
|
value: mod,
|
|
5674
5575
|
enumerable: true
|
|
5675
5576
|
}) : target, mod));
|
|
5676
|
-
var require_common$
|
|
5577
|
+
var require_common$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5677
5578
|
function isNothing(subject) {
|
|
5678
5579
|
return typeof subject === "undefined" || subject === null;
|
|
5679
5580
|
}
|
|
@@ -5737,7 +5638,7 @@ var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5737
5638
|
module.exports = YAMLException;
|
|
5738
5639
|
}));
|
|
5739
5640
|
var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5740
|
-
var common = require_common$
|
|
5641
|
+
var common = require_common$1();
|
|
5741
5642
|
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
5742
5643
|
let head = "";
|
|
5743
5644
|
let tail = "";
|
|
@@ -6017,7 +5918,7 @@ var require_bool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6017
5918
|
});
|
|
6018
5919
|
}));
|
|
6019
5920
|
var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6020
|
-
var common = require_common$
|
|
5921
|
+
var common = require_common$1();
|
|
6021
5922
|
var Type = require_type();
|
|
6022
5923
|
function isHexCode(c) {
|
|
6023
5924
|
return c >= 48 && c <= 57 || c >= 65 && c <= 70 || c >= 97 && c <= 102;
|
|
@@ -6124,7 +6025,7 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6124
6025
|
});
|
|
6125
6026
|
}));
|
|
6126
6027
|
var require_float = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6127
|
-
var common = require_common$
|
|
6028
|
+
var common = require_common$1();
|
|
6128
6029
|
var Type = require_type();
|
|
6129
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))$");
|
|
6130
6031
|
var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
@@ -6425,7 +6326,7 @@ var require_default$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6425
6326
|
});
|
|
6426
6327
|
}));
|
|
6427
6328
|
var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6428
|
-
var common = require_common$
|
|
6329
|
+
var common = require_common$1();
|
|
6429
6330
|
var YAMLException = require_exception();
|
|
6430
6331
|
var makeSnippet = require_snippet();
|
|
6431
6332
|
var DEFAULT_SCHEMA = require_default$1();
|
|
@@ -7448,7 +7349,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7448
7349
|
module.exports.load = load;
|
|
7449
7350
|
}));
|
|
7450
7351
|
var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7451
|
-
var common = require_common$
|
|
7352
|
+
var common = require_common$1();
|
|
7452
7353
|
var YAMLException = require_exception();
|
|
7453
7354
|
var DEFAULT_SCHEMA = require_default$1();
|
|
7454
7355
|
var _toString = Object.prototype.toString;
|
|
@@ -8438,7 +8339,7 @@ var ConfigManager = class ConfigManager {
|
|
|
8438
8339
|
update(section, data) {
|
|
8439
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`);
|
|
8440
8341
|
let raw = {};
|
|
8441
|
-
if (fs$
|
|
8342
|
+
if (fs$17.existsSync(this.configPath)) raw = asJsonObject(load$1(fs$17.readFileSync(this.configPath, "utf-8"))) ?? {};
|
|
8442
8343
|
const existing = asJsonObject(raw[section]) ?? {};
|
|
8443
8344
|
raw[section] = {
|
|
8444
8345
|
...existing,
|
|
@@ -8447,12 +8348,12 @@ var ConfigManager = class ConfigManager {
|
|
|
8447
8348
|
const validation = bootstrapSchema.safeParse(raw);
|
|
8448
8349
|
if (!validation.success) throw new Error(`[ConfigManager] Invalid config update for section "${section}": ${validation.error.message}`);
|
|
8449
8350
|
const tmpPath = `${this.configPath}.tmp`;
|
|
8450
|
-
fs$
|
|
8351
|
+
fs$17.writeFileSync(tmpPath, dump(raw, {
|
|
8451
8352
|
lineWidth: 120,
|
|
8452
8353
|
indent: 2,
|
|
8453
8354
|
quotingType: "\""
|
|
8454
8355
|
}), "utf-8");
|
|
8455
|
-
fs$
|
|
8356
|
+
fs$17.renameSync(tmpPath, this.configPath);
|
|
8456
8357
|
this.bootstrapConfig = validation.data;
|
|
8457
8358
|
}
|
|
8458
8359
|
/**
|
|
@@ -8489,11 +8390,11 @@ var ConfigManager = class ConfigManager {
|
|
|
8489
8390
|
return result;
|
|
8490
8391
|
}
|
|
8491
8392
|
loadYaml() {
|
|
8492
|
-
if (!fs$
|
|
8393
|
+
if (!fs$17.existsSync(this.configPath)) {
|
|
8493
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`);
|
|
8494
8395
|
return {};
|
|
8495
8396
|
}
|
|
8496
|
-
const parsed = load$1(fs$
|
|
8397
|
+
const parsed = load$1(fs$17.readFileSync(this.configPath, "utf-8")) ?? {};
|
|
8497
8398
|
console.log(`[ConfigManager] Loaded config from: ${this.configPath}`);
|
|
8498
8399
|
return parsed;
|
|
8499
8400
|
}
|
|
@@ -8538,9 +8439,9 @@ var ConfigManager = class ConfigManager {
|
|
|
8538
8439
|
return found ? result : null;
|
|
8539
8440
|
}
|
|
8540
8441
|
loadRuntimeState() {
|
|
8541
|
-
if (!fs$
|
|
8442
|
+
if (!fs$17.existsSync(this.runtimeStatePath)) return EMPTY_RUNTIME_STATE;
|
|
8542
8443
|
try {
|
|
8543
|
-
const parsed = asJsonObject(parseJsonUnknown(fs$
|
|
8444
|
+
const parsed = asJsonObject(parseJsonUnknown(fs$17.readFileSync(this.runtimeStatePath, "utf-8")));
|
|
8544
8445
|
if (parsed === null) return EMPTY_RUNTIME_STATE;
|
|
8545
8446
|
const systemActivation = asJsonObject(parsed.systemActivation) ?? {};
|
|
8546
8447
|
const deviceActivationRaw = asJsonObject(parsed.deviceActivation) ?? {};
|
|
@@ -8565,10 +8466,10 @@ var ConfigManager = class ConfigManager {
|
|
|
8565
8466
|
}
|
|
8566
8467
|
saveRuntimeState() {
|
|
8567
8468
|
const dir = path$40.dirname(this.runtimeStatePath);
|
|
8568
|
-
if (!fs$
|
|
8469
|
+
if (!fs$17.existsSync(dir)) fs$17.mkdirSync(dir, { recursive: true });
|
|
8569
8470
|
const tmpPath = `${this.runtimeStatePath}.tmp`;
|
|
8570
|
-
fs$
|
|
8571
|
-
fs$
|
|
8471
|
+
fs$17.writeFileSync(tmpPath, JSON.stringify(this.runtimeState, null, 2), "utf-8");
|
|
8472
|
+
fs$17.renameSync(tmpPath, this.runtimeStatePath);
|
|
8572
8473
|
}
|
|
8573
8474
|
};
|
|
8574
8475
|
//#endregion
|
|
@@ -28586,9 +28487,9 @@ var require_kleur = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
28586
28487
|
//#region ../../node_modules/moleculer/src/utils.js
|
|
28587
28488
|
var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
28588
28489
|
var kleur = require_kleur();
|
|
28589
|
-
var os$
|
|
28490
|
+
var os$16 = __require("os");
|
|
28590
28491
|
var path$38 = __require("path");
|
|
28591
|
-
var fs$
|
|
28492
|
+
var fs$15 = __require("fs");
|
|
28592
28493
|
var { TimeoutError } = require_errors$2();
|
|
28593
28494
|
var lut = [];
|
|
28594
28495
|
for (let i = 0; i < 256; i++) lut[i] = (i < 16 ? "0" : "") + i.toString(16);
|
|
@@ -28685,7 +28586,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
28685
28586
|
* @returns
|
|
28686
28587
|
*/
|
|
28687
28588
|
getNodeID() {
|
|
28688
|
-
return os$
|
|
28589
|
+
return os$16.hostname().toLowerCase() + "-" + process.pid;
|
|
28689
28590
|
},
|
|
28690
28591
|
/**
|
|
28691
28592
|
* Get list of local IPs
|
|
@@ -28695,7 +28596,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
28695
28596
|
getIpList() {
|
|
28696
28597
|
const list = [];
|
|
28697
28598
|
const ilist = [];
|
|
28698
|
-
const interfaces = os$
|
|
28599
|
+
const interfaces = os$16.networkInterfaces();
|
|
28699
28600
|
for (let iface in interfaces) for (let i in interfaces[iface]) {
|
|
28700
28601
|
const f = interfaces[iface]?.[i];
|
|
28701
28602
|
if (f.family === "IPv4") if (f.internal) {
|
|
@@ -28881,7 +28782,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
28881
28782
|
makeDirs(p) {
|
|
28882
28783
|
p.split(path$38.sep).reduce((prevPath, folder) => {
|
|
28883
28784
|
const currentPath = path$38.join(prevPath, folder, path$38.sep);
|
|
28884
|
-
if (!fs$
|
|
28785
|
+
if (!fs$15.existsSync(currentPath)) fs$15.mkdirSync(currentPath);
|
|
28885
28786
|
return currentPath;
|
|
28886
28787
|
}, "");
|
|
28887
28788
|
},
|
|
@@ -30107,7 +30008,7 @@ var require_csv = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
30107
30008
|
var { makeDirs } = require_utils$3();
|
|
30108
30009
|
var _ = require_lodash();
|
|
30109
30010
|
var path$37 = __require("path");
|
|
30110
|
-
var fs$
|
|
30011
|
+
var fs$14 = __require("fs");
|
|
30111
30012
|
var METRIC = require_constants$6();
|
|
30112
30013
|
var MODE_METRIC = "metric";
|
|
30113
30014
|
var MODE_LABEL = "label";
|
|
@@ -30266,8 +30167,8 @@ var require_csv = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
30266
30167
|
*/
|
|
30267
30168
|
writeRow(filename, headers, fields) {
|
|
30268
30169
|
try {
|
|
30269
|
-
if (!fs$
|
|
30270
|
-
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);
|
|
30271
30172
|
} catch (err) {
|
|
30272
30173
|
/* istanbul ignore next */
|
|
30273
30174
|
this.logger.error(`Unable to write metrics values to the '${filename}' file. Error: ${err.message}`, fields, err);
|
|
@@ -30381,7 +30282,7 @@ var require_event$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
30381
30282
|
var require_datadog$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
30382
30283
|
var BaseReporter = require_base$8();
|
|
30383
30284
|
var _ = require_lodash();
|
|
30384
|
-
var os$
|
|
30285
|
+
var os$15 = __require("os");
|
|
30385
30286
|
var { MoleculerError } = require_errors$2();
|
|
30386
30287
|
var METRIC = require_constants$6();
|
|
30387
30288
|
var { isFunction } = require_utils$3();
|
|
@@ -30414,7 +30315,7 @@ var require_datadog$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
30414
30315
|
super(opts);
|
|
30415
30316
|
/** @type {DatadogReporterOptions} */
|
|
30416
30317
|
this.opts = _.defaultsDeep(this.opts, {
|
|
30417
|
-
host: os$
|
|
30318
|
+
host: os$15.hostname(),
|
|
30418
30319
|
baseUrl: BASE_URL,
|
|
30419
30320
|
apiVersion: "v1",
|
|
30420
30321
|
path: "/series",
|
|
@@ -31090,18 +30991,18 @@ var require_cpu_usage$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
31090
30991
|
*
|
|
31091
30992
|
* Based on: https://github.com/icebob/cpu
|
|
31092
30993
|
*/
|
|
31093
|
-
var os$
|
|
30994
|
+
var os$14 = __require("os");
|
|
31094
30995
|
/* istanbul ignore next */
|
|
31095
30996
|
module.exports = function getCpuUsage(sampleTime = 100) {
|
|
31096
30997
|
return new Promise((resolve, reject) => {
|
|
31097
30998
|
try {
|
|
31098
|
-
const first = os$
|
|
30999
|
+
const first = os$14.cpus().map((cpu) => cpu.times);
|
|
31099
31000
|
setTimeout(() => {
|
|
31100
31001
|
try {
|
|
31101
|
-
const second = os$
|
|
31002
|
+
const second = os$14.cpus().map((cpu) => cpu.times);
|
|
31102
31003
|
setTimeout(() => {
|
|
31103
31004
|
try {
|
|
31104
|
-
const third = os$
|
|
31005
|
+
const third = os$14.cpus().map((cpu) => cpu.times);
|
|
31105
31006
|
const usages = [];
|
|
31106
31007
|
for (let i = 0; i < first.length; i++) {
|
|
31107
31008
|
const first_idle = first[i].idle;
|
|
@@ -31134,7 +31035,7 @@ var require_cpu_usage$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
31134
31035
|
//#endregion
|
|
31135
31036
|
//#region ../../node_modules/moleculer/src/metrics/commons.js
|
|
31136
31037
|
var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
31137
|
-
var os$
|
|
31038
|
+
var os$13 = __require("os");
|
|
31138
31039
|
var METRIC = require_constants$6();
|
|
31139
31040
|
var cpuUsage = require_cpu_usage$1();
|
|
31140
31041
|
var v8;
|
|
@@ -31313,27 +31214,27 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31313
31214
|
name: METRIC.OS_TYPE,
|
|
31314
31215
|
type: METRIC.TYPE_INFO,
|
|
31315
31216
|
description: "OS type"
|
|
31316
|
-
}).set(os$
|
|
31217
|
+
}).set(os$13.type());
|
|
31317
31218
|
this.register({
|
|
31318
31219
|
name: METRIC.OS_RELEASE,
|
|
31319
31220
|
type: METRIC.TYPE_INFO,
|
|
31320
31221
|
description: "OS release"
|
|
31321
|
-
}).set(os$
|
|
31222
|
+
}).set(os$13.release());
|
|
31322
31223
|
this.register({
|
|
31323
31224
|
name: METRIC.OS_HOSTNAME,
|
|
31324
31225
|
type: METRIC.TYPE_INFO,
|
|
31325
31226
|
description: "Hostname"
|
|
31326
|
-
}).set(os$
|
|
31227
|
+
}).set(os$13.hostname());
|
|
31327
31228
|
this.register({
|
|
31328
31229
|
name: METRIC.OS_ARCH,
|
|
31329
31230
|
type: METRIC.TYPE_INFO,
|
|
31330
31231
|
description: "OS architecture"
|
|
31331
|
-
}).set(os$
|
|
31232
|
+
}).set(os$13.arch());
|
|
31332
31233
|
this.register({
|
|
31333
31234
|
name: METRIC.OS_PLATFORM,
|
|
31334
31235
|
type: METRIC.TYPE_INFO,
|
|
31335
31236
|
description: "OS platform"
|
|
31336
|
-
}).set(os$
|
|
31237
|
+
}).set(os$13.platform());
|
|
31337
31238
|
const userInfo = getUserInfo();
|
|
31338
31239
|
this.register({
|
|
31339
31240
|
name: METRIC.OS_USER_UID,
|
|
@@ -31484,22 +31385,22 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31484
31385
|
}
|
|
31485
31386
|
this.set(METRIC.PROCESS_UPTIME, process.uptime());
|
|
31486
31387
|
this.set(METRIC.PROCESS_INTERNAL_ACTIVE_HANDLES, process.getActiveResourcesInfo().length);
|
|
31487
|
-
const freeMem = os$
|
|
31488
|
-
const totalMem = os$
|
|
31388
|
+
const freeMem = os$13.freemem();
|
|
31389
|
+
const totalMem = os$13.totalmem();
|
|
31489
31390
|
const usedMem = totalMem - freeMem;
|
|
31490
31391
|
this.set(METRIC.OS_MEMORY_FREE, freeMem);
|
|
31491
31392
|
this.set(METRIC.OS_MEMORY_USED, usedMem);
|
|
31492
31393
|
this.set(METRIC.OS_MEMORY_TOTAL, totalMem);
|
|
31493
|
-
this.set(METRIC.OS_UPTIME, os$
|
|
31494
|
-
this.set(METRIC.OS_TYPE, os$
|
|
31495
|
-
this.set(METRIC.OS_RELEASE, os$
|
|
31496
|
-
this.set(METRIC.OS_HOSTNAME, os$
|
|
31497
|
-
this.set(METRIC.OS_ARCH, os$
|
|
31498
|
-
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());
|
|
31499
31400
|
const getNetworkInterfaces = () => {
|
|
31500
31401
|
const list = [];
|
|
31501
31402
|
const ilist = [];
|
|
31502
|
-
const interfaces = os$
|
|
31403
|
+
const interfaces = os$13.networkInterfaces();
|
|
31503
31404
|
for (let iface in interfaces) for (let i in interfaces[iface]) {
|
|
31504
31405
|
const f = interfaces[iface][i];
|
|
31505
31406
|
if (f.internal) ilist.push({
|
|
@@ -31529,7 +31430,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31529
31430
|
this.set(METRIC.OS_DATETIME_ISO, d.toISOString());
|
|
31530
31431
|
this.set(METRIC.OS_DATETIME_UTC, d.toUTCString());
|
|
31531
31432
|
this.set(METRIC.OS_DATETIME_TZ_OFFSET, d.getTimezoneOffset());
|
|
31532
|
-
const load = os$
|
|
31433
|
+
const load = os$13.loadavg();
|
|
31533
31434
|
this.set(METRIC.OS_CPU_LOAD_1, load[0]);
|
|
31534
31435
|
this.set(METRIC.OS_CPU_LOAD_5, load[1]);
|
|
31535
31436
|
this.set(METRIC.OS_CPU_LOAD_15, load[2]);
|
|
@@ -31537,7 +31438,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31537
31438
|
return this.broker.Promise.resolve().then(() => cpuUsage().then((res) => {
|
|
31538
31439
|
this.set(METRIC.OS_CPU_UTILIZATION, res.avg);
|
|
31539
31440
|
try {
|
|
31540
|
-
const cpus = os$
|
|
31441
|
+
const cpus = os$13.cpus();
|
|
31541
31442
|
this.set(METRIC.OS_CPU_TOTAL, cpus.length);
|
|
31542
31443
|
this.set(METRIC.OS_CPU_USER, cpus.reduce((a, b) => a + b.times.user, 0));
|
|
31543
31444
|
this.set(METRIC.OS_CPU_SYSTEM, cpus.reduce((a, b) => a + b.times.sys, 0));
|
|
@@ -31559,7 +31460,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31559
31460
|
*/
|
|
31560
31461
|
function getUserInfo() {
|
|
31561
31462
|
try {
|
|
31562
|
-
return os$
|
|
31463
|
+
return os$13.userInfo();
|
|
31563
31464
|
} catch {
|
|
31564
31465
|
/* istanbul ignore next */
|
|
31565
31466
|
return {};
|
|
@@ -35258,10 +35159,10 @@ var require_inherits_browser = /* @__PURE__ */ __commonJSMin$1(((exports, module
|
|
|
35258
35159
|
//#region ../../node_modules/inherits/inherits.js
|
|
35259
35160
|
var require_inherits = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
35260
35161
|
try {
|
|
35261
|
-
var util$
|
|
35162
|
+
var util$7 = __require("util");
|
|
35262
35163
|
/* istanbul ignore next */
|
|
35263
|
-
if (typeof util$
|
|
35264
|
-
module.exports = util$
|
|
35164
|
+
if (typeof util$7.inherits !== "function") throw "";
|
|
35165
|
+
module.exports = util$7.inherits;
|
|
35265
35166
|
} catch (e) {
|
|
35266
35167
|
/* istanbul ignore next */
|
|
35267
35168
|
module.exports = require_inherits_browser();
|
|
@@ -35269,7 +35170,7 @@ var require_inherits = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
35269
35170
|
}));
|
|
35270
35171
|
//#endregion
|
|
35271
35172
|
//#region ../../node_modules/util-deprecate/node.js
|
|
35272
|
-
var require_node$
|
|
35173
|
+
var require_node$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
35273
35174
|
/**
|
|
35274
35175
|
* For Node.js, simply re-export the core `util.deprecate` function.
|
|
35275
35176
|
*/
|
|
@@ -35289,7 +35190,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin$1(((exports, module
|
|
|
35289
35190
|
}
|
|
35290
35191
|
var Duplex;
|
|
35291
35192
|
Writable.WritableState = WritableState;
|
|
35292
|
-
var internalUtil = { deprecate: require_node$
|
|
35193
|
+
var internalUtil = { deprecate: require_node$1() };
|
|
35293
35194
|
var Stream = require_stream$1();
|
|
35294
35195
|
var Buffer$13 = __require("buffer").Buffer;
|
|
35295
35196
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {};
|
|
@@ -37170,14 +37071,14 @@ var require_pipeline$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
37170
37071
|
//#endregion
|
|
37171
37072
|
//#region ../../node_modules/msgpack5/node_modules/readable-stream/readable.js
|
|
37172
37073
|
var require_readable$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
37173
|
-
var Stream$
|
|
37174
|
-
if (process.env.READABLE_STREAM === "disable" && Stream$
|
|
37175
|
-
module.exports = Stream$
|
|
37176
|
-
Object.assign(module.exports, Stream$
|
|
37177
|
-
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;
|
|
37178
37079
|
} else {
|
|
37179
37080
|
exports = module.exports = require__stream_readable();
|
|
37180
|
-
exports.Stream = Stream$
|
|
37081
|
+
exports.Stream = Stream$2 || exports;
|
|
37181
37082
|
exports.Readable = exports;
|
|
37182
37083
|
exports.Writable = require__stream_writable();
|
|
37183
37084
|
exports.Duplex = require__stream_duplex();
|
|
@@ -37523,7 +37424,7 @@ var require_streams = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
37523
37424
|
//#endregion
|
|
37524
37425
|
//#region ../../node_modules/msgpack5/lib/helpers.js
|
|
37525
37426
|
var require_helpers$2 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
37526
|
-
var util$
|
|
37427
|
+
var util$6 = __require("util");
|
|
37527
37428
|
exports.IncompleteBufferError = IncompleteBufferError;
|
|
37528
37429
|
function IncompleteBufferError(message) {
|
|
37529
37430
|
Error.call(this);
|
|
@@ -37531,7 +37432,7 @@ var require_helpers$2 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
37531
37432
|
this.name = this.constructor.name;
|
|
37532
37433
|
this.message = message || "unable to decode";
|
|
37533
37434
|
}
|
|
37534
|
-
util$
|
|
37435
|
+
util$6.inherits(IncompleteBufferError, Error);
|
|
37535
37436
|
exports.isFloat = function isFloat(n) {
|
|
37536
37437
|
return n % 1 !== 0;
|
|
37537
37438
|
};
|
|
@@ -39069,7 +38970,7 @@ var require_discoverers = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
39069
38970
|
}));
|
|
39070
38971
|
//#endregion
|
|
39071
38972
|
//#region ../../node_modules/moleculer/src/registry/node.js
|
|
39072
|
-
var require_node
|
|
38973
|
+
var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
39073
38974
|
/**
|
|
39074
38975
|
* Import types
|
|
39075
38976
|
*
|
|
@@ -39184,8 +39085,8 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
39184
39085
|
//#region ../../node_modules/moleculer/src/registry/node-catalog.js
|
|
39185
39086
|
var require_node_catalog = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
39186
39087
|
var _ = require_lodash();
|
|
39187
|
-
var os$
|
|
39188
|
-
var Node = require_node
|
|
39088
|
+
var os$12 = __require("os");
|
|
39089
|
+
var Node = require_node();
|
|
39189
39090
|
var { getIpList } = require_utils$3();
|
|
39190
39091
|
/**
|
|
39191
39092
|
* Import types
|
|
@@ -39230,7 +39131,7 @@ var require_node_catalog = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
39230
39131
|
node.local = true;
|
|
39231
39132
|
node.ipList = getIpList();
|
|
39232
39133
|
node.instanceID = this.broker.instanceID;
|
|
39233
|
-
node.hostname = os$
|
|
39134
|
+
node.hostname = os$12.hostname();
|
|
39234
39135
|
node.client = {
|
|
39235
39136
|
type: "nodejs",
|
|
39236
39137
|
version: this.broker.MOLECULER_VERSION,
|
|
@@ -40988,7 +40889,7 @@ var require_formatted = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
40988
40889
|
var BaseLogger = require_base$4();
|
|
40989
40890
|
var _ = require_lodash();
|
|
40990
40891
|
var kleur = require_kleur();
|
|
40991
|
-
var util$
|
|
40892
|
+
var util$5 = __require("util");
|
|
40992
40893
|
var { isObject, isFunction } = require_utils$3();
|
|
40993
40894
|
/**
|
|
40994
40895
|
* Import types
|
|
@@ -41036,7 +40937,7 @@ var require_formatted = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41036
40937
|
init(loggerFactory) {
|
|
41037
40938
|
super.init(loggerFactory);
|
|
41038
40939
|
if (!this.opts.colors) kleur.enabled = false;
|
|
41039
|
-
this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$
|
|
40940
|
+
this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$5.inspect(o, {
|
|
41040
40941
|
showHidden: false,
|
|
41041
40942
|
depth: 2,
|
|
41042
40943
|
colors: kleur.enabled,
|
|
@@ -41304,9 +41205,9 @@ var require_console$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41304
41205
|
var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41305
41206
|
var BaseLogger = require_base$4();
|
|
41306
41207
|
var _ = require_lodash();
|
|
41307
|
-
var os$
|
|
41208
|
+
var os$11 = __require("os");
|
|
41308
41209
|
var { MoleculerError } = require_errors$2();
|
|
41309
|
-
var util$
|
|
41210
|
+
var util$4 = __require("util");
|
|
41310
41211
|
var { isObject } = require_utils$3();
|
|
41311
41212
|
/**
|
|
41312
41213
|
* Import types
|
|
@@ -41337,7 +41238,7 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41337
41238
|
apiKey: process.env.DATADOG_API_KEY,
|
|
41338
41239
|
ddSource: "moleculer",
|
|
41339
41240
|
env: void 0,
|
|
41340
|
-
hostname: os$
|
|
41241
|
+
hostname: os$11.hostname(),
|
|
41341
41242
|
objectPrinter: null,
|
|
41342
41243
|
interval: 10 * 1e3
|
|
41343
41244
|
});
|
|
@@ -41352,7 +41253,7 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41352
41253
|
*/
|
|
41353
41254
|
init(loggerFactory) {
|
|
41354
41255
|
super.init(loggerFactory);
|
|
41355
|
-
this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$
|
|
41256
|
+
this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$4.inspect(o, {
|
|
41356
41257
|
showHidden: false,
|
|
41357
41258
|
depth: 2,
|
|
41358
41259
|
colors: false,
|
|
@@ -41461,712 +41362,6 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
41461
41362
|
module.exports = DatadogLogger;
|
|
41462
41363
|
}));
|
|
41463
41364
|
//#endregion
|
|
41464
|
-
//#region ../../node_modules/debug/src/common.js
|
|
41465
|
-
var require_common$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41466
|
-
/**
|
|
41467
|
-
* This is the common logic for both the Node.js and web browser
|
|
41468
|
-
* implementations of `debug()`.
|
|
41469
|
-
*/
|
|
41470
|
-
function setup(env) {
|
|
41471
|
-
createDebug.debug = createDebug;
|
|
41472
|
-
createDebug.default = createDebug;
|
|
41473
|
-
createDebug.coerce = coerce;
|
|
41474
|
-
createDebug.disable = disable;
|
|
41475
|
-
createDebug.enable = enable;
|
|
41476
|
-
createDebug.enabled = enabled;
|
|
41477
|
-
createDebug.humanize = require_ms();
|
|
41478
|
-
createDebug.destroy = destroy;
|
|
41479
|
-
Object.keys(env).forEach((key) => {
|
|
41480
|
-
createDebug[key] = env[key];
|
|
41481
|
-
});
|
|
41482
|
-
/**
|
|
41483
|
-
* The currently active debug mode names, and names to skip.
|
|
41484
|
-
*/
|
|
41485
|
-
createDebug.names = [];
|
|
41486
|
-
createDebug.skips = [];
|
|
41487
|
-
/**
|
|
41488
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
41489
|
-
*
|
|
41490
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
41491
|
-
*/
|
|
41492
|
-
createDebug.formatters = {};
|
|
41493
|
-
/**
|
|
41494
|
-
* Selects a color for a debug namespace
|
|
41495
|
-
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
41496
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
|
41497
|
-
* @api private
|
|
41498
|
-
*/
|
|
41499
|
-
function selectColor(namespace) {
|
|
41500
|
-
let hash = 0;
|
|
41501
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
41502
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
41503
|
-
hash |= 0;
|
|
41504
|
-
}
|
|
41505
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
41506
|
-
}
|
|
41507
|
-
createDebug.selectColor = selectColor;
|
|
41508
|
-
/**
|
|
41509
|
-
* Create a debugger with the given `namespace`.
|
|
41510
|
-
*
|
|
41511
|
-
* @param {String} namespace
|
|
41512
|
-
* @return {Function}
|
|
41513
|
-
* @api public
|
|
41514
|
-
*/
|
|
41515
|
-
function createDebug(namespace) {
|
|
41516
|
-
let prevTime;
|
|
41517
|
-
let enableOverride = null;
|
|
41518
|
-
let namespacesCache;
|
|
41519
|
-
let enabledCache;
|
|
41520
|
-
function debug(...args) {
|
|
41521
|
-
if (!debug.enabled) return;
|
|
41522
|
-
const self = debug;
|
|
41523
|
-
const curr = Number(/* @__PURE__ */ new Date());
|
|
41524
|
-
self.diff = curr - (prevTime || curr);
|
|
41525
|
-
self.prev = prevTime;
|
|
41526
|
-
self.curr = curr;
|
|
41527
|
-
prevTime = curr;
|
|
41528
|
-
args[0] = createDebug.coerce(args[0]);
|
|
41529
|
-
if (typeof args[0] !== "string") args.unshift("%O");
|
|
41530
|
-
let index = 0;
|
|
41531
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
41532
|
-
if (match === "%%") return "%";
|
|
41533
|
-
index++;
|
|
41534
|
-
const formatter = createDebug.formatters[format];
|
|
41535
|
-
if (typeof formatter === "function") {
|
|
41536
|
-
const val = args[index];
|
|
41537
|
-
match = formatter.call(self, val);
|
|
41538
|
-
args.splice(index, 1);
|
|
41539
|
-
index--;
|
|
41540
|
-
}
|
|
41541
|
-
return match;
|
|
41542
|
-
});
|
|
41543
|
-
createDebug.formatArgs.call(self, args);
|
|
41544
|
-
(self.log || createDebug.log).apply(self, args);
|
|
41545
|
-
}
|
|
41546
|
-
debug.namespace = namespace;
|
|
41547
|
-
debug.useColors = createDebug.useColors();
|
|
41548
|
-
debug.color = createDebug.selectColor(namespace);
|
|
41549
|
-
debug.extend = extend;
|
|
41550
|
-
debug.destroy = createDebug.destroy;
|
|
41551
|
-
Object.defineProperty(debug, "enabled", {
|
|
41552
|
-
enumerable: true,
|
|
41553
|
-
configurable: false,
|
|
41554
|
-
get: () => {
|
|
41555
|
-
if (enableOverride !== null) return enableOverride;
|
|
41556
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
41557
|
-
namespacesCache = createDebug.namespaces;
|
|
41558
|
-
enabledCache = createDebug.enabled(namespace);
|
|
41559
|
-
}
|
|
41560
|
-
return enabledCache;
|
|
41561
|
-
},
|
|
41562
|
-
set: (v) => {
|
|
41563
|
-
enableOverride = v;
|
|
41564
|
-
}
|
|
41565
|
-
});
|
|
41566
|
-
if (typeof createDebug.init === "function") createDebug.init(debug);
|
|
41567
|
-
return debug;
|
|
41568
|
-
}
|
|
41569
|
-
function extend(namespace, delimiter) {
|
|
41570
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
41571
|
-
newDebug.log = this.log;
|
|
41572
|
-
return newDebug;
|
|
41573
|
-
}
|
|
41574
|
-
/**
|
|
41575
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
41576
|
-
* separated by a colon and wildcards.
|
|
41577
|
-
*
|
|
41578
|
-
* @param {String} namespaces
|
|
41579
|
-
* @api public
|
|
41580
|
-
*/
|
|
41581
|
-
function enable(namespaces) {
|
|
41582
|
-
createDebug.save(namespaces);
|
|
41583
|
-
createDebug.namespaces = namespaces;
|
|
41584
|
-
createDebug.names = [];
|
|
41585
|
-
createDebug.skips = [];
|
|
41586
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
41587
|
-
for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
|
|
41588
|
-
else createDebug.names.push(ns);
|
|
41589
|
-
}
|
|
41590
|
-
/**
|
|
41591
|
-
* Checks if the given string matches a namespace template, honoring
|
|
41592
|
-
* asterisks as wildcards.
|
|
41593
|
-
*
|
|
41594
|
-
* @param {String} search
|
|
41595
|
-
* @param {String} template
|
|
41596
|
-
* @return {Boolean}
|
|
41597
|
-
*/
|
|
41598
|
-
function matchesTemplate(search, template) {
|
|
41599
|
-
let searchIndex = 0;
|
|
41600
|
-
let templateIndex = 0;
|
|
41601
|
-
let starIndex = -1;
|
|
41602
|
-
let matchIndex = 0;
|
|
41603
|
-
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
|
|
41604
|
-
starIndex = templateIndex;
|
|
41605
|
-
matchIndex = searchIndex;
|
|
41606
|
-
templateIndex++;
|
|
41607
|
-
} else {
|
|
41608
|
-
searchIndex++;
|
|
41609
|
-
templateIndex++;
|
|
41610
|
-
}
|
|
41611
|
-
else if (starIndex !== -1) {
|
|
41612
|
-
templateIndex = starIndex + 1;
|
|
41613
|
-
matchIndex++;
|
|
41614
|
-
searchIndex = matchIndex;
|
|
41615
|
-
} else return false;
|
|
41616
|
-
while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
|
|
41617
|
-
return templateIndex === template.length;
|
|
41618
|
-
}
|
|
41619
|
-
/**
|
|
41620
|
-
* Disable debug output.
|
|
41621
|
-
*
|
|
41622
|
-
* @return {String} namespaces
|
|
41623
|
-
* @api public
|
|
41624
|
-
*/
|
|
41625
|
-
function disable() {
|
|
41626
|
-
const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
|
|
41627
|
-
createDebug.enable("");
|
|
41628
|
-
return namespaces;
|
|
41629
|
-
}
|
|
41630
|
-
/**
|
|
41631
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
41632
|
-
*
|
|
41633
|
-
* @param {String} name
|
|
41634
|
-
* @return {Boolean}
|
|
41635
|
-
* @api public
|
|
41636
|
-
*/
|
|
41637
|
-
function enabled(name) {
|
|
41638
|
-
for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
|
|
41639
|
-
for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
|
|
41640
|
-
return false;
|
|
41641
|
-
}
|
|
41642
|
-
/**
|
|
41643
|
-
* Coerce `val`.
|
|
41644
|
-
*
|
|
41645
|
-
* @param {Mixed} val
|
|
41646
|
-
* @return {Mixed}
|
|
41647
|
-
* @api private
|
|
41648
|
-
*/
|
|
41649
|
-
function coerce(val) {
|
|
41650
|
-
if (val instanceof Error) return val.stack || val.message;
|
|
41651
|
-
return val;
|
|
41652
|
-
}
|
|
41653
|
-
/**
|
|
41654
|
-
* XXX DO NOT USE. This is a temporary stub function.
|
|
41655
|
-
* XXX It WILL be removed in the next major release.
|
|
41656
|
-
*/
|
|
41657
|
-
function destroy() {
|
|
41658
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
41659
|
-
}
|
|
41660
|
-
createDebug.enable(createDebug.load());
|
|
41661
|
-
return createDebug;
|
|
41662
|
-
}
|
|
41663
|
-
module.exports = setup;
|
|
41664
|
-
}));
|
|
41665
|
-
//#endregion
|
|
41666
|
-
//#region ../../node_modules/debug/src/browser.js
|
|
41667
|
-
var require_browser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41668
|
-
/**
|
|
41669
|
-
* This is the web browser implementation of `debug()`.
|
|
41670
|
-
*/
|
|
41671
|
-
exports.formatArgs = formatArgs;
|
|
41672
|
-
exports.save = save;
|
|
41673
|
-
exports.load = load;
|
|
41674
|
-
exports.useColors = useColors;
|
|
41675
|
-
exports.storage = localstorage();
|
|
41676
|
-
exports.destroy = (() => {
|
|
41677
|
-
let warned = false;
|
|
41678
|
-
return () => {
|
|
41679
|
-
if (!warned) {
|
|
41680
|
-
warned = true;
|
|
41681
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
41682
|
-
}
|
|
41683
|
-
};
|
|
41684
|
-
})();
|
|
41685
|
-
/**
|
|
41686
|
-
* Colors.
|
|
41687
|
-
*/
|
|
41688
|
-
exports.colors = [
|
|
41689
|
-
"#0000CC",
|
|
41690
|
-
"#0000FF",
|
|
41691
|
-
"#0033CC",
|
|
41692
|
-
"#0033FF",
|
|
41693
|
-
"#0066CC",
|
|
41694
|
-
"#0066FF",
|
|
41695
|
-
"#0099CC",
|
|
41696
|
-
"#0099FF",
|
|
41697
|
-
"#00CC00",
|
|
41698
|
-
"#00CC33",
|
|
41699
|
-
"#00CC66",
|
|
41700
|
-
"#00CC99",
|
|
41701
|
-
"#00CCCC",
|
|
41702
|
-
"#00CCFF",
|
|
41703
|
-
"#3300CC",
|
|
41704
|
-
"#3300FF",
|
|
41705
|
-
"#3333CC",
|
|
41706
|
-
"#3333FF",
|
|
41707
|
-
"#3366CC",
|
|
41708
|
-
"#3366FF",
|
|
41709
|
-
"#3399CC",
|
|
41710
|
-
"#3399FF",
|
|
41711
|
-
"#33CC00",
|
|
41712
|
-
"#33CC33",
|
|
41713
|
-
"#33CC66",
|
|
41714
|
-
"#33CC99",
|
|
41715
|
-
"#33CCCC",
|
|
41716
|
-
"#33CCFF",
|
|
41717
|
-
"#6600CC",
|
|
41718
|
-
"#6600FF",
|
|
41719
|
-
"#6633CC",
|
|
41720
|
-
"#6633FF",
|
|
41721
|
-
"#66CC00",
|
|
41722
|
-
"#66CC33",
|
|
41723
|
-
"#9900CC",
|
|
41724
|
-
"#9900FF",
|
|
41725
|
-
"#9933CC",
|
|
41726
|
-
"#9933FF",
|
|
41727
|
-
"#99CC00",
|
|
41728
|
-
"#99CC33",
|
|
41729
|
-
"#CC0000",
|
|
41730
|
-
"#CC0033",
|
|
41731
|
-
"#CC0066",
|
|
41732
|
-
"#CC0099",
|
|
41733
|
-
"#CC00CC",
|
|
41734
|
-
"#CC00FF",
|
|
41735
|
-
"#CC3300",
|
|
41736
|
-
"#CC3333",
|
|
41737
|
-
"#CC3366",
|
|
41738
|
-
"#CC3399",
|
|
41739
|
-
"#CC33CC",
|
|
41740
|
-
"#CC33FF",
|
|
41741
|
-
"#CC6600",
|
|
41742
|
-
"#CC6633",
|
|
41743
|
-
"#CC9900",
|
|
41744
|
-
"#CC9933",
|
|
41745
|
-
"#CCCC00",
|
|
41746
|
-
"#CCCC33",
|
|
41747
|
-
"#FF0000",
|
|
41748
|
-
"#FF0033",
|
|
41749
|
-
"#FF0066",
|
|
41750
|
-
"#FF0099",
|
|
41751
|
-
"#FF00CC",
|
|
41752
|
-
"#FF00FF",
|
|
41753
|
-
"#FF3300",
|
|
41754
|
-
"#FF3333",
|
|
41755
|
-
"#FF3366",
|
|
41756
|
-
"#FF3399",
|
|
41757
|
-
"#FF33CC",
|
|
41758
|
-
"#FF33FF",
|
|
41759
|
-
"#FF6600",
|
|
41760
|
-
"#FF6633",
|
|
41761
|
-
"#FF9900",
|
|
41762
|
-
"#FF9933",
|
|
41763
|
-
"#FFCC00",
|
|
41764
|
-
"#FFCC33"
|
|
41765
|
-
];
|
|
41766
|
-
/**
|
|
41767
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
41768
|
-
* and the Firebug extension (any Firefox version) are known
|
|
41769
|
-
* to support "%c" CSS customizations.
|
|
41770
|
-
*
|
|
41771
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
41772
|
-
*/
|
|
41773
|
-
function useColors() {
|
|
41774
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
|
|
41775
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
|
|
41776
|
-
let m;
|
|
41777
|
-
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+)/);
|
|
41778
|
-
}
|
|
41779
|
-
/**
|
|
41780
|
-
* Colorize log arguments if enabled.
|
|
41781
|
-
*
|
|
41782
|
-
* @api public
|
|
41783
|
-
*/
|
|
41784
|
-
function formatArgs(args) {
|
|
41785
|
-
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
41786
|
-
if (!this.useColors) return;
|
|
41787
|
-
const c = "color: " + this.color;
|
|
41788
|
-
args.splice(1, 0, c, "color: inherit");
|
|
41789
|
-
let index = 0;
|
|
41790
|
-
let lastC = 0;
|
|
41791
|
-
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
41792
|
-
if (match === "%%") return;
|
|
41793
|
-
index++;
|
|
41794
|
-
if (match === "%c") lastC = index;
|
|
41795
|
-
});
|
|
41796
|
-
args.splice(lastC, 0, c);
|
|
41797
|
-
}
|
|
41798
|
-
/**
|
|
41799
|
-
* Invokes `console.debug()` when available.
|
|
41800
|
-
* No-op when `console.debug` is not a "function".
|
|
41801
|
-
* If `console.debug` is not available, falls back
|
|
41802
|
-
* to `console.log`.
|
|
41803
|
-
*
|
|
41804
|
-
* @api public
|
|
41805
|
-
*/
|
|
41806
|
-
exports.log = console.debug || console.log || (() => {});
|
|
41807
|
-
/**
|
|
41808
|
-
* Save `namespaces`.
|
|
41809
|
-
*
|
|
41810
|
-
* @param {String} namespaces
|
|
41811
|
-
* @api private
|
|
41812
|
-
*/
|
|
41813
|
-
function save(namespaces) {
|
|
41814
|
-
try {
|
|
41815
|
-
if (namespaces) exports.storage.setItem("debug", namespaces);
|
|
41816
|
-
else exports.storage.removeItem("debug");
|
|
41817
|
-
} catch (error) {}
|
|
41818
|
-
}
|
|
41819
|
-
/**
|
|
41820
|
-
* Load `namespaces`.
|
|
41821
|
-
*
|
|
41822
|
-
* @return {String} returns the previously persisted debug modes
|
|
41823
|
-
* @api private
|
|
41824
|
-
*/
|
|
41825
|
-
function load() {
|
|
41826
|
-
let r;
|
|
41827
|
-
try {
|
|
41828
|
-
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
41829
|
-
} catch (error) {}
|
|
41830
|
-
if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
|
|
41831
|
-
return r;
|
|
41832
|
-
}
|
|
41833
|
-
/**
|
|
41834
|
-
* Localstorage attempts to return the localstorage.
|
|
41835
|
-
*
|
|
41836
|
-
* This is necessary because safari throws
|
|
41837
|
-
* when a user disables cookies/localstorage
|
|
41838
|
-
* and you attempt to access it.
|
|
41839
|
-
*
|
|
41840
|
-
* @return {LocalStorage}
|
|
41841
|
-
* @api private
|
|
41842
|
-
*/
|
|
41843
|
-
function localstorage() {
|
|
41844
|
-
try {
|
|
41845
|
-
return localStorage;
|
|
41846
|
-
} catch (error) {}
|
|
41847
|
-
}
|
|
41848
|
-
module.exports = require_common$1()(exports);
|
|
41849
|
-
var { formatters } = module.exports;
|
|
41850
|
-
/**
|
|
41851
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
41852
|
-
*/
|
|
41853
|
-
formatters.j = function(v) {
|
|
41854
|
-
try {
|
|
41855
|
-
return JSON.stringify(v);
|
|
41856
|
-
} catch (error) {
|
|
41857
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
41858
|
-
}
|
|
41859
|
-
};
|
|
41860
|
-
}));
|
|
41861
|
-
//#endregion
|
|
41862
|
-
//#region ../../node_modules/has-flag/index.js
|
|
41863
|
-
var require_has_flag$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41864
|
-
module.exports = (flag, argv = process.argv) => {
|
|
41865
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
41866
|
-
const position = argv.indexOf(prefix + flag);
|
|
41867
|
-
const terminatorPosition = argv.indexOf("--");
|
|
41868
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
41869
|
-
};
|
|
41870
|
-
}));
|
|
41871
|
-
//#endregion
|
|
41872
|
-
//#region ../../node_modules/supports-color/index.js
|
|
41873
|
-
var require_supports_color$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41874
|
-
var os$11 = __require("os");
|
|
41875
|
-
var tty$1 = __require("tty");
|
|
41876
|
-
var hasFlag = require_has_flag$1();
|
|
41877
|
-
var { env } = process;
|
|
41878
|
-
var flagForceColor;
|
|
41879
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
41880
|
-
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
41881
|
-
function envForceColor() {
|
|
41882
|
-
if ("FORCE_COLOR" in env) {
|
|
41883
|
-
if (env.FORCE_COLOR === "true") return 1;
|
|
41884
|
-
if (env.FORCE_COLOR === "false") return 0;
|
|
41885
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
41886
|
-
}
|
|
41887
|
-
}
|
|
41888
|
-
function translateLevel(level) {
|
|
41889
|
-
if (level === 0) return false;
|
|
41890
|
-
return {
|
|
41891
|
-
level,
|
|
41892
|
-
hasBasic: true,
|
|
41893
|
-
has256: level >= 2,
|
|
41894
|
-
has16m: level >= 3
|
|
41895
|
-
};
|
|
41896
|
-
}
|
|
41897
|
-
function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
41898
|
-
const noFlagForceColor = envForceColor();
|
|
41899
|
-
if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
|
|
41900
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
41901
|
-
if (forceColor === 0) return 0;
|
|
41902
|
-
if (sniffFlags) {
|
|
41903
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
41904
|
-
if (hasFlag("color=256")) return 2;
|
|
41905
|
-
}
|
|
41906
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
41907
|
-
const min = forceColor || 0;
|
|
41908
|
-
if (env.TERM === "dumb") return min;
|
|
41909
|
-
if (process.platform === "win32") {
|
|
41910
|
-
const osRelease = os$11.release().split(".");
|
|
41911
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
41912
|
-
return 1;
|
|
41913
|
-
}
|
|
41914
|
-
if ("CI" in env) {
|
|
41915
|
-
if ([
|
|
41916
|
-
"TRAVIS",
|
|
41917
|
-
"CIRCLECI",
|
|
41918
|
-
"APPVEYOR",
|
|
41919
|
-
"GITLAB_CI",
|
|
41920
|
-
"GITHUB_ACTIONS",
|
|
41921
|
-
"BUILDKITE",
|
|
41922
|
-
"DRONE"
|
|
41923
|
-
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
41924
|
-
return min;
|
|
41925
|
-
}
|
|
41926
|
-
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
41927
|
-
if (env.COLORTERM === "truecolor") return 3;
|
|
41928
|
-
if ("TERM_PROGRAM" in env) {
|
|
41929
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
41930
|
-
switch (env.TERM_PROGRAM) {
|
|
41931
|
-
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
41932
|
-
case "Apple_Terminal": return 2;
|
|
41933
|
-
}
|
|
41934
|
-
}
|
|
41935
|
-
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
41936
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
41937
|
-
if ("COLORTERM" in env) return 1;
|
|
41938
|
-
return min;
|
|
41939
|
-
}
|
|
41940
|
-
function getSupportLevel(stream, options = {}) {
|
|
41941
|
-
return translateLevel(supportsColor(stream, {
|
|
41942
|
-
streamIsTTY: stream && stream.isTTY,
|
|
41943
|
-
...options
|
|
41944
|
-
}));
|
|
41945
|
-
}
|
|
41946
|
-
module.exports = {
|
|
41947
|
-
supportsColor: getSupportLevel,
|
|
41948
|
-
stdout: getSupportLevel({ isTTY: tty$1.isatty(1) }),
|
|
41949
|
-
stderr: getSupportLevel({ isTTY: tty$1.isatty(2) })
|
|
41950
|
-
};
|
|
41951
|
-
}));
|
|
41952
|
-
//#endregion
|
|
41953
|
-
//#region ../../node_modules/debug/src/node.js
|
|
41954
|
-
var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
41955
|
-
/**
|
|
41956
|
-
* Module dependencies.
|
|
41957
|
-
*/
|
|
41958
|
-
var tty = __require("tty");
|
|
41959
|
-
var util$5 = __require("util");
|
|
41960
|
-
/**
|
|
41961
|
-
* This is the Node.js implementation of `debug()`.
|
|
41962
|
-
*/
|
|
41963
|
-
exports.init = init;
|
|
41964
|
-
exports.log = log;
|
|
41965
|
-
exports.formatArgs = formatArgs;
|
|
41966
|
-
exports.save = save;
|
|
41967
|
-
exports.load = load;
|
|
41968
|
-
exports.useColors = useColors;
|
|
41969
|
-
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`.");
|
|
41970
|
-
/**
|
|
41971
|
-
* Colors.
|
|
41972
|
-
*/
|
|
41973
|
-
exports.colors = [
|
|
41974
|
-
6,
|
|
41975
|
-
2,
|
|
41976
|
-
3,
|
|
41977
|
-
4,
|
|
41978
|
-
5,
|
|
41979
|
-
1
|
|
41980
|
-
];
|
|
41981
|
-
try {
|
|
41982
|
-
const supportsColor = require_supports_color$1();
|
|
41983
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
|
|
41984
|
-
20,
|
|
41985
|
-
21,
|
|
41986
|
-
26,
|
|
41987
|
-
27,
|
|
41988
|
-
32,
|
|
41989
|
-
33,
|
|
41990
|
-
38,
|
|
41991
|
-
39,
|
|
41992
|
-
40,
|
|
41993
|
-
41,
|
|
41994
|
-
42,
|
|
41995
|
-
43,
|
|
41996
|
-
44,
|
|
41997
|
-
45,
|
|
41998
|
-
56,
|
|
41999
|
-
57,
|
|
42000
|
-
62,
|
|
42001
|
-
63,
|
|
42002
|
-
68,
|
|
42003
|
-
69,
|
|
42004
|
-
74,
|
|
42005
|
-
75,
|
|
42006
|
-
76,
|
|
42007
|
-
77,
|
|
42008
|
-
78,
|
|
42009
|
-
79,
|
|
42010
|
-
80,
|
|
42011
|
-
81,
|
|
42012
|
-
92,
|
|
42013
|
-
93,
|
|
42014
|
-
98,
|
|
42015
|
-
99,
|
|
42016
|
-
112,
|
|
42017
|
-
113,
|
|
42018
|
-
128,
|
|
42019
|
-
129,
|
|
42020
|
-
134,
|
|
42021
|
-
135,
|
|
42022
|
-
148,
|
|
42023
|
-
149,
|
|
42024
|
-
160,
|
|
42025
|
-
161,
|
|
42026
|
-
162,
|
|
42027
|
-
163,
|
|
42028
|
-
164,
|
|
42029
|
-
165,
|
|
42030
|
-
166,
|
|
42031
|
-
167,
|
|
42032
|
-
168,
|
|
42033
|
-
169,
|
|
42034
|
-
170,
|
|
42035
|
-
171,
|
|
42036
|
-
172,
|
|
42037
|
-
173,
|
|
42038
|
-
178,
|
|
42039
|
-
179,
|
|
42040
|
-
184,
|
|
42041
|
-
185,
|
|
42042
|
-
196,
|
|
42043
|
-
197,
|
|
42044
|
-
198,
|
|
42045
|
-
199,
|
|
42046
|
-
200,
|
|
42047
|
-
201,
|
|
42048
|
-
202,
|
|
42049
|
-
203,
|
|
42050
|
-
204,
|
|
42051
|
-
205,
|
|
42052
|
-
206,
|
|
42053
|
-
207,
|
|
42054
|
-
208,
|
|
42055
|
-
209,
|
|
42056
|
-
214,
|
|
42057
|
-
215,
|
|
42058
|
-
220,
|
|
42059
|
-
221
|
|
42060
|
-
];
|
|
42061
|
-
} catch (error) {}
|
|
42062
|
-
/**
|
|
42063
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
|
42064
|
-
*
|
|
42065
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
42066
|
-
*/
|
|
42067
|
-
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
42068
|
-
return /^debug_/i.test(key);
|
|
42069
|
-
}).reduce((obj, key) => {
|
|
42070
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
42071
|
-
return k.toUpperCase();
|
|
42072
|
-
});
|
|
42073
|
-
let val = process.env[key];
|
|
42074
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
|
42075
|
-
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
|
42076
|
-
else if (val === "null") val = null;
|
|
42077
|
-
else val = Number(val);
|
|
42078
|
-
obj[prop] = val;
|
|
42079
|
-
return obj;
|
|
42080
|
-
}, {});
|
|
42081
|
-
/**
|
|
42082
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
42083
|
-
*/
|
|
42084
|
-
function useColors() {
|
|
42085
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
42086
|
-
}
|
|
42087
|
-
/**
|
|
42088
|
-
* Adds ANSI color escape codes if enabled.
|
|
42089
|
-
*
|
|
42090
|
-
* @api public
|
|
42091
|
-
*/
|
|
42092
|
-
function formatArgs(args) {
|
|
42093
|
-
const { namespace: name, useColors } = this;
|
|
42094
|
-
if (useColors) {
|
|
42095
|
-
const c = this.color;
|
|
42096
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
42097
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
42098
|
-
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
42099
|
-
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
42100
|
-
} else args[0] = getDate() + name + " " + args[0];
|
|
42101
|
-
}
|
|
42102
|
-
function getDate() {
|
|
42103
|
-
if (exports.inspectOpts.hideDate) return "";
|
|
42104
|
-
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
42105
|
-
}
|
|
42106
|
-
/**
|
|
42107
|
-
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
|
42108
|
-
*/
|
|
42109
|
-
function log(...args) {
|
|
42110
|
-
return process.stderr.write(util$5.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
42111
|
-
}
|
|
42112
|
-
/**
|
|
42113
|
-
* Save `namespaces`.
|
|
42114
|
-
*
|
|
42115
|
-
* @param {String} namespaces
|
|
42116
|
-
* @api private
|
|
42117
|
-
*/
|
|
42118
|
-
function save(namespaces) {
|
|
42119
|
-
if (namespaces) process.env.DEBUG = namespaces;
|
|
42120
|
-
else delete process.env.DEBUG;
|
|
42121
|
-
}
|
|
42122
|
-
/**
|
|
42123
|
-
* Load `namespaces`.
|
|
42124
|
-
*
|
|
42125
|
-
* @return {String} returns the previously persisted debug modes
|
|
42126
|
-
* @api private
|
|
42127
|
-
*/
|
|
42128
|
-
function load() {
|
|
42129
|
-
return process.env.DEBUG;
|
|
42130
|
-
}
|
|
42131
|
-
/**
|
|
42132
|
-
* Init logic for `debug` instances.
|
|
42133
|
-
*
|
|
42134
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
|
42135
|
-
* differently for a particular `debug` instance.
|
|
42136
|
-
*/
|
|
42137
|
-
function init(debug) {
|
|
42138
|
-
debug.inspectOpts = {};
|
|
42139
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
42140
|
-
for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
42141
|
-
}
|
|
42142
|
-
module.exports = require_common$1()(exports);
|
|
42143
|
-
var { formatters } = module.exports;
|
|
42144
|
-
/**
|
|
42145
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
42146
|
-
*/
|
|
42147
|
-
formatters.o = function(v) {
|
|
42148
|
-
this.inspectOpts.colors = this.useColors;
|
|
42149
|
-
return util$5.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
42150
|
-
};
|
|
42151
|
-
/**
|
|
42152
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
42153
|
-
*/
|
|
42154
|
-
formatters.O = function(v) {
|
|
42155
|
-
this.inspectOpts.colors = this.useColors;
|
|
42156
|
-
return util$5.inspect(v, this.inspectOpts);
|
|
42157
|
-
};
|
|
42158
|
-
}));
|
|
42159
|
-
//#endregion
|
|
42160
|
-
//#region ../../node_modules/debug/src/index.js
|
|
42161
|
-
var require_src = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42162
|
-
/**
|
|
42163
|
-
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
42164
|
-
* treat as a browser.
|
|
42165
|
-
*/
|
|
42166
|
-
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
|
|
42167
|
-
else module.exports = require_node();
|
|
42168
|
-
}));
|
|
42169
|
-
//#endregion
|
|
42170
41365
|
//#region ../../node_modules/moleculer/src/loggers/debug.js
|
|
42171
41366
|
var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42172
41367
|
var BaseLogger = require_base$4();
|
|
@@ -42237,7 +41432,7 @@ var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42237
41432
|
var require_file$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42238
41433
|
var FormattedLogger = require_formatted();
|
|
42239
41434
|
var _ = require_lodash();
|
|
42240
|
-
var fs$
|
|
41435
|
+
var fs$13 = __require("fs/promises");
|
|
42241
41436
|
var path$36 = __require("path");
|
|
42242
41437
|
var os$10 = __require("os");
|
|
42243
41438
|
var { makeDirs } = require_utils$3();
|
|
@@ -42341,7 +41536,7 @@ var require_file$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42341
41536
|
const rows = Array.from(this.queue);
|
|
42342
41537
|
this.queue.length = 0;
|
|
42343
41538
|
const buf = rows.join(this.opts.eol) + this.opts.eol;
|
|
42344
|
-
return fs$
|
|
41539
|
+
return fs$13.appendFile(filename, buf).catch((err) => {
|
|
42345
41540
|
/* istanbul ignore next */
|
|
42346
41541
|
console.debug("Unable to write log file:", filename, err);
|
|
42347
41542
|
});
|
|
@@ -42489,7 +41684,7 @@ var require_rfdc = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42489
41684
|
//#endregion
|
|
42490
41685
|
//#region ../../node_modules/log4js/lib/configuration.js
|
|
42491
41686
|
var require_configuration = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42492
|
-
var util$
|
|
41687
|
+
var util$3 = __require("util");
|
|
42493
41688
|
var debug = require_src()("log4js:configuration");
|
|
42494
41689
|
var preProcessingListeners = [];
|
|
42495
41690
|
var listeners = [];
|
|
@@ -42507,7 +41702,7 @@ var require_configuration = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
|
|
|
42507
41702
|
};
|
|
42508
41703
|
var throwExceptionIf = (config, checks, message) => {
|
|
42509
41704
|
(Array.isArray(checks) ? checks : [checks]).forEach((test) => {
|
|
42510
|
-
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}`);
|
|
42511
41706
|
});
|
|
42512
41707
|
};
|
|
42513
41708
|
var configure = (candidate) => {
|
|
@@ -42689,7 +41884,7 @@ var require_lib$5 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42689
41884
|
var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
42690
41885
|
var dateFormat = require_lib$5();
|
|
42691
41886
|
var os$9 = __require("os");
|
|
42692
|
-
var util$
|
|
41887
|
+
var util$2 = __require("util");
|
|
42693
41888
|
var path$35 = __require("path");
|
|
42694
41889
|
var styles = {
|
|
42695
41890
|
bold: [1, 22],
|
|
@@ -42719,7 +41914,7 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42719
41914
|
return colorizeStart(style) + str + colorizeEnd(style);
|
|
42720
41915
|
}
|
|
42721
41916
|
function timestampLevelAndCategory(loggingEvent, colour) {
|
|
42722
|
-
return colorize(util$
|
|
41917
|
+
return colorize(util$2.format("[%s] [%s] %s - ", dateFormat.asString(loggingEvent.startTime), loggingEvent.level.toString(), loggingEvent.categoryName), colour);
|
|
42723
41918
|
}
|
|
42724
41919
|
/**
|
|
42725
41920
|
* BasicLayout is a simple layout for storing the logs. The logs are stored
|
|
@@ -42731,17 +41926,17 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42731
41926
|
* @author Stephan Strittmatter
|
|
42732
41927
|
*/
|
|
42733
41928
|
function basicLayout(loggingEvent) {
|
|
42734
|
-
return timestampLevelAndCategory(loggingEvent) + util$
|
|
41929
|
+
return timestampLevelAndCategory(loggingEvent) + util$2.format(...loggingEvent.data);
|
|
42735
41930
|
}
|
|
42736
41931
|
/**
|
|
42737
41932
|
* colouredLayout - taken from masylum's fork.
|
|
42738
41933
|
* same as basicLayout, but with colours.
|
|
42739
41934
|
*/
|
|
42740
41935
|
function colouredLayout(loggingEvent) {
|
|
42741
|
-
return timestampLevelAndCategory(loggingEvent, loggingEvent.level.colour) + util$
|
|
41936
|
+
return timestampLevelAndCategory(loggingEvent, loggingEvent.level.colour) + util$2.format(...loggingEvent.data);
|
|
42742
41937
|
}
|
|
42743
41938
|
function messagePassThroughLayout(loggingEvent) {
|
|
42744
|
-
return util$
|
|
41939
|
+
return util$2.format(...loggingEvent.data);
|
|
42745
41940
|
}
|
|
42746
41941
|
function dummyLayout(loggingEvent) {
|
|
42747
41942
|
return loggingEvent.data[0];
|
|
@@ -42817,7 +42012,7 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
42817
42012
|
return os$9.hostname().toString();
|
|
42818
42013
|
}
|
|
42819
42014
|
function formatMessage(loggingEvent) {
|
|
42820
|
-
return util$
|
|
42015
|
+
return util$2.format(...loggingEvent.data);
|
|
42821
42016
|
}
|
|
42822
42017
|
function endOfLine() {
|
|
42823
42018
|
return os$9.EOL;
|
|
@@ -43499,720 +42694,6 @@ var require_universalify = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
43499
42694
|
};
|
|
43500
42695
|
}));
|
|
43501
42696
|
//#endregion
|
|
43502
|
-
//#region ../../node_modules/graceful-fs/polyfills.js
|
|
43503
|
-
var require_polyfills = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
43504
|
-
var constants$1 = __require("constants");
|
|
43505
|
-
var origCwd = process.cwd;
|
|
43506
|
-
var cwd = null;
|
|
43507
|
-
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
43508
|
-
process.cwd = function() {
|
|
43509
|
-
if (!cwd) cwd = origCwd.call(process);
|
|
43510
|
-
return cwd;
|
|
43511
|
-
};
|
|
43512
|
-
try {
|
|
43513
|
-
process.cwd();
|
|
43514
|
-
} catch (er) {}
|
|
43515
|
-
if (typeof process.chdir === "function") {
|
|
43516
|
-
var chdir = process.chdir;
|
|
43517
|
-
process.chdir = function(d) {
|
|
43518
|
-
cwd = null;
|
|
43519
|
-
chdir.call(process, d);
|
|
43520
|
-
};
|
|
43521
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
43522
|
-
}
|
|
43523
|
-
module.exports = patch;
|
|
43524
|
-
function patch(fs) {
|
|
43525
|
-
if (constants$1.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
|
|
43526
|
-
if (!fs.lutimes) patchLutimes(fs);
|
|
43527
|
-
fs.chown = chownFix(fs.chown);
|
|
43528
|
-
fs.fchown = chownFix(fs.fchown);
|
|
43529
|
-
fs.lchown = chownFix(fs.lchown);
|
|
43530
|
-
fs.chmod = chmodFix(fs.chmod);
|
|
43531
|
-
fs.fchmod = chmodFix(fs.fchmod);
|
|
43532
|
-
fs.lchmod = chmodFix(fs.lchmod);
|
|
43533
|
-
fs.chownSync = chownFixSync(fs.chownSync);
|
|
43534
|
-
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
43535
|
-
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
43536
|
-
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
43537
|
-
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
43538
|
-
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
43539
|
-
fs.stat = statFix(fs.stat);
|
|
43540
|
-
fs.fstat = statFix(fs.fstat);
|
|
43541
|
-
fs.lstat = statFix(fs.lstat);
|
|
43542
|
-
fs.statSync = statFixSync(fs.statSync);
|
|
43543
|
-
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
43544
|
-
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
43545
|
-
if (fs.chmod && !fs.lchmod) {
|
|
43546
|
-
fs.lchmod = function(path, mode, cb) {
|
|
43547
|
-
if (cb) process.nextTick(cb);
|
|
43548
|
-
};
|
|
43549
|
-
fs.lchmodSync = function() {};
|
|
43550
|
-
}
|
|
43551
|
-
if (fs.chown && !fs.lchown) {
|
|
43552
|
-
fs.lchown = function(path, uid, gid, cb) {
|
|
43553
|
-
if (cb) process.nextTick(cb);
|
|
43554
|
-
};
|
|
43555
|
-
fs.lchownSync = function() {};
|
|
43556
|
-
}
|
|
43557
|
-
if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
|
|
43558
|
-
function rename(from, to, cb) {
|
|
43559
|
-
var start = Date.now();
|
|
43560
|
-
var backoff = 0;
|
|
43561
|
-
fs$rename(from, to, function CB(er) {
|
|
43562
|
-
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
43563
|
-
setTimeout(function() {
|
|
43564
|
-
fs.stat(to, function(stater, st) {
|
|
43565
|
-
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
|
|
43566
|
-
else cb(er);
|
|
43567
|
-
});
|
|
43568
|
-
}, backoff);
|
|
43569
|
-
if (backoff < 100) backoff += 10;
|
|
43570
|
-
return;
|
|
43571
|
-
}
|
|
43572
|
-
if (cb) cb(er);
|
|
43573
|
-
});
|
|
43574
|
-
}
|
|
43575
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
43576
|
-
return rename;
|
|
43577
|
-
})(fs.rename);
|
|
43578
|
-
fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
|
|
43579
|
-
function read(fd, buffer, offset, length, position, callback_) {
|
|
43580
|
-
var callback;
|
|
43581
|
-
if (callback_ && typeof callback_ === "function") {
|
|
43582
|
-
var eagCounter = 0;
|
|
43583
|
-
callback = function(er, _, __) {
|
|
43584
|
-
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
43585
|
-
eagCounter++;
|
|
43586
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
43587
|
-
}
|
|
43588
|
-
callback_.apply(this, arguments);
|
|
43589
|
-
};
|
|
43590
|
-
}
|
|
43591
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
43592
|
-
}
|
|
43593
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
43594
|
-
return read;
|
|
43595
|
-
})(fs.read);
|
|
43596
|
-
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
|
|
43597
|
-
return function(fd, buffer, offset, length, position) {
|
|
43598
|
-
var eagCounter = 0;
|
|
43599
|
-
while (true) try {
|
|
43600
|
-
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
43601
|
-
} catch (er) {
|
|
43602
|
-
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
43603
|
-
eagCounter++;
|
|
43604
|
-
continue;
|
|
43605
|
-
}
|
|
43606
|
-
throw er;
|
|
43607
|
-
}
|
|
43608
|
-
};
|
|
43609
|
-
})(fs.readSync);
|
|
43610
|
-
function patchLchmod(fs) {
|
|
43611
|
-
fs.lchmod = function(path, mode, callback) {
|
|
43612
|
-
fs.open(path, constants$1.O_WRONLY | constants$1.O_SYMLINK, mode, function(err, fd) {
|
|
43613
|
-
if (err) {
|
|
43614
|
-
if (callback) callback(err);
|
|
43615
|
-
return;
|
|
43616
|
-
}
|
|
43617
|
-
fs.fchmod(fd, mode, function(err) {
|
|
43618
|
-
fs.close(fd, function(err2) {
|
|
43619
|
-
if (callback) callback(err || err2);
|
|
43620
|
-
});
|
|
43621
|
-
});
|
|
43622
|
-
});
|
|
43623
|
-
};
|
|
43624
|
-
fs.lchmodSync = function(path, mode) {
|
|
43625
|
-
var fd = fs.openSync(path, constants$1.O_WRONLY | constants$1.O_SYMLINK, mode);
|
|
43626
|
-
var threw = true;
|
|
43627
|
-
var ret;
|
|
43628
|
-
try {
|
|
43629
|
-
ret = fs.fchmodSync(fd, mode);
|
|
43630
|
-
threw = false;
|
|
43631
|
-
} finally {
|
|
43632
|
-
if (threw) try {
|
|
43633
|
-
fs.closeSync(fd);
|
|
43634
|
-
} catch (er) {}
|
|
43635
|
-
else fs.closeSync(fd);
|
|
43636
|
-
}
|
|
43637
|
-
return ret;
|
|
43638
|
-
};
|
|
43639
|
-
}
|
|
43640
|
-
function patchLutimes(fs) {
|
|
43641
|
-
if (constants$1.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
43642
|
-
fs.lutimes = function(path, at, mt, cb) {
|
|
43643
|
-
fs.open(path, constants$1.O_SYMLINK, function(er, fd) {
|
|
43644
|
-
if (er) {
|
|
43645
|
-
if (cb) cb(er);
|
|
43646
|
-
return;
|
|
43647
|
-
}
|
|
43648
|
-
fs.futimes(fd, at, mt, function(er) {
|
|
43649
|
-
fs.close(fd, function(er2) {
|
|
43650
|
-
if (cb) cb(er || er2);
|
|
43651
|
-
});
|
|
43652
|
-
});
|
|
43653
|
-
});
|
|
43654
|
-
};
|
|
43655
|
-
fs.lutimesSync = function(path, at, mt) {
|
|
43656
|
-
var fd = fs.openSync(path, constants$1.O_SYMLINK);
|
|
43657
|
-
var ret;
|
|
43658
|
-
var threw = true;
|
|
43659
|
-
try {
|
|
43660
|
-
ret = fs.futimesSync(fd, at, mt);
|
|
43661
|
-
threw = false;
|
|
43662
|
-
} finally {
|
|
43663
|
-
if (threw) try {
|
|
43664
|
-
fs.closeSync(fd);
|
|
43665
|
-
} catch (er) {}
|
|
43666
|
-
else fs.closeSync(fd);
|
|
43667
|
-
}
|
|
43668
|
-
return ret;
|
|
43669
|
-
};
|
|
43670
|
-
} else if (fs.futimes) {
|
|
43671
|
-
fs.lutimes = function(_a, _b, _c, cb) {
|
|
43672
|
-
if (cb) process.nextTick(cb);
|
|
43673
|
-
};
|
|
43674
|
-
fs.lutimesSync = function() {};
|
|
43675
|
-
}
|
|
43676
|
-
}
|
|
43677
|
-
function chmodFix(orig) {
|
|
43678
|
-
if (!orig) return orig;
|
|
43679
|
-
return function(target, mode, cb) {
|
|
43680
|
-
return orig.call(fs, target, mode, function(er) {
|
|
43681
|
-
if (chownErOk(er)) er = null;
|
|
43682
|
-
if (cb) cb.apply(this, arguments);
|
|
43683
|
-
});
|
|
43684
|
-
};
|
|
43685
|
-
}
|
|
43686
|
-
function chmodFixSync(orig) {
|
|
43687
|
-
if (!orig) return orig;
|
|
43688
|
-
return function(target, mode) {
|
|
43689
|
-
try {
|
|
43690
|
-
return orig.call(fs, target, mode);
|
|
43691
|
-
} catch (er) {
|
|
43692
|
-
if (!chownErOk(er)) throw er;
|
|
43693
|
-
}
|
|
43694
|
-
};
|
|
43695
|
-
}
|
|
43696
|
-
function chownFix(orig) {
|
|
43697
|
-
if (!orig) return orig;
|
|
43698
|
-
return function(target, uid, gid, cb) {
|
|
43699
|
-
return orig.call(fs, target, uid, gid, function(er) {
|
|
43700
|
-
if (chownErOk(er)) er = null;
|
|
43701
|
-
if (cb) cb.apply(this, arguments);
|
|
43702
|
-
});
|
|
43703
|
-
};
|
|
43704
|
-
}
|
|
43705
|
-
function chownFixSync(orig) {
|
|
43706
|
-
if (!orig) return orig;
|
|
43707
|
-
return function(target, uid, gid) {
|
|
43708
|
-
try {
|
|
43709
|
-
return orig.call(fs, target, uid, gid);
|
|
43710
|
-
} catch (er) {
|
|
43711
|
-
if (!chownErOk(er)) throw er;
|
|
43712
|
-
}
|
|
43713
|
-
};
|
|
43714
|
-
}
|
|
43715
|
-
function statFix(orig) {
|
|
43716
|
-
if (!orig) return orig;
|
|
43717
|
-
return function(target, options, cb) {
|
|
43718
|
-
if (typeof options === "function") {
|
|
43719
|
-
cb = options;
|
|
43720
|
-
options = null;
|
|
43721
|
-
}
|
|
43722
|
-
function callback(er, stats) {
|
|
43723
|
-
if (stats) {
|
|
43724
|
-
if (stats.uid < 0) stats.uid += 4294967296;
|
|
43725
|
-
if (stats.gid < 0) stats.gid += 4294967296;
|
|
43726
|
-
}
|
|
43727
|
-
if (cb) cb.apply(this, arguments);
|
|
43728
|
-
}
|
|
43729
|
-
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
43730
|
-
};
|
|
43731
|
-
}
|
|
43732
|
-
function statFixSync(orig) {
|
|
43733
|
-
if (!orig) return orig;
|
|
43734
|
-
return function(target, options) {
|
|
43735
|
-
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
43736
|
-
if (stats) {
|
|
43737
|
-
if (stats.uid < 0) stats.uid += 4294967296;
|
|
43738
|
-
if (stats.gid < 0) stats.gid += 4294967296;
|
|
43739
|
-
}
|
|
43740
|
-
return stats;
|
|
43741
|
-
};
|
|
43742
|
-
}
|
|
43743
|
-
function chownErOk(er) {
|
|
43744
|
-
if (!er) return true;
|
|
43745
|
-
if (er.code === "ENOSYS") return true;
|
|
43746
|
-
if (!process.getuid || process.getuid() !== 0) {
|
|
43747
|
-
if (er.code === "EINVAL" || er.code === "EPERM") return true;
|
|
43748
|
-
}
|
|
43749
|
-
return false;
|
|
43750
|
-
}
|
|
43751
|
-
}
|
|
43752
|
-
}));
|
|
43753
|
-
//#endregion
|
|
43754
|
-
//#region ../../node_modules/graceful-fs/legacy-streams.js
|
|
43755
|
-
var require_legacy_streams = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
43756
|
-
var Stream$2 = __require("stream").Stream;
|
|
43757
|
-
module.exports = legacy;
|
|
43758
|
-
function legacy(fs) {
|
|
43759
|
-
return {
|
|
43760
|
-
ReadStream,
|
|
43761
|
-
WriteStream
|
|
43762
|
-
};
|
|
43763
|
-
function ReadStream(path, options) {
|
|
43764
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
43765
|
-
Stream$2.call(this);
|
|
43766
|
-
var self = this;
|
|
43767
|
-
this.path = path;
|
|
43768
|
-
this.fd = null;
|
|
43769
|
-
this.readable = true;
|
|
43770
|
-
this.paused = false;
|
|
43771
|
-
this.flags = "r";
|
|
43772
|
-
this.mode = 438;
|
|
43773
|
-
this.bufferSize = 64 * 1024;
|
|
43774
|
-
options = options || {};
|
|
43775
|
-
var keys = Object.keys(options);
|
|
43776
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
43777
|
-
var key = keys[index];
|
|
43778
|
-
this[key] = options[key];
|
|
43779
|
-
}
|
|
43780
|
-
if (this.encoding) this.setEncoding(this.encoding);
|
|
43781
|
-
if (this.start !== void 0) {
|
|
43782
|
-
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
43783
|
-
if (this.end === void 0) this.end = Infinity;
|
|
43784
|
-
else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
|
|
43785
|
-
if (this.start > this.end) throw new Error("start must be <= end");
|
|
43786
|
-
this.pos = this.start;
|
|
43787
|
-
}
|
|
43788
|
-
if (this.fd !== null) {
|
|
43789
|
-
process.nextTick(function() {
|
|
43790
|
-
self._read();
|
|
43791
|
-
});
|
|
43792
|
-
return;
|
|
43793
|
-
}
|
|
43794
|
-
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
43795
|
-
if (err) {
|
|
43796
|
-
self.emit("error", err);
|
|
43797
|
-
self.readable = false;
|
|
43798
|
-
return;
|
|
43799
|
-
}
|
|
43800
|
-
self.fd = fd;
|
|
43801
|
-
self.emit("open", fd);
|
|
43802
|
-
self._read();
|
|
43803
|
-
});
|
|
43804
|
-
}
|
|
43805
|
-
function WriteStream(path, options) {
|
|
43806
|
-
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
43807
|
-
Stream$2.call(this);
|
|
43808
|
-
this.path = path;
|
|
43809
|
-
this.fd = null;
|
|
43810
|
-
this.writable = true;
|
|
43811
|
-
this.flags = "w";
|
|
43812
|
-
this.encoding = "binary";
|
|
43813
|
-
this.mode = 438;
|
|
43814
|
-
this.bytesWritten = 0;
|
|
43815
|
-
options = options || {};
|
|
43816
|
-
var keys = Object.keys(options);
|
|
43817
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
43818
|
-
var key = keys[index];
|
|
43819
|
-
this[key] = options[key];
|
|
43820
|
-
}
|
|
43821
|
-
if (this.start !== void 0) {
|
|
43822
|
-
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
43823
|
-
if (this.start < 0) throw new Error("start must be >= zero");
|
|
43824
|
-
this.pos = this.start;
|
|
43825
|
-
}
|
|
43826
|
-
this.busy = false;
|
|
43827
|
-
this._queue = [];
|
|
43828
|
-
if (this.fd === null) {
|
|
43829
|
-
this._open = fs.open;
|
|
43830
|
-
this._queue.push([
|
|
43831
|
-
this._open,
|
|
43832
|
-
this.path,
|
|
43833
|
-
this.flags,
|
|
43834
|
-
this.mode,
|
|
43835
|
-
void 0
|
|
43836
|
-
]);
|
|
43837
|
-
this.flush();
|
|
43838
|
-
}
|
|
43839
|
-
}
|
|
43840
|
-
}
|
|
43841
|
-
}));
|
|
43842
|
-
//#endregion
|
|
43843
|
-
//#region ../../node_modules/graceful-fs/clone.js
|
|
43844
|
-
var require_clone = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
43845
|
-
module.exports = clone;
|
|
43846
|
-
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
43847
|
-
return obj.__proto__;
|
|
43848
|
-
};
|
|
43849
|
-
function clone(obj) {
|
|
43850
|
-
if (obj === null || typeof obj !== "object") return obj;
|
|
43851
|
-
if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
|
|
43852
|
-
else var copy = Object.create(null);
|
|
43853
|
-
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
43854
|
-
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
43855
|
-
});
|
|
43856
|
-
return copy;
|
|
43857
|
-
}
|
|
43858
|
-
}));
|
|
43859
|
-
//#endregion
|
|
43860
|
-
//#region ../../node_modules/graceful-fs/graceful-fs.js
|
|
43861
|
-
var require_graceful_fs = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
43862
|
-
var fs$13 = __require("fs");
|
|
43863
|
-
var polyfills = require_polyfills();
|
|
43864
|
-
var legacy = require_legacy_streams();
|
|
43865
|
-
var clone = require_clone();
|
|
43866
|
-
var util$2 = __require("util");
|
|
43867
|
-
/* istanbul ignore next - node 0.x polyfill */
|
|
43868
|
-
var gracefulQueue;
|
|
43869
|
-
var previousSymbol;
|
|
43870
|
-
/* istanbul ignore else - node 0.x polyfill */
|
|
43871
|
-
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
43872
|
-
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
43873
|
-
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
43874
|
-
} else {
|
|
43875
|
-
gracefulQueue = "___graceful-fs.queue";
|
|
43876
|
-
previousSymbol = "___graceful-fs.previous";
|
|
43877
|
-
}
|
|
43878
|
-
function noop() {}
|
|
43879
|
-
function publishQueue(context, queue) {
|
|
43880
|
-
Object.defineProperty(context, gracefulQueue, { get: function() {
|
|
43881
|
-
return queue;
|
|
43882
|
-
} });
|
|
43883
|
-
}
|
|
43884
|
-
var debug = noop;
|
|
43885
|
-
if (util$2.debuglog) debug = util$2.debuglog("gfs4");
|
|
43886
|
-
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
|
|
43887
|
-
var m = util$2.format.apply(util$2, arguments);
|
|
43888
|
-
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
43889
|
-
console.error(m);
|
|
43890
|
-
};
|
|
43891
|
-
if (!fs$13[gracefulQueue]) {
|
|
43892
|
-
publishQueue(fs$13, global[gracefulQueue] || []);
|
|
43893
|
-
fs$13.close = (function(fs$close) {
|
|
43894
|
-
function close(fd, cb) {
|
|
43895
|
-
return fs$close.call(fs$13, fd, function(err) {
|
|
43896
|
-
if (!err) resetQueue();
|
|
43897
|
-
if (typeof cb === "function") cb.apply(this, arguments);
|
|
43898
|
-
});
|
|
43899
|
-
}
|
|
43900
|
-
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
43901
|
-
return close;
|
|
43902
|
-
})(fs$13.close);
|
|
43903
|
-
fs$13.closeSync = (function(fs$closeSync) {
|
|
43904
|
-
function closeSync(fd) {
|
|
43905
|
-
fs$closeSync.apply(fs$13, arguments);
|
|
43906
|
-
resetQueue();
|
|
43907
|
-
}
|
|
43908
|
-
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
43909
|
-
return closeSync;
|
|
43910
|
-
})(fs$13.closeSync);
|
|
43911
|
-
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
43912
|
-
debug(fs$13[gracefulQueue]);
|
|
43913
|
-
__require("assert").equal(fs$13[gracefulQueue].length, 0);
|
|
43914
|
-
});
|
|
43915
|
-
}
|
|
43916
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$13[gracefulQueue]);
|
|
43917
|
-
module.exports = patch(clone(fs$13));
|
|
43918
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$13.__patched) {
|
|
43919
|
-
module.exports = patch(fs$13);
|
|
43920
|
-
fs$13.__patched = true;
|
|
43921
|
-
}
|
|
43922
|
-
function patch(fs) {
|
|
43923
|
-
polyfills(fs);
|
|
43924
|
-
fs.gracefulify = patch;
|
|
43925
|
-
fs.createReadStream = createReadStream;
|
|
43926
|
-
fs.createWriteStream = createWriteStream;
|
|
43927
|
-
var fs$readFile = fs.readFile;
|
|
43928
|
-
fs.readFile = readFile;
|
|
43929
|
-
function readFile(path, options, cb) {
|
|
43930
|
-
if (typeof options === "function") cb = options, options = null;
|
|
43931
|
-
return go$readFile(path, options, cb);
|
|
43932
|
-
function go$readFile(path, options, cb, startTime) {
|
|
43933
|
-
return fs$readFile(path, options, function(err) {
|
|
43934
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
43935
|
-
go$readFile,
|
|
43936
|
-
[
|
|
43937
|
-
path,
|
|
43938
|
-
options,
|
|
43939
|
-
cb
|
|
43940
|
-
],
|
|
43941
|
-
err,
|
|
43942
|
-
startTime || Date.now(),
|
|
43943
|
-
Date.now()
|
|
43944
|
-
]);
|
|
43945
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
43946
|
-
});
|
|
43947
|
-
}
|
|
43948
|
-
}
|
|
43949
|
-
var fs$writeFile = fs.writeFile;
|
|
43950
|
-
fs.writeFile = writeFile;
|
|
43951
|
-
function writeFile(path, data, options, cb) {
|
|
43952
|
-
if (typeof options === "function") cb = options, options = null;
|
|
43953
|
-
return go$writeFile(path, data, options, cb);
|
|
43954
|
-
function go$writeFile(path, data, options, cb, startTime) {
|
|
43955
|
-
return fs$writeFile(path, data, options, function(err) {
|
|
43956
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
43957
|
-
go$writeFile,
|
|
43958
|
-
[
|
|
43959
|
-
path,
|
|
43960
|
-
data,
|
|
43961
|
-
options,
|
|
43962
|
-
cb
|
|
43963
|
-
],
|
|
43964
|
-
err,
|
|
43965
|
-
startTime || Date.now(),
|
|
43966
|
-
Date.now()
|
|
43967
|
-
]);
|
|
43968
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
43969
|
-
});
|
|
43970
|
-
}
|
|
43971
|
-
}
|
|
43972
|
-
var fs$appendFile = fs.appendFile;
|
|
43973
|
-
if (fs$appendFile) fs.appendFile = appendFile;
|
|
43974
|
-
function appendFile(path, data, options, cb) {
|
|
43975
|
-
if (typeof options === "function") cb = options, options = null;
|
|
43976
|
-
return go$appendFile(path, data, options, cb);
|
|
43977
|
-
function go$appendFile(path, data, options, cb, startTime) {
|
|
43978
|
-
return fs$appendFile(path, data, options, function(err) {
|
|
43979
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
43980
|
-
go$appendFile,
|
|
43981
|
-
[
|
|
43982
|
-
path,
|
|
43983
|
-
data,
|
|
43984
|
-
options,
|
|
43985
|
-
cb
|
|
43986
|
-
],
|
|
43987
|
-
err,
|
|
43988
|
-
startTime || Date.now(),
|
|
43989
|
-
Date.now()
|
|
43990
|
-
]);
|
|
43991
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
43992
|
-
});
|
|
43993
|
-
}
|
|
43994
|
-
}
|
|
43995
|
-
var fs$copyFile = fs.copyFile;
|
|
43996
|
-
if (fs$copyFile) fs.copyFile = copyFile;
|
|
43997
|
-
function copyFile(src, dest, flags, cb) {
|
|
43998
|
-
if (typeof flags === "function") {
|
|
43999
|
-
cb = flags;
|
|
44000
|
-
flags = 0;
|
|
44001
|
-
}
|
|
44002
|
-
return go$copyFile(src, dest, flags, cb);
|
|
44003
|
-
function go$copyFile(src, dest, flags, cb, startTime) {
|
|
44004
|
-
return fs$copyFile(src, dest, flags, function(err) {
|
|
44005
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
44006
|
-
go$copyFile,
|
|
44007
|
-
[
|
|
44008
|
-
src,
|
|
44009
|
-
dest,
|
|
44010
|
-
flags,
|
|
44011
|
-
cb
|
|
44012
|
-
],
|
|
44013
|
-
err,
|
|
44014
|
-
startTime || Date.now(),
|
|
44015
|
-
Date.now()
|
|
44016
|
-
]);
|
|
44017
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
44018
|
-
});
|
|
44019
|
-
}
|
|
44020
|
-
}
|
|
44021
|
-
var fs$readdir = fs.readdir;
|
|
44022
|
-
fs.readdir = readdir;
|
|
44023
|
-
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
44024
|
-
function readdir(path, options, cb) {
|
|
44025
|
-
if (typeof options === "function") cb = options, options = null;
|
|
44026
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
|
|
44027
|
-
return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
|
|
44028
|
-
} : function go$readdir(path, options, cb, startTime) {
|
|
44029
|
-
return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
|
|
44030
|
-
};
|
|
44031
|
-
return go$readdir(path, options, cb);
|
|
44032
|
-
function fs$readdirCallback(path, options, cb, startTime) {
|
|
44033
|
-
return function(err, files) {
|
|
44034
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
44035
|
-
go$readdir,
|
|
44036
|
-
[
|
|
44037
|
-
path,
|
|
44038
|
-
options,
|
|
44039
|
-
cb
|
|
44040
|
-
],
|
|
44041
|
-
err,
|
|
44042
|
-
startTime || Date.now(),
|
|
44043
|
-
Date.now()
|
|
44044
|
-
]);
|
|
44045
|
-
else {
|
|
44046
|
-
if (files && files.sort) files.sort();
|
|
44047
|
-
if (typeof cb === "function") cb.call(this, err, files);
|
|
44048
|
-
}
|
|
44049
|
-
};
|
|
44050
|
-
}
|
|
44051
|
-
}
|
|
44052
|
-
if (process.version.substr(0, 4) === "v0.8") {
|
|
44053
|
-
var legStreams = legacy(fs);
|
|
44054
|
-
ReadStream = legStreams.ReadStream;
|
|
44055
|
-
WriteStream = legStreams.WriteStream;
|
|
44056
|
-
}
|
|
44057
|
-
var fs$ReadStream = fs.ReadStream;
|
|
44058
|
-
if (fs$ReadStream) {
|
|
44059
|
-
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
44060
|
-
ReadStream.prototype.open = ReadStream$open;
|
|
44061
|
-
}
|
|
44062
|
-
var fs$WriteStream = fs.WriteStream;
|
|
44063
|
-
if (fs$WriteStream) {
|
|
44064
|
-
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
44065
|
-
WriteStream.prototype.open = WriteStream$open;
|
|
44066
|
-
}
|
|
44067
|
-
Object.defineProperty(fs, "ReadStream", {
|
|
44068
|
-
get: function() {
|
|
44069
|
-
return ReadStream;
|
|
44070
|
-
},
|
|
44071
|
-
set: function(val) {
|
|
44072
|
-
ReadStream = val;
|
|
44073
|
-
},
|
|
44074
|
-
enumerable: true,
|
|
44075
|
-
configurable: true
|
|
44076
|
-
});
|
|
44077
|
-
Object.defineProperty(fs, "WriteStream", {
|
|
44078
|
-
get: function() {
|
|
44079
|
-
return WriteStream;
|
|
44080
|
-
},
|
|
44081
|
-
set: function(val) {
|
|
44082
|
-
WriteStream = val;
|
|
44083
|
-
},
|
|
44084
|
-
enumerable: true,
|
|
44085
|
-
configurable: true
|
|
44086
|
-
});
|
|
44087
|
-
var FileReadStream = ReadStream;
|
|
44088
|
-
Object.defineProperty(fs, "FileReadStream", {
|
|
44089
|
-
get: function() {
|
|
44090
|
-
return FileReadStream;
|
|
44091
|
-
},
|
|
44092
|
-
set: function(val) {
|
|
44093
|
-
FileReadStream = val;
|
|
44094
|
-
},
|
|
44095
|
-
enumerable: true,
|
|
44096
|
-
configurable: true
|
|
44097
|
-
});
|
|
44098
|
-
var FileWriteStream = WriteStream;
|
|
44099
|
-
Object.defineProperty(fs, "FileWriteStream", {
|
|
44100
|
-
get: function() {
|
|
44101
|
-
return FileWriteStream;
|
|
44102
|
-
},
|
|
44103
|
-
set: function(val) {
|
|
44104
|
-
FileWriteStream = val;
|
|
44105
|
-
},
|
|
44106
|
-
enumerable: true,
|
|
44107
|
-
configurable: true
|
|
44108
|
-
});
|
|
44109
|
-
function ReadStream(path, options) {
|
|
44110
|
-
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
44111
|
-
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
44112
|
-
}
|
|
44113
|
-
function ReadStream$open() {
|
|
44114
|
-
var that = this;
|
|
44115
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
44116
|
-
if (err) {
|
|
44117
|
-
if (that.autoClose) that.destroy();
|
|
44118
|
-
that.emit("error", err);
|
|
44119
|
-
} else {
|
|
44120
|
-
that.fd = fd;
|
|
44121
|
-
that.emit("open", fd);
|
|
44122
|
-
that.read();
|
|
44123
|
-
}
|
|
44124
|
-
});
|
|
44125
|
-
}
|
|
44126
|
-
function WriteStream(path, options) {
|
|
44127
|
-
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
44128
|
-
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
44129
|
-
}
|
|
44130
|
-
function WriteStream$open() {
|
|
44131
|
-
var that = this;
|
|
44132
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
44133
|
-
if (err) {
|
|
44134
|
-
that.destroy();
|
|
44135
|
-
that.emit("error", err);
|
|
44136
|
-
} else {
|
|
44137
|
-
that.fd = fd;
|
|
44138
|
-
that.emit("open", fd);
|
|
44139
|
-
}
|
|
44140
|
-
});
|
|
44141
|
-
}
|
|
44142
|
-
function createReadStream(path, options) {
|
|
44143
|
-
return new fs.ReadStream(path, options);
|
|
44144
|
-
}
|
|
44145
|
-
function createWriteStream(path, options) {
|
|
44146
|
-
return new fs.WriteStream(path, options);
|
|
44147
|
-
}
|
|
44148
|
-
var fs$open = fs.open;
|
|
44149
|
-
fs.open = open;
|
|
44150
|
-
function open(path, flags, mode, cb) {
|
|
44151
|
-
if (typeof mode === "function") cb = mode, mode = null;
|
|
44152
|
-
return go$open(path, flags, mode, cb);
|
|
44153
|
-
function go$open(path, flags, mode, cb, startTime) {
|
|
44154
|
-
return fs$open(path, flags, mode, function(err, fd) {
|
|
44155
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
44156
|
-
go$open,
|
|
44157
|
-
[
|
|
44158
|
-
path,
|
|
44159
|
-
flags,
|
|
44160
|
-
mode,
|
|
44161
|
-
cb
|
|
44162
|
-
],
|
|
44163
|
-
err,
|
|
44164
|
-
startTime || Date.now(),
|
|
44165
|
-
Date.now()
|
|
44166
|
-
]);
|
|
44167
|
-
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
44168
|
-
});
|
|
44169
|
-
}
|
|
44170
|
-
}
|
|
44171
|
-
return fs;
|
|
44172
|
-
}
|
|
44173
|
-
function enqueue(elem) {
|
|
44174
|
-
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
44175
|
-
fs$13[gracefulQueue].push(elem);
|
|
44176
|
-
retry();
|
|
44177
|
-
}
|
|
44178
|
-
var retryTimer;
|
|
44179
|
-
function resetQueue() {
|
|
44180
|
-
var now = Date.now();
|
|
44181
|
-
for (var i = 0; i < fs$13[gracefulQueue].length; ++i) if (fs$13[gracefulQueue][i].length > 2) {
|
|
44182
|
-
fs$13[gracefulQueue][i][3] = now;
|
|
44183
|
-
fs$13[gracefulQueue][i][4] = now;
|
|
44184
|
-
}
|
|
44185
|
-
retry();
|
|
44186
|
-
}
|
|
44187
|
-
function retry() {
|
|
44188
|
-
clearTimeout(retryTimer);
|
|
44189
|
-
retryTimer = void 0;
|
|
44190
|
-
if (fs$13[gracefulQueue].length === 0) return;
|
|
44191
|
-
var elem = fs$13[gracefulQueue].shift();
|
|
44192
|
-
var fn = elem[0];
|
|
44193
|
-
var args = elem[1];
|
|
44194
|
-
var err = elem[2];
|
|
44195
|
-
var startTime = elem[3];
|
|
44196
|
-
var lastTime = elem[4];
|
|
44197
|
-
if (startTime === void 0) {
|
|
44198
|
-
debug("RETRY", fn.name, args);
|
|
44199
|
-
fn.apply(null, args);
|
|
44200
|
-
} else if (Date.now() - startTime >= 6e4) {
|
|
44201
|
-
debug("TIMEOUT", fn.name, args);
|
|
44202
|
-
var cb = args.pop();
|
|
44203
|
-
if (typeof cb === "function") cb.call(null, err);
|
|
44204
|
-
} else {
|
|
44205
|
-
var sinceAttempt = Date.now() - lastTime;
|
|
44206
|
-
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
44207
|
-
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
44208
|
-
debug("RETRY", fn.name, args);
|
|
44209
|
-
fn.apply(null, args.concat([startTime]));
|
|
44210
|
-
} else fs$13[gracefulQueue].push(elem);
|
|
44211
|
-
}
|
|
44212
|
-
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
44213
|
-
}
|
|
44214
|
-
}));
|
|
44215
|
-
//#endregion
|
|
44216
42697
|
//#region ../../node_modules/streamroller/node_modules/fs-extra/lib/fs/index.js
|
|
44217
42698
|
var require_fs = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
44218
42699
|
var u = require_universalify().fromCallback;
|
|
@@ -48930,7 +47411,7 @@ var require_thread_stream = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
|
|
|
48930
47411
|
var { EventEmitter: EventEmitter$7 } = __require("events");
|
|
48931
47412
|
var { Worker: Worker$1 } = __require("worker_threads");
|
|
48932
47413
|
var { join: join$2 } = __require("path");
|
|
48933
|
-
var { pathToFileURL } = __require("url");
|
|
47414
|
+
var { pathToFileURL: pathToFileURL$1 } = __require("url");
|
|
48934
47415
|
var { wait } = require_wait();
|
|
48935
47416
|
var { WRITE_INDEX, READ_INDEX, SEQ_INDEX } = require_indexes();
|
|
48936
47417
|
var buffer = __require("buffer");
|
|
@@ -48975,7 +47456,7 @@ var require_thread_stream = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
|
|
|
48975
47456
|
name: opts.workerOpts?.name || "thread-stream",
|
|
48976
47457
|
trackUnmanagedFds: false,
|
|
48977
47458
|
workerData: {
|
|
48978
|
-
filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href,
|
|
47459
|
+
filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL$1(filename).href,
|
|
48979
47460
|
dataBuf: stream[kImpl].dataBuf,
|
|
48980
47461
|
stateBuf: stream[kImpl].stateBuf,
|
|
48981
47462
|
workerData: {
|
|
@@ -77444,7 +75925,7 @@ var require_tcp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
77444
75925
|
var { isObject, isString } = require_utils$3();
|
|
77445
75926
|
var fs$8 = __require("fs");
|
|
77446
75927
|
var kleur = require_kleur();
|
|
77447
|
-
var Node = require_node
|
|
75928
|
+
var Node = require_node();
|
|
77448
75929
|
var P = require_packets();
|
|
77449
75930
|
var { resolvePacketID } = require_constants();
|
|
77450
75931
|
var { MoleculerServerError } = require_errors$2();
|
|
@@ -90397,7 +88878,7 @@ while (this[Le](this[Ft]()) && this[C].length);
|
|
|
90397
88878
|
readlink,
|
|
90398
88879
|
realpath
|
|
90399
88880
|
}
|
|
90400
|
-
}, Ue = (n) => !n || n === wt || n === fs$
|
|
88881
|
+
}, Ue = (n) => !n || n === wt || n === fs$17 ? wt : {
|
|
90401
88882
|
...wt,
|
|
90402
88883
|
...n,
|
|
90403
88884
|
promises: {
|
|
@@ -91974,6 +90455,9 @@ function resolveUseHostname() {
|
|
|
91974
90455
|
function createBroker(config) {
|
|
91975
90456
|
const { nodeID, mode, hubAddress, logLevel = "warn", secret, tcpPort = DEFAULT_HUB_TCP_PORT, udpPort = DEFAULT_UDP_PORT } = config;
|
|
91976
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;
|
|
91977
90461
|
if (mode === "test") return new ServiceBroker({
|
|
91978
90462
|
nodeID,
|
|
91979
90463
|
transporter: "Fake",
|
|
@@ -92002,17 +90486,19 @@ function createBroker(config) {
|
|
|
92002
90486
|
useHostname,
|
|
92003
90487
|
udpDiscovery: true,
|
|
92004
90488
|
udpPort,
|
|
92005
|
-
udpPeriod: 5
|
|
90489
|
+
udpPeriod: 5,
|
|
90490
|
+
debug: moleculerDebug
|
|
92006
90491
|
}
|
|
92007
90492
|
},
|
|
92008
90493
|
logger: {
|
|
92009
90494
|
type: "Console",
|
|
92010
90495
|
options: { level: {
|
|
92011
|
-
BROKER:
|
|
92012
|
-
TRANSPORTER:
|
|
92013
|
-
|
|
92014
|
-
|
|
92015
|
-
|
|
90496
|
+
BROKER: infraLevel,
|
|
90497
|
+
TRANSPORTER: infraLevel,
|
|
90498
|
+
TRANSIT: infraLevel,
|
|
90499
|
+
REGISTRY: infraLevel,
|
|
90500
|
+
DISCOVERER: infraLevel,
|
|
90501
|
+
"**": wildcardLevel
|
|
92016
90502
|
} }
|
|
92017
90503
|
},
|
|
92018
90504
|
metrics: metricsConfig
|
|
@@ -92020,7 +90506,8 @@ function createBroker(config) {
|
|
|
92020
90506
|
const tcpOptions = {
|
|
92021
90507
|
maxPacketSize: 10 * 1024 * 1024,
|
|
92022
90508
|
port: config.agentListenPort ?? deriveAgentListenPort(nodeID),
|
|
92023
|
-
useHostname
|
|
90509
|
+
useHostname,
|
|
90510
|
+
debug: moleculerDebug
|
|
92024
90511
|
};
|
|
92025
90512
|
if (hubAddress) {
|
|
92026
90513
|
tcpOptions.urls = normalizeHubUrl(hubAddress, tcpPort);
|
|
@@ -92041,11 +90528,12 @@ function createBroker(config) {
|
|
|
92041
90528
|
logger: {
|
|
92042
90529
|
type: "Console",
|
|
92043
90530
|
options: { level: {
|
|
92044
|
-
BROKER:
|
|
92045
|
-
TRANSPORTER:
|
|
92046
|
-
|
|
92047
|
-
|
|
92048
|
-
|
|
90531
|
+
BROKER: infraLevel,
|
|
90532
|
+
TRANSPORTER: infraLevel,
|
|
90533
|
+
TRANSIT: infraLevel,
|
|
90534
|
+
REGISTRY: infraLevel,
|
|
90535
|
+
DISCOVERER: infraLevel,
|
|
90536
|
+
"**": wildcardLevel
|
|
92049
90537
|
} }
|
|
92050
90538
|
},
|
|
92051
90539
|
metrics: metricsConfig
|
|
@@ -93251,4 +91739,407 @@ var RingBuffer = class {
|
|
|
93251
91739
|
}
|
|
93252
91740
|
};
|
|
93253
91741
|
//#endregion
|
|
93254
|
-
|
|
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 };
|